%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/reportlab/lib/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/reportlab/lib/__pycache__/utils.cpython-312.pyc

�

��d����
�dZdZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZ
mZddlmZddlmZddlmZmZd	d
lmZmZmZmZddlmZGd�d
�Ze�Z	ddlZej>�dk(Z d�Z!Gd�d�Z"e#e"jH�fd�Z%["d�Z&e'e(ffd�Z)d�Z*e#d�Z+e,e-fZ.d�Z/d�d�Z0d�d�Z1d�d�Z2d�d�Z3d�Z4d�Z5d�Z6d�Z7d �Z8d!�Z9d"�Z:d�d#�Z;d$�Z<d%�Z=d&�Z>d'�Z?ddl@Z@eAe@d(�ZB[@d)�ZCd�d*�ZDd+�ZEd�d,�ZFd�d-�ZGGd.�d/eH�ZIej�d0k(rddlKZKddlLZLd1d2d2d3d4d4d5d5d6d7d8d8d9d:d;�ZMd�d<�ZNnd�d=�ZNddlOZOej�j�eOj��ZSej�j�eS�xreSxsej�j�eS�ZV[O	eRddlXZXddlYZY	eZZ[e[Z\eFe[�>�se]d?e[z��ej�j�ej�j�e[j���Zaeaej�zZcej�j�ea�Zdedej�zZeefec�Zgefee�Zheceeeaedej�j�ej�j�ej�ej�efej��f	d@�ZjdA�ZkeXj�eYj�eVej�j�fdB�Zm[X[Ye\xr:ej�j�ej�j�eR�ddEz�ZpdF�ZqdG�ZrdH�ZsdI�ZteAedJdK��Zud�dL�ZveduZwGdM�dN�ZxdO�Zyd�dP�ZzdQ�Z{d�dR�Z|ddSl}m~Z~mZddTl�m�Z�dU�Z�d�dV�Z�d�dW�Z�d�dX�Z�ej�j�fdY�Z�ej��jej�j�fdZ�Z�ej��jej�j�e�jfd[�Z�ej�j�ej�j�ej��je�jfd\�Z�dd]lm�Z�d^�Z�d_�Z�d`�Z�Gda�db�Z�Gdc�dde��Z�de�Z�Gdf�dg�Z�dh�Z�di�Z�d�dj�Z�Gdk�dl�Z�Gdm�dn�Z�do�Z�dp�Z�dq�Z�dr�Z�ddl�Z�ds�Z�dt�Z�du�Z�d�dv�Z�d�dw�Z�dx�Z�Gdy�dze,�Z�Gd{�d|e,�Z�d}�Z�Gd~�de�jT�Z�Gd��d��Z�d�d��Z�d��Z�d��Z�d��Z�y#dZ Y���xYw#ej�dZRY��txYw#ej�j�eR�Z\dZ[dC�ZkeXj�fdD�ZmY��vxYw)�z3.5.34z6Gazillions of miscellaneous internal utility functions�N)�literal_eval)�decodebytes�encodebytes)�BytesIO)�md5)�get_rl_tempfile�get_rl_tempdir�)�rl_safe_exec�rl_safe_eval�
safer_globals�rl_extended_literal_eval)�Imagec�0�eZdZed��Zed��ZeZy)�	__UNSET__c��y)NF�r��5/usr/lib/python3/dist-packages/reportlab/lib/utils.py�__bool__z__UNSET__.__bool__s��rc��y)Nrrrrr�__str__z__UNSET__.__str__s��rN)�__name__�
__module__�__qualname__�staticmethodrr�__repr__rrrrrs+�����������Hrr�PyPyFc�8�t|�tt�k(S�N)�type�
isFunction��vs rr"r"!s����7�d�:�&�&�&rc��eZdZd�Zy)�cc��yr r��selfs r�mzc.m%��rN)rrrr*rrrr&r&$s��rr&c��t|�|k(Sr )r!)r$�mts  r�isMethodr.'s����7�b�=�rc�8�t|�tt�k(Sr )r!�sysr#s r�isModuler1+s����7�d�3�i��rc��t||�Sr )�
isinstance)r$�_sts  r�isSeqr5.s���a���rc�"�t|t�Sr �r3�strr#s r�isNativer91����a���rc��tt|�r|�j�S|jd��j�S)N�utf8)r�isBytes�encode�	hexdigest��ss r�	_digesterrB9s6���G�A�J�q�5�?�?�A�A�A�H�H�V�$4�5�?�?�A�Arc	��t|t�r|S	|j|�S#tdt	|��dt	|��d��YyxYw)NzasBytes(�,enc=�	) error: )r3�bytesr>�annotateException�ascii�r$�encs  r�asBytesrK<sA���!�E��1�H�P��x�x��}���P��%��(�5��:�N�O��	�%�&A
c	��t|t�r|S	|j|�S#tdt	|��dt	|��d��YyxYw)Nz
asUnicode(rDrE)r3r8�decoderGrHrIs  r�	asUnicoderOCsA���!�C���(�R��x�x��}���R��E�!�H�U�3�Z�P�Q�rLc	���t|t�r|S	t|t�r|j|�St|�S#t	dt|��dt|��d��YyxYw)NzasUnicodeEx(rDrE)r3r8rFrNrGrHrIs  r�asUnicodeExrQJsS���!�C���(�T� *�1�U� 3�q�x�x��}�?��Q��?��T��e�A�h�u�S�z�R�S�s� A�
A�&A(c��t||��S)N)rJ)rOrIs  r�asNativerSQs���Q�3��rc��t|g�Sr )rF)�is r�int2ByterVTs���!��:�rc�.�t|ttf�Sr )r3r8rFr#s r�isStrrXWs���a�#�e��%�%rc�"�t|t�Sr )r3rFr#s rr=r=Zs���a���rc�"�t|t�Sr r7r#s r�	isUnicoder[]r:rc�"�t|t�Sr �r3r!r#s r�isClassr^`s���a���rc�8�t|ttttt
ttttttttjtjtj tj"tj$tj&tj(tj*tj,tj.tj0tj2tj4tj6f�Sr )r3�float�intr!�tuple�list�dictr8rF�complex�bool�slice�_rl_NoneType�types�FunctionType�
LambdaType�CodeType�MappingProxyType�SimpleNamespace�
GeneratorType�
MethodType�BuiltinFunctionType�BuiltinMethodType�
ModuleType�
TracebackType�	FrameType�GetSetDescriptorType�MemberDescriptorType)�xs r�isNonPrimitiveInstancerycs����!�U�3�t�E�$�t�C��g�d�SX�Ye�
���5�+�+�E�N�N�
���u�4�4�
���E�,�,�U�-F�-F�
���� 0� 0��1D�1D�
����2�2�5�3M�3M�O�P�P�Prc�$�t|t�Sr r]r#s r�instantiatedr{ks���!�D�!�!�!rc��t|t�r|j|�St|t�r|St|�j|�Sr )r3r8r>rF)rxrJs  r�bytestrr}ns<���!�C���x�x��}��	�A�e�	����1�v�}�}�S�!�!rc�x�ttj|��j�j	d�S�N�latin1)�base64_encodebytes�pickle�dumps�striprN)�argss r�encode_labelr�vs*���f�l�l�4�0�1�7�7�9�@�@��J�Jrc�\�tjt|jd���Sr)r��loads�base64_decodebytesr>)�labels r�decode_labelr�ys ���<�<�*�5�<�<��+A�B�C�Crc�H�t|t�s|jd�S|S�zconverts first 256 unicodes 1-1r�)r3r8rNr@s r�
rawUnicoder�|s��%/��#�%6�1�8�8�H��=�A�=rc�H�t|t�r|jd�S|Sr�)r3r8r>r@s r�rawBytesr��s��!+�A�c�!2�1�8�8�H��9��9r�execc�~�t|t�r|Stt|t�r|n|j	d��Sr)r3ra�ordr8rNr@s r�char2intr��s0���A�c�"�A�[���A�c�1B�A����QY�HZ�([�[rc�D�|j|ur|j|��|�r )�
__traceback__�with_traceback)�tr$�bs   r�
rl_reraiser��s$�����a�����q�!�!�
�Grc�V�ddl}|j�D]\}}t|||��y�Nr)�builtins�items�setattr)�kwdr��kr$s    r�rl_add_builtinsr��s*����y�y�{����!����1��rc��	|s"tjd�jd}ddlm}t||�rt
|j�r|SdS#YyxYw)Nr
�
__loader__r)�zipimporter)r0�	_getframe�	f_globals�	zipimportr�r3�len�_files)�ldrr�s  r�zipImportedr��sN�����-�-��"�,�,�\�:�C�)� ��[�1�c�#�*�*�o�s�O�4�O����s�AA�A�Ac��ddlm}m}m}ddlm}|j
�}g}|j}|D]T}||�s�||�D]>}	|||	�}	||	�s�|r |	j
�j|�s�7||	��@�V|S)Nr)�isfile�isdir�join)�listdir)	�os.pathr�r�r��osr��lower�append�endswith)
�dirList�extr�r��	path_joinr��R�A�D�fns
          r�
_findFilesr��s���8�8��

�)�)�+�C�
�A�	���A�
�K���Q�x���!�*�	K�B��1�R��B��b�z�3�"�(�(�*�*=�*=�c�*B�Q�r�U�	K�K�

�Hrc�D�eZdZd�Zd�Zd�Zd�Zd�Zdd�Zd�Z	d	�Z
d
�Zy)�CIDictc�V�|D]}|j|��|j|�yr )�update)r)r��kwds�as    r�__init__zCIDict.__init__�s#���%�A�t�{�{�1�~�%����D�rc�>�|j�D]
\}}|||<�yr )r�)r)r�r�r$s    rr�z
CIDict.update�s���7�7�9�)�C�A�a��d�1�g�)rc�b�	|j�}tj|||�y#Y�xYwr )r�rd�__setitem__�r)r�r$s   rr�zCIDict.__setitem__�s0��	����	�A�	
����a��"��	��s�*�.c�^�	|j�}tj||�S#Y�xYwr )r�rd�__getitem__�r)r�s  rr�zCIDict.__getitem__��1��	����	�A�����Q�'�'��	����(�,c�^�	|j�}tj||�S#Y�xYwr )r�rd�__delitem__r�s  rr�zCIDict.__delitem__�r�r�Nc�0�	||S#t$r|cYSwxYwr )�KeyError)r)r��dvs   r�getz
CIDict.get�s$��	���7�N���	��I�	�s���c��	||y#YyxYw)NTFrr�s  r�__contains__zCIDict.__contains__�s��	���G���	��s��c�`�	|j�}tj||f|z�S#Y�xYwr )r�rd�pop�r)r�r�s   rr�z
CIDict.pop�s5��	����	�A��x�x�4��(�1�*�&�&��	����)�-c�`�	|j�}tj||f|z�S#Y�xYwr )r�rd�
setdefaultr�s   rr�zCIDict.setdefault�s5��	����	�A����$�q��!��-�-��	��r�r )rrrr�r�r�r�r�r�r�r�r�rrrr�r��s/���*�#�(�(���'�.rr��mac)�oglezBMP )r��EPSF)r��GIFf)r��JPEG)�ttxt�PICT)r��PNGf)r�z.PPM)r��TIFF)�CAROzPDF )�MSIE�TEXT)�BMP�EPSr��GIF�JPGr��PCTr��PNG�PPM�TIFr��PDF�HTMLc���	|�|�|�	t|j�\}}tj|�j	||�tj|�y#YyxYw#YyxYwr )�_KNOWN_MAC_EXT�upper�macfs�FSSpec�SetCreatorType�
macostools�touched)�filename�creatorcode�filetyper�s    r�markfilenamer��sl��		��"�h�&6�3�?��,:�3�9�9�;�,G�)�K��
�L�L��"�1�1�+�h�G����x�(�����	��s'�A%�A�:A%�A"� A%�"A%�%A)c��yr r)r�r�r�s   rr�r�s��r)r�z#can't handle compact distro type %rc
��||jd|��}||�}
|
||fvry|
j|�rd|tdfS|
j|�rd|tdfS||��}t	|�}|
j|�r-||dj|�r
d|||	zdfS|t	|�k(ryt
jj|�|fS)z3if the name starts with a known prefix strip it off�/)r
�r
N)�replace�
startswith�_archivepfxlen�_archivedirpfxlenr�r��path�isabs)
r��_archivepfx�_archivedirpfx�_archive�_archivedir�os_path_normpath�os_path_normcase�	os_getcwd�os_sep�
os_sep_len�nfn�cwd�ns
             r�__startswith_rlrs����b�j�j��V�4�
5���r�"���;�x�(�(���>�>�+�&�q��N�O�1D�/D�(D��>�>�.�)�!�B�7H�7I�4J�2J�+J��y�{�+����H���>�>�#���!�"�v� � ��(��B�q��|�}�4E�1E�*E��#�b�'�z�$��7�7�=�=��$�$�R�'�'rc��t|�dS)Nr
)r�r�s r�_startswith_rlr3s���r�"�1�%�%rc��t|�\}}||�}|s|gk(r\|ttt|fd�tt	||fd�tt
jj������z
}|S)Nc��|t|�Sr )r	)rxr��pjoins   r�<lambda>zrl_glob.<locals>.<lambda>:s��e�K�PQ�>R�rc��|||�Sr r)rx�pfn�fnmatchs   rrzrl_glob.<locals>.<lambda>:s ��BI�JK�LO�BP�r)rrc�mapr	�filter�
__rl_loader__r��keys)�pattern�globr�_RL_DIRrr&r�rs        r�rl_globr(6s��� ��)���3���I����2��
��c�[�u�R�SW�X^�lo�x�`P�QU�Vc�Vj�Vj�Vo�Vo�Vq�Qr�Ys�Tt�u�v�
v�A��rc��|Sr rrs rrr?s���	rc��||�Sr r)r$r%s  rr(r(As���G�}�r�.pyc��tS)z*return truth if a file system distribution��_isFSDrrr�isFileSystemDistror/Fs���Mrc��tS)z.return truth if not a file system distributionr-rrr�isCompactDistror1Js
���:�rc��tS)z1return truth if a source file system distribution)�_isFSSDrrr�isSourceDistror4Ns���Nrc��tjjtjjtjj	|���Sr )r�r�normcase�abspath�normpath)�ps r�normalize_pathr:Rs3��
�7�7���B�G�G�O�O�B�G�G�,<�,<�Q�,?�@�A�Ar�invalidate_cachesc��yr rrrrrrUr+rc�T�tjD�cgc]
}t|���}}|rEt|tt
f�r|n|fD]'}|s�t|�}||vs�|j
d|��)|r?ddtd�fD]-}||vs�|rtd|z�|j|�||vr�&�/n*tj�}||vr|j
d|�tj}	|t_t�|r�t�td�tdt|�z�tdttj��z�tdttj�z�td	td
|z��dttjjd
|z�����tdt|�z�td
�tj|�|t_t�|rtdt!|�z�SScc}w#t"$r7t%d|�dtj�dtj����Yn[t%dt'tj(�d��d|�dtj�dtj����YnxYw|t_t�|rtdt!|�z�yy#|t_t�|rtdt!|�z�wwxYw)zEDynamically imports possible packagized module, or raises ImportErrorrr�.zremoved "%s" from pathz++++++++++++++++++++z+++++ modulename=%sz+++++ cwd=%sz+++++ sys.path=%sz+++++ os.paths.isfile(z./%s.pyz)=z+++++ opath=%sz--------------------z===== restore sys.path=%szCould not import z
using sys.path z in cwd=z
Exception r
z while importing N)r0rr:r3rcrb�insert�print�remover��getcwd�_importlib_invalidate_cachesrHr��	importlib�
import_module�repr�ImportErrorrGr8�exc_info)�
modulename�baseDir�noCWD�debugr9r�opaths       r�recursiveImportrNWs~��'*�x�x�0�!�N�1��0�D�0��&�w��U�|�<��7�*�	3�A��"�1�%���D�=�$�+�+�a��"2�	3�
��S���,�-�	�A��t�)��%� 8�1� <�=����A���t�)�	�

�I�I�K���D�=��K�K��!��
�H�H�E�=����$�&���G��&�M��'�%�
�*;�;�<��.�5�����#5�5�6��%��c�h�h��7�8��E�)�J�:N�4O�QV�WY�W^�W^�We�We�fo�pz�fz�W{�Q|�}�~��"�U�5�\�1�2��&�M��&�&�z�2����$�&���-��U��;�<���S1��>����3�8�8�B�I�I�K�1�	�J���C�L�L�N�1�%�&�
�3�8�8�B�I�I�K�I�	J�����$�&���-��U��;�<������$�&���-��U��;�<��s+�H'�*D
H,�,=K�)K6�+AK�K6�61L'c��eZdZdZd�Zy)�
ArgvDictValuezGA type to allow clients of getArgvDict to specify a conversion functionc� �||_||_yr )�value�func)r)rRrSs   rr�zArgvDictValue.__init__�s����
���	rN)rrr�__doc__r�rrrrPrP�s
��Q�rrPc�z�d�}tjdd}i}|j�D]�\}}t|t�r|j
|j}}nd}d}|dz}|D]C}	|	j|�s�|	t|�d}
|j|	�|||
|�||<d}n|r��||||�||<��|S)z� Builds a dictionary from its keyword arguments with overrides from sys.argv.
        Attempts to be smart about conversions, but the value can be an instance
        of ArgDictValue to allow specifying a conversion function.
    c�|�|r
||�}|St|�r|}|St|t�r
t|�}|St|t�r
t|�}|St|t�rt	t|�i�}|St|t�rt
t|�i�}|Std|�dt|�����)NzCan't convert string z to )	rXr3r`rarcrrb�	TypeErrorr!)r$�avrSs   r�handleValuez getArgvDict.<locals>.handleValue�s�����R��A����Q�x������A�e�$��"�I�����A�c�"���G����
�A�d�#���b�)�"�-��
��	�A�e�$��,�r�*�2�.���� �2�d�1�g� N�O�Orr
Nr�=)
r0�argvr�r3rPrRrSrr�rA)�kwrYr�r�r�r$rS�handled�ker�rXs           r�getArgvDictr_�s���
�$	������A�
�A����
�5���1��a�
�&��g�g�q�v�v�t�A��D���
�s�U���	�A��|�|�B���s�2�w�x�[�������"�1�R��-��!�����
	��{�1�Q�t�4��!��5�"
�Hrc���	ddlm}|�Atjj	tjjt�d�}||�S#t$r}t|�dk7r�Yd}~yd}~wwxYw)Nr)�Hyphenz
hyphen.mashedzNo module named pyHnj)	�reportlab.lib.pyHnjrar�rr��dirname�__file__rGr8)�hDictra�errMsgs   r�
getHyphenaterrg�s[���.��=������R�W�W�_�_�X�-F�� W�%��e�}������v�;�/�/�����s�AA�	A5�A0�0A5c��	|jj}|jd�}|dk\r||dzdS|S#t$rt	|�cYSwxYw)zReturn a shortened class namer>rr
N)�	__class__r�rfind�AttributeErrorr8)r)�namerUs   r�
_classNamerm�sW����~�~�&�&��
�*�*�S�/���a�4��Q�q�S�T�
�"�������4�y���s�38�8�A�Ac�*�d|vrd|z}	t||�S#t$rrtst��t	|�}tj|�}d|vr3tjdk7r |jtjd�}t|�cYSwxYw)Nr'r��
)
�open�IOErrorr.r"r�get_datar��lineseprr)rl�moderAs   r�open_for_read_by_nameru�s���
�$��s�4�x��	��D��������]�*�E��d�#���"�"�4�(���d�?�r�z�z�4�/�Q�Y�Y�r�z�z�$�5O���q�z���s��A8B�B)�unquote�urlparse)�urlopenc�4�t|�j�Sr )rx�read)rls r�	rlUrlReadr{�s���4�=����rc������tfd��ddlm�m��rIddl}ddl��fd�}|j
djddjt|���df���d���fd	�	}|t�d
<|||�S)Nc�6�	|jdd�\}}|sd}|jd�}|dk\rd||d	vr||dzd	}|d	|}nd
}|dk(rt	|jd��}|S||�jd
�}|S#t$r
tdd��wxYw)zUse "data" URL.�,r
z
data errorzbad data URLztext/plain;charset=US-ASCII�;rrZNr�base64rHzlatin-1)�split�
ValueErrorrqrjr�r>)�urlrv�typ�data�semi�encodings      r�
datareaderz!open_for_read.<locals>.datareader�s���	8��	�	�#�q�)�I�C���/�C��y�y��~���1�9��C���J�.��4��6�7�|�H��e�t�*�C��H��x��%�d�k�k�'�&:�;�D����4�=�'�'�	�2�D�����	8��,��7�7�	8�s�B�Br)�trustedHosts�trustedSchemesc�^���j|�}|jd�r|ddS|ddS)Nz(?s:����i����)�	translater)rArs �r�xrezopen_for_read.<locals>.xres7���!��!�!�!�$�A��l�l�6�2�1�Q�r�7�>��#�2��>rrz^(?:�|z)\Zc�H��t|d�r|S	t||�S#	��=t|�}|dr-|ddvs�j|d�r|d�vst	d��t|ddj
�dk(r�nt|��cYS#td	|z��xYwxYw)
z)attempt to open a file or URL for readingrzNr)r��filer
zAttempted untrusted host access�zdata:zCannot open resource "%s")	�hasattrrurw�matchr�rr�r{rq)rlrt�purlr�r�r�s   ���r�
open_for_readz$open_for_read.<locals>.open_for_reads�����4�����
	B�(��d�3�3��	B�
B��+�#�D�>�D��A�w��a��O�)C�|�GY�GY�Z^�_`�Za�Gb�im�no�ip�uC�jC�(�)J�K�K�� V�d�2�A�h�n�n�.>��.G�
�Y�X\�]�^�^��
B��9�D�@�A�A�s!��B!�A+B�B!�B�B!r��r�)
rv�reportlab.rl_configr�r��rer�compiler�r �globals)	rlrtr�r�r�r�rr�r�s	     @@@@rr�r��sw���
!(��6A���	?��z�z�"�'�'�6� #����S��)>� ?� &�+(�#)�*��
B�"/�G�I�o����d�#�#rc��t||�}||ur(t|d�r|5|j�cddd�S|j�S#1swYyxYw)N�__exit__)r�r�rz)rlrt�fs   r�
open_and_readr�sQ���d�4� �A��1�}���:�.�
�	��6�6�8�	�	��v�v�x��	�	�s�A	�	Ac�8�t||�jd�S�Nro)r�r�)rlrts  r�open_and_readlinesr� s����d�#�)�)�$�/�/rc��t|d�ry||�rytst�yt|�}|t	tj
j
��vS)NrzTF)r�r.r"rrcr�r#)r��os_path_isfiles  r�	rl_isfiler�#sK���r�&��$��b��$�
��&�u�	��	�B�
��m�*�*�/�/�1�2�2�2rc�F�||�rytst�yt||��}|jtj
�s|tj
z
}t
tt|fd�ttjj�����dkDS)NTFc�$�|j|�Sr )r)rx�pns  rrzrl_isdir.<locals>.<lambda>/s��1�<�<��+;�rr)r.r"rr�r��sepr�rcr!r�r#)r��
os_path_isdirr
s   r�rl_isdirr�*sv���R���
��&�u�	�(��,�	-�B�
�;�;�r�v�v���b�f�f����t�F�r�;�D��AU�AU�AZ�AZ�A\�<]�^�_�`�ab�b�brc�^�||�stst�||�St||��}|jtj
�s|tj
z
}tjj�D�cgc]"}|j|�s�|t|�d��$c}Scc}wr )
r.r"rr�r�r�r�r#rr�)r�r�r
�
os_listdirrxs     r�
rl_listdirr�1s~���R��F�m�&;�J�r�N�=R�	�(��,�	-�B�
�;�;�r�v�v���b�f�f���!.�!5�!5�!:�!:�!<�Q�A����R�@P�A�c�"�g�h�K�Q�Q��Qs�B*�B*c�0�||�stst�||�St||��}	tj|}|d}|d}||dz	dzdz|dz	dz|dz|dz	dz|dz	d	z|dzd
zdddf	�S#t$r||�cYSwxYw)Nr���	�i�����?r
r)r.r"rr�r�)	r�r�r
�os_path_getmtime�time_mktimer9�erA�ds	         r�rl_getmtimer�7s����b��V�}�'<�EU�VX�EY�>Y��'��+�,�A�$�� � ��#��	
�!��A�	�!��A��!�Q�$���d�*�A�q�D�#�:�a��f�a��e�T�\�1�a�4�QU�+�WX�Y]�W]�`a�Va�bc�de�fg�h�i�i��	�$���#�#�$�s�B�B�B)�utilc��dD]v}tjj|||z�}tjj|�s�Ft	j
||�}|jj�cStd��)N)r+z.pywz.pyoz.pycz.pydzno suitable file found)	r�rr�r��importlib_util�spec_from_file_location�loader�load_modulerG)rl�dirr�r�specs     r�__rl_get_module__r�Csl��2�-���w�w�|�|�C��S��)��
�7�7�>�>�$��!�9�9�$�t�D�D��;�;�*�*�,�,�	-�
�.�
/�/rc�p�|tjvr%tj|}tj|=nd}		t||�|r|tj|<SS#t�r�ddl}t|�}|dk(xs|xrtxsBtjjt|jdtj��}|j|�}|j|�cY|r|tj|<SSt|�d|�d���xYw#|r|tj|<wwxYw)Nrr>r�[�])r0�modulesr�r1r�rrr�rr�rr�r�r�rG)rlr��omr��zis     r�
rl_get_moduler�Ks���s�{�{��
�[�[��
���K�K���
��
&�
	5�$�T�#�.��2�s�{�{�4� �2��	5�� � �$�S�)���C�x�*�s�7�8��j�B�G�G�L�L��RU�R]�R]�^a�bd�bh�bh�Ri�<j���*�*�3�/���~�~�d�+�+��2�s�{�{�4� �2��$�s�3�4�4��
�2�s�{�{�4� �2�s$�A�BD�1D�	D�D�D5c�V�	t|tj�S#t$rYywxYwr�)r3rrk)�ims r�_isPILImager�`s*����"�U�[�[�)�)������s��	(�(c�r�eZdZdZiZdZdd�Zd�Zd�Ze	d��Z
e	dd��Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zy)�ImageReaderz%Wraps up PIL to get data from bitmapsNc��t|t�r|j|_y||_||_d|_d|_d|_d|_d|_	t|�r6||_t|dd�|_	|j
j|_y	ddlm}|dk7rt#d��t%|d�}t|t&�s,|t'|j)��}}|j+�~||_|j-|j�|_t|t.�r|n
t1|�|j
_|j3|j
�t|j
dd�dk(r|j4|_yy#t$rdt|�z|_YywxYw#t9d	|�d
|j;����YyxYw)N�fpzPILIMAGE_%dr)�imageReaderFlagszYimageReaderFlags values other than 0 are no longer supported; all images are interned nowr��formatr�z

fileName=z
 identity=)r3r��__dict__�_ident�fileName�_image�_width�_height�_transparent�_datar��getattrr�rk�idr�r�r�r�rrz�close�_read_imager8rF�check_pil_image_size�_jpeg_fh�jpeg_fhrG�identity)r)r��identr�r��tfps      rr�zImageReader.__init__js����h�{�+�$�-�-�D�M�����!��
���������� �����
��x� �"�D�K��h�t�D�1�D�G�
9� $��� 4� 4��
�
Z�@�#�q�(�$�&A�B�B�"�8�C�0��!�"�g�.� �'�"�'�'�)�"4��C��I�I�K�����"�.�.�t�w�w�7���3=�h�s�3K�x�QU�V^�Q_����$��)�)�$�+�+�6��4�;�;�x��5�v�=�#'�=�=�D�L�>��!"�
9� -��4�� 8��
�
9��$
Z�!�x��
�
��"X�Y�s�9F�C7F1�F.�-F.�1!Gc�
�|j}t|�stt|dd�dd�}|j}d|jj
�dt
t|���|xrd|zxsd�|xrd|zxsd�d	�S)
z9try to return information that will identify the instancer�Nrlr��@z	 ident=%rrz filename=%rr�)r�rXr�r�rir�hexr�)r)r�r�s   rr�zImageReader.identity�s���
�]�]���R�y����d�4�0���=�B����� $��� 7� 7��B�t�H�
�e�Fe�Q\�_d�Qd�Fk�ik�Fk�ln�mI�uC�FH�uH�mO�MO�mO�P�	Prc�,�tj|�Sr )rrp�r)r�s  rr�zImageReader._read_image�s���z�z�"�~�rc
���|j}|�y|j\}}|j}td|dk(rdn
dt	|�z|z|zdz	�}||kDrtd|�d|�d|�d|�d	|�d
���y)Nr
�1��zPIL � z x z image would use z > z bytes)�_max_image_size�sizert�maxr��MemoryError)�clsr��max_image_size�w�hr*r�s       rr�z ImageReader.check_pil_image_size�s����,�,���!�6��w�w���1��G�G���1�A�s�F�q��#�a�&��!�3�A�5��9�:������./��!�D��I�J�
J�rc�H�||_|�ddlm}||j�yy)Nr)�register_reset)r�r�r��set_max_image_size)r�r�r�s   rr�zImageReader.set_max_image_size�s&��,����%�:��3�1�1�2�&rc�@�|j}|jd�|Sr�)r��seekr�s  rr�zImageReader._jpeg_fh�s��
�W�W��
����
��	rc��yr rr(s rr�zImageReader.jpeg_fh�s��rc��|j�|j�#|jj\|_|_|j|jfSr )r�r�r�r�r(s r�getSizezImageReader.getSize�s@���K�K��4�<�<�#7�(,���(8�(8�%�D�K������T�\�\�*�*rc�0�	|j��Zd|_|j}|jx}|_|dvrvt	t
dd�j
d�r|j�t|j�|dk(rdnd�|_|dd	}|j|�}||_n�|d
vr�|jdk(ra|jdk(rRd
|jvrD|jd�}t|j�d�|_|jd�}n|jd�}d|_t|d�r|jn|j�|_|jS#t!d|j#�z�YyxYw)z'Return byte array of RGB data as stringN)�LA�RGBA�VERSIONrz1.1.7rr�r
���)�L�RGB�CMYKr��P�transparencyr�tobytesz
identity=%s)r��_dataAr�rtr�rr�loadr�r��convertr��infor�r�tostringrGr�)r)r�rt�nms    r�
getRGBDatazImageReader.getRGBData�sL��	?��z�z�!�"����[�[��#%�7�7�*��t�y��=�(��u�Y�r�2�=�=�g�F����	�"-�b�h�h�j�d�F�l��PQ�.R�"S�D�K��c�r��B����B��B� "�D�I��!3�3��y�y�%�'�B�G�G�S�L�^�r�w�w�=V��Z�Z��/��&1�"�(�(�*�Q�-�&@����Z�Z��.���Z�Z��.�� %�D�I�S�G�B�	�,B�b�j�j����V��
��:�:���	?��o�d�m�m�o�=�>�s�E2E5�5Fc�N�|j�\}}|||j�fSr )rr)r)�width�heights   r�getImageDatazImageReader.getImageData�s%������
��v��f�d�o�o�/�/�/rc��d|jjvrG|jjddz}|jj}	|j}|||dzSy#	|j}n#YYyxYwY�#xYw)Nrr�)r�r�paletter�)r)rrs   r�getTransparentzImageReader.getTransparent�s����T�[�[�-�-�-��;�;�+�+�N�;�a�?�L��k�k�)�)�G�
 �!�/�/���<��Q��7�7���
 � �%�l�l�G�� ����s*�A!�!A;�$A1�0A;�1A6�3A;�6A;r )rrrrT�_cacher�r�r�r��classmethodr�r�r�r�rrrrrrrr�r�fsi��+�
�F��O�%Z�NP���J��J��3��3��
�+�
?�60�
rr�c��eZdZy)�LazyImageReaderN)rrrrrrrr�s��rrc�t�	|j�S#t$rt|�j�cYSwxYw)z<Get width, height and RGB pixels from image file.  Wraps PIL)rrkr�)�
imageFileNames rrr�s9��9��)�)�+�+���9��=�)�6�6�8�8�9�s��"7�7c��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�Zd�Zd�Ze
eeed�Zd�Zd�Zd�Zd�Zd�Zy)�	DebugMemoa�Intended as a simple report back encapsulator

    Typical usages:
        
    1. To record error data::
        
        dbg = DebugMemo(fn='dbgmemo.dbg',myVar=value)
        dbg.add(anotherPayload='aaaa',andagain='bbb')
        dbg.dump()

    2. To show the recorded info::
        
        dbg = DebugMemo(fn='dbgmemo.dbg',mode='r')
        dbg.load()
        dbg.show()

    3. To re-use recorded information::
        
        dbg = DebugMemo(fn='dbgmemo.dbg',mode='r')
            dbg.load()
        myTestFunc(dbg.payload('myVar'),dbg.payload('andagain'))

    In addition to the payload variables the dump records many useful bits
    of information which are also printed in the show() method.
    Nc�@
�ddl}||_|stj|_n%t	|d�r||_nt|d�|_|dk7ryix|_}	|rJtj�dk7r3ddl}
t�}|
jd|�|j�|	d<tj�}tj|�}
tjj!|�}|xrtj|�xsd}tjj#tjj!tj$d��}d}d}	ddl}|j)t*j-d��}|d}tj.}t1|j3��}|j5�|	j7id	t9j:t9j<t9j8����d
tj>�dtj@�dtCtjD��d
tjF�dtjH�dtjJ�dtj�dtj$�d|�d|jM��d|
�d|�dtjN�dtQtdd��dtQtdd��dtQtdd��tQtdd�djSdg|D�cgc]}|�d||����c}z�tUt*�||d ���td!ftd"ffD].\}}|D]$}t	||�s�	tQ||��|	|<�&�0||k7r(	|	j7|tj|�d#��|rotjj#tj$d�}tjjW|�r 	|t|d$�jY�f|	d%<i}tjZj]�D]y\}}|d&k(s|d'k(s|dd(d)k(s	|dd*d+k(s�!d,D�cgc]}tQ||d���}}|D�cgc]}|s�|��	c}s�O|dg|d-dD�cgc]}|s�|��	c}z}t_|�||<�{||	d.<i|jd/<|ja|�y#Y��jxYwcc}w#Y���xYw#Y��MxYw#Y��xYwcc}wcc}wcc}w)0Nr�writer�)NNN�__tracebackz???z
meta_data.mar�project_version�gmt�platform�version�
hexversion�
executable�exec_prefix�prefixrr[r�hostname�lcwd�lpcwd�	byteorder�maxint�
maxunicodez????�api_version�version_info�winverz
			rrZ)r6�environmentr"�project_meta_datar&)�getwindowsversion�getfilesystemencoding)�uname�ctermid�getgid�getuid�getegid�geteuid�getlogin�	getgroups�getpgrp�getpid�getppid)�exed�lexedr'�__script�	reportlab�rlextra�
z
reportlab.r�zrlextra.)�__version__�__path__rdr
�__module_versions�	__payload)1�socketr�r0�stdoutr�rp�storerH�	tracebackr�	print_exc�getvaluer�rBr�rrcr7r[�marshalr�r"rr�environrcr#�sortr��time�asctime�gmtimer(r)r�r*r+r,r-�gethostnamer1r�r�rFr�rzr�r�rb�_add) r)r�rt�	getScriptr��capture_tracebackrQr\rPrRrSrArr/�pcwdr0rFr&�mdrV�env�Kr��Mr�r��module_versionsrr*rxr$�_fs                                 rr�zDebugMemo.__init__s���������*�*�D�K��v�g�&�$���"�6�#�.�����9�f����
�U������3C�!C���	�A�����Q�'�#$�:�:�<�E�-� ��I�I�K���z�z�#����w�w���s�#���)����D�)�2�U���w�w���r�w�w���s�x�x��{�;�<������	���}�}�]�3�3�O�D�E�B��0�1�O��j�j��
�s�x�x�z�
��	����
�����t�|�|�D�K�K��	�	��,D�E��"�C�L�L��!�3�;�;��%�c�#�.�.�&9��%�c�n�n�	�
&�s����!�#�*�*�
������������s��#�F�$6�$6�$8����� ���$�S�]�]��!�'�#�l�6�"B��&�w�s�=��'H�� '���N�6�(J�!�"#*�#�h�v�">�'1����t�[\�<]�VW��#�a�&�=Q�<]�7]�'^�)-�m�)<�-/�+:�+�	�0�B�C�����	�C�A�a��
���1�Q�<��#/�7�1�Q�<�>��a��
�
	���9�
����d�R�Z�Z��5E�G�H����������!��-�B��w�w�~�~�b�!��)+�D��C�L�,=�,=�,?�(@�E�*�%����;�;�$�$�&�	2�C�A�a��+�~��I���3�B���1E��2�A��PZ�IZ�0U�V�1�W�Q�q��&�V��V�!"�)�2�b�B�)��1���q���u�!;���"�!;�;�A�).�q��O�A�&�	2�&5��!�"�"$��
�
�;���	�	�"�
��{	���,=^�����
������W��)��!;sT�-S-�S5�5S:�'T�T
�0T�
T�T�&T�.T�-S2�:S?�T�
Tc�\�|jd}|j�D]
\}}|||<�y�NrO)rRr�)r)r��payloadr�r$s     rr]zDebugMemo._addgs2���*�*�[�)���G�G�I�	�D�A�q��G�A�J�	rc�&�|j|�yr )r])r)r\s  r�addz
DebugMemo.addls
���	�	�"�
rc��	|j�}tj|j|�y#|jj	�}t�}|j
�D]-\}}	tj||i|�� #d|z||<Y�,xYw|jd�tj||�YyxYw)Nz<unpicklable object %r>r)�tellr��dumprR�copyrr�r�)r)r��pos�S�ffr�r$s       r�_dumpzDebugMemo._dumpos���	�����C��K�K��
�
�1�%��		��j�j�o�o��A��y�B��w�w�y�
9���!�9��K�K��1��b�)��9�4�q�8�A�a�D��	
9�

�F�F�3�q�M��K�K��!��s!�03�<C�0B	�C�	
B�.Cc��t|jd�}	|j|�|j�y#|j�wxYw)N�wb)rpr�rsr��r)r�s  rrnzDebugMemo.dump~�5���������	��J�J�q�M�
�G�G�I��A�G�G�I��	�:�Ac�X�t�}|j|�|j�Sr )rrsrUrvs  rr�zDebugMemo.dumps�s ���I���
�
�1�
��z�z�|�rc�8�tj|�|_yr )r�rrRrvs  r�_loadzDebugMemo._load�s���[�[��^��
rc��t|jd�}	|j|�|j�y#|j�wxYw)N�rb)rpr�r{r�rvs  rrzDebugMemo.load�rwrxc�8�|jt|��yr )r{r)r)rAs  rr�zDebugMemo.loads�s���
�
�7�1�:�rc
�~�|j|dd�t|j��}|j�|D]p}||x}}t	|t
�r|d}	t
|�tj|}t|dd�|k(xrdxsd}|jd|�d|�d	|�d
���ry#d}d}Y�&xYw)N�rrL�SAME�	DIFFERENTz??????unknown??????z  � = z (�))
�_writelnrcr#rXr3rb�
__import__r0r�r�)r)r�r$rc�vk�vk0r*r�s        r�_show_module_versionszDebugMemo._show_module_versions�s����
�
�a���e�������N��	�����
	7�A���t�O�B���"�U�#�2�a�5�S�
*��1�
��K�K��N���A�m�D�1�3�6�A�6�P�[��
�M�M�a��1�5�6�
	7��
*���)��s� 6B4�4B<c�:�|jd|�d|dd�d��y)Nz###################r�r�z##################)r�)r)r��whats   r�_bannerzDebugMemo._banner�s���
�
�d�1�Q�R�5�Q�Rrc�(�|j|d�y)NzStart  �r�r�s  r�_startzDebugMemo._start�������Q�y�!rc�(�|j|d�y)NzFinish r�r�s  r�_finishzDebugMemo._finish�r�rc�j�|j|�|j|�|j|�yr )r�r�r�r�s   r�_show_lineszDebugMemo._show_lines�s$�����A���
�
�a�����Q�rc�|�|�dtjj|d���}|j||d�y)Nr�rr
)r�r�basenamer�r�s   r�
_show_filezDebugMemo._show_file�s3������)�)�!�A�$�/�0������1�Q�4� rc��|rCddl}|j|�|j||j�|j|�yyr�)�pprintr�rQr�)r)r�r$r�s    r�
_show_payloadzDebugMemo._show_payload�s5�����K�K��N��M�M�!�D�K�K�(��L�L��O�	
rc
�^�dD]�}	|gj}t|�tj|}||j�dD]&}t||�s�||�dt
||�����(	|jddj|j�z���y#d�Y�<xYw)N)�	_rl_accel�	_renderPM�sgmlop�pyRXP�pyRXPU�_imagingr)rLr�_versionr)rZz	not foundr�)
r�r�r0r�rdr�r�r�r��__self__)r)�mnr�r*�vns     r�_show_extensionszDebugMemo._show_extensions�s���X�	4�B�	
��D�K�K���2���K�K��O���!�*�*�
�H�8�B��q��}��R���"�
�6�7�8�

�M�M�#�c�h�h�q�z�z�2�2�3�	4��
��+��s�AB �B � 
B,)rNrOr%rHc���t|jj��}|j�|D]L}|t|jj��vs�)|j|d�d|j|����N|D]L}|t|jj��vs�)|j||||j|��N|j
�y)N�15r�)rcrRr#rX�specialsr�r�)r)rcr�s   r�showzDebugMemo.show�s���������"�#��	�����	d�A���T�]�]�/�/�1�2�2�D�M�M�RS�TX�T^�T^�_`�Ta�Bb�4c�	d��	W�A��D����+�+�-�.�.�0@��
�
�a�0@��a��
�
�ST�
�0V�	W����rc�&�|jd|Srh�rR�r)rls  rrizDebugMemo.payload�����z�z�+�&�t�,�,rc�(�||jd|<yrhr�)r)rlrRs   rr�zDebugMemo.__setitem__�s��(-��
�
�;���%rc�&�|jd|Srhr�r�s  rr�zDebugMemo.__getitem__�r�rc�@�|jj|dz�yr�)rQr$)r)�msgs  rr�zDebugMemo._writeln�s�������#�d�(�#r)zrl_dbgmemo.dbgr�r
rr
N)rrrrTr�r]rkrsrnr�r{rr�r�r�r�r�r�r�r�r�r�r�rir�r�r�rrrr"r"�s����2Y�v�
�
���
$���7� S�"�"��
!��4�&;�*�*�&��H�
 �-�.�-�$rr"c�R�|D]"}t|�r
t||��||��$yr )r5�_flatten)rr�rxs   rr�r��s'��
�����8�X�a��]���d�rc�6�g}t||j�|S)z'recursively flatten the list or tuple L)r�r�)rr�s  r�flattenr��s��
�A��Q�q�x�x���Hrc�b�	|tj|�j�}|r|S|dz
}�/)zPapply func to the locals at each stack frame till func returns a non false valuer
)r0r��f_locals)rS�depth�_s   r�find_localsr��s3��
�����u�%�.�.�/���Q�h�
��
��rc��eZdZd�Zd�Zy)�_FmtSelfDictc� �||_||_yr )�obj�
_overrideArgs)r)r��overrideArgss   rr�z_FmtSelfDict.__init__�s�����)��rc���	|j|S#t$rD	|jj|cYS#t$rt	|j|�cYcYSwxYwwxYwr )r�r�r�r�r�r�s  rr�z_FmtSelfDict.__getitem__�sa��	+��%�%�a�(�(���	+�
+��x�x�(�(��+�+���
+��t�x�x��*�*�
+��	+�s)��	A�6�A�A�A�A�AN)rrrr�r�rrrr�r��s��*�+rr�c��eZdZdZd�Zy)�FmtSelfDictz mixin to provide the _fmt methodc�$�t||�}||zSr )r�)r)�fmtr�r�s    r�_fmtzFmtSelfDict._fmt	s����|�,���Q�w�rN)rrrrTr�rrrr�r�s
��*�rr�c�F�g}|d�}g}|}|j�D]Y}||�}||z|z|ks|gk(r|j|�||z|z}�5|jdj|��|g}|}�[|gk7r |jdj|��|S)Nr�)r�r�r�)	�txt�mW�SWr�ws�Or�r��lts	         r�_simpleSplitr�
s���
�A�	�C��B�
�A�	��A�
�Y�Y�[���
��U���R�4��7�B�;�!�R�%�
�H�H�Q�K��B����A�
�H�H�S�X�X�a�[�!���A��A��	�"�u�a�h�h�s�x�x��{�#��Hrc���ddlm�t|�jd�}||f�fd�	}|r'g}|D]}|j	t|||��� |}|S)Nr)�stringWidthroc����|||�Sr r)�text�fN�fSr�s   �rrzsimpleSplit.<locals>.<lambda>!s����D�"�b�0I�r)�reportlab.pdfbase.pdfmetricsr�rOr��extendr�)	r��fontName�fontSize�maxWidth�linesr�r�lr�s	        @r�simpleSplitr�sZ���8��d�O�!�!�%�(�E�!�h�	I�B�����	2�A�
�H�H�\�!�H�R�0�1�	2����Lrc���ddlm}|�|St|�r|jd�}||�}|j	dd�}|j	dd�}|j	dd	�}|S)
zEscapes once onlyr)�escaper<�	&amp;amp;�&amp;�&amp;gt;�&gt;�&amp;lt;�&lt;)�xml.sax.saxutilsr�r=rNr)r�r�rAs   r�escapeTextOncer�)sa��'��|����t�}�$�+�+�f�-�a��$�<�D��<�<��X�.�D��<�<��W�-�D��<�<��W�-�D��Krc��t|�r|StD]}	|j|�cStd|z��#Y�*xYw)Nz(cannot convert %r to filesystem encoding)r[�fsEncodingsrNr�)r�rJs  r�fileName2FSEncr�5sM����}��
��	�C�
��y�y��~�%�	�
�?�"�D�
E�E��
��s�:�>c���tjdg|dg�}tj|d�\}}}	||�||�||�t	|||�S#t$rY�wxYw)a�
    Loop over a collection with look-ahead and look-back.
    
    From Thomas Guest, 
    http://wordaligned.org/articles/zippy-triples-served-with-python
    
    Seriously useful looping tool (Google "zippy triples")
    lets you loop a collection and see the previous and next items,
    which get set to None at the ends.
    
    To be used in layout algorithms where one wants a peek at the
    next item coming down the pipe.

    Nr�)�	itertools�chain�tee�
StopIteration�zip)r�r��prev�this�nexts     r�prev_this_nextr�Asp�� �_�_�d�V�U�T�F�
3�F� �}�}�V�Q�/��D�$��
��T�
��T�
��T�
��t�T�4� � ���
��
�s�A�	A&�%A&c��t|�r|jd�}t|�dz
}|dz
}d}dg}||krn||dk(rK||dzdk(r|dxxdz
cc<|dz
}n=|dj�|d<||k7r"|j	d�n|dxx||z
cc<|dz
}||kr�n|dj�|d<|S)a
    Splits the string s at every unescaped comma and returns the result as a list.
    To escape a comma, double it. Individual items are stripped.
    To avoid the ambiguity of 3 successive commas to denote a comma at the beginning
    or end of an item, add a space between the item seperator and the escaped comma.
    
    >>> commasplit(u'a,b,c') == [u'a', u'b', u'c']
    True
    >>> commasplit('a,, , b , c    ') == [u'a,', u'b', u'c']
    True
    >>> commasplit(u'a, ,,b, c') == [u'a', u',b', u'c']
    r<r
r�rrr~r)r=rNr�r�r�)rArrUr's    r�
commasplitr�[s����q�z�q�x�x��'�1��A��q��A���I�A�	�A�
�e�A�
�Q�$��Q�4��:���1��v�t�|��"��t����Q����"����
��"���a�4����#��
�b�E�Q�q�T�M�E�	�1����Q�$�
�b�E�K�K�M�A�b�E��Hrc
��dj|D�cgc]#}dt|�jdd�zdz��%c}�Scc}w)a�
    Inverse of commasplit, except that whitespace around items is not conserved.
    Adds more whitespace than needed for simplicity and performance.
    
    >>> commasplit(commajoin(['a', 'b', 'c'])) == [u'a', u'b', u'c']
    True
    >>> commasplit((commajoin([u'a,', u' b ', u'c'])) == [u'a,', u'b', u'c']
    True
    >>> commasplit((commajoin([u'a ', u',b', u'c'])) == [u'a', u',b', u'c'] 
    r~r�z,,)r�rOr)r�rUs  r�	commajoinr�{s=���9�9�PQ�S�1�t�i��l�2�2�4��?�?�$�F�S�T�T��Ss�(?c�^�|xrtjjxstjj}||�r|Stjj}tjj|�s|D]}|||�}||�s�|cS|rt
d|�d|����|S)z*search for relative files in likely placeszcannot locate z with paths=)r�rr�r�r�rr�)r��pathsr��fail�existsrr9rs        r�findInPathsr��s���
�
&������
7�"�'�'�-�-�F�
�b�z�"�9��G�G�L�L�E�
�7�7�=�=����	�A���"�+�C��c�{��
�	��:�"�U�K�L�
L�
�Irc��tj�\}}}t|||jd�|t	|�|fD���|�y)z,add msg to the args of an existing exceptionc3�&K�|]	}|s�|���y�wr r)�.0r�s  r�	<genexpr>z$annotateException.<locals>.<genexpr>�s����B�1��Q�B�s��N)r0rHr�r�r8)r�rJ�postMsgr�r�r$r�s       rrGrG�s>��

�,�,�.�E�A�a���q��3�8�8�B��S��V�G�(<�B�C�D�Q�Grc�&�|jdd�}|jdd�}|jdd�}|jdd�}|jdd	�}|jdd�}|jdd�}|jdd�}|S)
z�Ensure XML output is escaped just once, irrespective of input

    >>> escapeOnce('A & B')
    'A &amp; B'
    >>> escapeOnce('C &amp; D')
    'C &amp; D'
    >>> escapeOnce('E &amp;amp; F')
    'E &amp; F'

    �&r�r�r�r�r�r�z&amp;#z&#)r)r�s r�
escapeOncer�s����<�<��W�%�D�
�<�<��W�-�D��<�<�
�F�+�D��<�<�
�F�+�D��<�<��$�'�D��<�<��W�-�D��<�<�
�F�+�D��<�<�
�F�+�D��Krc��eZdZdZd�Zy)�IdentStrz,useful for identifying things that get splitc���t|t�r-|j}|ddtt	|��z}|dz
}nd}|d|zz
}tj||�}||_|S)Nr�r
rz[%d])r3r�_IdentStr__incr�r8�__new__)r�rR�incr)s    rr
zIdentStr.__new__�si���e�H�%��+�+�C��-�Q�s�3�s�8�}�_�-�.�E��1�H�C��C�
��#�����{�{�3�u�%����
��rN�rrrrTr
rrrrr�s
��6�
rrc��eZdZdZd�Zy)�RLStringz�allows specification of extra properties of a string using a dictionary of extra attributes
    eg fontName = RLString('proxima-nova-bold',
                    svgAttrs=dict(family='"proxima-nova"',weight='bold'))
    c�|�tj||�}|j�D]\}}t|||��|Sr )r8r
r�r�)r�r$r�r)r�s     rr
zRLString.__new__�s<���{�{�3�q�!���:�:�<�	�C�A�a��D��1��	��rNrrrrrr�s���rrc�>�t|�s|jd�}|S)zEforce filename strings to unicode so python can handle encoding stuffr<)r[rNr@s r�makeFileNamer�s���Q�<�
�H�H�V����Hrc�(�eZdZdZd�Zd�Zd�Zd�Zy)�
FixedOffsetTZz&Fixed offset in minutes east from UTC.c�J�tj||��|_||_y)N)�hours�minutes)�datetime�	timedelta�_FixedOffsetTZ__offset�_FixedOffsetTZ__name)r)r�r*rls    rr�zFixedOffsetTZ.__init__�s�� �*�*��a�@��
���rc��|jSr )r�r)�dts  r�	utcoffsetzFixedOffsetTZ.utcoffset�s���}�}�rc��|jSr )rrs  r�tznamezFixedOffsetTZ.tzname�s���{�{�rc�,�tjd�Sr�)rrrs  r�dstzFixedOffsetTZ.dst�s���!�!�!�$�$rN)rrrrTr�rr r"rrrrr�s��0����%rrc�4�eZdZdd�Zed��Zed��Zy)�	TimeStampNc��|�ddlm}tjj	dd�j�}|s|r0|rt
|�nd}tj|�}dx}}d|_	nktj�}ttj|��}t
tjdz�}tjdzd	z}d|_	||_
||_t|�dd
|_||_||_y)Nr)�	invariant�SOURCE_DATE_EPOCHrg��6�A�UTCg �@i�<r�)r�r&r�rWr�r�rarYr[r rb�	localtime�timezoner�r��YMDhms�dhh�dmm)r)r&r�r�r-r.s      rr�zTimeStamp.__init__�s�����5��J�J�N�N�.�r�2�8�8�:������A���A����Q��B��M�C�#��D�K��	�	��A��t�~�~�a�(�)�B��d�m�m�v�.�/�C��=�=�4�'�2�-�C��D�K��������B�i���m��������rc��|jrStjj|jt	|j
|j|j��Stjj�Sr )r r�
fromtimestampr�rr-r.�nowr(s rrzTimeStamp.datetime�sV���;�;��$�$�2�2�4�6�6�-����QU�QY�QY�Z^�Ze�Ze�:f�g�g��$�$�(�(�*�*rc�@�tj|j�Sr )rYrZr�r(s rrZzTimeStamp.asctimes���|�|�D�G�G�$�$rr )rrrr��propertyrrZrrrr$r$�s/���*�+��+��%��%rr$c��t|�stdt|��d|����t|�}|j	�}|stdt|�z��|r	|ddvrdnd}t
d|�|��it|���	�S)
z/Can call down into e.g. object1.object2[4].attrzinvalid recursive access of r>zempty recursive access of %srz[.(rr�)r�)�gr�)rXrWrFrSr�r�rrd)r�rlr5�dots    r�recursiveGetAttrr7su����;�i�t�TW�y�Y]�(^�_�_��D�>�D��:�:�<�D��z�"@�4��9�"L�M�M��$�q�'��.�#�B�C��3�t�,��d�s�m�D�Drc���|jd�}t|�dk(rt|||�ydj|dd�}|d}t	||�}t|||�y)z7Can call down into e.g. object1.object2[4].attr = valuer>r
Nr)r�r�r�r�r7)r�rlrR�tokens�most�last�parents       r�recursiveSetAttrr=s^���Z�Z��_�F�
�6�{�a����T�5�!��x�x��s���$���b�z��!�#�t�,�����e�$rc��|jd�}t|�dk(r
t||�ydj|dd�}|d}t	||�}t||�y)Nr>r
r)r�r��delattrr�r7)r�rlr9r:r;r<s      r�recursiveDelAttrr@sX��
�Z�Z��_�F�
�6�{�a����T���x�x��s���$���b�z��!�#�t�,�����rc#�K�d}t|�}||kr*	|jd|�}|||��|dz}|sy	||kr�)yy#t$r
||d��YywxYw�w)z:yield sublists of L separated by None; the Nones disappearrNr
)r��indexr�)rrUr�js    r�yieldNoneSplitsrD$sq����	�A��A��A�
�A�#�	�����Q��A��A�a�&�L��!��A��e�1��A�#���	��A�B�%�K��	�s,�A� A�A�A�A�A�A�A)r<r )z.ttf)NNr�)NN)Nrrr�)r�)r)TF)r<rr�)�rLrTr�r�r0rYrirrD�astrr�rr�rr��ior�hashlibr�reportlab.lib.rltempfilerr	rrr
r�PILrrr(�python_implementation�isPyPyr"r&r!r*r.r1rbrcr5r9rhr8rF�strTypesrBrKrOrQrSrVrXr=r[r^ryr{r}r�r�r�r�r�r��rl_execr�r�r�r�r�rdr�rlr�r�r�r�rIrrcrd�__RL_DIRrr7r&r[r%rr�r"r.�NotImplementedErrorr6r8�archiverr�r	rr
r�rrrBrrr�r(r��splitextr3r/r1r4r:rCrN�
haveImagesrPr_rgrmru�urllib.parservrw�urllib.requestrxr{r�r�r�r�r�r�r�r��getmtime�mktimer�r�r�r�r�r�r�rrr"r�r�r�r�r�r�r�r�r�r�r�r�r�r�rGrrrr�tzinforr$r7r=r@rDrrr�<module>rXsw��
��D��8�8�8�8��W���D�^�^����
�K�	���
+�X�
+�
+�
-�v�
5�F�'����q�s�s�)��� ��t�����$�Z����;��B�P�R�T� ��&� ���P�"�"�K�D�>�:��
�(�6�
"���\���
�
�6.�T�6.�p�7�7�e�����������������
�N� 
�
��	������+�+�	,��
���
�
�h��,�H�I�������0I��
����1��M��
�F��=�)�!�"G�-�"W�X�X��w�w������ 0� 0��1F�1F� G�H�H��R�V�V�#�K��'�'�/�/�(�+�K� �2�6�6�)�N���%�N��N�+�� +�#1�%� +�%'�W�W�%5�%5�%'�W�W�%5�%5� �i�i��6�6�!$�R�V�V��(�.&�"�Y�Y�w����VX�V]�V]�Vb�Vb��	�'�
�
I�R�W�W�^�^�B�G�G�$4�$4�X�$>�q�$A�5�$H�I�����B� '�y�1D�\�R��,=�\�$�
�
���*
�X���+�"� �8$�t�0�!#�����3�!�g�g�m�m�R�W�W�=M�=M�c�!#���
�
�r�w�w�?O�?O�[]�[e�[e�R�#%�'�'�.�.�"�'�'�BR�BR�df�dk�dk�dt�dt�BF�BM�BM�	j�-�0�&�*�@�@�D	�k�	�9�t$�t$�l�

��+�+���
�"	�
�	F��!�4
�@U��H�
�6�s��	�s�	�
�%�H�O�O�%� %�%�BE�
%����M(�
�F��^��x�x��{�H��Z�
�W�W�^�^�H�
%�F��M��!�Y�Y��s%�'T�6T�D,T/�T�T,�/1U#

Zerion Mini Shell 1.0