Skip to content

Commit c43e6b4

Browse files
author
Saumya Saksena
committed
fix: pre commit issues
1 parent 704fd4d commit c43e6b4

8 files changed

Lines changed: 28 additions & 20 deletions

File tree

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: CI
22

33
on:
44
push:
5-
branches: [main, develop]
5+
branches: [main, dev, master]
66
pull_request:
7-
branches: [main, develop]
7+
branches: [main, dev, master]
88

99
jobs:
1010
test:
@@ -13,7 +13,7 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, macos-latest, windows-latest]
16-
python-version: ["3.8", "3.9", "3.10", "3.11"]
16+
python-version: ["3.9", "3.10", "3.11", "3.12"]
1717

1818
steps:
1919
- uses: actions/checkout@v3
@@ -109,9 +109,9 @@ jobs:
109109
- name: Install dependencies
110110
run: |
111111
python -m pip install --upgrade pip
112-
pip install safety bandit
112+
pip install pre-commit
113+
pre-commit install
113114
114-
- name: Check for security vulnerabilities
115+
- name: Check for pre-commit issues
115116
run: |
116-
safety check --json || true
117-
bandit -r src/ -f json || true
117+
pre-commit run --all-files

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
version="2.0.0",
1919
author="dronefreak",
2020
author_email="",
21-
description="Real-time monocular depth estimation for DJI Tello drone collision avoidance using PyDNet",
21+
description="Real-time monocular depth estimation for DJI "
22+
"Tello drone collision avoidance using PyDNet",
2223
long_description=long_description,
2324
long_description_content_type="text/markdown",
2425
url="https://github.com/dronefreak/dji-tello-collision-avoidance-pydnet",
@@ -59,7 +60,8 @@
5960
},
6061
include_package_data=True,
6162
zip_safe=False,
62-
keywords="drone tello depth-estimation computer-vision pytorch collision-avoidance autonomous-navigation",
63+
keywords="drone tello depth-estimation computer-vision pytorch"
64+
"collision-avoidance autonomous-navigation",
6365
project_urls={
6466
"Bug Reports": "https://github.com/dronefreak/dji-tello-collision-avoidance-pydnet/issues",
6567
"Source": "https://github.com/dronefreak/dji-tello-collision-avoidance-pydnet",

src/collision_avoidance.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ def analyze_depth(self, depth_map: np.ndarray) -> Dict[str, Any]:
7171
center_y, center_x = h // 2, w // 2
7272
h4 = max(h // 4, 1)
7373
w4 = max(w // 4, 1)
74-
center_region = depth_map[
75-
center_y - h4 : center_y + h4, center_x - w4 : center_x + w4
76-
]
74+
center_region = depth_map[center_y - h4 : center_y + h4, center_x - w4 : center_x + w4]
7775
if center_region.size == 0:
7876
center_region = depth_map
7977
center_depth = float(np.mean(center_region))

tests/test_collision_avoidance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
# Check if OpenCV is available (required for collision_avoidance)
1414
try:
15-
import cv2
15+
import cv2 # noqa: F401
1616

1717
CV2_AVAILABLE = True
1818
except ImportError:

tests/test_depth_estimator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
# Check if TensorFlow is available
1515
try:
16-
import tensorflow as tf
16+
import tensorflow as tf # noqa: F401
1717

1818
TF_AVAILABLE = True
1919
from src.depth_estimator import DepthEstimator, PyDNetModel

tests/test_tello_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# Check if OpenCV is available (required for imports through src package)
1717
try:
18-
import cv2
18+
import cv2 # noqa: F401
1919

2020
CV2_AVAILABLE = True
2121
except ImportError:

tests/test_utils.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,20 @@
1111

1212
# Check if OpenCV is available (required for utils module)
1313
try:
14-
import cv2
14+
import cv2 # noqa: F401
1515

1616
CV2_AVAILABLE = True
17-
from src.utils import (apply_colormap, draw_center_region, draw_crosshair, draw_depth_stats,
18-
draw_fps, find_max_depth_region, preprocess_image, resize_with_aspect_ratio,
19-
visualize_depth)
17+
from src.utils import (
18+
apply_colormap,
19+
draw_center_region,
20+
draw_crosshair,
21+
draw_depth_stats,
22+
draw_fps,
23+
find_max_depth_region,
24+
preprocess_image,
25+
resize_with_aspect_ratio,
26+
visualize_depth,
27+
)
2028
except ImportError:
2129
CV2_AVAILABLE = False
2230

tests/test_webcam_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# Check if OpenCV is available (required for webcam_source)
1717
try:
18-
import cv2
18+
import cv2 # noqa: F401
1919

2020
CV2_AVAILABLE = True
2121
except ImportError:

0 commit comments

Comments
 (0)