diff options
-rw-r--r-- | pylint/checkers/utils.py | 2 | ||||
-rw-r--r-- | pylint/extensions/private_import.py | 8 |
2 files changed, 6 insertions, 4 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 38100e135..383550415 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -701,7 +701,7 @@ def get_argument_from_call( raise NoSuchArgumentError -def inherit_from_std_ex(node: nodes.NodeNG) -> bool: +def inherit_from_std_ex(node: nodes.NodeNG | astroid.Instance) -> bool: """Return whether the given class node is subclass of exceptions.Exception. """ 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 |