Skip to content

Specification

Specification

Abstract class for loading and verifying a Study Specification

Source code in maestrowf/abstracts/specification.py
@six.add_metaclass(ABCMeta)
class Specification:
    """
    Abstract class for loading and verifying a Study Specification
    """

    @abstractclassmethod
    def load_specification(cls, path):
        """
        Method for loading a study specification from a file.

        :param path: Path to a study specification.
        :returns: A specification object containing the information loaded
                  from path.
        """

    @abstractclassmethod
    def load_specification_from_stream(cls, stream):
        """
        Method for loading a study specification from a stream.

        :param stream: Raw text stream containing specification data.
        :returns: A specification object containing the information in string.
        """

    @abstractmethod
    def verify(self):
        """
        Verify the whole specification.
        """

    @abstractmethod
    def get_study_environment(self):
        """
        Generate a StudyEnvironment object from the environment in the spec.

        :returns: A StudyEnvironment object with the data in the specification.
        """

    @abstractmethod
    def get_parameters(self):
        """
        Generate a ParameterGenerator object from the global parameters.

        :returns: A ParameterGenerator with data from the specification.
        """

    @abstractmethod
    def get_study_steps(self):
        """
        Generate a list of StudySteps from the study in the specification.

        :returns: A list of StudyStep objects.
        """

    @abstractproperty
    def output_path(self):
        """
        Return the OUTPUT_PATH variable (if it exists).

        :returns: Returns OUTPUT_PATH if it exists, empty string otherwise.
        """

    @abstractproperty
    def name(self):
        """
        Getter for the name of a study specification.

        :returns: The name of the study described by the specification.
        """

    @name.setter
    def name(self, value):
        """
        Setter for the name of a study specification.

        :param value: String value representing the new name.
        """

    @abstractproperty
    def desc(self):
        """
        Getter for the description of a study specification.

        :returns: A string containing the description of the study
            specification.
        """

    @desc.setter
    def desc(self, value):
        """
        Setter for the description of a study specification.

        :param value: String value representing the new description.
        """

desc(value)

Setter for the description of a study specification.

Parameters:

Name Type Description Default
value

String value representing the new description.

required
Source code in maestrowf/abstracts/specification.py
@desc.setter
def desc(self, value):
    """
    Setter for the description of a study specification.

    :param value: String value representing the new description.
    """

get_parameters() abstractmethod

Generate a ParameterGenerator object from the global parameters.

Returns:

Type Description

A ParameterGenerator with data from the specification.

Source code in maestrowf/abstracts/specification.py
@abstractmethod
def get_parameters(self):
    """
    Generate a ParameterGenerator object from the global parameters.

    :returns: A ParameterGenerator with data from the specification.
    """

get_study_environment() abstractmethod

Generate a StudyEnvironment object from the environment in the spec.

Returns:

Type Description

A StudyEnvironment object with the data in the specification.

Source code in maestrowf/abstracts/specification.py
@abstractmethod
def get_study_environment(self):
    """
    Generate a StudyEnvironment object from the environment in the spec.

    :returns: A StudyEnvironment object with the data in the specification.
    """

get_study_steps() abstractmethod

Generate a list of StudySteps from the study in the specification.

Returns:

Type Description

A list of StudyStep objects.

Source code in maestrowf/abstracts/specification.py
@abstractmethod
def get_study_steps(self):
    """
    Generate a list of StudySteps from the study in the specification.

    :returns: A list of StudyStep objects.
    """

load_specification(path)

Method for loading a study specification from a file.

Parameters:

Name Type Description Default
path

Path to a study specification.

required

Returns:

Type Description

A specification object containing the information loaded from path.

Source code in maestrowf/abstracts/specification.py
@abstractclassmethod
def load_specification(cls, path):
    """
    Method for loading a study specification from a file.

    :param path: Path to a study specification.
    :returns: A specification object containing the information loaded
              from path.
    """

load_specification_from_stream(stream)

Method for loading a study specification from a stream.

Parameters:

Name Type Description Default
stream

Raw text stream containing specification data.

required

Returns:

Type Description

A specification object containing the information in string.

Source code in maestrowf/abstracts/specification.py
@abstractclassmethod
def load_specification_from_stream(cls, stream):
    """
    Method for loading a study specification from a stream.

    :param stream: Raw text stream containing specification data.
    :returns: A specification object containing the information in string.
    """

name(value)

Setter for the name of a study specification.

Parameters:

Name Type Description Default
value

String value representing the new name.

required
Source code in maestrowf/abstracts/specification.py
@name.setter
def name(self, value):
    """
    Setter for the name of a study specification.

    :param value: String value representing the new name.
    """

output_path()

Return the OUTPUT_PATH variable (if it exists).

Returns:

Type Description

Returns OUTPUT_PATH if it exists, empty string otherwise.

Source code in maestrowf/abstracts/specification.py
@abstractproperty
def output_path(self):
    """
    Return the OUTPUT_PATH variable (if it exists).

    :returns: Returns OUTPUT_PATH if it exists, empty string otherwise.
    """

verify() abstractmethod

Verify the whole specification.

Source code in maestrowf/abstracts/specification.py
@abstractmethod
def verify(self):
    """
    Verify the whole specification.
    """