code style changes
This commit is contained in:
parent
50ac344095
commit
2dde80f715
10
database.py
10
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)
|
||||
|
|
Loading…
Reference in a new issue