Skip to content

Commit 64be375

Browse files
committed
Ruff-ruff.
1 parent 35565a4 commit 64be375

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

scalene/scalene_neuron.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def _generate_config(self) -> str:
5151
}
5252
],
5353
}
54-
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".json")
54+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".json") # noqa: SIM115
5555
with open(temp_file.name, "w") as file:
5656
json.dump(config, file)
5757
return temp_file.name

scalene/scalene_profiler.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,10 +1164,7 @@ def _passes_exclusion_rules(filename: Filename) -> bool:
11641164

11651165
# Check explicit exclude patterns
11661166
profile_exclude_list = Scalene.__args.profile_exclude.split(",")
1167-
if any(prof in filename for prof in profile_exclude_list if prof != ""):
1168-
return False
1169-
1170-
return True
1167+
return not any(prof in filename for prof in profile_exclude_list if prof != ""):
11711168

11721169
@staticmethod
11731170
def _handle_jupyter_cell(filename: Filename) -> bool:
@@ -1188,9 +1185,7 @@ def _handle_jupyter_cell(filename: Filename) -> bool:
11881185
def _passes_profile_only_rules(filename: Filename) -> bool:
11891186
"""Check if filename passes profile-only patterns."""
11901187
profile_only_set = set(Scalene.__args.profile_only.split(","))
1191-
if profile_only_set and all(prof not in filename for prof in profile_only_set):
1192-
return False
1193-
return True
1188+
return not(profile_only_set and all(prof not in filename for prof in profile_only_set))
11941189

11951190
@staticmethod
11961191
def _should_trace_by_location(filename: Filename) -> bool:

0 commit comments

Comments
 (0)