prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  "CustomJS for Selections" Example in Docs Broken
  In the latest version of the docs, it appears [this example]( https://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#customjs-for-selections ) is broken. This is also true of the example in the Bokeh 1.0.0 docs. Selecting points in the plot on the left does not result in points being shown in the right plot. Compare this to [the same plot using Bokeh 0.13.0]( https://bokeh.pydata.org/en/0.13.0/docs/user_guide/interaction/callbacks.html#customjs-for-selections ), which seems to work without issues.
  
  </issue>
  <code>
  [start of sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py]
  1 from random import random
  2 
  3 from bokeh.layouts import row
  4 from bokeh.models import CustomJS, ColumnDataSource
  5 from bokeh.plotting import figure, output_file, show
  6 
  7 output_file("callback.html")
  8 
  9 x = [random() for x in range(500)]
  10 y = [random() for y in range(500)]
  11 
  12 s1 = ColumnDataSource(data=dict(x=x, y=y))
  13 p1 = figure(plot_width=400, plot_height=400, tools="lasso_select", title="Select Here")
  14 p1.circle('x', 'y', source=s1, alpha=0.6)
  15 
  16 s2 = ColumnDataSource(data=dict(x=[], y=[]))
  17 p2 = figure(plot_width=400, plot_height=400, x_range=(0, 1), y_range=(0, 1),
  18             tools="", title="Watch Here")
  19 p2.circle('x', 'y', source=s2, alpha=0.6)
  20 
  21 s1.callback = CustomJS(args=dict(s2=s2), code="""
  22         var inds = cb_obj.selected.indices;
  23         var d1 = cb_obj.data;
  24         var d2 = s2.data;
  25         d2['x'] = []
  26         d2['y'] = []
  27         for (var i = 0; i < inds.length; i++) {
  28             d2['x'].push(d1['x'][inds[i]])
  29             d2['y'].push(d1['y'][inds[i]])
  30         }
  31         s2.change.emit();
  32     """)
  33 
  34 layout = row(p1, p2)
  35 
  36 show(layout)
  37
  [end of sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.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/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py b/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py
  --- a/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py
  +++ b/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py
  @@ -18,9 +18,9 @@
               tools="", title="Watch Here")
   p2.circle('x', 'y', source=s2, alpha=0.6)
   
  -s1.callback = CustomJS(args=dict(s2=s2), code="""
  -        var inds = cb_obj.selected.indices;
  -        var d1 = cb_obj.data;
  +s1.selected.js_on_change('indices', CustomJS(args=dict(s1=s1, s2=s2), code="""
  +        var inds = cb_obj.indices;
  +        var d1 = s1.data;
           var d2 = s2.data;
           d2['x'] = []
           d2['y'] = []
  @@ -30,6 +30,7 @@
           }
           s2.change.emit();
       """)
  +)
   
   layout = row(p1, p2)
  
verification_info: {"golden_diff": "diff --git a/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py b/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py\n--- a/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py\n+++ b/sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py\n@@ -18,9 +18,9 @@\n             tools=\"\", title=\"Watch Here\")\n p2.circle('x', 'y', source=s2, alpha=0.6)\n \n-s1.callback = CustomJS(args=dict(s2=s2), code=\"\"\"\n-        var inds = cb_obj.selected.indices;\n-        var d1 = cb_obj.data;\n+s1.selected.js_on_change('indices', CustomJS(args=dict(s1=s1, s2=s2), code=\"\"\"\n+        var inds = cb_obj.indices;\n+        var d1 = s1.data;\n         var d2 = s2.data;\n         d2['x'] = []\n         d2['y'] = []\n@@ -30,6 +30,7 @@\n         }\n         s2.change.emit();\n     \"\"\")\n+)\n \n layout = row(p1, p2)\n", "issue": "\"CustomJS for Selections\" Example in Docs Broken\nIn the latest version of the docs, it appears [this example]( https://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#customjs-for-selections ) is broken. This is also true of the example in the Bokeh 1.0.0 docs. Selecting points in the plot on the left does not result in points being shown in the right plot. Compare this to [the same plot using Bokeh 0.13.0]( https://bokeh.pydata.org/en/0.13.0/docs/user_guide/interaction/callbacks.html#customjs-for-selections ), which seems to work without issues.\n", "before_files": [{"content": "from random import random\n\nfrom bokeh.layouts import row\nfrom bokeh.models import CustomJS, ColumnDataSource\nfrom bokeh.plotting import figure, output_file, show\n\noutput_file(\"callback.html\")\n\nx = [random() for x in range(500)]\ny = [random() for y in range(500)]\n\ns1 = ColumnDataSource(data=dict(x=x, y=y))\np1 = figure(plot_width=400, plot_height=400, tools=\"lasso_select\", title=\"Select Here\")\np1.circle('x', 'y', source=s1, alpha=0.6)\n\ns2 = ColumnDataSource(data=dict(x=[], y=[]))\np2 = figure(plot_width=400, plot_height=400, x_range=(0, 1), y_range=(0, 1),\n            tools=\"\", title=\"Watch Here\")\np2.circle('x', 'y', source=s2, alpha=0.6)\n\ns1.callback = CustomJS(args=dict(s2=s2), code=\"\"\"\n        var inds = cb_obj.selected.indices;\n        var d1 = cb_obj.data;\n        var d2 = s2.data;\n        d2['x'] = []\n        d2['y'] = []\n        for (var i = 0; i < inds.length; i++) {\n            d2['x'].push(d1['x'][inds[i]])\n            d2['y'].push(d1['y'][inds[i]])\n        }\n        s2.change.emit();\n    \"\"\")\n\nlayout = row(p1, p2)\n\nshow(layout)\n", "path": "sphinx/source/docs/user_guide/examples/interaction_callbacks_for_selections.py"}]}