Metadata Python Module

MetaData class to handle input and output of metadata format.

class pacifica.uploader.metadata.metadata.FileObj[source]

FileObj class for holding file metadata.

Instances of this class represent individual files, including both the data and metadata for the file. During a file upload, instances of this class are automatically associated with new instances of the pacifica.uploader.metadata.MetaData class.

The above named fields are identical to those of the pacifica.metadata.orm.Files class, provided by the Pacifica Metadata library.

class pacifica.uploader.metadata.metadata.MetaData(*args, **kwargs)[source]

Class to hold a list of MetaObj and FileObj objects.

This class is a sub-class of list that implements the index protocol (__getitem__, __setitem__ and __delitem__) as a proxy to the indices of the value of the metaID field of the associated instance of the pacifica.uploader.metadata.MetaObj class.

Instances of this class are upper-level objects that provide the metadata for interacting with the designated Pacifica Ingest server.

__init__(*args, **kwargs)[source]

Call the super constructor and add a metaID index to it as well.

append(value)[source]

Append the value to the list.

extend(iterable)[source]

Extend the array from the values in iterable.

insert(key, value)[source]

Insert the value to the list.

is_valid()[source]

Return true if all the values of MetaObjs are something.

pop(key=-1)[source]

Remove the key from the list and return it.

remove(value)[source]

Remove the value from the list.

class pacifica.uploader.metadata.metadata.MetaDataDecoder(*, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None)[source]

Class to decode a json string into a MetaData object.

decode(s)[source]

Decode the string into a MetaData object.

class pacifica.uploader.metadata.metadata.MetaDataEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Class to encode a MetaData object into json.

encode(o)[source]

Encode the MetaData object into a json list.

class pacifica.uploader.metadata.metadata.MetaObj[source]

MetaObj class holding a specific metadata element.

Instances of this class represent units of metadata whose representation is disjoint to a file, i.e., units of metadata that are describe but are not stored as part of a file.

pacifica.uploader.metadata.metadata._FileObj

alias of pacifica.uploader.metadata.metadata.FileObj

pacifica.uploader.metadata.metadata._MetaObj

alias of pacifica.uploader.metadata.metadata.MetaObj

pacifica.uploader.metadata.metadata.file_or_meta_obj(**json_data)[source]

Determine if this is a File or Meta object and return result.

pacifica.uploader.metadata.metadata.metadata_decode(json_str)[source]

Decode the json string into MetaData object.

This method deserializes the given JSON source, json_str, and then returns a new instance of the pacifica.uploader.metadata.MetaData class.

The new instance is automatically associated with new instances of the pacifica.uploader.metadata.MetaObj and pacifica.uploader.metadata.FileObj classes.

pacifica.uploader.metadata.metadata.metadata_encode(md_obj)[source]

Encode the MetaData object into a json string.

This method encodes the given instance of the pacifica.uploader.metadata.MetaData class, md_obj, as a JSON object, and then returns its JSON serialization.

Associated instances of the pacifica.uploader.metadata.MetaObj and pacifica.uploader.metadata.FileObj classes are automatically included in the JSON object and the resulting JSON serialization.