Skip to content

fix(tracer): Correct type hint for MyPy #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions aws_lambda_powertools/tracing/tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def patch(self, modules: Tuple[str] = None):

def capture_lambda_handler(
self,
lambda_handler: Callable[[Dict, Any, Optional[Dict]], Any] = None,
lambda_handler: Union[Callable[[Dict, Any], Any], Callable[[Dict, Any, Optional[Dict]], Any]] = None,
capture_response: Optional[bool] = None,
capture_error: Optional[bool] = None,
):
Expand Down Expand Up @@ -517,7 +517,7 @@ async def async_tasks():

def _decorate_async_function(
self,
method: Callable = None,
method: Callable,
capture_response: Optional[Union[bool, str]] = None,
capture_error: Optional[Union[bool, str]] = None,
method_name: str = None,
Expand All @@ -544,7 +544,7 @@ async def decorate(*args, **kwargs):

def _decorate_generator_function(
self,
method: Callable = None,
method: Callable,
capture_response: Optional[Union[bool, str]] = None,
capture_error: Optional[Union[bool, str]] = None,
method_name: str = None,
Expand All @@ -571,7 +571,7 @@ def decorate(*args, **kwargs):

def _decorate_generator_function_with_context_manager(
self,
method: Callable = None,
method: Callable,
capture_response: Optional[Union[bool, str]] = None,
capture_error: Optional[Union[bool, str]] = None,
method_name: str = None,
Expand Down Expand Up @@ -599,7 +599,7 @@ def decorate(*args, **kwargs):

def _decorate_sync_function(
self,
method: Callable = None,
method: Callable,
capture_response: Optional[Union[bool, str]] = None,
capture_error: Optional[Union[bool, str]] = None,
method_name: str = None,
Expand Down Expand Up @@ -654,20 +654,20 @@ def _add_response_as_metadata(

def _add_full_exception_as_metadata(
self,
method_name: str = None,
error: Exception = None,
subsegment: BaseSegment = None,
method_name: str,
error: Exception,
subsegment: BaseSegment,
capture_error: Optional[bool] = None,
):
"""Add full exception object as metadata for given subsegment

Parameters
----------
method_name : str, optional
method_name : str
method name to add as metadata key, by default None
error : Exception, optional
error : Exception
error to add as subsegment metadata, by default None
subsegment : BaseSegment, optional
subsegment : BaseSegment
existing subsegment to add metadata on, by default None
capture_error : bool, optional
Do not include error as metadata, by default True
Expand Down Expand Up @@ -717,7 +717,7 @@ def __build_config(
service: str = None,
disabled: bool = None,
auto_patch: bool = None,
patch_modules: List = None,
patch_modules: Union[List, Tuple] = None,
provider: BaseProvider = None,
):
""" Populates Tracer config for new and existing initializations """
Expand Down