\h&ddlZddlmZddlZddlZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZ ddlZddlZddlZddlZddlZddlZ ddlZddlZddlmZddlmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/e j`e1Z2e jfdZ4e jfdZ5e jfd Z6e jfd Z7e jfd Z8e jfd Z9e jfd Z:e jfdZ;dZdZ?dZ@didZAdZBdZCdZDejdZFejdZGejdjdZHGddeIZJdZKGddeIZLd ZMGd!d"eIZNe jfd#e jZPd$ZQdkd%ZRd&ZSd'ZTd(ZUd)ZVd*ZWe jfd+e jZYe jfd,ZZdkd-Z[e jfd.Z\d/Z]d0Z^d1Z_d2Z`d3Zad4ZbGd5d6eIZcGd7d8eIZdGd9d:eIZed;Zfdld<Zgd=Zhd>ZiGd?d@eIZje jfdAZke jfdBZle jfdCZmdDZdEZner6ddFlmoZpmqZqmrZrGdGdHe$jZsGdIdJepZoGdKdLeoe&ZtGdMdNe%jZuerGdOdPe%jZvGdQdRe%jZwdSZxGdTdUeIZyGdVdWeyZzGdXdYeyZ{GdZd[e'Z|Gd\d]eIZ}d^Z~Gd_d`eIZdaZdbZdcZdddedfdgZdhZy#e$rdZYEwxYw#e$rddlZY=?|={2,3}|[~!]=)\s*z*^((<=?)|(>=?)|={2,3}|[~!]=|in|not\s+in)\s*z^or\b\s*z ^and\b\s*z(\S+)\s*z(([\s\w\.{}()*+#:;,/?!~`@$%^&=|<>\[\]-]+)c@dfdfdfd|S)ae Parse a marker string and return a dictionary containing a marker expression. The dictionary will contain keys "op", "lhs" and "rhs" for non-terminals in the expression grammar, or strings. A string contained in quotes is to be interpreted as a literal string, and a string not contained in quotes is a variable (such as os_name). ctj|}|r*|jd}||jd}||fS|s t d|d}|dvrt d|zdj |d}|dd}|g}|r|d|k(rn|d|k(r|j ||dd}nZtj|}|st d|z|j |jd||jd}|rdj|}t d|z|j |dj|}|ddj}||fS) Nrzunexpected end of inputz'"zinvalid expression: %srzerror in string literal: %szunterminated string: %s) IDENTIFIERmatchgroupsend SyntaxErrorreplaceappend STRING_CHUNKjoinlstrip) remainingmresultqoqpartsss [/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_vendor/distlib/util.py marker_varz parse_marker..marker_varBs{   Y ' XXZ]F!!%%'(+I<y  ;78 8! A~!":Y"FGGq"%B!!" ICEQ<1$q\R'LL$ )!" I$**95A)*G*3+455LLA/ )!%%'( 3IGGEN!";a"?@@ LLOWWU^F!!" ,,.Iy  ct|rQ|ddk(rI|ddj\}}|ddk7rtd|z|ddj}||fS|\}}|rRtj|}|sn:|j d}||j d}|\}}|||d}|rR|}||fS)Nr(r)unterminated parenthesis: %soplhsrhs)r'r" MARKER_OPrr r!)r(r*r8r)r7r9markerr0s r/ marker_exprz!parse_marker..marker_exprgs 1, &y}';';'= > FI|s"!"@9"LMM!!" ,,.Iy  ( 2NCOOI.XXZ]%aeegh/ !+I!6YC8Fy  r1c|\}}|rCtj|}|s ||fS||jd}|\}}d||d}|rC||fS)Nandr6)ANDrr!)r(r8r)r9r<s r/ marker_andz parse_marker..marker_andzss$Y/Y )$AI~"!%%'(+I(3NCs37C I~r1c|\}}|rCtj|}|s ||fS||jd}|\}}d||d}|rC||fS)Norr6)ORrr!)r(r8r)r9r@s r/r;zparse_marker..markerss#I.Y#AI~"!%%'(+I' 2NCc#6C I~r1) marker_stringr;r@r<r0s @@@@r/ parse_markerrF8s%#!J!&   -  r1c |j}|r|jdrytj|}|st d|z|j d}||j d}dx}x}x}}|r|ddk(r|jdd}|dkrt d|z|d|} ||dzdj}g}| rtj| }|st d | z|j|j d| |j d} | sn,| dd k7rt d | z| ddj} | r|sd}|r|dd k(r|ddj}tj|}|st d |z|j d}t|} | jr | jst d|z||j dj}nd} |ddk7r | |\}}n|jdd}|dkrt d|z|d|} ||dzdj}tj| r | | \}} nntj| }|st d| z|j d} | |j dj} | rt d| zd| fg}|r7|ddk7rt d|z|ddj}t!|\}}|r|ddk7rt d|z|s|}n'|ddj#|Dcgc]}d|z c}}t%||||||Scc}w)z Parse a requirement passed in as a string. Return a Container whose attributes contain the various parts of the requirement. #Nzname expected: %sr[]rzunterminated extra: %szmalformed extra: %s,zcomma expected in extras: %s@zinvalid URI: %szInvalid URL: %sctj|}d}|rg} |jd}||jd}tj|}|st d|z|jd}|j ||f||jd}|r|ddk7rn<|ddj}|sn&tj|}|st d|z|sd}||fS)z| Return a list of operator, version tuples if any are specified, else None. Nrzinvalid version: %srKrinvalid constraint: %s) COMPARE_OPrr r!VERSION_IDENTIFIERr"r$r') ver_remainingr)versionsr7vs r/ get_versionsz'parse_requirement..get_versionss $$]3!HXXZ](5aeegh(? .44]C "-.C.;/<#==HHJqM Q0(5aeegh(? , a0@C0G!(5ab(9(@(@(B  -!&,,]; "-.F.;/<#=='*$#'..r1r3r4r5rNz~=;zinvalid requirement: %szunexpected trailing data: %s , z%s %s)nameextras constraintsr;url requirement)strip startswithrrr"r r!findr'r$ NON_SPACErschemenetlocrOrPrFr&r)reqr(r)distnamerY mark_exprrRuriir.trT_rSrscons r/parse_requirementrls  I  ,,S1#A - 9::xxz!}H!%%'(#I*..F.Y.CYq\S( NN3 " q56BC C aNa!ef%,,.   #A!"7!";<< MM!((*Q- (!%%'( Ats{!"@1"DEE!" AF Q<3 !!" ,,.I *A!"3i"?@@((*Q-C A HH!"3c"9::!!%%'(+224I /D|s"&29&=#)NN3*q5%&D&/'011aN%a!ef-446 ##A&".q/KHa*003A)*BQ*FGG 1 A!%%'( **,A)*BQ*FGG!%q {H Q<3 7)CD DabM((* +I6 9Yq\S(89DEE   $))&. /sWs] /#12 ("!)%!#  %% 0s M0 cd}i}|D]\}}}tjj||}t|D]}tjj||} t| D]m} ||| } ||j | d!||| } |j tjj djd} | dz| z|| <o|S)z%Find destinations for resources filesc |jtjjd}|jtjjd}|j |sJ|t |dj dSN/)r#ospathsepr^lenr')rootrrs r/ get_rel_pathz)get_resources_dests..get_rel_paths`||BGGKK-||BGGKK-t$$$CIJ&&s++r1Nrp)rqrrr&rpopr#rsrstrip)resources_rootrulesrv destinationsbasesuffixdestprefixabs_baseabs_globabs_path resource_filerel_pathrel_dests r/get_resources_destsrs,L# Lfdnd3f LHww||Hf5H!(O L ,^X F < $$]D9+Hh?H#||BGGKK=DDSIH2:S.82KL/ L L L r1cttdrd}|Stjttdtjk7}|S)N real_prefixT base_prefix)hasattrsysrgetattrr*s r/in_venvr2s:sM" MwsM3::FF Mr1c\tj}t|ts t |}|SN)r executable isinstancerrrs r/get_executabler<s&^^F fi (&! Mr1c||} t|}|}|s|r|}|r$|dj}||vr |S|rd|||fz}:)Nrz %c: %s %s)r lower)prompt allowed_chars error_promptdefaultpr.cs r/proceedrNsaA  aL WA ! AM! H A|V#<< r1crt|tr|j}i}|D]}||vs||||<|Sr)rrsplit)dkeysr*keys r/extract_by_keyr^sF$ %zz| F! !8C&F3K! Mr1cHtjddk\rtjd|}|j }t |} t j|}|ddd}|jD]8\}}|jD] \}}|d|}t|} | J| ||<":|S#t$r|jddYnwxYwd} tj} | | |nR#tj$r<|jt!j"|}t |}| | |YnwxYwi}| j%D]=} ix|| <}| j| D] \} }| d|}t|} | J| || <"?|S) Nrutf-8 extensionszpython.exportsexports = cbt|dr|j|y|j|y)N read_file)rrreadfp)cpstreams r/ read_streamz!read_exports..read_stream|s$ 2{ # LL IIf r1)r version_infocodecs getreaderreadr jsonloaditemsget_export_entry Exceptionseekr ConfigParserMissingSectionHeaderErrorclosetextwrapdedentsections)rdatajdatar*groupentrieskrSr.entryrrrrXvalues r/ read_exportsrhs a*!!'*62 ;;=D d^F  &!|$%56yA$lln #NE7  #1!"A&(+((("  # #   Aq  " " $B B  1 1  t$$B  F{{}" ""s g88C= "KD%!5)A$Q'E$ $$!GDM  "" Ms&A,B;;CC4 C>>A E  E c(tjddk\rtjd|}t j }|j D]\}}|j||jD]}|j |j}n|jd|j}|jr!|ddj|jd}|j||j||j|y)Nrrr:z [rWrJ)rrr getwriterrrr add_sectionvaluesr}rflagsr&setrXwrite)rrrrrSrr.s r/ write_exportsrs a*!!'*62  " " $B  %1 qXXZ %E||#LL$||U\\:{{!"DIIekk$:; FF1ejj! $ % %HHVr1c#Ktj} |tj|y#tj|wxYwwr)tempfilemkdtempr rmtree)tds r/tempdirrs6    B b bsA 2A A  A c#Ktj} tj|dtj|y#tj|wxYwwr)rqgetcwdchdir)rcwds r/rrs: ))+C      A!AA!AA!c#Ktj} tj|dtj|y#tj|wxYwwr)socketgetdefaulttimeoutsetdefaulttimeout)secondsctos r/socket_timeoutrsF  " " $C&  )   %  %rceZdZdZddZy)cached_propertyc||_yr)func)selfrs r/__init__zcached_property.__init__s  r1Nc||S|j|}tj||jj||Sr)robject __setattr____name__)robjclsrs r/__get__zcached_property.__get__s: ;K #3 2 2E: r1r)r __module__ __qualname__rrrDr1r/rrs  r1rctjdk(r|S|s|S|ddk(rtd|z|ddk(rtd|z|jd}tj|vr2|j tjtj|vr2|stjStj j|S)aReturn 'pathname' as a name that will work on the native filesystem. The path is split on '/' and put back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. rprzpath '%s' cannot be absolutezpath '%s' cannot end with '/')rqrs ValueErrorrcurdirremoverrr&)pathnamepathss r/ convert_pathrs vv} {c7(BCC|s88CDD NN3 E ))u  RYY ))u  yy 77<< r1c|eZdZddZdZdZdZddZddZdZ d Z d Z d Z d Z dd ZdZdZdZdZy) FileOperatorcP||_t|_|jyr)dry_runrensured _init_record)rrs r/rzFileOperator.__init__s u  r1cNd|_t|_t|_yNF)recordr files_written dirs_createdrs r/rzFileOperator._init_records  UEr1cT|jr|jj|yyr)rradd)rrrs r/record_as_writtenzFileOperator.record_as_writtens" ;;    " "4 ( r1cTtjj|s+tdtjj |ztjj|sytj |j tj |j kDS)aTell if the target is newer than the source. Returns true if 'source' exists and is more recently modified than 'target', or if 'source' exists and 'target' doesn't. Returns false if both exist and 'target' is the same age or younger than 'source'. Raise PackagingFileError if 'source' does not exist. Note that this test is not very accurate: files created in the same second will have the same "age". zfile '%r' does not existT)rqrrexistsrabspathstatst_mtime)rsourcetargets r/newerzFileOperator.newerssww~~f%"#=#%77??6#:$;< <ww~~f%wwv''"''&/*B*BBBr1c|jtjj|tj d|||j sd}|rhtjj|rd|z}nCtjj|r$tjj|sd|z}|rt|dztj|||j|y)z8Copy a file respecting dry-run and force flags. zCopying %s to %sNz%s is a symlinkz%s is a non-regular filez which would be overwritten) ensure_dirrqrrdirnameloggerinforislinkr isfilerr copyfiler)rinfileoutfilecheckmsgs r/ copy_filezFileOperator.copy_files 01 &8||C77>>'*+g5CWW^^G,RWW^^G5L4w>C 'D!DEE OOFG , w'r1Nctjj|rJ|jtjj |t j d|||jsN| t|d}ntj|d|} tj|||j|j|y#|jwxYw)NzCopying stream %s to %swbwencoding)rqrrisdirrrrrropenrr copyfileobjrr)rinstreamrr! outstreams r/ copy_streamzFileOperator.copy_stream's77==))) 01 -xA|| $/ "KKxH  """8Y7! w'!s CC%cf|jtjj||jsZtjj |rtj |t|d5}|j|ddd|j|y#1swYxYw)Nr) rrqrrrrr rr#rr)rrrrfs r/write_binary_filezFileOperator.write_binary_file6sw -.||ww~~d# $dD! Q   t$  s ;B''B0cF|j||j|yr)r*encode)rrrrr!s r/write_text_filezFileOperator.write_text_file?s tT[[%:;r1crtjdk(s&tjdk(rtjdk(r}|D]w}|jrtj d|&tj |j|z|z}tj d||tj||yyyy)Nposixjavazchanging mode of %szchanging mode of %s to %o) rqrX_namerrrr st_modechmod)rbitsmaskfilesr)modes r/set_modezFileOperator.set_modeBs 77g "''V"3G8K &<<KK 5q9GGAJ..5=DKK ;QEHHQ%  &9L"3r1c(|jdd|S)Nimi)r8)r.r)s r/zFileOperator.Nsqzz%'Cr1ctjj|}||jvrtjj |s|jj |tjj |\}}|j|tjd|z|jstj||jr|jj |yyyy)Nz Creating %s)rqrrr rr rrrrrrmkdirrr)rrrrr)s r/rzFileOperator.ensure_dirPswwt$ t|| #BGGNN4,@ LL  T "77==&DAq OOA  KK , -<<{{!!%%d+-A #r1ct|| }tjd|||js|s|j ||r&|sd}n!|j |sJ|t |d}i}|r-ttdrtjj|d<tj||dfi||j||S)NzByte-compiling %s to %sPycInvalidationModeinvalidation_modeT) r rrrrr^rtr py_compiler> CHECKED_HASHcompiler) rrroptimizeforcerhashed_invalidationdpathdiagpathcompile_kwargss r/ byte_compilezFileOperator.byte_compile\s "$H 5 -tU;|| 4/#H??6222#CKL1HN"wz/D(F,6+I+I+V+V')   tUHd 1!/ 1 u% r1ctjj|rAtjj|rtjj |sot j d||jstj||jr+||jvr|jj|yyytjj |rd}nd}t j d|||jstj||jr+||jvr|jj|yyyy)NzRemoving directory tree at %slinkfilezRemoving %s %s)rqrrr r"rrdebugrr rrrrr)rrrr.s r/ensure_removedzFileOperator.ensure_removedus 77>>$ ww}}T"277>>$+? >$'AA -q$7||IIdO;;t111**11$72! r1cd}|srtjj|r'tj|tj} |Stjj |}||k(r |S|}|sr|Sr)rqrrr accessW_OKr)rrrr*parents r/ is_writablezFileOperator.is_writablesnww~~d#41  WW__T*F~ D r1cr|jsJ|j|jf}|j|S)zV Commit recorded changes, turn off recording, return changes. )rrrr)rr*s r/commitzFileOperator.commits7 {{{##T%6%66  r1c|jst|jD]7}tjj |s#tj |9t|jd}|D]n}tj|}|r@|dgk(sJtjj||d}tj|tj|p|jy)NT)reverse __pycache__r) rlistrrqrrr rsortedrlistdirr&rmdirr)rr)dirsrflistsds r/rollbackzFileOperator.rollbacks||$,,- !77>>!$IIaL ! $++T:D  1  ]O333aq2BHHRL   r1FTr)FFNF)rrrrrrrrr'r*r-r8set_executable_moderrIrNrSrUr`rDr1r/rrse " )C((" (%< &D ,$  ). 28* r1rc|tjvrtj|}n t|}||}|S|jd}t ||j d}|D]}t ||}|S)N.r)rmodules __import__rrrw) module_name dotted_pathmodr*r-rs r/resolverks~ckk!kk+&% M !!#&eiil+ (AVQ'F ( Mr1cFeZdZdZedZdZdZejZ y) ExportEntryc<||_||_||_||_yrrXrr}r)rrXrr}rs r/rzExportEntry.__init__s    r1cBt|j|jSr)rkrr}rs r/rzExportEntry.valuest{{DKK00r1c pd|jd|jd|jd|jd S)Nz rors r/__repr__zExportEntry.__repr__s(04 4;;04 TZZI Ir1ct|tsd}|S|j|jk(xrO|j|jk(xr4|j|jk(xr|j |j k(}|Sr)rrmrXrr}r)rotherr*s r/__eq__zExportEntry.__eq__st%-F  ii5::-4$++2M4++54** 3  r1N) rrrrrrrsrvr__hash__rDr1r/rmrms1 11IHr1rmz(?P([^\[]\S*)) \s*=\s*(?P(\w+)([:\.]\w+)*) \s*(\[\s*(?P[\w-]+(=\w+)?(,\s*\w+(=\w+)?)*)\s*\])? ctj|}|sd}d|vsd|vrtd|z|S|j}|d}|d}|j d}|dk(r|d}}n'|dk7rtd|z|j d\}}|d } | d|vsd|vrtd|zg} n,| j d D cgc]} | j } } t|||| }|Scc} w) NrIrJzInvalid specification '%s'rXcallablerrrrrK)ENTRY_REsearchr groupdictcountrr]rm) specificationr)r*rrXrrcolonsrr}rr)s r/rrs. &A  - 3-#7"$*,9$:; ;. M) KKMy}C Q;!4FF{&(.0=(>??!ZZ_NFF'  =m#sm';&(.0=(>??E(- C(891QWWY9E9T6659 M:sC*c|d}tjdk(r2dtjvr tjj d}ntjj d}tjj |r=tj|tj}|s/tjd|n tj|d}|s*tj}tjd |tjj||S#t$rtjd|d d }YqwxYw) a Return the default base location for distlib caches. If the directory does not exist, it is created. Use the suffix provided for the base directory, and default to '.distlib' if it isn't provided. On Windows, if LOCALAPPDATA is defined in the environment, then it is assumed to be a directory, and will be the parent directory of the result. On POSIX, and on Windows if LOCALAPPDATA is not defined, the user's home directory - using os.expanduser('~') - will be the parent directory of the result. The result is just the directory '.distlib' in the parent directory as determined above, or with the name specified with ``suffix``. z.distlibnt LOCALAPPDATAz $localappdata~z(Directory exists but is not writable: %sTzUnable to create %s)exc_infoFz#Default location unusable, using %s)rqrXenvironrr expandvars expanduserr"rPrQrwarningmakedirsOSErrorrrr&)r}r*usables r/get_cache_basers~ ww$>RZZ7##O4##C( ww}}V6277+ NNEv N  KK F !!#s ::c?3w Hr1cdx}}d|vr1|jdd\}}d|vr|}n|jdd\}}|r t|}|r t|}|||fS)NrLrr)rsplitrr)rbusernamepasswordrs r/parse_credentialsrDspHx f}sA. f H!'c1!5 Hh8$8$ Xv %%r1cZtjd}tj||S)N)rqumaskrs r/get_process_umaskrSs XXd^FHHV Mr1cdd}d}t|D]\}}t|trd}n|J|S)NTF) enumeraterr)seqr*rgr.s r/is_string_sequencerYsF F A#1!\*F  == Mr1z3([a-z0-9_]+([.-][a-z_][a-z0-9_]*)*)-([a-z0-9_.+-]+)z -py(\d\.?\d?)cd}d}t|jdd}tj|}|r$|j d}|d|j }|rft |t |dzkDrLtjtj|dz|}|r|j}|d|||dzd|f}|:tj|}|r#|j d|j d|f}|S)zw Extract name, version, python version from a filename (no extension) Return name, version, pyver or None NrV-rz\br) rr#PYTHON_VERSIONr{rstartrtrerescaper!PROJECT_NAME_AND_VERSION)filename project_namer*pyverr)ns r/split_filenamerjs F Ex ((c2Hh'A JQWWY'H L(9A(== HHRYY|,u4h ? Abq\8AEF#3U:F ~ $ * *8 4 WWQZU2F Mr1z-(?P[\w .-]+)\s*\(\s*(?P[^\s)]+)\)$ctj|}|std|z|j}|dj j |dfS)z A utility method used to get name and version from a string. From e.g. a Provides-Dist value. :param p: A value in a form 'foo (1.0)' :return: The name and version as a tuple. z$Ill-formed name/version string: '%s'rXver)NAME_VERSION_RErrr|r]r)rr)rs r/parse_name_and_versionrsV a A G!KLL A V9??  " " $ah ..r1ct}t|xsg}t|xsg}d|vr|jd||z}|D]}|dk(r|j||jdr8|dd}||vrtj d|z||vsQ|j|c||vrtj d|z|j||S)N*rrzundeclared extra: %s)rrrr^rr) requested availabler*runwanteds r/ get_extrasrs UFIO$IIO$I i)   8 JJqM \\# uHy(5@A6! h' !59: JJqM  Mr1cti} t|}|j}|jd}|jdstj d||St jd|}tj|} |S#t$r"}tjd||Yd}~|Sd}~wwxYw)Nz Content-Typezapplication/jsonz(Unexpected response for JSON request: %srz&Failed to get external data for %s: %s) r rgetr^rrMrrrrr exception)r[r*respheadersctreaderes r/_get_external_datars FKs|))+ [[ (}}/0 LLCR H M /V%%g.t4FYYv&F M KA3JJ MKsAB 0B B7B22B7z'https://www.red-dove.com/pypi/projects/cn|djd|d}tt|}t|}|S)Nrrpz /project.jsonupperr_external_data_base_urlr)rXr[r*s r/get_project_datars2"&q'--/4 8C )3 /C  $F Mr1cp|djd|d|d}tt|}t|S)Nrrpz /package-z.jsonr)rXversionr[s r/get_package_datars0%)!W]]_dG DC )3 /C c ""r1c"eZdZdZdZdZdZy)Cachez A class implementing a cache for resources that need to live in the file system e.g. shared libraries. This class was moved from resources to here because it could be used by other modules, e.g. the wheel module. cdtjj|stj|tj|j dzdk7rt jd|tjjtjj||_ y)zu Initialise an instance. :param base: The base directory where the cache should be located. ?rzDirectory '%s' is not privateN) rqrrr"rr r2rrr normpathr|)rr|s r/rzCache.__init__smww}}T" KK  GGDM ! !D (Q . NN>"%);IIbMWW]]2&MM"%  ' '""2& 'sBCC98C9N)rrr__doc__rrrrDr1r/rrs <) r1rc0eZdZdZdZddZdZdZdZy) EventMixinz1 A very simple publish/subscribe system. ci|_yr) _subscribersrs r/rzEventMixin.__init__ s r1c|j}||vrt|g||<y||}|r|j|y|j|y)a` Add a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be added (and called when the event is published). :param append: Whether to append or prepend the subscriber to an existing subscriber list for the event. N)rrr$ appendleft)revent subscriberr$subssqs r/rzEventMixin.add sK     -DKeB *% j)r1ch|j}||vrtd|z||j|y)z Remove a subscriber for an event. :param event: The name of an event. :param subscriber: The subscriber to be removed. zNo subscribers: %rN)rrr)rrrrs r/rzEventMixin.remove!s:    1E9: : U :&r1cLt|jj|dS)z Return an iterator for the subscribers for an event. :param event: The event to return subscribers for. rD)iterrr)rrs r/get_subscriberszEventMixin.get_subscribers-s" D%%))%455r1cg}|j|D] } ||g|i|}|j |"tj d|||||S#t$rtjdd}YPwxYw)a^ Publish a event and return a list of values returned by its subscribers. :param event: The event to publish. :param args: The positional arguments to pass to the event's subscribers. :param kwargs: The keyword arguments to pass to the event's subscribers. z"Exception during event publicationNz/publish %s: args = %s, kwargs = %s, result = %s)rrrrr$rM)rrargskwargsr*rrs r/publishzEventMixin.publish4s..u5 !J "5:4:6: MM%  !  F66 +    !EF s A A54A5Nrb) rrrrrrrrrrDr1r/rrs *( '6r1rcXeZdZdZdZd dZdZdZdZdZ e dZ e d Z y ) Sequencerc>i|_i|_t|_yr)_preds_succsr_nodesrs r/rzSequencer.__init__Qs  e r1c:|jj|yr)rr)rnodes r/add_nodezSequencer.add_nodeVs r1c8||jvr|jj||rt|jj |dD]}|j||t|j j |dD]}|j||t |jjD]\}}|r |j|=t |j jD]\}}|r |j |=yy)NrD)rrrrrrrYr)rredgesrr.rrSs r/ remove_nodezSequencer.remove_nodeYs 4;;  KK  t $ r23 % At$ %r23 % D!$ %T[[..01 '1 A 'T[[..01 '1 A ' r1c||k7sJ|jj|tj||jj|tj|yr)r setdefaultrrr)rpredsuccs r/rz Sequencer.addisPt|| tSU+//5 tSU+//5r1c||k7sJ |j|}|j|} |j ||j |y#t$rtd|zwxYw#t$rt|d|wxYw)Nz%r not a successor of anythingz not a successor of )rrKeyErrorrr)rrrpredssuccss r/rzSequencer.removenst|| FKK%EKK%E H LL  LL   F=DE E F  H4FG G HsA "A& A#&Bc^||jvxs||jvxs||jvSr)rrr)rsteps r/is_stepzSequencer.is_step{s4 #'tt{{':'4;;& (r1c|j|std|zg}g}t}|j||r|j d}||vr(||k7rr|j ||j|nO|j ||j||jj|d}|j||rt|S)Nz Unknown: %rrrD) rrrr$rwrrrrextendreversed)rfinalr*todoseenrrs r/ get_stepszSequencer.get_stepss||E"]U23 3u E88A;Dt| 5=MM$'MM$' d# b1 E" r1cdggiig|jfdD]}|vs|S)Nrcd|<d|<dxxdz cc< j| |}|D]>}|vr |t|||<%| vs*t|||<@||k(rHg} j}|j|||k(rn(t |} j|yy#t$rg}YwxYwNrr)r$rminrwtuple) r successors successorconnected_component componentgraphindex index_counterlowlinksr*stack strongconnects r/rz3Sequencer.strong_connections..strongconnects '*E$K*1-HTN !  !  LL  "4[ ( K H,!),%($)9L%MHTN%'&)$y9I%JHTN K~t,&(# % I'..y9 D(  ""56  i(-   sC CC)r) rrr rrrr*rrs @@@@@@@r/strong_connectionszSequencer.strong_connectionss\  ! )! )F $D8#d# $ r1c dg}|jD]0}|j|}|D]}|jd|d|d2|jD]}|jd|z|jddj|S)Nz digraph G {z z -> rUz %s;} )rr$rr&)rr*rrrrs r/dotz Sequencer.dotsKK .check_pathsm$ *;;w'D GGOOBGGLL48 9||H%4BFF):;a?@ @*;r1)rrzip)rrtgzzr:gz)rrtbzzr:bz2rtarrzUnknown format for %rrrrc tj||S#tj$r}tt |d}~wwxYw)z9Run tarfile.tar_filter, but raise the expected ValueErrorN)tarfile tar_filter FilterErrorrstr)memberrrexcs r/extraction_filterz$unarchive..extraction_filters? +))&$77&& + S** +sA?A)rqrrr rtrrrnamelistr+r#getnamesrr getmembersrrXrr"r1 extractallr) archive_filenamer#formatrr%archiver7namesrXtarinfor1r$s ` @r/ unarchiver;sAwwx(H x=DG ~  $ $%5 6F  & &': ;FD  & &'; <FD  & &v .FD47GGH H' U?.4G((*!%Dt$%ll#3T:G((*!%Dt$% U?s//2Q6 #--/ @!',, :#*<<#6#6w#?GL @ +%6!8$  MMO 7 MMO sB2F =F F5ctj}t|}t|d5}t j |D]d\}}}|D]Y}tj j||}||d} tj j| |} |j|| [f ddd|S#1swY|SxYw)z*zip a directory tree into a BytesIO objectrN) ioBytesIOrtrrqwalkrrr&r) directoryr*dlenzfrur]r6rXfullrelr~s r/zip_dirrE%s ZZ\F y>D  %!#!3 % D$ %ww||D$/45kww||C.t$  % %% M% Ms A=B44B>)rKMGTPcveZdZdZd dZdZdZdZdZe dZ e dZ d Z e d Z e d Zy )ProgressUNKNOWNcj|||k\sJ|x|_|_||_d|_d|_d|_y)NrF)rcurmaxstartedelapseddone)rminvalmaxvals r/rzProgress.__init__=s>~6!111$$48   r1c|j|ksJ|j||jksJ||_tj}|j||_y||jz |_yr)rrPrOtimerQrR)rcurvalnows r/updatezProgress.updateEsbxx6!!!xx6TXX#555iik << DL-DLr1cN|dk\sJ|j|j|zy)Nr)rZrO)rincrs r/ incrementzProgress.incrementOs"qyy DHHtO$r1c<|j|j|Sr)rZrrs r/rzProgress.startSs DHH r1c`|j|j|jd|_yNT)rPrZrSrs r/stopz Progress.stopWs# 88  KK ! r1cJ|j |jS|jSr)rPunknownrs r/maximumzProgress.maximum\s#xx/t||=TXX=r1c|jrd}|S|jd}|Sd|j|jz z|j|jz z }d|z}|S)Nz100 %z ?? %gY@z%3d %%)rSrPrOr)rr*rSs r/ percentagezProgress.percentage`sf 99F  XX F DHH,-DHH1DEA\F r1c|dkr |j|j|jk(rd}|Stjdtj |}|S)Nrz??:??:??z%H:%M:%S)rPrOrrWstrftimegmtime)rdurationr*s r/format_durationzProgress.format_durationksM Mtxx/488txx3GF  ]]:t{{8/DEF r1c||jrd}|j}nd}|jd}n{|jdk(s|j|jk(rd}nPt |j|jz }||j|jz z}|dz |jz}|d|j |S)NDonezETA rrrz: )rSrRrPrOrfloatrk)rrrhs r/ETAz Progress.ETAts 99F AFxx"txx488';$((TXX-.TXX((Udll*!4#7#7#:;;r1c|jdk(rd}n&|j|jz |jz }tD]}|dkrn|dz}d|fzS)Nrgig@@z%d %sB/s)rRrOrUNITS)rr*units r/speedzProgress.speedsb <<1 Fhh)T\\9F D} f F VTN**r1N)rd)rrrrcrrZr]rrarrdrfrkrorsrDr1r/rLrL:suG.% >><<$ + +r1rLz \{([^}]*)\}z[^/\\,{]\*\*|\*\*[^/\\,}]z^[^{]*\}|\{[^}]*$ctj|rd}t||ztj|rd}t||zt |S)zAExtended globbing function that supports ** and {opt1,opt2,opt3}.z7invalid glob %r: recursive glob "**" must be used alonez2invalid glob %r: mismatching set marker '{' or '}')_CHECK_RECURSIVE_GLOBr{r_CHECK_MISMATCH_SET_iglob) path_globrs r/rrsQ##I.Ky))!!),Fy)) ) r1c#Ktj|d}t|dkDrXt|dk(sJ||\}}}|jdD](}tdj |||fD]}|*yd|vrt |D]}|y|jdd\}}|dk(rd}|dk(rd}n"|j d}|j d }tj|D]W\}}} tjj|}ttjj ||D]} | Yyw) NrrrKrz**rerrp\) RICH_GLOBrrtrxr& std_iglobr'rqr?rrr) ryrich_path_globrrr}itemrrradicaldirr6rs r/rxrxsP__Y2N >Q>"a'77',VIIcN Drwwf'=>?     y !),   (oodA6OFG|"}"..-!...$&GGFO  c5ww''- dG!<=BH sE E) HTTPSHandlermatch_hostnameCertificateErrorceZdZdZdZdZy)HTTPSConnectionNTc,tj|j|jf|j}t |ddr||_|jtjtj}ttdr#|xjtjzc_ t |ddr&|j|j|j i}|j"rQtj$|_|j)|j"t tddr|j|d<|j*|fi||_|j"r]|j,rP t/|j j1|jt2j5d|jyyy#t6$rE|j j9tj:|j j=wxYw) N _tunnel_hostF OP_NO_SSLv2 cert_file)cafileHAS_SNIserver_hostnamezHost verified: %s)rcreate_connectionhostporttimeoutrsock_tunnelssl SSLContextPROTOCOL_SSLv23roptionsrload_cert_chainrkey_fileca_certs CERT_REQUIRED verify_modeload_verify_locations wrap_socket check_domainr getpeercertrrMrshutdown SHUT_RDWRr)rrcontextrs r/connectzHTTPSConnection.connects~++TYY ,B,0LL:Dt^U3   nnS%8%89GsM*3??2t[$/'' FF}}&)&7&7#--T]]-C3 5104 F,-+++D;F;DI}}!2!2"499#8#8#:DIIFLL!4dii@"3}(II&&v'7'78IIOO%s4AGAH)rrrrrrrDr1r/rrs  r1rc eZdZddZdZdZy)rcJtj|||_||_yr)BaseHTTPSHandlerrrr)rrrs r/rzHTTPSHandler.__init__s  % %d +$DM ,D r1cxt|i|}|jr"|j|_|j|_|S)a This is called to create a connection instance. Normally you'd pass a connection class to do_open, but it doesn't actually check for a class, and just expects a callable. As long as we behave just as a constructor would have, we should be OK. If it ever changes so that we *must* pass a class, we'll create an UnsafeHTTPSConnection class which just sets check_domain to False in the class definition, and choose which one to pass to do_open. )rrr)rrrr*s r/ _conn_makerzHTTPSHandler._conn_makers8%d5f5F}}"&--&*&7&7#Mr1c |j|j|S#t$r5}dt|jvrt d|j zd}~wwxYw)Nzcertificate verify failedz*Unable to verify server certificate for %s)do_openrrr.reasonrr)rrcrs r/ https_openzHTTPSHandler.https_opensa ||D$4$4c:: .#ahh-?*!#&88,--  s A0AANrb)rrrrrrrDr1r/rrs -   r1rceZdZdZy)HTTPSOnlyHandlerctd|z)NzAUnexpected HTTP request on what should be a secure connection: %s)r)rrcs r/ http_openzHTTPSOnlyHandler.http_opens!#&'( (r1N)rrrrrDr1r/rrs (r1rceZdZddZdZy) TransportcR||_tjj||yr)rrrrrr use_datetimes r/rzTransport.__init__&s $$T<8r1c|j|\}}}|jr||jdk7r#||_|tj|f|_|jdSr) get_host_info _connection_extra_headersrHTTPConnection)rrhehx509s r/make_connectionzTransport.make_connection*sd((. 2t44+;+;A+>#>"$D #W%;%;A%>>D ""r1NrrrrrrrDr1r/rr$s 9#r1rceZdZddZdZy) SafeTransportcR||_tjj||yr)rrrrrs r/rzSafeTransport.__init__6s"DL  # # , ,T< @r1c|j|\}}}|si}|j|d<|jr||jdk7r%||_|t j |dfi|f|_|jdS)Nrrr)rrrrrr)rrrrrs r/rzSafeTransport.make_connection:s ..t4MAr6 $ F9 ##tt/?/?/B'B&(##')@)@t*'%*'$' ##A& &r1NrrrDr1r/rr4s  A 'r1rceZdZdZy) ServerProxyc |jddx|_}|Ht|d}|jdd}|dk(rt}nt }|||x|d<}||_tjj||fi|y)Nrrrhttps)r transport) rwrrrrrrrrr)rrfrrrartclsrhs r/rzServerProxy.__init__Hs!'It!<< w  c]1%F!::na8L $ &*7&N NF; !DN&&tS;F;r1N)rrrrrDr1r/rrFs|d}tjddk\rtjd|}||_nt |dd|_t j|jfi|j|_y)Nrrrrrrr) rrrrrrcsvrr)rrrs r/rzCSVReader.__init__zst v H%F"a'2))'26: DK#F6NC8DKjj> > r1c|SrrDrs r/__iter__zCSVReader.__iter__rr1ct|j}tjddkr8t |D]*\}}t |t r|jd||<,|SNrrr)nextrrrrrrr")rr*rgrs r/rzCSVReader.nexts^dkk"   A  "$V, 54!$ 2 $ G 4F1I 5 r1N)rrrrrr__next__rDr1r/rrxs ?Hr1rceZdZdZdZy) CSVWriterc t|d|_tj|jfi|j|_y)Nr)rrrwriterr)rrrs r/rzCSVWriter.__init__s-C( jj> > r1ctjddkr=g}|D]4}t|tr|j d}|j |6|}|j j|yr)rrrrr,r$rwriterow)rrowrrs r/rzCSVWriter.writerowse   A  "A dI.;;w/D C S!r1N)rrrrrrDr1r/rrs ?"r1rc`eZdZeej Zded<dfd ZdZdZdZ xZ S) Configurator inc_convertinccftt| ||xstj|_yr)superrrrqrr|)rconfigr| __class__s r/rzConfigurator.__init__s$ lD*62'BIIK r1c fd |jd}t|sj|}|jdd}|jdd}|rt|Dcgc] } | c}}|Dcgc]}t |s| ||f}}t |}||i|} |r+|j D]\} } t| |  | | Scc}wcc}w)Nc.t|ttfr't||Dcgc] }| c}}|St|tr0d|vrj |}|Si}|D]}||||<|Sj |}|Scc}wN())rrYrtypedictconfigure_customconvert)orgr*rrrs r/rz.Configurator.configure_custom..converts!dE]+ aa!8'!*!89MAt$19!2215FM  F2$+AaDMq 2MaM"9sBrrez[]rD)rwryrkrrrrsetattr) rrrpropsrrrrrr*rrSrs ` @r/rzConfigurator.configure_customs  JJt { QA 3%zz$# d3'!*34D28KQKN!WVAY'(KKeD#F#   /171:. / 4Ks%C#?C(C(c|j|}t|tr$d|vr |j|x|j|<}|Sr)rrrr)rrr*s r/ __getitem__zConfigurator.__getitem__sCS! fd #(,(=(=f(E EDKK v r1ctjj|s*tjj|j|}t j |dd5}tj|}ddd|S#1swYSxYw)z*Default converter for the inc:// protocol.rrr N) rqrrisabsr&r|rr#rr)rrr)r*s r/rzConfigurator.inc_convertscww}}U#GGLLE2E [[g 6 "!YYq\F "  " s "BB r) rrrrrvalue_convertersrrrr __classcell__)rs@r/rrs5,==>+U(@ r1rc$eZdZdZddZdZdZy)SubprocessMixinzC Mixin for running subprocesses and capturing their output Nc ||_||_yr)verboseprogress)rr r s r/rzSubprocessMixin.__init__s   r1cr|j}|j} |j}|sn{| |||nn|s tjj dn.tjj |j dtjj|jy)z Read lines from a subprocess' output stream and either pass to a progress callable (if specified) or write progress information to sys.stderr. Nrer) r r readlinerstderrrr"flushr)rrrr r r.s r/rzSubprocessMixin.readers ==,,!A#G$JJ$$S)JJ$$QXXg%67   "  r1c Ztj|ftjtjd|}tj|j |j df}|jtj|j |jdf}|j|j|j|j|j|jdd|S|jrtjjd|S)N)stdoutr r)rrr zdone.mainzdone. ) subprocessPopenPIPE threadingThreadrrrr waitr&r r rr)rcmdrrt1t2s r/ run_commandzSubprocessMixin.run_commands   S '$.OO$.OO ' & '  T[[(7K L    T[[(7K L       == $ MM'6 *\\ JJ  Y 'r1)FN)rrrrrrrrDr1r/rrs!*r1rcLtjdd|jS)z,Normalize a python package name a la PEP 503z[-_.]+r)rsubr)rXs r/normalize_namers  66(C & , , ..r1c(eZdZdZdZddZdZdZy) PyPIRCFilezhttps://upload.pypi.org/legacy/pypiNc|=tjjtjjdd}||_||_y)Nrz.pypirc)rqrrr&rrr[)rrr[s r/rzPyPIRCFile.__init__(s8 :bgg005yAB r1ci}tjj|jr|jxs |j }t j}|j|j|j}d|vr |jdd}|jdDcgc]%}|jdk7r|j'}}|gk(r d|vrdg}|S|D]}d|i}|j|d|d<d|j fd |jfd fD]2\}} |j||r|j||||<.| ||<4|dk(r ||j dfvr|j |d<|d|k7s|d|k7si}|Sd |vred }|j|dr|j|d}n |j }|j|d|j|d |||jd }|Scc}w)N distutilsz index-serversrrr!serverr repositoryrealm)rNz server-loginr)rrr&r%r')rqrrr rr[DEFAULT_REPOSITORYrRawConfigParserrrrrr] DEFAULT_REALM has_option) rr*r&rr index_serversr%_serversrrs r/rzPyPIRCFile.read.s8 77>>$-- (1D1DT1J'-||~+LLNr>)$*8N K#+("*F!3-3ZZ -Kz*/;.2.E.E.G.5t7I7I-J-?-A6LC &00=.4jj.Es .5s 6#f,$($;$;V#D2E373J3JF<0$X.*<"("6*"D%'F-(J  8+'$$V\:!'FL!AJ!%!8!8J & 6: > & 6: >",$!//  ]s0*HcZtj}|j}|j||j ds|j d|j dd||j dd|t|d5}|j|dddy#1swYyxYw)Nr!rrr) rr)rr has_sectionrrr#r)rrrrrr)s r/rZzPyPIRCFile.updatejs--/ ]] B!!&)   v & 6:x0 6:x0 "c] a LLO   s B!!B*NN)rrrr(r*rrrZrDr1r/r r #s:M :x r1r cJt|jjS)zG Read the PyPI access configuration as supported by distutils. )r[)r r[rrs r/ _load_pypircr3ws %)) $ ) ) ++r1c`tj|j|jyr)r rZrrr2s r/ _store_pypircr5~sL7r1ctjdk(rsdtjj vrydtjj vrydtjj vrytj Sdtj vrtj dStjd k7sttd stj Stj\}}}}}|j jd d }|jd djd d}|dddk(r|d|S|dddk(rB|ddk\rd}dt|ddz |ddfz}ddd}|d|tjzz }n|dddk(r ddl m }|S|dd d!k(rJd!}tjd"tj }|j#|}|rJ|j%}n9|dd d#k(r1ddl} dd$lm} | j/| j1|||\}}}|d|d|S#t,$rddl} Y?wxYw)%aReturn a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. on Linux, the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u Windows will return one of: win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) win32 (all others - specifically, sys.platform is returned) For other non-POSIX platforms, currently just returns 'sys.platform'. ramd64 win-amd64z(arm) win-arm32z(arm64)z win-arm64_PYTHON_HOST_PLATFORMr/unamerprrVrirNlinuxsunosr5solarisz%d.%sr32bit64bit)ilz.%saix) aix_platformcygwinz[\d.]+darwin) sysconfig)rqrXrrrplatformrrr;r#intmaxsize _aix_supportrErrBASCIIrr _osx_supportr$rI ImportErrorget_platform_osxget_config_vars) osnamerreleasermachinebitnessrErel_rer)rOrIs r/get_host_platformrXs3( ww$ ckk'') ) ckk'') )  ))+ +||"**,zz122 ww'W!5||13 -VT7GW\\^ # #C ,Fooc3'//S9G bqzW!'** w  1: FWQZ1!4gabk BBG$+IG uws{{33 3G u -~ x Irxx0 LL ! ggiG x   +$0#@#@  % % ''$C  ' 22    sH>> I Iwin32r8r9)x86x64armctjdk7r tStjj d}|t vr tSt |S)NrVSCMD_ARG_TGT_ARCH)rqrXrXrr_TARGET_TO_PLAT)cross_compilation_targets r/ get_platformrasG ww$ ""!zz~~.BC6 "" 3 44r1r0)rr`)r collectionsr contextlibrglobrr}r=rloggingrqr@rrrrPrrr+rrrdummy_threadingrWrrcompatrrr r r r r rrrrrrrrrrrrr getLoggerrrrBrrPrOr:rCr?r`r%rFrlrrrrrrrcontextmanagerrrrrrrrrkrmVERBOSErzrrrrrrrIrrrrrrrrrrrrrARCHIVE_EXTENSIONSr;rErqrLr|rvrwrxrrrrrrrrrrrrrrrrr r3r5rXr_rarDr1r/rns+  #    ( ((((((   8 $ RZZ) * RZZ 34 RZZ5 6 BJJD E RZZ bjj BJJ{ # rzzEF X!vB%J4$  ,^&   && f   6~6~B &8 2::::  '>&(R" & &2::tt,-4"**9: / 8*D# )F)XDDTG!G!\AH $ &W+vW+| BJJ~ & " #?@ bjj!568++ '11 D ' V(<( # ## #' //'$<)''<2$ f 6"",5#5p.f.b/"QQh,8Q3j   5a> C('(s#M5N5N?N NN