Revert sys.platform verification to simple comparison (#11998)

As the comment above it states, we need to keep the comparison simple so mypy can understand it, otherwise it will fail to properly handle this on Windows and will flag ``os.getuid()`` missing.
This commit is contained in:
Bruno Oliveira 2024-02-17 16:10:21 -03:00 committed by GitHub
parent aebeb33137
commit 5f241f388b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -289,7 +289,7 @@ def get_user_id() -> int | None:
# mypy follows the version and platform checking expectation of PEP 484:
# https://mypy.readthedocs.io/en/stable/common_issues.html?highlight=platform#python-version-and-system-platform-checks
# Containment checks are too complex for mypy v1.5.0 and cause failure.
if sys.platform in {"win32", "emscripten"}:
if sys.platform == "win32" or sys.platform == "emscripten": # noqa: PLR1714
# win32 does not have a getuid() function.
# Emscripten has a return 0 stub.
return None