Skip to content

Instantly share code, notes, and snippets.

@schlerp
Created May 25, 2021 23:53
Show Gist options
  • Save schlerp/e294e6aa50872e4d011206d0423df906 to your computer and use it in GitHub Desktop.
Save schlerp/e294e6aa50872e4d011206d0423df906 to your computer and use it in GitHub Desktop.
async def get_operations_collection(
module_list: List[ModuleType] = [inputs, processors, outputs]
) -> List[Dict[str, Any]]:
operations_collection = []
for module in module_list:
importlib.invalidate_caches()
module = importlib.reload(module)
for _class in get_classes_from_module(module):
if hasattr(_class, "_node_subtype"):
args = [arg for arg in get_init_args_from_class(_class)]
operations_collection.append(
{
"operation_id": f"{_class._node_type}.{_class._node_subtype}",
"nodeType": _class._node_type,
"nodeSubtype": _class._node_subtype,
"name": _class._node_name,
"args": args,
}
)
return operations_collection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment