Skip to content

Commit f77c625

Browse files
authored
Merge pull request #789 from Labelbox/AL-4359-improve-print-visual-representation-of-the-entities
pretty print objects values
2 parents b8660d8 + 72ea43f commit f77c625

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

labelbox/orm/db_object.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime, timezone
22
from functools import wraps
33
import logging
4+
import json
45

56
from labelbox import utils
67
from labelbox.exceptions import InvalidQueryError, InvalidAttributeError
@@ -92,7 +93,7 @@ def __str__(self):
9293
attribute_values = {
9394
field.name: getattr(self, field.name) for field in self.fields()
9495
}
95-
return "<%s %s>" % (self.type_name().split(".")[-1], attribute_values)
96+
return "<%s %s>" % (self.type_name().split(".")[-1], json.dumps(attribute_values, indent=4, default=str))
9697

9798
def __eq__(self, other):
9899
return (isinstance(other, DbObject) and

labelbox/orm/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ def _attributes_of_type(cls, attr_type):
389389

390390
@classmethod
391391
def fields(cls):
392-
""" Returns a generateor that yields all the Fields declared in a
392+
""" Returns a generator that yields all the Fields declared in a
393393
concrete subclass.
394394
"""
395395
for attr in cls._attributes_of_type(Field):
@@ -398,7 +398,7 @@ def fields(cls):
398398

399399
@classmethod
400400
def relationships(cls):
401-
""" Returns a generateor that yields all the Relationships declared in
401+
""" Returns a generator that yields all the Relationships declared in
402402
a concrete subclass.
403403
"""
404404
return cls._attributes_of_type(Relationship)

0 commit comments

Comments
 (0)