KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache
System : Linux cs317.bluehost.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64
User : andertr9 ( 1047)
PHP Version : 8.2.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/mercurial/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/mercurial/encoding.pyo
�
Hq�Qc@smddlZddlZddlZddlZd�Zid�d6d�d6ed6ZyIejjd�Zes�ej	�p�d	Zejed
���ZnWnej
k
r�d	ZnXejjdd�Zd
Zde
fd��YZd�Zd�Zejjdd�dkr$dp'dZd�Zd�Zd�Zd�Zd�Zd�Zd�ZdS(i����NcCsxytjWntk
r)tj�dSXtjtj�}tjtjd�tjtj�}tjtj|�|S(s�
    On darwin, getpreferredencoding ignores the locale environment and
    always returns mac-roman. http://bugs.python.org/issue6202 fixes this
    for Python 2.7 and up. This is the same corrected code for earlier
    Python versions.

    However, we can't use a version check for this method, as some distributions
    patch Python to fix this. Instead, we use it as a 'fixer' for the mac-roman
    encoding, as it is unlikely that this encoding is the actually expected.
    it(tlocaletCODESETtAttributeErrortgetdefaultlocalet	setlocaletLC_CTYPEtnl_langinfo(toldloctresult((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyt_getpreferredencodings
cCsdS(Ntascii((((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyt<lambda>$st646cCsdS(NR((((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyR%ssANSI_X3.4-1968s	mac-romant
HGENCODINGRcCstS(N(tencoding(((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyR-stHGENCODINGMODEtstricts
ISO-8859-1tlocalstrcBs eZdZd�Zd�ZRS(sdThis class allows strings that are unmodified to be
    round-tripped to the local encoding and backcCstj||�}||_|S(N(tstrt__new__t_utf8(tclstutlts((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyR6s	cCs
t|j�S(N(thashR(tself((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyt__hash__:s(t__name__t
__module__t__doc__RR(((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyR3s	cCs)y�y[|jd�}tdkr%|S|jtd�}||jt�krP|St||�SWn�tk
r�yT|jt�}|jtd�}||jt�kr�|St|jd�|�SWq�tk
r�|jdd�}|jtd�SXnXWn(tk
r$}tj|dd��nXdS(s�
    Convert a string from internal UTF-8 to local encoding

    All internal strings should be UTF-8 but some repos before the
    implementation of locale support may contain latin1 or possibly
    other character sets. We attempt to decode everything strictly
    using UTF-8, then Latin-1, and failing that, we use UTF-8 and
    replace unknown characters.

    The localstr class is used to cache the known UTF-8 encoding of
    strings next to their local representation to allow lossless
    round-trip conversion back to UTF-8.

    >>> u = 'foo: \xc3\xa4' # utf-8
    >>> l = tolocal(u)
    >>> l
    'foo: ?'
    >>> fromlocal(l)
    'foo: \xc3\xa4'
    >>> u2 = 'foo: \xc3\xa1'
    >>> d = { l: 1, tolocal(u2): 2 }
    >>> len(d) # no collision
    2
    >>> 'foo: ?' in d
    False
    >>> l1 = 'foo: \xe4' # historical latin1 fallback
    >>> l = tolocal(l1)
    >>> l
    'foo: ?'
    >>> fromlocal(l) # magically in utf-8
    'foo: \xc3\xa4'
    sUTF-8treplacesutf-8thints!please check your locale settingsN(	tdecodeRtencodeRtUnicodeDecodeErrortfallbackencodingtLookupErrorterrortAbort(RRtrtk((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyttolocal=s*"

cCs�t|t�r|jSy|jtt�jd�SWnwtk
r�}|td|j	d�|j	d!}t
jd||f��n(tk
r�}t
j|dd��nXdS(s�
    Convert a string from the local character encoding to UTF-8

    We attempt to decode strings using the encoding mode set by
    HGENCODINGMODE, which defaults to 'strict'. In this mode, unknown
    characters will cause an error message. Other modes include
    'replace', which replaces unknown characters with a special
    Unicode character, and 'ignore', which drops the character.
    sutf-8ii
sdecoding near '%s': %s!R!s!please check your locale settingsN(
t
isinstanceRRR"RtencodingmodeR#R$tmaxtstartR'R(R&(RtinsttsubR*((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyt	fromlocalzs$tHGENCODINGAMBIGUOUStnarrowtwidetWFAtWFcCst|jtd��S(sCFind the column width of a string for display in the local encodingR (t	ucolwidthR"R(R((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pytcolwidth�scCs]ttdd�}|dk	rStg|D]$}||�tkrFdpId^q(�St|�S(s5Find the column width of a Unicode string for displayteast_asian_widthiiN(tgetattrtunicodedatatNonetsumR5tlen(tdteawtc((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyR8�s5cCsKxDt||t|��D])}|||!}t|�|kr|SqWdS(sOUse colwidth to find a c-column substring of s starting at byte
    index startN(txrangeR?R9(RR/RBtxtt((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pytgetcols�s 
cCs�y|jd�|j�SWntk
r.nXyct|t�rV|jjd�}n|jtt�}|j�}||kr�|S|jt�SWn?t	k
r�|j�St
k
r�}tj|dd��nXdS(s9best-effort encoding-aware case-folding of local string sRsutf-8R!s!please check your locale settingsN(
R"tlowerR$R,RRRR-R#tUnicodeErrorR&R'R((RRtluR*((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyRG�s"



cCs�y|jd�|j�SWntk
r.nXyct|t�rV|jjd�}n|jtt�}|j�}||kr�|S|jt�SWn?t	k
r�|j�St
k
r�}tj|dd��nXdS(s9best-effort encoding-aware case-folding of local string sRsutf-8R!s!please check your locale settingsN(
R"tupperR$R,RRRR-R#RHR&R'R((RRtuuR*((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyRJ�s"



cCs�t|t�r|jSy|jd�r,|SWn�tk
r�|jdd�jd�}d}d}x_|D]W}|||d!|kr�||7}|d7}qk|tdt|��jd�7}qkW|SXdS(s�convert a local, possibly-binary string into UTF-8b

    This is intended as a generic method to preserve data when working
    with schemes like JSON and XML that have no provision for
    arbitrary byte strings. As Mercurial often doesn't know
    what encoding data is in, we use so-called UTF-8b.

    If a string is already valid UTF-8 (or ASCII), it passes unmodified.
    Otherwise, unsupported bytes are mapped to UTF-16 surrogate range,
    uDC00-uDCFF.

    Principles of operation:

    - ASCII and UTF-8 data successfully round-trips and is understood
      by Unicode-oriented clients
    - filenames and file contents in arbitrary other encodings can have
      be round-tripped or recovered by clueful clients
    - local strings that have a cached known UTF-8 encoding (aka
      localstr) get sent as UTF-8 so Unicode-oriented clients get the
      Unicode data they want
    - because we must preserve UTF-8 bytestring in places such as
      filenames, metadata can't be roundtripped without help

    (Note: "UTF-8b" often refers to decoding a mix of valid UTF-8 and
    arbitrary bytes into an internal Unicode format that can be
    re-encoded back into the original. Here we are exposing the
    internal surrogate encoding as a UTF-8 string.)
    sutf-8tignoreRiii�N(R,RRR"R$R#tunichrtord(Rts2R)tposRB((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyttoutf8b�s



'cCs�d|kr|S|jd�}d}xT|D]L}t|�d@dkre|tt|�d@�7}q,||jd�7}q,W|S(stGiven a UTF-8b string, return a local, possibly-binary string.

    return the original binary string. This
    is a round-trip process for strings like filenames, but metadata
    that's was passed through tolocal will remain in UTF-8.

    >>> m = "\xc3\xa9\x99abcd"
    >>> n = toutf8b(m)
    >>> n
    '\xc3\xa9\xed\xb2\x99abcd'
    >>> fromutf8b(n) == m
    True
    s�sutf-8Ri�i�i�(R"RNtchrR#(RRR)RB((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyt	fromutf8bs
(R'R<RtosR
t_encodingfixerstenvirontgetRtgetpreferredencodingtErrorR-R%RRR+R2R5R9R8RFRGRJRQRS(((s8/usr/lib64/python2.7/site-packages/mercurial/encoding.pyt<module>s6$	




	=							1

Anon7 - 2021