Skip to content

Commit 7c9a319

Browse files
author
Michael Brewer
authored
fix(tracer): Correct type hint for MyPy (#365)
1 parent 29497d4 commit 7c9a319

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Diff for: aws_lambda_powertools/tracing/tracer.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def patch(self, modules: Tuple[str] = None):
244244

245245
def capture_lambda_handler(
246246
self,
247-
lambda_handler: Callable[[Dict, Any, Optional[Dict]], Any] = None,
247+
lambda_handler: Union[Callable[[Dict, Any], Any], Callable[[Dict, Any, Optional[Dict]], Any]] = None,
248248
capture_response: Optional[bool] = None,
249249
capture_error: Optional[bool] = None,
250250
):
@@ -517,7 +517,7 @@ async def async_tasks():
517517

518518
def _decorate_async_function(
519519
self,
520-
method: Callable = None,
520+
method: Callable,
521521
capture_response: Optional[Union[bool, str]] = None,
522522
capture_error: Optional[Union[bool, str]] = None,
523523
method_name: str = None,
@@ -544,7 +544,7 @@ async def decorate(*args, **kwargs):
544544

545545
def _decorate_generator_function(
546546
self,
547-
method: Callable = None,
547+
method: Callable,
548548
capture_response: Optional[Union[bool, str]] = None,
549549
capture_error: Optional[Union[bool, str]] = None,
550550
method_name: str = None,
@@ -571,7 +571,7 @@ def decorate(*args, **kwargs):
571571

572572
def _decorate_generator_function_with_context_manager(
573573
self,
574-
method: Callable = None,
574+
method: Callable,
575575
capture_response: Optional[Union[bool, str]] = None,
576576
capture_error: Optional[Union[bool, str]] = None,
577577
method_name: str = None,
@@ -599,7 +599,7 @@ def decorate(*args, **kwargs):
599599

600600
def _decorate_sync_function(
601601
self,
602-
method: Callable = None,
602+
method: Callable,
603603
capture_response: Optional[Union[bool, str]] = None,
604604
capture_error: Optional[Union[bool, str]] = None,
605605
method_name: str = None,
@@ -654,20 +654,20 @@ def _add_response_as_metadata(
654654

655655
def _add_full_exception_as_metadata(
656656
self,
657-
method_name: str = None,
658-
error: Exception = None,
659-
subsegment: BaseSegment = None,
657+
method_name: str,
658+
error: Exception,
659+
subsegment: BaseSegment,
660660
capture_error: Optional[bool] = None,
661661
):
662662
"""Add full exception object as metadata for given subsegment
663663
664664
Parameters
665665
----------
666-
method_name : str, optional
666+
method_name : str
667667
method name to add as metadata key, by default None
668-
error : Exception, optional
668+
error : Exception
669669
error to add as subsegment metadata, by default None
670-
subsegment : BaseSegment, optional
670+
subsegment : BaseSegment
671671
existing subsegment to add metadata on, by default None
672672
capture_error : bool, optional
673673
Do not include error as metadata, by default True
@@ -717,7 +717,7 @@ def __build_config(
717717
service: str = None,
718718
disabled: bool = None,
719719
auto_patch: bool = None,
720-
patch_modules: List = None,
720+
patch_modules: Union[List, Tuple] = None,
721721
provider: BaseProvider = None,
722722
):
723723
""" Populates Tracer config for new and existing initializations """

0 commit comments

Comments
 (0)