MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / _decorator

Function _decorator

flow-python/megflow/func_op.py:29–49  ·  view source on GitHub ↗
(func)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

name_convert_to_camelFunction · 0.85
_with_contextFunction · 0.85

Tested by

no test coverage detected