summaryrefslogtreecommitdiffstats
path: root/contrib/python/argcomplete
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/python/argcomplete')
-rw-r--r--contrib/python/argcomplete/py3/.dist-info/METADATA4
-rw-r--r--contrib/python/argcomplete/py3/.dist-info/entry_points.txt1
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/bash_completion.d/_python-argcomplete5
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/completers.py11
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/finders.py2
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py24
-rw-r--r--contrib/python/argcomplete/py3/argcomplete/scripts/python_argcomplete_check_easy_install_script.py84
-rw-r--r--contrib/python/argcomplete/py3/ya.make3
8 files changed, 28 insertions, 106 deletions
diff --git a/contrib/python/argcomplete/py3/.dist-info/METADATA b/contrib/python/argcomplete/py3/.dist-info/METADATA
index 33d51a548ba..fa5e1d45d3a 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.6.3
+Version: 3.7.0
Summary: Bash tab completion for argparse
Project-URL: Homepage, https://github.com/kislyuk/argcomplete
Project-URL: Documentation, https://kislyuk.github.io/argcomplete
@@ -22,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.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 :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development
diff --git a/contrib/python/argcomplete/py3/.dist-info/entry_points.txt b/contrib/python/argcomplete/py3/.dist-info/entry_points.txt
index f13e435fafb..874a9e1481d 100644
--- a/contrib/python/argcomplete/py3/.dist-info/entry_points.txt
+++ b/contrib/python/argcomplete/py3/.dist-info/entry_points.txt
@@ -1,4 +1,3 @@
[console_scripts]
activate-global-python-argcomplete = argcomplete.scripts.activate_global_python_argcomplete:main
-python-argcomplete-check-easy-install-script = argcomplete.scripts.python_argcomplete_check_easy_install_script:main
register-python-argcomplete = argcomplete.scripts.register_python_argcomplete:main
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 1155f1ce5e8..6d395c66ed9 100644
--- a/contrib/python/argcomplete/py3/argcomplete/bash_completion.d/_python-argcomplete
+++ b/contrib/python/argcomplete/py3/argcomplete/bash_completion.d/_python-argcomplete
@@ -190,10 +190,7 @@ _python_argcomplete_global() {
interpreter=($interpreter)
fi
- if (__python_argcomplete_scan_head_noerr "$SCRIPT_NAME" easy_install \
- && "${interpreter[@]}" "$(__python_argcomplete_which python-argcomplete-check-easy-install-script)" "$SCRIPT_NAME") >/dev/null 2>&1; then
- ARGCOMPLETE=1
- elif ([[ "${interpreter[@]}" == *python* ]] || [[ "${interpreter[@]}" == *pypy* ]])\
+ if ([[ "${interpreter[@]}" == *python* ]] || [[ "${interpreter[@]}" == *pypy* ]])\
&& __python_argcomplete_run "${interpreter[@]}" -m argcomplete._check_console_script "$SCRIPT_NAME"; then
ARGCOMPLETE=1
fi
diff --git a/contrib/python/argcomplete/py3/argcomplete/completers.py b/contrib/python/argcomplete/py3/argcomplete/completers.py
index 4c01e695189..48715811898 100644
--- a/contrib/python/argcomplete/py3/argcomplete/completers.py
+++ b/contrib/python/argcomplete/py3/argcomplete/completers.py
@@ -4,6 +4,7 @@
import argparse
import os
import subprocess
+from shlex import quote
def _call(*args, **kwargs):
@@ -64,20 +65,22 @@ class FilesCompleter(BaseCompleter):
# 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
+ ["bash", "-c", "bind; compgen -A directory -- {p}".format(p=quote(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)],
+ ["bash", "-c", "bind; compgen -A file -X '!*.{0}' -- {p}".format(x, p=quote(prefix))],
stderr=subprocess.DEVNULL,
)
else:
completion += _call(
- ["bash", "-c", "bind; compgen -A file -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL
+ ["bash", "-c", "bind; compgen -A file -- {p}".format(p=quote(prefix))], stderr=subprocess.DEVNULL
)
anticomp = _call(
- ["bash", "-c", "bind; compgen -A directory -- '{p}'".format(p=prefix)], stderr=subprocess.DEVNULL
+ ["bash", "-c", "bind; compgen -A directory -- {p}".format(p=quote(prefix))],
+ stderr=subprocess.DEVNULL,
)
completion = list(set(completion) - set(anticomp))
diff --git a/contrib/python/argcomplete/py3/argcomplete/finders.py b/contrib/python/argcomplete/py3/argcomplete/finders.py
index ab8bb1d90a2..2159b7dea2f 100644
--- a/contrib/python/argcomplete/py3/argcomplete/finders.py
+++ b/contrib/python/argcomplete/py3/argcomplete/finders.py
@@ -527,7 +527,7 @@ class CompletionFinder(object):
# (extended to characters other than the colon).
if last_wordbreak_pos is not None:
completions = [c[last_wordbreak_pos + 1 :] for c in completions]
- special_chars += "();<>|&!`$* \t\n\"'"
+ special_chars += "();<>|&!`$*?[]{} \t\n\"'"
elif cword_prequote == '"':
special_chars += '"`$!'
diff --git a/contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py b/contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py
index f6ecb1f4172..574d9d8207a 100644
--- a/contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py
+++ b/contrib/python/argcomplete/py3/argcomplete/packages/_argparse.py
@@ -19,7 +19,13 @@ from argparse import (
_SubParsersAction,
)
from gettext import gettext
-from typing import Dict, List, Set, Tuple
+from typing import Dict, List, Optional, Set, Tuple, Union, cast
+
+_OptionTuple = Union[
+ Tuple[Optional[Action], str, Optional[str]],
+ Tuple[Optional[Action], str, Optional[str], Optional[str]],
+]
+_OptionTupleEntry = Union[_OptionTuple, List[_OptionTuple]]
_num_consumed_args: Dict[Action, int] = {}
@@ -97,7 +103,7 @@ class IntrospectiveArgumentParser(ArgumentParser):
# find all option indices, and determine the arg_string_pattern
# which has an 'O' if there is an option at an index,
# an 'A' if there is an argument, or a '-' if there is a '--'
- option_string_indices = {}
+ option_string_indices: Dict[int, _OptionTupleEntry] = {}
arg_string_pattern_parts = []
arg_strings_iter = iter(arg_strings)
for i, arg_string in enumerate(arg_strings_iter):
@@ -114,7 +120,7 @@ class IntrospectiveArgumentParser(ArgumentParser):
if option_tuple is None:
pattern = 'A'
else:
- option_string_indices[i] = option_tuple
+ option_string_indices[i] = cast(_OptionTupleEntry, option_tuple)
pattern = 'O'
arg_string_pattern_parts.append(pattern)
@@ -161,9 +167,11 @@ class IntrospectiveArgumentParser(ArgumentParser):
# function to convert arg_strings into an optional action
def consume_optional(start_index):
# get the optional identified at this index
- option_tuple = option_string_indices[start_index]
- if isinstance(option_tuple, list): # Python 3.12.7+
- option_tuple = option_tuple[0]
+ raw_option_tuple = option_string_indices[start_index]
+ if isinstance(raw_option_tuple, list): # Python 3.12.7+
+ option_tuple = raw_option_tuple[0]
+ else:
+ option_tuple = raw_option_tuple
if len(option_tuple) == 3:
action, option_string, explicit_arg = option_tuple
else: # Python 3.11.9+, 3.12.3+, 3.13+
@@ -241,8 +249,8 @@ class IntrospectiveArgumentParser(ArgumentParser):
# add the Optional to the list and return the index at which
# the Optional's string args stopped
assert action_tuples
- for action, args, option_string in action_tuples:
- take_action(action, args, option_string)
+ for optional_action, args, option_string in action_tuples:
+ take_action(optional_action, args, option_string)
return stop
# the list of Positionals left to be parsed; this is modified
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
deleted file mode 100644
index 0eb744c9e96..00000000000
--- a/contrib/python/argcomplete/py3/argcomplete/scripts/python_argcomplete_check_easy_install_script.py
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2012-2023, Andrey Kislyuk and argcomplete contributors.
-# Licensed under the Apache License. See https://github.com/kislyuk/argcomplete for more info.
-
-"""
-This script is part of the Python argcomplete package (https://github.com/kislyuk/argcomplete).
-It is used to check if an EASY-INSTALL-SCRIPT wrapper redirects to a script that contains the string
-"PYTHON_ARGCOMPLETE_OK". If you have enabled global completion in argcomplete, the completion hook will run it every
-time you press <TAB> in your shell.
-
-Usage:
- python-argcomplete-check-easy-install-script <input executable file>
-"""
-
-import sys
-
-# PEP 366
-__package__ = "argcomplete.scripts"
-
-
-def main():
- if len(sys.argv) != 2:
- sys.exit(__doc__)
-
- sys.tracebacklimit = 0
-
- with open(sys.argv[1]) as fh:
- line1, head = fh.read(1024).split("\n", 1)[:2]
- if line1.startswith("#") and ("py" in line1 or "Py" in line1):
- import re
-
- lines = head.split("\n", 12)
- for line in lines:
- if line.startswith("# EASY-INSTALL-SCRIPT"):
- import pkg_resources # type: ignore
-
- re_match = re.match("# EASY-INSTALL-SCRIPT: '(.+)','(.+)'", line)
- assert re_match is not None
- dist, script = re_match.groups()
- if "PYTHON_ARGCOMPLETE_OK" in pkg_resources.get_distribution(dist).get_metadata(
- "scripts/" + script
- ):
- return 0
- elif line.startswith("# EASY-INSTALL-ENTRY-SCRIPT"):
- re_match = re.match("# EASY-INSTALL-ENTRY-SCRIPT: '(.+)','(.+)','(.+)'", line)
- assert re_match is not None
- dist, group, name = re_match.groups()
- import pkgutil
-
- 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
- module_name = entry_point_info.module_name
- with open(pkgutil.get_loader(module_name).get_filename()) as mod_fh: # type: ignore
- if "PYTHON_ARGCOMPLETE_OK" in mod_fh.read(1024):
- return 0
- elif line.startswith("# EASY-INSTALL-DEV-SCRIPT"):
- for line2 in lines:
- if line2.startswith("__file__"):
- re_match = re.match("__file__ = '(.+)'", line2)
- assert re_match is not None
- filename = re_match.group(1)
- with open(filename) as mod_fh:
- if "PYTHON_ARGCOMPLETE_OK" in mod_fh.read(1024):
- return 0
- elif line.startswith("# PBR Generated"):
- re_match = re.search("from (.*) import", head)
- assert re_match is not None
- module = re_match.groups()[0]
- import pkgutil
-
- 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):
- return 0
-
- return 1
-
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/contrib/python/argcomplete/py3/ya.make b/contrib/python/argcomplete/py3/ya.make
index 1ffd0082bb2..397e1ff3f2e 100644
--- a/contrib/python/argcomplete/py3/ya.make
+++ b/contrib/python/argcomplete/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(3.6.3)
+VERSION(3.7.0)
LICENSE(Apache-2.0)
@@ -23,7 +23,6 @@ PY_SRCS(
argcomplete/packages/_shlex.py
argcomplete/scripts/__init__.py
argcomplete/scripts/activate_global_python_argcomplete.py
- argcomplete/scripts/python_argcomplete_check_easy_install_script.py
argcomplete/scripts/register_python_argcomplete.py
argcomplete/shell_integration.py
)