From a8ce60b65116a0aeda17a59b0eed5a90fbda9a93 Mon Sep 17 00:00:00 2001 From: Jan Iwaszkiewicz Date: Fri, 23 Jun 2023 15:06:02 +0200 Subject: [PATCH] Fix flake8 warnings and ignore VNE001 for Python samples (#18204) * Ignore VNE001 for Python samples * Add explanation * Fix flake8 on wheel setup.py * Fix onnx test reporting VNE001 --- samples/python/setup.cfg | 3 ++- src/bindings/python/tests/test_onnx/test_ops_reshape.py | 2 +- src/bindings/python/wheel/setup.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/samples/python/setup.cfg b/samples/python/setup.cfg index 1e8c86607e1..0326d23be63 100644 --- a/samples/python/setup.cfg +++ b/samples/python/setup.cfg @@ -3,9 +3,10 @@ # D100 - Missing docstring in public module # D101 - Missing docstring in public class # D103 - Missing docstring in public function +# VNE001 - Single letter variable names are not allowed filename = *.py max-line-length = 160 -ignore = E203,D100,D101,D103 +ignore = E203,D100,D101,D103,VNE001 max-parameters-amount = 8 show_source = True docstring-convention = google diff --git a/src/bindings/python/tests/test_onnx/test_ops_reshape.py b/src/bindings/python/tests/test_onnx/test_ops_reshape.py index 5771962fea1..30355665697 100644 --- a/src/bindings/python/tests/test_onnx/test_ops_reshape.py +++ b/src/bindings/python/tests/test_onnx/test_ops_reshape.py @@ -412,7 +412,7 @@ def test_split_1d(): def test_depth_to_space(): - b, c, h, w = shape = (2, 8, 3, 3) + b, c, h, w = shape = (2, 8, 3, 3) # noqa: VNE001 blocksize = 2 data = np.random.random_sample(shape).astype(np.float32) tmp = np.reshape(data, [b, blocksize, blocksize, c // (blocksize ** 2), h, w]) diff --git a/src/bindings/python/wheel/setup.py b/src/bindings/python/wheel/setup.py index e8427dea31e..b713cf59059 100644 --- a/src/bindings/python/wheel/setup.py +++ b/src/bindings/python/wheel/setup.py @@ -220,7 +220,7 @@ class CustomBuild(build): ("cmake-args=", None, "Additional options to be passed to CMake."), ("python-extensions-only", None, "Install Python extensions without C++ libraries."), ] - boolean_options = build.boolean_options + ['python-extensions-only'] + boolean_options = build.boolean_options + ["python-extensions-only"] def initialize_options(self): """Set default values for all the options that this command supports.""" @@ -436,7 +436,7 @@ class CopyExt(build_ext): user_options = [ ("skip-rpath", None, "Skips RPATH for Python extensions."), ] - boolean_options = ['skip_rpath'] + boolean_options = ["skip_rpath"] def initialize_options(self): """Set default values for all the options that this command supports."""