oh-my-batch 0.3.1__py3-none-any.whl → 0.3.2__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 CHANGED
@@ -168,11 +168,11 @@ class ComboMaker:
168
168
  For example, if delimiter is '@', then the template file can include @var1, @var2, ...
169
169
 
170
170
  The destination can also include variables in string format style.
171
- For example, if dest is 'output/{i}-{TEMP}.txt',
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
174
  :param file: Path pattern to destination file
175
- :param template: Path to template file
175
+ :param template: Path to template file, the path can include variables in string format style
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, ...
@@ -185,7 +185,8 @@ class ComboMaker:
185
185
 
186
186
  combos = self._make_combos()
187
187
  for i, combo in enumerate(combos):
188
- with open(template, 'r') as f:
188
+ _template = template.format(i=i, **combo)
189
+ with open(_template, 'r') as f:
189
190
  template_text = f.read()
190
191
  text = _Template(template_text).safe_substitute(combo)
191
192
  _file = file.format(i=i, **combo)
@@ -195,7 +196,7 @@ class ComboMaker:
195
196
  if mode is not None:
196
197
  os.chmod(_file, mode_translate(str(mode)))
197
198
  return self
198
-
199
+
199
200
  def print(self, *line: str, file: str = '', mode=None, encoding='utf-8'):
200
201
  """
201
202
  Print lines to a file against each combo
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oh-my-batch
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary:
5
5
  License: GPL
6
6
  Author: weihong.xu
@@ -4,12 +4,12 @@ oh_my_batch/assets/__init__.py,sha256=Exub46UbQaz2V2eXpQeiVfnThQpXaNeuyjlGY6gBSZ
4
4
  oh_my_batch/assets/functions.sh,sha256=LaiavZBu84D7C1r-dWhf91vPTuHXCMV1DQZUIPVQnjE,1001
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=U3vdHcqe2TEqMVMH7kVW-AlIYFzle839E9BzMNVtj6Y,9324
7
+ oh_my_batch/combo.py,sha256=424EGKgWdgTKRyBHWoE9HdXaQShtV4gRYBd9BRo4Hek,9429
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=5ve2QcviuF0UHFLrsXmjMTj0ogXJ4g05q1y-yWCFuOk,2409
11
- oh_my_batch-0.3.1.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
- oh_my_batch-0.3.1.dist-info/METADATA,sha256=vCTUrC_RUrC7162mntphFlwIt3JAYvdxjC3EFQZFqi8,5492
13
- oh_my_batch-0.3.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
14
- oh_my_batch-0.3.1.dist-info/entry_points.txt,sha256=ZY2GutSoNjjSyJ4qO2pTeseKUFgoTYdvmgkuZZkwi68,77
15
- oh_my_batch-0.3.1.dist-info/RECORD,,
11
+ oh_my_batch-0.3.2.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
12
+ oh_my_batch-0.3.2.dist-info/METADATA,sha256=z3cE86WXw3q4nvYq_LCvH01ydnMntgWQToZOrAbgjpU,5492
13
+ oh_my_batch-0.3.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
14
+ oh_my_batch-0.3.2.dist-info/entry_points.txt,sha256=ZY2GutSoNjjSyJ4qO2pTeseKUFgoTYdvmgkuZZkwi68,77
15
+ oh_my_batch-0.3.2.dist-info/RECORD,,