Skip to content

Commit 53724a6

Browse files
committed
fix other linter stuff
1 parent 29349ec commit 53724a6

File tree

12 files changed

+13
-79
lines changed

12 files changed

+13
-79
lines changed

.pylintrc-wip

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -75,46 +75,13 @@ disable=blacklisted-name,
7575
wrong-import-order,
7676
ungrouped-imports,
7777
wrong-import-position,
78-
too-many-star-expressions,
79-
invalid-star-assignment-target,
8078
method-hidden,
81-
access-member-before-definition,
82-
no-method-argument,
83-
no-self-argument,
84-
invalid-slots-object,
85-
assigning-non-slot,
86-
duplicate-bases,
87-
non-iterator-returned,
88-
unexpected-special-method-signature,
89-
invalid-length-returned,
90-
import-error,
91-
relative-beyond-top-level,
92-
used-before-assignment,
93-
undefined-variable,
94-
undefined-all-variable,
95-
invalid-all-object,
96-
no-name-in-module,
97-
unpacking-non-sequence,
98-
bad-exception-context,
9979
misplaced-bare-raise,
100-
raising-non-exception,
101-
notimplemented-raised,
102-
catching-non-exception,
103-
no-value-for-parameter,
10480
too-many-function-args,
105-
unexpected-keyword-arg,
106-
redundant-keyword-arg,
10781
print-statement,
108-
parameter-unpacking,
109-
unpacking-in-except,
11082
import-star-module-level,
111-
yield-inside-async-function,
11283
locally-disabled,
113-
file-ignored,
11484
no-self-use,
115-
useless-object-inheritance,
116-
cyclic-import,
117-
duplicate-code,
11885
too-many-ancestors,
11986
too-many-instance-attributes,
12087
too-few-public-methods,
@@ -125,22 +92,7 @@ disable=blacklisted-name,
12592
too-many-locals,
12693
too-many-statements,
12794
too-many-nested-blocks,
128-
inconsistent-return-statements,
12995
no-else-raise,
130-
dangerous-default-value,
131-
pointless-statement,
132-
pointless-string-statement,
133-
expression-not-assigned,
134-
unnecessary-pass,
135-
unnecessary-lambda,
136-
duplicate-key,
137-
assign-to-new-keyword,
138-
useless-else-on-loop,
139-
exec-used,
140-
eval-used,
141-
confusing-with-statement,
142-
using-constant-test,
143-
comparison-with-callable,
14496
lost-exception,
14597
assert-on-tuple,
14698
attribute-defined-outside-init,
@@ -154,9 +106,7 @@ disable=blacklisted-name,
154106
non-parent-init-called,
155107
bad-indentation,
156108
wildcard-import,
157-
misplaced-future,
158109
fixme,
159-
invalid-encoded-data,
160110
unused-import,
161111
unused-variable,
162112
unused-argument,
@@ -172,19 +122,18 @@ disable=blacklisted-name,
172122
invalid-format-index,
173123
no-absolute-import,
174124
dict-iter-method,
175-
indexing-exception,
176-
raising-string,
177125
oct-method,
178126
hex-method,
179127
exception-message-attribute,
180-
invalid-str-codec,
181-
sys-max-int,
182-
next-method-defined,
183128
redefined-builtin,
184129
no-else-return,
185130
redefined-argument-from-local,
186131
abstract-class-instantiated,
187-
multiple-statements
132+
multiple-statements,
133+
cyclic-import,
134+
useless-else-on-loop,
135+
duplicate-code,
136+
inconsistent-return-statements
188137

189138
# Enable the message, report, category or checker with the given id(s). You can
190139
# either give multiple identifier separated by comma (,) or put this option

can/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ class CanError(IOError):
1717
"""Indicates an error with the CAN network.
1818
1919
"""
20-
pass
2120

2221

2322
from .listener import Listener, BufferedReader, RedirectReader, AsyncBufferedReader

can/bus.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,6 @@ def _apply_filters(self, filters):
313313
:param Iterator[dict] filters:
314314
See :meth:`~can.BusABC.set_filters` for details.
315315
"""
316-
pass
317316

318317
def _matches_filters(self, msg):
319318
"""Checks whether the given message matches at least one of the
@@ -354,14 +353,12 @@ def _matches_filters(self, msg):
354353
def flush_tx_buffer(self):
355354
"""Discard every message that may be queued in the output buffer(s).
356355
"""
357-
pass
358356

359357
def shutdown(self):
360358
"""
361359
Called to carry out any interface specific cleanup required
362360
in shutting down a bus.
363361
"""
364-
pass
365362

366363
def __enter__(self):
367364
return self

can/interfaces/ixxat/exceptions.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@
1313

1414
class VCITimeout(CanError):
1515
""" Wraps the VCI_E_TIMEOUT error """
16-
pass
1716

1817

1918
class VCIError(CanError):
2019
""" Try to display errors that occur within the wrapped C library nicely. """
21-
pass
2220

2321

2422
class VCIRxQueueEmptyError(VCIError):

can/interfaces/kvaser/canlib.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def _unimplemented_function(*args):
4141
raise NotImplementedError('This function is not implemented in canlib')
4242

4343

44-
def __get_canlib_function(func_name, argtypes=[], restype=None, errcheck=None):
44+
def __get_canlib_function(func_name, argtypes=None, restype=None, errcheck=None):
45+
argtypes = [] if argtypes is None else argtypes
4546
#log.debug('Wrapping function "%s"' % func_name)
4647
try:
4748
# e.g. canlib.canBusOn

can/interfaces/pcan/pcan.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,4 +426,3 @@ class PcanError(CanError):
426426
"""
427427
A generic error on a PCAN bus.
428428
"""
429-
pass

can/interfaces/serial/serial_can.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _recv_internal(self, timeout):
121121
message are the default values.
122122
123123
:rtype:
124-
can.Message, bool
124+
Tuple[can.Message, Bool]
125125
"""
126126
try:
127127
# ser.read can return an empty string

can/interfaces/systec/structures.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class CanMsg(Structure):
3535
("m_dwTime", DWORD,) # Receive time stamp in ms (for transmit messages no meaning)
3636
]
3737

38-
def __init__(self, id=0, frame_format=MsgFrameFormat.MSG_FF_STD, data=[]):
38+
def __init__(self, id=0, frame_format=MsgFrameFormat.MSG_FF_STD, data=None):
39+
data = [] if data is None else data
3940
super().__init__(id, frame_format, len(data), (BYTE * 8)(*data), 0)
4041

4142
def __eq__(self, other):

can/interfaces/systec/ucan.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def check_result(result, func, arguments):
291291
log.warning("Cannot load SYSTEC ucan library: %s.", ex)
292292

293293

294-
class UcanServer(object):
294+
class UcanServer:
295295
"""
296296
UcanServer is a Python wrapper class for using the usbcan32.dll / usbcan64.dll.
297297
"""
@@ -987,7 +987,6 @@ def init_hw_event(self):
987987
988988
.. note:: To be overridden by subclassing.
989989
"""
990-
pass
991990

992991
def init_can_event(self, channel):
993992
"""
@@ -997,7 +996,6 @@ def init_can_event(self, channel):
997996
998997
.. note:: To be overridden by subclassing.
999998
"""
1000-
pass
1001999

10021000
def can_msg_received_event(self, channel):
10031001
"""
@@ -1009,7 +1007,6 @@ def can_msg_received_event(self, channel):
10091007
10101008
.. note:: To be overridden by subclassing.
10111009
"""
1012-
pass
10131010

10141011
def status_event(self, channel):
10151012
"""
@@ -1021,7 +1018,6 @@ def status_event(self, channel):
10211018
10221019
.. note:: To be overridden by subclassing.
10231020
"""
1024-
pass
10251021

10261022
def deinit_can_event(self, channel):
10271023
"""
@@ -1031,31 +1027,27 @@ def deinit_can_event(self, channel):
10311027
10321028
.. note:: To be overridden by subclassing.
10331029
"""
1034-
pass
10351030

10361031
def deinit_hw_event(self):
10371032
"""
10381033
Event occurs when an USB-CANmodul has been deinitialized (see method :meth:`shutdown`).
10391034
10401035
.. note:: To be overridden by subclassing.
10411036
"""
1042-
pass
10431037

10441038
def connect_event(self):
10451039
"""
10461040
Event occurs when a new USB-CANmodul has been connected to the host.
10471041
10481042
.. note:: To be overridden by subclassing.
10491043
"""
1050-
pass
10511044

10521045
def disconnect_event(self):
10531046
"""
10541047
Event occurs when an USB-CANmodul has been disconnected from the host.
10551048
10561049
.. note:: To be overridden by subclassing.
10571050
"""
1058-
pass
10591051

10601052
def fatal_disconnect_event(self, device_number):
10611053
"""
@@ -1067,7 +1059,6 @@ def fatal_disconnect_event(self, device_number):
10671059
10681060
.. note:: To be overridden by subclassing.
10691061
"""
1070-
pass
10711062

10721063

10731064
UcanServer._enum_callback_ref = EnumCallback(UcanServer._enum_callback)

can/io/blf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
class BLFParseError(Exception):
3030
"""BLF file could not be parsed correctly."""
31-
pass
31+
3232

3333
LOG = logging.getLogger(__name__)
3434

can/listener.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def on_message_received(self, msg):
3939
:param can.Message msg: the delivered message
4040
4141
"""
42-
pass
4342

4443
def __call__(self, msg):
4544
return self.on_message_received(msg)

can/thread_safe_bus.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from contextlib import nullcontext
1919

2020
except ImportError:
21-
class nullcontext(object):
21+
class nullcontext:
2222
"""A context manager that does nothing at all.
2323
A fallback for Python 3.7's :class:`contextlib.nullcontext` manager.
2424
"""

0 commit comments

Comments
 (0)