U C^@s8dZddddddddd d d d d dddddddddgZddlZddlZzddlmZmZWnek rtdZZYnXejddkrddl Z z ddl Z Wnek rddl Z YnXe Z e fZeZeZeZddZddZdd ZddZd;d d Zd!dZd"ZnNddlZ eZe Z eZeZe e fZeZeZd#Zd$dZd%dZdd0dZ!ddl"Z"ejdd1d2kre"j#Z$ne"%d3efd4d5iZ$ejdd1d6krej&Z'ej(Z)n d7d8Z*Gd9dde$Z)d:dZ'dS)?a Python 3.X compatibility tools. While this file was originally intented 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)rPurePathcCst|tr|dSt|SNlatin1 isinstancerdecodestrsr"4/tmp/pip-install-6_kvzl1k/numpy/numpy/compat/py3k.pyr(s  cCst|tr|St|dSr)rrrencoder r"r"r#r-s cCst|tr|dSt|Srrr r"r"r#r 2s  cCst|tjtjtjfSN)rioFileIOBufferedReaderBufferedWriterfr"r"r#r7srcCst||ddS)Nz iso-8859-1)modeencodingopenfilenamer-r"r"r#r :scCs|Sr%r"r r"r"r#r=sUScCs t|tSr%)rfiler*r"r"r#rNscCst|tr|St|dS)Nascii)rrrrr r"r"r#rQs cCs t||dS)N)r-r/r1r"r"r#r VscCs t|dS)NZunicode_escape)rr r"r"r#rYscCs tdS)N)sysexc_infor"r"r"r#r\scCs2t|dr&t|ttfs&dd|DSt|SdS)N__iter__cSsg|] }t|qSr")r.0yr"r"r# asz"asbytes_nested..)hasattrrrrrxr"r"r#r_scCs2t|dr&t|ttfs&dd|DSt|SdS)Nr:cSsg|] }t|qSr")r r;r"r"r#r>gsz$asunicode_nested..)r?rrrrr@r"r"r#r escCstdk ot|tS)z Check whether obj is a pathlib.Path object. Prefer using `isinstance(obj, os_PathLike)` instead of this function. N)rr)objr"r"r#rksc@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)selfrDr"r"r#__init__szcontextlib_nullcontext.__init__cCs|jSr%rCrEr"r"r# __enter__sz contextlib_nullcontext.__enter__cGsdSr%r")rEexcinfor"r"r#__exit__szcontextlib_nullcontext.__exit__)N)__name__ __module__ __qualname____doc__rFrHrJr"r"r"r#rts r7cCsddl}|j||S)ad 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 rN)importlib.machinery machinerySourceFileLoader load_module)namefninfo importlibr"r"r#rscCsdddl}|dkr2tj|}|||g\}}}nt||d}z|||||}W5|X|S)a} Load a module. .. versionadded:: 1.11.2 Parameters ---------- name : str Full module name. fn : str Path to module file. info : tuple, optional Information as returned by `imp.find_module` (suffix, mode, type). Returns ------- mod : module rNr7)impospathdirname find_moduler0closerS)rTrUrVrXrZfomodr"r"r#rs  )rrOABC __slots__r")rcCst|Sr%)rrGr"r"r#_PurePath__fspath__srdc@s*eZdZdZejddZeddZdS)rzCAbstract base class for implementing the file system path protocol.cCstdS)z9Return the file system path representation of the object.N)NotImplementedErrorrGr"r"r# __fspath__szos_PathLike.__fspath__cCs tdk rt|trdSt|dS)NTrf)r issubclassr?)clssubclassr"r"r#__subclasshook__szos_PathLike.__subclasshook__N) rKrLrMrNabcabstractmethodrf classmethodrjr"r"r"r#rs  cCst|ttfr|St|}z||}WnNtk rvt|drFn,tdk rdt|trdt |YSt 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. rfNz/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {}) rrrtyperfAttributeErrorr?rrgrd TypeErrorrKformat)rZ path_type path_reprr"r"r#rs&   )r,)r,)N)N)+rN__all__r8rYpathlibrr ImportError version_infor&Zpickle5rintr rrr rrrrr rr rrZcpicklerrr robjectrrrkraZabc_ABCABCMetafspathrPathLikerrdr"r"r"r#s        "