@@ -2640,7 +2640,7 @@ class LandMine:
2640
2640
# try to access any
2641
2641
__message__ : str
2642
2642
2643
- def __getattribute__ (self , name : str ):
2643
+ def __getattribute__ (self , name : str ) -> Any :
2644
2644
if name in ('__repr__' , '__message__' ):
2645
2645
return super ().__getattribute__ (name )
2646
2646
# raise RuntimeError(repr(name))
@@ -3896,7 +3896,7 @@ def converter_init(self, *, accept: TypeSet = {buffer}) -> None:
3896
3896
3897
3897
self .format_unit = format_unit
3898
3898
3899
- def cleanup (self ):
3899
+ def cleanup (self ) -> str :
3900
3900
name = self .name
3901
3901
return "" .join (["if (" , name , ".obj) {\n PyBuffer_Release(&" , name , ");\n }\n " ])
3902
3902
@@ -4115,7 +4115,7 @@ def __init__(
4115
4115
self ,
4116
4116
* ,
4117
4117
py_default : str | None = None ,
4118
- ** kwargs
4118
+ ** kwargs : Any
4119
4119
) -> None :
4120
4120
self .py_default = py_default
4121
4121
try :
@@ -4493,7 +4493,7 @@ def directive_destination(
4493
4493
self ,
4494
4494
name : str ,
4495
4495
command : str ,
4496
- * args
4496
+ * args : str
4497
4497
) -> None :
4498
4498
match command :
4499
4499
case "new" :
@@ -4847,12 +4847,13 @@ def state_parameters_start(self, line: str | None) -> None:
4847
4847
return self .next (self .state_parameter , line )
4848
4848
4849
4849
4850
- def to_required (self ):
4850
+ def to_required (self ) -> None :
4851
4851
"""
4852
4852
Transition to the "required" parameter state.
4853
4853
"""
4854
4854
if self .parameter_state is not ParamState .REQUIRED :
4855
4855
self .parameter_state = ParamState .REQUIRED
4856
+ assert self .function is not None
4856
4857
for p in self .function .parameters .values ():
4857
4858
p .group = - p .group
4858
4859
@@ -5000,7 +5001,7 @@ def parse_parameter(self, line: str) -> None:
5000
5001
# of disallowed ast nodes.
5001
5002
class DetectBadNodes (ast .NodeVisitor ):
5002
5003
bad = False
5003
- def bad_node (self , node ) :
5004
+ def bad_node (self , node : ast . AST ) -> None :
5004
5005
self .bad = True
5005
5006
5006
5007
# inline function call
@@ -5248,7 +5249,9 @@ def state_parameter_docstring_start(self, line: str | None) -> None:
5248
5249
# every line of the docstring must start with at least F spaces,
5249
5250
# where F > P.
5250
5251
# these F spaces will be stripped.
5251
- def state_parameter_docstring (self , line ):
5252
+ def state_parameter_docstring (self , line : str | None ) -> None :
5253
+ assert line is not None
5254
+
5252
5255
stripped = line .strip ()
5253
5256
if stripped .startswith ('#' ):
5254
5257
return
@@ -5263,7 +5266,7 @@ def state_parameter_docstring(self, line):
5263
5266
assert self .indent .depth == 1
5264
5267
return self .next (self .state_function_docstring , line )
5265
5268
5266
- assert self .function .parameters
5269
+ assert self .function and self . function .parameters
5267
5270
last_parameter = next (reversed (list (self .function .parameters .values ())))
5268
5271
5269
5272
new_docstring = last_parameter .docstring
@@ -5276,7 +5279,10 @@ def state_parameter_docstring(self, line):
5276
5279
last_parameter .docstring = new_docstring
5277
5280
5278
5281
# the final stanza of the DSL is the docstring.
5279
- def state_function_docstring (self , line ):
5282
+ def state_function_docstring (self , line : str | None ) -> None :
5283
+ assert self .function is not None
5284
+ assert line is not None
5285
+
5280
5286
if self .group :
5281
5287
fail ("Function " + self .function .name + " has a ] without a matching [." )
5282
5288
0 commit comments