We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents e2d88e8 + 6e48c47 commit 497ed68Copy full SHA for 497ed68
lib/ramble/ramble/expander.py
@@ -798,9 +798,12 @@ def _eval_bool_op(self, node):
798
def _eval_comparisons(self, node):
799
"""Handle a comparison node in the ast"""
800
801
- # Extract In nodes, and call their helper
802
- if len(node.ops) == 1 and isinstance(node.ops[0], ast.In):
803
- return self._eval_comp_in(node)
+ # Extract In or NotIn nodes, and call their helper
+ if len(node.ops) == 1 and isinstance(node.ops[0], (ast.In, ast.NotIn)):
+ is_in = self._eval_comp_in(node)
804
+ if isinstance(node.ops[0], ast.NotIn):
805
+ return not is_in
806
+ return is_in
807
808
if len(node.ops) == 1 and isinstance(node.ops[0], ast.Is):
809
raise RambleSyntaxError("Encountered unsupported operator `is`")
@@ -830,7 +833,7 @@ def _eval_comparisons(self, node):
830
833
raise SyntaxError("Unsupported binary comparison operator")
831
834
832
835
def _eval_comp_in(self, node):
- """Handle in nodes in the ast
836
+ """Handle in node in the ast
837
838
Perform extraction of `<variable> in <experiment>` syntax.
839
Raises an exception if the experiment does not exist.
lib/ramble/ramble/test/expander.py
@@ -73,11 +73,15 @@ def exp_dict():
73
(r"\\{experiment_name\\}", "baz", set(), 3),
74
('"2.1.1" in ["2.1.1", "3.1.1", "4.2.1"]', "True", set(), 1),
75
('"2.1.2" in ["2.1.1", "3.1.1", "4.2.1"]', "False", set(), 1),
76
+ ('"3.1.2" not in ["2.1.1", "3.1.1", "4.2.1"]', "True", set(), 1),
77
+ ('"2.1.1" not in ["2.1.1", "3.1.1", "4.2.1"]', "False", set(), 1),
78
("{test_mask}", "0x0", {"test_mask"}, 1),
79
('re_search(r"bz$", {experiment_name})', "False", set(), 1),
80
('re_search("o+\\\\.b", {env_name})', "True", set(), 1),
81
('"foo" in "{env_name}"', "True", set(), 1),
82
('"c" in "{experiment_name}"', "False", set(), 1),
83
+ ('"foo123" not in "{env_name}"', "True", set(), 1),
84
+ ('"foo" not in "{env_name}"', "False", set(), 1),
85
('"{env_name}"[:{max_len}:1]', "spack_foo", set(), 1),
86
],
87
)
0 commit comments