Skip to content

Commit b45b100

Browse files
authored
Merge pull request #9 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents baa6900 + 33f76b6 commit b45b100

File tree

4 files changed

+96
-71
lines changed

4 files changed

+96
-71
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__cpython.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
4040
* Adafruit CircuitPython firmware for the supported boards:
4141
https://github.com/adafruit/circuitpython/releases
42-
42+
4343
.. todo:: Uncomment or remove the Bus Device and/or the Register library dependencies based on the library's use of either.
4444
4545
# * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice

colorsys.py

+29-22
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,43 @@
77
# This implements a chopped down relevant version of the colorsys library
88
# to add HLS and HSV to RGB support. Script altered to return RGB[0-255]
99

10-
__all__ = ["hls_to_rgb","hsv_to_rgb"]
10+
__all__ = ["hls_to_rgb", "hsv_to_rgb"]
1111

1212
# Some floating point constants
1313

14-
ONE_THIRD = 1.0/3.0
15-
ONE_SIXTH = 1.0/6.0
16-
TWO_THIRD = 2.0/3.0
14+
ONE_THIRD = 1.0 / 3.0
15+
ONE_SIXTH = 1.0 / 6.0
16+
TWO_THIRD = 2.0 / 3.0
1717

1818
# HLS: Hue, Luminance, Saturation
1919
# H: position in the spectrum
2020
# L: color lightness
2121
# S: color saturation
2222

23+
2324
def hls_to_rgb(h, l, s):
2425
if s == 0.0:
2526
return l, l, l
2627
if l <= 0.5:
27-
m2 = l * (1.0+s)
28+
m2 = l * (1.0 + s)
2829
else:
29-
m2 = l+s-(l*s)
30-
m1 = 2.0*l - m2
31-
return (int(_v(m1, m2, h+ONE_THIRD)*255), int(_v(m1, m2, h)*255), int(_v(m1, m2, h-ONE_THIRD)*255))
30+
m2 = l + s - (l * s)
31+
m1 = 2.0 * l - m2
32+
return (
33+
int(_v(m1, m2, h + ONE_THIRD) * 255),
34+
int(_v(m1, m2, h) * 255),
35+
int(_v(m1, m2, h - ONE_THIRD) * 255),
36+
)
37+
3238

3339
def _v(m1, m2, hue):
3440
hue = hue % 1.0
3541
if hue < ONE_SIXTH:
36-
return m1 + (m2-m1)*hue*6.0
42+
return m1 + (m2 - m1) * hue * 6.0
3743
if hue < 0.5:
3844
return m2
3945
if hue < TWO_THIRD:
40-
return m1 + (m2-m1)*(TWO_THIRD-hue)*6.0
46+
return m1 + (m2 - m1) * (TWO_THIRD - hue) * 6.0
4147
return m1
4248

4349

@@ -46,25 +52,26 @@ def _v(m1, m2, hue):
4652
# S: color saturation ("purity")
4753
# V: color brightness
4854

55+
4956
def hsv_to_rgb(h, s, v):
5057
if s == 0.0:
5158
return v, v, v
52-
i = int(h*6.0) # XXX assume int() truncates!
53-
f = (h*6.0) - i
54-
p = v*(1.0 - s)
55-
q = v*(1.0 - s*f)
56-
t = v*(1.0 - s*(1.0-f))
57-
i = i%6
59+
i = int(h * 6.0) # XXX assume int() truncates!
60+
f = (h * 6.0) - i
61+
p = v * (1.0 - s)
62+
q = v * (1.0 - s * f)
63+
t = v * (1.0 - s * (1.0 - f))
64+
i = i % 6
5865
if i == 0:
59-
return int(v * 255), int(t *255), int(p * 255)
66+
return int(v * 255), int(t * 255), int(p * 255)
6067
if i == 1:
61-
return int(q * 255), int(v *255), int(p * 255)
68+
return int(q * 255), int(v * 255), int(p * 255)
6269
if i == 2:
63-
return int(p * 255), int(v *255), int(t * 255)
70+
return int(p * 255), int(v * 255), int(t * 255)
6471
if i == 3:
65-
return int(p * 255), int(q *255), int(v * 255)
72+
return int(p * 255), int(q * 255), int(v * 255)
6673
if i == 4:
67-
return int(t * 255), int(p *255), int(v * 255)
74+
return int(t * 255), int(p * 255), int(v * 255)
6875
if i == 5:
69-
return int(v * 255), int(p *255), int(q * 255)
76+
return int(v * 255), int(p * 255), int(q * 255)
7077
# Cannot get here

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

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_ CPython Library'
38-
copyright = u'2017 Scott Shawcroft'
39-
author = u'Scott Shawcroft'
41+
project = u"Adafruit_ CPython Library"
42+
copyright = u"2017 Scott Shawcroft"
43+
author = u"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 = u"1.0"
4751
# The full version, including alpha/beta/rc tags.
48-
release = u'1.0'
52+
release = u"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 = 'Adafruit_CpythonLibrarydoc'
117+
htmlhelp_basename = "Adafruit_CpythonLibrarydoc"
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, 'Adafruit_CPythonLibrary.tex', u'Adafruit_CPython Library Documentation',
139-
author, 'manual'),
140+
(
141+
master_doc,
142+
"Adafruit_CPythonLibrary.tex",
143+
u"Adafruit_CPython 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, 'Adafruit_CPythonlibrary', u'Adafruit_ CPython Library Documentation',
148-
[author], 1)
154+
(
155+
master_doc,
156+
"Adafruit_CPythonlibrary",
157+
u"Adafruit_ CPython 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, 'Adafruit_CPythonLibrary', u'Adafruit_ CPython Library Documentation',
158-
author, 'Adafruit_CPythonLibrary', 'One line description of project.',
159-
'Miscellaneous'),
169+
(
170+
master_doc,
171+
"Adafruit_CPythonLibrary",
172+
u"Adafruit_ CPython Library Documentation",
173+
author,
174+
"Adafruit_CPythonLibrary",
175+
"One line description of project.",
176+
"Miscellaneous",
177+
),
160178
]

0 commit comments

Comments
 (0)