You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BaseSegment defines put_annotation as having return type NoReturn #2002
The return type should be None. NoReturn means that the function never returns (e.g. it always throws an exception) and makes type checkers (e.g. mypy) mark all code following put_annotation as unreachable.
Also applies to put_metadata, patch, and patch_all.
Current Behaviour
These methods breaks type checking in any modules they're used because all code following a call to e.g. put_annotation is marked as unreachable.
Code snippet
withTracer().provider.in_subsegment('test') assubsegment:
subsegment.put_metadata('x', 1)
print("hi") # marked as unreachable
Possible Solution
Change the return type to None.
Steps to Reproduce
Use the code snippet above and run mypy on the file.
Thanks a lot for filling this Johan, definitely overlooked it. If you have
the bandwidth to make a PR, we can include it in the next release.
Thank you!
On Mon, 13 Mar 2023 at 12:06, Johan Tibell ***@***.***> wrote:
Expected Behaviour
The return type should be None. NoReturn means that the function never
returns (e.g. it always throws an exception) and makes type checkers (e.g.
mypy) mark all code following put_annotation as unreachable.
Also applies to put_metadata, patch, and patch_all.
Current Behaviour
These methods breaks type checking in any modules they're used because all
code following a call to e.g. put_annotation is marked as unreachable.
Code snippet
with Tracer().provider.in_subsegment('test') as subsegment:
subsegment.put_metadata('x', 1)
print("hi"). # marked as unreachable
Possible Solution
Change the return type to None.
Steps to Reproduce
Use the code snippet above and run mypy on the file.
AWS Lambda Powertools for Python version
latest
AWS Lambda function runtime
3.9
Packaging format used
PyPi
Debugging logs
*No response*
—
Reply to this email directly, view it on GitHub
<#2002>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBEEDTGLIBZ26P62YT3W335RRANCNFSM6AAAAAAVY5JAIM>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
Activity
heitorlessa commentedon Mar 13, 2023
github-actions commentedon Mar 17, 2023
This is now released under 2.10.0 version!