Skip to content

Commit ab33e66

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 0ebfd0d commit ab33e66

File tree

14 files changed

+35
-22
lines changed

14 files changed

+35
-22
lines changed

mdit_py_plugins/admon/index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
from __future__ import annotations
44

5+
from collections.abc import Callable, Sequence
56
from contextlib import suppress
67
import re
7-
from typing import TYPE_CHECKING, Callable, Sequence
8+
from typing import TYPE_CHECKING
89

910
from markdown_it import MarkdownIt
1011
from markdown_it.rules_block import StateBlock

mdit_py_plugins/amsmath/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
from __future__ import annotations
44

5+
from collections.abc import Callable, Sequence
56
import re
6-
from typing import TYPE_CHECKING, Callable, Sequence
7+
from typing import TYPE_CHECKING
78

89
from markdown_it import MarkdownIt
910
from markdown_it.common.utils import escapeHtml

mdit_py_plugins/anchors/index.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
from collections.abc import Callable
12
import re
2-
from typing import Callable, List, Optional, Set
33

44
from markdown_it import MarkdownIt
55
from markdown_it.rules_core import StateCore
@@ -10,7 +10,7 @@ def anchors_plugin(
1010
md: MarkdownIt,
1111
min_level: int = 1,
1212
max_level: int = 2,
13-
slug_func: Optional[Callable[[str], str]] = None,
13+
slug_func: Callable[[str], str] | None = None,
1414
permalink: bool = False,
1515
permalinkSymbol: str = "¶",
1616
permalinkBefore: bool = False,
@@ -58,15 +58,15 @@ def anchors_plugin(
5858

5959

6060
def _make_anchors_func(
61-
selected_levels: List[int],
61+
selected_levels: list[int],
6262
slug_func: Callable[[str], str],
6363
permalink: bool,
6464
permalinkSymbol: str,
6565
permalinkBefore: bool,
6666
permalinkSpace: bool,
6767
) -> Callable[[StateCore], None]:
6868
def _anchor_func(state: StateCore) -> None:
69-
slugs: Set[str] = set()
69+
slugs: set[str] = set()
7070
for idx, token in enumerate(state.tokens):
7171
if token.type != "heading_open":
7272
continue
@@ -119,7 +119,7 @@ def slugify(title: str) -> str:
119119
return re.sub(r"[^\w\u4e00-\u9fff\- ]", "", title.strip().lower().replace(" ", "-"))
120120

121121

122-
def unique_slug(slug: str, slugs: Set[str]) -> str:
122+
def unique_slug(slug: str, slugs: set[str]) -> str:
123123
uniq = slug
124124
i = 1
125125
while uniq in slugs:

mdit_py_plugins/attrs/index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3+
from collections.abc import Sequence
34
from functools import partial
4-
from typing import Any, Sequence
5+
from typing import Any
56

67
from markdown_it import MarkdownIt
78
from markdown_it.rules_block import StateBlock

mdit_py_plugins/attrs/parse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class <- '.' name
2222

2323
from __future__ import annotations
2424

25+
from collections.abc import Callable
2526
from enum import Enum
2627
import re
27-
from typing import Callable
2828

2929

3030
class State(Enum):

mdit_py_plugins/colon_fence.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Sequence
3+
from collections.abc import Sequence
4+
from typing import TYPE_CHECKING
45

56
from markdown_it import MarkdownIt
67
from markdown_it.common.utils import escapeHtml, unescapeAll

mdit_py_plugins/container/index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
from __future__ import annotations
44

5+
from collections.abc import Callable, Sequence
56
from math import floor
6-
from typing import TYPE_CHECKING, Any, Callable, Sequence
7+
from typing import TYPE_CHECKING, Any
78

89
from markdown_it import MarkdownIt
910
from markdown_it.rules_block import StateBlock

mdit_py_plugins/dollarmath/index.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
from __future__ import annotations
22

3+
from collections.abc import Callable, Sequence
34
import re
4-
from typing import TYPE_CHECKING, Any, Callable, Sequence
5+
from typing import TYPE_CHECKING, Any
56

67
from markdown_it import MarkdownIt
78
from markdown_it.common.utils import escapeHtml, isWhiteSpace

mdit_py_plugins/field_list/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Field list plugin"""
22

3+
from collections.abc import Iterator
34
from contextlib import contextmanager
4-
from typing import Iterator, Optional, Tuple
5+
from typing import Optional, Tuple
56

67
from markdown_it import MarkdownIt
78
from markdown_it.rules_block import StateBlock
@@ -45,7 +46,7 @@ def fieldlist_plugin(md: MarkdownIt) -> None:
4546
)
4647

4748

48-
def parseNameMarker(state: StateBlock, startLine: int) -> Tuple[int, str]:
49+
def parseNameMarker(state: StateBlock, startLine: int) -> tuple[int, str]:
4950
"""Parse field name: `:name:`
5051
5152
:returns: position after name marker, name text
@@ -159,7 +160,7 @@ def _fieldlist_rule(
159160

160161
# to figure out the indent of the body,
161162
# we look at all non-empty, indented lines and find the minimum indent
162-
block_indent: Optional[int] = None
163+
block_indent: int | None = None
163164
_line = startLine + 1
164165
while _line < endLine:
165166
# if start_of_content < end_of_content, then non-empty line

mdit_py_plugins/footnote/index.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
from __future__ import annotations
44

5+
from collections.abc import Sequence
56
from functools import partial
6-
from typing import TYPE_CHECKING, Sequence, TypedDict
7+
from typing import TYPE_CHECKING, TypedDict
78

89
from markdown_it import MarkdownIt
910
from markdown_it.helpers import parseLinkLabel
@@ -332,7 +333,7 @@ def footnote_tail(state: StateCore) -> None:
332333

333334
tok_filter.append(not insideRef)
334335

335-
state.tokens = [t for t, f in zip(state.tokens, tok_filter) if f]
336+
state.tokens = [t for t, f in zip(state.tokens, tok_filter, strict=False) if f]
336337

337338
footnote_data = _data_from_env(state.env)
338339
if not footnote_data["list"]:

0 commit comments

Comments
 (0)