aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/prompt-toolkit/py3
diff options
context:
space:
mode:
authorMaxim Yurchuk <maxim-yurchuk@ydb.tech>2024-10-18 20:31:38 +0300
committerGitHub <noreply@github.com>2024-10-18 20:31:38 +0300
commit2a74bac2d2d3bccb4e10120f1ead805640ec9dd0 (patch)
tree047e4818ced5aaf73f58517629e5260b5291f9f0 /contrib/python/prompt-toolkit/py3
parent2d9656823e9521d8c29ea4c9a1d0eab78391abfc (diff)
parent3d834a1923bbf9403cd4a448e7f32b670aa4124f (diff)
downloadydb-2a74bac2d2d3bccb4e10120f1ead805640ec9dd0.tar.gz
Merge pull request #10502 from ydb-platform/mergelibs-241016-1210
Library import 241016-1210
Diffstat (limited to 'contrib/python/prompt-toolkit/py3')
-rw-r--r--contrib/python/prompt-toolkit/py3/.dist-info/METADATA2
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/__init__.py2
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/fuzzy_completer.py4
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/word_completer.py4
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/regular_languages/compiler.py17
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/cursor_shapes.py17
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/output/defaults.py22
-rw-r--r--contrib/python/prompt-toolkit/py3/prompt_toolkit/patch_stdout.py2
-rw-r--r--contrib/python/prompt-toolkit/py3/ya.make2
9 files changed, 48 insertions, 24 deletions
diff --git a/contrib/python/prompt-toolkit/py3/.dist-info/METADATA b/contrib/python/prompt-toolkit/py3/.dist-info/METADATA
index c4f9a4a3ff..eae81f9c1d 100644
--- a/contrib/python/prompt-toolkit/py3/.dist-info/METADATA
+++ b/contrib/python/prompt-toolkit/py3/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: prompt_toolkit
-Version: 3.0.47
+Version: 3.0.48
Summary: Library for building powerful interactive command lines in Python
Home-page: https://github.com/prompt-toolkit/python-prompt-toolkit
Author: Jonathan Slenders
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/__init__.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/__init__.py
index 7f6f30251c..80da72d1ec 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/__init__.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/__init__.py
@@ -28,7 +28,7 @@ from .formatted_text import ANSI, HTML
from .shortcuts import PromptSession, print_formatted_text, prompt
# Don't forget to update in `docs/conf.py`!
-__version__ = "3.0.47"
+__version__ = "3.0.48"
assert pep440.match(__version__)
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/fuzzy_completer.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/fuzzy_completer.py
index 25ea8923a3..82625ab63f 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/fuzzy_completer.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/fuzzy_completer.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import re
-from typing import Callable, Iterable, NamedTuple
+from typing import Callable, Iterable, NamedTuple, Sequence
from prompt_toolkit.document import Document
from prompt_toolkit.filters import FilterOrBool, to_filter
@@ -187,7 +187,7 @@ class FuzzyWordCompleter(Completer):
def __init__(
self,
- words: list[str] | Callable[[], list[str]],
+ words: Sequence[str] | Callable[[], Sequence[str]],
meta_dict: dict[str, str] | None = None,
WORD: bool = False,
) -> None:
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/word_completer.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/word_completer.py
index 6ef4031fab..2e124056ba 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/word_completer.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/completion/word_completer.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from typing import Callable, Iterable, Mapping, Pattern
+from typing import Callable, Iterable, Mapping, Pattern, Sequence
from prompt_toolkit.completion import CompleteEvent, Completer, Completion
from prompt_toolkit.document import Document
@@ -33,7 +33,7 @@ class WordCompleter(Completer):
def __init__(
self,
- words: list[str] | Callable[[], list[str]],
+ words: Sequence[str] | Callable[[], Sequence[str]],
ignore_case: bool = False,
display_dict: Mapping[str, AnyFormattedText] | None = None,
meta_dict: Mapping[str, AnyFormattedText] | None = None,
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/regular_languages/compiler.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/regular_languages/compiler.py
index dd558a68a2..4009d54f2d 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/regular_languages/compiler.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/contrib/regular_languages/compiler.py
@@ -42,7 +42,7 @@ Partial matches are possible::
from __future__ import annotations
import re
-from typing import Callable, Dict, Iterable, Iterator, Pattern
+from typing import Callable, Dict, Iterable, Iterator, Pattern, TypeVar, overload
from typing import Match as RegexMatch
from .regex_parser import (
@@ -57,9 +57,7 @@ from .regex_parser import (
tokenize_regex,
)
-__all__ = [
- "compile",
-]
+__all__ = ["compile", "Match", "Variables"]
# Name of the named group in the regex, matching trailing input.
@@ -491,6 +489,9 @@ class Match:
yield MatchVariable(varname, value, (reg[0], reg[1]))
+_T = TypeVar("_T")
+
+
class Variables:
def __init__(self, tuples: list[tuple[str, str, tuple[int, int]]]) -> None:
#: List of (varname, value, slice) tuples.
@@ -502,7 +503,13 @@ class Variables:
", ".join(f"{k}={v!r}" for k, v, _ in self._tuples),
)
- def get(self, key: str, default: str | None = None) -> str | None:
+ @overload
+ def get(self, key: str) -> str | None: ...
+
+ @overload
+ def get(self, key: str, default: str | _T) -> str | _T: ...
+
+ def get(self, key: str, default: str | _T | None = None) -> str | _T | None:
items = self.getall(key)
return items[0] if items else default
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/cursor_shapes.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/cursor_shapes.py
index 453b72c3cb..01d10926a2 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/cursor_shapes.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/cursor_shapes.py
@@ -69,10 +69,23 @@ class ModalCursorShapeConfig(CursorShapeConfig):
def get_cursor_shape(self, application: Application[Any]) -> CursorShape:
if application.editing_mode == EditingMode.VI:
- if application.vi_state.input_mode == InputMode.INSERT:
+ if application.vi_state.input_mode in {
+ InputMode.NAVIGATION,
+ }:
+ return CursorShape.BLOCK
+ if application.vi_state.input_mode in {
+ InputMode.INSERT,
+ InputMode.INSERT_MULTIPLE,
+ }:
return CursorShape.BEAM
- if application.vi_state.input_mode == InputMode.REPLACE:
+ if application.vi_state.input_mode in {
+ InputMode.REPLACE,
+ InputMode.REPLACE_SINGLE,
+ }:
return CursorShape.UNDERLINE
+ elif application.editing_mode == EditingMode.EMACS:
+ # like vi's INSERT
+ return CursorShape.BEAM
# Default
return CursorShape.BLOCK
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/output/defaults.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/output/defaults.py
index ed114e32af..6b06ed43c8 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/output/defaults.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/output/defaults.py
@@ -1,7 +1,7 @@
from __future__ import annotations
import sys
-from typing import TextIO, cast
+from typing import TYPE_CHECKING, TextIO, cast
from prompt_toolkit.utils import (
get_bell_environment_variable,
@@ -13,13 +13,17 @@ from .base import DummyOutput, Output
from .color_depth import ColorDepth
from .plain_text import PlainTextOutput
+if TYPE_CHECKING:
+ from prompt_toolkit.patch_stdout import StdoutProxy
+
+
__all__ = [
"create_output",
]
def create_output(
- stdout: TextIO | None = None, always_prefer_tty: bool = False
+ stdout: TextIO | StdoutProxy | None = None, always_prefer_tty: bool = False
) -> Output:
"""
Return an :class:`~prompt_toolkit.output.Output` instance for the command
@@ -54,13 +58,6 @@ def create_output(
stdout = io
break
- # If the output is still `None`, use a DummyOutput.
- # This happens for instance on Windows, when running the application under
- # `pythonw.exe`. In that case, there won't be a terminal Window, and
- # stdin/stdout/stderr are `None`.
- if stdout is None:
- return DummyOutput()
-
# If the patch_stdout context manager has been used, then sys.stdout is
# replaced by this proxy. For prompt_toolkit applications, we want to use
# the real stdout.
@@ -69,6 +66,13 @@ def create_output(
while isinstance(stdout, StdoutProxy):
stdout = stdout.original_stdout
+ # If the output is still `None`, use a DummyOutput.
+ # This happens for instance on Windows, when running the application under
+ # `pythonw.exe`. In that case, there won't be a terminal Window, and
+ # stdin/stdout/stderr are `None`.
+ if stdout is None:
+ return DummyOutput()
+
if sys.platform == "win32":
from .conemu import ConEmuOutput
from .win32 import Win32Output
diff --git a/contrib/python/prompt-toolkit/py3/prompt_toolkit/patch_stdout.py b/contrib/python/prompt-toolkit/py3/prompt_toolkit/patch_stdout.py
index 4958e9d2e4..e1f2a7a2c3 100644
--- a/contrib/python/prompt-toolkit/py3/prompt_toolkit/patch_stdout.py
+++ b/contrib/python/prompt-toolkit/py3/prompt_toolkit/patch_stdout.py
@@ -273,7 +273,7 @@ class StdoutProxy:
self._flush()
@property
- def original_stdout(self) -> TextIO:
+ def original_stdout(self) -> TextIO | None:
return self._output.stdout or sys.__stdout__
# Attributes for compatibility with sys.__stdout__:
diff --git a/contrib/python/prompt-toolkit/py3/ya.make b/contrib/python/prompt-toolkit/py3/ya.make
index cdfd5cd4ca..b1cb3e19b0 100644
--- a/contrib/python/prompt-toolkit/py3/ya.make
+++ b/contrib/python/prompt-toolkit/py3/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(3.0.47)
+VERSION(3.0.48)
LICENSE(BSD-3-Clause)