Skip to content

DeviceCapability enum has value None which can't be used from generated python code #48

Description

@Zunawe

Unsure to what degree this might be considered a grpcio bug. When generating python code, this class is defined:

class DeviceCapability(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
    __slots__ = ()
    None: _ClassVar[DeviceCapability]
    ReadMemory: _ClassVar[DeviceCapability]
    WriteMemory: _ClassVar[DeviceCapability]
    ...

But None is a reserved keyword, so it doesn't get created in the namespace as an attribute. It just sits there as a statement I guess. The type hint causes my IDE to be upset, but nothing crashes.

It does mean that it's impossible to reference DeviceCapability.None. I'm not sure if explicitly using the int is a workaround. This isn't blocking me on anything, I just happened to notice it when looking through the generated code.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions