Skip to content

Commit 6d04695

Browse files
committed
fix: cleanup unused imports
1 parent 231df01 commit 6d04695

19 files changed

+30
-46
lines changed

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ where = ["src"]
4646
[tool.setuptools.package-data]
4747
mistune = ["py.typed"]
4848

49+
[tool.ruff]
50+
line-length = 120
51+
4952
[tool.pytest.ini_options]
5053
pythonpath = ["src", "."]
5154
testpaths = ["tests"]

src/mistune/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Documentation: https://mistune.lepture.com/
99
"""
1010

11-
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
11+
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
1212

1313
from typing_extensions import Literal
1414

src/mistune/block_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import re
2-
from typing import Optional, List, Tuple, Match, Type, Pattern
2+
from typing import Optional, List, Tuple, Match, Pattern
33
from .util import (
44
unikey,
55
escape_url,

src/mistune/core.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import re
2-
from collections.abc import Generator
32
from typing import (
43
Any,
54
Callable,
@@ -12,7 +11,6 @@
1211
MutableMapping,
1312
Optional,
1413
Pattern,
15-
Set,
1614
Type,
1715
TypeVar,
1816
Union,

src/mistune/directives/admonition.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, Any, Dict, List, Match, Optional
1+
from typing import TYPE_CHECKING, Any, Dict, Match
22

33
from ._base import BaseDirective, DirectivePlugin
44

src/mistune/directives/toc.py

-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ def render_html_toc(
9696
) -> str:
9797
if not title:
9898
title = 'Table of Contents'
99-
toc = attrs['toc']
10099
content = render_toc_ul(attrs['toc'])
101100

102101
html = '<details class="toc"'

src/mistune/inline_parser.py

-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
11
import re
22
from typing import (
33
Any,
4-
ClassVar,
54
Dict,
6-
Generic,
7-
Iterator,
85
List,
96
Match,
107
MutableMapping,
118
Optional,
12-
Pattern,
13-
Tuple,
14-
TypeVar,
15-
Union,
169
)
1710

18-
from typing_extensions import Literal
19-
2011
from .core import InlineState, Parser
2112
from .helpers import (
2213
HTML_ATTRIBUTES,

src/mistune/list_parser.py

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import re
44
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Tuple, Match
55

6-
from typing_extensions import Literal
76

87
from .util import expand_leading_tab, expand_tab, strip_end
98

src/mistune/plugins/abbr.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import re
22
import types
3-
from typing import TYPE_CHECKING, Match, Optional
3+
from typing import TYPE_CHECKING, Match
44

55
from ..helpers import PREVENT_BACKSLASH
66
from ..util import escape
77

88
if TYPE_CHECKING:
99
from ..block_parser import BlockParser
10-
from ..core import BaseRenderer, BlockState, InlineState, Parser
10+
from ..core import BaseRenderer, BlockState, InlineState
1111
from ..inline_parser import InlineParser
1212
from ..markdown import Markdown
1313

src/mistune/plugins/def_list.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import re
2-
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
2+
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match
33

44
from ..util import strip_end
55

66
if TYPE_CHECKING:
77
from ..block_parser import BlockParser
8-
from ..core import BaseRenderer, BlockState, InlineState, Parser
9-
from ..inline_parser import InlineParser
8+
from ..core import BaseRenderer, BlockState
109
from ..markdown import Markdown
1110

1211
__all__ = ['def_list']

src/mistune/plugins/footnotes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import re
2-
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional, Union
2+
from typing import TYPE_CHECKING, Any, Dict, List, Match, Union
33

44
from ..core import BlockState
55
from ..helpers import LINK_LABEL
66
from ..util import unikey
77

88
if TYPE_CHECKING:
99
from ..block_parser import BlockParser
10-
from ..core import BaseRenderer, InlineState, Parser
10+
from ..core import BaseRenderer, InlineState
1111
from ..inline_parser import InlineParser
1212
from ..markdown import Markdown
1313

src/mistune/plugins/formatting.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import re
2-
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional, Pattern
2+
from typing import TYPE_CHECKING, Match, Optional, Pattern
33

44
from ..helpers import PREVENT_BACKSLASH
55

66
if TYPE_CHECKING:
7-
from ..block_parser import BlockParser
8-
from ..core import BaseRenderer, BlockState, InlineState, Parser
7+
from ..core import BaseRenderer, InlineState
98
from ..inline_parser import InlineParser
109
from ..markdown import Markdown
1110

src/mistune/plugins/math.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
__all__ = ['math', 'math_in_quote', 'math_in_list']
2-
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
1+
from typing import TYPE_CHECKING, Match
32

43
if TYPE_CHECKING:
54
from ..block_parser import BlockParser
6-
from ..core import BaseRenderer, BlockState, InlineState, Parser
5+
from ..core import BaseRenderer, BlockState, InlineState
76
from ..inline_parser import InlineParser
87
from ..markdown import Markdown
98

9+
__all__ = ['math', 'math_in_quote', 'math_in_list']
10+
1011
BLOCK_MATH_PATTERN = r'^ {0,3}\$\$[ \t]*\n(?P<math_text>[\s\S]+?)\n\$\$[ \t]*$'
1112
INLINE_MATH_PATTERN = r'\$(?!\s)(?P<math_text>.+?)(?!\s)\$'
1213

src/mistune/plugins/ruby.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import re
2-
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
2+
from typing import TYPE_CHECKING, Any, Dict, List, Match, Optional
33

44
from ..helpers import parse_link, parse_link_label
55
from ..util import unikey
66

77
if TYPE_CHECKING:
8-
from ..block_parser import BlockParser
9-
from ..core import BaseRenderer, BlockState, InlineState, Parser
8+
from ..core import BaseRenderer, InlineState
109
from ..inline_parser import InlineParser
1110
from ..markdown import Markdown
1211

src/mistune/plugins/speedup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import re
22
import string
3-
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
3+
from typing import TYPE_CHECKING, Match
44

55
if TYPE_CHECKING:
66
from ..block_parser import BlockParser
7-
from ..core import BaseRenderer, BlockState, InlineState, Parser
7+
from ..core import BlockState, InlineState
88
from ..inline_parser import InlineParser
99
from ..markdown import Markdown
1010

src/mistune/plugins/spoiler.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import re
2-
from typing import TYPE_CHECKING, Match, Optional
2+
from typing import TYPE_CHECKING, Match
33

44
if TYPE_CHECKING:
55
from ..block_parser import BlockParser
6-
from ..core import BaseRenderer, BlockState, InlineState, Parser
6+
from ..core import BaseRenderer, BlockState, InlineState
77
from ..inline_parser import InlineParser
88
from ..markdown import Markdown
99

src/mistune/plugins/table.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
TYPE_CHECKING,
44
Any,
55
Dict,
6-
Iterable,
76
List,
87
Match,
98
Optional,
@@ -15,8 +14,7 @@
1514

1615
if TYPE_CHECKING:
1716
from ..block_parser import BlockParser
18-
from ..core import BaseRenderer, BlockState, InlineState, Parser
19-
from ..inline_parser import InlineParser
17+
from ..core import BaseRenderer, BlockState
2018
from ..markdown import Markdown
2119

2220
# https://michelf.ca/projects/php-markdown/extra/#table

src/mistune/plugins/task_lists.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import re
2-
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
2+
from typing import TYPE_CHECKING, Any, Dict, Iterable
33

44
if TYPE_CHECKING:
5-
from ..block_parser import BlockParser
6-
from ..core import BaseRenderer, BlockState, InlineState, Parser
7-
from ..inline_parser import InlineParser
5+
from ..core import BaseRenderer, BlockState
86
from ..markdown import Markdown
97

108
__all__ = ['task_lists']

src/mistune/plugins/url.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
1+
from typing import TYPE_CHECKING, Match
22

33
from ..util import escape_url
44

55
if TYPE_CHECKING:
6-
from ..block_parser import BlockParser
7-
from ..core import BaseRenderer, BlockState, InlineState, Parser
6+
from ..core import InlineState
87
from ..inline_parser import InlineParser
98
from ..markdown import Markdown
9+
1010
__all__ = ['url']
1111

1212
URL_LINK_PATTERN = r'''https?:\/\/[^\s<]+[^<.,:;"')\]\s]'''

0 commit comments

Comments
 (0)