diff --git a/labelbox/orm/db_object.py b/labelbox/orm/db_object.py index 5b986afcb..4513c9a66 100644 --- a/labelbox/orm/db_object.py +++ b/labelbox/orm/db_object.py @@ -1,6 +1,7 @@ from datetime import datetime, timezone from functools import wraps import logging +import json from labelbox import utils from labelbox.exceptions import InvalidQueryError, InvalidAttributeError @@ -92,7 +93,7 @@ def __str__(self): attribute_values = { field.name: getattr(self, field.name) for field in self.fields() } - return "<%s %s>" % (self.type_name().split(".")[-1], attribute_values) + return "<%s %s>" % (self.type_name().split(".")[-1], json.dumps(attribute_values, indent=4, default=str)) def __eq__(self, other): return (isinstance(other, DbObject) and diff --git a/labelbox/orm/model.py b/labelbox/orm/model.py index 79783c10a..02ba5288b 100644 --- a/labelbox/orm/model.py +++ b/labelbox/orm/model.py @@ -389,7 +389,7 @@ def _attributes_of_type(cls, attr_type): @classmethod def fields(cls): - """ Returns a generateor that yields all the Fields declared in a + """ Returns a generator that yields all the Fields declared in a concrete subclass. """ for attr in cls._attributes_of_type(Field): @@ -398,7 +398,7 @@ def fields(cls): @classmethod def relationships(cls): - """ Returns a generateor that yields all the Relationships declared in + """ Returns a generator that yields all the Relationships declared in a concrete subclass. """ return cls._attributes_of_type(Relationship)