From: Simon Marchi Date: Mon, 29 Apr 2019 21:03:44 +0000 (-0400) Subject: Remove clock_class_priority_map.py X-Git-Tag: v2.0.0-pre5~38 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=f5a05aa251877738285d55225155720f88e7cd99 Remove clock_class_priority_map.py This concept no longer exists in the BT api, and therefore this file won't be needed anymore. Change-Id: Ib298f5463ee701be3a0a5b3d4b37b6e7ecf8d5b3 Signed-off-by: Simon Marchi Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/452469 Reviewed-by: Philippe Proulx Tested-by: Philippe Proulx --- diff --git a/bindings/python/bt2/Makefile.am b/bindings/python/bt2/Makefile.am index a1d3b1ae..6482d0c2 100644 --- a/bindings/python/bt2/Makefile.am +++ b/bindings/python/bt2/Makefile.am @@ -33,7 +33,6 @@ STATIC_BINDINGS_DEPS = \ bt2/native_bt_trace.i \ bt2/native_bt_value.i \ bt2/native_bt_version.i \ - bt2/clock_class_priority_map.py \ bt2/clock_class.py \ bt2/clock_snapshot.py \ bt2/component.py \ diff --git a/bindings/python/bt2/bt2/__init__.py.in b/bindings/python/bt2/bt2/__init__.py.in index 8e26fc73..6a4ead01 100644 --- a/bindings/python/bt2/bt2/__init__.py.in +++ b/bindings/python/bt2/bt2/__init__.py.in @@ -24,7 +24,6 @@ __version__ = '@PACKAGE_VERSION@' from bt2.clock_class import * -from bt2.clock_class_priority_map import * from bt2.clock_snapshot import * from bt2.component import * from bt2.component import _FilterComponent diff --git a/bindings/python/bt2/bt2/clock_class_priority_map.py b/bindings/python/bt2/bt2/clock_class_priority_map.py deleted file mode 100644 index af4ac26f..00000000 --- a/bindings/python/bt2/bt2/clock_class_priority_map.py +++ /dev/null @@ -1,129 +0,0 @@ -# The MIT License (MIT) -# -# Copyright (c) 2017 Philippe Proulx -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. - -from bt2 import native_bt, object, utils -import collections.abc -import bt2.clock_class -import copy -import bt2 - - -class _ClockClassIterator(collections.abc.Iterator): - def __init__(self, cc_prio_map): - self._cc_prio_map = cc_prio_map - self._at = 0 - - def __next__(self): - if self._at == len(self._cc_prio_map): - raise StopIteration - - cc_ptr = native_bt.clock_class_priority_map_get_clock_class_by_index(self._cc_prio_map._ptr, - self._at) - assert(cc_ptr) - clock_class = bt2.ClockClass._create_from_ptr(cc_ptr) - self._at += 1 - return clock_class - - -class ClockClassPriorityMap(object._Object, collections.abc.MutableMapping): - def __init__(self, clock_class_priorities=None): - ptr = native_bt.clock_class_priority_map_create() - - if ptr is None: - raise bt2.CreationError('cannot create clock class priority map object') - - super().__init__(ptr) - - if clock_class_priorities is not None: - for clock_class, priority in clock_class_priorities.items(): - self[clock_class] = priority - - def __getitem__(self, key): - utils._check_type(key, bt2.ClockClass) - ret, prio = native_bt.clock_class_priority_map_get_clock_class_priority(self._ptr, - key._ptr) - - if ret != 0: - raise KeyError(key) - - return prio - - def __len__(self): - count = native_bt.clock_class_priority_map_get_clock_class_count(self._ptr) - assert(count >= 0) - return count - - def __delitem__(self): - raise NotImplementedError - - def __setitem__(self, key, value): - utils._check_type(key, bt2.ClockClass) - utils._check_uint64(value) - ret = native_bt.clock_class_priority_map_add_clock_class(self._ptr, - key._ptr, - value) - utils._handle_ret(ret, "cannot set clock class's priority in clock class priority map object") - - def __iter__(self): - return _ClockClassIterator(self) - - @property - def highest_priority_clock_class(self): - cc_ptr = native_bt.clock_class_priority_map_get_highest_priority_clock_class(self._ptr) - - if cc_ptr is None: - return - - return bt2.ClockClass._create_from_ptr(cc_ptr) - - def _get_prios(self): - prios = {} - - for clock_class, prio in self.items(): - prios[clock_class] = prio - - return prios - - def __eq__(self, other): - if type(other) is not type(self): - return False - - if self.addr == other.addr: - return True - - return self._get_prios() == other._get_prios() - - def _copy(self, cc_copy_func): - cpy = ClockClassPriorityMap() - - for clock_class, prio in self.items(): - cpy[cc_copy_func(clock_class)] = prio - - return cpy - - def __copy__(self): - return self._copy(lambda obj: obj) - - def __deepcopy__(self, memo): - cpy = self._copy(copy.deepcopy) - memo[id(self)] = cpy - return cpy diff --git a/bindings/python/bt2/bt2/message.py b/bindings/python/bt2/bt2/message.py index 4ffc5030..236ddd89 100644 --- a/bindings/python/bt2/bt2/message.py +++ b/bindings/python/bt2/bt2/message.py @@ -21,7 +21,6 @@ # THE SOFTWARE. from bt2 import native_bt, object, utils -import bt2.clock_class_priority_map import bt2.clock_snapshot import collections import bt2.packet diff --git a/tests/bindings/python/bt2/Makefile.am b/tests/bindings/python/bt2/Makefile.am index bda53f93..72361a1a 100644 --- a/tests/bindings/python/bt2/Makefile.am +++ b/tests/bindings/python/bt2/Makefile.am @@ -1,6 +1,5 @@ EXTRA_DIST = \ test_clock_class.py \ - test_clock_class_priority_map.py \ test_component.py \ test_component_class.py \ test_connection.py \