Skip to content

Commit df49c88

Browse files
authored
Merge pull request #18 from adafruit/pylint-update
Pylint update
2 parents 5b62dc9 + b2ab0d2 commit df49c88

File tree

6 files changed

+167
-125
lines changed

6 files changed

+167
-125
lines changed

.github/workflows/build.yml

+1-1
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 pylint black==19.10b0 Sphinx sphinx-rtd-theme
4444
- name: Library version
4545
run: git describe --dirty --always --tags
4646
- name: PyLint

adafruit_cursorcontrol/cursorcontrol.py

+26-15
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,17 @@ class Cursor():
6565
# initialize the mouse cursor object
6666
mouse_cursor = Cursor(display, display_group=splash)
6767
"""
68+
6869
# pylint: disable=too-many-arguments,line-too-long
69-
def __init__(self, display=None, display_group=None, bmp=None, is_hidden=False, cursor_speed=5, scale=1):
70+
def __init__(
71+
self,
72+
display=None,
73+
display_group=None,
74+
bmp=None,
75+
is_hidden=False,
76+
cursor_speed=5,
77+
scale=1,
78+
):
7079
self._display = display
7180
self._scale = scale
7281
self._speed = cursor_speed
@@ -79,6 +88,7 @@ def __init__(self, display=None, display_group=None, bmp=None, is_hidden=False,
7988
else:
8089
self._cursor_bitmap = bmp
8190
self.generate_cursor(self._cursor_bitmap)
91+
8292
# pylint: enable=too-many-arguments,line-too-long
8393

8494
def __enter__(self):
@@ -96,8 +106,10 @@ def deinit(self):
96106
def _is_deinited(self):
97107
"""checks cursor deinitialization"""
98108
if self._scale is None:
99-
raise ValueError("Cursor object has been deinitialized and can no longer "
100-
"be used. Create a new cursor object.")
109+
raise ValueError(
110+
"Cursor object has been deinitialized and can no longer "
111+
"be used. Create a new cursor object."
112+
)
101113

102114
@property
103115
def scale(self):
@@ -187,7 +199,7 @@ def show(self):
187199
"""Show the cursor."""
188200
self.hidden = False
189201

190-
#pylint:disable=no-self-use
202+
# pylint:disable=no-self-use
191203
def _default_cursor_bitmap(self):
192204
bmp = displayio.Bitmap(20, 20, 3)
193205
# left edge, outline
@@ -196,20 +208,21 @@ def _default_cursor_bitmap(self):
196208
# right diag outline, inside fill
197209
for j in range(1, 15):
198210
bmp[j, j] = 2
199-
for i in range(j+1, bmp.height - j):
211+
for i in range(j + 1, bmp.height - j):
200212
bmp[j, i] = 1
201213
# bottom diag., outline
202214
for i in range(1, 5):
203-
bmp[i, bmp.height-i] = 2
215+
bmp[i, bmp.height - i] = 2
204216
# bottom flat line, right side fill
205217
for i in range(5, 15):
206218
bmp[i, 15] = 2
207-
bmp[i-1, 14] = 1
208-
bmp[i-2, 13] = 1
209-
bmp[i-3, 12] = 1
210-
bmp[i-4, 11] = 1
219+
bmp[i - 1, 14] = 1
220+
bmp[i - 2, 13] = 1
221+
bmp[i - 3, 12] = 1
222+
bmp[i - 4, 11] = 1
211223
return bmp
212-
#pylint:enable=no-self-use
224+
225+
# pylint:enable=no-self-use
213226

214227
@property
215228
def cursor_bitmap(self):
@@ -224,8 +237,7 @@ def cursor_bitmap(self, bmp):
224237
"""
225238
self._cursor_bitmap = bmp
226239
self._cursor_grp.remove(self._cur_sprite)
227-
self._cur_sprite = displayio.TileGrid(bmp,
228-
pixel_shader=self._cur_palette)
240+
self._cur_sprite = displayio.TileGrid(bmp, pixel_shader=self._cur_palette)
229241
self._cursor_grp.append(self._cur_sprite)
230242

231243
def generate_cursor(self, bmp):
@@ -236,7 +248,6 @@ def generate_cursor(self, bmp):
236248
self._cur_palette.make_transparent(0)
237249
self._cur_palette[1] = 0xFFFFFF
238250
self._cur_palette[2] = 0x0000
239-
self._cur_sprite = displayio.TileGrid(bmp,
240-
pixel_shader=self._cur_palette)
251+
self._cur_sprite = displayio.TileGrid(bmp, pixel_shader=self._cur_palette)
241252
self._cursor_grp.append(self._cur_sprite)
242253
self._display_grp.append(self._cursor_grp)

adafruit_cursorcontrol/cursorcontrol_cursormanager.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
# PyBadge & PyGamer
4242
PYBADGE_BUTTON_A = const(2)
4343

44-
class CursorManager():
44+
45+
class CursorManager:
4546
"""Simple interaction user interface interaction for Adafruit_CursorControl.
4647
4748
:param adafruit_cursorcontrol cursor: The cursor object we are using.

docs/conf.py

+65-47
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!
@@ -23,29 +24,32 @@
2324
autodoc_mock_imports = ["displayio"]
2425

2526

26-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
27+
intersphinx_mapping = {
28+
"python": ("https://docs.python.org/3.4", None),
29+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
30+
}
2731

2832
# Add any paths that contain templates here, relative to this directory.
29-
templates_path = ['_templates']
33+
templates_path = ["_templates"]
3034

31-
source_suffix = '.rst'
35+
source_suffix = ".rst"
3236

3337
# The master toctree document.
34-
master_doc = 'index'
38+
master_doc = "index"
3539

3640
# General information about the project.
37-
project = u'Adafruit CursorControl Library'
38-
copyright = u'2019 Brent Rubell'
39-
author = u'Brent Rubell'
41+
project = "Adafruit CursorControl Library"
42+
copyright = "2019 Brent Rubell"
43+
author = "Brent Rubell"
4044

4145
# The version info for the project you're documenting, acts as replacement for
4246
# |version| and |release|, also used in various other places throughout the
4347
# built documents.
4448
#
4549
# The short X.Y version.
46-
version = u'1.0'
50+
version = "1.0"
4751
# The full version, including alpha/beta/rc tags.
48-
release = u'1.0'
52+
release = "1.0"
4953

5054
# The language for content autogenerated by Sphinx. Refer to documentation
5155
# for a list of supported languages.
@@ -57,7 +61,7 @@
5761
# List of patterns, relative to source directory, that match files and
5862
# directories to ignore when looking for source files.
5963
# This patterns also effect to html_static_path and html_extra_path
60-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
64+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
6165

6266
# The reST default role (used for this markup: `text`) to use for all
6367
# documents.
@@ -69,7 +73,7 @@
6973
add_function_parentheses = True
7074

7175
# The name of the Pygments (syntax highlighting) style to use.
72-
pygments_style = 'sphinx'
76+
pygments_style = "sphinx"
7377

7478
# If true, `todo` and `todoList` produce output, else they produce nothing.
7579
todo_include_todos = False
@@ -84,68 +88,76 @@
8488
# The theme to use for HTML and HTML Help pages. See the documentation for
8589
# a list of builtin themes.
8690
#
87-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
91+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
8892

8993
if not on_rtd: # only import and set the theme if we're building docs locally
9094
try:
9195
import sphinx_rtd_theme
92-
html_theme = 'sphinx_rtd_theme'
93-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
96+
97+
html_theme = "sphinx_rtd_theme"
98+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
9499
except:
95-
html_theme = 'default'
96-
html_theme_path = ['.']
100+
html_theme = "default"
101+
html_theme_path = ["."]
97102
else:
98-
html_theme_path = ['.']
103+
html_theme_path = ["."]
99104

100105
# Add any paths that contain custom static files (such as style sheets) here,
101106
# relative to this directory. They are copied after the builtin static files,
102107
# so a file named "default.css" will overwrite the builtin "default.css".
103-
html_static_path = ['_static']
108+
html_static_path = ["_static"]
104109

105110
# The name of an image file (relative to this directory) to use as a favicon of
106111
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
107112
# pixels large.
108113
#
109-
html_favicon = '_static/favicon.ico'
114+
html_favicon = "_static/favicon.ico"
110115

111116
# Output file base name for HTML help builder.
112-
htmlhelp_basename = 'AdafruitCursorcontrolLibrarydoc'
117+
htmlhelp_basename = "AdafruitCursorcontrolLibrarydoc"
113118

114119
# -- Options for LaTeX output ---------------------------------------------
115120

116121
latex_elements = {
117-
# The paper size ('letterpaper' or 'a4paper').
118-
#
119-
# 'papersize': 'letterpaper',
120-
121-
# The font size ('10pt', '11pt' or '12pt').
122-
#
123-
# 'pointsize': '10pt',
124-
125-
# Additional stuff for the LaTeX preamble.
126-
#
127-
# 'preamble': '',
128-
129-
# Latex figure (float) alignment
130-
#
131-
# 'figure_align': 'htbp',
122+
# The paper size ('letterpaper' or 'a4paper').
123+
#
124+
# 'papersize': 'letterpaper',
125+
# The font size ('10pt', '11pt' or '12pt').
126+
#
127+
# 'pointsize': '10pt',
128+
# Additional stuff for the LaTeX preamble.
129+
#
130+
# 'preamble': '',
131+
# Latex figure (float) alignment
132+
#
133+
# 'figure_align': 'htbp',
132134
}
133135

134136
# Grouping the document tree into LaTeX files. List of tuples
135137
# (source start file, target name, title,
136138
# author, documentclass [howto, manual, or own class]).
137139
latex_documents = [
138-
(master_doc, 'AdafruitCursorControlLibrary.tex', u'AdafruitCursorControl Library Documentation',
139-
author, 'manual'),
140+
(
141+
master_doc,
142+
"AdafruitCursorControlLibrary.tex",
143+
"AdafruitCursorControl Library Documentation",
144+
author,
145+
"manual",
146+
),
140147
]
141148

142149
# -- Options for manual page output ---------------------------------------
143150

144151
# One entry per manual page. List of tuples
145152
# (source start file, name, description, authors, manual section).
146153
man_pages = [
147-
(master_doc, 'AdafruitCursorControllibrary', u'Adafruit CursorControl Library Documentation',
148-
[author], 1)
154+
(
155+
master_doc,
156+
"AdafruitCursorControllibrary",
157+
"Adafruit CursorControl Library Documentation",
158+
[author],
159+
1,
160+
)
149161
]
150162

151163
# -- Options for Texinfo output -------------------------------------------
@@ -154,7 +166,13 @@
154166
# (source start file, target name, title, author,
155167
# dir menu entry, description, category)
156168
texinfo_documents = [
157-
(master_doc, 'AdafruitCursorControlLibrary', u'Adafruit CursorControl Library Documentation',
158-
author, 'AdafruitCursorControlLibrary', 'One line description of project.',
159-
'Miscellaneous'),
169+
(
170+
master_doc,
171+
"AdafruitCursorControlLibrary",
172+
"Adafruit CursorControl Library Documentation",
173+
author,
174+
"AdafruitCursorControlLibrary",
175+
"One line description of project.",
176+
"Miscellaneous",
177+
),
160178
]

0 commit comments

Comments
 (0)