Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 2 commits into from
Jan 15, 2021

Conversation

aabmass
Copy link
Member

@aabmass aabmass commented Nov 17, 2020

Description

Adds type stubs for opentelemetry/sdk/util/__init__py, most importantly BoundedList and BoundedDict which are pretty widely used. I could not put the annotations inline because you can't subclass typing.Sequence and collections.abc.Sequence, and you can't add generic parameters to collections.abc.Sequence either.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

These are typing changes only, so I tested only by running mypy on this module

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@aabmass aabmass force-pushed the bound-list-dict-typing branch 3 times, most recently from b9c6aa1 to b34f968 Compare November 17, 2020 17:42
@aabmass aabmass marked this pull request as ready for review November 17, 2020 18:27
@aabmass aabmass requested review from a team, owais and ocelotl and removed request for a team November 17, 2020 18:27
@@ -0,0 +1,71 @@
# Copyright The OpenTelemetry Authors
Copy link
Contributor

@NathanielRN NathanielRN Dec 16, 2020

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?

Copy link
Member Author

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

Copy link
Contributor

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], ...]
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@NathanielRN NathanielRN left a 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.

@codeboten
Copy link
Contributor

@aabmass looks like there's a few unresolved comments from @NathanielRN, can you take a quick look and resolve the conflict

@aabmass aabmass force-pushed the bound-list-dict-typing branch from b34f968 to 8c19f08 Compare January 15, 2021 16:16
@aabmass aabmass added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 15, 2021
@codeboten codeboten merged commit 7688332 into open-telemetry:master Jan 15, 2021
@aabmass aabmass deleted the bound-list-dict-typing branch January 15, 2021 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants