Skip to content

Commit 935451d

Browse files
authored
Minor Python 2 to Python 3 changes (#387)
* Remove redundant default * Use set/dict comprehension instead of constructing lists * UTF-8 is the default as of Python 3 * Remove redundant parenthesis * Construct set directly instead of converting lists * Use f-strings * `black`
1 parent 88f69c8 commit 935451d

29 files changed

+144
-140
lines changed

docs/conf.py

+83-75
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
#
32
# mir_eval documentation build configuration file, created by
43
# sphinx-quickstart on Thu May 8 15:55:45 2014.
@@ -14,230 +13,233 @@
1413

1514
import sys
1615
import os
17-
sys.path.insert(0, os.path.abspath('..'))
16+
17+
sys.path.insert(0, os.path.abspath(".."))
1818

1919

2020
# If extensions (or modules to document with autodoc) are in another directory,
2121
# add these directories to sys.path here. If the directory is relative to the
2222
# documentation root, use os.path.abspath to make it absolute, like shown here.
23-
#sys.path.insert(0, os.path.abspath('.'))
23+
# sys.path.insert(0, os.path.abspath('.'))
2424

2525
# -- General configuration ------------------------------------------------
2626

2727
# If your documentation needs a minimal Sphinx version, state it here.
28-
#needs_sphinx = '1.0'
28+
# needs_sphinx = '1.0'
2929

3030
# Add any Sphinx extension module names here, as strings. They can be
3131
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3232
# ones.
3333
extensions = [
34-
'sphinx.ext.autodoc',
35-
'sphinx.ext.imgmath',
36-
'numpydoc',
34+
"sphinx.ext.autodoc",
35+
"sphinx.ext.imgmath",
36+
"numpydoc",
3737
]
3838

3939
# Add any paths that contain templates here, relative to this directory.
40-
templates_path = ['_templates']
40+
templates_path = ["_templates"]
4141

4242
# The suffix of source filenames.
43-
source_suffix = '.rst'
43+
source_suffix = ".rst"
4444

4545
# The encoding of source files.
46-
#source_encoding = 'utf-8-sig'
46+
# source_encoding = 'utf-8-sig'
4747

4848
# The master toctree document.
49-
master_doc = 'index'
49+
master_doc = "index"
5050

5151
# General information about the project.
52-
project = 'mir_eval'
53-
copyright = '2014, Colin Raffel et al.'
52+
project = "mir_eval"
53+
copyright = "2014, Colin Raffel et al."
5454

5555
# The version info for the project you're documenting, acts as replacement for
5656
# |version| and |release|, also used in various other places throughout the
5757
# built documents.
5858
#
5959
# The short X.Y version.
60-
version = '0.7'
60+
version = "0.7"
6161
# The full version, including alpha/beta/rc tags.
62-
release = '0.7'
62+
release = "0.7"
6363

6464
# The language for content autogenerated by Sphinx. Refer to documentation
6565
# for a list of supported languages.
66-
#language = None
66+
# language = None
6767

6868
# There are two options for replacing |today|: either, you set today to some
6969
# non-false value, then it is used:
70-
#today = ''
70+
# today = ''
7171
# Else, today_fmt is used as the format for a strftime call.
72-
#today_fmt = '%B %d, %Y'
72+
# today_fmt = '%B %d, %Y'
7373

7474
# List of patterns, relative to source directory, that match files and
7575
# directories to ignore when looking for source files.
76-
exclude_patterns = ['_build']
76+
exclude_patterns = ["_build"]
7777

7878
# The reST default role (used for this markup: `text`) to use for all
7979
# documents.
80-
#default_role = None
80+
# default_role = None
8181

8282
# If true, '()' will be appended to :func: etc. cross-reference text.
83-
#add_function_parentheses = True
83+
# add_function_parentheses = True
8484

8585
# If true, the current module name will be prepended to all description
8686
# unit titles (such as .. function::).
87-
#add_module_names = True
87+
# add_module_names = True
8888

8989
# If true, sectionauthor and moduleauthor directives will be shown in the
9090
# output. They are ignored by default.
91-
#show_authors = False
91+
# show_authors = False
9292

9393
# The name of the Pygments (syntax highlighting) style to use.
94-
pygments_style = 'sphinx'
94+
pygments_style = "sphinx"
9595

9696
# A list of ignored prefixes for module index sorting.
97-
#modindex_common_prefix = []
97+
# modindex_common_prefix = []
9898

9999
# If true, keep warnings as "system message" paragraphs in the built documents.
100-
#keep_warnings = False
100+
# keep_warnings = False
101101

102102

103103
# -- Options for HTML output ----------------------------------------------
104104

105105
# The theme to use for HTML and HTML Help pages. See the documentation for
106106
# a list of builtin themes.
107-
html_theme = 'default'
107+
html_theme = "default"
108108

109109
# Theme options are theme-specific and customize the look and feel of a theme
110110
# further. For a list of options available for each theme, see the
111111
# documentation.
112-
#html_theme_options = {}
112+
# html_theme_options = {}
113113

114114
# Add any paths that contain custom themes here, relative to this directory.
115-
#html_theme_path = []
115+
# html_theme_path = []
116116

117117
# The name for this set of Sphinx documents. If None, it defaults to
118118
# "<project> v<release> documentation".
119-
#html_title = None
119+
# html_title = None
120120

121121
# A shorter title for the navigation bar. Default is the same as html_title.
122-
#html_short_title = None
122+
# html_short_title = None
123123

124124
# The name of an image file (relative to this directory) to place at the top
125125
# of the sidebar.
126-
#html_logo = None
126+
# html_logo = None
127127

128128
# The name of an image file (within the static path) to use as favicon of the
129129
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
130130
# pixels large.
131-
#html_favicon = None
131+
# html_favicon = None
132132

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

138138
# Add any extra paths that contain custom files (such as robots.txt or
139139
# .htaccess) here, relative to this directory. These files are copied
140140
# directly to the root of the documentation.
141-
#html_extra_path = []
141+
# html_extra_path = []
142142

143143
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
144144
# using the given strftime format.
145-
#html_last_updated_fmt = '%b %d, %Y'
145+
# html_last_updated_fmt = '%b %d, %Y'
146146

147147
# If true, SmartyPants will be used to convert quotes and dashes to
148148
# typographically correct entities.
149-
#html_use_smartypants = True
149+
# html_use_smartypants = True
150150

151151
# Custom sidebar templates, maps document names to template names.
152-
#html_sidebars = {}
152+
# html_sidebars = {}
153153

154154
# Additional templates that should be rendered to pages, maps page names to
155155
# template names.
156-
#html_additional_pages = {}
156+
# html_additional_pages = {}
157157

158158
# If false, no module index is generated.
159-
#html_domain_indices = True
159+
# html_domain_indices = True
160160

161161
# If false, no index is generated.
162-
#html_use_index = True
162+
# html_use_index = True
163163

164164
# If true, the index is split into individual pages for each letter.
165-
#html_split_index = False
165+
# html_split_index = False
166166

167167
# If true, links to the reST sources are added to the pages.
168-
#html_show_sourcelink = True
168+
# html_show_sourcelink = True
169169

170170
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
171-
#html_show_sphinx = True
171+
# html_show_sphinx = True
172172

173173
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
174-
#html_show_copyright = True
174+
# html_show_copyright = True
175175

176176
# If true, an OpenSearch description file will be output, and all pages will
177177
# contain a <link> tag referring to it. The value of this option must be the
178178
# base URL from which the finished HTML is served.
179-
#html_use_opensearch = ''
179+
# html_use_opensearch = ''
180180

181181
# This is the file name suffix for HTML files (e.g. ".xhtml").
182-
#html_file_suffix = None
182+
# html_file_suffix = None
183183

184184
# Output file base name for HTML help builder.
185-
htmlhelp_basename = 'mir_evaldoc'
185+
htmlhelp_basename = "mir_evaldoc"
186186

187187

188188
# -- Options for LaTeX output ---------------------------------------------
189189

190190
latex_elements = {
191-
# The paper size ('letterpaper' or 'a4paper').
192-
#'papersize': 'letterpaper',
193-
194-
# The font size ('10pt', '11pt' or '12pt').
195-
#'pointsize': '10pt',
196-
197-
# Additional stuff for the LaTeX preamble.
198-
#'preamble': '',
191+
# The paper size ('letterpaper' or 'a4paper').
192+
#'papersize': 'letterpaper',
193+
# The font size ('10pt', '11pt' or '12pt').
194+
#'pointsize': '10pt',
195+
# Additional stuff for the LaTeX preamble.
196+
#'preamble': '',
199197
}
200198

201199
# Grouping the document tree into LaTeX files. List of tuples
202200
# (source start file, target name, title,
203201
# author, documentclass [howto, manual, or own class]).
204202
latex_documents = [
205-
('index', 'mir_eval.tex', 'mir\\_eval Documentation',
206-
'Colin Raffel et al.', 'manual'),
203+
(
204+
"index",
205+
"mir_eval.tex",
206+
"mir\\_eval Documentation",
207+
"Colin Raffel et al.",
208+
"manual",
209+
),
207210
]
208211

209212
# The name of an image file (relative to this directory) to place at the top of
210213
# the title page.
211-
#latex_logo = None
214+
# latex_logo = None
212215

213216
# For "manual" documents, if this is true, then toplevel headings are parts,
214217
# not chapters.
215-
#latex_use_parts = False
218+
# latex_use_parts = False
216219

217220
# If true, show page references after internal links.
218-
#latex_show_pagerefs = False
221+
# latex_show_pagerefs = False
219222

220223
# If true, show URL addresses after external links.
221-
#latex_show_urls = False
224+
# latex_show_urls = False
222225

223226
# Documents to append as an appendix to all manuals.
224-
#latex_appendices = []
227+
# latex_appendices = []
225228

226229
# If false, no module index is generated.
227-
#latex_domain_indices = True
230+
# latex_domain_indices = True
228231

229232

230233
# -- Options for manual page output ---------------------------------------
231234

232235
# One entry per manual page. List of tuples
233236
# (source start file, name, description, authors, manual section).
234237
man_pages = [
235-
('index', 'mir_eval', 'mir_eval Documentation',
236-
['Colin Raffel et al.'], 1)
238+
("index", "mir_eval", "mir_eval Documentation", ["Colin Raffel et al."], 1)
237239
]
238240

239241
# If true, show URL addresses after external links.
240-
#man_show_urls = False
242+
# man_show_urls = False
241243

242244

243245
# -- Options for Texinfo output -------------------------------------------
@@ -246,21 +248,27 @@
246248
# (source start file, target name, title, author,
247249
# dir menu entry, description, category)
248250
texinfo_documents = [
249-
('index', 'mir_eval', 'mir_eval Documentation',
250-
'Colin Raffel et al.', 'mir_eval', 'One line description of project.',
251-
'Miscellaneous'),
251+
(
252+
"index",
253+
"mir_eval",
254+
"mir_eval Documentation",
255+
"Colin Raffel et al.",
256+
"mir_eval",
257+
"One line description of project.",
258+
"Miscellaneous",
259+
),
252260
]
253261

254262
# Documents to append as an appendix to all manuals.
255-
#texinfo_appendices = []
263+
# texinfo_appendices = []
256264

257265
# If false, no module index is generated.
258-
#texinfo_domain_indices = True
266+
# texinfo_domain_indices = True
259267

260268
# How to display URL addresses: 'footnote', 'no', or 'inline'.
261-
#texinfo_show_urls = 'footnote'
269+
# texinfo_show_urls = 'footnote'
262270

263271
# If true, do not generate a @detailmenu in the "Top" node's menu.
264-
#texinfo_no_detailmenu = False
272+
# texinfo_no_detailmenu = False
265273

266-
autodoc_member_order = 'bysource'
274+
autodoc_member_order = "bysource"

0 commit comments

Comments
 (0)