summaryrefslogtreecommitdiff
path: root/pylint/checkers/typecheck.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/typecheck.py')
-rw-r--r--pylint/checkers/typecheck.py31
1 files changed, 3 insertions, 28 deletions
diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py
index f2518beae..d97f352f6 100644
--- a/pylint/checkers/typecheck.py
+++ b/pylint/checkers/typecheck.py
@@ -6,7 +6,6 @@
from __future__ import annotations
-import fnmatch
import heapq
import itertools
import operator
@@ -14,7 +13,6 @@ import re
import shlex
import sys
import types
-from collections import deque
from collections.abc import Callable, Iterator, Sequence
from functools import singledispatch
from re import Pattern
@@ -36,6 +34,7 @@ from pylint.checkers.utils import (
is_inside_abstract_class,
is_iterable,
is_mapping,
+ is_module_ignored,
is_node_in_type_annotation_context,
is_overload_stub,
is_postponed_evaluation_enabled,
@@ -116,32 +115,8 @@ def _is_owner_ignored(owner, attrname, ignored_classes, ignored_modules):
matches any name from the *ignored_classes* or if its qualified
name can be found in *ignored_classes*.
"""
- ignored_modules = set(ignored_modules)
- module_name = owner.root().name
- module_qname = owner.root().qname()
-
- for ignore in ignored_modules:
- # Try to match the module name / fully qualified name directly
- if module_qname in ignored_modules or module_name in ignored_modules:
- return True
-
- # Try to see if the ignores pattern match against the module name.
- if fnmatch.fnmatch(module_qname, ignore):
- return True
-
- # Otherwise, we might have a root module name being ignored,
- # and the qualified owner has more levels of depth.
- parts = deque(module_name.split("."))
- current_module = ""
-
- while parts:
- part = parts.popleft()
- if not current_module:
- current_module = part
- else:
- current_module += f".{part}"
- if current_module in ignored_modules:
- return True
+ if is_module_ignored(owner.root(), ignored_modules):
+ return True
# Match against ignored classes.
ignored_classes = set(ignored_classes)