diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-23 16:16:51 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-23 16:26:57 +0300 |
commit | 37301b6734a60d826aedac5b317544c9fa12c4aa (patch) | |
tree | aca8e8c26cf87da2c2c148dcf96bba349c5021a5 /contrib/python/argcomplete | |
parent | 15f9f66ba02967d573fff43c7b7622c5f5f4bc3e (diff) | |
download | ydb-37301b6734a60d826aedac5b317544c9fa12c4aa.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/argcomplete')
6 files changed, 28 insertions, 9 deletions
diff --git a/contrib/python/argcomplete/py3/.dist-info/METADATA b/contrib/python/argcomplete/py3/.dist-info/METADATA index 4fe1c2bb9e..acf27c40a4 100644 --- a/contrib/python/argcomplete/py3/.dist-info/METADATA +++ b/contrib/python/argcomplete/py3/.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: argcomplete -Version: 3.2.2 +Version: 3.2.3 Summary: Bash tab completion for argparse Home-page: https://github.com/kislyuk/argcomplete Author: Andrey Kislyuk diff --git a/contrib/python/argcomplete/py3/argcomplete/_check_console_script.py b/contrib/python/argcomplete/py3/argcomplete/_check_console_script.py index 63eac73f6f..ab31a5b1be 100644 --- a/contrib/python/argcomplete/py3/argcomplete/_check_console_script.py +++ b/contrib/python/argcomplete/py3/argcomplete/_check_console_script.py @@ -11,6 +11,7 @@ https://setuptools.readthedocs.io/en/latest/setuptools.html#automatic-script-cre Intended to be invoked by argcomplete's global completion function. """ + import os import sys from importlib.metadata import EntryPoint diff --git a/contrib/python/argcomplete/py3/argcomplete/_check_module.py b/contrib/python/argcomplete/py3/argcomplete/_check_module.py index 0d9fb8f444..7fd6a5caa4 100644 --- a/contrib/python/argcomplete/py3/argcomplete/_check_module.py +++ b/contrib/python/argcomplete/py3/argcomplete/_check_module.py @@ -6,6 +6,7 @@ The module name should be specified in a form usable with `python -m`. Intended to be invoked by argcomplete's global completion function. """ + import os import sys import tokenize diff --git a/contrib/python/argcomplete/py3/argcomplete/finders.py b/contrib/python/argcomplete/py3/argcomplete/finders.py index 95af973b1a..fb0f31cefd 100644 --- a/contrib/python/argcomplete/py3/argcomplete/finders.py +++ b/contrib/python/argcomplete/py3/argcomplete/finders.py @@ -117,11 +117,7 @@ class CompletionFinder(object): # not an argument completion invocation return - try: - _io.debug_stream = os.fdopen(9, "w") - except Exception: - _io.debug_stream = sys.stderr - debug() + self._init_debug_stream() if output_stream is None: filename = os.environ.get("_ARGCOMPLETE_STDOUT_FILENAME") @@ -190,6 +186,19 @@ class CompletionFinder(object): _io.debug_stream.flush() exit_method(0) + def _init_debug_stream(self): + """Initialize debug output stream + + By default, writes to file descriptor 9, or stderr if that fails. + This can be overridden by derived classes, for example to avoid + clashes with file descriptors being used elsewhere (such as in pytest). + """ + try: + _io.debug_stream = os.fdopen(9, "w") + except Exception: + _io.debug_stream = sys.stderr + debug() + def _get_completions(self, comp_words, cword_prefix, cword_prequote, last_wordbreak_pos): active_parsers = self._patch_argument_parser() diff --git a/contrib/python/argcomplete/py3/argcomplete/shell_integration.py b/contrib/python/argcomplete/py3/argcomplete/shell_integration.py index 73214bb651..e84f507de4 100644 --- a/contrib/python/argcomplete/py3/argcomplete/shell_integration.py +++ b/contrib/python/argcomplete/py3/argcomplete/shell_integration.py @@ -5,7 +5,7 @@ from shlex import quote -bashcode = r""" +bashcode = r"""#compdef %(executables)s # Run something, muting output or redirecting it to the debug stream # depending on the value of _ARC_DEBUG. # If ARGCOMPLETE_USE_TEMPFILES is set, use tempfiles for IPC. @@ -75,8 +75,16 @@ _python_argcomplete%(function_suffix)s() { if [[ -z "${ZSH_VERSION-}" ]]; then complete %(complete_opts)s -F _python_argcomplete%(function_suffix)s %(executables)s else + # When called by the Zsh completion system, this will end with + # "loadautofunc" when initially autoloaded and "shfunc" later on, otherwise, + # the script was "eval"-ed so use "compdef" to register it with the + # completion system autoload is-at-least - compdef _python_argcomplete%(function_suffix)s %(executables)s + if [[ $zsh_eval_context == *func ]]; then + _python_argcomplete%(function_suffix)s "$@" + else + compdef _python_argcomplete%(function_suffix)s %(executables)s + fi fi """ diff --git a/contrib/python/argcomplete/py3/ya.make b/contrib/python/argcomplete/py3/ya.make index 4f82b20e4e..02e0bd87f8 100644 --- a/contrib/python/argcomplete/py3/ya.make +++ b/contrib/python/argcomplete/py3/ya.make @@ -2,7 +2,7 @@ PY3_LIBRARY() -VERSION(3.2.2) +VERSION(3.2.3) LICENSE(Apache-2.0) |