Skip to content

Commit 5ca35f4

Browse files
committed
pylint: create a global configuration file
Move all too-few / too-many arbitrary warnings into this config file. Signed-off-by: Emmanuel Blot <[email protected]>
1 parent 9834c46 commit 5ca35f4

37 files changed

+134
-176
lines changed

.flake8

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
max-line-length = 80

.pylintrc

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[MESSAGES CONTROL]
2+
3+
disable=
4+
too-few-public-methods,
5+
too-many-arguments,
6+
too-many-branches,
7+
too-many-instance-attributes,
8+
too-many-lines,
9+
too-many-locals,
10+
too-many-nested-blocks,
11+
too-many-public-methods,
12+
too-many-statements

pyftdi/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# SPDX-License-Identifier: BSD-3-Clause
66

7-
#pylint: disable-msg=missing-docstring
7+
# pylint: disable=missing-docstring
88

99
__version__ = '0.55.1'
1010
__title__ = 'PyFtdi'

pyftdi/bin/ftconf.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
from pyftdi.ftdi import Ftdi
2020
from pyftdi.misc import add_custom_devices, hexdump
2121

22-
#pylint: disable-msg=too-many-locals
23-
#pylint: disable-msg=too-many-branches
24-
#pylint: disable-msg=too-many-statements
22+
# pylint: disable=too-many-locals
23+
# pylint: disable=too-many-branches
24+
# pylint: disable=too-many-statements
2525

2626

2727
def main():
@@ -107,7 +107,7 @@ def main():
107107
FtdiLogger.log.addHandler(StreamHandler(stderr))
108108

109109
if args.virtual:
110-
#pylint: disable-msg=import-outside-toplevel
110+
# pylint: disable=import-outside-toplevel
111111
from pyftdi.usbtools import UsbTools
112112
# Force PyUSB to use PyFtdi test framework for USB backends
113113
UsbTools.BACKENDS = ('pyftdi.tests.backend.usbvirt', )

pyftdi/bin/ftdi_urls.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def main():
4545
FtdiLogger.log.addHandler(StreamHandler(stderr))
4646

4747
if args.virtual:
48-
#pylint: disable-msg=import-outside-toplevel
48+
# pylint: disable=import-outside-toplevel
4949
from pyftdi.usbtools import UsbTools
5050
# Force PyUSB to use PyFtdi test framework for USB backends
5151
UsbTools.BACKENDS = ('pyftdi.tests.backend.usbvirt', )

pyftdi/bin/i2cscan.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33

4-
# Copyright (c) 2018-2022, Emmanuel Blot <[email protected]>
4+
# Copyright (c) 2018-2024, Emmanuel Blot <[email protected]>
55
# All rights reserved.
66
#
77
# SPDX-License-Identifier: BSD-3-Clause
88

99
"""Tiny I2C bus scanner."""
1010

11-
#pylint: disable-msg=broad-except
12-
#pylint: disable-msg=too-few-public-methods
11+
# pylint: disable=broad-except
1312

1413
from argparse import ArgumentParser, FileType
1514
from logging import Formatter, StreamHandler, getLogger, DEBUG, ERROR
@@ -124,7 +123,7 @@ def main():
124123
FtdiLogger.set_level(loglevel)
125124

126125
if args.virtual:
127-
#pylint: disable-msg=import-outside-toplevel
126+
# pylint: disable=import-outside-toplevel
128127
from pyftdi.usbtools import UsbTools
129128
# Force PyUSB to use PyFtdi test framework for USB backends
130129
UsbTools.BACKENDS = ('pyftdi.tests.backend.usbvirt', )

pyftdi/bin/pyterm.py

+5-11
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,14 @@
33
"""Simple Python serial terminal
44
"""
55

6-
# Copyright (c) 2010-2022, Emmanuel Blot <[email protected]>
6+
# Copyright (c) 2010-2024, Emmanuel Blot <[email protected]>
77
# Copyright (c) 2016, Emmanuel Bouaziz <[email protected]>
88
# All rights reserved.
99
#
1010
# SPDX-License-Identifier: BSD-3-Clause
1111

12-
#pylint: disable-msg=too-many-instance-attributes
13-
#pylint: disable-msg=too-many-arguments
14-
#pylint: disable-msg=too-many-nested-blocks
15-
#pylint: disable-msg=too-many-branches
16-
#pylint: disable-msg=too-many-statements
17-
#pylint: disable-msg=too-few-public-methods
18-
#pylint: disable-msg=broad-except
19-
#pylint: disable-msg=wrong-import-position
12+
# pylint: disable=broad-except
13+
# pylint: disable=wrong-import-position
2014

2115
from argparse import ArgumentParser, FileType
2216
from atexit import register
@@ -30,8 +24,8 @@
3024
from traceback import format_exc
3125
from _thread import interrupt_main
3226

33-
#pylint: disable-msg=import-error
34-
#pylint: disable-msg=import-outside-toplevel
27+
# pylint: disable=import-error
28+
# pylint: disable=import-outside-toplevel
3529

3630
from pyftdi import FtdiLogger
3731
from pyftdi.ftdi import Ftdi

pyftdi/bits.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010-2019 Emmanuel Blot <[email protected]>
1+
# Copyright (c) 2010-2024 Emmanuel Blot <[email protected]>
22
# Copyright (c) 2008-2016, Neotion
33
# All rights reserved.
44
#
@@ -9,11 +9,10 @@
99
from typing import Iterable, List, Optional, Tuple, Union
1010
from .misc import is_iterable, xor
1111

12-
#pylint: disable-msg=invalid-name
13-
#pylint: disable-msg=unneeded-not
14-
#pylint: disable-msg=too-many-branches
15-
#pylint: disable-msg=too-many-arguments
16-
#pylint: disable-msg=duplicate-key
12+
# pylint: disable=invalid-name
13+
# pylint: disable=unneeded-not
14+
# pylint: disable=duplicate-key
15+
1716

1817
class BitSequenceError(Exception):
1918
"""Bit sequence error"""

pyftdi/eeprom.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,8 @@
55

66
"""EEPROM management for PyFdti"""
77

8-
#pylint: disable-msg=too-many-arguments
9-
#pylint: disable-msg=too-many-branches
10-
#pylint: disable-msg=too-many-instance-attributes
11-
#pylint: disable-msg=too-many-locals
12-
#pylint: disable-msg=too-many-public-methods
13-
#pylint: disable-msg=wrong-import-position
14-
#pylint: disable-msg=import-error
8+
# pylint: disable=wrong-import-position
9+
# pylint: disable=import-error
1510

1611
import sys
1712
from binascii import hexlify, unhexlify

pyftdi/ftdi.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2010-2023 Emmanuel Blot <[email protected]>
1+
# Copyright (c) 2010-2024 Emmanuel Blot <[email protected]>
22
# Copyright (c) 2016 Emmanuel Bouaziz <[email protected]>
33
# All rights reserved.
44
#
@@ -21,17 +21,7 @@
2121
from .misc import to_bool
2222
from .usbtools import UsbDeviceDescriptor, UsbTools
2323

24-
#pylint: disable-msg=invalid-name
25-
#pylint: disable-msg=too-many-arguments
26-
#pylint: disable=too-many-arguments
27-
#pylint: disable=too-many-branches
28-
#pylint: disable=too-many-statements
29-
#pylint: disable=too-many-nested-blocks
30-
#pylint: disable=too-many-instance-attributes
31-
#pylint: disable=too-many-nested-blocks
32-
#pylint: disable=too-many-public-methods
33-
#pylint: disable=too-many-locals
34-
#pylint: disable=too-many-lines
24+
# pylint: disable=invalid-name
3525

3626

3727
class FtdiError(IOError):
@@ -730,13 +720,13 @@ def open_mpsse_from_device(self, device: UsbDevice,
730720
:param bool debug: add more debug traces
731721
:return: actual bus frequency in Hz
732722
"""
733-
# pylint: disable-msg=unused-argument
723+
# pylint: disable=unused-argument
734724
self.open_from_device(device, interface)
735725
if not self.is_mpsse_interface(interface):
736726
self.close()
737727
raise FtdiMpsseError('This interface does not support MPSSE')
738728
if to_bool(tracer): # accept strings as boolean
739-
#pylint: disable-msg=import-outside-toplevel
729+
# pylint: disable=import-outside-toplevel
740730
from .tracer import FtdiMpsseTracer
741731
self._tracer = FtdiMpsseTracer(self.device_version)
742732
self.log.debug('Using MPSSE tracer')
@@ -2044,7 +2034,7 @@ def _set_interface(self, config: UsbConfiguration, ifnum: int):
20442034
except (NotImplementedError, USBError):
20452035
pass
20462036

2047-
#pylint: disable-msg=protected-access
2037+
# pylint: disable=protected-access
20482038
# need to access private member _ctx of PyUSB device (resource manager)
20492039
# until PyUSB #302 is addressed
20502040

@@ -2057,7 +2047,7 @@ def _is_pyusb_handle_active(self) -> bool:
20572047
# and there is no public API for this.
20582048
return bool(self._usb_dev._ctx.handle)
20592049

2060-
#pylint: enable-msg=protected-access
2050+
# pylint: enable-msg=protected-access
20612051

20622052
def _reset_device(self):
20632053
"""Reset the FTDI device (FTDI vendor command)"""

pyftdi/gpio.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# Copyright (c) 2014-2020, Emmanuel Blot <[email protected]>
1+
# Copyright (c) 2014-2024, Emmanuel Blot <[email protected]>
22
# Copyright (c) 2016, Emmanuel Bouaziz <[email protected]>
33
# All rights reserved.
44
#
55
# SPDX-License-Identifier: BSD-3-Clause
66

77
"""GPIO/BitBang support for PyFdti"""
88

9-
#pylint: disable-msg=too-few-public-methods
109

1110
from struct import calcsize as scalc, unpack as sunpack
1211
from typing import Iterable, Optional, Tuple, Union

pyftdi/i2c.py

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
# Copyright (c) 2017-2021, Emmanuel Blot <[email protected]>
1+
# Copyright (c) 2017-2024, Emmanuel Blot <[email protected]>
22
# All rights reserved.
33
#
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
"""I2C support for PyFdti"""
77

8-
#pylint: disable-msg=too-many-lines
9-
#pylint: disable-msg=too-many-locals
10-
#pylint: disable-msg=too-many-instance-attributes
11-
#pylint: disable-msg=too-many-public-methods
12-
#pylint: disable-msg=too-many-arguments
13-
#pylint: disable-msg=too-many-branches
14-
#pylint: disable-msg=too-many-statements
15-
16-
178
from binascii import hexlify
189
from collections import namedtuple
1910
from logging import getLogger

pyftdi/jtag.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
"""JTAG support for PyFdti"""
88

9-
#pylint: disable-msg=invalid-name
10-
#pylint: disable-msg=missing-function-docstring
9+
# pylint: disable=invalid-name
10+
# pylint: disable=missing-function-docstring
1111

1212
from time import sleep
1313
from typing import List, Tuple, Union

pyftdi/misc.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
# Copyright (c) 2010-2021 Emmanuel Blot <[email protected]>
1+
# Copyright (c) 2010-2024 Emmanuel Blot <[email protected]>
22
# Copyright (c) 2008-2016, Neotion
33
# All rights reserved.
44
#
55
# SPDX-License-Identifier: BSD-3-Clause
66

77
"""Miscellaneous helpers"""
88

9-
#pylint: disable-msg=invalid-name
10-
#pylint: disable-msg=import-outside-toplevel
11-
#pylint: disable-msg=too-many-locals
12-
#pylint: disable-msg=too-many-arguments
9+
# pylint: disable=invalid-name
10+
# pylint: disable=import-outside-toplevel
1311

1412
from array import array
1513
from copy import deepcopy
@@ -198,7 +196,7 @@ def xor(_a_: bool, _b_: bool) -> bool:
198196
:param _b_: second argument
199197
:return: xor-ed value
200198
"""
201-
#pylint: disable-msg=superfluous-parens
199+
# pylint: disable=superfluous-parens
202200
return bool((not(_a_) and _b_) or (_a_ and not(_b_)))
203201

204202

@@ -311,7 +309,7 @@ def show_call_stack():
311309

312310
class classproperty(property):
313311
"""Getter property decorator for a class"""
314-
#pylint: disable=invalid-name
312+
# pylint: disable=invalid-name
315313
def __get__(self, obj: Any, objtype=None) -> Any:
316314
return super().__get__(objtype)
317315

pyftdi/serialext/logger.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#
55
# SPDX-License-Identifier: BSD-3-Clause
66

7-
#pylint: disable-msg=no-member
8-
#pylint: disable-msg=broad-except
9-
#pylint: disable-msg=invalid-name
10-
#pylint: disable-msg=super-with-arguments
11-
#pylint: disable-msg=missing-function-docstring
12-
#pylint: disable-msg=missing-module-docstring
7+
# pylint: disable=no-member
8+
# pylint: disable=broad-except
9+
# pylint: disable=invalid-name
10+
# pylint: disable=super-with-arguments
11+
# pylint: disable=missing-function-docstring
12+
# pylint: disable=missing-module-docstring
1313

1414
from sys import stderr
1515
from time import time

pyftdi/serialext/protocol_ftdi.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# SPDX-License-Identifier: BSD-3-Clause
66

77
# this file has not been updated for a while, so coding style needs some love
8-
#pylint: disable-msg=attribute-defined-outside-init
9-
#pylint: disable-msg=invalid-name
10-
#pylint: disable-msg=missing-class-docstring
11-
#pylint: disable-msg=missing-module-docstring
8+
# pylint: disable=attribute-defined-outside-init
9+
# pylint: disable=invalid-name
10+
# pylint: disable=missing-class-docstring
11+
# pylint: disable=missing-module-docstring
1212

1313
from io import RawIOBase
1414
from time import sleep, time as now

pyftdi/serialext/protocol_unix.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
# Copyright (c) 2008-2016, Emmanuel Blot <[email protected]>
1+
# Copyright (c) 2008-2024, Emmanuel Blot <[email protected]>
22
# Copyright (c) 2016, Emmanuel Bouaziz <[email protected]>
33
# All rights reserved.
44
#
55
# SPDX-License-Identifier: BSD-3-Clause
66

77
# this file has not been updated for a while, so coding style needs some love
8-
#pylint: disable-msg=broad-except
9-
#pylint: disable-msg=attribute-defined-outside-init
10-
#pylint: disable-msg=redefined-outer-name
11-
#pylint: disable-msg=invalid-name
12-
#pylint: disable-msg=too-few-public-methods
13-
#pylint: disable-msg=missing-function-docstring
14-
#pylint: disable-msg=missing-class-docstring
15-
#pylint: disable-msg=missing-module-docstring
8+
# pylint: disable=broad-except
9+
# pylint: disable=attribute-defined-outside-init
10+
# pylint: disable=redefined-outer-name
11+
# pylint: disable=invalid-name
12+
# pylint: disable=missing-function-docstring
13+
# pylint: disable=missing-class-docstring
14+
# pylint: disable=missing-module-docstring
1615

1716
import errno
1817
import os
@@ -70,7 +69,7 @@ def open(self):
7069
self.close()
7170
msg = "Could not open port: %s" % (str(e),)
7271
if isinstance(e, socket.error):
73-
# pylint: disable-msg=no-member
72+
# pylint: disable=no-member
7473
raise SerialExceptionWithErrno(msg, e.errno) from e
7574
raise SerialException(msg) from e
7675
self._set_open_state(True)
@@ -91,7 +90,7 @@ def close(self):
9190

9291
def in_waiting(self):
9392
"""Return the number of characters currently in the input buffer."""
94-
#pylint: disable-msg=no-self-use
93+
# pylint: disable=no-self-use
9594
return 0
9695

9796
def read(self, size=1):

pyftdi/serialext/tests/rl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
path.append(dirname(dirname(dirname(dirname(__file__)))))
1010

11-
#pylint: disable-msg=wrong-import-position
11+
# pylint: disable=wrong-import-position
1212
from pyftdi import serialext
1313

1414

0 commit comments

Comments
 (0)