-
Notifications
You must be signed in to change notification settings - Fork 763
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe your environment
opentelemetry-semantic-conventions==0.47b0
What happened?
#3966 added many Final annotations to semantic convention literals.
However, usage of any annotation for Enum member attributes is considered invalid, and a bare Final not being flagged appear to be an edge case that was overlooked in at least pyright: microsoft/pyright#8543 (comment)
This leads to misleading type checker errors.
Steps to Reproduce
Consider:
from opentelemetry.semconv.attributes.otel_attributes import OtelStatusCodeValues
def get_ok() -> OtelStatusCodeValues:
return OtelStatusCodeValues.OKExpected Result
No type violations in get_ok().
Actual Result
Expression of type "Literal['OK']" is incompatible with return type "OtelStatusCodeValues"
"Literal['OK']" is incompatible with "OtelStatusCodeValues"Pylance[reportReturnType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportReturnType)
Additional context
No response
Would you like to implement a fix?
None
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working