in azure_functions_worker/functions.py [0:0]
def get_function_return_type(annotations: dict, has_explicit_return: bool,
has_implicit_return: bool, binding_name: str,
func_name: str):
return_pytype = None
if has_explicit_return and 'return' in annotations:
return_anno = annotations.get('return')
if typing_inspect.is_generic_type(
return_anno) and typing_inspect.get_origin(
return_anno).__name__ == 'Out':
raise FunctionLoadError(
func_name,
'return annotation should not be azure.functions.Out')
return_pytype = return_anno
if not isinstance(return_pytype, type):
raise FunctionLoadError(
func_name,
f'has invalid non-type return '
f'annotation {return_pytype!r}')
if return_pytype is (str, bytes):
binding_name = 'generic'
if not bindings_utils.check_output_type_annotation(
binding_name, return_pytype):
raise FunctionLoadError(
func_name,
f'Python return annotation "{return_pytype.__name__}" '
f'does not match binding type "{binding_name}"')
if has_implicit_return and 'return' in annotations:
return_pytype = annotations.get('return')
return_type = None
if has_explicit_return or has_implicit_return:
return_type = ParamTypeInfo(binding_name, return_pytype)
return return_type