Skip to content

Commit 3685e06

Browse files
committed
Removed need for six.
1 parent 03a1784 commit 3685e06

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

pyocd_pemicro/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
#
33
# Copyright © 2020 NXP
4-
# Copyright @ 2020 Chris Reed
4+
# Copyright © 2020 Chris Reed
55
#
66
# SPDX-License-Identifier: BSD-3-Clause
77
#

pyocd_pemicro/pemicro_probe.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
#
33
# Copyright © 2020 NXP
4-
# Copyright © 2020 Chris Reed
4+
# Copyright © 2020-2021 Chris Reed
55
#
66
# SPDX-License-Identifier: BSD-3-Clause
77
#
@@ -30,7 +30,6 @@
3030
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
3131
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232

33-
import six
3433
from pypemicro import PyPemicro, PEMicroException, PEMicroTransferException, PEMicroInterfaces
3534
import logging
3635
from time import sleep
@@ -88,7 +87,7 @@ def get_all_connected_probes(cls, unique_id=None, is_explicit=False):
8887
# the PEMicro library but on which the plugin is installed.
8988
if cls.NO_LIBRARY_ERR in str(exc):
9089
return []
91-
six.raise_from(cls._convert_exception(exc), exc)
90+
raise cls._convert_exception(exc) from exc
9291

9392
@classmethod
9493
def get_probe_with_id(cls, unique_id, is_explicit=False):
@@ -106,7 +105,7 @@ def get_probe_with_id(cls, unique_id, is_explicit=False):
106105
# the PEMicro library but on which the plugin is installed.
107106
if cls.NO_LIBRARY_ERR in str(exc):
108107
return None
109-
six.raise_from(cls._convert_exception(exc), exc)
108+
raise cls._convert_exception(exc) from exc
110109

111110
def __init__(self, serial_number):
112111
super(PEMicroProbe, self).__init__()
@@ -126,7 +125,7 @@ def __init__(self, serial_number):
126125
self._product_name = self._pemicro.version() or "Unknown"
127126
self._pemicro.close()
128127
except PEMicroException as exc:
129-
six.raise_from(self._convert_exception(exc), exc)
128+
raise cls._convert_exception(exc) from exc
130129

131130
@property
132131
def description(self):
@@ -178,14 +177,14 @@ def open(self):
178177
self._default_protocol = DebugProbe.Protocol.SWD
179178

180179
except PEMicroException as exc:
181-
six.raise_from(self._convert_exception(exc), exc)
180+
raise cls._convert_exception(exc) from exc
182181

183182
def close(self):
184183
try:
185184
self._pemicro.close()
186185
self._is_open = False
187186
except PEMicroException as exc:
188-
six.raise_from(self._convert_exception(exc), exc)
187+
raise cls._convert_exception(exc) from exc
189188

190189
# ------------------------------------------- #
191190
# Target control functions
@@ -219,7 +218,7 @@ def connect(self, protocol=None):
219218
self._pemicro.connect(iface, self.session.options.get("swv_clock"))
220219
self._protocol = protocol
221220
except PEMicroException as exc:
222-
six.raise_from(self._convert_exception(exc), exc)
221+
raise cls._convert_exception(exc) from exc
223222

224223
def swj_sequence(self, length, bits):
225224
raise NotImplementedError()
@@ -232,7 +231,7 @@ def set_clock(self, frequency):
232231
try:
233232
self._pemicro.set_debug_frequency(frequency)
234233
except PEMicroException as exc:
235-
six.raise_from(self._convert_exception(exc), exc)
234+
raise cls._convert_exception(exc) from exc
236235

237236
def reset(self):
238237
try:
@@ -259,14 +258,14 @@ def reset(self):
259258
sleep(self.session.options.get('reset.post_delay'))
260259

261260
except PEMicroException as exc:
262-
six.raise_from(self._convert_exception(exc), exc)
261+
raise cls._convert_exception(exc) from exc
263262

264263
def assert_reset(self, asserted=False):
265264
try:
266265
self._pemicro.control_reset_line(asserted)
267266
self.reset_pin_state = not asserted
268267
except PEMicroException as exc:
269-
six.raise_from(self._convert_exception(exc), exc)
268+
raise cls._convert_exception(exc) from exc
270269

271270
def is_reset_asserted(self):
272271
return not self.reset_pin_state
@@ -278,13 +277,13 @@ def flush(self):
278277
try:
279278
self._pemicro.flush_any_queued_data()
280279
except Exception as exc:
281-
six.raise_from(self._convert_exception(exc), exc)
280+
raise cls._convert_exception(exc) from exc
282281

283282
def read_dp(self, addr, now=True):
284283
try:
285284
value = self._pemicro.read_dp_register(addr=addr, now=now)
286285
except PEMicroTransferException as exc:
287-
six.raise_from(self._convert_exception(exc), exc)
286+
raise cls._convert_exception(exc) from exc
288287
else:
289288
def read_reg_cb():
290289
return value
@@ -295,26 +294,26 @@ def write_dp(self, addr, data, now = True):
295294
try:
296295
self._pemicro.write_dp_register(addr=addr, value=data)
297296
except PEMicroTransferException as exc:
298-
six.raise_from(self._convert_exception(exc), exc)
297+
raise cls._convert_exception(exc) from exc
299298

300299
def read_ap(self, addr, now=True):
301-
assert type(addr) in (six.integer_types)
300+
assert isinstance(addr, int)
302301
try:
303302
value = self._pemicro.read_ap_register(addr=(addr & self.APADDR), now=now, apselect= ((addr & self.APSEL_APBANKSEL) >> self.APSEL_SHIFT))
304303
except PEMicroTransferException as exc:
305-
six.raise_from(self._convert_exception(exc), exc)
304+
raise cls._convert_exception(exc) from exc
306305
else:
307306
def read_reg_cb():
308307
return value
309308

310309
return value if now else read_reg_cb
311310

312311
def write_ap(self, addr, data, now = True):
313-
assert type(addr) in (six.integer_types)
312+
assert isinstance(addr, int)
314313
try:
315314
self._pemicro.write_ap_register(addr=(addr & self.APADDR), value=data, apselect=((addr & self.APSEL_APBANKSEL) >> self.APSEL_SHIFT))
316315
except PEMicroTransferException as exc:
317-
six.raise_from(self._convert_exception(exc), exc)
316+
raise cls._convert_exception(exc) from exc
318317

319318
def read_ap_multiple(self, addr, count=1, now=True):
320319
results = [self.read_ap(addr, True) for n in range(count)]

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
],
7676
install_requires = [
7777
'pypemicro>=0.1.5',
78-
'six>=1.0,<2.0',
7978
],
8079
entry_points={
8180
'pyocd.probe': [

0 commit comments

Comments
 (0)