Auto-format code with black (#9474)

* Auto-format code with black

* Update spacy/pipeline/pipe.pyi

Co-authored-by: explosion-bot <explosion-bot@users.noreply.github.com>
Co-authored-by: Sofie Van Landeghem <svlandeg@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2021-10-15 11:36:49 +02:00 committed by GitHub
parent b5143b1b84
commit 29e83f0819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 9 deletions

View File

@ -56,7 +56,9 @@ class RussianLemmatizer(Lemmatizer):
if not len(filtered_analyses): if not len(filtered_analyses):
return [string.lower()] return [string.lower()]
if morphology is None or (len(morphology) == 1 and POS in morphology): 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"): if univ_pos in ("ADJ", "DET", "NOUN", "PROPN"):
features_to_compare = ["Case", "Number", "Gender"] features_to_compare = ["Case", "Number", "Gender"]
elif univ_pos == "NUM": elif univ_pos == "NUM":
@ -87,7 +89,9 @@ class RussianLemmatizer(Lemmatizer):
filtered_analyses.append(analysis) filtered_analyses.append(analysis)
if not len(filtered_analyses): if not len(filtered_analyses):
return [string.lower()] 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]: def pymorphy2_lookup_lemmatize(self, token: Token) -> List[str]:
string = token.text string = token.text

View File

@ -1,5 +1,6 @@
from pathlib import Path 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 from ..tokens.doc import Doc
@ -8,9 +9,14 @@ from ..language import Language
class Pipe: class Pipe:
def __call__(self, doc: Doc) -> Doc: ... 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( def initialize(
self, get_examples: Callable[[], Iterable[Example]], *, nlp: Language = ..., self,
get_examples: Callable[[], Iterable[Example]],
*,
nlp: Language = ...,
) -> None: ... ) -> None: ...
def score( def score(
self, examples: Iterable[Example], **kwargs: Any self, examples: Iterable[Example], **kwargs: Any
@ -26,7 +32,7 @@ class Pipe:
self, error_handler: Callable[[str, "Pipe", List[Doc], Exception], NoReturn] self, error_handler: Callable[[str, "Pipe", List[Doc], Exception], NoReturn]
) -> None: ... ) -> None: ...
def get_error_handler( def get_error_handler(
self self,
) -> Callable[[str, "Pipe", List[Doc], Exception], NoReturn]: ... ) -> Callable[[str, "Pipe", List[Doc], Exception], NoReturn]: ...
def deserialize_config(path: Path) -> Any: ... def deserialize_config(path: Path) -> Any: ...

View File

@ -196,7 +196,11 @@ def test_pipe_class_component_model_custom():
@Language.factory(name, default_config=default_config) @Language.factory(name, default_config=default_config)
class Component: class Component:
def __init__( 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.nlp = nlp
self.model = model self.model = model

View File

@ -22,7 +22,6 @@ class Vocab:
strings: StringStore strings: StringStore
vectors: Vectors vectors: Vectors
writing_system: Dict[str, Any] writing_system: Dict[str, Any]
def __init__( def __init__(
self, self,
lex_attr_getters: Optional[Dict[str, Callable[[str], Any]]] = ..., lex_attr_getters: Optional[Dict[str, Callable[[str], Any]]] = ...,