1
- from _typeshed import Incomplete
2
- from typing import Any
3
-
4
- CODE_INDENT : int
5
- reHtmlBlockOpen : Any
6
- reHtmlBlockClose : Any
7
- reThematicBreak : Any
8
- reMaybeSpecial : Any
9
- reNonSpace : Any
10
- reBulletListMarker : Any
11
- reOrderedListMarker : Any
12
- reATXHeadingMarker : Any
13
- reCodeFence : Any
14
- reClosingCodeFence : Any
15
- reSetextHeadingLine : Any
16
- reLineEnding : Any
17
-
18
- def is_blank (s ): ...
19
- def is_space_or_tab (s ): ...
20
- def peek (ln , pos ): ...
21
- def ends_with_blank_line (block ): ...
22
- def parse_list_marker (parser , container ): ...
23
- def lists_match (list_data , item_data ): ...
1
+ import re
2
+ from typing import Any , Final , Literal
3
+
4
+ from .inlines import InlineParser
5
+ from .node import Node
6
+
7
+ CODE_INDENT : Final [int ]
8
+ reHtmlBlockOpen : Final [list [re .Pattern [str ]]]
9
+ reHtmlBlockClose : Final [list [re .Pattern [str ]]]
10
+ reThematicBreak : Final [re .Pattern [str ]]
11
+ reMaybeSpecial : Final [re .Pattern [str ]]
12
+ reNonSpace : Final [re .Pattern [str ]]
13
+ reBulletListMarker : Final [re .Pattern [str ]]
14
+ reOrderedListMarker : Final [re .Pattern [str ]]
15
+ reATXHeadingMarker : Final [re .Pattern [str ]]
16
+ reCodeFence : Final [re .Pattern [str ]]
17
+ reClosingCodeFence : Final [re .Pattern [str ]]
18
+ reSetextHeadingLine : Final [re .Pattern [str ]]
19
+ reLineEnding : Final [re .Pattern [str ]]
20
+
21
+ def is_blank (s : str ) -> bool : ...
22
+ def is_space_or_tab (s : str ) -> bool : ...
23
+ def peek (ln : str , pos : int ) -> str | None : ...
24
+ def ends_with_blank_line (block : Node ) -> bool : ...
25
+ def parse_list_marker (parser : Parser , container : Node ) -> dict [str , Any ] | None : ...
26
+ def lists_match (list_data : dict [str , Any ], item_data : dict [str , Any ]) -> bool : ...
24
27
25
28
class Block :
26
- accepts_lines : Any
29
+ accepts_lines : bool | None
27
30
@staticmethod
28
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ... ) -> None : ...
31
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> int | None : ...
29
32
@staticmethod
30
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
33
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
31
34
@staticmethod
32
- def can_contain (t ) -> None : ...
35
+ def can_contain (t : str ) -> bool | None : ...
33
36
34
37
class Document (Block ):
35
- accepts_lines : bool
38
+ accepts_lines : Literal [ False ]
36
39
@staticmethod
37
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
40
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 0 ] : ...
38
41
@staticmethod
39
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
42
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
40
43
@staticmethod
41
- def can_contain (t ) : ...
44
+ def can_contain (t : str ) -> bool : ...
42
45
43
46
class List (Block ):
44
- accepts_lines : bool
47
+ accepts_lines : Literal [ False ]
45
48
@staticmethod
46
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
49
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 0 ] : ...
47
50
@staticmethod
48
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
51
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
49
52
@staticmethod
50
- def can_contain (t ) : ...
53
+ def can_contain (t : str ) -> bool : ...
51
54
52
55
class BlockQuote (Block ):
53
- accepts_lines : bool
56
+ accepts_lines : Literal [ False ]
54
57
@staticmethod
55
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
58
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 0 , 1 ] : ...
56
59
@staticmethod
57
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
60
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
58
61
@staticmethod
59
- def can_contain (t ) : ...
62
+ def can_contain (t : str ) -> bool : ...
60
63
61
64
class Item (Block ):
62
- accepts_lines : bool
65
+ accepts_lines : Literal [ False ]
63
66
@staticmethod
64
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
67
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 0 , 1 ] : ...
65
68
@staticmethod
66
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
69
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
67
70
@staticmethod
68
- def can_contain (t ) : ...
71
+ def can_contain (t : str ) -> bool : ...
69
72
70
73
class Heading (Block ):
71
- accepts_lines : bool
74
+ accepts_lines : Literal [ False ]
72
75
@staticmethod
73
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
76
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 1 ] : ...
74
77
@staticmethod
75
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
78
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
76
79
@staticmethod
77
- def can_contain (t ) : ...
80
+ def can_contain (t : str ) -> Literal [ False ] : ...
78
81
79
82
class ThematicBreak (Block ):
80
- accepts_lines : bool
83
+ accepts_lines : Literal [ False ]
81
84
@staticmethod
82
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
85
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 1 ] : ...
83
86
@staticmethod
84
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
87
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
85
88
@staticmethod
86
- def can_contain (t ) : ...
89
+ def can_contain (t : str ) -> Literal [ False ] : ...
87
90
88
91
class CodeBlock (Block ):
89
- accepts_lines : bool
92
+ accepts_lines : Literal [ True ]
90
93
@staticmethod
91
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
94
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 0 , 1 , 2 ] : ...
92
95
@staticmethod
93
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
96
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
94
97
@staticmethod
95
- def can_contain (t ) : ...
98
+ def can_contain (t : str ) -> Literal [ False ] : ...
96
99
97
100
class HtmlBlock (Block ):
98
- accepts_lines : bool
101
+ accepts_lines : Literal [ True ]
99
102
@staticmethod
100
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
103
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 0 , 1 ] : ...
101
104
@staticmethod
102
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
105
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
103
106
@staticmethod
104
- def can_contain (t ) : ...
107
+ def can_contain (t : str ) -> Literal [ False ] : ...
105
108
106
109
class Paragraph (Block ):
107
- accepts_lines : bool
110
+ accepts_lines : Literal [ True ]
108
111
@staticmethod
109
- def continue_ (parser : Incomplete | None = ... , container : Incomplete | None = ...) : ...
112
+ def continue_ (parser : Parser | None = None , container : Node | None = None ) -> Literal [ 0 , 1 ] : ...
110
113
@staticmethod
111
- def finalize (parser : Incomplete | None = ... , block : Incomplete | None = ... ) -> None : ...
114
+ def finalize (parser : Parser | None = None , block : Node | None = None ) -> None : ...
112
115
@staticmethod
113
- def can_contain (t ) : ...
116
+ def can_contain (t : str ) -> Literal [ False ] : ...
114
117
115
118
class BlockStarts :
116
- METHODS : Any
119
+ METHODS : list [ str ]
117
120
@staticmethod
118
- def block_quote (parser , container : Incomplete | None = ...) : ...
121
+ def block_quote (parser : Parser , container : Node | None = None ) -> Literal [ 0 , 1 ] : ...
119
122
@staticmethod
120
- def atx_heading (parser , container : Incomplete | None = ...) : ...
123
+ def atx_heading (parser : Parser , container : Node | None = None ) -> Literal [ 0 , 2 ] : ...
121
124
@staticmethod
122
- def fenced_code_block (parser , container : Incomplete | None = ...) : ...
125
+ def fenced_code_block (parser : Parser , container : Node | None = None ) -> Literal [ 0 , 2 ] : ...
123
126
@staticmethod
124
- def html_block (parser , container : Incomplete | None = ...) : ...
127
+ def html_block (parser : Parser , container : Node | None = None ) -> Literal [ 0 , 2 ] : ...
125
128
@staticmethod
126
- def setext_heading (parser , container : Incomplete | None = ...) : ...
129
+ def setext_heading (parser : Parser , container : Node | None = None ) -> Literal [ 0 , 2 ] : ...
127
130
@staticmethod
128
- def thematic_break (parser , container : Incomplete | None = ...) : ...
131
+ def thematic_break (parser : Parser , container : Node | None = None ) -> Literal [ 0 , 2 ] : ...
129
132
@staticmethod
130
- def list_item (parser , container : Incomplete | None = ...) : ...
133
+ def list_item (parser : Parser , container : Node | None = None ) -> Literal [ 0 , 1 ] : ...
131
134
@staticmethod
132
- def indented_code_block (parser , container : Incomplete | None = ...) : ...
135
+ def indented_code_block (parser : Parser , container : Node | None = None ) -> Literal [ 0 , 2 ] : ...
133
136
134
137
class Parser :
135
- doc : Any
136
- block_starts : Any
137
- tip : Any
138
- oldtip : Any
138
+ doc : Node
139
+ block_starts : BlockStarts
140
+ tip : Node
141
+ oldtip : Node
139
142
current_line : str
140
143
line_number : int
141
144
offset : int
@@ -147,21 +150,22 @@ class Parser:
147
150
blank : bool
148
151
partially_consumed_tab : bool
149
152
all_closed : bool
150
- last_matched_container : Any
151
- refmap : Any
153
+ last_matched_container : Node
154
+ refmap : dict [ str , Any ]
152
155
last_line_length : int
153
- inline_parser : Any
154
- options : Any
155
- def __init__ (self , options = ...) -> None : ...
156
+ inline_parser : InlineParser
157
+ options : dict [str , Any ]
158
+ blocks : dict [str , Block ]
159
+ def __init__ (self , options : dict [str , Any ] = {}) -> None : ...
156
160
def add_line (self ) -> None : ...
157
- def add_child (self , tag , offset ) : ...
161
+ def add_child (self , tag : str , offset : int ) -> Node : ...
158
162
def close_unmatched_blocks (self ) -> None : ...
159
163
def find_next_nonspace (self ) -> None : ...
160
164
def advance_next_nonspace (self ) -> None : ...
161
- def advance_offset (self , count , columns ) -> None : ...
162
- def incorporate_line (self , ln ) -> None : ...
163
- def finalize (self , block , line_number ) -> None : ...
164
- def process_inlines (self , block ) -> None : ...
165
- def parse (self , my_input ) : ...
165
+ def advance_offset (self , count : int , columns : bool ) -> None : ...
166
+ def incorporate_line (self , ln : str ) -> None : ...
167
+ def finalize (self , block : Node , line_number : int ) -> None : ...
168
+ def process_inlines (self , block : Node ) -> None : ...
169
+ def parse (self , my_input : str ) -> Node : ...
166
170
167
- CAMEL_RE : Any
171
+ CAMEL_RE : Final [ re . Pattern [ str ]]
0 commit comments