o
    ﯪg                     @   s  U d Z ddlZddlZddlZddlZddlmZmZ ddlm	Z	m
Z
mZmZmZmZmZmZmZmZmZ ejdkejdkejdkdZd	ed
e	fddZesQeZd
ee fddZeed< 	 eed< 	 eed< 	 e Z	 edddZede
d
efddZdee
df d
ee fddZedddZ ede
d
e!fddZ dee
 d
ee! fddZ edddZ"ede
d
e!fddZ"dee
 d
ee! fddZ"dS ) aC  Utilities to help provide compatibility with Python 3.

This module exists for historical reasons. Code outside GitPython may make use of public
members of this module, but is unlikely to benefit from doing so. GitPython continues to
use some of these utilities, in some cases for compatibility across different platforms.
    N)force_bytes
force_text)AnyAnyStrDictIOListOptionalTYPE_CHECKINGTupleTypeUnionoverloadntposixdarwin)is_winis_posix	is_darwinnamereturnc                 C   sR   zt |  }W n ty   tdtd| d w tjt d|  dtdd |S )Nzmodule z has no attribute .zt and other is_<platform> aliases are deprecated. Write the desired os.name or sys.platform check explicitly instead.   )
stacklevel)_deprecated_platform_aliasesKeyErrorAttributeError__name__warningswarnDeprecationWarning)r   value r"   F/var/www/html/chatdoc2/venv/lib/python3.10/site-packages/git/compat.py_getattr.   s   r$   c                   C   s   g t  tS N)globalsr   r"   r"   r"   r#   __dir__A   s   r'   r   r   r   sc                 C      d S r%   r"   r(   r"   r"   r#   safe_decodem      r+   c                 C   r)   r%   r"   r*   r"   r"   r#   r+   q   r,   c                 C   s>   t | tr| S t | tr| tdS | du rdS td| f )z)Safely decode a binary string to Unicode.surrogateescapeN"Expected bytes or text, but got %r)
isinstancestrbytesdecodedefenc	TypeErrorr*   r"   r"   r#   r+   u   s   

c                 C   r)   r%   r"   r*   r"   r"   r#   safe_encode   r,   r5   c                 C   r)   r%   r"   r*   r"   r"   r#   r5      r,   c                 C   s<   t | tr
| tS t | tr| S | du rdS td| f )z)Safely encode a binary string to Unicode.Nr.   )r/   r0   encoder3   r1   r4   r*   r"   r"   r#   r5      s   


c                 C   r)   r%   r"   r*   r"   r"   r#   
win_encode   r,   r7   c                 C   r)   r%   r"   r*   r"   r"   r#   r7      r,   c                 C   sB   t | tr| tdS t | tr| S | durtd| f dS )z8Encode Unicode strings for process arguments on Windows.FNr.   )r/   r0   r6   localegetpreferredencodingr1   r4   r*   r"   r"   r#   r7      s   

)r(   Nr   N)#__doc__r8   ossysr   gitdb.utils.encodingr   r   typingr   r   r   r   r   r	   r
   r   r   r   r   r   platformr   r0   r$   __getattr__r'   bool__annotations__getfilesystemencodingr3   r+   r5   r1   r7   r"   r"   r"   r#   <module>   sL   4
