|
15 | 15 | from __future__ import absolute_import |
16 | 16 | import sys |
17 | 17 |
|
18 | | -from google.api_core.protobuf_helpers import get_messages |
19 | | - |
20 | 18 | from google.api import http_pb2 |
21 | 19 | from google.api import label_pb2 |
22 | 20 | from google.api import monitored_resource_pb2 |
| 21 | +from google.protobuf import descriptor_pb2 |
| 22 | +from google.protobuf import duration_pb2 |
| 23 | +from google.protobuf import timestamp_pb2 |
| 24 | + |
| 25 | +from google.api_core.protobuf_helpers import get_messages |
23 | 26 | from google.cloud.errorreporting_v1beta1.proto import common_pb2 |
24 | 27 | from google.cloud.errorreporting_v1beta1.proto import error_group_service_pb2 |
25 | 28 | from google.cloud.errorreporting_v1beta1.proto import error_stats_service_pb2 |
26 | 29 | from google.cloud.errorreporting_v1beta1.proto import report_errors_service_pb2 |
27 | | -from google.protobuf import descriptor_pb2 |
28 | | -from google.protobuf import duration_pb2 |
29 | | -from google.protobuf import timestamp_pb2 |
| 30 | + |
| 31 | + |
| 32 | +_shared_modules = [ |
| 33 | + http_pb2, |
| 34 | + label_pb2, |
| 35 | + monitored_resource_pb2, |
| 36 | + report_errors_service_pb2, |
| 37 | + descriptor_pb2, |
| 38 | + duration_pb2, |
| 39 | + timestamp_pb2, |
| 40 | +] |
| 41 | + |
| 42 | +_local_modules = [ |
| 43 | + common_pb2, |
| 44 | + error_group_service_pb2, |
| 45 | + error_stats_service_pb2, |
| 46 | +] |
30 | 47 |
|
31 | 48 | names = [] |
32 | | -for module in ( |
33 | | - http_pb2, |
34 | | - label_pb2, |
35 | | - monitored_resource_pb2, |
36 | | - common_pb2, |
37 | | - error_group_service_pb2, |
38 | | - error_stats_service_pb2, |
39 | | - report_errors_service_pb2, |
40 | | - descriptor_pb2, |
41 | | - duration_pb2, |
42 | | - timestamp_pb2, |
43 | | -): |
| 49 | + |
| 50 | +for module in _shared_modules: |
| 51 | + for name, message in get_messages(module).items(): |
| 52 | + setattr(sys.modules[__name__], name, message) |
| 53 | + names.append(name) |
| 54 | + |
| 55 | +for module in _local_modules: |
44 | 56 | for name, message in get_messages(module).items(): |
45 | 57 | message.__module__ = 'google.cloud.errorreporting_v1beta1.types' |
46 | 58 | setattr(sys.modules[__name__], name, message) |
|
0 commit comments