🚨 remove linter error

This commit is contained in:
yanyongyu 2021-07-07 14:09:03 +08:00
parent f42d578765
commit aaed345a20

View File

@ -75,14 +75,14 @@ class Event(BaseEvent):
if event_class is None: if event_class is None:
return Event.parse_obj(data) return Event.parse_obj(data)
while issubclass(event_class, Event): while event_class and issubclass(event_class, Event):
try: try:
return event_class.parse_obj(data) return event_class.parse_obj(data)
except ValidationError as e: except ValidationError as e:
logger.info( logger.info(
f'Failed to parse {data} to class {event_class.__name__}: ' f'Failed to parse {data} to class {event_class.__name__}: '
f'{e.errors()!r}. Fallback to parent class.') f'{e.errors()!r}. Fallback to parent class.')
event_class = event_class.__base__ event_class = event_class.__base__ # type: ignore
raise ValueError(f'Failed to serialize {data}.') raise ValueError(f'Failed to serialize {data}.')