Move to kernel style SPDX license identifiers
[babeltrace.git] / src / bindings / python / bt2 / bt2 / __init__.py
CommitLineData
0235b0db 1# SPDX-License-Identifier: MIT
81447b5b 2#
811644b8 3# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
81447b5b 4
79935628
SM
5import sys
6
3fb99a22 7# import all public names
5290f876 8from bt2.clock_class import ClockClassOffset
eddea575 9from bt2.clock_snapshot import _ClockSnapshotConst
5290f876 10from bt2.clock_snapshot import _UnknownClockSnapshot
615238be
FD
11from bt2.component import _SourceComponentClassConst
12from bt2.component import _FilterComponentClassConst
13from bt2.component import _SinkComponentClassConst
14from bt2.component import _SourceComponentConst
15from bt2.component import _FilterComponentConst
16from bt2.component import _SinkComponentConst
5290f876 17from bt2.component import _UserSourceComponent
811644b8
PP
18from bt2.component import _UserFilterComponent
19from bt2.component import _UserSinkComponent
f865c2aa 20from bt2.component_descriptor import ComponentDescriptor
5290f876
PP
21from bt2.error import ComponentClassType
22from bt2.error import _ErrorCause
23from bt2.error import _ComponentErrorCause
24from bt2.error import _ComponentClassErrorCause
25from bt2.error import _MessageIteratorErrorCause
694c792b 26from bt2.error import _Error
5290f876 27from bt2.event_class import EventClassLogLevel
aae30e61 28from bt2.field import _BoolField
ead8c3d4 29from bt2.field import _BitArrayField
5290f876
PP
30from bt2.field import _IntegerField
31from bt2.field import _UnsignedIntegerField
32from bt2.field import _SignedIntegerField
33from bt2.field import _RealField
fe4df857
FD
34from bt2.field import _SinglePrecisionRealField
35from bt2.field import _DoublePrecisionRealField
5290f876
PP
36from bt2.field import _EnumerationField
37from bt2.field import _UnsignedEnumerationField
38from bt2.field import _SignedEnumerationField
39from bt2.field import _StringField
40from bt2.field import _StructureField
cec0261d 41from bt2.field import _OptionField
5290f876
PP
42from bt2.field import _VariantField
43from bt2.field import _ArrayField
44from bt2.field import _StaticArrayField
45from bt2.field import _DynamicArrayField
f0a42b33
FD
46from bt2.field import _BoolFieldConst
47from bt2.field import _BitArrayFieldConst
48from bt2.field import _IntegerFieldConst
49from bt2.field import _UnsignedIntegerFieldConst
50from bt2.field import _SignedIntegerFieldConst
51from bt2.field import _RealFieldConst
fe4df857
FD
52from bt2.field import _SinglePrecisionRealFieldConst
53from bt2.field import _DoublePrecisionRealFieldConst
f0a42b33
FD
54from bt2.field import _EnumerationFieldConst
55from bt2.field import _UnsignedEnumerationFieldConst
56from bt2.field import _SignedEnumerationFieldConst
57from bt2.field import _StringFieldConst
58from bt2.field import _StructureFieldConst
59from bt2.field import _OptionFieldConst
60from bt2.field import _VariantFieldConst
61from bt2.field import _ArrayFieldConst
62from bt2.field import _StaticArrayFieldConst
63from bt2.field import _DynamicArrayFieldConst
5290f876 64from bt2.field_class import IntegerDisplayBase
aae30e61 65from bt2.field_class import _BoolFieldClass
ead8c3d4 66from bt2.field_class import _BitArrayFieldClass
5290f876
PP
67from bt2.field_class import _IntegerFieldClass
68from bt2.field_class import _UnsignedIntegerFieldClass
69from bt2.field_class import _SignedIntegerFieldClass
70from bt2.field_class import _RealFieldClass
71from bt2.field_class import _EnumerationFieldClass
72from bt2.field_class import _UnsignedEnumerationFieldClass
73from bt2.field_class import _SignedEnumerationFieldClass
74from bt2.field_class import _StringFieldClass
75from bt2.field_class import _StructureFieldClass
cec0261d 76from bt2.field_class import _OptionFieldClass
0aa006b7
PP
77from bt2.field_class import _OptionWithSelectorFieldClass
78from bt2.field_class import _OptionWithBoolSelectorFieldClass
79from bt2.field_class import _OptionWithIntegerSelectorFieldClass
80from bt2.field_class import _OptionWithUnsignedIntegerSelectorFieldClass
81from bt2.field_class import _OptionWithSignedIntegerSelectorFieldClass
5290f876
PP
82from bt2.field_class import _VariantFieldClass
83from bt2.field_class import _VariantFieldClassWithoutSelector
fabfe034
PP
84from bt2.field_class import _VariantFieldClassWithIntegerSelector
85from bt2.field_class import _VariantFieldClassWithUnsignedIntegerSelector
86from bt2.field_class import _VariantFieldClassWithSignedIntegerSelector
5290f876
PP
87from bt2.field_class import _ArrayFieldClass
88from bt2.field_class import _StaticArrayFieldClass
89from bt2.field_class import _DynamicArrayFieldClass
81b8fa44 90from bt2.field_class import _DynamicArrayWithLengthFieldFieldClass
f0a42b33
FD
91from bt2.field_class import _BoolFieldClassConst
92from bt2.field_class import _BitArrayFieldClassConst
93from bt2.field_class import _IntegerFieldClassConst
94from bt2.field_class import _UnsignedIntegerFieldClassConst
95from bt2.field_class import _SignedIntegerFieldClassConst
96from bt2.field_class import _RealFieldClassConst
97from bt2.field_class import _EnumerationFieldClassConst
98from bt2.field_class import _UnsignedEnumerationFieldClassConst
99from bt2.field_class import _SignedEnumerationFieldClassConst
100from bt2.field_class import _StringFieldClassConst
101from bt2.field_class import _StructureFieldClassConst
102from bt2.field_class import _OptionFieldClassConst
0aa006b7
PP
103from bt2.field_class import _OptionWithSelectorFieldClassConst
104from bt2.field_class import _OptionWithBoolSelectorFieldClassConst
105from bt2.field_class import _OptionWithIntegerSelectorFieldClassConst
106from bt2.field_class import _OptionWithUnsignedIntegerSelectorFieldClassConst
107from bt2.field_class import _OptionWithSignedIntegerSelectorFieldClassConst
f0a42b33
FD
108from bt2.field_class import _VariantFieldClassConst
109from bt2.field_class import _VariantFieldClassWithoutSelectorConst
fabfe034
PP
110from bt2.field_class import _VariantFieldClassWithIntegerSelectorConst
111from bt2.field_class import _VariantFieldClassWithUnsignedIntegerSelectorConst
112from bt2.field_class import _VariantFieldClassWithSignedIntegerSelectorConst
f0a42b33
FD
113from bt2.field_class import _ArrayFieldClassConst
114from bt2.field_class import _StaticArrayFieldClassConst
115from bt2.field_class import _DynamicArrayFieldClassConst
81b8fa44 116from bt2.field_class import _DynamicArrayWithLengthFieldFieldClassConst
e7ceb9df 117from bt2.field_path import FieldPathScope
5290f876
PP
118from bt2.field_path import _IndexFieldPathItem
119from bt2.field_path import _CurrentArrayElementFieldPathItem
cec0261d 120from bt2.field_path import _CurrentOptionContentFieldPathItem
5290f876
PP
121from bt2.graph import Graph
122from bt2.integer_range_set import SignedIntegerRange
123from bt2.integer_range_set import UnsignedIntegerRange
124from bt2.integer_range_set import SignedIntegerRangeSet
125from bt2.integer_range_set import UnsignedIntegerRangeSet
fc866000
FD
126from bt2.integer_range_set import _SignedIntegerRangeConst
127from bt2.integer_range_set import _UnsignedIntegerRangeConst
128from bt2.integer_range_set import _SignedIntegerRangeSetConst
129from bt2.integer_range_set import _UnsignedIntegerRangeSetConst
5290f876
PP
130from bt2.interrupter import Interrupter
131from bt2.logging import LoggingLevel
132from bt2.logging import get_minimal_logging_level
133from bt2.logging import get_global_logging_level
134from bt2.logging import set_global_logging_level
135from bt2.message import _EventMessage
136from bt2.message import _PacketBeginningMessage
137from bt2.message import _PacketEndMessage
138from bt2.message import _StreamBeginningMessage
139from bt2.message import _StreamEndMessage
140from bt2.message import _MessageIteratorInactivityMessage
5602ef81
SM
141from bt2.message import _DiscardedEventsMessage
142from bt2.message import _DiscardedPacketsMessage
f0a42b33
FD
143from bt2.message import _EventMessageConst
144from bt2.message import _PacketBeginningMessageConst
145from bt2.message import _PacketEndMessageConst
146from bt2.message import _StreamBeginningMessageConst
147from bt2.message import _StreamEndMessageConst
148from bt2.message import _MessageIteratorInactivityMessageConst
149from bt2.message import _DiscardedEventsMessageConst
150from bt2.message import _DiscardedPacketsMessageConst
5602ef81 151from bt2.message_iterator import _UserMessageIterator
f1f74173
PP
152from bt2.mip import get_greatest_operative_mip_version
153from bt2.mip import get_maximal_mip_version
5290f876
PP
154from bt2.plugin import find_plugins_in_path
155from bt2.plugin import find_plugins
156from bt2.plugin import find_plugin
157from bt2.py_plugin import plugin_component_class
158from bt2.py_plugin import register_plugin
159from bt2.query_executor import QueryExecutor
f3c9a159 160from bt2.trace_collection_message_iterator import AutoSourceComponentSpec
5290f876
PP
161from bt2.trace_collection_message_iterator import ComponentSpec
162from bt2.trace_collection_message_iterator import TraceCollectionMessageIterator
163from bt2.value import create_value
164from bt2.value import BoolValue
fdd3a2da 165from bt2.value import _IntegerValue
5290f876
PP
166from bt2.value import UnsignedIntegerValue
167from bt2.value import SignedIntegerValue
168from bt2.value import RealValue
169from bt2.value import StringValue
170from bt2.value import ArrayValue
171from bt2.value import MapValue
e42e1587
FD
172from bt2.value import _BoolValueConst
173from bt2.value import _IntegerValueConst
174from bt2.value import _UnsignedIntegerValueConst
175from bt2.value import _SignedIntegerValueConst
176from bt2.value import _RealValueConst
177from bt2.value import _StringValueConst
178from bt2.value import _ArrayValueConst
179from bt2.value import _MapValueConst
07041daf 180from bt2.version import __version__
81447b5b 181
79935628
SM
182if (sys.version_info.major, sys.version_info.minor) != (3, 4):
183
184 def _del_global_name(name):
185 if name in globals():
186 del globals()[name]
81447b5b 187
79935628
SM
188 # remove private module names from the package
189 _del_global_name('_native_bt')
190 _del_global_name('clock_class')
191 _del_global_name('clock_snapshot')
192 _del_global_name('component')
193 _del_global_name('connection')
194 _del_global_name('error')
195 _del_global_name('event')
196 _del_global_name('event_class')
197 _del_global_name('field')
198 _del_global_name('field_class')
199 _del_global_name('field_path')
200 _del_global_name('graph')
201 _del_global_name('integer_range_set')
202 _del_global_name('interrupter')
203 _del_global_name('logging')
204 _del_global_name('message')
205 _del_global_name('message_iterator')
206 _del_global_name('native_bt')
207 _del_global_name('object')
208 _del_global_name('packet')
209 _del_global_name('plugin')
210 _del_global_name('port')
211 _del_global_name('py_plugin')
212 _del_global_name('query_executor')
213 _del_global_name('stream')
214 _del_global_name('stream_class')
215 _del_global_name('trace')
216 _del_global_name('trace_class')
217 _del_global_name('trace_collection_message_iterator')
218 _del_global_name('utils')
219 _del_global_name('value')
220 _del_global_name('version')
3fb99a22 221
79935628
SM
222 # remove private `_del_global_name` name from the package
223 del _del_global_name
3fb99a22 224
3fb99a22 225
79935628
SM
226# remove sys module name from the package
227del sys
3fb99a22
PP
228
229
694c792b 230class _MemoryError(_Error):
4acc866e 231 '''Raised when an operation fails due to memory issues.'''
81447b5b
PP
232
233
76b6c2f7
SM
234class UnknownObject(Exception):
235 '''
236 Raised when a component class handles a query for an object it doesn't
237 know about.
238 '''
239
c7eee084
PP
240 pass
241
242
0ddaae90 243class _OverflowError(_Error, OverflowError):
81447b5b
PP
244 pass
245
246
d24d5663 247class TryAgain(Exception):
81447b5b
PP
248 pass
249
250
d24d5663
PP
251class Stop(StopIteration):
252 pass
253
254
cb06aa27 255class _IncompleteUserClass(Exception):
811644b8
PP
256 pass
257
258
0b03f63e 259def _init_and_register_exit():
3fb99a22 260 from bt2 import native_bt
0b03f63e
PP
261 import atexit
262
612a9870
PP
263 atexit.register(native_bt.bt2_exit_handler)
264 native_bt.bt2_init_from_bt2()
0b03f63e
PP
265
266
267_init_and_register_exit()
268
3fb99a22
PP
269# remove private `_init_and_register_exit` name from the package
270del _init_and_register_exit
This page took 0.07718 seconds and 4 git commands to generate.