Various improvements to non-generated protobuf stubs (#10010)

This commit is contained in:
Alex Waygood
2023-04-04 13:44:58 +01:00
committed by GitHub
parent 755e2bda7e
commit 60939b00af
2 changed files with 31 additions and 29 deletions

View File

@@ -7,17 +7,19 @@ from typing_extensions import TypeAlias
from google.protobuf import struct_pb2
class Any:
type_url: tAny = ...
value: tAny = ...
def Pack(self, msg: tAny, type_url_prefix: str = ..., deterministic: Incomplete | None = ...) -> None: ...
def Unpack(self, msg: tAny) -> bool: ...
type_url: str
value: Incomplete
def Pack(
self, msg: Incomplete, type_url_prefix: str = "type.googleapis.com/", deterministic: Incomplete | None = None
) -> None: ...
def Unpack(self, msg: Incomplete) -> bool: ...
def TypeName(self) -> str: ...
def Is(self, descriptor: tAny) -> bool: ...
def Is(self, descriptor: Incomplete) -> bool: ...
class Timestamp:
def ToJsonString(self) -> str: ...
seconds: int = ...
nanos: int = ...
seconds: int
nanos: int
def FromJsonString(self, value: str) -> None: ...
def GetCurrentTime(self) -> None: ...
def ToNanoseconds(self) -> int: ...
@@ -33,8 +35,8 @@ class Timestamp:
class Duration:
def ToJsonString(self) -> str: ...
seconds: int = ...
nanos: int = ...
seconds: int
nanos: int
def FromJsonString(self, value: tAny) -> None: ...
def ToNanoseconds(self) -> int: ...
def ToMicroseconds(self) -> int: ...

View File

@@ -107,20 +107,20 @@ def PrintFieldValue(
) -> None: ...
class _Printer:
out: SupportsWrite[str] = ...
indent: int = ...
as_utf8: bool = ...
as_one_line: bool = ...
use_short_repeated_primitives: bool = ...
pointy_brackets: bool = ...
use_index_order: bool = ...
float_format: str | None = ...
double_format: str | None = ...
use_field_number: bool = ...
descriptor_pool: DescriptorPool | None = ...
message_formatter: _MessageFormatter | None = ...
print_unknown_fields: bool = ...
force_colon: bool = ...
out: SupportsWrite[str]
indent: int
as_utf8: bool
as_one_line: bool
use_short_repeated_primitives: bool
pointy_brackets: bool
use_index_order: bool
float_format: str | None
double_format: str | None
use_field_number: bool
descriptor_pool: DescriptorPool | None
message_formatter: _MessageFormatter | None
print_unknown_fields: bool
force_colon: bool
def __init__(
self,
out: SupportsWrite[str],
@@ -168,10 +168,10 @@ def MergeLines(
) -> _M: ...
class _Parser:
allow_unknown_extension: bool = ...
allow_field_number: bool = ...
descriptor_pool: DescriptorPool | None = ...
allow_unknown_field: bool = ...
allow_unknown_extension: bool
allow_field_number: bool
descriptor_pool: DescriptorPool | None
allow_unknown_field: bool
def __init__(
self,
allow_unknown_extension: bool = ...,
@@ -185,8 +185,8 @@ class _Parser:
_ParseError: TypeAlias = ParseError
class Tokenizer:
token: str = ...
def __init__(self, lines: Iterable[str], skip_comments: bool = ...) -> None: ...
token: str
def __init__(self, lines: Iterable[str], skip_comments: bool = True) -> None: ...
def LookingAt(self, token: str) -> bool: ...
def AtEnd(self) -> bool: ...
def TryConsume(self, token: str) -> bool: ...