Total Complexity | 2 |
Total Lines | 8 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | from lib.action import CiscoSparkAction |
||
8 | class GenericAction(CiscoSparkAction): |
||
9 | |||
10 | def run(self, accessor, method_name, **kwargs): |
||
11 | a = getattr(self.connection, accessor) |
||
12 | result = getattr(a, method_name)(**kwargs) |
||
13 | if method_name == 'list': |
||
14 | result = list(result) # iterate generator |
||
15 | return self._parse_result(result) |
||
16 |