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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 If you want to get a Python class for the specified proto, use the | 53 If you want to get a Python class for the specified proto, use the |
54 helper functions inside google.protobuf.message_factory | 54 helper functions inside google.protobuf.message_factory |
55 directly instead of this class. | 55 directly instead of this class. |
56 """ | 56 """ |
57 | 57 |
58 __author__ = 'matthewtoia@google.com (Matt Toia)' | 58 __author__ = 'matthewtoia@google.com (Matt Toia)' |
59 | 59 |
60 import sys | 60 import sys |
61 | 61 |
62 from google.protobuf import descriptor | 62 from protobuf26 import descriptor |
63 from google.protobuf import descriptor_database | 63 from protobuf26 import descriptor_database |
64 from google.protobuf import text_encoding | 64 from protobuf26 import text_encoding |
65 | 65 |
66 | 66 |
67 def _NormalizeFullyQualifiedName(name): | 67 def _NormalizeFullyQualifiedName(name): |
68 """Remove leading period from fully-qualified type name. | 68 """Remove leading period from fully-qualified type name. |
69 | 69 |
70 Due to b/13860351 in descriptor_database.py, types in the root namespace are | 70 Due to b/13860351 in descriptor_database.py, types in the root namespace are |
71 generated with a leading period. This function removes that prefix. | 71 generated with a leading period. This function removes that prefix. |
72 | 72 |
73 Args: | 73 Args: |
74 name: A str, the fully-qualified symbol name. | 74 name: A str, the fully-qualified symbol name. |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 if possible_match in scope: | 634 if possible_match in scope: |
635 type_name = possible_match | 635 type_name = possible_match |
636 break | 636 break |
637 else: | 637 else: |
638 components.pop(-1) | 638 components.pop(-1) |
639 return scope[type_name] | 639 return scope[type_name] |
640 | 640 |
641 | 641 |
642 def _PrefixWithDot(name): | 642 def _PrefixWithDot(name): |
643 return name if name.startswith('.') else '.%s' % name | 643 return name if name.startswith('.') else '.%s' % name |
OLD | NEW |