Skip to content

Commit c34f11d

Browse files
Roy Williamsambv
Roy Williams
authored andcommitted
Add more specific types to protobuf
1 parent 6a15963 commit c34f11d

File tree

4 files changed

+60
-1
lines changed

4 files changed

+60
-1
lines changed

third_party/2/google/protobuf/descriptor.pyi

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from typing import Any
66

7+
from .message import Message
8+
79
class Error(Exception): ...
810
class TypeTransformationError(Error): ...
911

@@ -160,4 +162,4 @@ class FileDescriptor(DescriptorBase):
160162
def CopyToProto(self, proto): ...
161163

162164
def MakeDescriptor(desc_proto, package=..., build_file_if_cpp=..., syntax=...): ...
163-
def _ParseOptions(message, string): ...
165+
def _ParseOptions(message: Message, string: str) -> Message: ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Stubs for google.protobuf.descriptor_pool (Python 3.5)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any, Optional
6+
7+
class DescriptorPool:
8+
def __new__(cls, descriptor_db: Optional[Any] = ...): ...
9+
def __init__(self, descriptor_db: Optional[Any] = ...) -> None: ...
10+
def Add(self, file_desc_proto): ...
11+
def AddSerializedFile(self, serialized_file_desc_proto): ...
12+
def AddDescriptor(self, desc): ...
13+
def AddEnumDescriptor(self, enum_desc): ...
14+
def AddFileDescriptor(self, file_desc): ...
15+
def FindFileByName(self, file_name): ...
16+
def FindFileContainingSymbol(self, symbol): ...
17+
def FindMessageTypeByName(self, full_name): ...
18+
def FindEnumTypeByName(self, full_name): ...
19+
def FindFieldByName(self, full_name): ...
20+
def FindExtensionByName(self, full_name): ...
21+
22+
def Default(): ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Stubs for google.protobuf.message_factory (Python 3.5)
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Any, Dict, Iterable, Optional, Type
6+
7+
from .message import Message
8+
from .descriptor import Descriptor
9+
from .descriptor_pool import DescriptorPool
10+
11+
class MessageFactory:
12+
pool = ... # type: Any
13+
def __init__(self, pool: DescriptorPool=None) -> None: ...
14+
def GetPrototype(self, descriptor: Descriptor) -> Type[Message]: ...
15+
def GetMessages(self, files: Iterable[str]) -> Dict[str, Type[Message]]: ...
16+
17+
def GetMessages(file_protos: Iterable[str]) -> Dict[str, Type[Message]]: ...
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Stubs for google.protobuf.symbol_database
2+
#
3+
# NOTE: This dynamically typed stub was automatically generated by stubgen.
4+
5+
from typing import Dict, Iterable, Type
6+
7+
from .descriptor import EnumDescriptor, FileDescriptor
8+
from .message import Message
9+
from .message_factory import MessageFactory
10+
11+
class SymbolDatabase(MessageFactory):
12+
def RegisterMessage(self, message: Type[Message]) -> Type[Message]: ...
13+
def RegisterEnumDescriptor(self, enum_descriptor: Type[EnumDescriptor]) -> EnumDescriptor: ...
14+
def RegisterFileDescriptor(self, file_descriptor: Type[FileDescriptor]) -> FileDescriptor: ...
15+
def GetSymbol(self, symbol: str) -> Type[Message]: ...
16+
def GetMessages(self, files: Iterable[str]) -> Dict[str, Type[Message]]: ...
17+
18+
def Default(): ...

0 commit comments

Comments
 (0)