Hacked By AnonymousFox

Current Path : /proc/thread-self/root/usr/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/usr/lib64/python2.7/plistlib.pyc

�
zfc	@s�dZddddddddd	g	Zd
dlZd
dlZd
dlmZd
dlZd
dlZd
�Zd�Z	d�Z
d�Zddd�Zddd�Z
dd*d��YZejd�Zd�Zd�Zejd�Zd�ZdZdefd��YZdefd ��YZd	efd!��YZdefd"��YZd#d$�Zdd+d%��YZd&efd'��YZd(d,d)��YZdS(-s�plistlib.py -- a tool to generate and parse MacOSX .plist files.

The PropertyList (.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 strings, you can use readPlistFromString()
and writePlistToString().

Values can be strings, integers, floats, booleans, tuples, lists,
dictionaries, Data or datetime.datetime objects. String values (including
dictionary keys) may 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 string.

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=u'M\xe4ssig, Ma\xdf',
            aTrueValue=True,
            aFalseValue=False,
        ),
        someData=Data("<binary gunk>"),
        someMoreData=Data("<lots of binary gunk>" * 10),
        aDate=datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
    )
    # unicode keys are possible, but a little awkward to use:
    pl[u'\xc5benraa'] = "That was a unicode key."
    writePlist(pl, fileName)

Parse Plist example:

    pl = readPlist(pathOrFile)
    print pl["aKey"]
t	readPlistt
writePlisttreadPlistFromStringtwritePlistToStringtreadPlistFromResourcetwritePlistToResourcetPlisttDatatDicti����N(tStringIOcCs_d}t|ttf�r0t|�}d}nt�}|j|�}|r[|j�n|S(s�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).
    ii(t
isinstancetstrtunicodetopentPlistParsertparsetclose(t
pathOrFiletdidOpentpt
rootObject((s /usr/lib64/python2.7/plistlib.pyRDs		
cCs}d}t|ttf�r3t|d�}d}nt|�}|jd�|j|�|jd�|ry|j�ndS(sqWrite 'rootObject' to a .plist file. 'pathOrFile' may either be a
    file name or a (writable) file object.
    itwis<plist version="1.0">s</plist>N(R
RRR
tPlistWritertwritelnt
writeValueR(RRRtwriter((s /usr/lib64/python2.7/plistlib.pyRTs	


cCstt|��S(s=Read a plist data from a string. Return the root object.
    (RR	(tdata((s /usr/lib64/python2.7/plistlib.pyRdscCs t�}t||�|j�S(s5Return 'rootObject' as a plist-formatted string.
    (R	Rtgetvalue(Rtf((s /usr/lib64/python2.7/plistlib.pyRjs	
tplstic
Cs�tjddd�ddlm}m}ddlm}ddlm}||�}|j	||�|�}|j
|�|j||�j}	|j
|�t|	�S(s7Read plst resource from the resource fork of path.
    s)In 3.x, readPlistFromResource is removed.t
stacklevelii����(tFSReftFSGetResourceForkName(tfsRdPerm(tRes(twarningstwarnpy3ktCarbon.FileRR tCarbon.FilesR!tCarbonR"tFSOpenResourceFilet
UseResFiletGet1ResourceRtCloseResFileR(
tpathtrestypetresidRR R!R"tfsReftresNumt	plistData((s /usr/lib64/python2.7/plistlib.pyRrs

cCs�tjddd�ddlm}m}ddlm}ddlm}t	|�}||�}	|j
|	|�|�}
|j|
�y|j||�j
�Wn|jk
r�nX|j|�}|j||d�|j�|j|
�d	S(
sHWrite 'rootObject' as a plst resource to the resource fork of path.
    s(In 3.x, writePlistToResource is removed.Rii����(RR (t
fsRdWrPerm(R"tN(R#R$R%RR R&R2R'R"RR(R)R*tRemoveResourcetErrortResourcetAddResourcet
WriteResourceR+(RR,R-R.RR R2R"R1R/R0tres((s /usr/lib64/python2.7/plistlib.pyR�s 

t
DumbXMLWritercBs>eZddd�Zd�Zd�Zdd�Zd�ZRS(is	cCs(||_g|_||_||_dS(N(tfiletstacktindentLeveltindent(tselfR;R=R>((s /usr/lib64/python2.7/plistlib.pyt__init__�s			cCs4|jj|�|jd|�|jd7_dS(Ns<%s>i(R<tappendRR=(R?telement((s /usr/lib64/python2.7/plistlib.pytbeginElement�scCsT|jdkst�|jj�|ks0t�|jd8_|jd|�dS(Niis</%s>(R=tAssertionErrorR<tpopR(R?RB((s /usr/lib64/python2.7/plistlib.pyt
endElement�scCsJ|dk	r5t|�}|jd|||f�n|jd|�dS(Ns<%s>%s</%s>s<%s/>(tNonet_escapeAndEncodeR(R?RBtvalue((s /usr/lib64/python2.7/plistlib.pyt
simpleElement�scCs?|r+|jj|j|j|d�n|jjd�dS(Ns
(R;twriteR=R>(R?tline((s /usr/lib64/python2.7/plistlib.pyR�s%N(t__name__t
__module__R@RCRFRGRJR(((s /usr/lib64/python2.7/plistlib.pyR:�s
		s{(?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(Ntyeartmonthtdaythourtminutetsecond(RORPRQRRRSRT(t_dateParsertmatcht	groupdictRGRAtinttdatetime(tstordertgdtlsttkeytval((s /usr/lib64/python2.7/plistlib.pyt_dateFromString�s

cCs,d|j|j|j|j|j|jfS(Ns%04d-%02d-%02dT%02d:%02d:%02dZ(RORPRQRRRSRT(td((s /usr/lib64/python2.7/plistlib.pyt
_dateToString�ssv[\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
�}|jd�S(NsDstrings can't contains control characters; use plistlib.Data insteads
s
s
t&s&amp;t<s&lt;t>s&gt;sutf-8(t_controlCharPattsearchRGt
ValueErrortreplacetencode(ttexttm((s /usr/lib64/python2.7/plistlib.pyRH�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">
RcBs>eZdddd�Zd�Zd�Zd�Zd�ZRS(is	icCs0|r|jt�ntj||||�dS(N(RKtPLISTHEADERR:R@(R?R;R=R>twriteHeader((s /usr/lib64/python2.7/plistlib.pyR@�scCsYt|ttf�r(|jd|�n-t|t�r]|rM|jd�qU|jd�n�t|ttf�r�|jdd|�n�t|t�r�|jdt|��n�t|t	�r�|j
|�n�t|t�r�|j|�nft|t
j
�r|jdt|��n;t|ttf�r?|j|�ntdt|���dS(	Ntstringttruetfalsetintegers%dtrealtdatesunsuported type: %s(R
RRRJtboolRXtlongtfloattreprtdictt	writeDictRt	writeDataRYRbttupletlistt
writeArrayt	TypeErrorttype(R?RI((s /usr/lib64/python2.7/plistlib.pyR�s&cCs�|jd�|jd8_tddt|jjdd	�|j��}x6|j|�jd�D]}|rd|j|�qdqdW|jd7_|j	d�dS(
NRiiiLs	t is
s        (
RCR=tmaxtlenR>RitasBase64tsplitRRF(R?Rt
maxlinelengthRL((s /usr/lib64/python2.7/plistlib.pyR{s
cCs�|jd�|j�}|j�xU|D]M\}}t|ttf�sZtd��n|jd|�|j|�q*W|j	d�dS(NRyskeys must be stringsR^(
RCtitemstsortR
RRRRJRRF(R?RaR�R^RI((s /usr/lib64/python2.7/plistlib.pyRzs

cCs<|jd�x|D]}|j|�qW|jd�dS(Ntarray(RCRRF(R?R�RI((s /usr/lib64/python2.7/plistlib.pyR~s

(RMRNR@RR{RzR~(((s /usr/lib64/python2.7/plistlib.pyR�s
			t
_InternalDictcBs#eZd�Zd�Zd�ZRS(cCsOy||}Wntk
r*t|�nXddlm}|dtd�|S(Ni����(twarnsLAttribute access from plist dicts is deprecated, use d[key] notation insteadi(tKeyErrortAttributeErrorR#R�tPendingDeprecationWarning(R?tattrRIR�((s /usr/lib64/python2.7/plistlib.pyt__getattr__)s


cCs.ddlm}|dtd�|||<dS(Ni����(R�sLAttribute access from plist dicts is deprecated, use d[key] notation insteadi(R#R�R�(R?R�RIR�((s /usr/lib64/python2.7/plistlib.pyt__setattr__3s
cCsLy||=Wntk
r't|�nXddlm}|dtd�dS(Ni����(R�sLAttribute access from plist dicts is deprecated, use d[key] notation insteadi(R�R�R#R�R�(R?R�R�((s /usr/lib64/python2.7/plistlib.pyt__delattr__9s

(RMRNR�R�R�(((s /usr/lib64/python2.7/plistlib.pyR�#s	
	cBseZd�ZRS(cKs:ddlm}|dtd�tt|�j|�dS(Ni����(R�s?The plistlib.Dict class is deprecated, use builtin dict insteadi(R#R�R�tsuperRR@(R?tkwargsR�((s /usr/lib64/python2.7/plistlib.pyR@Ds
(RMRNR@(((s /usr/lib64/python2.7/plistlib.pyRBscBs5eZdZd�Zd�Zee�Zd�ZRS(s�This class has been deprecated. Use readPlist() and writePlist()
    functions instead, together with regular dict objects.
    cKs:ddlm}|dtd�tt|�j|�dS(Ni����(R�sUThe Plist class is deprecated, use the readPlist() and writePlist() functions insteadi(R#R�R�R�RR@(R?R�R�((s /usr/lib64/python2.7/plistlib.pyR@Qs
cCs&t|�}|�}|j|�|S(s1Deprecated. Use the readPlist() function instead.(Rtupdate(tclsRRtplist((s /usr/lib64/python2.7/plistlib.pytfromFileWs	
cCst||�dS(s2Deprecated. Use the writePlist() function instead.N(R(R?R((s /usr/lib64/python2.7/plistlib.pyRK_s(RMRNt__doc__R@R�tclassmethodRK(((s /usr/lib64/python2.7/plistlib.pyRKs
		iLcCsk|dd}g}xGtdt|�|�D]-}||||!}|jtj|��q-Wdj|�S(NiiiR3(trangeR�RAtbinasciit
b2a_base64tjoin(RZR�t
maxbinsizetpiecestitchunk((s /usr/lib64/python2.7/plistlib.pyt
_encodeBase64dscBsJeZdZd�Zd�Zee�Zdd�Zd�Zd�ZRS(sWrapper for binary data.cCs
||_dS(N(R(R?R((s /usr/lib64/python2.7/plistlib.pyR@qscCs|tj|��S(N(R�t
a2b_base64(R�R((s /usr/lib64/python2.7/plistlib.pyt
fromBase64tsiLcCst|j|�S(N(R�R(R?R�((s /usr/lib64/python2.7/plistlib.pyR�zscCsat||j�r%t|j|j�St|t�rDt|j|�Stt|�t|��SdS(N(R
t	__class__tcmpRRtid(R?tother((s /usr/lib64/python2.7/plistlib.pyt__cmp__}s
cCsd|jjt|j�fS(Ns%s(%s)(R�RMRxR(R?((s /usr/lib64/python2.7/plistlib.pyt__repr__�s(	RMRNR�R@R�R�R�R�R�(((s /usr/lib64/python2.7/plistlib.pyRms			tInvalidFileExceptioncBseZdd�ZRS(sInvalid filecCstj||�dS(N(RhR@(R?tmessage((s /usr/lib64/python2.7/plistlib.pyR@�s(RMRNR@(((s /usr/lib64/python2.7/plistlib.pyR��sRcBs�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsg|_d|_d|_dS(N(R<RGt
currentKeytroot(R?((s /usr/lib64/python2.7/plistlib.pyR@�s		cCs]ddlm}|�}|j|_|j|_|j|_|j|_	|j
|�|jS(Ni����(tParserCreate(txml.parsers.expatR�thandleBeginElementtStartElementHandlerthandleEndElementtEndElementHandlert
handleDatatCharacterDataHandlerthandle_entity_decltEntityDeclHandlert	ParseFileR�(R?tfileobjR�tparser((s /usr/lib64/python2.7/plistlib.pyR�s	
cCstd��dS(Ns8XML entity declarations are not supported in plist files(R�(R?tentity_nametis_parameter_entityRItbaset	system_idt	public_idt
notation_name((s /usr/lib64/python2.7/plistlib.pyR��scCs<g|_t|d|d�}|dk	r8||�ndS(Ntbegin_(RtgetattrRG(R?RBtattrsthandler((s /usr/lib64/python2.7/plistlib.pyR��s	cCs0t|d|d�}|dk	r,|�ndS(Ntend_(R�RG(R?RBR�((s /usr/lib64/python2.7/plistlib.pyR��scCs|jj|�dS(N(RRA(R?R((s /usr/lib64/python2.7/plistlib.pyR��scCs\|jdk	r/||jd|j<d|_n)|jsD||_n|jdj|�dS(Ni����(R�RGR<R�RA(R?RI((s /usr/lib64/python2.7/plistlib.pyt	addObject�s	cCsFdj|j�}y|jd�}Wntk
r8nXg|_|S(NR3tascii(R�RRjtUnicodeError(R?R((s /usr/lib64/python2.7/plistlib.pytgetData�s
	cCs*t�}|j|�|jj|�dS(N(R�R�R<RA(R?R�Ra((s /usr/lib64/python2.7/plistlib.pyt
begin_dict�s	
cCs|jj�dS(N(R<RE(R?((s /usr/lib64/python2.7/plistlib.pytend_dict�scCs|j�|_dS(N(R�R�(R?((s /usr/lib64/python2.7/plistlib.pytend_key�scCs'g}|j|�|jj|�dS(N(R�R<RA(R?R�ta((s /usr/lib64/python2.7/plistlib.pytbegin_array�s
cCs|jj�dS(N(R<RE(R?((s /usr/lib64/python2.7/plistlib.pyt	end_array�scCs|jt�dS(N(R�tTrue(R?((s /usr/lib64/python2.7/plistlib.pytend_true�scCs|jt�dS(N(R�tFalse(R?((s /usr/lib64/python2.7/plistlib.pyt	end_false�scCs|jt|j���dS(N(R�RXR�(R?((s /usr/lib64/python2.7/plistlib.pytend_integer�scCs|jt|j���dS(N(R�RwR�(R?((s /usr/lib64/python2.7/plistlib.pytend_real�scCs|j|j��dS(N(R�R�(R?((s /usr/lib64/python2.7/plistlib.pyt
end_string�scCs |jtj|j���dS(N(R�RR�R�(R?((s /usr/lib64/python2.7/plistlib.pytend_data�scCs|jt|j���dS(N(R�R`R�(R?((s /usr/lib64/python2.7/plistlib.pytend_date�s(RMRNR@RR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s /usr/lib64/python2.7/plistlib.pyR�s(		
					
												(((( R�t__all__R�RYt	cStringIOR	treR#RRRRRRR:tcompileRUR`RbRfRHRmRRyR�RRR�RRhR�R(((s /usr/lib64/python2.7/plistlib.pyt<module>3s<				$				=		

Hacked By AnonymousFox1.0, Coded By AnonymousFox