oh-my-batch 0.4.2__tar.gz → 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/PKG-INFO +1 -1
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/combo.py +23 -3
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/pyproject.toml +1 -1
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/LICENSE +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/README.md +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/__init__.py +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/__main__.py +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/assets/__init__.py +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/assets/functions.sh +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/batch.py +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/cli.py +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/job.py +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/misc.py +0 -0
- {oh_my_batch-0.4.2 → oh_my_batch-0.4.4}/oh_my_batch/util.py +0 -0
@@ -33,7 +33,7 @@ class ComboMaker:
|
|
33
33
|
self.add_var(key, *args)
|
34
34
|
return self
|
35
35
|
|
36
|
-
def add_randint(self, key: str, n: int, a: int, b: int, seed=None):
|
36
|
+
def add_randint(self, key: str, n: int, a: int, b: int, uniq=False, seed=None):
|
37
37
|
"""
|
38
38
|
Add a variable with random integer values
|
39
39
|
|
@@ -41,11 +41,17 @@ class ComboMaker:
|
|
41
41
|
:param n: Number of values
|
42
42
|
:param a: Lower bound
|
43
43
|
:param b: Upper bound
|
44
|
+
:param uniq: If True, values are unique, default is False
|
44
45
|
:param seed: Seed for random number generator
|
45
46
|
"""
|
46
47
|
if seed is not None:
|
47
48
|
random.seed(seed)
|
48
|
-
|
49
|
+
if uniq:
|
50
|
+
if b - a + 1 < n:
|
51
|
+
raise ValueError("Not enough unique values")
|
52
|
+
args = random.sample(range(a, b + 1), n)
|
53
|
+
else:
|
54
|
+
args = [random.randint(a, b) for _ in range(n)]
|
49
55
|
self.add_var(key, *args)
|
50
56
|
return self
|
51
57
|
|
@@ -221,7 +227,7 @@ class ComboMaker:
|
|
221
227
|
|
222
228
|
For example,
|
223
229
|
|
224
|
-
run_cmd "cp {
|
230
|
+
run_cmd "cp {DATA_FILE} ./path/to/workdir/{i}/data.txt"
|
225
231
|
|
226
232
|
will copy each file in DATA_FILE to ./path/to/workdir/{i}/data.txt
|
227
233
|
|
@@ -237,6 +243,20 @@ class ComboMaker:
|
|
237
243
|
raise RuntimeError(f"Failed to run command: {_cmd}")
|
238
244
|
return self
|
239
245
|
|
246
|
+
def show_combos(self):
|
247
|
+
combos = self._make_combos()
|
248
|
+
if not combos:
|
249
|
+
print("No combos")
|
250
|
+
keys = combos[0].keys()
|
251
|
+
|
252
|
+
for i, combo in enumerate(combos):
|
253
|
+
print(f"> Combo {i}:")
|
254
|
+
for k in keys:
|
255
|
+
v = str(combo[k])
|
256
|
+
if '\n' in v:
|
257
|
+
v = f"\n{v}"
|
258
|
+
print(f"@{k}: {v}")
|
259
|
+
|
240
260
|
def done(self):
|
241
261
|
"""
|
242
262
|
End of command chain
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|