Skip to content

Commit

Permalink
Breaking change: Remove deprecated GetPrototype MessageFactory.GetPro…
Browse files Browse the repository at this point in the history
…totype(),

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
  • Loading branch information
anandolee authored and copybara-github committed Nov 5, 2024
1 parent 08d5ef9 commit c261b49
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 102 deletions.
17 changes: 0 additions & 17 deletions csharp/src/Google.Protobuf/Reflection/FeatureSetDescriptor.g.cs

This file was deleted.

63 changes: 0 additions & 63 deletions python/google/protobuf/message_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,69 +142,6 @@ def __init__(self, pool=None):
"""Initializes a new factory."""
self.pool = pool or descriptor_pool.DescriptorPool()

def GetPrototype(self, descriptor):
"""Obtains a proto2 message class based on the passed in descriptor.
Passing a descriptor with a fully qualified name matching a previous
invocation will cause the same class to be returned.
Args:
descriptor: The descriptor to build from.
Returns:
A class describing the passed in descriptor.
"""
warnings.warn(
'MessageFactory class is deprecated. Please use '
'GetMessageClass() instead of MessageFactory.GetPrototype. '
'MessageFactory class will be removed after 2024.',
stacklevel=2,
)
return GetMessageClass(descriptor)

def CreatePrototype(self, descriptor):
"""Builds a proto2 message class based on the passed in descriptor.
Don't call this function directly, it always creates a new class. Call
GetMessageClass() instead.
Args:
descriptor: The descriptor to build from.
Returns:
A class describing the passed in descriptor.
"""
warnings.warn(
'Directly call CreatePrototype is wrong. Please use '
'GetMessageClass() method instead. Directly use '
'CreatePrototype will raise error after July 2023.',
stacklevel=2,
)
return _InternalCreateMessageClass(descriptor)

def GetMessages(self, files):
"""Gets all the messages from a specified file.
This will find and resolve dependencies, failing if the descriptor
pool cannot satisfy them.
Args:
files: The file names to extract messages from.
Returns:
A dictionary mapping proto names to the message classes. This will include
any dependent messages as well as any messages defined in the same file as
a specified message.
"""
warnings.warn(
'MessageFactory class is deprecated. Please use '
'GetMessageClassesForFiles() instead of '
'MessageFactory.GetMessages(). MessageFactory class '
'will be removed after 2024.',
stacklevel=2,
)
return GetMessageClassesForFiles(files, self.pool)


def GetMessages(file_protos, pool=None):
"""Builds a dictionary of all the messages available in a set of files.
Expand Down
22 changes: 0 additions & 22 deletions python/google/protobuf/symbol_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,6 @@ def __init__(self, pool=None):
"""Initializes a new SymbolDatabase."""
self.pool = pool or descriptor_pool.DescriptorPool()

def GetPrototype(self, descriptor):
warnings.warn(
'SymbolDatabase.GetPrototype() is deprecated. Please '
'use message_factory.GetMessageClass() instead. '
'SymbolDatabase.GetPrototype() will be removed in Jan 2025.'
)
return message_factory.GetMessageClass(descriptor)

def CreatePrototype(self, descriptor):
warnings.warn('Directly call CreatePrototype() is wrong. Please use '
'message_factory.GetMessageClass() instead. '
'SymbolDatabase.CreatePrototype() will be removed in '
'Jan 2025.')
return message_factory._InternalCreateMessageClass(descriptor)

def GetMessages(self, files):
warnings.warn('SymbolDatabase.GetMessages() is deprecated. Please use '
'message_factory.GetMessageClassedForFiles() instead. '
'SymbolDatabase.GetMessages() will be removed in '
'Jan 2025.')
return message_factory.GetMessageClassedForFiles(files, self.pool)

def RegisterMessage(self, message):
"""Registers the given message type in the local database.
Expand Down

0 comments on commit c261b49

Please sign in to comment.