improved PA class __repr() to handle bytes and thumbnails and remove internal sql alchemy
This commit is contained in:
10
shared.py
10
shared.py
@@ -10,7 +10,15 @@ class PA:
|
||||
def __repr__(self):
|
||||
str=f"<{self.__class__.__name__}("
|
||||
for k, v in self.__dict__.items():
|
||||
str += f"{k}={v!r}, "
|
||||
if isinstance(v, (bytes, bytearray)):
|
||||
str += f"{k}=<bytes>, "
|
||||
elif k == "thumbnail":
|
||||
str += f"{k}=<base64>, "
|
||||
# skip internal state
|
||||
elif k == "_sa_instance_state":
|
||||
continue
|
||||
else:
|
||||
str += f"{k}={v!r}, "
|
||||
str=str.rstrip(", ") + ")>"
|
||||
return str
|
||||
|
||||
|
||||
Reference in New Issue
Block a user