From 50ac34409544e1ec346266183f9a35860a62d81b Mon Sep 17 00:00:00 2001 From: mitsuha_s Date: Wed, 13 Jul 2022 20:50:03 +0000 Subject: [PATCH] rename __convert_to_list_of_dicts method to __dictrow_to_dict_list --- database.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/database.py b/database.py index 357bcc8..a336317 100644 --- a/database.py +++ b/database.py @@ -125,20 +125,20 @@ class Database: """Get a list of feeds.""" self.log.debug('find_feeds()') self.cur.execute('SELECT * FROM feeds') - return self.__convert_to_list_of_dicts(self.cur.fetchall()) + return self.__dictrow_to_dict_list(self.cur.fetchall()) def find_user_feeds(self, user_id: int) -> list[dict]: """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]) - return self.__convert_to_list_of_dicts(self.cur.fetchall()) + return self.__dictrow_to_dict_list(self.cur.fetchall()) def find_feed_items(self, feed_id: int) -> list[dict]: """Get last feed items.""" self.log.debug('find_feed_items(feed_id=\'%s\')', feed_id) self.cur.execute('SELECT * FROM feeds_last_items WHERE feed_id = %s', [feed_id]) - return self.__convert_to_list_of_dicts(self.cur.fetchall()) + return self.__dictrow_to_dict_list(self.cur.fetchall()) def find_feed_items_urls(self, feed_id: int) -> list[str]: """Return urls last feed items""" @@ -182,6 +182,6 @@ class Database: ) @staticmethod - def __convert_to_list_of_dicts(rows: list[DictRow]) -> list[dict]: + 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))