Skip to content

Commit 0ae6778

Browse files
chore: suppress Bandit false positives (#1561)
Signed-off-by: Barabanov, Alexander <[email protected]>
1 parent 836f81b commit 0ae6778

File tree

19 files changed

+34
-34
lines changed

19 files changed

+34
-34
lines changed

dev_tools/pre_commit_scripts/find_py_projects_and_run_make_target.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
exit_code = 0
4242

4343
for project_dir, project_files in files_per_project.items():
44-
if subprocess.run(
44+
if subprocess.run( # nosec: B603
4545
["make", "-n", make_target],
4646
cwd=project_dir,
4747
stdout=subprocess.DEVNULL,
@@ -55,7 +55,7 @@
5555
project_files = [
5656
str(Path(file).relative_to(project_dir)) for file in project_files
5757
]
58-
exit_code |= subprocess.run(
58+
exit_code |= subprocess.run( # nosec: B603
5959
["make", make_target, "FILES=" + " ".join(project_files)], cwd=project_dir
6060
).returncode
6161

interactive_ai/data_migration/migration/scripts/convert_vfr_videos_to_cfr.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def _get_video_fps(cls, video_path: str) -> float:
9292
:param video_path: Local path or presigned S3 URL pointing to the video
9393
:return: Video FPS as float
9494
"""
95-
result = subprocess.run( # noqa: S603
95+
result = subprocess.run( # noqa: S603 # nosec: B603
9696
[ # noqa: S607
9797
"ffprobe",
9898
"-v",
@@ -122,7 +122,7 @@ def _is_variable_frame_rate(cls, video_path: str) -> bool:
122122
:return: True if the video has variable frame rate, False if constant frame rate
123123
"""
124124
# Get r_frame_rate
125-
r_frame_rate_result = subprocess.run( # noqa: S603
125+
r_frame_rate_result = subprocess.run( # noqa: S603 # nosec: B603
126126
[ # noqa: S607
127127
"ffprobe",
128128
"-v",
@@ -141,7 +141,7 @@ def _is_variable_frame_rate(cls, video_path: str) -> bool:
141141
)
142142

143143
# Get avg_frame_rate
144-
avg_frame_rate_result = subprocess.run( # noqa: S603
144+
avg_frame_rate_result = subprocess.run( # noqa: S603 # nosec: B603
145145
[ # noqa: S607
146146
"ffprobe",
147147
"-v",
@@ -307,7 +307,7 @@ def _stitch_frames_to_cfr_video(cls, frames_dir: str, output_path: str, fps: flo
307307
logger.info(f"Stitching {len(frame_files)} frames into CFR video at {fps} fps")
308308

309309
# Use ffmpeg to create video from image sequence
310-
process = subprocess.run( # noqa: S603
310+
process = subprocess.run( # noqa: S603 # nosec: B603
311311
[ # noqa: S607
312312
"ffmpeg",
313313
"-y", # Overwrite output file

interactive_ai/data_migration/migration/scripts/correct_vfr_video_fps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def upgrade_project(cls, organization_id: str, workspace_id: str, project_id: st
5353
@staticmethod
5454
def get_video_fps(video_path: str) -> float:
5555
# Run ffprobe to get video stream information
56-
result = subprocess.run( # noqa: S603
56+
result = subprocess.run( # noqa: S603 # nosec: B603
5757
[ # noqa: S607
5858
"ffprobe",
5959
"-v",

interactive_ai/libs/media_utils/media_utils/video_decoder.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def reset_reader(self, file_location: str) -> None:
172172

173173
def get_fps(self, file_location: str) -> float:
174174
# Run ffprobe to get video stream information
175-
result = subprocess.run( # noqa: S603
175+
result = subprocess.run( # noqa: S603 # nosec: B603
176176
[ # noqa: S607
177177
"ffprobe",
178178
"-v",
@@ -207,7 +207,7 @@ def is_variable_frame_rate(self, file_location: str) -> bool:
207207
"""
208208
try:
209209
# Get r_frame_rate
210-
r_frame_rate_result = subprocess.run( # noqa: S603
210+
r_frame_rate_result = subprocess.run( # noqa: S603 # nosec: B603
211211
[ # noqa: S607
212212
"ffprobe",
213213
"-v",
@@ -226,7 +226,7 @@ def is_variable_frame_rate(self, file_location: str) -> bool:
226226
)
227227

228228
# Get avg_frame_rate
229-
avg_frame_rate_result = subprocess.run( # noqa: S603
229+
avg_frame_rate_result = subprocess.run( # noqa: S603 # nosec: B603
230230
[ # noqa: S607
231231
"ffprobe",
232232
"-v",
@@ -278,7 +278,7 @@ def convert_vfr_to_cfr(self, input_path: str, output_path: str, target_fps: floa
278278
:return: True if conversion was successful, False otherwise
279279
"""
280280
try:
281-
process = subprocess.run( # noqa: S603
281+
process = subprocess.run( # noqa: S603 # nosec: B603
282282
[ # noqa: S607
283283
"ffmpeg",
284284
"-i",

interactive_ai/libs/media_utils/media_utils/video_file_repair.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def attempt_repair(video_binary_repo: VideoBinaryRepo, filename: str) -> bool:
6565

6666
import subprocess
6767

68-
process = subprocess.Popen( # noqa: S603
68+
process = subprocess.Popen( # noqa: S603 # nosec: B603
6969
[ # noqa: S607
7070
"ffmpeg",
7171
"-hide_banner",

interactive_ai/libs/media_utils/media_utils/video_thumbnail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def generate_thumbnail_video(
3232
target_resolution = f"{default_thumbnail_size}:-2"
3333

3434
_, tmp_thumbnail_path = tempfile.mkstemp()
35-
process = subprocess.Popen( # noqa: S603
35+
process = subprocess.Popen( # noqa: S603 # nosec: B603
3636
[ # noqa: S607
3737
"ffmpeg",
3838
"-threads",

interactive_ai/services/model_registration/app/service/model_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import zipfile
1313
from enum import Enum, auto
1414
from pathlib import Path
15-
from xml.etree.ElementTree import Element
15+
from xml.etree.ElementTree import Element # nosec: B405 # defusedxml is used to parse data
1616

1717
from defusedxml import ElementTree
1818
from grpc_interfaces.model_registration.pb.service_pb2 import Model, Project

interactive_ai/services/resource/app/resource_management/media_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ def create_and_save_thumbnail_video(
731731
filename=video.thumbnail_video_filename, make_unique=False
732732
)
733733
video_path_or_url = str(video_binary_repo.get_path_or_presigned_url(filename=video.data_binary_filename))
734-
process = subprocess.Popen( # noqa: S603
734+
process = subprocess.Popen( # noqa: S603 # nosec: B603
735735
[ # noqa: S607
736736
"ffmpeg",
737737
"-threads",

interactive_ai/workflows/common/jobs_common_extras/datumaro_conversion/convert_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ def build_labels_data(label_names: list[str], anomaly_label_names: list[str] | N
765765
for label_name in label_names:
766766
label_data: dict[str, Any] = {
767767
"name": label_name,
768-
"color": "#00" + "".join([random.choice("0123456789ABCDEF") for j in range(6)]), # noqa: S311
768+
"color": "#00" + "".join([random.choice("0123456789ABCDEF") for j in range(6)]), # noqa: S311 # nosec: B311
769769
}
770770
label_datas.append(label_data)
771771

interactive_ai/workflows/train/trainer/scripts/s3_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def wrapper(*args, **kwargs):
5353
raise
5454

5555
# ruff: noqa: S311
56-
jitter = random.uniform(0, 1) # nosec
56+
jitter = random.uniform(0, 1) # nosec: B311
5757
backoff_time = min(jitter * (2**retries) * delay, max_backoff)
5858
time.sleep(backoff_time)
5959
retries += 1

0 commit comments

Comments
 (0)