File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed
Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change 44from collections .abc import Iterable
55import itertools
66import re
7+ import sys
78from typing import Any , NamedTuple
89
910import astroid
1011import astroid .nodes
1112
1213
14+ if sys .version_info < (3 , 10 ): # PY310
15+ from stdlib_list import in_stdlib
16+ else :
17+
18+ def in_stdlib (module_name : str ) -> bool :
19+ return module_name in sys .stdlib_module_names
20+
21+
1322class ArgInfo (NamedTuple ):
1423 prefix : str | None
1524 name : str | None
@@ -649,12 +658,11 @@ def get_func_docstring(node: astroid.nodes.FunctionDef) -> str:
649658
650659 if not doc and isinstance (node .parent , astroid .nodes .ClassDef ):
651660 for base in node .parent .ancestors ():
652- if node .name in ("__init__" , "__new__" ) and base .qname () in (
653- "__builtins__.object" ,
654- "builtins.object" ,
655- "builtins.type" ,
656- ):
657- continue
661+ if node .name in ("__init__" , "__new__" ):
662+ base_module = base .qname ().split ("." , 1 )[0 ]
663+ if in_stdlib (base_module ):
664+ continue
665+
658666 for child in base .get_children ():
659667 if (
660668 isinstance (child , node .__class__ )
You can’t perform that action at this time.
0 commit comments