U Dx`? @s*dZddddddddd d d d d dddddddddgZddlZddlZddlmZddlZddlZddlmZ z ddl Z Wne k rddl Z YnXe Ze fZeZeZeZddZddZdd ZddZd)d d Zd!dZd"Zd#dZd$dZd%d Zd&dZGd'ddZd*d(dZ ej!Z"ej#Z$dS)+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. bytesasbytes isfileobj getexceptionstrcharunicode asunicodeasbytes_nestedasunicode_nestedasstr open_latin1long basestringsixu integer_typesis_pathlib_pathnpy_load_modulePathpicklecontextlib_nullcontext os_fspath os_PathLikeN)r)ABCcCst|tr|dSt|SNlatin1 isinstancerdecodestrsr!8/tmp/pip-target-zr53vnty/lib/python/numpy/compat/py3k.pyr&s  cCst|tr|St|dSr)rrrencoderr!r!r"r+s cCst|tr|dSt|Srrrr!r!r"r 0s  cCst|tjtjtjfSN)rioFileIOBufferedReaderBufferedWriter)fr!r!r"r5srcCst||ddS)Nz iso-8859-1)modeencoding)open)filenamer+r!r!r"r 8scCs|Sr$r!rr!r!r"r;sUcCs tdS)N)sysexc_infor!r!r!r"r@scCs2t|dr&t|ttfs&dd|DSt|SdS)N__iter__cSsg|] }t|qSr!)r.0yr!r!r" Esz"asbytes_nested..)hasattrrrrrxr!r!r"rCscCs2t|dr&t|ttfs&dd|DSt|SdS)Nr3cSsg|] }t|qSr!)r r4r!r!r"r7Ksz$asunicode_nested..)r8rrrrr9r!r!r"r IscCs t|tS)z Check whether obj is a `pathlib.Path` object. Prefer using ``isinstance(obj, os.PathLike)`` instead of this function. )rr)objr!r!r"rOsc@s*eZdZdZd ddZddZddZdS) 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 ||_dSr$ enter_result)selfr=r!r!r"__init__cszcontextlib_nullcontext.__init__cCs|jSr$r<)r>r!r!r" __enter__fsz contextlib_nullcontext.__enter__cGsdSr$r!)r>excinfor!r!r"__exit__iszcontextlib_nullcontext.__exit__)N)__name__ __module__ __qualname____doc__r?r@rBr!r!r!r"rXs cCsddlm}|||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)Zimportlib.machineryrG load_module)namefninforGr!r!r"rms )r*)N)%rF__all__r1ospathlibrr%abcrZabc_ABCZpickle5r ImportErrorintr rrr rrrrr rr rrrrr rrrfspathrPathLikerr!r!r!r"sb