Skip to content

Containers


Module that defines containers for storing various types of information.

Record

Bases: object

A container class for holding general information.

Source code in maestrowf/abstracts/containers/__init__.py
class Record(object):
    """A container class for holding general information."""

    def __init__(self):
        """Initialize an empty Record."""
        self._info = {}

    def get(self, key, default=None):
        """
        Get information by key in a record.

        :param key: The key to look up in a Record's stored information.
        :param default: The default value to return if the key is not found
             (Default: None).
        :returns: The information labeled by parameter key. Default if key does
             not exist.

        """
        return self._info.get(key, default)

__init__()

Initialize an empty Record.

Source code in maestrowf/abstracts/containers/__init__.py
def __init__(self):
    """Initialize an empty Record."""
    self._info = {}

get(key, default=None)

Get information by key in a record.

Parameters:

Name Type Description Default
key

The key to look up in a Record's stored information.

required
default

The default value to return if the key is not found (Default: None).

None

Returns:

Type Description

The information labeled by parameter key. Default if key does not exist.

Source code in maestrowf/abstracts/containers/__init__.py
def get(self, key, default=None):
    """
    Get information by key in a record.

    :param key: The key to look up in a Record's stored information.
    :param default: The default value to return if the key is not found
         (Default: None).
    :returns: The information labeled by parameter key. Default if key does
         not exist.

    """
    return self._info.get(key, default)