B MO]I@sddlmZddlZddlZddlZddlZddlmZdZej dedZ e j dd d d d d de j dddddddddZ ddZ edejejBZedejejBZddZddZdS) )absolute_importN)htmldiffzR%prog [OPTIONS] FILE1 FILE2 %prog --annotate [OPTIONS] INFO1 FILE1 INFO2 FILE2 ...)usage descriptionz-oz--outputZFILEoutput-zFile to write the difference to)metavardestdefaulthelpz-az --annotation store_true annotationzDo an annotation)actionr r c Cs|dkrtjdd}t|\}}|jr4t||St|dkrZtdtt d|\}}t |}t |}t |d}t |\}}} t ||} || | } |j dkr| ds| d7} tj| n"t|j d} | | WdQRXdS)NrzError: you must give two filesr  wb)sysargvparser parse_argsrannotatelenprint print_helpexit read_file split_bodyrrendswithstdoutwriteopen) argsoptionsZfile1Zfile2Zinput1Zinput2Zbody1preZbody2postresultfr)I/opt/alt/python37/lib64/python3.7/site-packages/lxml/html/_diffcommand.pymain s,        r+c CsP|dkrtj}n8tj|s.td|nt|d}|}WdQRX|S)Nr zInput file %s does not existrb)rstdinreadospathexistsOSErrorr")filenamecr(r)r)r*r9s    rz z cCsnd}}t|}|r6|d|}||d}t|}|rd||d}|d|}|||fS)Nr) body_start_researchend body_end_restart)htmlr%r&matchr)r)r*rIs  rcCstdtddS)NzNot yet implementedr)rrr)r$r#r)r)r*rUsr)N) __future__roptparserrer/Zdiffrr OptionParserr add_optionr+rcompileISr5r8rrr)r)r)r*s8