Skip to content

Commit

Permalink
lint code
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Mar 14, 2024
1 parent 45125b4 commit 3182d58
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions seal5/transform/filter_model/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,15 @@ def opcodes_helper(x):

def check_filter_regex(name, keep, drop):
if drop and keep:
return not any(re.compile(expr).match(name) for expr in drop) and any(re.compile(expr).match(name) for expr in keep)
return not any(re.compile(expr).match(name) for expr in drop) and any(
re.compile(expr).match(name) for expr in keep
)
elif keep:
return any(re.compile(expr).match(name) for expr in keep)
elif drop:
return not any(re.compile(expr).match(name) for expr in drop)
return True


def check_encoding_filter(enc, keep, drop, keep2, drop2):
opcode = None
size = 0
Expand Down Expand Up @@ -236,7 +237,9 @@ def check_encoding_filter(enc, keep, drop, keep2, drop2):
return True

model["sets"] = {
set_name: set_def for set_name, set_def in model["sets"].items() if check_filter_regex(set_name, keep_sets, drop_sets)
set_name: set_def
for set_name, set_def in model["sets"].items()
if check_filter_regex(set_name, keep_sets, drop_sets)
}
for set_name, set_def in model["sets"].items():
set_def.instructions = {
Expand Down

0 comments on commit 3182d58

Please sign in to comment.