Skip to content

Commit fcead9a

Browse files
committed
Enforce sorting of imports
1 parent 92ed36d commit fcead9a

File tree

7 files changed

+20
-15
lines changed

7 files changed

+20
-15
lines changed

.github/workflows/codeqa-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ jobs:
1919
path: ~/.cache/pip
2020
key: pip-lint
2121
- name: Install dependencies
22-
run: pip install flake8
22+
run: pip install flake8 isort
2323
- name: Run flake8
2424
run: flake8 sphinx_autodoc_typehints.py tests
25+
- name: Run isort
26+
run: isort -c sphinx_autodoc_typehints.py tests
2527

2628
test:
2729
needs: [lint]

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,11 @@ requires = [
55
"wheel >= 0.29.0",
66
]
77
build-backend = 'setuptools.build_meta'
8+
9+
[tool.isort]
10+
skip_gitignore = true
11+
line_length = 99
12+
multi_line_output = 4
13+
14+
[tool.autopep8]
15+
max_line_length = 99

setup.cfg

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,3 @@ type_comments =
4040

4141
[flake8]
4242
max-line-length = 99
43-
44-
[tool:pytest]
45-
addopts = -rsx --tb=short
46-
testpaths = tests

sphinx_autodoc_typehints.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import textwrap
44
import typing
5-
from typing import get_type_hints, TypeVar, Any, AnyStr, Tuple
5+
from typing import Any, AnyStr, Tuple, TypeVar, get_type_hints
66

77
from sphinx.util import logging
88
from sphinx.util.inspect import signature as Signature
@@ -425,7 +425,7 @@ def process_docstring(app, what, name, obj, options, lines):
425425
formatted_annotation = format_annotation(
426426
type_hints['return'], fully_qualified=app.config.typehints_fully_qualified,
427427
simplify_optional_unions=app.config.simplify_optional_unions
428-
)
428+
)
429429

430430
insert_index = len(lines)
431431
for i, line in enumerate(lines):

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import os
2-
import re
3-
import sys
42
import pathlib
3+
import re
54
import shutil
5+
import sys
66

77
import pytest
88
from sphinx.testing.path import path

tests/roots/test-dummy/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pathlib
22
import sys
33

4-
54
# Make dummy_module.py available for autodoc.
65
sys.path.insert(0, str(pathlib.Path(__file__).parent))
76

@@ -12,4 +11,4 @@
1211
'sphinx.ext.autodoc',
1312
'sphinx.ext.napoleon',
1413
'sphinx_autodoc_typehints',
15-
]
14+
]

tests/test_sphinx_autodoc_typehints.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
import textwrap
55
import typing
66
from typing import (
7-
Any, AnyStr, Callable, Dict, Generic, Mapping, NewType, Optional, Pattern, Match, Tuple,
8-
TypeVar, Union, Type)
7+
Any, AnyStr, Callable, Dict, Generic, Mapping, Match, NewType, Optional, Pattern, Tuple, Type,
8+
TypeVar, Union)
99

1010
import pytest
1111
import typing_extensions
1212

1313
from sphinx_autodoc_typehints import (
14-
format_annotation, process_docstring, get_annotation_module, get_annotation_class_name,
15-
get_annotation_args)
14+
format_annotation, get_annotation_args, get_annotation_class_name, get_annotation_module,
15+
process_docstring)
1616

1717
try:
1818
from typing import IO

0 commit comments

Comments
 (0)