mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
Allow unicode and bytes in the EnumTypeWrapper.Value classmethod (#5004)
Here is a unit test which shows that this behavior is accepted by protobuf itself at runtime in both py2 and py3 https://github.com/dropbox/mypy-protobuf/pull/205
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Generic, List, Tuple, TypeVar
|
||||
from typing import Generic, List, Tuple, TypeVar, Union
|
||||
|
||||
from google.protobuf.descriptor import EnumDescriptor
|
||||
|
||||
@@ -10,7 +10,7 @@ class _EnumTypeWrapper(Generic[_V]):
|
||||
DESCRIPTOR: EnumDescriptor
|
||||
def __init__(self, enum_type: EnumDescriptor) -> None: ...
|
||||
def Name(self, number: _V) -> str: ...
|
||||
def Value(self, name: str) -> _V: ...
|
||||
def Value(self, name: Union[str, bytes]) -> _V: ...
|
||||
def keys(self) -> List[str]: ...
|
||||
def values(self) -> List[_V]: ...
|
||||
def items(self) -> List[Tuple[str, _V]]: ...
|
||||
|
||||
Reference in New Issue
Block a user