try vscode plugin
This commit is contained in:
18
Html/apps/function_tools/function_manager.py
Normal file
18
Html/apps/function_tools/function_manager.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from typing import Callable
|
||||
class FunctionManager:
|
||||
def __init__(self):
|
||||
self.function_caller = {}
|
||||
self.function_predifine_args = {}
|
||||
|
||||
def add_function(self, function:Callable, predifine_args:dict):
|
||||
self.function_caller[function.__name__] = function
|
||||
self.function_predifine_args[function.__name__] = predifine_args
|
||||
|
||||
def get_function(self, function_name:str):
|
||||
return self.function_caller[function_name]
|
||||
|
||||
def get_function_predifine_args(self, function_name:str):
|
||||
return self.function_predifine_args[function_name]
|
||||
|
||||
def call_function(self, function_name:str, args:dict):
|
||||
return self.function_caller[function_name]( **args, **self.function_predifine_args[function_name])
|
||||
Reference in New Issue
Block a user