B { `R@sddZddddddddd d d d d dddddddddgZddlZddlZddlmZmZddlZddlZddlm Z y ddl Z Wne k rddl Z YnXeZefZeZeZeZddZddZdd ZddZd/d d Zd!dZd"Zd#dZd$dZd%d Zd&dZGd'ddZ d0d(dZ!ej"dd)d*kr@ej#Z$ej%Z&n d+d,Z'Gd-dde Z&d.dZ$dS)1a 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)rPurePath)ABCcCst|tr|dSt|S)Nlatin1) isinstancerdecodestr)sr5/tmp/pip-unpacked-wheel-4iou4664/numpy/compat/py3k.pyr&s  cCst|tr|St|dS)Nr)rrrencode)rrrr r+s cCst|tr|dSt|S)Nr)rrrr)rrrr r 0s  cCst|tjtjtjfS)N)rioFileIOBufferedReaderBufferedWriter)frrr r5srcCst||ddS)Nz iso-8859-1)modeencoding)open)filenamer(rrr r 8scCs|S)Nr)rrrr r;sUcCs tdS)N)sysexc_inforrrr r@scCs2t|dr&t|ttfs&dd|DSt|SdS)N__iter__cSsg|] }t|qSr)r).0yrrr Esz"asbytes_nested..)hasattrrrrr)xrrr rCscCs2t|dr&t|ttfs&dd|DSt|SdS)Nr0cSsg|] }t|qSr)r )r1r2rrr r3Ksz$asunicode_nested..)r4rrrr)r5rrr r IscCstdk ot|tS)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 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 ||_dS)N) enter_result)selfr7rrr __init__cszcontextlib_nullcontext.__init__cCs|jS)N)r7)r8rrr __enter__fsz contextlib_nullcontext.__enter__cGsdS)Nr)r8excinforrr __exit__iszcontextlib_nullcontext.__exit__)N)__name__ __module__ __qualname____doc__r9r:r<rrrr 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.machineryrA load_module)namefninforArrr rms )cCst|S)N)r)r8rrr _PurePath__fspath__srIc@s*eZdZdZejddZeddZdS)rzCAbstract base class for implementing the file system path protocol.cCstdS)z9Return the file system path representation of the object.N)NotImplementedError)r8rrr __fspath__szos_PathLike.__fspath__cCs tdk rt|trdSt|dS)NTrK)r issubclassr4)clssubclassrrr __subclasshook__szos_PathLike.__subclasshook__N) r=r>r?r@abcabstractmethodrK classmethodrOrrrr rscCst|ttfr|St|}y||}WnJtk rrt|drFn(tdk r`t|tr`t |St d|j YnXt|ttfr|St d |j t|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 {}) rrrtyperKAttributeErrorr4rrLrI TypeErrorr=format)path path_type path_reprrrr rs" )r')N)(r@__all__r.ospathlibrrr"rPrZabc_ABCZpickle5r ImportErrorintr rrr rrrrr rr rrrrr rrr version_infofspathrPathLikerrIrrrr  sN