Utilities for documents.
Class |
|
A registry of fiftyone.core.odm.document.MongoEngineBaseDocument classes found when importing data from the database. |
Exception |
|
Error raised when an unknown document class is encountered. |
Function | create |
Creates the field defined by the given specification. |
Function | create |
Creates the field for the given value. |
Function | deserialize |
Deserializes the given value. |
Function | get |
Constructs the field keyword arguments dictionary for the given field. |
Function | get |
Infers the field keyword arguments dictionary for a field that can hold the given value. |
Function | load |
Loads the dataset from the database by its unique id or name. Throws an error if neither id nor name is provided. |
Function | serialize |
Serializes the given value. |
Function | validate |
Verifies that the given field name is valid. |
Function | validate |
Validates that the types of the given fields match. |
Variable | fol |
Undocumented |
Variable | food |
Undocumented |
Variable | fooe |
Undocumented |
Function | _finalize |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _get |
Undocumented |
Function | _merge |
Undocumented |
Function | _parse |
Undocumented |
Function | _parse |
Undocumented |
Function | _parse |
Undocumented |
Variable | _document |
Undocumented |
Creates the field defined by the given specification.
Note
This method is used exclusively to create user-defined (non-default)
fields. Any parameters accepted here must be stored on
fiftyone.core.odm.dataset.SampleFieldDocument
or else datasets
will "lose" any additional decorations when they are loaded from the
database.
Parameters | |
name | the field name |
ftype | the field type to create. Must be a subclass of
fiftyone.core.fields.Field |
embeddedNone | the
fiftyone.core.odm.BaseEmbeddedDocument type of the field.
Only applicable when ftype is
fiftyone.core.fields.EmbeddedDocumentField |
subfield:None | the fiftyone.core.fields.Field type of the
contained field. Only applicable when ftype is
fiftyone.core.fields.ListField or
fiftyone.core.fields.DictField |
fields:None | a list of fiftyone.core.fields.Field instances
defining embedded document attributes. Only applicable when
ftype is fiftyone.core.fields.EmbeddedDocumentField |
dbNone | the database field to store this field in. By default, name is used |
description:None | an optional description |
info:None | an optional info dict |
readFalse | whether the field should be read-only |
createdNone | the datetime the field was created |
**kwargs | Undocumented |
Returns | |
a fiftyone.core.fields.Field |
Creates the field for the given value.
Parameters | |
path | the field name or path |
value | a value |
dynamic:False | whether to declare dynamic embedded document fields |
Returns | |
a fiftyone.core.fields.Field |
Constructs the field keyword arguments dictionary for the given field.
Parameters | |
field | a fiftyone.core.fields.Field or str(field)
representation of one |
Returns | |
a field specification dict |
Infers the field keyword arguments dictionary for a field that can hold the given value.
Parameters | |
value | a value |
dynamic:False | whether to declare dynamic embedded document fields |
Returns | |
a field specification dict |
Loads the dataset from the database by its unique id or name. Throws an error if neither id nor name is provided.
Parameters | |
id:None | the unique id of the dataset |
name:None | the name of the dataset |
Returns | |
a fiftyone.core.dataset.Dataset |
Serializes the given value.
Parameters | |
value | the value |
extended:False | whether to serialize extended JSON constructs such as ObjectIDs, Binary, etc. into JSON format |
Returns | |
the serialized value |
Verifies that the given field name is valid.
Parameters | |
field | the field name |
mediaNone | the media type of the sample, if known |
isFalse | whether this is a frame-level field |
Raises | |
ValueError | if the field name is invalid |
Validates that the types of the given fields match.
Embedded document fields are not validated, if applicable.
Parameters | |
name | the field name or embedded.field.name |
field | a fiftyone.core.fields.Field |
existing | the reference fiftyone.core.fields.Field |
Raises | |
ValueError | if the fields do not match |