Skip to content

Commit 89dbe60

Browse files
authored
Merge pull request #25 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents c7e86e2 + 7776ef8 commit 89dbe60

File tree

7 files changed

+141
-116
lines changed

7 files changed

+141
-116
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]

adafruit_amg88xx.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,48 +54,51 @@
5454
# Operating Modes
5555
# pylint: disable=bad-whitespace
5656
_NORMAL_MODE = const(0x00)
57-
_SLEEP_MODE = const(0x10)
57+
_SLEEP_MODE = const(0x10)
5858
_STAND_BY_60 = const(0x20)
5959
_STAND_BY_10 = const(0x21)
6060

6161
# sw resets
62-
_FLAG_RESET = const(0x30)
62+
_FLAG_RESET = const(0x30)
6363
_INITIAL_RESET = const(0x3F)
6464

6565
# frame rates
6666
_FPS_10 = const(0x00)
67-
_FPS_1 = const(0x01)
67+
_FPS_1 = const(0x01)
6868

6969
# int enables
7070
_INT_DISABLED = const(0x00)
71-
_INT_ENABLED = const(0x01)
71+
_INT_ENABLED = const(0x01)
7272

7373
# int modes
74-
_DIFFERENCE = const(0x00)
74+
_DIFFERENCE = const(0x00)
7575
_ABSOLUTE_VALUE = const(0x01)
7676

77-
_INT_OFFSET = const(0x010)
77+
_INT_OFFSET = const(0x010)
7878
_PIXEL_OFFSET = const(0x80)
7979

8080
_PIXEL_ARRAY_WIDTH = const(8)
8181
_PIXEL_ARRAY_HEIGHT = const(8)
82-
_PIXEL_TEMP_CONVERSION = .25
83-
_THERMISTOR_CONVERSION = .0625
82+
_PIXEL_TEMP_CONVERSION = 0.25
83+
_THERMISTOR_CONVERSION = 0.0625
8484
# pylint: enable=bad-whitespace
8585

86+
8687
def _signed_12bit_to_float(val):
87-
#take first 11 bits as absolute val
88-
abs_val = (val & 0x7FF)
88+
# take first 11 bits as absolute val
89+
abs_val = val & 0x7FF
8990
if val & 0x800:
9091
return 0 - float(abs_val)
9192
return float(abs_val)
9293

94+
9395
def _twos_comp_to_float(val):
94-
val &= 0xfff
96+
val &= 0xFFF
9597
if val & 0x800:
9698
val -= 0x1000
9799
return float(val)
98100

101+
99102
class AMG88XX:
100103
"""Driver for the AMG88xx GRID-Eye IR 8x8 thermal camera."""
101104

@@ -130,16 +133,16 @@ class AMG88XX:
130133
def __init__(self, i2c, addr=0x69):
131134
self.i2c_device = I2CDevice(i2c, addr)
132135

133-
#enter normal mode
136+
# enter normal mode
134137
self._pctl = _NORMAL_MODE
135138

136-
#software reset
139+
# software reset
137140
self._rst = _INITIAL_RESET
138141

139-
#disable interrupts by default
142+
# disable interrupts by default
140143
self._inten = False
141144

142-
#set to 10 FPS
145+
# set to 10 FPS
143146
self._fps = _FPS_10
144147

145148
@property
@@ -155,7 +158,7 @@ def pixels(self):
155158
Temperatures are stored in a two dimensional list where the first index is the row and
156159
the second is the column. The first row is on the side closest to the writing on the
157160
sensor."""
158-
retbuf = [[0]*_PIXEL_ARRAY_WIDTH for _ in range(_PIXEL_ARRAY_HEIGHT)]
161+
retbuf = [[0] * _PIXEL_ARRAY_WIDTH for _ in range(_PIXEL_ARRAY_HEIGHT)]
159162
buf = bytearray(3)
160163

161164
with self.i2c_device as i2c:

docs/conf.py

Lines changed: 63 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
#
1919
import os
2020
import sys
21-
sys.path.insert(0, os.path.abspath('..'))
21+
22+
sys.path.insert(0, os.path.abspath(".."))
2223

2324
# -- General configuration ------------------------------------------------
2425

@@ -30,9 +31,9 @@
3031
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3132
# ones.
3233
extensions = [
33-
'sphinx.ext.autodoc',
34-
'sphinx.ext.intersphinx',
35-
'sphinx.ext.viewcode',
34+
"sphinx.ext.autodoc",
35+
"sphinx.ext.intersphinx",
36+
"sphinx.ext.viewcode",
3637
]
3738

3839
# Uncomment the below if you use native CircuitPython modules such as
@@ -41,34 +42,34 @@
4142
# autodoc_mock_imports = ["adafruit_bus_device", "micropython", "adafruit_register"]
4243

4344
# Add any paths that contain templates here, relative to this directory.
44-
templates_path = ['_templates']
45+
templates_path = ["_templates"]
4546

4647
# The suffix(es) of source filenames.
4748
# You can specify multiple suffix as a list of string:
4849
#
4950
# source_suffix = ['.rst', '.md']
50-
source_suffix = '.rst'
51+
source_suffix = ".rst"
5152

5253
# The encoding of source files.
5354
#
5455
# source_encoding = 'utf-8-sig'
5556

5657
# The master toctree document.
57-
master_doc = 'index'
58+
master_doc = "index"
5859

5960
# General information about the project.
60-
project = u'Adafruit AMG88xx Library'
61-
copyright = u'2017, Dean Miller for Adafruit Industries'
62-
author = u'Dean Miller'
61+
project = u"Adafruit AMG88xx Library"
62+
copyright = u"2017, Dean Miller for Adafruit Industries"
63+
author = u"Dean Miller"
6364

6465
# The version info for the project you're documenting, acts as replacement for
6566
# |version| and |release|, also used in various other places throughout the
6667
# built documents.
6768
#
6869
# The short X.Y version.
69-
version = u'1.0'
70+
version = u"1.0"
7071
# The full version, including alpha/beta/rc tags.
71-
release = u'1.0'
72+
release = u"1.0"
7273

7374
# The language for content autogenerated by Sphinx. Refer to documentation
7475
# for a list of supported languages.
@@ -89,7 +90,7 @@
8990
# List of patterns, relative to source directory, that match files and
9091
# directories to ignore when looking for source files.
9192
# This patterns also effect to html_static_path and html_extra_path
92-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
93+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
9394

9495
# The reST default role (used for this markup: `text`) to use for all
9596
# documents.
@@ -111,7 +112,7 @@
111112
# show_authors = False
112113

113114
# The name of the Pygments (syntax highlighting) style to use.
114-
pygments_style = 'sphinx'
115+
pygments_style = "sphinx"
115116

116117
# If true, `todo` and `todoList` produce output, else they produce nothing.
117118
todo_include_todos = False
@@ -134,18 +135,19 @@
134135
# The theme to use for HTML and HTML Help pages. See the documentation for
135136
# a list of builtin themes.
136137
#
137-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
138+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
138139

139140
if not on_rtd: # only import and set the theme if we're building docs locally
140141
try:
141142
import sphinx_rtd_theme
142-
html_theme = 'sphinx_rtd_theme'
143-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
143+
144+
html_theme = "sphinx_rtd_theme"
145+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
144146
except:
145-
html_theme = 'default'
146-
html_theme_path = ['.']
147+
html_theme = "default"
148+
html_theme_path = ["."]
147149
else:
148-
html_theme_path = ['.']
150+
html_theme_path = ["."]
149151

150152
# Theme options are theme-specific and customize the look and feel of a theme
151153
# further. For a list of options available for each theme, see the
@@ -179,7 +181,7 @@
179181
# Add any paths that contain custom static files (such as style sheets) here,
180182
# relative to this directory. They are copied after the builtin static files,
181183
# so a file named "default.css" will overwrite the builtin "default.css".
182-
html_static_path = ['_static']
184+
html_static_path = ["_static"]
183185

184186
# Add any extra paths that contain custom files (such as robots.txt or
185187
# .htaccess) here, relative to this directory. These files are copied
@@ -259,34 +261,36 @@
259261
# html_search_scorer = 'scorer.js'
260262

261263
# Output file base name for HTML help builder.
262-
htmlhelp_basename = 'AdafruitAMG88xxLibrarydoc'
264+
htmlhelp_basename = "AdafruitAMG88xxLibrarydoc"
263265

264266
# -- Options for LaTeX output ---------------------------------------------
265267

266268
latex_elements = {
267-
# The paper size ('letterpaper' or 'a4paper').
268-
#
269-
# 'papersize': 'letterpaper',
270-
271-
# The font size ('10pt', '11pt' or '12pt').
272-
#
273-
# 'pointsize': '10pt',
274-
275-
# Additional stuff for the LaTeX preamble.
276-
#
277-
# 'preamble': '',
278-
279-
# Latex figure (float) alignment
280-
#
281-
# 'figure_align': 'htbp',
269+
# The paper size ('letterpaper' or 'a4paper').
270+
#
271+
# 'papersize': 'letterpaper',
272+
# The font size ('10pt', '11pt' or '12pt').
273+
#
274+
# 'pointsize': '10pt',
275+
# Additional stuff for the LaTeX preamble.
276+
#
277+
# 'preamble': '',
278+
# Latex figure (float) alignment
279+
#
280+
# 'figure_align': 'htbp',
282281
}
283282

284283
# Grouping the document tree into LaTeX files. List of tuples
285284
# (source start file, target name, title,
286285
# author, documentclass [howto, manual, or own class]).
287286
latex_documents = [
288-
(master_doc, 'AdafruitAMG88xxLibrary.tex', u'Adafruit AMG88xx Library Documentation',
289-
u'Dean Miller', 'manual'),
287+
(
288+
master_doc,
289+
"AdafruitAMG88xxLibrary.tex",
290+
u"Adafruit AMG88xx Library Documentation",
291+
u"Dean Miller",
292+
"manual",
293+
),
290294
]
291295

292296
# The name of an image file (relative to this directory) to place at the top of
@@ -327,8 +331,13 @@
327331
# One entry per manual page. List of tuples
328332
# (source start file, name, description, authors, manual section).
329333
man_pages = [
330-
(master_doc, 'adafruitAMG88xxLibrary', u'Adafruit AMG88xx Library Documentation',
331-
[author], 1)
334+
(
335+
master_doc,
336+
"adafruitAMG88xxLibrary",
337+
u"Adafruit AMG88xx Library Documentation",
338+
[author],
339+
1,
340+
)
332341
]
333342

334343
# If true, show URL addresses after external links.
@@ -342,9 +351,15 @@
342351
# (source start file, target name, title, author,
343352
# dir menu entry, description, category)
344353
texinfo_documents = [
345-
(master_doc, 'AdafruitAMG88xxLibrary', u'Adafruit AMG88xx Library Documentation',
346-
author, 'AdafruitAMG88xxLibrary', 'One line description of project.',
347-
'Miscellaneous'),
354+
(
355+
master_doc,
356+
"AdafruitAMG88xxLibrary",
357+
u"Adafruit AMG88xx Library Documentation",
358+
author,
359+
"AdafruitAMG88xxLibrary",
360+
"One line description of project.",
361+
"Miscellaneous",
362+
),
348363
]
349364

350365
# Documents to append as an appendix to all manuals.
@@ -363,5 +378,7 @@
363378
#
364379
# texinfo_no_detailmenu = False
365380

366-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
367-
'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
381+
intersphinx_mapping = {
382+
"python": ("https://docs.python.org/3.4", None),
383+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
384+
}

0 commit comments

Comments
 (0)