From 87882c1e033493b04718e56333399efd82d40d39 Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Thu, 6 Jul 2023 14:53:12 +0200 Subject: [PATCH] use Optional typing in docstrings Co-authored-by: Raphael Mitsch --- spacy/language.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spacy/language.py b/spacy/language.py index 562ff8687..51a4a7f93 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -777,8 +777,8 @@ class Language: component directly before. after (Union[str, int]): Name or index of the component to insert new component directly after. - first (True or None): If True, insert component first in the pipeline. - last (True or None): If True, insert component last in the pipeline. + first (Optional[Literal[True]]): If True, insert component first in the pipeline. + last (Optional[Literal[True]]): If True, insert component last in the pipeline. source (Language): Optional loaded nlp object to copy the pipeline component from. config (Dict[str, Any]): Config parameters to use for this component. @@ -831,8 +831,8 @@ class Language: before (str): Name or index of the component to insert directly before. after (str): Name or index of component to insert directly after. - first (True or None): If True, insert component first in the pipeline. - last (True or None): If True, insert component last in the pipeline. + first (Optional[Literal[True]]): If True, insert component first in the pipeline. + last (Optional[Literal[True]]): If True, insert component last in the pipeline. RETURNS (int): The index of the new pipeline component. """ if first is not None and first is not True: