diff options
author | Alexander Smirnov <alex@ydb.tech> | 2025-03-22 00:51:33 +0000 |
---|---|---|
committer | Alexander Smirnov <alex@ydb.tech> | 2025-03-22 00:51:33 +0000 |
commit | 25754ddf6bf0d9f39deb2b793a946176b6d7c9fb (patch) | |
tree | b81cf85ea8fbef3290618d909971b9ad02dd9e46 /contrib/python | |
parent | c18aa245b684fef9b14c697b38e6c6695e0733f3 (diff) | |
parent | 87f8036d8027790ed03ac34feb2b5f3e141f948c (diff) | |
download | ydb-25754ddf6bf0d9f39deb2b793a946176b6d7c9fb.tar.gz |
Merge branch 'rightlib' into merge-libs-250322-0050
Diffstat (limited to 'contrib/python')
10 files changed, 45 insertions, 40 deletions
diff --git a/contrib/python/argcomplete/py3/.dist-info/METADATA b/contrib/python/argcomplete/py3/.dist-info/METADATA index fe74af8ae5..bf74fb4961 100644 --- a/contrib/python/argcomplete/py3/.dist-info/METADATA +++ b/contrib/python/argcomplete/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.4 Name: argcomplete -Version: 3.5.3 +Version: 3.6.0 Summary: Bash tab completion for argparse Project-URL: Homepage, https://github.com/kislyuk/argcomplete Project-URL: Documentation, https://kislyuk.github.io/argcomplete @@ -9,6 +9,8 @@ Project-URL: Issue Tracker, https://github.com/kislyuk/argcomplete/issues Project-URL: Change Log, https://github.com/kislyuk/argcomplete/blob/develop/Changes.rst Author: Andrey Kislyuk Author-email: kislyuk@gmail.com +Maintainer: Andrey Kislyuk +Maintainer-email: kislyuk@gmail.com License: Apache Software License License-File: LICENSE.rst License-File: NOTICE @@ -20,12 +22,12 @@ Classifier: Operating System :: MacOS :: MacOS X Classifier: Operating System :: POSIX Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: Implementation :: PyPy Classifier: Topic :: Software Development @@ -296,7 +298,7 @@ work for zsh as well. Python Support -------------- -Argcomplete requires Python 3.7+. +Argcomplete requires Python 3.9+. Support for other shells ------------------------ diff --git a/contrib/python/argcomplete/py3/README.rst b/contrib/python/argcomplete/py3/README.rst index 13f0fa7ae3..c897ad4191 100644 --- a/contrib/python/argcomplete/py3/README.rst +++ b/contrib/python/argcomplete/py3/README.rst @@ -253,7 +253,7 @@ work for zsh as well. Python Support -------------- -Argcomplete requires Python 3.7+. +Argcomplete requires Python 3.9+. Support for other shells ------------------------ diff --git a/contrib/python/argcomplete/py3/argcomplete/_check_module.py b/contrib/python/argcomplete/py3/argcomplete/_check_module.py index 7fd6a5caa4..03726529fc 100644 --- a/contrib/python/argcomplete/py3/argcomplete/_check_module.py +++ b/contrib/python/argcomplete/py3/argcomplete/_check_module.py @@ -10,30 +10,7 @@ Intended to be invoked by argcomplete's global completion function. import os import sys import tokenize - -try: - from importlib.util import find_spec # type:ignore -except ImportError: - import typing as t - from collections import namedtuple - from imp import find_module # type:ignore - - ModuleSpec = namedtuple("ModuleSpec", ["origin", "has_location", "submodule_search_locations"]) - - def find_spec( # type:ignore - name: str, - package: t.Optional[str] = None, - ) -> t.Optional[ModuleSpec]: - """Minimal implementation as required by `find`.""" - try: - f, path, _ = find_module(name) - except ImportError: - return None - has_location = path is not None - if f is None: - return ModuleSpec(None, has_location, [path]) - f.close() - return ModuleSpec(path, has_location, None) +from importlib.util import find_spec class ArgcompleteMarkerNotFound(RuntimeError): @@ -42,7 +19,12 @@ class ArgcompleteMarkerNotFound(RuntimeError): def find(name, return_package=False): names = name.split(".") - spec = find_spec(names[0]) + # Look for the first importlib ModuleSpec that has `origin` set, indicating it's not a namespace package. + for package_name_boundary in range(len(names)): + spec = find_spec(".".join(names[: package_name_boundary + 1])) + if spec is not None and spec.origin is not None: + break + if spec is None: raise ArgcompleteMarkerNotFound('no module named "{}"'.format(names[0])) if not spec.has_location: @@ -53,7 +35,7 @@ def find(name, return_package=False): return spec.origin if len(spec.submodule_search_locations) != 1: raise ArgcompleteMarkerNotFound("expecting one search location") - path = os.path.join(spec.submodule_search_locations[0], *names[1:]) + path = os.path.join(spec.submodule_search_locations[0], *names[package_name_boundary + 1 :]) if os.path.isdir(path): filename = "__main__.py" if return_package: diff --git a/contrib/python/argcomplete/py3/argcomplete/bash_completion.d/_python-argcomplete b/contrib/python/argcomplete/py3/argcomplete/bash_completion.d/_python-argcomplete index 81c9d41f80..8a91272dea 100644 --- a/contrib/python/argcomplete/py3/argcomplete/bash_completion.d/_python-argcomplete +++ b/contrib/python/argcomplete/py3/argcomplete/bash_completion.d/_python-argcomplete @@ -124,6 +124,12 @@ __python_argcomplete_which() { _python_argcomplete_global() { if [[ -n "${ZSH_VERSION-}" ]]; then + if [[ "${_matcher_num-}" -gt 1 ]]; then + # Return early if the completer is called multiple times in the same completion run. + # Currently the only known occurrence of this is in zsh when a matcher-list zstyle is declared. + # When this happens, _matcher_num is incremented past 1. + return + fi # Store result of a regex match in the # BASH_REMATCH variable rather than MATCH setopt local_options BASH_REMATCH diff --git a/contrib/python/argcomplete/py3/argcomplete/completers.py b/contrib/python/argcomplete/py3/argcomplete/completers.py index 610349f652..4c01e69518 100644 --- a/contrib/python/argcomplete/py3/argcomplete/completers.py +++ b/contrib/python/argcomplete/py3/argcomplete/completers.py @@ -63,13 +63,22 @@ class FilesCompleter(BaseCompleter): # that was fixed in bash 5.3 but affects older versions. Environment variables are not treated # correctly in older versions and calling bind makes them available. For details, see # https://savannah.gnu.org/support/index.php?111125 - files = _call(["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL) + files = _call( + ["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL + ) completion += [f + "/" for f in files] for x in self.allowednames: - completion += _call(["bash", "-c", "bind; compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix)], stderr=subprocess.DEVNULL) + completion += _call( + ["bash", "-c", "bind; compgen -A file -X '!*.{0}' -- '{p}'".format(x, p=prefix)], + stderr=subprocess.DEVNULL, + ) else: - completion += _call(["bash", "-c", "bind; compgen -A file -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL) - anticomp = _call(["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL) + completion += _call( + ["bash", "-c", "bind; compgen -A file -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL + ) + anticomp = _call( + ["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL + ) completion = list(set(completion) - set(anticomp)) if self.directories: diff --git a/contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py b/contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py index 0666845e3a..f6ecb1f417 100644 --- a/contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py +++ b/contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py @@ -75,7 +75,7 @@ class IntrospectiveArgumentParser(ArgumentParser): except for the lines that contain the string "Added by argcomplete". ''' - def _parse_known_args(self, arg_strings, namespace, intermixed=False): + def _parse_known_args(self, arg_strings, namespace, intermixed=False, **kwargs): _num_consumed_args.clear() # Added by argcomplete self._argcomplete_namespace = namespace self.active_actions: List[Action] = [] # Added by argcomplete diff --git a/contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py b/contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py index 613feb2597..ecd785b80b 100644 --- a/contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py +++ b/contrib/python/argcomplete/py3/argcomplete/packages/_shlex.py @@ -36,7 +36,7 @@ class shlex: else: self.eof = '' self.commenters = '#' - self.wordchars = 'abcdfeghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' + self.wordchars = 'abcdfeghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_' # Modified by argcomplete: 2/3 compatibility # if self.posix: # self.wordchars += ('ßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ' diff --git a/contrib/python/argcomplete/py3/argcomplete/scripts/python_argcomplete_check_easy_install_script.py b/contrib/python/argcomplete/py3/argcomplete/scripts/python_argcomplete_check_easy_install_script.py index d914c222fe..0eb744c9e9 100644 --- a/contrib/python/argcomplete/py3/argcomplete/scripts/python_argcomplete_check_easy_install_script.py +++ b/contrib/python/argcomplete/py3/argcomplete/scripts/python_argcomplete_check_easy_install_script.py @@ -33,7 +33,7 @@ def main(): lines = head.split("\n", 12) for line in lines: if line.startswith("# EASY-INSTALL-SCRIPT"): - import pkg_resources + import pkg_resources # type: ignore re_match = re.match("# EASY-INSTALL-SCRIPT: '(.+)','(.+)'", line) assert re_match is not None @@ -48,7 +48,7 @@ def main(): dist, group, name = re_match.groups() import pkgutil - import pkg_resources + import pkg_resources # type: ignore entry_point_info = pkg_resources.get_distribution(dist).get_entry_info(group, name) assert entry_point_info is not None @@ -71,7 +71,7 @@ def main(): module = re_match.groups()[0] import pkgutil - import pkg_resources + import pkg_resources # type: ignore with open(pkgutil.get_loader(module).get_filename()) as mod_fh: # type: ignore if "PYTHON_ARGCOMPLETE_OK" in mod_fh.read(1024): diff --git a/contrib/python/argcomplete/py3/argcomplete/shell_integration.py b/contrib/python/argcomplete/py3/argcomplete/shell_integration.py index f0b9d7db5b..37b5603b11 100644 --- a/contrib/python/argcomplete/py3/argcomplete/shell_integration.py +++ b/contrib/python/argcomplete/py3/argcomplete/shell_integration.py @@ -34,6 +34,12 @@ _python_argcomplete%(function_suffix)s() { local IFS=$'\013' local script="%(argcomplete_script)s" if [[ -n "${ZSH_VERSION-}" ]]; then + if [[ "${_matcher_num-}" -gt 1 ]]; then + # Return early if the completer is called multiple times in the same completion run. + # Currently the only known occurrence of this is in zsh when a matcher-list zstyle is declared. + # When this happens, _matcher_num is incremented past 1. + return + fi local completions completions=($(IFS="$IFS" \ COMP_LINE="$BUFFER" \ diff --git a/contrib/python/argcomplete/py3/ya.make b/contrib/python/argcomplete/py3/ya.make index dfa97494a9..74c5629658 100644 --- a/contrib/python/argcomplete/py3/ya.make +++ b/contrib/python/argcomplete/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(3.5.3) +VERSION(3.6.0) LICENSE(Apache-2.0) |