Skip to content

Commit 22f3cf6

Browse files
committed
cleanup code
1 parent 7cdea46 commit 22f3cf6

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/urh/models/GeneratorTableModel.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import array
2-
import time
32
from collections import defaultdict
43

54
from PyQt5.QtCore import Qt, QModelIndex, pyqtSlot, pyqtSignal
@@ -17,6 +16,7 @@
1716
from urh.ui.actions.DeleteBitsAndPauses import DeleteBitsAndPauses
1817
from urh.ui.actions.InsertBitsAndPauses import InsertBitsAndPauses
1918
from urh.util import util
19+
from urh.cythonext import util as c_util
2020

2121

2222
class GeneratorTableModel(TableModel):
@@ -147,7 +147,7 @@ def generate_de_bruijn(self, row_index: int, start: int, end: int):
147147
f = 1 if self.proto_view == 0 else 4 if self.proto_view == 1 else 8
148148
start, end = f * start, f * end
149149

150-
de_bruijn_seq = util.de_bruijn(end-start)
150+
de_bruijn_seq = c_util.de_bruijn(end-start)
151151

152152
tmp_protocol = ProtocolAnalyzer(None)
153153
tmp_protocol.messages = []

src/urh/util/util.py

-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import time
88
from xml.dom import minidom
99
from xml.etree import ElementTree as ET
10-
import urh.cythonext.util as c_util
1110

1211
import numpy as np
1312
from PyQt5.QtCore import Qt
@@ -473,7 +472,3 @@ def calc_x_y_scale(rect, parent):
473472
scale_y = view_rect.height() / parent_height
474473

475474
return scale_x, scale_y
476-
477-
478-
def de_bruijn(n: int) -> array.array:
479-
return c_util.de_bruijn(n)

tests/test_util.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from urh.signalprocessing.Signal import Signal
1414
from urh.util import util
1515
from urh.util.Logger import logger
16+
from urh.cythonext import util as c_util
1617

1718

1819
class TestUtil(QtTestCase):
@@ -71,8 +72,8 @@ def test_write_pcap(self):
7172
pcap.write_packets(proto_analyzer.messages, os.path.join(tempfile.gettempdir(), "test.pcap"), 1e6)
7273

7374
def test_de_bruijn_fuzzing(self):
74-
self.assertEqual(util.de_bruijn(3), array.array("B", [0, 0, 0, 1, 0, 1, 1, 1]))
75-
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]))
75+
self.assertEqual(c_util.de_bruijn(3), array.array("B", [0, 0, 0, 1, 0, 1, 1, 1]))
76+
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]))
7677

7778
def test_native_backends_installed(self):
7879
from urh.util import util

0 commit comments

Comments
 (0)