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