Skip to content

Commit

Permalink
fix: cleanup unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Oct 24, 2024
1 parent 231df01 commit 6d04695
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 46 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ where = ["src"]
[tool.setuptools.package-data]
mistune = ["py.typed"]

[tool.ruff]
line-length = 120

[tool.pytest.ini_options]
pythonpath = ["src", "."]
testpaths = ["tests"]
Expand Down
2 changes: 1 addition & 1 deletion src/mistune/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Documentation: https://mistune.lepture.com/
"""

from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union

from typing_extensions import Literal

Expand Down
2 changes: 1 addition & 1 deletion src/mistune/block_parser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import re
from typing import Optional, List, Tuple, Match, Type, Pattern
from typing import Optional, List, Tuple, Match, Pattern
from .util import (
unikey,
escape_url,
Expand Down
2 changes: 0 additions & 2 deletions src/mistune/core.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import re
from collections.abc import Generator
from typing import (
Any,
Callable,
Expand All @@ -12,7 +11,6 @@
MutableMapping,
Optional,
Pattern,
Set,
Type,
TypeVar,
Union,
Expand Down
2 changes: 1 addition & 1 deletion src/mistune/directives/admonition.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING, Any, Dict, List, Match, Optional
from typing import TYPE_CHECKING, Any, Dict, Match

from ._base import BaseDirective, DirectivePlugin

Expand Down
1 change: 0 additions & 1 deletion src/mistune/directives/toc.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def render_html_toc(
) -> str:
if not title:
title = 'Table of Contents'
toc = attrs['toc']
content = render_toc_ul(attrs['toc'])

html = '<details class="toc"'
Expand Down
9 changes: 0 additions & 9 deletions src/mistune/inline_parser.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
import re
from typing import (
Any,
ClassVar,
Dict,
Generic,
Iterator,
List,
Match,
MutableMapping,
Optional,
Pattern,
Tuple,
TypeVar,
Union,
)

from typing_extensions import Literal

from .core import InlineState, Parser
from .helpers import (
HTML_ATTRIBUTES,
Expand Down
1 change: 0 additions & 1 deletion src/mistune/list_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import re
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Optional, Tuple, Match

from typing_extensions import Literal

from .util import expand_leading_tab, expand_tab, strip_end

Expand Down
4 changes: 2 additions & 2 deletions src/mistune/plugins/abbr.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import re
import types
from typing import TYPE_CHECKING, Match, Optional
from typing import TYPE_CHECKING, Match

from ..helpers import PREVENT_BACKSLASH
from ..util import escape

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..core import BaseRenderer, BlockState, InlineState
from ..inline_parser import InlineParser
from ..markdown import Markdown

Expand Down
5 changes: 2 additions & 3 deletions src/mistune/plugins/def_list.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import re
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match

from ..util import strip_end

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..inline_parser import InlineParser
from ..core import BaseRenderer, BlockState
from ..markdown import Markdown

__all__ = ['def_list']
Expand Down
4 changes: 2 additions & 2 deletions src/mistune/plugins/footnotes.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import re
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional, Union
from typing import TYPE_CHECKING, Any, Dict, List, Match, Union

from ..core import BlockState
from ..helpers import LINK_LABEL
from ..util import unikey

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, InlineState, Parser
from ..core import BaseRenderer, InlineState
from ..inline_parser import InlineParser
from ..markdown import Markdown

Expand Down
5 changes: 2 additions & 3 deletions src/mistune/plugins/formatting.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import re
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional, Pattern
from typing import TYPE_CHECKING, Match, Optional, Pattern

from ..helpers import PREVENT_BACKSLASH

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..core import BaseRenderer, InlineState
from ..inline_parser import InlineParser
from ..markdown import Markdown

Expand Down
7 changes: 4 additions & 3 deletions src/mistune/plugins/math.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
__all__ = ['math', 'math_in_quote', 'math_in_list']
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
from typing import TYPE_CHECKING, Match

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..core import BaseRenderer, BlockState, InlineState
from ..inline_parser import InlineParser
from ..markdown import Markdown

__all__ = ['math', 'math_in_quote', 'math_in_list']

BLOCK_MATH_PATTERN = r'^ {0,3}\$\$[ \t]*\n(?P<math_text>[\s\S]+?)\n\$\$[ \t]*$'
INLINE_MATH_PATTERN = r'\$(?!\s)(?P<math_text>.+?)(?!\s)\$'

Expand Down
5 changes: 2 additions & 3 deletions src/mistune/plugins/ruby.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import re
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
from typing import TYPE_CHECKING, Any, Dict, List, Match, Optional

from ..helpers import parse_link, parse_link_label
from ..util import unikey

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..core import BaseRenderer, InlineState
from ..inline_parser import InlineParser
from ..markdown import Markdown

Expand Down
4 changes: 2 additions & 2 deletions src/mistune/plugins/speedup.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import re
import string
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
from typing import TYPE_CHECKING, Match

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..core import BlockState, InlineState
from ..inline_parser import InlineParser
from ..markdown import Markdown

Expand Down
4 changes: 2 additions & 2 deletions src/mistune/plugins/spoiler.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import re
from typing import TYPE_CHECKING, Match, Optional
from typing import TYPE_CHECKING, Match

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..core import BaseRenderer, BlockState, InlineState
from ..inline_parser import InlineParser
from ..markdown import Markdown

Expand Down
4 changes: 1 addition & 3 deletions src/mistune/plugins/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
TYPE_CHECKING,
Any,
Dict,
Iterable,
List,
Match,
Optional,
Expand All @@ -15,8 +14,7 @@

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..inline_parser import InlineParser
from ..core import BaseRenderer, BlockState
from ..markdown import Markdown

# https://michelf.ca/projects/php-markdown/extra/#table
Expand Down
6 changes: 2 additions & 4 deletions src/mistune/plugins/task_lists.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import re
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
from typing import TYPE_CHECKING, Any, Dict, Iterable

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..inline_parser import InlineParser
from ..core import BaseRenderer, BlockState
from ..markdown import Markdown

__all__ = ['task_lists']
Expand Down
6 changes: 3 additions & 3 deletions src/mistune/plugins/url.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Match, Optional
from typing import TYPE_CHECKING, Match

from ..util import escape_url

if TYPE_CHECKING:
from ..block_parser import BlockParser
from ..core import BaseRenderer, BlockState, InlineState, Parser
from ..core import InlineState
from ..inline_parser import InlineParser
from ..markdown import Markdown

__all__ = ['url']

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

0 comments on commit 6d04695

Please sign in to comment.