g!xddlZddlZddlZddlZddlmZdZejdeZejddd d d d ejdddddddZ dZ ejdejejzZejdejejzZdZdZy)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 rc|tjdd}tj|\}}|jr t ||St |dk7r4tdtjtjd|\}}t|}t|}t|d}t|\}}} t||} || z| z} |jdk(r6| jds| dz } tjj!| yt#|jd5} | j!| dddy#1swYyxYw)NrzError: you must give two filesr  wb)sysargvparser parse_argsrannotatelenprint print_helpexit read_file split_bodyrr endswithstdoutwriteopen) argsoptionsfile1file2input1input2body1prebody2postresultfs G/opt/hc_python/lib64/python3.12/site-packages/lxml/html/_diffcommand.pymainr2s |xx|%%d+MGT&& 4yA~ ./  LE5 u F u F v q !E!&)C eU #F 6\D F~~t$ dNF  '..$ '1 GGFO( ' 's /E  Ec|dk(r tjj}|Stjj |st d|zt|d5}|j}ddd|S#1swYSxYw)Nr zInput file %s does not existrb)rstdinreadospathexistsOSErrorr$)filenamecr0s r1rr7su3 IINN  H WW^^H % *X 57 7(D !QA" H" Hs A::Bz z cdx}}tj|}|r&|d|j}||jd}tj|}|r&||j d}|d|j }|||fS)Nr) body_start_researchend body_end_restart)htmlr,r.matchs r1r r GsOC$   &E rAr rrEr1rPs      =  *    * .     2   "$$rtt) bjj2449  rE