U e!@sddlZddlZddlZddlZddlmZdZejdedZej ddd d d d d ej dddddddddZ ddZ e dej ejBZe dej ejBZddZddZdS)N)htmldiffzR%prog [OPTIONS] FILE1 FILE2 %prog --annotate [OPTIONS] INFO1 FILE1 INFO2 FILE2 ...)usage descriptionz-oz--outputFILEoutput-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} | | W5QRXdS)NrzError: you must give two filesr  wb)sysargvparser parse_argsrannotatelenprint print_helpexit read_file split_bodyrrendswithstdoutwriteopen) argsoptionsZfile1Zfile2Zinput1Zinput2Zbody1preZbody2postresultfr)F/opt/hc_python/lib64/python3.8/site-packages/lxml/html/_diffcommand.pymains,        r+c CsP|dkrtj}n8tj|s.td|nt|d}|}W5QRX|S)Nr zInput file %s does not existrb)rstdinreadospathexistsOSErrorr")filenamecr(r)r)r*r7s   rz z cCsnd}}t|}|r6|d|}||d}t|}|rd||d}|d|}|||fS)Nr) body_start_researchend body_end_restart)htmlr%r&matchr)r)r*rGs  rcCstdtddS)NzNot yet implementedr)rrr)r$r#r)r)r*rSsr)N)optparserrer/diffrr OptionParserr add_optionr+rcompileISr5r8rrr)r)r)r*sH