Add optional type hinting to arguments#4455
Conversation
xrmx
left a comment
There was a problem hiding this comment.
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
Optionaltype hint in all places where arguments default toNoneand so are clearlyOptionalNote 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.tomlpyright .onmainand see 1560 errorspyright .on this branch and see 1508 errorsDoes This PR Require a Contrib Repo Change?
Don't think so?
Checklist: