Raised when a list is not the correct length
Raise when an string is not in a required controlled vocabulary
A module for parsing, manipulating, and serializing AVM data in the XMP format.
AVMMeta is a class offering direct access and validation of AVM metadata. An AVM dictionary or XMPMeta object may be passed to the constructor. Priority will be given to the AVM dictionary.
Parameters: |
|
---|
Method to decompress data to a SQL-friendly string.
Returns: | String (UTF-8) |
---|
Function to retrieve the XMP packet from a file
Parameters: | file_path – Path to file |
---|---|
Returns: | A dictionary with AVM data |
Function to retrieve the XMP packet from a file
Parameters: | file_path – Path to file |
---|---|
Returns: | A dictionary with AVM data |
Function to inject AVM into a file. Preserves existing XMP in the file, while replacing fields passed through dict.
If a field is an unordered list, then data is appended to existing values
Parameters: |
|
---|---|
Returns: | Boolean |
Todo
Improve avm_to_file function. Add ability to input an XMP file
Definition of various AVM specific data types
Abstract AVM data class. All other data classes inherit from AVMData.
All other data classes should define check_data() based on the type of data. Encoding of string into UTF-8 happens here.
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Retrieves data from an XMP packet. Should be overridden when appropriate.
Returns: | Object. Depending on the data type, different objects will be returned. If the data does not exist |
---|
in the xmp packet, then the None object is returned
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for strings
Check that the data is a string or unicode, otherwise it raises a TypeError.
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Retrieves data from an XMP packet. Should be overridden when appropriate.
Returns: | Object. Depending on the data type, different objects will be returned. If the data does not exist |
---|
in the xmp packet, then the None object is returned
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
If a controlled vocabulary is specified, this function checks the input value against the allowed values. AVMItemNotInControlledVocabularyError is raised if not in the controlled vocabulary
Returns: | Boolean |
---|
Check that the data is a string or unicode, formats the data appropriately using format_data() and calls check_cv()
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Returns: | String |
---|
Retrieves data from an XMP packet. Should be overridden when appropriate.
Returns: | Object. Depending on the data type, different objects will be returned. If the data does not exist |
---|
in the xmp packet, then the None object is returned
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
If a controlled vocabulary is specified, this function checks the input value against the allowed values. AVMItemNotInControlledVocabularyError is raised if not in the controlled vocabulary
Returns: | Boolean |
---|
Check that the data is a string or unicode, formats the data appropriately using format_data() and calls check_cv()
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Formats the data to be a capitalized string
Returns: | String |
---|
Retrieves data from an XMP packet. Should be overridden when appropriate.
Returns: | Object. Depending on the data type, different objects will be returned. If the data does not exist |
---|
in the xmp packet, then the None object is returned
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
If a controlled vocabulary is specified, this function checks the input value against the allowed values. AVMItemNotInControlledVocabularyError is raised if not in the controlled vocabulary
Returns: | Boolean |
---|
Check that the data is a string or unicode, formats the data appropriately using format_data() and calls check_cv()
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Formats the data to be an upper case string
Returns: | String: |
---|
Retrieves data from an XMP packet. Should be overridden when appropriate.
Returns: | Object. Depending on the data type, different objects will be returned. If the data does not exist |
---|
in the xmp packet, then the None object is returned
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for URLs.
Returns: | String (UTF-8) |
---|
Checks the data is a string or unicode, and checks data against a regular expression for a URL. If the user leaves off the protocol,then ‘http://‘ is attached as a default.
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Retrieves data from an XMP packet. Should be overridden when appropriate.
Returns: | Object. Depending on the data type, different objects will be returned. If the data does not exist |
---|
in the xmp packet, then the None object is returned
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for email addresses.
Returns: | String (UTF-8) |
---|
Checks data is a string or unicode, and checks against a regular expression for an email. If value is not a string or unicode, a TypeError is raised. If the value is not a proper email, then a ValueError is raised.
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Retrieves data from an XMP packet. Should be overridden when appropriate.
Returns: | Object. Depending on the data type, different objects will be returned. If the data does not exist |
---|
in the xmp packet, then the None object is returned
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for localized strings. (i.e. fields contained in an alt tag, such as dc:description)
Check that the data is a string or unicode, otherwise it raises a TypeError.
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Retrieves localized data from an XMP packet.
Returns: | String |
---|
After calling check_data(), injects the data into the XMP packet.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for float fields
Checks that data can be represented as a number.
Returns: | String (UTF-8) |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Retrieves data from an XMP packet. Should be overridden when appropriate.
Returns: | Object. Depending on the data type, different objects will be returned. If the data does not exist |
---|
in the xmp packet, then the None object is returned
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Generic data type for lists (i.e xmp bag arrays)
Checks that the data type is a Python List. Calls check_length() first.
Todo
Redo this function. Implement the dash functionality only for ordered lists.
Returns: | List (UTF-8 elements) |
---|
Checks the length of the Python List.
Returns: | Boolean |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Extract data from XMP packet
Returns: | List (UTF-8 elements) or None if array does not have any elements |
---|
After checking length and type, inject the data to the XMP packet. This function replaces the existing data; it is not meant to append values.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for an unordered list of strings
Check that the passed data is a Python List, and checks that the elements are strings or unicode.
Returns: | List of strings (UTF-8) |
---|
Checks the length of the Python List.
Returns: | Boolean |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Extract data from XMP packet
Returns: | List (UTF-8 elements) or None if array does not have any elements |
---|
After checking length and type, inject the data to the XMP packet. This function replaces the existing data; it is not meant to append values.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for ordered lists (i.e. seq arrays)
Checks that the data type is a Python List. Calls check_length() first.
Todo
Redo this function. Implement the dash functionality only for ordered lists.
Returns: | List (UTF-8 elements) |
---|
Checks the length of the Python List.
Returns: | Boolean |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Extract data from XMP packet
Returns: | List (UTF-8 elements) or None if array does not have any elements |
---|
Checks the data before injecting to the XMP packets.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for ordered lists of floats.
Checks that the data is of the correct type, length and elements are strings able to be represented as floats.
Returns: | List of strings (UTF-8) |
---|
Checks the length of the Python List.
Returns: | Boolean |
---|
Deletes data from an XMP packet. Should be overridden when appropriate.
Extract data from XMP packet
Returns: | List (UTF-8 elements) or None if array does not have any elements |
---|
Checks the data before injecting to the XMP packets.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|
Data type for Dates.
Checks for a Python date
Todo
Implement a better way to determine class.
Deletes data from an XMP packet. Should be overridden when appropriate.
.todo:: Something funny happens here...
Returns: | Python date object |
---|
Injects data into an XMP packet. Should be overridden if other requirements are necessary.
Returns: | Boolean |
---|
Method to retrieve data from an XMP packet in a SQL-friendly string format.
Returns: | String (UTF-8) |
---|