Skip to content

Commit 192dc64

Browse files
authored
Merge pull request #12 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents 87ab5a2 + 9f1863e commit 192dc64

File tree

8 files changed

+130
-110
lines changed

8 files changed

+130
-110
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 --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_gizmo/eink_gizmo.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,24 @@ class EInk_Gizmo(IL0373):
4444
def __init__(self, *, spi=None, cs=None, dc=None, reset=None, busy=None):
4545
displayio.release_displays()
4646
if spi is None:
47-
import busio
47+
import busio # pylint: disable=import-outside-toplevel
48+
4849
spi = busio.SPI(board.SCL, MOSI=board.SDA)
4950
if cs is None:
5051
cs = board.RX
5152
if dc is None:
5253
dc = board.TX
5354
if reset is None:
5455
reset = board.A3
55-
self._display_bus = displayio.FourWire(spi,
56-
command=dc,
57-
chip_select=cs,
58-
reset=reset,
59-
baudrate=1000000)
56+
self._display_bus = displayio.FourWire(
57+
spi, command=dc, chip_select=cs, reset=reset, baudrate=1000000
58+
)
6059
sleep(1)
61-
super().__init__(self._display_bus, width=152, height=152,
62-
busy_pin=busy, rotation=180,
63-
highlight_color=0xff0000)
60+
super().__init__(
61+
self._display_bus,
62+
width=152,
63+
height=152,
64+
busy_pin=busy,
65+
rotation=180,
66+
highlight_color=0xFF0000,
67+
)

adafruit_gizmo/tft_gizmo.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,20 @@
4040
class TFT_Gizmo(ST7789):
4141
"""Class representing a TFT Gizmo."""
4242

43-
def __init__(self, *, spi=None, cs=board.RX, dc=board.TX,
44-
backlight=board.A3, rotation=180):
43+
def __init__(
44+
self, *, spi=None, cs=board.RX, dc=board.TX, backlight=board.A3, rotation=180
45+
):
4546
displayio.release_displays()
4647
if spi is None:
47-
import busio
48+
import busio # pylint: disable=import-outside-toplevel
49+
4850
spi = busio.SPI(board.SCL, MOSI=board.SDA)
49-
self._display_bus = displayio.FourWire(spi,
50-
command=dc,
51-
chip_select=cs)
52-
super().__init__(self._display_bus, width=240, height=240,
53-
rowstart=80, backlight_pin=backlight,
54-
rotation=rotation)
51+
self._display_bus = displayio.FourWire(spi, command=dc, chip_select=cs)
52+
super().__init__(
53+
self._display_bus,
54+
width=240,
55+
height=240,
56+
rowstart=80,
57+
backlight_pin=backlight,
58+
rotation=rotation,
59+
)

docs/conf.py

+69-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,36 @@
2324
autodoc_mock_imports = ["adafruit_st7789", "digitalio", "busio", "displayio", "board"]
2425

2526

26-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
27+
intersphinx_mapping = {
28+
"python": ("https://docs.python.org/3.4", None),
29+
"BusDevice": (
30+
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
31+
None,
32+
),
33+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
34+
}
2735

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

31-
source_suffix = '.rst'
39+
source_suffix = ".rst"
3240

3341
# The master toctree document.
34-
master_doc = 'index'
42+
master_doc = "index"
3543

3644
# General information about the project.
37-
project = u'Adafruit Gizmo Library'
38-
copyright = u'2019 Carter Nelson'
39-
author = u'Carter Nelson'
45+
project = u"Adafruit Gizmo Library"
46+
copyright = u"2019 Carter Nelson"
47+
author = u"Carter Nelson"
4048

4149
# The version info for the project you're documenting, acts as replacement for
4250
# |version| and |release|, also used in various other places throughout the
4351
# built documents.
4452
#
4553
# The short X.Y version.
46-
version = u'1.0'
54+
version = u"1.0"
4755
# The full version, including alpha/beta/rc tags.
48-
release = u'1.0'
56+
release = u"1.0"
4957

5058
# The language for content autogenerated by Sphinx. Refer to documentation
5159
# for a list of supported languages.
@@ -57,7 +65,7 @@
5765
# List of patterns, relative to source directory, that match files and
5866
# directories to ignore when looking for source files.
5967
# 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']
68+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
6169

6270
# The reST default role (used for this markup: `text`) to use for all
6371
# documents.
@@ -69,7 +77,7 @@
6977
add_function_parentheses = True
7078

7179
# The name of the Pygments (syntax highlighting) style to use.
72-
pygments_style = 'sphinx'
80+
pygments_style = "sphinx"
7381

7482
# If true, `todo` and `todoList` produce output, else they produce nothing.
7583
todo_include_todos = False
@@ -84,68 +92,76 @@
8492
# The theme to use for HTML and HTML Help pages. See the documentation for
8593
# a list of builtin themes.
8694
#
87-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
95+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
8896

8997
if not on_rtd: # only import and set the theme if we're building docs locally
9098
try:
9199
import sphinx_rtd_theme
92-
html_theme = 'sphinx_rtd_theme'
93-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
100+
101+
html_theme = "sphinx_rtd_theme"
102+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
94103
except:
95-
html_theme = 'default'
96-
html_theme_path = ['.']
104+
html_theme = "default"
105+
html_theme_path = ["."]
97106
else:
98-
html_theme_path = ['.']
107+
html_theme_path = ["."]
99108

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

105114
# The name of an image file (relative to this directory) to use as a favicon of
106115
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
107116
# pixels large.
108117
#
109-
html_favicon = '_static/favicon.ico'
118+
html_favicon = "_static/favicon.ico"
110119

111120
# Output file base name for HTML help builder.
112-
htmlhelp_basename = 'AdafruitGizmoLibrarydoc'
121+
htmlhelp_basename = "AdafruitGizmoLibrarydoc"
113122

114123
# -- Options for LaTeX output ---------------------------------------------
115124

116125
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',
126+
# The paper size ('letterpaper' or 'a4paper').
127+
#
128+
# 'papersize': 'letterpaper',
129+
# The font size ('10pt', '11pt' or '12pt').
130+
#
131+
# 'pointsize': '10pt',
132+
# Additional stuff for the LaTeX preamble.
133+
#
134+
# 'preamble': '',
135+
# Latex figure (float) alignment
136+
#
137+
# 'figure_align': 'htbp',
132138
}
133139

134140
# Grouping the document tree into LaTeX files. List of tuples
135141
# (source start file, target name, title,
136142
# author, documentclass [howto, manual, or own class]).
137143
latex_documents = [
138-
(master_doc, 'AdafruitGizmoLibrary.tex', u'AdafruitGizmo Library Documentation',
139-
author, 'manual'),
144+
(
145+
master_doc,
146+
"AdafruitGizmoLibrary.tex",
147+
u"AdafruitGizmo Library Documentation",
148+
author,
149+
"manual",
150+
),
140151
]
141152

142153
# -- Options for manual page output ---------------------------------------
143154

144155
# One entry per manual page. List of tuples
145156
# (source start file, name, description, authors, manual section).
146157
man_pages = [
147-
(master_doc, 'AdafruitGizmolibrary', u'Adafruit Gizmo Library Documentation',
148-
[author], 1)
158+
(
159+
master_doc,
160+
"AdafruitGizmolibrary",
161+
u"Adafruit Gizmo Library Documentation",
162+
[author],
163+
1,
164+
)
149165
]
150166

151167
# -- Options for Texinfo output -------------------------------------------
@@ -154,7 +170,13 @@
154170
# (source start file, target name, title, author,
155171
# dir menu entry, description, category)
156172
texinfo_documents = [
157-
(master_doc, 'AdafruitGizmoLibrary', u'Adafruit Gizmo Library Documentation',
158-
author, 'AdafruitGizmoLibrary', 'One line description of project.',
159-
'Miscellaneous'),
173+
(
174+
master_doc,
175+
"AdafruitGizmoLibrary",
176+
u"Adafruit Gizmo Library Documentation",
177+
author,
178+
"AdafruitGizmoLibrary",
179+
"One line description of project.",
180+
"Miscellaneous",
181+
),
160182
]

examples/gizmo_simpletest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Create a two color palette
1616
palette = displayio.Palette(2)
1717
palette[0] = 0x000000
18-
palette[1] = 0xffffff
18+
palette[1] = 0xFFFFFF
1919

2020
# Create a TileGrid using the Bitmap and Palette
2121
tile_grid = displayio.TileGrid(bitmap, pixel_shader=palette)

examples/gizmo_tft_demo.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,23 @@
1616

1717
color_bitmap = displayio.Bitmap(240, 240, 1)
1818
color_palette = displayio.Palette(1)
19-
color_palette[0] = 0x00FF00 # Bright Green
19+
color_palette[0] = 0x00FF00 # Bright Green
2020

21-
bg_sprite = displayio.TileGrid(color_bitmap,
22-
pixel_shader=color_palette,
23-
x=0, y=0)
21+
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
2422
splash.append(bg_sprite)
2523

2624
# Draw a smaller inner rectangle
2725
inner_bitmap = displayio.Bitmap(200, 200, 1)
2826
inner_palette = displayio.Palette(1)
29-
inner_palette[0] = 0xAA0088 # Purple
30-
inner_sprite = displayio.TileGrid(inner_bitmap,
31-
pixel_shader=inner_palette,
32-
x=20, y=20)
27+
inner_palette[0] = 0xAA0088 # Purple
28+
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=20, y=20)
3329
splash.append(inner_sprite)
3430

3531
# Draw a label
3632
text_group = displayio.Group(max_size=10, scale=2, x=50, y=120)
3733
text = "Hello World!"
3834
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00)
39-
text_group.append(text_area) # Subgroup for text scaling
35+
text_group.append(text_area) # Subgroup for text scaling
4036
splash.append(text_group)
4137

4238
while True:

examples/gizmo_tft_termometer.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import terminalio
1616
from adafruit_display_text import label
1717
from adafruit_gizmo import tft_gizmo
18+
1819
display = tft_gizmo.TFT_Gizmo()
1920

2021

@@ -30,7 +31,7 @@
3031

3132
# function to convert celsius degrees to fahrenheit
3233
def c_to_f(c_val):
33-
return (c_val * 9/5) + 32
34+
return (c_val * 9 / 5) + 32
3435

3536

3637
# Open the background image file
@@ -61,7 +62,7 @@ def c_to_f(c_val):
6162
text_area.anchor_point = (0.5, 0.0)
6263

6364
# Set the location to center of display, accounting for text_scale
64-
text_area.anchored_position = (240/(2*TEXT_SCALE), 240/(2*TEXT_SCALE))
65+
text_area.anchored_position = (240 / (2 * TEXT_SCALE), 240 / (2 * TEXT_SCALE))
6566

6667
# Subgroup for text scaling
6768
text_group.append(text_area)
@@ -77,7 +78,7 @@ def c_to_f(c_val):
7778
# set current button state to variable
7879
cur_a_val = cp.button_a
7980
if cur_a_val and not old_a_val: # if the button was released
80-
print('Just released')
81+
print("Just released")
8182
# flip the units boolean to the opposite value
8283
show_c_units = not show_c_units
8384

0 commit comments

Comments
 (0)