exporters
Package¶
Define a list with all Python modules in which the introspect mechanism should search for Export Adapters.
abcexporter
¶
Root class for export functionality.
- class tvb.adapters.exporters.abcexporter.ABCExporter[source]¶
Bases:
object
Base class for all data type exporters This should provide common functionality for all TVB exporters.
- accepts(data)[source]¶
This method specify if the current exporter can export provided data. :param data: data to be checked :returns: true if this data can be exported by current exporter, false otherwise.
- abstract export(data, project, public_key_path, password)[source]¶
Actual export method, to be implemented in each sub-class.
- Parameters:
data – data type to be exported
project – project that contains data to be exported
public_key_path – path to public key that will be used for encrypting the password by TVB
password – password used for encrypting the files before exporting
- Returns:
a tuple with the following elements:
name of the file to be shown to user
full path of the export file (available for download)
boolean which specify if file can be deleted after download
- abstract get_export_file_extension(data)[source]¶
This method computes the extension of the export file :param data: data type to be exported :returns: the extension of the file to be exported (e.g zip or h5)
- get_label()[source]¶
This method returns a string to be used on the UI controls to initiate export
- Returns:
string to be used on UI for starting this export. By default class name is returned
- abstract get_supported_types()[source]¶
This method specify what types are accepted by this exporter. Method should be implemented by each subclass and return an array with the supported types.
- Returns:
an array with the supported data types.
- static prepare_datatypes_for_export(data)[source]¶
Method used for exporting data type groups. This method returns a list of all datatype indexes needed to be exported and a dictionary where keys are operation folder names and the values are lists containing the paths that belong to one particular operation folder.
exceptions
¶
Exceptions for Export mechanism.
- exception tvb.adapters.exporters.exceptions.ExportException(message)[source]¶
Bases:
TVBException
Generic export exception.
- exception tvb.adapters.exporters.exceptions.InvalidExportDataException(message)[source]¶
Bases:
TVBException
Exception thrown when an invalid data is provided for export
export_manager
¶
Class responsible for all TVB exports (datatype or project).
- class tvb.adapters.exporters.export_manager.ExportManager[source]¶
Bases:
object
This class provides basic methods for exporting data types of projects in different formats.
- all_exporters = {}¶
- export_data(data, exporter_id, project, user_public_key=None)[source]¶
Export provided data using given exporter :param data: data type to be exported :param exporter_id: identifier of the exporter to be used :param project: project that contains data to be exported :param user_public_key: public key file used for encrypting data before exporting
- Returns:
a tuple with the following elements 1. name of the file to be shown to user 2. full path of the export file (available for download) 3. boolean which specify if file can be deleted after download
- export_project(project)[source]¶
Given a project root and the TVB storage_path, create a ZIP ready for export. :param project: project object which identifies project to be exported
- get_exporters_for_data(data)[source]¶
Get available exporters for current data type. :returns: a dictionary with the {exporter_id : label}
- logger = <Logger tvb.adapters.exporters.export_manager (INFO)>¶
tvb_export
¶
- class tvb.adapters.exporters.tvb_export.TVBExporter[source]¶
Bases:
ABCExporter
This exporter simply provides for download data in TVB format
- export(data, project, public_key_path, password)[source]¶
Exports data type: 1. If data is a normal data type, simply exports storage file (HDF format) 2. If data is a DataTypeGroup creates a zip with all files for all data types
- get_export_file_extension(data)[source]¶
This method computes the extension of the export file :param data: data type to be exported :returns: the extension of the file to be exported (e.g zip or h5)
tvb_linked_export
¶
- class tvb.adapters.exporters.tvb_linked_export.TVBLinkedExporter[source]¶
Bases:
ABCExporter
- export(data, project, public_key_path, password)[source]¶
Exports data type: 1. If data is a normal data type, simply exports storage file (HDF format) 2. If data is a DataTypeGroup creates a zip with all files for all data types
- get_export_file_extension(data)[source]¶
This method computes the extension of the export file :param data: data type to be exported :returns: the extension of the file to be exported (e.g zip or h5)
- get_label()[source]¶
This method returns a string to be used on the UI controls to initiate export
- Returns:
string to be used on UI for starting this export. By default class name is returned