diff --git a/butterrobot/db.py b/butterrobot/db.py index 5a6a130..547a1f2 100644 --- a/butterrobot/db.py +++ b/butterrobot/db.py @@ -3,8 +3,8 @@ from typing import Union import dataset -from butterrobot.config import DATABASE_PATH, SECRET_KEY -from butterrobot.objects import Channel, ChannelPlugin, User +from butterrobot.config import SECRET_KEY, DATABASE_PATH +from butterrobot.objects import User, Channel, ChannelPlugin db = dataset.connect(DATABASE_PATH) @@ -25,7 +25,7 @@ class Query: yield cls.obj(**row) @classmethod - def get(cls, **kwargs) -> "class": + def get(cls, **kwargs): """ Returns the object representation of an specific row in a table. Allows retrieving object by multiple columns. @@ -153,7 +153,9 @@ class ChannelPluginQuery(Query): @classmethod def get_from_channel_id(cls, channel_id): - yield from [cls.obj(**row) for row in db[cls.tablename].find(channel_id=channel_id)] + yield from [ + cls.obj(**row) for row in db[cls.tablename].find(channel_id=channel_id) + ] @classmethod def delete_by_channel(cls, channel_id): diff --git a/butterrobot/platforms/base.py b/butterrobot/platforms/base.py index f92d665..a5d778e 100644 --- a/butterrobot/platforms/base.py +++ b/butterrobot/platforms/base.py @@ -36,7 +36,7 @@ class Platform: @classmethod @abstractmethod - def parse_incoming_message(cls, request) -> 'Message': + def parse_incoming_message(cls, request): """ Parses the incoming request and returns a :class:`butterrobot.objects.Message` instance. """ @@ -52,7 +52,7 @@ class Platform: @classmethod @abstractmethod - def parse_channel_from_message(cls, channel_raw) -> 'Channel': + def parse_channel_from_message(cls, channel_raw): """ Extracts the Channel raw data from the message received in the incoming webhook. """ @@ -62,6 +62,6 @@ class Platform: class PlatformMethods: @classmethod @abstractmethod - def send_message(cls, message: 'Message'): + def send_message(cls, message): """Method used to send a message via the platform""" pass diff --git a/tests/test_objects.py b/tests/test_objects.py index 1388dbd..ffab485 100644 --- a/tests/test_objects.py +++ b/tests/test_objects.py @@ -7,9 +7,11 @@ def test_channel_has_enabled_plugin_ok(): platform_channel_id="debug", channel_raw={}, plugins={ - "enabled": ChannelPlugin(id=1, channel_id="test", plugin_id="enabled", enabled=True), + "enabled": ChannelPlugin( + id=1, channel_id="test", plugin_id="enabled", enabled=True + ), "existant": ChannelPlugin(id=2, channel_id="test", plugin_id="existant"), - } + }, ) assert not channel.has_enabled_plugin("non.existant") assert not channel.has_enabled_plugin("existant")