generated from amazon-archives/__template_MIT-0
-
Notifications
You must be signed in to change notification settings - Fork 455
Closed
Description
What were you trying to accomplish?
I want to use the @tracer.capture_method decorator for detailed function level tracing however it's currently unusable because it disables all errors when linting with mypy.
Expected Behavior
See code example below
Current Behavior
Function signatures (argument and return types) are not preserved when decorated with @tracer.capture_method and linting with mypy.
Possible Solution
Mypy can be forced to look at the decorated function signature: https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators
Steps to Reproduce (for bugs)
- Use code sample below
- Run mypy (tested on
mypy==0.782)
Environment
- Powertools version used:
aws-lambda-powertools==1.10.2 - Packaging format (Layers, PyPi): PyPi
tracer = Tracer()
@tracer.capture_method
def foo(bar: str) -> str:
return bar
x = foo('baz')
x.get('this is not a dict') # should cause mypy error
y = foo(123) # should cause mypy errorMetadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working