Skip to content

Commit 4941e00

Browse files
authored
Merge pull request #11 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents 1016566 + d6adf45 commit 4941e00

File tree

4 files changed

+115
-87
lines changed

4 files changed

+115
-87
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_veml7700.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class VEML7700:
6060
:param busio.I2C i2c_bus: The I2C bus the VEML7700 is connected to.
6161
6262
"""
63+
6364
# Ambient light sensor gain settings
6465
ALS_GAIN_1 = const(0x0)
6566
ALS_GAIN_2 = const(0x1)
@@ -80,7 +81,7 @@ class VEML7700:
8081
ALS_GAIN_2: 2,
8182
ALS_GAIN_1: 1,
8283
ALS_GAIN_1_4: 0.25,
83-
ALS_GAIN_1_8: 0.125
84+
ALS_GAIN_1_8: 0.125,
8485
}
8586

8687
# Integration time value integers
@@ -90,7 +91,7 @@ class VEML7700:
9091
ALS_100MS: 100,
9192
ALS_200MS: 200,
9293
ALS_400MS: 400,
93-
ALS_800MS: 800
94+
ALS_800MS: 800,
9495
}
9596

9697
# ALS - Ambient light sensor high resolution output data
@@ -221,10 +222,16 @@ def resolution(self):
221222
gain_max = 2
222223
integration_time_max = 800
223224

224-
if self.gain_value() == gain_max and self.integration_time_value() == integration_time_max:
225+
if (
226+
self.gain_value() == gain_max
227+
and self.integration_time_value() == integration_time_max
228+
):
225229
return resolution_at_max
226-
return resolution_at_max * (integration_time_max / self.integration_time_value()) * \
227-
(gain_max / self.gain_value())
230+
return (
231+
resolution_at_max
232+
* (integration_time_max / self.integration_time_value())
233+
* (gain_max / self.gain_value())
234+
)
228235

229236
@property
230237
def lux(self):

docs/conf.py

+78-49
Original file line numberDiff line numberDiff line change
@@ -2,51 +2,66 @@
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!
2021
# Uncomment the below if you use native CircuitPython modules such as
2122
# digitalio, micropython and busio. List the modules you use. Without it, the
2223
# autodoc module docs will fail to generate with a warning.
23-
autodoc_mock_imports = ["adafruit_register.i2c_struct", "adafruit_register.i2c_bits",
24-
"adafruit_register.i2c_bit"]
24+
autodoc_mock_imports = [
25+
"adafruit_register.i2c_struct",
26+
"adafruit_register.i2c_bits",
27+
"adafruit_register.i2c_bit",
28+
]
2529

2630

27-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),'BusDevice': ('https://circuitpython.readthedocs.io/projects/busdevice/en/latest/', None),'Register': ('https://circuitpython.readthedocs.io/projects/register/en/latest/', None),'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
31+
intersphinx_mapping = {
32+
"python": ("https://docs.python.org/3.4", None),
33+
"BusDevice": (
34+
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
35+
None,
36+
),
37+
"Register": (
38+
"https://circuitpython.readthedocs.io/projects/register/en/latest/",
39+
None,
40+
),
41+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
42+
}
2843

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

32-
source_suffix = '.rst'
47+
source_suffix = ".rst"
3348

3449
# The master toctree document.
35-
master_doc = 'index'
50+
master_doc = "index"
3651

3752
# General information about the project.
38-
project = u'Adafruit VEML7700 Library'
39-
copyright = u'2019 Kattni Rembor'
40-
author = u'Kattni Rembor'
53+
project = u"Adafruit VEML7700 Library"
54+
copyright = u"2019 Kattni Rembor"
55+
author = u"Kattni Rembor"
4156

4257
# The version info for the project you're documenting, acts as replacement for
4358
# |version| and |release|, also used in various other places throughout the
4459
# built documents.
4560
#
4661
# The short X.Y version.
47-
version = u'1.0'
62+
version = u"1.0"
4863
# The full version, including alpha/beta/rc tags.
49-
release = u'1.0'
64+
release = u"1.0"
5065

5166
# The language for content autogenerated by Sphinx. Refer to documentation
5267
# for a list of supported languages.
@@ -58,7 +73,7 @@
5873
# List of patterns, relative to source directory, that match files and
5974
# directories to ignore when looking for source files.
6075
# This patterns also effect to html_static_path and html_extra_path
61-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
76+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
6277

6378
# The reST default role (used for this markup: `text`) to use for all
6479
# documents.
@@ -70,7 +85,7 @@
7085
add_function_parentheses = True
7186

7287
# The name of the Pygments (syntax highlighting) style to use.
73-
pygments_style = 'sphinx'
88+
pygments_style = "sphinx"
7489

7590
# If true, `todo` and `todoList` produce output, else they produce nothing.
7691
todo_include_todos = False
@@ -85,68 +100,76 @@
85100
# The theme to use for HTML and HTML Help pages. See the documentation for
86101
# a list of builtin themes.
87102
#
88-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
103+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
89104

90105
if not on_rtd: # only import and set the theme if we're building docs locally
91106
try:
92107
import sphinx_rtd_theme
93-
html_theme = 'sphinx_rtd_theme'
94-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
108+
109+
html_theme = "sphinx_rtd_theme"
110+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
95111
except:
96-
html_theme = 'default'
97-
html_theme_path = ['.']
112+
html_theme = "default"
113+
html_theme_path = ["."]
98114
else:
99-
html_theme_path = ['.']
115+
html_theme_path = ["."]
100116

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

106122
# The name of an image file (relative to this directory) to use as a favicon of
107123
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
108124
# pixels large.
109125
#
110-
html_favicon = '_static/favicon.ico'
126+
html_favicon = "_static/favicon.ico"
111127

112128
# Output file base name for HTML help builder.
113-
htmlhelp_basename = 'AdafruitVeml7700Librarydoc'
129+
htmlhelp_basename = "AdafruitVeml7700Librarydoc"
114130

115131
# -- Options for LaTeX output ---------------------------------------------
116132

117133
latex_elements = {
118-
# The paper size ('letterpaper' or 'a4paper').
119-
#
120-
# 'papersize': 'letterpaper',
121-
122-
# The font size ('10pt', '11pt' or '12pt').
123-
#
124-
# 'pointsize': '10pt',
125-
126-
# Additional stuff for the LaTeX preamble.
127-
#
128-
# 'preamble': '',
129-
130-
# Latex figure (float) alignment
131-
#
132-
# 'figure_align': 'htbp',
134+
# The paper size ('letterpaper' or 'a4paper').
135+
#
136+
# 'papersize': 'letterpaper',
137+
# The font size ('10pt', '11pt' or '12pt').
138+
#
139+
# 'pointsize': '10pt',
140+
# Additional stuff for the LaTeX preamble.
141+
#
142+
# 'preamble': '',
143+
# Latex figure (float) alignment
144+
#
145+
# 'figure_align': 'htbp',
133146
}
134147

135148
# Grouping the document tree into LaTeX files. List of tuples
136149
# (source start file, target name, title,
137150
# author, documentclass [howto, manual, or own class]).
138151
latex_documents = [
139-
(master_doc, 'AdafruitVEML7700Library.tex', u'AdafruitVEML7700 Library Documentation',
140-
author, 'manual'),
152+
(
153+
master_doc,
154+
"AdafruitVEML7700Library.tex",
155+
u"AdafruitVEML7700 Library Documentation",
156+
author,
157+
"manual",
158+
),
141159
]
142160

143161
# -- Options for manual page output ---------------------------------------
144162

145163
# One entry per manual page. List of tuples
146164
# (source start file, name, description, authors, manual section).
147165
man_pages = [
148-
(master_doc, 'AdafruitVEML7700library', u'Adafruit VEML7700 Library Documentation',
149-
[author], 1)
166+
(
167+
master_doc,
168+
"AdafruitVEML7700library",
169+
u"Adafruit VEML7700 Library Documentation",
170+
[author],
171+
1,
172+
)
150173
]
151174

152175
# -- Options for Texinfo output -------------------------------------------
@@ -155,7 +178,13 @@
155178
# (source start file, target name, title, author,
156179
# dir menu entry, description, category)
157180
texinfo_documents = [
158-
(master_doc, 'AdafruitVEML7700Library', u'Adafruit VEML7700 Library Documentation',
159-
author, 'AdafruitVEML7700Library', 'One line description of project.',
160-
'Miscellaneous'),
181+
(
182+
master_doc,
183+
"AdafruitVEML7700Library",
184+
u"Adafruit VEML7700 Library Documentation",
185+
author,
186+
"AdafruitVEML7700Library",
187+
"One line description of project.",
188+
"Miscellaneous",
189+
),
161190
]

setup.py

+24-32
Original file line numberDiff line numberDiff line change
@@ -6,61 +6,53 @@
66
"""
77

88
from setuptools import setup, find_packages
9+
910
# To use a consistent encoding
1011
from codecs import open
1112
from os import path
1213

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

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

1920
setup(
20-
name='adafruit-circuitpython-veml7700',
21-
21+
name="adafruit-circuitpython-veml7700",
2222
use_scm_version=True,
23-
setup_requires=['setuptools_scm'],
24-
25-
description='CircuitPython driver for VEML7700 high precision I2C ambient light sensor.',
23+
setup_requires=["setuptools_scm"],
24+
description="CircuitPython driver for VEML7700 high precision I2C ambient light sensor.",
2625
long_description=long_description,
27-
long_description_content_type='text/x-rst',
28-
26+
long_description_content_type="text/x-rst",
2927
# The project's main homepage.
30-
url='https://github.com/adafruit/Adafruit_CircuitPython_VEML7700',
31-
28+
url="https://github.com/adafruit/Adafruit_CircuitPython_VEML7700",
3229
# Author details
33-
author='Adafruit Industries',
34-
author_email='[email protected]',
35-
30+
author="Adafruit Industries",
31+
author_email="[email protected]",
3632
install_requires=[
37-
'Adafruit-Blinka',
38-
'adafruit-circuitpython-busdevice',
39-
'adafruit-circuitpython-register'
33+
"Adafruit-Blinka",
34+
"adafruit-circuitpython-busdevice",
35+
"adafruit-circuitpython-register",
4036
],
41-
4237
# Choose your license
43-
license='MIT',
44-
38+
license="MIT",
4539
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
4640
classifiers=[
47-
'Development Status :: 3 - Alpha',
48-
'Intended Audience :: Developers',
49-
'Topic :: Software Development :: Libraries',
50-
'Topic :: System :: Hardware',
51-
'License :: OSI Approved :: MIT License',
52-
'Programming Language :: Python :: 3',
53-
'Programming Language :: Python :: 3.4',
54-
'Programming Language :: Python :: 3.5',
41+
"Development Status :: 3 - Alpha",
42+
"Intended Audience :: Developers",
43+
"Topic :: Software Development :: Libraries",
44+
"Topic :: System :: Hardware",
45+
"License :: OSI Approved :: MIT License",
46+
"Programming Language :: Python :: 3",
47+
"Programming Language :: Python :: 3.4",
48+
"Programming Language :: Python :: 3.5",
5549
],
56-
5750
# What does your project relate to?
58-
keywords='adafruit blinka circuitpython micropython veml7700 ambient light sensor i2c '
59-
'precision',
60-
51+
keywords="adafruit blinka circuitpython micropython veml7700 ambient light sensor i2c "
52+
"precision",
6153
# You can just specify the packages manually here if your project is
6254
# simple. Or you can use find_packages().
6355
# TODO: IF LIBRARY FILES ARE A PACKAGE FOLDER,
6456
# CHANGE `py_modules=['...']` TO `packages=['...']`
65-
py_modules=['adafruit_veml7700'],
57+
py_modules=["adafruit_veml7700"],
6658
)

0 commit comments

Comments
 (0)