X7ROOT File Manager
Current Path:
/usr/lib/python2.7/site-packages/google/protobuf/internal
usr
/
lib
/
python2.7
/
site-packages
/
google
/
protobuf
/
internal
/
📁
..
📄
__init__.py
(0 B)
📄
__init__.pyc
(156 B)
📄
__init__.pyo
(156 B)
📄
_parameterized.py
(15.07 KB)
📄
_parameterized.pyc
(15.94 KB)
📄
_parameterized.pyo
(15.5 KB)
📄
any_test_pb2.py
(6.96 KB)
📄
any_test_pb2.pyc
(4.84 KB)
📄
any_test_pb2.pyo
(4.84 KB)
📄
api_implementation.py
(6.9 KB)
📄
api_implementation.pyc
(3.37 KB)
📄
api_implementation.pyo
(3.37 KB)
📄
containers.py
(20.4 KB)
📄
containers.pyc
(24.48 KB)
📄
containers.pyo
(24.48 KB)
📄
decoder.py
(30.56 KB)
📄
decoder.pyc
(25.39 KB)
📄
decoder.pyo
(25.3 KB)
📄
descriptor_database_test.py
(4.5 KB)
📄
descriptor_database_test.pyc
(2.56 KB)
📄
descriptor_database_test.pyo
(2.56 KB)
📄
descriptor_pool_test.py
(42.62 KB)
📄
descriptor_pool_test.pyc
(35.53 KB)
📄
descriptor_pool_test.pyo
(35.53 KB)
📄
descriptor_pool_test1_pb2.py
(20.43 KB)
📄
descriptor_pool_test1_pb2.pyc
(11.03 KB)
📄
descriptor_pool_test1_pb2.pyo
(11.03 KB)
📄
descriptor_pool_test2_pb2.py
(12.12 KB)
📄
descriptor_pool_test2_pb2.pyc
(7.57 KB)
📄
descriptor_pool_test2_pb2.pyo
(7.57 KB)
📄
descriptor_test.py
(41.73 KB)
📄
descriptor_test.pyc
(32.79 KB)
📄
descriptor_test.pyo
(32.79 KB)
📄
encoder.py
(27.87 KB)
📄
encoder.pyc
(28.82 KB)
📄
encoder.pyo
(28.65 KB)
📄
enum_type_wrapper.py
(3.47 KB)
📄
enum_type_wrapper.pyc
(2.92 KB)
📄
enum_type_wrapper.pyo
(2.92 KB)
📄
factory_test1_pb2.py
(7.63 KB)
📄
factory_test1_pb2.pyc
(5.49 KB)
📄
factory_test1_pb2.pyo
(5.49 KB)
📄
factory_test2_pb2.py
(24.34 KB)
📄
factory_test2_pb2.pyc
(14.02 KB)
📄
factory_test2_pb2.pyo
(14.02 KB)
📄
file_options_test_pb2.py
(2.98 KB)
📄
file_options_test_pb2.pyc
(3.03 KB)
📄
file_options_test_pb2.pyo
(3.03 KB)
📄
generator_test.py
(14.4 KB)
📄
generator_test.pyc
(12.98 KB)
📄
generator_test.pyo
(12.98 KB)
📁
import_test_package
📄
json_format_test.py
(40.46 KB)
📄
json_format_test.pyc
(33.87 KB)
📄
json_format_test.pyo
(33.87 KB)
📄
message_factory_test.py
(9.43 KB)
📄
message_factory_test.pyc
(6.74 KB)
📄
message_factory_test.pyo
(6.74 KB)
📄
message_listener.py
(3.29 KB)
📄
message_listener.pyc
(2.56 KB)
📄
message_listener.pyo
(2.56 KB)
📄
message_set_extensions_pb2.py
(8.28 KB)
📄
message_set_extensions_pb2.pyc
(5.4 KB)
📄
message_set_extensions_pb2.pyo
(5.4 KB)
📄
message_test.py
(85.56 KB)
📄
message_test.pyc
(71.09 KB)
📄
message_test.pyo
(70.97 KB)
📄
missing_enum_values_pb2.py
(9.38 KB)
📄
missing_enum_values_pb2.pyc
(6.04 KB)
📄
missing_enum_values_pb2.pyo
(6.04 KB)
📄
more_extensions_dynamic_pb2.py
(4.85 KB)
📄
more_extensions_dynamic_pb2.pyc
(4 KB)
📄
more_extensions_dynamic_pb2.pyo
(4 KB)
📄
more_extensions_pb2.py
(7.13 KB)
📄
more_extensions_pb2.pyc
(5.02 KB)
📄
more_extensions_pb2.pyo
(5.02 KB)
📄
more_messages_pb2.py
(4.16 KB)
📄
more_messages_pb2.pyc
(3.62 KB)
📄
more_messages_pb2.pyo
(3.62 KB)
📄
packed_field_test_pb2.py
(19.87 KB)
📄
packed_field_test_pb2.pyc
(10.76 KB)
📄
packed_field_test_pb2.pyo
(10.76 KB)
📄
proto_builder_test.py
(3.66 KB)
📄
proto_builder_test.pyc
(2.85 KB)
📄
proto_builder_test.pyo
(2.85 KB)
📄
python_message.py
(56.49 KB)
📄
python_message.pyc
(50.45 KB)
📄
python_message.pyo
(50.34 KB)
📄
reflection_test.py
(125.23 KB)
📄
reflection_test.pyc
(96.92 KB)
📄
reflection_test.pyo
(96.92 KB)
📄
service_reflection_test.py
(5.26 KB)
📄
service_reflection_test.pyc
(5.18 KB)
📄
service_reflection_test.pyo
(5.18 KB)
📄
symbol_database_test.py
(5.5 KB)
📄
symbol_database_test.pyc
(4.65 KB)
📄
symbol_database_test.pyo
(4.65 KB)
📄
test_bad_identifiers_pb2.py
(5.8 KB)
📄
test_bad_identifiers_pb2.pyc
(4.58 KB)
📄
test_bad_identifiers_pb2.pyo
(4.58 KB)
📄
test_util.py
(33.15 KB)
📄
test_util.pyc
(31.33 KB)
📄
test_util.pyo
(31.28 KB)
📄
testing_refleaks.py
(4.4 KB)
📄
testing_refleaks.pyc
(3.81 KB)
📄
testing_refleaks.pyo
(3.81 KB)
📄
text_encoding_test.py
(2.81 KB)
📄
text_encoding_test.pyc
(1.96 KB)
📄
text_encoding_test.pyo
(1.96 KB)
📄
text_format_test.py
(63.68 KB)
📄
text_format_test.pyc
(56.52 KB)
📄
text_format_test.pyo
(56.52 KB)
📄
type_checkers.py
(13.9 KB)
📄
type_checkers.pyc
(11.58 KB)
📄
type_checkers.pyo
(11.58 KB)
📄
unknown_fields_test.py
(13.52 KB)
📄
unknown_fields_test.pyc
(11.46 KB)
📄
unknown_fields_test.pyo
(11.46 KB)
📄
well_known_types.py
(27.62 KB)
📄
well_known_types.pyc
(32.88 KB)
📄
well_known_types.pyo
(32.88 KB)
📄
well_known_types_test.py
(34.58 KB)
📄
well_known_types_test.pyc
(25.4 KB)
📄
well_known_types_test.pyo
(25.4 KB)
📄
wire_format.py
(8.25 KB)
📄
wire_format.pyc
(8.82 KB)
📄
wire_format.pyo
(8.82 KB)
📄
wire_format_test.py
(10.65 KB)
📄
wire_format_test.pyc
(6.77 KB)
📄
wire_format_test.pyo
(6.77 KB)
Editing: wire_format.py
# Protocol Buffers - Google's data interchange format # Copyright 2008 Google Inc. All rights reserved. # https://developers.google.com/protocol-buffers/ # # 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. """Constants and static functions to support protocol buffer wire format.""" __author__ = 'robinson@google.com (Will Robinson)' import struct from google.protobuf import descriptor from google.protobuf import message TAG_TYPE_BITS = 3 # Number of bits used to hold type info in a proto tag. TAG_TYPE_MASK = (1 << TAG_TYPE_BITS) - 1 # 0x7 # These numbers identify the wire type of a protocol buffer value. # We use the least-significant TAG_TYPE_BITS bits of the varint-encoded # tag-and-type to store one of these WIRETYPE_* constants. # These values must match WireType enum in google/protobuf/wire_format.h. WIRETYPE_VARINT = 0 WIRETYPE_FIXED64 = 1 WIRETYPE_LENGTH_DELIMITED = 2 WIRETYPE_START_GROUP = 3 WIRETYPE_END_GROUP = 4 WIRETYPE_FIXED32 = 5 _WIRETYPE_MAX = 5 # Bounds for various integer types. INT32_MAX = int((1 << 31) - 1) INT32_MIN = int(-(1 << 31)) UINT32_MAX = (1 << 32) - 1 INT64_MAX = (1 << 63) - 1 INT64_MIN = -(1 << 63) UINT64_MAX = (1 << 64) - 1 # "struct" format strings that will encode/decode the specified formats. FORMAT_UINT32_LITTLE_ENDIAN = '<I' FORMAT_UINT64_LITTLE_ENDIAN = '<Q' FORMAT_FLOAT_LITTLE_ENDIAN = '<f' FORMAT_DOUBLE_LITTLE_ENDIAN = '<d' # We'll have to provide alternate implementations of AppendLittleEndian*() on # any architectures where these checks fail. if struct.calcsize(FORMAT_UINT32_LITTLE_ENDIAN) != 4: raise AssertionError('Format "I" is not a 32-bit number.') if struct.calcsize(FORMAT_UINT64_LITTLE_ENDIAN) != 8: raise AssertionError('Format "Q" is not a 64-bit number.') def PackTag(field_number, wire_type): """Returns an unsigned 32-bit integer that encodes the field number and wire type information in standard protocol message wire format. Args: field_number: Expected to be an integer in the range [1, 1 << 29) wire_type: One of the WIRETYPE_* constants. """ if not 0 <= wire_type <= _WIRETYPE_MAX: raise message.EncodeError('Unknown wire type: %d' % wire_type) return (field_number << TAG_TYPE_BITS) | wire_type def UnpackTag(tag): """The inverse of PackTag(). Given an unsigned 32-bit number, returns a (field_number, wire_type) tuple. """ return (tag >> TAG_TYPE_BITS), (tag & TAG_TYPE_MASK) def ZigZagEncode(value): """ZigZag Transform: Encodes signed integers so that they can be effectively used with varint encoding. See wire_format.h for more details. """ if value >= 0: return value << 1 return (value << 1) ^ (~0) def ZigZagDecode(value): """Inverse of ZigZagEncode().""" if not value & 0x1: return value >> 1 return (value >> 1) ^ (~0) # The *ByteSize() functions below return the number of bytes required to # serialize "field number + type" information and then serialize the value. def Int32ByteSize(field_number, int32): return Int64ByteSize(field_number, int32) def Int32ByteSizeNoTag(int32): return _VarUInt64ByteSizeNoTag(0xffffffffffffffff & int32) def Int64ByteSize(field_number, int64): # Have to convert to uint before calling UInt64ByteSize(). return UInt64ByteSize(field_number, 0xffffffffffffffff & int64) def UInt32ByteSize(field_number, uint32): return UInt64ByteSize(field_number, uint32) def UInt64ByteSize(field_number, uint64): return TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(uint64) def SInt32ByteSize(field_number, int32): return UInt32ByteSize(field_number, ZigZagEncode(int32)) def SInt64ByteSize(field_number, int64): return UInt64ByteSize(field_number, ZigZagEncode(int64)) def Fixed32ByteSize(field_number, fixed32): return TagByteSize(field_number) + 4 def Fixed64ByteSize(field_number, fixed64): return TagByteSize(field_number) + 8 def SFixed32ByteSize(field_number, sfixed32): return TagByteSize(field_number) + 4 def SFixed64ByteSize(field_number, sfixed64): return TagByteSize(field_number) + 8 def FloatByteSize(field_number, flt): return TagByteSize(field_number) + 4 def DoubleByteSize(field_number, double): return TagByteSize(field_number) + 8 def BoolByteSize(field_number, b): return TagByteSize(field_number) + 1 def EnumByteSize(field_number, enum): return UInt32ByteSize(field_number, enum) def StringByteSize(field_number, string): return BytesByteSize(field_number, string.encode('utf-8')) def BytesByteSize(field_number, b): return (TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(len(b)) + len(b)) def GroupByteSize(field_number, message): return (2 * TagByteSize(field_number) # START and END group. + message.ByteSize()) def MessageByteSize(field_number, message): return (TagByteSize(field_number) + _VarUInt64ByteSizeNoTag(message.ByteSize()) + message.ByteSize()) def MessageSetItemByteSize(field_number, msg): # First compute the sizes of the tags. # There are 2 tags for the beginning and ending of the repeated group, that # is field number 1, one with field number 2 (type_id) and one with field # number 3 (message). total_size = (2 * TagByteSize(1) + TagByteSize(2) + TagByteSize(3)) # Add the number of bytes for type_id. total_size += _VarUInt64ByteSizeNoTag(field_number) message_size = msg.ByteSize() # The number of bytes for encoding the length of the message. total_size += _VarUInt64ByteSizeNoTag(message_size) # The size of the message. total_size += message_size return total_size def TagByteSize(field_number): """Returns the bytes required to serialize a tag with this field number.""" # Just pass in type 0, since the type won't affect the tag+type size. return _VarUInt64ByteSizeNoTag(PackTag(field_number, 0)) # Private helper function for the *ByteSize() functions above. def _VarUInt64ByteSizeNoTag(uint64): """Returns the number of bytes required to serialize a single varint using boundary value comparisons. (unrolled loop optimization -WPierce) uint64 must be unsigned. """ if uint64 <= 0x7f: return 1 if uint64 <= 0x3fff: return 2 if uint64 <= 0x1fffff: return 3 if uint64 <= 0xfffffff: return 4 if uint64 <= 0x7ffffffff: return 5 if uint64 <= 0x3ffffffffff: return 6 if uint64 <= 0x1ffffffffffff: return 7 if uint64 <= 0xffffffffffffff: return 8 if uint64 <= 0x7fffffffffffffff: return 9 if uint64 > UINT64_MAX: raise message.EncodeError('Value out of range: %d' % uint64) return 10 NON_PACKABLE_TYPES = ( descriptor.FieldDescriptor.TYPE_STRING, descriptor.FieldDescriptor.TYPE_GROUP, descriptor.FieldDescriptor.TYPE_MESSAGE, descriptor.FieldDescriptor.TYPE_BYTES ) def IsTypePackable(field_type): """Return true iff packable = true is valid for fields of this type. Args: field_type: a FieldDescriptor::Type value. Returns: True iff fields of this type are packable. """ return field_type not in NON_PACKABLE_TYPES
Upload File
Create Folder