@@ -565,7 +565,7 @@ def _get_func_args(self, o: FuncDef, ctx: FunctionContext) -> list[ArgSig]:
565565 default = "..."
566566 if arg_ .initializer :
567567 if not typename :
568- typename = self .get_str_type_of_node (arg_ .initializer , True , False )
568+ typename = self .get_str_type_of_node (arg_ .initializer , can_be_incomplete = False )
569569 potential_default , valid = self .get_str_default_of_node (arg_ .initializer )
570570 if valid and len (potential_default ) <= 200 :
571571 default = potential_default
@@ -1305,9 +1305,7 @@ def is_private_member(self, fullname: str) -> bool:
13051305 parts = fullname .split ("." )
13061306 return any (self .is_private_name (part ) for part in parts )
13071307
1308- def get_str_type_of_node (
1309- self , rvalue : Expression , can_infer_optional : bool = False , can_be_any : bool = True
1310- ) -> str :
1308+ def get_str_type_of_node (self , rvalue : Expression , * , can_be_incomplete : bool = True ) -> str :
13111309 rvalue = self .maybe_unwrap_unary_expr (rvalue )
13121310
13131311 if isinstance (rvalue , IntExpr ):
@@ -1327,9 +1325,7 @@ def get_str_type_of_node(
13271325 return "complex"
13281326 if isinstance (rvalue , NameExpr ) and rvalue .name in ("True" , "False" ):
13291327 return "bool"
1330- if can_infer_optional and isinstance (rvalue , NameExpr ) and rvalue .name == "None" :
1331- return f"{ self .add_name ('_typeshed.Incomplete' )} | None"
1332- if can_be_any :
1328+ if can_be_incomplete :
13331329 return self .add_name ("_typeshed.Incomplete" )
13341330 else :
13351331 return ""
0 commit comments