Reformat Python files with Black v20.8b1
[babeltrace.git] / src / bindings / python / bt2 / bt2 / __init__.py
1 # SPDX-License-Identifier: MIT
2 #
3 # Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
4
5 import sys
6
7 # import all public names
8 from bt2.clock_class import ClockClassOffset
9 from bt2.clock_snapshot import _ClockSnapshotConst
10 from bt2.clock_snapshot import _UnknownClockSnapshot
11 from bt2.component import _SourceComponentClassConst
12 from bt2.component import _FilterComponentClassConst
13 from bt2.component import _SinkComponentClassConst
14 from bt2.component import _SourceComponentConst
15 from bt2.component import _FilterComponentConst
16 from bt2.component import _SinkComponentConst
17 from bt2.component import _UserSourceComponent
18 from bt2.component import _UserFilterComponent
19 from bt2.component import _UserSinkComponent
20 from bt2.component_descriptor import ComponentDescriptor
21 from bt2.error import ComponentClassType
22 from bt2.error import _ErrorCause
23 from bt2.error import _ComponentErrorCause
24 from bt2.error import _ComponentClassErrorCause
25 from bt2.error import _MessageIteratorErrorCause
26 from bt2.error import _Error
27 from bt2.event_class import EventClassLogLevel
28 from bt2.field import _BoolField
29 from bt2.field import _BitArrayField
30 from bt2.field import _IntegerField
31 from bt2.field import _UnsignedIntegerField
32 from bt2.field import _SignedIntegerField
33 from bt2.field import _RealField
34 from bt2.field import _SinglePrecisionRealField
35 from bt2.field import _DoublePrecisionRealField
36 from bt2.field import _EnumerationField
37 from bt2.field import _UnsignedEnumerationField
38 from bt2.field import _SignedEnumerationField
39 from bt2.field import _StringField
40 from bt2.field import _StructureField
41 from bt2.field import _OptionField
42 from bt2.field import _VariantField
43 from bt2.field import _ArrayField
44 from bt2.field import _StaticArrayField
45 from bt2.field import _DynamicArrayField
46 from bt2.field import _BoolFieldConst
47 from bt2.field import _BitArrayFieldConst
48 from bt2.field import _IntegerFieldConst
49 from bt2.field import _UnsignedIntegerFieldConst
50 from bt2.field import _SignedIntegerFieldConst
51 from bt2.field import _RealFieldConst
52 from bt2.field import _SinglePrecisionRealFieldConst
53 from bt2.field import _DoublePrecisionRealFieldConst
54 from bt2.field import _EnumerationFieldConst
55 from bt2.field import _UnsignedEnumerationFieldConst
56 from bt2.field import _SignedEnumerationFieldConst
57 from bt2.field import _StringFieldConst
58 from bt2.field import _StructureFieldConst
59 from bt2.field import _OptionFieldConst
60 from bt2.field import _VariantFieldConst
61 from bt2.field import _ArrayFieldConst
62 from bt2.field import _StaticArrayFieldConst
63 from bt2.field import _DynamicArrayFieldConst
64 from bt2.field_class import IntegerDisplayBase
65 from bt2.field_class import _BoolFieldClass
66 from bt2.field_class import _BitArrayFieldClass
67 from bt2.field_class import _IntegerFieldClass
68 from bt2.field_class import _UnsignedIntegerFieldClass
69 from bt2.field_class import _SignedIntegerFieldClass
70 from bt2.field_class import _RealFieldClass
71 from bt2.field_class import _EnumerationFieldClass
72 from bt2.field_class import _UnsignedEnumerationFieldClass
73 from bt2.field_class import _SignedEnumerationFieldClass
74 from bt2.field_class import _StringFieldClass
75 from bt2.field_class import _StructureFieldClass
76 from bt2.field_class import _OptionFieldClass
77 from bt2.field_class import _OptionWithSelectorFieldClass
78 from bt2.field_class import _OptionWithBoolSelectorFieldClass
79 from bt2.field_class import _OptionWithIntegerSelectorFieldClass
80 from bt2.field_class import _OptionWithUnsignedIntegerSelectorFieldClass
81 from bt2.field_class import _OptionWithSignedIntegerSelectorFieldClass
82 from bt2.field_class import _VariantFieldClass
83 from bt2.field_class import _VariantFieldClassWithoutSelector
84 from bt2.field_class import _VariantFieldClassWithIntegerSelector
85 from bt2.field_class import _VariantFieldClassWithUnsignedIntegerSelector
86 from bt2.field_class import _VariantFieldClassWithSignedIntegerSelector
87 from bt2.field_class import _ArrayFieldClass
88 from bt2.field_class import _StaticArrayFieldClass
89 from bt2.field_class import _DynamicArrayFieldClass
90 from bt2.field_class import _DynamicArrayWithLengthFieldFieldClass
91 from bt2.field_class import _BoolFieldClassConst
92 from bt2.field_class import _BitArrayFieldClassConst
93 from bt2.field_class import _IntegerFieldClassConst
94 from bt2.field_class import _UnsignedIntegerFieldClassConst
95 from bt2.field_class import _SignedIntegerFieldClassConst
96 from bt2.field_class import _RealFieldClassConst
97 from bt2.field_class import _EnumerationFieldClassConst
98 from bt2.field_class import _UnsignedEnumerationFieldClassConst
99 from bt2.field_class import _SignedEnumerationFieldClassConst
100 from bt2.field_class import _StringFieldClassConst
101 from bt2.field_class import _StructureFieldClassConst
102 from bt2.field_class import _OptionFieldClassConst
103 from bt2.field_class import _OptionWithSelectorFieldClassConst
104 from bt2.field_class import _OptionWithBoolSelectorFieldClassConst
105 from bt2.field_class import _OptionWithIntegerSelectorFieldClassConst
106 from bt2.field_class import _OptionWithUnsignedIntegerSelectorFieldClassConst
107 from bt2.field_class import _OptionWithSignedIntegerSelectorFieldClassConst
108 from bt2.field_class import _VariantFieldClassConst
109 from bt2.field_class import _VariantFieldClassWithoutSelectorConst
110 from bt2.field_class import _VariantFieldClassWithIntegerSelectorConst
111 from bt2.field_class import _VariantFieldClassWithUnsignedIntegerSelectorConst
112 from bt2.field_class import _VariantFieldClassWithSignedIntegerSelectorConst
113 from bt2.field_class import _ArrayFieldClassConst
114 from bt2.field_class import _StaticArrayFieldClassConst
115 from bt2.field_class import _DynamicArrayFieldClassConst
116 from bt2.field_class import _DynamicArrayWithLengthFieldFieldClassConst
117 from bt2.field_path import FieldPathScope
118 from bt2.field_path import _IndexFieldPathItem
119 from bt2.field_path import _CurrentArrayElementFieldPathItem
120 from bt2.field_path import _CurrentOptionContentFieldPathItem
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.integer_range_set import _SignedIntegerRangeConst
127 from bt2.integer_range_set import _UnsignedIntegerRangeConst
128 from bt2.integer_range_set import _SignedIntegerRangeSetConst
129 from bt2.integer_range_set import _UnsignedIntegerRangeSetConst
130 from bt2.interrupter import Interrupter
131 from bt2.logging import LoggingLevel
132 from bt2.logging import get_minimal_logging_level
133 from bt2.logging import get_global_logging_level
134 from bt2.logging import set_global_logging_level
135 from bt2.message import _EventMessage
136 from bt2.message import _PacketBeginningMessage
137 from bt2.message import _PacketEndMessage
138 from bt2.message import _StreamBeginningMessage
139 from bt2.message import _StreamEndMessage
140 from bt2.message import _MessageIteratorInactivityMessage
141 from bt2.message import _DiscardedEventsMessage
142 from bt2.message import _DiscardedPacketsMessage
143 from bt2.message import _EventMessageConst
144 from bt2.message import _PacketBeginningMessageConst
145 from bt2.message import _PacketEndMessageConst
146 from bt2.message import _StreamBeginningMessageConst
147 from bt2.message import _StreamEndMessageConst
148 from bt2.message import _MessageIteratorInactivityMessageConst
149 from bt2.message import _DiscardedEventsMessageConst
150 from bt2.message import _DiscardedPacketsMessageConst
151 from bt2.message_iterator import _UserMessageIterator
152 from bt2.mip import get_greatest_operative_mip_version
153 from bt2.mip import get_maximal_mip_version
154 from bt2.plugin import find_plugins_in_path
155 from bt2.plugin import find_plugins
156 from bt2.plugin import find_plugin
157 from bt2.py_plugin import plugin_component_class
158 from bt2.py_plugin import register_plugin
159 from bt2.query_executor import QueryExecutor
160 from bt2.trace_collection_message_iterator import AutoSourceComponentSpec
161 from bt2.trace_collection_message_iterator import ComponentSpec
162 from bt2.trace_collection_message_iterator import TraceCollectionMessageIterator
163 from bt2.value import create_value
164 from bt2.value import BoolValue
165 from bt2.value import _IntegerValue
166 from bt2.value import UnsignedIntegerValue
167 from bt2.value import SignedIntegerValue
168 from bt2.value import RealValue
169 from bt2.value import StringValue
170 from bt2.value import ArrayValue
171 from bt2.value import MapValue
172 from bt2.value import _BoolValueConst
173 from bt2.value import _IntegerValueConst
174 from bt2.value import _UnsignedIntegerValueConst
175 from bt2.value import _SignedIntegerValueConst
176 from bt2.value import _RealValueConst
177 from bt2.value import _StringValueConst
178 from bt2.value import _ArrayValueConst
179 from bt2.value import _MapValueConst
180 from bt2.version import __version__
181
182 if (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]
187
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')
221
222 # remove private `_del_global_name` name from the package
223 del _del_global_name
224
225
226 # remove sys module name from the package
227 del sys
228
229
230 class _MemoryError(_Error):
231 '''Raised when an operation fails due to memory issues.'''
232
233
234 class UnknownObject(Exception):
235 """
236 Raised when a component class handles a query for an object it doesn't
237 know about.
238 """
239
240 pass
241
242
243 class _OverflowError(_Error, OverflowError):
244 pass
245
246
247 class TryAgain(Exception):
248 pass
249
250
251 class Stop(StopIteration):
252 pass
253
254
255 class _IncompleteUserClass(Exception):
256 pass
257
258
259 def _init_and_register_exit():
260 from bt2 import native_bt
261 import atexit
262
263 atexit.register(native_bt.bt2_exit_handler)
264 native_bt.bt2_init_from_bt2()
265
266
267 _init_and_register_exit()
268
269 # remove private `_init_and_register_exit` name from the package
270 del _init_and_register_exit
This page took 0.036225 seconds and 4 git commands to generate.