From 564c2b04d9b760c0bbee0a8699e7db1704f204fa Mon Sep 17 00:00:00 2001 From: Raphael Mitsch Date: Thu, 13 Jul 2023 08:56:34 +0200 Subject: [PATCH] Format. --- spacy/cli/init_config.py | 20 ++++++++++++++------ spacy/tests/test_cli.py | 2 -- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/spacy/cli/init_config.py b/spacy/cli/init_config.py index 2cb50ba33..099fdcac1 100644 --- a/spacy/cli/init_config.py +++ b/spacy/cli/init_config.py @@ -187,30 +187,38 @@ def init_config( raise ValueError(Errors.E1055) from ex if llm_model is None: - raise ValueError("Option `llm.model` must be set if `llm` component is in pipeline.") + raise ValueError( + "Option `llm.model` must be set if `llm` component is in pipeline." + ) if llm_task is None: - raise ValueError("Option `llm.task` must be set if `llm` component is in pipeline.") + raise ValueError( + "Option `llm.task` must be set if `llm` component is in pipeline." + ) # Select registry handles for model(s) and task(s). Raise if no match found. llm_spec = { spec_type: { "arg": llm_model if spec_type == "model" else llm_task, "matched_reg_handle": None, - "reg_handles": getattr(registry, f"llm_{spec_type}s").get_all() + "reg_handles": getattr(registry, f"llm_{spec_type}s").get_all(), } for spec_type in ("model", "task") } for spec_type, spec in llm_spec.items(): for reg_handle in spec["reg_handles"]: - if reg_handle.split(".")[1].lower() == spec["arg"].lower().replace(".", "-"): + if reg_handle.split(".")[1].lower() == spec["arg"].lower().replace( + ".", "-" + ): spec["matched_reg_handle"] = reg_handle break if not spec["matched_reg_handle"]: arg = spec["arg"] - raise ValueError(f"Couldn't find a matching registration handle for {spec_type} '{spec}'. Double-check" - f" whether '{arg}' is spelled correctly.") + raise ValueError( + f"Couldn't find a matching registration handle for {spec_type} '{spec}'. Double-check" + f" whether '{arg}' is spelled correctly." + ) defaults = RECOMMENDATIONS["__default__"] reco = RecommendationSchema(**RECOMMENDATIONS.get(lang, defaults)).dict() diff --git a/spacy/tests/test_cli.py b/spacy/tests/test_cli.py index 66c4e308f..fdaaf5359 100644 --- a/spacy/tests/test_cli.py +++ b/spacy/tests/test_cli.py @@ -670,8 +670,6 @@ def test_init_config_llm(pipeline, llm_model, llm_task): load_model_from_config(config, auto_fill=True) - - def test_model_recommendations(): for lang, data in RECOMMENDATIONS.items(): assert RecommendationSchema(**data)