L iKHUdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ddl m Z ddlmZddlmZddlmZmZmZeeZd ad ed <iad ed <d+dZd,dZd-dZd-dZd-dZej<riZd ed<iZ ded<d.dZ!nd.dZ!d.dZ"d/dZ#d0dZ$d-dZ%d1dZ&d2dZ'GddZ(Gd d!Z)Gd"d#Z*d3d$Z+d%Dcgc]\}}ejX||fc}}Z-d4d&Z. d5 d6d'Z/Gd(d)Z0d7d*Z1eycc}}w)8zFile wrangling.) annotationsN)Iterable)Callable)env) ConfigError) human_sortedisolate_module join_regexstr RELATIVE_DIRzdict[str, str]CANONICAL_FILENAME_CACHEcttj}|jtjs|tjz}tj j |aiay)z?Set the directory that `relative_filename` will be relative to.N) abs_fileoscurdirendswithseppathnormcaser r) abs_curdirs T/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/coverage/files.pyset_relative_directoryrsP "))$J   rvv &"&&( 77##J/L "ctS)z=Return the directory that `relative_filename` is relative to.)r rrrelative_directoryr/s rctjj|}|jtr|t td}|S)zReturn the relative form of `filename`. The file name will be relative to the current directory when the `set_relative_directory` was called. N)rrr startswithr len)filenamefnorms rrelative_filenamer#4s= GG  X &E  %C -/0 Orc|tvr|}tjj|sptjgt jzD]K}|tjj ||} tjj|}|sI|}nt|}|t|<t|S#t$rd}Y2wxYw)zzReturn a canonical file name for `filename`. An absolute path with no redundant components and normalized case. F) rrrisabsrsysjoinexists UnicodeErrorr)r!cfrfr(s rcanonical_filenamer,As // ww}}X& chh. <GGLLx0#WW^^A.FB b\-/ * #H --$#"F#s3B77 CCctj|\}}|r?tjd|j ddj dd}d|d}nd }||j d dzS) a7A base for a flat file name to correspond to this file. Useful for writing files about the code where you want all the files in the same directory, but need to differentiate same-named files from different directories. For example, the file a/b/c.py will return 'z_86bbcbe134d28fd2_c_py' sha3_256zUTF-8F)usedforsecurityNz__r .)ntpathsplithashlibnewencode hexdigestreplace)r!dirnamebasenamefpprefixs r flat_rootnamer?Zsx X.GX [[  NN7 #!  )+cr  bT H$$S#. ..r_ACTUAL_PATH_CACHEzdict[str, list[str]]_ACTUAL_PATH_LIST_CACHEc |tvr t|Stjj|\}}|s|j }n|s|}nt |}|t vr t |}n tj|}|t |<tjj|}|D](}tjj||k(s&|}ntjj||}|t|<|S#t$rg}YwxYw)z:Get the actual path of `path`, including the correct case.) r@rrr5upper actual_pathrAlistdir Exceptionrr')rheadtailactpathfilesnormtailr+s rrDrDus % %%d+ +WW]]4( djjlGGt$D../5JJt,E 16'-ww''-H 77##A&(2D ggll4.G#*4 !Es*C?? D  D c|S)z*The actual path for non-Windows platforms.rrs rrDrDs rcttjjtjj |S)z.Return the absolute normalized form of `path`.)rDrrabspathrealpathrMs rrrs) rwwrww'7'7'=> ??rcdD]P}|j|t|z\}}}|s'||z}tjj |sL||fcSy)zSplit a filename into a zipfile / inner name pair. Only return a pair if the zipfile exists. No check is made if the inner name is in the zipfile. )z.zipz.whlz.eggz.pexz.parN) partitionrrrr()r!extzipbase extensioninnerzipfiles r zip_locationrXs^8&$,$6$6sS]7J$K!E mGww~~g&~% & rc\tjj|ryt|ryy)z'Determine if a source file path exists.TF)rrr(rXrMs r source_existsrZs% ww~~dD rc@tjj|S)z:Return the string as Python would describe this file name.)rrrOr!s rpython_reported_filer]s 77??8 $$rcZtj|xstj|S)z)Is `filename` an absolute path on any OS?)r4r% posixpathr\s risabs_anywherer`s << ! >Y__X%>>rcg}|xsgD]?}|j||jdr&|jt|A|S)aPrepare the file patterns for use in a `GlobMatcher`. If a pattern starts with a wildcard, it is used as a pattern as-is. If it does not start with a wildcard, then it is made absolute with the current directory. If `patterns` is None, an empty list is returned. )*?)appendrr)patternspreppedps r prep_patternsrhsKG ^(q||J' NN8A; '( Nrc2eZdZdZdddZd dZd dZd dZy) TreeMatcherzA matcher for files in a tree. Construct with a list of paths, either files or directories. Paths match with the `match` method if they are one of the files, or if they are somewhere in a subtree rooted at one of the directories. ct||_|Dcgc]!}tjj |#c}|_||_ycc}wN)roriginal_pathsrrrpathsname)selfrnrorgs r__init__zTreeMatcher.__init__s<)5e)<389abgg&&q)9  :s&A c<d|jd|jdS)Nz )rormrps r__repr__zTreeMatcher.__repr__s"tyyk4+>+>*ACCrc|jSz4A list of strings for displaying when dumping state.)rmrus rinfozTreeMatcher.infos"""rctjj|}|jD]<}|j |s||k(ry|t |tj k(s<yy)z1Does `fpath` indicate a file in one of our trees?TF)rrrrnrr r)rpfpathrgs rmatchzTreeMatcher.matchs]  ' A"A:Q=BFF* rNunknown)rn Iterable[str]ror returnNonerr r list[str]r{r rbool__name__ __module__ __qualname____doc__rqrvryr|rrrrjrjs D# rrjc2eZdZdZdddZd dZd dZd dZy) ModuleMatcherz A matcher for modules in a tree.c2t||_||_yrl)listmodulesro)rp module_namesros rrqzModuleMatcher.__init__sL)  rc<d|jd|jdS)Nz>rc|jSrx)rrus rryzModuleMatcher.infos ||rc|sy|jD].}|j|s||k(ry|t|dk(s.yy)z)z[a-zA-Z0-9_-]+r)z[\[\]]N)r3z\\\g<0>cl|jdd}d|vrd|}g}d}|t|krwtD]_\}}|j||x}s|t d|d|j |j ||j}n|t|krwdj|S)z.Convert a file-path glob pattern into a regex.\rz**/r)poszFile pattern can't include r ) r:r G2RX_TOKENSr|rrdexpandendr')patternpath_rxrrxsubrs r_glob_to_regexrNsoodC(G 'y/G C G " GBHHW#H..q.;%(CAaD8&LMMqxx}-eeg   G  777 rcd}|r|tjz}ttt|}|sd|d}tj ||}|S)a{Convert glob patterns to a compiled regex that matches any of them. Slashes are always converted to match either slash or backslash, for Windows support, even when running elsewhere. If the pattern has no slash or backslash, then it is interpreted as matching a file name anywhere it appears in the tree. Otherwise, the glob pattern must match the whole file path. If `partial` is true, then the pattern will match if the target string starts with the pattern. Otherwise, it must match the entire string. Returns: a compiled regex object. Use the .match method to compare target strings. rz(?:z)\Z)flags)r IGNORECASEr maprcompile)rerpartialrrcompileds rrrasP* E  C1 2B B4s^zz"E*H OrcDeZdZdZ d ddZd dZd dZefd dZy) PathAliasesaA collection of aliases for paths. When combining data files from remote machines, often the paths to source code are different, for example, due to OS differences, or because of serialized checkouts on continuous integration machines. A `PathAliases` object tracks a list of pattern/result pairs, and can map a path through those aliases to produce a unified path. NcFg|_|xsd|_||_d|_y)Ncy)Nrr)msgs rz&PathAliases.__init__..srF)aliasesdebugfnrelativepprinted)rprrs rrqzPathAliases.__init__s' @B 1=    rc |jd|jd|jD]*\}}}|jd|d|d|j,y)z;Dump the important parts of the PathAliases, for debugging.zAliases (relative=z):z Rule:  -> using regex N)rrrr)rporiginal_patternregexresults rpprintzPathAliases.pprintsb )$--;'KBW3X"7+ , { "Gy4N[ u% 2 -uf=>rc | |js|jd|_|jD]\}}}|j|x}s|j |d|}|j t |t |}|j s t|}|jdxrt|dkD}|jdr|s|dd}||s|jd|d|d|d d z|jd |d |d |dd|z|cS|j r t|}|j rt|stjd|} t| dkDr| d} d|  dtj| d} | t j }t# fd|jDs^|jd d |d| |jj% tj&| |f|j)||S|jd|d|S)aMap `path` through the aliases. `path` is checked against all of the patterns. The first pattern to match is used to replace the root of the path with the result root. Only one pattern is ever used. If no patterns match, `path` is returned unchanged. The separator style in the result is made to match that of the result in the alias. `exists` is a function to determine if the resulting path actually exists. Returns the mapped path. If a mapping has happened, this is a canonical path. If no mapping has happened, it is the original value of `path` unchanged. Tr)z./z.\NzRule z changed z to rszwhich doesn't exist, continuingz Matched path z to rule rz, z producing z[/\\]rz*/z ^(.*[\\/])?rc30K|] \}}}|k(ywrlr).0rgr2rs r z"PathAliases.map..sDGAq!1<DszGenerating rule: r)r(zNo rules match, path z is unchanged)rrrr|r:rrr,rr rr#r`rr5escaperanyrdrr) rprr(rrrrr7 dot_startpartsdir1 regex_patrs @rrzPathAliases.maps6&}} KKM DM/3||  + eVKK%%q%ll1Q40kk#d)S[9}},S1C"--m<PVq >>-0ab'Cc{LL 039THDqQ;< #D895E4HVJVXY"3'*+ ' . ==$T*D ==!5HHXt,E5zA~Qxtf+*299T?*;5A  6"&&*Dt||DDLL+G;d6*MR[Q^_LL''"**Y2G(PQ88D888 ,THMBC r)NF)rzCallable[[str], None] | Nonerrrrrr)rr rr rr)rr r(zCallable[[str], bool]rr ) rrrrrqrrrZrrrrrrsH 15 -    e %?N>KBrrc#Kttj|D]Z\}\}}}|s|dkDr d|vr|dd=|D];}tjd|stj j ||=\yw)a|Yield all of the importable Python files in `dirname`, recursively. To be importable, the files have to be in a directory with a __init__.py, except for `dirname` itself, which isn't required to have one. The assumption is that `dirname` was specified directly, so the user knows best, but sub-directories are checked for a __init__.py to be sure we only find the importable files. If `include_namespace_packages` is True, then the check for __init__.py files is skipped. Files with strange characters are skipped, since they couldn't have been imported, and are probably editor side-files. rz __init__.pyNz^[^.#~!$@%^&*()+=,]+\.pyw?$) enumeraterwalkrr|rr')r;include_namespace_packagesidirpathdirnames filenamesr!s rfind_python_filesr s .7rwww7G-H 6) )GXy)1ui7QK! 6Hxx6Aggll7H55  6 6s AA?'A?rr)r!r rr )rr rr )r!r rztuple[str, str] | None)rr rr)r!r rr)rerrr)rr rr )rr rr )FF)rerrrrrrzre.Pattern[str])r;r rrrr)2r __future__rr6r4ros.pathr_rr&collections.abcrtypingrcoveragercoverage.exceptionsr coverage.miscrr r r __annotations__rrrr#r,r?rr@rArDrrXrZr]r`rhrjrrrrrrrrr)rrs00rrs\"  $+BBB c+-.-"$ .2/.;;)++4616D @  % ? $  F<00(5S  2$ &*# >FFR6@]sD