Skip to content

Commit c43d820

Browse files
authored
refactor: use f-strings for __repr__
* Refactor __repr__ method in TinyDB class for clarity and consistency * Change double quotes to single quotes in the __repr__ method * Change from double quotes to single quotes in default_table_name
1 parent 2d02489 commit c43d820

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tinydb/database.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
This module contains the main component of TinyDB: the database.
33
"""
4+
45
from typing import Dict, Iterator, Set, Type
56

67
from . import JSONStorage
@@ -97,13 +98,12 @@ def __init__(self, *args, **kwargs) -> None:
9798
self._tables: Dict[str, Table] = {}
9899

99100
def __repr__(self):
101+
100102
args = [
101-
'tables={}'.format(list(self.tables())),
102-
'tables_count={}'.format(len(self.tables())),
103-
'default_table_documents_count={}'.format(self.__len__()),
104-
'all_tables_documents_count={}'.format(
105-
['{}={}'.format(table, len(self.table(table)))
106-
for table in self.tables()]),
103+
f'tables={list(self.tables())}',
104+
f'tables_count={len(self.tables())}',
105+
f'default_table_documents_count={self.__len__()}',
106+
f'all_tables_documents_count={[f"{table}={len(self.table(table))}" for table in self.tables()]}',
107107
]
108108

109109
return '<{} {}>'.format(type(self).__name__, ', '.join(args))

0 commit comments

Comments
 (0)