Skip to content

Commit

Permalink
chore: change for loop by list slicing
Browse files Browse the repository at this point in the history
  • Loading branch information
yannpoupon committed Aug 2, 2023
1 parent 631f7be commit 0f24500
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions can/interfaces/pcan/pcan.py
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,7 @@ def send(self, msg, timeout=None):
CANMsg.MSGTYPE = msgType

# copy data
for i in range(msg.dlc):
CANMsg.DATA[i] = msg.data[i]
CANMsg.DATA[: msg.dlc] = msg.data[: msg.dlc]

log.debug("Data: %s", msg.data)
log.debug("Type: %s", type(msg.data))
Expand All @@ -628,8 +627,7 @@ def send(self, msg, timeout=None):
# if a remote frame will be sent, data bytes are not important.
if not msg.is_remote_frame:
# copy data
for i in range(CANMsg.LEN):
CANMsg.DATA[i] = msg.data[i]
CANMsg.DATA[: CANMsg.LEN] = msg.data[: CANMsg.LEN]

log.debug("Data: %s", msg.data)
log.debug("Type: %s", type(msg.data))
Expand Down

0 comments on commit 0f24500

Please sign in to comment.