-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
¦îNc@@s/ddlmZddlZddlmZddlmZdefd„ƒYZdefd„ƒYZ	dd	„Zd
„Zdefd„ƒYZ
d
„Zd„Zd„Zdd„Zd„Zd„Zy ddlmZmZmZWn<ek
r*ZejeƒddlmZmZmZnXdS(i(tabsolute_importN(tosutils(tIterableFilet	RioWritercB@seZd„Zd„ZRS(cC@st|_||_dS(N(tFalset_soft_nlt_to_file(tselftto_file((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt__init__,s	cC@s9|jr|jjdƒn|j|jƒt|_dS(Ns
(RRtwritetTrue(Rtstanza((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytwrite_stanza0s	(t__name__t
__module__R	R
(((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR+s	t	RioReadercB@s eZdZd„Zd„ZRS(s‹Read stanzas from a file as a sequence

    to_file can be anything that can be enumerated as a sequence of
    lines (with newlines.)
    cC@s
||_dS(N(t
_from_file(Rt	from_file((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR	=scc@s5x.tr0t|jƒ}|dkr(Pq|VqWdS(N(Rtread_stanzaRtNone(Rts((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt__iter__@s
	(RRt__doc__R	R(((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR7s	c@s‡‡fd†}t|ƒƒS(s6Produce a rio IterableFile from an iterable of stanzasc3@siˆdk	rˆdVnt}xDˆD]<}|tk	r?dVnx|jƒD]}|VqLWt}q%WdS(Ns
(RRtto_linesR(tfirst_stanzaRtline(theadertstanzas(s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytstr_iterKs
	(R(RRR((RRs./usr/lib/python2.7/dist-packages/bzrlib/rio.pytrio_fileIs
cc@s2x+tr-t|ƒ}|dkr%Pq|VqWdS(N(RRR(RR((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytread_stanzasXs
	tStanzacB@s³eZdZdgZd„Zd„Zed„ƒZd„Zd„Z	d„Z
d„Zd	„Zd
„Z
d„Zd„Zd
„Zd„Zd„ZeZd„Zd„ZRS(s+One stanza for rio.

    Each stanza contains a set of named fields.

    Names must be non-empty ascii alphanumeric plus _.  Names can be repeated
    within a stanza.  Names are case-sensitive.  The ordering of fields is
    preserved.

    Each field value must be either an int or a string.
    titemscK@sIg|_|rEx3t|jƒƒD]\}}|j||ƒq"WndS(sqConstruct a new Stanza.

        The keyword arguments, if any, are added in sorted order to the stanza.
        N(R!tsortedtadd(Rtkwargsttagtvalue((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR	ns	cC@sˆt|ƒs"td|fƒ‚nt|tƒr@t|ƒ}n.t|tƒrRntd|t|ƒfƒ‚|jj||fƒdS(s&Append a name and value to the stanza.sinvalid tag %rs)invalid type for rio value: %r of type %sN(	t	valid_tagt
ValueErrort
isinstancetstrtunicodet	TypeErrorttypeR!tappend(RR%R&((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR#xscC@s|ƒ}||_|S(N(R!(tclstpairstret((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt
from_pairs‡s		cC@s.x'|jD]\}}||kr
tSq
WtS(s=True if there is any field in this stanza with the given tag.(R!RR(Rtfind_tagR%R&((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt__contains__scC@s
t|jƒS(s%Return number of pairs in the stanza.(tlenR!(R((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt__len__”scC@s#t|tƒstS|j|jkS(N(R)R RR!(Rtother((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt__eq__˜scC@s|j|ƒS(N(R8(RR7((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt__ne__scC@sd|jS(Ns
Stanza(%r)(R!(R((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt__repr__ scC@s
t|jƒS(s$Return iterator of tag, value pairs.(titerR!(R((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt
iter_pairs£scC@sê|js
gSg}xÐ|jD]Å\}}|dkrI|j|dƒqd|krÀ|jdƒ}|j|d|djdƒdƒxU|dD]$}|jd|jdƒdƒq•Wq|j|d|jdƒdƒqW|S(	s{Generate sequence of lines for external version of this file.

        The lines are always utf-8 encoded strings.
        ts: 
s
s: isutf-8is	(R!R.tsplittencode(RtresultR%R&t	val_linesR((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR§s	&%&cC@sdj|jƒƒS(s Return stanza as a single stringR=(tjoinR(R((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt	to_string½scC@sØ|js
dSg}xµ|jD]ª\}}|dkrI|j|dƒqd|kr®|jdƒ}|j|d|ddƒxC|dD]}|jd|dƒqŒWq|j|d|dƒqWdj|ƒS(swReturn stanza as a single Unicode string.

        This is most useful when adding a Stanza to a parent Stanza
        uu: 
u
u: iiu	(R!R.R>RB(RR@R%R&RAR((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt
to_unicodeÁs	cC@s|j|jƒƒdS(sWrite stanza to a fileN(t
writelinesR(RR((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR
×scC@s:x3|jD]\}}||kr
|Sq
Wt|ƒ‚dS(s²Return the value for a field wih given tag.

        If there is more than one value, only the first is returned.  If the
        tag is not present, KeyError is raised.
        N(R!tKeyError(RR%tttv((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytgetÛscC@s@g}x3|jD](\}}||kr|j|ƒqqW|S(N(R!R.(RR%trRGRH((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytget_allés
cC@s.i}x!|jD]\}}|||<qW|S(sBReturn a dict containing the unique values of the stanza.
        (R!(RtdR%R&((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytas_dictðs(RRRt	__slots__R	R#tclassmethodR2R4R6R8R9R:R<RRCRDR
RIt__getitem__RKRM(((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR `s&
		
													cC@s
t|ƒS(N(t
_valid_tag(R%((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyR'ùscC@s
t|ƒS(sóReturn new Stanza read from list of lines or a file

    Returns one Stanza that was read, or returns None at end of file.  If a
    blank line follows the stanza, it is consumed.  It's not an error for
    there to be no blank at end of file.  If there is a blank file at the
    start of the input this is really an empty stanza and that is returned.

    Only the stanza lines and the trailing blank (if any) are consumed
    from the line_iter.

    The raw lines must be in utf-8 encoding.
    (t_read_stanza_utf8(t	line_iter((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyRýs
cC@s
t|ƒS(sÊRead a Stanza from a list of lines or a file.

    The lines should already be in unicode form. This returns a single
    stanza that was read. If there is a blank line at the end of the Stanza,
    it is consumed. It is not an error for there to be no blank line at
    the end of the iterable. If there is a blank line at the beginning,
    this is treated as an empty Stanza and None is returned.

    Only the stanza lines and the trailing blank (if any) are consumed
    from the unicode_iter

    :param unicode_iter: A iterable, yeilding Unicode strings. See read_stanza
        if you have a utf-8 encoded string.
    :return: A Stanza object if there are any lines in the file.
        None otherwise
    (t_read_stanza_unicode(tunicode_iter((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytread_stanza_unicode
siHc	C@s|dkrt|ƒ‚n|d}g}xÐ|jƒD]Â}x¹|jdƒd D]¤}tjdd|ƒ}x†t|ƒdkrõ|| }||}t|ƒdkrI|ddgkrId}|jdd	ƒ}|d
krþ|jdd	ƒ}|d7}n|d
kr|jd
d	ƒ}n|d
krI|||}|| }qInt|ƒdkrhd|}ntjdd|ƒ}t}t|ƒdkr¢|d7}n%tjd|ƒrÇ|d7}t	}n|j
d|dƒ|rp|j
dƒqpqpWqRWq8W|S(swConvert a stanza into RIO-Patch format lines.

    RIO-Patch is a RIO variant designed to be e-mailed as part of a patch.
    It resists common forms of damage such as newline conversion or the removal
    of trailing whitespace, yet is also reasonably easy to read.

    :param max_width: The maximum number of characters per physical line.
    :return: a list of lines
    iis
iÿÿÿÿs\\s\\\\it iìÿÿÿit-it/s  s
s\\rs\s $s# s#   
(R(RR>tretsubR5trfindRtsearchRR.(	Rt	max_widtht
max_rio_widthtlinestplineRtpartlinetbreak_indext
blank_line((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytto_patch_lines!sD



%



	c#@s6idd6dd6dd6‰‡fd†}d}xë|D]ã}|jdƒrY|d	}n/|jd
ƒru|d}ntd|fƒ‚|dk	r³t|ƒd	kr³|d	}ntjdd|ƒ}tjd
||ƒ}|dkrò|}n
||7}|ddkr7|Vd}q7q7W|dk	r2|VndS(Ns\s\\s
s\rR=s\
c@sˆ|jdƒS(Ni(tgroup(tmatch(tmap(s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytmapgetSss# it#isbad line %rs\\(.|
)iÿÿÿÿs
(Rt
startswithR(R5RZR[(RSRit	last_lineR((Rhs./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt_patch_stanza_iterOs.





	

cC@stt|ƒƒS(s5Convert an iterable of RIO-Patch format lines into a Stanza.

    RIO-Patch is a RIO variant designed to be e-mailed as part of a patch.
    It resists common forms of damage such as newline conversion or the removal
    of trailing whitespace, yet is also reasonably easy to read.

    :return: a Stanza
    (RRm(RS((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pytread_patch_stanzams	(RRRTRQ(t
__future__RRZtbzrlibRtbzrlib.iterablefileRtobjectRRRRRR R'RRVReRmRntbzrlib._rio_pyxRRRTRQtImportErrortetfailed_to_load_extensiontbzrlib._rio_py(((s./usr/lib/python2.7/dist-packages/bzrlib/rio.pyt<module>s&	™			.		 


Copyright © 2017 || Recoded By Mr.Bumblebee