Skip to content

Commit 9b9f621

Browse files
authored
Sort imports using isort (#491)
* Sort imports using `isort` * Couple of extras * Even more * Ok
1 parent 415de38 commit 9b9f621

File tree

15 files changed

+182
-100
lines changed

15 files changed

+182
-100
lines changed

.prospector.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ test-warnings: true
55
doc-warnings: false
66

77
ignore-paths:
8+
- .git
9+
- .hg
810
- .cache
911
- .mypy_cache
1012
- .pytest_cache
1113
- .tox
1214
- build
1315
- dist
16+
- docs
17+
- htmlcov
18+
- junit
19+
- pip-wheel-metadata
1420
- lispcore.py
1521
- tests
1622

Makefile

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

2020
.PHONY: format
2121
format:
22-
@pipenv run black .
22+
@pipenv run sh -c 'isort -rc . && black .'
2323

2424

2525
lispcore.py:

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ sphinx-rtd-theme = "*"
1313
tox = "*"
1414
tox-pyenv = "*"
1515
twine = "*"
16+
isort = "*"
1617

1718
[packages]
1819
astor = "*"

Pipfile.lock

Lines changed: 127 additions & 84 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,35 @@ exclude = '''
1515
| buck-out
1616
| build
1717
| dist
18+
| docs
19+
| htmlcov
20+
| junit
21+
| pip-wheel-metadata
1822
)/
19-
'''
23+
'''
24+
25+
[tool.isort]
26+
known_first_party = 'basilisp'
27+
multi_line_output = 3
28+
include_trailing_comma = true
29+
force_grid_wrap = 0
30+
use_parentheses = true
31+
line_length = 88
32+
combine_as_imports = true
33+
skip = [
34+
'.env',
35+
'.hg',
36+
'.git',
37+
'.mypy_cache',
38+
'.pytest_cache',
39+
'.tox',
40+
'.venv',
41+
'buck-out',
42+
'build',
43+
'dist',
44+
'docs',
45+
'lispcore.py',
46+
'htmlcov',
47+
'junit',
48+
'pip-wheel-metadata',
49+
]

src/basilisp/_pyast.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
Is,
5656
IsNot,
5757
JoinedStr,
58-
LShift,
5958
Lambda,
6059
List,
6160
ListComp,
6261
Load,
62+
LShift,
6363
Lt,
6464
LtE,
6565
MatMult,
@@ -79,9 +79,9 @@
7979
Param,
8080
Pass,
8181
Pow,
82-
RShift,
8382
Raise,
8483
Return,
84+
RShift,
8585
Set,
8686
SetComp,
8787
Slice,
@@ -94,8 +94,8 @@
9494
Try,
9595
Tuple,
9696
UAdd,
97-
USub,
9897
UnaryOp,
98+
USub,
9999
While,
100100
With,
101101
Yield,

src/basilisp/importer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def get_filename(self, fullname: str) -> str: # pragma: no cover
219219
return spec.loader_state.filename
220220

221221
def create_module(self, spec: ModuleSpec):
222-
logger.debug(f"Creating Basilisp module '{spec.name}''")
222+
logger.debug(f"Creating Basilisp module '{spec.name}'")
223223
mod = BasilispModule(spec.name)
224224
mod.__file__ = spec.loader_state["filename"]
225225
mod.__loader__ = spec.loader

src/basilisp/lang/compiler/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
import basilisp._pyast as ast
99
import basilisp.lang.runtime as runtime
1010
from basilisp.lang.compiler.analyzer import ( # noqa
11-
AnalyzerContext,
1211
WARN_ON_SHADOWED_NAME,
1312
WARN_ON_SHADOWED_VAR,
1413
WARN_ON_UNUSED_NAMES,
14+
AnalyzerContext,
1515
analyze_form,
1616
macroexpand,
1717
macroexpand_1,
1818
)
1919
from basilisp.lang.compiler.exception import CompilerException, CompilerPhase # noqa
2020
from basilisp.lang.compiler.generator import ( # noqa
21-
GeneratedPyAST,
22-
GeneratorContext,
2321
USE_VAR_INDIRECTION,
2422
WARN_ON_VAR_INDIRECTION,
23+
GeneratedPyAST,
24+
GeneratorContext,
2525
expressionize as _expressionize,
2626
gen_py_ast,
2727
py_module_preamble,

src/basilisp/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import contextlib
22
import time
3-
from typing import Optional, Callable, TypeVar, Generic
3+
from typing import Callable, Generic, Optional, TypeVar
44

55
from functional import seq
66
from functional.pipeline import Sequence

tests/basilisp/core_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def setup_module():
3030
runtime.print_generated_python = orig
3131

3232

33-
import basilisp.core as core
33+
import basilisp.core as core # isort:skip
3434

3535
TRUTHY_VALUES = [
3636
True,

0 commit comments

Comments
 (0)