diff --git a/database.py b/database.py index a336317..2e0a58f 100644 --- a/database.py +++ b/database.py @@ -1,9 +1,7 @@ -import psycopg2 +from logging import Logger +import psycopg2 from psycopg2.extensions import connection from psycopg2.extras import DictCursor, DictRow - -from logging import Logger - from exceptions import DisplayableException from rss import FeedItem @@ -131,7 +129,7 @@ class Database: """Return a list of feeds the user is subscribed to.""" self.log.debug('find_user_feeds(user_id=\'%s\')', user_id) self.cur.execute('SELECT * FROM feeds WHERE id IN (SELECT feed_id FROM subscriptions WHERE user_id = %s)', - [user_id]) + [user_id]) return self.__dictrow_to_dict_list(self.cur.fetchall()) def find_feed_items(self, feed_id: int) -> list[dict]: @@ -184,4 +182,4 @@ class Database: @staticmethod def __dictrow_to_dict_list(rows: list[DictRow]) -> list[dict]: """Convert list of DictRows to list of dicts""" - return list(map(lambda x: dict(x), rows)) + return list(dict, rows)