3
3
import json
4
4
import logging
5
5
from 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
7
8
8
9
from azure .functions .decorators .blob import BlobTrigger , BlobInput , BlobOutput
9
10
from azure .functions .decorators .core import Binding , Trigger , DataType , \
@@ -35,7 +36,7 @@ class Function(object):
35
36
function indexing model. Ref: https://aka.ms/azure-function-ref
36
37
"""
37
38
38
- def __init__ (self , func : Callable , script_file : str ):
39
+ def __init__ (self , func : Callable [..., Any ] , script_file : str ):
39
40
"""Constructor of :class:`FunctionBuilder` object.
40
41
41
42
:param func: User defined python function instance.
@@ -133,7 +134,7 @@ def get_dict_repr(self) -> Dict:
133
134
stub_f_json .update (self .get_bindings_dict ()) # NoQA
134
135
return stub_f_json
135
136
136
- def get_user_function (self ) -> Callable :
137
+ def get_user_function (self ) -> Callable [..., Any ] :
137
138
"""Get the python function customer defined.
138
139
139
140
:return: The python function customer defined.
@@ -249,7 +250,9 @@ def app_script_file(self) -> str:
249
250
"""
250
251
return self ._app_script_file
251
252
252
- def _validate_type (self , func : Union [Callable , FunctionBuilder ]) \
253
+ def _validate_type (self ,
254
+ func : Union [Callable [..., Any ],
255
+ FunctionBuilder ]) \
253
256
-> FunctionBuilder :
254
257
"""Validate the type of the function object and return the created
255
258
:class:`FunctionBuilder` object.
@@ -270,7 +273,7 @@ def _validate_type(self, func: Union[Callable, FunctionBuilder]) \
270
273
"Unsupported type for function app decorator found." )
271
274
return fb
272
275
273
- def _configure_function_builder (self , wrap ) -> Callable :
276
+ def _configure_function_builder (self , wrap ) -> Callable [..., Any ] :
274
277
"""Decorator function on user defined function to create and return
275
278
:class:`FunctionBuilder` object from :class:`Callable` func.
276
279
"""
@@ -282,7 +285,7 @@ def decorator(func):
282
285
283
286
return decorator
284
287
285
- def function_name (self , name : str ) -> Callable :
288
+ def function_name (self , name : str ) -> Callable [..., Any ] :
286
289
"""Set name of the :class:`Function` object.
287
290
288
291
:param name: Name of the function.
@@ -299,8 +302,8 @@ def decorator():
299
302
300
303
return wrap
301
304
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.
304
307
305
308
:param http_type: Http type of the function.
306
309
:return: Decorator function.
@@ -348,7 +351,7 @@ def route(self,
348
351
auth_level : Optional [Union [AuthLevel , str ]] = None ,
349
352
trigger_extra_fields : Dict = {},
350
353
binding_extra_fields : Dict = {}
351
- ) -> Callable :
354
+ ) -> Callable [..., Any ] :
352
355
"""The route decorator adds :class:`HttpTrigger` and
353
356
:class:`HttpOutput` binding to the :class:`FunctionBuilder` object
354
357
for building :class:`Function` object used in worker function
@@ -402,7 +405,7 @@ def schedule(self,
402
405
run_on_startup : Optional [bool ] = None ,
403
406
use_monitor : Optional [bool ] = None ,
404
407
data_type : Optional [Union [DataType , str ]] = None ,
405
- ** kwargs ) -> Callable :
408
+ ** kwargs ) -> Callable [..., Any ] :
406
409
"""The schedule decorator adds :class:`TimerTrigger` to the
407
410
:class:`FunctionBuilder` object
408
411
for building :class:`Function` object used in worker function
@@ -454,7 +457,7 @@ def service_bus_queue_trigger(
454
457
access_rights : Optional [Union [AccessRights , str ]] = None ,
455
458
is_sessions_enabled : Optional [bool ] = None ,
456
459
cardinality : Optional [Union [Cardinality , str ]] = None ,
457
- ** kwargs ) -> Callable :
460
+ ** kwargs ) -> Callable [..., Any ] :
458
461
"""The on_service_bus_queue_change decorator adds
459
462
:class:`ServiceBusQueueTrigger` to the :class:`FunctionBuilder` object
460
463
for building :class:`Function` object used in worker function
@@ -513,7 +516,7 @@ def service_bus_topic_trigger(
513
516
access_rights : Optional [Union [AccessRights , str ]] = None ,
514
517
is_sessions_enabled : Optional [bool ] = None ,
515
518
cardinality : Optional [Union [Cardinality , str ]] = None ,
516
- ** kwargs ) -> Callable :
519
+ ** kwargs ) -> Callable [..., Any ] :
517
520
"""The on_service_bus_topic_change decorator adds
518
521
:class:`ServiceBusTopicTrigger` to the :class:`FunctionBuilder` object
519
522
for building :class:`Function` object used in worker function
@@ -569,7 +572,7 @@ def queue_trigger(self,
569
572
queue_name : str ,
570
573
connection : str ,
571
574
data_type : Optional [DataType ] = None ,
572
- ** kwargs ) -> Callable :
575
+ ** kwargs ) -> Callable [..., Any ] :
573
576
"""The queue_trigger decorator adds :class:`QueueTrigger` to the
574
577
:class:`FunctionBuilder` object
575
578
for building :class:`Function` object used in worker function
@@ -621,7 +624,7 @@ def event_hub_message_trigger(self,
621
624
Union [Cardinality , str ]] = None ,
622
625
consumer_group : Optional [
623
626
str ] = None ,
624
- ** kwargs ) -> Callable :
627
+ ** kwargs ) -> Callable [..., Any ] :
625
628
"""The event_hub_message_trigger decorator adds
626
629
:class:`EventHubTrigger`
627
630
to the :class:`FunctionBuilder` object
@@ -695,7 +698,7 @@ def cosmos_db_trigger(self,
695
698
data_type : Optional [
696
699
Union [DataType , str ]] = None ,
697
700
** kwargs ) -> \
698
- Callable :
701
+ Callable [..., Any ] :
699
702
"""The cosmos_db_trigger decorator adds :class:`CosmosDBTrigger`
700
703
to the :class:`FunctionBuilder` object
701
704
for building :class:`Function` object used in worker function
@@ -799,7 +802,7 @@ def blob_trigger(self,
799
802
path : str ,
800
803
connection : str ,
801
804
data_type : Optional [DataType ] = None ,
802
- ** kwargs ) -> Callable :
805
+ ** kwargs ) -> Callable [..., Any ] :
803
806
"""
804
807
The blob_change_trigger decorator adds :class:`BlobTrigger` to the
805
808
:class:`FunctionBuilder` object
@@ -844,7 +847,7 @@ def event_grid_trigger(self,
844
847
arg_name : str ,
845
848
data_type : Optional [
846
849
Union [DataType , str ]] = None ,
847
- ** kwargs ) -> Callable :
850
+ ** kwargs ) -> Callable [..., Any ] :
848
851
"""
849
852
The event_grid_trigger decorator adds
850
853
:class:`EventGridTrigger`
@@ -885,7 +888,7 @@ def generic_trigger(self,
885
888
type : str ,
886
889
data_type : Optional [Union [DataType , str ]] = None ,
887
890
** kwargs
888
- ) -> Callable :
891
+ ) -> Callable [..., Any ] :
889
892
"""
890
893
The generic_trigger decorator adds :class:`GenericTrigger`
891
894
to the :class:`FunctionBuilder` object for building :class:`Function`
@@ -937,7 +940,7 @@ def service_bus_queue_output(self,
937
940
access_rights : Optional [Union [
938
941
AccessRights , str ]] = None ,
939
942
** kwargs ) -> \
940
- Callable :
943
+ Callable [..., Any ] :
941
944
"""The service_bus_queue_output decorator adds
942
945
:class:`ServiceBusQueueOutput` to the :class:`FunctionBuilder` object
943
946
for building :class:`Function` object used in worker function
@@ -989,7 +992,7 @@ def service_bus_topic_output(self,
989
992
access_rights : Optional [Union [
990
993
AccessRights , str ]] = None ,
991
994
** kwargs ) -> \
992
- Callable :
995
+ Callable [..., Any ] :
993
996
"""The service_bus_topic_output decorator adds
994
997
:class:`ServiceBusTopicOutput` to the :class:`FunctionBuilder` object
995
998
for building :class:`Function` object used in worker function
@@ -1039,7 +1042,7 @@ def queue_output(self,
1039
1042
queue_name : str ,
1040
1043
connection : str ,
1041
1044
data_type : Optional [DataType ] = None ,
1042
- ** kwargs ) -> Callable :
1045
+ ** kwargs ) -> Callable [..., Any ] :
1043
1046
"""The queue_output decorator adds :class:`QueueOutput` to the
1044
1047
:class:`FunctionBuilder` object
1045
1048
for building :class:`Function` object used in worker function
@@ -1087,7 +1090,7 @@ def event_hub_output(self,
1087
1090
data_type : Optional [
1088
1091
Union [DataType , str ]] = None ,
1089
1092
** kwargs ) -> \
1090
- Callable :
1093
+ Callable [..., Any ] :
1091
1094
"""The event_hub_output decorator adds
1092
1095
:class:`EventHubOutput` to the :class:`FunctionBuilder` object
1093
1096
for building :class:`Function` object used in worker function
@@ -1143,7 +1146,7 @@ def cosmos_db_output(self,
1143
1146
data_type : Optional [
1144
1147
Union [DataType , str ]] = None ,
1145
1148
** kwargs ) \
1146
- -> Callable :
1149
+ -> Callable [..., Any ] :
1147
1150
"""The cosmos_db_output decorator adds
1148
1151
:class:`CosmosDBOutput` to the :class:`FunctionBuilder` object
1149
1152
for building :class:`Function` object used in worker function
@@ -1215,7 +1218,7 @@ def cosmos_db_input(self,
1215
1218
data_type : Optional [
1216
1219
Union [DataType , str ]] = None ,
1217
1220
** kwargs ) \
1218
- -> Callable :
1221
+ -> Callable [..., Any ] :
1219
1222
"""The cosmos_db_input decorator adds
1220
1223
:class:`CosmosDBInput` to the :class:`FunctionBuilder` object
1221
1224
for building :class:`Function` object used in worker function
@@ -1272,7 +1275,7 @@ def blob_input(self,
1272
1275
path : str ,
1273
1276
connection : str ,
1274
1277
data_type : Optional [DataType ] = None ,
1275
- ** kwargs ) -> Callable :
1278
+ ** kwargs ) -> Callable [..., Any ] :
1276
1279
"""
1277
1280
The blob_input decorator adds :class:`BlobInput` to the
1278
1281
:class:`FunctionBuilder` object
@@ -1320,7 +1323,7 @@ def blob_output(self,
1320
1323
path : str ,
1321
1324
connection : str ,
1322
1325
data_type : Optional [DataType ] = None ,
1323
- ** kwargs ) -> Callable :
1326
+ ** kwargs ) -> Callable [..., Any ] :
1324
1327
"""
1325
1328
The blob_output decorator adds :class:`BlobOutput` to the
1326
1329
:class:`FunctionBuilder` object
@@ -1368,7 +1371,7 @@ def event_grid_output(self,
1368
1371
topic_key_setting : str ,
1369
1372
data_type : Optional [
1370
1373
Union [DataType , str ]] = None ,
1371
- ** kwargs ) -> Callable :
1374
+ ** kwargs ) -> Callable [..., Any ] :
1372
1375
"""
1373
1376
The event_grid_output decorator adds
1374
1377
:class:`EventGridOutput`
@@ -1419,7 +1422,7 @@ def table_input(self,
1419
1422
take : Optional [int ] = None ,
1420
1423
filter : Optional [str ] = None ,
1421
1424
data_type : Optional [
1422
- Union [DataType , str ]] = None ) -> Callable :
1425
+ Union [DataType , str ]] = None ) -> Callable [..., Any ] :
1423
1426
"""
1424
1427
The table_input decorator adds :class:`TableInput` to the
1425
1428
:class:`FunctionBuilder` object
@@ -1474,7 +1477,7 @@ def table_output(self,
1474
1477
row_key : Optional [str ] = None ,
1475
1478
partition_key : Optional [str ] = None ,
1476
1479
data_type : Optional [
1477
- Union [DataType , str ]] = None ) -> Callable :
1480
+ Union [DataType , str ]] = None ) -> Callable [..., Any ] :
1478
1481
"""
1479
1482
The table_output decorator adds :class:`TableOutput` to the
1480
1483
:class:`FunctionBuilder` object
@@ -1522,7 +1525,7 @@ def generic_input_binding(self,
1522
1525
type : str ,
1523
1526
data_type : Optional [Union [DataType , str ]] = None ,
1524
1527
** kwargs
1525
- ) -> Callable :
1528
+ ) -> Callable [..., Any ] :
1526
1529
"""
1527
1530
The generic_input_binding decorator adds :class:`GenericInputBinding`
1528
1531
to the :class:`FunctionBuilder` object for building :class:`Function`
@@ -1567,7 +1570,7 @@ def generic_output_binding(self,
1567
1570
data_type : Optional [
1568
1571
Union [DataType , str ]] = None ,
1569
1572
** kwargs
1570
- ) -> Callable :
1573
+ ) -> Callable [..., Any ] :
1571
1574
"""
1572
1575
The generic_output_binding decorator adds :class:`GenericOutputBinding`
1573
1576
to the :class:`FunctionBuilder` object for building :class:`Function`
0 commit comments