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
Branches
Tags
2 merge requests!198REL: Release 0.10.0,!182Better error message
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment