Skip to content

Commit 10f5c94

Browse files
authored
fixed issue for apply arity issues
1 parent cd3ef0f commit 10f5c94

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

adk/ADK.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def __init__(self, apply_func, load_func=None):
2323
self.load_func = load_func
2424
else:
2525
self.load_func = None
26-
if len(apply_args) > 2 or len(apply_args) == 0:
26+
self.apply_arity = len(apply_args)
27+
if self.apply_arity > 2 or len(apply_args) == 0:
2728
raise Exception("apply function may have between 1 and 2 parameters, not {}".format(len(apply_args)))
2829
self.apply_func = apply_func
2930
self.is_local = not os.path.exists(self.FIFO_PATH)
@@ -119,7 +120,7 @@ def process_loop(self):
119120
try:
120121
request = json.loads(line)
121122
formatted_input = self.format_data(request)
122-
if self.load_result:
123+
if self.load_result and self.apply_arity > 1:
123124
apply_result = self.apply_func(formatted_input, self.load_result)
124125
else:
125126
apply_result = self.apply_func(formatted_input)

0 commit comments

Comments
 (0)