Skip to content

Commit e20e47b

Browse files
authored
Merge branch 'develop' into felixdivo-fix-1275
2 parents 76f05c5 + af55b0a commit e20e47b

File tree

9 files changed

+11
-9
lines changed

9 files changed

+11
-9
lines changed

can/interfaces/neousys/neousys.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class NeousysCanBitClk(Structure):
131131
NEOUSYS_CANLIB = CDLL("libwdt_dio.so")
132132
logger.info("Loaded Neousys WDT_DIO Can driver")
133133
except OSError as error:
134-
logger.info("Cannot load Neousys CAN bus dll or shared object: %d", format(error))
134+
logger.info("Cannot load Neousys CAN bus dll or shared object: %s", error)
135135

136136

137137
class NeousysBus(BusABC):

can/interfaces/socketcan/constants.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858

5959
CANFD_MTU = 72
6060

61-
STD_ACCEPTANCE_MASK_ALL_BITS = 2 ** 11 - 1
61+
STD_ACCEPTANCE_MASK_ALL_BITS = 2**11 - 1
6262
MAX_11_BIT_ID = STD_ACCEPTANCE_MASK_ALL_BITS
6363

64-
EXT_ACCEPTANCE_MASK_ALL_BITS = 2 ** 29 - 1
64+
EXT_ACCEPTANCE_MASK_ALL_BITS = 2**29 - 1
6565
MAX_29_BIT_ID = EXT_ACCEPTANCE_MASK_ALL_BITS

can/interfaces/socketcan/socketcan.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ def _send_periodic_internal(
829829

830830
def _get_next_task_id(self) -> int:
831831
with self._task_id_guard:
832-
self._task_id = (self._task_id + 1) % (2 ** 32 - 1)
832+
self._task_id = (self._task_id + 1) % (2**32 - 1)
833833
return self._task_id
834834

835835
def _get_bcm_socket(self, channel: str) -> socket.socket:

can/interfaces/systec/ucan.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def check_result(result, func, arguments):
120120

121121
try:
122122
# Select the proper dll architecture
123-
lib = WinDLL("usbcan64.dll" if sys.maxsize > 2 ** 32 else "usbcan32.dll")
123+
lib = WinDLL("usbcan64.dll" if sys.maxsize > 2**32 else "usbcan32.dll")
124124

125125
# BOOL PUBLIC UcanSetDebugMode (DWORD dwDbgLevel_p, _TCHAR* pszFilePathName_p, DWORD dwFlags_p);
126126
UcanSetDebugMode = lib.UcanSetDebugMode

can/interfaces/vector/canlib.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __init__(
8282
poll_interval: float = 0.01,
8383
receive_own_messages: bool = False,
8484
bitrate: Optional[int] = None,
85-
rx_queue_size: int = 2 ** 14,
85+
rx_queue_size: int = 2**14,
8686
app_name: Optional[str] = "CANalyzer",
8787
serial: Optional[int] = None,
8888
fd: bool = False,

can/io/canutils.py

+2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ def on_message_received(self, msg):
160160
timestamp = msg.timestamp
161161

162162
channel = msg.channel if msg.channel is not None else self.channel
163+
if isinstance(channel, int) or isinstance(channel, str) and channel.isdigit():
164+
channel = f"can{channel}"
163165

164166
framestr = "(%f) %s" % (timestamp, channel)
165167

requirements-lint.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
pylint==2.12.2
2-
black==22.3.0
2+
black~=22.3.0
33
mypy==0.931
44
mypy-extensions==0.4.3
55
types-setuptools

test/data/example_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def generate_message(arbitration_id):
179179
Generates a new message with the given ID, some random data
180180
and a non-extended ID.
181181
"""
182-
data = bytearray([random.randrange(0, 2 ** 8 - 1) for _ in range(8)])
182+
data = bytearray([random.randrange(0, 2**8 - 1) for _ in range(8)])
183183
return Message(
184184
arbitration_id=arbitration_id,
185185
data=data,

test/network_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ControllerAreaNetworkTestCase(unittest.TestCase):
3838

3939
ids = list(range(num_messages))
4040
data = list(
41-
bytearray([random.randrange(0, 2 ** 8 - 1) for a in range(random.randrange(9))])
41+
bytearray([random.randrange(0, 2**8 - 1) for a in range(random.randrange(9))])
4242
for b in range(num_messages)
4343
)
4444

0 commit comments

Comments
 (0)