1 class CannotAutomateException(Exception):
2 '''signal from an Automatia that we can't automate this item
3 This is NOT an error. It's just saying that the item cannot
4 be processed by this module.
6 This should ONLY be raised if the system state was not changed
10 class Automatia(object):
11 '''Base class for anything that can automate an item'''
14 def __init__(self, item_state, task_metadata):
15 self.item_state = item_state
16 self.task_metadata = task_metadata
18 module_name = property(lambda self: self.__class__.__name__)
21 def can_automate_item(cls, item_state, task_metadata):
22 '''return if this module can automate an item given item state and task metadata
24 default implementation to return True iff item name is in
27 This must be a class method as modules can count on
28 only being instantiated if they are going to be used
29 to attempt to automate something
31 return item_state['name'] in cls.can_handle
34 '''automate a build step'''
35 raise NotImplementedError(self.module_name+'.do_magic()')