Skip to content

Update pylint version #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repos:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/pycqa/pylint
rev: v2.11.1
rev: v2.15.5
hooks:
- id: pylint
name: pylint (library code)
Expand Down
43 changes: 3 additions & 40 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs=1

# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
load-plugins=pylint.extensions.no_self_use

# Pickle collected data for later comparisons.
persistent=yes
Expand Down Expand Up @@ -54,8 +54,8 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation,pointless-string-statement,unused-argument,no-self-use
# disable=import-error,raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,deprecated-str-translate-call
disable=raw-checker-failed,bad-inline-option,locally-disabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,import-error,pointless-string-statement,unspecified-encoding

# Enable the message, report, category or checker with the given id(s). You can
# either give multiple identifier separated by comma (,) or put this option
Expand Down Expand Up @@ -225,12 +225,6 @@ max-line-length=100
# Maximum number of lines in a module
max-module-lines=1000

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator

# Allow the body of a class to be on the same line as the declaration if body
# contains single statement.
single-line-class-stmt=no
Expand All @@ -257,48 +251,29 @@ min-similarity-lines=12

[BASIC]

# Naming hint for argument names
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct argument names
argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Naming hint for attribute names
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct attribute names
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Bad variable names which should always be refused, separated by a comma
bad-names=foo,bar,baz,toto,tutu,tata

# Naming hint for class attribute names
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Regular expression matching correct class attribute names
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$

# Naming hint for class names
# class-name-hint=[A-Z_][a-zA-Z0-9]+$
class-name-hint=[A-Z_][a-zA-Z0-9_]+$

# Regular expression matching correct class names
# class-rgx=[A-Z_][a-zA-Z0-9]+$
class-rgx=[A-Z_][a-zA-Z0-9_]+$

# Naming hint for constant names
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Regular expression matching correct constant names
const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$

# Minimum line length for functions/classes that require docstrings, shorter
# ones are exempt.
docstring-min-length=-1

# Naming hint for function names
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct function names
function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

Expand All @@ -309,21 +284,12 @@ good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
# Include a hint for the correct naming format with invalid-name
include-naming-hint=no

# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$

# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$

# Naming hint for method names
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct method names
method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Naming hint for module names
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

# Regular expression matching correct module names
module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$

Expand All @@ -339,9 +305,6 @@ no-docstring-rgx=^_
# to this list to register other decorators that produce valid properties.
property-classes=abc.abstractproperty

# Naming hint for variable names
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

# Regular expression matching correct variable names
variable-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$

Expand Down
2 changes: 0 additions & 2 deletions circuitpython_typing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ def read(self, count: Optional[int] = None) -> Optional[bytes]:
or if the parameter is not specified in the call,
the outcome is implementation-dependent.
"""
...

# Should be `, /)`, but not available in Python 3.7.
def write(self, buf: ReadableBuffer) -> Optional[int]:
"""Write the bytes in ``buf`` to the stream."""
...


# These types may not be in adafruit-blinka, so use the string form instead of a resolved name.
Expand Down
5 changes: 0 additions & 5 deletions circuitpython_typing/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,15 @@ class HTTPProtocol(Protocol):

def get(self, url: str, **kw) -> Response:
"""Send HTTP GET request"""
...

def put(self, url: str, **kw) -> Response:
"""Send HTTP PUT request"""
...

def post(self, url: str, **kw) -> Response:
"""Send HTTP POST request"""
...

def patch(self, url: str, **kw) -> Response:
"""Send HTTP PATCH request"""
...

def delete(self, url: str, **kw) -> Response:
"""Send HTTP DELETE request"""
...
1 change: 1 addition & 0 deletions circuitpython_typing/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def value(self) -> float:
on the specifics of the class.
"""

# pylint: disable=no-self-use,unused-argument
@value.setter
def value(self, input_value: float, /):
...
2 changes: 0 additions & 2 deletions circuitpython_typing/led.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ class ColorBasedLED(Protocol):

def color(self, value: ColorBasedColorUnion) -> None:
"""Sets the color of the LED"""
...


class FillBasedLED(Protocol):
"""Protocol for LEDs using the :meth:`fill` method"""

def fill(self, color: FillBasedColorUnion) -> None:
"""Sets the color of the LED"""
...
4 changes: 0 additions & 4 deletions circuitpython_typing/pil.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class PixelAccess(Protocol):
# pylint: disable=invalid-name
def __getitem__(self, xy: Tuple[int, int]) -> int:
"""Get pixels by x, y coordinate"""
...


class Image(Protocol):
Expand All @@ -30,13 +29,10 @@ class Image(Protocol):
@property
def mode(self) -> str:
"""The mode of the image"""
...

@property
def size(self) -> Tuple[int, int]:
"""The size of the image"""
...

def load(self) -> PixelAccess:
"""Load the image for quick pixel access"""
...
2 changes: 1 addition & 1 deletion circuitpython_typing/pwmio.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class PWMOut(Protocol):
@property
def duty_cycle(self) -> int:
"""The duty cycle as a ratio using 16-bits"""
...

# pylint: disable=no-self-use,unused-argument
@duty_cycle.setter
def duty_cycle(self, duty_cycle: int) -> None:
...
11 changes: 0 additions & 11 deletions circuitpython_typing/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ class CommonSocketType(Protocol):
def send(self, data: bytes, flags: int = ...) -> None:
"""Send data to the socket. The meaning of the optional flags kwarg is
implementation-specific."""
...

def settimeout(self, value: Optional[float]) -> None:
"""Set a timeout on blocking socket operations."""
...

def close(self) -> None:
"""Close the socket."""
...


class CommonCircuitPythonSocketType(CommonSocketType, Protocol):
Expand All @@ -62,7 +59,6 @@ def connect(
) -> None:
"""Connect to a remote socket at the provided (host, port) address. The conntype
kwarg optionally may indicate SSL or not, depending on the underlying interface."""
...


class LegacyCircuitPythonSocketType(CommonCircuitPythonSocketType, Protocol):
Expand All @@ -72,7 +68,6 @@ def recv(self, bufsize: int = ...) -> bytes:
"""Receive data from the socket. The return value is a bytes object representing
the data received. The maximum amount of data to be received at once is specified
by bufsize."""
...


class SupportsRecvWithFlags(Protocol):
Expand All @@ -82,7 +77,6 @@ def recv(self, bufsize: int = ..., flags: int = ...) -> bytes:
"""Receive data from the socket. The return value is a bytes object representing
the data received. The maximum amount of data to be received at once is specified
by bufsize. The meaning of the optional flags kwarg is implementation-specific."""
...


class SupportsRecvInto(Protocol):
Expand All @@ -93,7 +87,6 @@ def recv_into(self, buffer: bytearray, nbytes: int = ..., flags: int = ...) -> i
buffer. If nbytes is not specified (or 0), receive up to the size available in the
given buffer. The meaning of the optional flags kwarg is implementation-specific.
Returns the number of bytes received."""
...


class CircuitPythonSocketType(
Expand All @@ -104,8 +97,6 @@ class CircuitPythonSocketType(
): # pylint: disable=too-many-ancestors
"""Describes the structure every modern CircuitPython socket type must have."""

...


class StandardPythonSocketType(
CommonSocketType, SupportsRecvInto, SupportsRecvWithFlags, Protocol
Expand All @@ -114,7 +105,6 @@ class StandardPythonSocketType(

def connect(self, address: Union[Tuple[Any, ...], str, bytes]) -> None:
"""Connect to a remote socket at the provided address."""
...


SocketType: TypeAlias = Union[
Expand All @@ -132,7 +122,6 @@ class InterfaceType(Protocol):
@property
def TLS_MODE(self) -> int: # pylint: disable=invalid-name
"""Constant representing that a socket's connection mode is TLS."""
...


SSLContextType: TypeAlias = Union[SSLContext, "_FakeSSLContext"]