Skip to content

Commit 4c767ad

Browse files
committed
Ignore some bandit warnings
1 parent f2a43bd commit 4c767ad

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

datumaro/plugins/sampler/random_sampler.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def __init__(
6767

6868
def __iter__(self):
6969
if self._indices is None:
70-
rng = Random(self._seed)
70+
rng = Random(self._seed) # nosec - disable B311
7171

7272
if self._subset:
7373
n = len(self._extractor.get_subset(self._subset))
@@ -213,7 +213,7 @@ def _make_bucket():
213213

214214
buckets = defaultdict(_make_bucket) # subset -> subset_buckets
215215

216-
rng = Random(self._seed)
216+
rng = Random(self._seed) # nosec - disable B311
217217

218218
for i, item in enumerate(self._extractor):
219219
labels = set(getattr(ann, "label", None) for ann in item.annotations)

datumaro/plugins/synthetic_data/image_generator.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ def generate_dataset(self) -> None:
6666

6767
mp_ctx = get_context("spawn") # On Mac 10.15 and Python 3.7 fork leads to hangs
6868
with mp_ctx.Pool(processes=self._cpu_count) as pool:
69-
params = pool.map(self._generate_category, [Random(i) for i in range(self._categories)])
69+
params = pool.map(
70+
self._generate_category, [Random(i) for i in range(self._categories)]
71+
) # nosec - disable B311
7072

7173
instances_weights = np.repeat(self._weights, self._instances, axis=0)
7274
weight_per_img = np.tile(instances_weights, (self._categories, 1))
@@ -110,7 +112,7 @@ def _generate_image_batch(
110112

111113
for i, param, w in zip(indices, params, weights):
112114
image = self._generate_image(
113-
Random(i),
115+
Random(i), # nosec - disable B311
114116
param,
115117
self._iterations,
116118
self._height,
@@ -119,7 +121,7 @@ def _generate_image_batch(
119121
weight=w,
120122
)
121123
color_image = colorize(image, net)
122-
aug_image = augment(Random(i), color_image, background_colors)
124+
aug_image = augment(Random(i), color_image, background_colors) # nosec - disable B311
123125
save_image(
124126
osp.join(self._output_dir, "{:06d}.png".format(i)), aug_image, create_dir=True
125127
)

0 commit comments

Comments
 (0)