"Jd_+ddlZddlZddlZddlZddlZddlmZmZm Z m Z m Z m Z m Z mZmZddlmZddlmZmZddlmZddlmZmZddlmZmZmZddlmZdd l m!Z!dd l"m#Z#erdd lm$Z$ne%Z$eeefZ&ej'e(Z)Gd d e$Z*Gdde$Z+GddZ,Gdde$Z-Gdde-Z.Gdde-Z/dS)N) IO TYPE_CHECKING Collection ContainerIterableIteratorListOptionalUnion) Requirement)InvalidSpecifier SpecifierSet)NormalizedName) LegacyVersionVersion)DIRECT_URL_METADATA_NAME DirectUrlDirectUrlValidationError) stdlib_pkgs)egg_link_path_from_sys_path) url_to_path)ProtocolcbeZdZedefdZedefdZedefdZdS)BaseEntryPointreturnctNNotImplementedErrorselfs N/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/metadata/base.pynamezBaseEntryPoint.name+!###ctrrr s r"valuezBaseEntryPoint.value/r$r%ctrrr s r"groupzBaseEntryPoint.group3r$r%N)__name__ __module__ __qualname__propertystrr#r'r)r%r"rr*s $c$$$X$$s$$$X$$s$$$X$$$r%rceZdZdefdZdefdZedeefdZedeefdZ edeefdZ ede fdZ ede fdZedeefd Zedefd Zedefd Zedefd Zedefd ZedefdZdedefdZdeefdZedejjfdZedeefdZedefdZ ede!fdZ"dde#edee$fdZ%deefdZ&dS)BaseDistributionrc6|jd|jd|jdS)N z ())raw_nameversionlocationr s r"__repr__zBaseDistribution.__repr__9s'-BB$,BB$-BBBBr%c$|jd|jS)Nr3)r5r6r s r"__str__zBaseDistribution.__str__<s-00$,000r%ct)aWhere the distribution is loaded from. A string value is not necessarily a filesystem path, since distributions can be loaded from other sources, e.g. arbitrary zip archives. ``None`` means the distribution is created in-memory. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and files in the distribution. rr s r"r7zBaseDistribution.location?s"###r%c|j}|r)|rt|jSnt |j}|r|jSdS)zThe project location for editable distributions. This is the directory where pyproject.toml or setup.py is located. None if the distribution is not installed in editable mode. N) direct_urlis_local_editablerurlrr5r7)r!r= egg_link_paths r"editable_project_locationz*BaseDistribution.editable_project_locationMsd_  %++-- 3":>222 3 8 FFM %}$tr%ct)a'Location of the .[egg|dist]-info directory. Similarly to ``location``, a string value is not necessarily a filesystem path. ``None`` means the distribution is created in-memory. For a modern .dist-info installation on disk, this should be something like ``{location}/{raw_name}-{version}.dist-info``. Do not canonicalize this value with e.g. ``pathlib.Path.resolve()``. If this is a symbolic link, we want to preserve the relative path between it and other files in the distribution. rr s r"info_directoryzBaseDistribution.info_directorycs"###r%ctrrr s r"canonical_namezBaseDistribution.canonical_namesr$r%ctrrr s r"r6zBaseDistribution.versionwr$r%c( |t}n#t$rYdSwxYw tj|S#t t jtf$r2}t dt|j |Yd}~dSd}~wwxYw)zObtain a DirectUrl from this distribution. Returns None if the distribution has no `direct_url.json` metadata, or if `direct_url.json` is invalid. NzError parsing %s for %s: %s) read_textrFileNotFoundErrorr from_jsonUnicodeDecodeErrorjsonJSONDecodeErrorrloggerwarningrE)r!contentes r"r=zBaseDistribution.direct_url{s nn%=>>GG    44  &w// /   $    NN-(#     44444 s# ++AB'B  Bctrrr s r" installerzBaseDistribution.installerr$r%c*t|jSr)boolrAr s r"editablezBaseDistribution.editablesD2333r%ctrrr s r"localzBaseDistribution.localr$r%ctrrr s r" in_usersitezBaseDistribution.in_usersiter$r%ctrrr s r"in_site_packagesz!BaseDistribution.in_site_packagesr$r%r#ct)zRead a file in the .dist-info (or .egg-info) directory. Should raise ``FileNotFoundError`` if ``name`` does not exist in the metadata directory. rr!r#s r"rHzBaseDistribution.read_text "###r%ctrrr s r"iter_entry_pointsz"BaseDistribution.iter_entry_points!###r%ct)z?Metadata of distribution parsed from e.g. METADATA or PKG-INFO.rr s r"metadatazBaseDistribution.metadatas"###r%c6|jdS)zDValue of "Metadata-Version:" in distribution metadata, if available.zMetadata-Version)rdgetr s r"metadata_versionz!BaseDistribution.metadata_versions}  !3444r%cB|jd|jS)z*Value of "Name:" in distribution metadata.Name)rdrfrEr s r"r5zBaseDistribution.raw_names }  )<===r%c&|jd}|tS tt|}nH#t$r;}d}t ||j|tcYd}~Sd}~wwxYw|S)zValue of "Requires-Python:" in distribution metadata. If the key does not exist or contains an invalid value, an empty SpecifierSet should be returned. zRequires-PythonNz-Package %r has an invalid Requires-Python: %s)rdrfrr.r rNrOr5)r!r'specrQmessages r"requires_pythonz BaseDistribution.requires_pythons !!"344 =>> ! "E ++DD " " "EG NN7DM1 5 5 5>> ! ! ! ! ! ! " sA B0B B Br/extrasct)zDependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. r)r!rns r"iter_dependenciesz"BaseDistribution.iter_dependenciesr_r%ct)zExtras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. rr s r"iter_provided_extrasz%BaseDistribution.iter_provided_extrasr_r%N)r/)'r*r+r,r.r8r:r-r r7rArCrrEDistributionVersionr6rr=rSrUrVrXrZr\rHrrraemailrlMessagerdrgr5rrmrr rprrr/r%r"r1r18sDC#CCCC11111 $(3- $ $ $X $8C=X* $ $ $ $X $$$$$X$$,$$$X$HY/X2$3$$$X$4$444X4$t$$$X$$T$$$X$$$$$$X$$c$c$$$$$8N#;$$$$$%-/$$$X$5(3-555X5>#>>>X> X$$$ 3$+AV$$$$$hsm$$$$$$r%r1ceZdZdZeddZedeeeddfdZ dededfdZ de dfd Z de dfd Z d ed d d fd edeedededede ef dZdS)BaseEnvironmentz6An environment containing distributions to introspect.rctrr)clss r"defaultzBaseEnvironment.defaultr$r%pathsctrr)ryr{s r" from_pathszBaseEnvironment.from_pathsr$r%r#r1ct)z=Given a requirement name, return the installed distributions.rr^s r"get_distributionz BaseEnvironment.get_distributionr$r%ct)aIterate through installed distributions. This function should be implemented by subclass, but never called directly. Use the public ``iter_distribution()`` instead, which implements additional logic to make sure the distributions are valid. rr s r"_iter_distributionsz#BaseEnvironment._iter_distributionss"###r%c#K|D]U}tjd|jtj}|s't d|j|jQ|VVdS)z(Iterate through installed distributions.z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$)flagsz%Ignoring invalid distribution %s (%s)N)rrematchrE IGNORECASErNrOr7)r!distproject_name_valids r"iter_distributionsz"BaseEnvironment.iter_distributionss,,..  D "$<#m"""  & ;'M JJJJ#  r%TF local_onlyskipinclude_editableseditables_only user_onlyc|}|r d|D}|s d|D}|r d|D}|r d|D}fd|DS)aReturn a list of installed distributions. :param local_only: If True (default), only return installations local to the current virtualenv, if in a virtualenv. :param skip: An iterable of canonicalized project names to ignore; defaults to ``stdlib_pkgs``. :param include_editables: If False, don't report editables. :param editables_only: If True, only report editables. :param user_only: If True, only report installations in the user site directory. c3(K|] }|j |VdSr)rX.0ds r" z?BaseEnvironment.iter_installed_distributions..+s)++17+!++++++r%c3(K|] }|j |VdSrrVrs r"rz?BaseEnvironment.iter_installed_distributions..-s)22qz2!222222r%c3(K|] }|j |VdSrrrs r"rz?BaseEnvironment.iter_installed_distributions../s)..1:.!......r%c3(K|] }|j |VdSr)rZrs r"rz?BaseEnvironment.iter_installed_distributions..1s)111=1!111111r%c3.K|]}|jv |VdSr)rE)rrrs r"rz?BaseEnvironment.iter_installed_distributions..2s0>>a!1!=!=!=!=!=!=>>r%)r)r!rrrrrits ` r"iter_installed_distributionsz,BaseEnvironment.iter_installed_distributionss& $ $ & &  ,++R+++B  322R222B  /..R...B  211R111B>>>>2>>>>r%N)rrw)r*r+r,__doc__ classmethodrzr r r.r}rrrrrrUrr1rr/r%r"rwrwsH@@$$$[$$xS 2$7H$$$[$$S$X6H-I$$$$$X.@%A$$$$H-?$@. *"&$ ???n? ?  ?  ? " #??????r%rwc0eZdZUeed<dejfdZdS)Wheelr7rctrrr s r" as_zipfilezWheel.as_zipfile8rbr%N)r*r+r,r.__annotations__zipfileZipFilerr/r%r"rr5s<MMM$GO$$$$$$r%rc4eZdZdeddfdZdejfdZdS)FilesystemWheelr7rNc||_dSr)r7)r!r7s r"__init__zFilesystemWheel.__init__=s   r%c8tj|jdSNT) allowZip64)rrr7r s r"rzFilesystemWheel.as_zipfile@st}>>>>r%)r*r+r,r.rrrrr/r%r"rr<sS!!!!!!?GO??????r%rcDeZdZdedeeddfdZdejfdZ dS) MemoryWheelr7streamrNc"||_||_dSr)r7r)r!r7rs r"rzMemoryWheel.__init__Es   r%c8tj|jdSr)rrrr s r"rzMemoryWheel.as_zipfileIst{t<<<rs                        ;:::::KKKKKKKK666666@@@@@@@@ 322222DDDDDD000000HM723  8 $ $ $ $ $ $ $X $ $ $n$n$n$n$n$xn$n$n$bI?I?I?I?I?I?I?I?X$$$$$H$$$?????e???=====%=====r%