Skip to content

Commit 757d2b7

Browse files
authored
Merge pull request #78 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents 7153fc8 + c77feb9 commit 757d2b7

File tree

8 files changed

+133
-111
lines changed

8 files changed

+133
-111
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

.pylintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ spelling-store-unknown-words=no
119119
[MISCELLANEOUS]
120120

121121
# List of note tags to take in consideration, separated by a comma.
122-
notes=FIXME,XXX,TODO
122+
# notes=FIXME,XXX,TODO
123+
notes=FIXME,XXX
123124

124125

125126
[TYPECHECK]

docs/conf.py

Lines changed: 64 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,48 @@
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.viewcode',
14+
"sphinx.ext.autodoc",
15+
"sphinx.ext.intersphinx",
16+
"sphinx.ext.viewcode",
1617
]
1718

1819
autodoc_mock_imports = ["neopixel_write"]
1920

20-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
21+
intersphinx_mapping = {
22+
"python": ("https://docs.python.org/3.4", None),
23+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
24+
}
2125

2226
# Add any paths that contain templates here, relative to this directory.
23-
templates_path = ['_templates']
27+
templates_path = ["_templates"]
2428

25-
source_suffix = '.rst'
29+
source_suffix = ".rst"
2630

2731
# The master toctree document.
28-
master_doc = 'index'
32+
master_doc = "index"
2933

3034
# General information about the project.
31-
project = u'Adafruit CircuitPython NeoPixel Library'
32-
copyright = u'2017 Scott Shawcroft & Damien P. George'
33-
author = u'Scott Shawcroft & Damien P. George'
35+
project = u"Adafruit CircuitPython NeoPixel Library"
36+
copyright = u"2017 Scott Shawcroft & Damien P. George"
37+
author = u"Scott Shawcroft & Damien P. George"
3438

3539
# The version info for the project you're documenting, acts as replacement for
3640
# |version| and |release|, also used in various other places throughout the
3741
# built documents.
3842
#
3943
# The short X.Y version.
40-
version = u'1.0'
44+
version = u"1.0"
4145
# The full version, including alpha/beta/rc tags.
42-
release = u'1.0'
46+
release = u"1.0"
4347

4448
# The language for content autogenerated by Sphinx. Refer to documentation
4549
# for a list of supported languages.
@@ -51,7 +55,7 @@
5155
# List of patterns, relative to source directory, that match files and
5256
# directories to ignore when looking for source files.
5357
# This patterns also effect to html_static_path and html_extra_path
54-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
58+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
5559

5660
# The reST default role (used for this markup: `text`) to use for all
5761
# documents.
@@ -63,7 +67,7 @@
6367
add_function_parentheses = True
6468

6569
# The name of the Pygments (syntax highlighting) style to use.
66-
pygments_style = 'sphinx'
70+
pygments_style = "sphinx"
6771

6872
# If true, `todo` and `todoList` produce output, else they produce nothing.
6973
todo_include_todos = False
@@ -76,68 +80,76 @@
7680
# The theme to use for HTML and HTML Help pages. See the documentation for
7781
# a list of builtin themes.
7882
#
79-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
83+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
8084

8185
if not on_rtd: # only import and set the theme if we're building docs locally
8286
try:
8387
import sphinx_rtd_theme
84-
html_theme = 'sphinx_rtd_theme'
85-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
88+
89+
html_theme = "sphinx_rtd_theme"
90+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
8691
except:
87-
html_theme = 'default'
88-
html_theme_path = ['.']
92+
html_theme = "default"
93+
html_theme_path = ["."]
8994
else:
90-
html_theme_path = ['.']
95+
html_theme_path = ["."]
9196

9297
# Add any paths that contain custom static files (such as style sheets) here,
9398
# relative to this directory. They are copied after the builtin static files,
9499
# so a file named "default.css" will overwrite the builtin "default.css".
95-
html_static_path = ['_static']
100+
html_static_path = ["_static"]
96101

97102
# The name of an image file (relative to this directory) to use as a favicon of
98103
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
99104
# pixels large.
100105
#
101-
html_favicon = '_static/favicon.ico'
106+
html_favicon = "_static/favicon.ico"
102107

103108
# Output file base name for HTML help builder.
104-
htmlhelp_basename = 'AdafruitNEOPIXEL2Librarydoc'
109+
htmlhelp_basename = "AdafruitNEOPIXEL2Librarydoc"
105110

106111
# -- Options for LaTeX output ---------------------------------------------
107112

108113
latex_elements = {
109-
# The paper size ('letterpaper' or 'a4paper').
110-
#
111-
# 'papersize': 'letterpaper',
112-
113-
# The font size ('10pt', '11pt' or '12pt').
114-
#
115-
# 'pointsize': '10pt',
116-
117-
# Additional stuff for the LaTeX preamble.
118-
#
119-
# 'preamble': '',
120-
121-
# Latex figure (float) alignment
122-
#
123-
# 'figure_align': 'htbp',
114+
# The paper size ('letterpaper' or 'a4paper').
115+
#
116+
# 'papersize': 'letterpaper',
117+
# The font size ('10pt', '11pt' or '12pt').
118+
#
119+
# 'pointsize': '10pt',
120+
# Additional stuff for the LaTeX preamble.
121+
#
122+
# 'preamble': '',
123+
# Latex figure (float) alignment
124+
#
125+
# 'figure_align': 'htbp',
124126
}
125127

126128
# Grouping the document tree into LaTeX files. List of tuples
127129
# (source start file, target name, title,
128130
# author, documentclass [howto, manual, or own class]).
129131
latex_documents = [
130-
(master_doc, 'AdafruitNeoPixelLibrary.tex', u'Adafruit NeoPixel Library Documentation',
131-
author, 'manual'),
132+
(
133+
master_doc,
134+
"AdafruitNeoPixelLibrary.tex",
135+
u"Adafruit NeoPixel Library Documentation",
136+
author,
137+
"manual",
138+
),
132139
]
133140

134141
# -- Options for manual page output ---------------------------------------
135142

136143
# One entry per manual page. List of tuples
137144
# (source start file, name, description, authors, manual section).
138145
man_pages = [
139-
(master_doc, 'adafruitneoPixellibrary', u'Adafruit NeoPixel Library Documentation',
140-
[author], 1)
146+
(
147+
master_doc,
148+
"adafruitneoPixellibrary",
149+
u"Adafruit NeoPixel Library Documentation",
150+
[author],
151+
1,
152+
)
141153
]
142154

143155
# -- Options for Texinfo output -------------------------------------------
@@ -146,7 +158,13 @@
146158
# (source start file, target name, title, author,
147159
# dir menu entry, description, category)
148160
texinfo_documents = [
149-
(master_doc, 'AdafruitNeoPixelLibrary', u'Adafruit NeoPixel Library Documentation',
150-
author, 'AdafruitNeoPixelLibrary', 'One line description of project.',
151-
'Miscellaneous'),
161+
(
162+
master_doc,
163+
"AdafruitNeoPixelLibrary",
164+
u"Adafruit NeoPixel Library Documentation",
165+
author,
166+
"AdafruitNeoPixelLibrary",
167+
"One line description of project.",
168+
"Miscellaneous",
169+
),
152170
]

examples/neopixel_pixel.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
import neopixel
88

99
# Configure the setup
10-
PIXEL_PIN = board.D1 # pin that the NeoPixel is connected to
11-
ORDER = neopixel.RGB # pixel color channel order
12-
COLOR = (100, 50, 150) # color to blink
13-
CLEAR = (0, 0, 0) # clear (or second color)
14-
DELAY = 0.25 # blink rate in seconds
10+
PIXEL_PIN = board.D1 # pin that the NeoPixel is connected to
11+
ORDER = neopixel.RGB # pixel color channel order
12+
COLOR = (100, 50, 150) # color to blink
13+
CLEAR = (0, 0, 0) # clear (or second color)
14+
DELAY = 0.25 # blink rate in seconds
1515

1616
# Create the NeoPixel object
1717
pixel = neopixel.NeoPixel(PIXEL_PIN, 1, pixel_order=ORDER)

examples/neopixel_rpi_simpletest.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
# For RGBW NeoPixels, simply change the ORDER to RGBW or GRBW.
1616
ORDER = neopixel.GRB
1717

18-
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.2, auto_write=False,
19-
pixel_order=ORDER)
18+
pixels = neopixel.NeoPixel(
19+
pixel_pin, num_pixels, brightness=0.2, auto_write=False, pixel_order=ORDER
20+
)
2021

2122

2223
def wheel(pos):
@@ -26,19 +27,19 @@ def wheel(pos):
2627
r = g = b = 0
2728
elif pos < 85:
2829
r = int(pos * 3)
29-
g = int(255 - pos*3)
30+
g = int(255 - pos * 3)
3031
b = 0
3132
elif pos < 170:
3233
pos -= 85
33-
r = int(255 - pos*3)
34+
r = int(255 - pos * 3)
3435
g = 0
35-
b = int(pos*3)
36+
b = int(pos * 3)
3637
else:
3738
pos -= 170
3839
r = 0
39-
g = int(pos*3)
40-
b = int(255 - pos*3)
41-
return (r, g, b) if ORDER == neopixel.RGB or ORDER == neopixel.GRB else (r, g, b, 0)
40+
g = int(pos * 3)
41+
b = int(255 - pos * 3)
42+
return (r, g, b) if ORDER in (neopixel.RGB, neopixel.GRB) else (r, g, b, 0)
4243

4344

4445
def rainbow_cycle(wait):
@@ -72,4 +73,4 @@ def rainbow_cycle(wait):
7273
pixels.show()
7374
time.sleep(1)
7475

75-
rainbow_cycle(0.001) # rainbow cycle with 1ms delay per step
76+
rainbow_cycle(0.001) # rainbow cycle with 1ms delay per step

examples/neopixel_simpletest.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
pixel_pin = board.NEOPIXEL
99

1010
# On a Raspberry pi, use this instead, not all pins are supported
11-
#pixel_pin = board.D18
11+
# pixel_pin = board.D18
1212

1313
# The number of NeoPixels
1414
num_pixels = 10
@@ -17,8 +17,9 @@
1717
# For RGBW NeoPixels, simply change the ORDER to RGBW or GRBW.
1818
ORDER = neopixel.GRB
1919

20-
pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=0.2, auto_write=False,
21-
pixel_order=ORDER)
20+
pixels = neopixel.NeoPixel(
21+
pixel_pin, num_pixels, brightness=0.2, auto_write=False, pixel_order=ORDER
22+
)
2223

2324

2425
def wheel(pos):
@@ -28,19 +29,19 @@ def wheel(pos):
2829
r = g = b = 0
2930
elif pos < 85:
3031
r = int(pos * 3)
31-
g = int(255 - pos*3)
32+
g = int(255 - pos * 3)
3233
b = 0
3334
elif pos < 170:
3435
pos -= 85
35-
r = int(255 - pos*3)
36+
r = int(255 - pos * 3)
3637
g = 0
37-
b = int(pos*3)
38+
b = int(pos * 3)
3839
else:
3940
pos -= 170
4041
r = 0
41-
g = int(pos*3)
42-
b = int(255 - pos*3)
43-
return (r, g, b) if ORDER == neopixel.RGB or ORDER == neopixel.GRB else (r, g, b, 0)
42+
g = int(pos * 3)
43+
b = int(255 - pos * 3)
44+
return (r, g, b) if ORDER in (neopixel.RGB, neopixel.GRB) else (r, g, b, 0)
4445

4546

4647
def rainbow_cycle(wait):
@@ -74,4 +75,4 @@ def rainbow_cycle(wait):
7475
pixels.show()
7576
time.sleep(1)
7677

77-
rainbow_cycle(0.001) # rainbow cycle with 1ms delay per step
78+
rainbow_cycle(0.001) # rainbow cycle with 1ms delay per step

0 commit comments

Comments
 (0)