Skip to content

Commit 2fa4406

Browse files
authored
Merge pull request #10 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents cba7123 + 095aab9 commit 2fa4406

File tree

7 files changed

+102
-91
lines changed

7 files changed

+102
-91
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
source actions-ci/install.sh
4141
- name: Pip install pylint, black, & Sphinx
4242
run: |
43-
pip install --force-reinstall pylint==1.9.2 black==19.10b0 Sphinx sphinx-rtd-theme
43+
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
4444
- name: Library version
4545
run: git describe --dirty --always --tags
4646
- name: PyLint

adafruit_matrixkeypad.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
__version__ = "0.0.0-auto.0"
4848
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MatrixKeypad.git"
4949

50-
class Matrix_Keypad(object):
50+
51+
class Matrix_Keypad:
5152
"""Driver for passive matrix keypads - any size"""
53+
5254
def __init__(self, row_pins, col_pins, keys):
5355
"""Initialise the driver with the correct size and key list.
5456
@@ -73,7 +75,7 @@ def pressed_keys(self):
7375
pressed = []
7476

7577
# set all pins pins to be inputs w/pullups
76-
for pin in self.row_pins+self.col_pins:
78+
for pin in self.row_pins + self.col_pins:
7779
pin.direction = Direction.INPUT
7880
pin.pull = Pull.UP
7981

docs/conf.py

Lines changed: 73 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22

33
import os
44
import sys
5-
sys.path.insert(0, os.path.abspath('..'))
5+
6+
sys.path.insert(0, os.path.abspath(".."))
67

78
# -- General configuration ------------------------------------------------
89

910
# Add any Sphinx extension module names here, as strings. They can be
1011
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
1112
# ones.
1213
extensions = [
13-
'sphinx.ext.autodoc',
14-
'sphinx.ext.intersphinx',
15-
'sphinx.ext.napoleon',
16-
'sphinx.ext.todo',
14+
"sphinx.ext.autodoc",
15+
"sphinx.ext.intersphinx",
16+
"sphinx.ext.napoleon",
17+
"sphinx.ext.todo",
1718
]
1819

1920
# TODO: Please Read!
@@ -24,29 +25,40 @@
2425
# autodoc_mock_imports = ["digitalio"]
2526

2627

27-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'Register': ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
28+
intersphinx_mapping = {
29+
"python": ("https://docs.python.org/3.4", None),
30+
"BusDevice": (
31+
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
32+
None,
33+
),
34+
"Register": (
35+
"https://circuitpython.readthedocs.io/projects/register/en/latest/",
36+
None,
37+
),
38+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
39+
}
2840

2941
# Add any paths that contain templates here, relative to this directory.
30-
templates_path = ['_templates']
42+
templates_path = ["_templates"]
3143

32-
source_suffix = '.rst'
44+
source_suffix = ".rst"
3345

3446
# The master toctree document.
35-
master_doc = 'index'
47+
master_doc = "index"
3648

3749
# General information about the project.
38-
project = u'Adafruit MatrixKeypad Library'
39-
copyright = u'2018 ladyada'
40-
author = u'ladyada'
50+
project = u"Adafruit MatrixKeypad Library"
51+
copyright = u"2018 ladyada"
52+
author = u"ladyada"
4153

4254
# The version info for the project you're documenting, acts as replacement for
4355
# |version| and |release|, also used in various other places throughout the
4456
# built documents.
4557
#
4658
# The short X.Y version.
47-
version = u'1.0'
59+
version = u"1.0"
4860
# The full version, including alpha/beta/rc tags.
49-
release = u'1.0'
61+
release = u"1.0"
5062

5163
# The language for content autogenerated by Sphinx. Refer to documentation
5264
# for a list of supported languages.
@@ -58,7 +70,7 @@
5870
# List of patterns, relative to source directory, that match files and
5971
# directories to ignore when looking for source files.
6072
# This patterns also effect to html_static_path and html_extra_path
61-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
73+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
6274

6375
# The reST default role (used for this markup: `text`) to use for all
6476
# documents.
@@ -70,7 +82,7 @@
7082
add_function_parentheses = True
7183

7284
# The name of the Pygments (syntax highlighting) style to use.
73-
pygments_style = 'sphinx'
85+
pygments_style = "sphinx"
7486

7587
# If true, `todo` and `todoList` produce output, else they produce nothing.
7688
todo_include_todos = False
@@ -85,68 +97,76 @@
8597
# The theme to use for HTML and HTML Help pages. See the documentation for
8698
# a list of builtin themes.
8799
#
88-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
100+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
89101

90102
if not on_rtd: # only import and set the theme if we're building docs locally
91103
try:
92104
import sphinx_rtd_theme
93-
html_theme = 'sphinx_rtd_theme'
94-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
105+
106+
html_theme = "sphinx_rtd_theme"
107+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
95108
except:
96-
html_theme = 'default'
97-
html_theme_path = ['.']
109+
html_theme = "default"
110+
html_theme_path = ["."]
98111
else:
99-
html_theme_path = ['.']
112+
html_theme_path = ["."]
100113

101114
# Add any paths that contain custom static files (such as style sheets) here,
102115
# relative to this directory. They are copied after the builtin static files,
103116
# so a file named "default.css" will overwrite the builtin "default.css".
104-
html_static_path = ['_static']
117+
html_static_path = ["_static"]
105118

106119
# The name of an image file (relative to this directory) to use as a favicon of
107120
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
108121
# pixels large.
109122
#
110-
html_favicon = '_static/favicon.ico'
123+
html_favicon = "_static/favicon.ico"
111124

112125
# Output file base name for HTML help builder.
113-
htmlhelp_basename = 'AdafruitMatrixkeypadLibrarydoc'
126+
htmlhelp_basename = "AdafruitMatrixkeypadLibrarydoc"
114127

115128
# -- Options for LaTeX output ---------------------------------------------
116129

117130
latex_elements = {
118-
# The paper size ('letterpaper' or 'a4paper').
119-
#
120-
# 'papersize': 'letterpaper',
121-
122-
# The font size ('10pt', '11pt' or '12pt').
123-
#
124-
# 'pointsize': '10pt',
125-
126-
# Additional stuff for the LaTeX preamble.
127-
#
128-
# 'preamble': '',
129-
130-
# Latex figure (float) alignment
131-
#
132-
# 'figure_align': 'htbp',
131+
# The paper size ('letterpaper' or 'a4paper').
132+
#
133+
# 'papersize': 'letterpaper',
134+
# The font size ('10pt', '11pt' or '12pt').
135+
#
136+
# 'pointsize': '10pt',
137+
# Additional stuff for the LaTeX preamble.
138+
#
139+
# 'preamble': '',
140+
# Latex figure (float) alignment
141+
#
142+
# 'figure_align': 'htbp',
133143
}
134144

135145
# Grouping the document tree into LaTeX files. List of tuples
136146
# (source start file, target name, title,
137147
# author, documentclass [howto, manual, or own class]).
138148
latex_documents = [
139-
(master_doc, 'AdafruitMatrixKeypadLibrary.tex', u'AdafruitMatrixKeypad Library Documentation',
140-
author, 'manual'),
149+
(
150+
master_doc,
151+
"AdafruitMatrixKeypadLibrary.tex",
152+
u"AdafruitMatrixKeypad Library Documentation",
153+
author,
154+
"manual",
155+
),
141156
]
142157

143158
# -- Options for manual page output ---------------------------------------
144159

145160
# One entry per manual page. List of tuples
146161
# (source start file, name, description, authors, manual section).
147162
man_pages = [
148-
(master_doc, 'AdafruitMatrixKeypadlibrary', u'Adafruit MatrixKeypad Library Documentation',
149-
[author], 1)
163+
(
164+
master_doc,
165+
"AdafruitMatrixKeypadlibrary",
166+
u"Adafruit MatrixKeypad Library Documentation",
167+
[author],
168+
1,
169+
)
150170
]
151171

152172
# -- Options for Texinfo output -------------------------------------------
@@ -155,7 +175,13 @@
155175
# (source start file, target name, title, author,
156176
# dir menu entry, description, category)
157177
texinfo_documents = [
158-
(master_doc, 'AdafruitMatrixKeypadLibrary', u'Adafruit MatrixKeypad Library Documentation',
159-
author, 'AdafruitMatrixKeypadLibrary', 'One line description of project.',
160-
'Miscellaneous'),
178+
(
179+
master_doc,
180+
"AdafruitMatrixKeypadLibrary",
181+
u"Adafruit MatrixKeypad Library Documentation",
182+
author,
183+
"AdafruitMatrixKeypadLibrary",
184+
"One line description of project.",
185+
"Miscellaneous",
186+
),
161187
]

examples/matrixkeypad_4x4.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66
# Extended 4x4 matrix keypad
77
cols = [DigitalInOut(x) for x in (board.D0, board.D1, board.D2, board.D3)]
88
rows = [DigitalInOut(x) for x in (board.D4, board.D5, board.D6, board.D7)]
9-
keys = ((1, 2, 3, 'A'),
10-
(4, 5, 6, 'B'),
11-
(7, 8, 9, 'C'),
12-
('*', 0, '#', 'D'))
9+
keys = ((1, 2, 3, "A"), (4, 5, 6, "B"), (7, 8, 9, "C"), ("*", 0, "#", "D"))
1310

1411
keypad = adafruit_matrixkeypad.Matrix_Keypad(rows, cols, keys)
1512

examples/matrixkeypad_rpi_simpletest.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313
# cols = [digitalio.DigitalInOut(x) for x in (board.D13, board.D5, board.D26)]
1414
# rows = [digitalio.DigitalInOut(x) for x in (board.D6, board.D21, board.D20, board.D19)]
1515

16-
keys = ((1, 2, 3),
17-
(4, 5, 6),
18-
(7, 8, 9),
19-
('*', 0, '#'))
16+
keys = ((1, 2, 3), (4, 5, 6), (7, 8, 9), ("*", 0, "#"))
2017

2118
keypad = adafruit_matrixkeypad.Matrix_Keypad(rows, cols, keys)
2219

examples/matrixkeypad_simpletest.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@
1212
# cols = [digitalio.DigitalInOut(x) for x in (board.D11, board.D13, board.D9)]
1313
# rows = [digitalio.DigitalInOut(x) for x in (board.D12, board.D5, board.D6, board.D10)]
1414

15-
keys = ((1, 2, 3),
16-
(4, 5, 6),
17-
(7, 8, 9),
18-
('*', 0, '#'))
15+
keys = ((1, 2, 3), (4, 5, 6), (7, 8, 9), ("*", 0, "#"))
1916

2017
keypad = adafruit_matrixkeypad.Matrix_Keypad(rows, cols, keys)
2118

setup.py

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,46 @@
77

88
# Always prefer setuptools over distutils
99
from setuptools import setup, find_packages
10+
1011
# To use a consistent encoding
1112
from codecs import open
1213
from os import path
1314

1415
here = path.abspath(path.dirname(__file__))
1516

1617
# Get the long description from the README file
17-
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
18+
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
1819
long_description = f.read()
1920

2021
setup(
21-
name='adafruit-circuitpython-matrixkeypad',
22-
22+
name="adafruit-circuitpython-matrixkeypad",
2323
use_scm_version=True,
24-
setup_requires=['setuptools_scm'],
25-
26-
description='CircuitPython library for passive matrix keypads.',
24+
setup_requires=["setuptools_scm"],
25+
description="CircuitPython library for passive matrix keypads.",
2726
long_description=long_description,
28-
long_description_content_type='text/x-rst',
29-
27+
long_description_content_type="text/x-rst",
3028
# The project's main homepage.
31-
url='https://github.com/adafruit/Adafruit_CircuitPython_MatrixKeypad',
32-
29+
url="https://github.com/adafruit/Adafruit_CircuitPython_MatrixKeypad",
3330
# Author details
34-
author='Adafruit Industries',
35-
author_email='[email protected]',
36-
37-
install_requires=['Adafruit-Blinka'],
38-
31+
author="Adafruit Industries",
32+
author_email="[email protected]",
33+
install_requires=["Adafruit-Blinka"],
3934
# Choose your license
40-
license='MIT',
41-
35+
license="MIT",
4236
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
4337
classifiers=[
44-
'Development Status :: 3 - Alpha',
45-
'Intended Audience :: Developers',
46-
'Topic :: Software Development :: Libraries',
47-
'Topic :: System :: Hardware',
48-
'License :: OSI Approved :: MIT License',
49-
'Programming Language :: Python :: 3',
50-
'Programming Language :: Python :: 3.4',
51-
'Programming Language :: Python :: 3.5',
38+
"Development Status :: 3 - Alpha",
39+
"Intended Audience :: Developers",
40+
"Topic :: Software Development :: Libraries",
41+
"Topic :: System :: Hardware",
42+
"License :: OSI Approved :: MIT License",
43+
"Programming Language :: Python :: 3",
44+
"Programming Language :: Python :: 3.4",
45+
"Programming Language :: Python :: 3.5",
5246
],
53-
5447
# What does your project relate to?
55-
keywords='adafruit matrix keypad hardware micropython circuitpython',
56-
48+
keywords="adafruit matrix keypad hardware micropython circuitpython",
5749
# You can just specify the packages manually here if your project is
5850
# simple. Or you can use find_packages().
59-
py_modules=['adafruit_matrixkeypad'],
51+
py_modules=["adafruit_matrixkeypad"],
6052
)

0 commit comments

Comments
 (0)