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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 # The database's underlying descriptor pool can be queried, so it's not | 53 # The database's underlying descriptor pool can be queried, so it's not |
54 # necessary to know a type's filename to be able to generate it: | 54 # necessary to know a type's filename to be able to generate it: |
55 filename = db.pool.FindFileContainingSymbol('MyMessage') | 55 filename = db.pool.FindFileContainingSymbol('MyMessage') |
56 my_message_instance = db.GetMessages([filename])['MyMessage']() | 56 my_message_instance = db.GetMessages([filename])['MyMessage']() |
57 | 57 |
58 # This functionality is also provided directly via a convenience method: | 58 # This functionality is also provided directly via a convenience method: |
59 my_message_instance = db.GetSymbol('MyMessage')() | 59 my_message_instance = db.GetSymbol('MyMessage')() |
60 """ | 60 """ |
61 | 61 |
62 | 62 |
63 from google.protobuf import descriptor_pool | 63 from protobuf26 import descriptor_pool |
64 | 64 |
65 | 65 |
66 class SymbolDatabase(object): | 66 class SymbolDatabase(object): |
67 """A database of Python generated symbols. | 67 """A database of Python generated symbols. |
68 | 68 |
69 SymbolDatabase also models message_factory.MessageFactory. | 69 SymbolDatabase also models message_factory.MessageFactory. |
70 | 70 |
71 The symbol database can be used to keep a global registry of all protocol | 71 The symbol database can be used to keep a global registry of all protocol |
72 buffer types used within a program. | 72 buffer types used within a program. |
73 """ | 73 """ |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 for f in files: | 176 for f in files: |
177 result.update(self._symbols_by_file[f]) | 177 result.update(self._symbols_by_file[f]) |
178 return result | 178 return result |
179 | 179 |
180 _DEFAULT = SymbolDatabase() | 180 _DEFAULT = SymbolDatabase() |
181 | 181 |
182 | 182 |
183 def Default(): | 183 def Default(): |
184 """Returns the default SymbolDatabase.""" | 184 """Returns the default SymbolDatabase.""" |
185 return _DEFAULT | 185 return _DEFAULT |
OLD | NEW |