MCPcopy Index your code
hub / github.com/zappa/Zappa / run_function

Method run_function

zappa/handler.py:615–632  ·  view source on GitHub ↗

Given a function and event context, detect signature and execute, returning any result.

(app_function, event, context)

Source from the content-addressed store, hash-verified

613
614 @staticmethod
615 def run_function(app_function, event, context):
616 """
617 Given a function and event context,
618 detect signature and execute, returning any result.
619 """
620 args, varargs, keywords, defaults, _, _, _ = inspect.getfullargspec(app_function)
621 num_args = len(args)
622 if num_args == 0:
623 result = app_function(event, context) if varargs else app_function()
624 elif num_args == 1:
625 result = app_function(event, context) if varargs else app_function(event)
626 elif num_args == 2:
627 result = app_function(event, context)
628 else:
629 raise RuntimeError(
630 "Function signature is invalid. Expected a function that accepts at most " "2 arguments or varargs."
631 )
632 return result
633
634 def get_function_for_aws_event(self, record):
635 """

Callers 3

handlerMethod · 0.95
test_run_functionMethod · 0.80

Calls

no outgoing calls

Tested by 2

test_run_functionMethod · 0.64