🌐 AI搜索 & 代理 主页
Skip to content

Commit f4491a9

Browse files
refactor: enable isort
1 parent 43f32dc commit f4491a9

27 files changed

+75
-60
lines changed

afterpython/_io/toml.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from __future__ import annotations
2+
23
from typing import TYPE_CHECKING
34

45
if TYPE_CHECKING:
5-
from tomlkit.toml_document import TOMLDocument
66
from pathlib import Path
77

8+
from tomlkit.toml_document import TOMLDocument
9+
810
import tomlkit
911

1012

@@ -16,7 +18,7 @@ def _from_tomlkit(value):
1618
- tomlkit containers → plain Python containers
1719
- tomlkit primitives → plain Python primitives
1820
"""
19-
from tomlkit.items import Array, InlineTable, Table, AoT
21+
from tomlkit.items import AoT, Array, InlineTable, Table
2022

2123
if value is None:
2224
return None
@@ -58,7 +60,7 @@ def _to_tomlkit(value):
5860
- List of dicts → array of inline tables: [{key = val}]
5961
- Nested dicts → nested tables with proper structure
6062
"""
61-
from tomlkit import inline_table, array
63+
from tomlkit import array, inline_table
6264

6365
if value is None:
6466
return None

afterpython/_paths.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
from pathlib import Path
21
from dataclasses import dataclass, field
2+
from pathlib import Path
33

44

55
@dataclass

afterpython/_typing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from typing import TypeAlias, Literal
2-
1+
from typing import Literal, TypeAlias
32

43
NodeEnv: TypeAlias = dict[str, str]
54
tContentType = Literal["doc", "blog", "tutorial", "example", "guide"]

afterpython/builders/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from afterpython.builders.metadata import build_metadata
22
from afterpython.builders.molab import add_molab_badge_to_jupyter_notebooks
33

4-
54
__all__ = (
65
"add_molab_badge_to_jupyter_notebooks",
76
"build_metadata",

afterpython/builders/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
from typing import TYPE_CHECKING
34

45
if TYPE_CHECKING:
@@ -8,7 +9,6 @@
89

910
import afterpython as ap
1011

11-
1212
build_path = ap.paths.build_path
1313

1414

afterpython/builders/molab.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
from typing import TYPE_CHECKING
34

45
if TYPE_CHECKING:
@@ -10,8 +11,8 @@
1011
from pyproject_metadata import StandardMetadata
1112

1213
import afterpython as ap
13-
from afterpython.tools.pyproject import read_metadata
1414
from afterpython.const import CONTENT_TYPES
15+
from afterpython.tools.pyproject import read_metadata
1516

1617

1718
def _get_molab_badge() -> str:

afterpython/cli/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
from afterpython.cli.main import afterpython_group
22

3-
43
__all__ = ["afterpython_group"]

afterpython/cli/commands/build.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
from __future__ import annotations
2-
from typing import TYPE_CHECKING
2+
33
from collections.abc import Callable
4+
from typing import TYPE_CHECKING
45

56
if TYPE_CHECKING:
6-
from afterpython._typing import NodeEnv
77
from pathlib import Path
88

9+
from afterpython._typing import NodeEnv
10+
911
import os
1012
import shutil
1113
import subprocess
@@ -14,12 +16,12 @@
1416
from click.exceptions import Exit
1517

1618
import afterpython as ap
17-
from afterpython.utils import find_node_env
18-
from afterpython.const import CONTENT_TYPES
1919
from afterpython.builders import (
20-
build_metadata,
2120
add_molab_badge_to_jupyter_notebooks,
21+
build_metadata,
2222
)
23+
from afterpython.const import CONTENT_TYPES
24+
from afterpython.utils import find_node_env
2325

2426

2527
def determine_base_path() -> str:
@@ -29,9 +31,9 @@ def determine_base_path() -> str:
2931
Empty string if custom domain is configured (no github.io in URL)
3032
/repo-name if using default GitHub Pages URL (contains github.io)
3133
"""
34+
from afterpython._io.toml import _from_tomlkit
3235
from afterpython.tools._afterpython import read_afterpython
3336
from afterpython.tools.pyproject import read_metadata
34-
from afterpython._io.toml import _from_tomlkit
3537

3638
# Read website URL from afterpython.toml
3739
afterpython = read_afterpython()
@@ -167,8 +169,7 @@ def build(ctx, dev: bool, execute: bool):
167169
168170
Use --execute to execute Jupyter notebooks for all content types.
169171
"""
170-
from afterpython.utils import has_content_for_myst
171-
from afterpython.utils import handle_passthrough_help
172+
from afterpython.utils import handle_passthrough_help, has_content_for_myst
172173

173174
# Show both our options and myst's help and exit
174175
handle_passthrough_help(

afterpython/cli/commands/clean.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import annotations
2+
23
from typing import TYPE_CHECKING
34

45
if TYPE_CHECKING:
@@ -10,8 +11,8 @@
1011
import click
1112
from click.exceptions import Exit
1213

13-
from afterpython.utils import find_node_env, has_content_for_myst
1414
from afterpython.const import CONTENT_TYPES
15+
from afterpython.utils import find_node_env, has_content_for_myst
1516

1617

1718
@click.command(

afterpython/cli/commands/dev.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
from __future__ import annotations
2+
23
from typing import TYPE_CHECKING
34

45
if TYPE_CHECKING:
56
from afterpython._typing import NodeEnv
67

7-
import time
88
import subprocess
9+
import time
910

1011
import click
1112
from click.exceptions import Exit
1213

13-
from afterpython.utils import find_node_env, find_available_port
1414
from afterpython.const import CONTENT_TYPES
15+
from afterpython.utils import find_available_port, find_node_env
1516

1617

1718
@click.command(

0 commit comments

Comments
 (0)