From 5e7231408ed74d4127dd3c3e71a8a7267e23c3ef Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 24 Sep 2019 02:51:06 +0000 Subject: [PATCH] add type hints git-svn-id: https://xpra.org/svn/Xpra/trunk@23915 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/server/auth/file_auth.py | 3 ++- src/xpra/server/auth/sys_auth_base.py | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/xpra/server/auth/file_auth.py b/src/xpra/server/auth/file_auth.py index 27fb4b5bc1..2898489703 100644 --- a/src/xpra/server/auth/file_auth.py +++ b/src/xpra/server/auth/file_auth.py @@ -12,7 +12,8 @@ class Authenticator(FileAuthenticatorBase): - def authenticate_hmac(self, challenge_response, client_salt=None): + def authenticate_hmac(self, challenge_response, client_salt=None) -> bool: + log("file_auth.authenticate_hmac(%r, %r)", challenge_response, client_salt) if not self.salt: log.error("Error: illegal challenge response received - salt cleared or unset") return None diff --git a/src/xpra/server/auth/sys_auth_base.py b/src/xpra/server/auth/sys_auth_base.py index 52ba24a3d3..813f0134b1 100644 --- a/src/xpra/server/auth/sys_auth_base.py +++ b/src/xpra/server/auth/sys_auth_base.py @@ -19,7 +19,7 @@ DEFAULT_GID = os.environ.get("XPRA_AUTHENTICATION_DEFAULT_GID", "nobody") -def parse_uid(v): +def parse_uid(v) -> int: if v: try: return int(v) @@ -35,7 +35,7 @@ def parse_uid(v): return os.getuid() return -1 -def parse_gid(v): +def parse_gid(v) -> int: if v: try: return int(v) @@ -71,10 +71,10 @@ def __init__(self, username, **kwargs): log.warn("Warning: unused keyword arguments for %s authentication:", self) log.warn(" %s", unused) - def get_uid(self): + def get_uid(self) -> int: raise NotImplementedError() - def get_gid(self): + def get_gid(self) -> int: raise NotImplementedError() def requires_challenge(self): @@ -146,6 +146,7 @@ def authenticate_check(self, challenge_response, client_salt=None) -> bool: return ret def authenticate_hmac(self, challenge_response, client_salt=None) -> bool: + log("sys_auth_base.authenticate_hmac(%r, %r)", challenge_response, client_salt) if not self.salt: log.error("Error: illegal challenge response received - salt cleared or unset") return None @@ -199,12 +200,12 @@ def __init__(self, username, **kwargs): except Exception: log("cannot load password database entry for '%s'", username, exc_info=True) - def get_uid(self): + def get_uid(self) -> int: if self.pw is None: raise Exception("username '%s' not found" % self.username) return self.pw.pw_uid - def get_gid(self): + def get_gid(self) -> int: if self.pw is None: raise Exception("username '%s' not found" % self.username) return self.pw.pw_gid