7i3eVddlZddlZddlZddlZddlZddlZddlZddlZddl m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZddlmZddlmZmZddlmZmZddlm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&dd l'm(Z(m)Z)m*Z*dd l+m,Z,dd l-m.Z.dd l/m0Z0m1Z1dd l2m3Z3ddl4m5Z5e rddl m6Z6ne7Z6ee e!fZ8ee9ejtfZ;ejxe=Z>Gdde6Z?dee9dfdee9dfde9fdZ@GddeZAGdde6ZBGddZCGdde6ZDGd d!eDZEGd"d#eDZFy)$N) IO TYPE_CHECKINGAny Collection ContainerDictIterableIteratorList NamedTupleOptionalTupleUnion) Requirement)InvalidSpecifier SpecifierSet)NormalizedNamecanonicalize_name) LegacyVersionVersion)NoneMetadataError) site_packages user_site)DIRECT_URL_METADATA_NAME DirectUrlDirectUrlValidationError) stdlib_pkgs)egg_link_path_from_sys_path)is_localnormalize_path) url_to_path) msg_to_json)ProtocolcNeZdZedefdZedefdZedefdZy)BaseEntryPointreturnctNNotImplementedErrorselfs d/mnt/ssd/data/python-lab/ChefSystem/venv/lib/python3.12/site-packages/pip/_internal/metadata/base.pynamezBaseEntryPoint.name9 !##ctr)r*r,s r.valuezBaseEntryPoint.value=r0r1ctr)r*r,s r.groupzBaseEntryPoint.groupAr0r1N)__name__ __module__ __qualname__propertystrr/r3r5r1r.r&r&8sQ $c$$$s$$$s$$r1r&entry.infor'c|r-|ddk(r%|r|ddk(r|dz }n|dd}|dd}|r |ddk(r%ttjg||S)aConvert a legacy installed-files.txt path into modern RECORD path. The legacy format stores paths relative to the info directory, while the modern format stores paths relative to the package root, e.g. the site-packages directory. :param entry: Path parts of the installed-files.txt entry. :param info: Path parts of the egg-info directory relative to package root. :returns: The converted entry. For best compatibility with symlinks, this does not use ``abspath()`` or ``Path.resolve()``, but tries to work with path parts: 1. While ``entry`` starts with ``..``, remove the equal amounts of parts from ``info``; if ``info`` is empty, start appending ``..`` instead. 2. Join the two directly. r..)r?Nr"r:pathlibPath)r<r=s r._convert_installed_files_pathrDFsm* E!H$tBx4' GOD9Dab  E!H$ w||*T*E* ++r1c,eZdZUeed<eed<eed<y) RequiresEntry requirementextramarkerN)r6r7r8r:__annotations__r;r1r.rFrFds J Kr1rFc eZdZededdfdZededededdfdZedd d eddfd Zdefd Z defd Z e de efdZ e de efdZe de efdZe de efdZe defdZe defdZe defdZe defdZe defdZe defdZe defdZe de efdZe defdZe defdZe defdZe defdZ e defdZ!e defdZ"d e#defd!Z$de%efd"Z&d e#defd#Z'de(e)fd$Z*de+jXjZfd%Z.e/j`d&'de+jXjZfd(Z1e de+jXjZfd)Z2e de3ee4ffd*Z5e de efd+Z6e defd,Z7e de8fd-Z9dde e%efd3Z?de e%efd4Z@de e%efd5ZAde%eBfd6ZCde(efd7ZDde(efd8ZEd9e+jXjZdd:fd;ZFy:)=BaseDistribution directoryr'ct)zLoad the distribution from a metadata directory. :param directory: Path to a metadata directory, e.g. ``.dist-info``. r*)clsrMs r.from_directoryzBaseDistribution.from_directoryk "##r1metadata_contentsfilename project_namect)aLoad the distribution from the contents of a METADATA file. This is used to implement PEP 658 by generating a "shallow" dist object that can be used for resolution without downloading or building the actual dist yet. :param metadata_contents: The contents of a METADATA file. :param filename: File name for the dist with this metadata. :param project_name: Name of the project this dist represents. r*)rOrRrSrTs r.from_metadata_file_contentsz,BaseDistribution.from_metadata_file_contentsss "##r1wheelWheelr/ct)aLoad the distribution from a given wheel. :param wheel: A concrete wheel definition. :param name: File name of the wheel. :raises InvalidWheel: Whenever loading of the wheel causes a :py:exc:`zipfile.BadZipFile` exception to be thrown. :raises UnsupportedWheel: If the wheel is a valid zip, but malformed internally. r*)rOrWr/s r. from_wheelzBaseDistribution.from_wheel "##r1cT|jd|jd|jdS)N z ())raw_nameversionlocationr,s r.__repr__zBaseDistribution.__repr__s'--$,,r$--BBr1c8|jd|jS)Nr])r_r`r,s r.__str__zBaseDistribution.__str__s--$,,00r1ct)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. r*r,s r.razBaseDistribution.locationr[r1c|j}|r&|jrt|jSyt |j }|r |j Sy)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_editabler!urlrr_ra)r-rg egg_link_paths r.editable_project_locationz*BaseDistribution.editable_project_locationsR__ ++-":>>22 8 FM}}$r1ct)aThe distribution's "installed" location. This should generally be a ``site-packages`` directory. This is usually ``dist.location``, except for legacy develop-installed packages, where ``dist.location`` is the source code location, and this is where the ``.egg-link`` file is. The returned location is normalized (in particular, with symlinks removed). r*r,s r.installed_locationz#BaseDistribution.installed_location "##r1ct)a/Location of the .[egg|dist]-info directory or file. 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. r*r,s r. info_locationzBaseDistribution.info_locations "##r1cf|j}|sytj|jS)aWhether this distribution is installed with legacy distutils format. A distribution installed with "raw" distutils not patched by setuptools uses one single file at ``info_location`` to store metadata. We need to treat this specially on uninstallation. F)rprBrCis_filer-rps r.installed_by_distutilsz'BaseDistribution.installed_by_distutilss-** ||M*2244r1cB|j}|sy|jdS)zWhether this distribution is installed as an egg. This usually indicates the distribution was installed by (older versions of) easy_install. Fz.egg)raendswithr-ras r.installed_as_eggz!BaseDistribution.installed_as_eggs$==  ((r1c|j}|sy|jdsytj|j S)aWhether this distribution is installed with the ``.egg-info`` format. This usually indicates the distribution was installed with setuptools with an old pip version or with ``single-version-externally-managed``. Note that this ensure the metadata store is a directory. distutils can also installs an ``.egg-info``, but as a file, not a directory. This property is *False* for that case. Also see ``installed_by_distutils``. Fz .egg-inforprvrBrCis_dirrss r."installed_with_setuptools_egg_infoz3BaseDistribution.installed_with_setuptools_egg_infos>** %%k2||M*1133r1c|j}|sy|jdsytj|j S)aaWhether this distribution is installed with the "modern format". This indicates a "modern" installation, e.g. storing metadata in the ``.dist-info`` directory. This applies to installations made by setuptools (but through pip, not directly), or anything using the standardized build backend interface (PEP 517). Fz .dist-inforzrss r.installed_with_dist_infoz)BaseDistribution.installed_with_dist_infos>** %%l3||M*1133r1ctr)r*r,s r.canonical_namezBaseDistribution.canonical_namer0r1ctr)r*r,s r.r`zBaseDistribution.versionr0r1c:|jjddS)zConvert a project name to its setuptools-compatible filename. This is a copy of ``pkg_resources.to_filename()`` for compatibility. -_)r_replacer,s r.setuptools_filenamez$BaseDistribution.setuptools_filenames }}$$S#..r1c |jt} tj|S#t$rYywxYw#t t jtf$r0}tjdt|j|Yd}~yd}~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_jsonUnicodeDecodeErrorjsonJSONDecodeErrorrloggerwarningr)r-contentes r.rgzBaseDistribution.direct_url%s nn%=>G &&w/ /!     $  NN-(##    s!-< 99B &BB c |jd}|j D]}|j }|s|cSy#tttf$rYywxYw)N INSTALLER)rOSError ValueErrorr splitlinesstrip)r-installer_textline cleaned_lines r. installerzBaseDistribution.installer?sd !^^K8N#--/ $D:: ! "E +D    "EG NN7DMM1 5> ! "s? A?,A:4A?:A?extrasct)zDependencies of this distribution. For modern .dist-info distributions, this is the collection of "Requires-Dist:" entries in distribution metadata. r*)r-rs r.iter_dependenciesz"BaseDistribution.iter_dependenciesrQr1ct)aExtras provided by this distribution. For modern .dist-info distributions, this is the collection of "Provides-Extra:" entries in distribution metadata. The return value of this function is not particularly useful other than display purposes due to backward compatibility issues and the extra names being poorly normalized prior to PEP 685. If you want to perform logic operations on extras, use :func:`is_extra_provided` instead. r*r,s r.iter_provided_extrasz%BaseDistribution.iter_provided_extrasrnr1rHct)zCheck whether an extra is provided by this distribution. This is needed mostly for compatibility issues with pkg_resources not following the extra normalization rules defined in PEP 685. r*)r-rHs r.is_extra_providedz"BaseDistribution.is_extra_providedrQr1c |jd}dtj|j DS#t$rYywxYw)NRECORDc3^K|]%}ttj|d'yw)rNrA).0rows r. zFBaseDistribution._iter_declared_entries_from_record..s"ScGLLQ()Ss+-)rrcsvreaderr)r-texts r."_iter_declared_entries_from_recordz3BaseDistribution._iter_declared_entries_from_recordsG >>(+DTSZZ@Q5RSS!  s= A A cR |jd}d|jdD}|j}|j}|||S t j |j|js|Sfd|DS#t$rYywxYw#t$r|cYSwxYw)Nzinstalled-files.txtc3&K|] }|s| ywr)r;)rps r.rzFBaseDistribution._iter_declared_entries_from_legacy..sAqqAsF)keependsc3K|]7}ttj|jj9ywr))rDrBrCparts)rrinfo_rels r.rzFBaseDistribution._iter_declared_entries_from_legacy..s2  *',,q/*?*? P s=A) rrrrarprBrC relative_torr)r-rpathsrootr=rs @r."_iter_declared_entries_from_legacyz3BaseDistribution._iter_declared_entries_from_legacys >>"78DBDOOUO;A}}!! <4<L ||D)55d;H~~L   !   L s#B $B BB B&%B&cF|jxs|jS)aIterate through file entries declared in this distribution. For modern .dist-info distributions, this is the files listed in the ``RECORD`` metadata file. For legacy setuptools distributions, this comes from ``installed-files.txt``, with entries normalized to be compatible with the format used by ``RECORD``. :return: An iterator for listed entries, or None if the distribution contains neither ``RECORD`` nor ``installed-files.txt``. )rrr,s r.iter_declared_entriesz&BaseDistribution.iter_declared_entriess&  3 3 5 9668 r1c#vK |jd}dx}}|jD]}}|j}|r|j dr'|j dr6|j dr%|jdj d\}}}nt||| y#t$rYywxYww) aParse a ``requires.txt`` in an egg-info directory. This is an INI-ish format where an egg-info stores dependencies. A section name describes extra other environment markers, while each entry is an arbitrary string (not a key-value pair) representing a dependency as a requirement string (no markers). There is a construct in ``importlib.metadata`` called ``Sectioned`` that does mostly the same, but the format is currently considered private. z requires.txtNr#[]z[]:)rGrHrI)rrrrrrv partitionrF)r-rrHrIrrs r._iter_requires_txt_entriesz+BaseDistribution._iter_requires_txt_entries s nn^4G&&( ND::#>> $$ 3$+AV$ $hsm $$s$t$THXc]4KT HXc]4K * x '> NH],CN2x}(Xc](83u}}/D/D33r1rLceZdZdZeddZedeeeddfdZ dededfdZ de dfd Z de e fd Zd ed d d fd edeedededede e f dZy)BaseEnvironmentz6An environment containing distributions to introspect.r'ctr)r*)rOs r.defaultzBaseEnvironment.defaultWr0r1rctr)r*)rOrs r. from_pathszBaseEnvironment.from_paths[r0r1r/rLct)zGiven a requirement name, return the installed distributions. The name may not be normalized. The implementation must canonicalize it for lookup. r*)r-r/s r.get_distributionz BaseEnvironment.get_distribution_rQr1ct)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. r*r,s r._iter_distributionsz#BaseEnvironment._iter_distributionsgrr1c#K|jD]d}tjd|jtj}|s,t j d|j|ja|fyw)zBIterate through all installed distributions without any filtering.z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$)flagsz%Ignoring invalid distribution %s (%s)N)r rematchr IGNORECASErrra)r-distproject_name_valids r.iter_all_distributionsz&BaseEnvironment.iter_all_distributionspsp,,. D "$<##mm"  &;''MM J# sA9A;TF local_onlyskipinclude_editableseditables_only user_onlyc|j}|r d|D}|s d|D}|r d|D}|r d|D}fd|DS)a/Return a list of installed distributions. This is based on ``iter_all_distributions()`` with additional filtering options. Note that ``iter_installed_distributions()`` without arguments is *not* equal to ``iter_all_distributions()``, since some of the configurations exclude packages by default. :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|]}|js|ywr))rrds r.rz?BaseEnvironment.iter_installed_distributions..s+177!+c3:K|]}|jr|ywr)rrs r.rz?BaseEnvironment.iter_installed_distributions..s2qzz!2rc3:K|]}|js|ywr)rrs r.rz?BaseEnvironment.iter_installed_distributions..s.1::!.rc3:K|]}|js|ywr))rrs r.rz?BaseEnvironment.iter_installed_distributions..s11==!1rc3@K|]}|jvs|ywr))r)rrrs r.rz?BaseEnvironment.iter_installed_distributions..s>a!1!1!=>s)r)r-rrrrrits ` r.iter_installed_distributionsz,BaseEnvironment.iter_installed_distributionssR0 ( ( * +R+B 2R2B .R.B 1R1B>2>>r1N)r'r)r6r7r8__doc__rrr r r:rrr r rLrrrrr"r;r1r.rrTs@$$$xS 2$7H$$$S$X6H-I$$X.@%A$1A(B. *"&$ !?!?n!? !?  !?  !? " #!?r1rc8eZdZUeed<dej fdZy)rXrar'ctr)r*r,s r. as_zipfilezWheel.as_zipfilerr1N)r6r7r8r:rJzipfileZipFiler&r;r1r.rXrXsM$GOO$r1rXc<eZdZdeddfdZdej fdZy)FilesystemWheelrar'Nc||_yr))rarws r.__init__zFilesystemWheel.__init__s   r1cDtj|jdSNT) allowZip64)r'r(rar,s r.r&zFilesystemWheel.as_zipfilest}}>>r1)r6r7r8r:r,r'r(r&r;r1r.r*r*s%!!!?GOO?r1r*cFeZdZdedeeddfdZdejfdZ y) MemoryWheelrastreamr'Nc ||_||_yr))rar2)r-rar2s r.r,zMemoryWheel.__init__s   r1cDtj|jdSr.)r'r(r2r,s r.r&zMemoryWheel.as_zipfilest{{t<rGs)    ;KI@6< 3D=0HM723 g&&& '   8 $ $X $, c?, S/, ,<J g3xg3TR?R?j$H$?e?=%=r1