33import json
44import logging
55from abc import ABC
6- from typing import Callable , Dict , List , Optional , Union , Iterable
6+ from typing import Any , Callable , Dict , List , Optional , Union , \
7+ Iterable
78
89from azure .functions .decorators .blob import BlobTrigger , BlobInput , BlobOutput
910from azure .functions .decorators .core import Binding , Trigger , DataType , \
@@ -35,7 +36,7 @@ class Function(object):
3536 function indexing model. Ref: https://aka.ms/azure-function-ref
3637 """
3738
38- def __init__ (self , func : Callable , script_file : str ):
39+ def __init__ (self , func : Callable [..., Any ] , script_file : str ):
3940 """Constructor of :class:`FunctionBuilder` object.
4041
4142 :param func: User defined python function instance.
@@ -133,7 +134,7 @@ def get_dict_repr(self) -> Dict:
133134 stub_f_json .update (self .get_bindings_dict ()) # NoQA
134135 return stub_f_json
135136
136- def get_user_function (self ) -> Callable :
137+ def get_user_function (self ) -> Callable [..., Any ] :
137138 """Get the python function customer defined.
138139
139140 :return: The python function customer defined.
@@ -249,7 +250,9 @@ def app_script_file(self) -> str:
249250 """
250251 return self ._app_script_file
251252
252- def _validate_type (self , func : Union [Callable , FunctionBuilder ]) \
253+ def _validate_type (self ,
254+ func : Union [Callable [..., Any ],
255+ FunctionBuilder ]) \
253256 -> FunctionBuilder :
254257 """Validate the type of the function object and return the created
255258 :class:`FunctionBuilder` object.
@@ -270,7 +273,7 @@ def _validate_type(self, func: Union[Callable, FunctionBuilder]) \
270273 "Unsupported type for function app decorator found." )
271274 return fb
272275
273- def _configure_function_builder (self , wrap ) -> Callable :
276+ def _configure_function_builder (self , wrap ) -> Callable [..., Any ] :
274277 """Decorator function on user defined function to create and return
275278 :class:`FunctionBuilder` object from :class:`Callable` func.
276279 """
@@ -282,7 +285,7 @@ def decorator(func):
282285
283286 return decorator
284287
285- def function_name (self , name : str ) -> Callable :
288+ def function_name (self , name : str ) -> Callable [..., Any ] :
286289 """Set name of the :class:`Function` object.
287290
288291 :param name: Name of the function.
@@ -299,8 +302,8 @@ def decorator():
299302
300303 return wrap
301304
302- def http_type (self , http_type : str ) -> Callable :
303- """Set http type of the :class:`Function` object.
305+ def http_type (self , http_type : str ) -> Callable [..., Any ] :
306+ """Set http type of the :class:`Function` object.
304307
305308 :param http_type: Http type of the function.
306309 :return: Decorator function.
@@ -348,7 +351,7 @@ def route(self,
348351 auth_level : Optional [Union [AuthLevel , str ]] = None ,
349352 trigger_extra_fields : Dict = {},
350353 binding_extra_fields : Dict = {}
351- ) -> Callable :
354+ ) -> Callable [..., Any ] :
352355 """The route decorator adds :class:`HttpTrigger` and
353356 :class:`HttpOutput` binding to the :class:`FunctionBuilder` object
354357 for building :class:`Function` object used in worker function
@@ -402,7 +405,7 @@ def schedule(self,
402405 run_on_startup : Optional [bool ] = None ,
403406 use_monitor : Optional [bool ] = None ,
404407 data_type : Optional [Union [DataType , str ]] = None ,
405- ** kwargs ) -> Callable :
408+ ** kwargs ) -> Callable [..., Any ] :
406409 """The schedule decorator adds :class:`TimerTrigger` to the
407410 :class:`FunctionBuilder` object
408411 for building :class:`Function` object used in worker function
@@ -454,7 +457,7 @@ def service_bus_queue_trigger(
454457 access_rights : Optional [Union [AccessRights , str ]] = None ,
455458 is_sessions_enabled : Optional [bool ] = None ,
456459 cardinality : Optional [Union [Cardinality , str ]] = None ,
457- ** kwargs ) -> Callable :
460+ ** kwargs ) -> Callable [..., Any ] :
458461 """The on_service_bus_queue_change decorator adds
459462 :class:`ServiceBusQueueTrigger` to the :class:`FunctionBuilder` object
460463 for building :class:`Function` object used in worker function
@@ -513,7 +516,7 @@ def service_bus_topic_trigger(
513516 access_rights : Optional [Union [AccessRights , str ]] = None ,
514517 is_sessions_enabled : Optional [bool ] = None ,
515518 cardinality : Optional [Union [Cardinality , str ]] = None ,
516- ** kwargs ) -> Callable :
519+ ** kwargs ) -> Callable [..., Any ] :
517520 """The on_service_bus_topic_change decorator adds
518521 :class:`ServiceBusTopicTrigger` to the :class:`FunctionBuilder` object
519522 for building :class:`Function` object used in worker function
@@ -569,7 +572,7 @@ def queue_trigger(self,
569572 queue_name : str ,
570573 connection : str ,
571574 data_type : Optional [DataType ] = None ,
572- ** kwargs ) -> Callable :
575+ ** kwargs ) -> Callable [..., Any ] :
573576 """The queue_trigger decorator adds :class:`QueueTrigger` to the
574577 :class:`FunctionBuilder` object
575578 for building :class:`Function` object used in worker function
@@ -621,7 +624,7 @@ def event_hub_message_trigger(self,
621624 Union [Cardinality , str ]] = None ,
622625 consumer_group : Optional [
623626 str ] = None ,
624- ** kwargs ) -> Callable :
627+ ** kwargs ) -> Callable [..., Any ] :
625628 """The event_hub_message_trigger decorator adds
626629 :class:`EventHubTrigger`
627630 to the :class:`FunctionBuilder` object
@@ -695,7 +698,7 @@ def cosmos_db_trigger(self,
695698 data_type : Optional [
696699 Union [DataType , str ]] = None ,
697700 ** kwargs ) -> \
698- Callable :
701+ Callable [..., Any ] :
699702 """The cosmos_db_trigger decorator adds :class:`CosmosDBTrigger`
700703 to the :class:`FunctionBuilder` object
701704 for building :class:`Function` object used in worker function
@@ -799,7 +802,7 @@ def blob_trigger(self,
799802 path : str ,
800803 connection : str ,
801804 data_type : Optional [DataType ] = None ,
802- ** kwargs ) -> Callable :
805+ ** kwargs ) -> Callable [..., Any ] :
803806 """
804807 The blob_change_trigger decorator adds :class:`BlobTrigger` to the
805808 :class:`FunctionBuilder` object
@@ -844,7 +847,7 @@ def event_grid_trigger(self,
844847 arg_name : str ,
845848 data_type : Optional [
846849 Union [DataType , str ]] = None ,
847- ** kwargs ) -> Callable :
850+ ** kwargs ) -> Callable [..., Any ] :
848851 """
849852 The event_grid_trigger decorator adds
850853 :class:`EventGridTrigger`
@@ -885,7 +888,7 @@ def generic_trigger(self,
885888 type : str ,
886889 data_type : Optional [Union [DataType , str ]] = None ,
887890 ** kwargs
888- ) -> Callable :
891+ ) -> Callable [..., Any ] :
889892 """
890893 The generic_trigger decorator adds :class:`GenericTrigger`
891894 to the :class:`FunctionBuilder` object for building :class:`Function`
@@ -937,7 +940,7 @@ def service_bus_queue_output(self,
937940 access_rights : Optional [Union [
938941 AccessRights , str ]] = None ,
939942 ** kwargs ) -> \
940- Callable :
943+ Callable [..., Any ] :
941944 """The service_bus_queue_output decorator adds
942945 :class:`ServiceBusQueueOutput` to the :class:`FunctionBuilder` object
943946 for building :class:`Function` object used in worker function
@@ -989,7 +992,7 @@ def service_bus_topic_output(self,
989992 access_rights : Optional [Union [
990993 AccessRights , str ]] = None ,
991994 ** kwargs ) -> \
992- Callable :
995+ Callable [..., Any ] :
993996 """The service_bus_topic_output decorator adds
994997 :class:`ServiceBusTopicOutput` to the :class:`FunctionBuilder` object
995998 for building :class:`Function` object used in worker function
@@ -1039,7 +1042,7 @@ def queue_output(self,
10391042 queue_name : str ,
10401043 connection : str ,
10411044 data_type : Optional [DataType ] = None ,
1042- ** kwargs ) -> Callable :
1045+ ** kwargs ) -> Callable [..., Any ] :
10431046 """The queue_output decorator adds :class:`QueueOutput` to the
10441047 :class:`FunctionBuilder` object
10451048 for building :class:`Function` object used in worker function
@@ -1087,7 +1090,7 @@ def event_hub_output(self,
10871090 data_type : Optional [
10881091 Union [DataType , str ]] = None ,
10891092 ** kwargs ) -> \
1090- Callable :
1093+ Callable [..., Any ] :
10911094 """The event_hub_output decorator adds
10921095 :class:`EventHubOutput` to the :class:`FunctionBuilder` object
10931096 for building :class:`Function` object used in worker function
@@ -1143,7 +1146,7 @@ def cosmos_db_output(self,
11431146 data_type : Optional [
11441147 Union [DataType , str ]] = None ,
11451148 ** kwargs ) \
1146- -> Callable :
1149+ -> Callable [..., Any ] :
11471150 """The cosmos_db_output decorator adds
11481151 :class:`CosmosDBOutput` to the :class:`FunctionBuilder` object
11491152 for building :class:`Function` object used in worker function
@@ -1215,7 +1218,7 @@ def cosmos_db_input(self,
12151218 data_type : Optional [
12161219 Union [DataType , str ]] = None ,
12171220 ** kwargs ) \
1218- -> Callable :
1221+ -> Callable [..., Any ] :
12191222 """The cosmos_db_input decorator adds
12201223 :class:`CosmosDBInput` to the :class:`FunctionBuilder` object
12211224 for building :class:`Function` object used in worker function
@@ -1272,7 +1275,7 @@ def blob_input(self,
12721275 path : str ,
12731276 connection : str ,
12741277 data_type : Optional [DataType ] = None ,
1275- ** kwargs ) -> Callable :
1278+ ** kwargs ) -> Callable [..., Any ] :
12761279 """
12771280 The blob_input decorator adds :class:`BlobInput` to the
12781281 :class:`FunctionBuilder` object
@@ -1320,7 +1323,7 @@ def blob_output(self,
13201323 path : str ,
13211324 connection : str ,
13221325 data_type : Optional [DataType ] = None ,
1323- ** kwargs ) -> Callable :
1326+ ** kwargs ) -> Callable [..., Any ] :
13241327 """
13251328 The blob_output decorator adds :class:`BlobOutput` to the
13261329 :class:`FunctionBuilder` object
@@ -1368,7 +1371,7 @@ def event_grid_output(self,
13681371 topic_key_setting : str ,
13691372 data_type : Optional [
13701373 Union [DataType , str ]] = None ,
1371- ** kwargs ) -> Callable :
1374+ ** kwargs ) -> Callable [..., Any ] :
13721375 """
13731376 The event_grid_output decorator adds
13741377 :class:`EventGridOutput`
@@ -1419,7 +1422,7 @@ def table_input(self,
14191422 take : Optional [int ] = None ,
14201423 filter : Optional [str ] = None ,
14211424 data_type : Optional [
1422- Union [DataType , str ]] = None ) -> Callable :
1425+ Union [DataType , str ]] = None ) -> Callable [..., Any ] :
14231426 """
14241427 The table_input decorator adds :class:`TableInput` to the
14251428 :class:`FunctionBuilder` object
@@ -1474,7 +1477,7 @@ def table_output(self,
14741477 row_key : Optional [str ] = None ,
14751478 partition_key : Optional [str ] = None ,
14761479 data_type : Optional [
1477- Union [DataType , str ]] = None ) -> Callable :
1480+ Union [DataType , str ]] = None ) -> Callable [..., Any ] :
14781481 """
14791482 The table_output decorator adds :class:`TableOutput` to the
14801483 :class:`FunctionBuilder` object
@@ -1522,7 +1525,7 @@ def generic_input_binding(self,
15221525 type : str ,
15231526 data_type : Optional [Union [DataType , str ]] = None ,
15241527 ** kwargs
1525- ) -> Callable :
1528+ ) -> Callable [..., Any ] :
15261529 """
15271530 The generic_input_binding decorator adds :class:`GenericInputBinding`
15281531 to the :class:`FunctionBuilder` object for building :class:`Function`
@@ -1567,7 +1570,7 @@ def generic_output_binding(self,
15671570 data_type : Optional [
15681571 Union [DataType , str ]] = None ,
15691572 ** kwargs
1570- ) -> Callable :
1573+ ) -> Callable [..., Any ] :
15711574 """
15721575 The generic_output_binding decorator adds :class:`GenericOutputBinding`
15731576 to the :class:`FunctionBuilder` object for building :class:`Function`
0 commit comments