-=[ Mr. Bumblebee ]=-
_Indonesia_

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

ó
¦îNc@@sŒddlmZddlZddlZddlmZddlmZdddgZ	dej
fd„ƒYZdd	„Z
dd
„ZdS(i(tabsolute_importN(teast_asian_width(tosutilstUTextWrappertfilltwrapcB@sbeZdZd
d„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„ZRS(sŸ
    Extend TextWrapper for Unicode.

    This textwrapper handles east asian double width and split word
    even if !break_long_words when word contains double width
    characters.

    :param ambiguous_width: (keyword argument) width for character when
                            unicodedata.east_asian_width(c) == 'A'
                            (default: 1)

    Limitations:
    * expand_tabs doesn't fixed. It uses len() for calculating width
      of string on left of TAB.
    * Handles one codeunit as a single character having 1 or 2 width.
      This is not correct when there are surrogate pairs, combined
      characters or zero-width characters.
    * Treats all asian character are line breakable. But it is not
      true because line breaking is prohibited around some characters.
      (For example, breaking before punctation mark is prohibited.)
      See UAX # 14 "UNICODE LINE BREAKING ALGORITHM"
    cK@sÏ|dkr(tjƒptjd}n|jddƒ}|dkrRd|_n$|dkrjd|_ntdƒ‚tjd
krµ|jdt	ƒ|_
|j
sµtd	ƒ‚qµntjj
|||dS(Nitambiguous_widthtFWitFWAs ambiguous_width should be 1 or 2itdrop_whitespaces(TextWrapper version must drop whitespace(ii(tNoneRtterminal_widthtdefault_terminal_widthtpopt_east_asian_doublewidtht
ValueErrortsystversion_infotTrueR	ttextwraptTextWrappert__init__(tselftwidthtkwargst
ambi_width((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyR<s	cC@st|ƒ|jkrdpdS(s_Return width of character `uc`.

        :param:     uc      Single unicode character.
        ii(t_eawidthR(Rtuc((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyt_unicode_char_widthPsc@s#|j‰t‡fd†|DƒƒS(s›Returns width for s.

        When s is unicode, take care of east asian width.
        When s is bytes, treat all byte is single width character.
        c3@s|]}ˆ|ƒVqdS(N((t.0tc(t	charwidth(s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pys	<genexpr>as(Rtsum(Rts((Rs4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyt_widthZs	cC@sdd}|j}xHt|ƒD]:\}}|||ƒ7}||kr|| ||fSqW|dfS(snReturns head and rest of s. (head+rest == s)

        Head is large as long as _width(head) <= width.
        iu(Rt	enumerate(RR!RtwRtposR((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyt_cutcs	cC@s‚d}t|ƒd}|jj}xY||kr}||ddkrp|||ƒrpd||d<|d7}q%|d7}q%WdS(sÐ_fix_sentence_endings(chunks : [string])

        Correct for sentence endings buried in 'chunks'.  Eg. when the
        original text contains "... foo.
Bar ...", munge_whitespace()
        and split() will convert that to [..., "foo.", " ", "Bar", ...]
        which has one too few spaces; this method simply changes the one
        space to two.

        Note: This function is copied from textwrap.TextWrap and modified
        to use unicode always.
        iiu u  iN(tlentsentence_end_retsearch(RtchunkstitLt	patsearch((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyt_fix_sentence_endingsps$
cC@s¯|dkr6|dr-|j|ddƒp0d}n
||}|jr|j|d|ƒ\}}|j|ƒ|r…||d<q«|d=n|s«|j|jƒƒndS(Niiÿÿÿÿii(R"tbreak_long_wordsR&tappendR
(RR*tcur_linetcur_lenRt
space_lefttheadtrest((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyt_handle_long_word†s*
	


cC@s…g}|jdkr+td|jƒ‚n|jƒxI|r€g}d}|r\|j}n	|j}|jt|ƒ}|jr§|djƒdkr§|r§|d=nxN|r÷|j|dƒ}|||kró|j	|j
ƒƒ||7}qªPqªW|r0|j|dƒ|kr0|j||||ƒn|jrZ|rZ|djƒrZ|d=n|r8|j	|dj|ƒƒq8q8W|S(Nisinvalid width %r (must be > 0)iÿÿÿÿtu(
RRtreversetsubsequent_indenttinitial_indentR'R	tstripR"R0R
R6tjoin(RR*tlinesR1R2tindentRtl((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyt_wrap_chunks¤s4
		%
	
 
!cC@sÑtjj|t|ƒƒ}g}x©|D]¡}d}xlt|ƒD]^\}}|j|ƒdkrA||kr…|j|||!ƒn|j|ƒ|d}qAqAW|t|ƒkr(|j||ƒq(q(W|S(Niii(RRt_splittunicodeR#RR0R'(RttextR*tcjk_split_chunkstchunktprev_posR%tchar((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyRAßs

cC@stjj|t|ƒƒS(N(RRRRB(RRC((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyRîsN(
t__name__t
__module__t__doc__R
RRR"R&R.R6R@RAR(((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyR$s	
			
			;	cK@std||j|ƒS(sÈWrap a single paragraph of text, returning a list of wrapped lines.

    Reformat the single paragraph in 'text' so it fits in lines of no
    more than 'width' columns, and return a list of wrapped lines.  By
    default, tabs in 'text' are expanded with string.expandtabs(), and
    all other whitespace characters (including newline) are converted to
    space.  See TextWrapper class for available keyword args to customize
    wrapping behaviour.
    R(RR(RCRR((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyRôs
cK@std||j|ƒS(s–Fill a single paragraph of text, returning a new string.

    Reformat the single paragraph in 'text' to fit in lines of no more
    than 'width' columns, and return a new string containing the entire
    wrapped paragraph.  As with wrap(), tabs are expanded and other
    whitespace characters converted to space.  See TextWrapper class for
    available keyword args to customize wrapping behaviour.
    R(RR(RCRR((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyRs	(t
__future__RRRtunicodedataRRtbzrlibRt__all__RRR
RR(((s4/usr/lib/python2.7/dist-packages/bzrlib/utextwrap.pyt<module>sÐ

Copyright © 2017 || Recoded By Mr.Bumblebee