Viewing File: /opt/hc_python/lib/python3.12/site-packages/lxml/html/__pycache__/_diffcommand.cpython-312.pyc
�
_��g! � �x � d dl Z d dlZd dlZd dlZddlmZ dZ e j de�� Zej ddd d
dd�
� ej ddddd�� dd�Z
d� Z ej dej ej z � Z ej dej ej z � Zd� Zd� Zy)� N� )�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 � � | �t j dd } t j | � \ }} |j rt || � S t
| � dk7 r4t d� t j � t j d� | \ }}t |� }t |� }t |� d }t |� \ }}} t ||� }
||
z | z }
|j dk( r6|
j d� s|
dz
}
t j j! |
� y t# |j d� 5 }|j! |
� d d d � y # 1 sw Y y xY w)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�file2�input1�input2�body1�pre�body2�post�result�fs �G/opt/hc_python/lib64/python3.12/site-packages/lxml/html/_diffcommand.py�mainr2 s � ��|��x�x���|���%�%�d�+�M�G�T�������&�&�
�4�y�A�~�
�.�/�����������L�E�5�
�u�
�F�
�u�
�F��v��q�!�E�!�&�)��C���
�e�U�
#�F�
�6�\�D�
�F��~�~������t�$��d�N�F��
�
���� �
�'�.�.�$�
'�1�
�G�G�F�O� (�
'�
'�s �/E
�
Ec � � | dk( r t j j � }|S t j j | � st
d| z � �t | d� 5 }|j � }d d d � |S # 1 sw Y S xY w)Nr
zInput file %s does not exist�rb)r �stdin�read�os�path�exists�OSErrorr$ )�filename�cr0 s r1 r r 7 su � ��3���I�I�N�N���
�H�
�W�W�^�^�H�
%��*�X�5�7� 7� �(�D�
!�Q�����A� "��H� "��H�s �A:�:Bz <body.*?>z
</body.*?>c � � dx}}t j | � }|r&| d |j � }| |j � d } t j | � }|r&| |j � d }| d |j � } || |fS )Nr )�
body_start_re�search�end�body_end_re�start)�htmlr, r. �matchs r1 r r G s� � ��O�C�$�� � ��&�E���<�E�I�I�K� ���E�I�I�K�L�!�����t�$�E���E�K�K�M�N�#���N�U�[�[�]�#����d�?�� c �D � t d� t j d� y )NzNot yet implementedr )r r r )r&