Skip to content

Commit 2ca197f

Browse files
committed
Ran black, updated to pylint 2.x
1 parent 9ac0cc1 commit 2ca197f

File tree

4 files changed

+121
-98
lines changed

4 files changed

+121
-98
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_veml6075.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,19 @@
5353
# pylint: disable=bad-whitespace
5454
_VEML6075_ADDR = const(0x10)
5555

56-
_REG_CONF = const(0x00)
57-
_REG_UVA = const(0x07)
58-
_REG_DARK = const(0x08) # check is true?
59-
_REG_UVB = const(0x09)
56+
_REG_CONF = const(0x00)
57+
_REG_UVA = const(0x07)
58+
_REG_DARK = const(0x08) # check is true?
59+
_REG_UVB = const(0x09)
6060
_REG_UVCOMP1 = const(0x0A)
6161
_REG_UVCOMP2 = const(0x0B)
62-
_REV_ID = const(0x0C)
62+
_REV_ID = const(0x0C)
6363

6464
# Valid constants for UV Integration Time
65-
_VEML6075_UV_IT = { 50: 0x00,
66-
100: 0x01,
67-
200: 0x02,
68-
400: 0x03,
69-
800: 0x04 }
65+
_VEML6075_UV_IT = {50: 0x00, 100: 0x01, 200: 0x02, 400: 0x03, 800: 0x04}
7066
# pylint: enable=bad-whitespace
7167

68+
7269
class VEML6075:
7370
"""
7471
Driver base for the VEML6075 UV Light Sensor
@@ -89,10 +86,19 @@ class VEML6075:
8986
:param float uvb_response: the UVA responsivity
9087
"""
9188

92-
def __init__(self, i2c_bus, *, integration_time=50, high_dynamic=True,
93-
uva_a_coef=2.22, uva_b_coef=1.33,
94-
uvb_c_coef=2.95, uvb_d_coef=1.74,
95-
uva_response=0.001461, uvb_response=0.002591):
89+
def __init__(
90+
self,
91+
i2c_bus,
92+
*,
93+
integration_time=50,
94+
high_dynamic=True,
95+
uva_a_coef=2.22,
96+
uva_b_coef=1.33,
97+
uvb_c_coef=2.95,
98+
uvb_d_coef=1.74,
99+
uva_response=0.001461,
100+
uvb_response=0.002591
101+
):
96102
# Set coefficients
97103
self._a = uva_a_coef
98104
self._b = uva_b_coef
@@ -129,13 +135,13 @@ def _take_reading(self):
129135
time.sleep(0.1)
130136
uva = self._read_register(_REG_UVA)
131137
uvb = self._read_register(_REG_UVB)
132-
#dark = self._read_register(_REG_DARK)
138+
# dark = self._read_register(_REG_DARK)
133139
uvcomp1 = self._read_register(_REG_UVCOMP1)
134140
uvcomp2 = self._read_register(_REG_UVCOMP2)
135141
# Equasion 1 & 2 in App note, without 'golden sample' calibration
136142
self._uvacalc = uva - (self._a * uvcomp1) - (self._b * uvcomp2)
137143
self._uvbcalc = uvb - (self._c * uvcomp1) - (self._d * uvcomp2)
138-
#print("UVA = %d, UVB = %d, UVcomp1 = %d, UVcomp2 = %d, Dark = %d" %
144+
# print("UVA = %d, UVB = %d, UVcomp1 = %d, UVcomp2 = %d, Dark = %d" %
139145
# (uva, uvb, uvcomp1, uvcomp2, dark))
140146

141147
@property
@@ -171,11 +177,10 @@ def integration_time(self, val):
171177
if not val in _VEML6075_UV_IT.keys():
172178
raise RuntimeError("Invalid integration time")
173179
conf = self._read_register(_REG_CONF)
174-
conf &= ~ 0b01110000 # mask off bits 4:6
180+
conf &= ~0b01110000 # mask off bits 4:6
175181
conf |= _VEML6075_UV_IT[val] << 4
176182
self._write_register(_REG_CONF, conf)
177183

178-
179184
def _read_register(self, register):
180185
"""Read a 16-bit value from the `register` location"""
181186
self._buffer[0] = register

docs/conf.py

Lines changed: 76 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,62 @@
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 = ["micropython"]
24-
25-
26-
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)}
24+
# autodoc_mock_imports = ["micropython"]
25+
26+
27+
intersphinx_mapping = {
28+
"python": ("https://docs.python.org/3.4", None),
29+
"BusDevice": (
30+
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
31+
None,
32+
),
33+
"Register": (
34+
"https://circuitpython.readthedocs.io/projects/register/en/latest/",
35+
None,
36+
),
37+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
38+
}
2739

2840
# Add any paths that contain templates here, relative to this directory.
29-
templates_path = ['_templates']
41+
templates_path = ["_templates"]
3042

31-
source_suffix = '.rst'
43+
source_suffix = ".rst"
3244

3345
# The master toctree document.
34-
master_doc = 'index'
46+
master_doc = "index"
3547

3648
# General information about the project.
37-
project = u'Adafruit VEML6075 Library'
38-
copyright = u'2018 ladyada'
39-
author = u'ladyada'
49+
project = u"Adafruit VEML6075 Library"
50+
copyright = u"2018 ladyada"
51+
author = u"ladyada"
4052

4153
# The version info for the project you're documenting, acts as replacement for
4254
# |version| and |release|, also used in various other places throughout the
4355
# built documents.
4456
#
4557
# The short X.Y version.
46-
version = u'1.0'
58+
version = u"1.0"
4759
# The full version, including alpha/beta/rc tags.
48-
release = u'1.0'
60+
release = u"1.0"
4961

5062
# The language for content autogenerated by Sphinx. Refer to documentation
5163
# for a list of supported languages.
@@ -57,7 +69,7 @@
5769
# List of patterns, relative to source directory, that match files and
5870
# directories to ignore when looking for source files.
5971
# This patterns also effect to html_static_path and html_extra_path
60-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
72+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
6173

6274
# The reST default role (used for this markup: `text`) to use for all
6375
# documents.
@@ -69,7 +81,7 @@
6981
add_function_parentheses = True
7082

7183
# The name of the Pygments (syntax highlighting) style to use.
72-
pygments_style = 'sphinx'
84+
pygments_style = "sphinx"
7385

7486
# If true, `todo` and `todoList` produce output, else they produce nothing.
7587
todo_include_todos = False
@@ -84,68 +96,76 @@
8496
# The theme to use for HTML and HTML Help pages. See the documentation for
8597
# a list of builtin themes.
8698
#
87-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
99+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
88100

89101
if not on_rtd: # only import and set the theme if we're building docs locally
90102
try:
91103
import sphinx_rtd_theme
92-
html_theme = 'sphinx_rtd_theme'
93-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
104+
105+
html_theme = "sphinx_rtd_theme"
106+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
94107
except:
95-
html_theme = 'default'
96-
html_theme_path = ['.']
108+
html_theme = "default"
109+
html_theme_path = ["."]
97110
else:
98-
html_theme_path = ['.']
111+
html_theme_path = ["."]
99112

100113
# Add any paths that contain custom static files (such as style sheets) here,
101114
# relative to this directory. They are copied after the builtin static files,
102115
# so a file named "default.css" will overwrite the builtin "default.css".
103-
html_static_path = ['_static']
116+
html_static_path = ["_static"]
104117

105118
# The name of an image file (relative to this directory) to use as a favicon of
106119
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
107120
# pixels large.
108121
#
109-
html_favicon = '_static/favicon.ico'
122+
html_favicon = "_static/favicon.ico"
110123

111124
# Output file base name for HTML help builder.
112-
htmlhelp_basename = 'AdafruitVeml6075Librarydoc'
125+
htmlhelp_basename = "AdafruitVeml6075Librarydoc"
113126

114127
# -- Options for LaTeX output ---------------------------------------------
115128

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

134144
# Grouping the document tree into LaTeX files. List of tuples
135145
# (source start file, target name, title,
136146
# author, documentclass [howto, manual, or own class]).
137147
latex_documents = [
138-
(master_doc, 'AdafruitVEML6075Library.tex', u'AdafruitVEML6075 Library Documentation',
139-
author, 'manual'),
148+
(
149+
master_doc,
150+
"AdafruitVEML6075Library.tex",
151+
u"AdafruitVEML6075 Library Documentation",
152+
author,
153+
"manual",
154+
),
140155
]
141156

142157
# -- Options for manual page output ---------------------------------------
143158

144159
# One entry per manual page. List of tuples
145160
# (source start file, name, description, authors, manual section).
146161
man_pages = [
147-
(master_doc, 'AdafruitVEML6075library', u'Adafruit VEML6075 Library Documentation',
148-
[author], 1)
162+
(
163+
master_doc,
164+
"AdafruitVEML6075library",
165+
u"Adafruit VEML6075 Library Documentation",
166+
[author],
167+
1,
168+
)
149169
]
150170

151171
# -- Options for Texinfo output -------------------------------------------
@@ -154,7 +174,13 @@
154174
# (source start file, target name, title, author,
155175
# dir menu entry, description, category)
156176
texinfo_documents = [
157-
(master_doc, 'AdafruitVEML6075Library', u'Adafruit VEML6075 Library Documentation',
158-
author, 'AdafruitVEML6075Library', 'One line description of project.',
159-
'Miscellaneous'),
177+
(
178+
master_doc,
179+
"AdafruitVEML6075Library",
180+
u"Adafruit VEML6075 Library Documentation",
181+
author,
182+
"AdafruitVEML6075Library",
183+
"One line description of project.",
184+
"Miscellaneous",
185+
),
160186
]

setup.py

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,54 +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-veml6075',
22-
22+
name="adafruit-circuitpython-veml6075",
2323
use_scm_version=True,
24-
setup_requires=['setuptools_scm'],
25-
26-
description='CircuitPython library for interfacing with VEML6075 UV sensor',
24+
setup_requires=["setuptools_scm"],
25+
description="CircuitPython library for interfacing with VEML6075 UV sensor",
2726
long_description=long_description,
28-
long_description_content_type='text/x-rst',
29-
27+
long_description_content_type="text/x-rst",
3028
# The project's main homepage.
31-
url='https://github.com/adafruit/Adafruit_CircuitPython_VEML6075',
32-
29+
url="https://github.com/adafruit/Adafruit_CircuitPython_VEML6075",
3330
# Author details
34-
author='Adafruit Industries',
35-
author_email='[email protected]',
36-
37-
install_requires=['Adafruit-Blinka', 'adafruit-circuitpython-busdevice'],
38-
31+
author="Adafruit Industries",
32+
author_email="[email protected]",
33+
install_requires=["Adafruit-Blinka", "adafruit-circuitpython-busdevice"],
3934
# Choose your license
40-
license='MIT',
41-
35+
license="MIT",
4236
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
4337
classifiers=[
44-
'Development Status :: 3 - Alpha',
45-
'Intended Audience :: Developers',
46-
'Topic :: Software Development :: Libraries',
47-
'Topic :: System :: Hardware',
48-
'License :: OSI Approved :: MIT License',
49-
'Programming Language :: Python :: 3',
50-
'Programming Language :: Python :: 3.4',
51-
'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",
5246
],
53-
5447
# What does your project relate to?
55-
keywords='adafruit sensor hardware micropython circuitpython',
56-
48+
keywords="adafruit sensor hardware micropython circuitpython",
5749
# You can just specify the packages manually here if your project is
5850
# simple. Or you can use find_packages().
59-
py_modules=['adafruit_veml6075'],
51+
py_modules=["adafruit_veml6075"],
6052
)

0 commit comments

Comments
 (0)