Skip to content

Update mypy protobuf pin to include well_known_types #4850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scripts/generate_proto_stubs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# Update these two variables when rerunning script
PROTOBUF_VERSION=3.14.0
MYPY_PROTOBUF_VERSION=v1.23
MYPY_PROTOBUF_VERSION=8639282dae3bb64b2e1db9928d72fc374f7fa831 # Update to 1.24 when it releases

set -ex

Expand Down Expand Up @@ -58,6 +58,8 @@ PROTO_FILES=$(grep "generate_proto.*google" $PYTHON_PROTOBUF_DIR/python/setup.py
grep -v "test" | \
grep -v google/protobuf/internal/ | \
grep -v google/protobuf/pyext/python.proto | \
grep -v src/google/protobuf/util/json_format.proto | \
grep -v src/google/protobuf/util/json_format_proto3.proto | \
sed "s:^:$PYTHON_PROTOBUF_DIR/python/:" | \
xargs -L1 realpath --relative-to=. \
)
Expand Down
14 changes: 9 additions & 5 deletions third_party/2and3/google/protobuf/any_pb2.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
)

from google.protobuf.internal.well_known_types import (
Any as google___protobuf___internal___well_known_types___Any,
)

from google.protobuf.message import (
Message as google___protobuf___message___Message,
)

from google.protobuf.internal import well_known_types

from typing import (
Optional as typing___Optional,
Text as typing___Text,
Expand All @@ -29,7 +33,7 @@ builtin___int = int

DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...

class Any(google___protobuf___message___Message, well_known_types.Any_):
class Any(google___protobuf___message___Message, google___protobuf___internal___well_known_types___Any):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
type_url: typing___Text = ...
value: builtin___bytes = ...
Expand Down
6 changes: 4 additions & 2 deletions third_party/2and3/google/protobuf/api_pb2.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
Expand Down
7 changes: 4 additions & 3 deletions third_party/2and3/google/protobuf/compiler/plugin_pb2.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
EnumDescriptor as google___protobuf___descriptor___EnumDescriptor,
Expand Down Expand Up @@ -96,7 +98,6 @@ class CodeGeneratorResponse(google___protobuf___message___Message):
FEATURE_PROTO3_OPTIONAL = typing___cast(CodeGeneratorResponse.FeatureValue, 1)
FEATURE_NONE = typing___cast(CodeGeneratorResponse.FeatureValue, 0)
FEATURE_PROTO3_OPTIONAL = typing___cast(CodeGeneratorResponse.FeatureValue, 1)
type___Feature = Feature

class File(google___protobuf___message___Message):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
Expand Down
12 changes: 4 additions & 8 deletions third_party/2and3/google/protobuf/descriptor_pb2.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
EnumDescriptor as google___protobuf___descriptor___EnumDescriptor,
Expand Down Expand Up @@ -233,7 +235,6 @@ class FieldDescriptorProto(google___protobuf___message___Message):
TYPE_SFIXED64 = typing___cast(FieldDescriptorProto.TypeValue, 16)
TYPE_SINT32 = typing___cast(FieldDescriptorProto.TypeValue, 17)
TYPE_SINT64 = typing___cast(FieldDescriptorProto.TypeValue, 18)
type___Type = Type

LabelValue = typing___NewType('LabelValue', builtin___int)
type___LabelValue = LabelValue
Expand All @@ -246,7 +247,6 @@ class FieldDescriptorProto(google___protobuf___message___Message):
LABEL_OPTIONAL = typing___cast(FieldDescriptorProto.LabelValue, 1)
LABEL_REQUIRED = typing___cast(FieldDescriptorProto.LabelValue, 2)
LABEL_REPEATED = typing___cast(FieldDescriptorProto.LabelValue, 3)
type___Label = Label

name: typing___Text = ...
number: builtin___int = ...
Expand Down Expand Up @@ -411,7 +411,6 @@ class FileOptions(google___protobuf___message___Message):
SPEED = typing___cast(FileOptions.OptimizeModeValue, 1)
CODE_SIZE = typing___cast(FileOptions.OptimizeModeValue, 2)
LITE_RUNTIME = typing___cast(FileOptions.OptimizeModeValue, 3)
type___OptimizeMode = OptimizeMode

java_package: typing___Text = ...
java_outer_classname: typing___Text = ...
Expand Down Expand Up @@ -500,7 +499,6 @@ class FieldOptions(google___protobuf___message___Message):
STRING = typing___cast(FieldOptions.CTypeValue, 0)
CORD = typing___cast(FieldOptions.CTypeValue, 1)
STRING_PIECE = typing___cast(FieldOptions.CTypeValue, 2)
type___CType = CType

JSTypeValue = typing___NewType('JSTypeValue', builtin___int)
type___JSTypeValue = JSTypeValue
Expand All @@ -513,7 +511,6 @@ class FieldOptions(google___protobuf___message___Message):
JS_NORMAL = typing___cast(FieldOptions.JSTypeValue, 0)
JS_STRING = typing___cast(FieldOptions.JSTypeValue, 1)
JS_NUMBER = typing___cast(FieldOptions.JSTypeValue, 2)
type___JSType = JSType

ctype: type___FieldOptions.CTypeValue = ...
packed: builtin___bool = ...
Expand Down Expand Up @@ -615,7 +612,6 @@ class MethodOptions(google___protobuf___message___Message):
IDEMPOTENCY_UNKNOWN = typing___cast(MethodOptions.IdempotencyLevelValue, 0)
NO_SIDE_EFFECTS = typing___cast(MethodOptions.IdempotencyLevelValue, 1)
IDEMPOTENT = typing___cast(MethodOptions.IdempotencyLevelValue, 2)
type___IdempotencyLevel = IdempotencyLevel

deprecated: builtin___bool = ...
idempotency_level: type___MethodOptions.IdempotencyLevelValue = ...
Expand Down
14 changes: 9 additions & 5 deletions third_party/2and3/google/protobuf/duration_pb2.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
)

from google.protobuf.internal.well_known_types import (
Duration as google___protobuf___internal___well_known_types___Duration,
)

from google.protobuf.message import (
Message as google___protobuf___message___Message,
)

from google.protobuf.internal import well_known_types

from typing import (
Optional as typing___Optional,
)
Expand All @@ -28,7 +32,7 @@ builtin___int = int

DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...

class Duration(google___protobuf___message___Message, well_known_types.Duration):
class Duration(google___protobuf___message___Message, google___protobuf___internal___well_known_types___Duration):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
seconds: builtin___int = ...
nanos: builtin___int = ...
Expand Down
6 changes: 4 additions & 2 deletions third_party/2and3/google/protobuf/empty_pb2.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
Expand Down
14 changes: 9 additions & 5 deletions third_party/2and3/google/protobuf/field_mask_pb2.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
Expand All @@ -9,12 +11,14 @@ from google.protobuf.internal.containers import (
RepeatedScalarFieldContainer as google___protobuf___internal___containers___RepeatedScalarFieldContainer,
)

from google.protobuf.internal.well_known_types import (
FieldMask as google___protobuf___internal___well_known_types___FieldMask,
)

from google.protobuf.message import (
Message as google___protobuf___message___Message,
)

from google.protobuf.internal import well_known_types

from typing import (
Iterable as typing___Iterable,
Optional as typing___Optional,
Expand All @@ -34,7 +38,7 @@ builtin___int = int

DESCRIPTOR: google___protobuf___descriptor___FileDescriptor = ...

class FieldMask(google___protobuf___message___Message, well_known_types.FieldMask):
class FieldMask(google___protobuf___message___Message, google___protobuf___internal___well_known_types___FieldMask):
DESCRIPTOR: google___protobuf___descriptor___Descriptor = ...
paths: google___protobuf___internal___containers___RepeatedScalarFieldContainer[typing___Text] = ...

Expand Down
72 changes: 36 additions & 36 deletions third_party/2and3/google/protobuf/internal/well_known_types.pyi
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
from datetime import datetime, timedelta
from typing import Any, Optional
from typing import Any as tAny, Dict, Optional, Text, Type

class Error(Exception): ...
class ParseError(Error): ...

# This is named 'Any' in the original, but that conflicts with typing.Any,
# and we really only need this file to mix in.
class Any_:
type_url: Any = ...
value: Any = ...
def Pack(self, msg: Any, type_url_prefix: bytes = ..., deterministic: Optional[Any] = ...) -> None: ...
def Unpack(self, msg: Any): ...
class Any:
type_url: tAny = ...
value: tAny = ...
def Pack(self, msg: tAny, type_url_prefix: bytes = ..., deterministic: Optional[tAny] = ...) -> None: ...
def Unpack(self, msg: tAny): ...
def TypeName(self): ...
def Is(self, descriptor: Any): ...
def Is(self, descriptor: tAny): ...

class Timestamp:
def ToJsonString(self) -> str: ...
Expand All @@ -35,7 +33,7 @@ class Duration:
def ToJsonString(self) -> str: ...
seconds: int = ...
nanos: int = ...
def FromJsonString(self, value: Any) -> None: ...
def FromJsonString(self, value: tAny) -> None: ...
def ToNanoseconds(self) -> int: ...
def ToMicroseconds(self) -> int: ...
def ToMilliseconds(self) -> int: ...
Expand All @@ -49,46 +47,48 @@ class Duration:

class FieldMask:
def ToJsonString(self) -> str: ...
def FromJsonString(self, value: Any) -> None: ...
def IsValidForDescriptor(self, message_descriptor: Any): ...
def AllFieldsFromDescriptor(self, message_descriptor: Any) -> None: ...
def CanonicalFormFromMask(self, mask: Any) -> None: ...
def Union(self, mask1: Any, mask2: Any) -> None: ...
def Intersect(self, mask1: Any, mask2: Any) -> None: ...
def FromJsonString(self, value: tAny) -> None: ...
def IsValidForDescriptor(self, message_descriptor: tAny): ...
def AllFieldsFromDescriptor(self, message_descriptor: tAny) -> None: ...
def CanonicalFormFromMask(self, mask: tAny) -> None: ...
def Union(self, mask1: tAny, mask2: tAny) -> None: ...
def Intersect(self, mask1: tAny, mask2: tAny) -> None: ...
def MergeMessage(
self, source: Any, destination: Any, replace_message_field: bool = ..., replace_repeated_field: bool = ...
self, source: tAny, destination: tAny, replace_message_field: bool = ..., replace_repeated_field: bool = ...
) -> None: ...

class _FieldMaskTree:
def __init__(self, field_mask: Optional[Any] = ...) -> None: ...
def MergeFromFieldMask(self, field_mask: Any) -> None: ...
def AddPath(self, path: Any): ...
def ToFieldMask(self, field_mask: Any) -> None: ...
def IntersectPath(self, path: Any, intersection: Any): ...
def AddLeafNodes(self, prefix: Any, node: Any) -> None: ...
def MergeMessage(self, source: Any, destination: Any, replace_message: Any, replace_repeated: Any) -> None: ...
def __init__(self, field_mask: Optional[tAny] = ...) -> None: ...
def MergeFromFieldMask(self, field_mask: tAny) -> None: ...
def AddPath(self, path: tAny): ...
def ToFieldMask(self, field_mask: tAny) -> None: ...
def IntersectPath(self, path: tAny, intersection: tAny): ...
def AddLeafNodes(self, prefix: tAny, node: tAny) -> None: ...
def MergeMessage(self, source: tAny, destination: tAny, replace_message: tAny, replace_repeated: tAny) -> None: ...

class Struct:
def __getitem__(self, key: Any): ...
def __contains__(self, item: Any): ...
def __setitem__(self, key: Any, value: Any) -> None: ...
def __delitem__(self, key: Any) -> None: ...
def __getitem__(self, key: tAny): ...
def __contains__(self, item: tAny): ...
def __setitem__(self, key: tAny, value: tAny) -> None: ...
def __delitem__(self, key: tAny) -> None: ...
def __len__(self): ...
def __iter__(self): ...
def keys(self): ...
def values(self): ...
def items(self): ...
def get_or_create_list(self, key: Any): ...
def get_or_create_struct(self, key: Any): ...
def update(self, dictionary: Any) -> None: ...
def get_or_create_list(self, key: tAny): ...
def get_or_create_struct(self, key: tAny): ...
def update(self, dictionary: tAny) -> None: ...

class ListValue:
def __len__(self): ...
def append(self, value: Any) -> None: ...
def extend(self, elem_seq: Any) -> None: ...
def __getitem__(self, index: Any): ...
def __setitem__(self, index: Any, value: Any) -> None: ...
def __delitem__(self, key: Any) -> None: ...
def append(self, value: tAny) -> None: ...
def extend(self, elem_seq: tAny) -> None: ...
def __getitem__(self, index: tAny): ...
def __setitem__(self, index: tAny, value: tAny) -> None: ...
def __delitem__(self, key: tAny) -> None: ...
def items(self) -> None: ...
def add_struct(self): ...
def add_list(self): ...

WKTBASES: Dict[Text, Type]
6 changes: 4 additions & 2 deletions third_party/2and3/google/protobuf/source_context_pb2.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @generated by generate_proto_mypy_stubs.py. Do not edit!
import sys
"""
@generated by mypy-protobuf. Do not edit manually!
isort:skip_file
"""
from google.protobuf.descriptor import (
Descriptor as google___protobuf___descriptor___Descriptor,
FileDescriptor as google___protobuf___descriptor___FileDescriptor,
Expand Down
Loading