PyOpenWorm.datasource module¶
-
class
PyOpenWorm.datasource.BaseDataTranslator(**kwargs)[source]¶ Bases:
PyOpenWorm.dataObject.DataObjectTranslates from a data source to PyOpenWorm objects
-
input_type¶ alias of
DataSource
-
output_type¶ alias of
DataSource
-
translation_type¶ alias of
Translation
-
make_translation(self, sources=())[source]¶ It’s intended that implementations of DataTranslator will override this method to make custom Translations according with how different arguments to Translate are (or are not) distinguished.
The actual properties of a Translation subclass must be defined within the ‘translate’ method
-
-
class
PyOpenWorm.datasource.DataObjectContextDataSource(context, **kwargs)[source]¶ Bases:
PyOpenWorm.datasource.DataSource- Input source :
ObjectProperty Attribute: source
The data source that was translated into this one
- Translation :
ObjectProperty Attribute: translation
Information about the translation process that created this object
- Description :
DatatypeProperty Attribute: description
Free-text describing the data source
- Input source :
-
class
PyOpenWorm.datasource.DataSource(**kwargs)[source]¶ Bases:
PyOpenWorm.dataObject.DataObjectA source for data that can get translated into PyOpenWorm objects.
The value for any field can be passed to __init__ by name. Additionally, if the sub-class definition of a DataSource assigns a value for that field like:
class A(DataSource): some_field = 3
that value will be used over the default value for the field, but not over any value provided to __init__.
-
commit(self)[source]¶ Commit the data source locally
This includes staging files such as they would be available for a translation. In general, a sub-class should implement
commit_augment()rather than this method, or at least call this method via superFor example, if the data source produces a file, that file should be in
-
defined_augment(self)[source]¶ This fuction must return False if
identifier_augment()would raise anIdentifierMissingException. Override it when defining a non-standard identifier for subclasses of DataObjects.
-
identifier_augment(self)[source]¶ Override this method to define an identifier in lieu of one explicity set.
One must also override
defined_augment()to return True whenever this method could return a valid identifier.IdentifierMissingExceptionshould be raised if an identifier cannot be generated by this method.Raises: - IdentifierMissingException
-
-
class
PyOpenWorm.datasource.DataSourceType(name, bases, dct)[source]¶ Bases:
PyOpenWorm.dataObject.ContextMappedClassA type for DataSources
Sets up the graph with things needed for MappedClasses
-
class
PyOpenWorm.datasource.DataTranslator(**kwargs)[source]¶ Bases:
PyOpenWorm.datasource.BaseDataTranslatorA specialization with the
GenericTranslationtranslation type that adds sources for the translation automatically when a new output is made-
translation_type¶ alias of
GenericTranslation
-
make_translation(self, sources=())[source]¶ It’s intended that implementations of DataTranslator will override this method to make custom Translations according with how different arguments to Translate are (or are not) distinguished.
The actual properties of a Translation subclass must be defined within the ‘translate’ method
-
-
class
PyOpenWorm.datasource.GenericTranslation(**kwargs)[source]¶ Bases:
PyOpenWorm.datasource.TranslationA generic translation that just has sources in order
-
defined_augment(self)[source]¶ This fuction must return False if
identifier_augment()would raise anIdentifierMissingException. Override it when defining a non-standard identifier for subclasses of DataObjects.
-
identifier_augment(self)[source]¶ Override this method to define an identifier in lieu of one explicity set.
One must also override
defined_augment()to return True whenever this method could return a valid identifier.IdentifierMissingExceptionshould be raised if an identifier cannot be generated by this method.Raises: - IdentifierMissingException
-
-
class
PyOpenWorm.datasource.OneOrMore(source_type)[source]¶ Bases:
objectWrapper for
DataTranslatorinputDataSourcetypes indicating that one or more of the wrapped type must be provided to the translator
-
class
PyOpenWorm.datasource.PersonDataTranslator(**kwargs)[source]¶ Bases:
PyOpenWorm.datasource.BaseDataTranslatorA person who was responsible for carrying out the translation of a data source
-
person¶ A person responsible for carrying out the translation.
-
-
class
PyOpenWorm.datasource.Translation(**kwargs)[source]¶ Bases:
PyOpenWorm.dataObject.DataObjectRepresentation of the method by which a DataSource was translated and the sources of that translation. Unlike the ‘source’ field attached to DataSources, the Translation may distinguish different kinds of input source to a translation.
-
defined_augment(self)[source]¶ This fuction must return False if
identifier_augment()would raise anIdentifierMissingException. Override it when defining a non-standard identifier for subclasses of DataObjects.
-
identifier_augment(self)[source]¶ Override this method to define an identifier in lieu of one explicity set.
One must also override
defined_augment()to return True whenever this method could return a valid identifier.IdentifierMissingExceptionshould be raised if an identifier cannot be generated by this method.Raises: - IdentifierMissingException
-