Skip to content

Commit 6af7d61

Browse files
committed
🔧 MAINTAIN: Add isort
1 parent 22a4007 commit 6af7d61

File tree

10 files changed

+21
-13
lines changed

10 files changed

+21
-13
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ repos:
2323
hooks:
2424
- id: check-manifest
2525

26+
- repo: https://github.com/pycqa/isort
27+
rev: 5.8.0
28+
hooks:
29+
- id: isort
30+
2631
- repo: https://github.com/psf/black
2732
rev: 20.8b1
2833
hooks:

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
[build-system]
22
requires = ["setuptools>=46.4.0", "wheel"]
33
build-backend = "setuptools.build_meta"
4+
5+
[tool.isort]
6+
profile = "black"
7+
src_paths = ["sphinx_external_toc", "tests"]

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jb.cmdline =
4545

4646
[options.extras_require]
4747
code_style =
48-
pre-commit==2.6
48+
pre-commit~=2.12
4949
rtd =
5050
myst-parser~=0.13.5
5151
sphinx_book_theme>=0.0.36

sphinx_external_toc/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
def setup(app: "Sphinx") -> dict:
1313
"""Initialize the Sphinx extension."""
1414
from .events import (
15-
add_changed_toctrees,
1615
InsertToctrees,
17-
parse_toc_to_env,
1816
TableofContents,
17+
add_changed_toctrees,
18+
parse_toc_to_env,
1919
)
2020

2121
# variables

sphinx_external_toc/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from typing import Any, Dict, Iterator, List, Optional, Sequence, Set, Tuple, Union
55

66
import attr
7-
from attr.validators import instance_of, deep_iterable, optional
87
import yaml
8+
from attr.validators import deep_iterable, instance_of, optional
99

1010
FILE_KEY = "file"
1111
GLOB_KEY = "glob"

sphinx_external_toc/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import yaml
55

66
from sphinx_external_toc import __version__
7-
from sphinx_external_toc.api import parse_toc_yaml, create_toc_dict
7+
from sphinx_external_toc.api import create_toc_dict, parse_toc_yaml
88
from sphinx_external_toc.tools import create_site_from_toc, create_site_map_from_path
99

1010

sphinx_external_toc/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from sphinx.util.docutils import SphinxDirective
1515
from sphinx.util.matching import Matcher, patfilter, patmatch
1616

17-
from .api import DocItem, GlobItem, FileItem, SiteMap, UrlItem, parse_toc_yaml
17+
from .api import DocItem, FileItem, GlobItem, SiteMap, UrlItem, parse_toc_yaml
1818

1919
logger = logging.getLogger(__name__)
2020

sphinx_external_toc/tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
import re
2+
import shutil
13
from fnmatch import fnmatch
24
from itertools import chain
35
from pathlib import Path, PurePosixPath
4-
import re
5-
import shutil
66
from typing import Mapping, Optional, Sequence, Tuple, Union
77

8-
from .api import parse_toc_yaml, SiteMap, DocItem, TocItem, FileItem
8+
from .api import DocItem, FileItem, SiteMap, TocItem, parse_toc_yaml
99

1010

1111
def create_site_from_toc(

tests/test_cli.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
from pathlib import Path
33
from typing import List
44

5+
import pytest
56
from click.testing import CliRunner
67

7-
from sphinx_external_toc.cli import main, parse_toc, create_toc
88
from sphinx_external_toc import __version__
9-
10-
import pytest
9+
from sphinx_external_toc.cli import create_toc, main, parse_toc
1110

1211

1312
@pytest.fixture()

tests/test_sphinx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from pathlib import Path
33

44
import pytest
5-
from sphinx.testing.util import SphinxTestApp
65
from sphinx.testing.path import path as sphinx_path
6+
from sphinx.testing.util import SphinxTestApp
77

88
from sphinx_external_toc.tools import create_site_from_toc
99

0 commit comments

Comments
 (0)