refactor: change name of self-documenting constant

The previous constant name implied that a user id was returned
 and that it cannot be relied upon. That is not the case. -1 is an
 error flag and the constant should identify it as such.
This commit is contained in:
Warren 2023-08-27 10:29:50 +10:00
parent af4ebebf44
commit 60f65668ed
1 changed files with 2 additions and 2 deletions

View File

@ -329,9 +329,9 @@ def get_user_id() -> int | None:
else: else:
# On other platforms, a return value of -1 is assumed to indicate that # On other platforms, a return value of -1 is assumed to indicate that
# the current process's real user id cannot be determined. # the current process's real user id cannot be determined.
UNRELIABLE = -1 ERROR = -1
uid = os.getuid() uid = os.getuid()
return uid if uid != UNRELIABLE else None return uid if uid != ERROR else None
# Perform exhaustiveness checking. # Perform exhaustiveness checking.