Skip to content

[psutil] Replace FloatInt in arguments and usage percentages - #16985

Open
alienxviking wants to merge 1 commit into
python:mainfrom
alienxviking:psutil-floatint-args-percent
Open

alienxviking wants to merge 1 commit into
python:mainfrom
alienxviking:psutil-floatint-args-percent

Conversation

@alienxviking

Copy link
Copy Markdown

Part of #16059.

  • Arguments (timeout, interval, ctime, usage_percent(total=...), TimeoutExpired(seconds)) become float | int. TimeoutExpired.seconds and INIT_BOOT_TIME stay float | int: the first stores the argument as passed, and the second falls back to 0 when boot_time() fails at import (source).
  • The percent fields of svmem, sswap and sdiskusage are float on every platform. They all come from usage_percent(), which returns either round(float(used) / total * 100, 1) or 0.0 (source). The one exception is Windows swap, which is round() of a C double or of 0.0 (source).
  • wait_pid_posix(_sleep=...) is only ever called with the float poll interval (source), so it becomes Callable[[float], None].

The CPU-time, frequency and temperature fields need a per-platform check of the C extensions, so I've left them for a follow-up PR.

Prepared with Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

This branch has not been deployed

No deployments
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.

1 participant