Skip to content

Commit 485ca0b

Browse files
authored
Merge pull request #17 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents 0dcf633 + 8f76064 commit 485ca0b

9 files changed

+239
-197
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_avrprog.py

+111-95
Large diffs are not rendered by default.

docs/conf.py

+64-46
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,51 @@
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
# Uncomment the below if you use native CircuitPython modules such as
1920
# digitalio, micropython and busio. List the modules you use. Without it, the
2021
# autodoc module docs will fail to generate with a warning.
2122
# autodoc_mock_imports = ["digitalio"]
2223

23-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
24+
intersphinx_mapping = {
25+
"python": ("https://docs.python.org/3.4", None),
26+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
27+
}
2428

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

28-
source_suffix = '.rst'
32+
source_suffix = ".rst"
2933

3034
# The master toctree document.
31-
master_doc = 'index'
35+
master_doc = "index"
3236

3337
# General information about the project.
34-
project = u'Adafruit AVRprog Library'
35-
copyright = u'2017 ladyada'
36-
author = u'ladyada'
38+
project = u"Adafruit AVRprog Library"
39+
copyright = u"2017 ladyada"
40+
author = u"ladyada"
3741

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

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

5963
# The reST default role (used for this markup: `text`) to use for all
6064
# documents.
@@ -66,7 +70,7 @@
6670
add_function_parentheses = True
6771

6872
# The name of the Pygments (syntax highlighting) style to use.
69-
pygments_style = 'sphinx'
73+
pygments_style = "sphinx"
7074

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

8589
if not on_rtd: # only import and set the theme if we're building docs locally
8690
try:
8791
import sphinx_rtd_theme
88-
html_theme = 'sphinx_rtd_theme'
89-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
92+
93+
html_theme = "sphinx_rtd_theme"
94+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
9095
except:
91-
html_theme = 'default'
92-
html_theme_path = ['.']
96+
html_theme = "default"
97+
html_theme_path = ["."]
9398
else:
94-
html_theme_path = ['.']
99+
html_theme_path = ["."]
95100

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

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

107112
# Output file base name for HTML help builder.
108-
htmlhelp_basename = 'AdafruitAvrprogLibrarydoc'
113+
htmlhelp_basename = "AdafruitAvrprogLibrarydoc"
109114

110115
# -- Options for LaTeX output ---------------------------------------------
111116

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

130132
# Grouping the document tree into LaTeX files. List of tuples
131133
# (source start file, target name, title,
132134
# author, documentclass [howto, manual, or own class]).
133135
latex_documents = [
134-
(master_doc, 'AdafruitAVRprogLibrary.tex', u'AdafruitAVRprog Library Documentation',
135-
author, 'manual'),
136+
(
137+
master_doc,
138+
"AdafruitAVRprogLibrary.tex",
139+
u"AdafruitAVRprog Library Documentation",
140+
author,
141+
"manual",
142+
),
136143
]
137144

138145
# -- Options for manual page output ---------------------------------------
139146

140147
# One entry per manual page. List of tuples
141148
# (source start file, name, description, authors, manual section).
142149
man_pages = [
143-
(master_doc, 'AdafruitAVRproglibrary', u'Adafruit AVRprog Library Documentation',
144-
[author], 1)
150+
(
151+
master_doc,
152+
"AdafruitAVRproglibrary",
153+
u"Adafruit AVRprog Library Documentation",
154+
[author],
155+
1,
156+
)
145157
]
146158

147159
# -- Options for Texinfo output -------------------------------------------
@@ -150,7 +162,13 @@
150162
# (source start file, target name, title, author,
151163
# dir menu entry, description, category)
152164
texinfo_documents = [
153-
(master_doc, 'AdafruitAVRprogLibrary', u'Adafruit AVRprog Library Documentation',
154-
author, 'AdafruitAVRprogLibrary', 'One line description of project.',
155-
'Miscellaneous'),
165+
(
166+
master_doc,
167+
"AdafruitAVRprogLibrary",
168+
u"Adafruit AVRprog Library Documentation",
169+
author,
170+
"AdafruitAVRprogLibrary",
171+
"One line description of project.",
172+
"Miscellaneous",
173+
),
156174
]

examples/avrprog_program_mega2560.py

+17-10
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,43 @@
2323
# http://svn.savannah.nongnu.org/viewvc/*checkout*/avrdude/trunk/avrdude/avrdude.conf.in
2424
# You can also use the predefined values in AVRprog.Boards
2525
atmega2560 = {
26-
'name': "ATmega2560",
27-
'sig': [0x1E, 0x98, 0x01],
28-
'flash_size': 262144,
29-
'page_size': 256,
30-
'fuse_mask': (0xFF, 0xFF, 0x07, 0x3F)
26+
"name": "ATmega2560",
27+
"sig": [0x1E, 0x98, 0x01],
28+
"flash_size": 262144,
29+
"page_size": 256,
30+
"fuse_mask": (0xFF, 0xFF, 0x07, 0x3F),
3131
}
3232

33+
3334
def error(err):
3435
""" Helper to print out errors for us and then halt """
35-
print("ERROR: "+err)
36+
print("ERROR: " + err)
3637
avrprog.end()
3738
while True:
3839
pass
3940

40-
while input("Ready to GO, type 'G' here to start> ") != 'G':
41+
42+
while input("Ready to GO, type 'G' here to start> ") != "G":
4143
pass
4244

4345
if not avrprog.verify_sig(atmega2560, verbose=True):
4446
error("Signature read failure")
45-
print("Found", atmega2560['name'])
47+
print("Found", atmega2560["name"])
4648

4749
# Since we are unsetting the lock fuse, an erase is required!
4850
avrprog.erase_chip()
4951

5052
avrprog.write_fuses(atmega2560, low=0xFF, high=0xD8, ext=0x05, lock=0x3F)
5153
if not avrprog.verify_fuses(atmega2560, low=0xFF, high=0xD8, ext=0x05, lock=0x3F):
52-
error("Failure programming fuses: "+str([hex(i) for i in avrprog.read_fuses(atmega2560)]))
54+
error(
55+
"Failure programming fuses: "
56+
+ str([hex(i) for i in avrprog.read_fuses(atmega2560)])
57+
)
5358

5459
print("Programming flash from file")
55-
avrprog.program_file(atmega2560, "stk500boot_v2_mega2560.hex", verbose=True, verify=True)
60+
avrprog.program_file(
61+
atmega2560, "stk500boot_v2_mega2560.hex", verbose=True, verify=True
62+
)
5663

5764
avrprog.write_fuses(atmega2560, lock=0x0F)
5865
if not avrprog.verify_fuses(atmega2560, lock=0x0F):

examples/avrprog_program_tiny13a.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,21 @@
2020
# Each chip has to have a definition so the script knows how to find it
2121
attiny13 = avrprog.Boards.ATtiny13a
2222

23+
2324
def error(err):
2425
""" Helper to print out errors for us and then halt """
25-
print("ERROR: "+err)
26+
print("ERROR: " + err)
2627
avrprog.end()
2728
while True:
2829
pass
2930

30-
while input("Ready to GO, type 'G' here to start> ") != 'G':
31+
32+
while input("Ready to GO, type 'G' here to start> ") != "G":
3133
pass
3234

3335
if not avrprog.verify_sig(attiny13, verbose=True):
3436
error("Signature read failure")
35-
print("Found", attiny13['name'])
37+
print("Found", attiny13["name"])
3638

3739
avrprog.write_fuses(attiny13, low=0x7A, high=0xFF)
3840
if not avrprog.verify_fuses(attiny13, low=0x7A, high=0xFF):

examples/avrprog_program_trinket85.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,21 @@
2020
# Each chip has to have a definition so the script knows how to find it
2121
attiny85 = avrprog.Boards.ATtiny85
2222

23+
2324
def error(err):
2425
""" Helper to print out errors for us and then halt """
25-
print("ERROR: "+err)
26+
print("ERROR: " + err)
2627
avrprog.end()
2728
while True:
2829
pass
2930

30-
while input("Ready to GO, type 'G' here to start> ") != 'G':
31+
32+
while input("Ready to GO, type 'G' here to start> ") != "G":
3133
pass
3234

3335
if not avrprog.verify_sig(attiny85, verbose=True):
3436
error("Signature read failure")
35-
print("Found", attiny85['name'])
37+
print("Found", attiny85["name"])
3638

3739
avrprog.write_fuses(attiny85, low=0xF1, high=0xD5, ext=0x06, lock=0x3F)
3840
if not avrprog.verify_fuses(attiny85, low=0xF1, high=0xD5, ext=0x06, lock=0x3F):

examples/avrprog_program_uno328.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,39 @@
1818
avrprog = adafruit_avrprog.AVRprog()
1919
avrprog.init(spi, board.D5)
2020

21-
#pylint: disable-msg=no-member
21+
# pylint: disable-msg=no-member
2222
# we can generate an 6 MHz clock for driving bare chips too!
23-
clock_pwm = pulseio.PWMOut(board.D9, frequency=6000000, duty_cycle=65536//2)
24-
#pylint: enable-msg=no-member
23+
clock_pwm = pulseio.PWMOut(board.D9, frequency=6000000, duty_cycle=65536 // 2)
24+
# pylint: enable-msg=no-member
2525

2626
# Each chip has to have a definition so the script knows how to find it
2727
atmega328p = avrprog.Boards.ATmega328p
2828

29+
2930
def error(err):
3031
""" Helper to print out errors for us and then halt """
31-
print("ERROR: "+err)
32+
print("ERROR: " + err)
3233
avrprog.end()
3334
while True:
3435
pass
3536

36-
while input("Ready to GO, type 'G' here to start> ") != 'G':
37+
38+
while input("Ready to GO, type 'G' here to start> ") != "G":
3739
pass
3840

3941
if not avrprog.verify_sig(atmega328p, verbose=True):
4042
error("Signature read failure")
41-
print("Found", atmega328p['name'])
43+
print("Found", atmega328p["name"])
4244

4345
# Since we are unsetting the lock fuse, an erase is required!
4446
avrprog.erase_chip()
4547

4648
avrprog.write_fuses(atmega328p, low=0xFF, high=0xDE, ext=0x05, lock=0x3F)
4749
if not avrprog.verify_fuses(atmega328p, low=0xFF, high=0xDE, ext=0x05, lock=0x3F):
48-
error("Failure programming fuses: "+str([hex(i) for i in avrprog.read_fuses(atmega328p)]))
50+
error(
51+
"Failure programming fuses: "
52+
+ str([hex(i) for i in avrprog.read_fuses(atmega328p)])
53+
)
4954

5055
print("Programming flash from file")
5156
avrprog.program_file(atmega328p, "optiboot_atmega328.hex", verbose=True, verify=True)

examples/avrprog_read_signature_simpletest.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
avrprog = adafruit_avrprog.AVRprog()
1313
avrprog.init(spi, board.D5)
1414

15-
#pylint: disable-msg=no-member
15+
# pylint: disable-msg=no-member
1616
# we can generate an 6 MHz clock for driving bare chips too!
17-
clock_pwm = pulseio.PWMOut(board.D9, frequency=6000000, duty_cycle=65536//2)
18-
#pylint: enable-msg=no-member
17+
clock_pwm = pulseio.PWMOut(board.D9, frequency=6000000, duty_cycle=65536 // 2)
18+
# pylint: enable-msg=no-member
1919

2020
avrprog.begin()
2121
print("Signature bytes: ", [hex(i) for i in avrprog.read_signature()])

0 commit comments

Comments
 (0)