Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pylint/checkers/design_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
DATACLASS_IMPORT = "dataclasses"
TYPING_NAMEDTUPLE = "typing.NamedTuple"
TYPING_TYPEDDICT = "typing.TypedDict"
TYPING_EXTENSIONS_TYPEDDICT = "typing_extensions.TypedDict"

# Set of stdlib classes to ignore when calculating number of ancestors
STDLIB_CLASSES_IGNORE_ANCESTOR = frozenset(
Expand Down Expand Up @@ -168,6 +169,7 @@
"typing.Sized",
TYPING_NAMEDTUPLE,
TYPING_TYPEDDICT,
TYPING_EXTENSIONS_TYPEDDICT,
)
)

Expand All @@ -179,7 +181,11 @@ def _is_exempt_from_public_methods(node: astroid.ClassDef) -> bool:
for ancestor in node.ancestors():
if is_enum(ancestor):
return True
if ancestor.qname() in (TYPING_NAMEDTUPLE, TYPING_TYPEDDICT):
if ancestor.qname() in (
TYPING_NAMEDTUPLE,
TYPING_TYPEDDICT,
TYPING_EXTENSIONS_TYPEDDICT,
):
return True

# Or if it's a dataclass
Expand Down