|
2 | 2 |
|
3 | 3 | from collections import namedtuple |
4 | 4 | from collections.abc import MutableMapping |
| 5 | +from dataclasses import dataclass |
5 | 6 | from typing import TYPE_CHECKING |
6 | 7 |
|
7 | | -import attr |
8 | | - |
9 | 8 | from ..common.utils import isMdAsciiPunct, isPunctChar, isWhiteSpace |
10 | 9 | from ..ruler import StateBase |
11 | 10 | from ..token import Token |
|
14 | 13 | from markdown_it import MarkdownIt |
15 | 14 |
|
16 | 15 |
|
17 | | -@attr.s(slots=True) |
| 16 | +@dataclass() |
18 | 17 | class Delimiter: |
19 | 18 | # Char code of the starting marker (number). |
20 | | - marker: int = attr.ib() |
| 19 | + marker: int |
21 | 20 |
|
22 | 21 | # Total length of these series of delimiters. |
23 | | - length: int = attr.ib() |
| 22 | + length: int |
24 | 23 |
|
25 | 24 | # An amount of characters before this one that's equivalent to |
26 | 25 | # current one. In plain English: if this delimiter does not open |
27 | 26 | # an emphasis, neither do previous `jump` characters. |
28 | 27 | # |
29 | 28 | # Used to skip sequences like "*****" in one step, for 1st asterisk |
30 | 29 | # value will be 0, for 2nd it's 1 and so on. |
31 | | - jump: int = attr.ib() |
| 30 | + jump: int |
32 | 31 |
|
33 | 32 | # A position of the token this delimiter corresponds to. |
34 | | - token: int = attr.ib() |
| 33 | + token: int |
35 | 34 |
|
36 | 35 | # If this delimiter is matched as a valid opener, `end` will be |
37 | 36 | # equal to its position, otherwise it's `-1`. |
38 | | - end: int = attr.ib() |
| 37 | + end: int |
39 | 38 |
|
40 | 39 | # Boolean flags that determine if this delimiter could open or close |
41 | 40 | # an emphasis. |
42 | | - open: bool = attr.ib() |
43 | | - close: bool = attr.ib() |
| 41 | + open: bool |
| 42 | + close: bool |
44 | 43 |
|
45 | | - level: bool = attr.ib(default=None) |
| 44 | + level: bool | None = None |
46 | 45 |
|
47 | 46 |
|
48 | 47 | Scanned = namedtuple("Scanned", ["can_open", "can_close", "length"]) |
|
0 commit comments