Skip to content

Commit 96458d9

Browse files
authored
Merge pull request #856 from flit/bugfix/name_issues
Fix several issues identified by pytype
2 parents eab95aa + d202050 commit 96458d9

File tree

19 files changed

+36
-61
lines changed

19 files changed

+36
-61
lines changed

pyocd/coresight/discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def discover(self):
4848
"""! @brief Init task for component discovery.
4949
@return CallSequence for the discovery process.
5050
"""
51-
raise NotImplementedException()
51+
raise NotImplementedError()
5252

5353
def _create_component(self, cmpid):
5454
LOG.debug("Creating %s component", cmpid.name)

pyocd/coresight/gpr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def factory(cls, ap, cmpid, address):
4444

4545
def __init__(self, ap, cmpid=None, addr=None):
4646
super(GPR, self).__init__(ap, cmpid, addr)
47+
self.domain_count = 0
4748

4849
def init(self):
4950
"""! @brief Inits the GPR."""

pyocd/coresight/itm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def enable(self, enabled_ports=0xffffffff):
9797
self.ap.write32(self.address + ITM.TPR, 0xf) # Allow unprivileged access to all 32 ports.
9898
self._is_enabled = True
9999

100-
def set_enabled_ports(enabled_ports):
100+
def set_enabled_ports(self, enabled_ports):
101101
self.ap.write32(self.address + ITM.TERn, enabled_ports)
102102

103103
def disable(self):

pyocd/flash/eraser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ def _sector_erase(self, addresses):
129129
flash = region.flash
130130
flash.init(flash.Operation.ERASE)
131131

132+
assert flash is not None
133+
132134
# Get sector info for the current address.
133135
sector_info = flash.get_sector_info(sector_addr)
134136
assert sector_info, ("sector address 0x%08x within flash region '%s' is invalid"

pyocd/flash/file_programmer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def __init__(self, session, progress=None, chip_erase=None, smart_flash=None,
8282
self._trust_crc = trust_crc
8383
self._keep_unwritten = keep_unwritten
8484
self._progress = progress
85+
self._loader = None
8586

8687
self._format_handlers = {
8788
'axf': self._program_elf,

pyocd/flash/flash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def __init__(self):
7575

7676
def __repr__(self):
7777
return "<FlashInfo@0x%x start=0x%x erswt=%g crc=%s>" \
78-
% (id(self), self.rom_start, self._erase_weight, self.crc_supported)
78+
% (id(self), self.rom_start, self.erase_weight, self.crc_supported)
7979

8080
class Flash(object):
8181
"""!

pyocd/probe/jlink_probe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
import six
1818
import logging
1919
import pylink
20-
from pylink.errors import JLinkException
20+
from time import sleep
21+
from pylink.errors import (JLinkException, JLinkWriteException, JLinkReadException)
2122

2223
from .debug_probe import DebugProbe
2324
from ..core import (exceptions, memory_interface)
@@ -301,7 +302,7 @@ def read_ap_multiple(self, addr, count=1, now=True):
301302
results = [self.read_ap(addr, now=True) for n in range(count)]
302303

303304
def read_ap_multiple_result_callback():
304-
return result
305+
return results
305306

306307
return results if now else read_ap_multiple_result_callback
307308

pyocd/probe/pydapaccess/interface/hidapi_backend.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self):
4343
super(HidApiUSB, self).__init__()
4444
# Vendor page and usage_id = 2
4545
self.device = None
46+
self.device_info = None
4647

4748
def open(self):
4849
try:
@@ -110,18 +111,8 @@ def read(self, timeout=-1):
110111
# LOG.debug("rcv<(%d) %s" % (len(data), ' '.join(['%02x' % i for i in data])))
111112
return data
112113

113-
def get_serial_number(self):
114-
return self.serial_number
115-
116114
def close(self):
117115
"""! @brief Close the interface
118116
"""
119117
LOG.debug("closing interface")
120118
self.device.close()
121-
122-
def set_packet_count(self, count):
123-
# No interface level restrictions on count
124-
self.packet_count = count
125-
126-
def set_packet_size(self, size):
127-
self.packet_size = size

pyocd/probe/pydapaccess/interface/interface.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self):
2222
self.pid = 0
2323
self.vendor_name = ""
2424
self.product_name = ""
25+
self.serial_number = ""
2526
self.packet_count = 1
2627
self.packet_size = 64
2728

@@ -32,6 +33,9 @@ def has_swo_ep(self):
3233
def open(self):
3334
return
3435

36+
def close(self):
37+
return
38+
3539
def write(self, data):
3640
return
3741

@@ -44,12 +48,15 @@ def get_info(self):
4448
str(hex(self.vid)) + ", " + \
4549
str(hex(self.pid)) + ")"
4650

47-
def set_packet_count(self, count):
48-
# Unless overridden the packet count cannot be changed
49-
return
50-
5151
def get_packet_count(self):
5252
return self.packet_count
5353

54-
def close(self):
55-
return
54+
def set_packet_count(self, count):
55+
# No interface level restrictions on count
56+
self.packet_count = count
57+
58+
def set_packet_size(self, size):
59+
self.packet_size = size
60+
61+
def get_serial_number(self):
62+
return self.serial_number

pyocd/probe/pydapaccess/interface/pyusb_backend.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,16 +193,6 @@ def read(self):
193193
self.serial_number)
194194
return self.rcv_data.pop(0)
195195

196-
def set_packet_count(self, count):
197-
# No interface level restrictions on count
198-
self.packet_count = count
199-
200-
def set_packet_size(self, size):
201-
self.packet_size = size
202-
203-
def get_serial_number(self):
204-
return self.serial_number
205-
206196
def close(self):
207197
"""! @brief Close the interface
208198
"""

0 commit comments

Comments
 (0)