From f4d52dfb951a9e4f5e34ab7c87c20cbc723a3ade Mon Sep 17 00:00:00 2001 From: cow-bot Date: Mon, 25 Sep 2023 12:06:24 +0000 Subject: [PATCH] GO FORMAT YOURSELF (black) --- nexus_constructor/json/load_from_json_utils.py | 2 +- nexus_constructor/json/shape_reader.py | 10 ++++++---- nexus_constructor/model/group.py | 4 +++- tests/json/test_load_from_json.py | 7 +------ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/nexus_constructor/json/load_from_json_utils.py b/nexus_constructor/json/load_from_json_utils.py index 7f0b08c89..ecbf3f665 100644 --- a/nexus_constructor/json/load_from_json_utils.py +++ b/nexus_constructor/json/load_from_json_utils.py @@ -9,7 +9,7 @@ NodeType, ) -DEPENDS_ON_IGNORE = [None, 'None', ".", ""] +DEPENDS_ON_IGNORE = [None, "None", ".", ""] def _find_shape_information(children: List[Dict]) -> Union[Dict, None]: diff --git a/nexus_constructor/json/shape_reader.py b/nexus_constructor/json/shape_reader.py index 49e83270c..f3740fda7 100644 --- a/nexus_constructor/json/shape_reader.py +++ b/nexus_constructor/json/shape_reader.py @@ -431,9 +431,7 @@ def _all_in_list_have_expected_type( ) return False - def _get_values_attribute( - self, dataset: Dict, parent_name: str - ) -> Optional[List]: + def _get_values_attribute(self, dataset: Dict, parent_name: str) -> Optional[List]: """ Attempts to get the values attribute in a dataset. Creates an error message if it cannot be found. :param dataset: The dataset we hope to find the values attribute in. @@ -575,7 +573,11 @@ def _handle_mapping(self, children: List[Dict]): detector_faces_dataset = self._get_shape_dataset_from_list( DETECTOR_FACES, shape_group[CommonKeys.CHILDREN], False ) - if detector_faces_dataset and not isinstance(self.shape, BoxGeometry) and not isinstance(self.shape, CylindricalGeometry): + if ( + detector_faces_dataset + and not isinstance(self.shape, BoxGeometry) + and not isinstance(self.shape, CylindricalGeometry) + ): self.shape.detector_faces = detector_faces_dataset[CommonKeys.VALUES] def _find_and_add_pixel_offsets_to_component( diff --git a/nexus_constructor/model/group.py b/nexus_constructor/model/group.py index 5705571f0..facf26794 100644 --- a/nexus_constructor/model/group.py +++ b/nexus_constructor/model/group.py @@ -151,7 +151,9 @@ def nx_class(self): def nx_class(self, new_nx_class: str): self.attributes.set_attribute_value(CommonAttrs.NX_CLASS, new_nx_class) - def set_field_value(self, name: str, value: Any, dtype: Optional[str], unit: str = ""): + def set_field_value( + self, name: str, value: Any, dtype: Optional[str], unit: str = "" + ): self[name] = Dataset(parent_node=self, name=name, type=dtype, values=value) if unit: self[name].attributes.set_attribute_value(CommonAttrs.UNITS, unit) diff --git a/tests/json/test_load_from_json.py b/tests/json/test_load_from_json.py index 5a330bcee..e93452089 100644 --- a/tests/json/test_load_from_json.py +++ b/tests/json/test_load_from_json.py @@ -351,12 +351,7 @@ def test_GIVEN_json_with_component_depending_on_non_existent_transform_WHEN_load @pytest.mark.parametrize( "depends_on_path", - [ - ".", - "", - 'None', - None - ], + [".", "", "None", None], ) def test_GIVEN_json_with_component_with_null_depends_on_WHEN_loaded_THEN_no_effect( json_dict_with_component, json_reader, depends_on_path