mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-12 19:27:17 +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:
|
||||
def build(self, event_handler, *, keys=None, event_handler_type=EventHandler):
|
||||
builder = EventHandlerBuilder(event_handler, keys, event_handler_type)
|
||||
def build(self, handler_stub, *, keys=None, event_handler_type=EventHandler):
|
||||
builder = EventHandlerBuilder(handler_stub, keys, event_handler_type)
|
||||
server_connector = self._build_server_connector()
|
||||
real_event_handler = builder.build(server_connector)
|
||||
event_handler.server_connector = server_connector
|
||||
event_handler = builder.build(server_connector)
|
||||
handler_stub.server_connector = server_connector
|
||||
with suppress(AttributeError):
|
||||
event_handler.start()
|
||||
real_event_handler.start()
|
||||
return real_event_handler
|
||||
handler_stub.start()
|
||||
event_handler.start()
|
||||
return event_handler
|
||||
|
||||
def _build_server_connector(self):
|
||||
raise NotImplementedError()
|
||||
@ -20,7 +20,7 @@ class EventHandlerFactoryBase:
|
||||
|
||||
class EventHandlerBuilder:
|
||||
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
|
||||
|
||||
def build(self, server_connector):
|
||||
@ -40,7 +40,7 @@ class EventHandlerBuilder:
|
||||
raise
|
||||
|
||||
|
||||
class EventHandlerAnalyzer:
|
||||
class HandlerStubAnalyzer:
|
||||
def __init__(self, event_handler, supplied_keys):
|
||||
self._event_handler = event_handler
|
||||
self._supplied_keys = supplied_keys
|
||||
|
Loading…
Reference in New Issue
Block a user