bt2: Add `_Clock*Const` classes and adapt tests
[babeltrace.git] / src / bindings / python / bt2 / bt2 / __init__.py
CommitLineData
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 24from bt2.clock_class import ClockClassOffset
a2519c12 25from bt2.clock_snapshot import _ClockSnapshotConst
d016011d
PP
26from bt2.clock_snapshot import _UnknownClockSnapshot
27from bt2.component import _SourceComponentClass
ede525fd
PP
28from bt2.component import _FilterComponentClass
29from bt2.component import _SinkComponentClass
f6a5e476 30from bt2.component import _SourceComponent
d016011d
PP
31from bt2.component import _FilterComponent
32from bt2.component import _SinkComponent
33from bt2.component import _UserSourceComponent
f6a5e476
PP
34from bt2.component import _UserFilterComponent
35from bt2.component import _UserSinkComponent
71e8e5c5 36from bt2.component_descriptor import ComponentDescriptor
d016011d
PP
37from bt2.error import ComponentClassType
38from bt2.error import _ErrorCause
39from bt2.error import _ComponentErrorCause
40from bt2.error import _ComponentClassErrorCause
41from bt2.error import _MessageIteratorErrorCause
614743a5 42from bt2.error import _Error
d016011d 43from bt2.event_class import EventClassLogLevel
a07f15cb 44from bt2.field import _BoolField
6b29f2d4 45from bt2.field import _BitArrayField
d016011d
PP
46from bt2.field import _IntegerField
47from bt2.field import _UnsignedIntegerField
48from bt2.field import _SignedIntegerField
49from bt2.field import _RealField
50from bt2.field import _EnumerationField
51from bt2.field import _UnsignedEnumerationField
52from bt2.field import _SignedEnumerationField
53from bt2.field import _StringField
54from bt2.field import _StructureField
84eba0d9 55from bt2.field import _OptionField
d016011d
PP
56from bt2.field import _VariantField
57from bt2.field import _ArrayField
58from bt2.field import _StaticArrayField
59from bt2.field import _DynamicArrayField
60from bt2.field_class import IntegerDisplayBase
a07f15cb 61from bt2.field_class import _BoolFieldClass
6b29f2d4 62from bt2.field_class import _BitArrayFieldClass
d016011d
PP
63from bt2.field_class import _IntegerFieldClass
64from bt2.field_class import _UnsignedIntegerFieldClass
65from bt2.field_class import _SignedIntegerFieldClass
66from bt2.field_class import _RealFieldClass
67from bt2.field_class import _EnumerationFieldClass
68from bt2.field_class import _UnsignedEnumerationFieldClass
69from bt2.field_class import _SignedEnumerationFieldClass
70from bt2.field_class import _StringFieldClass
71from bt2.field_class import _StructureFieldClass
84eba0d9 72from bt2.field_class import _OptionFieldClass
d016011d
PP
73from bt2.field_class import _VariantFieldClass
74from bt2.field_class import _VariantFieldClassWithoutSelector
75from bt2.field_class import _VariantFieldClassWithSelector
76from bt2.field_class import _VariantFieldClassWithUnsignedSelector
77from bt2.field_class import _VariantFieldClassWithSignedSelector
78from bt2.field_class import _ArrayFieldClass
79from bt2.field_class import _StaticArrayFieldClass
80from bt2.field_class import _DynamicArrayFieldClass
056995e5 81from bt2.field_path import FieldPathScope
d016011d
PP
82from bt2.field_path import _IndexFieldPathItem
83from bt2.field_path import _CurrentArrayElementFieldPathItem
84eba0d9 84from bt2.field_path import _CurrentOptionContentFieldPathItem
d016011d
PP
85from bt2.graph import Graph
86from bt2.integer_range_set import SignedIntegerRange
87from bt2.integer_range_set import UnsignedIntegerRange
88from bt2.integer_range_set import SignedIntegerRangeSet
89from bt2.integer_range_set import UnsignedIntegerRangeSet
90from bt2.interrupter import Interrupter
91from bt2.logging import LoggingLevel
92from bt2.logging import get_minimal_logging_level
93from bt2.logging import get_global_logging_level
94from bt2.logging import set_global_logging_level
95from bt2.message import _EventMessage
96from bt2.message import _PacketBeginningMessage
97from bt2.message import _PacketEndMessage
98from bt2.message import _StreamBeginningMessage
99from bt2.message import _StreamEndMessage
100from bt2.message import _MessageIteratorInactivityMessage
fa4c33e3
SM
101from bt2.message import _DiscardedEventsMessage
102from bt2.message import _DiscardedPacketsMessage
fa4c33e3 103from bt2.message_iterator import _UserMessageIterator
ea307835
PP
104from bt2.mip import get_greatest_operative_mip_version
105from bt2.mip import get_maximal_mip_version
d016011d
PP
106from bt2.plugin import find_plugins_in_path
107from bt2.plugin import find_plugins
108from bt2.plugin import find_plugin
109from bt2.py_plugin import plugin_component_class
110from bt2.py_plugin import register_plugin
111from bt2.query_executor import QueryExecutor
94e72386 112from bt2.trace_collection_message_iterator import AutoSourceComponentSpec
d016011d
PP
113from bt2.trace_collection_message_iterator import ComponentSpec
114from bt2.trace_collection_message_iterator import TraceCollectionMessageIterator
115from bt2.value import create_value
116from bt2.value import BoolValue
68d9d039 117from bt2.value import _IntegerValue
d016011d
PP
118from bt2.value import UnsignedIntegerValue
119from bt2.value import SignedIntegerValue
120from bt2.value import RealValue
121from bt2.value import StringValue
122from bt2.value import ArrayValue
123from bt2.value import MapValue
f19e40a1
FD
124from bt2.value import _BoolValueConst
125from bt2.value import _IntegerValueConst
126from bt2.value import _UnsignedIntegerValueConst
127from bt2.value import _SignedIntegerValueConst
128from bt2.value import _RealValueConst
129from bt2.value import _StringValueConst
130from bt2.value import _ArrayValueConst
131from bt2.value import _MapValueConst
a90c9738 132from bt2.version import __version__
81447b5b
PP
133
134
c946c9de
PP
135def _del_global_name(name):
136 if name in globals():
137 del globals()[name]
138
139
140# remove private module names from the package
141_del_global_name('_native_bt')
142_del_global_name('clock_class')
143_del_global_name('clock_snapshot')
144_del_global_name('component')
145_del_global_name('connection')
146_del_global_name('error')
147_del_global_name('event')
148_del_global_name('event_class')
149_del_global_name('field')
150_del_global_name('field_class')
151_del_global_name('field_path')
152_del_global_name('graph')
153_del_global_name('integer_range_set')
154_del_global_name('interrupter')
155_del_global_name('logging')
156_del_global_name('message')
157_del_global_name('message_iterator')
158_del_global_name('native_bt')
159_del_global_name('object')
160_del_global_name('packet')
161_del_global_name('plugin')
162_del_global_name('port')
163_del_global_name('py_plugin')
164_del_global_name('query_executor')
165_del_global_name('stream')
166_del_global_name('stream_class')
167_del_global_name('trace')
168_del_global_name('trace_class')
169_del_global_name('trace_collection_message_iterator')
170_del_global_name('utils')
171_del_global_name('value')
a90c9738 172_del_global_name('version')
c946c9de
PP
173
174# remove private `_del_global_name` name from the package
175del _del_global_name
176
177
614743a5 178class _MemoryError(_Error):
493428a0 179 '''Raised when an operation fails due to memory issues.'''
81447b5b
PP
180
181
7dd3e712
SM
182class UnknownObject(Exception):
183 '''
184 Raised when a component class handles a query for an object it doesn't
185 know about.
186 '''
187
1286dcbb
PP
188 pass
189
190
35752b44 191class _OverflowError(_Error, OverflowError):
81447b5b
PP
192 pass
193
194
fb25b9e3 195class TryAgain(Exception):
81447b5b
PP
196 pass
197
198
fb25b9e3
PP
199class Stop(StopIteration):
200 pass
201
202
64e96b5d 203class _IncompleteUserClass(Exception):
f6a5e476
PP
204 pass
205
206
5c8b3186 207def _init_and_register_exit():
c946c9de 208 from bt2 import native_bt
5c8b3186
PP
209 import atexit
210
65e28173
PP
211 atexit.register(native_bt.bt2_exit_handler)
212 native_bt.bt2_init_from_bt2()
5c8b3186
PP
213
214
215_init_and_register_exit()
216
c946c9de
PP
217# remove private `_init_and_register_exit` name from the package
218del _init_and_register_exit
This page took 0.055473 seconds and 4 git commands to generate.