Cleanup EventHandler.process() method and use AssertionError
This commit is contained in:
parent
06efe1a169
commit
088b555ae0
1 changed files with 7 additions and 2 deletions
|
@ -165,14 +165,19 @@ class EventHandler(Dependant):
|
||||||
return f'0x{addr:X}'
|
return f'0x{addr:X}'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def process(cls, events: List[DictEvent], **kwargs) -> 'EventHandler':
|
def process(
|
||||||
|
cls,
|
||||||
|
events: List[DictEvent],
|
||||||
|
**kwargs,
|
||||||
|
) -> 'EventHandler':
|
||||||
"""
|
"""
|
||||||
Create a `Processor` and process an instance of the class.
|
Create a `Processor` and process an instance of the class.
|
||||||
|
|
||||||
:param events: the list of events
|
:param events: the list of events
|
||||||
:return: the processor object after processing
|
:return: the processor object after processing
|
||||||
"""
|
"""
|
||||||
assert cls != EventHandler, 'only call process() from inheriting classes'
|
if cls == EventHandler:
|
||||||
|
raise AssertionError('only call EventHandler.process() from inheriting classes')
|
||||||
handler_object = cls(**kwargs) # pylint: disable=all
|
handler_object = cls(**kwargs) # pylint: disable=all
|
||||||
processor = Processor(handler_object, **kwargs)
|
processor = Processor(handler_object, **kwargs)
|
||||||
processor.process(events)
|
processor.process(events)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue