From 1f465bea185d6aff3f4320b84f6a006b72b71917 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Tue, 13 Oct 2020 09:27:19 +0200 Subject: [PATCH] if-else --- spacy/util.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/spacy/util.py b/spacy/util.py index 58f951f86..8335a4fcc 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -1361,11 +1361,12 @@ def check_bool_env_var(env_var: str) -> bool: def _pipe(docs, proc, kwargs): if hasattr(proc, "pipe"): yield from proc.pipe(docs, **kwargs) - # We added some args for pipe that __call__ doesn't expect. - kwargs = dict(kwargs) - for arg in ["batch_size"]: - if arg in kwargs: - kwargs.pop(arg) - for doc in docs: - doc = proc(doc, **kwargs) - yield doc + else: + # We added some args for pipe that __call__ doesn't expect. + kwargs = dict(kwargs) + for arg in ["batch_size"]: + if arg in kwargs: + kwargs.pop(arg) + for doc in docs: + doc = proc(doc, **kwargs) + yield doc