From 839feac41ab40b4bddfc8a4131dd36b5cd20e149 Mon Sep 17 00:00:00 2001 From: sbilge Date: Wed, 27 Nov 2024 12:41:17 +0000 Subject: [PATCH] formatting --- src/metldata/builtin_transformations/common/utils.py | 4 ++-- .../count_content_values/data_transform.py | 6 ++++-- .../delete_properties/assumptions.py | 4 +--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/metldata/builtin_transformations/common/utils.py b/src/metldata/builtin_transformations/common/utils.py index 98fbe04..11abd64 100644 --- a/src/metldata/builtin_transformations/common/utils.py +++ b/src/metldata/builtin_transformations/common/utils.py @@ -38,7 +38,7 @@ def model_to_dict( return json.loads(dumps_schemapack(deepcopy(model), yaml_format=False)) -def data_to_dict(data:DataPack)-> dict[str, Any]: +def data_to_dict(data: DataPack) -> dict[str, Any]: """Converts the provided DataPack data to a JSON-serializable dictionary. Returns: @@ -47,7 +47,7 @@ def data_to_dict(data:DataPack)-> dict[str, Any]: return json.loads(dumps_datapack(deepcopy(data), yaml_format=False)) -def _thaw_content(frozen_dict: Mapping ) -> dict: +def _thaw_content(frozen_dict: Mapping) -> dict: """Recursively converts a nested FrozenDict and frozenset to mutable types. This will be removed after we implement a FrozenDict validation to Schemapack lib. """ diff --git a/src/metldata/builtin_transformations/count_content_values/data_transform.py b/src/metldata/builtin_transformations/count_content_values/data_transform.py index f09698b..d2fe549 100644 --- a/src/metldata/builtin_transformations/count_content_values/data_transform.py +++ b/src/metldata/builtin_transformations/count_content_values/data_transform.py @@ -54,7 +54,9 @@ def count_content( modified_data = data_to_dict(data) for class_name, instructions in instructions_by_class.items(): - transform_class(class_name=class_name, data=modified_data, instructions=instructions) + transform_class( + class_name=class_name, data=modified_data, instructions=instructions + ) return DataPack.model_validate(modified_data) @@ -95,7 +97,7 @@ def transform_resource( target_content = target_resource.get("content") if not target_content: raise EvitableTransformationError() - + relation_target_ids = target_resource.get("relations", {}).get(relation_name) if not relation_target_ids: raise EvitableTransformationError() diff --git a/src/metldata/builtin_transformations/delete_properties/assumptions.py b/src/metldata/builtin_transformations/delete_properties/assumptions.py index f8dff67..caa1014 100644 --- a/src/metldata/builtin_transformations/delete_properties/assumptions.py +++ b/src/metldata/builtin_transformations/delete_properties/assumptions.py @@ -43,9 +43,7 @@ def assert_classes_and_properties_exist( ) for property in properties: - if property not in model.classes[class_name].content.get( - "properties", {} - ): + if property not in model.classes[class_name].content.get("properties", {}): raise ModelAssumptionError( f"Property {property} does not exist in class {class_name}." )