AlkantarClanX12

Your IP : 3.144.89.152


Current Path : /opt/alt/python33/lib64/python3.3/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/__pycache__/plistlib.cpython-33.pyc

�
��f�9c@swdZdddddddgZdd	lZdd	lZdd
lmZdd	lZdd�Zdd�Zd
d�Z	dd�Z
Gdd�d�Zejdej
�Zdd�Zdd�Zejd�Zdd�ZdZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�Zd d!d"�ZGd#d�d�ZGd$d%�d%�Zd	S(&uplistlib.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 writePlist(rootObject, pathOrFile)
function. 'rootObject' is the top level object, 'pathOrFile' is a
filename or a (writable) file object.

To parse a plist from a file, use the readPlist(pathOrFile) function,
with a file name or 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 readPlistFromBytes()
and writePlistToBytes().

Values can be strings, integers, floats, booleans, tuples, lists,
dictionaries (but only with string keys), Data or datetime.datetime objects.
String values (including dictionary keys) have to be unicode strings -- they
will be written out as UTF-8.

The <data> plist type is supported through the Data class. This is a
thin wrapper around a Python bytes object. Use 'Data' if your strings
contain control characters.

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 = Data(b"<binary gunk>"),
        someMoreData = Data(b"<lots of binary gunk>" * 10),
        aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
    )
    writePlist(pl, fileName)

Parse Plist example:

    pl = readPlist(pathOrFile)
    print pl["aKey"]
u	readPlistu
writePlistureadPlistFromBytesuwritePlistToBytesuPlistuDatauDictiN(uBytesIOc
Csdd}zCt|t�r0t|d�}d}nt�}|j|�}Wd|r_|j�nX|S(u�Read a .plist file. 'pathOrFile' may either be a file name or a
    (readable) file object. Return the unpacked root object (which
    usually is a dictionary).
    urbNFT(uFalseu
isinstanceustruopenuTrueuPlistParseruparseuclose(u
pathOrFileudidOpenupu
rootObject((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu	readPlistAs		c
Csd}z^t|t�r0t|d�}d}nt|�}|jd�|j|�|jd�Wd|rz|j�nXdS(uqWrite 'rootObject' to a .plist file. 'pathOrFile' may either be a
    file name or a (writable) file object.
    uwbu<plist version="1.0">u</plist>NFT(	uFalseu
isinstanceustruopenuTrueuPlistWriteruwritelnu
writeValueuclose(u
rootObjectu
pathOrFileudidOpenuwriter((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
writePlistSs	

cCstt|��S(uCRead a plist data from a bytes object. Return the root object.
    (u	readPlistuBytesIO(udata((u-/opt/alt/python33/lib64/python3.3/plistlib.pyureadPlistFromBytesescCs t�}t||�|j�S(u;Return 'rootObject' as a plist-formatted bytes object.
    (uBytesIOu
writePlistugetvalue(u
rootObjectuf((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuwritePlistToBytesks	
cBsY|EeZdZdddd�Zdd�Zdd�Zd
d	d
�Zdd�Zd
S(u
DumbXMLWriteriu	cCs(||_g|_||_||_dS(N(ufileustackuindentLeveluindent(uselfufileuindentLeveluindent((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__init__ts			uDumbXMLWriter.__init__cCs4|jj|�|jd|�|jd7_dS(Nu<%s>i(ustackuappenduwritelnuindentLevel(uselfuelement((u-/opt/alt/python33/lib64/python3.3/plistlib.pyubeginElementzsuDumbXMLWriter.beginElementcCsT|jdkst�|jj�|ks0t�|jd8_|jd|�dS(Niiu</%s>(uindentLeveluAssertionErrorustackupopuwriteln(uselfuelement((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
endElementsuDumbXMLWriter.endElementcCsJ|dk	r5t|�}|jd|||f�n|jd|�dS(Nu<%s>%s</%s>u<%s/>(uNoneu_escapeuwriteln(uselfuelementuvalue((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
simpleElement�suDumbXMLWriter.simpleElementcCsh|rTt|t�r'|jd�}n|jj|j|j�|jj|�n|jjd�dS(Nuutf-8s
(u
isinstanceustruencodeufileuwriteuindentLeveluindent(uselfuline((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuwriteln�suDumbXMLWriter.writelnN(	u__name__u
__module__u__qualname__u__init__ubeginElementu
endElementuNoneu
simpleElementuwriteln(u
__locals__((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
DumbXMLWriterss
u
DumbXMLWriteru{(?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))?)?)?)?)?ZcCsld}tj|�j�}g}x;|D]3}||}|dkrHPn|jt|��q(Wtj|�S(Nuyearumonthudayuhouruminuteusecond(uyearumonthudayuhouruminuteusecond(u_dateParserumatchu	groupdictuNoneuappenduintudatetime(usuorderugdulstukeyuval((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu_dateFromString�s

u_dateFromStringcCs,d|j|j|j|j|j|jfS(Nu%04d-%02d-%02dT%02d:%02d:%02dZ(uyearumonthudayuhouruminuteusecond(ud((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
_dateToString�su
_dateToStringuv[\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]cCs�tj|�}|dk	r*td��n|jdd�}|jdd�}|jdd�}|jdd�}|jd	d
�}|S(NuDstrings can't contains control characters; use plistlib.Data insteadu
u
u
u&u&amp;u<u&lt;u>u&gt;(u_controlCharPatusearchuNoneu
ValueErrorureplace(utextum((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu_escape�su_escapes�<?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">
cBsY|EeZdZddddd�Zdd�Zdd	�Zd
d�Zdd
�ZdS(uPlistWriteris	icCs0|r|jt�ntj||||�dS(N(uwriteuPLISTHEADERu
DumbXMLWriteru__init__(uselfufileuindentLeveluindentuwriteHeader((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__init__�suPlistWriter.__init__cCsMt|t�r"|jd|�n't|t�rW|rG|jd�qI|jd�n�t|t�r}|jdd|�n�t|t�r�|jdt|��n�t|t�r�|j|�n�t|t	�r�|j
|�nft|tj�r|jdt|��n;t|t
tf�r3|j|�ntdt|���dS(	Nustringutrueufalseuintegeru%durealudateuunsupported type: %s(u
isinstanceustru
simpleElementubooluintufloatureprudictu	writeDictuDatau	writeDataudatetimeu
_dateToStringutupleulistu
writeArrayu	TypeErrorutype(uselfuvalue((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
writeValue�s&uPlistWriter.writeValuecCs�|jd�|jd8_tddt|jjdd	�|j��}x6|j|�jd�D]}|rd|j|�qdqdW|jd7_|j	d�dS(
NudataiiiLs	s is
s        (
ubeginElementuindentLevelumaxulenuindentureplaceuasBase64usplituwritelnu
endElement(uselfudatau
maxlinelengthuline((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu	writeData�s
uPlistWriter.writeDatacCs�|r�|jd�t|j��}xO|D]G\}}t|t�sVtd��n|jd|�|j|�q,W|jd�n
|jd�dS(Nudictukeys must be stringsukey(	ubeginElementusorteduitemsu
isinstanceustru	TypeErroru
simpleElementu
writeValueu
endElement(uselfuduitemsukeyuvalue((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu	writeDict�s
uPlistWriter.writeDictcCsR|rA|jd�x|D]}|j|�qW|jd�n
|jd�dS(Nuarray(ubeginElementu
writeValueu
endElementu
simpleElement(uselfuarrayuvalue((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
writeArray�s

uPlistWriter.writeArrayN(u__name__u
__module__u__qualname__u__init__u
writeValueu	writeDatau	writeDictu
writeArray(u
__locals__((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuPlistWriter�s

uPlistWritercBs8|EeZdZdd�Zdd�Zdd�ZdS(u
_InternalDictcCsSy||}Wntk
r.t|��YnXddlm}|dtd�|S(Ni(uwarnuLAttribute access from plist dicts is deprecated, use d[key] notation insteadi(uKeyErroruAttributeErroruwarningsuwarnuDeprecationWarning(uselfuattruvalueuwarn((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__getattr__s

u_InternalDict.__getattr__cCs.ddlm}|dtd�|||<dS(Ni(uwarnuLAttribute access from plist dicts is deprecated, use d[key] notation insteadi(uwarningsuwarnuDeprecationWarning(uselfuattruvalueuwarn((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__setattr__s
u_InternalDict.__setattr__cCsPy||=Wntk
r+t|��YnXddlm}|dtd�dS(Ni(uwarnuLAttribute access from plist dicts is deprecated, use d[key] notation insteadi(uKeyErroruAttributeErroruwarningsuwarnuDeprecationWarning(uselfuattruwarn((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__delattr__s
u_InternalDict.__delattr__N(u__name__u
__module__u__qualname__u__getattr__u__setattr__u__delattr__(u
__locals__((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
_InternalDicts
u
_InternalDictcs&|EeZdZ�fdd�Z�S(uDictcs4ddlm}|dtd�t�j|�dS(Ni(uwarnu?The plistlib.Dict class is deprecated, use builtin dict insteadi(uwarningsuwarnuDeprecationWarningusuperu__init__(uselfukwargsuwarn(u	__class__(u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__init__'s
u
Dict.__init__(u__name__u
__module__u__qualname__u__init__(u
__locals__((u	__class__u-/opt/alt/python33/lib64/python3.3/plistlib.pyuDict%scsP|EeZdZdZ�fdd�Zdd�Zee�Zdd�Z�S(uPlistu�This class has been deprecated. Use readPlist() and writePlist()
    functions instead, together with regular dict objects.
    cs4ddlm}|dtd�t�j|�dS(Ni(uwarnuUThe Plist class is deprecated, use the readPlist() and writePlist() functions insteadi(uwarningsuwarnuDeprecationWarningusuperu__init__(uselfukwargsuwarn(u	__class__(u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__init__4s
uPlist.__init__cCs&t|�}|�}|j|�|S(u1Deprecated. Use the readPlist() function instead.(u	readPlistuupdate(uclsu
pathOrFileu
rootObjectuplist((u-/opt/alt/python33/lib64/python3.3/plistlib.pyufromFile:s	
uPlist.fromFilecCst||�dS(u2Deprecated. Use the writePlist() function instead.N(u
writePlist(uselfu
pathOrFile((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuwriteBsuPlist.write(u__name__u
__module__u__qualname__u__doc__u__init__ufromFileuclassmethoduwrite(u
__locals__((u	__class__u-/opt/alt/python33/lib64/python3.3/plistlib.pyuPlist.s
iLcCsn|dd}g}xJtdt|�|�D]0}||||�}|jtj|��q-Wdj|�S(Niiis(urangeulenuappendubinasciiu
b2a_base64ujoin(usu
maxlinelengthu
maxbinsizeupiecesuiuchunk((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
_encodeBase64Gsu
_encodeBase64cBs_|EeZdZdZdd�Zedd��Zddd�Zd	d
�Zdd�Z	d
S(uDatauWrapper for binary data.cCs+t|t�std��n||_dS(Nudata must be as bytes(u
isinstanceubytesu	TypeErrorudata(uselfudata((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__init__Tsu
Data.__init__cCs|tj|��S(N(ubinasciiu
a2b_base64(uclsudata((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
fromBase64YsuData.fromBase64iLcCst|j|�S(N(u
_encodeBase64udata(uselfu
maxlinelength((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuasBase64_su
Data.asBase64cCsXt||j�r"|j|jkSt|t�r>|j|kSt|�t|�kSdS(N(u
isinstanceu	__class__udataustruid(uselfuother((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__eq__bs

uData.__eq__cCsd|jjt|j�fS(Nu%s(%s)(u	__class__u__name__ureprudata(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__repr__jsu
Data.__repr__N(
u__name__u
__module__u__qualname__u__doc__u__init__uclassmethodu
fromBase64uasBase64u__eq__u__repr__(u
__locals__((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuDataPscBs�|EeZdZdd�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((uPlistParsercCsg|_d|_d|_dS(N(ustackuNoneu
currentKeyuroot(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu__init__os		uPlistParser.__init__cCs`ddlm}|�|_|j|j_|j|j_|j|j_|jj	|�|j
S(Ni(uParserCreate(uxml.parsers.expatuParserCreateuparseruhandleBeginElementuStartElementHandleruhandleEndElementuEndElementHandleru
handleDatauCharacterDataHandleru	ParseFileuroot(uselfufileobjuParserCreate((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuparsetsuPlistParser.parsecCs<g|_t|d|d�}|dk	r8||�ndS(Nubegin_(udataugetattruNone(uselfuelementuattrsuhandler((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuhandleBeginElement}s	uPlistParser.handleBeginElementcCs0t|d|d�}|dk	r,|�ndS(Nuend_(ugetattruNone(uselfuelementuhandler((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuhandleEndElement�suPlistParser.handleEndElementcCs|jj|�dS(N(udatauappend(uselfudata((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
handleData�suPlistParser.handleDatacCs�|jdk	rdt|jdti��sDtd|jj��n||jd|j<d|_n^|jsy||_nIt|jdtg��s�td|jj��n|jdj	|�dS(Niuunexpected element at line %di����i����i����i����(
u
currentKeyuNoneu
isinstanceustackutypeu
ValueErroruparseruCurrentLineNumberurootuappend(uselfuvalue((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu	addObject�s	uPlistParser.addObjectcCsdj|j�}g|_|S(Nu(ujoinudata(uselfudata((u-/opt/alt/python33/lib64/python3.3/plistlib.pyugetData�s	uPlistParser.getDatacCs*t�}|j|�|jj|�dS(N(u
_InternalDictu	addObjectustackuappend(uselfuattrsud((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
begin_dict�s	
uPlistParser.begin_dictcCs<|jr+td|j|jjf��n|jj�dS(Nu%missing value for key '%s' at line %d(u
currentKeyu
ValueErroruparseruCurrentLineNumberustackupop(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuend_dict�s	uPlistParser.end_dictcCsR|js&t|jdti��r?td|jj��n|j�|_dS(Niuunexpected key at line %di����(u
currentKeyu
isinstanceustackutypeu
ValueErroruparseruCurrentLineNumberugetData(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuend_key�s&uPlistParser.end_keycCs'g}|j|�|jj|�dS(N(u	addObjectustackuappend(uselfuattrsua((u-/opt/alt/python33/lib64/python3.3/plistlib.pyubegin_array�s
uPlistParser.begin_arraycCs|jj�dS(N(ustackupop(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu	end_array�suPlistParser.end_arraycCs|jd�dS(NT(u	addObjectuTrue(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuend_true�suPlistParser.end_truecCs|jd�dS(NF(u	addObjectuFalse(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu	end_false�suPlistParser.end_falsecCs|jt|j���dS(N(u	addObjectuintugetData(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuend_integer�suPlistParser.end_integercCs|jt|j���dS(N(u	addObjectufloatugetData(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuend_real�suPlistParser.end_realcCs|j|j��dS(N(u	addObjectugetData(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu
end_string�suPlistParser.end_stringcCs)|jtj|j�jd���dS(Nuutf-8(u	addObjectuDatau
fromBase64ugetDatauencode(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuend_data�suPlistParser.end_datacCs|jt|j���dS(N(u	addObjectu_dateFromStringugetData(uself((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuend_date�suPlistParser.end_dateN(u__name__u
__module__u__qualname__u__init__uparseuhandleBeginElementuhandleEndElementu
handleDatau	addObjectugetDatau
begin_dictuend_dictuend_keyubegin_arrayu	end_arrayuend_trueu	end_falseuend_integeruend_realu
end_stringuend_datauend_date(u
__locals__((u-/opt/alt/python33/lib64/python3.3/plistlib.pyuPlistParserms&	uPlistParser(u__doc__u__all__ubinasciiudatetimeuiouBytesIOureu	readPlistu
writePlistureadPlistFromBytesuwritePlistToBytesu
DumbXMLWriterucompileuASCIIu_dateParseru_dateFromStringu
_dateToStringu_controlCharPatu_escapeuPLISTHEADERuPlistWriterudictu
_InternalDictuDictuPlistu
_encodeBase64uDatauPlistParser(((u-/opt/alt/python33/lib64/python3.3/plistlib.pyu<module>2s2&	B