Using the babeltrace Python module with Python 3.3-3.8 gives a warning:
/usr/lib/python3/dist-packages/babeltrace/babeltrace.py:811:
DeprecationWarning: Using or importing the ABCs from 'collections'
instead of from 'collections.abc' is deprecated since Python 3.3,
and in 3.9 it will stop working
Therefore, for forward compability (Python 3.9+), try importing it
using the new way first. Otherwise, fall back on the old way.
Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
Change-Id: I7f650593a013643b2fb0b77b0d388cf57bc2b765
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
_scopes = [CTFScope.EVENT_FIELDS, CTFScope.EVENT_CONTEXT, CTFScope.STREAM_EVENT_CONTEXT,
CTFScope.STREAM_EVENT_HEADER, CTFScope.STREAM_PACKET_CONTEXT, CTFScope.TRACE_PACKET_HEADER]
-import collections
-class Event(collections.Mapping):
+try:
+ import collections.abc as collections_abc
+except ImportError:
+ import collections as collections_abc # Fallback for Python 3.2
+class Event(collections_abc.Mapping):
"""
This class represents an event from the trace.
It is obtained using the TraceCollection generator functions.