# Buggy code
def visit_symbol_table(self, symtab: SymbolTable) -> None:
    # Copy the items because we may mutate symtab.
    for key, value in list(symtab.items()):
        cross_ref = value.cross_ref
        if cross_ref is not None:  # Fix up cross-reference.
            del value.cross_ref
            if cross_ref in self.modules:
                value.node = self.modules[cross_ref]
            else:
                stnode = lookup_qualified_stnode(
                    self.modules, cross_ref, self.quick_and_dirty
                )
                if stnode is not None:
                    value.node = stnode.node
                    value.type_override = stnode.type_override
                elif not self.quick_and_dirty:
                    assert stnode is not None, "Could not find cross-ref %s" % (
                        cross_ref,
                    )
                else:
                    # We have a missing crossref in quick mode, need to put something
                    value.node = stale_info()
                    if value.type_override is not None:
                        value.type_override.accept(self.type_fixer)
        else:
            if isinstance(value.node, TypeInfo):
                # TypeInfo has no accept().  TODO: Add it?
                self.visit_type_info(value.node)
            elif value.node is not None:
                value.node.accept(self)
            if value.type_override is not None:
                value.type_override.accept(self.type_fixer)


# Traceback (AssertionError)
build_number/__init__.py:31: error: Module 'build_number._frozen_version' has no attribute 'DROPBOXEXT_VERSION'
build_number/__init__.py:102: error: "DesktopClientBuildNumber" has no attribute "name"
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/Cellar/python3/3.6.1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/__main__.py", line 5, in <module>
main(None)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/main.py", line 46, in main
res = type_check_only(sources, bin_dir, options)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/main.py", line 93, in type_check_only
options=options)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/build.py", line 188, in build
graph = dispatch(sources, manager)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/build.py", line 1595, in dispatch
process_graph(graph, manager)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/build.py", line 1838, in process_graph
process_stale_scc(graph, scc, manager)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/build.py", line 1931, in process_stale_scc
graph[id].semantic_analysis()
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/build.py", line 1495, in semantic_analysis
self.manager.semantic_analyzer.visit_file(self.tree, self.xpath, self.options)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/semanal.py", line 257, in visit_file
self.accept(d)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/semanal.py", line 3288, in accept
node.accept(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/nodes.py", line 749, in accept
return visitor.visit_class_def(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/semanal.py", line 620, in visit_class_def
defn.defs.accept(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/nodes.py", line 810, in accept
return visitor.visit_block(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/semanal.py", line 1375, in visit_block
self.accept(s)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/semanal.py", line 3288, in accept
node.accept(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/nodes.py", line 631, in accept
return visitor.visit_decorator(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/semanal.py", line 2470, in visit_decorator
dec.func.accept(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/nodes.py", line 564, in accept
return visitor.visit_func_def(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/semanal.py", line 376, in visit_func_def
self.analyze_function(defn)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/semanal.py", line 550, in analyze_function
defn.type = self.type_analyzer().visit_callable_type(defn.type, nested=False)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/typeanal.py", line 343, in visit_callable_type
ret_type=self.anal_type(t.ret_type, nested=nested),
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/typeanal.py", line 521, in anal_type
return t.accept(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/types.py", line 211, in accept
return visitor.visit_unbound_type(self)
File "/Users/---/src/desktop-client/.mypy/venv/lib/python3.6/site-packages/mypy/typeanal.py", line 210, in visit_unbound_type
assert override is not None
AssertionError:

# Fixed code
def visit_symbol_table(self, symtab: SymbolTable) -> None:
    # Copy the items because we may mutate symtab.
    for key, value in list(symtab.items()):
        cross_ref = value.cross_ref
        if cross_ref is not None:  # Fix up cross-reference.
            del value.cross_ref
            if cross_ref in self.modules:
                value.node = self.modules[cross_ref]
            else:
                stnode = lookup_qualified_stnode(
                    self.modules, cross_ref, self.quick_and_dirty
                )
                if stnode is not None:
                    value.node = stnode.node
                    value.type_override = stnode.type_override
                elif not self.quick_and_dirty:
                    assert stnode is not None, "Could not find cross-ref %s" % (
                        cross_ref,
                    )
                else:
                    # We have a missing crossref in quick mode, need to put something
                    value.node = stale_info()
                    if value.kind == TYPE_ALIAS:
                        value.type_override = Instance(stale_info(), [])
        else:
            if isinstance(value.node, TypeInfo):
                # TypeInfo has no accept().  TODO: Add it?
                self.visit_type_info(value.node)
            elif value.node is not None:
                value.node.accept(self)
            if value.type_override is not None:
                value.type_override.accept(self.type_fixer)