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&