diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-09-03 10:35:19 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-09-03 10:45:11 +0300 |
commit | 68122e8b6e8d8cd07ef1eaca97150227566b4119 (patch) | |
tree | c908c9505295f1afb7389878567b5c55bbe6968d /contrib/python/importlib-metadata/py3 | |
parent | 8e1b86ec67624bcc8399753f602bc2c5dc444d66 (diff) | |
download | ydb-68122e8b6e8d8cd07ef1eaca97150227566b4119.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/importlib-metadata/py3')
3 files changed, 34 insertions, 8 deletions
diff --git a/contrib/python/importlib-metadata/py3/.dist-info/METADATA b/contrib/python/importlib-metadata/py3/.dist-info/METADATA index edd2ab879a..d9b8f53e25 100644 --- a/contrib/python/importlib-metadata/py3/.dist-info/METADATA +++ b/contrib/python/importlib-metadata/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: importlib_metadata -Version: 8.2.0 +Version: 8.4.0 Summary: Read metadata from Python packages Author-email: "Jason R. Coombs" <jaraco@jaraco.com> Project-URL: Source, https://github.com/python/importlib_metadata diff --git a/contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py b/contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py index 655bdf80ae..7dc38f73d0 100644 --- a/contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py +++ b/contrib/python/importlib-metadata/py3/importlib_metadata/__init__.py @@ -7,7 +7,6 @@ import sys import json import email import types -import inspect import pathlib import operator import textwrap @@ -232,9 +231,26 @@ class EntryPoint: >>> ep.matches(attr='bong') True """ + self._disallow_dist(params) attrs = (getattr(self, param) for param in params) return all(map(operator.eq, params.values(), attrs)) + @staticmethod + def _disallow_dist(params): + """ + Querying by dist is not allowed (dist objects are not comparable). + >>> EntryPoint(name='fan', value='fav', group='fag').matches(dist='foo') + Traceback (most recent call last): + ... + ValueError: "dist" is not suitable for matching... + """ + if "dist" in params: + raise ValueError( + '"dist" is not suitable for matching. ' + "Instead, use Distribution.entry_points.select() on a " + "located distribution." + ) + def _key(self): return self.name, self.value, self.group @@ -378,6 +394,17 @@ class Distribution(metaclass=abc.ABCMeta): """ Given a path to a file in this distribution, return a SimplePath to it. + + This method is used by callers of ``Distribution.files()`` to + locate files within the distribution. If it's possible for a + Distribution to represent files in the distribution as + ``SimplePath`` objects, it should implement this method + to resolve such objects. + + Some Distribution providers may elect not to resolve SimplePath + objects within the distribution by raising a + NotImplementedError, but consumers of such a Distribution would + be unable to invoke ``Distribution.files()``. """ @classmethod @@ -1136,11 +1163,10 @@ def _get_toplevel_name(name: PackagePath) -> str: >>> _get_toplevel_name(PackagePath('foo.dist-info')) 'foo.dist-info' """ - return _topmost(name) or ( - # python/typeshed#10328 - inspect.getmodulename(name) # type: ignore - or str(name) - ) + # Defer import of inspect for performance (python/cpython#118761) + import inspect + + return _topmost(name) or (inspect.getmodulename(name) or str(name)) def _top_level_inferred(dist): diff --git a/contrib/python/importlib-metadata/py3/ya.make b/contrib/python/importlib-metadata/py3/ya.make index 705317eb97..57e5ec6b3b 100644 --- a/contrib/python/importlib-metadata/py3/ya.make +++ b/contrib/python/importlib-metadata/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(8.2.0) +VERSION(8.4.0) LICENSE(Apache-2.0) |