PyOpenWorm.datasource module

exception PyOpenWorm.datasource.DuplicateAlsoException[source]

Bases: exceptions.Exception

class PyOpenWorm.datasource.BaseDataTranslator[source]

Bases: PyOpenWorm.dataObject.BaseDataObject

Translates from a data source to PyOpenWorm objects

input_type

alias of DataSource

output_type

alias of DataSource

translation_type

alias of Translation

get_data_objects(data_source)[source]

Override this to change how data objects are generated

make_translation(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

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

Notionally, this method takes a data source, which is translated into some other data source. There doesn’t necessarily need to be an input data source.

class PyOpenWorm.datasource.DataObjectContextDataSource(context, **kwargs)[source]

Bases: PyOpenWorm.datasource.DataSource

Description : DatatypeProperty

Attribute: description

Free-text describing the data source

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

class PyOpenWorm.datasource.DataSource(**kwargs)[source]

Bases: PyOpenWorm.dataObject.BaseDataObject

A 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__.

defined_augment()[source]

This fuction must return False if identifier_augment() would raise an IdentifierMissingException. Override it when defining a non-standard identifier for subclasses of DataObjects.

identifier_augment()[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. IdentifierMissingException should be raised if an identifier cannot be generated by this method.

Raises:
IdentifierMissingException
class PyOpenWorm.datasource.DataSourceType(name, bases, dct)[source]

Bases: PyOpenWorm.dataObject.ContextMappedClass

A type for DataSources

Sets up the graph with things needed for MappedClasses

class PyOpenWorm.datasource.DataTransatorType(name, bases, dct)[source]

Bases: PyOpenWorm.dataObject.ContextMappedClass

class PyOpenWorm.datasource.DataTranslator[source]

Bases: PyOpenWorm.datasource.BaseDataTranslator

A specialization with the GenericTranslation translation type that adds sources for the translation automatically when a new output is made

translation_type

alias of GenericTranslation

make_translation(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.Translation

A generic translation that just has sources in order

defined_augment()[source]

This fuction must return False if identifier_augment() would raise an IdentifierMissingException. Override it when defining a non-standard identifier for subclasses of DataObjects.

identifier_augment()[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. IdentifierMissingException should be raised if an identifier cannot be generated by this method.

Raises:
IdentifierMissingException
class PyOpenWorm.datasource.PersonDataTranslator[source]

Bases: PyOpenWorm.datasource.BaseDataTranslator

A 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.BaseDataObject

Representation 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()[source]

This fuction must return False if identifier_augment() would raise an IdentifierMissingException. Override it when defining a non-standard identifier for subclasses of DataObjects.

identifier_augment()[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. IdentifierMissingException should be raised if an identifier cannot be generated by this method.

Raises:
IdentifierMissingException