oh-my-batch 0.2.5__py3-none-any.whl → 0.3.0__py3-none-any.whl
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/combo.py +6 -6
- {oh_my_batch-0.2.5.dist-info → oh_my_batch-0.3.0.dist-info}/METADATA +4 -3
- {oh_my_batch-0.2.5.dist-info → oh_my_batch-0.3.0.dist-info}/RECORD +6 -6
- {oh_my_batch-0.2.5.dist-info → oh_my_batch-0.3.0.dist-info}/WHEEL +1 -1
- {oh_my_batch-0.2.5.dist-info → oh_my_batch-0.3.0.dist-info}/LICENSE +0 -0
- {oh_my_batch-0.2.5.dist-info → oh_my_batch-0.3.0.dist-info}/entry_points.txt +0 -0
oh_my_batch/combo.py
CHANGED
@@ -161,7 +161,7 @@ class ComboMaker:
|
|
161
161
|
raise ValueError(f"Variable {key} not found")
|
162
162
|
return self
|
163
163
|
|
164
|
-
def make_files(self,
|
164
|
+
def make_files(self, file: str, template: str, delimiter='@', mode=None, encoding='utf-8'):
|
165
165
|
"""
|
166
166
|
Make files from template against each combo
|
167
167
|
The template file can include variables with delimiter.
|
@@ -171,8 +171,8 @@ class ComboMaker:
|
|
171
171
|
For example, if dest is 'output/{i}-{TEMP}.txt',
|
172
172
|
then files are saved as output/0-300K.txt, output/1-400K.txt, ...
|
173
173
|
|
174
|
+
:param file: Path pattern to destination file
|
174
175
|
:param template: Path to template file
|
175
|
-
:param dest: Path pattern to destination file
|
176
176
|
:param delimiter: Delimiter for variables in template, default is '@', as '$' is popular in shell scripts
|
177
177
|
can be changed to other character, e.g $, $$, ...
|
178
178
|
:param mode: File mode, e.g. 755, 644, ...
|
@@ -188,12 +188,12 @@ class ComboMaker:
|
|
188
188
|
with open(template, 'r') as f:
|
189
189
|
template_text = f.read()
|
190
190
|
text = _Template(template_text).safe_substitute(combo)
|
191
|
-
|
192
|
-
ensure_dir(
|
193
|
-
with open(
|
191
|
+
_file = file.format(i=i, **combo)
|
192
|
+
ensure_dir(_file)
|
193
|
+
with open(_file, 'w', encoding=encoding) as f:
|
194
194
|
f.write(text)
|
195
195
|
if mode is not None:
|
196
|
-
os.chmod(
|
196
|
+
os.chmod(_file, mode_translate(str(mode)))
|
197
197
|
return self
|
198
198
|
|
199
199
|
def print(self, *line: str, file: str = '', mode=None, encoding='utf-8'):
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: oh-my-batch
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.3.0
|
4
4
|
Summary:
|
5
5
|
License: GPL
|
6
6
|
Author: weihong.xu
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
16
17
|
Requires-Dist: fire (>=0.7.0,<0.8.0)
|
17
18
|
Description-Content-Type: text/markdown
|
18
19
|
|
@@ -83,8 +84,8 @@ omb combo \
|
|
83
84
|
add_files DATA_FILE tmp/*.data - \
|
84
85
|
add_var TEMP 300 400 500 - \
|
85
86
|
add_randint RANDOM -n 3 -a 1 -b 1000 --broadcast - \
|
86
|
-
make_files tmp/
|
87
|
-
make_files tmp/
|
87
|
+
make_files tmp/tasks/{i}-T-{TEMP}/in.lmp --template tmp/in.lmp.tmp - \
|
88
|
+
make_files tmp/tasks/{i}-T-{TEMP}/run.sh --template tmp/run.sh.tmp --mode 755 - \
|
88
89
|
done
|
89
90
|
```
|
90
91
|
|
@@ -4,12 +4,12 @@ oh_my_batch/assets/__init__.py,sha256=Exub46UbQaz2V2eXpQeiVfnThQpXaNeuyjlGY6gBSZ
|
|
4
4
|
oh_my_batch/assets/functions.sh,sha256=dvPGpOKz4CyUSlE5IAewQc8HUrQJuaZ0j-WZIuxB3Tg,1002
|
5
5
|
oh_my_batch/batch.py,sha256=6qnaXEVyA493heGzzbCrdZXCcnYk8zgl7WP0rmo7KlU,3690
|
6
6
|
oh_my_batch/cli.py,sha256=Jyz8q2pUYke3mfJS6F_G9S9hApddgXxQw1BsN6Kfkjc,553
|
7
|
-
oh_my_batch/combo.py,sha256
|
7
|
+
oh_my_batch/combo.py,sha256=U3vdHcqe2TEqMVMH7kVW-AlIYFzle839E9BzMNVtj6Y,9324
|
8
8
|
oh_my_batch/job.py,sha256=Uk0E-WxnexBu9wuUV3uc1aAwVF_5rWdNdLEOB8Y9B-U,6252
|
9
9
|
oh_my_batch/misc.py,sha256=G_iOovRCrShBJJCc82QLN0CvMqW4adOefEoY1GedEiw,452
|
10
10
|
oh_my_batch/util.py,sha256=K-XAndE5dgpxBrohAlUhVpeJGT7Q9vUG9ghHc9L0HaU,2426
|
11
|
-
oh_my_batch-0.
|
12
|
-
oh_my_batch-0.
|
13
|
-
oh_my_batch-0.
|
14
|
-
oh_my_batch-0.
|
15
|
-
oh_my_batch-0.
|
11
|
+
oh_my_batch-0.3.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
12
|
+
oh_my_batch-0.3.0.dist-info/METADATA,sha256=GCNn-8-7s18Ps8fTb_9wyMsHm0MWBDB0Yox1-HVEiRI,5518
|
13
|
+
oh_my_batch-0.3.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
14
|
+
oh_my_batch-0.3.0.dist-info/entry_points.txt,sha256=ZY2GutSoNjjSyJ4qO2pTeseKUFgoTYdvmgkuZZkwi68,77
|
15
|
+
oh_my_batch-0.3.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|