U ʗRe @sddlZddlZddlZddlZddlmZmZmZmZm Z ddl m Z ddl m Z mZmZmZmZervddlmZneZddd d d d d ddg ZedddZGdddeZejddedddZeddd Zeeeeddd Zee dddZeee dddZdS)N) TYPE_CHECKINGListOptionalTypecast) strtobool)BaseDistributionBaseEnvironmentFilesystemWheel MemoryWheelWheel)Protocolr r r r r get_default_environmentget_environmentget_wheel_distributionselect_backend)returnc CsZttt tttjdW5QRSQRXtj dkr@dSddl }tt |j ddS)aWhether to use the ``importlib.metadata`` or ``pkg_resources`` backend. By default, pip uses ``importlib.metadata`` on Python 3.11+, and ``pkg_resourcess`` otherwise. This can be overridden by a couple of ways: * If environment variable ``_PIP_USE_IMPORTLIB_METADATA`` is set, it dictates whether ``importlib.metadata`` is used, regardless of Python version. * On Python 3.11+, Python distributors can patch ``importlib.metadata`` to add a global constant ``_PIP_USE_IMPORTLIB_METADATA = False``. This makes pip use ``pkg_resources`` (unless the user set the aforementioned environment variable to *True*). _PIP_USE_IMPORTLIB_METADATA) FrNT) contextlibsuppressKeyError ValueErrorboolrosenvironsys version_infoimportlib.metadatagetattrmetadata importlibr%/builddir/build/BUILDROOT/alt-python38-pip-22.2.1-2.el8.x86_64/opt/alt/python38/lib/python3.8/site-packages/pip/_internal/metadata/__init__.py_should_use_importlib_metadatas $ r'c@s&eZdZUeeed<eeed<dS)Backend Distribution EnvironmentN)__name__ __module__ __qualname__rr __annotations__r r%r%r%r&r(4s  r()maxsizecCs2trddlm}tt|Sddlm}tt|S)Nrr#) pkg_resources)r'r$rr(r0)r$r0r%r%r&r9s    cCs tjS)a Get the default representation for the current environment. This returns an Environment instance from the chosen backend. The default Environment instance should be built from ``sys.path`` and may use caching to share instance state accorss calls. )rr*defaultr%r%r%r&rDs)pathsrcCstj|S)a'Get a representation of the environment specified by ``paths``. This returns an Environment instance from the chosen backend based on the given import paths. The backend must build a fresh instance representing the state of installed distributions when this function is called. )rr* from_paths)r3r%r%r&rNs) directoryrcCstj|S)zGet the distribution metadata representation in the specified directory. This returns a Distribution instance from the chosen backend based on the given on-disk ``.dist-info`` directory. )rr)from_directory)r5r%r%r&get_directory_distributionXsr7)wheelcanonical_namercCstj||S)aGet the representation of the specified wheel's distribution metadata. This returns a Distribution instance from the chosen backend based on the given wheel's ``.dist-info`` directory. :param canonical_name: Normalized project name of the given wheel. )rr) from_wheel)r8r9r%r%r&ras)r functoolsrrtypingrrrrrpip._internal.utils.miscrbaser r r r r robject__all__rr'r( lru_cacherrstrrr7rr%r%r%r&s6