Skip to content

Commit 16747da

Browse files
committed
Format code with black
1 parent 63122ed commit 16747da

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

scalene/scalene_parseargs.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,19 +526,13 @@ def _add_run_arguments(
526526
"--on",
527527
action="store_true",
528528
help=(
529-
"start with profiling on (default)"
530-
if show_advanced
531-
else advanced_help
529+
"start with profiling on (default)" if show_advanced else advanced_help
532530
),
533531
)
534532
group.add_argument(
535533
"--off",
536534
action="store_true",
537-
help=(
538-
"start with profiling off"
539-
if show_advanced
540-
else advanced_help
541-
),
535+
help=("start with profiling off" if show_advanced else advanced_help),
542536
)
543537

544538
# Internal/hidden options (always hidden)

scalene/scalene_signal_manager.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,7 @@ def _lifecycle_watcher_loop_win32(
299299
)
300300
while self.__lifecycle_watcher_active:
301301
# Wait on both events with 100ms timeout
302-
result = _kernel32.WaitForMultipleObjects(
303-
2, handle_array, False, 100
304-
)
302+
result = _kernel32.WaitForMultipleObjects(2, handle_array, False, 100)
305303
if result == _WAIT_OBJECT_0:
306304
# Start event signaled
307305
with contextlib.suppress(Exception):
@@ -337,34 +335,32 @@ def signal_lifecycle_event(pid: int, start: bool) -> None:
337335
template = _LIFECYCLE_START_EVENT if start else _LIFECYCLE_STOP_EVENT
338336
event_name = template.format(pid=pid)
339337
# Need EVENT_MODIFY_STATE to call SetEvent
340-
handle = _kernel32.OpenEventW(
341-
_EVENT_MODIFY_STATE, False, event_name
342-
)
338+
handle = _kernel32.OpenEventW(_EVENT_MODIFY_STATE, False, event_name)
343339
if handle:
344340
_kernel32.SetEvent(handle)
345341
_kernel32.CloseHandle(handle)
346342
else:
347343
signals = ScaleneSignals()
348-
sig = signals.start_profiling_signal if start else signals.stop_profiling_signal
344+
sig = (
345+
signals.start_profiling_signal
346+
if start
347+
else signals.stop_profiling_signal
348+
)
349349
os.kill(pid, sig)
350350

351351
def send_lifecycle_start_to_child(self, pid: int) -> None:
352352
"""Send a start-profiling signal to a child process (cross-platform)."""
353353
if sys.platform == "win32":
354354
self.signal_lifecycle_event(pid, start=True)
355355
else:
356-
self.__orig_kill(
357-
pid, self.__signals.start_profiling_signal
358-
)
356+
self.__orig_kill(pid, self.__signals.start_profiling_signal)
359357

360358
def send_lifecycle_stop_to_child(self, pid: int) -> None:
361359
"""Send a stop-profiling signal to a child process (cross-platform)."""
362360
if sys.platform == "win32":
363361
self.signal_lifecycle_event(pid, start=False)
364362
else:
365-
self.__orig_kill(
366-
pid, self.__signals.stop_profiling_signal
367-
)
363+
self.__orig_kill(pid, self.__signals.stop_profiling_signal)
368364

369365
def send_signal_to_children(
370366
self, child_pids: "Set[int]", signal_type: signal.Signals

0 commit comments

Comments
 (0)