Skip to content

Commit 3ef988a

Browse files
pre-commit linting (#248)
1 parent 3d2b16d commit 3ef988a

19 files changed

Lines changed: 1659 additions & 1488 deletions

.github/workflows/lint.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-python@v2
12+
with:
13+
python-version: 3.x
14+
- name: Lint
15+
uses: pre-commit/action@v2.0.0
16+
with:
17+
extra_args: --all-files --show-diff-on-failure

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.5.0
4+
hooks:
5+
- id: check-yaml
6+
- id: end-of-file-fixer
7+
- id: trailing-whitespace
8+
- repo: https://github.com/astral-sh/ruff-pre-commit
9+
# Ruff version.
10+
rev: v0.3.4
11+
hooks:
12+
# Run the linter.
13+
- id: ruff
14+
types_or: [ python, pyi, jupyter ]
15+
args: [ --fix ]
16+
# Run the formatter.
17+
- id: ruff-format
18+
types_or: [ python, pyi, jupyter ]

00_prepare_for_PyPI.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# Fail the script at the first failed command (HOWEVER, maybe when there are
99
# no commits to be done during the merges, the commands fail?):
10-
#set -e
10+
#set -e
1111

1212
echo "****************************************************************"
1313
echo "WARNING: if any commit fails, RESOLVE IT before running this"

doc/conf.py

Lines changed: 57 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,93 +13,94 @@
1313

1414
from datetime import date
1515

16-
import sys, os
16+
import sys
17+
import os
1718

18-
sys.path.insert(0, os.path.abspath('..'))
19+
sys.path.insert(0, os.path.abspath(".."))
1920
import uncertainties
2021

2122
# If extensions (or modules to document with autodoc) are in another directory,
2223
# add these directories to sys.path here. If the directory is relative to the
2324
# documentation root, use os.path.abspath to make it absolute, like shown here.
24-
#sys.path.append(os.path.abspath('.'))
25+
# sys.path.append(os.path.abspath('.'))
2526

2627
# -- General configuration -----------------------------------------------------
2728

2829
# Add any Sphinx extension module names here, as strings. They can be extensions
2930
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
30-
extensions = ['sphinx.ext.autodoc', 'sphinx_copybutton']
31+
extensions = ["sphinx.ext.autodoc", "sphinx_copybutton"]
3132

3233
# Add any paths that contain templates here, relative to this directory.
33-
templates_path = ['_templates']
34+
templates_path = ["_templates"]
3435

3536
# The suffix of source filenames.
36-
source_suffix = '.rst'
37+
source_suffix = ".rst"
3738

3839
# The encoding of source files.
39-
#source_encoding = 'utf-8'
40+
# source_encoding = 'utf-8'
4041

4142
# The master toctree document.
42-
master_doc = 'index'
43+
master_doc = "index"
4344

4445
# General information about the project.
45-
project = u'uncertainties'
46-
copyright = f'2010–{date.today().year}, Eric O. LEBIGOT (EOL)'
46+
project = "uncertainties"
47+
copyright = f"2010–{date.today().year}, Eric O. LEBIGOT (EOL)"
4748

4849
# The version info for the project you're documenting, acts as replacement for
4950
# |version| and |release|, also used in various other places throughout the
5051
# built documents.
5152
#
5253
# The short X.Y version.
53-
version = '1'
54+
version = "1"
5455
# The full version, including alpha/beta/rc tags.
5556
release = uncertainties.__version__
5657

5758
# The language for content autogenerated by Sphinx. Refer to documentation
5859
# for a list of supported languages.
59-
#language = None
60+
# language = None
6061

6162
# There are two options for replacing |today|: either, you set today to some
6263
# non-false value, then it is used:
63-
#today = ''
64+
# today = ''
6465
# Else, today_fmt is used as the format for a strftime call.
65-
#today_fmt = '%B %d, %Y'
66+
# today_fmt = '%B %d, %Y'
6667

6768
# List of documents that shouldn't be included in the build.
68-
#unused_docs = []
69+
# unused_docs = []
6970

7071
# List of directories, relative to source directory, that shouldn't be searched
7172
# for source files.
72-
exclude_trees = ['_build']
73+
exclude_trees = ["_build"]
7374

7475
# The reST default role (used for this markup: `text`) to use for all documents.
75-
#default_role = None
76+
# default_role = None
7677

7778
# If true, '()' will be appended to :func: etc. cross-reference text.
78-
#add_function_parentheses = True
79+
# add_function_parentheses = True
7980

8081
# If true, the current module name will be prepended to all description
8182
# unit titles (such as .. function::).
82-
#add_module_names = True
83+
# add_module_names = True
8384

8485
# If true, sectionauthor and moduleauthor directives will be shown in the
8586
# output. They are ignored by default.
86-
#show_authors = False
87+
# show_authors = False
8788

8889
# The name of the Pygments (syntax highlighting) style to use.
89-
pygments_style = 'sphinx'
90+
pygments_style = "sphinx"
9091

9192
# A list of ignored prefixes for module index sorting.
92-
#modindex_common_prefix = []
93+
# modindex_common_prefix = []
9394

9495

9596
# -- Options for HTML output ---------------------------------------------------
9697

9798
# The theme to use for HTML and HTML Help pages. Major themes that come with
9899
# Sphinx are currently 'default' and 'sphinxdoc'.
99100
# html_theme = 'sphinxdoc'
100-
html_theme = 'bizstyle'
101+
html_theme = "bizstyle"
101102
# html_theme = 'cloud'
102-
html_theme = 'python_docs_theme'
103+
html_theme = "python_docs_theme"
103104
# html_theme = "pydata_sphinx_theme"
104105

105106
# Theme options are theme-specific and customize the look and feel of a theme
@@ -108,105 +109,110 @@
108109
# html_theme_options = {}
109110

110111
# Add any paths that contain custom themes here, relative to this directory.
111-
#html_theme_path = []
112+
# html_theme_path = []
112113

113114
# The name for this set of Sphinx documents. If None, it defaults to
114115
# "<project> v<release> documentation".
115116
html_title = "uncertainties"
116117

117118
# A shorter title for the navigation bar. Default is the same as html_title.
118-
#html_short_title = None
119+
# html_short_title = None
119120

120121
# The name of an image file (relative to this directory) to place at the top
121122
# of the sidebar.
122-
#html_logo = None
123+
# html_logo = None
123124

124125
# The name of an image file (within the static path) to use as favicon of the
125126
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
126127
# pixels large.
127-
html_favicon = '_static/favicon.ico'
128+
html_favicon = "_static/favicon.ico"
128129

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

134135
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
135136
# using the given strftime format.
136-
#html_last_updated_fmt = '%b %d, %Y'
137+
# html_last_updated_fmt = '%b %d, %Y'
137138

138139
# If true, SmartyPants will be used to convert quotes and dashes to
139140
# typographically correct entities.
140-
#html_use_smartypants = True
141+
# html_use_smartypants = True
141142

142143
# Custom sidebar templates, maps document names to template names.
143-
html_sidebars = {'index': ['indexsidebar.html', 'searchbox.html', 'globaltoc.html']}
144+
html_sidebars = {"index": ["indexsidebar.html", "searchbox.html", "globaltoc.html"]}
144145

145146
# Additional templates that should be rendered to pages, maps page names to
146147
# template names.
147-
#html_additional_pages = {}
148+
# html_additional_pages = {}
148149

149150
# If false, no module index is generated.
150-
#html_use_modindex = True
151+
# html_use_modindex = True
151152

152153
# If false, no index is generated.
153-
#html_use_index = True
154+
# html_use_index = True
154155

155156
# If true, the index is split into individual pages for each letter.
156-
#html_split_index = False
157+
# html_split_index = False
157158

158159
# If true, links to the reST sources are added to the pages.
159160
html_show_sourcelink = False
160161

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

166167
# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
167-
#html_file_suffix = ''
168+
# html_file_suffix = ''
168169

169170
# Output file base name for HTML help builder.
170-
htmlhelp_basename = 'uncertainties'
171+
htmlhelp_basename = "uncertainties"
171172

172173

173174
# -- Options for LaTeX output --------------------------------------------------
174175

175176
# The paper size ('letter' or 'a4').
176-
#latex_paper_size = 'letter'
177+
# latex_paper_size = 'letter'
177178

178179
# The font size ('10pt', '11pt' or '12pt').
179-
#latex_font_size = '10pt'
180+
# latex_font_size = '10pt'
180181

181182
# Grouping the document tree into LaTeX files. List of tuples
182183
# (source start file, target name, title, author, documentclass [howto/manual]).
183184
latex_documents = [
184-
('index', 'uncertainties.tex', u'uncertainties Python package Documentation',
185-
u'Eric O. LEBIGOT (EOL)', 'manual'),
185+
(
186+
"index",
187+
"uncertainties.tex",
188+
"uncertainties Python package Documentation",
189+
"Eric O. LEBIGOT (EOL)",
190+
"manual",
191+
),
186192
]
187193

188-
#latex_engine = "xelatex" # Not recognized by readthedocs.io as of 2018-04-08
194+
# latex_engine = "xelatex" # Not recognized by readthedocs.io as of 2018-04-08
189195

190196
# The name of an image file (relative to this directory) to place at the top of
191197
# the title page.
192-
#latex_logo = None
198+
# latex_logo = None
193199

194200
# For "manual" documents, if this is true, then toplevel headings are parts,
195201
# not chapters.
196-
#latex_use_parts = False
202+
# latex_use_parts = False
197203

198204
# Additional stuff for the LaTeX preamble.
199-
#latex_preamble = r'\DeclareUnicodeCharacter{207B}{$^-$}'
205+
# latex_preamble = r'\DeclareUnicodeCharacter{207B}{$^-$}'
200206
latex_elements = {
201207
# Superscript -, etc. for pdflatex (unnecessary, with xelatex):
202-
'preamble': r'''
208+
"preamble": r"""
203209
\DeclareUnicodeCharacter{207B}{$^-$}
204210
\DeclareUnicodeCharacter{22C5}{$\cdot$}
205-
'''
211+
"""
206212
}
207213

208214
# Documents to append as an appendix to all manuals.
209-
#latex_appendices = []
215+
# latex_appendices = []
210216

211217
# If false, no module index is generated.
212-
#latex_use_modindex = True
218+
# latex_use_modindex = True

0 commit comments

Comments
 (0)