From 9fe9b6d97091e7f6df6101dab08064569d870a40 Mon Sep 17 00:00:00 2001 From: Alexander Dokuchaev Date: Fri, 7 Feb 2025 00:49:11 +0200 Subject: [PATCH] isc --- .../tensorflow/common/object_detection/architecture/fpn.py | 5 +++-- nncf/common/quantization/quantizer_setup.py | 2 +- .../algorithms/bias_correction/torch_fx_backend.py | 2 +- nncf/tensorflow/quantization/init_range.py | 2 +- nncf/torch/model_creation.py | 2 +- pyproject.toml | 1 + tests/openvino/tools/calibrate.py | 2 +- 7 files changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/tensorflow/common/object_detection/architecture/fpn.py b/examples/tensorflow/common/object_detection/architecture/fpn.py index 834b3746ae7..9ab6adb33b3 100644 --- a/examples/tensorflow/common/object_detection/architecture/fpn.py +++ b/examples/tensorflow/common/object_detection/architecture/fpn.py @@ -108,10 +108,11 @@ def __call__(self, multilevel_features, is_training=None): input_levels = list(multilevel_features.keys()) if min(input_levels) > self._min_level: - raise ValueError( + msg = ( f"The minimum backbone level {min(input_levels)} should be " - + f"less or equal to FPN minimum level {self._min_level}." + f"less or equal to FPN minimum level {self._min_level}." ) + raise ValueError(msg) backbone_max_level = min(max(input_levels), self._max_level) with tf.name_scope("fpn"): diff --git a/nncf/common/quantization/quantizer_setup.py b/nncf/common/quantization/quantizer_setup.py index 377b0d4c5c0..7801057eca8 100644 --- a/nncf/common/quantization/quantizer_setup.py +++ b/nncf/common/quantization/quantizer_setup.py @@ -220,7 +220,7 @@ def select_qconfig(self, qconfig: QuantizerConfig) -> SingleConfigQuantizationPo qconfig_any = deepcopy(qconfig) qconfig_any.signedness_to_force = None if qconfig_any not in self.possible_qconfigs: - msg = "Invalid selection for a quantizer config - " "tried to select {} among [{}]".format( + msg = "Invalid selection for a quantizer config - tried to select {} among [{}]".format( qconfig, ",".join([str(q) for q in self.possible_qconfigs]) ) raise ValueError(msg) diff --git a/nncf/quantization/algorithms/bias_correction/torch_fx_backend.py b/nncf/quantization/algorithms/bias_correction/torch_fx_backend.py index 2c59ab700b2..65e7d205a34 100644 --- a/nncf/quantization/algorithms/bias_correction/torch_fx_backend.py +++ b/nncf/quantization/algorithms/bias_correction/torch_fx_backend.py @@ -105,7 +105,7 @@ def get_output_name(model: torch.fx.GraphModule, node_name: str, output_port_id: elif node.op == "output": return node.all_input_nodes.index(graph_node) - msg = f"Node with name {node_name} expected to have an output," " no outputs were found." + msg = f"Node with name {node_name} expected to have an output, no outputs were found." raise nncf.InternalError(msg) @staticmethod diff --git a/nncf/tensorflow/quantization/init_range.py b/nncf/tensorflow/quantization/init_range.py index 59a15f7478e..9566ffbb25d 100644 --- a/nncf/tensorflow/quantization/init_range.py +++ b/nncf/tensorflow/quantization/init_range.py @@ -75,7 +75,7 @@ def get_init_config_for_scope_and_group(self, node_name: str, group: QuantizerGr ) ) if len(matches) > 1: - msg = f"Location {str(node_name)} matches more than one per-layer initialization parameter " "definition!" + msg = f"Location {str(node_name)} matches more than one per-layer initialization parameter definition!" raise ValueError(msg) if len(matches) == 1: return matches[0] diff --git a/nncf/torch/model_creation.py b/nncf/torch/model_creation.py index e4accf8d5c3..f9f6b924e07 100644 --- a/nncf/torch/model_creation.py +++ b/nncf/torch/model_creation.py @@ -180,7 +180,7 @@ def get_input_info_from_config(config: NNCFConfig) -> ModelInputInfo: return FillerInputInfo.from_nncf_config(config) nncf_logger.debug( - "Config has no 'input_info' section, trying to use dataloader output as model inputs " "for graph building." + "Config has no 'input_info' section, trying to use dataloader output as model inputs for graph building." ) exact_info = LoaderInputInfo.from_nncf_config_dataloaders(config) if exact_info is not None: diff --git a/pyproject.toml b/pyproject.toml index 9d7b3c071b8..39a5091709a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -142,6 +142,7 @@ select = [ "UP", # pyupgrade "EM", # flake8-errmsg "INP", # flake8-no-pep420 + "ISC", # flake8-implicit-str-concat ] extend-select = [ "SIM", # https://pypi.org/project/flake8-simplify diff --git a/tests/openvino/tools/calibrate.py b/tests/openvino/tools/calibrate.py index b12573c74c0..4d45cb4a385 100644 --- a/tests/openvino/tools/calibrate.py +++ b/tests/openvino/tools/calibrate.py @@ -355,7 +355,7 @@ def map_ignored_scope(ignored): if operations is not None: for op in operations: if op.get("attributes") is not None: - msg = '"attributes" in the ignored operations ' "are not supported" + msg = '"attributes" in the ignored operations are not supported' raise ValueError(msg) ignored_operations.append(op["type"]) return {"ignored_scope": IgnoredScope(names=ignored.get("scope", []), types=ignored_operations)}