yawning_titan.db.doc_metadata#

Classes

DocMetaDataObject

A base class for managing access to the doc_metadata attribute.

DocMetadata

A secure class to hold metadata related to a document in a Yawning-Titan TinyDB file.

DocMetadataSchema

A schema-like class that defines the document metadata fields.

class yawning_titan.db.doc_metadata.DocMetaDataObject[source]#

A base class for managing access to the doc_metadata attribute.

property doc_metadata#

The configs document metadata.

class yawning_titan.db.doc_metadata.DocMetadata(uuid=None, name=None, description=None, author=None, locked=False, created_at=None, updated_at=None)[source]#

A secure class to hold metadata related to a document in a Yawning-Titan TinyDB file.

The uuid and created_at attributes are set upon instantiation if they are not passed as params. Once set, they cannot be changed.

The DocMetadata constructor.

Parameters:
  • uuid – The documents globally unique identifier.

  • name – The name given to the document by the author.

  • description – The description given to the document by the author.

  • author – The original author of the document.

  • locked – Whether the doc is locked for editing or not.

  • created_at – The datetime the document was created at as an ISO 8601 str.

  • updated_at – The datetime the document was last updated at as an ISO 8601 str.

__init__(uuid=None, name=None, description=None, author=None, locked=False, created_at=None, updated_at=None)[source]#

The DocMetadata constructor.

Parameters:
  • uuid – The documents globally unique identifier.

  • name – The name given to the document by the author.

  • description – The description given to the document by the author.

  • author – The original author of the document.

  • locked – Whether the doc is locked for editing or not.

  • created_at – The datetime the document was created at as an ISO 8601 str.

  • updated_at – The datetime the document was last updated at as an ISO 8601 str.

property uuid#

The documents globally unique identifier.

property created_at#

The datetime the document was created at as an ISO 8601 str.

property locked#

Whether the doc is locked for editing or not.

property updated_at#

The datetime the document was last updated at as an ISO 8601 str.

property name#

The name given to the document by the author.

property description#

The description given to the document by the author.

property author#

The original author of the document.

update(name=None, description=None, author=None)[source]#

Updated the name, description, and author.

Parameters:
  • name – The name given to the document by the author.

  • description – The description given to the document by the author.

  • author – The original author of the document.

to_dict(include_none=False)[source]#

Serialize the DocMetadata as a dict.

Parameters:

include_none – Determines whether to include empty fields in the dict.

Returns:

The DocMetadata as a Python dict.

to_list()[source]#

Get the doc metadata values as a list.

Returns:

The values as a list of strings and None.

class yawning_titan.db.doc_metadata.DocMetadataSchema[source]#

A schema-like class that defines the document metadata fields.

Fields are defined using the YawningTitanQuery class so that schema paths can be used directly within tinydb.table.Table.search() function calls. All fields are mapped to a property in the DocMetadata class.