mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
Fix code style with black
This commit is contained in:
@@ -259,25 +259,25 @@ class EventThread(threading.Thread):
|
|||||||
self._process_event(event)
|
self._process_event(event)
|
||||||
|
|
||||||
def _process_event(self, event) -> None:
|
def _process_event(self, event) -> None:
|
||||||
evt = lib.dc_event_get_id(event)
|
evt = lib.dc_event_get_id(event)
|
||||||
data1 = lib.dc_event_get_data1_int(event)
|
data1 = lib.dc_event_get_data1_int(event)
|
||||||
# the following code relates to the deltachat/_build.py's helper
|
# the following code relates to the deltachat/_build.py's helper
|
||||||
# function which provides us signature info of an event call
|
# function which provides us signature info of an event call
|
||||||
evt_name = get_dc_event_name(evt)
|
evt_name = get_dc_event_name(evt)
|
||||||
if lib.dc_event_has_string_data(evt):
|
if lib.dc_event_has_string_data(evt):
|
||||||
data2 = from_optional_dc_charpointer(lib.dc_event_get_data2_str(event))
|
data2 = from_optional_dc_charpointer(lib.dc_event_get_data2_str(event))
|
||||||
else:
|
else:
|
||||||
data2 = lib.dc_event_get_data2_int(event)
|
data2 = lib.dc_event_get_data2_int(event)
|
||||||
|
|
||||||
lib.dc_event_unref(event)
|
lib.dc_event_unref(event)
|
||||||
ffi_event = FFIEvent(name=evt_name, data1=data1, data2=data2)
|
ffi_event = FFIEvent(name=evt_name, data1=data1, data2=data2)
|
||||||
with self.swallow_and_log_exception(f"ac_process_ffi_event {ffi_event}"):
|
with self.swallow_and_log_exception(f"ac_process_ffi_event {ffi_event}"):
|
||||||
self.account._pm.hook.ac_process_ffi_event(account=self, ffi_event=ffi_event)
|
self.account._pm.hook.ac_process_ffi_event(account=self, ffi_event=ffi_event)
|
||||||
for name, kwargs in self._map_ffi_event(ffi_event):
|
for name, kwargs in self._map_ffi_event(ffi_event):
|
||||||
hook = getattr(self.account._pm.hook, name)
|
hook = getattr(self.account._pm.hook, name)
|
||||||
info = f"call {name} kwargs={kwargs} failed"
|
info = f"call {name} kwargs={kwargs} failed"
|
||||||
with self.swallow_and_log_exception(info):
|
with self.swallow_and_log_exception(info):
|
||||||
hook(**kwargs)
|
hook(**kwargs)
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def swallow_and_log_exception(self, info):
|
def swallow_and_log_exception(self, info):
|
||||||
|
|||||||
Reference in New Issue
Block a user