apply isort and black formatters, add format checking to CI

This commit is contained in:
adbenitez
2022-05-29 21:11:49 -04:00
parent 62b50c87d4
commit 16e0f0e986
26 changed files with 899 additions and 575 deletions

View File

@@ -2,7 +2,6 @@
import pluggy
account_spec_name = "deltachat-account"
account_hookspec = pluggy.HookspecMarker(account_spec_name)
account_hookimpl = pluggy.HookimplMarker(account_spec_name)
@@ -13,12 +12,13 @@ global_hookimpl = pluggy.HookimplMarker(global_spec_name)
class PerAccount:
""" per-Account-instance hook specifications.
"""per-Account-instance hook specifications.
All hooks are executed in a dedicated Event thread.
Hooks are generally not allowed to block/last long as this
blocks overall event processing on the python side.
"""
@classmethod
def _make_plugin_manager(cls):
pm = pluggy.PluginManager(account_spec_name)
@@ -27,7 +27,7 @@ class PerAccount:
@account_hookspec
def ac_process_ffi_event(self, ffi_event):
""" process a CFFI low level events for a given account.
"""process a CFFI low level events for a given account.
ffi_event has "name", "data1", "data2" values as specified
with `DC_EVENT_* <https://c.delta.chat/group__DC__EVENT.html>`_.
@@ -35,37 +35,37 @@ class PerAccount:
@account_hookspec
def ac_log_line(self, message):
""" log a message related to the account. """
"""log a message related to the account."""
@account_hookspec
def ac_configure_completed(self, success):
""" Called after a configure process completed. """
"""Called after a configure process completed."""
@account_hookspec
def ac_incoming_message(self, message):
""" Called on any incoming message (both existing chats and contact requests). """
"""Called on any incoming message (both existing chats and contact requests)."""
@account_hookspec
def ac_outgoing_message(self, message):
""" Called on each outgoing message (both system and "normal")."""
"""Called on each outgoing message (both system and "normal")."""
@account_hookspec
def ac_message_delivered(self, message):
""" Called when an outgoing message has been delivered to SMTP.
"""Called when an outgoing message has been delivered to SMTP.
:param message: Message that was just delivered.
"""
@account_hookspec
def ac_chat_modified(self, chat):
""" Chat was created or modified regarding membership, avatar, title.
"""Chat was created or modified regarding membership, avatar, title.
:param chat: Chat which was modified.
"""
@account_hookspec
def ac_member_added(self, chat, contact, actor, message):
""" Called for each contact added to an accepted chat.
"""Called for each contact added to an accepted chat.
:param chat: Chat where contact was added.
:param contact: Contact that was added.
@@ -75,7 +75,7 @@ class PerAccount:
@account_hookspec
def ac_member_removed(self, chat, contact, actor, message):
""" Called for each contact removed from a chat.
"""Called for each contact removed from a chat.
:param chat: Chat where contact was removed.
:param contact: Contact that was removed.
@@ -85,10 +85,11 @@ class PerAccount:
class Global:
""" global hook specifications using a per-process singleton
"""global hook specifications using a per-process singleton
plugin manager instance.
"""
_plugin_manager = None
@classmethod
@@ -100,11 +101,11 @@ class Global:
@global_hookspec
def dc_account_init(self, account):
""" called when `Account::__init__()` function starts executing. """
"""called when `Account::__init__()` function starts executing."""
@global_hookspec
def dc_account_extra_configure(self, account):
""" Called when account configuration successfully finished.
"""Called when account configuration successfully finished.
This hook can be used to perform extra work before
ac_configure_completed is called.
@@ -112,4 +113,4 @@ class Global:
@global_hookspec
def dc_account_after_shutdown(self, account):
""" Called after the account has been shutdown. """
"""Called after the account has been shutdown."""