summaryrefslogtreecommitdiff
path: root/pylint/extensions
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2022-04-21 23:06:31 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2022-04-22 00:12:47 +0200
commit8bab34e23c88057753bc251373467c47a6c66ba7 (patch)
tree466effe8cb17e3a922c9bb0d2236f2a04a9b7596 /pylint/extensions
parentc9c75177bcdbe4f9c59d7a95a57d13a623a85b47 (diff)
downloadpylint-git-8bab34e23c88057753bc251373467c47a6c66ba7.tar.gz
[typing] Add missing type in the private import checker
Diffstat (limited to 'pylint/extensions')
-rw-r--r--pylint/extensions/private_import.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pylint/extensions/private_import.py b/pylint/extensions/private_import.py
index 75d305ed4..3fb36f27b 100644
--- a/pylint/extensions/private_import.py
+++ b/pylint/extensions/private_import.py
@@ -112,7 +112,7 @@ class PrivateImportChecker(BaseChecker):
)
def _get_type_annotation_names(
- self, node: nodes.Import, names: list[str]
+ self, node: nodes.Import | nodes.ImportFrom, names: list[str]
) -> list[str]:
"""Removes from names any names that are used as type annotations with no other illegal usages."""
if names and not self.populated_annotations:
@@ -185,7 +185,7 @@ class PrivateImportChecker(BaseChecker):
def _populate_type_annotations_annotation(
self,
- node: nodes.Attribute | nodes.Subscript | nodes.Name,
+ node: nodes.Attribute | nodes.Subscript | nodes.Name | None,
all_used_type_annotations: dict[str, bool],
) -> str | None:
"""Handles the possiblity of an annotation either being a Name, i.e. just type,
@@ -240,7 +240,9 @@ class PrivateImportChecker(BaseChecker):
return True
@staticmethod
- def same_root_dir(node: nodes.Import, import_mod_name: str) -> bool:
+ def same_root_dir(
+ node: nodes.Import | nodes.ImportFrom, import_mod_name: str
+ ) -> bool:
"""Does the node's file's path contain the base name of `import_mod_name`?"""
if not import_mod_name: # from . import ...
return True