Your IP : 3.144.95.167


Current Path : /usr/lib64/python3.6/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/__pycache__/plistlib.cpython-36.pyc

3

�Qg#~�@sbdZddddddddd	d
ddd
dgZddlZddlZddlZddlZddlZddlmZddl	Z	ddl
Z
ddlZddlZddl
mZddlmZejdded�Ze�jej�Gdd�de�ZGdd�de�Zejdd��ZGdd�de�Zdd�Zdd�Zdd�Zd d�Z Gd!d�d�Z!d"Z"ej#d#�Z$dPd%d&�Z%d'd(�Z&ej#d)ej'�Z(d*d+�Z)d,d-�Z*d.d/�Z+Gd0d1�d1�Z,Gd2d3�d3�Z-Gd4d5�d5e-�Z.d6d7�Z/Gd8d�de0�Z1d9d:d;d<d=�Z2e3�Z4Gd>d?�d?�Z5d@dA�Z6e7e8e9eje:fZ;GdBdC�dCe3�Z<dDdE�Z=e>ee/e,e.dF�e?ee=e5e<dF�iZ@ddGedH�dId�ZAddGedH�dJd
�ZBe>dGdKdL�dMd�ZCe>dKdGdN�dOd�ZDdS)Qa�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:

    pl = dict(
        aString = "Doodah",
        aList = ["A", "B", 12, 32.1, [1, 2, 3]],
        aFloat = 0.1,
        anInt = 728,
        aDict = dict(
            anotherString = "<hello & hi there!>",
            aUnicodeValue = "M\xe4ssig, Ma\xdf",
            aTrueValue = True,
            aFalseValue = False,
        ),
        someData = b"<binary gunk>",
        someMoreData = b"<lots of binary gunk>" * 10,
        aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
    )
    with open(fileName, 'wb') as fp:
        dump(pl, fp)

Parse Plist example:

    with open(fileName, 'rb') as fp:
        pl = load(fp)
    print(pl["aKey"])
�	readPlist�
writePlist�readPlistFromBytes�writePlistToBytes�Plist�Data�Dict�InvalidFileException�FMT_XML�
FMT_BINARY�load�dump�loads�dumps�N)�BytesIO)�warn)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec@s(eZdZfZdd�Zdd�Zdd�ZdS)�
_InternalDictcCs:y||}Wntk
r(t|��YnXtdtd�|S)NzLAttribute access from plist dicts is deprecated, use d[key] notation instead�)�KeyError�AttributeErrorr�DeprecationWarning)�self�attr�value�r� /usr/lib64/python3.6/plistlib.py�__getattr__Vsz_InternalDict.__getattr__cCstdtd�|||<dS)NzLAttribute access from plist dicts is deprecated, use d[key] notation insteadr)rr)rrrrrr�__setattr___sz_InternalDict.__setattr__cCs8y
||=Wntk
r&t|��YnXtdtd�dS)NzLAttribute access from plist dicts is deprecated, use d[key] notation insteadr)rrrr)rrrrr�__delattr__ds
z_InternalDict.__delattr__N)�__name__�
__module__�__qualname__�	__slots__rr r!rrrrrOs	rcseZdZ�fdd�Z�ZS)rcstdtd�t�jf|�dS)Nz?The plistlib.Dict class is deprecated, use builtin dict insteadr)rr�super�__init__)r�kwargs)�	__class__rrr'osz
Dict.__init__)r"r#r$r'�
__classcell__rr)r)rrmsc	cs2t|t�r(t||��}|VWdQRXn|VdS)N)�
isinstance�str�open)�
pathOrFile�mode�fprrr�_maybe_openus
r1cs4eZdZdZ�fdd�Zedd��Zdd�Z�ZS)rzuThis class has been deprecated. Use dump() and load()
    functions instead, together with regular dict objects.
    cstdtd�t�jf|�dS)NzJThe Plist class is deprecated, use the load() and dump() functions insteadr)rrr&r')rr()r)rrr'�szPlist.__init__c	Cs2t|d��}t|�}WdQRX|�}|j|�|S)z,Deprecated. Use the load() function instead.�rbN)r1r�update)�clsr.r0rZplistrrr�fromFile�s

zPlist.fromFilec
Cs$t|d��}t||�WdQRXdS)z,Deprecated. Use the dump() function instead.�wbN)r1r)rr.r0rrr�write�szPlist.write)	r"r#r$�__doc__r'�classmethodr5r7r*rr)r)rrs	c
Cs2tdtd�t|d��}t|ddtd�SQRXdS)z�
    Read a .plist from a path or file. pathOrFile should either
    be a file name, or a readable binary file object.

    This function is deprecated, use load instead.
    z8The readPlist function is deprecated, use load() insteadrr2NF)�fmt�use_builtin_types�	dict_type)rrr1rr)r.r0rrrr�s
cCs8tdtd�t|d��}t||tddd�WdQRXdS)z�
    Write 'value' to a .plist file. 'pathOrFile' may either be a
    file name or a (writable) file object.

    This function is deprecated, use dump instead.
    z9The writePlist function is deprecated, use dump() insteadrr6TF)r:�	sort_keys�skipkeysN)rrr1rr	)rr.r0rrrr�scCs tdtd�tt|�ddtd�S)z}
    Read a plist data from a bytes object. Return the root object.

    This function is deprecated, use loads instead.
    zBThe readPlistFromBytes function is deprecated, use loads() insteadrNF)r:r;r<)rrrrr)�datarrrr�scCs,tdtd�t�}t||tddd�|j�S)zp
    Return 'value' as a plist-formatted bytes object.

    This function is deprecated, use dumps instead.
    zAThe writePlistToBytes function is deprecated, use dumps() insteadrTF)r:r=r>)rrrrr	�getvalue)r�frrrr�s
c@s>eZdZdZdd�Zedd��Zddd�Zd	d
�Zdd�Z	d
S)rz]
    Wrapper for binary data.

    This class is deprecated, use a bytes object instead.
    cCst|t�std��||_dS)Nzdata must be as bytes)r+�bytes�	TypeErrorr?)rr?rrrr'�s
z
Data.__init__cCs|t|��S)N)�_decode_base64)r4r?rrr�
fromBase64�szData.fromBase64�LcCst|j|�S)N)�_encode_base64r?)r�
maxlinelengthrrr�asBase64�sz
Data.asBase64cCs4t||j�r|j|jkSt|t�r,|j|kStSdS)N)r+r)r?rB�NotImplemented)r�otherrrr�__eq__�s


zData.__eq__cCsd|jjt|j�fS)Nz%s(%s))r)r"�reprr?)rrrr�__repr__�sz
Data.__repr__N)rF)
r"r#r$r8r'r9rErIrLrNrrrrr�s
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]rFcCsT|dd}g}x8tdt|�|�D]$}||||�}|jtj|��q"Wdj|�S)N��r�)�range�len�append�binasciiZ
b2a_base64�join)�srHZ
maxbinsize�pieces�i�chunkrrrrGsrGcCs(t|t�rtj|jd��Stj|�SdS)Nzutf-8)r+r,rUZ
a2b_base64�encode)rWrrrrD
s
rDz{(?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))?)?)?)?)?ZcCsNd}tj|�j�}g}x,|D]$}||}|dkr2P|jt|��qWtj|�S)N�year�month�day�hour�minute�second)r\r]r^r_r`ra)�_dateParser�match�	groupdictrT�int�datetime)rW�orderZgdZlst�key�valrrr�_date_from_strings
rjcCs d|j|j|j|j|j|jfS)Nz%04d-%02d-%02dT%02d:%02d:%02dZ)r\r]r^r_r`ra)�drrr�_date_to_string&srlcCsZtj|�}|dk	rtd��|jdd�}|jdd�}|jdd�}|jdd�}|jd	d
�}|S)Nz<strings can't contains control characters; use bytes insteadz
�
�
�&z&amp;�<z&lt;�>z&gt;)�_controlCharPat�search�
ValueError�replace)�text�mrrr�_escape,s
rxc@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'S)(�_PlistParsercCs"g|_d|_d|_||_||_dS)N)�stack�current_key�root�_use_builtin_types�
_dict_type)rr;r<rrrr'9s
z_PlistParser.__init__cCs8t�|_|j|j_|j|j_|j|j_|jj|�|j	S)N)
r�parser�handle_begin_elementZStartElementHandler�handle_end_elementZEndElementHandler�handle_dataZCharacterDataHandlerZ	ParseFiler|)rZfileobjrrr�parse@s


z_PlistParser.parsecCs*g|_t|d|d�}|dk	r&||�dS)NZbegin_)r?�getattr)r�element�attrs�handlerrrrr�Hsz!_PlistParser.handle_begin_elementcCs"t|d|d�}|dk	r|�dS)NZend_)r�)rr�r�rrrr�Nsz_PlistParser.handle_end_elementcCs|jj|�dS)N)r?rT)rr?rrrr�Ssz_PlistParser.handle_datacCs�|jdk	rFt|jdti��s.td|jj��||jd|j<d|_nB|jsT||_n4t|jdtg��sxtd|jj��|jdj|�dS)N�zunexpected element at line %d���r�r�r�)	r{r+rz�typertr�CurrentLineNumberr|rT)rrrrr�
add_objectVs
z_PlistParser.add_objectcCsdj|j�}g|_|S)N�)rVr?)rr?rrr�get_datafsz_PlistParser.get_datacCs"|j�}|j|�|jj|�dS)N)r~r�rzrT)rr�rkrrr�
begin_dictms
z_PlistParser.begin_dictcCs*|jrtd|j|jjf��|jj�dS)Nz%missing value for key '%s' at line %d)r{rtrr�rz�pop)rrrr�end_dictrsz_PlistParser.end_dictcCs:|jst|jdti��r,td|jj��|j�|_dS)Nr�zunexpected key at line %dr�)r{r+rzr�rtrr�r�)rrrr�end_keyxsz_PlistParser.end_keycCsg}|j|�|jj|�dS)N)r�rzrT)rr��arrr�begin_array~s
z_PlistParser.begin_arraycCs|jj�dS)N)rzr�)rrrr�	end_array�sz_PlistParser.end_arraycCs|jd�dS)NT)r�)rrrr�end_true�sz_PlistParser.end_truecCs|jd�dS)NF)r�)rrrr�	end_false�sz_PlistParser.end_falsecCs|jt|j���dS)N)r�rer�)rrrr�end_integer�sz_PlistParser.end_integercCs|jt|j���dS)N)r��floatr�)rrrr�end_real�sz_PlistParser.end_realcCs|j|j��dS)N)r�r�)rrrr�
end_string�sz_PlistParser.end_stringcCs2|jr|jt|j���n|jtj|j���dS)N)r}r�rDr�rrE)rrrr�end_data�sz_PlistParser.end_datacCs|jt|j���dS)N)r�rjr�)rrrr�end_date�sz_PlistParser.end_dateN)r"r#r$r'r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrry8s&ryc@s8eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zd	S)�_DumbXMLWriterr�	cCs||_g|_||_||_dS)N)�filerz�
_indent_level�indent)rr��indent_levelr�rrrr'�sz_DumbXMLWriter.__init__cCs,|jj|�|jd|�|jd7_dS)Nz<%s>r�)rzrT�writelnr�)rr�rrr�
begin_element�sz_DumbXMLWriter.begin_elementcCs@|jdkst�|jj�|ks t�|jd8_|jd|�dS)Nrr�z</%s>)r��AssertionErrorrzr�r�)rr�rrr�end_element�sz_DumbXMLWriter.end_elementNcCs8|dk	r&t|�}|jd|||f�n|jd|�dS)Nz<%s>%s</%s>z<%s/>)rxr�)rr�rrrr�simple_element�sz_DumbXMLWriter.simple_elementcCsH|r8t|t�r|jd�}|jj|j|j�|jj|�|jjd�dS)Nzutf-8�
)r+r,r[r�r7r�r�)r�linerrrr��s

z_DumbXMLWriter.writeln)rr�)N)r"r#r$r'r�r�r�r�rrrrr��s


r�c@sFeZdZddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dS)�_PlistWriterr�	r�TFcCs.|r|jt�tj||||�||_||_dS)N)r7�PLISTHEADERr�r'�
_sort_keys�	_skipkeys)rr�r�r�ZwriteHeaderr=r>rrrr'�s

z_PlistWriter.__init__cCs"|jd�|j|�|jd�dS)Nz<plist version="1.0">z</plist>)r��write_value)rrrrrr7�s

z_PlistWriter.writecCs4t|t�r|jd|��n|dkr0|jd��n|dkrD|jd�n�t|t�r�d|ko`dknrx|jd	d
|�nt|��n�t|t�r�|jdt|��n�t|t�r�|j|�n|t|t	�r�|j
|�nft|ttf�r�|j
|�nLt|tj��r|jdt|��n,t|ttf��r |j|�ntd
t|���dS)N�stringT�trueFZfalser��?�@Zintegerz%d�realZdatezunsupported type: %sr�l����l)r+r,r�re�
OverflowErrorr�rM�dict�
write_dictr�
write_datarB�	bytearray�write_bytesrfrl�tuple�list�write_arrayrCr�)rrrrrr��s.





z_PlistWriter.write_valuecCs|j|j�dS)N)r�r?)rr?rrrr��sz_PlistWriter.write_datacCs~|jd�|jd8_tddt|jjdd	�|j��}x&t||�jd�D]}|rL|j|�qLW|jd7_|j	d�dS)
Nr?r��rFr�� �r�s        )
r�r��maxrSr�rurG�splitr�r�)rr?rHr�rrrr��s
z_PlistWriter.write_bytescCs�|rx|jd�|jr"t|j��}n|j�}x@|D]8\}}t|t�sR|jrJq0td��|jd|�|j	|�q0W|j
d�n
|jd�dS)Nr�zkeys must be stringsrh)r�r��sorted�itemsr+r,r�rCr�r�r�)rrkr�rhrrrrr�s

z_PlistWriter.write_dictcCs@|r2|jd�x|D]}|j|�qW|jd�n
|jd�dS)N�array)r�r�r�r�)rr�rrrrr�s

z_PlistWriter.write_arrayN)rr�r�TF)
r"r#r$r'r7r�r�r�r�r�rrrrr��s
%
r�cCs�d	}x|D]}|j|�r
dSq
WxntjdftjdftjdffD]N\}}|j|�sRq>x8|D]0}||jd�j|�}|dt|��|krXdSqXWq>WdS)
N�<?xml�<plistTzutf-8z	utf-16-bez	utf-16-le�asciiF)r�r�)�
startswith�codecs�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LE�decoder[rS)�header�prefixesZpfxZbom�encoding�start�prefixrrr�_is_fmt_xml*s



r�c@seZdZddd�ZdS)r�Invalid filecCstj||�dS)N)rtr')r�messagerrrr'LszInvalidFileException.__init__N)r�)r"r#r$r'rrrrrKs�B�H�L�Q)r�rrOr�c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�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
    cCs||_||_dS)N)r}r~)rr;r<rrrr'[sz_BinaryPlistParser.__init__cCs�y|||_|jjdtj�|jjd�}t|�dkr6t��tjd|�\}|_	}}}|jj|�|j
||�|_tg||_
|j|�Stttjttfk
r�t��YnXdS)N� z>6xBBQQQi��)�_fp�seek�os�SEEK_END�readrSr�struct�unpack�	_ref_size�
_read_ints�_object_offsets�
_undefined�_objects�_read_object�OSError�
IndexError�errorr�rt)rr0�trailer�offset_size�num_objects�
top_object�offset_table_offsetrrrr�_s
z_BinaryPlistParser.parsecCsL|dkrH|jjd�dd@}d|>}dt|}tj||jj|��dS|S)z$ return the size of the next object.�r�rrPrq)r�r��_BINARY_FORMATr�r�)r�tokenLrwrWrArrr�	_get_sizexsz_BinaryPlistParser._get_sizecsv|jj�|���tkr2tjd|�t�����S�sHt���|krNt��t��fdd�td�|��D��SdS)Nrqc3s&|]}tj�||��d�VqdS)�bigN)re�
from_bytes)�.0rY)r?�sizerr�	<genexpr>�sz0_BinaryPlistParser._read_ints.<locals>.<genexpr>r)	r�r�r�r�r�rSrr�rR)r�nr�r)r?r�rr��sz_BinaryPlistParser._read_intscCs|j||j�S)N)r�r�)rr�rrr�
_read_refs�sz_BinaryPlistParser._read_refscs��j|}|tk	r|S�j|}�jj|��jjd�d}|d@|d@}}|dkr^d}�n�|dkrnd}�n||dkr~d	}�nl|dkr�d
}�n\|dkr�tj�jjd|>�d|d
kd�}�n0|dkr�tj	d�jjd��d}�n|dk�rtj	d�jjd��d}�n�|dk�rDtj	d�jjd��d}t
j
ddd�t
j|d�}�n�|dk�r��j|�}�jj|�}t
|�|k�rxt���j�s�t|�}�n^|dk�rΈj|�}�jj|�}	t
|	�|k�r�t��|	jd�}�n|dk�r�j|�d}�jj|�}	t
|	�|k�rt��|	jd�}n�|dk�rX�j|�}�j|�}
g}|�j|<|j�fdd�|
D��n�|d k�r�j|�}�j|�}�j|�}
�j�}|�j|<y2x,t||
�D]\}}
�j|
�|�j|�<�q�WWntk
�r�t��YnXnt��|�j|<|S)!zx
        read the object by reference.

        May recursively read sub-objects (content of an array/dict/set)
        r�r��r�Nr�F�	TrQr�r�rP)�signed�"z>frO�#z>d�3i�)Zsecondsr��Pr��`rzutf-16be�c3s|]}�j|�VqdS)N)r�)r��x)rrrr��sz2_BinaryPlistParser._read_object.<locals>.<genexpr>��)r�r�r�r�r�r�rer�r�r�rfZ	timedeltar�rSrr}rr�r��extendr~�zipr�rC)r�ref�result�offset�tokenZtokenHr�rArWr?Zobj_refsZkey_refs�k�or)rrr��s�


















z_BinaryPlistParser._read_objectN)
r"r#r$r8r'r�r�r�r�r�rrrrr�Ss

r�cCs0|dkrdS|dkrdS|d>d>r(dSdSdS)	Nr�r�r�rr�rO�ir)�countrrr�_count_to_size�src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistWritercCs||_||_||_dS)N)r�r�r�)rr0r=r>rrrr'sz_BinaryPlistWriter.__init__c
Cs�g|_i|_i|_|j|�t|j�}dg||_t|�|_t|j|_	|j
jd�x|jD]}|j|�q\W|j
|�}|j
j�}t|�}dt||}|j
jtj|f|j���d}|||j|||f}	|j
jtjd|	���dS)Nrsbplist00rq�	>5xBBBQQQ)r)�_objlist�	_objtable�_objidtable�_flattenrSr�rr�r��_ref_formatr�r7�
_write_object�
_getrefnum�tellr��pack)
rrr��objr�r�r�Z
offset_formatZsort_versionr�rrrr7
s(





z_BinaryPlistWriter.writec	Cs~t|t�r"t|�|f|jkrZdSn8t|t�rHt|j�|jf|jkrZdSnt|�|jkrZdSt|j	�}|j	j
|�t|t�r�||jt|�|f<n0t|t�r�||jt|j�|jf<n||jt|�<t|t��rPg}g}|j�}|j
r�t|�}xB|D]:\}}t|t��s|j�rq�td��|j
|�|j
|�q�WxLtj||�D]}|j|��q:Wn*t|ttf��rzx|D]}|j|��qfWdS)Nzkeys must be strings)r+�_scalarsr�rrr?�idrrSrrTr�r�r�r�r,r�rC�	itertools�chainrr�r�)	rrZrefnum�keys�valuesr�r�vrrrrr7sB






z_BinaryPlistWriter._flattencCsNt|t�r|jt|�|fSt|t�r<|jt|j�|jfS|jt|�SdS)N)r+r rr�rr?rr!)rrrrrrgs


z_BinaryPlistWriter._getrefnumcCs�|dkr"|jjtjd||B��n�|dkrH|jjtjd|dBd|��nh|dkrn|jjtjd|dBd|��nB|dkr�|jjtjd
|dBd|��n|jjtjd|dBd
|��dS)Nr�z>Br�r�z>BBBr�z>BBH�r�z>BBL�z>BBQ�ril)r�r7r�r)rrr�rrr�_write_sizeosz_BinaryPlistWriter._write_sizecs��j|�}�jj��j|<|dkr2�jjd��n�|dkrJ�jjd��n�|dkrb�jjd��n�t|t��rl|dkr�y�jjtjdd|��Wn tj	k
r�t
|�d�YnXn�|d'krԈjjtjdd|��n�|d(kr�jjtjd
d|��nt|d)k�r�jjtjdd|��nR|d*k�r8�jjtjdd|��n0|d+k�r`�jjd|jdddd��nt
|���nxt|t��r��jjtjdd|���nRt|t
j
��r�|t
j
dd	d	�j�}�jjtjdd|���nt|t��r�jdt|j���jj|j��n�t|ttf��r0�jdt|���jj|��n�t|t��r�y|jd�}�jdt|��Wn4tk
�r�|jd�}�jdt|�d �YnX�jj|��nDt|ttf��r��fd!d"�|D�}t|�}�jd#|��jjtjd$�j|f|���n�t|t��r�gg}}�j�r&t|j��}	n|j�}	xR|	D]J\}
}t|
t��s\�j�rT�q4t d%��|j!�j|
��|j!�j|���q4Wt|�}�jd&|��jjtjd$�j|f|����jjtjd$�j|f|���nt |��dS),N�F�Tr�rz>Bqr)r�r�z>BBr�z>BHr'r�z>BLr(r�z>BQr��r�)rz>Bdri�rr�rzutf-16berrcsg|]}�j|��qSr)r)r�r)rrr�
<listcomp>�sz4_BinaryPlistWriter._write_object.<locals>.<listcomp>rrqzkeys must be stringsrrilll)"rr�rr�r7r+rer�rr�r��to_bytesr�rfZ
total_secondsrr*rSr?rBr�r,r[�UnicodeEncodeErrorr�r�rr�r�r�r�r�rCrT)rrrrA�tZrefsrWZkeyRefsZvalRefsZ	rootItemsrr&r)rrrs�





$
"$z _BinaryPlistWriter._write_objectN)	r"r#r$r'r7rrr*rrrrrrs-0rcCs|dd�dkS)Nr�sbplist00r)r�rrr�_is_fmt_binary�sr2)�detectr�writerT)r:r;r<cCsn|dkrL|jd�}|jd�x:tj�D]}|d|�r&|d}Pq&Wt��nt|d}|||d�}|j|�S)z�Read a .plist file. 'fp' should be (readable) file object.
    Return the unpacked root object (which usually is a dictionary).
    Nr�rr3r)r;r<)r�r��_FORMATSr%rr�)r0r:r;r<r��info�P�prrrr�s

cCst|�}t||||d�S)zqRead a .plist file from a bytes object.
    Return the unpacked root object (which usually is a dictionary).
    )r:r;r<)rr)rr:r;r<r0rrrr
sF)r:r=r>cCs:|tkrtd|f��t|d|||d�}|j|�dS)zQWrite 'value' to a .plist file. 'fp' should be a (writable)
    file object.
    zUnsupported format: %rr4)r=r>N)r5rtr7)rr0r:r=r>r4rrrrs)r:r>r=cCs t�}t|||||d�|j�S)z?Return a bytes object with the contents for a .plist file.
    )r:r>r=)rrr@)rr:r>r=r0rrrrs)rF)Er8�__all__rUr��
contextlibrf�enum�iorr"r��rer��warningsrZxml.parsers.expatr�Enumr"r�globalsr3�__members__r�rr�contextmanagerr1rrrrrrr��compilerrrGrD�ASCIIrbrjrlrxryr�r�r�rtrr��objectr�r�rr,rer�rBr rr2r	r
r5rr
rrrrrr�<module>/sz



0
	
h&d!#
S	
	

?>