a
    hI                     @   s   d dl mZ d dlZd dlZd dlZd dlZddlmZ dZej	dedZ
e
jdd	d
dddd e
jdddddd dddZdd ZedejejB ZedejejB Zdd Zdd ZdS )     )absolute_importN   )htmldiff zR%prog [OPTIONS] FILE1 FILE2
%prog --annotate [OPTIONS] INFO1 FILE1 INFO2 FILE2 ...)usagedescriptionz-oz--outputFILEoutput-zFile to write the difference to)metavardestdefaulthelpz-az--annotation
store_true
annotationzDo an annotation)actionr   r   c                 C   s  | d u rt jdd  } t| \}} |jr4t|| S t| dkrZtd t  t 	d | \}}t
|}t
|}t|d }t|\}}}	t||}
||
 |	 }
|jdkr|
ds|
d7 }
t j|
 n6t|jd}||
 W d    n1 s0    Y  d S )Nr      zError: you must give two filesr
   
wb)sysargvparser
parse_argsr   annotatelenprint
print_helpexit	read_file
split_bodyr   r	   endswithstdoutwriteopen)argsoptionsfile1file2Zinput1Zinput2Zbody1preZbody2postresultf r,   [/var/www/html/swiplay.fr/scambot/venv/lib/python3.9/site-packages/lxml/html/_diffcommand.pymain    s,    




r.   c                 C   sd   | dkrt j }nLtj| s.td|  n2t| d}| }W d    n1 sV0    Y  |S )Nr
   zInput file %s does not existrb)r   stdinreadospathexistsOSErrorr#   )filenamecr+   r,   r,   r-   r   9   s    &r   z	<body.*?>z
</body.*?>c                 C   sn   d }}t | }|r6| d |  }| | d  } t| }|rd| | d  }| d |  } || |fS )Nr   )body_start_researchendbody_end_restart)htmlr(   r)   matchr,   r,   r-   r   I   s    

r   c                 C   s   t d td d S )NzNot yet implementedr   )r   r   r   )r%   r$   r,   r,   r-   r   U   s    r   )N)
__future__r   optparser   rer2   diffr   r   OptionParserr   
add_optionr.   r   compileISr8   r;   r   r   r,   r,   r,   r-   <module>   sB   
