-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyc

ó
(WaOc@@sâdZddlmZddlZy(ddljjZeede	ƒZ
Wn[ek
r§ddljj
Zyddlm
Z
Wq¨ek
r£ddlmZ
q¨XnXej
ejejejejejf\Z
ZZZZZddlmZmZmZmZmZdejfd	„ƒYZd
„Zejd„Zej dƒZ!ej d
ƒZ"idd6dd6dd6dd6dd6Z#e#d„Z$e#d„Z%iZ&e&d„Z'd„Z(de*d„Z+de*d„Z,d„Z-dS(sXML externalization support.i(tabsolute_importNt
ParseError(R(t
ExpatError(t
cache_utf8terrorst	inventoryt
lazy_regext
serializert
XMLSerializercB@sheZdZeZd	d	ed„Zd	d„Zd„Z	d„Z
d„Zd„Zd„Z
d„ZRS(
s)Abstract XML object serialize/deserializecC@sOy&|jt|ƒ|d|d|ƒSWn"tk
rJ}tj|ƒ‚nXdS(siRead xml_string into an inventory object.

        :param xml_string: The xml to read.
        :param revision_id: If not-None, the expected revision id of the
            inventory. Some serialisers use this to set the results' root
            revision. This should be supplied for deserialising all
            from-repository inventories so that xml5 inventories that were
            serialised without a revision identifier can be given the right
            revision id (but not for working tree inventories where users can
            edit the data without triggering checksum errors or anything).
        :param entry_cache: An optional cache of InventoryEntry objects. If
            supplied we will look up entries via (file_id, revision_id) which
            should map to a valid InventoryEntry (File/Directory/etc) object.
        :param return_from_cache: Return entries directly from the cache,
            rather than copying them first. This is only safe if the caller
            promises not to mutate the returned inventory entries, but it can
            make some operations significantly faster.
        tentry_cachetreturn_from_cacheN(t_unpack_inventoryt
fromstringRRtUnexpectedInventoryFormat(tselft
xml_stringtrevision_idR	R
te((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytread_inventory_from_string;scC@s[y2z |j|j|ƒddƒSWd|jƒXWn"tk
rV}tj|ƒ‚nXdS(NR(Rt
_read_elementtNonetcloseRRR
(RtfRR((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytread_inventoryVscC@s|j|j|ƒ|ƒdS(N(t_write_elementt_pack_revision(RtrevR((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytwrite_revision`scC@st|j|ƒƒdS(Ns
(ttostringR(RR((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytwrite_revision_to_stringcscC@s|j|j|ƒƒS(N(t_unpack_revisionR(RR((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyt
read_revisionfscC@s|jt|ƒƒS(N(RR(RR((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytread_revision_from_stringiscC@s't|ƒj|dƒ|jdƒdS(Nsutf-8s
(tElementTreetwrite(RteltR((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyRlscC@stƒj|ƒS(N(R!tparse(RR((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyRpsN(t__name__t
__module__t__doc__tTruetsquashes_xml_invalid_charactersRtFalseRRRRRR RR(((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyR6s
					cC@s&|dkrdStjdd„|ƒS(s²Escape the XML-invalid characters in a commit message.

    :param message: Commit message to escape
    :return: tuple with escaped message and number of characters escaped
    iu[^	

 -퟿-�]+cS@s|jdƒjdƒS(Nitunicode_escape(tgrouptencode(tmatch((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyt<lambda>sN(Ni(Rtretsubn(tmessage((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytescape_invalid_charsts
	cC@s'|jtkr||ƒSt|ƒSdS(sßReturn a cached version of the string.

    cElementTree will return a plain string if the XML is plain ascii. It only
    returns Unicode when it needs to. We want to work in utf-8 strings. So if
    cElementTree returns a plain string, we can just return the cached version.
    If it is Unicode, then we need to encode it.

    :param a_str: An 8-bit string or Unicode as returned by
                  cElementTree.Element.get()
    :return: A utf-8 encoded 8-bit string.
    N(t	__class__tunicodetintern(ta_strt_encode_utf8((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytget_utf8_or_ascii…s
s[&<>'"]|[€-ÿ]+u
[&<>'"€-ï¿¿]s&amp;t&s&apos;t's&quot;s"s&lt;t<s&gt;t>cC@s;y||jƒSWn"tk
r6dt|jƒƒSXdS(sGReplace a string of non-ascii, non XML safe characters with their escape

    This will escape both Standard XML escapes, like <>"', etc.
    As well as escaping non ascii characters, because ElementTree did.
    This helps us remain compatible to older versions of bzr. We may change
    our policy in the future, though.
    s&#%d;N(R,tKeyErrortord(R.t_map((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyt_unicode_escape_replace§s

cC@sMy||jƒSWn4tk
rHdjd„|jƒjdƒDƒƒSXdS(s\Escape utf8 characters into XML safe ones.

    This uses 2 tricks. It is either escaping "standard" characters, like "&<>,
    or it is handling characters with the high-bit set. For ascii characters,
    we just lookup the replacement in the dictionary. For everything else, we
    decode back into Unicode, and then use the XML escape code.
    tcs@s|]}dt|ƒVqdS(s&#%d;N(R?(t.0tuni_chr((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pys	<genexpr>Åstutf8N(R,R>tjointdecode(R.R@((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyt_utf8_escape_replaceºs

cC@sp|j|ƒ}|dkrl|jtkrIttjt|ƒƒd}ntjt	|ƒd}|||<n|S(s>Encode the string into utf8, and escape invalid XML characterst"N(
tgetRR4R5tstrt_unicode_retsubRAt_utf8_reRH(tunicode_or_utf8_strR@ttext((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytencode_and_escapeËs	

cC@stjƒdS(s$Clean out the unicode => escaped mapN(t_to_escaped_maptclear(((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyt_clear_cacheäscC@s¤|j}|dƒ}|dƒ}|dk	r—|dk	r—||f}y||}Wntk
rfq—X|rŠ|jdkr†|jƒS|S|jƒSn|j}tjj|ƒsÅt	d|ƒ‚nt
|ƒ}|dk	rìt
|ƒ}n|dƒ}	|	dk	rt
|	ƒ}	n|dkr=tj||dƒ|	ƒ}
n/|dkrµtj||dƒ|	ƒ}
|dƒ|
_
|d	ƒd
kr‘t|
_n|dƒ}|o¬t|ƒ|
_n·|dkrîtj||dƒ|	ƒ}
|d
ƒ|
_n~|dkr]|jd}|jd}|jd}	|jdƒ}|jdƒ}
tj|||	||
ƒ}
ntj|ƒ‚||
_|dk	r |dk	r |
jƒ||<n|
S(Ntfile_idtrevisiont	directorysunsupported entry kind %st	parent_idtnametfilet	text_sha1t
executabletyest	text_sizetsymlinktsymlink_targetstree-referencetreference_revision(RJRR>tkindtcopyttagRtInventoryEntrytversionable_kindtAssertionErrorR9tInventoryDirectoryt
InventoryFileR[R(R\tintR^t
InventoryLinkR`tattribt
TreeReferenceRtUnsupportedInventoryKindRV(R#R	R
telt_getRURVtkeyt	cached_ieRbRXtietvRYRa((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytunpack_inventory_entryésl	 


									


	c
C@sÒ|jdkr(tjd|jƒ‚n|jdƒ}||krYtjd|ƒ‚n|jdƒ}|dk	r†tj|ƒ}ntjddd|ƒ}x-|D]%}||||ƒ}	|j	|	ƒq¥W|S(s8Unpack a flat XML inventory.

    :param elt: XML element for the inventory
    :param format_num: Expected format number
    :param unpack_entry: Function for unpacking inventory entries
    :return: An inventory
    :raise UnexpectedInventoryFormat: When unexpected elements or data is
        encountered
    RsRoot tag is %rtformatsInvalid format version %rRtroot_idN(
RdRR
RJRRR-Rt	Inventorytadd(
R#t
format_numtunpack_entryR	R
RuRtinvRRr((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytunpack_inventory_flatMs	

c
C@sê|jƒ}|jƒ\}}x»|D]³\}}	|	j|krXd}
t|	jƒ}nd}
d}|	jdkr
|	jr…d}nd}|sÛ|d|t|	jƒt|	jƒ|
|t|	jƒ|	j	|	j
fƒqØ|d|t|	jƒt|	jƒ|
|fƒq%|	jdkrŒ|s]|dt|	jƒt|	jƒ|
|t|	jƒfƒqØ|d	t|	jƒt|	jƒ|
|fƒq%|	jd
kr|sè|dt|	jƒt|	jƒ|
|t|	jƒt|	jƒfƒqØ|dt|	jƒt|	jƒ|
|fƒq%|	jd
krÆ|	j|krJtj
|	jƒ‚n|s—|dt|	jƒt|	jƒ|
|t|	jƒt|	jƒfƒqØ|dt|	jƒt|	jƒ|
|fƒq%tj
|	jƒ‚q%W|dƒdS(s Serialize an inventory to a flat XML file.

    :param inv: Inventory to serialize
    :param append: Function for writing a line of output
    :param working: If True skip history data - text_sha1, text_size,
        reference_revision, symlink_target.    self._check_revisions(inv)
    s parent_id="RBRZs executable="yes"sO<file%s file_id="%s name="%s%s%s revision="%s text_sha1="%s" text_size="%d" />
s$<file%s file_id="%s name="%s%s%s />
RWs4<directory file_id="%s name="%s%s%s revision="%s />
s'<directory file_id="%s name="%s%s%s />
R_sE<symlink file_id="%s name="%s%s%s revision="%s symlink_target="%s />
s%<symlink file_id="%s name="%s%s%s />
stree-referencesP<tree-reference file_id="%s name="%s%s%s revision="%s reference_revision="%s />
s,<tree-reference file_id="%s name="%s%s%s />
s
</inventory>
N(titer_entriestnextRXRQRbR\RURYRVR[R^R`RRnRa(
R{tappendRvtsupported_kindstworkingtentriest	root_pathtroot_ietpathRrt
parent_strRXR\((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pytserialize_inventory_flathsx		(.R't
__future__RR0txml.etree.cElementTreetetreetcElementTreetelementtreetgetattrtSyntaxErrorRtImportErrortxml.etree.ElementTreeR!txml.parsers.expatRt
SubElementtElementtXMLTreeBuilderRRtbzrlibRRRRRt
SerializerRR3R-R9tlazy_compileRNRLt_xml_escape_mapRARHRRRQRTRR*RtR|R‡(((s9/usr/lib/python2.7/dist-packages/bzrlib/xml_serializer.pyt<module>sB

*(	>	
	e

Copyright © 2017 || Recoded By Mr.Bumblebee