diff --git a/src/caoscrawler/validator.py b/src/caoscrawler/validator.py index 3051f4c42dd50496e64e9ab0871b464b5f564192..fdfed23f503e09f11e9be26fcad7dd2b4f13e7e0 100644 --- a/src/caoscrawler/validator.py +++ b/src/caoscrawler/validator.py @@ -71,7 +71,8 @@ def representer_ordereddict(dumper, data): Helper function to be able to represent the converted json schema objects correctly as yaml. This representer essentially replaced OrderedDict objects with simple dict objects. - Since Python 3.7 dicts are ordered by default, see e.g.: https://softwaremaniacs.org/blog/2020/02/05/dicts-ordered/en/ + Since Python 3.7 dicts are ordered by default, see e.g.: + https://softwaremaniacs.org/blog/2020/02/05/dicts-ordered/en/ Example how to use the representer: ```python @@ -81,7 +82,7 @@ def representer_ordereddict(dumper, data): return dumper.represent_data(dict(data)) -def apply_schema_patches(pobj: dict): +def _apply_schema_patches(pobj: dict): """ Changes applied: - properties are moved vom subitem "proeprties" to top-level. @@ -92,7 +93,7 @@ def apply_schema_patches(pobj: dict): return pobj for prop in pobj["properties"]: if isinstance(pobj["properties"][prop], dict): - pobj[prop] = apply_schema_patches(pobj["properties"][prop]) + pobj[prop] = _apply_schema_patches(pobj["properties"][prop]) else: pobj[prop] = pobj["properties"][prop] @@ -108,8 +109,8 @@ def convert_record(record: db.Record): """ Convert a record into a form suitable for validation with jsonschema. - Uses high_level_api.convert_to_python_object - Afterwards apply_schema_patches is called recursively to refactor the dictionary + Uses `high_level_api.convert_to_python_object` + Afterwards `_apply_schema_patches` is called recursively to refactor the dictionary to match the current form of the jsonschema. Arguments: