From 22f3cf6891ba579b8de4f3f90f4d295f9bd81d08 Mon Sep 17 00:00:00 2001 From: jopohl Date: Tue, 7 Jul 2020 20:50:43 +0200 Subject: [PATCH] cleanup code --- src/urh/models/GeneratorTableModel.py | 4 ++-- src/urh/util/util.py | 5 ----- tests/test_util.py | 5 +++-- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/urh/models/GeneratorTableModel.py b/src/urh/models/GeneratorTableModel.py index f458a6b171..c9b725aaf3 100644 --- a/src/urh/models/GeneratorTableModel.py +++ b/src/urh/models/GeneratorTableModel.py @@ -1,5 +1,4 @@ import array -import time from collections import defaultdict from PyQt5.QtCore import Qt, QModelIndex, pyqtSlot, pyqtSignal @@ -17,6 +16,7 @@ from urh.ui.actions.DeleteBitsAndPauses import DeleteBitsAndPauses from urh.ui.actions.InsertBitsAndPauses import InsertBitsAndPauses from urh.util import util +from urh.cythonext import util as c_util class GeneratorTableModel(TableModel): @@ -147,7 +147,7 @@ def generate_de_bruijn(self, row_index: int, start: int, end: int): f = 1 if self.proto_view == 0 else 4 if self.proto_view == 1 else 8 start, end = f * start, f * end - de_bruijn_seq = util.de_bruijn(end-start) + de_bruijn_seq = c_util.de_bruijn(end-start) tmp_protocol = ProtocolAnalyzer(None) tmp_protocol.messages = [] diff --git a/src/urh/util/util.py b/src/urh/util/util.py index 6a9ebe645d..caab18feb7 100644 --- a/src/urh/util/util.py +++ b/src/urh/util/util.py @@ -7,7 +7,6 @@ import time from xml.dom import minidom from xml.etree import ElementTree as ET -import urh.cythonext.util as c_util import numpy as np from PyQt5.QtCore import Qt @@ -473,7 +472,3 @@ def calc_x_y_scale(rect, parent): scale_y = view_rect.height() / parent_height return scale_x, scale_y - - -def de_bruijn(n: int) -> array.array: - return c_util.de_bruijn(n) diff --git a/tests/test_util.py b/tests/test_util.py index b3cedeaa32..e5adaa40e2 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -13,6 +13,7 @@ from urh.signalprocessing.Signal import Signal from urh.util import util from urh.util.Logger import logger +from urh.cythonext import util as c_util class TestUtil(QtTestCase): @@ -71,8 +72,8 @@ def test_write_pcap(self): pcap.write_packets(proto_analyzer.messages, os.path.join(tempfile.gettempdir(), "test.pcap"), 1e6) def test_de_bruijn_fuzzing(self): - self.assertEqual(util.de_bruijn(3), array.array("B", [0, 0, 0, 1, 0, 1, 1, 1])) - self.assertEqual(util.de_bruijn(4), array.array("B", [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1])) + self.assertEqual(c_util.de_bruijn(3), array.array("B", [0, 0, 0, 1, 0, 1, 1, 1])) + self.assertEqual(c_util.de_bruijn(4), array.array("B", [0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1])) def test_native_backends_installed(self): from urh.util import util