Skip to content

Commit df4e244

Browse files
authored
Update type definition for words argument in completers (#1889)
Accept `Sequence` instead of `list`.
1 parent 728983b commit df4e244

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: src/prompt_toolkit/completion/fuzzy_completer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import annotations
22

33
import re
4-
from typing import Callable, Iterable, NamedTuple
4+
from typing import Callable, Iterable, NamedTuple, Sequence
55

66
from prompt_toolkit.document import Document
77
from prompt_toolkit.filters import FilterOrBool, to_filter
@@ -187,7 +187,7 @@ class FuzzyWordCompleter(Completer):
187187

188188
def __init__(
189189
self,
190-
words: list[str] | Callable[[], list[str]],
190+
words: Sequence[str] | Callable[[], Sequence[str]],
191191
meta_dict: dict[str, str] | None = None,
192192
WORD: bool = False,
193193
) -> None:

Diff for: src/prompt_toolkit/completion/word_completer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import Callable, Iterable, Mapping, Pattern
3+
from typing import Callable, Iterable, Mapping, Pattern, Sequence
44

55
from prompt_toolkit.completion import CompleteEvent, Completer, Completion
66
from prompt_toolkit.document import Document
@@ -33,7 +33,7 @@ class WordCompleter(Completer):
3333

3434
def __init__(
3535
self,
36-
words: list[str] | Callable[[], list[str]],
36+
words: Sequence[str] | Callable[[], Sequence[str]],
3737
ignore_case: bool = False,
3838
display_dict: Mapping[str, AnyFormattedText] | None = None,
3939
meta_dict: Mapping[str, AnyFormattedText] | None = None,

0 commit comments

Comments
 (0)