[*.{py,hpp,cpp}]
indent_style = space
indent_size = 4
+
+[*.{h,c}]
+indent_style = tab
+indent_size = 8
/tests/lib/plugin
/tests/lib/test_bt_uuid
/tests/lib/test_bt_values
+/tests/lib/test_fields_bin
/tests/lib/test_graph_topo
/tests/lib/test_trace_ir_ref
/tests/lib/test_simple_sink
+
[source,c]
----
-BT_HIDDEN
char *bt_common_get_home_plugin_path(int log_level);
----
+
/* ... */
};
-BT_HIDDEN
bt_self_component_status my_comp_init(
bt_self_component_source *self_comp_src,
bt_value *params, void *init_method_data)
You _must_ format modified and new {cpp} files with clang-format before
you create a contribution patch.
-You need clang-format{nbsp}14 to use the project's `.clang-format` file.
+You need clang-format{nbsp}15 to use the project's `.clang-format` file.
To automatically format all the project's {cpp} files, run:
#endif // BABELTRACE_BABY_HPP
----
====
+
+== Python Usage
+
+=== Formatting
+
+All Python code must be formatted using the version of
+https://github.com/psf/black[Black] specified in `dev-requirements.txt`.
+
+All Python imports must be sorted using the version of
+https://pycqa.github.io/isort/[isort] indicated in `dev-requirements.txt`.
doc/api/libbabeltrace2/*
+The typing Python module is provided under the terms of the Python Software
+Foundation License 2:
+
+ SPDX-License-Identifier: PSF-2.0
+
+According with:
+
+ LICENSES/PSF-2.0
+
+This applies to:
+
+ tests/utils/python/local_typing.py
+
In addition, other licenses may also apply, see SPDX-License-Identifier in
individual files.
--- /dev/null
+A. HISTORY OF THE SOFTWARE
+==========================
+
+Python was created in the early 1990s by Guido van Rossum at Stichting
+Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
+as a successor of a language called ABC. Guido remains Python's
+principal author, although it includes many contributions from others.
+
+In 1995, Guido continued his work on Python at the Corporation for
+National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
+in Reston, Virginia where he released several versions of the
+software.
+
+In May 2000, Guido and the Python core development team moved to
+BeOpen.com to form the BeOpen PythonLabs team. In October of the same
+year, the PythonLabs team moved to Digital Creations, which became
+Zope Corporation. In 2001, the Python Software Foundation (PSF, see
+https://www.python.org/psf/) was formed, a non-profit organization
+created specifically to own Python-related Intellectual Property.
+Zope Corporation was a sponsoring member of the PSF.
+
+All Python releases are Open Source (see http://www.opensource.org for
+the Open Source Definition). Historically, most, but not all, Python
+releases have also been GPL-compatible; the table below summarizes
+the various releases.
+
+ Release Derived Year Owner GPL-
+ from compatible? (1)
+
+ 0.9.0 thru 1.2 1991-1995 CWI yes
+ 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
+ 1.6 1.5.2 2000 CNRI no
+ 2.0 1.6 2000 BeOpen.com no
+ 1.6.1 1.6 2001 CNRI yes (2)
+ 2.1 2.0+1.6.1 2001 PSF no
+ 2.0.1 2.0+1.6.1 2001 PSF yes
+ 2.1.1 2.1+2.0.1 2001 PSF yes
+ 2.1.2 2.1.1 2002 PSF yes
+ 2.1.3 2.1.2 2002 PSF yes
+ 2.2 and above 2.1.1 2001-now PSF yes
+
+Footnotes:
+
+(1) GPL-compatible doesn't mean that we're distributing Python under
+ the GPL. All Python licenses, unlike the GPL, let you distribute
+ a modified version without making your changes open source. The
+ GPL-compatible licenses make it possible to combine Python with
+ other software that is released under the GPL; the others don't.
+
+(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
+ because its license has a choice of law clause. According to
+ CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
+ is "not incompatible" with the GPL.
+
+Thanks to the many outside volunteers who have worked under Guido's
+direction to make these releases possible.
+
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
+===============================================================
+
+PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
+--------------------------------------------
+
+1. This LICENSE AGREEMENT is between the Python Software Foundation
+("PSF"), and the Individual or Organization ("Licensee") accessing and
+otherwise using this software ("Python") in source or binary form and
+its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, PSF hereby
+grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
+analyze, test, perform and/or display publicly, prepare derivative works,
+distribute, and otherwise use Python alone or in any derivative version,
+provided, however, that PSF's License Agreement and PSF's notice of copyright,
+i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Python Software Foundation;
+All Rights Reserved" are retained in Python alone or in any derivative version
+prepared by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python.
+
+4. PSF is making Python available to Licensee on an "AS IS"
+basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between PSF and
+Licensee. This License Agreement does not grant permission to use PSF
+trademarks or trade name in a trademark sense to endorse or promote
+products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using Python, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
+-------------------------------------------
+
+BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
+
+1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
+office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
+Individual or Organization ("Licensee") accessing and otherwise using
+this software in source or binary form and its associated
+documentation ("the Software").
+
+2. Subject to the terms and conditions of this BeOpen Python License
+Agreement, BeOpen hereby grants Licensee a non-exclusive,
+royalty-free, world-wide license to reproduce, analyze, test, perform
+and/or display publicly, prepare derivative works, distribute, and
+otherwise use the Software alone or in any derivative version,
+provided, however, that the BeOpen Python License is retained in the
+Software, alone or in any derivative version prepared by Licensee.
+
+3. BeOpen is making the Software available to Licensee on an "AS IS"
+basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
+SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
+AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
+DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+5. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+6. This License Agreement shall be governed by and interpreted in all
+respects by the law of the State of California, excluding conflict of
+law provisions. Nothing in this License Agreement shall be deemed to
+create any relationship of agency, partnership, or joint venture
+between BeOpen and Licensee. This License Agreement does not grant
+permission to use BeOpen trademarks or trade names in a trademark
+sense to endorse or promote products or services of Licensee, or any
+third party. As an exception, the "BeOpen Python" logos available at
+http://www.pythonlabs.com/logos.html may be used according to the
+permissions granted on that web page.
+
+7. By copying, installing or otherwise using the software, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
+
+CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
+---------------------------------------
+
+1. This LICENSE AGREEMENT is between the Corporation for National
+Research Initiatives, having an office at 1895 Preston White Drive,
+Reston, VA 20191 ("CNRI"), and the Individual or Organization
+("Licensee") accessing and otherwise using Python 1.6.1 software in
+source or binary form and its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, CNRI
+hereby grants Licensee a nonexclusive, royalty-free, world-wide
+license to reproduce, analyze, test, perform and/or display publicly,
+prepare derivative works, distribute, and otherwise use Python 1.6.1
+alone or in any derivative version, provided, however, that CNRI's
+License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
+1995-2001 Corporation for National Research Initiatives; All Rights
+Reserved" are retained in Python 1.6.1 alone or in any derivative
+version prepared by Licensee. Alternately, in lieu of CNRI's License
+Agreement, Licensee may substitute the following text (omitting the
+quotes): "Python 1.6.1 is made available subject to the terms and
+conditions in CNRI's License Agreement. This Agreement together with
+Python 1.6.1 may be located on the internet using the following
+unique, persistent identifier (known as a handle): 1895.22/1013. This
+Agreement may also be obtained from a proxy server on the internet
+using the following URL: http://hdl.handle.net/1895.22/1013".
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates Python 1.6.1 or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to Python 1.6.1.
+
+4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
+basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
+IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
+DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
+FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
+INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
+1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
+A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
+OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. This License Agreement shall be governed by the federal
+intellectual property law of the United States, including without
+limitation the federal copyright law, and, to the extent such
+U.S. federal law does not apply, by the law of the Commonwealth of
+Virginia, excluding Virginia's conflict of law provisions.
+Notwithstanding the foregoing, with regard to derivative works based
+on Python 1.6.1 that incorporate non-separable material that was
+previously distributed under the GNU General Public License (GPL), the
+law of the Commonwealth of Virginia shall govern this License
+Agreement only as to issues arising under or with respect to
+Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
+License Agreement shall be deemed to create any relationship of
+agency, partnership, or joint venture between CNRI and Licensee. This
+License Agreement does not grant permission to use CNRI trademarks or
+trade name in a trademark sense to endorse or promote products or
+services of Licensee, or any third party.
+
+8. By clicking on the "ACCEPT" button where indicated, or by copying,
+installing or otherwise using Python 1.6.1, Licensee agrees to be
+bound by the terms and conditions of this License Agreement.
+
+ ACCEPT
+
+
+CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
+--------------------------------------------------
+
+Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
+The Netherlands. All rights reserved.
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted,
+provided that the above copyright notice appear in all copies and that
+both that copyright notice and this permission notice appear in
+supporting documentation, and that the name of Stichting Mathematisch
+Centrum or CWI not be used in advertising or publicity pertaining to
+distribution of the software without specific, written prior
+permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
+THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
+FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Tools::
* https://www.gnu.org/software/make/[GNU Make]
* **If you build from a Git clone**:
- ** https://www.gnu.org/software/automake/[GNU Automake]{nbsp}≥{nbsp}1.12
+ ** https://www.gnu.org/software/automake/[GNU Automake]{nbsp}≥{nbsp}1.13
** https://www.gnu.org/software/autoconf/[GNU Autoconf]{nbsp}≥{nbsp}2.69
** https://www.gnu.org/software/libtool/[GNU Libtool]{nbsp}≥{nbsp}2.2
** https://github.com/westes/flex[flex]{nbsp}≥{nbsp}2.5.35
- ** https://www.gnu.org/software/bison/bison.html[GNU Bison]{nbsp}≥{nbsp}2.4
+ ** https://www.gnu.org/software/bison/bison.html[GNU Bison]{nbsp}≥{nbsp}2.5
Libraries::
* A C library (for example,
## Automake base setup ##
## ##
-AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc -Wall -Wno-portability -Werror])
+AM_INIT_AUTOMAKE([1.13 foreign dist-bzip2 no-dist-gzip tar-ustar nostdinc -Wall -Wno-portability -Werror])
AM_MAINTAINER_MODE([enable])
# Enable silent rules by default
AS_IF([test "x$have_bison" != "xyes"], [
AE_IF_IN_GIT_REPO([
AC_MSG_FAILURE([dnl
-Bison >= 2.4 is required when building from the Git repository. You can
+Bison >= 2.5 is required when building from the Git repository. You can
set the YACC variable to override automatic detection.
])
], [
AC_MSG_WARN([dnl
-Missing Bison >= 2.4. Note that the parser files are already built in
+Missing Bison >= 2.5. Note that the parser files are already built in
this distribution tarball, so Bison is only needed if you intend to
modify their sources. You can set the YACC variable to override automatic
detection.
# When given, build with AddressSanitizer.
AE_FEATURE_DEFAULT_DISABLE
AE_FEATURE([asan],[Build with AddressSanitizer.])
+AE_FEATURE([ubsan],[Build with UndefinedBehaviorSanitizer.])
## ##
## Check for conflicting features selection ##
AS_IF([test "x$have_python_dev" = xno], [
AC_MSG_ERROR([Cannot find a suitable python-config. You can override the python-config path with the PYTHON_CONFIG environment variable.])
])
+
+ AX_COMPARE_VERSION(["$PYTHON_VERSION"], [ge], ["3.12"], [
+ AC_MSG_CHECKING([for python setuptools])
+ AS_IF(["$PYTHON" -c "import setuptools" 2>/dev/null], [
+ AC_MSG_RESULT([yes])
+ ], [
+ AC_MSG_RESULT([no])
+ AC_MSG_ERROR([Python >= 3.12 removed 'distutils', the 'setuptools' module needs to be installed for the selected interpreter.])
+ ])
+ ])
])
AE_IF_FEATURE_ENABLED([python-bindings-doc],
ASAN_LDFLAGS="-fsanitize=address"
])
-
+# If --enable-ubsan is used...
+AE_IF_FEATURE_ENABLED([ubsan], [
+ # ... add -fsanitize=undefined to the *FLAGS variables.
+ UBSAN_CFLAGS="-fsanitize=undefined"
+ UBSAN_CXXFLAGS="-fsanitize=undefined"
+ UBSAN_LDFLAGS="-fsanitize=undefined"
+])
# CFLAGS from libraries (the glib ones are needed for the following sizeof
# test).
-AM_CFLAGS="${PTHREAD_CFLAGS} ${GLIB_CFLAGS} ${ASAN_CFLAGS}"
-AM_CXXFLAGS="${PTHREAD_CFLAGS} ${GLIB_CFLAGS} ${ASAN_CXXFLAGS}"
-AM_LDFLAGS="${ASAN_LDFLAGS}"
+AM_CFLAGS="-fvisibility=hidden ${PTHREAD_CFLAGS} ${GLIB_CFLAGS} ${ASAN_CFLAGS} ${UBSAN_CFLAGS}"
+AM_CXXFLAGS="-fvisibility=hidden -fvisibility-inlines-hidden ${PTHREAD_CFLAGS} ${GLIB_CFLAGS} ${ASAN_CXXFLAGS} ${UBSAN_CFLAGS}"
+AM_LDFLAGS="${ASAN_LDFLAGS} ${UBSAN_CFLAGS}"
# Check that the current size_t matches the size that glib thinks it should
# be. This catches problems on multi-arch where people try to do a 32-bit
dnl Clang's does not. Enable Clang's `-Wshadow-field-in-constructor`, to make
dnl Clang warn about that.
-Wshadow-field-in-constructor dnl
+ -Wshadow-field dnl
-Wjump-misses-init dnl
-Wsuggest-attribute=format dnl
-Wtautological-constant-out-of-range-compare dnl
tests/lib/Makefile
tests/lib/test-plugin-plugins/Makefile
tests/lib/conds/Makefile
+ tests/lib/utils/Makefile
tests/Makefile
tests/param-validation/Makefile
tests/plugins/Makefile
-black ~= 22.0
+black ~= 23.9.1
flake8 >= 3.8
+# Required for black 22.0, it's broken with click >= 8.1
+click < 8.1
+isort ~= 5.12
/* Keep a link to the component's private data */
distill_iter->distill = distill;
- /* Create the uptream message iterator */
+ /* Create the upstream message iterator */
bt_message_iterator_create_from_message_iterator(self_message_iterator,
distill->in_port, &distill_iter->message_iterator);
bt_self_component_sink_borrow_input_port_by_index(
self_component_sink, 0);
- /* Create the uptream message iterator */
+ /* Create the upstream message iterator */
bt_message_iterator_create_from_sink_component(self_component_sink,
in_port, &epitome_out->message_iterator);
#
# :bt2link:`libbabeltrace2 <https://babeltrace.org/docs/v@ver@/libbabeltrace2/>`
-import docutils
-import docutils.utils
-import docutils.nodes
import re
import functools
+import docutils
+import docutils.nodes
+import docutils.utils
+
def _bt2man_role(
bt2_version, name, rawtext, text, lineno, inliner, options=None, content=None
#
# Copyright (c) 2020 Philippe Proulx <pproulx@efficios.com>
-import bt2
import re
+import bt2
+
# project
project = "Babeltrace 2 Python bindings"
copyright = "2020, EfficiOS, Inc"
= babeltrace2-filter.lttng-utils.debug-info(7)
:manpagetype: component class
-:revdate: 14 September 2019
+:revdate: 1 September 2023
:compcls: compcls:filter.lttng-utils.debug-info
:defdebuginfoname: `debug_info`
of the created events 'NAME' instead of the default
{defdebuginfoname}.
-param:full-path=`yes` vtype:[optional boolean]::
- Use the full path when writing the executable name (`bin`) and
- source file name (`src`) fields in the {defdebuginfoname} context
- field of the created events.
+param:full-path='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then use the full path when writing the executable
+ name (`bin`) and source file name (`src`) fields in the
+ {defdebuginfoname} context field of the created events.
++
+Default: false.
param:target-prefix='DIR' vtype:[optional string]::
Use 'DIR' as the root directory of the target file system instead of
= babeltrace2-filter.utils.trimmer(7)
:manpagetype: component class
-:revdate: 14 September 2019
+:revdate: 1 September 2023
== NAME
If you don't specify this parameter, the component discards no events
from the beginning of the trimming time range.
-param:gmt=`yes` vtype:[optional boolean]::
- Set the time zone of the param:begin and param:end parameters
- to GMT instead of the local time zone.
+param:gmt='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then set the time zone of the param:begin and
+ param:end parameters to GMT instead of the local time zone.
++
+Default: false.
== PORTS
[role="term"]
----
$ babeltrace2 query src.ctf.fs metadata-info \
- --params='path="/path/to/trace"'
+ --params='inputs=["/path/to/trace"]'
----
====
[role="term"]
----
$ babeltrace2 query src.ctf.fs babeltrace.trace-infos \
- --params='path="/path/to/trace"'
+ --params='inputs=["/path/to/trace"]'
----
====
= babeltrace2-sink.ctf.fs(7)
:manpagetype: component class
-:revdate: 14 September 2019
+:revdate: 1 September 2023
== NAME
== INITIALIZATION PARAMETERS
-param:assume-single-trace=`yes` vtype:[optional boolean]::
- Assume that the component only receives messages related to a single
- input trace.
+param:assume-single-trace='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then assume that the component only receives
+ messages related to a single input trace.
+
This parameter affects how the component builds the output trace path
(see <<output-path,``Output path''>>).
++
+Default: false.
-param:ignore-discarded-events=`yes` vtype:[optional boolean]::
- Ignore discarded events messages.
+param:ignore-discarded-events='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then ignore discarded events messages.
++
+Default: false.
-param:ignore-discarded-packets=`yes` vtype:[optional boolean]::
- Ignore discarded packets messages.
+param:ignore-discarded-packets='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then ignore discarded packets messages.
++
+Default: false.
param:path='PATH' vtype:[string]::
Base output path.
See <<output-path,``Output path''>> to learn how the component uses this
parameter to build the output path for a given input trace.
-param:quiet=`yes` vtype:[optional boolean]::
- Do not write anything to the standard output.
+param:quiet='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then do not write anything to the standard output.
++
+Default: false.
== PORTS
= babeltrace2-sink.text.details(7)
:manpagetype: component class
-:revdate: 14 September 2019
+:revdate: 1 September 2023
== NAME
The `BABELTRACE_TERM_COLOR` environment variable overrides this
parameter.
-param:compact=`yes` vtype:[optional boolean]::
- Enable compact mode.
+param:compact='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then enable compact mode.
+
In compact mode, the component prints one line per message, omitting
many details about messages. This is useful if you only need the time,
+
In compact mode, the component still prints the full metadata blocks.
You can remove such blocks with the param:with-metadata parameter.
++
+Default: false.
-param:with-metadata=`no` vtype:[optional boolean]::
- Do not print metadata blocks.
+param:with-metadata='VAL' vtype:[optional boolean]::
+ If 'VAL' is false, then do not print metadata blocks.
++
+Default: true.
-param:with-stream-class-name=`no` vtype:[optional boolean]::
- Do not print stream class names.
+param:with-stream-class-name='VAL' vtype:[optional boolean]::
+ If 'VAL' is false, then do not print stream class names.
++
+Default: true.
-param:with-stream-name=`no` vtype:[optional boolean]::
- Do not print stream names.
+param:with-stream-name='VAL' vtype:[optional boolean]::
+ If 'VAL' is false, then do not print stream names.
++
+Default: true.
-param:with-time=`no` vtype:[optional boolean]::
- Do not print timing information.
+param:with-time='VAL' vtype:[optional boolean]::
+ If 'VAL' is false, then do not print timing information.
++
+Default: true.
-param:with-trace-name=`no` vtype:[optional boolean]::
- Do not print trace names.
+param:with-trace-name='VAL' vtype:[optional boolean]::
+ If 'VAL' is false, then do not print trace names.
++
+Default: true.
-param:with-uuid=`no` vtype:[optional boolean]::
- Do not print UUIDs.
+param:with-uuid='VAL' vtype:[optional boolean]::
+ If 'VAL' is false, then do not print UUIDs.
++
+Default: true.
== PORTS
= babeltrace2-sink.text.pretty(7)
:manpagetype: component class
-:revdate: 14 September 2019
+:revdate: 1 September 2023
== NAME
== INITIALIZATION PARAMETERS
-param:clock-cycles=`yes` vtype:[optional boolean]::
- Print event times in clock cycles instead of hours, minutes,
- seconds, and nanoseconds.
+param:clock-cycles='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then print event times in clock cycles instead of
+ hours, minutes, seconds, and nanoseconds.
++
+Default: false.
-param:clock-date=`yes` vtype:[optional boolean]::
- Print event times _and_ dates.
+param:clock-date='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then print event times _and_ dates.
++
+Default: false.
-param:clock-gmt=`yes` vtype:[optional boolean]::
- Print event times in the GMT time zone instead of the local time
- zone.
+param:clock-gmt='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then print event times in the GMT time zone
+ instead of the local time zone.
++
+Default: false.
-param:clock-seconds=`yes` vtype:[optional boolean]::
- Print event times in seconds instead of hours, minutes,
- seconds, and nanoseconds.
+param:clock-seconds='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then print event times in seconds instead of
+ hours, minutes, seconds, and nanoseconds.
++
+Default: false.
param:color=(`never` | `auto` | `always`) vtype:[optional string]::
Force the terminal color support, one of:
By default, show or hide all the fields. This sets the default value
of all the parameters which start with `field-`.
-param:field-emf=(`yes` | `no`) vtype:[optional boolean]::
+param:field-emf='VAL' vtype:[optional boolean]::
Show or hide the event's Eclipse Modeling Framework URI field.
++
+Default, depending on the param:field-default parameter:
++
+--
+`show`::
+ True
+
+`hide`::
+ False
+
+Not set::
+ False
+--
-param:field-loglevel=(`yes` | `no`) vtype:[optional boolean]::
+param:field-loglevel='VAL' vtype:[optional boolean]::
Show or hide the event's logging level field.
++
+Default, depending on the param:field-default parameter:
++
+--
+`show`::
+ True
-param:field-trace=(`yes` | `no`) vtype:[optional boolean]::
+`hide`::
+ False
+
+Not set::
+ False
+--
+
+param:field-trace='VAL' vtype:[optional boolean]::
Show or hide the trace name field.
++
+Default, depending on the param:field-default parameter:
++
+--
+`show`::
+ True
-param:field-trace:domain=(`yes` | `no`) vtype:[optional boolean]::
+`hide`::
+ False
+
+Not set::
+ False
+--
+
+param:field-trace:domain='VAL' vtype:[optional boolean]::
Show or hide the tracing domain field.
++
+Default, depending on the param:field-default parameter:
++
+--
+`show`::
+ True
+
+`hide`::
+ False
+
+Not set::
+ False
+--
-param:field-trace:hostname=(`yes` | `no`) vtype:[optional boolean]::
+param:field-trace:hostname='VAL' vtype:[optional boolean]::
Show or hide the hostname field.
++
+Default, depending on the param:field-default parameter:
++
+--
+`show`::
+ True
-param:field-trace:procname=(`yes` | `no`) vtype:[optional boolean]::
+`hide`::
+ False
+
+Not set::
+ True
+--
+
+param:field-trace:procname='VAL' vtype:[optional boolean]::
Show or hide the process name field.
++
+Default, depending on the param:field-default parameter:
++
+--
+`show`::
+ True
-param:field-trace:vpid=(`yes` | `no`) vtype:[optional boolean]::
+`hide`::
+ False
+
+Not set::
+ True
+--
+
+param:field-trace:vpid='VAL' vtype:[optional boolean]::
Show or hide the virtual process ID field.
++
+Default, depending on the param:field-default parameter:
++
+--
+`show`::
+ True
-param:name-context=(`yes` | `no`) vtype:[optional boolean]::
- Show or hide the field names in the context scopes.
+`hide`::
+ False
+
+Not set::
+ True
+--
param:name-default=(`show` | `hide`) vtype:[optional string]::
By default, show or hide all the names. This sets the
default value of all the parameters which start with `name-`.
-param:name-header=(`yes` | `no`) vtype:[optional boolean]::
+param:name-header='VAL' vtype:[optional boolean]::
Show or hide the field names in the header scopes.
++
+Default, depending on the param:name-default parameter:
++
+--
+`show`::
+ True
+
+`hide`::
+ False
+
+Not set::
+ False
+--
-param:name-payload=(`yes` | `no`) vtype:[optional boolean]::
+param:name-context='VAL' vtype:[optional boolean]::
+ Show or hide the field names in the context scopes.
++
+Default, depending on the param:name-default parameter:
++
+--
+`show`::
+ True
+
+`hide`::
+ False
+
+Not set::
+ True
+--
+
+param:name-payload='VAL' vtype:[optional boolean]::
Show or hide the field names in the event payload scopes.
++
+Default, depending on the param:name-default parameter:
++
+--
+`show`::
+ True
+
+`hide`::
+ False
+
+Not set::
+ True
+--
-param:name-scope=(`yes` | `no`) vtype:[optional boolean]::
+param:name-scope='VAL' vtype:[optional boolean]::
Show or hide the scope names.
++
+Default, depending on the param:name-default parameter:
++
+--
+`show`::
+ True
-param:no-delta=`yes` vtype:[optional boolean]::
- Do not print the time delta between consecutive lines.
+`hide`::
+ False
+
+Not set::
+ False
+--
+
+param:no-delta='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then do not print the time delta between
+ consecutive lines.
++
+Default: false.
param:path='PATH' vtype:[optional string]::
Print the text output to the file 'PATH' instead of the standard
output.
-param:verbose=`yes` vtype:[optional boolean]::
- Turn the verbose mode on.
+param:verbose='VAL' vtype:[optional boolean]::
+ If 'VAL' if true, then turn the verbose mode on.
++
+Default: false.
== PORTS
= babeltrace2-sink.utils.counter(7)
:manpagetype: component class
-:revdate: 14 September 2019
+:revdate: 1 September 2023
== NAME
== INITIALIZATION PARAMETERS
-param:hide-zero=`yes` vtype:[optional boolean]::
- Do not print the statistics lines where the count is zero.
+param:hide-zero='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then do not print the statistics lines where the
+ count is zero.
++
+Default: false.
param:step='STEP' vtype:[optional unsigned integer]::
Print a new block of statistics every 'STEP' consumed messages
= babeltrace2-source.ctf.fs(7)
:manpagetype: component class
-:revdate: 14 September 2019
+:revdate: 1 September 2023
== NAME
You can combine this parameter with the param:clock-class-offset-ns
parameter.
-param:force-clock-class-origin-unix-epoch=`yes` vtype:[optional boolean]::
- Force the origin of all clock classes that the component creates to
- have a Unix epoch origin, whatever the detected tracer.
+param:force-clock-class-origin-unix-epoch='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then force the origin of all clock classes that
+ the component creates to have a Unix epoch origin, whatever the
+ detected tracer.
++
+Default: false.
param:inputs='DIRS' vtype:[array of strings]::
Open and read the physical CTF traces located in 'DIRS'.
= babeltrace2-source.text.dmesg(7)
:manpagetype: component class
-:revdate: 14 September 2019
+:revdate: 1 September 2023
== NAME
== INITIALIZATION PARAMETERS
-param:no-extract-timestamp=`yes` vtype:[optional boolean]::
- Do :not: extract timestamps from the kernel ring buffer lines: set
- the created event's payload's `str` field to the whole line,
- including any timestamp prefix.
+param:no-extract-timestamp='VAL' vtype:[optional boolean]::
+ If 'VAL' is true, then do :not: extract timestamps from the kernel
+ ring buffer lines: set the created event's payload's `str` field to
+ the whole line, including any timestamp prefix.
++
+Default: false.
param:path='PATH' vtype:[optional string]::
Read the kernel ring buffer lines from the file 'PATH' instead of
to create.
Unlike the \bt_p{params} parameter of
- the <code>bt_graph_add_*_component_*_port_added_listener()</code>
+ the <code>bt_graph_add_*_component*()</code>
functions (see \ref api-graph), this parameter does not need to
be a \bt_map_val.
#define _BT_HIDDEN __attribute__((visibility("hidden")))
#endif
+/*
+ * _BT_EXPORT: set the visibility for exported functions.
+ */
+#if defined(_WIN32) || defined(__CYGWIN__)
+#define _BT_EXPORT
+#else
+#define _BT_EXPORT __attribute__((visibility("default")))
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
_BT_HIDDEN extern struct __bt_plugin_component_class_descriptor_attribute const *__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_EXTRA; \
_BT_HIDDEN extern struct __bt_plugin_component_class_descriptor_attribute const *__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_SYMBOL __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_EXTRA; \
\
- struct __bt_plugin_descriptor const * const *__bt_get_begin_section_plugin_descriptors(void) \
+ _BT_EXPORT struct __bt_plugin_descriptor const * const *__bt_get_begin_section_plugin_descriptors(void) \
{ \
return &__BT_PLUGIN_DESCRIPTOR_BEGIN_SYMBOL; \
} \
- struct __bt_plugin_descriptor const * const *__bt_get_end_section_plugin_descriptors(void) \
+ _BT_EXPORT struct __bt_plugin_descriptor const * const *__bt_get_end_section_plugin_descriptors(void) \
{ \
return &__BT_PLUGIN_DESCRIPTOR_END_SYMBOL; \
} \
- struct __bt_plugin_descriptor_attribute const * const *__bt_get_begin_section_plugin_descriptor_attributes(void) \
+ _BT_EXPORT struct __bt_plugin_descriptor_attribute const * const *__bt_get_begin_section_plugin_descriptor_attributes(void) \
{ \
return &__BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL; \
} \
- struct __bt_plugin_descriptor_attribute const * const *__bt_get_end_section_plugin_descriptor_attributes(void) \
+ _BT_EXPORT struct __bt_plugin_descriptor_attribute const * const *__bt_get_end_section_plugin_descriptor_attributes(void) \
{ \
return &__BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_END_SYMBOL; \
} \
- struct __bt_plugin_component_class_descriptor const * const *__bt_get_begin_section_component_class_descriptors(void) \
+ _BT_EXPORT struct __bt_plugin_component_class_descriptor const * const *__bt_get_begin_section_component_class_descriptors(void) \
{ \
return &__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_BEGIN_SYMBOL; \
} \
- struct __bt_plugin_component_class_descriptor const * const *__bt_get_end_section_component_class_descriptors(void) \
+ _BT_EXPORT struct __bt_plugin_component_class_descriptor const * const *__bt_get_end_section_component_class_descriptors(void) \
{ \
return &__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_END_SYMBOL; \
} \
- struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_begin_section_component_class_descriptor_attributes(void) \
+ _BT_EXPORT struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_begin_section_component_class_descriptor_attributes(void) \
{ \
return &__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_BEGIN_SYMBOL; \
} \
- struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_end_section_component_class_descriptor_attributes(void) \
+ _BT_EXPORT struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_end_section_component_class_descriptor_attributes(void) \
{ \
return &__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_END_SYMBOL; \
}
# Copyright (c) 2008 Rafael Laboissiere <rafael@laboissiere.net>
# Copyright (c) 2008 Andrew Collier
# Copyright (c) 2011 Murray Cumming <murrayc@openismus.com>
+# Copyright (c) 2018 Reini Urban <rurban@cpan.org>
+# Copyright (c) 2021 Vincent Danjean <Vincent.Danjean@ens-lyon.org>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
-#serial 13
+#serial 15
AC_DEFUN([AX_PKG_SWIG],[
# Find path to the "swig" executable.
AC_PATH_PROGS([SWIG],[swig swig3.0 swig2.0])
if test -z "$SWIG" ; then
m4_ifval([$3],[$3],[:])
- elif test -n "$1" ; then
+ elif test -z "$1" ; then
+ m4_ifval([$2],[$2],[:])
+ else
AC_MSG_CHECKING([SWIG version])
[swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`]
AC_MSG_RESULT([$swig_version])
if test -z "$required_major" ; then
[required_major=0]
fi
- [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
+ [required=`echo $required. | sed 's/[0-9]*[^0-9]//'`]
[required_minor=`echo $required | sed 's/[^0-9].*//'`]
if test -z "$required_minor" ; then
[required_minor=0]
fi
- [required=`echo $required | sed 's/[0-9]*[^0-9]//'`]
+ [required=`echo $required. | sed 's/[0-9]*[^0-9]//'`]
[required_patch=`echo $required | sed 's/[^0-9].*//'`]
if test -z "$required_patch" ; then
[required_patch=0]
m4_ifval([$3],[$3],[])
else
AC_MSG_CHECKING([for SWIG library])
- SWIG_LIB=`$SWIG -swiglib`
+ SWIG_LIB=`$SWIG -swiglib | tr '\r\n' ' '`
AC_MSG_RESULT([$SWIG_LIB])
m4_ifval([$2],[$2],[])
fi
| src/bindings/python/bt2/setup\.py$
| src/bindings/python/bt2/bt2/native_bt\.py$
| src/bindings/python/bt2/bt2/version\.py$
+ | tests/utils/python/local_typing\.py$
| tests/utils/python/tap
)
'''
+
+[tool.isort]
+profile = "black"
+extend_skip_glob = [
+ "tests/utils/python/tap",
+ "tests/utils/python/local_typing.py",
+]
+length_sort = true
# warning for this file.
per-file-ignores = src/bindings/python/bt2/bt2/__init__.py:F401
-exclude = tests/utils/python/tap
+exclude = tests/utils/python/tap tests/utils/python/local_typing.py
{
auto_source_discovery_internal_status status;
GError *error = NULL;
+ GDir *dir = NULL;
if (g_file_test(input->str, G_FILE_TEST_IS_REGULAR)) {
/* It's a file. */
component_class_restrict, log_level, auto_disc,
interrupter);
} else if (g_file_test(input->str, G_FILE_TEST_IS_DIR)) {
- GDir *dir;
const gchar *dirent;
gsize saved_input_len;
int dir_status = AUTO_SOURCE_DISCOVERY_INTERNAL_STATUS_NO_MATCH;
} while (dirent);
status = dir_status;
-
- g_dir_close(dir);
} else {
BT_LOGD("Skipping %s, not a file or directory", input->str);
status = AUTO_SOURCE_DISCOVERY_INTERNAL_STATUS_NO_MATCH;
status = AUTO_SOURCE_DISCOVERY_INTERNAL_STATUS_ERROR;
end:
+ if (dir) {
+ g_dir_close(dir);
+ }
if (error) {
g_error_free(error);
# code.
WARN_CFLAGS += -Wno-deprecated-declarations
+# Python 3.11 + gcc 12.2.0 gave warnings of this kind in Python.h.
+WARN_CFLAGS += -Wno-redundant-decls
+
BUILD_FLAGS=CC="$(CC)" \
CFLAGS="$(GLIB_CFLAGS) $(AM_CFLAGS) $(CFLAGS) $(WARN_CFLAGS)" \
CPPFLAGS="$(AM_CPPFLAGS) $(CPPFLAGS) -I$(srcdir)/bt2" \
-include bt2/native_bt.d
+pyinstall_verbose = $(pyinstall_verbose_@AM_V@)
+pyinstall_verbose_ = $(pyinstall_verbose_@AM_DEFAULT_V@)
+pyinstall_verbose_0 = @
+
install-exec-local: build-python-bindings.stamp
- @opts="--prefix=$(prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \
+ $(pyinstall_verbose)opts="--prefix=$(prefix) --exec-prefix=$(exec_prefix) --record $(INSTALLED_FILES) --verbose --no-compile $(DISTSETUPOPTS)"; \
if [ "$(DESTDIR)" != "" ]; then \
opts="$$opts --root=$(DESTDIR)"; \
fi; \
import sys
+from bt2.mip import get_maximal_mip_version, get_greatest_operative_mip_version
+from bt2.error import (
+ ComponentClassType,
+ _Error,
+ _ErrorCause,
+ _MemoryError,
+ _ComponentErrorCause,
+ _ComponentClassErrorCause,
+ _MessageIteratorErrorCause,
+)
+from bt2.field import (
+ _BoolField,
+ _RealField,
+ _ArrayField,
+ _OptionField,
+ _StringField,
+ _IntegerField,
+ _VariantField,
+ _BitArrayField,
+ _BoolFieldConst,
+ _RealFieldConst,
+ _StructureField,
+ _ArrayFieldConst,
+ _EnumerationField,
+ _OptionFieldConst,
+ _StaticArrayField,
+ _StringFieldConst,
+ _DynamicArrayField,
+ _IntegerFieldConst,
+ _VariantFieldConst,
+ _BitArrayFieldConst,
+ _SignedIntegerField,
+ _StructureFieldConst,
+ _UnsignedIntegerField,
+ _EnumerationFieldConst,
+ _StaticArrayFieldConst,
+ _DynamicArrayFieldConst,
+ _SignedEnumerationField,
+ _SignedIntegerFieldConst,
+ _DoublePrecisionRealField,
+ _SinglePrecisionRealField,
+ _UnsignedEnumerationField,
+ _UnsignedIntegerFieldConst,
+ _SignedEnumerationFieldConst,
+ _DoublePrecisionRealFieldConst,
+ _SinglePrecisionRealFieldConst,
+ _UnsignedEnumerationFieldConst,
+)
+from bt2.graph import Graph
+from bt2.utils import Stop, TryAgain, UnknownObject, _OverflowError
+from bt2.value import (
+ MapValue,
+ BoolValue,
+ RealValue,
+ ArrayValue,
+ StringValue,
+ SignedIntegerValue,
+ UnsignedIntegerValue,
+ create_value,
+ _IntegerValue,
+ _MapValueConst,
+ _BoolValueConst,
+ _RealValueConst,
+ _ArrayValueConst,
+ _StringValueConst,
+ _IntegerValueConst,
+ _SignedIntegerValueConst,
+ _UnsignedIntegerValueConst,
+)
+from bt2.plugin import find_plugin, find_plugins, find_plugins_in_path
+from bt2.logging import (
+ LoggingLevel,
+ get_global_logging_level,
+ set_global_logging_level,
+ get_minimal_logging_level,
+)
+from bt2.message import (
+ _EventMessage,
+ _PacketEndMessage,
+ _StreamEndMessage,
+ _EventMessageConst,
+ _PacketEndMessageConst,
+ _StreamEndMessageConst,
+ _DiscardedEventsMessage,
+ _PacketBeginningMessage,
+ _StreamBeginningMessage,
+ _DiscardedPacketsMessage,
+ _DiscardedEventsMessageConst,
+ _PacketBeginningMessageConst,
+ _StreamBeginningMessageConst,
+ _DiscardedPacketsMessageConst,
+ _MessageIteratorInactivityMessage,
+ _MessageIteratorInactivityMessageConst,
+)
+from bt2.version import __version__
+from bt2.component import (
+ _UserSinkComponent,
+ _SinkComponentConst,
+ _IncompleteUserClass,
+ _UserFilterComponent,
+ _UserSourceComponent,
+ _FilterComponentConst,
+ _SourceComponentConst,
+ _SinkComponentClassConst,
+ _FilterComponentClassConst,
+ _SourceComponentClassConst,
+)
+from bt2.py_plugin import register_plugin, plugin_component_class
+from bt2.field_path import (
+ FieldPathScope,
+ _IndexFieldPathItem,
+ _CurrentArrayElementFieldPathItem,
+ _CurrentOptionContentFieldPathItem,
+)
+
# import all public names
from bt2.clock_class import ClockClassOffset
-from bt2.clock_snapshot import _ClockSnapshotConst
-from bt2.clock_snapshot import _UnknownClockSnapshot
-from bt2.component import _SourceComponentClassConst
-from bt2.component import _FilterComponentClassConst
-from bt2.component import _SinkComponentClassConst
-from bt2.component import _SourceComponentConst
-from bt2.component import _FilterComponentConst
-from bt2.component import _SinkComponentConst
-from bt2.component import _UserSourceComponent
-from bt2.component import _UserFilterComponent
-from bt2.component import _UserSinkComponent
-from bt2.component_descriptor import ComponentDescriptor
-from bt2.error import ComponentClassType
-from bt2.error import _ErrorCause
-from bt2.error import _ComponentErrorCause
-from bt2.error import _ComponentClassErrorCause
-from bt2.error import _MessageIteratorErrorCause
-from bt2.error import _Error
from bt2.event_class import EventClassLogLevel
-from bt2.field import _BoolField
-from bt2.field import _BitArrayField
-from bt2.field import _IntegerField
-from bt2.field import _UnsignedIntegerField
-from bt2.field import _SignedIntegerField
-from bt2.field import _RealField
-from bt2.field import _SinglePrecisionRealField
-from bt2.field import _DoublePrecisionRealField
-from bt2.field import _EnumerationField
-from bt2.field import _UnsignedEnumerationField
-from bt2.field import _SignedEnumerationField
-from bt2.field import _StringField
-from bt2.field import _StructureField
-from bt2.field import _OptionField
-from bt2.field import _VariantField
-from bt2.field import _ArrayField
-from bt2.field import _StaticArrayField
-from bt2.field import _DynamicArrayField
-from bt2.field import _BoolFieldConst
-from bt2.field import _BitArrayFieldConst
-from bt2.field import _IntegerFieldConst
-from bt2.field import _UnsignedIntegerFieldConst
-from bt2.field import _SignedIntegerFieldConst
-from bt2.field import _RealFieldConst
-from bt2.field import _SinglePrecisionRealFieldConst
-from bt2.field import _DoublePrecisionRealFieldConst
-from bt2.field import _EnumerationFieldConst
-from bt2.field import _UnsignedEnumerationFieldConst
-from bt2.field import _SignedEnumerationFieldConst
-from bt2.field import _StringFieldConst
-from bt2.field import _StructureFieldConst
-from bt2.field import _OptionFieldConst
-from bt2.field import _VariantFieldConst
-from bt2.field import _ArrayFieldConst
-from bt2.field import _StaticArrayFieldConst
-from bt2.field import _DynamicArrayFieldConst
-from bt2.field_class import IntegerDisplayBase
-from bt2.field_class import _BoolFieldClass
-from bt2.field_class import _BitArrayFieldClass
-from bt2.field_class import _IntegerFieldClass
-from bt2.field_class import _UnsignedIntegerFieldClass
-from bt2.field_class import _SignedIntegerFieldClass
-from bt2.field_class import _RealFieldClass
-from bt2.field_class import _EnumerationFieldClass
-from bt2.field_class import _UnsignedEnumerationFieldClass
-from bt2.field_class import _SignedEnumerationFieldClass
-from bt2.field_class import _StringFieldClass
-from bt2.field_class import _StructureFieldClass
-from bt2.field_class import _OptionFieldClass
-from bt2.field_class import _OptionWithSelectorFieldClass
-from bt2.field_class import _OptionWithBoolSelectorFieldClass
-from bt2.field_class import _OptionWithIntegerSelectorFieldClass
-from bt2.field_class import _OptionWithUnsignedIntegerSelectorFieldClass
-from bt2.field_class import _OptionWithSignedIntegerSelectorFieldClass
-from bt2.field_class import _VariantFieldClass
-from bt2.field_class import _VariantFieldClassWithoutSelector
-from bt2.field_class import _VariantFieldClassWithIntegerSelector
-from bt2.field_class import _VariantFieldClassWithUnsignedIntegerSelector
-from bt2.field_class import _VariantFieldClassWithSignedIntegerSelector
-from bt2.field_class import _ArrayFieldClass
-from bt2.field_class import _StaticArrayFieldClass
-from bt2.field_class import _DynamicArrayFieldClass
-from bt2.field_class import _DynamicArrayWithLengthFieldFieldClass
-from bt2.field_class import _BoolFieldClassConst
-from bt2.field_class import _BitArrayFieldClassConst
-from bt2.field_class import _IntegerFieldClassConst
-from bt2.field_class import _UnsignedIntegerFieldClassConst
-from bt2.field_class import _SignedIntegerFieldClassConst
-from bt2.field_class import _RealFieldClassConst
-from bt2.field_class import _EnumerationFieldClassConst
-from bt2.field_class import _UnsignedEnumerationFieldClassConst
-from bt2.field_class import _SignedEnumerationFieldClassConst
-from bt2.field_class import _StringFieldClassConst
-from bt2.field_class import _StructureFieldClassConst
-from bt2.field_class import _OptionFieldClassConst
-from bt2.field_class import _OptionWithSelectorFieldClassConst
-from bt2.field_class import _OptionWithBoolSelectorFieldClassConst
-from bt2.field_class import _OptionWithIntegerSelectorFieldClassConst
-from bt2.field_class import _OptionWithUnsignedIntegerSelectorFieldClassConst
-from bt2.field_class import _OptionWithSignedIntegerSelectorFieldClassConst
-from bt2.field_class import _VariantFieldClassConst
-from bt2.field_class import _VariantFieldClassWithoutSelectorConst
-from bt2.field_class import _VariantFieldClassWithIntegerSelectorConst
-from bt2.field_class import _VariantFieldClassWithUnsignedIntegerSelectorConst
-from bt2.field_class import _VariantFieldClassWithSignedIntegerSelectorConst
-from bt2.field_class import _ArrayFieldClassConst
-from bt2.field_class import _StaticArrayFieldClassConst
-from bt2.field_class import _DynamicArrayFieldClassConst
-from bt2.field_class import _DynamicArrayWithLengthFieldFieldClassConst
-from bt2.field_path import FieldPathScope
-from bt2.field_path import _IndexFieldPathItem
-from bt2.field_path import _CurrentArrayElementFieldPathItem
-from bt2.field_path import _CurrentOptionContentFieldPathItem
-from bt2.graph import Graph
-from bt2.integer_range_set import SignedIntegerRange
-from bt2.integer_range_set import UnsignedIntegerRange
-from bt2.integer_range_set import SignedIntegerRangeSet
-from bt2.integer_range_set import UnsignedIntegerRangeSet
-from bt2.integer_range_set import _SignedIntegerRangeConst
-from bt2.integer_range_set import _UnsignedIntegerRangeConst
-from bt2.integer_range_set import _SignedIntegerRangeSetConst
-from bt2.integer_range_set import _UnsignedIntegerRangeSetConst
+from bt2.field_class import (
+ IntegerDisplayBase,
+ _BoolFieldClass,
+ _RealFieldClass,
+ _ArrayFieldClass,
+ _OptionFieldClass,
+ _StringFieldClass,
+ _IntegerFieldClass,
+ _VariantFieldClass,
+ _BitArrayFieldClass,
+ _BoolFieldClassConst,
+ _RealFieldClassConst,
+ _StructureFieldClass,
+ _ArrayFieldClassConst,
+ _EnumerationFieldClass,
+ _OptionFieldClassConst,
+ _StaticArrayFieldClass,
+ _StringFieldClassConst,
+ _DynamicArrayFieldClass,
+ _IntegerFieldClassConst,
+ _VariantFieldClassConst,
+ _BitArrayFieldClassConst,
+ _SignedIntegerFieldClass,
+ _StructureFieldClassConst,
+ _UnsignedIntegerFieldClass,
+ _EnumerationFieldClassConst,
+ _StaticArrayFieldClassConst,
+ _DynamicArrayFieldClassConst,
+ _SignedEnumerationFieldClass,
+ _OptionWithSelectorFieldClass,
+ _SignedIntegerFieldClassConst,
+ _UnsignedEnumerationFieldClass,
+ _UnsignedIntegerFieldClassConst,
+ _OptionWithBoolSelectorFieldClass,
+ _SignedEnumerationFieldClassConst,
+ _VariantFieldClassWithoutSelector,
+ _OptionWithSelectorFieldClassConst,
+ _UnsignedEnumerationFieldClassConst,
+ _OptionWithIntegerSelectorFieldClass,
+ _VariantFieldClassWithIntegerSelector,
+ _DynamicArrayWithLengthFieldFieldClass,
+ _OptionWithBoolSelectorFieldClassConst,
+ _VariantFieldClassWithoutSelectorConst,
+ _OptionWithIntegerSelectorFieldClassConst,
+ _OptionWithSignedIntegerSelectorFieldClass,
+ _VariantFieldClassWithIntegerSelectorConst,
+ _DynamicArrayWithLengthFieldFieldClassConst,
+ _VariantFieldClassWithSignedIntegerSelector,
+ _OptionWithUnsignedIntegerSelectorFieldClass,
+ _VariantFieldClassWithUnsignedIntegerSelector,
+ _OptionWithSignedIntegerSelectorFieldClassConst,
+ _VariantFieldClassWithSignedIntegerSelectorConst,
+ _OptionWithUnsignedIntegerSelectorFieldClassConst,
+ _VariantFieldClassWithUnsignedIntegerSelectorConst,
+)
from bt2.interrupter import Interrupter
-from bt2.logging import LoggingLevel
-from bt2.logging import get_minimal_logging_level
-from bt2.logging import get_global_logging_level
-from bt2.logging import set_global_logging_level
-from bt2.message import _EventMessage
-from bt2.message import _PacketBeginningMessage
-from bt2.message import _PacketEndMessage
-from bt2.message import _StreamBeginningMessage
-from bt2.message import _StreamEndMessage
-from bt2.message import _MessageIteratorInactivityMessage
-from bt2.message import _DiscardedEventsMessage
-from bt2.message import _DiscardedPacketsMessage
-from bt2.message import _EventMessageConst
-from bt2.message import _PacketBeginningMessageConst
-from bt2.message import _PacketEndMessageConst
-from bt2.message import _StreamBeginningMessageConst
-from bt2.message import _StreamEndMessageConst
-from bt2.message import _MessageIteratorInactivityMessageConst
-from bt2.message import _DiscardedEventsMessageConst
-from bt2.message import _DiscardedPacketsMessageConst
-from bt2.message_iterator import _UserMessageIterator
-from bt2.mip import get_greatest_operative_mip_version
-from bt2.mip import get_maximal_mip_version
-from bt2.plugin import find_plugins_in_path
-from bt2.plugin import find_plugins
-from bt2.plugin import find_plugin
-from bt2.py_plugin import plugin_component_class
-from bt2.py_plugin import register_plugin
+from bt2.clock_snapshot import _ClockSnapshotConst, _UnknownClockSnapshot
from bt2.query_executor import QueryExecutor
-from bt2.trace_collection_message_iterator import AutoSourceComponentSpec
-from bt2.trace_collection_message_iterator import ComponentSpec
-from bt2.trace_collection_message_iterator import TraceCollectionMessageIterator
-from bt2.value import create_value
-from bt2.value import BoolValue
-from bt2.value import _IntegerValue
-from bt2.value import UnsignedIntegerValue
-from bt2.value import SignedIntegerValue
-from bt2.value import RealValue
-from bt2.value import StringValue
-from bt2.value import ArrayValue
-from bt2.value import MapValue
-from bt2.value import _BoolValueConst
-from bt2.value import _IntegerValueConst
-from bt2.value import _UnsignedIntegerValueConst
-from bt2.value import _SignedIntegerValueConst
-from bt2.value import _RealValueConst
-from bt2.value import _StringValueConst
-from bt2.value import _ArrayValueConst
-from bt2.value import _MapValueConst
-from bt2.version import __version__
+from bt2.message_iterator import _UserMessageIterator
+from bt2.integer_range_set import (
+ SignedIntegerRange,
+ UnsignedIntegerRange,
+ SignedIntegerRangeSet,
+ UnsignedIntegerRangeSet,
+ _SignedIntegerRangeConst,
+ _UnsignedIntegerRangeConst,
+ _SignedIntegerRangeSetConst,
+ _UnsignedIntegerRangeSetConst,
+)
+from bt2.component_descriptor import ComponentDescriptor
+from bt2.trace_collection_message_iterator import (
+ ComponentSpec,
+ AutoSourceComponentSpec,
+ TraceCollectionMessageIterator,
+)
if (sys.version_info.major, sys.version_info.minor) != (3, 4):
del sys
-class _MemoryError(_Error):
- """Raised when an operation fails due to memory issues."""
-
-
-class UnknownObject(Exception):
- """
- Raised when a component class handles a query for an object it doesn't
- know about.
- """
-
- pass
-
-
-class _OverflowError(_Error, OverflowError):
- pass
-
-
-class TryAgain(Exception):
- pass
-
-
-class Stop(StopIteration):
- pass
-
-
-class _IncompleteUserClass(Exception):
- pass
-
-
def _init_and_register_exit():
- from bt2 import native_bt
import atexit
+ from bt2 import native_bt
+
atexit.register(native_bt.bt2_exit_handler)
native_bt.bt2_init_from_bt2()
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import value as bt2_value
import uuid as uuidp
+from bt2 import utils as bt2_utils
+from bt2 import value as bt2_value
+from bt2 import object as bt2_object
+from bt2 import native_bt
+
class ClockClassOffset:
def __init__(self, seconds=0, cycles=0):
- utils._check_int64(seconds)
- utils._check_int64(cycles)
+ bt2_utils._check_int64(seconds)
+ bt2_utils._check_int64(cycles)
self._seconds = seconds
self._cycles = cycles
return (self.seconds, self.cycles) == (other.seconds, other.cycles)
-class _ClockClassConst(object._SharedObject):
- _get_ref = staticmethod(native_bt.clock_class_get_ref)
- _put_ref = staticmethod(native_bt.clock_class_put_ref)
+class _ClockClassConst(bt2_object._SharedObject):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.clock_class_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.clock_class_put_ref(ptr)
+
_create_value_from_ptr_and_get_ref = staticmethod(
bt2_value._create_from_const_ptr_and_get_ref
)
return uuidp.UUID(bytes=uuid_bytes)
def cycles_to_ns_from_origin(self, cycles):
- utils._check_uint64(cycles)
+ bt2_utils._check_uint64(cycles)
status, ns = native_bt.clock_class_cycles_to_ns_from_origin(self._ptr, cycles)
error_msg = "cannot convert clock value to nanoseconds from origin for given clock class"
- utils._handle_func_status(status, error_msg)
+ bt2_utils._handle_func_status(status, error_msg)
return ns
def _user_attributes(self, user_attributes):
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
native_bt.clock_class_set_user_attributes(self._ptr, value._ptr)
_user_attributes = property(fset=_user_attributes)
def _name(self, name):
- utils._check_str(name)
+ bt2_utils._check_str(name)
status = native_bt.clock_class_set_name(self._ptr, name)
- utils._handle_func_status(status, "cannot set clock class object's name")
+ bt2_utils._handle_func_status(status, "cannot set clock class object's name")
_name = property(fset=_name)
def _description(self, description):
- utils._check_str(description)
+ bt2_utils._check_str(description)
status = native_bt.clock_class_set_description(self._ptr, description)
- utils._handle_func_status(status, "cannot set clock class object's description")
+ bt2_utils._handle_func_status(
+ status, "cannot set clock class object's description"
+ )
_description = property(fset=_description)
def _frequency(self, frequency):
- utils._check_uint64(frequency)
+ bt2_utils._check_uint64(frequency)
native_bt.clock_class_set_frequency(self._ptr, frequency)
_frequency = property(fset=_frequency)
def _precision(self, precision):
- utils._check_uint64(precision)
+ bt2_utils._check_uint64(precision)
native_bt.clock_class_set_precision(self._ptr, precision)
_precision = property(fset=_precision)
def _offset(self, offset):
- utils._check_type(offset, ClockClassOffset)
+ bt2_utils._check_type(offset, ClockClassOffset)
native_bt.clock_class_set_offset(self._ptr, offset.seconds, offset.cycles)
_offset = property(fset=_offset)
def _origin_is_unix_epoch(self, origin_is_unix_epoch):
- utils._check_bool(origin_is_unix_epoch)
+ bt2_utils._check_bool(origin_is_unix_epoch)
native_bt.clock_class_set_origin_is_unix_epoch(
self._ptr, int(origin_is_unix_epoch)
)
_origin_is_unix_epoch = property(fset=_origin_is_unix_epoch)
def _uuid(self, uuid):
- utils._check_type(uuid, uuidp.UUID)
+ bt2_utils._check_type(uuid, uuidp.UUID)
native_bt.clock_class_set_uuid(self._ptr, uuid.bytes)
_uuid = property(fset=_uuid)
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
import numbers
-from bt2 import clock_class as bt2_clock_class
import functools
+from bt2 import utils as bt2_utils
+from bt2 import object as bt2_object
+from bt2 import native_bt
+from bt2 import clock_class as bt2_clock_class
+
@functools.total_ordering
-class _ClockSnapshotConst(object._UniqueObject):
+class _ClockSnapshotConst(bt2_object._UniqueObject):
@property
def clock_class(self):
cc_ptr = native_bt.clock_snapshot_borrow_clock_class_const(self._ptr)
@property
def ns_from_origin(self):
status, ns = native_bt.clock_snapshot_get_ns_from_origin(self._ptr)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot get clock snapshot's nanoseconds from origin"
)
return ns
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import message_iterator as bt2_message_iterator
+import sys
import collections.abc
+
+from bt2 import port as bt2_port
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
from bt2 import value as bt2_value
-from bt2 import trace_class as bt2_trace_class
+from bt2 import object as bt2_object
+from bt2 import native_bt
from bt2 import clock_class as bt2_clock_class
+from bt2 import trace_class as bt2_trace_class
from bt2 import query_executor as bt2_query_executor
-from bt2 import port as bt2_port
-import sys
-import bt2
+from bt2 import message_iterator as bt2_message_iterator
+from bt2 import integer_range_set as bt2_integer_range_set
+
+
+class _IncompleteUserClass(Exception):
+ pass
# This class wraps a component class pointer. This component class could
# pointer to a 'bt_component_class *'.
-class _ComponentClassConst(object._SharedObject):
+class _ComponentClassConst(bt2_object._SharedObject):
@property
def name(self):
ptr = self._bt_as_component_class_ptr(self._ptr)
class _SourceComponentClassConst(_ComponentClassConst):
- _get_ref = staticmethod(native_bt.component_class_source_get_ref)
- _put_ref = staticmethod(native_bt.component_class_source_put_ref)
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.component_class_source_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.component_class_source_put_ref(ptr)
+
_bt_as_component_class_ptr = staticmethod(
native_bt.component_class_source_as_component_class
)
class _FilterComponentClassConst(_ComponentClassConst):
- _get_ref = staticmethod(native_bt.component_class_filter_get_ref)
- _put_ref = staticmethod(native_bt.component_class_filter_put_ref)
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.component_class_filter_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.component_class_filter_put_ref(ptr)
+
_bt_as_component_class_ptr = staticmethod(
native_bt.component_class_filter_as_component_class
)
class _SinkComponentClassConst(_ComponentClassConst):
- _get_ref = staticmethod(native_bt.component_class_sink_get_ref)
- _put_ref = staticmethod(native_bt.component_class_sink_put_ref)
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.component_class_sink_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.component_class_sink_put_ref(ptr)
+
_bt_as_component_class_ptr = staticmethod(
native_bt.component_class_sink_as_component_class
)
class _ComponentPorts(collections.abc.Mapping):
-
# component_ptr is a bt_component_source *, bt_component_filter * or
# bt_component_sink *. Its type must match the type expected by the
# functions passed as arguments.
self._port_pycls = port_pycls
def __getitem__(self, key):
- utils._check_str(key)
+ bt2_utils._check_str(key)
port_ptr = self._borrow_port_ptr_by_name(self._component_ptr, key)
if port_ptr is None:
# This is analogous to _SourceComponentClassConst, but for source
# component objects.
-class _GenericSourceComponentConst(object._SharedObject, _SourceComponentConst):
- _get_ref = staticmethod(native_bt.component_source_get_ref)
- _put_ref = staticmethod(native_bt.component_source_put_ref)
+class _GenericSourceComponentConst(bt2_object._SharedObject, _SourceComponentConst):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.component_source_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.component_source_put_ref(ptr)
@property
def output_ports(self):
# This is analogous to _FilterComponentClassConst, but for filter
# component objects.
-class _GenericFilterComponentConst(object._SharedObject, _FilterComponentConst):
- _get_ref = staticmethod(native_bt.component_filter_get_ref)
- _put_ref = staticmethod(native_bt.component_filter_put_ref)
+class _GenericFilterComponentConst(bt2_object._SharedObject, _FilterComponentConst):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.component_filter_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.component_filter_put_ref(ptr)
@property
def output_ports(self):
# This is analogous to _SinkComponentClassConst, but for sink
# component objects.
-class _GenericSinkComponentConst(object._SharedObject, _SinkComponentConst):
- _get_ref = staticmethod(native_bt.component_sink_get_ref)
- _put_ref = staticmethod(native_bt.component_sink_put_ref)
+class _GenericSinkComponentConst(bt2_object._SharedObject, _SinkComponentConst):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.component_sink_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.component_sink_put_ref(ptr)
@property
def input_ports(self):
return
comp_cls_name = kwargs.get("name", class_name)
- utils._check_str(comp_cls_name)
+ bt2_utils._check_str(comp_cls_name)
comp_cls_descr = None
comp_cls_help = None
if hasattr(cls, "__doc__") and cls.__doc__ is not None:
- utils._check_str(cls.__doc__)
+ bt2_utils._check_str(cls.__doc__)
docstring = _trim_docstring(cls.__doc__)
lines = docstring.splitlines()
)
elif _UserSinkComponent in bases:
if not hasattr(cls, "_user_consume"):
- raise bt2._IncompleteUserClass(
+ raise _IncompleteUserClass(
"cannot create component class '{}': missing a _user_consume() method".format(
class_name
)
cls, comp_cls_name, comp_cls_descr, comp_cls_help
)
else:
- raise bt2._IncompleteUserClass(
+ raise _IncompleteUserClass(
"cannot find a known component class base in the bases of '{}'".format(
class_name
)
)
if cc_ptr is None:
- raise bt2._MemoryError(
+ raise bt2_error._MemoryError(
"cannot create component class '{}'".format(class_name)
)
@staticmethod
def _bt_set_iterator_class(cls, iter_cls):
if iter_cls is None:
- raise bt2._IncompleteUserClass(
+ raise _IncompleteUserClass(
"cannot create component class '{}': missing message iterator class".format(
cls.__name__
)
)
if not issubclass(iter_cls, bt2_message_iterator._UserMessageIterator):
- raise bt2._IncompleteUserClass(
+ raise _IncompleteUserClass(
"cannot create component class '{}': message iterator class does not inherit bt2._UserMessageIterator".format(
cls.__name__
)
)
if not hasattr(iter_cls, "__next__"):
- raise bt2._IncompleteUserClass(
+ raise _IncompleteUserClass(
"cannot create component class '{}': message iterator class is missing a __next__() method".format(
cls.__name__
)
if hasattr(iter_cls, "_user_can_seek_ns_from_origin") and not hasattr(
iter_cls, "_user_seek_ns_from_origin"
):
- raise bt2._IncompleteUserClass(
+ raise _IncompleteUserClass(
"cannot create component class '{}': message iterator class implements _user_can_seek_ns_from_origin but not _user_seek_ns_from_origin".format(
cls.__name__
)
if hasattr(iter_cls, "_user_can_seek_beginning") and not hasattr(
iter_cls, "_user_seek_beginning"
):
- raise bt2._IncompleteUserClass(
+ raise _IncompleteUserClass(
"cannot create component class '{}': message iterator class implements _user_can_seek_beginning but not _user_seek_beginning".format(
cls.__name__
)
# this can raise, but the native side checks the exception
range_set = cls._user_get_supported_mip_versions(params, obj, log_level)
- if type(range_set) is not bt2.UnsignedIntegerRangeSet:
+ if type(range_set) is not bt2_integer_range_set.UnsignedIntegerRangeSet:
# this can raise, but the native side checks the exception
- range_set = bt2.UnsignedIntegerRangeSet(range_set)
+ range_set = bt2_integer_range_set.UnsignedIntegerRangeSet(range_set)
# return new reference
range_set._get_ref(range_set._ptr)
priv_query_exec._invalidate()
# this can raise, but the native side checks the exception
- results = bt2.create_value(results)
+ results = bt2_value.create_value(results)
if results is None:
results_ptr = native_bt.value_null
return int(results_ptr)
def _user_query(cls, priv_query_executor, object_name, params, method_obj):
- raise bt2.UnknownObject
+ raise bt2_utils.UnknownObject
def _bt_component_class_ptr(self):
return self._bt_as_component_class_ptr(self._bt_cc_ptr)
tc_ptr = native_bt.trace_class_create(ptr)
if tc_ptr is None:
- raise bt2._MemoryError("could not create trace class")
+ raise bt2_error._MemoryError("could not create trace class")
tc = bt2_trace_class._TraceClass._create_from_ptr(tc_ptr)
tc._assigns_automatic_stream_class_id = assigns_automatic_stream_class_id
cc_ptr = native_bt.clock_class_create(ptr)
if cc_ptr is None:
- raise bt2._MemoryError("could not create clock class")
+ raise bt2_error._MemoryError("could not create clock class")
cc = bt2_clock_class._ClockClass._create_from_ptr(cc_ptr)
)
def _add_output_port(self, name, user_data=None):
- utils._check_str(name)
+ bt2_utils._check_str(name)
if name in self._output_ports:
raise ValueError(
fn = native_bt.self_component_source_add_output_port
comp_status, self_port_ptr = fn(self._bt_ptr, name, user_data)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
comp_status, "cannot add output port to source component object"
)
assert self_port_ptr is not None
)
def _add_output_port(self, name, user_data=None):
- utils._check_str(name)
+ bt2_utils._check_str(name)
if name in self._output_ports:
raise ValueError(
fn = native_bt.self_component_filter_add_output_port
comp_status, self_port_ptr = fn(self._bt_ptr, name, user_data)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
comp_status, "cannot add output port to filter component object"
)
assert self_port_ptr
)
def _add_input_port(self, name, user_data=None):
- utils._check_str(name)
+ bt2_utils._check_str(name)
if name in self._input_ports:
raise ValueError(
fn = native_bt.self_component_filter_add_input_port
comp_status, self_port_ptr = fn(self._bt_ptr, name, user_data)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
comp_status, "cannot add input port to filter component object"
)
assert self_port_ptr
)
def _add_input_port(self, name, user_data=None):
- utils._check_str(name)
+ bt2_utils._check_str(name)
if name in self._input_ports:
raise ValueError(
fn = native_bt.self_component_sink_add_input_port
comp_status, self_port_ptr = fn(self._bt_ptr, name, user_data)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
comp_status, "cannot add input port to sink component object"
)
assert self_port_ptr
)
def _create_message_iterator(self, input_port):
- utils._check_type(input_port, bt2_port._UserComponentInputPort)
+ bt2_utils._check_type(input_port, bt2_port._UserComponentInputPort)
if not input_port.is_connected:
raise ValueError("input port is not connected")
) = native_bt.bt2_message_iterator_create_from_sink_component(
self._bt_ptr, input_port._ptr
)
- utils._handle_func_status(status, "cannot create message iterator object")
+ bt2_utils._handle_func_status(status, "cannot create message iterator object")
assert msg_iter_ptr is not None
return bt2_message_iterator._UserComponentInputPortMessageIterator(msg_iter_ptr)
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt
+from bt2 import value as bt2_value
from bt2 import component as bt2_component
-import bt2
+from bt2 import native_bt
def _is_source_comp_cls(comp_cls):
raise ValueError("cannot pass a Python object to a non-Python component")
self._comp_cls = component_class
- self._params = bt2.create_value(params)
+ self._params = bt2_value.create_value(params)
self._obj = obj
@property
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt
from bt2 import port as bt2_port
from bt2 import object as bt2_object
+from bt2 import native_bt
class _ConnectionConst(bt2_object._SharedObject):
- _get_ref = staticmethod(native_bt.connection_get_ref)
- _put_ref = staticmethod(native_bt.connection_put_ref)
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.connection_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.connection_put_ref(ptr)
@property
def downstream_port(self):
#
# Copyright (c) 2019 Simon Marchi <simon.marchi@efficios.com>
-from bt2 import native_bt
from collections import abc
+from bt2 import native_bt
+
class ComponentClassType:
SOURCE = native_bt.COMPONENT_CLASS_TYPE_SOURCE
def __str__(self):
return self._str
+
+
+class _MemoryError(_Error):
+ """Raised when an operation fails due to memory issues."""
#
# Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import event_class as bt2_event_class
+import collections.abc
+
+from bt2 import field as bt2_field
+from bt2 import utils as bt2_utils
+from bt2 import object as bt2_object
from bt2 import packet as bt2_packet
from bt2 import stream as bt2_stream
-from bt2 import field as bt2_field
-import collections.abc
+from bt2 import native_bt
+from bt2 import event_class as bt2_event_class
-class _EventConst(object._UniqueObject, collections.abc.Mapping):
+class _EventConst(bt2_object._UniqueObject, collections.abc.Mapping):
_borrow_class_ptr = staticmethod(native_bt.event_borrow_class_const)
_borrow_packet_ptr = staticmethod(native_bt.event_borrow_packet_const)
_borrow_stream_ptr = staticmethod(native_bt.event_borrow_stream_const)
)
def __getitem__(self, key):
- utils._check_str(key)
+ bt2_utils._check_str(key)
payload_field = self.payload_field
if payload_field is not None and key in payload_field:
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import field_class as bt2_field_class
+from bt2 import utils as bt2_utils
from bt2 import value as bt2_value
+from bt2 import object as bt2_object
+from bt2 import native_bt
+from bt2 import field_class as bt2_field_class
def _bt2_stream_class():
DEBUG = native_bt.EVENT_CLASS_LOG_LEVEL_DEBUG
-class _EventClassConst(object._SharedObject):
- _get_ref = staticmethod(native_bt.event_class_get_ref)
- _put_ref = staticmethod(native_bt.event_class_put_ref)
+class _EventClassConst(bt2_object._SharedObject):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.event_class_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.event_class_put_ref(ptr)
+
_borrow_stream_class_ptr = staticmethod(
native_bt.event_class_borrow_stream_class_const
)
def _emf_uri(self, emf_uri):
status = native_bt.event_class_set_emf_uri(self._ptr, emf_uri)
- utils._handle_func_status(status, "cannot set event class object's EMF URI")
+ bt2_utils._handle_func_status(status, "cannot set event class object's EMF URI")
_emf_uri = property(fset=_emf_uri)
status = native_bt.event_class_set_specific_context_field_class(
self._ptr, context_field_class._ptr
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot set event class object's context field class"
)
status = native_bt.event_class_set_payload_field_class(
self._ptr, payload_field_class._ptr
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot set event class object's payload field class"
)
payload_field_class,
):
if name is not None:
- utils._check_str(name)
+ bt2_utils._check_str(name)
if user_attributes is not None:
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
if log_level is not None:
log_levels = (
raise ValueError("'{}' is not a valid log level".format(log_level))
if emf_uri is not None:
- utils._check_str(emf_uri)
+ bt2_utils._check_str(emf_uri)
if specific_context_field_class is not None:
- utils._check_type(
+ bt2_utils._check_type(
specific_context_field_class, bt2_field_class._StructureFieldClass
)
if payload_field_class is not None:
- utils._check_type(payload_field_class, bt2_field_class._StructureFieldClass)
+ bt2_utils._check_type(
+ payload_field_class, bt2_field_class._StructureFieldClass
+ )
_EVENT_CLASS_LOG_LEVEL_TO_OBJ = {
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import field_class as bt2_field_class
-import collections.abc
-import functools
-import numbers
import math
+import numbers
+import functools
+import collections.abc
+
+from bt2 import utils as bt2_utils
+from bt2 import object as bt2_object
+from bt2 import native_bt
+from bt2 import field_class as bt2_field_class
def _create_field_from_ptr_template(
object_map, ptr, owner_ptr, owner_get_ref, owner_put_ref
):
-
field_class_ptr = native_bt.field_borrow_class_const(ptr)
typeid = native_bt.field_class_get_type(field_class_ptr)
field = object_map[typeid]._create_from_ptr_and_get_ref(
return field
-class _FieldConst(object._UniqueObject):
+class _FieldConst(bt2_object._UniqueObject):
_create_field_from_ptr = staticmethod(_create_field_from_const_ptr)
_create_field_class_from_ptr_and_get_ref = staticmethod(
bt2_field_class._create_field_class_from_const_ptr_and_get_ref
_NAME = "Bit array"
def _value_as_integer(self, value):
- utils._check_uint64(value)
+ bt2_utils._check_uint64(value)
native_bt.field_bit_array_set_value_as_integer(self._ptr, value)
value_as_integer = property(
@property
def labels(self):
status, labels = self._get_mapping_labels(self._ptr)
- utils._handle_func_status(status, "cannot get label for enumeration field")
+ bt2_utils._handle_func_status(status, "cannot get label for enumeration field")
assert labels is not None
return labels
def __iadd__(self, value):
value = self._value_to_str(value)
status = native_bt.field_string_append(self._ptr, value)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot append to string field object's value"
)
return self
return "{{{}}}".format(", ".join(items))
def __getitem__(self, key):
- utils._check_str(key)
+ bt2_utils._check_str(key)
field_ptr = self._borrow_member_field_ptr_by_name(self._ptr, key)
if field_ptr is None:
)
def member_at_index(self, index):
- utils._check_uint64(index)
+ bt2_utils._check_uint64(index)
if index >= len(self):
raise IndexError
_borrow_field_ptr = staticmethod(native_bt.field_option_borrow_field)
def _has_field(self, value):
- utils._check_bool(value)
+ bt2_utils._check_bool(value)
native_bt.field_option_set_has_field(self._ptr, value)
has_field = property(fget=_OptionFieldConst.has_field.fget, fset=_has_field)
_NAME = "Dynamic array"
def _set_length(self, length):
- utils._check_uint64(length)
+ bt2_utils._check_uint64(length)
status = native_bt.field_array_dynamic_set_length(self._ptr, length)
- utils._handle_func_status(status, "cannot set dynamic array length")
+ bt2_utils._handle_func_status(status, "cannot set dynamic array length")
length = property(fget=_ArrayField._get_length, fset=_set_length)
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
import collections.abc
+
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
+from bt2 import value as bt2_value
+from bt2 import object as bt2_object
+from bt2 import native_bt
from bt2 import field_path as bt2_field_path
from bt2 import integer_range_set as bt2_integer_range_set
-from bt2 import value as bt2_value
-import bt2
def _obj_type_from_field_class_ptr_template(type_map, ptr):
HEXADECIMAL = native_bt.FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL
-class _FieldClassConst(object._SharedObject):
- _get_ref = staticmethod(native_bt.field_class_get_ref)
- _put_ref = staticmethod(native_bt.field_class_put_ref)
+class _FieldClassConst(bt2_object._SharedObject):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.field_class_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.field_class_put_ref(ptr)
+
_borrow_user_attributes_ptr = staticmethod(
native_bt.field_class_borrow_user_attributes_const
)
def _check_create_status(self, ptr):
if ptr is None:
- raise bt2._MemoryError(
+ raise bt2_error._MemoryError(
"cannot create {} field class object".format(self._NAME.lower())
)
def _user_attributes(self, user_attributes):
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
native_bt.field_class_set_user_attributes(self._ptr, value._ptr)
_user_attributes = property(fset=_user_attributes)
_field_value_range = property(fset=_field_value_range)
def _preferred_display_base(self, base):
- utils._check_uint64(base)
+ bt2_utils._check_uint64(base)
if base not in (
IntegerDisplayBase.BINARY,
self._check_int_type(value)
status, labels = self._get_mapping_labels_for_value(self._ptr, value)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot get mapping labels for value {}".format(value)
)
return [self[label] for label in labels]
yield self._mapping_pycls(mapping_ptr).label
def __getitem__(self, label):
- utils._check_str(label)
+ bt2_utils._check_str(label)
mapping_ptr = self._borrow_mapping_ptr_by_label(self._ptr, label)
if mapping_ptr is None:
class _EnumerationFieldClass(_EnumerationFieldClassConst, _IntegerFieldClass):
def add_mapping(self, label, ranges):
- utils._check_str(label)
- utils._check_type(ranges, self._range_set_pycls)
+ bt2_utils._check_str(label)
+ bt2_utils._check_type(ranges, self._range_set_pycls)
if label in self:
raise ValueError("duplicate mapping label '{}'".format(label))
status = self._add_mapping(self._ptr, label, ranges._ptr)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot add mapping to enumeration field class object"
)
_get_mapping_labels_for_value = staticmethod(
native_bt.field_class_enumeration_unsigned_get_mapping_labels_for_value
)
- _check_int_type = staticmethod(utils._check_uint64)
+ _check_int_type = staticmethod(bt2_utils._check_uint64)
class _UnsignedEnumerationFieldClass(
_get_mapping_labels_for_value = staticmethod(
native_bt.field_class_enumeration_signed_get_mapping_labels_for_value
)
- _check_int_type = staticmethod(utils._check_int64)
+ _check_int_type = staticmethod(bt2_utils._check_int64)
class _SignedEnumerationFieldClass(
def _user_attributes(self, user_attributes):
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
native_bt.field_class_structure_member_set_user_attributes(
self._ptr, value._ptr
)
yield native_bt.field_class_structure_member_get_name(member_ptr)
def member_at_index(self, index):
- utils._check_uint64(index)
+ bt2_utils._check_uint64(index)
if index >= len(self):
raise IndexError
_structure_member_field_class_pycls = property(lambda _: _StructureFieldClassMember)
def append_member(self, name, field_class, user_attributes=None):
- utils._check_str(name)
- utils._check_type(field_class, _FieldClass)
+ bt2_utils._check_str(name)
+ bt2_utils._check_type(field_class, _FieldClass)
if name in self:
raise ValueError("duplicate member name '{}'".format(name))
if user_attributes is not None:
# check now that user attributes are valid
- user_attributes_value = bt2.create_value(user_attributes)
+ user_attributes_value = bt2_value.create_value(user_attributes)
status = native_bt.field_class_structure_append_member(
self._ptr, name, field_class._ptr
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot append member to structure field class object"
)
_NAME = "Option (with boolean selector)"
def _selector_is_reversed(self, selector_is_reversed):
- utils._check_bool(selector_is_reversed)
+ bt2_utils._check_bool(selector_is_reversed)
native_bt.field_class_option_with_selector_field_bool_set_selector_is_reversed(
self._ptr, selector_is_reversed
)
def _user_attributes(self, user_attributes):
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
native_bt.field_class_variant_option_set_user_attributes(self._ptr, value._ptr)
_user_attributes = property(fset=_user_attributes)
yield native_bt.field_class_variant_option_get_name(base_opt_ptr)
def option_at_index(self, index):
- utils._check_uint64(index)
+ bt2_utils._check_uint64(index)
if index >= len(self):
raise IndexError
_NAME = "Variant (without selector)"
def append_option(self, name, field_class, user_attributes=None):
- utils._check_str(name)
- utils._check_type(field_class, _FieldClass)
+ bt2_utils._check_str(name)
+ bt2_utils._check_type(field_class, _FieldClass)
if name in self:
raise ValueError("duplicate option name '{}'".format(name))
if user_attributes is not None:
# check now that user attributes are valid
- user_attributes_value = bt2.create_value(user_attributes)
+ user_attributes_value = bt2_value.create_value(user_attributes)
status = native_bt.field_class_variant_without_selector_append_option(
self._ptr, name, field_class._ptr
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot append option to variant field class object"
)
_NAME = "Variant (with selector)"
def append_option(self, name, field_class, ranges, user_attributes=None):
- utils._check_str(name)
- utils._check_type(field_class, _FieldClass)
- utils._check_type(ranges, self._variant_option_pycls._range_set_pycls)
+ bt2_utils._check_str(name)
+ bt2_utils._check_type(field_class, _FieldClass)
+ bt2_utils._check_type(ranges, self._variant_option_pycls._range_set_pycls)
if name in self:
raise ValueError("duplicate option name '{}'".format(name))
if user_attributes is not None:
# check now that user attributes are valid
- user_attributes_value = bt2.create_value(user_attributes)
+ user_attributes_value = bt2_value.create_value(user_attributes)
# TODO: check overlaps (precondition of self._append_option())
status = self._append_option(self._ptr, name, field_class._ptr, ranges._ptr)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot append option to variant field class object"
)
# Copyright (c) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
import collections
-from bt2 import native_bt, object
+
+from bt2 import object as bt2_object
+from bt2 import native_bt
class FieldPathScope:
pass
-class _FieldPathConst(object._SharedObject, collections.abc.Iterable):
- _get_ref = staticmethod(native_bt.field_path_get_ref)
- _put_ref = staticmethod(native_bt.field_path_put_ref)
+class _FieldPathConst(bt2_object._SharedObject, collections.abc.Iterable):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.field_path_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.field_path_put_ref(ptr)
@property
def root_scope(self):
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import interrupter as bt2_interrupter
-from bt2 import connection as bt2_connection
-from bt2 import component as bt2_component
import functools
+
+from bt2 import mip as bt2_mip
from bt2 import port as bt2_port
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
+from bt2 import value as bt2_value
+from bt2 import object as bt2_object
from bt2 import logging as bt2_logging
-import bt2
+from bt2 import component as bt2_component
+from bt2 import native_bt
+from bt2 import connection as bt2_connection
+from bt2 import interrupter as bt2_interrupter
def _graph_port_added_listener_from_native(
user_listener(component, port)
-class Graph(object._SharedObject):
- _get_ref = staticmethod(native_bt.graph_get_ref)
- _put_ref = staticmethod(native_bt.graph_put_ref)
+class Graph(bt2_object._SharedObject):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.graph_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.graph_put_ref(ptr)
def __init__(self, mip_version=0):
- utils._check_uint64(mip_version)
+ bt2_utils._check_uint64(mip_version)
- if mip_version > bt2.get_maximal_mip_version():
+ if mip_version > bt2_mip.get_maximal_mip_version():
raise ValueError("unknown MIP version {}".format(mip_version))
ptr = native_bt.graph_create(mip_version)
if ptr is None:
- raise bt2._MemoryError("cannot create graph object")
+ raise bt2_error._MemoryError("cannot create graph object")
super().__init__(ptr)
)
)
- utils._check_str(name)
- utils._check_log_level(logging_level)
+ bt2_utils._check_str(name)
+ bt2_utils._check_log_level(logging_level)
base_cc_ptr = component_class._bt_component_class_ptr()
if obj is not None and not native_bt.bt2_is_python_component_class(base_cc_ptr):
raise ValueError("cannot pass a Python object to a non-Python component")
- if params is not None and not isinstance(params, (dict, bt2.MapValue)):
+ if params is not None and not isinstance(params, (dict, bt2_value.MapValue)):
raise TypeError("'params' parameter is not a 'dict' or a 'bt2.MapValue'.")
- params = bt2.create_value(params)
+ params = bt2_value.create_value(params)
params_ptr = params._ptr if params is not None else None
status, comp_ptr = add_fn(
self._ptr, cc_ptr, name, params_ptr, obj, logging_level
)
- utils._handle_func_status(status, "cannot add component to graph")
+ bt2_utils._handle_func_status(status, "cannot add component to graph")
assert comp_ptr
return bt2_component._create_component_from_const_ptr_and_get_ref(
comp_ptr, cc_type
)
def connect_ports(self, upstream_port, downstream_port):
- utils._check_type(upstream_port, bt2_port._OutputPortConst)
- utils._check_type(downstream_port, bt2_port._InputPortConst)
+ bt2_utils._check_type(upstream_port, bt2_port._OutputPortConst)
+ bt2_utils._check_type(downstream_port, bt2_port._InputPortConst)
status, conn_ptr = native_bt.graph_connect_ports(
self._ptr, upstream_port._ptr, downstream_port._ptr
)
- utils._handle_func_status(status, "cannot connect component ports within graph")
+ bt2_utils._handle_func_status(
+ status, "cannot connect component ports within graph"
+ )
assert conn_ptr
return bt2_connection._ConnectionConst._create_from_ptr_and_get_ref(conn_ptr)
listener_ids = fn(self._ptr, listener_from_native)
if listener_ids is None:
- raise bt2._Error("cannot add listener to graph object")
+ raise bt2_error._Error("cannot add listener to graph object")
# keep the partial's reference
self._listener_partials.append(listener_from_native)
def run_once(self):
status = native_bt.graph_run_once(self._ptr)
- utils._handle_func_status(status, "graph object could not run once")
+ bt2_utils._handle_func_status(status, "graph object could not run once")
def run(self):
status = native_bt.graph_run(self._ptr)
- utils._handle_func_status(status, "graph object stopped running")
+ bt2_utils._handle_func_status(status, "graph object stopped running")
def add_interrupter(self, interrupter):
- utils._check_type(interrupter, bt2_interrupter.Interrupter)
+ bt2_utils._check_type(interrupter, bt2_interrupter.Interrupter)
native_bt.graph_add_interrupter(self._ptr, interrupter._ptr)
@property
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
import collections.abc
-import bt2
+
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
+from bt2 import object as bt2_object
+from bt2 import native_bt
class _IntegerRangeConst:
class _SignedIntegerRangeConst(_IntegerRangeConst):
- _is_type = staticmethod(utils._is_int64)
- _check_type = staticmethod(utils._check_int64)
+ _is_type = staticmethod(bt2_utils._is_int64)
+ _check_type = staticmethod(bt2_utils._check_int64)
class SignedIntegerRange(_SignedIntegerRangeConst, _IntegerRange):
class _UnsignedIntegerRangeConst(_IntegerRangeConst):
- _is_type = staticmethod(utils._is_uint64)
- _check_type = staticmethod(utils._check_uint64)
+ _is_type = staticmethod(bt2_utils._is_uint64)
+ _check_type = staticmethod(bt2_utils._check_uint64)
class UnsignedIntegerRange(_UnsignedIntegerRangeConst, _IntegerRange):
pass
-class _IntegerRangeSetConst(object._SharedObject, collections.abc.Set):
+class _IntegerRangeSetConst(bt2_object._SharedObject, collections.abc.Set):
def __len__(self):
range_set_ptr = self._as_range_set_ptr(self._ptr)
count = native_bt.integer_range_set_get_range_count(range_set_ptr)
yield self._range_pycls(lower, upper)
def __eq__(self, other):
-
if not isinstance(other, _IntegerRangeSetConst):
return False
ptr = self._create_range_set()
if ptr is None:
- raise bt2._MemoryError("cannot create range set object")
+ raise bt2_error._MemoryError("cannot create range set object")
super().__init__(ptr)
rg = self._range_pycls(rg[0], rg[1])
status = self._add_range(self._ptr, rg.lower, rg.upper)
- utils._handle_func_status(status, "cannot add range to range set object")
+ bt2_utils._handle_func_status(status, "cannot add range to range set object")
def discard(self, rg):
raise NotImplementedError
class _SignedIntegerRangeSetConst(_IntegerRangeSetConst):
- _get_ref = staticmethod(native_bt.integer_range_set_signed_get_ref)
- _put_ref = staticmethod(native_bt.integer_range_set_signed_put_ref)
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.integer_range_set_signed_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.integer_range_set_signed_put_ref(ptr)
+
_as_range_set_ptr = staticmethod(
native_bt.integer_range_set_signed_as_range_set_const
)
class _UnsignedIntegerRangeSetConst(_IntegerRangeSetConst):
- _get_ref = staticmethod(native_bt.integer_range_set_unsigned_get_ref)
- _put_ref = staticmethod(native_bt.integer_range_set_unsigned_put_ref)
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.integer_range_set_unsigned_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.integer_range_set_unsigned_put_ref(ptr)
+
_as_range_set_ptr = staticmethod(
native_bt.integer_range_set_unsigned_as_range_set_const
)
#
# Copyright (c) 2019 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object
-import bt2
+from bt2 import error as bt2_error
+from bt2 import object as bt2_object
+from bt2 import native_bt
-class Interrupter(object._SharedObject):
- _get_ref = staticmethod(native_bt.interrupter_get_ref)
- _put_ref = staticmethod(native_bt.interrupter_put_ref)
+class Interrupter(bt2_object._SharedObject):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.interrupter_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.interrupter_put_ref(ptr)
def __init__(self):
ptr = native_bt.interrupter_create()
if ptr is None:
- raise bt2._MemoryError("cannot create interrupter object")
+ raise bt2_error._MemoryError("cannot create interrupter object")
super().__init__(ptr)
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import clock_snapshot as bt2_clock_snapshot
+from bt2 import event as bt2_event
+from bt2 import utils as bt2_utils
+from bt2 import object as bt2_object
from bt2 import packet as bt2_packet
from bt2 import stream as bt2_stream
-from bt2 import event as bt2_event
+from bt2 import native_bt
+from bt2 import clock_snapshot as bt2_clock_snapshot
def _create_from_ptr(ptr):
return _MESSAGE_TYPE_TO_CLS[msg_type]._create_from_ptr(ptr)
-class _MessageConst(object._SharedObject):
- _get_ref = staticmethod(native_bt.message_get_ref)
- _put_ref = staticmethod(native_bt.message_put_ref)
+class _MessageConst(bt2_object._SharedObject):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.message_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.message_put_ref(ptr)
@staticmethod
def _check_has_default_clock_class(clock_class):
class _StreamMessage(_StreamMessageConst, _Message):
def _default_clock_snapshot(self, raw_value):
- utils._check_uint64(raw_value)
+ bt2_utils._check_uint64(raw_value)
self._set_default_clock_snapshot(self._ptr, raw_value)
_default_clock_snapshot = property(
_stream_pycls = property(lambda _: bt2_stream._Stream)
def _set_count(self, count):
- utils._check_uint64(count)
+ bt2_utils._check_uint64(count)
if count == 0:
raise ValueError("discarded {} count is 0".format(self._item_name))
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import message as bt2_message
import collections.abc
-from bt2 import stream as bt2_stream
-from bt2 import event_class as bt2_event_class
-from bt2 import packet as bt2_packet
+
from bt2 import port as bt2_port
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
+from bt2 import object as bt2_object
+from bt2 import packet as bt2_packet
+from bt2 import stream as bt2_stream
+from bt2 import message as bt2_message
+from bt2 import native_bt
from bt2 import clock_class as bt2_clock_class
-import bt2
+from bt2 import event_class as bt2_event_class
class _MessageIterator(collections.abc.Iterator):
raise NotImplementedError
-class _UserComponentInputPortMessageIterator(object._SharedObject, _MessageIterator):
- _get_ref = staticmethod(native_bt.message_iterator_get_ref)
- _put_ref = staticmethod(native_bt.message_iterator_put_ref)
+class _UserComponentInputPortMessageIterator(
+ bt2_object._SharedObject, _MessageIterator
+):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.message_iterator_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.message_iterator_put_ref(ptr)
def __init__(self, ptr):
self._current_msgs = []
status, msgs = native_bt.bt2_self_component_port_input_get_msg_range(
self._ptr
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "unexpected error: cannot advance the message iterator"
)
self._current_msgs = msgs
def can_seek_beginning(self):
(status, res) = native_bt.message_iterator_can_seek_beginning(self._ptr)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status,
"cannot check whether or not message iterator can seek its beginning",
)
self._at = 0
status = native_bt.message_iterator_seek_beginning(self._ptr)
- utils._handle_func_status(status, "cannot seek message iterator beginning")
+ bt2_utils._handle_func_status(status, "cannot seek message iterator beginning")
def can_seek_ns_from_origin(self, ns_from_origin):
- utils._check_int64(ns_from_origin)
+ bt2_utils._check_int64(ns_from_origin)
(status, res) = native_bt.message_iterator_can_seek_ns_from_origin(
self._ptr, ns_from_origin
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status,
"cannot check whether or not message iterator can seek given ns from origin",
)
return res != 0
def seek_ns_from_origin(self, ns_from_origin):
- utils._check_int64(ns_from_origin)
+ bt2_utils._check_int64(ns_from_origin)
# Forget about buffered messages, they won't be valid after seeking.
self._current_msgs.clear()
status = native_bt.message_iterator_seek_ns_from_origin(
self._ptr, ns_from_origin
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "message iterator cannot seek given ns from origin"
)
self._ptr = ptr
def can_seek_forward(self, value):
- utils._check_bool(value)
+ bt2_utils._check_bool(value)
native_bt.self_message_iterator_configuration_set_can_seek_forward(
self._ptr, value
)
pass
def __next__(self):
- raise bt2.Stop
+ raise bt2_utils.Stop
def _bt_next_from_native(self):
# this can raise anything: it's catched by the native part
try:
msg = next(self)
except StopIteration:
- raise bt2.Stop
+ raise bt2_utils.Stop
except Exception:
raise
- utils._check_type(msg, bt2_message._MessageConst)
+ bt2_utils._check_type(msg, bt2_message._MessageConst)
# The reference we return will be given to the message array.
# However, the `msg` Python object may stay alive, if the user has kept
# method indicates whether the iterator can seek beginning.
if hasattr(self, "_user_can_seek_beginning"):
can_seek_beginning = self._user_can_seek_beginning()
- utils._check_bool(can_seek_beginning)
+ bt2_utils._check_bool(can_seek_beginning)
return can_seek_beginning
else:
return hasattr(self, "_user_seek_beginning")
if hasattr(self, "_user_can_seek_ns_from_origin"):
can_seek_ns_from_origin = self._user_can_seek_ns_from_origin(ns_from_origin)
- utils._check_bool(can_seek_ns_from_origin)
+ bt2_utils._check_bool(can_seek_ns_from_origin)
return can_seek_ns_from_origin
else:
return hasattr(self, "_user_seek_ns_from_origin")
self._user_seek_ns_from_origin(ns_from_origin)
def _create_message_iterator(self, input_port):
- utils._check_type(input_port, bt2_port._UserComponentInputPort)
+ bt2_utils._check_type(input_port, bt2_port._UserComponentInputPort)
if not input_port.is_connected:
raise ValueError("input port is not connected")
) = native_bt.bt2_message_iterator_create_from_message_iterator(
self._bt_ptr, input_port._ptr
)
- utils._handle_func_status(status, "cannot create message iterator object")
+ bt2_utils._handle_func_status(status, "cannot create message iterator object")
assert msg_iter_ptr is not None
return _UserComponentInputPortMessageIterator(msg_iter_ptr)
def _create_event_message(self, event_class, parent, default_clock_snapshot=None):
- utils._check_type(event_class, bt2_event_class._EventClass)
+ bt2_utils._check_type(event_class, bt2_event_class._EventClass)
if event_class.stream_class.supports_packets:
- utils._check_type(parent, bt2_packet._Packet)
+ bt2_utils._check_type(parent, bt2_packet._Packet)
else:
- utils._check_type(parent, bt2_stream._Stream)
+ bt2_utils._check_type(parent, bt2_stream._Stream)
if default_clock_snapshot is not None:
if event_class.stream_class.default_clock_class is None:
"event messages in this stream must not have a default clock snapshot"
)
- utils._check_uint64(default_clock_snapshot)
+ bt2_utils._check_uint64(default_clock_snapshot)
if event_class.stream_class.supports_packets:
ptr = native_bt.message_event_create_with_packet_and_default_clock_snapshot(
)
if ptr is None:
- raise bt2._MemoryError("cannot create event message object")
+ raise bt2_error._MemoryError("cannot create event message object")
return bt2_message._EventMessage(ptr)
def _create_message_iterator_inactivity_message(self, clock_class, clock_snapshot):
- utils._check_type(clock_class, bt2_clock_class._ClockClass)
+ bt2_utils._check_type(clock_class, bt2_clock_class._ClockClass)
ptr = native_bt.message_message_iterator_inactivity_create(
self._bt_ptr, clock_class._ptr, clock_snapshot
)
if ptr is None:
- raise bt2._MemoryError("cannot create inactivity message object")
+ raise bt2_error._MemoryError("cannot create inactivity message object")
return bt2_message._MessageIteratorInactivityMessage(ptr)
def _create_stream_beginning_message(self, stream, default_clock_snapshot=None):
- utils._check_type(stream, bt2_stream._Stream)
+ bt2_utils._check_type(stream, bt2_stream._Stream)
ptr = native_bt.message_stream_beginning_create(self._bt_ptr, stream._ptr)
if ptr is None:
- raise bt2._MemoryError("cannot create stream beginning message object")
+ raise bt2_error._MemoryError(
+ "cannot create stream beginning message object"
+ )
msg = bt2_message._StreamBeginningMessage(ptr)
return msg
def _create_stream_end_message(self, stream, default_clock_snapshot=None):
- utils._check_type(stream, bt2_stream._Stream)
+ bt2_utils._check_type(stream, bt2_stream._Stream)
ptr = native_bt.message_stream_end_create(self._bt_ptr, stream._ptr)
if ptr is None:
- raise bt2._MemoryError("cannot create stream end message object")
+ raise bt2_error._MemoryError("cannot create stream end message object")
msg = bt2_message._StreamEndMessage(ptr)
return msg
def _create_packet_beginning_message(self, packet, default_clock_snapshot=None):
- utils._check_type(packet, bt2_packet._Packet)
+ bt2_utils._check_type(packet, bt2_packet._Packet)
if packet.stream.cls.packets_have_beginning_default_clock_snapshot:
if default_clock_snapshot is None:
"packet beginning messages in this stream must have a default clock snapshot"
)
- utils._check_uint64(default_clock_snapshot)
+ bt2_utils._check_uint64(default_clock_snapshot)
ptr = native_bt.message_packet_beginning_create_with_default_clock_snapshot(
self._bt_ptr, packet._ptr, default_clock_snapshot
)
ptr = native_bt.message_packet_beginning_create(self._bt_ptr, packet._ptr)
if ptr is None:
- raise bt2._MemoryError("cannot create packet beginning message object")
+ raise bt2_error._MemoryError(
+ "cannot create packet beginning message object"
+ )
return bt2_message._PacketBeginningMessage(ptr)
def _create_packet_end_message(self, packet, default_clock_snapshot=None):
- utils._check_type(packet, bt2_packet._Packet)
+ bt2_utils._check_type(packet, bt2_packet._Packet)
if packet.stream.cls.packets_have_end_default_clock_snapshot:
if default_clock_snapshot is None:
"packet end messages in this stream must have a default clock snapshot"
)
- utils._check_uint64(default_clock_snapshot)
+ bt2_utils._check_uint64(default_clock_snapshot)
ptr = native_bt.message_packet_end_create_with_default_clock_snapshot(
self._bt_ptr, packet._ptr, default_clock_snapshot
)
ptr = native_bt.message_packet_end_create(self._bt_ptr, packet._ptr)
if ptr is None:
- raise bt2._MemoryError("cannot create packet end message object")
+ raise bt2_error._MemoryError("cannot create packet end message object")
return bt2_message._PacketEndMessage(ptr)
def _create_discarded_events_message(
self, stream, count=None, beg_clock_snapshot=None, end_clock_snapshot=None
):
- utils._check_type(stream, bt2_stream._Stream)
+ bt2_utils._check_type(stream, bt2_stream._Stream)
if not stream.cls.supports_discarded_events:
raise ValueError("stream class does not support discarded events")
"discarded events have default clock snapshots for this stream class"
)
- utils._check_uint64(beg_clock_snapshot)
- utils._check_uint64(end_clock_snapshot)
+ bt2_utils._check_uint64(beg_clock_snapshot)
+ bt2_utils._check_uint64(end_clock_snapshot)
if beg_clock_snapshot > end_clock_snapshot:
raise ValueError(
ptr = native_bt.message_discarded_events_create(self._bt_ptr, stream._ptr)
if ptr is None:
- raise bt2._MemoryError("cannot discarded events message object")
+ raise bt2_error._MemoryError("cannot discarded events message object")
msg = bt2_message._DiscardedEventsMessage(ptr)
def _create_discarded_packets_message(
self, stream, count=None, beg_clock_snapshot=None, end_clock_snapshot=None
):
- utils._check_type(stream, bt2_stream._Stream)
+ bt2_utils._check_type(stream, bt2_stream._Stream)
if not stream.cls.supports_discarded_packets:
raise ValueError("stream class does not support discarded packets")
"discarded packets have default clock snapshots for this stream class"
)
- utils._check_uint64(beg_clock_snapshot)
- utils._check_uint64(end_clock_snapshot)
+ bt2_utils._check_uint64(beg_clock_snapshot)
+ bt2_utils._check_uint64(end_clock_snapshot)
if beg_clock_snapshot > end_clock_snapshot:
raise ValueError(
ptr = native_bt.message_discarded_packets_create(self._bt_ptr, stream._ptr)
if ptr is None:
- raise bt2._MemoryError("cannot discarded packets message object")
+ raise bt2_error._MemoryError("cannot discarded packets message object")
msg = bt2_message._DiscardedPacketsMessage(ptr)
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, utils
-import bt2
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
+from bt2 import logging as bt2_logging
+from bt2 import native_bt
+from bt2 import component_descriptor as bt2_component_descriptor
def get_greatest_operative_mip_version(
- component_descriptors, log_level=bt2.LoggingLevel.NONE
+ component_descriptors, log_level=bt2_logging.LoggingLevel.NONE
):
- utils._check_log_level(log_level)
+ bt2_utils._check_log_level(log_level)
comp_descr_set_ptr = native_bt.component_descriptor_set_create()
if comp_descr_set_ptr is None:
- raise bt2._MemoryError("cannot create component descriptor set object")
+ raise bt2_error._MemoryError("cannot create component descriptor set object")
if len(component_descriptors) == 0:
raise ValueError("no component descriptors")
try:
for descr in component_descriptors:
- if type(descr) is not bt2.ComponentDescriptor:
+ if type(descr) is not bt2_component_descriptor.ComponentDescriptor:
raise TypeError("'{}' is not a component descriptor".format(descr))
base_cc_ptr = descr.component_class._bt_component_class_ptr()
status = native_bt.bt2_component_descriptor_set_add_descriptor_with_initialize_method_data(
comp_descr_set_ptr, base_cc_ptr, params_ptr, descr.obj
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot add descriptor to component descriptor set"
)
if status == native_bt.__BT_FUNC_STATUS_NO_MATCH:
return None
- utils._handle_func_status(status, "cannot get greatest operative MIP version")
+ bt2_utils._handle_func_status(
+ status, "cannot get greatest operative MIP version"
+ )
return version
finally:
native_bt.component_descriptor_set_put_ref(comp_descr_set_ptr)
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
+import abc
+
+
class _BaseObject:
# Ensure that the object always has _ptr set, even if it throws during
# construction.
class _UniqueObject(_BaseObject):
-
# Create a _UniqueObject.
#
# - ptr: SWIG Object, pointer to the unique object.
# Python object that owns a reference to a Babeltrace object.
-class _SharedObject(_BaseObject):
-
+class _SharedObject(_BaseObject, abc.ABC):
# Get a new reference on ptr.
#
# This must be implemented by subclasses to work correctly with a pointer
# of the native type they wrap.
@staticmethod
+ @abc.abstractmethod
def _get_ref(ptr):
raise NotImplementedError
# of the native type they wrap.
@staticmethod
+ @abc.abstractmethod
def _put_ref(ptr):
raise NotImplementedError
#
# Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object
from bt2 import field as bt2_field
+from bt2 import object as bt2_object
+from bt2 import native_bt
def _bt2_stream():
return bt2_stream
-class _PacketConst(object._SharedObject):
- _get_ref = staticmethod(native_bt.packet_get_ref)
- _put_ref = staticmethod(native_bt.packet_put_ref)
+class _PacketConst(bt2_object._SharedObject):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.packet_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.packet_put_ref(ptr)
+
_borrow_stream_ptr = staticmethod(native_bt.packet_borrow_stream_const)
_borrow_context_field_ptr = staticmethod(
native_bt.packet_borrow_context_field_const
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
+import os.path
import collections.abc
+
+from bt2 import utils as bt2_utils
+from bt2 import object as bt2_object
from bt2 import component as bt2_component
-import os.path
+from bt2 import native_bt
def find_plugins_in_path(path, recurse=True, fail_on_load_error=False):
- utils._check_str(path)
- utils._check_bool(recurse)
- utils._check_bool(fail_on_load_error)
+ bt2_utils._check_str(path)
+ bt2_utils._check_bool(recurse)
+ bt2_utils._check_bool(fail_on_load_error)
plugin_set_ptr = None
if os.path.isfile(path):
if status == native_bt.__BT_FUNC_STATUS_NOT_FOUND:
return
- utils._handle_func_status(status, "failed to find plugins")
+ bt2_utils._handle_func_status(status, "failed to find plugins")
assert plugin_set_ptr is not None
return _PluginSet._create_from_ptr(plugin_set_ptr)
find_in_static=True,
fail_on_load_error=False,
):
- utils._check_bool(find_in_std_env_var)
- utils._check_bool(find_in_user_dir)
- utils._check_bool(find_in_sys_dir)
- utils._check_bool(find_in_static)
- utils._check_bool(fail_on_load_error)
+ bt2_utils._check_bool(find_in_std_env_var)
+ bt2_utils._check_bool(find_in_user_dir)
+ bt2_utils._check_bool(find_in_sys_dir)
+ bt2_utils._check_bool(find_in_static)
+ bt2_utils._check_bool(fail_on_load_error)
plugin_set_ptr = None
status, plugin_set_ptr = native_bt.bt2_plugin_find_all(
if status == native_bt.__BT_FUNC_STATUS_NOT_FOUND:
return
- utils._handle_func_status(status, "failed to find plugins")
+ bt2_utils._handle_func_status(status, "failed to find plugins")
assert plugin_set_ptr is not None
return _PluginSet._create_from_ptr(plugin_set_ptr)
find_in_static=True,
fail_on_load_error=False,
):
- utils._check_str(name)
- utils._check_bool(fail_on_load_error)
+ bt2_utils._check_str(name)
+ bt2_utils._check_bool(fail_on_load_error)
status, ptr = native_bt.bt2_plugin_find(
name,
int(find_in_std_env_var),
if status == native_bt.__BT_FUNC_STATUS_NOT_FOUND:
return
- utils._handle_func_status(status, "failed to find plugin")
+ bt2_utils._handle_func_status(status, "failed to find plugin")
assert ptr is not None
return _Plugin._create_from_ptr(ptr)
-class _PluginSet(object._SharedObject, collections.abc.Sequence):
- _put_ref = staticmethod(native_bt.plugin_set_put_ref)
- _get_ref = staticmethod(native_bt.plugin_set_get_ref)
+class _PluginSet(bt2_object._SharedObject, collections.abc.Sequence):
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.plugin_set_put_ref(ptr)
+
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.plugin_set_get_ref(ptr)
def __len__(self):
count = native_bt.plugin_set_get_plugin_count(self._ptr)
return count
def __getitem__(self, index):
- utils._check_uint64(index)
+ bt2_utils._check_uint64(index)
if index >= len(self):
raise IndexError
self._plugin = plugin
def __getitem__(self, key):
- utils._check_str(key)
+ bt2_utils._check_str(key)
cc_ptr = self._borrow_component_class_by_name(self._plugin._ptr, key)
if cc_ptr is None:
_comp_cls_type = native_bt.COMPONENT_CLASS_TYPE_SINK
-class _Plugin(object._SharedObject):
- _put_ref = staticmethod(native_bt.plugin_put_ref)
- _get_ref = staticmethod(native_bt.plugin_get_ref)
+class _Plugin(bt2_object._SharedObject):
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.plugin_put_ref(ptr)
+
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.plugin_get_ref(ptr)
@property
def name(self):
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object
+from bt2 import object as bt2_object
+from bt2 import native_bt
def _bt2_connection():
return cls._create_from_ptr_and_get_ref(ptr)
-class _PortConst(object._SharedObject):
+class _PortConst(bt2_object._SharedObject):
@classmethod
def _get_ref(cls, ptr):
ptr = cls._as_port_ptr(ptr)
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import utils
-from bt2 import component as bt2_component
import sys
+from bt2 import utils as bt2_utils
+from bt2 import component as bt2_component
# Python plugin path to `_PluginInfo` (cache)
_plugin_infos = {}
"cannot find module '{}' in loaded modules".format(module_name)
)
- utils._check_str(name)
+ bt2_utils._check_str(name)
if description is not None:
- utils._check_str(description)
+ bt2_utils._check_str(description)
if author is not None:
- utils._check_str(author)
+ bt2_utils._check_str(author)
if license is not None:
- utils._check_str(license)
+ bt2_utils._check_str(license)
if version is not None:
if not _validate_version(version):
# do not load module and create plugin info twice for this path
return _plugin_infos[path]
- import importlib.machinery
- import inspect
import hashlib
+ import inspect
+ import importlib.machinery
if path is None:
raise TypeError("missing path")
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import interrupter as bt2_interrupter
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
from bt2 import value as bt2_value
-import bt2
+from bt2 import object as bt2_object
+from bt2 import native_bt
+from bt2 import interrupter as bt2_interrupter
def _bt2_component():
return native_bt.query_executor_get_logging_level(self._common_ptr)
-class QueryExecutor(object._SharedObject, _QueryExecutorCommon):
- _get_ref = staticmethod(native_bt.query_executor_get_ref)
- _put_ref = staticmethod(native_bt.query_executor_put_ref)
+class QueryExecutor(bt2_object._SharedObject, _QueryExecutorCommon):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.query_executor_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.query_executor_put_ref(ptr)
def _as_query_executor_ptr(self):
return self._ptr
o = component_class
raise TypeError("'{}' is not a component class object".format(o))
- utils._check_str(object_name)
+ bt2_utils._check_str(object_name)
if params is None:
params_ptr = native_bt.value_null
else:
- params = bt2.create_value(params)
+ params = bt2_value.create_value(params)
params_ptr = params._ptr
cc_ptr = component_class._bt_component_class_ptr()
)
if ptr is None:
- raise bt2._MemoryError("cannot create query executor object")
+ raise bt2_error._MemoryError("cannot create query executor object")
super().__init__(ptr)
self._method_obj = method_obj
def add_interrupter(self, interrupter):
- utils._check_type(interrupter, bt2_interrupter.Interrupter)
+ bt2_utils._check_type(interrupter, bt2_interrupter.Interrupter)
native_bt.query_executor_add_interrupter(self._ptr, interrupter._ptr)
@property
return bt2_interrupter.Interrupter._create_from_ptr_and_get_ref(ptr)
def _set_logging_level(self, log_level):
- utils._check_log_level(log_level)
+ bt2_utils._check_log_level(log_level)
status = native_bt.query_executor_set_logging_level(self._ptr, log_level)
- utils._handle_func_status(status, "cannot set query executor's logging level")
+ bt2_utils._handle_func_status(
+ status, "cannot set query executor's logging level"
+ )
logging_level = property(
fget=_QueryExecutorCommon.logging_level, fset=_set_logging_level
def query(self):
status, result_ptr = native_bt.query_executor_query(self._ptr)
- utils._handle_func_status(status, "cannot query component class")
+ bt2_utils._handle_func_status(status, "cannot query component class")
assert result_ptr is not None
return bt2_value._create_from_const_ptr(result_ptr)
#
# Copyright (c) 2016-2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, utils
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
+from bt2 import value as bt2_value
from bt2 import object as bt2_object
from bt2 import packet as bt2_packet
+from bt2 import native_bt
from bt2 import stream_class as bt2_stream_class
-from bt2 import value as bt2_value
-import bt2
def _bt2_trace():
class _StreamConst(bt2_object._SharedObject):
- _get_ref = staticmethod(native_bt.stream_get_ref)
- _put_ref = staticmethod(native_bt.stream_put_ref)
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.stream_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.stream_put_ref(ptr)
+
_borrow_class_ptr = staticmethod(native_bt.stream_borrow_class_const)
_borrow_user_attributes_ptr = staticmethod(
native_bt.stream_borrow_user_attributes_const
packet_ptr = native_bt.packet_create(self._ptr)
if packet_ptr is None:
- raise bt2._MemoryError("cannot create packet object")
+ raise bt2_error._MemoryError("cannot create packet object")
return bt2_packet._Packet._create_from_ptr(packet_ptr)
def _user_attributes(self, user_attributes):
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
native_bt.stream_set_user_attributes(self._ptr, value._ptr)
_user_attributes = property(
)
def _name(self, name):
- utils._check_str(name)
+ bt2_utils._check_str(name)
native_bt.stream_set_name(self._ptr, name)
_name = property(fget=_StreamConst.name.fget, fset=_name)
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
-from bt2 import field_class as bt2_field_class
-from bt2 import event_class as bt2_event_class
-from bt2 import clock_class as bt2_clock_class
-from bt2 import value as bt2_value
import collections.abc
+from bt2 import utils as bt2_utils
+from bt2 import value as bt2_value
+from bt2 import object as bt2_object
+from bt2 import native_bt
+from bt2 import clock_class as bt2_clock_class
+from bt2 import event_class as bt2_event_class
+from bt2 import field_class as bt2_field_class
+
def _bt2_trace_class():
from bt2 import trace_class as bt2_trace_class
return bt2_trace_class
-class _StreamClassConst(object._SharedObject, collections.abc.Mapping):
- _get_ref = staticmethod(native_bt.stream_class_get_ref)
- _put_ref = staticmethod(native_bt.stream_class_put_ref)
+class _StreamClassConst(bt2_object._SharedObject, collections.abc.Mapping):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.stream_class_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.stream_class_put_ref(ptr)
+
_borrow_event_class_ptr_by_id = staticmethod(
native_bt.stream_class_borrow_event_class_by_id_const
)
_clock_class_cls = property(lambda _: bt2_clock_class._ClockClassConst)
def __getitem__(self, key):
- utils._check_int64(key)
+ bt2_utils._check_int64(key)
ec_ptr = self._borrow_event_class_ptr_by_id(self._ptr, key)
if ec_ptr is None:
class _StreamClass(_StreamClassConst):
- _get_ref = staticmethod(native_bt.stream_class_get_ref)
- _put_ref = staticmethod(native_bt.stream_class_put_ref)
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.stream_class_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.stream_class_put_ref(ptr)
+
_borrow_event_class_ptr_by_id = staticmethod(
native_bt.stream_class_borrow_event_class_by_id
)
"id not provided, but stream class does not assign automatic event class ids"
)
- utils._check_uint64(id)
+ bt2_utils._check_uint64(id)
ec_ptr = native_bt.event_class_create_with_id(self._ptr, id)
event_class = bt2_event_class._EventClass._create_from_ptr(ec_ptr)
def _name(self, name):
status = native_bt.stream_class_set_name(self._ptr, name)
- utils._handle_func_status(status, "cannot set stream class object's name")
+ bt2_utils._handle_func_status(status, "cannot set stream class object's name")
_name = property(fset=_name)
status = native_bt.stream_class_set_packet_context_field_class(
self._ptr, packet_context_field_class._ptr
)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot set stream class' packet context field class"
)
def _event_common_context_field_class(self, event_common_context_field_class):
set_context_fn = native_bt.stream_class_set_event_common_context_field_class
status = set_context_fn(self._ptr, event_common_context_field_class._ptr)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot set stream class' event context field type"
)
):
# Name
if name is not None:
- utils._check_str(name)
+ bt2_utils._check_str(name)
# User attributes
if user_attributes is not None:
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
# Packet context field class
if packet_context_field_class is not None:
"cannot have a packet context field class without supporting packets"
)
- utils._check_type(
+ bt2_utils._check_type(
packet_context_field_class, bt2_field_class._StructureFieldClass
)
# Event common context field class
if event_common_context_field_class is not None:
- utils._check_type(
+ bt2_utils._check_type(
event_common_context_field_class, bt2_field_class._StructureFieldClass
)
# Default clock class
if default_clock_class is not None:
- utils._check_type(default_clock_class, bt2_clock_class._ClockClass)
+ bt2_utils._check_type(default_clock_class, bt2_clock_class._ClockClass)
# Assigns automatic event class id
- utils._check_bool(assigns_automatic_event_class_id)
+ bt2_utils._check_bool(assigns_automatic_event_class_id)
# Assigns automatic stream id
- utils._check_bool(assigns_automatic_stream_id)
+ bt2_utils._check_bool(assigns_automatic_stream_id)
# Packets
- utils._check_bool(supports_packets)
- utils._check_bool(packets_have_beginning_default_clock_snapshot)
- utils._check_bool(packets_have_end_default_clock_snapshot)
+ bt2_utils._check_bool(supports_packets)
+ bt2_utils._check_bool(packets_have_beginning_default_clock_snapshot)
+ bt2_utils._check_bool(packets_have_end_default_clock_snapshot)
if not supports_packets:
if packets_have_beginning_default_clock_snapshot:
)
# Discarded events
- utils._check_bool(supports_discarded_events)
- utils._check_bool(discarded_events_have_default_clock_snapshots)
+ bt2_utils._check_bool(supports_discarded_events)
+ bt2_utils._check_bool(discarded_events_have_default_clock_snapshots)
if discarded_events_have_default_clock_snapshots:
if not supports_discarded_events:
)
# Discarded packets
- utils._check_bool(supports_discarded_packets)
- utils._check_bool(discarded_packets_have_default_clock_snapshots)
+ bt2_utils._check_bool(supports_discarded_packets)
+ bt2_utils._check_bool(discarded_packets_have_default_clock_snapshots)
if supports_discarded_packets and not supports_packets:
raise ValueError(
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import native_bt, object, utils
+import uuid as uuidp
+import functools
import collections.abc
+
+from bt2 import error as bt2_error
+from bt2 import utils as bt2_utils
from bt2 import value as bt2_value
+from bt2 import object as bt2_object
from bt2 import stream as bt2_stream
+from bt2 import native_bt
from bt2 import stream_class as bt2_stream_class
-import bt2
-import functools
-import uuid as uuidp
def _bt2_trace_class():
self._trace = trace
def __getitem__(self, key):
- utils._check_str(key)
+ bt2_utils._check_str(key)
borrow_entry_fn = native_bt.trace_borrow_environment_entry_value_by_name_const
value_ptr = borrow_entry_fn(self._trace._ptr, key)
raise TypeError("expected str or int, got {}".format(type(value)))
status = set_env_entry_fn(self._trace._ptr, key, value)
- utils._handle_func_status(status, "cannot set trace object's environment entry")
+ bt2_utils._handle_func_status(
+ status, "cannot set trace object's environment entry"
+ )
def __delitem__(self, key):
raise NotImplementedError
-class _TraceConst(object._SharedObject, collections.abc.Mapping):
- _get_ref = staticmethod(native_bt.trace_get_ref)
- _put_ref = staticmethod(native_bt.trace_put_ref)
+class _TraceConst(bt2_object._SharedObject, collections.abc.Mapping):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.trace_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.trace_put_ref(ptr)
+
_borrow_stream_ptr_by_id = staticmethod(native_bt.trace_borrow_stream_by_id_const)
_borrow_stream_ptr_by_index = staticmethod(
native_bt.trace_borrow_stream_by_index_const
return count
def __getitem__(self, id):
- utils._check_uint64(id)
+ bt2_utils._check_uint64(id)
stream_ptr = self._borrow_stream_ptr_by_id(self._ptr, id)
if not callable(listener):
raise TypeError("'listener' parameter is not callable")
- handle = utils._ListenerHandle(self.addr)
+ handle = bt2_utils._ListenerHandle(self.addr)
fn = native_bt.bt2_trace_add_destruction_listener
listener_from_native = functools.partial(
)
status, listener_id = fn(self._ptr, listener_from_native)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot add destruction listener to trace object"
)
return handle
def remove_destruction_listener(self, listener_handle):
- utils._check_type(listener_handle, utils._ListenerHandle)
+ bt2_utils._check_type(listener_handle, bt2_utils._ListenerHandle)
if listener_handle._addr != self.addr:
raise ValueError(
status = native_bt.trace_remove_destruction_listener(
self._ptr, listener_handle._listener_id
)
- utils._handle_func_status(status)
+ bt2_utils._handle_func_status(status)
listener_handle._invalidate()
_trace_env_pycls = property(lambda _: _TraceEnvironment)
def _name(self, name):
- utils._check_str(name)
+ bt2_utils._check_str(name)
status = native_bt.trace_set_name(self._ptr, name)
- utils._handle_func_status(status, "cannot set trace class object's name")
+ bt2_utils._handle_func_status(status, "cannot set trace class object's name")
_name = property(fset=_name)
def _user_attributes(self, user_attributes):
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
native_bt.trace_set_user_attributes(self._ptr, value._ptr)
_user_attributes = property(fset=_user_attributes)
def _uuid(self, uuid):
- utils._check_type(uuid, uuidp.UUID)
+ bt2_utils._check_type(uuid, uuidp.UUID)
native_bt.trace_set_uuid(self._ptr, uuid.bytes)
_uuid = property(fset=_uuid)
def create_stream(self, stream_class, id=None, name=None, user_attributes=None):
- utils._check_type(stream_class, bt2_stream_class._StreamClass)
+ bt2_utils._check_type(stream_class, bt2_stream_class._StreamClass)
if stream_class.assigns_automatic_stream_id:
if id is not None:
"id not provided, but stream class does not assign automatic stream ids"
)
- utils._check_uint64(id)
+ bt2_utils._check_uint64(id)
stream_ptr = native_bt.stream_create_with_id(
stream_class._ptr, self._ptr, id
)
if stream_ptr is None:
- raise bt2._MemoryError("cannot create stream object")
+ raise bt2_error._MemoryError("cannot create stream object")
stream = bt2_stream._Stream._create_from_ptr(stream_ptr)
# Copyright (c) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
# Copyright (c) 2019 Simon Marchi <simon.marchi@efficios.com>
-from bt2 import native_bt, utils, object
-from bt2 import stream_class as bt2_stream_class
-from bt2 import field_class as bt2_field_class
-from bt2 import integer_range_set as bt2_integer_range_set
+import functools
+import collections.abc
+
+from bt2 import error as bt2_error
from bt2 import trace as bt2_trace
+from bt2 import utils as bt2_utils
from bt2 import value as bt2_value
-import collections.abc
-import functools
-import bt2
+from bt2 import object as bt2_object
+from bt2 import native_bt
+from bt2 import field_class as bt2_field_class
+from bt2 import stream_class as bt2_stream_class
+from bt2 import integer_range_set as bt2_integer_range_set
def _trace_class_destruction_listener_from_native(
handle._invalidate()
-class _TraceClassConst(object._SharedObject, collections.abc.Mapping):
- _get_ref = staticmethod(native_bt.trace_class_get_ref)
- _put_ref = staticmethod(native_bt.trace_class_put_ref)
+class _TraceClassConst(bt2_object._SharedObject, collections.abc.Mapping):
+ @staticmethod
+ def _get_ref(ptr):
+ native_bt.trace_class_get_ref(ptr)
+
+ @staticmethod
+ def _put_ref(ptr):
+ native_bt.trace_class_put_ref(ptr)
+
_borrow_stream_class_ptr_by_index = staticmethod(
native_bt.trace_class_borrow_stream_class_by_index_const
)
# Get a stream class by stream id.
def __getitem__(self, key):
- utils._check_uint64(key)
+ bt2_utils._check_uint64(key)
sc_ptr = self._borrow_stream_class_ptr_by_id(self._ptr, key)
if sc_ptr is None:
# Add a listener to be called when the trace class is destroyed.
def add_destruction_listener(self, listener):
-
if not callable(listener):
raise TypeError("'listener' parameter is not callable")
- handle = utils._ListenerHandle(self.addr)
+ handle = bt2_utils._ListenerHandle(self.addr)
listener_from_native = functools.partial(
_trace_class_destruction_listener_from_native, listener, handle
fn = native_bt.bt2_trace_class_add_destruction_listener
status, listener_id = fn(self._ptr, listener_from_native)
- utils._handle_func_status(
+ bt2_utils._handle_func_status(
status, "cannot add destruction listener to trace class object"
)
return handle
def remove_destruction_listener(self, listener_handle):
- utils._check_type(listener_handle, utils._ListenerHandle)
+ bt2_utils._check_type(listener_handle, bt2_utils._ListenerHandle)
if listener_handle._addr != self.addr:
raise ValueError(
status = native_bt.trace_class_remove_destruction_listener(
self._ptr, listener_handle._listener_id
)
- utils._handle_func_status(status)
+ bt2_utils._handle_func_status(status)
listener_handle._invalidate()
trace_ptr = native_bt.trace_create(self._ptr)
if trace_ptr is None:
- raise bt2._MemoryError("cannot create trace class object")
+ raise bt2_error._MemoryError("cannot create trace class object")
trace = bt2_trace._Trace._create_from_ptr(trace_ptr)
"id not provided, but trace class does not assign automatic stream class ids"
)
- utils._check_uint64(id)
+ bt2_utils._check_uint64(id)
sc_ptr = native_bt.stream_class_create_with_id(self._ptr, id)
sc = bt2_stream_class._StreamClass._create_from_ptr(sc_ptr)
def _user_attributes(self, user_attributes):
value = bt2_value.create_value(user_attributes)
- utils._check_type(value, bt2_value.MapValue)
+ bt2_utils._check_type(value, bt2_value.MapValue)
native_bt.trace_class_set_user_attributes(self._ptr, value._ptr)
_user_attributes = property(fset=_user_attributes)
def _assigns_automatic_stream_class_id(self, auto_id):
- utils._check_bool(auto_id)
+ bt2_utils._check_bool(auto_id)
return native_bt.trace_class_set_assigns_automatic_stream_class_id(
self._ptr, auto_id
)
def _check_field_class_create_status(self, ptr, type_name):
if ptr is None:
- raise bt2._MemoryError("cannot create {} field class".format(type_name))
+ raise bt2_error._MemoryError(
+ "cannot create {} field class".format(type_name)
+ )
@staticmethod
def _set_field_class_user_attrs(fc, user_attributes):
return fc
def create_bit_array_field_class(self, length, user_attributes=None):
- utils._check_uint64(length)
+ bt2_utils._check_uint64(length)
if length < 1 or length > 64:
raise ValueError(
return fc
def create_static_array_field_class(self, elem_fc, length, user_attributes=None):
- utils._check_type(elem_fc, bt2_field_class._FieldClass)
- utils._check_uint64(length)
+ bt2_utils._check_type(elem_fc, bt2_field_class._FieldClass)
+ bt2_utils._check_uint64(length)
ptr = native_bt.field_class_array_static_create(self._ptr, elem_fc._ptr, length)
self._check_field_class_create_status(ptr, "static array")
fc = bt2_field_class._StaticArrayFieldClass._create_from_ptr(ptr)
def create_dynamic_array_field_class(
self, elem_fc, length_fc=None, user_attributes=None
):
- utils._check_type(elem_fc, bt2_field_class._FieldClass)
+ bt2_utils._check_type(elem_fc, bt2_field_class._FieldClass)
length_fc_ptr = None
if length_fc is not None:
- utils._check_type(length_fc, bt2_field_class._UnsignedIntegerFieldClass)
+ bt2_utils._check_type(length_fc, bt2_field_class._UnsignedIntegerFieldClass)
length_fc_ptr = length_fc._ptr
ptr = native_bt.field_class_array_dynamic_create(
def create_option_without_selector_field_class(
self, content_fc, user_attributes=None
):
- utils._check_type(content_fc, bt2_field_class._FieldClass)
+ bt2_utils._check_type(content_fc, bt2_field_class._FieldClass)
ptr = native_bt.field_class_option_without_selector_create(
self._ptr, content_fc._ptr
)
def create_option_with_bool_selector_field_class(
self, content_fc, selector_fc, selector_is_reversed=False, user_attributes=None
):
- utils._check_type(content_fc, bt2_field_class._FieldClass)
- utils._check_bool(selector_is_reversed)
- utils._check_type(selector_fc, bt2_field_class._BoolFieldClass)
+ bt2_utils._check_type(content_fc, bt2_field_class._FieldClass)
+ bt2_utils._check_bool(selector_is_reversed)
+ bt2_utils._check_type(selector_fc, bt2_field_class._BoolFieldClass)
ptr = native_bt.field_class_option_with_selector_field_bool_create(
self._ptr, content_fc._ptr, selector_fc._ptr
)
def create_option_with_integer_selector_field_class(
self, content_fc, selector_fc, ranges, user_attributes=None
):
- utils._check_type(content_fc, bt2_field_class._FieldClass)
- utils._check_type(selector_fc, bt2_field_class._IntegerFieldClass)
+ bt2_utils._check_type(content_fc, bt2_field_class._FieldClass)
+ bt2_utils._check_type(selector_fc, bt2_field_class._IntegerFieldClass)
if len(ranges) == 0:
raise ValueError("integer range set is empty")
if isinstance(selector_fc, bt2_field_class._UnsignedIntegerFieldClass):
- utils._check_type(ranges, bt2_integer_range_set.UnsignedIntegerRangeSet)
+ bt2_utils._check_type(ranges, bt2_integer_range_set.UnsignedIntegerRangeSet)
ptr = native_bt.field_class_option_with_selector_field_integer_unsigned_create(
self._ptr, content_fc._ptr, selector_fc._ptr, ranges._ptr
)
else:
- utils._check_type(ranges, bt2_integer_range_set.SignedIntegerRangeSet)
+ bt2_utils._check_type(ranges, bt2_integer_range_set.SignedIntegerRangeSet)
ptr = (
native_bt.field_class_option_with_selector_field_integer_signed_create(
self._ptr, content_fc._ptr, selector_fc._ptr, ranges._ptr
selector_fc_ptr = None
if selector_fc is not None:
- utils._check_type(selector_fc, bt2_field_class._IntegerFieldClass)
+ bt2_utils._check_type(selector_fc, bt2_field_class._IntegerFieldClass)
selector_fc_ptr = selector_fc._ptr
ptr = native_bt.field_class_variant_create(self._ptr, selector_fc_ptr)
#
# Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
-from bt2 import utils, native_bt
-import bt2
+import numbers
+import datetime
import itertools
-from bt2 import message_iterator as bt2_message_iterator
+from collections import namedtuple
+
+from bt2 import mip as bt2_mip
from bt2 import port as bt2_port
-from bt2 import component as bt2_component
+from bt2 import error as bt2_error
+from bt2 import graph as bt2_graph
+from bt2 import utils as bt2_utils
from bt2 import value as bt2_value
from bt2 import plugin as bt2_plugin
-import datetime
-from collections import namedtuple
-import numbers
-
+from bt2 import logging as bt2_logging
+from bt2 import component as bt2_component
+from bt2 import native_bt
+from bt2 import query_executor as bt2_query_executor
+from bt2 import message_iterator as bt2_message_iterator
+from bt2 import component_descriptor as bt2_component_descriptor
# a pair of component and ComponentSpec
_ComponentAndSpec = namedtuple("_ComponentAndSpec", ["comp", "spec"])
# TraceCollectionMessageIterator.
def __init__(self, params, obj, logging_level):
if logging_level is not None:
- utils._check_log_level(logging_level)
+ bt2_utils._check_log_level(logging_level)
- self._params = bt2.create_value(params)
+ self._params = bt2_value.create_value(params)
self._obj = obj
self._logging_level = logging_level
component_class,
params=None,
obj=None,
- logging_level=bt2.LoggingLevel.NONE,
+ logging_level=bt2_logging.LoggingLevel.NONE,
):
if type(params) is str:
params = {"inputs": [params]}
is_cc_object = isinstance(
component_class,
- (bt2._SourceComponentClassConst, bt2._FilterComponentClassConst),
+ (
+ bt2_component._SourceComponentClassConst,
+ bt2_component._FilterComponentClassConst,
+ ),
)
is_user_cc_type = isinstance(
component_class, bt2_component._UserComponentType
) and issubclass(
- component_class, (bt2._UserSourceComponent, bt2._UserFilterComponent)
+ component_class,
+ (bt2_component._UserSourceComponent, bt2_component._UserFilterComponent),
)
if not is_cc_object and not is_user_cc_type:
component_class_name,
params=None,
obj=None,