Skip to content

Commit 3b408f2

Browse files
authored
Add pylint and black. Apply formatting (#364)
* Install pylint and black * Add black config and pylintrc file * Apply black formatting * Add black format to workflow
1 parent 1e69501 commit 3b408f2

28 files changed

+6373
-3083
lines changed

.github/workflows/run-tests.yml

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
run: pytest
3434
- name: Validate poetry file
3535
run: poetry check
36+
- name: Format files
37+
run: black .
3638

3739
test-deb10-i386:
3840
runs-on: ubuntu-latest

docs/conf.py

+33-31
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,19 @@
2020
import os
2121
import sys
2222

23-
sys.path.insert(0, os.path.abspath('..'))
23+
sys.path.insert(0, os.path.abspath(".."))
2424

2525
# For dependencies
2626
from unittest.mock import MagicMock
27+
28+
2729
class Mock(MagicMock):
2830
@classmethod
2931
def __getattr__(cls, name):
30-
return MagicMock()
32+
return MagicMock()
3133

32-
MOCK_MODULES = ['numpy', 'matplotlib', 'matplotlib.pyplot', 'pandas', 'scipy']
34+
35+
MOCK_MODULES = ["numpy", "matplotlib", "matplotlib.pyplot", "pandas", "scipy"]
3336
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
3437

3538
# -- General configuration ------------------------------------------------
@@ -41,26 +44,26 @@ def __getattr__(cls, name):
4144
# Add any Sphinx extension module names here, as strings. They can be
4245
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
4346
# ones.
44-
extensions = ['sphinx.ext.autodoc']
47+
extensions = ["sphinx.ext.autodoc"]
4548

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

4952
# The suffix(es) of source filenames.
5053
# You can specify multiple suffix as a list of string:
5154
#
5255
# source_suffix = ['.rst', '.md']
53-
source_suffix = '.rst'
56+
source_suffix = ".rst"
5457

5558
# The master toctree document.
56-
master_doc = 'index'
59+
master_doc = "index"
5760

5861
# General information about the project.
59-
project = 'wfdb'
60-
copyright = '2018, MIT Lab for Computational Physiology'
61-
author = 'MIT Lab for Computational Physiology'
62+
project = "wfdb"
63+
copyright = "2018, MIT Lab for Computational Physiology"
64+
author = "MIT Lab for Computational Physiology"
6265

63-
with open('../wfdb/version.py') as f:
66+
with open("../wfdb/version.py") as f:
6467
__version__ = f.read().split()[-1].strip("'")
6568
# The version info for the project you're documenting, acts as replacement for
6669
# |version| and |release|, also used in various other places throughout the
@@ -81,10 +84,10 @@ def __getattr__(cls, name):
8184
# List of patterns, relative to source directory, that match files and
8285
# directories to ignore when looking for source files.
8386
# This patterns also effect to html_static_path and html_extra_path
84-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
87+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
8588

8689
# The name of the Pygments (syntax highlighting) style to use.
87-
pygments_style = 'sphinx'
90+
pygments_style = "sphinx"
8891

8992
# If true, `todo` and `todoList` produce output, else they produce nothing.
9093
todo_include_todos = False
@@ -95,7 +98,7 @@ def __getattr__(cls, name):
9598
# The theme to use for HTML and HTML Help pages. See the documentation for
9699
# a list of builtin themes.
97100
#
98-
html_theme = 'classic'
101+
html_theme = "classic"
99102

100103
# Theme options are theme-specific and customize the look and feel of a theme
101104
# further. For a list of options available for each theme, see the
@@ -106,25 +109,25 @@ def __getattr__(cls, name):
106109
# Add any paths that contain custom static files (such as style sheets) here,
107110
# relative to this directory. They are copied after the builtin static files,
108111
# so a file named "default.css" will overwrite the builtin "default.css".
109-
html_static_path = ['_static']
112+
html_static_path = ["_static"]
110113

111114
# Custom sidebar templates, must be a dictionary that maps document names
112115
# to template names.
113116
#
114117
# This is required for the alabaster theme
115118
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
116119
html_sidebars = {
117-
'**': [
118-
'relations.html', # needs 'show_related': True theme option to display
119-
'searchbox.html',
120+
"**": [
121+
"relations.html", # needs 'show_related': True theme option to display
122+
"searchbox.html",
120123
]
121124
}
122125

123126

124127
# -- Options for HTMLHelp output ------------------------------------------
125128

126129
# Output file base name for HTML help builder.
127-
htmlhelp_basename = 'wfdbdoc'
130+
htmlhelp_basename = "wfdbdoc"
128131

129132

130133
# -- Options for LaTeX output ---------------------------------------------
@@ -133,15 +136,12 @@ def __getattr__(cls, name):
133136
# The paper size ('letterpaper' or 'a4paper').
134137
#
135138
# 'papersize': 'letterpaper',
136-
137139
# The font size ('10pt', '11pt' or '12pt').
138140
#
139141
# 'pointsize': '10pt',
140-
141142
# Additional stuff for the LaTeX preamble.
142143
#
143144
# 'preamble': '',
144-
145145
# Latex figure (float) alignment
146146
#
147147
# 'figure_align': 'htbp',
@@ -151,19 +151,15 @@ def __getattr__(cls, name):
151151
# (source start file, target name, title,
152152
# author, documentclass [howto, manual, or own class]).
153153
latex_documents = [
154-
(master_doc, 'wfdb.tex', 'wfdb Documentation',
155-
author, 'manual'),
154+
(master_doc, "wfdb.tex", "wfdb Documentation", author, "manual"),
156155
]
157156

158157

159158
# -- Options for manual page output ---------------------------------------
160159

161160
# One entry per manual page. List of tuples
162161
# (source start file, name, description, authors, manual section).
163-
man_pages = [
164-
(master_doc, 'wfdb', 'wfdb Documentation',
165-
[author], 1)
166-
]
162+
man_pages = [(master_doc, "wfdb", "wfdb Documentation", [author], 1)]
167163

168164

169165
# -- Options for Texinfo output -------------------------------------------
@@ -172,7 +168,13 @@ def __getattr__(cls, name):
172168
# (source start file, target name, title, author,
173169
# dir menu entry, description, category)
174170
texinfo_documents = [
175-
(master_doc, 'wfdb', 'wfdb Documentation',
176-
author, 'wfdb', 'One line description of project.',
177-
'Miscellaneous'),
171+
(
172+
master_doc,
173+
"wfdb",
174+
"wfdb Documentation",
175+
author,
176+
"wfdb",
177+
"One line description of project.",
178+
"Miscellaneous",
179+
),
178180
]

0 commit comments

Comments
 (0)