1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Replace for loops with comprehensions

This commit is contained in:
monosans
2021-07-19 20:01:37 +03:00
parent d09d9f0c09
commit 097ba9fec2
3 changed files with 12 additions and 26 deletions

View File

@@ -81,13 +81,10 @@ class JsonDeserializable(object):
raise ValueError("json_type should be a json dict or string.")
def __str__(self):
d = {}
for x, y in self.__dict__.items():
if hasattr(y, '__dict__'):
d[x] = y.__dict__
else:
d[x] = y
d = {
x: y.__dict__ if hasattr(y, '__dict__') else y
for x, y in self.__dict__.items()
}
return str(d)