HOME


sh-3ll 1.0
DIR:/usr/local/lib64/python3.6/site-packages/numpy/compat/__pycache__/
Upload File :
Current File : //usr/local/lib64/python3.6/site-packages/numpy/compat/__pycache__/py3k.cpython-36.pyc
3

���hR�@sddZddddddddd	d
ddd
dddddddddgZddlZddlZddlmZmZddlZddlZddlm	Z
yddlZWne
k
r�ddlZYnXeZefZeZeZeZdd�Zdd�Zdd
�Zdd�Zd0d d�Zd!d�Zd"Zd#d�Zd$d�Zd%d	�Zd&d�ZGd'd�d�Z d1d(d�Z!ej"dd)�d2k�r@ej#Z$ej%Z&n d,d-�Z'Gd.d�de
�Z&d/d�Z$dS)3a�
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�PurePath)�ABCcCst|t�r|jd�St|�S)N�latin1)�
isinstancer�decode�str)�s�r�2/tmp/pip-build-5_djhm0z/numpy/numpy/compat/py3k.pyr&s

cCst|t�r|St|�jd�S)Nr)rrr�encode)rrrr r+s
cCst|t�r|jd�St|�S)Nr)rrrr)rrrr r
0s

cCst|tjtjtjf�S)N)r�io�FileIO�BufferedReader�BufferedWriter)�frrr r5s�rcCst||dd�S)Nz
iso-8859-1)�mode�encoding)�open)�filenamer(rrr r8scCs|S)Nr)rrrr r;s�UcCstj�dS)N�)�sys�exc_inforrrr r@scCs4t|d�r(t|ttf�r(dd�|D�St|�SdS)N�__iter__cSsg|]}t|��qSr)r)�.0�yrrr �
<listcomp>Esz"asbytes_nested.<locals>.<listcomp>)�hasattrrrrr)�xrrr rCscCs4t|d�r(t|ttf�r(dd�|D�St|�SdS)Nr0cSsg|]}t|��qSr)r	)r1r2rrr r3Ksz$asunicode_nested.<locals>.<listcomp>)r4rrrr)r5rrr r	IscCstdk	ot|t�S)z�
    Check whether obj is a pathlib.Path object.

    Prefer using `isinstance(obj, os_PathLike)` instead of this function.
    N)rr)�objrrr rOsc@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
raOContext 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
    NcCs
||_dS)N)�enter_result)�selfr7rrr �__init__cszcontextlib_nullcontext.__init__cCs|jS)N)r7)r8rrr �	__enter__fsz contextlib_nullcontext.__enter__cGsdS)Nr)r8Zexcinforrr �__exit__iszcontextlib_nullcontext.__exit__)N)�__name__�
__module__�__qualname__�__doc__r9r:r;rrrr rXs	
cCsddlm}|||�j�S)a,
    Load a module.

    .. 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.machineryr@�load_module)�name�fn�infor@rrr rms���cCst|�S)N)r)r8rrr �_PurePath__fspath__�srIc@s*eZdZdZejdd��Zedd��ZdS)rzCAbstract base class for implementing the file system path protocol.cCst�dS)z9Return the file system path representation of the object.N)�NotImplementedError)r8rrr �
__fspath__�szos_PathLike.__fspath__cCs tdk	rt|t�rdSt|d�S)NTrK)r�
issubclassr4)�cls�subclassrrr �__subclasshook__�szos_PathLike.__subclasshook__N)	r<r=r>r?�abc�abstractmethodrK�classmethodrOrrrr r�sc
Cs�t|ttf�r|St|�}y|j|�}WnJtk
rrt|d�rF�n(tdk	r`t|t�r`t	|�St
d|j��YnXt|ttf�r�|St
dj|jt|�j���dS)atReturn the path representation of a path-like object.
        If str or bytes is passed in, it is returned unchanged. Otherwise the
        os.PathLike interface is used to get the path representation. If the
        path representation is not str or bytes, TypeError is raised. If the
        provided path is not str, bytes, or os.PathLike, TypeError is raised.
        rKNz/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {})
rrr�typerK�AttributeErrorr4rrLrI�	TypeErrorr<�format)�path�	path_type�	path_reprrrr r�s"
)r')N)rGrH)(r?�__all__r.�osZpathlibrrr"rPrZabc_ABCZpickle5r�ImportError�intrrrr
rrrrr
rrrrrrr	rrr�version_info�fspathr�PathLikerrIrrrr �<module>sN