Skip to content

Commit 1e366f0

Browse files
committed
fixing pre-commits
1 parent 70202cd commit 1e366f0

30 files changed

+53
-69
lines changed

.binder/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
matplotlib
22
numpy
33
folium
4-
pandas
4+
pandas

.circleci/run_notebooks.py

-18
This file was deleted.

.flake8

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[flake8]
2+
max-line-length = 88
3+
ignore=E203,W503

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ dmypy.json
131131
.pyre/
132132

133133
# VSCode config
134-
.vscode
134+
.vscode

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2626
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2727
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2828
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ pip install -e .
1414
```
1515
cd docs
1616
jupyter-book build
17-
```
17+
```

docs/_toc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
- file: customize/index
1212
sections:
13-
- file: customize/toc
13+
- file: customize/toc
1414
- file: customize/faq
1515
- file: customize/advanced
1616

docs/customize/advanced.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ To use it, simply use the following command:
6060
jupyter-book toc path/to/mybook
6161
```
6262

63-
This will treat all `.md` and `.ipynb` files in the root of the
63+
This will treat all `.md` and `.ipynb` files in the root of the
6464
**content folder** as top-level pages, or chapters.
6565
For any files that are in folders, it will create one
6666
section per **top-level folder** and treat all content files inside that

docs/customize/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This page describes the general structure of `_config.yml`, and how
99
you can use it to control some basic parts of your book. The rest of the
1010
pages in this section describe more detail for specific features.
1111

12-
## Structure of `_config.yml`
12+
## Structure of `_config.yml`
1313

1414
Here is a very simple `_config.yml` configuration (it is taken from
1515
{download}`the demo book config file <../../jupyter_book/book_template/_config.yml>`):

docs/intro.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ The primary way to use this tool is via the command line. It provides a
7676
top-level command called `jupyter-book`, and a number of sub-commands.
7777
Run `jupyter-book -h` for more information.
7878

79-
For more information on how to use this tool, see {doc}`start/01_overview`.
79+
For more information on how to use this tool, see {doc}`start/01_overview`.

docs/use/citations.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,36 @@ way.
3232
1. Modify the file in `_bibliography/references.bib`. This has a few sample citations
3333
in bibtex form. Update as you wish!
3434
2. In your content, add the following text to include a citation
35-
35+
3636
```
3737
{cite}`mybibtexcitation`
3838
```
3939

4040
For example, this text
41-
41+
4242
```
4343
{cite}`holdgraf_rapid_2016`
4444
```
45-
45+
4646
generates this citation: {cite}`holdgraf_rapid_2016`
47-
47+
4848
You can also include multiple citations in one go, like so:
49-
49+
5050
```
5151
{cite}`holdgraf_evidence_2014,holdgraf_portable_2017`
5252
```
53-
53+
5454
becomes {cite}`holdgraf_evidence_2014,holdgraf_portable_2017`.
55-
55+
5656
3. Generate a bibliography on your page by using the following text:
5757

5858
````
5959
```{bibliography} path/to/your/bibtexfile.bib
6060
```
6161
````
62-
62+
6363
This will generate a bibliography for your entire bibtex file, like so:
64-
64+
6565
```{bibliography} ../references.bib
6666
```
6767

docs/use/hiding.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ Some hidden toggle content!
7676
You can hide most cell elements of a page. The sections below describe how
7777
to hide each.
7878

79-
If an element is hidden, Jupyter Book will display a small button to the right of the
79+
If an element is hidden, Jupyter Book will display a small button to the right of the
8080
old location for the hidden element. If a user clicks the button,
8181
the element will be displayed.
8282

8383

84-
### Hide cell inputs
84+
### Hide cell inputs
8585

8686
If you add the tag `hide-input` to a cell, then Jupyter Book will hide the cell but
8787
display the outputs.

docs/use/launchbuttons.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,4 +192,4 @@
192192
},
193193
"nbformat": 4,
194194
"nbformat_minor": 4
195-
}
195+
}

docs/use/myst-notebooks.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,5 +181,5 @@ Content in one markdown cell
181181
Content in another markdown cell
182182
```
183183
````
184-
184+
185185
[jupytext]: https://jupytext.readthedocs.io/

docs/use/myst.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ name: my_figure
219219
Here is my figure caption!
220220
```
221221

222-
You can then refer to this figure using the `{ref}` role like:
222+
You can then refer to this figure using the `{ref}` role like:
223223
`` {ref}`my-figure` ``, which will replace the reference with the figure
224224
caption like so: {ref}`my_figure`.
225225
Another convenient way to create cross-references is with the `{numref}` role,

docs/use/notebooks.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"cell_type": "markdown",
150150
"metadata": {},
151151
"source": [
152-
"Note that the image above is captured and displayed by Jekyll."
152+
"Note that the image above is captured and displayed in your site."
153153
]
154154
},
155155
{

examples/single_page.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@
113113
},
114114
"nbformat": 4,
115115
"nbformat_minor": 4
116-
}
116+
}

jupyter_book/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
"""Build an online book using Jupyter Notebooks and Jekyll."""
2-
from pathlib import Path
3-
import os
1+
"""Build a book with Jupyter Notebooks and Sphinx."""
42
from docutils.parsers.rst.directives.body import Sidebar
53
from .toc import update_indexname, add_toctree
64
from .yaml import add_yaml_config

jupyter_book/book_template/_toc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
sections:
44
- file: markdown
55
- file: notebooks
6-
- file: syntax
6+
- file: syntax

jupyter_book/book_template/references.bib

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,4 @@ @book{ruby
5353
author = {Flanagan, David and Matsumoto, Yukihiro},
5454
year = {2008},
5555
publisher = {O'Reilly Media}
56-
}
56+
}

jupyter_book/commands/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
"""Defines the commands that the CLI will use."""
2-
import sys
32
import os.path as op
43
from pathlib import Path
54
import click
65
from glob import glob
76
import shutil as sh
8-
import asyncio
97

108
from ..sphinx import build_sphinx
119
from ..toc import build_toc
@@ -37,8 +35,9 @@ def build(path_book, path_output, config, toc, build):
3735
book_config = {}
3836
build_dict = {"html": "html", "pdf_html": "singlehtml"}
3937
if build not in build_dict.keys():
38+
allowed_keys = tuple(build_dict.keys())
4039
raise ValueError(
41-
f"Value for --build must be one of {tuple(build_dict.keys())}. Got '{build}'"
40+
f"Value for --build must be one of {allowed_keys}. Got '{build}'"
4241
)
4342
builder = build_dict[build]
4443

@@ -48,7 +47,8 @@ def build(path_book, path_output, config, toc, build):
4847
toc = PATH_BOOK.joinpath("_toc.yml")
4948
else:
5049
raise ValueError(
51-
f"Couldn't find a Table of Contents file. To auto-generate one, run\n\n\tjupyter-book build {path_book}"
50+
f"Couldn't find a Table of Contents file. To auto-generate"
51+
"one, run\n\n\tjupyter-book build {path_book}"
5252
)
5353
book_config["globaltoc_path"] = str(toc)
5454

jupyter_book/sphinx.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"""
1414

1515
ROOT = Path(__file__)
16-
# Some configuration values that don't make sense to be in `default_config.yml` because they are sphinx-specific
16+
# Some configuration values that are really sphinx-specific
1717
DEFAULT_CONFIG = dict(
1818
extensions=[
1919
"sphinx_togglebutton",
@@ -30,7 +30,9 @@
3030
html_theme="sphinx_book_theme",
3131
html_theme_options={
3232
"single_page": False,
33-
"sidebar_footer_text": "Powered by <a href='https://jupyterbook.org'>Jupyter Book</a>",
33+
"sidebar_footer_text": (
34+
"Powered by <a href='https://jupyterbook.org'>Jupyter Book</a>"
35+
),
3436
},
3537
html_add_permalinks="¶",
3638
numfig=True,
@@ -150,11 +152,15 @@ def debug_args():
150152
path_toc = Path(config["globaltoc_path"])
151153
if not path_toc.exists():
152154
raise ValueError(
153-
f"You gave a Configuration file path that doesn't exist: {path_toc}"
155+
(
156+
f"You gave a Configuration file path"
157+
"that doesn't exist: {path_toc}"
158+
)
154159
)
155160
if path_toc.suffix not in [".yml", ".yaml"]:
156161
raise ValueError(
157-
f"You gave a Configuration file path that is not a YAML file: {path_toc}"
162+
f"You gave a Configuration file path"
163+
"that is not a YAML file: {path_toc}"
158164
)
159165
else:
160166
path_toc = None
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Content 2
1+
# Content 2
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# A subpage
1+
# A subpage
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# Subfolder index
1+
# Subfolder index

jupyter_book/tests/test_build.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import os
21
from pathlib import Path
32
from subprocess import run
4-
import jupyter_book as jb
53

64

75
path_tests = Path(__file__).parent

jupyter_book/tests/test_toc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def test_toc():
88
path_book = Path(__file__).parent.joinpath("books", "toc")
99
toc_yaml = build_toc(path_book)
10-
toc_dict = yaml.safe_load(toc_yaml)
10+
_ = yaml.safe_load(toc_yaml)
1111

1212
# Folder with no content should return none
1313
with pytest.raises(ValueError):

jupyter_book/toc.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ def add_toctree(app, docname, source):
4949
parent_suff = Path(path_parent).suffix
5050
# If we didn't find this page in the TOC, raise a warning
5151
if parent_page is None:
52-
logger.warning(
53-
f"Found a content page that is not in Table of Contents: {path_parent}."
54-
)
52+
logger.warning(f"Found a content page that is not in _toc.yml: {path_parent}.")
5553
return
5654

5755
# If we have no sections, then don't worry about a toctree
@@ -91,7 +89,7 @@ def gen_toctree(options, subsections):
9189
)
9290
return toctree
9391

94-
# Build toctrees for the page. We may need more than one depending on the options
92+
# Build toctrees for the page. We may need more than one
9593
toctrees = []
9694
toc_sections = []
9795
toc_options = []
@@ -126,7 +124,7 @@ def gen_toctree(options, subsections):
126124
if parent_page.get(option):
127125
toc_options.append(f":{option}:")
128126

129-
# Now create the final toctree for this page and prep them to insert into the page
127+
# Now create the final toctree for this page and prep to insert into page
130128
if toc_sections:
131129
final_toctree = gen_toctree(toc_options, toc_sections)
132130
toctrees.append(final_toctree)
@@ -245,7 +243,7 @@ def build_toc(path, filename_split_char="_", skip_text=None):
245243
* All subsequent files are sections of the parent page
246244
* For each sub-folder
247245
* Its first page is appended to sections of the parent page
248-
* All other sub-folder are children of the subfolder's first page
246+
* All other sub-folder are children of the subfolder's first page
249247
250248
Parameters
251249
----------

jupyter_book/yaml.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def add_yaml_config(app):
2222
path_yaml = Path(path_yaml)
2323
if not path_yaml.exists():
2424
raise ValueError(
25-
f"Path to a YAML configuration file was given, but not found: {path_yaml}"
25+
f"Path to a _config.yml file was given, but not found: {path_yaml}"
2626
)
2727

2828
# Load the YAML and update its values to translate it into Sphinx keys

scripts/clear_doc_outputs.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import nbformat as nbf
2-
from subprocess import run
32
from glob import glob
43
from nbconvert.exporters import NotebookExporter
54
from traitlets.config import Config

0 commit comments

Comments
 (0)