ape.components.component.Composite

class ape.components.component.Composite(error=None, error_message=None, identifier=None, component_category=None, time_remains=None)

A Composite to hold and execute Components

Composite Constructor

Param:
  • error: Exception to catch when calling components
  • error_message: string for header of error messages
  • component_category: label for error messages when reporting component actions
  • identifier: something to identify this when it starts the call
  • time_remains - a TimeTracker or CountdownTimer
__init__(error=None, error_message=None, identifier=None, component_category=None, time_remains=None)

Composite Constructor

Param:
  • error: Exception to catch when calling components
  • error_message: string for header of error messages
  • component_category: label for error messages when reporting component actions
  • identifier: something to identify this when it starts the call
  • time_remains - a TimeTracker or CountdownTimer

Methods

__init__([error, error_message, identifier, ...]) Composite Constructor
add(component) appends the component to self.components
check_rep() Checks the representation invariant
one_call(*args, **kwargs)
remove(component) Removes the component from the components (if it was there)

Attributes

components The list of components
logger
return:A logging object.
add(component)

appends the component to self.components

Param:
  • component: A Component
Postcondition:

component appended to components

check_rep()

Checks the representation invariant

Raise:ConfigurationError
close()

calls the close method on each component

Postcondition:comuponents closed and self.components is None
log_error(error, message='')

Logs the error in bold red

Param:
  • error: error type (prefix in red and bold)
  • message: descriptive message (red but not bold)
remove(component)

Removes the component from the components (if it was there)

components

The list of components

logger
Returns:A logging object.
time_remains
Returns:TimeTracker (default) or CountdownTimer object

Navigation