Skip to content

Commit 7117dfe

Browse files
authored
Merge pull request #17 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents 498d44c + 8a7d945 commit 7117dfe

File tree

5 files changed

+109
-91
lines changed

5 files changed

+109
-91
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

.pylintrc

+3-3
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ 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
123123
notes=FIXME,XXX
124124

125125

@@ -301,7 +301,7 @@ function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
301301

302302
# Good variable names which should always be accepted, separated by a comma
303303
# good-names=i,j,k,ex,Run,_
304-
good-names=r,g,b,i,j,k,n,ex,Run,_
304+
good-names=r,g,b,w,i,j,k,n,x,y,z,ex,ok,Run,_
305305

306306
# Include a hint for the correct naming format with invalid-name
307307
include-naming-hint=no
@@ -423,7 +423,7 @@ max-returns=6
423423
max-statements=50
424424

425425
# Minimum number of public methods for a class (see R0903).
426-
min-public-methods=2
426+
min-public-methods=1
427427

428428

429429
[EXCEPTIONS]

docs/conf.py

+64-47
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_register", "adafruit_bus_device"]
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 DS1307 Library'
61-
copyright = u'2016, Philip Moyer and Adafruit Industries'
62-
author = u'Philip Moyer'
61+
project = u"Adafruit DS1307 Library"
62+
copyright = u"2016, Philip Moyer and Adafruit Industries"
63+
author = u"Philip Moyer"
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
# A list of ignored prefixes for module index sorting.
117118
# modindex_common_prefix = []
@@ -131,18 +132,19 @@
131132
# The theme to use for HTML and HTML Help pages. See the documentation for
132133
# a list of builtin themes.
133134
#
134-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
135+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
135136

136137
if not on_rtd: # only import and set the theme if we're building docs locally
137138
try:
138139
import sphinx_rtd_theme
139-
html_theme = 'sphinx_rtd_theme'
140-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
140+
141+
html_theme = "sphinx_rtd_theme"
142+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
141143
except:
142-
html_theme = 'default'
143-
html_theme_path = ['.']
144+
html_theme = "default"
145+
html_theme_path = ["."]
144146
else:
145-
html_theme_path = ['.']
147+
html_theme_path = ["."]
146148

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

181183
# The name of an image file (relative to this directory) to use as a favicon of
182184
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
183185
# pixels large.
184186
#
185-
html_favicon = '_static/favicon.ico'
187+
html_favicon = "_static/favicon.ico"
186188

187189
# Add any extra paths that contain custom files (such as robots.txt or
188190
# .htaccess) here, relative to this directory. These files are copied
@@ -262,34 +264,36 @@
262264
# html_search_scorer = 'scorer.js'
263265

264266
# Output file base name for HTML help builder.
265-
htmlhelp_basename = 'AdafruitDS1307Librarydoc'
267+
htmlhelp_basename = "AdafruitDS1307Librarydoc"
266268

267269
# -- Options for LaTeX output ---------------------------------------------
268270

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

287286
# Grouping the document tree into LaTeX files. List of tuples
288287
# (source start file, target name, title,
289288
# author, documentclass [howto, manual, or own class]).
290289
latex_documents = [
291-
(master_doc, 'AdafruitDS1307Library.tex', u'Adafruit DS1307 Library Documentation',
292-
u'Phiilip Moyer', 'manual'),
290+
(
291+
master_doc,
292+
"AdafruitDS1307Library.tex",
293+
u"Adafruit DS1307 Library Documentation",
294+
u"Phiilip Moyer",
295+
"manual",
296+
),
293297
]
294298

295299
# The name of an image file (relative to this directory) to place at the top of
@@ -330,8 +334,13 @@
330334
# One entry per manual page. List of tuples
331335
# (source start file, name, description, authors, manual section).
332336
man_pages = [
333-
(master_doc, 'adafruitds1307library', u'Adafruit DS1307 Library Documentation',
334-
[author], 1)
337+
(
338+
master_doc,
339+
"adafruitds1307library",
340+
u"Adafruit DS1307 Library Documentation",
341+
[author],
342+
1,
343+
)
335344
]
336345

337346
# If true, show URL addresses after external links.
@@ -345,9 +354,15 @@
345354
# (source start file, target name, title, author,
346355
# dir menu entry, description, category)
347356
texinfo_documents = [
348-
(master_doc, 'AdafruitDS1307Library', u'Adafruit DS1307 Library Documentation',
349-
author, 'AdafruitDS1307Library', 'One line description of project.',
350-
'Miscellaneous'),
357+
(
358+
master_doc,
359+
"AdafruitDS1307Library",
360+
u"Adafruit DS1307 Library Documentation",
361+
author,
362+
"AdafruitDS1307Library",
363+
"One line description of project.",
364+
"Miscellaneous",
365+
),
351366
]
352367

353368
# Documents to append as an appendix to all manuals.
@@ -366,5 +381,7 @@
366381
#
367382
# texinfo_no_detailmenu = False
368383

369-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
370-
'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
384+
intersphinx_mapping = {
385+
"python": ("https://docs.python.org/3.4", None),
386+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
387+
}

examples/ds1307_simpletest.py

+17-11
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55

66
import time
77
import board
8+
89
# For hardware I2C (M0 boards) use this line:
910
import busio as io
11+
1012
# Or for software I2C (ESP8266) use this line instead:
11-
#import bitbangio as io
13+
# import bitbangio as io
1214

1315
import adafruit_ds1307
1416

@@ -22,23 +24,27 @@
2224
days = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
2325

2426

25-
#pylint: disable-msg=bad-whitespace
26-
#pylint: disable-msg=using-constant-test
27-
if False: # change to True if you want to set the time!
27+
# pylint: disable-msg=bad-whitespace
28+
# pylint: disable-msg=using-constant-test
29+
if False: # change to True if you want to set the time!
2830
# year, mon, date, hour, min, sec, wday, yday, isdst
29-
t = time.struct_time((2017, 10, 29, 15, 14, 15, 0, -1, -1))
31+
t = time.struct_time((2017, 10, 29, 15, 14, 15, 0, -1, -1))
3032
# you must set year, mon, date, hour, min, sec and weekday
3133
# yearday is not supported, isdst can be set but we don't do anything with it at this time
32-
print("Setting time to:", t) # uncomment for debugging
34+
print("Setting time to:", t) # uncomment for debugging
3335
rtc.datetime = t
3436
print()
35-
#pylint: enable-msg=using-constant-test
36-
#pylint: enable-msg=bad-whitespace
37+
# pylint: enable-msg=using-constant-test
38+
# pylint: enable-msg=bad-whitespace
3739

3840
# Main loop:
3941
while True:
4042
t = rtc.datetime
41-
#print(t) # uncomment for debugging
42-
print("The date is {} {}/{}/{}".format(days[int(t.tm_wday)], t.tm_mday, t.tm_mon, t.tm_year))
43+
# print(t) # uncomment for debugging
44+
print(
45+
"The date is {} {}/{}/{}".format(
46+
days[int(t.tm_wday)], t.tm_mday, t.tm_mon, t.tm_year
47+
)
48+
)
4349
print("The time is {}:{:02}:{:02}".format(t.tm_hour, t.tm_min, t.tm_sec))
44-
time.sleep(1) # wait a second
50+
time.sleep(1) # wait a second

setup.py

+24-29
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,49 @@
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-ds1307',
22-
22+
name="adafruit-circuitpython-ds1307",
2323
use_scm_version=True,
24-
setup_requires=['setuptools_scm'],
25-
26-
description='CircuitPython library for DS1307 real time clock.',
24+
setup_requires=["setuptools_scm"],
25+
description="CircuitPython library for DS1307 real time clock.",
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_DS1307',
32-
29+
url="https://github.com/adafruit/Adafruit_CircuitPython_DS1307",
3330
# Author details
34-
author='Adafruit Industries',
35-
author_email='[email protected]',
36-
37-
install_requires=['adafruit-circuitpython-register', 'adafruit-circuitpython-busdevice'],
38-
31+
author="Adafruit Industries",
32+
author_email="[email protected]",
33+
install_requires=[
34+
"adafruit-circuitpython-register",
35+
"adafruit-circuitpython-busdevice",
36+
],
3937
# Choose your license
40-
license='MIT',
41-
38+
license="MIT",
4239
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
4340
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',
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",
5249
],
53-
5450
# What does your project relate to?
55-
keywords='adafruit real time clock rtc breakout hardware micropython circuitpython',
56-
51+
keywords="adafruit real time clock rtc breakout hardware micropython circuitpython",
5752
# You can just specify the packages manually here if your project is
5853
# simple. Or you can use find_packages().
59-
py_modules=['adafruit_ds1307'],
54+
py_modules=["adafruit_ds1307"],
6055
)

0 commit comments

Comments
 (0)