mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Pretend _EnumTypeWrapper inherits from type (#10203)
Pretend `google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper` inherits from `type`. It doesn't really, but this makes type checkers stop complaining when you use it as a metaclass, which is the only reason the class exists.
This commit is contained in:
@@ -6,7 +6,10 @@ _V = TypeVar("_V", bound=int)
|
||||
|
||||
# Expose a generic version so that those using mypy-protobuf
|
||||
# can get autogenerated NewType wrapper around the int values
|
||||
class _EnumTypeWrapper(Generic[_V]):
|
||||
# NOTE: this doesn't actually inherit from type,
|
||||
# but mypy doesn't support metaclasses that don't inherit from type,
|
||||
# so we pretend it does in the stubs...
|
||||
class _EnumTypeWrapper(type, Generic[_V]):
|
||||
DESCRIPTOR: EnumDescriptor
|
||||
def __init__(self, enum_type: EnumDescriptor) -> None: ...
|
||||
def Name(self, number: _V) -> str: ...
|
||||
|
||||
Reference in New Issue
Block a user