diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-03-24 06:49:01 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-24 06:49:01 -0400 |
commit | af387cf52ac4641e7d5ade75d3483b0c41d05ebf (patch) | |
tree | d384b1fc0bfa9932fed7cbebfa184e4087982986 /synapse/secrets.py | |
parent | Add a type hints for service notices to the HomeServer object. (#9675) (diff) | |
download | synapse-af387cf52ac4641e7d5ade75d3483b0c41d05ebf.tar.xz |
Add type hints to misc. files. (#9676)
Diffstat (limited to 'synapse/secrets.py')
-rw-r--r-- | synapse/secrets.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/synapse/secrets.py b/synapse/secrets.py index fb6d90a3b7..7939db75e7 100644 --- a/synapse/secrets.py +++ b/synapse/secrets.py @@ -26,10 +26,10 @@ if sys.version_info[0:2] >= (3, 6): import secrets class Secrets: - def token_bytes(self, nbytes=32): + def token_bytes(self, nbytes: int = 32) -> bytes: return secrets.token_bytes(nbytes) - def token_hex(self, nbytes=32): + def token_hex(self, nbytes: int = 32) -> str: return secrets.token_hex(nbytes) @@ -38,8 +38,8 @@ else: import os class Secrets: - def token_bytes(self, nbytes=32): + def token_bytes(self, nbytes: int = 32) -> bytes: return os.urandom(nbytes) - def token_hex(self, nbytes=32): + def token_hex(self, nbytes: int = 32) -> str: return binascii.hexlify(self.token_bytes(nbytes)).decode("ascii") |