Your IP : 18.226.34.148


Current Path : /proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/plistlib.cpython-37.opt-2.pyc

B

YI~d�w�@s*dddddddddd	d
dgZdd
lZdd
lZdd
lZdd
lZdd
lZddlmZdd
lZdd
l	Z	dd
l
Z
dd
lZddlm
Z
ddlmZejdded�Ze��ej�ejdd��Zdd�Zdd�Zdd�Zdd�ZGdd�d�ZdZe
�d�ZdIdd�Z d d!�Z!e
�d"e
j"�Z#d#d$�Z$d%d&�Z%d'd(�Z&Gd)d*�d*�Z'Gd+d,�d,�Z(Gd-d.�d.e(�Z)d/d0�Z*Gd1d�de+�Z,d2d3d4d5d6�Z-e.�Z/Gd7d8�d8�Z0d9d:�Z1e2e3e4eje5fZ6Gd;d<�d<e.�Z7d=d>�Z8e9e:e*e'e)d?�e;e:e8e0e7d?�iZ<d
d@e:dA�dBd�Z=d
d@e:dA�dCd
�Z>e9d@dDdE�dFd	�Z?e9dDd@dG�dHd�Z@d
S)J�	readPlist�
writePlist�readPlistFromBytes�writePlistToBytes�Data�InvalidFileException�FMT_XML�
FMT_BINARY�load�dump�loads�dumps�N)�BytesIO)�warn)�ParserCreate�PlistFormatzFMT_XML FMT_BINARY)�modulec	cs2t|t�r(t||��}|VWdQRXn|VdS)N)�
isinstance�str�open)�
pathOrFile�mode�fp�r�-/opt/alt/python37/lib64/python3.7/plistlib.py�_maybe_openOs
rc	Cs0tdtd�t|d��}t|ddd�SQRXdS)Nz8The readPlist function is deprecated, use load() instead��rbF)�fmt�use_builtin_types)r�DeprecationWarningrr	)rrrrrrYsc	Cs8tdtd�t|d��}t||tddd�WdQRXdS)Nz9The writePlist function is deprecated, use dump() insteadr�wbTF)r�	sort_keys�skipkeys)rr rr
r)�valuerrrrrrfscCstdtd�tt|�ddd�S)NzBThe readPlistFromBytes function is deprecated, use loads() insteadrF)rr)rr r	r)�datarrrrsscCs,tdtd�t�}t||tddd�|��S)NzAThe writePlistToBytes function is deprecated, use dumps() insteadrTF)rr"r#)rr rr
r�getvalue)r$�frrrr~s
c@s:eZdZdd�Zedd��Zd
dd�Zdd	�Zd
d�ZdS)rcCst|t�std��||_dS)Nzdata must be as bytes)r�bytes�	TypeErrorr%)�selfr%rrr�__init__�s
z
Data.__init__cCs|t|��S)N)�_decode_base64)�clsr%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�	__class__r%r(�NotImplemented)r*�otherrrr�__eq__�s


zData.__eq__cCsd|jjt|j�fS)Nz%s(%s))r3�__name__�reprr%)r*rrr�__repr__�sz
Data.__repr__N)r/)	r7�
__module__�__qualname__r+�classmethodr.r2r6r9rrrrr�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]r/cCsT|dd}g}x8tdt|�|�D]$}||||�}|�t�|��q"Wd�|�S)N��r
�)�range�len�append�binasciiZ
b2a_base64�join)�sr1Z
maxbinsize�pieces�i�chunkrrrr0�sr0cCs(t|t�rt�|�d��St�|�SdS)Nzutf-8)rrrCZ
a2b_base64�encode)rErrrr,�s
r,z{(?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}t�|���}g}x,|D]$}||}|dkr2P|�t|��qWtj|�S)N)�year�month�day�hour�minute�second)�_dateParser�match�	groupdictrB�int�datetime)rE�order�gdZlst�key�valrrr�_date_from_string�s
rYcCs d|j|j|j|j|j|jfS)Nz%04d-%02d-%02dT%02d:%02d:%02dZ)rJrKrLrMrNrO)�drrr�_date_to_string�sr[cCsZt�|�}|dk	rtd��|�dd�}|�dd�}|�dd�}|�dd�}|�d	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
rgc@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'd(�Zd)S)*�_PlistParsercCs"g|_d|_d|_||_||_dS)N)�stack�current_key�root�_use_builtin_types�
_dict_type)r*r�	dict_typerrrr+�s
z_PlistParser.__init__cCsBt�|_|j|j_|j|j_|j|j_|j|j_	|j�
|�|jS)N)r�parser�handle_begin_elementZStartElementHandler�handle_end_elementZEndElementHandler�handle_dataZCharacterDataHandler�handle_entity_declZEntityDeclHandlerZ	ParseFilerk)r*Zfileobjrrr�parse�s



z_PlistParser.parsecCstd��dS)Nz8XML entity declarations are not supported in plist files)r)r*Zentity_nameZis_parameter_entityr$�baseZ	system_idZ	public_idZ
notation_namerrrrssz_PlistParser.handle_entity_declcCs*g|_t|d|d�}|dk	r&||�dS)NZbegin_)r%�getattr)r*�element�attrs�handlerrrrrpsz!_PlistParser.handle_begin_elementcCs"t|d|d�}|dk	r|�dS)NZend_)rv)r*rwryrrrrqsz_PlistParser.handle_end_elementcCs|j�|�dS)N)r%rB)r*r%rrrrrsz_PlistParser.handle_datacCs�|jdk	rFt|jdti��s.td|jj��||jd|j<d|_nB|jsT||_n4t|jdtg��sxtd|jj��|jd�|�dS)N���zunexpected element at line %d)	rjrri�typercro�CurrentLineNumberrkrB)r*r$rrr�
add_objects
z_PlistParser.add_objectcCsd�|j�}g|_|S)N�)rDr%)r*r%rrr�get_data,sz_PlistParser.get_datacCs"|��}|�|�|j�|�dS)N)rmr}rirB)r*rxrZrrr�
begin_dict3s
z_PlistParser.begin_dictcCs*|jrtd|j|jjf��|j��dS)Nz%missing value for key '%s' at line %d)rjrcror|ri�pop)r*rrr�end_dict8sz_PlistParser.end_dictcCs8|jst|jdti��s*td|jj��|��|_dS)Nrzzunexpected key at line %d)rjrrir{rcror|r)r*rrr�end_key>sz_PlistParser.end_keycCsg}|�|�|j�|�dS)N)r}rirB)r*rx�arrr�begin_arrayDs
z_PlistParser.begin_arraycCs|j��dS)N)rir�)r*rrr�	end_arrayIsz_PlistParser.end_arraycCs|�d�dS)NT)r})r*rrr�end_trueLsz_PlistParser.end_truecCs|�d�dS)NF)r})r*rrr�	end_falseOsz_PlistParser.end_falsecCs|�t|����dS)N)r}rSr)r*rrr�end_integerRsz_PlistParser.end_integercCs|�t|����dS)N)r}�floatr)r*rrr�end_realUsz_PlistParser.end_realcCs|�|���dS)N)r}r)r*rrr�
end_stringXsz_PlistParser.end_stringcCs2|jr|�t|����n|�t�|����dS)N)rlr}r,rrr.)r*rrr�end_data[sz_PlistParser.end_datacCs|�t|����dS)N)r}rYr)r*rrr�end_datebsz_PlistParser.end_dateN)r7r:r;r+rtrsrprqrrr}rr�r�r�r�r�r�r�r�r�r�r�r�rrrrrh�s(	rhc@s8eZdZddd�Zdd�Zdd�Zdd
d�Zdd
�Zd	S)�_DumbXMLWriterr
�	cCs||_g|_||_||_dS)N)�fileri�
_indent_level�indent)r*r��indent_levelr�rrrr+gsz_DumbXMLWriter.__init__cCs,|j�|�|�d|�|jd7_dS)Nz<%s>�)rirB�writelnr�)r*rwrrr�
begin_elementmsz_DumbXMLWriter.begin_elementcCs |jd8_|�d|�dS)Nr�z</%s>)r�r�)r*rwrrr�end_elementrsz_DumbXMLWriter.end_elementNcCs8|dk	r&t|�}|�d|||f�n|�d|�dS)Nz<%s>%s</%s>z<%s/>)rgr�)r*rwr$rrr�simple_elementxsz_DumbXMLWriter.simple_elementcCsH|r8t|t�r|�d�}|j�|j|j�|j�|�|j�d�dS)Nzutf-8�
)rrrIr��writer�r�)r*�linerrrr��s

z_DumbXMLWriter.writeln)r
r�)N)r7r:r;r+r�r�r�r�rrrrr�fs


r�c@sFeZdZddd�Zdd	�Zd
d�Zdd
�Zdd�Zdd�Zdd�Z	dS)�_PlistWriterr
�	r�TFcCs.|r|�t�t�||||�||_||_dS)N)r��PLISTHEADERr�r+�
_sort_keys�	_skipkeys)r*r�r�r�ZwriteHeaderr"r#rrrr+�s

z_PlistWriter.__init__cCs"|�d�|�|�|�d�dS)Nz<plist version="1.0">z</plist>)r��write_value)r*r$rrrr��s

z_PlistWriter.writecCs4t|t�r|�d|��n|dkr0|�d��n|dkrD|�d�n�t|t�r�d|krbdkrxnn|�dd	|�nt|��n�t|t�r�|�d
t|��n�t|t�r�|�|�n|t|t	�r�|�
|�nft|ttf�r�|�
|�nLt|tj��r|�dt|��n,t|ttf��r |�|�ntdt|���dS)
N�stringT�trueFZfalsel����lZintegerz%d�realZdatezunsupported type: %s)rrr�rS�
OverflowErrorr�r8�dict�
write_dictr�
write_datar(�	bytearray�write_bytesrTr[�tuple�list�write_arrayr)r{)r*r$rrrr��s.





z_PlistWriter.write_valuecCs|�|j�dS)N)r�r%)r*r%rrrr��sz_PlistWriter.write_datacCs~|�d�|jd8_tddt|j�dd�|j��}x&t||��d�D]}|rL|�|�qLW|jd7_|�	d�dS)Nr%r��r/r�s        r�)
r�r��maxrAr�rdr0�splitr�r�)r*r%r1r�rrrr��s
z_PlistWriter.write_bytescCs�|rx|�d�|jr"t|���}n|��}x@|D]8\}}t|t�sR|jrJq0td��|�d|�|�	|�q0W|�
d�n
|�d�dS)Nr�zkeys must be stringsrW)r�r��sorted�itemsrrr�r)r�r�r�)r*rZr�rWr$rrrr��s

z_PlistWriter.write_dictcCs@|r2|�d�x|D]}|�|�qW|�d�n
|�d�dS)N�array)r�r�r�r�)r*r�r$rrrr��s

z_PlistWriter.write_arrayN)r
r�r�TF)
r7r:r;r+r�r�r�r�r�r�rrrrr��s
%
r�cCs�d}x|D]}|�|�r
dSq
WxntjdftjdftjdffD]N\}}|�|�sRq>x8|D]0}||�d��|�}|dt|��|krXdSqXWq>WdS)N)s<?xmls<plistTzutf-8z	utf-16-bez	utf-16-le�asciiF)�
startswith�codecs�BOM_UTF8�BOM_UTF16_BE�BOM_UTF16_LE�decoderIrA)�header�prefixesZpfxZbom�encoding�start�prefixrrr�_is_fmt_xml�s



r�c@seZdZddd�ZdS)r�Invalid filecCst�||�dS)N)rcr+)r*�messagerrrr+szInvalidFileException.__init__N)r�)r7r:r;r+rrrrrs�B�H�L�Q)r�rr=�c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistParsercCs||_||_dS)N)rlrm)r*rrnrrrr+!sz_BinaryPlistParser.__init__cCs�y|||_|j�dtj�|j�d�}t|�dkr6t��t�d|�\}|_	}}}|j�|�|�
||�|_tg||_
|�|�Stttjttfk
r�t��YnXdS)Ni��� z>6xBBQQQ)�_fp�seek�os�SEEK_END�readrAr�struct�unpack�	_ref_size�
_read_ints�_object_offsets�
_undefined�_objects�_read_object�OSError�
IndexError�errorr�rc)r*r�trailer�offset_size�num_objects�
top_object�offset_table_offsetrrrrt%s
z_BinaryPlistParser.parsecCsL|dkrH|j�d�dd@}d|>}dt|}t�||j�|��dS|S)N�r�r
r>r`)r�r��_BINARY_FORMATr�r�)r*�tokenLrfrEr'rrr�	_get_size>sz_BinaryPlistParser._get_sizecst|j��|���tkr2t�d|�t�����S�rFt���|krLt��t��fdd�td�|��D��SdS)Nr`c3s&|]}t��||��d�VqdS)�bigN)rS�
from_bytes)�.0rG)r%�sizerr�	<genexpr>Osz0_BinaryPlistParser._read_ints.<locals>.<genexpr>r
)	r�r�r�r�r�rArr�r@)r*�nr�r)r%r�rr�Hsz_BinaryPlistParser._read_intscCs|�||j�S)N)r�r�)r*r�rrr�
_read_refsRsz_BinaryPlistParser._read_refscs��j|}|tk	r|S�j|}�j�|��j�d�d}|d@|d@}}|dkr^d}�n�|dkrnd}�n||dkr~d}�nl|dkr�d	}�n\|d
kr�tj�j�d|>�d|dkd
�}�n0|dkr�t�	d�j�d��d}�n|dk�rt�	d�j�d��d}�n�|dk�rDt�	d�j�d��d}t
�
ddd�t
j|d�}�n�|dk�r���|�}�j�|�}t
|�|k�rxt���j�s�t|�}�n^|dk�rΈ�|�}�j�|�}	t
|	�|k�r�t��|	�d�}�n|dk�r��|�d}�j�|�}	t
|	�|k�rt��|	�d�}n�|dk�rX��|�}��|�}
g}|�j|<|��fdd�|
D��n�|dk�r��|�}��|�}��|�}
���}|�j|<y2x,t||
�D]\}}
��|
�|��|�<�q�WWntk
�r�t��YnXnt��|�j|<|S) Nr�r
��r�r�F�	Tr?r�r�r>)�signed�"z>fr=�#z>d�3i�)Zseconds�@�Pr��`rzutf-16be�c3s|]}��|�VqdS)N)r�)r��x)r*rrr��sz2_BinaryPlistParser._read_object.<locals>.<genexpr>��)r�r�r�r�r�r�rSr�r�r�rTZ	timedeltar�rArrlrr�r��extendrm�zipr�r))r*�ref�result�offset�tokenZtokenHr�r'rEr%Zobj_refsZkey_refs�k�or)r*rr�Us�


















z_BinaryPlistParser._read_objectN)	r7r:r;r+rtr�r�r�r�rrrrr�s

r�cCs0|dkrdS|dkrdS|d>d>r(dSdSdS)N�r�irr�r=r�r)�countrrr�_count_to_size�src@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�_BinaryPlistWritercCs||_||_||_dS)N)r�r�r�)r*rr"r#rrrr+�sz_BinaryPlistWriter.__init__c
Cs�g|_i|_i|_|�|�t|j�}dg||_t|�|_t|j|_	|j
�d�x|jD]}|�|�q\W|�
|�}|j
��}t|�}dt||}|j
�tj|f|j���d}|||j|||f}	|j
�tjd|	���dS)Nr
sbplist00r`�	>5xBBBQQQ)r)�_objlist�	_objtable�_objidtable�_flattenrAr�rr�r��_ref_formatr�r��
_write_object�
_getrefnum�tellr��pack)
r*r$r��objr�r�r�Z
offset_formatZsort_versionr�rrrr��s(





z_BinaryPlistWriter.writec	Cs~t|t�r"t|�|f|jkrZdSn8t|t�rHt|j�|jf|jkrZdSnt|�|jkrZdSt|j	�}|j	�
|�t|t�r�||jt|�|f<n0t|t�r�||jt|j�|jf<n||jt|�<t|t��rPg}g}|��}|j
r�t|�}xB|D]:\}}t|t��s|j�rq�td��|�
|�|�
|�q�WxLt�||�D]}|�|��q:Wn*t|ttf��rzx|D]}|�|��qfWdS)Nzkeys must be strings)r�_scalarsr{rrr%�idrrArrBr�r�r�r�rr�r)�	itertools�chainrr�r�)	r*r$Zrefnum�keys�valuesr�r��vr�rrrr�sB






z_BinaryPlistWriter._flattencCsNt|t�r|jt|�|fSt|t�r<|jt|j�|jfS|jt|�SdS)N)rrrr{rr%rr)r*r$rrrr
-s


z_BinaryPlistWriter._getrefnumcCs�|dkr"|j�t�d||B��n�|dkrH|j�t�d|dBd|��nh|dkrn|j�t�d|dBd|��nB|d	kr�|j�t�d
|dBd|��n|j�t�d|dBd
|��dS)Nr�z>Br�z>BBBr�iz>BBH�lz>BBL�z>BBQ�)r�r�r�r)r*r�r�rrr�_write_size5sz_BinaryPlistWriter._write_sizecs���|�}�j���j|<|dkr2�j�d��n�|dkrJ�j�d��n�|dkrb�j�d��n�t|t��rl|dkr�y�j�t�dd|��Wn tj	k
r�t
|�d�YnXn�|d	krԈj�t�d
d|��n�|dkr�j�t�d
d|��nt|dk�r�j�t�dd|��nR|dk�r8�j�t�dd|��n0|dk�r`�j�d|jdddd��nt
|���nxt|t��r��j�t�dd|���nRt|t
j
��r�|t
�
ddd���}�j�t�dd|���nt|t��r��dt|j���j�|j��n�t|ttf��r0��dt|���j�|��n�t|t��r�y|�d�}��dt|��Wn4tk
�r�|�d �}��d!t|�d"�YnX�j�|��nDt|ttf��r��fd#d$�|D�}t|�}��d%|��j�tjd&�j|f|���n�t|t��r�gg}}�j�r&t|���}	n|��}	xR|	D]J\}
}t|
t��s\�j�rT�q4t d'��|�!��|
��|�!��|���q4Wt|�}��d(|��j�tjd&�j|f|����j�tjd&�j|f|���nt |��dS))N�F�Tr�r
z>Bqrr�z>BBr�iz>BHrlz>BLrlz>BQl�r�)r�z>Bdr�i�r�r�r�r�r�zutf-16ber�rcsg|]}��|��qSr)r
)r�r�)r*rr�
<listcomp>~sz4_BinaryPlistWriter._write_object.<locals>.<listcomp>r�r`zkeys must be stringsr�)"r
r�rr�r�rrSr�rr�r��to_bytesr�rTZ
total_secondsrrrAr%r(r�rrI�UnicodeEncodeErrorr�r�rr�r�r�r�r�r)rB)r*r$r�r'�tZrefsrEZkeyRefsZvalRefsZ	rootItemsr�rr)r*rr	Es�





$
"$z _BinaryPlistWriter._write_objectN)	r7r:r;r+r�rr
rr	rrrrr�s-0rcCs|dd�dkS)Nr�sbplist00r)r�rrr�_is_fmt_binary�sr )�detectro�writerT)rrrncCsn|dkrL|�d�}|�d�x:t��D]}|d|�r&|d}Pq&Wt��nt|d}|||d�}|�|�S)Nr�r
r!ro)rrn)r�r��_FORMATSrrrt)rrrrnr��info�P�prrrr	�s

cCst|�}t||||d�S)N)rrrn)rr	)r$rrrnrrrrr�sF)rr"r#cCs:|tkrtd|f��t|d|||d�}|�|�dS)NzUnsupported format: %rr")r"r#)r#rcr�)r$rrr"r#r"rrrr
�s)rr#r"cCs t�}t|||||d�|��S)N)rr#r")rr
r&)r$rr#r"rrrrr�s)r/)A�__all__rCr��
contextlibrT�enum�iorrr��rer��warningsrZxml.parsers.expatr�Enumr7r�globals�update�__members__�contextmanagerrrrrrrr��compilerar0r,�ASCIIrPrYr[rgrhr�r�r�rcrr��objectr�r�rrrSr�r(rrr rr�rr#r	rr
rrrrr�<module>1sr




0
	
o&d!#
S	
	

?>