Skip to content

Commit c261b49

Browse files
anandoleecopybara-github
authored andcommitted
Breaking change: Remove deprecated GetPrototype MessageFactory.GetPrototype(),
MessageFactory.CreatePrototype(), MessageFactory.GetMessages(), SymbolDatabase.GetPrototype(), SymbolDatabase.CreatePrototype(), SymbolDatabase.GetMessages() Replacement APIs are: message_factory.GetMessages(), message_factory.GetMessageClass(), message_factory.GetMessageClassesForFiles() PiperOrigin-RevId: 693421414
1 parent 08d5ef9 commit c261b49

File tree

3 files changed

+0
-102
lines changed

3 files changed

+0
-102
lines changed

csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs

-17
This file was deleted.

python/google/protobuf/message_factory.py

-63
Original file line numberDiff line numberDiff line change
@@ -142,69 +142,6 @@ def __init__(self, pool=None):
142142
"""Initializes a new factory."""
143143
self.pool = pool or descriptor_pool.DescriptorPool()
144144

145-
def GetPrototype(self, descriptor):
146-
"""Obtains a proto2 message class based on the passed in descriptor.
147-
148-
Passing a descriptor with a fully qualified name matching a previous
149-
invocation will cause the same class to be returned.
150-
151-
Args:
152-
descriptor: The descriptor to build from.
153-
154-
Returns:
155-
A class describing the passed in descriptor.
156-
"""
157-
warnings.warn(
158-
'MessageFactory class is deprecated. Please use '
159-
'GetMessageClass() instead of MessageFactory.GetPrototype. '
160-
'MessageFactory class will be removed after 2024.',
161-
stacklevel=2,
162-
)
163-
return GetMessageClass(descriptor)
164-
165-
def CreatePrototype(self, descriptor):
166-
"""Builds a proto2 message class based on the passed in descriptor.
167-
168-
Don't call this function directly, it always creates a new class. Call
169-
GetMessageClass() instead.
170-
171-
Args:
172-
descriptor: The descriptor to build from.
173-
174-
Returns:
175-
A class describing the passed in descriptor.
176-
"""
177-
warnings.warn(
178-
'Directly call CreatePrototype is wrong. Please use '
179-
'GetMessageClass() method instead. Directly use '
180-
'CreatePrototype will raise error after July 2023.',
181-
stacklevel=2,
182-
)
183-
return _InternalCreateMessageClass(descriptor)
184-
185-
def GetMessages(self, files):
186-
"""Gets all the messages from a specified file.
187-
188-
This will find and resolve dependencies, failing if the descriptor
189-
pool cannot satisfy them.
190-
191-
Args:
192-
files: The file names to extract messages from.
193-
194-
Returns:
195-
A dictionary mapping proto names to the message classes. This will include
196-
any dependent messages as well as any messages defined in the same file as
197-
a specified message.
198-
"""
199-
warnings.warn(
200-
'MessageFactory class is deprecated. Please use '
201-
'GetMessageClassesForFiles() instead of '
202-
'MessageFactory.GetMessages(). MessageFactory class '
203-
'will be removed after 2024.',
204-
stacklevel=2,
205-
)
206-
return GetMessageClassesForFiles(files, self.pool)
207-
208145

209146
def GetMessages(file_protos, pool=None):
210147
"""Builds a dictionary of all the messages available in a set of files.

python/google/protobuf/symbol_database.py

-22
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,6 @@ def __init__(self, pool=None):
5151
"""Initializes a new SymbolDatabase."""
5252
self.pool = pool or descriptor_pool.DescriptorPool()
5353

54-
def GetPrototype(self, descriptor):
55-
warnings.warn(
56-
'SymbolDatabase.GetPrototype() is deprecated. Please '
57-
'use message_factory.GetMessageClass() instead. '
58-
'SymbolDatabase.GetPrototype() will be removed in Jan 2025.'
59-
)
60-
return message_factory.GetMessageClass(descriptor)
61-
62-
def CreatePrototype(self, descriptor):
63-
warnings.warn('Directly call CreatePrototype() is wrong. Please use '
64-
'message_factory.GetMessageClass() instead. '
65-
'SymbolDatabase.CreatePrototype() will be removed in '
66-
'Jan 2025.')
67-
return message_factory._InternalCreateMessageClass(descriptor)
68-
69-
def GetMessages(self, files):
70-
warnings.warn('SymbolDatabase.GetMessages() is deprecated. Please use '
71-
'message_factory.GetMessageClassedForFiles() instead. '
72-
'SymbolDatabase.GetMessages() will be removed in '
73-
'Jan 2025.')
74-
return message_factory.GetMessageClassedForFiles(files, self.pool)
75-
7654
def RegisterMessage(self, message):
7755
"""Registers the given message type in the local database.
7856

0 commit comments

Comments
 (0)