diff --git a/src/caoscrawler/scanner.py b/src/caoscrawler/scanner.py index 9f8f5e40beb729d73151bad38f3e390a4a8cecb4..eeb2bdbf8f0f0d96579598cd8842739a3d154b93 100644 --- a/src/caoscrawler/scanner.py +++ b/src/caoscrawler/scanner.py @@ -55,10 +55,19 @@ from .version import check_cfood_version logger = logging.getLogger(__name__) -def load_definition(crawler_definition_path: str): +def load_definition(crawler_definition_path: str) -> dict: """ Load a cfood from a crawler definition defined by crawler definition path and validate it using cfood-schema.yml. + + Arguments: + ---------- + crawler_definition_path: str + Path to the crawler definition file in yaml format. + + Returns: + -------- + dict containing the crawler definition. """ # Load the cfood from a yaml file: @@ -70,13 +79,21 @@ def load_definition(crawler_definition_path: str): return _resolve_validator_paths(crawler_definition, crawler_definition_path) -def _load_definition_from_yaml_dict(crawler_definitions: list[dict]): +def _load_definition_from_yaml_dict(crawler_definitions: list[dict]) -> dict: """Load crawler definitions from a list of (yaml) dicts `crawler_definitions` which contains either one or two documents. Doesn't resolve the validator paths in the cfood definition, so for internal and testing use only. + Arguments: + ---------- + crawler_definitions: list[dict] + List of one or two dicts containing (optionally) metadata and the crawler definition. + + Returns: + -------- + dict containing the crawler definition. """ if len(crawler_definitions) == 1: # Simple case, just one document: