Skip to content

Commit 739779c

Browse files
committed
Remove Client objects representation
1 parent dcbce9f commit 739779c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

pyrogram/api/core/object.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,15 @@ def default(self, o: Object):
7272
else:
7373
return repr(o)
7474

75-
if objects.get(getattr(o, "ID", "")).startswith("pyrogram.client"):
76-
return remove_none(OrderedDict([i for i in content.items()]))
75+
o = objects.get(getattr(o, "ID", None), None)
76+
77+
if o is not None:
78+
if o.startswith("pyrogram.client"):
79+
r = remove_none(OrderedDict([i for i in content.items()]))
80+
r.pop("client", None)
81+
82+
return r
83+
else:
84+
return OrderedDict([("_", o)] + [i for i in content.items()])
7785
else:
78-
return OrderedDict(
79-
[("_", objects.get(getattr(o, "ID", None), None))]
80-
+ [i for i in content.items()]
81-
)
86+
return None

0 commit comments

Comments
 (0)