Skip to content

Commit f363100

Browse files
committed
Merge branch 'master' into pixelbuf
2 parents ccc7093 + e2ffd40 commit f363100

File tree

8 files changed

+132
-110
lines changed

8 files changed

+132
-110
lines changed

.github/workflows/build.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,18 @@ jobs:
3434
with:
3535
repository: adafruit/actions-ci-circuitpython-libs
3636
path: actions-ci
37-
- name: Install deps
37+
- name: Install dependencies
38+
# (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.)
3839
run: |
3940
source actions-ci/install.sh
41+
- name: Pip install pylint, black, & Sphinx
42+
run: |
43+
pip install --force-reinstall pylint black==19.10b0 Sphinx sphinx-rtd-theme
4044
- name: Library version
4145
run: git describe --dirty --always --tags
46+
- name: Check formatting
47+
run: |
48+
black --check --target-version=py35
4249
- name: PyLint
4350
run: |
4451
pylint $( find . -path './neopixel.py' )

.pylintrc

+3-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ confidence=
5252
# no Warning level messages displayed, use"--disable=all --enable=classes
5353
# --disable=W"
5454
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
55-
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error
55+
disable=print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,bad-continuation
5656

5757
# Enable the message, report, category or checker with the given id(s). You can
5858
# either give multiple identifier separated by comma (,) or put this option
@@ -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]

CODE_OF_CONDUCT.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ Examples of unacceptable behavior by participants include:
3434
* Excessive or unwelcome helping; answering outside the scope of the question
3535
asked
3636
* Trolling, insulting/derogatory comments, and personal or political attacks
37+
* Promoting or spreading disinformation, lies, or conspiracy theories against
38+
a person, group, organisation, project, or community
3739
* Public or private harassment
3840
* Publishing others' private information, such as a physical or electronic
3941
address, without explicit permission
4042
* Other conduct which could reasonably be considered inappropriate
4143

4244
The goal of the standards and moderation guidelines outlined here is to build
43-
and maintain a respectful community. We ask that you don’t just aim to be
45+
and maintain a respectful community. We ask that you don’t just aim to be
4446
"technically unimpeachable", but rather try to be your best self.
4547

4648
We value many things beyond technical expertise, including collaboration and
@@ -72,18 +74,18 @@ You may report in the following ways:
7274
In any situation, you may send an email to <[email protected]>.
7375

7476
On the Adafruit Discord, you may send an open message from any channel
75-
to all Community Helpers by tagging @community helpers. You may also send an
76-
open message from any channel, or a direct message to @kattni#1507,
77-
@tannewt#4653, @Dan Halbert#1614, @cater#2442, @sommersoft#0222, or
78-
@Andon#8175.
77+
to all Community Moderators by tagging @community moderators. You may
78+
also send an open message from any channel, or a direct message to
79+
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
80+
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
7981

8082
Email and direct message reports will be kept confidential.
8183

8284
In situations on Discord where the issue is particularly egregious, possibly
8385
illegal, requires immediate action, or violates the Discord terms of service,
8486
you should also report the message directly to Discord.
8587

86-
These are the steps for upholding our community’s standards of conduct.
88+
These are the steps for upholding our community’s standards of conduct.
8789

8890
1. Any member of the community may report any situation that violates the
8991
Adafruit Community Code of Conduct. All reports will be reviewed and
@@ -124,4 +126,4 @@ For other projects adopting the Adafruit Community Code of
124126
Conduct, please contact the maintainers of those projects for enforcement.
125127
If you wish to use this code of conduct for your own project, consider
126128
explicitly mentioning your moderation policy or making a copy with your
127-
own moderation policy so as to avoid confusion.
129+
own moderation policy so as to avoid confusion.

docs/conf.py

+64-46
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 = "Adafruit CircuitPython NeoPixel Library"
36+
copyright = "2017 Scott Shawcroft & Damien P. George"
37+
author = "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 = "1.0"
4145
# The full version, including alpha/beta/rc tags.
42-
release = u'1.0'
46+
release = "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+
"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+
"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+
"Adafruit NeoPixel Library Documentation",
165+
author,
166+
"AdafruitNeoPixelLibrary",
167+
"One line description of project.",
168+
"Miscellaneous",
169+
),
152170
]

examples/neopixel_pixel.py

+5-5
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

+10-9
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

0 commit comments

Comments
 (0)