diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py index 7eb35be0b5..22eb9b3b33 100644 --- a/pylint/checkers/base.py +++ b/pylint/checkers/base.py @@ -317,11 +317,10 @@ def _get_properties(config): return property_classes, property_names -def _determine_function_name_type(node, config=None): +def _determine_function_name_type(node: astroid.FunctionDef, config=None): """Determine the name type whose regex the a function's name should match. :param node: A function node. - :type node: astroid.node_classes.NodeNG :param config: Configuration from which to pull additional property classes. :type config: :class:`optparse.Values` @@ -349,7 +348,11 @@ def _determine_function_name_type(node, config=None): and decorator.attrname in property_names ): inferred = utils.safe_infer(decorator) - if inferred and inferred.qname() in property_classes: + if ( + inferred + and hasattr(inferred, "qname") + and inferred.qname() in property_classes + ): return "attr" return "method" diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 4f62f18675..af5a0d4e38 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -791,7 +791,7 @@ def _check_proper_bases(self, node): """ for base in node.bases: ancestor = safe_infer(base) - if ancestor in (astroid.Uninferable, None): + if not ancestor: continue if isinstance(ancestor, astroid.Instance) and ancestor.is_subtype_of( "%s.type" % (BUILTINS,) diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index ea67814d7b..e7c1339330 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -776,7 +776,7 @@ def decorated_with( @lru_cache(maxsize=1024) def unimplemented_abstract_methods( - node: astroid.node_classes.NodeNG, is_abstract_cb: astroid.FunctionDef = None + node: astroid.ClassDef, is_abstract_cb: astroid.FunctionDef = None ) -> Dict[str, astroid.node_classes.NodeNG]: """ Get the unimplemented abstract methods for the given *node*.