(plugin_def)
| 25 | |
| 26 | def _common_def(inputs=[], outputs=[]): |
| 27 | def common_def(plugin_def): |
| 28 | def decorator(name=None, exclusive=False): |
| 29 | def _decorator(func): |
| 30 | nonlocal name |
| 31 | if name is None: |
| 32 | name = func.__name__ |
| 33 | name = name_convert_to_camel(name) |
| 34 | with_context = _with_context(func) |
| 35 | |
| 36 | @register(name=name, inputs=inputs, outputs=outputs, exclusive=exclusive) |
| 37 | class Node: |
| 38 | def __init__(self, name, args): |
| 39 | self.context = Context(**args) |
| 40 | self.name = name |
| 41 | if with_context: |
| 42 | self.impl = partial(func, context = self.context) |
| 43 | else: |
| 44 | self.impl = func |
| 45 | |
| 46 | def exec(self): |
| 47 | plugin_def(self, self.impl) |
| 48 | |
| 49 | return Node |
| 50 | |
| 51 | return _decorator |
| 52 | return decorator |
| 53 | return common_def |
| 54 | |
| 55 |
nothing calls this directly
no outgoing calls
no test coverage detected