Completed
Pull Request — master (#564)
by
unknown
02:22
created

ActionWrapper.__init__()   A

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
c 1
b 0
f 1
dl 0
loc 2
rs 10
1
import importlib
2
from st2actions.runners.pythonrunner import Action
3
4
5
class ActionWrapper(Action):
6
    def __init__(self, config):
7
        self.config = config
8
9
    def run(self, **kwargs):
10
        cls_name = kwargs.pop("cls")
11
        module_path = kwargs.pop("module_path")
12
        module = importlib.import_module(module_path)
13
        cls = getattr(module, cls_name)(self.config)
14
        return cls.run(**kwargs)
15