Skip to content

Commit 9dd6dd6

Browse files
authored
Merge pull request #7 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents 3da188f + 113bfd4 commit 9dd6dd6

File tree

4 files changed

+80
-60
lines changed

4 files changed

+80
-60
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

adafruit_itertools/adafruit_itertools.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
* Adafruit CircuitPython firmware for the supported boards:
6060
https://github.com/adafruit/circuitpython/releases
6161
"""
62-
#pylint:disable=invalid-name,redefined-builtin,attribute-defined-outside-init
63-
#pylint:disable=stop-iteration-return,anomalous-backslash-in-string
62+
# pylint:disable=invalid-name,redefined-builtin,attribute-defined-outside-init
63+
# pylint:disable=stop-iteration-return,anomalous-backslash-in-string
6464

6565
__version__ = "0.0.0-auto.0"
6666
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Itertools.git"
@@ -146,8 +146,8 @@ def combinations(iterable, r):
146146
else:
147147
return
148148
indices[index] += 1
149-
for j in range(index+1, r):
150-
indices[j] = indices[j-1] + 1
149+
for j in range(index + 1, r):
150+
indices[j] = indices[j - 1] + 1
151151
yield tuple(pool[i] for i in indices)
152152

153153

@@ -296,6 +296,7 @@ class groupby:
296296
:param key: the key computation function (default is None)
297297
298298
"""
299+
299300
# [k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B
300301
# [list(g) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
301302

@@ -312,7 +313,7 @@ def __iter__(self):
312313
def __next__(self):
313314
self.id = object()
314315
while self.currkey == self.tgtkey:
315-
self.currvalue = next(self.it) # Exit on StopIteration
316+
self.currvalue = next(self.it) # Exit on StopIteration
316317
self.currkey = self.keyfunc(self.currvalue)
317318
self.tgtkey = self.currkey
318319
return (self.currkey, self._grouper(self.tgtkey, self.id))
@@ -397,13 +398,13 @@ def permutations(iterable, r=None):
397398
if r > n:
398399
return
399400
indices = list(range(n))
400-
cycles = list(range(n, n-r, -1))
401+
cycles = list(range(n, n - r, -1))
401402
yield tuple(pool[i] for i in indices[:r])
402403
while n:
403404
for i in reversed(range(r)):
404405
cycles[i] -= 1
405406
if cycles[i] == 0:
406-
indices[i:] = indices[i+1:] + indices[i:i+1]
407+
indices[i:] = indices[i + 1 :] + indices[i : i + 1]
407408
cycles[i] = n - i
408409
else:
409410
j = cycles[i]
@@ -440,7 +441,7 @@ def product(*args, r=1):
440441
pools = [tuple(pool) for pool in args] * r
441442
result = [[]]
442443
for pool in pools:
443-
result = [x+[y] for x in result for y in pool]
444+
result = [x + [y] for x in result for y in pool]
444445
for prod in result:
445446
yield tuple(prod)
446447

adafruit_itertools/adafruit_itertools_extras.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
https://github.com/adafruit/circuitpython/releases
7575
"""
7676

77-
#pylint:disable=invalid-name,deprecated-lambda,keyword-arg-before-vararg,relative-beyond-top-level
77+
# pylint:disable=invalid-name,keyword-arg-before-vararg,relative-beyond-top-level
7878

7979
from . import adafruit_itertools as it
8080

@@ -89,9 +89,9 @@ def all_equal(iterable):
8989
9090
"""
9191
g = it.groupby(iterable)
92-
next(g) # should succeed, value isn't relevant
92+
next(g) # should succeed, value isn't relevant
9393
try:
94-
next(g) # should fail: only 1 group
94+
next(g) # should fail: only 1 group
9595
return False
9696
except StopIteration:
9797
return True
@@ -198,10 +198,11 @@ def nth(iterable, n, default=None):
198198
199199
"""
200200
try:
201-
return next(it.islice(iterable, n, n+1))
201+
return next(it.islice(iterable, n, n + 1))
202202
except StopIteration:
203203
return default
204204

205+
205206
def padnone(iterable):
206207
"""Returns the sequence elements and then returns None indefinitely.
207208

docs/conf.py

Lines changed: 65 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,47 @@
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

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

2125
# Add any paths that contain templates here, relative to this directory.
22-
templates_path = ['_templates']
26+
templates_path = ["_templates"]
2327

24-
source_suffix = '.rst'
28+
source_suffix = ".rst"
2529

2630
# The master toctree document.
27-
master_doc = 'index'
31+
master_doc = "index"
2832

2933
# General information about the project.
30-
project = u'Adafruit itertools Library'
31-
copyright = u'2019 Dave Astels'
32-
author = u'Dave Astels'
34+
project = "Adafruit itertools Library"
35+
copyright = "2019 Dave Astels"
36+
author = "Dave Astels"
3337

3438
# The version info for the project you're documenting, acts as replacement for
3539
# |version| and |release|, also used in various other places throughout the
3640
# built documents.
3741
#
3842
# The short X.Y version.
39-
version = u'1.0'
43+
version = "1.0"
4044
# The full version, including alpha/beta/rc tags.
41-
release = u'1.0'
45+
release = "1.0"
4246

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

5559
# The reST default role (used for this markup: `text`) to use for all
5660
# documents.
@@ -62,7 +66,7 @@
6266
add_function_parentheses = True
6367

6468
# The name of the Pygments (syntax highlighting) style to use.
65-
pygments_style = 'sphinx'
69+
pygments_style = "sphinx"
6670

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

8286
if not on_rtd: # only import and set the theme if we're building docs locally
8387
try:
8488
import sphinx_rtd_theme
85-
html_theme = 'sphinx_rtd_theme'
86-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
89+
90+
html_theme = "sphinx_rtd_theme"
91+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
8792
except:
88-
html_theme = 'default'
89-
html_theme_path = ['.']
93+
html_theme = "default"
94+
html_theme_path = ["."]
9095
else:
91-
html_theme_path = ['.']
96+
html_theme_path = ["."]
9297

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

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

104109
# Output file base name for HTML help builder.
105-
htmlhelp_basename = 'AdafruitItertoolsLibrarydoc'
110+
htmlhelp_basename = "AdafruitItertoolsLibrarydoc"
106111

107112
# -- Options for LaTeX output ---------------------------------------------
108113

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

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

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

137144
# One entry per manual page. List of tuples
138145
# (source start file, name, description, authors, manual section).
139146
man_pages = [
140-
(master_doc, 'Adafruititertoolslibrary', u'Adafruit itertools Library Documentation',
141-
[author], 1)
147+
(
148+
master_doc,
149+
"Adafruititertoolslibrary",
150+
"Adafruit itertools Library Documentation",
151+
[author],
152+
1,
153+
)
142154
]
143155

144156
# -- Options for Texinfo output -------------------------------------------
@@ -147,7 +159,13 @@
147159
# (source start file, target name, title, author,
148160
# dir menu entry, description, category)
149161
texinfo_documents = [
150-
(master_doc, 'AdafruititertoolsLibrary', u'Adafruit itertools Library Documentation',
151-
author, 'AdafruititertoolsLibrary', 'One line description of project.',
152-
'Miscellaneous'),
162+
(
163+
master_doc,
164+
"AdafruititertoolsLibrary",
165+
"Adafruit itertools Library Documentation",
166+
author,
167+
"AdafruititertoolsLibrary",
168+
"One line description of project.",
169+
"Miscellaneous",
170+
),
153171
]

0 commit comments

Comments
 (0)