
    `N`                     F   d Z ddlZddlZddlZddlZej        d         dk    Zej        d         dk    oej        d         dk    Zej        d         dk    oej        d         dk    Zej        d         dk    oej        d         dk    Z	er9ej
        Z
ej        ZddlZdd	ZddlZej        ZeZeZd
 ZddlZej        j        Zn6ddlZddlZej
        xZ
Zej        ZddZeZddlmZ eZddlZej        j        ZddZereZeZ neZd Z  G d dej                  Zd Z!dS )z.Utilities for Python2 / Python3 compatibility.    N                c                 0    t          j        | ||          S )N)modeencoding)codecsopen)filenamer
   r   newlines       6lib/python3.11/site-packages/yapf/yapflib/py3compat.pyopen_with_encodingr       s    ;xdX>>>>    c                      t          j        t          j        j        d          } | j        j                                                            d          S )Nutf-8)r   )ioTextIOWrappersysstdinbufferrawreadalldecode)wrappers    r   	raw_inputr   )   sA    sy/'BBBG>%%''..w777r      Fc                     d }|S )Nc                     | S N )user_functions    r   fake_wrapperzlru_cache.<locals>.fake_wrapper<   s    r   r#   )maxsizetypedr%   s      r   	lru_cacher(   :   s       r   )ifilterr   c                 "   t           r9t          j        j                            |                     |                     dS t          j        dk    rddl}t          j        t          j        u r<|	                    t          j        
                                t          j                   t          j                            |                     |                     dS t          j                            |                     |                     dS )aI  Encode the given string and emit to stdout.

  The string may contain non-ascii characters. This is a problem when stdout is
  redirected, because then Python doesn't know the encoding and we may get a
  UnicodeEncodeError.

  Arguments:
    s: (string) The string to encode.
    encoding: (string) The encoding of the string.
  win32r   N)PY3r   stdoutr   writeencodeplatformmsvcrt
__stdout__setmodefilenoosO_BINARY)sr   r1   s      r   EncodeAndWriteToStdoutr8   J   s     	 )JAHHX../////
|w MMM
~##nnSZ&&(("+666JQXXh''(((((JQXXh''(((((r   c                 ,    t          j        | d          S )z!Force conversion of s to unicode.r   )__builtin__unicode)r7   s    r   r;   r;   m   s    q'***r   c                       e Zd ZesddZdS dS )ConfigParserNc                 4    |                      ||           d S )N)r   )readfp)selffpsources      r   	read_filezConfigParser.read_filex   s    
kk"vk&&&&&r   r"   )__name__
__module____qualname__r,   rC   r#   r   r   r=   r=   u   s:        	 '' ' ' ' ' '' 'r   r=   c                     t           j        }t          r|                    d          }|                     |          r| t          |          d         S | S )z>Remove any Byte-order-Mark bytes from the beginning of a file.r   N)r   BOM_UTF8r,   r   
startswithlen)rB   boms     r   	removeBOMrL   |   sR    # 
**W

Cs #c(())	-r   )r   )r   F)r   )"__doc__r   r   r5   r   version_infor,   PY36PY37PY38StringIOBytesIOr   	functoolsr(   rangefilterr)   r   configparserr=   BOOLEAN_STATESCONFIGPARSER_BOOLEAN_STATESr:   	cStringIOr   xrange	itertools_boolean_statesr8   str
basestringr;   rL   r#   r   r   <module>r`      s,   5 4  				 				 



	qQ
a<C$4Q$71$<
a<C$4Q$71$<
a<C$4Q$71$< -J[(J'---? ? ? ? !)
%'8 8 8  !- 9 H ))(Ww    %)%%%% , 9 I) ) ) ):  +*''*+ + +' ' ' ' '<, ' ' '    r   