B []h@sLdZddlmZmZmZddddddd d d d d dddddddddddgZddlZddlZyddlm Z m Z Wne k rdZ Z YnXej ddkrddl Z y ddlZWne k rddlZYnXeZefZeZeZeZdd ZddZdd ZddZdd0dZ%n d?d1dZ%ddl&Z&ej dd2d3kre&j'Z(ne&)d4e#fd5d6iZ(ej dd2d7kr(ej*Z+ej,Z-n d8d9Z.Gd:dde(Z-d;dZ+dS)@z Python 3 compatibility tools. )divisionabsolute_importprint_functionbytesasbytes isfileobj getexceptionstrcharunicode asunicodeasbytes_nestedasunicode_nestedasstr open_latin1long basestringsixu integer_typesis_pathlib_pathnpy_load_modulePathpicklecontextlib_nullcontext os_fspath os_PathLikeN)rPurePathcCst|tr|dSt|S)Nlatin1) isinstancerdecodestr)sr"4/tmp/pip-install-svzetoqp/numpy/numpy/compat/py3k.pyr "s  cCst|tr|St|dS)Nr)rrr encode)r!r"r"r#r's cCst|tr|dSt|S)Nr)rrrr )r!r"r"r#r,s  cCst|tjtjtjfS)N)rioFileIOBufferedReaderBufferedWriter)fr"r"r#r1srcCst||ddS)Nz iso-8859-1)modeencoding)open)filenamer+r"r"r#r4scCs|S)Nr")r!r"r"r#r7sUScCs t|tS)N)rfile)r)r"r"r#rHscCst|tr|St|dS)Nascii)rr r r)r!r"r"r#r Ks cCs t||dS)N)r+)r-)r.r+r"r"r#rPscCs t|dS)NZunicode_escape)r )r!r"r"r#rSscCs tdS)N)sysexc_infor"r"r"r#rVscCs2t|dr&t|ttfs&dd|DSt|SdS)N__iter__cSsg|] }t|qSr")r ).0yr"r"r# [sz"asbytes_nested..)hasattrrrr r)xr"r"r#r YscCs2t|dr&t|ttfs&dd|DSt|SdS)Nr6cSsg|] }t|qSr")r )r7r8r"r"r#r9asz$asunicode_nested..)r:rrr r )r;r"r"r#r _scCstdk 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#resc@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)selfr=r"r"r#__init__yszcontextlib_nullcontext.__init__cCs|jS)N)r=)r>r"r"r# __enter__|sz contextlib_nullcontext.__enter__cGsdS)Nr")r>excinfor"r"r#__exit__szcontextlib_nullcontext.__exit__)N)__name__ __module__ __qualname____doc__r?r@rBr"r"r"r#rns  r3cCsddl}|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)Zimportlib.machinery machinerySourceFileLoader load_module)namefninfo importlibr"r"r#rscCsdddl}|dkr2tj|}|||g\}}}nt||d}z|||||}Wd|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 rNr3)impospathdirname find_moduler-rJclose)rKrLrMrOrQfomodr"r"r#rs  )rrGABC __slots__r")rcCst|S)N)r )r>r"r"r#_PurePath__fspath__sr[c@s*eZdZdZejddZeddZdS)rzCAbstract base class for implementing the file system path protocol.cCstdS)z9Return the file system path representation of the object.N)NotImplementedError)r>r"r"r# __fspath__szos_PathLike.__fspath__cCs tdk rt|trdSt|dS)NTr])r issubclassr:)clssubclassr"r"r#__subclasshook__szos_PathLike.__subclasshook__N) rCrDrErFabcabstractmethodr] classmethodrar"r"r"r#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. r]Nz/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {}) rr rtyper]AttributeErrorr:rr^r[ TypeErrorrCformat)rQ path_type path_reprr"r"r#rs" )r*)r*)N)N)/rF __future__rrr__all__r4rPZpathlibrr ImportError version_infor%Zpickle5rintrrr rr rr rrrrrr Zcpicklerr r robjectrrrbrXZabc_ABCABCMetafspathrPathLikerr[r"r"r"r#sz          "