
    wg                         d Z g dZddlZddlZddlmZ ddlZ	 ddlZe
Ze
fZeZeZeZd Zd Zd Zd Zdd	Zd
 ZdZd Zd Zd Zd Z G d d      ZddZej<                  Zej@                  Z!y# e	$ r ddlZY ^w xY w)a  
Python 3.X compatibility tools.

While this file was originally intended for Python 2 -> 3 transition,
it is now used to create a compatibility layer between different
minor versions of Python 3.

While the active version of numpy may not support a given version of python, we
allow downstream libraries to continue to use these shims for forward
compatibility with numpy while they transition their code to newer versions of
Python.
)bytesasbytes	isfileobjgetexceptionstrcharunicode	asunicodeasbytes_nestedasunicode_nestedasstropen_latin1long
basestringsixuinteger_typesis_pathlib_pathnpy_load_modulePathpicklecontextlib_nullcontext	os_fspathos_PathLike    N)r   c                 Z    t        | t              r| j                  d      S t        |       S Nlatin1
isinstancer   decodestrss    V/home/mcse/projects/flask/flask-venv/lib/python3.12/site-packages/numpy/compat/py3k.pyr   r   "   $    !Uxx!!q6M    c                 Z    t        | t              r| S t        |       j                  d      S r   )r   r   r   encoder    s    r"   r   r   '   s$    !Uq6==""r$   c                 Z    t        | t              r| j                  d      S t        |       S r   r   r    s    r"   r   r   ,   r#   r$   c                     t        | t        j                  t        j                  t        j                  f      sy	 | j                          y# t        $ r Y yw xY w)NFT)r   ioFileIOBufferedReaderBufferedWriterfilenoOSError)fs    r"   r   r   1   sK    a"))R%6%68I8IJK 	

 s   A 	AAc                     t        | |d      S )Nz
iso-8859-1)modeencoding)open)filenamer1   s     r"   r   r   <   s    tl;;r$   c                     | S N r    s    r"   r   r   ?   s    Hr$   Uc                  0    t        j                         d   S )N   )sysexc_infor7   r$   r"   r   r   D   s    <<>!r$   c                     t        | d      r/t        | t        t        f      s| D cg c]  }t	        |       c}S t        |       S c c}w N__iter__)hasattrr   r   r   r	   r   xys     r"   r	   r	   G   s?    q*jUG4D&E+,-aq!--qz .   Ac                     t        | d      r/t        | t        t        f      s| D cg c]  }t	        |       c}S t        |       S c c}w r>   )r@   r   r   r   r
   r   rA   s     r"   r
   r
   M   s@    q*jUG4D&E-./ #//| 0rD   c                 "    t        | t              S )z
    Check whether obj is a `pathlib.Path` object.

    Prefer using ``isinstance(obj, os.PathLike)`` instead of this function.
    )r   r   )objs    r"   r   r   S   s     c4  r$   c                   $    e Zd ZdZddZd Zd Zy)r   a  Context manager that does no additional processing.

    Used as a stand-in for a normal context manager, when a particular
    block of code is only sometimes used with a normal context manager:

    cm = optional_cm if condition else nullcontext()
    with cm:
        # Perform operation, using optional_cm if condition is True

    .. note::
        Prefer using `contextlib.nullcontext` instead of this context manager.
    Nc                     || _         y r6   enter_result)selfrK   s     r"   __init__zcontextlib_nullcontext.__init__j   s
    (r$   c                     | j                   S r6   rJ   )rL   s    r"   	__enter__z contextlib_nullcontext.__enter__m   s       r$   c                      y r6   r7   )rL   excinfos     r"   __exit__zcontextlib_nullcontext.__exit__p   s    r$   r6   )__name__
__module____qualname____doc__rM   rO   rR   r7   r$   r"   r   r   \   s    )!r$   r   c                 <    ddl m}  || |      j                         S )a  
    Load a module. Uses ``load_module`` which will be deprecated in python
    3.12. An alternative that uses ``exec_module`` is in
    numpy.distutils.misc_util.exec_mod_from_location

    .. versionadded:: 1.11.2

    Parameters
    ----------
    name : str
        Full module name.
    fn : str
        Path to module file.
    info : tuple, optional
        Only here for backward compatibility with Python 2.*.

    Returns
    -------
    mod : module

    r   )SourceFileLoader)importlib.machineryrX   load_module)namefninforX   s       r"   r   r   t   s    0 5D"%1133r$   )rr6   )"rV   __all__r;   ospathlibr   r)   pickle5r   ImportErrorintr   r   r   r   r   r   r   r   r   r   r   r   r   r   r	   r
   r   r   r   fspathr   PathLiker   r7   r$   r"   <module>rg      s   K  	  	 


#

	< ! 048 II	kkq  s   A1 1	A=<A=