AlkantarClanX12

Your IP : 13.59.129.141


Current Path : /proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python311/lib64/python3.11/__pycache__/plistlib.cpython-311.pyc

�

c��f�n����dZgd�ZddlZddlZddlZddlZddlmZddlZddl	Z	ddl
Z
ddlZddlm
Z
ejdde���Ze���ej��Gd	�d
��ZdZe
jd��Zd2d�Zd�Ze
jde
j��Zd�Zd�Zd�ZGd�d��ZGd�d��Z Gd�de ��Z!d�Z"Gd�de#��Z$dddd d!�Z%e&��Z'Gd"�d#��Z(d$�Z)e*e+e,eje-fZ.Gd%�d&e&��Z/d'�Z0e1e2e"ee!�(��e3e2e0e(e/�(��iZ4de2d)�d*�Z5de2d)�d+�Z6e1d,d-d.�d/�Z7e1d-d,d0�d1�Z8dS)3a>plistlib.py -- a tool to generate and parse MacOSX .plist files.

The property list (.plist) file format is a simple XML pickle supporting
basic object types, like dictionaries, lists, numbers and strings.
Usually the top level object is a dictionary.

To write out a plist file, use the dump(value, file)
function. 'value' is the top level object, 'file' is
a (writable) file object.

To parse a plist from a file, use the load(file) function,
with a (readable) file object as the only argument. It
returns the top level object (again, usually a dictionary).

To work with plist data in bytes objects, you can use loads()
and dumps().

Values can be strings, integers, floats, booleans, tuples, lists,
dictionaries (but only with string keys), Data, bytes, bytearray, or
datetime.datetime objects.

Generate Plist example:

    import datetime
    import plistlib

    pl = dict(
        aString = "Doodah",
        aList = ["A", "B", 12, 32.1, [1, 2, 3]],
        aFloat = 0.1,
        anInt = 728,
        aDict = dict(
            anotherString = "<hello & hi there!>",
            aThirdString = "M\xe4ssig, Ma\xdf",
            aTrueValue = True,
            aFalseValue = False,
        ),
        someData = b"<binary gunk>",
        someMoreData = b"<lots of binary gunk>" * 10,
        aDate = datetime.datetime.now()
    )
    print(plistlib.dumps(pl).decode())

Parse Plist example:

    import plistlib

    plist = b'''<plist version="1.0">
    <dict>
        <key>foo</key>
        <string>bar</string>
    </dict>
    </plist>'''
    pl = plistlib.loads(plist)
    print(pl["foo"])
)�InvalidFileException�FMT_XML�
FMT_BINARY�load�dump�loads�dumps�UID�N)�BytesIO)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)r	c��t|t��std���|dkrtd���|dkrtd���||_dS)Nzdata must be an int�zUIDs cannot be >= 2**64r
�UIDs must be positive)�
isinstance�int�	TypeError�
ValueError�data��selfrs  �//opt/alt/python311/lib64/python3.11/plistlib.py�__init__zUID.__init__Ns^���$��$�$�	3��1�2�2�2��7�?�?��6�7�7�7��!�8�8��4�5�5�5���	�	�	�c��|jS�N)r�rs r�	__index__z
UID.__index__Ws
���y�rc�J�|jj�dt|j���d�S)N�(�))�	__class__�__name__�reprrrs r�__repr__zUID.__repr__Zs$���>�2�2�2�D���O�O�O�O�D�Drc� �|j|jffSr)r$rrs r�
__reduce__zUID.__reduce__]s���~��	�|�+�+rc�Z�t|t��stS|j|jkSr)rr	�NotImplementedr)r�others  r�__eq__z
UID.__eq__`s)���%��%�%�	"�!�!��y�E�J�&�&rc�*�t|j��Sr)�hashrrs r�__hash__zUID.__hash__es���D�I���rN)	r%�
__module__�__qualname__rr r'r)r-r0�rrr	r	Msq������������E�E�E�,�,�,�'�'�'�
����rr	s�<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
zv[\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f]�Lc���|dzdz}g}tdt|��|��D]6}||||z�}|�tj|�����7d�|��S)N��r
r)�range�len�append�binascii�
b2a_base64�join)�s�
maxlinelength�
maxbinsize�pieces�i�chunks      r�_encode_base64rDys|����"�A�%�J�
�F�
�1�c�!�f�f�j�
)�
)�2�2���!�a�*�n�$�%���
�
�h�)�%�0�0�1�1�1�1��8�8�F���rc��t|t��r'tj|�d����Stj|��S)N�utf-8)r�strr;�
a2b_base64�encode)r>s r�_decode_base64rJ�sD���!�S���&��"�1�8�8�G�#4�#4�5�5�5��"�1�%�%�%rz{(?P<year>\d\d\d\d)(?:-(?P<month>\d\d)(?:-(?P<day>\d\d)(?:T(?P<hour>\d\d)(?::(?P<minute>\d\d)(?::(?P<second>\d\d))?)?)?)?)?Zc���d}t�|�����}g}|D]0}||}|�n#|�t	|�����1tj|�S)N��year�month�day�hour�minute�second)�_dateParser�match�	groupdictr:r�datetime)r>�order�gd�lst�key�vals      r�_date_from_stringr\�sv��@�E�	�	�	�1�	�	�	'�	'�	)�	)�B�
�C�������g���;��E��
�
�3�s�8�8�������c�"�"rc�T�d|j|j|j|j|j|jfzS)Nz%04d-%02d-%02dT%02d:%02d:%02dZrL)�ds r�_date_to_stringr_�s.��+�	������	����!�(�/��rc�8�t�|��}|�td���|�dd��}|�dd��}|�dd��}|�dd��}|�d	d
��}|S)Nz;strings can't contain control characters; use bytes insteadz
�
�
�&z&amp;�<z&lt;�>z&gt;)�_controlCharPat�searchr�replace)�text�ms  r�_escaperk�s������t�$�$�A��}��-�.�.�	.��<�<���%�%�D��<�<��d�#�#�D��<�<��W�%�%�D��<�<��V�$�$�D��<�<��V�$�$�D��Krc��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS)�_PlistParserc�>�g|_d|_d|_||_dSr)�stack�current_key�root�
_dict_type�r�	dict_types  rrz_PlistParser.__init__�s#����
������	�#����rc���t��|_|j|j_|j|j_|j|j_|j|j_	|j�
|��|jSr)r�parser�handle_begin_element�StartElementHandler�handle_end_element�EndElementHandler�handle_data�CharacterDataHandler�handle_entity_decl�EntityDeclHandler�	ParseFilerq)r�fileobjs  r�parsez_PlistParser.parse�s_��"�n�n���*.�*C���'�(,�(?���%�+/�+;���(�(,�(?���%�����g�&�&�&��y�rc� �td���)Nz8XML entity declarations are not supported in plist files)r)r�entity_name�is_parameter_entity�value�base�	system_id�	public_id�
notation_names        rr}z_PlistParser.handle_entity_decl�s��#�#]�^�^�^rc�Z�g|_t|d|zd��}|�
||��dSdS)N�begin_)r�getattr)r�element�attrs�handlers    rrwz!_PlistParser.handle_begin_element�s>����	��$��7� 2�D�9�9�����G�E�N�N�N�N�N��rc�J�t|d|zd��}|�|��dSdS)N�end_)r�)rr�r�s   rryz_PlistParser.handle_end_element�s5���$��� 0�$�7�7�����G�I�I�I�I�I��rc�:�|j�|��dSr)rr:rs  rr{z_PlistParser.handle_data�s���	��������rc��|j�bt|jdti����st	d|jjz���||jd|j<d|_dS|js	||_dSt|jdtg����st	d|jjz���|jd�|��dS)N���zunexpected element at line %d)	rprro�typerrv�CurrentLineNumberrqr:�rr�s  r�
add_objectz_PlistParser.add_object�s�����'��d�j��n�d�2�h�h�7�7�
@� �!@�!%��!>�"?�@�@�@�/4�D�J�r�N�4�+�,�#�D������	)��D�I�I�I��d�j��n�d�2�h�h�7�7�
@� �!@�!%��!>�"?�@�@�@��J�r�N�!�!�%�(�(�(�(�(rc�H�d�|j��}g|_|S)N�)r=rrs  r�get_dataz_PlistParser.get_data�s!���w�w�t�y�!�!����	��rc��|���}|�|��|j�|��dSr)rrr�ror:)rr�r^s   r�
begin_dictz_PlistParser.begin_dict�s?���O�O������������
���!�����rc��|jr#td|j|jjfz���|j���dS)Nz%missing value for key '%s' at line %d)rprrvr�ro�poprs r�end_dictz_PlistParser.end_dict�sT����	O��D�"�.�t�{�/L�M�N�O�O�
O��
�������rc���|js(t|jdti����st	d|jjz���|���|_dS)Nr�zunexpected key at line %d)rprror�rrvr�r�rs r�end_keyz_PlistParser.end_key�sb����	<�:�d�j��n�d�2�h�h�#G�#G�	<��8�!�[�:�;�<�<�
<��=�=�?�?����rc�h�g}|�|��|j�|��dSr)r�ror:)rr��as   r�begin_arrayz_PlistParser.begin_array�s5������������
���!�����rc�8�|j���dSr)ror�rs r�	end_arrayz_PlistParser.end_array�s���
�������rc�0�|�d��dS)NT�r�rs r�end_truez_PlistParser.end_trues����������rc�0�|�d��dS)NFr�rs r�	end_falsez_PlistParser.end_falses����������rc��|���}|�d��s|�d��r%|�t|d����dS|�t|����dS)N�0x�0X�)r��
startswithr�r)r�raws  r�end_integerz_PlistParser.end_integerst���m�m�o�o���>�>�$���	&�3�>�>�$�#7�#7�	&��O�O�C��R�L�L�)�)�)�)�)��O�O�C��H�H�%�%�%�%�%rc�n�|�t|�������dSr)r��floatr�rs r�end_realz_PlistParser.end_reals*������d�m�m�o�o�.�.�/�/�/�/�/rc�T�|�|�����dSr)r�r�rs r�
end_stringz_PlistParser.end_strings"������
�
���(�(�(�(�(rc�n�|�t|�������dSr)r�rJr�rs r�end_dataz_PlistParser.end_datas*������t�}�}���7�7�8�8�8�8�8rc�n�|�t|�������dSr)r�r\r�rs r�end_datez_PlistParser.end_dates+�����)�$�-�-�/�/�:�:�;�;�;�;�;rN)r%r1r2rr�r}rwryr{r�r�r�r�r�r�r�r�r�r�r�r�r�r�r3rrrmrm�sC������$�$�$����_�_�_�������
���)�)�)� ������
���+�+�+����
���������&�&�&�0�0�0�)�)�)�9�9�9�<�<�<�<�<rrmc�0�eZdZd	d�Zd�Zd�Zd
d�Zd�ZdS)�_DumbXMLWriterr
�	c�>�||_g|_||_||_dSr)�filero�
_indent_level�indent)rr��indent_levelr�s    rrz_DumbXMLWriter.__init__s#����	���
�)�������rc��|j�|��|�d|z��|xjdz
c_dS)Nz<%s>�)ror:�writelnr��rr�s  r�
begin_elementz_DumbXMLWriter.begin_element"sI���
���'�"�"�"����V�g�%�&�&�&����a�����rc��|jdksJ�|j���|ksJ�|xjdzc_|�d|z��dS)Nr
r�z</%s>)r�ror�r�r�s  r�end_elementz_DumbXMLWriter.end_element'sd���!�A�%�%�%�%��z�~�~���7�*�*�*�*����a�������W�w�&�'�'�'�'�'rNc	��|�0t|��}|�d|�d|�d|�d���dS|�d|z��dS)Nrdrez</z<%s/>)rkr�)rr�r�s   r�simple_elementz_DumbXMLWriter.simple_element-s_�����E�N�N�E��L�L�L�'�'�'�5�5�5�'�'�'�B�C�C�C�C�C�
�L�L��7�*�+�+�+�+�+rc��|rkt|t��r|�d��}|j�|j|jz��|j�|��|j�d��dS)NrF�
)rrGrIr��writer�r�)r�lines  rr�z_DumbXMLWriter.writeln5s{���	"��$��$�$�
,��{�{�7�+�+���I�O�O�D�.���<�=�=�=��I�O�O�D�!�!�!��	��������r)r
r�r)r%r1r2rr�r�r�r�r3rrr�r�si���������� � � �
(�(�(�,�,�,�,�	�	�	�	�	rr�c�8�eZdZ		d
d�Zd�Zd�Zd	�Zd
�Zd�ZdS)�_PlistWriterr
�	r�TFc��|r|�t��t�||||��||_||_dSr)r��PLISTHEADERr�r�
_sort_keys�	_skipkeys)rr�r�r��writeHeader�	sort_keys�skipkeyss       rrz_PlistWriter.__init__BsJ���	$��J�J�{�#�#�#�����d�L�&�A�A�A�#���!����rc��|�d��|�|��|�d��dS)Nz<plist version="1.0">z</plist>)r��write_valuer�s  rr�z_PlistWriter.writeLsA�����.�/�/�/�����������Z� � � � � rc��t|t��r|�d|��dS|dur|�d��dS|dur|�d��dSt|t��r:d|cxkrdkrnn|�dd	|z��dSt	|���t|t
��r%|�d
t
|����dSt|t��r|�|��dSt|ttf��r|�|��dSt|tj��r%|�dt|����dSt|ttf��r|�|��dSt#dt%|��z���)
N�stringT�trueF�falsel����r�integerz%d�real�datezunsupported type: %s)rrGr�r�
OverflowErrorr�r&�dict�
write_dict�bytes�	bytearray�write_bytesrVr_�tuple�list�write_arrayrr�r�s  rr�z_PlistWriter.write_valueQs����e�S�!�!�	B�����%�0�0�0�0�0�
�d�]�]�����'�'�'�'�'�
�e�^�^�����(�(�(�(�(�
��s�
#�
#�	B��5�*�*�*�*�7�*�*�*�*�*��#�#�I�t�e�|�<�<�<�<�<�#�E�*�*�*�
��u�
%�
%�	B������U���4�4�4�4�4�
��t�
$�
$�
	B��O�O�E�"�"�"�"�"�
���y�1�
2�
2�
	B����U�#�#�#�#�#�
��x�0�
1�
1�	B�������(>�(>�?�?�?�?�?�
���t�}�
-�
-�	B����U�#�#�#�#�#��2�T�%�[�[�@�A�A�Arc
��|�d��|xjdzc_tddt|j�dd��|jz��z
��}t
||���d��D]}|r|�|���|xjdz
c_|�	d��dS)Nrr�r�r4r�s        r�)
r�r��maxr9r�rhrD�splitr�r�)rrr?r�s    rr�z_PlistWriter.write_bytesss������6�"�"�"����a��������T�[�(�(���9�9�D�<N�N�O�O�O�Q�Q�
�#�4��7�7�=�=�e�D�D�	#�	#�D��
#����T�"�"�"�����a�������� � � � � rc���|r�|�d��|jr"t|�����}n|���}|D]\\}}t	|t
��s|jr�"td���|�d|��|�	|���]|�
d��dS|�d��dS)Nr��keys must be stringsrZ)r�r��sorted�itemsrrGr�rr�r�r�)rr^r�rZr�s     rr�z_PlistWriter.write_dict�s����	(����v�&�&�&���
"��q�w�w�y�y�)�)������	�	��#�
(�
(�
��U�!�#�s�+�+�<��~�!� �#�$:�;�;�;��#�#�E�3�/�/�/�� � ��'�'�'�'����V�$�$�$�$�$�
����'�'�'�'�'rc��|rF|�d��|D]}|�|���|�d��dS|�d��dS)N�array)r�r�r�r�)rr�r�s   rr�z_PlistWriter.write_array�sz���	)����w�'�'�'��
(�
(��� � ��'�'�'�'����W�%�%�%�%�%�
����(�(�(�(�(rN)r
r�r�TF)	r%r1r2rr�r�r�r�r�r3rrr�r�As}������BC�%*�"�"�"�"�!�!�!�
 B� B� B�D!�!�!�(�(�(�()�)�)�)�)rr�c�l�d}|D]}|�|��rdS�tjdftjdftjdffD]j\}}|�|��s�|D]L}||�d���|��z}|dt|���|krdS�M�kdS)N)s<?xmls<plistTrFz	utf-16-bez	utf-16-le�asciiF)r��codecs�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LE�decoderIr9)�header�prefixes�pfx�bom�encoding�start�prefixs       r�_is_fmt_xmlr�s���$�H��������S�!�!�	��4�4�	���'�*��$�k�2��$�k�2����
��X�� � ��%�%�	���	�	�E��5�<�<��0�0�7�7��A�A�A�F��l�s�6�{�{�l�#�v�-�-��t�t�t�.�	�
�5rc��eZdZdd�ZdS)r�Invalid filec�<�t�||��dSr)rr)r�messages  rrzInvalidFileException.__init__�s�����D�'�*�*�*�*�*rN)r)r%r1r2rr3rrrr�s(������+�+�+�+�+�+rr�B�H�L�Q)r��r6�c�6�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	dS)	�_BinaryPlistParsera
    Read or write a binary plist file, following the description of the binary
    format.  Raise InvalidFileException in case of error, otherwise return the
    root object.

    see also: http://opensource.apple.com/source/CF/CF-744.18/CFBinaryPList.c
    c��||_dSr)rrrss  rrz_BinaryPlistParser.__init__�s
��#����rc�:�	||_|j�dtj��|j�d��}t|��dkrt
���tjd|��\}|_	}}}|j�|��|�
||��|_tg|z|_
|�|��S#tt tjt$t&f$rt
���wxYw)Ni��� z>6xBBQQQ)�_fp�seek�os�SEEK_END�readr9r�struct�unpack�	_ref_size�
_read_ints�_object_offsets�
_undefined�_objects�_read_object�OSError�
IndexError�errorr�r)r�fp�trailer�offset_size�num_objects�
top_object�offset_table_offsets       rr�z_BinaryPlistParser.parse�s��	)��D�H��H�M�M�#�r�{�+�+�+��h�m�m�B�'�'�G��7�|�|�r�!�!�*�,�,�,��
�j�'�2�2�
��T�^�[�*�#��H�M�M�-�.�.�.�#'�?�?�;��#L�#L�D� �'�L�;�6�D�M��$�$�Z�0�0�0����V�\�=���	)�	)�	)�&�(�(�(�	)���s�C C#�#7Dc���|dkrk|j�d��ddz}d|z}dt|z}tj||j�|����dS|S)z$ return the size of the next object.�r�r
r7re)rr�_BINARY_FORMATrr)r�tokenLrjr>�fs     r�	_get_sizez_BinaryPlistParser._get_size�sj���S�=�=���
�
�a� � ��#�c�)�A��Q��A��n�Q�'�'�A��=��D�H�M�M�!�$4�$4�5�5�a�8�8��
rc�D���|j��|z����tvr%tjd|�t������S�rt����|zkrt
���t��fd�td�|z���D����S)Nrec3�d�K�|]*}t��||�z�d��V��+dS)�bigN)r�
from_bytes)�.0rBr�sizes  ��r�	<genexpr>z0_BinaryPlistParser._read_ints.<locals>.<genexpr>�sR�����<�<������Q��D��[�(9�5�A�A�<�<�<�<�<�<rr
)	rrr-rrr9rr�r8)r�nr6rs  `@rrz_BinaryPlistParser._read_ints�s������x�}�}�T�A�X�&�&���>�!�!��=�!>�Q�!>��t�(<�!>�!>��E�E�E��
-�3�t�9�9��q��0�0�*�,�,�,��<�<�<�<�<�"'��4�!�8�T�":�":�<�<�<�<�<�
<rc�8�|�||j��Sr)rr)rr8s  r�
_read_refsz_BinaryPlistParser._read_refss�����q�$�.�1�1�1rc�����j|}|tur|S�j|}�j�|���j�d��d}|dz|dz}}|dkrd}�n�|dkrd}�n�|dkrd	}�n�|dkrd
}�n�|dkr>t��j�d|z��d|d
k���}�n�|dkr5tj	d�j�d����d}�nP|dkr5tj	d�j�d����d}�n|dkratj	d�j�d����d}tj
ddd��tj|���z}�n�|dkrR��|��}�j�|��}t|��|krt����nV|dkrg��|��}�j�|��}	t|	��|krt���|	�d��}�n�|dkrj��|��dz}�j�|��}	t|	��|krt���|	�d��}�ny|dkrEt!t��j�d|z��d����}�n.|dkrX��|��}��|��}
g}|�j|<|��fd�|
D����n�|d kr���|��}��|��}��|��}
����}|�j|<	t)||
��D]0\}}
��|
��|��|��<�1n*#t,$rt���wxYwt���|�j|<|S)!zx
        read the object by reference.

        May recursively read sub-objects (content of an array/dict/set)
        r�r
��r,NrF�	Trr�r3r7��signed�"z>fr6�#z>d�3��)�seconds�@�Pr��`r�utf-16be��c3�B�K�|]}��|��V��dSr)r!)r5�xrs  �rr7z2_BinaryPlistParser._read_object.<locals>.<genexpr>Os1�����A�A�1�$�+�+�A�.�.�A�A�A�A�A�Ar��)r rrrrrrr4rrrV�	timedeltar0r9rr�r	r:�extendrr�zipr!r)r�ref�result�offset�token�tokenHr.r/r>r�obj_refs�key_refs�k�os`             rr!z_BinaryPlistParser._read_objectsF�����s�#����#�#��M��%�c�*����
�
�f������
�
�a� � ��#�����u�t�|����D�=�=��F�F�
�d�]�]��F�F�
�d�]�]��F�F�
�d�]�]��F�F�
�t�^�^��^�^�D�H�M�M�!�v�+�$>�$>�$)�&�A�+�$�?�?�F�F��d�]�]��]�4�����q�)9�)9�:�:�1�=�F�F�
�d�]�]��]�4�����q�)9�)9�:�:�1�=�F�F�
�d�]�]��
�d�D�H�M�M�!�$4�$4�5�5�a�8�A��'��a��3�3��(��3�3�3�4�F�F��t�^�^����v�&�&�A��X�]�]�1�%�%�F��6�{�{�a���*�,�,�,� ��t�^�^����v�&�&�A��8�=�=��#�#�D��4�y�y�A�~�~�*�,�,�,��[�[��)�)�F�F�
�t�^�^����v�&�&��*�A��8�=�=��#�#�D��4�y�y�A�~�~�*�,�,�,��[�[��,�,�F�F�
�t�^�^�������
�
�a�&�j�(A�(A�5�I�I�J�J�F�F�
�t�^�^����v�&�&�A����q�)�)�H��F�!'�D�M�#���M�M�A�A�A�A��A�A�A�A�A�A�A��t�^�^����v�&�&�A����q�)�)�H����q�)�)�H��_�_�&�&�F�!'�D�M�#��
-���(�3�3�H�H�D�A�q�37�3D�3D�Q�3G�3G�F�4�,�,�Q�/�/�0�0�H���
-�
-�
-�*�,�,�,�
-����'�(�(�(�#��
�c���
s
�6AP8�8QN)
r%r1r2�__doc__rr�r0rr:r!r3rrrr�s}��������$�$�$�)�)�)�2���<�<�<�2�2�2�c�c�c�c�crrc�6�|dkrdS|dkrdS|dkrdSdS)N�r��r�r6rr3)�counts r�_count_to_sizer`hs3���v�~�~��q�	�����q�	�����q��qrc�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�_BinaryPlistWriterc�0�||_||_||_dSr)rr�r�)rr%r�r�s    rrz_BinaryPlistWriter.__init__xs�����#���!����rc���g|_i|_i|_|�|��t	|j��}dg|z|_t
|��|_t|j|_	|j
�d��|jD]}|�|���|�
|��}|j
���}t
|��}dt||zz}|j
�tj|g|j�R���d}|||j|||f}	|j
�tjdg|	�R���dS)Nr
�bplist00rez	>5xBBBQQQ)�_objlist�	_objtable�_objidtable�_flattenr9rr`rr-�_ref_formatrr��
_write_object�
_getrefnum�tellr�pack)
rr�r(�objr)r*r'�
offset_format�sort_versionr&s
          rr�z_BinaryPlistWriter.write}sh����
�������	
�
�
�e�����$�-�(�(�� !�s�;����'��4�4���)�$�.�9���	
����{�#�#�#��=�	$�	$�C����s�#�#�#�#��_�_�U�+�+�
�"�h�m�m�o�o��$�%8�9�9���n�[�9�K�G�G�
�����v�{�=�H�4�3G�H�H�H�I�I�I����+�t�~�{��+�
��	
����v�{�;�9��9�9�9�:�:�:�:�:rc��t|t��rt|��|f|jvrdSnt	|��|jvrdSt
|j��}|j�|��t|t��r||jt|��|f<n||jt	|��<t|t��r�g}g}|�
��}|jrt|��}|D][\}}t|t��s|jr�"td���|�|��|�|���\t!j||��D]}|�|���dSt|t&t(f��r|D]}|�|���dSdS)Nr�)r�_scalarsr�rg�idrhr9rfr:r�r�r�r�rGr�r�	itertools�chainrir�r�)	rr��refnum�keys�valuesr�rX�vrYs	         rriz_BinaryPlistWriter._flatten�s����e�X�&�&�	��U���U�#�t�~�5�5���6���Y�Y�$�*�
*�
*��F��T�]�#�#���
���U�#�#�#��e�X�&�&�	1�39�D�N�D��K�K��/�0�0�*0�D��R��Y�Y�'��e�T�"�"�	!��D��F��K�K�M�M�E���
&��u�
�
���
!�
!���1�!�!�S�)�)�<��~�!� �#�$:�;�;�;����A�����
�
�a� � � � ��_�T�6�2�2�
!�
!���
�
�a� � � � �
!�
!����e�}�
-�
-�	!��
!�
!���
�
�a� � � � �	!�	!�
!�
!rc��t|t��r|jt|��|fS|jt|��Sr)rrsrgr�rhrtr�s  rrlz_BinaryPlistWriter._getrefnum�s@���e�X�&�&�	/��>�4��;�;��"6�7�7��#�B�u�I�I�.�.rc�6�|dkr2|j�tjd||z����dS|dkr4|j�tjd|dzd|����dS|dkr4|j�tjd|dzd|����dS|d	kr4|j�tjd
|dzd|����dS|j�tjd|dzd
|����dS)Nr,z>Br\z>BBBr�r]z>BBH�r^z>BBL�z>BBQ�)rr�rrn)rrTr6s   r�_write_sizez_BinaryPlistWriter._write_size�s
���"�9�9��H�N�N�6�;�t�U�T�\�:�:�;�;�;�;�;�
�F�]�]��H�N�N�6�;�v�u�s�{�D�$�G�G�H�H�H�H�H�
�G�^�^��H�N�N�6�;�v�u�s�{�D�$�G�G�H�H�H�H�H�
�G�^�^��H�N�N�6�;�v�u�s�{�D�$�G�G�H�H�H�H�H�
�H�N�N�6�;�v�u�s�{�D�$�G�G�H�H�H�H�Hrc�>����|��}�j����j|<|��j�d��dS|dur�j�d��dS|dur�j�d��dSt|t���r||dkrT	�j�tjdd|����dS#tj	$rt|��d�wxYw|d	kr0�j�tjd
d|����dS|dkr0�j�tjd
d|����dS|dkr0�j�tjdd|����dS|dkr0�j�tjdd|����dS|dkr5�j�d|�ddd���z��dSt|���t|t��r0�j�tjdd|����dSt|tj
��r[|tj
ddd��z
���}�j�tjdd|����dSt|tt f��r?��dt%|�����j�|��dSt|t&��r�	|�d��}��dt%|����nK#t*$r>|�d ��}��d!t%|��d"z��YnwxYw�j�|��dSt|t,���r|jdkrt1d#���|jd	kr0�j�tjd
d$|����dS|jdkr0�j�tjd
d%|����dS|jdkr0�j�tjdd&|����dS|jdkr0�j�tjdd'|����dSt|���t|t2t4f��rj�fd(�|D��}t%|��}��d)|���j�tjd*�j|zzg|�R���dSt|t8���rVgg}}�jr"t=|�����}	n|���}	|	D]�\}
}t|
t&��s�j r�"tCd+���|�"��|
����|�"��|������t%|��}��d,|���j�tjd*�j|zzg|�R����j�tjd*�j|zzg|�R���dStC|���)-N�F�Tr�r
z>Bqrr\z>BBr�r]z>BHr}r^z>BLr~lz>BQr�r3r>z>BdrArCr�rBrEr�rFrHrGrrrI���c�:��g|]}��|����Sr3)rl)r5rYrs  �r�
<listcomp>z4_BinaryPlistWriter._write_object.<locals>.<listcomp>-s%���6�6�6�1�D�O�O�A�&�&�6�6�6rrJrer�rM)#rlrrmrr�rrrrnr$r��to_bytesr�rV�
total_secondsr�r�r�r9rGrI�UnicodeEncodeErrorr	rrr�r�rjr�r�r�r�r�rr:)rr�rQr/�t�refsr>�keyRefs�valRefs�	rootItemsrXrzs`           rrkz _BinaryPlistWriter._write_object�s�����o�o�e�$�$��$(�H�M�M�O�O���S�!��=��H�N�N�7�#�#�#�#�#�
�e�^�^��H�N�N�7�#�#�#�#�#�
�d�]�]��H�N�N�7�#�#�#�#�#�
��s�
#�
#�R	#��q�y�y�9��H�N�N�6�;�u�d�E�#B�#B�C�C�C�C�C���|�9�9�9�'��.�.�D�8�9������������v�{�5�$��>�>�?�?�?�?�?���������v�{�5�$��>�>�?�?�?�?�?���������v�{�5�$��>�>�?�?�?�?�?���������v�{�5�$��>�>�?�?�?�?�?���������w�����E�$��)O�)O�O�P�P�P�P�P�#�E�*�*�*�
��u�
%�
%�?	#��H�N�N�6�;�u�d�E�:�:�;�;�;�;�;�
��x�0�
1�
1�<	#���*�4��A�6�6�6�E�E�G�G�A��H�N�N�6�;�u�d�A�6�6�7�7�7�7�7�
���y�1�
2�
2�8	#����T�3�u�:�:�.�.�.��H�N�N�5�!�!�!�!�!�
��s�
#�
#�4	#�
4��L�L��)�)��� � ��s�5�z�z�2�2�2�2��%�
4�
4�
4��L�L��,�,��� � ��s�1�v�v��{�3�3�3�3�3�
4����
�H�N�N�1������
��s�
#�
#�*	#��z�A�~�~� �!8�9�9�9���f�$�$�����v�{�5�$��>�>�?�?�?�?�?���g�%�%�����v�{�5�$��>�>�?�?�?�?�?���g�%�%�����v�{�5�$��>�>�?�?�?�?�?���g�%�%�����v�{�5�$��>�>�?�?�?�?�?�#�E�*�*�*�
���e�}�
-�
-�	#�6�6�6�6��6�6�6�D��D�	�	�A����T�1�%�%�%��H�N�N�6�;�s�T�-=��-A�'A�I�D�I�I�I�J�J�J�J�J�
��t�
$�
$�	#�!�2�W�G���
*�"�5�;�;�=�=�1�1�	�	�!�K�K�M�M�	�!�
3�
3���1�!�!�S�)�)�<��~�!� �#�$:�;�;�;����t���q�1�1�2�2�2����t���q�1�1�2�2�2�2��G���A����T�1�%�%�%��H�N�N�6�;�s�T�-=��-A�'A�L�G�L�L�L�M�M�M��H�N�N�6�;�s�T�-=��-A�'A�L�G�L�L�L�M�M�M�M�M��E�"�"�"s�3.C#�# D�8N�AO�ON)	r%r1r2rr�rirlr�rkr3rrrbrbwsx������"�"�"�
+;�+;�+;�Z(!�(!�(!�T/�/�/�I�I�I� ^#�^#�^#�^#�^#rrbc��|dd�dkS)Nrrer3)r�s r�_is_fmt_binaryr�Ks���"�1�"�:��$�$r)�detectrv�writer��fmtrtc�N�|�p|�d��}|�d��t���D]}|d|��r
|d}n�t	���nt|d}||���}|�|��S)z�Read a .plist file. 'fp' should be a readable and binary file object.
    Return the unpacked root object (which usually is a dictionary).
    Nrr
r�rv)rt)rr�_FORMATSryrr�)r%r�rtr��info�P�ps       rrras����{��������
����
�
�
��O�O�%�%�	)�	)�D��t�H�~�f�%�%�
���N����
�
'�(�(�(��
�S�M�(�#��	��I����A��7�7�2�;�;�rc�D�t|��}t|||���S)zqRead a .plist file from a bytes object.
    Return the unpacked root object (which usually is a dictionary).
    r�)rr)r�r�rtr%s    rrrws$��
����B����y�1�1�1�1rTF)r�r�r�c��|tvrtd|�����t|d|||���}|�|��dS)zWWrite 'value' to a .plist file. 'fp' should be a writable,
    binary file object.
    zUnsupported format: r�)r�r�N)r�rr�)r�r%r�r�r�r�s      rrrsY���(����j�3�3�8�9�9�9�
�c�]�8�
$�R�9�x�
P�
P�
P�F�
�L�L������r�r�r�r�c�n�t��}t|||||���|���S)z?Return a bytes object with the contents for a .plist file.
    r�)rr�getvalue)r�r�r�r�r%s     rrr�s4��
���B�����h�)�D�D�D�D�
�;�;�=�=�r)r4)9rZ�__all__r;r�rV�enum�iorrur�rer�xml.parsers.expatr�Enumr%r
�globals�update�__members__r	r��compilerfrDrJ�ASCIIrSr\r_rkrmr�r�rrrr-�objectrrr`rGrr�r�rsrbr�rr�rr�rrrrr3rr�<module>r�s���7�7�p��������
�
�
�
�������������������	�	�	�	�	�	�	�	�
�
�
�
�*�*�*�*�*�*��d�i�
�';�H�M�M�M����	�	����(�)�)�)���������B���"�*�I�J�J������&�&�&��b�j�X�Z\�Zb�c�c��	#�	#�	#����
�
�
�k<�k<�k<�k<�k<�k<�k<�k<�\#�#�#�#�#�#�#�#�L[)�[)�[)�[)�[)�>�[)�[)�[)�|���B+�+�+�+�+�J�+�+�+��S�S�S�1�1��
�V�X�X�
�^�^�^�^�^�^�^�^�@���
��e�X�.��6��Q#�Q#�Q#�Q#�Q#�&�Q#�Q#�Q#�h%�%�%��T�T�������
����!�!����

���D������,��2�2�2�2�2�#�d�U������ �%�4�������r