mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-06 20:24:30 +08:00
Genericize types for stringly typed methods on google.protobuf.Message (#2807)
This commit is contained in:
committed by
Jelle Zijlstra
parent
3f83195558
commit
07ea6614c8
13
third_party/2and3/google/protobuf/message.pyi
vendored
13
third_party/2and3/google/protobuf/message.pyi
vendored
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Sequence, Optional, Text, Tuple
|
||||
from typing import Any, Sequence, Optional, Tuple
|
||||
|
||||
from .descriptor import (
|
||||
DescriptorBase,
|
||||
@@ -28,14 +28,19 @@ class Message:
|
||||
def SerializeToString(self, deterministic: bool = ...) -> bytes: ...
|
||||
def SerializePartialToString(self, deterministic: bool = ...) -> bytes: ...
|
||||
def ListFields(self) -> Sequence[Tuple[FieldDescriptor, Any]]: ...
|
||||
def HasField(self, field_name: Text) -> bool: ...
|
||||
def ClearField(self, field_name: Text) -> None: ...
|
||||
def WhichOneof(self, oneof_group) -> Optional[Text]: ...
|
||||
def HasExtension(self, extension_handle): ...
|
||||
def ClearExtension(self, extension_handle): ...
|
||||
def ByteSize(self) -> int: ...
|
||||
@property
|
||||
def Extensions(self) -> _ExtensionDict: ...
|
||||
|
||||
# Intentionally left out typing on these three methods, because they are
|
||||
# stringly typed and it is not useful to call them on a Message directly.
|
||||
# We prefer more specific typing on individual subclasses of Message
|
||||
# See https://github.com/dropbox/mypy-protobuf/issues/62 for details
|
||||
def HasField(self, field_name: Any) -> bool: ...
|
||||
def ClearField(self, field_name: Any) -> None: ...
|
||||
def WhichOneof(self, oneof_group: Any) -> Any: ...
|
||||
|
||||
# TODO: check kwargs
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user