Cleaned up the pep8

This commit is contained in:
Andrew Bastien 2020-04-12 13:00:47 -07:00
parent 58230504c5
commit 0639d43ddc
7 changed files with 13 additions and 18 deletions

View file

@ -464,6 +464,6 @@ class PortalSessionHandler(SessionHandler):
log_trace() log_trace()
_portal_sessionhandler_class = class_from_module(settings.PORTAL_SESSION_HANDLER_CLASS) _PORTAL_SESSION_HANDLER_CLASS = class_from_module(settings.PORTAL_SESSION_HANDLER_CLASS)
PORTAL_SESSIONS = _portal_sessionhandler_class() PORTAL_SESSIONS = _PORTAL_SESSION_HANDLER_CLASS()

View file

@ -73,7 +73,7 @@ and put them here:
_PRIVATE_KEY_FILE, _PUBLIC_KEY_FILE _PRIVATE_KEY_FILE, _PUBLIC_KEY_FILE
) )
_BASE_SESSION = class_from_module(settings.BASE_SESSION_CLASS) _BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS)
# not used atm # not used atm
@ -85,7 +85,7 @@ class SSHServerFactory(protocol.ServerFactory):
return "SSH" return "SSH"
class SshProtocol(Manhole, _BASE_SESSION): class SshProtocol(Manhole, _BASE_SESSION_CLASS):
""" """
Each account connecting over ssh gets this protocol assigned to Each account connecting over ssh gets this protocol assigned to
them. All communication between game and account goes through them. All communication between game and account goes through

View file

@ -43,10 +43,10 @@ example (linux, using the openssl program):
{exestring} {exestring}
""" """
_TELNET_PROTOCOL = class_from_module(settings.TELNET_PROTOCOL_CLASS) _TELNET_PROTOCOL_CLASS = class_from_module(settings.TELNET_PROTOCOL_CLASS)
class SSLProtocol(_TELNET_PROTOCOL): class SSLProtocol(_TELNET_PROTOCOL_CLASS):
""" """
Communication is the same as telnet, except data transfer Communication is the same as telnet, except data transfer
is done with encryption. is done with encryption.

View file

@ -55,7 +55,7 @@ _HTTP_WARNING = bytes(
) )
_BASE_SESSION = class_from_module(settings.BASE_SESSION_CLASS) _BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS)
@ -67,7 +67,7 @@ class TelnetServerFactory(protocol.ServerFactory):
return "Telnet" return "Telnet"
class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION): class TelnetProtocol(Telnet, StatefulTelnetProtocol, _BASE_SESSION_CLASS):
""" """
Each player connecting over telnet (ie using most traditional mud Each player connecting over telnet (ie using most traditional mud
clients) gets a telnet protocol instance assigned to them. All clients) gets a telnet protocol instance assigned to them. All

View file

@ -37,10 +37,10 @@ CLOSE_NORMAL = WebSocketServerProtocol.CLOSE_STATUS_CODE_NORMAL
# called when the browser is navigating away from the page # called when the browser is navigating away from the page
GOING_AWAY = WebSocketServerProtocol.CLOSE_STATUS_CODE_GOING_AWAY GOING_AWAY = WebSocketServerProtocol.CLOSE_STATUS_CODE_GOING_AWAY
_BASE_SESSION = class_from_module(settings.BASE_SESSION_CLASS) _BASE_SESSION_CLASS = class_from_module(settings.BASE_SESSION_CLASS)
class WebSocketClient(WebSocketServerProtocol, _BASE_SESSION): class WebSocketClient(WebSocketServerProtocol, _BASE_SESSION_CLASS):
""" """
Implements the server-side of the Websocket connection. Implements the server-side of the Websocket connection.
""" """

View file

@ -35,9 +35,6 @@ class Session(object):
""" """
# names of attributes that should be affected by syncing.
_attrs_to_sync = settings.SESSION_SYNC_ATTRS
def init_session(self, protocol_key, address, sessionhandler): def init_session(self, protocol_key, address, sessionhandler):
""" """
Initialize the Session. This should be called by the protocol when Initialize the Session. This should be called by the protocol when
@ -104,9 +101,7 @@ class Session(object):
the keys given by self._attrs_to_sync. the keys given by self._attrs_to_sync.
""" """
return dict( return {attr: getattr(self, attr, None) for attr in settings.SESSION_SYNC_ATTRS}
(key, value) for key, value in self.__dict__.items() if key in self._attrs_to_sync
)
def load_sync_data(self, sessdata): def load_sync_data(self, sessdata):
""" """

View file

@ -859,8 +859,8 @@ class ServerSessionHandler(SessionHandler):
# import class from settings # import class from settings
_session_handler_class = class_from_module(settings.SERVER_SESSION_HANDLER_CLASS) _SESSION_HANDLER_CLASS = class_from_module(settings.SERVER_SESSION_HANDLER_CLASS)
# Instantiate class. These globals are used to provide singleton-like behavior. # Instantiate class. These globals are used to provide singleton-like behavior.
SESSION_HANDLER = _session_handler_class() SESSION_HANDLER = _SESSION_HANDLER_CLASS()
SESSIONS = SESSION_HANDLER # legacy SESSIONS = SESSION_HANDLER # legacy