Description
The Python bindings use platform.system() for detecting Windows to run platform-specific code in many places. This works fine, but we run into issues with our type checker (mypy). It doesn't respect platform.system(), so we get type errors in some of our platform-specific code when the type checker runs on other platforms. see: comments on #16250
mypy does do the right thing if you use sys.platform for platform detection instead:
https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks
We should investigate where we are using platform.system() and switch to sys.platform if possible.
Reproducible Code
if platform.system() == "Windows"
Description
The Python bindings use
platform.system()for detecting Windows to run platform-specific code in many places. This works fine, but we run into issues with our type checker (mypy). It doesn't respectplatform.system(), so we get type errors in some of our platform-specific code when the type checker runs on other platforms. see: comments on #16250mypy does do the right thing if you use
sys.platformfor platform detection instead:https://mypy.readthedocs.io/en/stable/common_issues.html#python-version-and-system-platform-checks
We should investigate where we are using
platform.system()and switch tosys.platformif possible.Reproducible Code