Skip to content

Commit 9a60314

Browse files
committed
Ran black, made pylint 2.x compatible
1 parent 28b0f65 commit 9a60314

9 files changed

+162
-128
lines changed

adafruit_il0373.py

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@
5252
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_IL0373.git"
5353

5454
_START_SEQUENCE = (
55-
b"\x01\x05\x03\x00\x2b\x2b\x09" # power setting
56-
b"\x06\x03\x17\x17\x17" # booster soft start
57-
b"\x04\x80\xc8" # power on and wait 200 ms
58-
b"\x00\x01\xcf" # panel setting
59-
b"\x50\x01\x37" # CDI setting
60-
b"\x30\x01\x29" # PLL
61-
b"\x61\x03\x00\x00\x00" # Resolution
62-
b"\x82\x81\x32\x0a" # VCM DC and delay 50ms
55+
b"\x01\x05\x03\x00\x2b\x2b\x09" # power setting
56+
b"\x06\x03\x17\x17\x17" # booster soft start
57+
b"\x04\x80\xc8" # power on and wait 200 ms
58+
b"\x00\x01\xcf" # panel setting
59+
b"\x50\x01\x37" # CDI setting
60+
b"\x30\x01\x29" # PLL
61+
b"\x61\x03\x00\x00\x00" # Resolution
62+
b"\x82\x81\x32\x0a" # VCM DC and delay 50ms
6363
)
6464

6565
_STOP_SEQUENCE = (
66-
b"\x50\x01\x17" # CDI setting
67-
b"\x82\x01\x00" # VCM DC and delay 50ms
68-
b"\x02\x00" # Power off
66+
b"\x50\x01\x17" # CDI setting
67+
b"\x82\x01\x00" # VCM DC and delay 50ms
68+
b"\x02\x00" # Power off
6969
)
7070
# pylint: disable=too-few-public-methods
7171
class IL0373(displayio.EPaperDisplay):
@@ -88,15 +88,14 @@ class IL0373(displayio.EPaperDisplay):
8888
* *black_bits_inverted* (``bool``) --
8989
Invert black bit values
9090
"""
91+
9192
def __init__(self, bus, swap_rams=False, **kwargs):
9293
start_sequence = bytearray(_START_SEQUENCE)
9394

9495
width = kwargs["width"]
9596
height = kwargs["height"]
9697
if "rotation" in kwargs and kwargs["rotation"] % 180 != 0:
97-
w = width
98-
width = height
99-
height = w
98+
width, height = height, width
10099
start_sequence[26] = width & 0xFF
101100
start_sequence[27] = (height >> 8) & 0xFF
102101
start_sequence[28] = height & 0xFF
@@ -110,11 +109,17 @@ def __init__(self, bus, swap_rams=False, **kwargs):
110109
write_color_ram_command = 0x13
111110
color_bits_inverted = kwargs.pop("color_bits_inverted", True)
112111
black_bits_inverted = kwargs.pop("black_bits_inverted", False)
113-
super().__init__(bus, start_sequence, _STOP_SEQUENCE, **kwargs,
114-
ram_width=160, ram_height=296,
115-
busy_state=False,
116-
write_black_ram_command=write_black_ram_command,
117-
write_color_ram_command=write_color_ram_command,
118-
black_bits_inverted=black_bits_inverted,
119-
color_bits_inverted=color_bits_inverted,
120-
refresh_display_command=0x12)
112+
super().__init__(
113+
bus,
114+
start_sequence,
115+
_STOP_SEQUENCE,
116+
**kwargs,
117+
ram_width=160,
118+
ram_height=296,
119+
busy_state=False,
120+
write_black_ram_command=write_black_ram_command,
121+
write_color_ram_command=write_color_ram_command,
122+
black_bits_inverted=black_bits_inverted,
123+
color_bits_inverted=color_bits_inverted,
124+
refresh_display_command=0x12,
125+
)

docs/conf.py

Lines changed: 65 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!
@@ -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 IL0373 Library'
38-
copyright = u'2019 Scott Shawcroft'
39-
author = u'Scott Shawcroft'
41+
project = "Adafruit IL0373 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 = 'AdafruitIl0373Librarydoc'
117+
htmlhelp_basename = "AdafruitIl0373Librarydoc"
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, 'AdafruitIL0373Library.tex', u'AdafruitIL0373 Library Documentation',
139-
author, 'manual'),
140+
(
141+
master_doc,
142+
"AdafruitIL0373Library.tex",
143+
"AdafruitIL0373 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, 'AdafruitIL0373library', u'Adafruit IL0373 Library Documentation',
148-
[author], 1)
154+
(
155+
master_doc,
156+
"AdafruitIL0373library",
157+
"Adafruit IL0373 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, 'AdafruitIL0373Library', u'Adafruit IL0373 Library Documentation',
158-
author, 'AdafruitIL0373Library', 'One line description of project.',
159-
'Miscellaneous'),
169+
(
170+
master_doc,
171+
"AdafruitIL0373Library",
172+
"Adafruit IL0373 Library Documentation",
173+
author,
174+
"AdafruitIL0373Library",
175+
"One line description of project.",
176+
"Miscellaneous",
177+
),
160178
]

examples/il0373_1.54_color.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
displayio.release_displays()
1414

1515
# This pinout works on a Feather M4 and may need to be altered for other boards.
16-
spi = board.SPI() # Uses SCK and MOSI
16+
spi = board.SPI() # Uses SCK and MOSI
1717
epd_cs = board.D9
1818
epd_dc = board.D10
1919
epd_reset = board.D5
2020
epd_busy = board.D6
2121

22-
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
23-
baudrate=1000000)
22+
display_bus = displayio.FourWire(
23+
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
24+
)
2425
time.sleep(1)
2526

26-
display = adafruit_il0373.IL0373(display_bus, width=152, height=152, busy_pin=epd_busy,
27-
highlight_color=0xff0000)
27+
display = adafruit_il0373.IL0373(
28+
display_bus, width=152, height=152, busy_pin=epd_busy, highlight_color=0xFF0000
29+
)
2830

2931
g = displayio.Group()
3032

examples/il0373_2.13_color.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,20 @@
2222
epd_busy = board.D6
2323

2424
# Create the displayio connection to the display pins
25-
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,
26-
reset=epd_reset, baudrate=1000000)
25+
display_bus = displayio.FourWire(
26+
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
27+
)
2728
time.sleep(1) # Wait a bit
2829

2930
# Create the display object - the third color is red (0xff0000)
30-
display = adafruit_il0373.IL0373(display_bus, width=212, height=104,
31-
rotation=90, busy_pin=epd_busy,
32-
highlight_color=0xff0000)
31+
display = adafruit_il0373.IL0373(
32+
display_bus,
33+
width=212,
34+
height=104,
35+
rotation=90,
36+
busy_pin=epd_busy,
37+
highlight_color=0xFF0000,
38+
)
3339

3440
# Create a display group for our screen objects
3541
g = displayio.Group()

examples/il0373_2.9_color.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@
2121
epd_busy = board.D6
2222

2323
# Create the displayio connection to the display pins
24-
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs,
25-
reset=epd_reset, baudrate=1000000)
24+
display_bus = displayio.FourWire(
25+
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
26+
)
2627
time.sleep(1) # Wait a bit
2728

2829
# Create the display object - the third color is red (0xff0000)
29-
display = adafruit_il0373.IL0373(display_bus, width=296, height=128,
30-
rotation=270, busy_pin=epd_busy,
31-
highlight_color=0xff0000)
30+
display = adafruit_il0373.IL0373(
31+
display_bus,
32+
width=296,
33+
height=128,
34+
rotation=270,
35+
busy_pin=epd_busy,
36+
highlight_color=0xFF0000,
37+
)
3238

3339
# Create a display group for our screen objects
3440
g = displayio.Group()

examples/il0373_flexible_2.13_monochrome.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,20 @@
1313
displayio.release_displays()
1414

1515
# This pinout works on a Feather M4 and may need to be altered for other boards.
16-
spi = board.SPI() # Uses SCK and MOSI
16+
spi = board.SPI() # Uses SCK and MOSI
1717
epd_cs = board.D9
1818
epd_dc = board.D10
1919
epd_reset = board.D5
2020
epd_busy = board.D6
2121

22-
display_bus = displayio.FourWire(spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset,
23-
baudrate=1000000)
22+
display_bus = displayio.FourWire(
23+
spi, command=epd_dc, chip_select=epd_cs, reset=epd_reset, baudrate=1000000
24+
)
2425
time.sleep(1)
2526

26-
display = adafruit_il0373.IL0373(display_bus, width=212, height=104, rotation=90, busy_pin=epd_busy,
27-
swap_rams=True)
27+
display = adafruit_il0373.IL0373(
28+
display_bus, width=212, height=104, rotation=90, busy_pin=epd_busy, swap_rams=True
29+
)
2830

2931
g = displayio.Group()
3032

0 commit comments

Comments
 (0)