class SerializableDocument(object): (source)
Known subclasses: fiftyone.core.odm.document.MongoEngineBaseDocument
, fiftyone.core.odm.frame.NoDatasetFrameDocument
, fiftyone.core.odm.sample.NoDatasetSampleDocument
Mixin for documents that can be serialized in BSON or JSON format.
Class Method | from |
Loads the document from a BSON/JSON dictionary. |
Class Method | from |
Loads the document from a JSON string. |
Method | __eq__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | __str__ |
Undocumented |
Method | clear |
Clears the field from the document. |
Method | copy |
Returns a deep copy of the document. |
Method | fancy |
Generates a customizable string representation of the document. |
Method | get |
Gets the field of the document. |
Method | has |
Determines whether the document has a field of the given name. |
Method | iter |
Returns an iterator over the (name, value) pairs of the public fields of the document. |
Method | merge |
Merges the contents of the given document into this document. |
Method | set |
Sets the value of a field of the document. |
Method | to |
Serializes this document to a BSON/JSON dictionary. |
Method | to |
Serializes the document to a JSON string. |
Property | field |
An ordered tuple of the public fields of this document. |
Method | _get |
Returns an ordered tuple of field names of this document. |
Method | _get |
Returns an ordered tuple of field names that should be included in the repr of the document. |
fiftyone.core.odm.document.MongoEngineBaseDocument
Loads the document from a BSON/JSON dictionary.
Parameters | |
d | a dictionary |
extended:False | whether the input dictionary may contain serialized extended JSON constructs |
Returns | |
a SerializableDocument |
fiftyone.core.odm.document.MongoEngineBaseDocument
Clears the field from the document.
Parameters | |
field | the field name |
Raises | |
ValueError | if the field does not exist |
fiftyone.core.odm.document.Document
Returns a deep copy of the document.
Returns | |
a SerializableDocument |
Generates a customizable string representation of the document.
Parameters | |
classNone | optional class name to use |
selectNone | iterable of field names to restrict to |
excludeNone | iterable of field names to exclude |
**kwargs | additional key-value pairs to include in the string representation |
Returns | |
a string representation of the document |
fiftyone.core.odm.document.MongoEngineBaseDocument
Gets the field of the document.
Parameters | |
field | the field name |
Returns | |
the field value | |
Raises | |
AttributeError | if the field does not exist |
fiftyone.core.odm.document.MongoEngineBaseDocument
Determines whether the document has a field of the given name.
Parameters | |
field | the field name |
Returns | |
True/False |
Returns an iterator over the (name, value) pairs of the public fields of the document.
Returns | |
an iterator that emits (name, value) tuples |
Merges the contents of the given document into this document.
Parameters | |
doc | a SerializableDocument of same type as this document |
mergeTrue | whether to merge the elements of top-level list fields rather than treating the list as a single value |
mergeTrue | whether to recursively merge the contents of top-level dict fields rather than treating the dict as a single value |
overwrite:True | whether to overwrite (True) or skip (False) existing fields |
fiftyone.core.odm.document.MongoEngineBaseDocument
Sets the value of a field of the document.
Parameters | |
field | the field name |
value | the field value |
create:True | whether to create the field if it does not exist |
Raises | |
ValueError | if field_name is not an allowed field name or does not exist and create == False |
fiftyone.core.odm.document.MongoEngineBaseDocument
Serializes this document to a BSON/JSON dictionary.
Parameters | |
extended:False | whether to serialize extended JSON constructs such as ObjectIDs, Binary, etc. into JSON format |
Returns | |
a dict |
Serializes the document to a JSON string.
Parameters | |
prettyFalse | whether to render the JSON in human readable format with newlines and indentations |
Returns | |
a JSON string |
fiftyone.core.odm.document.MongoEngineBaseDocument
An ordered tuple of the public fields of this document.
fiftyone.core.odm.document.MongoEngineBaseDocument
, fiftyone.core.odm.sample.NoDatasetSampleDocument
Returns an ordered tuple of field names that should be included in the repr of the document.
Returns | |
a tuple of field names |