Skip to content

Commit 3382794

Browse files
authored
Merge pull request #16 from adafruit/pylint-update
Ran black, updated to pylint 2.x
2 parents a2d232f + 1f2d87c commit 3382794

File tree

6 files changed

+110
-92
lines changed

6 files changed

+110
-92
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

+2-1
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_pcf8523.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class is inherited by the chip-specific subclasses.
6969
STANDARD_BATTERY_SWITCHOVER_AND_DETECTION = 0b000
7070
BATTERY_SWITCHOVER_OFF = 0b111
7171

72+
7273
class PCF8523:
7374
"""Interface to the PCF8523 RTC."""
7475

@@ -86,8 +87,9 @@ class PCF8523:
8687

8788
# The False means that day and weekday share a register. The 0 is that the
8889
# first day of the week is value 0 and not 1.
89-
alarm = i2c_bcd_alarm.BCDAlarmTimeRegister(0x0a, has_seconds=False, weekday_shared=False,
90-
weekday_start=0)
90+
alarm = i2c_bcd_alarm.BCDAlarmTimeRegister(
91+
0x0A, has_seconds=False, weekday_shared=False, weekday_start=0
92+
)
9193
"""Alarm time for the first alarm."""
9294

9395
alarm_interrupt = i2c_bit.RWBit(0x00, 1)

docs/conf.py

+61-48
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

@@ -29,46 +30,42 @@
2930
# Add any Sphinx extension module names here, as strings. They can be
3031
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3132
# ones.
32-
extensions = [
33-
'sphinx.ext.autodoc',
34-
'sphinx.ext.todo',
35-
'sphinx.ext.intersphinx'
36-
]
33+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.todo", "sphinx.ext.intersphinx"]
3734

3835
# Uncomment the below if you use native CircuitPython modules such as
3936
# digitalio, micropython and busio. List the modules you use. Without it, the
4037
# autodoc module docs will fail to generate with a warning.
4138
# autodoc_mock_imports = ["adafruit_bus_device", "adafruit_register"]
4239

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

4643
# The suffix(es) of source filenames.
4744
# You can specify multiple suffix as a list of string:
4845
#
49-
source_suffix = ['.rst', '.md']
46+
source_suffix = [".rst", ".md"]
5047
# source_suffix = '.rst'
5148

5249
# The encoding of source files.
5350
#
5451
# source_encoding = 'utf-8-sig'
5552

5653
# The master toctree document.
57-
master_doc = 'index'
54+
master_doc = "index"
5855

5956
# General information about the project.
60-
project = u'Adafruit\'s PCF8523 RTC Library'
61-
copyright = u'2016, Philip Moyer'
62-
author = u'Philip Moyer'
57+
project = u"Adafruit's PCF8523 RTC Library"
58+
copyright = u"2016, Philip Moyer"
59+
author = u"Philip Moyer"
6360

6461
# The version info for the project you're documenting, acts as replacement for
6562
# |version| and |release|, also used in various other places throughout the
6663
# built documents.
6764
#
6865
# The short X.Y version.
69-
version = u'1.0'
66+
version = u"1.0"
7067
# The full version, including alpha/beta/rc tags.
71-
release = u'1.0'
68+
release = u"1.0"
7269

7370
# The language for content autogenerated by Sphinx. Refer to documentation
7471
# for a list of supported languages.
@@ -89,7 +86,7 @@
8986
# List of patterns, relative to source directory, that match files and
9087
# directories to ignore when looking for source files.
9188
# 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']
89+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
9390

9491
# The reST default role (used for this markup: `text`) to use for all
9592
# documents.
@@ -111,7 +108,7 @@
111108
# show_authors = False
112109

113110
# The name of the Pygments (syntax highlighting) style to use.
114-
pygments_style = 'sphinx'
111+
pygments_style = "sphinx"
115112

116113
# A list of ignored prefixes for module index sorting.
117114
# modindex_common_prefix = []
@@ -130,18 +127,19 @@
130127
# The theme to use for HTML and HTML Help pages. See the documentation for
131128
# a list of builtin themes.
132129
#
133-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
130+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
134131

135132
if not on_rtd: # only import and set the theme if we're building docs locally
136133
try:
137134
import sphinx_rtd_theme
138-
html_theme = 'sphinx_rtd_theme'
139-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
135+
136+
html_theme = "sphinx_rtd_theme"
137+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
140138
except:
141-
html_theme = 'default'
142-
html_theme_path = ['.']
139+
html_theme = "default"
140+
html_theme_path = ["."]
143141
else:
144-
html_theme_path = ['.']
142+
html_theme_path = ["."]
145143

146144
# Theme options are theme-specific and customize the look and feel of a theme
147145
# further. For a list of options available for each theme, see the
@@ -169,12 +167,12 @@
169167
# The name of an image file (within the static path) to use as favicon of the
170168
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
171169
# pixels large.
172-
html_favicon = '_static/favicon.ico'
170+
html_favicon = "_static/favicon.ico"
173171

174172
# Add any paths that contain custom static files (such as style sheets) here,
175173
# relative to this directory. They are copied after the builtin static files,
176174
# so a file named "default.css" will overwrite the builtin "default.css".
177-
html_static_path = ['_static']
175+
html_static_path = ["_static"]
178176

179177
# Add any extra paths that contain custom files (such as robots.txt or
180178
# .htaccess) here, relative to this directory. These files are copied
@@ -259,29 +257,31 @@
259257
# -- Options for LaTeX output ---------------------------------------------
260258

261259
latex_elements = {
262-
# The paper size ('letterpaper' or 'a4paper').
263-
#
264-
# 'papersize': 'letterpaper',
265-
266-
# The font size ('10pt', '11pt' or '12pt').
267-
#
268-
# 'pointsize': '10pt',
269-
270-
# Additional stuff for the LaTeX preamble.
271-
#
272-
# 'preamble': '',
273-
274-
# Latex figure (float) alignment
275-
#
276-
# 'figure_align': 'htbp',
260+
# The paper size ('letterpaper' or 'a4paper').
261+
#
262+
# 'papersize': 'letterpaper',
263+
# The font size ('10pt', '11pt' or '12pt').
264+
#
265+
# 'pointsize': '10pt',
266+
# Additional stuff for the LaTeX preamble.
267+
#
268+
# 'preamble': '',
269+
# Latex figure (float) alignment
270+
#
271+
# 'figure_align': 'htbp',
277272
}
278273

279274
# Grouping the document tree into LaTeX files. List of tuples
280275
# (source start file, target name, title,
281276
# author, documentclass [howto, manual, or own class]).
282277
latex_documents = [
283-
(master_doc, 'AdafruitsPCF8523RTCLibrary.tex', u'Adafruit\'s PCF8523 RTC Library Documentation',
284-
u'Philip Moyer', 'manual'),
278+
(
279+
master_doc,
280+
"AdafruitsPCF8523RTCLibrary.tex",
281+
u"Adafruit's PCF8523 RTC Library Documentation",
282+
u"Philip Moyer",
283+
"manual",
284+
),
285285
]
286286

287287
# The name of an image file (relative to this directory) to place at the top of
@@ -322,8 +322,13 @@
322322
# One entry per manual page. List of tuples
323323
# (source start file, name, description, authors, manual section).
324324
man_pages = [
325-
(master_doc, 'AdafruitsPCF8523RTCLibrary23rtclibrary', u'Adafruit\'s PCF8523 RTC Library Documentation',
326-
[author], 1)
325+
(
326+
master_doc,
327+
"AdafruitsPCF8523RTCLibrary23rtclibrary",
328+
u"Adafruit's PCF8523 RTC Library Documentation",
329+
[author],
330+
1,
331+
)
327332
]
328333

329334
# If true, show URL addresses after external links.
@@ -337,9 +342,15 @@
337342
# (source start file, target name, title, author,
338343
# dir menu entry, description, category)
339344
texinfo_documents = [
340-
(master_doc, 'AdafruitsPCF8523RTCLibrary', u'Adafruit\'s PCF8523 RTC Library Documentation',
341-
author, 'AdafruitsPCF8523RTCLibrary', 'One line description of project.',
342-
'Miscellaneous'),
345+
(
346+
master_doc,
347+
"AdafruitsPCF8523RTCLibrary",
348+
u"Adafruit's PCF8523 RTC Library Documentation",
349+
author,
350+
"AdafruitsPCF8523RTCLibrary",
351+
"One line description of project.",
352+
"Miscellaneous",
353+
),
343354
]
344355

345356
# Documents to append as an appendix to all manuals.
@@ -358,5 +369,7 @@
358369
#
359370
# texinfo_no_detailmenu = False
360371

361-
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
362-
'CircuitPython': ('https://circuitpython.readthedocs.io/en/latest/', None)}
372+
intersphinx_mapping = {
373+
"python": ("https://docs.python.org/3.4", None),
374+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
375+
}

examples/pcf8523_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_pcf8523
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, 10, 31, 0, 0, -1, -1))
31+
t = time.struct_time((2017, 10, 29, 10, 31, 0, 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

+25-29
Original file line numberDiff line numberDiff line change
@@ -7,54 +7,50 @@
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-pcf8523',
22-
22+
name="adafruit-circuitpython-pcf8523",
2323
use_scm_version=True,
24-
setup_requires=['setuptools_scm'],
25-
26-
description='CircuitPython library for PCF8523 real time clock.',
24+
setup_requires=["setuptools_scm"],
25+
description="CircuitPython library for PCF8523 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_PCF8523',
32-
29+
url="https://github.com/adafruit/Adafruit_CircuitPython_PCF8523",
3330
# Author details
34-
author='Adafruit Industries',
35-
author_email='[email protected]',
36-
37-
install_requires=['Adafruit-Blinka', 'adafruit-circuitpython-register', 'adafruit-circuitpython-busdevice'],
38-
31+
author="Adafruit Industries",
32+
author_email="[email protected]",
33+
install_requires=[
34+
"Adafruit-Blinka",
35+
"adafruit-circuitpython-register",
36+
"adafruit-circuitpython-busdevice",
37+
],
3938
# Choose your license
40-
license='MIT',
41-
39+
license="MIT",
4240
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
4341
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',
42+
"Development Status :: 3 - Alpha",
43+
"Intended Audience :: Developers",
44+
"Topic :: Software Development :: Libraries",
45+
"Topic :: System :: Hardware",
46+
"License :: OSI Approved :: MIT License",
47+
"Programming Language :: Python :: 3",
48+
"Programming Language :: Python :: 3.4",
49+
"Programming Language :: Python :: 3.5",
5250
],
53-
5451
# What does your project relate to?
55-
keywords='adafruit pcf8523 real time clock rtc breakout hardware micropython circuitpython',
56-
52+
keywords="adafruit pcf8523 real time clock rtc breakout hardware micropython circuitpython",
5753
# You can just specify the packages manually here if your project is
5854
# simple. Or you can use find_packages().
59-
py_modules=['adafruit_pcf8523'],
55+
py_modules=["adafruit_pcf8523"],
6056
)

0 commit comments

Comments
 (0)