1
1
import abc
2
- from typing import Self , TypeVar
2
+ from typing import Literal , Self , TypeVar
3
3
4
4
from docutils import nodes
5
5
@@ -20,7 +20,7 @@ def append_child(self, item: nodes.Node) -> None:
20
20
class UniqueElementNode (NodeBase ):
21
21
# pylint: disable=W1113
22
22
def __init__ (self , rawsource : str = "" , * children : nodes .Node ,
23
- ** attributes : dict ) -> None :
23
+ ** attributes : str ) -> None :
24
24
super ().__init__ (rawsource , * children , ** attributes )
25
25
26
26
self .elements = {}
@@ -127,7 +127,7 @@ class DataNode(UniqueElementNode, nodes.Part):
127
127
@classmethod
128
128
def create_template (
129
129
cls , rawsource : str = "" ,
130
- * children : nodes .Node , ** attributes : dict ) -> Self :
130
+ * children : nodes .Node , ** attributes : str ) -> Self :
131
131
node = cls (rawsource , * children , ** attributes )
132
132
133
133
node .append_child (NameNode ())
@@ -145,7 +145,7 @@ class AttributeNode(DataNode):
145
145
@classmethod
146
146
def create_template (
147
147
cls , rawsource : str = "" ,
148
- * children : nodes .Node , ** attributes : dict ) -> Self :
148
+ * children : nodes .Node , ** attributes : str ) -> Self :
149
149
node = cls (rawsource , * children , ** attributes )
150
150
151
151
node .append_child (NameNode ())
@@ -171,12 +171,13 @@ class ArgumentListNode(ListNode):
171
171
class ArgumentNode (UniqueElementNode , nodes .Part ):
172
172
tagname = "argument"
173
173
child_text_separator = ""
174
+ ArgumentType = Literal ["posonlyarg" , "arg" , "vararg" , "kwonlyarg" , "kwarg" ]
174
175
175
176
# pylint: disable=W1113
176
177
@classmethod
177
178
def create_template (
178
179
cls , rawsource : str = "" ,
179
- * children : nodes .Node , ** attributes : dict ) -> Self :
180
+ * children : nodes .Node , ** attributes : str ) -> Self :
180
181
node = cls (rawsource , * children , ** attributes )
181
182
182
183
node .append_child (NameNode ())
@@ -195,7 +196,7 @@ class FunctionReturnNode(UniqueElementNode, nodes.Part):
195
196
@classmethod
196
197
def create_template (
197
198
cls , rawsource : str = "" ,
198
- * children : nodes .Node , ** attributes : dict ) -> Self :
199
+ * children : nodes .Node , ** attributes : str ) -> Self :
199
200
node = cls (rawsource , * children , ** attributes )
200
201
201
202
node .append_child (DescriptionNode ())
@@ -215,7 +216,7 @@ class FunctionNode(UniqueElementNode, nodes.Part):
215
216
@classmethod
216
217
def create_template (
217
218
cls , rawsource : str = "" ,
218
- * children : nodes .Node , ** attributes : dict ) -> Self :
219
+ * children : nodes .Node , ** attributes : str ) -> Self :
219
220
node = cls (rawsource , * children , ** attributes )
220
221
221
222
node .append_child (NameNode ())
@@ -239,7 +240,7 @@ class BaseClassNode(UniqueElementNode, nodes.Part):
239
240
@classmethod
240
241
def create_template (
241
242
cls , rawsource : str = "" ,
242
- * children : nodes .Node , ** attributes : dict ) -> Self :
243
+ * children : nodes .Node , ** attributes : str ) -> Self :
243
244
node = cls (rawsource , * children , ** attributes )
244
245
245
246
node .append_child (DataTypeListNode ())
@@ -255,7 +256,7 @@ class ClassNode(UniqueElementNode, nodes.Part):
255
256
@classmethod
256
257
def create_template (
257
258
cls , rawsource : str = "" ,
258
- * children : nodes .Node , ** attributes : dict ) -> Self :
259
+ * children : nodes .Node , ** attributes : str ) -> Self :
259
260
node = cls (rawsource , * children , ** attributes )
260
261
261
262
node .append_child (NameNode ())
@@ -275,7 +276,7 @@ class ModuleNode(UniqueElementNode, nodes.Part):
275
276
@classmethod
276
277
def create_template (
277
278
cls , rawsource : str = "" ,
278
- * children : nodes .Node , ** attributes : dict ) -> Self :
279
+ * children : nodes .Node , ** attributes : str ) -> Self :
279
280
node = cls (rawsource , * children , ** attributes )
280
281
281
282
node .append_child (NameNode ())
@@ -297,7 +298,7 @@ class EnumItemNode(UniqueElementNode, nodes.Part):
297
298
@classmethod
298
299
def create_template (
299
300
cls , rawsource : str = "" ,
300
- * children : nodes .Node , ** attributes : dict ) -> Self :
301
+ * children : nodes .Node , ** attributes : str ) -> Self :
301
302
node = cls (rawsource , * children , ** attributes )
302
303
303
304
node .append_child (NameNode ())
@@ -319,7 +320,7 @@ class EnumNode(UniqueElementNode, nodes.Part):
319
320
@classmethod
320
321
def create_template (
321
322
cls , rawsource : str = "" ,
322
- * children : nodes .Node , ** attributes : dict ) -> Self :
323
+ * children : nodes .Node , ** attributes : str ) -> Self :
323
324
node = cls (rawsource , * children , ** attributes )
324
325
325
326
node .append_child (NameNode ())
0 commit comments