oh-my-batch 0.5.7__tar.gz → 0.6.0__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.5.7 → oh_my_batch-0.6.0}/PKG-INFO +1 -1
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/batch.py +19 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/pyproject.toml +1 -1
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/LICENSE +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/README.md +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/__init__.py +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/__main__.py +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/assets/__init__.py +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/assets/functions.sh +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/cli.py +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/combo.py +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/job.py +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/misc.py +0 -0
- {oh_my_batch-0.5.7 → oh_my_batch-0.6.0}/oh_my_batch/util.py +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
from typing import Optional
|
1
2
|
import shlex
|
2
3
|
import os
|
3
4
|
|
@@ -25,6 +26,24 @@ class BatchMaker:
|
|
25
26
|
self._work_dirs.extend(paths)
|
26
27
|
return self
|
27
28
|
|
29
|
+
def filter(self, expr: str):
|
30
|
+
"""
|
31
|
+
Filter working directories with a Python expression
|
32
|
+
|
33
|
+
:param expr: Python expression, the variable `{workdir} or {w}` is the directory path,
|
34
|
+
`{index} or {i}` is the index of the directory
|
35
|
+
|
36
|
+
Example: if expr is 'os.path.exits("{workdir}/input.json")',
|
37
|
+
then only the directories containing 'input.json' will be kept.
|
38
|
+
"""
|
39
|
+
filtered = []
|
40
|
+
for i, workdir in enumerate(self._work_dirs):
|
41
|
+
expr_eval = expr.format(workdir=workdir, w=workdir, index=i, i=i)
|
42
|
+
if eval(expr_eval):
|
43
|
+
filtered.append(workdir)
|
44
|
+
self._work_dirs = filtered
|
45
|
+
return self
|
46
|
+
|
28
47
|
def add_header_files(self, *file: str, encoding='utf-8'):
|
29
48
|
"""
|
30
49
|
Add script header from files
|
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
|