-
Notifications
You must be signed in to change notification settings - Fork 15.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove RegisterExtension() in python generated code
PiperOrigin-RevId: 530452253
- Loading branch information
1 parent
4c79444
commit e5a7a2e
Showing
4 changed files
with
45 additions
and
45 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
|
@@ -38,6 +38,7 @@ | |
__author__ = '[email protected] (Jie Luo)' | ||
|
||
from google.protobuf.internal import enum_type_wrapper | ||
from google.protobuf.internal import python_message | ||
from google.protobuf import message as _message | ||
from google.protobuf import reflection as _reflection | ||
from google.protobuf import symbol_database as _symbol_database | ||
|
@@ -108,6 +109,28 @@ def BuildMessage(msg_des): | |
module[name] = BuildMessage(msg_des) | ||
|
||
|
||
def AddHelpersToExtensions(file_des): | ||
"""Adds field helpers to extensions. | ||
Args: | ||
file_des: FileDescriptor of the .proto file | ||
""" | ||
def AddHelpersToExtension(extension): | ||
python_message._AttachFieldHelpers( | ||
extension.containing_type._concrete_class, extension) | ||
|
||
def AddHelpersToNestedExtensions(msg_des): | ||
for nested_type in msg_des.nested_types: | ||
AddHelpersToNestedExtensions(nested_type) | ||
for extension in msg_des.extensions: | ||
AddHelpersToExtension(extension) | ||
|
||
for extension in file_des.extensions_by_name.values(): | ||
AddHelpersToExtension(extension) | ||
for message_type in file_des.message_types_by_name.values(): | ||
AddHelpersToNestedExtensions(message_type) | ||
|
||
|
||
def BuildServices(file_des, module_name, module): | ||
"""Builds services classes and services stub class. | ||
|
This file contains 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 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