mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-14 15:57:16 +00:00
Improve names in EventHandlerFactoryBase to improve readability
This commit is contained in:
parent
9725f805ed
commit
ae69a094c7
@ -4,15 +4,15 @@ from .event_handler import EventHandler
|
|||||||
|
|
||||||
|
|
||||||
class EventHandlerFactoryBase:
|
class EventHandlerFactoryBase:
|
||||||
def build(self, event_handler, *, keys=None, event_handler_type=EventHandler):
|
def build(self, handler_stub, *, keys=None, event_handler_type=EventHandler):
|
||||||
builder = EventHandlerBuilder(event_handler, keys, event_handler_type)
|
builder = EventHandlerBuilder(handler_stub, keys, event_handler_type)
|
||||||
server_connector = self._build_server_connector()
|
server_connector = self._build_server_connector()
|
||||||
real_event_handler = builder.build(server_connector)
|
event_handler = builder.build(server_connector)
|
||||||
event_handler.server_connector = server_connector
|
handler_stub.server_connector = server_connector
|
||||||
with suppress(AttributeError):
|
with suppress(AttributeError):
|
||||||
event_handler.start()
|
handler_stub.start()
|
||||||
real_event_handler.start()
|
event_handler.start()
|
||||||
return real_event_handler
|
return event_handler
|
||||||
|
|
||||||
def _build_server_connector(self):
|
def _build_server_connector(self):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
@ -20,7 +20,7 @@ class EventHandlerFactoryBase:
|
|||||||
|
|
||||||
class EventHandlerBuilder:
|
class EventHandlerBuilder:
|
||||||
def __init__(self, event_handler, supplied_keys, event_handler_type):
|
def __init__(self, event_handler, supplied_keys, event_handler_type):
|
||||||
self._analyzer = EventHandlerAnalyzer(event_handler, supplied_keys)
|
self._analyzer = HandlerStubAnalyzer(event_handler, supplied_keys)
|
||||||
self._event_handler_type = event_handler_type
|
self._event_handler_type = event_handler_type
|
||||||
|
|
||||||
def build(self, server_connector):
|
def build(self, server_connector):
|
||||||
@ -40,7 +40,7 @@ class EventHandlerBuilder:
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
class EventHandlerAnalyzer:
|
class HandlerStubAnalyzer:
|
||||||
def __init__(self, event_handler, supplied_keys):
|
def __init__(self, event_handler, supplied_keys):
|
||||||
self._event_handler = event_handler
|
self._event_handler = event_handler
|
||||||
self._supplied_keys = supplied_keys
|
self._supplied_keys = supplied_keys
|
||||||
|
Loading…
Reference in New Issue
Block a user