mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 03:51:52 +08:00
Add options and extensions to google protobuf messages. (#2589)
This commit is contained in:
committed by
Sebastian Rittau
parent
23db1fc137
commit
c2ecb77ca5
18
third_party/2and3/google/protobuf/descriptor.pyi
vendored
18
third_party/2and3/google/protobuf/descriptor.pyi
vendored
@@ -1,6 +1,16 @@
|
||||
from typing import Any
|
||||
|
||||
from .message import Message
|
||||
from .descriptor_pb2 import (
|
||||
EnumOptions,
|
||||
EnumValueOptions,
|
||||
FieldOptions,
|
||||
FileOptions,
|
||||
MessageOptions,
|
||||
MethodOptions,
|
||||
OneofOptions,
|
||||
ServiceOptions,
|
||||
)
|
||||
|
||||
class Error(Exception): ...
|
||||
class TypeTransformationError(Error): ...
|
||||
@@ -42,6 +52,7 @@ class Descriptor(_NestedDescriptorBase):
|
||||
def __init__(self, name, full_name, filename, containing_type, fields, nested_types, enum_types, extensions, options=..., is_extendable=..., extension_ranges=..., oneofs=..., file=..., serialized_start=..., serialized_end=..., syntax=...) -> None: ...
|
||||
def EnumValueName(self, enum, value): ...
|
||||
def CopyToProto(self, proto): ...
|
||||
def GetOptions(self) -> MessageOptions: ...
|
||||
|
||||
class FieldDescriptor(DescriptorBase):
|
||||
TYPE_DOUBLE = ... # type: Any
|
||||
@@ -100,6 +111,7 @@ class FieldDescriptor(DescriptorBase):
|
||||
def __init__(self, name, full_name, index, number, type, cpp_type, label, default_value, message_type, enum_type, containing_type, is_extension, extension_scope, options=..., file=..., has_default_value=..., containing_oneof=...) -> None: ...
|
||||
@staticmethod
|
||||
def ProtoTypeToCppProtoType(proto_type): ...
|
||||
def GetOptions(self) -> FieldOptions: ...
|
||||
|
||||
class EnumDescriptor(_NestedDescriptorBase):
|
||||
def __new__(cls, name, full_name, filename, values, containing_type=..., options=..., file=..., serialized_start=..., serialized_end=...): ...
|
||||
@@ -108,6 +120,7 @@ class EnumDescriptor(_NestedDescriptorBase):
|
||||
values_by_number = ... # type: Any
|
||||
def __init__(self, name, full_name, filename, values, containing_type=..., options=..., file=..., serialized_start=..., serialized_end=...) -> None: ...
|
||||
def CopyToProto(self, proto): ...
|
||||
def GetOptions(self) -> EnumOptions: ...
|
||||
|
||||
class EnumValueDescriptor(DescriptorBase):
|
||||
def __new__(cls, name, index, number, type=..., options=...): ...
|
||||
@@ -116,6 +129,7 @@ class EnumValueDescriptor(DescriptorBase):
|
||||
number = ... # type: Any
|
||||
type = ... # type: Any
|
||||
def __init__(self, name, index, number, type=..., options=...) -> None: ...
|
||||
def GetOptions(self) -> EnumValueOptions: ...
|
||||
|
||||
class OneofDescriptor:
|
||||
def __new__(cls, name, full_name, index, containing_type, fields): ...
|
||||
@@ -125,6 +139,7 @@ class OneofDescriptor:
|
||||
containing_type = ... # type: Any
|
||||
fields = ... # type: Any
|
||||
def __init__(self, name, full_name, index, containing_type, fields) -> None: ...
|
||||
def GetOptions(self) -> OneofOptions: ...
|
||||
|
||||
class ServiceDescriptor(_NestedDescriptorBase):
|
||||
index = ... # type: Any
|
||||
@@ -133,6 +148,7 @@ class ServiceDescriptor(_NestedDescriptorBase):
|
||||
def __init__(self, name, full_name, index, methods, options=..., file=..., serialized_start=..., serialized_end=...) -> None: ...
|
||||
def FindMethodByName(self, name): ...
|
||||
def CopyToProto(self, proto): ...
|
||||
def GetOptions(self) -> ServiceOptions: ...
|
||||
|
||||
class MethodDescriptor(DescriptorBase):
|
||||
name = ... # type: Any
|
||||
@@ -142,6 +158,7 @@ class MethodDescriptor(DescriptorBase):
|
||||
input_type = ... # type: Any
|
||||
output_type = ... # type: Any
|
||||
def __init__(self, name, full_name, index, containing_service, input_type, output_type, options=...) -> None: ...
|
||||
def GetOptions(self) -> MethodOptions: ...
|
||||
|
||||
class FileDescriptor(DescriptorBase):
|
||||
def __new__(cls, name, package, options=..., serialized_pb=..., dependencies=..., public_dependencies=..., syntax=..., pool=...): ...
|
||||
@@ -159,6 +176,7 @@ class FileDescriptor(DescriptorBase):
|
||||
public_dependencies = ... # type: Any
|
||||
def __init__(self, name, package, options=..., serialized_pb=..., dependencies=..., public_dependencies=..., syntax=..., pool=...) -> None: ...
|
||||
def CopyToProto(self, proto): ...
|
||||
def GetOptions(self) -> FileOptions: ...
|
||||
|
||||
def MakeDescriptor(desc_proto, package=..., build_file_if_cpp=..., syntax=...): ...
|
||||
def _ParseOptions(message: Message, string: bytes) -> Message: ...
|
||||
|
||||
11
third_party/2and3/google/protobuf/message.pyi
vendored
11
third_party/2and3/google/protobuf/message.pyi
vendored
@@ -1,11 +1,18 @@
|
||||
from typing import Any, Sequence, Optional, Text, Tuple
|
||||
|
||||
from .descriptor import FieldDescriptor
|
||||
from .descriptor import (
|
||||
DescriptorBase,
|
||||
FieldDescriptor,
|
||||
)
|
||||
|
||||
class Error(Exception): ...
|
||||
class DecodeError(Error): ...
|
||||
class EncodeError(Error): ...
|
||||
|
||||
class _ExtensionDict:
|
||||
def __getitem__(self, extension_handle: DescriptorBase) -> Any: ...
|
||||
def __setitem__(self, extension_handle: DescriptorBase, value: Any) -> None: ...
|
||||
|
||||
class Message:
|
||||
DESCRIPTOR = ... # type: Any
|
||||
def __deepcopy__(self, memo=...): ...
|
||||
@@ -27,6 +34,8 @@ class Message:
|
||||
def HasExtension(self, extension_handle): ...
|
||||
def ClearExtension(self, extension_handle): ...
|
||||
def ByteSize(self) -> int: ...
|
||||
@property
|
||||
def Extensions(self) -> _ExtensionDict: ...
|
||||
|
||||
# TODO: check kwargs
|
||||
def __init__(self, **kwargs) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user