Skip to content

Commit e3e8008

Browse files
authored
Merge pull request #15 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents b9a5fce + 8b1eb6d commit e3e8008

8 files changed

+123
-108
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_st7735r.py

+22-19
Original file line numberDiff line numberDiff line change
@@ -57,39 +57,42 @@
5757
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_ST7735R.git"
5858

5959
_INIT_SEQUENCE = bytearray(
60-
b"\x01\x80\x96" # SWRESET and Delay 150ms
61-
b"\x11\x80\xff" # SLPOUT and Delay
62-
b"\xb1\x03\x01\x2C\x2D" # _FRMCTR1
63-
b"\xb2\x03\x01\x2C\x2D" # _FRMCTR2
64-
b"\xb3\x06\x01\x2C\x2D\x01\x2C\x2D" # _FRMCTR3
65-
b"\xb4\x01\x07" # _INVCTR line inversion
66-
b"\xc0\x03\xa2\x02\x84" # _PWCTR1 GVDD = 4.7V, 1.0uA
67-
b"\xc1\x01\xc5" # _PWCTR2 VGH=14.7V, VGL=-7.35V
68-
b"\xc2\x02\x0a\x00" # _PWCTR3 Opamp current small, Boost frequency
60+
b"\x01\x80\x96" # SWRESET and Delay 150ms
61+
b"\x11\x80\xff" # SLPOUT and Delay
62+
b"\xb1\x03\x01\x2C\x2D" # _FRMCTR1
63+
b"\xb2\x03\x01\x2C\x2D" # _FRMCTR2
64+
b"\xb3\x06\x01\x2C\x2D\x01\x2C\x2D" # _FRMCTR3
65+
b"\xb4\x01\x07" # _INVCTR line inversion
66+
b"\xc0\x03\xa2\x02\x84" # _PWCTR1 GVDD = 4.7V, 1.0uA
67+
b"\xc1\x01\xc5" # _PWCTR2 VGH=14.7V, VGL=-7.35V
68+
b"\xc2\x02\x0a\x00" # _PWCTR3 Opamp current small, Boost frequency
6969
b"\xc3\x02\x8a\x2a"
7070
b"\xc4\x02\x8a\xee"
71-
b"\xc5\x01\x0e" # _VMCTR1 VCOMH = 4V, VOML = -1.1V
72-
b"\x20\x00" # _INVOFF
73-
b"\x36\x01\x18" # _MADCTL bottom to top refresh
71+
b"\xc5\x01\x0e" # _VMCTR1 VCOMH = 4V, VOML = -1.1V
72+
b"\x20\x00" # _INVOFF
73+
b"\x36\x01\x18" # _MADCTL bottom to top refresh
7474
# 1 clk cycle nonoverlap, 2 cycle gate rise, 3 sycle osc equalie,
7575
# fix on VTL
76-
b"\x3a\x01\x05" # COLMOD - 16bit color
77-
b"\xe0\x10\x02\x1c\x07\x12\x37\x32\x29\x2d\x29\x25\x2B\x39\x00\x01\x03\x10" # _GMCTRP1 Gamma
78-
b"\xe1\x10\x03\x1d\x07\x06\x2E\x2C\x29\x2D\x2E\x2E\x37\x3F\x00\x00\x02\x10" # _GMCTRN1
79-
b"\x13\x80\x0a" # _NORON
80-
b"\x29\x80\x64" # _DISPON
76+
b"\x3a\x01\x05" # COLMOD - 16bit color
77+
b"\xe0\x10\x02\x1c\x07\x12\x37\x32\x29\x2d\x29\x25\x2B\x39\x00\x01\x03\x10" # _GMCTRP1 Gamma
78+
b"\xe1\x10\x03\x1d\x07\x06\x2E\x2C\x29\x2D\x2E\x2E\x37\x3F\x00\x00\x02\x10" # _GMCTRN1
79+
b"\x13\x80\x0a" # _NORON
80+
b"\x29\x80\x64" # _DISPON
8181
)
8282

8383
# pylint: disable=too-few-public-methods
8484
class ST7735R(displayio.Display):
8585
"""ST7735 driver for ST7735R"""
86+
8687
def __init__(self, bus, *, bgr=False, invert=False, **kwargs):
8788
"""
8889
:param bool bgr: (Optional) An extra init sequence to append (default=False)
8990
"""
9091
init_sequence = _INIT_SEQUENCE
9192
if bgr:
92-
init_sequence += b"\x36\x01\xC0" # _MADCTL Default rotation plus BGR encoding
93+
init_sequence += (
94+
b"\x36\x01\xC0" # _MADCTL Default rotation plus BGR encoding
95+
)
9396
if invert:
94-
init_sequence += b"\x21\x00" # _INVON
97+
init_sequence += b"\x21\x00" # _INVON
9598
super().__init__(bus, init_sequence, **kwargs)

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 = ["digitalio", "busio"]
2425
autodoc_mock_imports = ["displayio"]
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 ST7735R Library'
38-
copyright = u'2019 Scott Shawcroft'
39-
author = u'Scott Shawcroft'
41+
project = "Adafruit ST7735R Library"
42+
copyright = "2019 Scott Shawcroft"
43+
author = "Scott Shawcroft"
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 = 'AdafruitSt7735RLibrarydoc'
117+
htmlhelp_basename = "AdafruitSt7735RLibrarydoc"
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, 'AdafruitST7735RLibrary.tex', u'AdafruitST7735R Library Documentation',
139-
author, 'manual'),
140+
(
141+
master_doc,
142+
"AdafruitST7735RLibrary.tex",
143+
"AdafruitST7735R 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, 'AdafruitST7735Rlibrary', u'Adafruit ST7735R Library Documentation',
148-
[author], 1)
154+
(
155+
master_doc,
156+
"AdafruitST7735Rlibrary",
157+
"Adafruit ST7735R 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, 'AdafruitST7735RLibrary', u'Adafruit ST7735R Library Documentation',
158-
author, 'AdafruitST7735RLibrary', 'One line description of project.',
159-
'Miscellaneous'),
169+
(
170+
master_doc,
171+
"AdafruitST7735RLibrary",
172+
"Adafruit ST7735R Library Documentation",
173+
author,
174+
"AdafruitST7735RLibrary",
175+
"One line description of project.",
176+
"Miscellaneous",
177+
),
160178
]

examples/st7735r_128x160_simpletest.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
tft_cs = board.D5
1717
tft_dc = board.D6
1818

19-
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs, reset=board.D9)
19+
display_bus = displayio.FourWire(
20+
spi, command=tft_dc, chip_select=tft_cs, reset=board.D9
21+
)
2022

2123
display = ST7735R(display_bus, width=160, height=128, rotation=90, bgr=True)
2224

@@ -26,27 +28,23 @@
2628

2729
color_bitmap = displayio.Bitmap(160, 128, 1)
2830
color_palette = displayio.Palette(1)
29-
color_palette[0] = 0x00FF00 # Bright Green
31+
color_palette[0] = 0x00FF00 # Bright Green
3032

31-
bg_sprite = displayio.TileGrid(color_bitmap,
32-
pixel_shader=color_palette,
33-
x=0, y=0)
33+
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
3434
splash.append(bg_sprite)
3535

3636
# Draw a smaller inner rectangle
3737
inner_bitmap = displayio.Bitmap(150, 118, 1)
3838
inner_palette = displayio.Palette(1)
39-
inner_palette[0] = 0xAA0088 # Purple
40-
inner_sprite = displayio.TileGrid(inner_bitmap,
41-
pixel_shader=inner_palette,
42-
x=5, y=5)
39+
inner_palette[0] = 0xAA0088 # Purple
40+
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=5, y=5)
4341
splash.append(inner_sprite)
4442

4543
# Draw a label
4644
text_group = displayio.Group(max_size=10, scale=2, x=11, y=64)
4745
text = "Hello World!"
4846
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00)
49-
text_group.append(text_area) # Subgroup for text scaling
47+
text_group.append(text_area) # Subgroup for text scaling
5048
splash.append(text_group)
5149

5250
while True:

examples/st7735r_18tftshield_buttons.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@
5050
if buttons.c:
5151
print("Button C!")
5252

53-
time.sleep(.001)
53+
time.sleep(0.001)

examples/st7735r_minitft_featherwing_simpletest.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,33 @@
2525
display_bus = displayio.FourWire(spi, command=tft_dc, chip_select=tft_cs)
2626

2727
ss.digital_write(reset_pin, True)
28-
display = ST7735R(display_bus, width=160, height=80, colstart=24, rotation=270, bgr=True)
28+
display = ST7735R(
29+
display_bus, width=160, height=80, colstart=24, rotation=270, bgr=True
30+
)
2931

3032
# Make the display context
3133
splash = displayio.Group(max_size=10)
3234
display.show(splash)
3335

3436
color_bitmap = displayio.Bitmap(160, 80, 1)
3537
color_palette = displayio.Palette(1)
36-
color_palette[0] = 0x00FF00 # Bright Green
38+
color_palette[0] = 0x00FF00 # Bright Green
3739

38-
bg_sprite = displayio.TileGrid(color_bitmap,
39-
pixel_shader=color_palette,
40-
x=0, y=0)
40+
bg_sprite = displayio.TileGrid(color_bitmap, pixel_shader=color_palette, x=0, y=0)
4141
splash.append(bg_sprite)
4242

4343
# Draw a smaller inner rectangle
4444
inner_bitmap = displayio.Bitmap(150, 70, 1)
4545
inner_palette = displayio.Palette(1)
46-
inner_palette[0] = 0xAA0088 # Purple
47-
inner_sprite = displayio.TileGrid(inner_bitmap,
48-
pixel_shader=inner_palette,
49-
x=5, y=5)
46+
inner_palette[0] = 0xAA0088 # Purple
47+
inner_sprite = displayio.TileGrid(inner_bitmap, pixel_shader=inner_palette, x=5, y=5)
5048
splash.append(inner_sprite)
5149

5250
# Draw a label
5351
text_group = displayio.Group(max_size=10, scale=2, x=11, y=40)
5452
text = "Hello World!"
5553
text_area = label.Label(terminalio.FONT, text=text, color=0xFFFF00)
56-
text_group.append(text_area) # Subgroup for text scaling
54+
text_group.append(text_area) # Subgroup for text scaling
5755
splash.append(text_group)
5856

5957
while True:

0 commit comments

Comments
 (0)