\dxdZddlZddlmZmZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddgZ ejZejddZGddeZiZee ZdZd Zd ZGd dejZed zd d fedzdd fddfZdZdZdZdZdZ da!dZ"dZ#dZ$dZ%ee%j&Z'dZ(dZ)dZ*dZ+dZ,d Z-dS)!aPzipimport provides support for importing Python modules from Zip archives. This module exports three objects: - zipimporter: a class; its constructor takes a path to a Zip archive. - ZipImportError: exception raised by zipimporter objects. It's a subclass of ImportError, so it can be caught as ImportError, too. - _zip_directory_cache: a dict, mapping archive paths to zip directory info dicts, as used in zipimporter._files. It is usually not needed to use the zipimport module explicitly; it is used by the builtin import mechanism for sys.path items that are paths to Zip archives. N)_unpack_uint16_unpack_uint32ZipImportError zipimporterceZdZdS)rN)__name__ __module__ __qualname__..\python\lib\zipimport.pyrr"sDr sPKicfeZdZdZdZddZddZddZdZdZ d Z d Z d Z d Z d ZdZdZdS)razipimporter(archivepath) -> zipimporter object Create a new zipimporter instance. 'archivepath' must be a path to a zipfile, or to a specific path inside a zipfile. For example, it can be '/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a valid directory inside the archive. 'ZipImportError is raised if 'archivepath' doesn't point to a valid Zip archive. The 'archive' attribute of zipimporter objects contains the name of the zipfile targeted. c t|tstdt||st d|t r |t t}g} tj |}|j dzdkrt d|n]#ttf$rHtj |\}}||krt d||}||YnwxYw t|}n)#t $rt#|}|t|<YnwxYw||_||_tj|ddd|_|jr|xjtz c_dSdS) Nzexpected str, not zarchive path is emptypathTiiznot a Zip file) isinstancestr TypeErrortyper alt_path_sepreplacepath_sep_bootstrap_external _path_statst_modeOSError ValueError _path_splitappend_zip_directory_cacheKeyError_read_directory_filesarchive _path_joinprefix)selfrr)stdirnamebasenamefiless r__init__zzipimporter.__init__@s$$$ A?d??@@ @ E !8tDDD D  8<< h77D  (3D99J)h66()9EEEEZ( ( ( (%8$CD$I$I!d??()9EEEE h''''' ( $ /(.EE / / /#D))E).  & & & /  )4fTTrTlC ; $ KK8 #KKKK $ $s%3B''AD?D D#D98D9Nctjdtt||}||gfSt ||}t ||rd|jt|gfSdgfS)a/find_loader(fullname, path=None) -> self, str or None. Search for a module specified by 'fullname'. 'fullname' must be the fully qualified (dotted) module name. It returns the zipimporter instance itself if the module was found, a string containing the full path name if it's possibly a portion of a namespace package, or None otherwise. The optional 'path' argument is ignored -- it's there for compatibility with the importer protocol. Deprecated since Python 3.10. Use find_spec() instead. zfzipimporter.find_loader() is deprecated and slated for removal in Python 3.12; use find_spec() insteadN) _warningswarnDeprecationWarning_get_module_info_get_module_path_is_dirr'r)r*fullnamermimodpaths r find_loaderzzipimporter.find_loaderms I) + + +dH - - >8O#422 4 ! ! @T\>8>W>>?? ?Rxr cntjdt|||dS)afind_module(fullname, path=None) -> self or None. Search for a module specified by 'fullname'. 'fullname' must be the fully qualified (dotted) module name. It returns the zipimporter instance itself if the module was found, or None if it wasn't. The optional 'path' argument is ignored -- it's there for compatibility with the importer protocol. Deprecated since Python 3.10. Use find_spec() instead. zfzipimporter.find_module() is deprecated and slated for removal in Python 3.12; use find_spec() insteadr)r1r2r3r:)r*r7rs r find_modulezzipimporter.find_modules> I) + + +$//22r c"t||}|tj|||St||}t ||rE|jt |}tj|dd}|j ||SdS)zkCreate a ModuleSpec for the specified module. Returns None if the module cannot be found. N) is_packageT)nameloaderr>) r4 _bootstrapspec_from_loaderr5r6r'r ModuleSpecsubmodule_search_locationsr")r*r7target module_infor9rspecs r find_speczzipimporter.find_specs 'tX66  ".x+VVV V'tX66GtW%% ,;;';;!,(48<>>>/66t<<< tr c.t||\}}}|S)zget_code(fullname) -> code object. Return the code object for the specified module. Raise ZipImportError if the module couldn't be imported. _get_module_coder*r7code ispackager9s rget_codezzipimporter.get_codes $4D(#C#C i r cftr |tt}|}||jtzr$|t |jtzd} |j|}n#t$rtdd|wxYwt|j|S)zget_data(pathname) -> string with file data. Return the data associated with 'pathname'. Raise OSError if the file wasn't found. Nr) rrr startswithr'lenr&r$r _get_data)r*pathnamekey toc_entrys rget_datazzipimporter.get_datas  @'' h??H   t|h6 7 7 :3t|h677889C & C(II & & &!R%% % &y111s 1 A??Bc.t||\}}}|S)zget_filename(fullname) -> filename string. Return the filename for the specified module or raise ZipImportError if it couldn't be imported. rJrLs r get_filenamezzipimporter.get_filenames$4D(#C#C ir c6t||}|td||t||}|rtj|d}n|d} |j|}n#t $rYdSwxYwt|j| S)zget_source(fullname) -> source string. Return the source code for the specified module. Raise ZipImportError if the module couldn't be found, return None if the archive does contain the module, but has no source for it. Ncan't find module r? __init__.py.py) r4rr5rr(r&r$rTr'decode)r*r7r8rfullpathrWs r get_sourcezzipimporter.get_sourcesdH - - : !Bh!B!BRRR Rh//  $*5dMJJHH|||H  H-II   44 y1188:::s A## A10A1cRt||}|td|||S)zis_package(fullname) -> bool. Return True if the module specified by fullname is a package. Raise ZipImportError if the module couldn't be found. Nr\r])r4r)r*r7r8s rr>zzipimporter.is_packages9 dH - - : !Bh!B!BRRR R r cd}tj|tt||\}}}tj|}|t|tst|}|tj|<||_ |r2t||}tj |j |}|g|_t|ds t |_tj|j||t'||jn#tj|=xYw tj|}n!#t($rt+d|dwxYwt-jd|||S)a@load_module(fullname) -> module. Load the module specified by 'fullname'. 'fullname' must be the fully qualified (dotted) module name. It returns the imported module, or raises ZipImportError if it could not be imported. Deprecated since Python 3.10. Use exec_module() instead. zrzipimport.zipimporter.load_module() is deprecated and slated for removal in Python 3.12; use exec_module() insteadN __builtins__zLoaded module z not found in sys.moduleszimport {} # loaded from Zip {})r1r2r3rKsysmodulesgetr _module_type __loader__r5rr(r'__path__hasattrre_fix_up_module__dict__execr$ ImportErrorrA_verbose_message) r*r7msgrMrNr9modrras r load_modulezzipimporter.load_modulesyCs.///#3D(#C#C ikooh'' ;jl;;;x((C$'CK !  *(h77.9$,MM (z 3// 0#/  .s|Xw O O O s| $ $ $ $  H%  V+h'CC V V VTxTTTUU U V#$DhPWXXX s BDD"D55Ecz ||sdSn#t$rYdSwxYwddlm}|||S)zReturn the ResourceReader for a package in a zip file. If 'fullname' is a package within the zip file, return the 'ResourceReader' object for the package. Otherwise return None. Nr) ZipReader)r>rimportlib.readersrv)r*r7rvs rget_resource_readerzzipimporter.get_resource_reader:sk  ??8,, t    44 //////yx(((s  ((c t|j|_|jt|j<dS#t$r+t|jdi|_YdSwxYw)z)Reload the file data of the archive path.N)r%r'r&r#rpopr*s rinvalidate_cacheszzipimporter.invalidate_cachesIsm )$,77DK15  . . .    $ $T\4 8 8 8DKKKK s-11A&%A&c4d|jt|jdS)Nz)r'rr)r{s r__repr__zzipimporter.__repr__Ss!Nt|NXNt{NNNNr N)r r r __doc__r/r:r<rHrOrXrZrbr>rtrxr|r~r r rrr.s  "%$%$%$Z    J3333 6222*   ;;;4   (((V ) ) )OOOOOr z __init__.pycTr^F)z.pycTF)r_FFcH|j|ddzS)N.)r) rpartition)r*r7s rr5r5es" ;,,S11!4 44r c(|tz}||jvSr)rr&)r*rdirpaths rr6r6isXoG dk !!r cft||}tD]\}}}||z}||jvr|cSdSr)r5_zip_searchorderr&)r*r7rsuffix isbytecoderNras rr4r4rsS D( + +D)9% I&= t{ " "    # 4r c  tj|}n"#t$rtd||wxYw|5|} |t d|}|t }n"#t$rtd||wxYwt|t krtd|||ddtkrB |dd|}n"#t$rtd||wxYwt|tz t z d} |||}n"#t$rtd||wxYw| t}|dkrtd|||||t z}t|t krtd|||t|z |z}t|d d } t|d d } || krtd |||| krtd |||| z}|| z } | dkrtd||i} d} ||n"#t$rtd||wxYw |d}t|dkrtd|dddkrnt|dkrtdt|dd}t|dd }t|d d}t|dd }t|d d }t|d d}t|dd}t|dd}t|dd}t|dd}t|dd}||z|z} || krtd|||| z } ||}n"#t$rtd||wxYwt||krtd|| t|| |z | |z krtd||n"#t$rtd||wxYw|dzr|}nT |d}n=#t"$r0|dt&}YnwxYw|d t*}t-j||}||||||||f}|| |<| d!z }  ||n#||wxYw dddn #1swxYwYt1jd"| || S)#Nzcan't open Zip file: rrcan't read Zip file: rznot a Zip file: zcorrupt Zip file: zbad central directory size: zbad central directory offset: z&bad central directory size or offset: T.EOF read where not expectedsPK  "*zbad local header offset: iasciilatin1/rz!zipimport: found {} names in {!r})_io open_coderrtellseekEND_CENTRAL_DIR_SIZEreadrSSTRING_END_ARCHIVEmaxMAX_COMMENT_LENrfindrEOFErrorrr`UnicodeDecodeError translate cp437_tablerrrr(rArq)r'fp start_offsetheader_positionbuffer file_sizemax_comment_startdatapos header_size header_offset arc_offsetr.countflagscompresstimedatecrc data_size name_size extra_size comment_size file_offsetr?rts rr%r%sP ]7 # # PPP@W@@wOOOOP s"s"wwyy n " X--q111"$''))!566 X X X$%HW%H%HwWWWW X6{{222$%HW%H%HwWWWWbqbz///7GGAqMMM " II777()L)L)L.577777%( O(C(<)=>?%A%A!7GG-...7799DD777()L)L)L.577777jj!34477()GG)G)G.57777c#&:"::;v;;"666()Ig)I)I.57777"+c$ii"7#"=(277K*6"R%=99M,,$%OG%O%OV]^^^^..$%Qg%Q%QX_```` { *O(=8JA~~$%Yg%Y%Y`ghhhhEE X(((( X X X$%HW%H%HwWWWW X6 v;;??"#@AAA"1":..v;;"$$"#@AAA&vad|44)&B-88%fRUm44%fRUm44$VBrE]33*6"R%=99 *6"R%=99 *6"R%=99 +F2b5M:: -fRUm<< ,VBrE];; '*4|C ..()PW)P)PW^____z) \779--DD\\\()L)L)LSZ[[[[\t99 ))()L)L)LSZ[[[[\277;#:;;<< i@WWW,-PW-P-PW^____X\\\()L)L)LSZ[[[[\5=L;;==DDL#{{733-LLL#{{844>>{KKL||C22*5gtDD8Y ;dTWXd  m6  d GGL ! ! ! !BGGL ! ! ! ! !gs"s"s"s"s"s"s"s"s"s"s"s"s"s"s"h CUGTTT Ls6YA BX!B<X!WA X! Y!X88YY Y u  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ctr#tjdtdda ddlm}n1#t $r$tjdtdwxYw dan#dawxYwtjd|S)Nzzipimport: zlib UNAVAILABLE)can't decompress data; zlib not availableTr decompressFzzipimport: zlib available)_importing_zlibrArqrzlibr Exceptionrs r_get_decompress_funcr6sJ #$ABBBHIIIO ####### JJJ#$ABBBHIIIJ $  % ;<<< s5A*.A##A**A.c|\}}}}}}}} |dkrtdtj|5} | |n"#t$rtd||wxYw| d} t | dkrtd| dddkrtd ||t| d d } t| d d} d| z| z}||z } | |n"#t$rtd||wxYw| |}t ||krt d  dddn #1swxYwY|dkr|S t}n#t$rtd wxYw||dS)Nrznegative data sizerrrrrsPKzbad local file header: rzzipimport: can't read datari) rrrrrrrSrrrr)r'rWdatapathrrrrrrrrrrrrraw_datars rrTrTKswMVJHh 9k4s1}}1222 w  82 T GGK  T T T !D!D!D7SSS S T v;;"  899 9 "1": & & !F7!F!FWUUU U"6"R%=11 #F2b5M22 9nz1 {"  T GGK  T T T !D!D!D7SSS S T779%% x==I % %677 7 &/88888888888888841}}J)++ JJJHIIIJ :h $ $$sMFA  F A,,BFDFD99:FFFF##F=c.t||z dkS)Nr)abs)t1t2s r _eq_mtimerys rBw<<1 r c||d}tj|||}|dzdk}|rt|dzdk}tjdkrZ|stjdkrHt ||} | 6tjtj| } tj|| ||nnt||\} } | rYtt|dd| rt|dd | krtj d |dStj|d d} t| t st#d |d | S) N)r?rrrrneveralwaysrrrzbytecode is stale for zcompiled module z is not a code object)r _classify_pyc_impcheck_hash_based_pycs_get_pyc_source source_hash_RAW_MAGIC_NUMBER_validate_hash_pyc_get_mtime_and_size_of_sourcerrrArqmarshalloadsr _code_typer)r*rUrar7r exc_detailsr hash_based check_source source_bytesr source_mtime source_sizerMs r_unmarshal_codersK -dHk J JE!Jt|q(  &' 1 1 2!%!;x!G!G*4::L'".'9  $6+x>>> *$ 9 9 " k  nT!B$Z88,GG "42;//;>>+9X99;;;t =bcc # #D dJ ' 'NL8LLLMMM Kr c^|dd}|dd}|S)Ns   )r)sources r_normalize_line_endingsrs- ^^GU + +F ^^E5 ) )F Mr cFt|}t||ddS)NroT) dont_inherit)rcompile)rUrs r_compile_sourcers& $V , ,F 68V$ ? ? ??r c xtj|dz dz|dz dz|dz|dz |dz dz|dzdzd d d f S) N i ?rr)rmktime)drs r_parse_dostimers\ ; a4 a3 D R a4 TQ B  r c |dddvsJ|dd}|j|}|d}|d}|d}t|||fS#tttf$rYdSwxYw)Nrcor)rr)r&rr$ IndexErrorr)r*rrWrruncompressed_sizes rrrs BCCyJ&&&&CRCyK% ||%aLdD))+<<< j) ,ttsAAA,+A,c|dddvsJ|dd} |j|}t|j|S#t$rYdSwxYw)Nrr)r&rTr'r$)r*rrWs rrrsq 9 " " " " 9D2K% y111 tts < A  A ct||}d}tD]\}}}||z}tjd|jt |d |j|}|d} t|j|} d} |r. t|| ||| } n)#t$r } | }Yd} ~ nd} ~ wwxYwt| | } | |d} | || fcS#t$rYwxYw|rd|} t| ||td||)Nz trying {}{}{}r) verbosityrzmodule load failed: r]r\) r5rrArqr'rr&rTrrprr$r)r*r7r import_errorrrrNrarWr9rrMexcrrs rrKrKs| D( + +DL)9SS% I&=#OT\8Xabcccc , H-I lGT\955DD 6'*4(HdSSDD"'''#&LLLLLL''w55|lGG+ + + +%    D (  S777C 8444, F !Bh!B!BRRR Rs* C8B  B"BB" CC).r_frozen_importlib_externalrrr_frozen_importlibrArrrrfrr1__all__rpath_separatorsrrprr#rrirrr _LoaderBasicsrrr5r6r4r%rrrrTrr__code__rrrrrrrKr r rrsk   9888EEEEEEEE&&&&   ] +  '"21226      [   tCyy "fOfOfOfOfO%3fOfOfO^ d+ ud+ 555""">{{{J/ : *(%(%(%\&&&PT/* + + @@@    & 2 2 2 S S S S Sr