U :e@sdZdZeeZddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddddZeejZddddZeedZdZd Zd!gZd"gZeZZded#d$d%d&Zd'd(Zd)d*Zd+d,Z d-d.Z!d/d0Z"d1d2Z#d3d4Z$d5d6Z%d7d8Z&dfd9d:Z'dgd._relax_casecSsdS)NFrrrrr r (s)sysplatform startswith_CASE_INSENSITIVE_PLATFORMS#_CASE_INSENSITIVE_PLATFORMS_STR_KEY)r rr r _make_relax_cases  rcCst|d@ddS)Nlittle)intto_bytes)xrrr _pack_uint32.srcCs t|dSNrr from_bytesdatarrr _unpack_uint323srcCs t|dSrrrrrr _unpack_uint168sr cGstdd|DS)NcSsg|]}|r|tqSr)rstrippath_separators).0partrrr @sz_path_join..)path_sepjoin) path_partsrrr _path_join>s r)cCs`ttdkr$|t\}}}||fSt|D]*}|tkr,|j|dd\}}||fSq,d|fS)N)maxsplit)lenr" rpartitionr&reversedrsplit)pathfront_tailrrrr _path_splitDs  r5cCs t|Sr)rstatr1rrr _path_statPsr8cCs2z t|}Wntk r"YdSX|jd@|kS)NFi)r8OSErrorst_mode)r1mode stat_inforrr _path_is_mode_typeZs  r=cCs t|dS)Ni)r=r7rrr _path_isfilecsr>cCs|s t}t|dS)Ni@)rgetcwdr=r7rrr _path_isdirhsr@cCs|tp|ddtkS)Nr*)rr"_pathseps_with_colonr7rrr _path_isabsosrCc Csd|t|}t|tjtjBtjB|d@}z2t|d}| |W5QRXt ||Wn:t k rzt |Wnt k rYnXYnXdS)N{}.{}rDwb) formatidropenO_EXCLO_CREATO_WRONLY_ioFileIOwritereplacer9unlink)r1rr;path_tmpfdfilerrr _write_atomicxsrUiU rs __pycache__zopt-z.pyz.pycN) optimizationc CsX|dk r4tdt|dk r(d}t||r0dnd}t|}t|\}}|d\}}}tj j } | dkrrt dd |r~|n||| g} |dkrtj jdkrd}ntj j}t|}|dkr|std|d | t|} | td} tjdk rLt|stt|}|dd kr8|dtkr8|d d}ttj|t| St|t| S) NzFthe debug_override parameter is deprecated; use 'optimization' insteadz2debug_override or optimization must be set to Noner,r*.$sys.implementation.cache_tag is Nonez{!r} is not alphanumericz{}.{}{}:rV) _warningswarnDeprecationWarning TypeErrorrfspathr5r.r implementation cache_tagNotImplementedErrorr'flagsoptimizestrisalnum ValueErrorrG_OPTBYTECODE_SUFFIXESpycache_prefixrCr)r?r"lstrip_PYCACHE) r1debug_overriderXmessageheadr4basesepresttagalmost_filenamefilenamerrr cache_from_source&sH       rxc Cs.tjjdkrtdt|}t|\}}d}tjdk rftjt }| |t rf|t |d}d}|st|\}}|t krtt d||d}|dkrtd|n\|dkr|dd d }| tstd t|t td}|std |d |dd} t|| tdS)NrZFTz not bottom-level directory in rY>rVrAzexpected only 2 or 3 dots in rArVz5optimization portion of filename does not start with zoptimization level z is not an alphanumeric valuer[)r rbrcrdrrar5rlr!r"rr&r-rnricountr0rjrh partitionr)SOURCE_SUFFIXES) r1rqpycache_filenamefound_in_pycache_prefix stripped_pathpycache dot_countrX opt_level base_filenamerrr source_from_cachems4          rc Cs~t|dkrdS|d\}}}|r8|dddkr<|Sz t|}Wn$ttfk rl|dd}YnXt|rz|S|S)Nr[rYpy)r-r.lowerrrdrir>) bytecode_pathrtr3 extension source_pathrrr _get_sourcefiles  rcCsJ|ttr0z t|WStk r,YqFXn|ttrB|SdSdSr)endswithtupler|rxrdrk)rwrrr _get_cacheds rcCs4zt|j}Wntk r&d}YnX|dO}|S)NrD)r8r:r9)r1r;rrr _calc_modes  rcsDdfdd }z tj}Wntk r4dd}YnX|||S)NcsB|dkr|j}n |j|kr0td|j|f|d||f||S)Nzloader for %s cannot handle %sname)r ImportError)selfrargskwargsmethodrr _check_name_wrappers z(_check_name.._check_name_wrappercSs8dD] }t||rt||t||q|j|jdS)N) __module____name__ __qualname____doc__)hasattrsetattrgetattr__dict__update)newoldrPrrr _wraps z_check_name.._wrap)N) _bootstrapr NameError)rrrrrr _check_names  rcCs<||\}}|dkr8t|r8d}t||dt|S)Nz,Not importing directory {}: missing __init__r[) find_loaderr-r]r^rG ImportWarning)rfullnameloaderportionsmsgrrr _find_module_shims rcCs|dd}|tkrB}|t||||t||S)Nr*r)rrcheckedrrerrr _code_to_hash_pycYs   rcCs>ddl}t|j}||}tdd}|||dS)Nr[T)tokenizerMBytesIOreadlinedetect_encodingIncrementalNewlineDecoderdecode) source_bytesrsource_bytes_readlineencodingnewline_decoderrrr decode_sourceds    rrsubmodule_search_locationsc Cs|dkr get_filenameoriginT is_packager[)rrrrrar ModuleSpec _set_fileattr_get_supported_file_loadersrrr _POPULATErrr5append) rlocationrrspec loader_classsuffixesrdirnamerrr spec_from_file_locationus>        rc@sLeZdZdZdZdZeddZeddZed d d Z edd d Z dS)WindowsRegistryFinderz;Software\Python\PythonCore\{sys_version}\Modules\{fullname}zASoftware\Python\PythonCore\{sys_version}\Modules\{fullname}\DebugFcCs8zttj|WStk r2ttj|YSXdSr)_winregOpenKeyHKEY_CURRENT_USERr9HKEY_LOCAL_MACHINE)clsr rrr _open_registrysz$WindowsRegistryFinder._open_registryc Csr|jr|j}n|j}|j|dtjddd}z&||}t|d}W5QRXWnt k rlYdSX|S)Nz%d.%drV)r sys_versionr,) DEBUG_BUILDREGISTRY_KEY_DEBUG REGISTRY_KEYrGr version_inforr QueryValuer9)rr registry_keyr hkeyfilepathrrr _search_registrys z&WindowsRegistryFinder._search_registryNcCsz||}|dkrdSz t|Wntk r8YdSXtD]4\}}|t|r@tj|||||d}|Sq@dS)Nr)rr8r9rrrrspec_from_loader)rrr1targetrrrrrrr find_specs  zWindowsRegistryFinder.find_speccCs"|||}|dk r|jSdSdSrrrrrr1rrrr find_modules z!WindowsRegistryFinder.find_module)NN)N) rrrrrr classmethodrrrrrrrr rs   rc@s,eZdZddZddZddZddZd S) _LoaderBasicscCs@t||d}|ddd}|dd}|dko>|dkS)Nr*rYr[rV__init__)r5rr0r.)rrrw filename_base tail_namerrr rsz_LoaderBasics.is_packagecCsdSrrrrrrr create_modulesz_LoaderBasics.create_modulecCs8||j}|dkr$td|jtt||jdS)Nz4cannot load module {!r} when get_code() returns None)get_coderrrGr_call_with_frames_removedexecr)rmodulerrrr exec_module s  z_LoaderBasics.exec_modulecCs t||Sr)r_load_module_shimrrrrr load_modulesz_LoaderBasics.load_moduleN)rrrrr rrrrrr rsrc@sJeZdZddZddZddZddZd d Zd d d dZddZ dS) SourceLoadercCstdSr)r9rr1rrr path_mtimeszSourceLoader.path_mtimecCsd||iS)Nr)rrrrr path_stats s zSourceLoader.path_statscCs |||Sr)set_data)rr cache_pathrrrr _cache_bytecode.szSourceLoader._cache_bytecodecCsdSrr)rr1rrrr r8szSourceLoader.set_datac CsR||}z||}Wn0tk rH}ztd|d|W5d}~XYnXt|S)Nz'source not available through get_data()r)rget_datar9rr)rrr1rexcrrr get_source?s zSourceLoader.get_sourcer) _optimizecCstjt||dd|dS)NrT) dont_inheritrf)rrcompile)rrr1rrrr source_to_codeIs zSourceLoader.source_to_codec Cs"||}d}d}d}d}d}z t|}Wntk rDd}Yn0Xz||} Wntk rjYn Xt| d}z||} Wntk rYnX||d} zt| || } t| dd} | d@dk}|r$| d@dk}t j d kr8|st j d kr8||}t t |}t | ||| nt| || d || Wnttfk rTYn Xtd ||t| |||d S|dkr||}|||}td|tjs|dk r|dk r|r|dkrt |}t|||} nt||t|} z|||| Wntk rYnX|S)NFTrrrr*r[rVneveralwayssizez {} matches {})rrrzcode object from {})rrxrdrr9rrr memoryviewrcheck_hash_based_pycsr_RAW_MAGIC_NUMBERrrrrrrrr"r dont_write_bytecoderrr-r)rrrrrr hash_based check_sourcerstrrre bytes_data code_objectrrr r Qs               zSourceLoader.get_codeN) rrrrrrrrr"r rrrr rs  rcsxeZdZddZddZddZefddZed d Zd d Z ed dZ ddZ ddZ ddZ ddZZS) FileLoadercCs||_||_dSrr)rrr1rrr rszFileLoader.__init__cCs|j|jko|j|jkSr __class__rrotherrrr __eq__s  zFileLoader.__eq__cCst|jt|jASrhashrr1rrrr __hash__szFileLoader.__hash__cstt||Sr)superr/rrr1rr rs zFileLoader.load_modulecCs|jSrr7rrrr rszFileLoader.get_filenamec Csft|ttfr:tt|}|W5QRSQRXn(t|d}|W5QRSQRXdS)Nr)rrExtensionFileLoaderrM open_codergreadrN)rr1rTrrr rs zFileLoader.get_datacCs||r|SdSr)rrrrrr get_resource_readers zFileLoader.get_resource_readercCs tt|jd|}t|dS)Nr[r;)r)r5r1rMrNrresourcer1rrr open_resourceszFileLoader.open_resourcecCs&||sttt|jd|}|Sr) is_resourceFileNotFoundErrorr)r5r1rArrr resource_paths zFileLoader.resource_pathcCs(t|kr dStt|jd|}t|S)NFr[)r&r)r5r1r>rrr1rrr rDszFileLoader.is_resourcecCsttt|jdSr)iterrlistdirr5r1r7rrr contentsszFileLoader.contents)rrrrr4r8rrrrr@rCrFrDrJ __classcell__rrr:r r/s    r/c@s*eZdZddZddZddddZd S) SourceFileLoadercCst|}|j|jdS)N)rr%)r8st_mtimest_size)rr1r,rrr rszSourceFileLoader.path_statscCst|}|j|||dS)N_mode)rr)rrrrr;rrr rsz SourceFileLoader._cache_bytecoderDrOc Cst|\}}g}|r4t|s4t|\}}||qt|D]l}t||}zt|Wq<tk rpYq\sz1ExtensionFileLoader.is_package..)r5r1anyEXTENSION_SUFFIXESrrrYr rYs zExtensionFileLoader.is_packagecCsdSrrrrrr r _szExtensionFileLoader.get_codecCsdSrrrrrr rcszExtensionFileLoader.get_sourcecCs|jSrr7rrrr rgsz ExtensionFileLoader.get_filenameN) rrrrr4r8r rrr rrrrrrr r<8sr<c@sdeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS)_NamespacePathcCs$||_||_t||_||_dSr)_name_pathr_get_parent_path_last_parent_path _path_finderrrr1 path_finderrrr rtsz_NamespacePath.__init__cCs&|jd\}}}|dkrdS|dfS)NrYr,)r r1__path__)r_r.)rrSdotmerrr _find_parent_path_nameszsz&_NamespacePath._find_parent_path_namescCs|\}}ttj||Sr)rirr modules)rparent_module_namepath_attr_namerrr ras z_NamespacePath._get_parent_pathcCsPt|}||jkrJ||j|}|dk rD|jdkrD|jrD|j|_||_|jSr)rrarbrcr_rrr`)r parent_pathrrrr _recalculates  z_NamespacePath._recalculatecCs t|Sr)rHrnr7rrr __iter__sz_NamespacePath.__iter__cCs ||Srrn)rindexrrr __getitem__sz_NamespacePath.__getitem__cCs||j|<dSr)r`)rrqr1rrr __setitem__sz_NamespacePath.__setitem__cCs t|Sr)r-rnr7rrr __len__sz_NamespacePath.__len__cCs d|jS)Nz_NamespacePath({!r}))rGr`r7rrr __repr__sz_NamespacePath.__repr__cCs ||kSrrpritemrrr __contains__sz_NamespacePath.__contains__cCs|j|dSr)r`rrvrrr rsz_NamespacePath.appendN)rrrrrirarnrorrrsrtrurxrrrrr r^ms  r^c@sPeZdZddZeddZddZddZd d Zd d Z d dZ ddZ dS)_NamespaceLoadercCst||||_dSr)r^r`rdrrr rsz_NamespaceLoader.__init__cCs d|jS)Nz)rGr)rrrrr module_reprsz_NamespaceLoader.module_reprcCsdS)NTrrrrr rsz_NamespaceLoader.is_packagecCsdSNr,rrrrr rsz_NamespaceLoader.get_sourcecCstdddddS)Nr,zrT)r )r!rrrr r sz_NamespaceLoader.get_codecCsdSrrr rrr r sz_NamespaceLoader.create_modulecCsdSrrr?rrr rsz_NamespaceLoader.exec_modulecCstd|jt||S)Nz&namespace module loaded with path {!r})rrr`rrrrr rsz_NamespaceLoader.load_moduleN) rrrrrrzrrr r rrrrrr rys ryc@sreZdZeddZeddZeddZeddZedd d Zedd d Z edddZ eddZ d S) PathFindercCs@ttjD],\}}|dkr(tj|=qt|dr|qdS)Ninvalidate_caches)listr path_importer_cacheitemsrr})rrfinderrrr r}s   zPathFinder.invalidate_cachesc CsTtjdk rtjstdttjD],}z||WStk rLYq"Yq"Xq"dS)Nzsys.path_hooks is empty)r path_hooksr]r^rr)rr1hookrrr _path_hookss   zPathFinder._path_hookscCsh|dkr,z t}Wntk r*YdSXztj|}Wn(tk rb||}|tj|<YnX|Sr{)rr?rEr rKeyErrorr)rr1rrrr _path_importer_caches  zPathFinder._path_importer_cachecCsRt|dr||\}}n||}g}|dk r.rYr)r_loadersr1 _path_mtimeset _path_cache_relaxed_path_cache)rr1loader_detailsloadersrrrr rrs  zFileFinder.__init__cCs d|_dS)Nr)rr7rrr r}szFileFinder.invalidate_cachescCs*||}|dkrdgfS|j|jp&gfSr)rrr)rrrrrr rs zFileFinder.find_loadercCs|||}t||||dS)Nr)r)rrrr1smslrrrrr rs zFileFinder._get_specNcCsbd}|dd}zt|jp"tj}Wntk rBd}YnX||jkr\|||_t rr|j }| }n |j }|}||krt |j|}|jD]:\} } d| } t || } t| r|| || |g|Sqt|}|jD]R\} } t |j|| } tjd| dd|| |krt| r|| || d|Sq|r^td|t|d} |g| _| SdS) NFrYrVrrz trying {}) verbosityzpossible namespace for {})r.r8r1rr?rMr9r _fill_cacher rrrr)rr>rr@rrrr)rrr is_namespace tail_modulercache cache_module base_pathrXr init_filename full_pathrrrr rsJ          zFileFinder.find_specc Cs|j}zt|pt}Wntttfk r:g}YnXtj dsTt ||_ nJt }|D]8}| d\}}}|rd ||}n|}||q^||_ tj trdd|D|_dS)NrrYrEcSsh|] }|qSr)r)r#fnrrr sz)FileFinder._fill_cache..)r1rrIr?rEPermissionErrorNotADirectoryErrorr rrrrr{rGraddrr) rr1rJlower_suffix_contentsrwrrgrXnew_namerrr rs"     zFileFinder._fill_cachecsfdd}|S)Ncs"t|std|d|fS)Nzonly directories are supportedr7)r@rr7rrrr path_hook_for_FileFinders z6FileFinder.path_hook..path_hook_for_FileFinderr)rrrrrr path_hooks zFileFinder.path_hookcCs d|jS)NzFileFinder({!r}))rGr1r7rrr ruszFileFinder.__repr__)N)rrrrr}rrrrrrrrrurrrr ris   0 rcCs|d}|d}|sB|r$|j}n||kr8t||}n t||}|sTt|||d}z$||d<||d<||d<||d<Wntk rYnXdS)N __loader____spec__r__file__ __cached__)getrrTrLr Exception)nsrpathname cpathnamerrrrr _fix_up_modules"     rcCs&ttf}ttf}ttf}|||gSr)r<rextension_suffixesrLr|rTrk) extensionssourcebytecoderrr rs rc Cs|atjatjatjt}dD]0}|tjkr8t|}n tj|}t|||qddgfdddgff}|D]X\}}|d}|tjkrtj|}qqjzt|}WqWqjtk rYqjYqjXqjtdt|d|t|d |t|d d |t|d d d|Dtd} t|d| td} t|d| |dkrXtd} t|d| t|dt t t |dkrt ddt krdt_dS)N)rMr]builtinsrposix/nt\r[zimportlib requires posix or ntrr&r"r,rBcSsh|]}d|qS)r\r)r#srrr rIsz_setup.._thread_weakrefwinregrr z.pywz_d.pydT)rr rrjr_builtin_from_namerrr'rr]rrr|rrr) _bootstrap_module self_module builtin_namebuiltin_module os_details builtin_osr"r& os_module thread_moduleweakref_module winreg_modulerrr _setup sL                      rcCs2t|t}tjtj|gtjt dSr) rrr rrrr meta_pathrr|)rsupported_loadersrrr _installasr)rD)N)NNN)r[r[)T)N)N)>r%_CASE_INSENSITIVE_PLATFORMS_BYTES_KEYrrrrr r)r5r8r=r>r@rCrUtype__code__rrrrrr(rnrjr|rkDEBUG_BYTECODE_SUFFIXESOPTIMIZED_BYTECODE_SUFFIXESrxrrrrrrrrrrrrrobjectrrrrrr/rLrTr]r<r^ryr|rrrrrrrrr s|       G(  !  D@H-5?*  A