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 4
4
from collections .abc import Iterable
5
5
import itertools
6
6
import re
7
+ import sys
7
8
from typing import Any , NamedTuple
8
9
9
10
import astroid
10
11
import astroid .nodes
11
12
12
13
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
+
13
22
class ArgInfo (NamedTuple ):
14
23
prefix : str | None
15
24
name : str | None
@@ -649,12 +658,11 @@ def get_func_docstring(node: astroid.nodes.FunctionDef) -> str:
649
658
650
659
if not doc and isinstance (node .parent , astroid .nodes .ClassDef ):
651
660
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
+
658
666
for child in base .get_children ():
659
667
if (
660
668
isinstance (child , node .__class__ )
You can’t perform that action at this time.
0 commit comments