-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add support for well_known_types to google/protobuf #2157
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
third_party/2/google/protobuf/internal/well_known_types.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
from typing import Any, Optional | ||
|
||
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: str = ..., deterministic: Optional[Any] = ...) -> None: ... | ||
def Unpack(self, msg: Any): ... | ||
def TypeName(self): ... | ||
def Is(self, descriptor: Any): ... | ||
|
||
class Timestamp: | ||
def ToJsonString(self): ... | ||
seconds: Any = ... | ||
nanos: Any = ... | ||
def FromJsonString(self, value: Any) -> None: ... | ||
def GetCurrentTime(self) -> None: ... | ||
def ToNanoseconds(self): ... | ||
def ToMicroseconds(self): ... | ||
def ToMilliseconds(self): ... | ||
def ToSeconds(self): ... | ||
def FromNanoseconds(self, nanos: Any) -> None: ... | ||
def FromMicroseconds(self, micros: Any) -> None: ... | ||
def FromMilliseconds(self, millis: Any) -> None: ... | ||
def FromSeconds(self, seconds: Any) -> None: ... | ||
def ToDatetime(self): ... | ||
def FromDatetime(self, dt: Any) -> None: ... | ||
|
||
class Duration: | ||
def ToJsonString(self): ... | ||
seconds: Any = ... | ||
nanos: Any = ... | ||
def FromJsonString(self, value: Any) -> None: ... | ||
def ToNanoseconds(self): ... | ||
def ToMicroseconds(self): ... | ||
def ToMilliseconds(self): ... | ||
def ToSeconds(self): ... | ||
def FromNanoseconds(self, nanos: Any) -> None: ... | ||
def FromMicroseconds(self, micros: Any) -> None: ... | ||
def FromMilliseconds(self, millis: Any) -> None: ... | ||
def FromSeconds(self, seconds: Any) -> None: ... | ||
def ToTimedelta(self): ... | ||
def FromTimedelta(self, td: Any) -> None: ... | ||
|
||
class FieldMask: | ||
def ToJsonString(self): ... | ||
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 MergeMessage(self, source: Any, destination: Any, 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: ... | ||
|
||
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 __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: ... | ||
|
||
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 items(self) -> None: ... | ||
def add_struct(self): ... | ||
def add_list(self): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't we
from typing import Any as Any_
instead to avoid this?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because that would require more changes to the code below (generated by stubgen), all of which uses
Any
as meaningtyping.Any
.