# Buggy code
def __init__(self, master, base):
    self.master = master
    self.windows = dict(
        flowlist=flowlist.FlowListBox(master),
        flowview=flowview.FlowView(master),
        commands=commands.Commands(master),
        keybindings=keybindings.KeyBindings(master),
        options=options.Options(master),
        help=help.HelpView(master),
        eventlog=eventlog.EventLog(master),
        edit_focus_query=grideditor.QueryEditor(master),
        edit_focus_cookies=grideditor.CookieEditor(master),
        edit_focus_setcookies=grideditor.SetCookieEditor(master),
        edit_focus_form=grideditor.RequestFormEditor(master),
        edit_focus_path=grideditor.PathEditor(master),
        edit_focus_request_headers=grideditor.RequestHeaderEditor(master),
        edit_focus_response_headers=grideditor.ResponseHeaderEditor(master),
    )
    self.stack = [base]
    self.overlay = None


# Traceback (AttributeError)
Traceback (most recent call last):
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/master.py", line 216, in run
self.loop.run()
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 278, in run
self._run()
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 376, in _run
self.event_loop.run()
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 682, in run
self._loop()
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 719, in _loop
self._watch_files[fd]()
File "/home/user/venv/lib/python3.5/site-packages/urwid/raw_display.py", line 393, in <lambda>
event_loop, callback, self.get_available_raw_input())
File "/home/user/venv/lib/python3.5/site-packages/urwid/raw_display.py", line 493, in parse_input
callback(processed, processed_codes)
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 403, in _update
self.process_input(keys)
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 503, in process_input
k = self._topmost_widget.keypress(self.screen_size, k)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/window.py", line 303, in keypress
k
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/keymap.py", line 130, in handle
return self.executor(b.command)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/commandexecutor.py", line 17, in __call__
ret = self.master.commands.call(cmd)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/command.py", line 221, in call
return self.call_args(parts[0], parts[1:])
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/command.py", line 212, in call_args
return self.commands[path].call(args)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/command.py", line 101, in call
ret = self.func(*pargs)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/command.py", line 251, in wrapper
return function(*args, **kwargs)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/consoleaddons.py", line 174, in nav_select
self.master.inject_key("m_select")
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/master.py", line 181, in inject_key
self.loop.process_input([key])
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 503, in process_input
k = self._topmost_widget.keypress(self.screen_size, k)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/window.py", line 299, in keypress
k = super().keypress(size, k)
File "/home/user/venv/lib/python3.5/site-packages/urwid/container.py", line 1128, in keypress
return self.body.keypress( (maxcol, remaining), key )
File "/home/user/venv/lib/python3.5/site-packages/urwid/container.py", line 2269, in keypress
key = w.keypress((mc,) + size[1:], key)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/window.py", line 36, in keypress
ret = super().keypress(size, key)
File "/home/user/venv/lib/python3.5/site-packages/urwid/container.py", line 1128, in keypress
return self.body.keypress( (maxcol, remaining), key )
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/grideditor/base.py", line 356, in keypress
elif column.keypress(key, self) and not self.handle_key(key):
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/grideditor/col_subgrid.py", line 30, in keypress
editor.master.view_grideditor(
AttributeError: 'ConsoleMaster' object has no attribute 'view_grideditor'

# Fixed code
def __init__(self, master, base):
    self.master = master
    self.windows = dict(
        flowlist=flowlist.FlowListBox(master),
        flowview=flowview.FlowView(master),
        commands=commands.Commands(master),
        keybindings=keybindings.KeyBindings(master),
        options=options.Options(master),
        help=help.HelpView(master),
        eventlog=eventlog.EventLog(master),
        edit_focus_query=grideditor.QueryEditor(master),
        edit_focus_cookies=grideditor.CookieEditor(master),
        edit_focus_setcookies=grideditor.SetCookieEditor(master),
        edit_focus_setcookie_attrs=grideditor.CookieAttributeEditor(master),
        edit_focus_form=grideditor.RequestFormEditor(master),
        edit_focus_path=grideditor.PathEditor(master),
        edit_focus_request_headers=grideditor.RequestHeaderEditor(master),
        edit_focus_response_headers=grideditor.ResponseHeaderEditor(master),
    )
    self.stack = [base]
    self.overlay = None