Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd93fe5a

Browse files
authored
gh-104050: Argument clinic: misc improvements to type annotation coverage (#107206)
1 parent7608fa8 commitd93fe5a

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

‎Tools/clinic/clinic.py‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2640,7 +2640,7 @@ class LandMine:
26402640
# try to access any
26412641
__message__:str
26422642

2643-
def__getattribute__(self,name:str):
2643+
def__getattribute__(self,name:str)->Any:
26442644
ifnamein ('__repr__','__message__'):
26452645
returnsuper().__getattribute__(name)
26462646
# raise RuntimeError(repr(name))
@@ -3896,7 +3896,7 @@ def converter_init(self, *, accept: TypeSet = {buffer}) -> None:
38963896

38973897
self.format_unit=format_unit
38983898

3899-
defcleanup(self):
3899+
defcleanup(self)->str:
39003900
name=self.name
39013901
return"".join(["if (",name,".obj) {\n PyBuffer_Release(&",name,");\n}\n"])
39023902

@@ -4115,7 +4115,7 @@ def __init__(
41154115
self,
41164116
*,
41174117
py_default:str|None=None,
4118-
**kwargs
4118+
**kwargs:Any
41194119
)->None:
41204120
self.py_default=py_default
41214121
try:
@@ -4493,7 +4493,7 @@ def directive_destination(
44934493
self,
44944494
name:str,
44954495
command:str,
4496-
*args
4496+
*args:str
44974497
)->None:
44984498
matchcommand:
44994499
case"new":
@@ -4847,12 +4847,13 @@ def state_parameters_start(self, line: str | None) -> None:
48474847
returnself.next(self.state_parameter,line)
48484848

48494849

4850-
defto_required(self):
4850+
defto_required(self)->None:
48514851
"""
48524852
Transition to the "required" parameter state.
48534853
"""
48544854
ifself.parameter_stateisnotParamState.REQUIRED:
48554855
self.parameter_state=ParamState.REQUIRED
4856+
assertself.functionisnotNone
48564857
forpinself.function.parameters.values():
48574858
p.group=-p.group
48584859

@@ -5000,7 +5001,7 @@ def parse_parameter(self, line: str) -> None:
50005001
# of disallowed ast nodes.
50015002
classDetectBadNodes(ast.NodeVisitor):
50025003
bad=False
5003-
defbad_node(self,node):
5004+
defbad_node(self,node:ast.AST)->None:
50045005
self.bad=True
50055006

50065007
# inline function call
@@ -5248,7 +5249,9 @@ def state_parameter_docstring_start(self, line: str | None) -> None:
52485249
# every line of the docstring must start with at least F spaces,
52495250
# where F > P.
52505251
# these F spaces will be stripped.
5251-
defstate_parameter_docstring(self,line):
5252+
defstate_parameter_docstring(self,line:str|None)->None:
5253+
assertlineisnotNone
5254+
52525255
stripped=line.strip()
52535256
ifstripped.startswith('#'):
52545257
return
@@ -5263,7 +5266,7 @@ def state_parameter_docstring(self, line):
52635266
assertself.indent.depth==1
52645267
returnself.next(self.state_function_docstring,line)
52655268

5266-
assertself.function.parameters
5269+
assertself.functionandself.function.parameters
52675270
last_parameter=next(reversed(list(self.function.parameters.values())))
52685271

52695272
new_docstring=last_parameter.docstring
@@ -5276,7 +5279,10 @@ def state_parameter_docstring(self, line):
52765279
last_parameter.docstring=new_docstring
52775280

52785281
# the final stanza of the DSL is the docstring.
5279-
defstate_function_docstring(self,line):
5282+
defstate_function_docstring(self,line:str|None)->None:
5283+
assertself.functionisnotNone
5284+
assertlineisnotNone
5285+
52805286
ifself.group:
52815287
fail("Function "+self.function.name+" has a ] without a matching [.")
52825288

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp