Skip to content
Snippets Groups Projects
Commit 4c7ef8cc authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

DOC: improved some documentation of scanner functions

parent 5068f0b3
No related branches found
No related tags found
2 merge requests!198REL: Release 0.10.0,!182Better error message
...@@ -55,10 +55,19 @@ from .version import check_cfood_version ...@@ -55,10 +55,19 @@ from .version import check_cfood_version
logger = logging.getLogger(__name__) 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 Load a cfood from a crawler definition defined by
crawler definition path and validate it using cfood-schema.yml. 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: # Load the cfood from a yaml file:
...@@ -70,13 +79,21 @@ def load_definition(crawler_definition_path: str): ...@@ -70,13 +79,21 @@ def load_definition(crawler_definition_path: str):
return _resolve_validator_paths(crawler_definition, crawler_definition_path) 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 """Load crawler definitions from a list of (yaml) dicts `crawler_definitions` which
contains either one or two documents. contains either one or two documents.
Doesn't resolve the validator paths in the cfood definition, so for Doesn't resolve the validator paths in the cfood definition, so for
internal and testing use only. 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: if len(crawler_definitions) == 1:
# Simple case, just one document: # Simple case, just one document:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment