Commit | Line | Data |
---|---|---|
81447b5b PP |
1 | # The MIT License (MIT) |
2 | # | |
f6a5e476 | 3 | # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> |
81447b5b PP |
4 | # |
5 | # Permission is hereby granted, free of charge, to any person obtaining a copy | |
6 | # of this software and associated documentation files (the "Software"), to deal | |
7 | # in the Software without restriction, including without limitation the rights | |
8 | # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
9 | # copies of the Software, and to permit persons to whom the Software is | |
10 | # furnished to do so, subject to the following conditions: | |
11 | # | |
12 | # The above copyright notice and this permission notice shall be included in | |
13 | # all copies or substantial portions of the Software. | |
14 | # | |
15 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
16 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
17 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
18 | # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
19 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
20 | # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
21 | # THE SOFTWARE. | |
22 | ||
c946c9de | 23 | # import all public names |
d016011d | 24 | from bt2.clock_class import ClockClassOffset |
a2519c12 | 25 | from bt2.clock_snapshot import _ClockSnapshotConst |
d016011d PP |
26 | from bt2.clock_snapshot import _UnknownClockSnapshot |
27 | from bt2.component import _SourceComponentClass | |
ede525fd PP |
28 | from bt2.component import _FilterComponentClass |
29 | from bt2.component import _SinkComponentClass | |
f6a5e476 | 30 | from bt2.component import _SourceComponent |
d016011d PP |
31 | from bt2.component import _FilterComponent |
32 | from bt2.component import _SinkComponent | |
33 | from bt2.component import _UserSourceComponent | |
f6a5e476 PP |
34 | from bt2.component import _UserFilterComponent |
35 | from bt2.component import _UserSinkComponent | |
71e8e5c5 | 36 | from bt2.component_descriptor import ComponentDescriptor |
d016011d PP |
37 | from bt2.error import ComponentClassType |
38 | from bt2.error import _ErrorCause | |
39 | from bt2.error import _ComponentErrorCause | |
40 | from bt2.error import _ComponentClassErrorCause | |
41 | from bt2.error import _MessageIteratorErrorCause | |
614743a5 | 42 | from bt2.error import _Error |
d016011d | 43 | from bt2.event_class import EventClassLogLevel |
a07f15cb | 44 | from bt2.field import _BoolField |
6b29f2d4 | 45 | from bt2.field import _BitArrayField |
d016011d PP |
46 | from bt2.field import _IntegerField |
47 | from bt2.field import _UnsignedIntegerField | |
48 | from bt2.field import _SignedIntegerField | |
49 | from bt2.field import _RealField | |
50 | from bt2.field import _EnumerationField | |
51 | from bt2.field import _UnsignedEnumerationField | |
52 | from bt2.field import _SignedEnumerationField | |
53 | from bt2.field import _StringField | |
54 | from bt2.field import _StructureField | |
84eba0d9 | 55 | from bt2.field import _OptionField |
d016011d PP |
56 | from bt2.field import _VariantField |
57 | from bt2.field import _ArrayField | |
58 | from bt2.field import _StaticArrayField | |
59 | from bt2.field import _DynamicArrayField | |
9cbe0c59 FD |
60 | from bt2.field import _BoolFieldConst |
61 | from bt2.field import _BitArrayFieldConst | |
62 | from bt2.field import _IntegerFieldConst | |
63 | from bt2.field import _UnsignedIntegerFieldConst | |
64 | from bt2.field import _SignedIntegerFieldConst | |
65 | from bt2.field import _RealFieldConst | |
66 | from bt2.field import _EnumerationFieldConst | |
67 | from bt2.field import _UnsignedEnumerationFieldConst | |
68 | from bt2.field import _SignedEnumerationFieldConst | |
69 | from bt2.field import _StringFieldConst | |
70 | from bt2.field import _StructureFieldConst | |
71 | from bt2.field import _OptionFieldConst | |
72 | from bt2.field import _VariantFieldConst | |
73 | from bt2.field import _ArrayFieldConst | |
74 | from bt2.field import _StaticArrayFieldConst | |
75 | from bt2.field import _DynamicArrayFieldConst | |
d016011d | 76 | from bt2.field_class import IntegerDisplayBase |
a07f15cb | 77 | from bt2.field_class import _BoolFieldClass |
6b29f2d4 | 78 | from bt2.field_class import _BitArrayFieldClass |
d016011d PP |
79 | from bt2.field_class import _IntegerFieldClass |
80 | from bt2.field_class import _UnsignedIntegerFieldClass | |
81 | from bt2.field_class import _SignedIntegerFieldClass | |
82 | from bt2.field_class import _RealFieldClass | |
83 | from bt2.field_class import _EnumerationFieldClass | |
84 | from bt2.field_class import _UnsignedEnumerationFieldClass | |
85 | from bt2.field_class import _SignedEnumerationFieldClass | |
86 | from bt2.field_class import _StringFieldClass | |
87 | from bt2.field_class import _StructureFieldClass | |
84eba0d9 | 88 | from bt2.field_class import _OptionFieldClass |
d016011d PP |
89 | from bt2.field_class import _VariantFieldClass |
90 | from bt2.field_class import _VariantFieldClassWithoutSelector | |
91 | from bt2.field_class import _VariantFieldClassWithSelector | |
92 | from bt2.field_class import _VariantFieldClassWithUnsignedSelector | |
93 | from bt2.field_class import _VariantFieldClassWithSignedSelector | |
94 | from bt2.field_class import _ArrayFieldClass | |
95 | from bt2.field_class import _StaticArrayFieldClass | |
96 | from bt2.field_class import _DynamicArrayFieldClass | |
9cbe0c59 FD |
97 | from bt2.field_class import _BoolFieldClassConst |
98 | from bt2.field_class import _BitArrayFieldClassConst | |
99 | from bt2.field_class import _IntegerFieldClassConst | |
100 | from bt2.field_class import _UnsignedIntegerFieldClassConst | |
101 | from bt2.field_class import _SignedIntegerFieldClassConst | |
102 | from bt2.field_class import _RealFieldClassConst | |
103 | from bt2.field_class import _EnumerationFieldClassConst | |
104 | from bt2.field_class import _UnsignedEnumerationFieldClassConst | |
105 | from bt2.field_class import _SignedEnumerationFieldClassConst | |
106 | from bt2.field_class import _StringFieldClassConst | |
107 | from bt2.field_class import _StructureFieldClassConst | |
108 | from bt2.field_class import _OptionFieldClassConst | |
109 | from bt2.field_class import _VariantFieldClassConst | |
110 | from bt2.field_class import _VariantFieldClassWithoutSelectorConst | |
111 | from bt2.field_class import _VariantFieldClassWithSelectorConst | |
112 | from bt2.field_class import _VariantFieldClassWithUnsignedSelectorConst | |
113 | from bt2.field_class import _VariantFieldClassWithSignedSelectorConst | |
114 | from bt2.field_class import _ArrayFieldClassConst | |
115 | from bt2.field_class import _StaticArrayFieldClassConst | |
116 | from bt2.field_class import _DynamicArrayFieldClassConst | |
056995e5 | 117 | from bt2.field_path import FieldPathScope |
d016011d PP |
118 | from bt2.field_path import _IndexFieldPathItem |
119 | from bt2.field_path import _CurrentArrayElementFieldPathItem | |
84eba0d9 | 120 | from bt2.field_path import _CurrentOptionContentFieldPathItem |
d016011d PP |
121 | from bt2.graph import Graph |
122 | from bt2.integer_range_set import SignedIntegerRange | |
123 | from bt2.integer_range_set import UnsignedIntegerRange | |
124 | from bt2.integer_range_set import SignedIntegerRangeSet | |
125 | from bt2.integer_range_set import UnsignedIntegerRangeSet | |
126 | from bt2.interrupter import Interrupter | |
127 | from bt2.logging import LoggingLevel | |
128 | from bt2.logging import get_minimal_logging_level | |
129 | from bt2.logging import get_global_logging_level | |
130 | from bt2.logging import set_global_logging_level | |
131 | from bt2.message import _EventMessage | |
132 | from bt2.message import _PacketBeginningMessage | |
133 | from bt2.message import _PacketEndMessage | |
134 | from bt2.message import _StreamBeginningMessage | |
135 | from bt2.message import _StreamEndMessage | |
136 | from bt2.message import _MessageIteratorInactivityMessage | |
fa4c33e3 SM |
137 | from bt2.message import _DiscardedEventsMessage |
138 | from bt2.message import _DiscardedPacketsMessage | |
9cbe0c59 FD |
139 | from bt2.message import _EventMessageConst |
140 | from bt2.message import _PacketBeginningMessageConst | |
141 | from bt2.message import _PacketEndMessageConst | |
142 | from bt2.message import _StreamBeginningMessageConst | |
143 | from bt2.message import _StreamEndMessageConst | |
144 | from bt2.message import _MessageIteratorInactivityMessageConst | |
145 | from bt2.message import _DiscardedEventsMessageConst | |
146 | from bt2.message import _DiscardedPacketsMessageConst | |
fa4c33e3 | 147 | from bt2.message_iterator import _UserMessageIterator |
ea307835 PP |
148 | from bt2.mip import get_greatest_operative_mip_version |
149 | from bt2.mip import get_maximal_mip_version | |
d016011d PP |
150 | from bt2.plugin import find_plugins_in_path |
151 | from bt2.plugin import find_plugins | |
152 | from bt2.plugin import find_plugin | |
153 | from bt2.py_plugin import plugin_component_class | |
154 | from bt2.py_plugin import register_plugin | |
155 | from bt2.query_executor import QueryExecutor | |
94e72386 | 156 | from bt2.trace_collection_message_iterator import AutoSourceComponentSpec |
d016011d PP |
157 | from bt2.trace_collection_message_iterator import ComponentSpec |
158 | from bt2.trace_collection_message_iterator import TraceCollectionMessageIterator | |
159 | from bt2.value import create_value | |
160 | from bt2.value import BoolValue | |
68d9d039 | 161 | from bt2.value import _IntegerValue |
d016011d PP |
162 | from bt2.value import UnsignedIntegerValue |
163 | from bt2.value import SignedIntegerValue | |
164 | from bt2.value import RealValue | |
165 | from bt2.value import StringValue | |
166 | from bt2.value import ArrayValue | |
167 | from bt2.value import MapValue | |
f19e40a1 FD |
168 | from bt2.value import _BoolValueConst |
169 | from bt2.value import _IntegerValueConst | |
170 | from bt2.value import _UnsignedIntegerValueConst | |
171 | from bt2.value import _SignedIntegerValueConst | |
172 | from bt2.value import _RealValueConst | |
173 | from bt2.value import _StringValueConst | |
174 | from bt2.value import _ArrayValueConst | |
175 | from bt2.value import _MapValueConst | |
a90c9738 | 176 | from bt2.version import __version__ |
81447b5b PP |
177 | |
178 | ||
c946c9de PP |
179 | def _del_global_name(name): |
180 | if name in globals(): | |
181 | del globals()[name] | |
182 | ||
183 | ||
184 | # remove private module names from the package | |
185 | _del_global_name('_native_bt') | |
186 | _del_global_name('clock_class') | |
187 | _del_global_name('clock_snapshot') | |
188 | _del_global_name('component') | |
189 | _del_global_name('connection') | |
190 | _del_global_name('error') | |
191 | _del_global_name('event') | |
192 | _del_global_name('event_class') | |
193 | _del_global_name('field') | |
194 | _del_global_name('field_class') | |
195 | _del_global_name('field_path') | |
196 | _del_global_name('graph') | |
197 | _del_global_name('integer_range_set') | |
198 | _del_global_name('interrupter') | |
199 | _del_global_name('logging') | |
200 | _del_global_name('message') | |
201 | _del_global_name('message_iterator') | |
202 | _del_global_name('native_bt') | |
203 | _del_global_name('object') | |
204 | _del_global_name('packet') | |
205 | _del_global_name('plugin') | |
206 | _del_global_name('port') | |
207 | _del_global_name('py_plugin') | |
208 | _del_global_name('query_executor') | |
209 | _del_global_name('stream') | |
210 | _del_global_name('stream_class') | |
211 | _del_global_name('trace') | |
212 | _del_global_name('trace_class') | |
213 | _del_global_name('trace_collection_message_iterator') | |
214 | _del_global_name('utils') | |
215 | _del_global_name('value') | |
a90c9738 | 216 | _del_global_name('version') |
c946c9de PP |
217 | |
218 | # remove private `_del_global_name` name from the package | |
219 | del _del_global_name | |
220 | ||
221 | ||
614743a5 | 222 | class _MemoryError(_Error): |
493428a0 | 223 | '''Raised when an operation fails due to memory issues.''' |
81447b5b PP |
224 | |
225 | ||
7dd3e712 SM |
226 | class UnknownObject(Exception): |
227 | ''' | |
228 | Raised when a component class handles a query for an object it doesn't | |
229 | know about. | |
230 | ''' | |
231 | ||
1286dcbb PP |
232 | pass |
233 | ||
234 | ||
35752b44 | 235 | class _OverflowError(_Error, OverflowError): |
81447b5b PP |
236 | pass |
237 | ||
238 | ||
fb25b9e3 | 239 | class TryAgain(Exception): |
81447b5b PP |
240 | pass |
241 | ||
242 | ||
fb25b9e3 PP |
243 | class Stop(StopIteration): |
244 | pass | |
245 | ||
246 | ||
64e96b5d | 247 | class _IncompleteUserClass(Exception): |
f6a5e476 PP |
248 | pass |
249 | ||
250 | ||
5c8b3186 | 251 | def _init_and_register_exit(): |
c946c9de | 252 | from bt2 import native_bt |
5c8b3186 PP |
253 | import atexit |
254 | ||
65e28173 PP |
255 | atexit.register(native_bt.bt2_exit_handler) |
256 | native_bt.bt2_init_from_bt2() | |
5c8b3186 PP |
257 | |
258 | ||
259 | _init_and_register_exit() | |
260 | ||
c946c9de PP |
261 | # remove private `_init_and_register_exit` name from the package |
262 | del _init_and_register_exit |