π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Do not ignore undefined names in Python code (#1210)
Christian Claussf272a788bc02
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yamlindex 61d170d38..6c58b2ea0 100644--- a/.pre-commit-config.yaml+++ b/.pre-commit-config.yaml@@ -19,6 +19,7 @@ repos:rev: 21.7b0hooks:- id: black+ args: [--diff]- repo: https://github.com/codespell-project/codespellrev: v2.1.0diff --git a/kornia/geometry/camera/pinhole.py b/kornia/geometry/camera/pinhole.pyindex 11744d802..0d3d4e653 100644--- a/kornia/geometry/camera/pinhole.py+++ b/kornia/geometry/camera/pinhole.py@@ -501,7 +501,7 @@ def get_optical_pose_base(pinholes: torch.Tensor) -> torch.Tensor:raise AssertionError(pinholes.shape)optical_pose_parent = pinholes[..., 6:]# TODO: where is rtvec_to_pose?- return rtvec_to_pose(optical_pose_parent) # type: ignore+ return rtvec_to_pose(optical_pose_parent) # noqa: F821 type: ignoredef homography_i_H_ref(pinhole_i: torch.Tensor, pinhole_ref: torch.Tensor) -> torch.Tensor:diff --git a/setup.cfg b/setup.cfgindex 0f0060e43..61961a7d2 100644--- a/setup.cfg+++ b/setup.cfg@@ -20,7 +20,6 @@ license_file = LICENSE[flake8]max-line-length = 120ignore =- W503E203E305E402@@ -30,9 +29,9 @@ ignore =F401F403F405- F821- F841F811+ F841+ W503exclude = docs/src[mypy]diff --git a/setup.py b/setup.pyindex 315df88d0..389f42eac 100644--- a/setup.py+++ b/setup.py@@ -2,6 +2,7 @@#import distutils.command.cleanimport glob+import ioimport osimport shutilimport subprocessdiff --git a/test/augmentation/test_augmentation_3d.py b/test/augmentation/test_augmentation_3d.pyindex e7c180b2c..e78541ec3 100644--- a/test/augmentation/test_augmentation_3d.py+++ b/test/augmentation/test_augmentation_3d.py@@ -8,6 +8,7 @@ from torch.autograd import gradcheckimport korniaimport kornia.testing as utils # test utilsfrom kornia.augmentation import (+ RandomCrop,RandomCrop3D,RandomDepthicalFlip3D,RandomEqualize3D,diff --git a/test/augmentation/test_random_generator.py b/test/augmentation/test_random_generator.pyindex 087b7bcd5..d32967f12 100644--- a/test/augmentation/test_random_generator.py+++ b/test/augmentation/test_random_generator.py@@ -554,7 +554,7 @@ class TestRandomCropSizeGen(RandomGeneratorBaseTests):size=size,scale=scale.to(device=device, dtype=dtype),ratio=ratio.to(device=device, dtype=dtype),- same_on_batch=same_on_batch,+ same_on_batch=same_on_batch, # noqa: F821 raises NameError)def test_random_gen(self, device, dtype):@@ -653,7 +653,7 @@ class TestRandomRectangleGen(RandomGeneratorBaseTests):scale=scale.to(device=device, dtype=dtype),ratio=ratio.to(device=device, dtype=dtype),value=value,- same_on_batch=same_on_batch,+ same_on_batch=same_on_batch, # noqa: F821 raises NameError)def test_random_gen(self, device, dtype):@@ -854,7 +854,7 @@ class TestRandomSolarizeGen(RandomGeneratorBaseTests):def test_invalid_param_combinations(self, thresholds, additions, device, dtype):with pytest.raises(Exception):random_solarize_generator(- batch_size=batch_size,+ batch_size=batch_size, # noqa: F821 raises NameErrorthresholds=thresholds.to(device=device, dtype=dtype),additions=additions.to(device=device, dtype=dtype),)@@ -915,7 +915,9 @@ class TestRandomPosterizeGen(RandomGeneratorBaseTests):def test_invalid_param_combinations(self, bits, device, dtype):with pytest.raises(Exception):random_posterize_generator(- batch_size=batch_size, bits=bits.to(device=device, dtype=dtype), same_on_batch=same_on_batch+ batch_size=batch_size, # noqa: F821 raises NameError+ bits=bits.to(device=device, dtype=dtype),+ same_on_batch=same_on_batch, # noqa: F821 raises NameError)def test_random_gen(self, device, dtype):@@ -952,7 +954,9 @@ class TestRandomSharpnessGen(RandomGeneratorBaseTests):def test_invalid_param_combinations(self, sharpness, device, dtype):with pytest.raises(Exception):random_sharpness_generator(- batch_size=batch_size, sharpness=sharpness.to(device=device, dtype=dtype), same_on_batch=same_on_batch+ batch_size=batch_size, # noqa: F821 raises NameError+ sharpness=sharpness.to(device=device, dtype=dtype),+ same_on_batch=same_on_batch, # noqa: F821 raises NameError)def test_random_gen(self, device, dtype):diff --git a/test/enhance/test_adjust.py b/test/enhance/test_adjust.pyindex e80888424..7556f6a59 100644--- a/test/enhance/test_adjust.py+++ b/test/enhance/test_adjust.py@@ -782,6 +782,7 @@ class TestSharpness(BaseTester):@pytest.mark.jitdef test_jit(self, device, dtype):op = torch.jit.script(kornia.enhance.adjust.sharpness)+ op_script = torch.jit.script(op)inputs = torch.rand(2, 1, 3, 3).to(device=device, dtype=dtype)expected = op(input, 0.8)actual = op_script(input, 0.8)@@ -871,6 +872,7 @@ class TestSolarize(BaseTester):@pytest.mark.jitdef test_jit(self, device, dtype):op = torch.jit.script(kornia.enhance.adjust.solarize)+ op_script = torch.jit.script(op)inputs = torch.rand(2, 1, 3, 3).to(device=device, dtype=dtype)expected = op(input, 0.8)actual = op_script(input, 0.8)@@ -951,6 +953,7 @@ class TestPosterize(BaseTester):@pytest.mark.jitdef test_jit(self, device, dtype):op = torch.jit.script(kornia.enhance.adjust.posterize)+ op_script = torch.jit.script(op)inputs = torch.rand(2, 1, 3, 3).to(device=device, dtype=dtype)expected = op(input, 8)actual = op_script(input, 8)diff --git a/test/enhance/test_equalization.py b/test/enhance/test_equalization.pyindex c36947311..7775cfd58 100644--- a/test/enhance/test_equalization.py+++ b/test/enhance/test_equalization.py@@ -1,3 +1,5 @@+from typing import Tuple+import pytestimport torchfrom torch.autograd import gradcheckdiff --git a/test/geometry/epipolar/test_fundamental.py b/test/geometry/epipolar/test_fundamental.pyindex edcc31f09..2b19fb940 100644--- a/test/geometry/epipolar/test_fundamental.py+++ b/test/geometry/epipolar/test_fundamental.py@@ -1,3 +1,5 @@+from typing import Dict+import pytestimport test_common as utilsimport torchdiff --git a/test/geometry/epipolar/test_triangulation.py b/test/geometry/epipolar/test_triangulation.pyindex e53789002..1ae568051 100644--- a/test/geometry/epipolar/test_triangulation.py+++ b/test/geometry/epipolar/test_triangulation.py@@ -1,3 +1,5 @@+from typing import Dict+import pytestimport torchfrom torch.autograd import gradcheck