-
Notifications
You must be signed in to change notification settings - Fork 681
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
Add optional type hinting to arguments #4455
base: main
Are you sure you want to change the base?
Conversation
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.
If you add from __future__ import annotations
you can avoid importing Optional and use | None
syntax, while you are at it you may also drop the usage of Dict
and List
and use dict
and list
instead.
My reasoning was that the |
Updated the places where I have changed something and a few places in the same area to keep some consistency. I would be happy to do more but feels like a new PR as it would be a big change and I would rather get my original issue fixed sooner |
opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal/export/__init__.py
Outdated
Show resolved
Hide resolved
shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/__init__.py
Outdated
Show resolved
Hide resolved
shim/opentelemetry-opentracing-shim/src/opentelemetry/shim/opentracing_shim/__init__.py
Outdated
Show resolved
Hide resolved
I've filed this open-telemetry/opentelemetry-python-contrib#3320 because this PR failed at least three times that test. Since this continues to fail maybe it's not a flaky test and we are introducing a regression somewhere here instead. |
Description
Adds
Optional
type hint in all places where arguments default toNone
and so are clearlyOptional
Note the first commit is the changes that I would like for my application. 2nd one is just me trying to fix the same issue elsewhere. If there is something controversial about the second commit I'm happy to drop it.
Fixes #4454
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
typeCheckingMode = "off"
in thepyproject.toml
pyright .
onmain
and see 1560 errorspyright .
on this branch and see 1508 errorsDoes This PR Require a Contrib Repo Change?
Don't think so?
Checklist: