Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
fix: more robust handling of incompletely evaluated parameters (any i…
…nteraction with them will result in a string <TBD> now). (#1525) * fix: catch any errors when formatting job information * Detect incomplete params evaluation and avoid printing the shell command in such a case * More robust TBD handling, working for any interaction with the <TBD> object.
- Loading branch information
1 parent
f9cbc1e
commit 3d4c768
Showing
6 changed files
with
146 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# A string that prints as TBD | ||
# whatever interaction happens on this class, <TBD> shall be returned | ||
class TBDString(str): | ||
# the second arg is necessary to avoid problems when pickling | ||
def __new__(cls, _=None): | ||
return str.__new__(cls, "<TBD>") | ||
|
||
def __getitem__(self, __item): | ||
return self | ||
|
||
def __getattribute__(self, __name): | ||
return self | ||
|
||
def __bool__(self): | ||
return False | ||
|
||
def __add__(self, __other): | ||
return self | ||
|
||
def __sub__(self, __other): | ||
return self | ||
|
||
def __mul__(self, __other): | ||
return self | ||
|
||
def __matmul__(self, __other): | ||
return self | ||
|
||
def __truediv__(self, __other): | ||
return self | ||
|
||
def __floordiv__(self, __other): | ||
return self | ||
|
||
def __mod__(self, __other): | ||
return self | ||
|
||
def __divmod__(self, __other): | ||
return self | ||
|
||
def __pow__(self, __other): | ||
return self | ||
|
||
def __lshift__(self, __other): | ||
return self | ||
|
||
def __rshift__(self, __other): | ||
return self | ||
|
||
def __and__(self, __other): | ||
return self | ||
|
||
def __xor__(self, __other): | ||
return self | ||
|
||
def __or__(self, __other): | ||
return self | ||
|
||
def __neg__(self): | ||
return self | ||
|
||
def __pos__(self): | ||
return self | ||
|
||
def __abs__(self): | ||
return self | ||
|
||
def __invert__(self): | ||
return self | ||
|
||
def __complex__(self): | ||
return self | ||
|
||
def __int__(self): | ||
return self | ||
|
||
def __float__(self): | ||
return self | ||
|
||
def __index__(self): | ||
return self | ||
|
||
def __round__(self, ndigits=0): | ||
return self | ||
|
||
def __trunc__(self): | ||
return self | ||
|
||
def __floor__(self): | ||
return self | ||
|
||
def __ceil__(self): | ||
return self | ||
|
||
def __enter__(self): | ||
return self | ||
|
||
def __exit__(self, __exc_type, __exc_value, __traceback): | ||
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
def get_x(wildcards, input): | ||
with open(input[0]) as infile: | ||
return {"foo": infile.read()} | ||
|
||
|
||
def get_mem_mb(wildcards, input): | ||
return os.path.getsize(input[0]) / 1024.0 | ||
|
||
|
||
rule a: | ||
input: | ||
"test.in", | ||
output: | ||
"test.out", | ||
params: | ||
x=get_x, | ||
resources: | ||
mem_mb=get_mem_mb, | ||
shell: | ||
"echo {params.x[foo]} > {output}" | ||
|
||
|
||
rule b: | ||
output: | ||
"test.in", | ||
shell: | ||
"touch {output}" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters