Skip to content

Commit

Permalink
feat: support disable in funix_class
Browse files Browse the repository at this point in the history
  • Loading branch information
Yazawazi committed Nov 28, 2023
1 parent 39cef98 commit 8a1f57e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions backend/funix/decorator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,15 @@ def flush(self):

def funix_class_params(*args, **kwargs):
def decorator(func):
class_method_ids_to_params[id(func)] = {
"args": args,
"kwargs": kwargs,
}
if "disable" in kwargs and kwargs["disable"]:
class_method_ids_to_params[id(func)] = {
"disable": kwargs["disable"],
}
else:
class_method_ids_to_params[id(func)] = {
"args": args,
"kwargs": kwargs,
}
return func

return decorator
Expand Down Expand Up @@ -2025,6 +2030,8 @@ def funix_class(inited_class):
funix()(function)
else:
params = class_method_ids_to_params[org_id]
if "disable" in params:
continue
args = params["args"]
kwargs = params["kwargs"]
funix(*args, **kwargs)(function)

0 comments on commit 8a1f57e

Please sign in to comment.