File: //usr/lib/python3/dist-packages/pdfminer/__pycache__/ascii85.cpython-38.pyc
U
�R�] � @ sL d Z ddlZddlZddlZdd� Ze�dej�Ze�dej�Zdd� Z dS ) zi Python implementation of ASCII85/ASCIIHex decoder (Adobe version).
This code is in the public domain.
� Nc C s� d }}d}t �| �D ]�}t �|�}d|krr|dkrr|d7 }|d t|�d }|dkr�|t�d |�7 }d }}q|d
kr�|dks�tt|���|d7 }q|dkr|r�td| �D ]}|d d
}q�|t�d |�d|d � 7 } q�q|S )au
In ASCII85 encoding, every four bytes are encoded with five ASCII
letters, using 85 different types of characters (as 256**4 < 85**5).
When the length of the original bytes is not a multiple of 4, a special
rule is used for round up.
The Adobe's ASCII85 implementation is slightly different from
its original in handling the last characters.
r � � !� u� �U �! � z>L� zs � ~�T N) �sixZ iterbytes�int2byte�ord�structZpack�AssertionError�str�range)�data�n�b�out�i�c�_� r �2/usr/lib/python3/dist-packages/pdfminer/ascii85.py�
ascii85decode s(
r s ([a-f\d]{2})s# ^(?:[a-f\d]{2}|\s)*([a-f\d])[\s>]*$c C sP dd� }d}t �| �D ]}|||�7 }qt�| �}|rL|||�d�d �7 }|S )a�
ASCIIHexDecode filter: PDFReference v1.4 section 3.3.1
For each pair of ASCII hexadecimal digits (0-9 and A-F or a-f), the
ASCIIHexDecode filter produces one byte of binary data. All white-space
characters are ignored. A right angle bracket character (>) indicates
EOD. Any other characters will cause an error. If the filter encounters
the EOD marker after reading an odd number of hexadecimal digits, it
will behave as if a 0 followed the last digit.
c S s t | d�}t�|�S )N� )�intr r
)�xr r r r �decode? s
zasciihexdecode.<locals>.decoder r � 0)�hex_re�findall�trail_re�search�group)r r r r �mr r r �asciihexdecode5 s
r( )
�__doc__�rer r r �compile�
IGNORECASEr"