Skip to content

Commit 5892e63

Browse files
authored
Merge pull request #10 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents cac02a8 + 592140f commit 5892e63

File tree

4 files changed

+104
-83
lines changed

4 files changed

+104
-83
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_mprls.py

+13-5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
_MPRLS_DEFAULT_ADDR = const(0x18)
5757
# pylint: enable=bad-whitespace
5858

59+
5960
class MPRLS:
6061
"""
6162
Driver base for the MPRLS pressure sensor
@@ -67,8 +68,16 @@ class MPRLS:
6768
:param float psi_max: The maximum pressure in PSI, defaults to 25
6869
"""
6970

70-
def __init__(self, i2c_bus, *, addr=_MPRLS_DEFAULT_ADDR,
71-
reset_pin=None, eoc_pin=None, psi_min=0, psi_max=25):
71+
def __init__(
72+
self,
73+
i2c_bus,
74+
*,
75+
addr=_MPRLS_DEFAULT_ADDR,
76+
reset_pin=None,
77+
eoc_pin=None,
78+
psi_min=0,
79+
psi_max=25
80+
):
7281
# Init I2C
7382
self._i2c = I2CDevice(i2c_bus, addr)
7483
self._buffer = bytearray(4)
@@ -80,7 +89,7 @@ def __init__(self, i2c_bus, *, addr=_MPRLS_DEFAULT_ADDR,
8089
reset_pin.value = False
8190
time.sleep(0.01)
8291
reset_pin.value = True
83-
time.sleep(0.005) # Start up timing
92+
time.sleep(0.005) # Start up timing
8493

8594
# Optional end-of-conversion pin
8695
self._eoc = eoc_pin
@@ -98,7 +107,6 @@ def pressure(self):
98107
"""The measured pressure, in hPa"""
99108
return self._read_data()
100109

101-
102110
def _read_data(self):
103111
"""Read the status & 24-bit data reading"""
104112
self._buffer[0] = 0xAA
@@ -129,7 +137,7 @@ def _read_data(self):
129137
# All is good, calculate the PSI and convert to hPA
130138
raw_psi = (self._buffer[1] << 16) | (self._buffer[2] << 8) | self._buffer[3]
131139
# use the 10-90 calibration curve
132-
psi = (raw_psi - 0x19999A) * (self._psimax-self._psimin)
140+
psi = (raw_psi - 0x19999A) * (self._psimax - self._psimin)
133141
psi /= 0xE66666 - 0x19999A
134142
psi += self._psimin
135143
# convert PSI to hPA

docs/conf.py

+69-47
Original file line numberDiff line numberDiff line change
@@ -2,43 +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.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),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
20+
intersphinx_mapping = {
21+
"python": ("https://docs.python.org/3.4", None),
22+
"BusDevice": (
23+
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
24+
None,
25+
),
26+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
27+
}
2028

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

24-
source_suffix = '.rst'
32+
source_suffix = ".rst"
2533

2634
# The master toctree document.
27-
master_doc = 'index'
35+
master_doc = "index"
2836

2937
# General information about the project.
30-
project = u'Adafruit MPRLS Library'
31-
copyright = u'2018 ladyada'
32-
author = u'ladyada'
38+
project = u"Adafruit MPRLS Library"
39+
copyright = u"2018 ladyada"
40+
author = u"ladyada"
3341

3442
# The version info for the project you're documenting, acts as replacement for
3543
# |version| and |release|, also used in various other places throughout the
3644
# built documents.
3745
#
3846
# The short X.Y version.
39-
version = u'1.0'
47+
version = u"1.0"
4048
# The full version, including alpha/beta/rc tags.
41-
release = u'1.0'
49+
release = u"1.0"
4250

4351
# The language for content autogenerated by Sphinx. Refer to documentation
4452
# for a list of supported languages.
@@ -50,7 +58,7 @@
5058
# List of patterns, relative to source directory, that match files and
5159
# directories to ignore when looking for source files.
5260
# 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']
61+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
5462

5563
# The reST default role (used for this markup: `text`) to use for all
5664
# documents.
@@ -62,7 +70,7 @@
6270
add_function_parentheses = True
6371

6472
# The name of the Pygments (syntax highlighting) style to use.
65-
pygments_style = 'sphinx'
73+
pygments_style = "sphinx"
6674

6775
# If true, `todo` and `todoList` produce output, else they produce nothing.
6876
todo_include_todos = False
@@ -77,68 +85,76 @@
7785
# The theme to use for HTML and HTML Help pages. See the documentation for
7886
# a list of builtin themes.
7987
#
80-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
88+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
8189

8290
if not on_rtd: # only import and set the theme if we're building docs locally
8391
try:
8492
import sphinx_rtd_theme
85-
html_theme = 'sphinx_rtd_theme'
86-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
93+
94+
html_theme = "sphinx_rtd_theme"
95+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
8796
except:
88-
html_theme = 'default'
89-
html_theme_path = ['.']
97+
html_theme = "default"
98+
html_theme_path = ["."]
9099
else:
91-
html_theme_path = ['.']
100+
html_theme_path = ["."]
92101

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

98107
# The name of an image file (relative to this directory) to use as a favicon of
99108
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
100109
# pixels large.
101110
#
102-
html_favicon = '_static/favicon.ico'
111+
html_favicon = "_static/favicon.ico"
103112

104113
# Output file base name for HTML help builder.
105-
htmlhelp_basename = 'AdafruitMprlsLibrarydoc'
114+
htmlhelp_basename = "AdafruitMprlsLibrarydoc"
106115

107116
# -- Options for LaTeX output ---------------------------------------------
108117

109118
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',
119+
# The paper size ('letterpaper' or 'a4paper').
120+
#
121+
# 'papersize': 'letterpaper',
122+
# The font size ('10pt', '11pt' or '12pt').
123+
#
124+
# 'pointsize': '10pt',
125+
# Additional stuff for the LaTeX preamble.
126+
#
127+
# 'preamble': '',
128+
# Latex figure (float) alignment
129+
#
130+
# 'figure_align': 'htbp',
125131
}
126132

127133
# Grouping the document tree into LaTeX files. List of tuples
128134
# (source start file, target name, title,
129135
# author, documentclass [howto, manual, or own class]).
130136
latex_documents = [
131-
(master_doc, 'AdafruitMPRLSLibrary.tex', u'AdafruitMPRLS Library Documentation',
132-
author, 'manual'),
137+
(
138+
master_doc,
139+
"AdafruitMPRLSLibrary.tex",
140+
u"AdafruitMPRLS Library Documentation",
141+
author,
142+
"manual",
143+
),
133144
]
134145

135146
# -- Options for manual page output ---------------------------------------
136147

137148
# One entry per manual page. List of tuples
138149
# (source start file, name, description, authors, manual section).
139150
man_pages = [
140-
(master_doc, 'AdafruitMPRLSlibrary', u'Adafruit MPRLS Library Documentation',
141-
[author], 1)
151+
(
152+
master_doc,
153+
"AdafruitMPRLSlibrary",
154+
u"Adafruit MPRLS Library Documentation",
155+
[author],
156+
1,
157+
)
142158
]
143159

144160
# -- Options for Texinfo output -------------------------------------------
@@ -147,7 +163,13 @@
147163
# (source start file, target name, title, author,
148164
# dir menu entry, description, category)
149165
texinfo_documents = [
150-
(master_doc, 'AdafruitMPRLSLibrary', u'Adafruit MPRLS Library Documentation',
151-
author, 'AdafruitMPRLSLibrary', 'One line description of project.',
152-
'Miscellaneous'),
166+
(
167+
master_doc,
168+
"AdafruitMPRLSLibrary",
169+
u"Adafruit MPRLS Library Documentation",
170+
author,
171+
"AdafruitMPRLSLibrary",
172+
"One line description of project.",
173+
"Miscellaneous",
174+
),
153175
]

setup.py

+21-30
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,46 @@
77

88
# Always prefer setuptools over distutils
99
from setuptools import setup, find_packages
10+
1011
# To use a consistent encoding
1112
from codecs import open
1213
from os import path
1314

1415
here = path.abspath(path.dirname(__file__))
1516

1617
# Get the long description from the README file
17-
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
18+
with open(path.join(here, "README.rst"), encoding="utf-8") as f:
1819
long_description = f.read()
1920

2021
setup(
21-
name='adafruit-circuitpython-mprls',
22-
22+
name="adafruit-circuitpython-mprls",
2323
use_scm_version=True,
24-
setup_requires=['setuptools_scm'],
25-
26-
description='CircuitPython library to support Honeywell MPRLS digital pressure sensors.',
27-
24+
setup_requires=["setuptools_scm"],
25+
description="CircuitPython library to support Honeywell MPRLS digital pressure sensors.",
2826
long_description=long_description,
29-
long_description_content_type='text/x-rst',
30-
27+
long_description_content_type="text/x-rst",
3128
# The project's main homepage.
32-
url='https://github.com/adafruit/Adafruit_CircuitPython_MPRLS',
33-
29+
url="https://github.com/adafruit/Adafruit_CircuitPython_MPRLS",
3430
# Author details
35-
author='Adafruit Industries',
36-
author_email='[email protected]',
37-
38-
install_requires=['Adafruit-Blinka', 'adafruit-circuitpython-busdevice'],
39-
31+
author="Adafruit Industries",
32+
author_email="[email protected]",
33+
install_requires=["Adafruit-Blinka", "adafruit-circuitpython-busdevice"],
4034
# Choose your license
41-
license='MIT',
42-
35+
license="MIT",
4336
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
4437
classifiers=[
45-
'Development Status :: 3 - Alpha',
46-
'Intended Audience :: Developers',
47-
'Topic :: Software Development :: Libraries',
48-
'Topic :: System :: Hardware',
49-
'License :: OSI Approved :: MIT License',
50-
'Programming Language :: Python :: 3',
51-
'Programming Language :: Python :: 3.4',
52-
'Programming Language :: Python :: 3.5',
38+
"Development Status :: 3 - Alpha",
39+
"Intended Audience :: Developers",
40+
"Topic :: Software Development :: Libraries",
41+
"Topic :: System :: Hardware",
42+
"License :: OSI Approved :: MIT License",
43+
"Programming Language :: Python :: 3",
44+
"Programming Language :: Python :: 3.4",
45+
"Programming Language :: Python :: 3.5",
5346
],
54-
5547
# What does your project relate to?
56-
keywords='adafruit mprls hardware pressure honeywell micropython circuitpython',
57-
48+
keywords="adafruit mprls hardware pressure honeywell micropython circuitpython",
5849
# You can just specify the packages manually here if your project is
5950
# simple. Or you can use find_packages().
60-
py_modules=['adafruit_mprls'],
51+
py_modules=["adafruit_mprls"],
6152
)

0 commit comments

Comments
 (0)