MOON
Server: Apache
System: Linux server2.shieldcogroup.com 3.10.0-1160.119.1.el7.tuxcare.els12.x86_64 #1 SMP Fri Nov 8 05:49:38 UTC 2024 x86_64
User: jacom (1029)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python2.7/site-packages/dnf/i18n.pyo
�
�[/\c@s7ddlmZddlmZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
defd��YZd�Z
d�Zd	�Zd
�Zd�Zd�Zd
�Zdd�Zd�Zdeddd�Zdddd�Zd�Zd�Zed�\ZZeZdS(i����(tprint_function(tunicode_literals(tunicodeNt
UnicodeStreamcBs#eZd�Zd�Zd�ZRS(cCs||_||_dS(N(tstreamtencoding(tselfRR((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyt__init__$s	cCs�t|t�sHtjjr0|j|jd�n|j|jd�}ny|jj	|�Wnyt
k
r�|j|jjd�}t|jd�r�|jjj	|�q�|j|jjd�}|jj	|�nXdS(Nureplaceubackslashreplaceubufferuignore(
t
isinstancetstrtdnftpycomptPY3tdecodeRtencodeRtwritetUnicodeEncodeErrorthasattrtbuffer(Rtsts_bytes((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyR(s!
cCst|j|�S(N(tgetattrR(Rtname((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyt__getattr__7s(t__name__t
__module__RRR(((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyR#s		cCsB|dkrtS|j�}|jd�s:|jd�r>tStS(u�Return true if encoding can express any Unicode character.

    Even if an encoding can express all accented letters in the given language,
    we can't generally settle for it in DNF since sometimes we output special
    characters like the registered trademark symbol (U+00AE) and surprisingly
    many national non-unicode encodings, including e.g. ASCII and ISO-8859-2,
    don't contain it.

    uutf-uutf_N(tNonetFalsetlowert
startswithtTrue(RR((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyt_full_ucd_support:s
cCs&tjt�}|jd�r"dS|S(u= Take the best shot at the current system's string encoding. uANSIuutf-8(tlocaletgetpreferredencodingRR(R((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyt_guess_encodingKscCsmytjjtjd�WnLtjk
rh}tddtj�dt	j
d<tjjtjd�nXdS(Nuu%Failed to set locale, defaulting to CtfileuCuLC_ALL(R
Rt	setlocaleR tLC_ALLtErrortprinttsyststderrtostenviron(te((s,/usr/lib/python2.7/site-packages/dnf/i18n.pytsetup_localePs
cCs~tj}|j�s.tjtjtj�ny
|j}Wntk
rTd}nXt	|�szt
|t��t_tSt
S(u� Check that stdout is of suitable encoding and handle the situation if
        not.

        Returns True if stdout was of suitable encoding already and no changes
        were needed.
    N(R(tstdouttisattytsignaltSIGPIPEtSIG_DFLRtAttributeErrorRRRR"RR(R.R((s,/usr/lib/python2.7/site-packages/dnf/i18n.pytsetup_stdoutYs	


cCst|dd�tjj�S(u� It uses print instead of passing the prompt to raw_input.

        raw_input doesn't encode the passed string and the output
        goes into stderr
    tendu(R'R
Rt	raw_input(tucstring((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyt	ucd_inputmscCs�tjjrQtjj|�r4t|t�dd�St|t�rG|St|�St|tjj�rj|St|d�r�ytjj|�SWq�t	k
r�q�Xntjjt|�t�dd�SdS(uD Like the builtin unicode() but tries to use a reasonable encoding. terrorsuignoreu__unicode__N(
R
RRtis_py3bytesR	R"RRRtUnicodeError(tobj((s,/usr/lib/python2.7/site-packages/dnf/i18n.pytucdxs

cCstj|�dkrdSdS(NuWuFii(uWuF(tunicodedatateast_asian_width(tuchar((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyt_exact_width_char�scCsw|dkrt|�|fSd}d}xB|D]:}t|�}|||krUPn||7}||7}q/W||fS(u' Return the textual width of a Unicode string, chopping it to
        a specified value. This is what you want to use instead of %.*s, as it
        does the "right" thing with regard to different Unicode character width
        Eg. "%.*s" % (10, msg)   <= becomes => "%s" % (chop_str(msg, 10)) iuN(Rtexact_widthRA(tmsgtchoptwidthtchopped_msgtchart
char_width((s,/usr/lib/python2.7/site-packages/dnf/i18n.pytchop_str�s

cCstd�|D��S(uQ Calculates width of char at terminal screen
        (Asian char counts for two) css|]}t|�VqdS(N(RA(t.0tc((s,/usr/lib/python2.7/site-packages/dnf/i18n.pys	<genexpr>�s(tsum(RC((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyRB�sucCs�t||�\}}||krK|s-|r�dj|||g�}q�nMd||}|r}dj||||g�}ndj||||g�}|S(u� Expand a msg to a specified "width" or chop to same.
        Expansion can be left or right. This is what you want to use instead of
        %*.*s, as it does the "right" thing with regard to different Unicode
        character width.
        prefix and suffix should be used for "invisible" bytes, like
        highlighting.

        Examples:

        ``"%-*.*s" % (10, 20, msg)`` becomes
            ``"%s" % (fill_exact_width(msg, 10, 20))``.

        ``"%20.10s" % (msg)`` becomes
            ``"%s" % (fill_exact_width(msg, 20, 10, left=False))``.

        ``"%s%.10s%s" % (pre, msg, suf)`` becomes
            ``"%s" % (fill_exact_width(msg, 0, 10, prefix=pre, suffix=suf))``.
        uu (RItjoin(RCtfillRDtlefttprefixtsuffixREtextra((s,/usr/lib/python2.7/site-packages/dnf/i18n.pytfill_exact_width�siFcs��fd��|jd�}|jdd	�jd�}g}|}t}d}d}	x|D]}
|
jd�}
||	}}�|
�\}}	t}
|r�|	r�t}
n|r�|t|
�kr�t}
n|r�|r�|dkr�||kr�t}
q�n|
r*|j|jd��|}t}n|t|
�krEd}
n|rc|
jd�}
|}	nt||
�|kr�t}|j||
�|}q^nt}|
jd�}|}
|	}|r�|dkr�|}nxw|D]o}|t|
|�kr;t|
�t|�kr;|j|
jd��|d|}
n|
|7}
|
d7}
q�W|
jd�d}q^W|r�|j|jd��ndj	|�S(
uq Works like we want textwrap.wrap() to work, uses Unicode strings
        and doesn't screw up lists/blocks/etc. cs�d}d}x(|D] }|dkr)Pn|d7}qW|d
krM|dfSt||d�d}|dkr��||t|��}|dp�|d}|r�||d|fSn|dfS(NiuXu iu-u*u.uouâu•u‣u∘(u-u*u.uouâ(u-u*u.uou•u‣u∘(RItlen(tlinetcounttbytetlist_chrtnxt(t_indent_at_beg(s,/usr/lib/python2.7/site-packages/dnf/i18n.pyRZ�s 

	u
u	u iiiuu        (
trstriptreplacetsplitRRRTtappendtlstripRBRM(ttextREtinitial_indenttsubsequent_indenttlinestrettindentt	wrap_lasttcsabtcspc_indentRUtlsabtlspc_indenttforce_nltwordstspcstword((RZs,/usr/lib/python2.7/site-packages/dnf/i18n.pyt
textwrap_fill�sf

		
				

cCsDt�d�}tjjj|dt�}t|tjj|��S(u< Easy gettext translations setup based on given domain name cs
�fd�S(Ncst�|��S(N(R=(tw(tfnc(s,/usr/lib/python2.7/site-packages/dnf/i18n.pyt<lambda>(s((Rq((Rqs,/usr/lib/python2.7/site-packages/dnf/i18n.pytucd_wrapper'stfallback(R-R
RtgettextttranslationRtmapt
gettext_setup(RRstt((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyRv"s	cCs2t|td�|�}d|kr*|S|SdS(Niu(t_tchr(tcontexttmessagetresult((s,/usr/lib/python2.7/site-packages/dnf/i18n.pytpgettext-sudnf(t
__future__RRt
dnf.pycompRR
R R*R0R(R>tobjectRRR"R-R4R8R=RARRIRBRRSRoRvRRztP_tC_(((s,/usr/lib/python2.7/site-packages/dnf/i18n.pyt<module>s0									"O