Skip to content

fix: resolve isort, black, and mypy lint in dynamic_profiling_management#1021

Merged
artursarlo merged 1 commit intodynamic_profilingfrom
dynamic_profiling_lint_fix
Mar 11, 2026
Merged

fix: resolve isort, black, and mypy lint in dynamic_profiling_management#1021
artursarlo merged 1 commit intodynamic_profilingfrom
dynamic_profiling_lint_fix

Conversation

@marc-queiroz
Copy link
Copy Markdown

Description

Lint fixes for the dynamic_profiling branch so CI (isort, black, flake8, mypy) passes.

  • isort: Fix import order in gprofiler/main.py and in all gprofiler/dynamic_profiling_management modules (alphabetical and typing order).
  • black: Reformat one multi-line logger.info in heartbeat.py to a single line within the line-length limit.
  • mypy: Add and fix type annotations across the dynamic profiling code: return types for CommandManager.__init__, clear_queues, ProfilerSlotBase.__init__, and ContinuousProfilerSlot.__init__; type for heartbeat_client; ensure output_dir passed to GProfiler is a str; call maybe_cleanup_subprocesses via getattr so mypy does not require it on GProfiler; in heartbeat.py, add cast for return values and guard Optional[ProfilingCommand] before use.

Related Issue

Motivation and Context

The dynamic_profiling branch was failing CI due to isort, black, and mypy errors. These changes bring the branch in line with the project’s lint and type-check rules without changing behavior.

How Has This Been Tested?

  • Create a new python environment.
  • Installed the python libraries using the dev-requirements.txt and requirements.txt, following the CONTRIBUTING documentation.
  • Ran ./lint.sh --ci with the project venv (.venv/bin/activate). Isort, black, flake8, and mypy all pass.

Screenshots

N/A

Checklist:

  • I have read the CONTRIBUTING document.
  • I have updated the relevant documentation.
  • I have added tests for new logic.

- isort: fix import order (main.py and dynamic_profiling_management modules)
- black: single-line logger in heartbeat.py
- mypy: add return/arg types (CommandManager, clear_queues, ProfilerSlotBase,
  ContinuousProfilerSlot), fix output_dir type for GProfiler, use getattr for
  maybe_cleanup_subprocesses, add casts and Optional guards in heartbeat.py
Copy link
Copy Markdown

@artursarlo artursarlo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Pretty straightforward lint fixes

@artursarlo artursarlo merged commit 76032e7 into dynamic_profiling Mar 11, 2026
31 of 35 checks passed
@artursarlo artursarlo deleted the dynamic_profiling_lint_fix branch March 11, 2026 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants