Skip to content

Commit

Permalink
Update type definition for words argument in completers (#1889)
Browse files Browse the repository at this point in the history
Accept `Sequence` instead of `list`.
  • Loading branch information
mxr authored Sep 25, 2024
1 parent 728983b commit df4e244
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/prompt_toolkit/completion/fuzzy_completer.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions src/prompt_toolkit/completion/word_completer.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit df4e244

Please sign in to comment.