doit/action.py
def create_action(action, task_ref, param_name):
    """
    Create action using proper constructor based on the parameter type

    @param action: Action to be created
    @type action: L{BaseAction} subclass object, str, tuple or callable
    @param task_ref: Task object this action belongs to
    @param param_name: str, name of task param. i.e actions, teardown, clean
    @raise InvalidTask: If action parameter type isn't valid
    """
    if isinstance(action, BaseAction):
        action.task = task_ref
        return action

    if isinstance(action, str):
        return CmdAction(action, task_ref, shell=True)

    if isinstance(action, list):
        return CmdAction(action, task_ref, shell=False)

    if isinstance(action, tuple):
        if len(action) > 3:
            msg = "Task '{}': invalid '{}' tuple length. got: {!r} {}".format(
                task_ref.name, param_name, action, type(action))
            raise InvalidTask(msg)
        py_callable, args, kwargs = (list(action) + [None]*(3-len(action)))
        return PythonAction(py_callable, args, kwargs, task_ref)

    if hasattr(action, '__call__'):
        return PythonAction(action, task=task_ref)

    msg = "Task '{}': invalid '{}' type. got: {!r} {}".format(
        task_ref.name, param_name, action, type(action))
    raise InvalidTask(msg)

    Create action using proper constructor based on the parameter type

    @param action: Action to be created
    @type action: L{BaseAction} subclass object, str, tuple or callable
    @param task_ref: Task object this action belongs to
    @param param_name: str, name of task param. i.e actions, teardown, clean
    @raise InvalidTask: If action parameter type isn't valid
    
Create action using proper constructor based on the parameter type
Create action using proper constructor based on the parameter type
def create_action(action, task_ref, param_name):
    if isinstance(action, BaseAction):
        action.task = task_ref
        return action
    if isinstance(action, str):
        return CmdAction(action, task_ref, shell=True)
    if isinstance(action, list):
        return CmdAction(action, task_ref, shell=False)
    if isinstance(action, tuple):
        if len(action) > 3:
            msg = "Task '{}': invalid '{}' tuple length. got: {!r} {}".format(
                task_ref.name, param_name, action, type(action))
            raise InvalidTask(msg)
        py_callable, args, kwargs = (list(action) + [None]*(3-len(action)))
        return PythonAction(py_callable, args, kwargs, task_ref)
    if hasattr(action, '__call__'):
        return PythonAction(action, task=task_ref)
    msg = "Task '{}': invalid '{}' type. got: {!r} {}".format(
        task_ref.name, param_name, action, type(action))
    raise InvalidTask(msg)
def create_action ( action , task_ref , param_name ) : if isinstance ( action , BaseAction ) : action . task = task_ref return action if isinstance ( action , str ) : return CmdAction ( action , task_ref , shell = True ) if isinstance ( action , list ) : return CmdAction ( action , task_ref , shell = False ) if isinstance ( action , tuple ) : if len ( action ) > 3 : msg = "Task '{}': invalid '{}' tuple length. got: {!r} {}" . format ( task_ref . name , param_name , action , type ( action ) ) raise InvalidTask ( msg ) py_callable , args , kwargs = ( list ( action ) + [ None ] * ( 3 - len ( action ) ) ) return PythonAction ( py_callable , args , kwargs , task_ref ) if hasattr ( action , '__call__' ) : return PythonAction ( action , task = task_ref ) msg = "Task '{}': invalid '{}' type. got: {!r} {}" . format ( task_ref . name , param_name , action , type ( action ) ) raise InvalidTask ( msg )
Create action using proper constructor based on the parameter type
Create action using proper constructor based on the parameter type
"""
    Create action using proper constructor based on the parameter type

    @param action: Action to be created
    @type action: L{BaseAction} subclass object, str, tuple or callable
    @param task_ref: Task object this action belongs to
    @param param_name: str, name of task param. i.e actions, teardown, clean
    @raise InvalidTask: If action parameter type isn't valid
    """
If action parameter type isn't valid
If action parameter type isn ' t valid
InvalidTask
action
Action to be created
Action to be created
task_ref
Task object this action belongs to
Task object this action belongs to
param_name
str, name of task param. i.e actions, teardown, clean
str name of task param . i . e actions teardown clean