new mcp servers format

This commit is contained in:
Davidson Gomes
2025-04-28 12:37:58 -03:00
parent 0112573d9b
commit e98744b7a4
7182 changed files with 4839 additions and 4998 deletions

View File

@@ -142,6 +142,69 @@ class MessageFactory(object):
"""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.