Skip to content

Commit 4096817

Browse files
authored
Update linters (#1534)
* update black to 23.1.0 * update mypy to 1.0.1 * update pylint to 2.16.4 * remove useless suppression * fix warning
1 parent 75fdfe4 commit 4096817

34 files changed

+11
-59
lines changed

.pylintrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,5 +498,5 @@ min-public-methods=2
498498

499499
# Exceptions that will emit a warning when being caught. Defaults to
500500
# "BaseException, Exception".
501-
overgeneral-exceptions=BaseException,
502-
Exception
501+
overgeneral-exceptions=builtins.BaseException,
502+
builtins.Exception

can/bus.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ def recv(self, timeout: Optional[float] = None) -> Optional[Message]:
9393
time_left = timeout
9494

9595
while True:
96-
9796
# try to get a message
9897
msg, already_filtered = self._recv_internal(timeout=time_left)
9998

@@ -109,7 +108,6 @@ def recv(self, timeout: Optional[float] = None) -> Optional[Message]:
109108
# try next one only if there still is time, and with
110109
# reduced timeout
111110
else:
112-
113111
time_left = timeout - (time() - start)
114112

115113
if time_left > 0:

can/interface.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ def detect_available_configs(
171171

172172
result = []
173173
for interface in interfaces:
174-
175174
try:
176175
bus_class = _get_class_for_interface(interface)
177176
except CanInterfaceNotImplementedError:

can/interfaces/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@
3535
if sys.version_info >= (3, 8):
3636
from importlib.metadata import entry_points
3737

38-
# See https://docs.python.org/3/library/importlib.metadata.html#entry-points, "Compatibility Note".
38+
# See https://docs.python.org/3/library/importlib.metadata.html#entry-points,
39+
# "Compatibility Note".
3940
if sys.version_info >= (3, 10):
4041
BACKENDS.update(
4142
{

can/interfaces/ics_neovi/neovi_bus.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
try:
4141
from filelock import FileLock
4242
except ImportError as ie:
43-
4443
logger.warning(
4544
"Using ICS neoVI can backend without the "
4645
"filelock module installed may cause some issues!: %s",

can/interfaces/iscan.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ def shutdown(self) -> None:
157157

158158

159159
class IscanError(CanError):
160-
161160
ERROR_CODES = {
162161
0: "Success",
163162
1: "No access to device",

can/interfaces/pcan/basic.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,7 @@ class TPCANChannelInformation(Structure):
670670
# PCAN-Basic API function declarations
671671
# ///////////////////////////////////////////////////////////
672672

673+
673674
# PCAN-Basic API class implementation
674675
#
675676
class PCANBasic:
@@ -719,7 +720,6 @@ def Initialize(
719720
IOPort=c_uint(0),
720721
Interrupt=c_ushort(0),
721722
):
722-
723723
"""Initializes a PCAN Channel
724724
725725
Parameters:
@@ -744,7 +744,6 @@ def Initialize(
744744
# Initializes a FD capable PCAN Channel
745745
#
746746
def InitializeFD(self, Channel, BitrateFD):
747-
748747
"""Initializes a FD capable PCAN Channel
749748
750749
Parameters:
@@ -775,7 +774,6 @@ def InitializeFD(self, Channel, BitrateFD):
775774
# Uninitializes one or all PCAN Channels initialized by CAN_Initialize
776775
#
777776
def Uninitialize(self, Channel):
778-
779777
"""Uninitializes one or all PCAN Channels initialized by CAN_Initialize
780778
781779
Remarks:
@@ -797,7 +795,6 @@ def Uninitialize(self, Channel):
797795
# Resets the receive and transmit queues of the PCAN Channel
798796
#
799797
def Reset(self, Channel):
800-
801798
"""Resets the receive and transmit queues of the PCAN Channel
802799
803800
Remarks:
@@ -819,7 +816,6 @@ def Reset(self, Channel):
819816
# Gets the current status of a PCAN Channel
820817
#
821818
def GetStatus(self, Channel):
822-
823819
"""Gets the current status of a PCAN Channel
824820
825821
Parameters:
@@ -838,7 +834,6 @@ def GetStatus(self, Channel):
838834
# Reads a CAN message from the receive queue of a PCAN Channel
839835
#
840836
def Read(self, Channel):
841-
842837
"""Reads a CAN message from the receive queue of a PCAN Channel
843838
844839
Remarks:
@@ -867,7 +862,6 @@ def Read(self, Channel):
867862
# Reads a CAN message from the receive queue of a FD capable PCAN Channel
868863
#
869864
def ReadFD(self, Channel):
870-
871865
"""Reads a CAN message from the receive queue of a FD capable PCAN Channel
872866
873867
Remarks:
@@ -896,7 +890,6 @@ def ReadFD(self, Channel):
896890
# Transmits a CAN message
897891
#
898892
def Write(self, Channel, MessageBuffer):
899-
900893
"""Transmits a CAN message
901894
902895
Parameters:
@@ -916,7 +909,6 @@ def Write(self, Channel, MessageBuffer):
916909
# Transmits a CAN message over a FD capable PCAN Channel
917910
#
918911
def WriteFD(self, Channel, MessageBuffer):
919-
920912
"""Transmits a CAN message over a FD capable PCAN Channel
921913
922914
Parameters:
@@ -936,7 +928,6 @@ def WriteFD(self, Channel, MessageBuffer):
936928
# Configures the reception filter
937929
#
938930
def FilterMessages(self, Channel, FromID, ToID, Mode):
939-
940931
"""Configures the reception filter
941932
942933
Remarks:
@@ -963,7 +954,6 @@ def FilterMessages(self, Channel, FromID, ToID, Mode):
963954
# Retrieves a PCAN Channel value
964955
#
965956
def GetValue(self, Channel, Parameter):
966-
967957
"""Retrieves a PCAN Channel value
968958
969959
Remarks:
@@ -1026,7 +1016,6 @@ def GetValue(self, Channel, Parameter):
10261016
# error code, in any desired language
10271017
#
10281018
def SetValue(self, Channel, Parameter, Buffer):
1029-
10301019
"""Returns a descriptive text of a given TPCANStatus error
10311020
code, in any desired language
10321021
@@ -1069,7 +1058,6 @@ def SetValue(self, Channel, Parameter, Buffer):
10691058
raise
10701059

10711060
def GetErrorText(self, Error, Language=0):
1072-
10731061
"""Configures or sets a PCAN Channel value
10741062
10751063
Remarks:
@@ -1098,7 +1086,6 @@ def GetErrorText(self, Error, Language=0):
10981086
raise
10991087

11001088
def LookUpChannel(self, Parameters):
1101-
11021089
"""Finds a PCAN-Basic channel that matches with the given parameters
11031090
11041091
Remarks:

can/interfaces/serial/serial_can.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ def _recv_internal(
175175
try:
176176
rx_byte = self._ser.read()
177177
if rx_byte and ord(rx_byte) == 0xAA:
178-
179178
s = self._ser.read(4)
180179
timestamp = struct.unpack("<I", s)[0]
181180
dlc = ord(self._ser.read())

can/interfaces/slcan.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ def close(self) -> None:
193193
def _recv_internal(
194194
self, timeout: Optional[float]
195195
) -> Tuple[Optional[Message], bool]:
196-
197196
canId = None
198197
remote = False
199198
extended = False

can/interfaces/udp_multicast/bus.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ def _create_socket(self, address_family: socket.AddressFamily) -> socket.socket:
239239

240240
# configure the socket
241241
try:
242-
243242
# set hop limit / TTL
244243
ttl_as_binary = struct.pack("@I", self.hop_limit)
245244
if self.ip_version == 4:

0 commit comments

Comments
 (0)