From 4a0c34cf9e207e5e7394832cda2c0c4659247cfb Mon Sep 17 00:00:00 2001 From: GinzburgLev Date: Thu, 16 Jan 2025 16:49:14 +0100 Subject: [PATCH] Fix linting --- src/pynxtools/dataconverter/helpers.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/pynxtools/dataconverter/helpers.py b/src/pynxtools/dataconverter/helpers.py index bd41dc0c0..5a5617cfa 100644 --- a/src/pynxtools/dataconverter/helpers.py +++ b/src/pynxtools/dataconverter/helpers.py @@ -80,13 +80,11 @@ def _log(self, path: str, log_type: ValidationProblem, value: Optional[Any], *ar if log_type == ValidationProblem.UnitWithoutDocumentation: logger.warning( - f"The unit, {path} = {value}, " - "is being written but has no documentation" + f"The unit, {path} = {value}, is being written but has no documentation" ) elif log_type == ValidationProblem.InvalidEnum: logger.warning( - f"The value at {path} should be on of the " - f"following strings: {value}" + f"The value at {path} should be on of the following strings: {value}" ) elif log_type == ValidationProblem.MissingRequiredGroup: logger.warning(f"The required group, {path}, hasn't been supplied.") @@ -344,7 +342,7 @@ def get_all_defined_required_children_for_elem(xml_element): list_of_children_to_add.add(f"{name_to_add}/@units") elif tag == "group": nxdlpath = ( - f'{xml_element.get("nxdlpath")}/{get_nxdl_name_from_elem(child)}' + f"{xml_element.get('nxdlpath')}/{get_nxdl_name_from_elem(child)}" ) nxdlbase = xml_element.get("nxdlbase") nx_name = nxdlbase[nxdlbase.rfind("/") + 1 : nxdlbase.rfind(".nxdl")] @@ -696,7 +694,7 @@ def is_valid_data_field(value, nxdl_type, path): (if conversion is not needed or impossible) """ accepted_types = NEXUS_TO_PYTHON_DATA_TYPES[nxdl_type] - output_value=value + output_value = value if not isinstance(value, dict) and not is_valid_data_type(value, accepted_types): try: @@ -704,7 +702,7 @@ def is_valid_data_field(value, nxdl_type, path): value = convert_str_to_bool_safe(value) if value is None: raise ValueError - output_value=accepted_types[0](value) + output_value = accepted_types[0](value) except ValueError: collector.collect_and_log( path, ValidationProblem.InvalidType, accepted_types, nxdl_type