Skip to content

Commit 19712a7

Browse files
committed
Ran black, updated to pylint 2.x
1 parent d9822e6 commit 19712a7

File tree

6 files changed

+128
-100
lines changed

6 files changed

+128
-100
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

.pylintrc

Lines changed: 4 additions & 3 deletions
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]
@@ -300,7 +301,7 @@ function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
300301

301302
# Good variable names which should always be accepted, separated by a comma
302303
# good-names=i,j,k,ex,Run,_
303-
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,_
304305

305306
# Include a hint for the correct naming format with invalid-name
306307
include-naming-hint=no
@@ -422,7 +423,7 @@ max-returns=6
422423
max-statements=50
423424

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

427428

428429
[EXCEPTIONS]

adafruit_ds3231.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@
6262
__version__ = "0.0.0-auto.0"
6363
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_DS3231.git"
6464

65-
#pylint: disable-msg=too-few-public-methods
65+
# pylint: disable-msg=too-few-public-methods
6666
class DS3231:
6767
"""Interface to the DS3231 RTC."""
6868

69-
lost_power = i2c_bit.RWBit(0x0f, 7)
69+
lost_power = i2c_bit.RWBit(0x0F, 7)
7070
"""True if the device has lost power since the time was set."""
7171

72-
disable_oscillator = i2c_bit.RWBit(0x0e, 7)
72+
disable_oscillator = i2c_bit.RWBit(0x0E, 7)
7373
"""True if the oscillator is disabled."""
7474

7575
datetime_register = i2c_bcd_datetime.BCDDateTimeRegister(0x00)
@@ -78,19 +78,19 @@ class DS3231:
7878
alarm1 = i2c_bcd_alarm.BCDAlarmTimeRegister(0x07)
7979
"""Alarm time for the first alarm."""
8080

81-
alarm1_interrupt = i2c_bit.RWBit(0x0e, 0)
81+
alarm1_interrupt = i2c_bit.RWBit(0x0E, 0)
8282
"""True if the interrupt pin will output when alarm1 is alarming."""
8383

84-
alarm1_status = i2c_bit.RWBit(0x0f, 0)
84+
alarm1_status = i2c_bit.RWBit(0x0F, 0)
8585
"""True if alarm1 is alarming. Set to False to reset."""
8686

87-
alarm2 = i2c_bcd_alarm.BCDAlarmTimeRegister(0x0b, has_seconds=False)
87+
alarm2 = i2c_bcd_alarm.BCDAlarmTimeRegister(0x0B, has_seconds=False)
8888
"""Alarm time for the second alarm."""
8989

90-
alarm2_interrupt = i2c_bit.RWBit(0x0e, 1)
90+
alarm2_interrupt = i2c_bit.RWBit(0x0E, 1)
9191
"""True if the interrupt pin will output when alarm2 is alarming."""
9292

93-
alarm2_status = i2c_bit.RWBit(0x0f, 1)
93+
alarm2_status = i2c_bit.RWBit(0x0F, 1)
9494
"""True if alarm2 is alarming. Set to False to reset."""
9595

9696
def __init__(self, i2c):

docs/conf.py

Lines changed: 73 additions & 47 deletions
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,48 +31,59 @@
3031
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3132
# ones.
3233
extensions = [
33-
'sphinx.ext.autodoc',
34-
'sphinx.ext.todo',
35-
'sphinx.ext.viewcode',
36-
'sphinx.ext.intersphinx'
34+
"sphinx.ext.autodoc",
35+
"sphinx.ext.todo",
36+
"sphinx.ext.viewcode",
37+
"sphinx.ext.intersphinx",
3738
]
3839

3940
# Uncomment the below if you use native CircuitPython modules such as
4041
# digitalio, micropython and busio. List the modules you use. Without it, the
4142
# autodoc module docs will fail to generate with a warning.
4243
# autodoc_mock_imports = ["adafruit_bus_device", "adafruit_register"]
4344

44-
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)}
45+
intersphinx_mapping = {
46+
"python": ("https://docs.python.org/3.4", None),
47+
"BusDevice": (
48+
"https://circuitpython.readthedocs.io/projects/busdevice/en/latest/",
49+
None,
50+
),
51+
"Register": (
52+
"https://circuitpython.readthedocs.io/projects/register/en/latest/",
53+
None,
54+
),
55+
"CircuitPython": ("https://circuitpython.readthedocs.io/en/latest/", None),
56+
}
4557

4658
# Add any paths that contain templates here, relative to this directory.
47-
templates_path = ['_templates']
59+
templates_path = ["_templates"]
4860

4961
# The suffix(es) of source filenames.
5062
# You can specify multiple suffix as a list of string:
5163
#
52-
source_suffix = ['.rst', '.md']
64+
source_suffix = [".rst", ".md"]
5365
# source_suffix = '.rst'
5466

5567
# The encoding of source files.
5668
#
5769
# source_encoding = 'utf-8-sig'
5870

5971
# The master toctree document.
60-
master_doc = 'index'
72+
master_doc = "index"
6173

6274
# General information about the project.
63-
project = u'Adafruit\'s DS3231 RTC Library'
64-
copyright = u'2016, Philip Moyer'
65-
author = u'Philip Moyer'
75+
project = u"Adafruit's DS3231 RTC Library"
76+
copyright = u"2016, Philip Moyer"
77+
author = u"Philip Moyer"
6678

6779
# The version info for the project you're documenting, acts as replacement for
6880
# |version| and |release|, also used in various other places throughout the
6981
# built documents.
7082
#
7183
# The short X.Y version.
72-
version = u'1.0'
84+
version = u"1.0"
7385
# The full version, including alpha/beta/rc tags.
74-
release = u'1.0'
86+
release = u"1.0"
7587

7688
# The language for content autogenerated by Sphinx. Refer to documentation
7789
# for a list of supported languages.
@@ -92,7 +104,7 @@
92104
# List of patterns, relative to source directory, that match files and
93105
# directories to ignore when looking for source files.
94106
# This patterns also effect to html_static_path and html_extra_path
95-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.env', 'CODE_OF_CONDUCT.md']
107+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".env", "CODE_OF_CONDUCT.md"]
96108

97109
# The reST default role (used for this markup: `text`) to use for all
98110
# documents.
@@ -114,7 +126,7 @@
114126
# show_authors = False
115127

116128
# The name of the Pygments (syntax highlighting) style to use.
117-
pygments_style = 'sphinx'
129+
pygments_style = "sphinx"
118130

119131
# A list of ignored prefixes for module index sorting.
120132
# modindex_common_prefix = []
@@ -134,18 +146,19 @@
134146
# The theme to use for HTML and HTML Help pages. See the documentation for
135147
# a list of builtin themes.
136148
#
137-
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
149+
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
138150

139151
if not on_rtd: # only import and set the theme if we're building docs locally
140152
try:
141153
import sphinx_rtd_theme
142-
html_theme = 'sphinx_rtd_theme'
143-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), '.']
154+
155+
html_theme = "sphinx_rtd_theme"
156+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path(), "."]
144157
except:
145-
html_theme = 'default'
146-
html_theme_path = ['.']
158+
html_theme = "default"
159+
html_theme_path = ["."]
147160
else:
148-
html_theme_path = ['.']
161+
html_theme_path = ["."]
149162

150163
# Theme options are theme-specific and customize the look and feel of a theme
151164
# further. For a list of options available for each theme, see the
@@ -179,13 +192,13 @@
179192
# Add any paths that contain custom static files (such as style sheets) here,
180193
# relative to this directory. They are copied after the builtin static files,
181194
# so a file named "default.css" will overwrite the builtin "default.css".
182-
html_static_path = ['_static']
195+
html_static_path = ["_static"]
183196

184197
# The name of an image file (relative to this directory) to use as a favicon of
185198
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
186199
# pixels large.
187200
#
188-
html_favicon = '_static/favicon.ico'
201+
html_favicon = "_static/favicon.ico"
189202

190203
# Add any extra paths that contain custom files (such as robots.txt or
191204
# .htaccess) here, relative to this directory. These files are copied
@@ -265,34 +278,36 @@
265278
# html_search_scorer = 'scorer.js'
266279

267280
# Output file base name for HTML help builder.
268-
htmlhelp_basename = 'AdafruitsDS3231RTCLibrarydoc'
281+
htmlhelp_basename = "AdafruitsDS3231RTCLibrarydoc"
269282

270283
# -- Options for LaTeX output ---------------------------------------------
271284

272285
latex_elements = {
273-
# The paper size ('letterpaper' or 'a4paper').
274-
#
275-
# 'papersize': 'letterpaper',
276-
277-
# The font size ('10pt', '11pt' or '12pt').
278-
#
279-
# 'pointsize': '10pt',
280-
281-
# Additional stuff for the LaTeX preamble.
282-
#
283-
# 'preamble': '',
284-
285-
# Latex figure (float) alignment
286-
#
287-
# 'figure_align': 'htbp',
286+
# The paper size ('letterpaper' or 'a4paper').
287+
#
288+
# 'papersize': 'letterpaper',
289+
# The font size ('10pt', '11pt' or '12pt').
290+
#
291+
# 'pointsize': '10pt',
292+
# Additional stuff for the LaTeX preamble.
293+
#
294+
# 'preamble': '',
295+
# Latex figure (float) alignment
296+
#
297+
# 'figure_align': 'htbp',
288298
}
289299

290300
# Grouping the document tree into LaTeX files. List of tuples
291301
# (source start file, target name, title,
292302
# author, documentclass [howto, manual, or own class]).
293303
latex_documents = [
294-
(master_doc, 'AdafruitsDS3231RTCLibrary.tex', u'Adafruit\'s DS3231 RTC Library Documentation',
295-
u'Philip Moyer', 'manual'),
304+
(
305+
master_doc,
306+
"AdafruitsDS3231RTCLibrary.tex",
307+
u"Adafruit's DS3231 RTC Library Documentation",
308+
u"Philip Moyer",
309+
"manual",
310+
),
296311
]
297312

298313
# The name of an image file (relative to this directory) to place at the top of
@@ -333,8 +348,13 @@
333348
# One entry per manual page. List of tuples
334349
# (source start file, name, description, authors, manual section).
335350
man_pages = [
336-
(master_doc, 'adafruitsds3231rtclibrary', u'Adafruit\'s DS3231 RTC Library Documentation',
337-
[author], 1)
351+
(
352+
master_doc,
353+
"adafruitsds3231rtclibrary",
354+
u"Adafruit's DS3231 RTC Library Documentation",
355+
[author],
356+
1,
357+
)
338358
]
339359

340360
# If true, show URL addresses after external links.
@@ -348,9 +368,15 @@
348368
# (source start file, target name, title, author,
349369
# dir menu entry, description, category)
350370
texinfo_documents = [
351-
(master_doc, 'AdafruitsDS3231RTCLibrary', u'Adafruit\'s DS3231 RTC Library Documentation',
352-
author, 'AdafruitsDS3231RTCLibrary', 'One line description of project.',
353-
'Miscellaneous'),
371+
(
372+
master_doc,
373+
"AdafruitsDS3231RTCLibrary",
374+
u"Adafruit's DS3231 RTC Library Documentation",
375+
author,
376+
"AdafruitsDS3231RTCLibrary",
377+
"One line description of project.",
378+
"Miscellaneous",
379+
),
354380
]
355381

356382
# Documents to append as an appendix to all manuals.

examples/ds3231_simpletest.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
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_ds3231
1416

1517

1618
i2c = io.I2C(board.SCL, board.SDA) # Change to the appropriate I2C clock & data
17-
# pins here!
19+
# pins here!
1820

1921
# Create the RTC instance:
2022
rtc = adafruit_ds3231.DS3231(i2c)
@@ -23,23 +25,27 @@
2325
days = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
2426

2527

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

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

0 commit comments

Comments
 (0)