Skip to content

Commit 49f65db

Browse files
committed
Move loaders to CSET.loaders
1 parent 3d77f42 commit 49f65db

File tree

10 files changed

+8
-11
lines changed

10 files changed

+8
-11
lines changed

src/CSET/recipes/loaders/__init__.py renamed to src/CSET/loaders/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
__all__ below.
2020
"""
2121

22-
from CSET.recipes.loaders import (
22+
from CSET.loaders import (
2323
aoa,
2424
histograms,
2525
profiles,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/CSET/recipes/__init__.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from ruamel.yaml import YAML
2525

26+
import CSET.loaders
2627
from CSET._common import parse_recipe, slugify
2728
from CSET.cset_workflow.lib.python.jinja_utils import get_models as get_models
2829

@@ -272,12 +273,11 @@ def asdict(self) -> dict:
272273
def load_recipes(variables: dict[str, Any]) -> Iterable[RawRecipe]:
273274
"""Load recipes enabled by configuration.
274275
275-
Recipes are loaded using all loaders (python modules) in
276-
CSET.recipes.loaders. Each of these loaders must define a function with the
277-
signature `load(v: dict) -> Iterable[RawRecipe]`, which will be called with
278-
`variables`.
276+
Recipes are loaded using all loaders (python modules) in CSET.loaders. Each
277+
of these loaders must define a function with the signature `load(conf: dict)
278+
-> Iterable[RawRecipe]`, which will be called with `variables`.
279279
280-
A minimal example can be found in `CSET.recipes.loaders.test`.
280+
A minimal example can be found in `CSET.loaders.test`.
281281
282282
Parameters
283283
----------
@@ -294,11 +294,8 @@ def load_recipes(variables: dict[str, Any]) -> Iterable[RawRecipe]:
294294
AttributeError
295295
When a loader doesn't provide a `load` function.
296296
"""
297-
# Import here to avoid circular import.
298-
import CSET.recipes.loaders
299-
300297
config = Config(variables)
301-
for loader in CSET.recipes.loaders.__all__:
298+
for loader in CSET.loaders.__all__:
302299
logger.info("Loading recipes from %s", loader)
303-
module = getattr(CSET.recipes.loaders, loader)
300+
module = getattr(CSET.loaders, loader)
304301
yield from module.load(config)

0 commit comments

Comments
 (0)