prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  If main.py is run by bokeh serve, warn about running with directory name instead
  Lots of reports of people running, e.g.
  ```
  bokeh serve --show crossfilter/main.py
  ```
  Which prevents all the features of "directory style" apps from being enabled. 
  
  </issue>
  <code>
  [start of bokeh/command/util.py]
  1 ''' Provide utility functions for implementing the Bokeh command.
  2 
  3 '''
  4 from __future__ import print_function
  5 
  6 import os
  7 import sys
  8 
  9 from bokeh.application import Application
  10 from bokeh.application.handlers import ScriptHandler, DirectoryHandler, NotebookHandler
  11 
  12 def die(message):
  13     ''' Print an error message and exit.
  14 
  15     Args:
  16         message (str) : error message to print
  17 
  18     '''
  19     print(message, file=sys.stderr)
  20     sys.exit(1)
  21 
  22 def build_single_handler_application(path, argv=None):
  23     ''' Return a Bokeh application built using a single handler for a file
  24     or directory.
  25 
  26     Args:
  27         path (str) : path to a file or directory for creating a Bokeh
  28             application.
  29         argv (seq[str], optional) : command line arguments to pass to the
  30             application handler
  31 
  32     Returns:
  33         Application
  34 
  35     Raises:
  36         RuntimeError
  37 
  38     '''
  39     argv = argv or []
  40     path = os.path.abspath(path)
  41     if os.path.isdir(path):
  42         handler = DirectoryHandler(filename=path, argv=argv)
  43     else:
  44         if path.endswith(".ipynb"):
  45             handler = NotebookHandler(filename=path, argv=argv)
  46         elif path.endswith(".py"):
  47             handler = ScriptHandler(filename=path, argv=argv)
  48         else:
  49             raise ValueError("Expected a '.py' script or '.ipynb' notebook, got: '%s'" % path)
  50 
  51     if handler.failed:
  52         raise RuntimeError("Error loading %s:\n\n%s\n%s " % (path, handler.error, handler.error_detail))
  53 
  54     application = Application(handler)
  55 
  56     return application
  57 
  58 def build_single_handler_applications(paths, argvs=None):
  59     ''' Return a dictionary mapping routes to Bokeh applications built using
  60     single handlers, for specified files or directories.
  61 
  62     Args:
  63         path (seq[str]) : paths to files or directories for creating Bokeh
  64             applications.
  65         argvs (dict[str, list[str]], optional) : mapping of paths to command
  66             line arguments to pass to the handler for each path
  67 
  68     Returns:
  69         dict[str, Application]
  70 
  71     Raises:
  72         RuntimeError
  73 
  74     '''
  75     applications = {}
  76     argvs = {} or argvs
  77 
  78     for path in paths:
  79         application = build_single_handler_application(path, argvs.get(path, []))
  80 
  81         route = application.handlers[0].url_path()
  82 
  83         if not route:
  84             if '/' in applications:
  85                 raise RuntimeError("Don't know the URL path to use for %s" % (path))
  86             route = '/'
  87         applications[route] = application
  88 
  89     return applications
  90
  [end of bokeh/command/util.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/bokeh/command/util.py b/bokeh/command/util.py
  --- a/bokeh/command/util.py
  +++ b/bokeh/command/util.py
  @@ -5,6 +5,7 @@
   
   import os
   import sys
  +import warnings
   
   from bokeh.application import Application
   from bokeh.application.handlers import ScriptHandler, DirectoryHandler, NotebookHandler
  @@ -19,6 +20,16 @@
       print(message, file=sys.stderr)
       sys.exit(1)
   
  +DIRSTYLE_MAIN_WARNING = """
  +It looks like you might be running the main.py of a directory app directly.
  +If this is the case, to enable the features of directory style apps, you must
  +call "bokeh serve" on the directory instead. For example:
  +
  +    bokeh serve my_app_dir/
  +
  +If this is not the case, renaming main.py will supress this warning.
  +"""
  +
   def build_single_handler_application(path, argv=None):
       ''' Return a Bokeh application built using a single handler for a file
       or directory.
  @@ -44,6 +55,8 @@
           if path.endswith(".ipynb"):
               handler = NotebookHandler(filename=path, argv=argv)
           elif path.endswith(".py"):
  +            if path.endswith("main.py"):
  +                warnings.warn(DIRSTYLE_MAIN_WARNING)
               handler = ScriptHandler(filename=path, argv=argv)
           else:
               raise ValueError("Expected a '.py' script or '.ipynb' notebook, got: '%s'" % path)
  
verification_info: {"golden_diff": "diff --git a/bokeh/command/util.py b/bokeh/command/util.py\n--- a/bokeh/command/util.py\n+++ b/bokeh/command/util.py\n@@ -5,6 +5,7 @@\n \n import os\n import sys\n+import warnings\n \n from bokeh.application import Application\n from bokeh.application.handlers import ScriptHandler, DirectoryHandler, NotebookHandler\n@@ -19,6 +20,16 @@\n     print(message, file=sys.stderr)\n     sys.exit(1)\n \n+DIRSTYLE_MAIN_WARNING = \"\"\"\n+It looks like you might be running the main.py of a directory app directly.\n+If this is the case, to enable the features of directory style apps, you must\n+call \"bokeh serve\" on the directory instead. For example:\n+\n+    bokeh serve my_app_dir/\n+\n+If this is not the case, renaming main.py will supress this warning.\n+\"\"\"\n+\n def build_single_handler_application(path, argv=None):\n     ''' Return a Bokeh application built using a single handler for a file\n     or directory.\n@@ -44,6 +55,8 @@\n         if path.endswith(\".ipynb\"):\n             handler = NotebookHandler(filename=path, argv=argv)\n         elif path.endswith(\".py\"):\n+            if path.endswith(\"main.py\"):\n+                warnings.warn(DIRSTYLE_MAIN_WARNING)\n             handler = ScriptHandler(filename=path, argv=argv)\n         else:\n             raise ValueError(\"Expected a '.py' script or '.ipynb' notebook, got: '%s'\" % path)\n", "issue": "If main.py is run by bokeh serve, warn about running with directory name instead\nLots of reports of people running, e.g.\r\n```\r\nbokeh serve --show crossfilter/main.py\r\n```\r\nWhich prevents all the features of \"directory style\" apps from being enabled. \n", "before_files": [{"content": "''' Provide utility functions for implementing the Bokeh command.\n\n'''\nfrom __future__ import print_function\n\nimport os\nimport sys\n\nfrom bokeh.application import Application\nfrom bokeh.application.handlers import ScriptHandler, DirectoryHandler, NotebookHandler\n\ndef die(message):\n    ''' Print an error message and exit.\n\n    Args:\n        message (str) : error message to print\n\n    '''\n    print(message, file=sys.stderr)\n    sys.exit(1)\n\ndef build_single_handler_application(path, argv=None):\n    ''' Return a Bokeh application built using a single handler for a file\n    or directory.\n\n    Args:\n        path (str) : path to a file or directory for creating a Bokeh\n            application.\n        argv (seq[str], optional) : command line arguments to pass to the\n            application handler\n\n    Returns:\n        Application\n\n    Raises:\n        RuntimeError\n\n    '''\n    argv = argv or []\n    path = os.path.abspath(path)\n    if os.path.isdir(path):\n        handler = DirectoryHandler(filename=path, argv=argv)\n    else:\n        if path.endswith(\".ipynb\"):\n            handler = NotebookHandler(filename=path, argv=argv)\n        elif path.endswith(\".py\"):\n            handler = ScriptHandler(filename=path, argv=argv)\n        else:\n            raise ValueError(\"Expected a '.py' script or '.ipynb' notebook, got: '%s'\" % path)\n\n    if handler.failed:\n        raise RuntimeError(\"Error loading %s:\\n\\n%s\\n%s \" % (path, handler.error, handler.error_detail))\n\n    application = Application(handler)\n\n    return application\n\ndef build_single_handler_applications(paths, argvs=None):\n    ''' Return a dictionary mapping routes to Bokeh applications built using\n    single handlers, for specified files or directories.\n\n    Args:\n        path (seq[str]) : paths to files or directories for creating Bokeh\n            applications.\n        argvs (dict[str, list[str]], optional) : mapping of paths to command\n            line arguments to pass to the handler for each path\n\n    Returns:\n        dict[str, Application]\n\n    Raises:\n        RuntimeError\n\n    '''\n    applications = {}\n    argvs = {} or argvs\n\n    for path in paths:\n        application = build_single_handler_application(path, argvs.get(path, []))\n\n        route = application.handlers[0].url_path()\n\n        if not route:\n            if '/' in applications:\n                raise RuntimeError(\"Don't know the URL path to use for %s\" % (path))\n            route = '/'\n        applications[route] = application\n\n    return applications\n", "path": "bokeh/command/util.py"}]}