OwlCyberSecurity - MANAGER
Edit File: i18n.cpython-36.pyc
3 �ft`!0������������������@���s����d�dl�mZ�d�dl�mZ�d�dlmZ�d�dlZd�dlZd�dlZd�dlZd�dl Z d�dl Z G�dd��de�Zdd��Z d d ��Zdd��Zd d��Zdd��Zdd��Zdd��Zd'dd�Zdd��Zd(dd�Zd)dd�Zd d!��Zd"d#��Zd$d%��Zed&�\ZZeZdS�)*�����)�print_function)�unicode_literals)�unicodeNc���������������@���s$���e�Zd�Zdd��Zdd��Zdd��ZdS�)� UnicodeStreamc�������������C���s���||�_�||�_d�S�)N)�stream�encoding)�selfr���r�����r ����/usr/lib/python3.6/i18n.py�__init__$���s����zUnicodeStream.__init__c�������������C���s����t�|t�s.tjjr |j|�jd�n|j|�jd�}y|�jj |��W�n\�t k r����|j|�jjd�}t|�jd�rz|�jjj |��n|j|�jjd�}|�jj |��Y�nX�d�S�)N�replace�backslashreplace�buffer�ignore) � isinstance�str�dnf�pycomp�PY3�decoder����encoder����write�UnicodeEncodeError�hasattrr���)r����sZs_bytesr ���r ���r ���r���(���s���� zUnicodeStream.writec�������������C���s���t�|�j|�S�)N)�getattrr���)r����namer ���r ���r ����__getattr__7���s����zUnicodeStream.__getattr__N)�__name__� __module__�__qualname__r���r���r���r ���r ���r ���r ���r���#���s���r���c�������������C���s0���|�dkrdS�|�j���}|jd�s(|jd�r,dS�dS�)a���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. NFzutf-Zutf_T)�lower� startswith)r���r!���r ���r ���r ����_full_ucd_support:���s���� r#���c��������������C���s���t�jd�}�|�jd�rdS�|�S�)z= Take the best shot at the current system's string encoding. FZANSIzutf-8)�locale�getpreferredencodingr"���)r���r ���r ���r ����_guess_encodingK���s���� r&���c���������������C���s����yt�jjtjd��W�n��tjk r����yt�jjtjd��dtjd<�W�n0�tjk rt���t�jjtjd��dtjd<�Y�nX�tdj tjd��t jd��Y�nX�d�S�)N��zC.UTF-8�LC_ALL�Cz&Failed to set locale, defaulting to {})�file)r���r���� setlocaler$���r(����Error�os�environ�print�format�sys�stderrr ���r ���r ���r ����setup_localeP���s����r3���c��������������C���s`���t�j}�|�j��stjtjtj��y |�j}W�n�tk r@���d}Y�nX�t|�s\t |�t ���t�_dS�dS�)z� 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. NFT)r1����stdout�isatty�signal�SIGPIPE�SIG_DFLr����AttributeErrorr#���r���r&���)r4���r���r ���r ���r ����setup_stdout^���s���� r:���c�������������C���s���t�|�dd��tjj��S�)z� 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 r'���)�end)r/���r���r���Z raw_input)Zucstringr ���r ���r ���� ucd_inputr���s����r<���c���������� ���C���s����t�jjr:t�jj|��r$t|�t��dd�S�t|�t�r2|�S�t|��S�t|�t�jj�rL|�S�t|�d�rxyt�jj|��S��t k rv���Y�nX�t�jjt|��t��dd�S�dS�)zD Like the builtin unicode() but tries to use a reasonable encoding. r���)�errorsZ__unicode__N) r���r���r���Zis_py3bytesr���r&���r���r���r����UnicodeError)�objr ���r ���r ����ucd}���s���� r@���c�������������C���s���t�j|��dkrdS�dS�)N�W�F��������)rA���rB���)�unicodedataZeast_asian_width)Zucharr ���r ���r ����_exact_width_char����s����rF���c�������������C���sX���|dkrt�|��|�fS�d}d}x2|�D�]*}t|�}||�|kr<P�||7�}||7�}q"W�||fS�)a'�� 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)) Nr���r'���)�exact_widthrF���)�msg�chop�widthZchopped_msg�charZ char_widthr ���r ���r ����chop_str����s���� rL���c�������������C���s���t�dd��|�D���S�)zQ Calculates width of char at terminal screen (Asian char counts for two) c�������������s���s���|�]}t�|�V��qd�S�)N)rF���)�.0�cr ���r ���r ���� <genexpr>����s����zexact_width.<locals>.<genexpr>)�sum)rH���r ���r ���r ���rG�������s����rG���Tr'���c�������������C���sj���t�|�|�\}}�||kr0|s|rfdj||�|g�}�n6d||��}|rTdj||�||g�}�ndj|||�|g�}�|�S�)a��� 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))``. r'���� )rL����join)rH���ZfillrI����left�prefix�suffixrJ���Zextrar ���r ���r ����fill_exact_width����s����rV����F���c����������������s�����fdd���|�j�d�}�|�jdd�jd�}g�}|}d}d}d} �xr|D��]h} | j�d�} || �}}��| �\}} d} |rz| rzd } |r�|t| �kr�d } |r�|�r�|d kr�||kr�d } | r�|j|j�d���|}d}|t| �kr�d} |r�| jd�} |} t|| ��|k�rd}|j|| ���|}qDd }| jd�}|} | }|��r@|d k�r@|}x^|D�]V}|t| |��k��r�t| �t|�k�r�|j| j�d���|d|��} | |7�} | d7�} �qFW�| j�d�d�}qDW�|�r�|j|j�d���dj|�S�) zq Works like we want textwrap.wrap() to work, uses Unicode strings and doesn't screw up lists/blocks/etc. c����������������s����d}d}x|�D�]}|dkrP�|d7�}qW�|d kr8|dfS�t�|�|d���d�d�}|dkr���|�|t|��d����}|d�p||d�}|r�||d�|�fS�|dfS�)Nr����XrQ���rD����-�*�.�o����â����•����‣����∘)rY���rZ���r[���r\���r]���)rY���rZ���r[���r\���r^���r_���r`���)rL����len)�line�countZbyteZlist_chrZnxt)�_indent_at_begr ���r ���rd�������s ���� z%textwrap_fill.<locals>._indent_at_beg� � rQ�������Fr���T����r'���z )�rstripr����splitra����append�lstriprG���rR���)�textrJ���Zinitial_indentZsubsequent_indent�lines�ret�indentZ wrap_lastZcsabZcspc_indentrb���ZlsabZlspc_indentZforce_nlZwordsZspcsZwordr ���)rd���r ���� textwrap_fill����sf���� rq���c�������������C���sH���t�|�}t�|�}||kr|S�||kr4||�kr0|S�|S�||�kr@|S�|S�dS�)a��� Automatically selects the short (abbreviated) or long (full) message depending on whether we have enough screen space to display the full message or not. If a caller by mistake passes a long string as msg_short and a short string as a msg_long this function recognizes the mistake and swaps the arguments. This function is especially useful in the i18n context when you cannot predict how long are the translated messages. Limitations: 1. If msg_short is longer than width you will still get an overflow. This function does not abbreviate the string. 2. You are not obliged to provide an actually abbreviated string, it is perfectly correct to pass the same string twice if you don't want any abbreviation. However, if you provide two different strings but having the same width this function is unable to recognize which one is correct and you should assume that it is unpredictable which one is returned. Example: ``select_short_long (10, _("Repo"), _("Repository"))`` will return "Repository" in English but the results in other languages may be different. N)rG���)rJ���Z msg_shortZmsg_longZwidth_shortZ width_longr ���r ���r ����select_short_long'��s����rr���c�������������C���s2���t����dd��}tjjj|�dd�}t|tjj|��S�)z< Easy gettext translations setup based on given domain name c����������������s�����fdd�S�)Nc�����������������s���t���|����S�)N)r@���)�w)�fncr ���r ����<lambda>T��s����z2translation.<locals>.ucd_wrapper.<locals>.<lambda>r ���)rt���r ���)rt���r ����ucd_wrapperS��s����z translation.<locals>.ucd_wrapperT)Zfallback)r3���r���r����gettext�translation�mapZ gettext_setup)r���rv����tr ���r ���r ���rx���N��s����rx���c�������������C���s(���t�|�td��|��}d|kr |S�|S�d�S�)Nrh����)�_�chr)�context�message�resultr ���r ���r ����pgettextY��s����r����r���)N)NTr'���r'���)rW���r'���r'���)Z __future__r���r���Z dnf.pycompr���r���r$���r-���r6���r1���rE����objectr���r#���r&���r3���r:���r<���r@���rF���rL���rG���rV���rq���rr���rx���r����r|���ZP_ZC_r ���r ���r ���r ����<module>���s2��� " O'