# Buggy code
def visit_classdef(self, node):
    """visit an astroid.Class node

    * set the locals_type and instance_attrs_type mappings
    * set the implements list and build it
    * optionally tag the node with a unique id
    """
    if hasattr(node, "locals_type"):
        return
    node.locals_type = collections.defaultdict(list)
    if self.tag:
        node.uid = self.generate_id()
    # resolve ancestors
    for baseobj in node.ancestors(recurs=False):
        specializations = getattr(baseobj, "specializations", [])
        specializations.append(node)
        baseobj.specializations = specializations
    # resolve instance attributes
    node.instance_attrs_type = collections.defaultdict(list)
    for assignattrs in node.instance_attrs.values():
        for assignattr in assignattrs:
            self.handle_assignattr_type(assignattr, node)
    # resolve implemented interface
    try:
        node.implements = list(interfaces(node, self.inherited_interfaces))
    except astroid.InferenceError:
        node.implements = ()


# Traceback (AttributeError)
parsing tests/test_simple.py...
Traceback (most recent call last):
File "/home/enkidulan/.cache/pypoetry/virtualenvs/pylintdev-py3.7/bin/pyreverse", line 7, in <module>
exec(compile(f.read(), __file__, 'exec'))
File "/home/enkidulan/projects/pylint/pylint/bin/pyreverse", line 4, in <module>
run_pyreverse()
File "/home/enkidulan/projects/pylint/pylint/pylint/__init__.py", line 37, in run_pyreverse
PyreverseRun(sys.argv[1:])
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/main.py", line 184, in __init__
sys.exit(self.run(args))
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/main.py", line 202, in run
diadefs = handler.get_diadefs(project, linker)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/diadefslib.py", line 235, in get_diadefs
diagrams = DefaultDiadefGenerator(linker, self).visit(project)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/utils.py", line 217, in visit
self.visit(local_node)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/utils.py", line 217, in visit
self.visit(local_node)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/utils.py", line 214, in visit
methods[0](node)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/diadefslib.py", line 169, in visit_classdef
self.extract_classes(node, anc_level, association_level)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/diadefslib.py", line 113, in extract_classes
self.add_class(klass_node)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/diadefslib.py", line 83, in add_class
self.linker.visit(node)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/utils.py", line 214, in visit
methods[0](node)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/inspector.py", line 166, in visit_classdef
self.handle_assignattr_type(assignattr, node)
File "/home/enkidulan/projects/pylint/pylint/pylint/pyreverse/inspector.py", line 232, in handle_assignattr_type
current = set(parent.instance_attrs_type[node.attrname])
AttributeError: 'Unknown' object has no attribute 'attrname'

# Fixed code
def visit_classdef(self, node):
    """visit an astroid.Class node

    * set the locals_type and instance_attrs_type mappings
    * set the implements list and build it
    * optionally tag the node with a unique id
    """
    if hasattr(node, "locals_type"):
        return
    node.locals_type = collections.defaultdict(list)
    if self.tag:
        node.uid = self.generate_id()
    # resolve ancestors
    for baseobj in node.ancestors(recurs=False):
        specializations = getattr(baseobj, "specializations", [])
        specializations.append(node)
        baseobj.specializations = specializations
    # resolve instance attributes
    node.instance_attrs_type = collections.defaultdict(list)
    for assignattrs in node.instance_attrs.values():
        for assignattr in assignattrs:
            if not isinstance(assignattr, astroid.Unknown):
                self.handle_assignattr_type(assignattr, node)
    # resolve implemented interface
    try:
        node.implements = list(interfaces(node, self.inherited_interfaces))
    except astroid.InferenceError:
        node.implements = ()