prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  AttributeError: 'BaseShell' object has no attribute 'cmdloop'
  My installed xonsh (from [AUR](https://aur.archlinux.org/packages/xonsh/)) suddenly broke?
  
  ``` console
  $ xonsh
  The most exciting phrase to hear in science, the one that heralds new
  discoveries, is not "Eureka!" (I found it!) but "That's funny ..."
          -- Isaac Asimov
  Traceback (most recent call last):
    File "/bin/xonsh", line 3, in <module>
      main()
    File "/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py", line 16531, in main
      shell.shell.cmdloop()
  AttributeError: 'BaseShell' object has no attribute 'cmdloop'
  $ xonsh --version
  ('xonsh/0.4.4',)
  $ XONSH_DEBUG=1 xonsh
  Today is the first day of the rest of your lossage.
  Traceback (most recent call last):
    File "/bin/xonsh", line 3, in <module>
      main()
    File "/usr/lib/python3.5/site-packages/xonsh/main.py", line 222, in main
      shell.shell.cmdloop()
  AttributeError: 'BaseShell' object has no attribute 'cmdloop'
  ```
  
  (Ignore the output of `fortune`.)
  
  
  </issue>
  <code>
  [start of xonsh/shell.py]
  1 # -*- coding: utf-8 -*-
  2 """The xonsh shell"""
  3 import os
  4 import random
  5 import builtins
  6 import warnings
  7 
  8 from xonsh.xontribs import update_context
  9 from xonsh.environ import xonshrc_context
  10 from xonsh.execer import Execer
  11 from xonsh.platform import (best_shell_type, has_prompt_toolkit,
  12                             ptk_version_is_supported)
  13 from xonsh.tools import XonshError, to_bool_or_int
  14 
  15 
  16 class Shell(object):
  17     """Main xonsh shell.
  18 
  19     Initializes execution environment and decides if prompt_toolkit or
  20     readline version of shell should be used.
  21     """
  22 
  23     def __init__(self, ctx=None, shell_type=None, config=None, rc=None,
  24                  **kwargs):
  25         """
  26         Parameters
  27         ----------
  28         ctx : Mapping, optional
  29             The execution context for the shell (e.g. the globals namespace).
  30             If none, this is computed by loading the rc files. If not None,
  31             this no additional context is computed and this is used
  32             directly.
  33         shell_type : str, optional
  34             The shell type to start, such as 'readline', 'prompt_toolkit',
  35             or 'random'.
  36         config : str, optional
  37             Path to configuration file.
  38         rc : list of str, optional
  39             Sequence of paths to run control files.
  40         """
  41         self.login = kwargs.get('login', True)
  42         self.stype = shell_type
  43         self._init_environ(ctx, config, rc,
  44                            kwargs.get('scriptcache', True),
  45                            kwargs.get('cacheall', False))
  46         env = builtins.__xonsh_env__
  47         # pick a valid shell -- if no shell is specified by the user,
  48         # shell type is pulled from env
  49         if shell_type is None:
  50             shell_type = env.get('SHELL_TYPE')
  51         if shell_type == 'best' or shell_type is None:
  52             shell_type = best_shell_type()
  53         elif shell_type == 'random':
  54             shell_type = random.choice(('readline', 'prompt_toolkit'))
  55         if shell_type == 'prompt_toolkit':
  56             if not has_prompt_toolkit():
  57                 warnings.warn('prompt_toolkit is not available, using '
  58                               'readline instead.')
  59                 shell_type = 'readline'
  60             elif not ptk_version_is_supported():
  61                 warnings.warn('prompt-toolkit version < v1.0.0 is not '
  62                               'supported. Please update prompt-toolkit. Using '
  63                               'readline instead.')
  64                 shell_type = 'readline'
  65         env['SHELL_TYPE'] = shell_type
  66         # actually make the shell
  67         if shell_type == 'none':
  68             from xonsh.base_shell import BaseShell as shell_class
  69         elif shell_type == 'prompt_toolkit':
  70             from xonsh.ptk.shell import PromptToolkitShell as shell_class
  71         elif shell_type == 'readline':
  72             from xonsh.readline_shell import ReadlineShell as shell_class
  73         else:
  74             raise XonshError('{} is not recognized as a shell type'.format(
  75                              shell_type))
  76         self.shell = shell_class(execer=self.execer,
  77                                  ctx=self.ctx, **kwargs)
  78         # allows history garbace colector to start running
  79         builtins.__xonsh_history__.gc.wait_for_shell = False
  80 
  81     def __getattr__(self, attr):
  82         """Delegates calls to appropriate shell instance."""
  83         return getattr(self.shell, attr)
  84 
  85     def _init_environ(self, ctx, config, rc, scriptcache, cacheall):
  86         self.ctx = {} if ctx is None else ctx
  87         debug = to_bool_or_int(os.getenv('XONSH_DEBUG', '0'))
  88         self.execer = Execer(config=config, login=self.login, xonsh_ctx=self.ctx,
  89                              debug_level=debug)
  90         self.execer.scriptcache = scriptcache
  91         self.execer.cacheall = cacheall
  92         if self.stype != 'none' or self.login:
  93             # load xontribs from config file
  94             names = builtins.__xonsh_config__.get('xontribs', ())
  95             for name in names:
  96                 update_context(name, ctx=self.ctx)
  97             # load run control files
  98             env = builtins.__xonsh_env__
  99             rc = env.get('XONSHRC') if rc is None else rc
  100             self.ctx.update(xonshrc_context(rcfiles=rc, execer=self.execer, initial=self.ctx))
  101         self.ctx['__name__'] = '__main__'
  102
  [end of xonsh/shell.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/xonsh/shell.py b/xonsh/shell.py
  --- a/xonsh/shell.py
  +++ b/xonsh/shell.py
  @@ -48,6 +48,10 @@
           # shell type is pulled from env
           if shell_type is None:
               shell_type = env.get('SHELL_TYPE')
  +            if shell_type == 'none':
  +                # This bricks interactive xonsh
  +                # Can happen from the use of .xinitrc, .xsession, etc
  +                shell_type = 'best'
           if shell_type == 'best' or shell_type is None:
               shell_type = best_shell_type()
           elif shell_type == 'random':
  
verification_info: {"golden_diff": "diff --git a/xonsh/shell.py b/xonsh/shell.py\n--- a/xonsh/shell.py\n+++ b/xonsh/shell.py\n@@ -48,6 +48,10 @@\n         # shell type is pulled from env\n         if shell_type is None:\n             shell_type = env.get('SHELL_TYPE')\n+            if shell_type == 'none':\n+                # This bricks interactive xonsh\n+                # Can happen from the use of .xinitrc, .xsession, etc\n+                shell_type = 'best'\n         if shell_type == 'best' or shell_type is None:\n             shell_type = best_shell_type()\n         elif shell_type == 'random':\n", "issue": "AttributeError: 'BaseShell' object has no attribute 'cmdloop'\nMy installed xonsh (from [AUR](https://aur.archlinux.org/packages/xonsh/)) suddenly broke?\n\n``` console\n$ xonsh\nThe most exciting phrase to hear in science, the one that heralds new\ndiscoveries, is not \"Eureka!\" (I found it!) but \"That's funny ...\"\n        -- Isaac Asimov\nTraceback (most recent call last):\n  File \"/bin/xonsh\", line 3, in <module>\n    main()\n  File \"/usr/lib/python3.5/site-packages/xonsh/__amalgam__.py\", line 16531, in main\n    shell.shell.cmdloop()\nAttributeError: 'BaseShell' object has no attribute 'cmdloop'\n$ xonsh --version\n('xonsh/0.4.4',)\n$ XONSH_DEBUG=1 xonsh\nToday is the first day of the rest of your lossage.\nTraceback (most recent call last):\n  File \"/bin/xonsh\", line 3, in <module>\n    main()\n  File \"/usr/lib/python3.5/site-packages/xonsh/main.py\", line 222, in main\n    shell.shell.cmdloop()\nAttributeError: 'BaseShell' object has no attribute 'cmdloop'\n```\n\n(Ignore the output of `fortune`.)\n\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n\"\"\"The xonsh shell\"\"\"\nimport os\nimport random\nimport builtins\nimport warnings\n\nfrom xonsh.xontribs import update_context\nfrom xonsh.environ import xonshrc_context\nfrom xonsh.execer import Execer\nfrom xonsh.platform import (best_shell_type, has_prompt_toolkit,\n                            ptk_version_is_supported)\nfrom xonsh.tools import XonshError, to_bool_or_int\n\n\nclass Shell(object):\n    \"\"\"Main xonsh shell.\n\n    Initializes execution environment and decides if prompt_toolkit or\n    readline version of shell should be used.\n    \"\"\"\n\n    def __init__(self, ctx=None, shell_type=None, config=None, rc=None,\n                 **kwargs):\n        \"\"\"\n        Parameters\n        ----------\n        ctx : Mapping, optional\n            The execution context for the shell (e.g. the globals namespace).\n            If none, this is computed by loading the rc files. If not None,\n            this no additional context is computed and this is used\n            directly.\n        shell_type : str, optional\n            The shell type to start, such as 'readline', 'prompt_toolkit',\n            or 'random'.\n        config : str, optional\n            Path to configuration file.\n        rc : list of str, optional\n            Sequence of paths to run control files.\n        \"\"\"\n        self.login = kwargs.get('login', True)\n        self.stype = shell_type\n        self._init_environ(ctx, config, rc,\n                           kwargs.get('scriptcache', True),\n                           kwargs.get('cacheall', False))\n        env = builtins.__xonsh_env__\n        # pick a valid shell -- if no shell is specified by the user,\n        # shell type is pulled from env\n        if shell_type is None:\n            shell_type = env.get('SHELL_TYPE')\n        if shell_type == 'best' or shell_type is None:\n            shell_type = best_shell_type()\n        elif shell_type == 'random':\n            shell_type = random.choice(('readline', 'prompt_toolkit'))\n        if shell_type == 'prompt_toolkit':\n            if not has_prompt_toolkit():\n                warnings.warn('prompt_toolkit is not available, using '\n                              'readline instead.')\n                shell_type = 'readline'\n            elif not ptk_version_is_supported():\n                warnings.warn('prompt-toolkit version < v1.0.0 is not '\n                              'supported. Please update prompt-toolkit. Using '\n                              'readline instead.')\n                shell_type = 'readline'\n        env['SHELL_TYPE'] = shell_type\n        # actually make the shell\n        if shell_type == 'none':\n            from xonsh.base_shell import BaseShell as shell_class\n        elif shell_type == 'prompt_toolkit':\n            from xonsh.ptk.shell import PromptToolkitShell as shell_class\n        elif shell_type == 'readline':\n            from xonsh.readline_shell import ReadlineShell as shell_class\n        else:\n            raise XonshError('{} is not recognized as a shell type'.format(\n                             shell_type))\n        self.shell = shell_class(execer=self.execer,\n                                 ctx=self.ctx, **kwargs)\n        # allows history garbace colector to start running\n        builtins.__xonsh_history__.gc.wait_for_shell = False\n\n    def __getattr__(self, attr):\n        \"\"\"Delegates calls to appropriate shell instance.\"\"\"\n        return getattr(self.shell, attr)\n\n    def _init_environ(self, ctx, config, rc, scriptcache, cacheall):\n        self.ctx = {} if ctx is None else ctx\n        debug = to_bool_or_int(os.getenv('XONSH_DEBUG', '0'))\n        self.execer = Execer(config=config, login=self.login, xonsh_ctx=self.ctx,\n                             debug_level=debug)\n        self.execer.scriptcache = scriptcache\n        self.execer.cacheall = cacheall\n        if self.stype != 'none' or self.login:\n            # load xontribs from config file\n            names = builtins.__xonsh_config__.get('xontribs', ())\n            for name in names:\n                update_context(name, ctx=self.ctx)\n            # load run control files\n            env = builtins.__xonsh_env__\n            rc = env.get('XONSHRC') if rc is None else rc\n            self.ctx.update(xonshrc_context(rcfiles=rc, execer=self.execer, initial=self.ctx))\n        self.ctx['__name__'] = '__main__'\n", "path": "xonsh/shell.py"}]}