-
Notifications
You must be signed in to change notification settings - Fork 711
opentelemetry.sdk.util type stubs #1385
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
opentelemetry.sdk.util type stubs #1385
Conversation
b9c6aa1
to
b34f968
Compare
@@ -0,0 +1,71 @@ | |||
# Copyright The OpenTelemetry Authors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do imports for __init__.pyi
files work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? The pyi don't effect anything at runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant the from typing import
statements below, I was just curious what an import does in a .pyi
file
] | ||
Attributes = Optional[Mapping[str, AttributeValue]] | ||
AttributesAsKey = Tuple[Tuple[str, AttributeValueAsKey], ...] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked up the Ellipsis here but I'm still unsure as to why it's needed here. If the key and value are already in the first element of the tuple, what goes in the rest of the tuple?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Left some comments out of curiosity.
@aabmass looks like there's a few unresolved comments from @NathanielRN, can you take a quick look and resolve the conflict |
b34f968
to
8c19f08
Compare
Description
Adds type stubs for
opentelemetry/sdk/util/__init__py
, most importantlyBoundedList
andBoundedDict
which are pretty widely used. I could not put the annotations inline because you can't subclasstyping.Sequence
andcollections.abc.Sequence
, and you can't add generic parameters tocollections.abc.Sequence
either.Type of change
How Has This Been Tested?
These are typing changes only, so I tested only by running mypy on this module
Checklist: