File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1+ from __future__ import annotations
2+
3+ from collections .abc import Mapping
4+ import sys
5+ from typing import Any
6+
7+ if sys .version_info >= (3 , 10 ):
8+ DATACLASS_KWARGS : Mapping [str , Any ] = {"slots" : True }
9+ else :
10+ DATACLASS_KWARGS : Mapping [str , Any ] = {}
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ class Ruler
2121from dataclasses import dataclass , field
2222from typing import TYPE_CHECKING
2323
24+ from markdown_it ._compat import DATACLASS_KWARGS
25+
2426if TYPE_CHECKING :
2527 from markdown_it import MarkdownIt
2628
@@ -50,7 +52,7 @@ def src(self, value: str) -> None:
5052RuleFunc = Callable
5153
5254
53- @dataclass ()
55+ @dataclass (** DATACLASS_KWARGS )
5456class Rule :
5557 name : str
5658 enabled : bool
Original file line number Diff line number Diff line change 55from dataclasses import dataclass
66from typing import TYPE_CHECKING
77
8+ from .._compat import DATACLASS_KWARGS
89from ..common .utils import isMdAsciiPunct , isPunctChar , isWhiteSpace
910from ..ruler import StateBase
1011from ..token import Token
1314 from markdown_it import MarkdownIt
1415
1516
16- @dataclass ()
17+ @dataclass (** DATACLASS_KWARGS )
1718class Delimiter :
1819 # Char code of the starting marker (number).
1920 marker : int
Original file line number Diff line number Diff line change 55from typing import Any
66import warnings
77
8+ from markdown_it ._compat import DATACLASS_KWARGS
9+
810
911def convert_attrs (value : Any ) -> Any :
1012 """Convert Token.attrs set as ``None`` or ``[[key, value], ...]`` to a dict.
@@ -18,7 +20,7 @@ def convert_attrs(value: Any) -> Any:
1820 return value
1921
2022
21- @dc .dataclass ()
23+ @dc .dataclass (** DATACLASS_KWARGS )
2224class Token :
2325
2426 type : str
You can’t perform that action at this time.
0 commit comments