prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Tools get lost on Grid Plots
  JS logic error prevents all tools from showing up in the toolbar. (cf. comment in #1342)
  
  
  </issue>
  <code>
  [start of examples/plotting/file/grid.py]
  1 import numpy as np
  2 
  3 from bokeh.plotting import *
  4 
  5 N = 50
  6 
  7 x = np.linspace(0, 4*np.pi, N)
  8 y = np.sin(x)
  9 
  10 TOOLS = "pan,wheel_zoom,box_zoom,reset,save"
  11 
  12 l = figure(title="line", tools=TOOLS)
  13 l.line(x,y, line_width=3, color="gold")
  14 
  15 aw = figure(title="annular wedge", tools=TOOLS)
  16 aw.annular_wedge(x, y, 10, 20, 0.6, 4.1, color="navy", alpha=0.5,
  17     inner_radius_units="screen", outer_radius_units="screen")
  18 
  19 bez = figure(title="bezier", tools=TOOLS)
  20 bez.bezier(x, y, x+0.4, y, x+0.1, y+0.2, x-0.1, y-0.2,
  21     line_width=2, color="olive")
  22 
  23 q = figure(title="quad", tools=TOOLS)
  24 q.quad(x, x-0.2, y, y-0.2, color="tomato", alpha=0.4)
  25 
  26 p = gridplot([[l,aw],[bez,q]])
  27 
  28 output_file("grid.html", title="grid.py example")
  29 show(p)
  30
  [end of examples/plotting/file/grid.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/examples/plotting/file/grid.py b/examples/plotting/file/grid.py
  --- a/examples/plotting/file/grid.py
  +++ b/examples/plotting/file/grid.py
  @@ -7,7 +7,7 @@
   x = np.linspace(0, 4*np.pi, N)
   y = np.sin(x)
   
  -TOOLS = "pan,wheel_zoom,box_zoom,reset,save"
  +TOOLS = "pan,wheel_zoom,box_zoom,reset,save,crosshair"
   
   l = figure(title="line", tools=TOOLS)
   l.line(x,y, line_width=3, color="gold")
  
verification_info: {"golden_diff": "diff --git a/examples/plotting/file/grid.py b/examples/plotting/file/grid.py\n--- a/examples/plotting/file/grid.py\n+++ b/examples/plotting/file/grid.py\n@@ -7,7 +7,7 @@\n x = np.linspace(0, 4*np.pi, N)\n y = np.sin(x)\n \n-TOOLS = \"pan,wheel_zoom,box_zoom,reset,save\"\n+TOOLS = \"pan,wheel_zoom,box_zoom,reset,save,crosshair\"\n \n l = figure(title=\"line\", tools=TOOLS)\n l.line(x,y, line_width=3, color=\"gold\")\n", "issue": "Tools get lost on Grid Plots\nJS logic error prevents all tools from showing up in the toolbar. (cf. comment in #1342)\n\n", "before_files": [{"content": "import numpy as np\n\nfrom bokeh.plotting import *\n\nN = 50\n\nx = np.linspace(0, 4*np.pi, N)\ny = np.sin(x)\n\nTOOLS = \"pan,wheel_zoom,box_zoom,reset,save\"\n\nl = figure(title=\"line\", tools=TOOLS)\nl.line(x,y, line_width=3, color=\"gold\")\n\naw = figure(title=\"annular wedge\", tools=TOOLS)\naw.annular_wedge(x, y, 10, 20, 0.6, 4.1, color=\"navy\", alpha=0.5,\n    inner_radius_units=\"screen\", outer_radius_units=\"screen\")\n\nbez = figure(title=\"bezier\", tools=TOOLS)\nbez.bezier(x, y, x+0.4, y, x+0.1, y+0.2, x-0.1, y-0.2,\n    line_width=2, color=\"olive\")\n\nq = figure(title=\"quad\", tools=TOOLS)\nq.quad(x, x-0.2, y, y-0.2, color=\"tomato\", alpha=0.4)\n\np = gridplot([[l,aw],[bez,q]])\n\noutput_file(\"grid.html\", title=\"grid.py example\")\nshow(p)\n", "path": "examples/plotting/file/grid.py"}]}