From 29e83f08192e89dae13c250f1aab48de7afca656 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 15 Oct 2021 11:36:49 +0200 Subject: [PATCH] Auto-format code with black (#9474) * Auto-format code with black * Update spacy/pipeline/pipe.pyi Co-authored-by: explosion-bot Co-authored-by: Sofie Van Landeghem --- spacy/compat.py | 2 +- spacy/lang/ru/lemmatizer.py | 8 ++++++-- spacy/pipeline/pipe.pyi | 14 ++++++++++---- spacy/tests/pipeline/test_pipe_factories.py | 6 +++++- spacy/vocab.pyi | 1 - 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/spacy/compat.py b/spacy/compat.py index f4403f036..a0066741a 100644 --- a/spacy/compat.py +++ b/spacy/compat.py @@ -25,7 +25,7 @@ except ImportError: if sys.version_info[:2] >= (3, 8): # Python 3.8+ from typing import Literal else: - from typing_extensions import Literal # noqa: F401 + from typing_extensions import Literal # noqa: F401 # Important note: The importlib_metadata "backport" includes functionality # that's not part of the built-in importlib.metadata. We should treat this diff --git a/spacy/lang/ru/lemmatizer.py b/spacy/lang/ru/lemmatizer.py index 92bec4c8c..ce5ccf36f 100644 --- a/spacy/lang/ru/lemmatizer.py +++ b/spacy/lang/ru/lemmatizer.py @@ -56,7 +56,9 @@ class RussianLemmatizer(Lemmatizer): if not len(filtered_analyses): return [string.lower()] if morphology is None or (len(morphology) == 1 and POS in morphology): - return list(dict.fromkeys([analysis.normal_form for analysis in filtered_analyses])) + return list( + dict.fromkeys([analysis.normal_form for analysis in filtered_analyses]) + ) if univ_pos in ("ADJ", "DET", "NOUN", "PROPN"): features_to_compare = ["Case", "Number", "Gender"] elif univ_pos == "NUM": @@ -87,7 +89,9 @@ class RussianLemmatizer(Lemmatizer): filtered_analyses.append(analysis) if not len(filtered_analyses): return [string.lower()] - return list(dict.fromkeys([analysis.normal_form for analysis in filtered_analyses])) + return list( + dict.fromkeys([analysis.normal_form for analysis in filtered_analyses]) + ) def pymorphy2_lookup_lemmatize(self, token: Token) -> List[str]: string = token.text diff --git a/spacy/pipeline/pipe.pyi b/spacy/pipeline/pipe.pyi index a8d4e40ce..c7c0568f9 100644 --- a/spacy/pipeline/pipe.pyi +++ b/spacy/pipeline/pipe.pyi @@ -1,5 +1,6 @@ from pathlib import Path -from typing import Any, Callable, Dict, Iterable, Iterator, List, NoReturn, Optional, Tuple, Union +from typing import Any, Callable, Dict, Iterable, Iterator, List +from typing import NoReturn, Optional, Tuple, Union from ..tokens.doc import Doc @@ -8,9 +9,14 @@ from ..language import Language class Pipe: def __call__(self, doc: Doc) -> Doc: ... - def pipe(self, stream: Iterable[Doc], *, batch_size: int = ...) -> Iterator[Doc]: ... + def pipe( + self, stream: Iterable[Doc], *, batch_size: int = ... + ) -> Iterator[Doc]: ... def initialize( - self, get_examples: Callable[[], Iterable[Example]], *, nlp: Language = ..., + self, + get_examples: Callable[[], Iterable[Example]], + *, + nlp: Language = ..., ) -> None: ... def score( self, examples: Iterable[Example], **kwargs: Any @@ -26,7 +32,7 @@ class Pipe: self, error_handler: Callable[[str, "Pipe", List[Doc], Exception], NoReturn] ) -> None: ... def get_error_handler( - self + self, ) -> Callable[[str, "Pipe", List[Doc], Exception], NoReturn]: ... def deserialize_config(path: Path) -> Any: ... diff --git a/spacy/tests/pipeline/test_pipe_factories.py b/spacy/tests/pipeline/test_pipe_factories.py index 631b7c162..0c2554727 100644 --- a/spacy/tests/pipeline/test_pipe_factories.py +++ b/spacy/tests/pipeline/test_pipe_factories.py @@ -196,7 +196,11 @@ def test_pipe_class_component_model_custom(): @Language.factory(name, default_config=default_config) class Component: def __init__( - self, nlp: Language, model: Model, name: str, value1: StrictInt = StrictInt(10) + self, + nlp: Language, + model: Model, + name: str, + value1: StrictInt = StrictInt(10), ): self.nlp = nlp self.model = model diff --git a/spacy/vocab.pyi b/spacy/vocab.pyi index 304ac62df..603ef1ae7 100644 --- a/spacy/vocab.pyi +++ b/spacy/vocab.pyi @@ -22,7 +22,6 @@ class Vocab: strings: StringStore vectors: Vectors writing_system: Dict[str, Any] - def __init__( self, lex_attr_getters: Optional[Dict[str, Callable[[str], Any]]] = ...,