From 4c7ef8ccb708b040f403bc90059094da11272bf4 Mon Sep 17 00:00:00 2001 From: Alexander Schlemmer <a.schlemmer@indiscale.com> Date: Fri, 18 Oct 2024 13:56:51 +0200 Subject: [PATCH] DOC: improved some documentation of scanner functions --- src/caoscrawler/scanner.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/caoscrawler/scanner.py b/src/caoscrawler/scanner.py index 9f8f5e40..eeb2bdbf 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: -- GitLab