Commit 7ace76e2 by 赵增煜

新增lib

parent 762244de
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
# Copyright 2007 Google Inc. All Rights Reserved. # Copyright 2007 Google Inc. All Rights Reserved.
__version__ = '5.27.3' __version__ = '4.25.4'
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/any.proto # source: google/protobuf/any.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/any.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobu ...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobu
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.any_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.any_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\010AnyProtoP\001Z,google.golang.org/protobuf/types/known/anypb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\010AnyProtoP\001Z,google.golang.org/protobuf/types/known/anypb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_ANY']._serialized_start=46 _globals['_ANY']._serialized_start=46
_globals['_ANY']._serialized_end=100 _globals['_ANY']._serialized_end=100
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/api.proto # source: google/protobuf/api.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/api.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -31,8 +21,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobu ...@@ -31,8 +21,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x19google/protobu
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.api_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.api_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\010ApiProtoP\001Z,google.golang.org/protobuf/types/known/apipb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\010ApiProtoP\001Z,google.golang.org/protobuf/types/known/apipb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_API']._serialized_start=113 _globals['_API']._serialized_start=113
_globals['_API']._serialized_end=434 _globals['_API']._serialized_end=434
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/compiler/plugin.proto # source: google/protobuf/compiler/plugin.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/compiler/plugin.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -25,22 +15,22 @@ _sym_db = _symbol_database.Default() ...@@ -25,22 +15,22 @@ _sym_db = _symbol_database.Default()
from google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2 from google.protobuf import descriptor_pb2 as google_dot_protobuf_dot_descriptor__pb2
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n%google/protobuf/compiler/plugin.proto\x12\x18google.protobuf.compiler\x1a google/protobuf/descriptor.proto\"c\n\x07Version\x12\x14\n\x05major\x18\x01 \x01(\x05R\x05major\x12\x14\n\x05minor\x18\x02 \x01(\x05R\x05minor\x12\x14\n\x05patch\x18\x03 \x01(\x05R\x05patch\x12\x16\n\x06suffix\x18\x04 \x01(\tR\x06suffix\"\xcf\x02\n\x14\x43odeGeneratorRequest\x12(\n\x10\x66ile_to_generate\x18\x01 \x03(\tR\x0e\x66ileToGenerate\x12\x1c\n\tparameter\x18\x02 \x01(\tR\tparameter\x12\x43\n\nproto_file\x18\x0f \x03(\x0b\x32$.google.protobuf.FileDescriptorProtoR\tprotoFile\x12\\\n\x17source_file_descriptors\x18\x11 \x03(\x0b\x32$.google.protobuf.FileDescriptorProtoR\x15sourceFileDescriptors\x12L\n\x10\x63ompiler_version\x18\x03 \x01(\x0b\x32!.google.protobuf.compiler.VersionR\x0f\x63ompilerVersion\"\x85\x04\n\x15\x43odeGeneratorResponse\x12\x14\n\x05\x65rror\x18\x01 \x01(\tR\x05\x65rror\x12-\n\x12supported_features\x18\x02 \x01(\x04R\x11supportedFeatures\x12\'\n\x0fminimum_edition\x18\x03 \x01(\x05R\x0eminimumEdition\x12\'\n\x0fmaximum_edition\x18\x04 \x01(\x05R\x0emaximumEdition\x12H\n\x04\x66ile\x18\x0f \x03(\x0b\x32\x34.google.protobuf.compiler.CodeGeneratorResponse.FileR\x04\x66ile\x1a\xb1\x01\n\x04\x46ile\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\'\n\x0finsertion_point\x18\x02 \x01(\tR\x0einsertionPoint\x12\x18\n\x07\x63ontent\x18\x0f \x01(\tR\x07\x63ontent\x12R\n\x13generated_code_info\x18\x10 \x01(\x0b\x32\".google.protobuf.GeneratedCodeInfoR\x11generatedCodeInfo\"W\n\x07\x46\x65\x61ture\x12\x10\n\x0c\x46\x45\x41TURE_NONE\x10\x00\x12\x1b\n\x17\x46\x45\x41TURE_PROTO3_OPTIONAL\x10\x01\x12\x1d\n\x19\x46\x45\x41TURE_SUPPORTS_EDITIONS\x10\x02\x42r\n\x1c\x63om.google.protobuf.compilerB\x0cPluginProtosZ)google.golang.org/protobuf/types/pluginpb\xaa\x02\x18Google.Protobuf.Compiler') DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n%google/protobuf/compiler/plugin.proto\x12\x18google.protobuf.compiler\x1a google/protobuf/descriptor.proto\"c\n\x07Version\x12\x14\n\x05major\x18\x01 \x01(\x05R\x05major\x12\x14\n\x05minor\x18\x02 \x01(\x05R\x05minor\x12\x14\n\x05patch\x18\x03 \x01(\x05R\x05patch\x12\x16\n\x06suffix\x18\x04 \x01(\tR\x06suffix\"\xcf\x02\n\x14\x43odeGeneratorRequest\x12(\n\x10\x66ile_to_generate\x18\x01 \x03(\tR\x0e\x66ileToGenerate\x12\x1c\n\tparameter\x18\x02 \x01(\tR\tparameter\x12\x43\n\nproto_file\x18\x0f \x03(\x0b\x32$.google.protobuf.FileDescriptorProtoR\tprotoFile\x12\\\n\x17source_file_descriptors\x18\x11 \x03(\x0b\x32$.google.protobuf.FileDescriptorProtoR\x15sourceFileDescriptors\x12L\n\x10\x63ompiler_version\x18\x03 \x01(\x0b\x32!.google.protobuf.compiler.VersionR\x0f\x63ompilerVersion\"\xb3\x03\n\x15\x43odeGeneratorResponse\x12\x14\n\x05\x65rror\x18\x01 \x01(\tR\x05\x65rror\x12-\n\x12supported_features\x18\x02 \x01(\x04R\x11supportedFeatures\x12H\n\x04\x66ile\x18\x0f \x03(\x0b\x32\x34.google.protobuf.compiler.CodeGeneratorResponse.FileR\x04\x66ile\x1a\xb1\x01\n\x04\x46ile\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\'\n\x0finsertion_point\x18\x02 \x01(\tR\x0einsertionPoint\x12\x18\n\x07\x63ontent\x18\x0f \x01(\tR\x07\x63ontent\x12R\n\x13generated_code_info\x18\x10 \x01(\x0b\x32\".google.protobuf.GeneratedCodeInfoR\x11generatedCodeInfo\"W\n\x07\x46\x65\x61ture\x12\x10\n\x0c\x46\x45\x41TURE_NONE\x10\x00\x12\x1b\n\x17\x46\x45\x41TURE_PROTO3_OPTIONAL\x10\x01\x12\x1d\n\x19\x46\x45\x41TURE_SUPPORTS_EDITIONS\x10\x02\x42r\n\x1c\x63om.google.protobuf.compilerB\x0cPluginProtosZ)google.golang.org/protobuf/types/pluginpb\xaa\x02\x18Google.Protobuf.Compiler')
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.compiler.plugin_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.compiler.plugin_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\034com.google.protobuf.compilerB\014PluginProtosZ)google.golang.org/protobuf/types/pluginpb\252\002\030Google.Protobuf.Compiler' _globals['DESCRIPTOR']._serialized_options = b'\n\034com.google.protobuf.compilerB\014PluginProtosZ)google.golang.org/protobuf/types/pluginpb\252\002\030Google.Protobuf.Compiler'
_globals['_VERSION']._serialized_start=101 _globals['_VERSION']._serialized_start=101
_globals['_VERSION']._serialized_end=200 _globals['_VERSION']._serialized_end=200
_globals['_CODEGENERATORREQUEST']._serialized_start=203 _globals['_CODEGENERATORREQUEST']._serialized_start=203
_globals['_CODEGENERATORREQUEST']._serialized_end=538 _globals['_CODEGENERATORREQUEST']._serialized_end=538
_globals['_CODEGENERATORRESPONSE']._serialized_start=541 _globals['_CODEGENERATORRESPONSE']._serialized_start=541
_globals['_CODEGENERATORRESPONSE']._serialized_end=1058 _globals['_CODEGENERATORRESPONSE']._serialized_end=976
_globals['_CODEGENERATORRESPONSE_FILE']._serialized_start=792 _globals['_CODEGENERATORRESPONSE_FILE']._serialized_start=710
_globals['_CODEGENERATORRESPONSE_FILE']._serialized_end=969 _globals['_CODEGENERATORRESPONSE_FILE']._serialized_end=887
_globals['_CODEGENERATORRESPONSE_FEATURE']._serialized_start=971 _globals['_CODEGENERATORRESPONSE_FEATURE']._serialized_start=889
_globals['_CODEGENERATORRESPONSE_FEATURE']._serialized_end=1058 _globals['_CODEGENERATORRESPONSE_FEATURE']._serialized_end=976
# @@protoc_insertion_point(module_scope) # @@protoc_insertion_point(module_scope)
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -35,18 +35,32 @@ directly instead of this class. ...@@ -35,18 +35,32 @@ directly instead of this class.
__author__ = 'matthewtoia@google.com (Matt Toia)' __author__ = 'matthewtoia@google.com (Matt Toia)'
import collections import collections
import threading
import warnings import warnings
from google.protobuf import descriptor from google.protobuf import descriptor
from google.protobuf import descriptor_database from google.protobuf import descriptor_database
from google.protobuf import text_encoding from google.protobuf import text_encoding
from google.protobuf.internal import python_edition_defaults
from google.protobuf.internal import python_message from google.protobuf.internal import python_message
_USE_C_DESCRIPTORS = descriptor._USE_C_DESCRIPTORS # pylint: disable=protected-access _USE_C_DESCRIPTORS = descriptor._USE_C_DESCRIPTORS # pylint: disable=protected-access
def _Deprecated(func):
"""Mark functions as deprecated."""
def NewFunc(*args, **kwargs):
warnings.warn(
'Call to deprecated function %s(). Note: Do add unlinked descriptors '
'to descriptor_pool is wrong. Please use Add() or AddSerializedFile() '
'instead. This function will be removed soon.' % func.__name__,
category=DeprecationWarning)
return func(*args, **kwargs)
NewFunc.__name__ = func.__name__
NewFunc.__doc__ = func.__doc__
NewFunc.__dict__.update(func.__dict__)
return NewFunc
def _NormalizeFullyQualifiedName(name): def _NormalizeFullyQualifiedName(name):
"""Remove leading period from fully-qualified type name. """Remove leading period from fully-qualified type name.
...@@ -77,8 +91,6 @@ def _IsMessageSetExtension(field): ...@@ -77,8 +91,6 @@ def _IsMessageSetExtension(field):
field.type == descriptor.FieldDescriptor.TYPE_MESSAGE and field.type == descriptor.FieldDescriptor.TYPE_MESSAGE and
field.label == descriptor.FieldDescriptor.LABEL_OPTIONAL) field.label == descriptor.FieldDescriptor.LABEL_OPTIONAL)
_edition_defaults_lock = threading.Lock()
class DescriptorPool(object): class DescriptorPool(object):
"""A collection of protobufs dynamically constructed by descriptor protos.""" """A collection of protobufs dynamically constructed by descriptor protos."""
...@@ -119,11 +131,6 @@ class DescriptorPool(object): ...@@ -119,11 +131,6 @@ class DescriptorPool(object):
# full name or its tag number. # full name or its tag number.
self._extensions_by_name = collections.defaultdict(dict) self._extensions_by_name = collections.defaultdict(dict)
self._extensions_by_number = collections.defaultdict(dict) self._extensions_by_number = collections.defaultdict(dict)
self._serialized_edition_defaults = (
python_edition_defaults._PROTOBUF_INTERNAL_PYTHON_EDITION_DEFAULTS
)
self._edition_defaults = None
self._feature_cache = dict()
def _CheckConflictRegister(self, desc, desc_name, file_name): def _CheckConflictRegister(self, desc, desc_name, file_name):
"""Check if the descriptor name conflicts with another of the same name. """Check if the descriptor name conflicts with another of the same name.
...@@ -191,6 +198,12 @@ class DescriptorPool(object): ...@@ -191,6 +198,12 @@ class DescriptorPool(object):
file_desc.serialized_pb = serialized_file_desc_proto file_desc.serialized_pb = serialized_file_desc_proto
return file_desc return file_desc
# Add Descriptor to descriptor pool is deprecated. Please use Add()
# or AddSerializedFile() to add a FileDescriptorProto instead.
@_Deprecated
def AddDescriptor(self, desc):
self._AddDescriptor(desc)
# Never call this method. It is for internal usage only. # Never call this method. It is for internal usage only.
def _AddDescriptor(self, desc): def _AddDescriptor(self, desc):
"""Adds a Descriptor to the pool, non-recursively. """Adds a Descriptor to the pool, non-recursively.
...@@ -245,6 +258,12 @@ class DescriptorPool(object): ...@@ -245,6 +258,12 @@ class DescriptorPool(object):
self._top_enum_values[full_name] = enum_value self._top_enum_values[full_name] = enum_value
self._AddFileDescriptor(enum_desc.file) self._AddFileDescriptor(enum_desc.file)
# Add ServiceDescriptor to descriptor pool is deprecated. Please use Add()
# or AddSerializedFile() to add a FileDescriptorProto instead.
@_Deprecated
def AddServiceDescriptor(self, service_desc):
self._AddServiceDescriptor(service_desc)
# Never call this method. It is for internal usage only. # Never call this method. It is for internal usage only.
def _AddServiceDescriptor(self, service_desc): def _AddServiceDescriptor(self, service_desc):
"""Adds a ServiceDescriptor to the pool. """Adds a ServiceDescriptor to the pool.
...@@ -260,6 +279,12 @@ class DescriptorPool(object): ...@@ -260,6 +279,12 @@ class DescriptorPool(object):
service_desc.file.name) service_desc.file.name)
self._service_descriptors[service_desc.full_name] = service_desc self._service_descriptors[service_desc.full_name] = service_desc
# Add ExtensionDescriptor to descriptor pool is deprecated. Please use Add()
# or AddSerializedFile() to add a FileDescriptorProto instead.
@_Deprecated
def AddExtensionDescriptor(self, extension):
self._AddExtensionDescriptor(extension)
# Never call this method. It is for internal usage only. # Never call this method. It is for internal usage only.
def _AddExtensionDescriptor(self, extension): def _AddExtensionDescriptor(self, extension):
"""Adds a FieldDescriptor describing an extension to the pool. """Adds a FieldDescriptor describing an extension to the pool.
...@@ -309,6 +334,10 @@ class DescriptorPool(object): ...@@ -309,6 +334,10 @@ class DescriptorPool(object):
python_message._AttachFieldHelpers( python_message._AttachFieldHelpers(
extension.containing_type._concrete_class, extension) extension.containing_type._concrete_class, extension)
@_Deprecated
def AddFileDescriptor(self, file_desc):
self._InternalAddFileDescriptor(file_desc)
# Never call this method. It is for internal usage only. # Never call this method. It is for internal usage only.
def _InternalAddFileDescriptor(self, file_desc): def _InternalAddFileDescriptor(self, file_desc):
"""Adds a FileDescriptor to the pool, non-recursively. """Adds a FileDescriptor to the pool, non-recursively.
...@@ -650,114 +679,6 @@ class DescriptorPool(object): ...@@ -650,114 +679,6 @@ class DescriptorPool(object):
service_descriptor = self.FindServiceByName(service_name) service_descriptor = self.FindServiceByName(service_name)
return service_descriptor.methods_by_name[method_name] return service_descriptor.methods_by_name[method_name]
def SetFeatureSetDefaults(self, defaults):
"""Sets the default feature mappings used during the build.
Args:
defaults: a FeatureSetDefaults message containing the new mappings.
"""
if self._edition_defaults is not None:
raise ValueError(
"Feature set defaults can't be changed once the pool has started"
' building!'
)
# pylint: disable=g-import-not-at-top
from google.protobuf import descriptor_pb2
if not isinstance(defaults, descriptor_pb2.FeatureSetDefaults):
raise TypeError('SetFeatureSetDefaults called with invalid type')
if defaults.minimum_edition > defaults.maximum_edition:
raise ValueError(
'Invalid edition range %s to %s'
% (
descriptor_pb2.Edition.Name(defaults.minimum_edition),
descriptor_pb2.Edition.Name(defaults.maximum_edition),
)
)
prev_edition = descriptor_pb2.Edition.EDITION_UNKNOWN
for d in defaults.defaults:
if d.edition == descriptor_pb2.Edition.EDITION_UNKNOWN:
raise ValueError('Invalid edition EDITION_UNKNOWN specified')
if prev_edition >= d.edition:
raise ValueError(
'Feature set defaults are not strictly increasing. %s is greater'
' than or equal to %s'
% (
descriptor_pb2.Edition.Name(prev_edition),
descriptor_pb2.Edition.Name(d.edition),
)
)
prev_edition = d.edition
self._edition_defaults = defaults
def _CreateDefaultFeatures(self, edition):
"""Creates a FeatureSet message with defaults for a specific edition.
Args:
edition: the edition to generate defaults for.
Returns:
A FeatureSet message with defaults for a specific edition.
"""
# pylint: disable=g-import-not-at-top
from google.protobuf import descriptor_pb2
with _edition_defaults_lock:
if not self._edition_defaults:
self._edition_defaults = descriptor_pb2.FeatureSetDefaults()
self._edition_defaults.ParseFromString(
self._serialized_edition_defaults
)
if edition < self._edition_defaults.minimum_edition:
raise TypeError(
'Edition %s is earlier than the minimum supported edition %s!'
% (
descriptor_pb2.Edition.Name(edition),
descriptor_pb2.Edition.Name(
self._edition_defaults.minimum_edition
),
)
)
if edition > self._edition_defaults.maximum_edition:
raise TypeError(
'Edition %s is later than the maximum supported edition %s!'
% (
descriptor_pb2.Edition.Name(edition),
descriptor_pb2.Edition.Name(
self._edition_defaults.maximum_edition
),
)
)
found = None
for d in self._edition_defaults.defaults:
if d.edition > edition:
break
found = d
if found is None:
raise TypeError(
'No valid default found for edition %s!'
% descriptor_pb2.Edition.Name(edition)
)
defaults = descriptor_pb2.FeatureSet()
defaults.CopyFrom(found.fixed_features)
defaults.MergeFrom(found.overridable_features)
return defaults
def _InternFeatures(self, features):
serialized = features.SerializeToString()
with _edition_defaults_lock:
cached = self._feature_cache.get(serialized)
if cached is None:
self._feature_cache[serialized] = features
cached = features
return cached
def _FindFileContainingSymbolInDb(self, symbol): def _FindFileContainingSymbolInDb(self, symbol):
"""Finds the file in descriptor DB containing the specified symbol. """Finds the file in descriptor DB containing the specified symbol.
...@@ -798,22 +719,17 @@ class DescriptorPool(object): ...@@ -798,22 +719,17 @@ class DescriptorPool(object):
direct_deps = [self.FindFileByName(n) for n in file_proto.dependency] direct_deps = [self.FindFileByName(n) for n in file_proto.dependency]
public_deps = [direct_deps[i] for i in file_proto.public_dependency] public_deps = [direct_deps[i] for i in file_proto.public_dependency]
# pylint: disable=g-import-not-at-top
from google.protobuf import descriptor_pb2
file_descriptor = descriptor.FileDescriptor( file_descriptor = descriptor.FileDescriptor(
pool=self, pool=self,
name=file_proto.name, name=file_proto.name,
package=file_proto.package, package=file_proto.package,
syntax=file_proto.syntax, syntax=file_proto.syntax,
edition=descriptor_pb2.Edition.Name(file_proto.edition),
options=_OptionsOrNone(file_proto), options=_OptionsOrNone(file_proto),
serialized_pb=file_proto.SerializeToString(), serialized_pb=file_proto.SerializeToString(),
dependencies=direct_deps, dependencies=direct_deps,
public_dependencies=public_deps, public_dependencies=public_deps,
# pylint: disable=protected-access # pylint: disable=protected-access
create_key=descriptor._internal_create_key, create_key=descriptor._internal_create_key)
)
scope = {} scope = {}
# This loop extracts all the message and enum types from all the # This loop extracts all the message and enum types from all the
...@@ -960,10 +876,10 @@ class DescriptorPool(object): ...@@ -960,10 +876,10 @@ class DescriptorPool(object):
file=file_desc, file=file_desc,
serialized_start=None, serialized_start=None,
serialized_end=None, serialized_end=None,
syntax=syntax,
is_map_entry=desc_proto.options.map_entry, is_map_entry=desc_proto.options.map_entry,
# pylint: disable=protected-access # pylint: disable=protected-access
create_key=descriptor._internal_create_key, create_key=descriptor._internal_create_key)
)
for nested in desc.nested_types: for nested in desc.nested_types:
nested.containing_type = desc nested.containing_type = desc
for enum in desc.enum_types: for enum in desc.enum_types:
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/duration.proto # source: google/protobuf/duration.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/duration.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1egoogle/protobu ...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1egoogle/protobu
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.duration_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.duration_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\rDurationProtoP\001Z1google.golang.org/protobuf/types/known/durationpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\rDurationProtoP\001Z1google.golang.org/protobuf/types/known/durationpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_DURATION']._serialized_start=51 _globals['_DURATION']._serialized_start=51
_globals['_DURATION']._serialized_end=109 _globals['_DURATION']._serialized_end=109
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/empty.proto # source: google/protobuf/empty.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/empty.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bgoogle/protobu ...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1bgoogle/protobu
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.empty_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.empty_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\nEmptyProtoP\001Z.google.golang.org/protobuf/types/known/emptypb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\nEmptyProtoP\001Z.google.golang.org/protobuf/types/known/emptypb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_EMPTY']._serialized_start=48 _globals['_EMPTY']._serialized_start=48
_globals['_EMPTY']._serialized_end=55 _globals['_EMPTY']._serialized_end=55
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/field_mask.proto # source: google/protobuf/field_mask.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/field_mask.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n google/protobuf/f ...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n google/protobuf/f
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.field_mask_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.field_mask_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\016FieldMaskProtoP\001Z2google.golang.org/protobuf/types/known/fieldmaskpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\016FieldMaskProtoP\001Z2google.golang.org/protobuf/types/known/fieldmaskpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_FIELDMASK']._serialized_start=53 _globals['_FIELDMASK']._serialized_start=53
_globals['_FIELDMASK']._serialized_end=86 _globals['_FIELDMASK']._serialized_end=86
......
...@@ -13,8 +13,6 @@ import os ...@@ -13,8 +13,6 @@ import os
import sys import sys
import warnings import warnings
_GOOGLE3_PYTHON_UPB_DEFAULT = True
def _ApiVersionToImplementationType(api_version): def _ApiVersionToImplementationType(api_version):
if api_version == 2: if api_version == 2:
......
...@@ -136,7 +136,17 @@ class RepeatedScalarFieldContainer(BaseContainer[_T], MutableSequence[_T]): ...@@ -136,7 +136,17 @@ class RepeatedScalarFieldContainer(BaseContainer[_T], MutableSequence[_T]):
def extend(self, elem_seq: Iterable[_T]) -> None: def extend(self, elem_seq: Iterable[_T]) -> None:
"""Extends by appending the given iterable. Similar to list.extend().""" """Extends by appending the given iterable. Similar to list.extend()."""
# TODO: Change OSS to raise error too
if elem_seq is None:
return
try:
elem_seq_iter = iter(elem_seq) elem_seq_iter = iter(elem_seq)
except TypeError:
if not elem_seq:
warnings.warn('Value is not iterable. Please remove the wrong '
'usage. This will be changed to raise TypeError soon.')
return
raise
new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter] new_values = [self._type_checker.CheckValue(elem) for elem in elem_seq_iter]
if new_values: if new_values:
self._values.extend(new_values) self._values.extend(new_values)
......
...@@ -386,12 +386,18 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default, ...@@ -386,12 +386,18 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default,
message._unknown_fields.append( message._unknown_fields.append(
(tag_bytes, buffer[value_start_pos:pos].tobytes())) (tag_bytes, buffer[value_start_pos:pos].tobytes()))
if message._unknown_field_set is None:
message._unknown_field_set = containers.UnknownFieldSet()
message._unknown_field_set._add(
field_number, wire_format.WIRETYPE_VARINT, element)
# pylint: enable=protected-access # pylint: enable=protected-access
if pos > endpoint: if pos > endpoint:
if element in enum_type.values_by_number: if element in enum_type.values_by_number:
del value[-1] # Discard corrupt value. del value[-1] # Discard corrupt value.
else: else:
del message._unknown_fields[-1] del message._unknown_fields[-1]
# pylint: disable=protected-access
del message._unknown_field_set._values[-1]
# pylint: enable=protected-access # pylint: enable=protected-access
raise _DecodeError('Packed element was truncated.') raise _DecodeError('Packed element was truncated.')
return pos return pos
...@@ -425,6 +431,10 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default, ...@@ -425,6 +431,10 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default,
message._unknown_fields = [] message._unknown_fields = []
message._unknown_fields.append( message._unknown_fields.append(
(tag_bytes, buffer[pos:new_pos].tobytes())) (tag_bytes, buffer[pos:new_pos].tobytes()))
if message._unknown_field_set is None:
message._unknown_field_set = containers.UnknownFieldSet()
message._unknown_field_set._add(
field_number, wire_format.WIRETYPE_VARINT, element)
# pylint: enable=protected-access # pylint: enable=protected-access
# Predict that the next tag is another copy of the same repeated # Predict that the next tag is another copy of the same repeated
# field. # field.
...@@ -466,6 +476,10 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default, ...@@ -466,6 +476,10 @@ def EnumDecoder(field_number, is_repeated, is_packed, key, new_default,
wire_format.WIRETYPE_VARINT) wire_format.WIRETYPE_VARINT)
message._unknown_fields.append( message._unknown_fields.append(
(tag_bytes, buffer[value_start_pos:pos].tobytes())) (tag_bytes, buffer[value_start_pos:pos].tobytes()))
if message._unknown_field_set is None:
message._unknown_field_set = containers.UnknownFieldSet()
message._unknown_field_set._add(
field_number, wire_format.WIRETYPE_VARINT, enum_value)
# pylint: enable=protected-access # pylint: enable=protected-access
return pos return pos
return DecodeField return DecodeField
...@@ -781,6 +795,12 @@ def MessageSetItemDecoder(descriptor): ...@@ -781,6 +795,12 @@ def MessageSetItemDecoder(descriptor):
message._unknown_fields = [] message._unknown_fields = []
message._unknown_fields.append( message._unknown_fields.append(
(MESSAGE_SET_ITEM_TAG, buffer[message_set_item_start:pos].tobytes())) (MESSAGE_SET_ITEM_TAG, buffer[message_set_item_start:pos].tobytes()))
if message._unknown_field_set is None:
message._unknown_field_set = containers.UnknownFieldSet()
message._unknown_field_set._add(
type_id,
wire_format.WIRETYPE_LENGTH_DELIMITED,
buffer[message_start:message_end].tobytes())
# pylint: enable=protected-access # pylint: enable=protected-access
return pos return pos
......
"""
This file contains the serialized FeatureSetDefaults object corresponding to
the Pure Python runtime. This is used for feature resolution under Editions.
"""
_PROTOBUF_INTERNAL_PYTHON_EDITION_DEFAULTS = b"\n\023\030\346\007\"\000*\014\010\001\020\002\030\002 \003(\0010\002\n\023\030\347\007\"\000*\014\010\002\020\001\030\001 \002(\0010\001\n\023\030\350\007\"\014\010\001\020\001\030\001 \002(\0010\001*\000 \346\007(\350\007"
...@@ -240,6 +240,7 @@ def _AddSlots(message_descriptor, dictionary): ...@@ -240,6 +240,7 @@ def _AddSlots(message_descriptor, dictionary):
'_cached_byte_size_dirty', '_cached_byte_size_dirty',
'_fields', '_fields',
'_unknown_fields', '_unknown_fields',
'_unknown_field_set',
'_is_present_in_parent', '_is_present_in_parent',
'_listener', '_listener',
'_listener_for_children', '_listener_for_children',
...@@ -502,6 +503,9 @@ def _AddInitMethod(message_descriptor, cls): ...@@ -502,6 +503,9 @@ def _AddInitMethod(message_descriptor, cls):
# _unknown_fields is () when empty for efficiency, and will be turned into # _unknown_fields is () when empty for efficiency, and will be turned into
# a list if fields are added. # a list if fields are added.
self._unknown_fields = () self._unknown_fields = ()
# _unknown_field_set is None when empty for efficiency, and will be
# turned into UnknownFieldSet struct if fields are added.
self._unknown_field_set = None # pylint: disable=protected-access
self._is_present_in_parent = False self._is_present_in_parent = False
self._listener = message_listener_mod.NullMessageListener() self._listener = message_listener_mod.NullMessageListener()
self._listener_for_children = _Listener(self) self._listener_for_children = _Listener(self)
...@@ -775,6 +779,15 @@ def _AddPropertiesForExtensions(descriptor, cls): ...@@ -775,6 +779,15 @@ def _AddPropertiesForExtensions(descriptor, cls):
pool = descriptor.file.pool pool = descriptor.file.pool
def _AddStaticMethods(cls): def _AddStaticMethods(cls):
# TODO: This probably needs to be thread-safe(?)
def RegisterExtension(field_descriptor):
field_descriptor.containing_type = cls.DESCRIPTOR
# TODO: Use cls.MESSAGE_FACTORY.pool when available.
# pylint: disable=protected-access
cls.DESCRIPTOR.file.pool._AddExtensionDescriptor(field_descriptor)
_AttachFieldHelpers(cls, field_descriptor)
cls.RegisterExtension = staticmethod(RegisterExtension)
def FromString(s): def FromString(s):
message = cls() message = cls()
message.MergeFromString(s) message.MergeFromString(s)
...@@ -1140,6 +1153,8 @@ def _AddMergeFromStringMethod(message_descriptor, cls): ...@@ -1140,6 +1153,8 @@ def _AddMergeFromStringMethod(message_descriptor, cls):
assert isinstance(buffer, memoryview) assert isinstance(buffer, memoryview)
self._Modified() self._Modified()
field_dict = self._fields field_dict = self._fields
# pylint: disable=protected-access
unknown_field_set = self._unknown_field_set
while pos != end: while pos != end:
(tag_bytes, new_pos) = local_ReadTag(buffer, pos) (tag_bytes, new_pos) = local_ReadTag(buffer, pos)
field_decoder, field_des = message_set_decoders_by_tag.get( field_decoder, field_des = message_set_decoders_by_tag.get(
...@@ -1152,6 +1167,11 @@ def _AddMergeFromStringMethod(message_descriptor, cls): ...@@ -1152,6 +1167,11 @@ def _AddMergeFromStringMethod(message_descriptor, cls):
if field_des is None: if field_des is None:
if not self._unknown_fields: # pylint: disable=protected-access if not self._unknown_fields: # pylint: disable=protected-access
self._unknown_fields = [] # pylint: disable=protected-access self._unknown_fields = [] # pylint: disable=protected-access
if unknown_field_set is None:
# pylint: disable=protected-access
self._unknown_field_set = containers.UnknownFieldSet()
# pylint: disable=protected-access
unknown_field_set = self._unknown_field_set
# pylint: disable=protected-access # pylint: disable=protected-access
(tag, _) = decoder._DecodeVarint(tag_bytes, 0) (tag, _) = decoder._DecodeVarint(tag_bytes, 0)
field_number, wire_type = wire_format.UnpackTag(tag) field_number, wire_type = wire_format.UnpackTag(tag)
...@@ -1163,6 +1183,8 @@ def _AddMergeFromStringMethod(message_descriptor, cls): ...@@ -1163,6 +1183,8 @@ def _AddMergeFromStringMethod(message_descriptor, cls):
buffer, new_pos, wire_type) # pylint: disable=protected-access buffer, new_pos, wire_type) # pylint: disable=protected-access
if new_pos == -1: if new_pos == -1:
return pos return pos
# pylint: disable=protected-access
unknown_field_set._add(field_number, wire_type, data)
# TODO: remove _unknown_fields. # TODO: remove _unknown_fields.
new_pos = local_SkipField(buffer, old_pos, end, tag_bytes) new_pos = local_SkipField(buffer, old_pos, end, tag_bytes)
if new_pos == -1: if new_pos == -1:
...@@ -1323,6 +1345,10 @@ def _AddMergeFromMethod(cls): ...@@ -1323,6 +1345,10 @@ def _AddMergeFromMethod(cls):
if not self._unknown_fields: if not self._unknown_fields:
self._unknown_fields = [] self._unknown_fields = []
self._unknown_fields.extend(msg._unknown_fields) self._unknown_fields.extend(msg._unknown_fields)
# pylint: disable=protected-access
if self._unknown_field_set is None:
self._unknown_field_set = containers.UnknownFieldSet()
self._unknown_field_set._extend(msg._unknown_field_set)
cls.MergeFrom = MergeFrom cls.MergeFrom = MergeFrom
...@@ -1349,19 +1375,30 @@ def _Clear(self): ...@@ -1349,19 +1375,30 @@ def _Clear(self):
# Clear fields. # Clear fields.
self._fields = {} self._fields = {}
self._unknown_fields = () self._unknown_fields = ()
# pylint: disable=protected-access
if self._unknown_field_set is not None:
self._unknown_field_set._clear()
self._unknown_field_set = None
self._oneofs = {} self._oneofs = {}
self._Modified() self._Modified()
def _UnknownFields(self): def _UnknownFields(self):
raise NotImplementedError('Please use the add-on feaure ' warnings.warn(
'unknown_fields.UnknownFieldSet(message) in ' 'message.UnknownFields() is deprecated. Please use the add one '
'unknown_fields.py instead.') 'feature unknown_fields.UnknownFieldSet(message) in '
'unknown_fields.py instead.'
)
if self._unknown_field_set is None: # pylint: disable=protected-access
# pylint: disable=protected-access
self._unknown_field_set = containers.UnknownFieldSet()
return self._unknown_field_set # pylint: disable=protected-access
def _DiscardUnknownFields(self): def _DiscardUnknownFields(self):
self._unknown_fields = [] self._unknown_fields = []
self._unknown_field_set = None # pylint: disable=protected-access
for field, value in self.ListFields(): for field, value in self.ListFields():
if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE: if field.cpp_type == _FieldDescriptor.CPPTYPE_MESSAGE:
if _IsMapField(field): if _IsMapField(field):
...@@ -1403,6 +1440,7 @@ def _AddMessageMethods(message_descriptor, cls): ...@@ -1403,6 +1440,7 @@ def _AddMessageMethods(message_descriptor, cls):
_AddWhichOneofMethod(message_descriptor, cls) _AddWhichOneofMethod(message_descriptor, cls)
# Adds methods which do not depend on cls. # Adds methods which do not depend on cls.
cls.Clear = _Clear cls.Clear = _Clear
cls.UnknownFields = _UnknownFields
cls.DiscardUnknownFields = _DiscardUnknownFields cls.DiscardUnknownFields = _DiscardUnknownFields
cls._SetListener = _SetListener cls._SetListener = _SetListener
......
...@@ -20,7 +20,6 @@ __author__ = 'jieluo@google.com (Jie Luo)' ...@@ -20,7 +20,6 @@ __author__ = 'jieluo@google.com (Jie Luo)'
import calendar import calendar
import collections.abc import collections.abc
import datetime import datetime
import warnings
from google.protobuf.internal import field_mask from google.protobuf.internal import field_mask
...@@ -34,8 +33,6 @@ _MILLIS_PER_SECOND = 1000 ...@@ -34,8 +33,6 @@ _MILLIS_PER_SECOND = 1000
_MICROS_PER_SECOND = 1000000 _MICROS_PER_SECOND = 1000000
_SECONDS_PER_DAY = 24 * 3600 _SECONDS_PER_DAY = 24 * 3600
_DURATION_SECONDS_MAX = 315576000000 _DURATION_SECONDS_MAX = 315576000000
_TIMESTAMP_SECONDS_MIN = -62135596800
_TIMESTAMP_SECONDS_MAX = 253402300799
_EPOCH_DATETIME_NAIVE = datetime.datetime(1970, 1, 1, tzinfo=None) _EPOCH_DATETIME_NAIVE = datetime.datetime(1970, 1, 1, tzinfo=None)
_EPOCH_DATETIME_AWARE = _EPOCH_DATETIME_NAIVE.replace( _EPOCH_DATETIME_AWARE = _EPOCH_DATETIME_NAIVE.replace(
...@@ -88,10 +85,10 @@ class Timestamp(object): ...@@ -88,10 +85,10 @@ class Timestamp(object):
and uses 3, 6 or 9 fractional digits as required to represent the and uses 3, 6 or 9 fractional digits as required to represent the
exact time. Example of the return format: '1972-01-01T10:00:20.021Z' exact time. Example of the return format: '1972-01-01T10:00:20.021Z'
""" """
_CheckTimestampValid(self.seconds, self.nanos) nanos = self.nanos % _NANOS_PER_SECOND
nanos = self.nanos total_sec = self.seconds + (self.nanos - nanos) // _NANOS_PER_SECOND
seconds = self.seconds % _SECONDS_PER_DAY seconds = total_sec % _SECONDS_PER_DAY
days = (self.seconds - seconds) // _SECONDS_PER_DAY days = (total_sec - seconds) // _SECONDS_PER_DAY
dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(days, seconds) dt = datetime.datetime(1970, 1, 1) + datetime.timedelta(days, seconds)
result = dt.isoformat() result = dt.isoformat()
...@@ -169,7 +166,6 @@ class Timestamp(object): ...@@ -169,7 +166,6 @@ class Timestamp(object):
else: else:
seconds += (int(timezone[1:pos])*60+int(timezone[pos+1:]))*60 seconds += (int(timezone[1:pos])*60+int(timezone[pos+1:]))*60
# Set seconds and nanos # Set seconds and nanos
_CheckTimestampValid(seconds, nanos)
self.seconds = int(seconds) self.seconds = int(seconds)
self.nanos = int(nanos) self.nanos = int(nanos)
...@@ -179,53 +175,39 @@ class Timestamp(object): ...@@ -179,53 +175,39 @@ class Timestamp(object):
def ToNanoseconds(self): def ToNanoseconds(self):
"""Converts Timestamp to nanoseconds since epoch.""" """Converts Timestamp to nanoseconds since epoch."""
_CheckTimestampValid(self.seconds, self.nanos)
return self.seconds * _NANOS_PER_SECOND + self.nanos return self.seconds * _NANOS_PER_SECOND + self.nanos
def ToMicroseconds(self): def ToMicroseconds(self):
"""Converts Timestamp to microseconds since epoch.""" """Converts Timestamp to microseconds since epoch."""
_CheckTimestampValid(self.seconds, self.nanos)
return (self.seconds * _MICROS_PER_SECOND + return (self.seconds * _MICROS_PER_SECOND +
self.nanos // _NANOS_PER_MICROSECOND) self.nanos // _NANOS_PER_MICROSECOND)
def ToMilliseconds(self): def ToMilliseconds(self):
"""Converts Timestamp to milliseconds since epoch.""" """Converts Timestamp to milliseconds since epoch."""
_CheckTimestampValid(self.seconds, self.nanos)
return (self.seconds * _MILLIS_PER_SECOND + return (self.seconds * _MILLIS_PER_SECOND +
self.nanos // _NANOS_PER_MILLISECOND) self.nanos // _NANOS_PER_MILLISECOND)
def ToSeconds(self): def ToSeconds(self):
"""Converts Timestamp to seconds since epoch.""" """Converts Timestamp to seconds since epoch."""
_CheckTimestampValid(self.seconds, self.nanos)
return self.seconds return self.seconds
def FromNanoseconds(self, nanos): def FromNanoseconds(self, nanos):
"""Converts nanoseconds since epoch to Timestamp.""" """Converts nanoseconds since epoch to Timestamp."""
seconds = nanos // _NANOS_PER_SECOND self.seconds = nanos // _NANOS_PER_SECOND
nanos = nanos % _NANOS_PER_SECOND self.nanos = nanos % _NANOS_PER_SECOND
_CheckTimestampValid(seconds, nanos)
self.seconds = seconds
self.nanos = nanos
def FromMicroseconds(self, micros): def FromMicroseconds(self, micros):
"""Converts microseconds since epoch to Timestamp.""" """Converts microseconds since epoch to Timestamp."""
seconds = micros // _MICROS_PER_SECOND self.seconds = micros // _MICROS_PER_SECOND
nanos = (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND self.nanos = (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND
_CheckTimestampValid(seconds, nanos)
self.seconds = seconds
self.nanos = nanos
def FromMilliseconds(self, millis): def FromMilliseconds(self, millis):
"""Converts milliseconds since epoch to Timestamp.""" """Converts milliseconds since epoch to Timestamp."""
seconds = millis // _MILLIS_PER_SECOND self.seconds = millis // _MILLIS_PER_SECOND
nanos = (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND self.nanos = (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND
_CheckTimestampValid(seconds, nanos)
self.seconds = seconds
self.nanos = nanos
def FromSeconds(self, seconds): def FromSeconds(self, seconds):
"""Converts seconds since epoch to Timestamp.""" """Converts seconds since epoch to Timestamp."""
_CheckTimestampValid(seconds, 0)
self.seconds = seconds self.seconds = seconds
self.nanos = 0 self.nanos = 0
...@@ -247,7 +229,6 @@ class Timestamp(object): ...@@ -247,7 +229,6 @@ class Timestamp(object):
# https://github.com/python/cpython/issues/109849) or full range (on some # https://github.com/python/cpython/issues/109849) or full range (on some
# platforms, see https://github.com/python/cpython/issues/110042) of # platforms, see https://github.com/python/cpython/issues/110042) of
# datetime. # datetime.
_CheckTimestampValid(self.seconds, self.nanos)
delta = datetime.timedelta( delta = datetime.timedelta(
seconds=self.seconds, seconds=self.seconds,
microseconds=_RoundTowardZero(self.nanos, _NANOS_PER_MICROSECOND), microseconds=_RoundTowardZero(self.nanos, _NANOS_PER_MICROSECOND),
...@@ -271,22 +252,8 @@ class Timestamp(object): ...@@ -271,22 +252,8 @@ class Timestamp(object):
# manipulated into a long value of seconds. During the conversion from # manipulated into a long value of seconds. During the conversion from
# struct_time to long, the source date in UTC, and so it follows that the # struct_time to long, the source date in UTC, and so it follows that the
# correct transformation is calendar.timegm() # correct transformation is calendar.timegm()
seconds = calendar.timegm(dt.utctimetuple()) self.seconds = calendar.timegm(dt.utctimetuple())
nanos = dt.microsecond * _NANOS_PER_MICROSECOND self.nanos = dt.microsecond * _NANOS_PER_MICROSECOND
_CheckTimestampValid(seconds, nanos)
self.seconds = seconds
self.nanos = nanos
def _CheckTimestampValid(seconds, nanos):
if seconds < _TIMESTAMP_SECONDS_MIN or seconds > _TIMESTAMP_SECONDS_MAX:
raise ValueError(
'Timestamp is not valid: Seconds {0} must be in range '
'[-62135596800, 253402300799].'.format(seconds))
if nanos < 0 or nanos >= _NANOS_PER_SECOND:
raise ValueError(
'Timestamp is not valid: Nanos {} must be in a range '
'[0, 999999].'.format(nanos))
class Duration(object): class Duration(object):
...@@ -400,7 +367,7 @@ class Duration(object): ...@@ -400,7 +367,7 @@ class Duration(object):
self.seconds = seconds self.seconds = seconds
self.nanos = 0 self.nanos = 0
def ToTimedelta(self) -> datetime.timedelta: def ToTimedelta(self):
"""Converts Duration to timedelta.""" """Converts Duration to timedelta."""
return datetime.timedelta( return datetime.timedelta(
seconds=self.seconds, microseconds=_RoundTowardZero( seconds=self.seconds, microseconds=_RoundTowardZero(
......
...@@ -340,6 +340,11 @@ class Message(object): ...@@ -340,6 +340,11 @@ class Message(object):
def FromString(cls, s): def FromString(cls, s):
raise NotImplementedError raise NotImplementedError
# TODO: Remove it in OSS
@staticmethod
def RegisterExtension(field_descriptor):
raise NotImplementedError
def _SetListener(self, message_listener): def _SetListener(self, message_listener):
"""Internal method used by the protocol message implementation. """Internal method used by the protocol message implementation.
Clients should not call this directly. Clients should not call this directly.
......
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file or at
# https://developers.google.com/open-source/licenses/bsd
"""Protobuf Runtime versions and validators.
It should only be accessed by Protobuf gencodes and tests. DO NOT USE it
elsewhere.
"""
__author__ = 'shaod@google.com (Dennis Shao)'
from enum import Enum
import os
class Domain(Enum):
GOOGLE_INTERNAL = 1
PUBLIC = 2
class VersionError(Exception):
"""Exception class for version violation."""
# The versions of this Python Protobuf runtime to be changed automatically by
# the Protobuf release process. Do not edit them manually.
DOMAIN = Domain.PUBLIC
MAJOR = 5
MINOR = 27
PATCH = 3
SUFFIX = ''
def ValidateProtobufRuntimeVersion(
gen_domain, gen_major, gen_minor, gen_patch, gen_suffix, location
):
"""Function to validate versions.
Args:
gen_domain: The domain where the code was generated from.
gen_major: The major version number of the gencode.
gen_minor: The minor version number of the gencode.
gen_patch: The patch version number of the gencode.
gen_suffix: The version suffix e.g. '-dev', '-rc1' of the gencode.
location: The proto location that causes the version violation.
Raises:
VersionError: if gencode version is invalid or incompatible with the
runtime.
"""
disable_flag = os.getenv('TEMORARILY_DISABLE_PROTOBUF_VERSION_CHECK')
if disable_flag is not None and disable_flag.lower() == 'true':
return
version = f'{MAJOR}.{MINOR}.{PATCH}{SUFFIX}'
gen_version = f'{gen_major}.{gen_minor}.{gen_patch}{gen_suffix}'
if gen_major < 0 or gen_minor < 0 or gen_patch < 0:
raise VersionError(f'Invalid gencode version: {gen_version}')
error_prompt = (
'See Protobuf version guarantees at'
' https://protobuf.dev/support/cross-version-runtime-guarantee.'
)
if gen_domain != DOMAIN:
raise VersionError(
'Detected mismatched Protobuf Gencode/Runtime domains when loading'
f' {location}: gencode {gen_domain.name} runtime {DOMAIN.name}.'
' Cross-domain usage of Protobuf is not supported.'
)
if gen_major != MAJOR:
raise VersionError(
'Detected mismatched Protobuf Gencode/Runtime major versions when'
f' loading {location}: gencode {gen_version} runtime {version}.'
f' Same major version is required. {error_prompt}'
)
if MINOR < gen_minor or (MINOR == gen_minor and PATCH < gen_patch):
raise VersionError(
'Detected incompatible Protobuf Gencode/Runtime versions when loading'
f' {location}: gencode {gen_version} runtime {version}. Runtime version'
f' cannot be older than the linked gencode version. {error_prompt}'
)
if gen_suffix != SUFFIX:
raise VersionError(
'Detected mismatched Protobuf Gencode/Runtime version suffixes when'
f' loading {location}: gencode {gen_version} runtime {version}.'
f' Version suffixes must be the same. {error_prompt}'
)
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/source_context.proto # source: google/protobuf/source_context.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/source_context.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$google/protobuf/s ...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n$google/protobuf/s
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.source_context_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.source_context_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\022SourceContextProtoP\001Z6google.golang.org/protobuf/types/known/sourcecontextpb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\022SourceContextProtoP\001Z6google.golang.org/protobuf/types/known/sourcecontextpb\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_SOURCECONTEXT']._serialized_start=57 _globals['_SOURCECONTEXT']._serialized_start=57
_globals['_SOURCECONTEXT']._serialized_end=101 _globals['_SOURCECONTEXT']._serialized_end=101
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/struct.proto # source: google/protobuf/struct.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/struct.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -29,10 +19,10 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cgoogle/protobu ...@@ -29,10 +19,10 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1cgoogle/protobu
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.struct_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.struct_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\013StructProtoP\001Z/google.golang.org/protobuf/types/known/structpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\013StructProtoP\001Z/google.golang.org/protobuf/types/known/structpb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_STRUCT_FIELDSENTRY']._loaded_options = None _globals['_STRUCT_FIELDSENTRY']._options = None
_globals['_STRUCT_FIELDSENTRY']._serialized_options = b'8\001' _globals['_STRUCT_FIELDSENTRY']._serialized_options = b'8\001'
_globals['_NULLVALUE']._serialized_start=574 _globals['_NULLVALUE']._serialized_start=574
_globals['_NULLVALUE']._serialized_end=601 _globals['_NULLVALUE']._serialized_end=601
......
...@@ -8,42 +8,26 @@ ...@@ -8,42 +8,26 @@
"""Encoding related utilities.""" """Encoding related utilities."""
import re import re
def _AsciiIsPrint(i): _cescape_chr_to_symbol_map = {}
return i >= 32 and i < 127 _cescape_chr_to_symbol_map[9] = r'\t' # optional escape
_cescape_chr_to_symbol_map[10] = r'\n' # optional escape
def _MakeStrEscapes(): _cescape_chr_to_symbol_map[13] = r'\r' # optional escape
ret = {} _cescape_chr_to_symbol_map[34] = r'\"' # necessary escape
for i in range(0, 128): _cescape_chr_to_symbol_map[39] = r"\'" # optional escape
if not _AsciiIsPrint(i): _cescape_chr_to_symbol_map[92] = r'\\' # necessary escape
ret[i] = r'\%03o' % i
ret[ord('\t')] = r'\t' # optional escape # Lookup table for unicode
ret[ord('\n')] = r'\n' # optional escape _cescape_unicode_to_str = [chr(i) for i in range(0, 256)]
ret[ord('\r')] = r'\r' # optional escape for byte, string in _cescape_chr_to_symbol_map.items():
ret[ord('"')] = r'\"' # necessary escape _cescape_unicode_to_str[byte] = string
ret[ord('\'')] = r"\'" # optional escape
ret[ord('\\')] = r'\\' # necessary escape # Lookup table for non-utf8, with necessary escapes at (o >= 127 or o < 32)
return ret _cescape_byte_to_str = ([r'\%03o' % i for i in range(0, 32)] +
[chr(i) for i in range(32, 127)] +
# Maps int -> char, performing string escapes. [r'\%03o' % i for i in range(127, 256)])
_str_escapes = _MakeStrEscapes() for byte, string in _cescape_chr_to_symbol_map.items():
_cescape_byte_to_str[byte] = string
# Maps int -> char, performing byte escaping and string escapes del byte, string
_byte_escapes = {i: chr(i) for i in range(0, 256)}
_byte_escapes.update(_str_escapes)
_byte_escapes.update({i: r'\%03o' % i for i in range(128, 256)})
def _DecodeUtf8EscapeErrors(text_bytes):
ret = ''
while text_bytes:
try:
ret += text_bytes.decode('utf-8').translate(_str_escapes)
text_bytes = ''
except UnicodeDecodeError as e:
ret += text_bytes[:e.start].decode('utf-8').translate(_str_escapes)
ret += _byte_escapes[text_bytes[e.start]]
text_bytes = text_bytes[e.start+1:]
return ret
def CEscape(text, as_utf8) -> str: def CEscape(text, as_utf8) -> str:
...@@ -63,15 +47,13 @@ def CEscape(text, as_utf8) -> str: ...@@ -63,15 +47,13 @@ def CEscape(text, as_utf8) -> str:
# length. So, "\0011".encode('string_escape') ends up being "\\x011", which # length. So, "\0011".encode('string_escape') ends up being "\\x011", which
# will be decoded in C++ as a single-character string with char code 0x11. # will be decoded in C++ as a single-character string with char code 0x11.
text_is_unicode = isinstance(text, str) text_is_unicode = isinstance(text, str)
if as_utf8 and text_is_unicode:
# We're already unicode, no processing beyond control char escapes.
return text.translate(_cescape_chr_to_symbol_map)
ord_ = ord if text_is_unicode else lambda x: x # bytes iterate as ints.
if as_utf8: if as_utf8:
if text_is_unicode: return ''.join(_cescape_unicode_to_str[ord_(c)] for c in text)
return text.translate(_str_escapes) return ''.join(_cescape_byte_to_str[ord_(c)] for c in text)
else:
return _DecodeUtf8EscapeErrors(text)
else:
if text_is_unicode:
text = text.encode('utf-8')
return ''.join([_byte_escapes[c] for c in text])
_CUNESCAPE_HEX = re.compile(r'(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])') _CUNESCAPE_HEX = re.compile(r'(\\+)x([0-9a-fA-F])(?![0-9a-fA-F])')
...@@ -97,10 +79,7 @@ def CUnescape(text: str) -> bytes: ...@@ -97,10 +79,7 @@ def CUnescape(text: str) -> bytes:
# allow single-digit hex escapes (like '\xf'). # allow single-digit hex escapes (like '\xf').
result = _CUNESCAPE_HEX.sub(ReplaceHex, text) result = _CUNESCAPE_HEX.sub(ReplaceHex, text)
# Replaces Unicode escape sequences with their character equivalents. return (result.encode('utf-8') # Make it bytes to allow decode.
result = result.encode('raw_unicode_escape').decode('raw_unicode_escape') .decode('unicode_escape')
# Encode Unicode characters as UTF-8, then decode to Latin-1 escaping # Make it bytes again to return the proper type.
# unprintable characters. .encode('raw_unicode_escape'))
result = result.encode('utf-8').decode('unicode_escape')
# Convert Latin-1 text back to a byte string (latin-1 codec also works here).
return result.encode('latin-1')
...@@ -46,8 +46,6 @@ _QUOTES = frozenset(("'", '"')) ...@@ -46,8 +46,6 @@ _QUOTES = frozenset(("'", '"'))
_ANY_FULL_TYPE_NAME = 'google.protobuf.Any' _ANY_FULL_TYPE_NAME = 'google.protobuf.Any'
_DEBUG_STRING_SILENT_MARKER = '\t ' _DEBUG_STRING_SILENT_MARKER = '\t '
_as_utf8_default = True
class Error(Exception): class Error(Exception):
"""Top-level module error for text_format.""" """Top-level module error for text_format."""
...@@ -93,7 +91,7 @@ class TextWriter(object): ...@@ -93,7 +91,7 @@ class TextWriter(object):
def MessageToString( def MessageToString(
message, message,
as_utf8=_as_utf8_default, as_utf8=False,
as_one_line=False, as_one_line=False,
use_short_repeated_primitives=False, use_short_repeated_primitives=False,
pointy_brackets=False, pointy_brackets=False,
...@@ -185,40 +183,10 @@ def _IsMapEntry(field): ...@@ -185,40 +183,10 @@ def _IsMapEntry(field):
field.message_type.GetOptions().map_entry) field.message_type.GetOptions().map_entry)
def _IsGroupLike(field):
"""Determines if a field is consistent with a proto2 group.
Args:
field: The field descriptor.
Returns:
True if this field is group-like, false otherwise.
"""
# Groups are always tag-delimited.
if field.type != descriptor.FieldDescriptor.TYPE_GROUP:
return False
# Group fields always are always the lowercase type name.
if field.name != field.message_type.name.lower():
return False
if field.message_type.file != field.file:
return False
# Group messages are always defined in the same scope as the field. File
# level extensions will compare NULL == NULL here, which is why the file
# comparison above is necessary to ensure both come from the same file.
return (
field.message_type.containing_type == field.extension_scope
if field.is_extension
else field.message_type.containing_type == field.containing_type
)
def PrintMessage(message, def PrintMessage(message,
out, out,
indent=0, indent=0,
as_utf8=_as_utf8_default, as_utf8=False,
as_one_line=False, as_one_line=False,
use_short_repeated_primitives=False, use_short_repeated_primitives=False,
pointy_brackets=False, pointy_brackets=False,
...@@ -280,7 +248,7 @@ def PrintField(field, ...@@ -280,7 +248,7 @@ def PrintField(field,
value, value,
out, out,
indent=0, indent=0,
as_utf8=_as_utf8_default, as_utf8=False,
as_one_line=False, as_one_line=False,
use_short_repeated_primitives=False, use_short_repeated_primitives=False,
pointy_brackets=False, pointy_brackets=False,
...@@ -304,7 +272,7 @@ def PrintFieldValue(field, ...@@ -304,7 +272,7 @@ def PrintFieldValue(field,
value, value,
out, out,
indent=0, indent=0,
as_utf8=_as_utf8_default, as_utf8=False,
as_one_line=False, as_one_line=False,
use_short_repeated_primitives=False, use_short_repeated_primitives=False,
pointy_brackets=False, pointy_brackets=False,
...@@ -360,7 +328,7 @@ class _Printer(object): ...@@ -360,7 +328,7 @@ class _Printer(object):
self, self,
out, out,
indent=0, indent=0,
as_utf8=_as_utf8_default, as_utf8=False,
as_one_line=False, as_one_line=False,
use_short_repeated_primitives=False, use_short_repeated_primitives=False,
pointy_brackets=False, pointy_brackets=False,
...@@ -561,7 +529,7 @@ class _Printer(object): ...@@ -561,7 +529,7 @@ class _Printer(object):
else: else:
out.write(field.full_name) out.write(field.full_name)
out.write(']') out.write(']')
elif _IsGroupLike(field): elif field.type == descriptor.FieldDescriptor.TYPE_GROUP:
# For groups, use the capitalized name. # For groups, use the capitalized name.
out.write(field.message_type.name) out.write(field.message_type.name)
else: else:
...@@ -963,9 +931,11 @@ class _Parser(object): ...@@ -963,9 +931,11 @@ class _Parser(object):
# names. # names.
if not field: if not field:
field = message_descriptor.fields_by_name.get(name.lower(), None) field = message_descriptor.fields_by_name.get(name.lower(), None)
if field and not _IsGroupLike(field): if field and field.type != descriptor.FieldDescriptor.TYPE_GROUP:
field = None field = None
if field and field.message_type.name != name:
if (field and field.type == descriptor.FieldDescriptor.TYPE_GROUP and
field.message_type.name != name):
field = None field = None
if not field and not self.allow_unknown_field: if not field and not self.allow_unknown_field:
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/timestamp.proto # source: google/protobuf/timestamp.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/timestamp.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fgoogle/protobu ...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1fgoogle/protobu
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.timestamp_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.timestamp_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\016TimestampProtoP\001Z2google.golang.org/protobuf/types/known/timestamppb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\016TimestampProtoP\001Z2google.golang.org/protobuf/types/known/timestamppb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_TIMESTAMP']._serialized_start=52 _globals['_TIMESTAMP']._serialized_start=52
_globals['_TIMESTAMP']._serialized_end=111 _globals['_TIMESTAMP']._serialized_end=111
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/type.proto # source: google/protobuf/type.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/type.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -31,8 +21,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1agoogle/protobu ...@@ -31,8 +21,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1agoogle/protobu
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.type_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.type_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\tTypeProtoP\001Z-google.golang.org/protobuf/types/known/typepb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\tTypeProtoP\001Z-google.golang.org/protobuf/types/known/typepb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_SYNTAX']._serialized_start=1699 _globals['_SYNTAX']._serialized_start=1699
_globals['_SYNTAX']._serialized_end=1766 _globals['_SYNTAX']._serialized_end=1766
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT! # Generated by the protocol buffer compiler. DO NOT EDIT!
# NO CHECKED-IN PROTOBUF GENCODE
# source: google/protobuf/wrappers.proto # source: google/protobuf/wrappers.proto
# Protobuf Python Version: 5.27.3 # Protobuf Python Version: 4.25.4
"""Generated protocol buffer code.""" """Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder from google.protobuf.internal import builder as _builder
_runtime_version.ValidateProtobufRuntimeVersion(
_runtime_version.Domain.PUBLIC,
5,
27,
3,
'',
'google/protobuf/wrappers.proto'
)
# @@protoc_insertion_point(imports) # @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default() _sym_db = _symbol_database.Default()
...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1egoogle/protobu ...@@ -29,8 +19,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1egoogle/protobu
_globals = globals() _globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.wrappers_pb2', _globals) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'google.protobuf.wrappers_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS: if _descriptor._USE_C_DESCRIPTORS == False:
_globals['DESCRIPTOR']._loaded_options = None _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\rWrappersProtoP\001Z1google.golang.org/protobuf/types/known/wrapperspb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes' _globals['DESCRIPTOR']._serialized_options = b'\n\023com.google.protobufB\rWrappersProtoP\001Z1google.golang.org/protobuf/types/known/wrapperspb\370\001\001\242\002\003GPB\252\002\036Google.Protobuf.WellKnownTypes'
_globals['_DOUBLEVALUE']._serialized_start=51 _globals['_DOUBLEVALUE']._serialized_start=51
_globals['_DOUBLEVALUE']._serialized_end=86 _globals['_DOUBLEVALUE']._serialized_end=86
......
Copyright 2008 Google Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Code generated by the Protocol Buffer compiler is owned by the owner
of the input file used when generating it. This code is not
standalone and requires a support library to be linked with it. This
support library is itself covered by the above license.
Metadata-Version: 2.1
Name: protobuf
Author: protobuf@googlegroups.com
Author-email: protobuf@googlegroups.com
Home-page: https://developers.google.com/protocol-buffers/
License: 3-Clause BSD License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Version: 5.27.3
UNKNOWN
google/_upb/_message.pyd,sha256=AdWObG4cXXNxwa7FqUEMCPkcN1ndkbjarcPP4jfjO8E,780612
google/protobuf/__init__.py,sha256=Zdjf_fTpPjgkJOBVTb3CcEpMNHI_oIIUE1ppk4Bg3nI,346
google/protobuf/__pycache__/__init__.cpython-311.pyc,,
google/protobuf/__pycache__/any_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/api_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/descriptor.cpython-311.pyc,,
google/protobuf/__pycache__/descriptor_database.cpython-311.pyc,,
google/protobuf/__pycache__/descriptor_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/descriptor_pool.cpython-311.pyc,,
google/protobuf/__pycache__/duration_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/empty_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/field_mask_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/json_format.cpython-311.pyc,,
google/protobuf/__pycache__/message.cpython-311.pyc,,
google/protobuf/__pycache__/message_factory.cpython-311.pyc,,
google/protobuf/__pycache__/proto_builder.cpython-311.pyc,,
google/protobuf/__pycache__/reflection.cpython-311.pyc,,
google/protobuf/__pycache__/runtime_version.cpython-311.pyc,,
google/protobuf/__pycache__/service.cpython-311.pyc,,
google/protobuf/__pycache__/service_reflection.cpython-311.pyc,,
google/protobuf/__pycache__/source_context_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/struct_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/symbol_database.cpython-311.pyc,,
google/protobuf/__pycache__/text_encoding.cpython-311.pyc,,
google/protobuf/__pycache__/text_format.cpython-311.pyc,,
google/protobuf/__pycache__/timestamp_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/type_pb2.cpython-311.pyc,,
google/protobuf/__pycache__/unknown_fields.cpython-311.pyc,,
google/protobuf/__pycache__/wrappers_pb2.cpython-311.pyc,,
google/protobuf/any_pb2.py,sha256=R_yuTap3SRnpz4fHfFF770_zcX2p5w7le9g5jHttH84,1725
google/protobuf/api_pb2.py,sha256=WDTOgnUF1yTB9dItwaGoPAkrrRW2BAdNfhociAT-zLM,3145
google/protobuf/compiler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
google/protobuf/compiler/__pycache__/__init__.cpython-311.pyc,,
google/protobuf/compiler/__pycache__/plugin_pb2.cpython-311.pyc,,
google/protobuf/compiler/plugin_pb2.py,sha256=RTUJqysvHZ6J3QX9cEXbx8f4u31ThGbkn9XzxpvKwk8,3797
google/protobuf/descriptor.py,sha256=xM9LaJQJbyt0fxMdJwZdSzCS8tZK4LvHw5Yd2F9KgKU,52253
google/protobuf/descriptor_database.py,sha256=GDiSu-vBZBZ-L1YHQXSTsbsJMRNY-20icb6pj3ER8E8,5444
google/protobuf/descriptor_pb2.py,sha256=bSZheBJuPBULofwcKuQmei1SKlgZ2SwgIdrUeLhCULY,343107
google/protobuf/descriptor_pool.py,sha256=DA5XTv-jmRCJ1O4b_Yswg93KzmFpzaWOPofRGzhXeBY,48430
google/protobuf/duration_pb2.py,sha256=UmtlJdbkDweF5UachpCoy7ByCJ2_UJC2j32XZQQfkQs,1805
google/protobuf/empty_pb2.py,sha256=GyVaEBn0RgIGiXXv59rgJVmv4pn1Fa2X2ur3gba_o1g,1669
google/protobuf/field_mask_pb2.py,sha256=34WLmgpm_G9pquXjSDcoJnU7KIj5sp2ScnwRb_1AwQU,1765
google/protobuf/internal/__init__.py,sha256=8d_k1ksNWIuqPDEEEtOjgC3Xx8kAXD2-04R7mxJlSbs,272
google/protobuf/internal/__pycache__/__init__.cpython-311.pyc,,
google/protobuf/internal/__pycache__/_parameterized.cpython-311.pyc,,
google/protobuf/internal/__pycache__/api_implementation.cpython-311.pyc,,
google/protobuf/internal/__pycache__/builder.cpython-311.pyc,,
google/protobuf/internal/__pycache__/containers.cpython-311.pyc,,
google/protobuf/internal/__pycache__/decoder.cpython-311.pyc,,
google/protobuf/internal/__pycache__/encoder.cpython-311.pyc,,
google/protobuf/internal/__pycache__/enum_type_wrapper.cpython-311.pyc,,
google/protobuf/internal/__pycache__/extension_dict.cpython-311.pyc,,
google/protobuf/internal/__pycache__/field_mask.cpython-311.pyc,,
google/protobuf/internal/__pycache__/message_listener.cpython-311.pyc,,
google/protobuf/internal/__pycache__/python_edition_defaults.cpython-311.pyc,,
google/protobuf/internal/__pycache__/python_message.cpython-311.pyc,,
google/protobuf/internal/__pycache__/testing_refleaks.cpython-311.pyc,,
google/protobuf/internal/__pycache__/type_checkers.cpython-311.pyc,,
google/protobuf/internal/__pycache__/well_known_types.cpython-311.pyc,,
google/protobuf/internal/__pycache__/wire_format.cpython-311.pyc,,
google/protobuf/internal/_parameterized.py,sha256=_LLIH2kmUrI1hZfUlIF8OBcBbbQXgRnm39uB9TpzaHU,14073
google/protobuf/internal/api_implementation.py,sha256=Qnq9L9thCvgdxlhnGsaNrSCVXmMq_wCZ7-ooRNLVtzs,4787
google/protobuf/internal/builder.py,sha256=TaNII7ojWiJplPwkeLZ8T2l8MBC3F92WKspwzFFy2UA,4082
google/protobuf/internal/containers.py,sha256=CQ0R54YddBf2uWnDqMUnaevr79BdBb1fYM33qsnYSxY,21722
google/protobuf/internal/decoder.py,sha256=J46xzdm_bON1KHkIPlY7La0NrrqgzCOmpaXpg44r3PI,36387
google/protobuf/internal/encoder.py,sha256=Vujp3bU10dLBasUnRaGZKD-ZTLq7zEGA8wKh7mVLR-g,27297
google/protobuf/internal/enum_type_wrapper.py,sha256=9eWhuHhgzX3piT33HMx9y8_Y1KTudyGhIoDpPP00-Cg,3462
google/protobuf/internal/extension_dict.py,sha256=7bT-5iqa_qw4wkk3QNtCPzGlfPU2h9FDyc5TjF2wiTo,7225
google/protobuf/internal/field_mask.py,sha256=Ek2eDU8mY1Shj-V2wRmOggXummBv_brbL3XOEVFR6c0,10416
google/protobuf/internal/message_listener.py,sha256=uh8viU_MvWdDe4Kl14CromKVFAzBMPlMzFZ4vew_UJc,2008
google/protobuf/internal/python_edition_defaults.py,sha256=ddku5wFG4MY2QWFN8i7kwlgw3S6zrEapYSF14ofqFxU,434
google/protobuf/internal/python_message.py,sha256=PvsM4Co899Z0zjsrCIvb-iSZ7tTcw0-IFAdk3kr9-jk,55408
google/protobuf/internal/testing_refleaks.py,sha256=Pp-e8isZv-IwZDOzPaLo9WujUXj_XghNrbV-rHswvL4,4080
google/protobuf/internal/type_checkers.py,sha256=YFJUluNszW97kzWpwm7WMlFmBdSeuQQtVtVTnH-6vx0,15450
google/protobuf/internal/well_known_types.py,sha256=_vEVhdiIfoPJjffzUWJdSKzZBWC_xMDDS6Dxr77d-x0,20402
google/protobuf/internal/wire_format.py,sha256=EbAXZdb23iCObCZxNgaMx8-VRF2UjgyPrBCTtV10Rx8,7087
google/protobuf/json_format.py,sha256=v7DQgAHwYACU44kQfyoGikmZA0rwThdaixnL4UzKvqw,37073
google/protobuf/message.py,sha256=3SUbZaOuqNNCXSmkkcU30ITGjPQAPV5ZBHAIAa43tZQ,12844
google/protobuf/message_factory.py,sha256=POODzg8xr7J2YL7WgtWeJy23KAfjqz2meUzmmIUDD6E,8271
google/protobuf/proto_builder.py,sha256=pGU2L_pPEYkylZkrvHMCUH2PFWvc9wI-awwT7F5i740,4203
google/protobuf/pyext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
google/protobuf/pyext/__pycache__/__init__.cpython-311.pyc,,
google/protobuf/pyext/__pycache__/cpp_message.cpython-311.pyc,,
google/protobuf/pyext/cpp_message.py,sha256=tRWXzttU9M_Mm8ivTmxp1WIaAmg78mSuiR4Ow3rv5Zw,1704
google/protobuf/reflection.py,sha256=VLTQNavswAooyl3kIbFLeB8iyytAjuHRANby0e4oWjU,2413
google/protobuf/runtime_version.py,sha256=p5NT2eGKIxbTLrYOiiKXCWxP5_KT-I667ErHLFq3NKA,3117
google/protobuf/service.py,sha256=C63Fw-OMGXowsTmajKk0lQ6S3ODx8cGWCn2Fm-xlkTw,7787
google/protobuf/service_reflection.py,sha256=WHElGnPgywDtn3X8xKVNsZZOCgJOTzgpAyTd-rmCKGU,10058
google/protobuf/source_context_pb2.py,sha256=OhhGLN8MIvo9-D5j-qO7KU4YKdw51PJx1gv-fq4eWT0,1791
google/protobuf/struct_pb2.py,sha256=jOmLrF4oC5CD9D_YJ5eLHu8BHVBYTITdFDkHGUGckM8,3061
google/protobuf/symbol_database.py,sha256=ruKrtrkuxmFe7uzbJGMgOD7D6Qs2g6jFIRC3aS9NNvU,6709
google/protobuf/testdata/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
google/protobuf/testdata/__pycache__/__init__.cpython-311.pyc,,
google/protobuf/text_encoding.py,sha256=Ao1Q6OP8i4p8VDtvpe8uW1BjX7aQZvkJggvhFYYrB7w,3621
google/protobuf/text_format.py,sha256=cPU3NMHut4m5jmpw6h8E40zro3ONbhc_evDJxixhFuA,63478
google/protobuf/timestamp_pb2.py,sha256=0QGwAx-qyJ-yc53Sq0-mNeiIN51QjTRzWg1MBpwybqQ,1815
google/protobuf/type_pb2.py,sha256=azf_hoAak_gxrZffLHmuJu0KaIhOF-0SChe6h58SsFM,5438
google/protobuf/unknown_fields.py,sha256=RVMDxyiZcObbb40dMK-xXCAvc5pkyLNSL1y2qzPAUbA,3127
google/protobuf/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
google/protobuf/util/__pycache__/__init__.cpython-311.pyc,,
google/protobuf/wrappers_pb2.py,sha256=pYoqPDUEHlNg9JRmNpmk2YT8Y1o6zJGcoV6B-DSC0iU,3037
protobuf-5.27.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
protobuf-5.27.3.dist-info/LICENSE,sha256=bl4RcySv2UTc9n82zzKYQ7wakiKajNm7Vz16gxMP6n0,1732
protobuf-5.27.3.dist-info/METADATA,sha256=AzUAnjVXjUKEmhjHsPS5zg7iOxKeDlxbWawb3Bt_w-Y,592
protobuf-5.27.3.dist-info/RECORD,,
protobuf-5.27.3.dist-info/WHEEL,sha256=MNGKiqVzcEm_R-x4M_B59ZGraKmu9XeiF3PVWlldfs4,100
Wheel-Version: 1.0
Generator: bazel-wheelmaker 1.0
Root-Is-Purelib: false
Tag: cp310-abi3-win_amd64
Metadata-Version: 2.1
Name: tenacity
Version: 8.5.0
Summary: Retry code until it succeeds
Home-page: https://github.com/jd/tenacity
Author: Julien Danjou
Author-email: julien@danjou.info
License: Apache 2.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Utilities
Requires-Python: >=3.8
License-File: LICENSE
Provides-Extra: doc
Requires-Dist: reno ; extra == 'doc'
Requires-Dist: sphinx ; extra == 'doc'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: tornado >=4.5 ; extra == 'test'
Requires-Dist: typeguard ; extra == 'test'
Tenacity is a general-purpose retrying library to simplify the task of adding retry behavior to just about anything.
tenacity-8.5.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
tenacity-8.5.0.dist-info/LICENSE,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
tenacity-8.5.0.dist-info/METADATA,sha256=8CBR9pYHoi3YV66CkCQE5wDLNlmR6YSyFezjWE9OQIo,1155
tenacity-8.5.0.dist-info/RECORD,,
tenacity-8.5.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
tenacity-8.5.0.dist-info/top_level.txt,sha256=Zf8AOZMN7hr1EEcUo9U5KzXsM4TOC1pBZ22D8913JYs,9
tenacity/__init__.py,sha256=VEqa73Lqmwd0kWnyf1nDCRvp4JthP9RwUiNQZmfnTTw,24021
tenacity/__pycache__/__init__.cpython-311.pyc,,
tenacity/__pycache__/_utils.cpython-311.pyc,,
tenacity/__pycache__/after.cpython-311.pyc,,
tenacity/__pycache__/before.cpython-311.pyc,,
tenacity/__pycache__/before_sleep.cpython-311.pyc,,
tenacity/__pycache__/nap.cpython-311.pyc,,
tenacity/__pycache__/retry.cpython-311.pyc,,
tenacity/__pycache__/stop.cpython-311.pyc,,
tenacity/__pycache__/tornadoweb.cpython-311.pyc,,
tenacity/__pycache__/wait.cpython-311.pyc,,
tenacity/_utils.py,sha256=5AwPoFrGOIfPkCtqeJdFBi7KKQNcJXJ3erbtGOXtn6w,2916
tenacity/after.py,sha256=NR4rGyslG7xF1hDJZb2Wf8wVApafX0HZwz2nFVLvaqE,1658
tenacity/asyncio/__init__.py,sha256=PoDGzHN-neTr2GgA1Ti3ORMrSmUIEUblbiSiuyxKHTI,7773
tenacity/asyncio/__pycache__/__init__.cpython-311.pyc,,
tenacity/asyncio/__pycache__/retry.cpython-311.pyc,,
tenacity/asyncio/retry.py,sha256=ymu8F1JfAerc5vDO0V4-2kCvHXqyce2jpO1Nlt6aKxI,4244
tenacity/before.py,sha256=7zDTpZ3b6rkY9sOdS-qbpjBgSjVr3xBqcIqdYAh9ZKM,1544
tenacity/before_sleep.py,sha256=upKssiY5poOO3Bv0amADZA-a5CrY5tnb4_97s8_88SM,2360
tenacity/nap.py,sha256=fRWvnz1aIzbIq9Ap3gAkAZgDH6oo5zxMrU6ZOVByq0I,1383
tenacity/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
tenacity/retry.py,sha256=PVnZfXBeLN2DzsytKexw23SPLn82AdZfFPC2OhVQ_1Y,8986
tenacity/stop.py,sha256=wQuwGfCLw8OH1C3x0G9lH9xtJCyhgviePQ40HRAUg54,4113
tenacity/tornadoweb.py,sha256=vS1ONfPYoGzPx1asQaVbfoo6D9tPIzSysJipm61Yqw8,2125
tenacity/wait.py,sha256=Q9XoZCtFra53aQOyfABpvRDuUeB-NpUUXImHsUiRQI0,8042
Wheel-Version: 1.0
Generator: bdist_wheel (0.43.0)
Root-Is-Purelib: true
Tag: py3-none-any
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment