Skip to content

Commit a1d99b4

Browse files
committed
Pylint and RTD update patch, and other fixes
1 parent 8f41838 commit a1d99b4

File tree

6 files changed

+27
-23
lines changed

6 files changed

+27
-23
lines changed

.github/workflows/build.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ jobs:
4242
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
4343
run: |
4444
source actions-ci/install.sh
45-
- name: Pip install pylint, Sphinx, pre-commit
45+
- name: Pip install Sphinx, pre-commit
4646
run: |
47-
pip install --force-reinstall pylint Sphinx sphinx-rtd-theme pre-commit
47+
pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit
4848
- name: Library version
4949
run: git describe --dirty --always --tags
5050
- name: Pre-commit hooks

.pre-commit-config.yaml

+15-15
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,25 @@ repos:
1818
- id: end-of-file-fixer
1919
- id: trailing-whitespace
2020
- repo: https://github.com/pycqa/pylint
21-
rev: pylint-2.7.1
21+
rev: v2.11.1
2222
hooks:
2323
- id: pylint
2424
name: pylint (library code)
2525
types: [python]
26+
args:
27+
- --disable=consider-using-f-string
2628
exclude: "^(docs/|examples/|tests/|setup.py$)"
27-
- repo: local
28-
hooks:
29-
- id: pylint_examples
30-
name: pylint (examples code)
29+
- id: pylint
30+
name: pylint (example code)
3131
description: Run pylint rules on "examples/*.py" files
32-
entry: /usr/bin/env bash -c
33-
args: ['([[ ! -d "examples" ]] || for example in $(find . -path "./examples/*.py"); do pylint --disable=missing-docstring,invalid-name,consider-using-f-string $example; done)']
34-
language: system
35-
- repo: local
36-
hooks:
37-
- id: pylint_tests
38-
name: pylint (tests code)
32+
types: [python]
33+
files: "^examples/"
34+
args:
35+
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
36+
- id: pylint
37+
name: pylint (test code)
3938
description: Run pylint rules on "tests/*.py" files
40-
entry: /usr/bin/env bash -c
41-
args: ['([[ ! -d "tests" ]] || for example in $(find . -path "./tests/*.py"); do pylint --disable=missing-docstring,invalid-name $example; done)']
42-
language: system
39+
types: [python]
40+
files: "^tests/"
41+
args:
42+
- --disable=missing-docstring,consider-using-f-string,duplicate-code

.pylintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ ignore-docstrings=yes
252252
ignore-imports=yes
253253

254254
# Minimum lines number of a similarity.
255-
min-similarity-lines=12
255+
min-similarity-lines=4
256256

257257

258258
[BASIC]

adafruit_requests.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def _close_socket(self, sock):
383383
sock.close()
384384
del self._socket_free[sock]
385385
key = None
386-
for k in self._open_sockets:
386+
for k in self._open_sockets: # pylint: disable=consider-using-dict-items
387387
if self._open_sockets[k] == sock:
388388
key = k
389389
break
@@ -392,8 +392,8 @@ def _close_socket(self, sock):
392392

393393
def _free_sockets(self):
394394
free_sockets = []
395-
for sock in self._socket_free:
396-
if self._socket_free[sock]:
395+
for sock, val in self._socket_free.items():
396+
if val:
397397
free_sockets.append(sock)
398398
for sock in free_sockets:
399399
self._close_socket(sock)

docs/requirements.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# SPDX-FileCopyrightText: 2021 Kattni Rembor for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
5+
sphinx>=4.0.0

tests/mocket.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ def _recv_into(self, buf, nbytes=0):
5454
assert isinstance(nbytes, int) and nbytes >= 0
5555
read = nbytes if nbytes > 0 else len(buf)
5656
remaining = len(self._response) - self._position
57-
if read > remaining:
58-
read = remaining
57+
read = min(read, remaining)
5958
end = self._position + read
6059
buf[:read] = self._response[self._position : end]
6160
self._position = end

0 commit comments

Comments
 (0)