| OLD | NEW |
| 1 # Protocol Buffers - Google's data interchange format | 1 # Protocol Buffers - Google's data interchange format |
| 2 # Copyright 2008 Google Inc. All rights reserved. | 2 # Copyright 2008 Google Inc. All rights reserved. |
| 3 # http://code.google.com/p/protobuf/ | 3 # http://code.google.com/p/protobuf/ |
| 4 # | 4 # |
| 5 # Redistribution and use in source and binary forms, with or without | 5 # Redistribution and use in source and binary forms, with or without |
| 6 # modification, are permitted provided that the following conditions are | 6 # modification, are permitted provided that the following conditions are |
| 7 # met: | 7 # met: |
| 8 # | 8 # |
| 9 # * Redistributions of source code must retain the above copyright | 9 # * Redistributions of source code must retain the above copyright |
| 10 # notice, this list of conditions and the following disclaimer. | 10 # notice, this list of conditions and the following disclaimer. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 # | 32 # |
| 33 # Copyright 2007 Google Inc. All Rights Reserved. | 33 # Copyright 2007 Google Inc. All Rights Reserved. |
| 34 | 34 |
| 35 """Contains routines for printing protocol messages in text format.""" | 35 """Contains routines for printing protocol messages in text format.""" |
| 36 | 36 |
| 37 __author__ = 'kenton@google.com (Kenton Varda)' | 37 __author__ = 'kenton@google.com (Kenton Varda)' |
| 38 | 38 |
| 39 import cStringIO | 39 import cStringIO |
| 40 import re | 40 import re |
| 41 | 41 |
| 42 from google.protobuf.internal import type_checkers | 42 from protobuf26.internal import type_checkers |
| 43 from google.protobuf import descriptor | 43 from protobuf26 import descriptor |
| 44 from google.protobuf import text_encoding | 44 from protobuf26 import text_encoding |
| 45 | 45 |
| 46 __all__ = ['MessageToString', 'PrintMessage', 'PrintField', | 46 __all__ = ['MessageToString', 'PrintMessage', 'PrintField', |
| 47 'PrintFieldValue', 'Merge'] | 47 'PrintFieldValue', 'Merge'] |
| 48 | 48 |
| 49 | 49 |
| 50 _INTEGER_CHECKERS = (type_checkers.Uint32ValueChecker(), | 50 _INTEGER_CHECKERS = (type_checkers.Uint32ValueChecker(), |
| 51 type_checkers.Int32ValueChecker(), | 51 type_checkers.Int32ValueChecker(), |
| 52 type_checkers.Uint64ValueChecker(), | 52 type_checkers.Uint64ValueChecker(), |
| 53 type_checkers.Int64ValueChecker()) | 53 type_checkers.Int64ValueChecker()) |
| 54 _FLOAT_INFINITY = re.compile('-?inf(?:inity)?f?', re.IGNORECASE) | 54 _FLOAT_INFINITY = re.compile('-?inf(?:inity)?f?', re.IGNORECASE) |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 'Enum type "%s" has no value named %s.' % ( | 864 'Enum type "%s" has no value named %s.' % ( |
| 865 enum_descriptor.full_name, value)) | 865 enum_descriptor.full_name, value)) |
| 866 else: | 866 else: |
| 867 # Numeric value. | 867 # Numeric value. |
| 868 enum_value = enum_descriptor.values_by_number.get(number, None) | 868 enum_value = enum_descriptor.values_by_number.get(number, None) |
| 869 if enum_value is None: | 869 if enum_value is None: |
| 870 raise ValueError( | 870 raise ValueError( |
| 871 'Enum type "%s" has no value with number %d.' % ( | 871 'Enum type "%s" has no value with number %d.' % ( |
| 872 enum_descriptor.full_name, number)) | 872 enum_descriptor.full_name, number)) |
| 873 return enum_value.number | 873 return enum_value.number |
| OLD | NEW |