mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Type annotations
Add some type annotations to help PyCharm (in particular) to figure out the types of a bunch of things.
This commit is contained in:
parent
b9e997f561
commit
3413f1e284
@ -36,6 +36,10 @@ class BaseHandler(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
hs (synapse.server.HomeServer):
|
||||||
|
"""
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self.notifier = hs.get_notifier()
|
self.notifier = hs.get_notifier()
|
||||||
|
@ -45,6 +45,10 @@ class AuthHandler(BaseHandler):
|
|||||||
SESSION_EXPIRE_MS = 48 * 60 * 60 * 1000
|
SESSION_EXPIRE_MS = 48 * 60 * 60 * 1000
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
hs (synapse.server.HomeServer):
|
||||||
|
"""
|
||||||
super(AuthHandler, self).__init__(hs)
|
super(AuthHandler, self).__init__(hs)
|
||||||
self.checkers = {
|
self.checkers = {
|
||||||
LoginType.PASSWORD: self._check_password_auth,
|
LoginType.PASSWORD: self._check_password_auth,
|
||||||
|
@ -52,6 +52,10 @@ class ClientV1RestServlet(RestServlet):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
hs (synapse.server.HomeServer):
|
||||||
|
"""
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
self.handlers = hs.get_handlers()
|
self.handlers = hs.get_handlers()
|
||||||
self.builder_factory = hs.get_event_builder_factory()
|
self.builder_factory = hs.get_event_builder_factory()
|
||||||
|
@ -52,6 +52,10 @@ class RegisterRestServlet(ClientV1RestServlet):
|
|||||||
PATTERNS = client_path_patterns("/register$", releases=(), include_in_unstable=False)
|
PATTERNS = client_path_patterns("/register$", releases=(), include_in_unstable=False)
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
hs (synapse.server.HomeServer): server
|
||||||
|
"""
|
||||||
super(RegisterRestServlet, self).__init__(hs)
|
super(RegisterRestServlet, self).__init__(hs)
|
||||||
# sessions are stored as:
|
# sessions are stored as:
|
||||||
# self.sessions = {
|
# self.sessions = {
|
||||||
|
@ -45,6 +45,10 @@ class RegisterRequestTokenRestServlet(RestServlet):
|
|||||||
PATTERNS = client_v2_patterns("/register/email/requestToken$")
|
PATTERNS = client_v2_patterns("/register/email/requestToken$")
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
hs (synapse.server.HomeServer): server
|
||||||
|
"""
|
||||||
super(RegisterRequestTokenRestServlet, self).__init__()
|
super(RegisterRequestTokenRestServlet, self).__init__()
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
self.identity_handler = hs.get_handlers().identity_handler
|
self.identity_handler = hs.get_handlers().identity_handler
|
||||||
@ -77,7 +81,12 @@ class RegisterRestServlet(RestServlet):
|
|||||||
PATTERNS = client_v2_patterns("/register$")
|
PATTERNS = client_v2_patterns("/register$")
|
||||||
|
|
||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
hs (synapse.server.HomeServer): server
|
||||||
|
"""
|
||||||
super(RegisterRestServlet, self).__init__()
|
super(RegisterRestServlet, self).__init__()
|
||||||
|
|
||||||
self.hs = hs
|
self.hs = hs
|
||||||
self.auth = hs.get_auth()
|
self.auth = hs.get_auth()
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
|
21
synapse/server.pyi
Normal file
21
synapse/server.pyi
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import synapse.handlers
|
||||||
|
import synapse.handlers.auth
|
||||||
|
import synapse.handlers.device
|
||||||
|
import synapse.storage
|
||||||
|
import synapse.state
|
||||||
|
|
||||||
|
class HomeServer(object):
|
||||||
|
def get_auth_handler(self) -> synapse.handlers.auth.AuthHandler:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_datastore(self) -> synapse.storage.DataStore:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_device_handler(self) -> synapse.handlers.device.DeviceHandler:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_handlers(self) -> synapse.handlers.Handlers:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_state_handler(self) -> synapse.state.StateHandler:
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user