File: //usr/local/lib64/python3.6/site-packages/lxml/html/__pycache__/_diffcommand.cpython-36.pyc
3
��?eI � @ s� d dl mZ d dlZd dlZd dlZd dlZddlmZ dZej ded�Z
e
jdd d
ddd
d� e
jdddddd� ddd�Zdd� Z
ejdejejB �ZejdejejB �Zdd� Zdd� ZdS ) � )�absolute_importN� )�htmldiff� zR%prog [OPTIONS] FILE1 FILE2
%prog --annotate [OPTIONS] INFO1 FILE1 INFO2 FILE2 ...)�usage�descriptionz-oz--output�FILE�output�-zFile to write the difference to)�metavar�dest�default�helpz-az--annotation�
store_true�
annotationzDo an annotation)�actionr r c C s� | d krt jdd � } tj| �\}} |jr4t|| �S t| �dkrZtd� tj� t j d� | \}}t
|�}t
|�}t|�d }t|�\}}} t||�}
||
| }
|j
dkr�|
jd�s�|
d7 }
t jj|
� n"t|j
d��}|j|
� W d Q R X d S )Nr � zError: 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�file2Zinput1Zinput2Zbody1�preZbody2�post�result�f� r, �6/tmp/pip-build-_veujq9v/lxml/lxml/html/_diffcommand.py�main s,
r. c C sP | dkrt jj� }n8tjj| �s.td| ��nt| d��}|j� }W d Q R X |S )Nr
zInput 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 j| �}|r6| d |j� � }| |j� d � } tj| �}|rd| |j� d � }| d |j� � } || |fS )Nr )�
body_start_re�search�end�body_end_re�start)�htmlr( r) �matchr, r, r- r I s
r c C s t d� tjd� d S )NzNot yet implementedr )r r r )r% r$ r, r, r- r U s r )N)�
__future__r �optparser �rer2 Zdiffr r �OptionParserr �
add_optionr. r �compile�I�Sr8 r; r r r, r, r, r- �<module> s8