Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Add bandit B110 test and fix (#1243)

Edgar Riba23149197be20
diff --git a/.github/workflows/tests_cuda.yml b/.github/workflows/tests_cuda.yml
index a4d787eb1..fce5f0c95 100644
--- a/.github/workflows/tests_cuda.yml
+++ b/.github/workflows/tests_cuda.yml
@@ -21,6 +21,8 @@ jobs:
- name: Install dependencies
shell: bash -l {0}
run: |
+ # NOTE: pytorch image does not include git
+ conda install -c anaconda git
pip install -r requirements-dev.txt
python setup.py install
- name: Run Tests
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index aedf122fc..324e21c71 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -54,7 +54,7 @@ repos:
args:
- --recursive
- --skip
- - "B101,B110,B311,B404,B602,B603,B607"
+ - "B101,B311,B404,B602,B603,B607"
- .
- repo: https://github.com/myint/docformatter
diff --git a/kornia/feature/hardnet.py b/kornia/feature/hardnet.py
index 7cddfbb10..40ed38d73 100644
--- a/kornia/feature/hardnet.py
+++ b/kornia/feature/hardnet.py
@@ -148,10 +148,8 @@ class HardNet8(nn.Module):
def weights_init(m):
if isinstance(m, nn.Conv2d):
nn.init.orthogonal_(m.weight.data, gain=0.6)
- try:
+ if m.bias is not None:
nn.init.constant_(m.bias.data, 0.01)
- except:
- pass
@staticmethod
def _normalize_input(x: torch.Tensor, eps: float = 1e-7) -> torch.Tensor:
diff --git a/setup.py b/setup.py
index 686a1cdf1..4e46ef7af 100644
--- a/setup.py
+++ b/setup.py
@@ -65,7 +65,7 @@ cwd = os.path.dirname(os.path.abspath(__file__))
try:
sha = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=cwd).decode('ascii').strip()
-except Exception:
+except subprocess.CalledProcessError:
pass
if os.getenv('KORNIA_BUILD_VERSION'):