internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: bokeh/bokeh

Issue:
Dialog widget limitations
Dialog widget should be something that users can use to build dynamic apps. Right now it's way limited at the point that I can't think of how it can be used.  Here's a summary of the first limitations I can think of:
1. `buttons` is a list of label (the labels of the buttons being created). That limits the usage of the dialog itself. How is the server supposed to manage those buttons events? 
2. `content` is a String. This limits the dialog on `MessageDialog` only. What if I want to use the dialog to show a set of widgets to configure my interface?

Proposed changes:
1. Wouldn't it be better to expect a list of buttons? So `buttons = List(Button, ...)`
2. Change content to accept either `String` or a `Box`. So `content = Either(String(...), Instance(BaseBox))`



Discussion:

Resolving patch:
diff --git a/bokeh/models/widgets/dialogs.py b/bokeh/models/widgets/dialogs.py
--- a/bokeh/models/widgets/dialogs.py
+++ b/bokeh/models/widgets/dialogs.py
@@ -2,8 +2,10 @@
 
 from __future__ import absolute_import
 
-from ...properties import Bool, String, List
+from ...properties import Bool, String, List, Instance, Either
 from ..widget import Widget
+from .layouts import BaseBox, HBox
+from .buttons import Button
 
 class Dialog(Widget):
     """ Simple dialog box with string message.
@@ -23,11 +25,27 @@ class Dialog(Widget):
     The title of the dialog widget.
     """)
 
-    content = String(help="""
-    The message displayed by this dialog.
+    content = Either(String(), Instance(BaseBox), help="""
+    Either a message to be displayed by this dialog or a BaseBox to be used
+    as dialog body.
     """)
 
-    buttons = List(String, help="""
-    A list of button labels.
+    buttons = List(Instance(Button), help="""
+    A list of buttons to be placed on the bottom of the dialog.
     """)
 
+    buttons_box = Instance(BaseBox, help="""
+    A BaseBox with buttons to be used as dialog footer.
+    """)
+
+    def __init__(self, **kwargs):
+        if "buttons" in kwargs and "buttons_box" in kwargs:
+            raise ValueError("'buttons' keyword cannot be used with 'buttons_box' argument")
+
+        if 'buttons' in kwargs:
+            kwargs['buttons_box'] = HBox(children=kwargs['buttons'])
+
+        elif 'buttons_box' in kwargs:
+            kwargs['buttons'] = kwargs['buttons_box'].children
+
+        super(Dialog, self).__init__(**kwargs)
\ No newline at end of file
diff --git a/examples/glyphs/taylor_server.py b/examples/glyphs/taylor_server.py
--- a/examples/glyphs/taylor_server.py
+++ b/examples/glyphs/taylor_server.py
@@ -92,7 +92,7 @@ def on_text_value_change(obj, attr, old, new):
     else:
         update_data()
 
-dialog = Dialog(title="Invalid expression", buttons=["Close"])
+dialog = Dialog(title="Invalid expression")
 
 slider = Slider(start=1, end=20, value=order, step=1, title="Order:")
 slider.on_change('value', on_slider_value_change)


Test patch:
Repository: bokeh/bokeh

Issue:
Add a "callback" to a source.selected event
#2175 allows you to attach a callback to an input widget.

We also want to be able to attach one to source.selected event.



Discussion:

Resolving patch:
diff --git a/bokeh/models/sources.py b/bokeh/models/sources.py
--- a/bokeh/models/sources.py
+++ b/bokeh/models/sources.py
@@ -1,5 +1,6 @@
 from __future__ import absolute_import
 
+from .actions import Callback
 from ..plot_object import PlotObject
 from ..properties import HasProps
 from ..properties import Any, Int, String, Instance, List, Dict, Either, Bool, Enum
@@ -13,7 +14,7 @@ class DataSource(PlotObject):
     column_names = List(String, help="""
     An list of names for all the columns in this DataSource.
     """)
-    
+
     selected = Dict(String, Dict(String, Any), default={
         '0d': {'flag': False, 'indices': []},
         '1d': {'indices': []},
@@ -38,6 +39,10 @@ class DataSource(PlotObject):
                 hit/selected
     """)
 
+    callback = Instance(Callback, help="""
+    A callback to run in the browser whenever the selection is changed.
+    """)
+
     def columns(self, *columns):
         """ Returns a ColumnsRef object for a column or set of columns
         on this data source.


Test patch:
Repository: bokeh/bokeh

Issue:
`to_bokeh` ignores alpha
Hey,

I'm using seaborn's `tsplot` a lot but sadly the `alpha` values are being ignored when converting with `to_bokeh`. See the example:

![bokeh_problem_seaborn_orig](https://cloud.githubusercontent.com/assets/79138/5878556/15e07f92-a328-11e4-857e-142c089c5fb8.png)
![bokeh_problem_seaborn_to_bokeh](https://cloud.githubusercontent.com/assets/79138/5878557/15e082bc-a328-11e4-8b3a-8285f09ffc6c.png)

I'm using bokeh 0.7.1.



Discussion:
I will explore the issue, maybe it is something we need to expose in out `BokehRenderer` implementation... thanks for the report.

Thanks for the quick response. Here is a minimal example.

``` python
import seaborn as sns
import bokeh.plotting as bk
from bokeh.mpl import to_bokeh
gammas = sns.load_dataset("gammas")
fig, ax = plt.subplots()
sns.tsplot(gammas, "timepoint", "subject", "ROI", "BOLD signal", ax=ax)
bk.show(to_bokeh(fig))
```

Any updates on this?

not yet, but I changed the milestone to 0.8.2 to tackle on this soon...


Resolving patch:
diff --git a/bokeh/mpl.py b/bokeh/mpl.py
--- a/bokeh/mpl.py
+++ b/bokeh/mpl.py
@@ -373,6 +373,7 @@ def patches_props(self, patches, col):
         widths = get_props_cycled(col, col.get_linewidth())
         patches.line_width = self.source.add(widths)
         patches.line_alpha = col.get_alpha()
+        patches.fill_alpha = col.get_alpha()
         offset = col.get_linestyle()[0][0]
         if not col.get_linestyle()[0][1]:
             on_off = []


Test patch:
Repository: bokeh/bokeh

Issue:
tab completion for splattable lists
When splattable lists contain only models of a single type, provide a `__dir__` to return the common set of attribute names. 

Reference: https://ipython.org/ipython-doc/dev/config/integrating.html



Discussion:

Resolving patch:
diff --git a/bokeh/models/plots.py b/bokeh/models/plots.py
--- a/bokeh/models/plots.py
+++ b/bokeh/models/plots.py
@@ -21,12 +21,6 @@
 from .widget import Widget
 
 
-# TODO (bev) dupe, move to utils
-class _list_attr_splat(list):
-    def __setattr__(self, attr, value):
-        for x in self:
-            setattr(x, attr, value)
-
 class PlotContext(PlotObject):
     """ A container for multiple plot objects.
 
@@ -129,6 +123,7 @@ def select(self, *args, **kwargs):
             selector = kwargs
 
         # Want to pass selector that is a dictionary
+        from ..plotting_helpers import _list_attr_splat
         return _list_attr_splat(find(self.references(), selector, {'plot': self}))
 
     def row(self, row, gridplot):
@@ -463,6 +458,7 @@ def select(self, selector):
             seq[PlotObject]
 
         '''
+        from ..plotting_helpers import _list_attr_splat
         return _list_attr_splat(find(self.references(), selector, {'gridplot': self}))
 
     def column(self, col):
diff --git a/bokeh/plotting_helpers.py b/bokeh/plotting_helpers.py
--- a/bokeh/plotting_helpers.py
+++ b/bokeh/plotting_helpers.py
@@ -467,3 +467,9 @@ class _list_attr_splat(list):
     def __setattr__(self, attr, value):
         for x in self:
             setattr(x, attr, value)
+
+    def __dir__(self):
+        if len(set(type(x) for x in self)) == 1:
+            return dir(self[0])
+        else:
+            return dir(self)


Test patch:
Repository: bokeh/bokeh

Issue:
Spectrogram improvements
- [x] improved CPU usage 
- [x] use new `embed.components` to have better layout design



Discussion:

Resolving patch:
diff --git a/examples/embed/spectrogram/spectrogram.py b/examples/embed/spectrogram/spectrogram.py
--- a/examples/embed/spectrogram/spectrogram.py
+++ b/examples/embed/spectrogram/spectrogram.py
@@ -24,7 +24,7 @@
 FREQ_SAMPLES = NUM_SAMPLES / 8
 NGRAMS = 800
 SPECTROGRAM_LENGTH = 512
-TILE_WIDTH = 500
+TILE_WIDTH = 200
 TIMESLICE = 40 # ms
 
 mutex = RLock()
@@ -70,7 +70,7 @@ def params():
         "TILE_WIDTH": TILE_WIDTH,
         "TIMESLICE": TIMESLICE,
         "EQ_CLAMP": 20,
-        "FRAMES_PER_SECOND": 20
+        "FRAMES_PER_SECOND": 15
     })
 
 


Test patch:
Repository: bokeh/bokeh

Issue:
bokeh-server --url-prefix is being ignored
bokeh-server is not considering the `--url-prefix` option (see bokeh.server.settings)



Discussion:
btw, this patch seems to solve the issue...

``` diff
diff --git a/bokeh/server/settings.py b/bokeh/server/settings.py
index 7fd0484..5c4a400 100644
--- a/bokeh/server/settings.py
+++ b/bokeh/server/settings.py
@@ -93,6 +93,8 @@ class Settings(object):
             self.blaze_config = args.blaze_config
         if args.script:
             self.scripts = [args.script]
+        if args.url_prefix:
+            self.url_prefix = args.url_prefix
```


Resolving patch:
diff --git a/bokeh/server/settings.py b/bokeh/server/settings.py
--- a/bokeh/server/settings.py
+++ b/bokeh/server/settings.py
@@ -93,6 +93,8 @@ def from_args(self, args):
             self.blaze_config = args.blaze_config
         if args.script:
             self.scripts = [args.script]
+        if args.url_prefix:
+            self.url_prefix = args.url_prefix
 
     def process_settings(self):
         if self.url_prefix:


Test patch:
Repository: bokeh/bokeh

Issue:
DatetimeTickFormatter format attr ignores %n %t chars
When creating custom formats for a DatetimeTickFormatter, the strftime conversion specifications of %n (return line) and %t (tab) are ignored in the rendered tick label.

For example, all three following combinations yield the same label:

``` python
format1 = {"year" : ["%Y%m%d %n %H%M%S"]}
format2 = {"year" : ["%Y%m%d %t %H%M%S"]}
format3 = {"year" : ["%Y%m%d %H%M%S"]}
```

This requires either a bugfix or updating the docs to reflect that %n and %t are not valid conversion specs.



Discussion:
Not really related to DatetimeTickFormatter, which I believe does do the correct %n -> \n and %t -> \t conversions, but apparently instead an issue with newlines in html canvas: [#994](https://github.com/bokeh/bokeh/issues/994).


Resolving patch:
diff --git a/bokeh/models/formatters.py b/bokeh/models/formatters.py
--- a/bokeh/models/formatters.py
+++ b/bokeh/models/formatters.py
@@ -207,10 +207,15 @@ class DatetimeTickFormatter(TickFormatter):
 
     The enum values correspond roughly to different "time scales". The
     corresponding value is a list of `strftime`_ formats to use for
-    formatting datetime values that fall in in that "time scale".
+    formatting datetime tick values that fall in in that "time scale".
+
+    By default, only the first format string passed for each time scale
+    will be used. By default, all leading zeros are stripped away from
+    the formatted labels. These behaviors cannot be changed as of now.
 
     This list of supported `strftime`_ formats is reproduced below.
 
+
     .. warning::
         The client library BokehJS uses the `timezone`_ library to
         format datetimes. The inclusion of the list below is based on the
@@ -296,7 +301,8 @@ class DatetimeTickFormatter(TickFormatter):
         The minute as a decimal number (range 00 to 59).
 
     %n
-        A newline character.
+        A newline character. Bokeh text does not currently support
+        newline characters.
 
     %p
         Either "AM" or "PM" according to the given time value, or the
@@ -324,7 +330,8 @@ class DatetimeTickFormatter(TickFormatter):
         is up to 60 to allow for occasional leap seconds.)
 
     %t
-        A tab character.
+        A tab character. Bokeh text does not currently support tab
+        characters.
 
     %T
         The time in 24-hour notation (%H:%M:%S).


Test patch:
Repository: bokeh/bokeh

Issue:
Multiple select doesn't work on linked_tap_server example
examples/glyphs/linked_tap_server.py

doing a multiple select (holding shift down while clicking) causes 

``` python
  File "linked_tap_server.py", line 37, in on_selection_change1
    [index] = inds['1d']['indices']
ValueError: too many values to unpack
```



Discussion:

Resolving patch:
diff --git a/examples/glyphs/linked_tap_server.py b/examples/glyphs/linked_tap_server.py
--- a/examples/glyphs/linked_tap_server.py
+++ b/examples/glyphs/linked_tap_server.py
@@ -34,8 +34,9 @@
 def on_selection_change1(obj, attr, _, inds):
     color = ["blue"]*N
     if inds['1d']['indices']:
-        [index] = inds['1d']['indices']
-        color[index] = "red"
+        indices = inds['1d']['indices']
+        for i in indices:
+            color[i] = "red"
     source2.data["color"] = color
     session.store_objects(source2)
 


Test patch:
Repository: bokeh/bokeh

Issue:
DataTables slickgrid api
A few questions regarding the DataTables/slickgrid api. Cursory searches didn't pull up previous discussion for these, but maybe someone knows how to do these without having to make any changes on the bokeh-server side.
- When a selection of a `ColumnDataSource` is made, it would be helpful to [jump to the first highlighted row](https://github.com/mleibman/SlickGrid/wiki/Slick.Grid#gotoCell) in the respective DataTable, otherwise if your data series is long it can take forever to find the highlighted row. I figured there would be a JSCallback that could achieve this but don't know how to get from a reference to a coffeescript view from a model? It would be nice regardless to expose this in the python api.

``` python
        self.column_data_source.callback = models.Callback(
            args=dict(data_table=data_table),
            # Update the DataTable to point to the start of the selection
            code="""
              var indices = cb_obj.get('selected')['1d'].indices;
              var min_index = Math.min.apply(null, indices);
              console.log(indices, min_index);
              console.log(table.collection.models[0]);
              // Does not work
              data_table.collection.models[0].grid.gotoCell(min_index, 0);
            """)
```
- Is there support for copy+pasting from highlighted cells in slickgrid? I saw the [csv endpoint PR](https://github.com/bokeh/bokeh/pull/2382) but that would be a round-about way to just copy paste a few non-adjacent highlighted rows.
- The width of the slickgrid index doesn't seem to be draggable. So if the index has large values (for example, any datetime index which uses milliseconds since epoch), the index will not show anything meaningful, and on top of that you can't use copy+paste to figure out the values, but instead have to dig into the html.

If these are not possible now I will at least look into a PR for the first issue, but would like feedback first.



Discussion:

Resolving patch:
diff --git a/bokeh/models/widgets/tables.py b/bokeh/models/widgets/tables.py
--- a/bokeh/models/widgets/tables.py
+++ b/bokeh/models/widgets/tables.py
@@ -349,3 +349,9 @@ class DataTable(TableWidget):
     row_headers = Bool(True, help="""
     Enable or disable row headers, i.e. the index column.
     """)
+
+    scroll_to_selection = Bool(True, help="""
+    Whenever a selection is made on the data source, scroll the selected
+    rows into the table's viewport if none of the selected rows are already
+    in the viewport.
+    """)


Test patch:
Repository: bokeh/bokeh

Issue:
Gear.{angle,module} have their types mixed up



Discussion:
~~Fix in mattpap/0.9.2-fixes~~.


Resolving patch:
diff --git a/bokeh/models/glyphs.py b/bokeh/models/glyphs.py
--- a/bokeh/models/glyphs.py
+++ b/bokeh/models/glyphs.py
@@ -229,11 +229,11 @@ class Gear(Glyph):
     The y-coordinates of the center of the gears.
     """)
 
-    angle = NumberSpec(default=0, help="""
+    angle = AngleSpec(default=0, help="""
     The angle the gears are rotated from horizontal. [rad]
     """)
 
-    module = AngleSpec("module", help="""
+    module = NumberSpec("module", help="""
     A scaling factor, given by::
 
         m = p / pi


Test patch:
diff --git a/bokeh/models/tests/test_glyphs.py b/bokeh/models/tests/test_glyphs.py
--- a/bokeh/models/tests/test_glyphs.py
+++ b/bokeh/models/tests/test_glyphs.py
@@ -193,8 +193,8 @@ def test_Gear():
         "x",
         "y",
         "angle",
+        "angle_units",
         "module",
-        "module_units",
         "teeth",
         "pressure_angle",
         "shaft_size",
Repository: bokeh/bokeh

Issue:
Setup.py not deleting pycs
Setup.py should clean up old pyc files to prevent version mishmashes.



Discussion:
I think this can be done from python with `os.walk` and `os.remove(file)` if `--clean` is in the command line args


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -332,7 +332,16 @@ def install_js():
 
 def clean():
     print("Removing prior-built items...", end=" ")
-    dir_util.remove_tree('build/lib/bokeh')
+
+    build_dir = 'build/lib/bokeh'
+    if os.path.exists(build_dir):
+        dir_util.remove_tree(build_dir)
+
+    for root, dirs, files in os.walk('.'):
+        for item in files:
+            if item.endswith('.pyc'):
+                os.remove(os.path.join(root, item))
+
     print("Done")
 
 


Test patch:
Repository: bokeh/bokeh

Issue:
Components on multiple objects duplicates objects in all_models
This can causes models to be initialized more than once, which causes errors. Need to protect on both the python and JS sides. 



Discussion:

Resolving patch:
diff --git a/bokeh/embed.py b/bokeh/embed.py
--- a/bokeh/embed.py
+++ b/bokeh/embed.py
@@ -73,7 +73,7 @@ def components(plot_objects, resources=None):
         warn('Because the ``resources`` argument is no longer needed, '
              'it is deprecated and will be removed in'
              'a future version.', DeprecationWarning, stacklevel=2)
-    all_models = []
+    all_models = dict()
     plots = []
     if isinstance(plot_objects, Sequence) and all(isinstance(x, (PlotObject, Document)) for x in plot_objects):
         divs = []
@@ -85,7 +85,7 @@ def components(plot_objects, resources=None):
             divs = divs[0]
         else:
             divs = tuple(divs)
-        return _component_pair(all_models, plots, divs)
+        return _component_pair(list(all_models.values()), plots, divs)
     elif isinstance(plot_objects, dict) and \
          all(isinstance(x, string_types) for x in plot_objects.keys()) and \
          all(isinstance(x, (PlotObject, Document)) for x in plot_objects.values()):
@@ -94,7 +94,7 @@ def components(plot_objects, resources=None):
             elementid = str(uuid.uuid4())
             _append_plot(all_models, plots, plot_objects[key], elementid)
             divs = _append_div(elementid, divs, key)
-        return _component_pair(all_models, plots, divs)
+        return _component_pair(list(all_models.values()), plots, divs)
     else:
         raise ValueError('Input must be a PlotObject, a Sequence of PlotObjects, or a mapping of string to PlotObjects')
 
@@ -110,7 +110,8 @@ def _component_pair(all_models, plots, divs):
 
 def _append_plot(all_models, plots, plot_object, elementid):
     ref = plot_object.ref
-    all_models.extend(plot_object.dump())
+    for item in plot_object.dump():
+        all_models[item['id']] = item
     plots.append({
         'modelid': ref["id"],
         'elementid': '#' + elementid,
diff --git a/examples/plotting/file/ajax_source_realtime.py b/examples/plotting/file/ajax_source_realtime.py
--- a/examples/plotting/file/ajax_source_realtime.py
+++ b/examples/plotting/file/ajax_source_realtime.py
@@ -24,7 +24,6 @@ def gen_entry():
     while True:
         last_entry = Entry(x, np.sin(x*np.pi/10), time.time())
         entries.append(last_entry)
-        print("Entry generated: %s" % str(last_entry))
         x += 1
         if x > entries.maxlen and x % 10 == 0:
             time.sleep(2)


Test patch:
Repository: bokeh/bokeh

Issue:
Create example of using Hover tool to display custom images
It would be nice to show how someone can use the hovertool to display custom images using URL/URI upon hovering over a region of interest.  It would allow users to embed an additional dimension into plots.



Discussion:

Resolving patch:
diff --git a/sphinx/source/docs/user_guide/source_examples/tools_hover_custom_tooltip.py b/sphinx/source/docs/user_guide/source_examples/tools_hover_custom_tooltip.py
--- a/sphinx/source/docs/user_guide/source_examples/tools_hover_custom_tooltip.py
+++ b/sphinx/source/docs/user_guide/source_examples/tools_hover_custom_tooltip.py
@@ -8,18 +8,34 @@
             x=[1, 2, 3, 4, 5],
             y=[2, 5, 8, 2, 7],
             desc=['A', 'b', 'C', 'd', 'E'],
+            imgs = [
+                'http://bokeh.pydata.org/static/snake.jpg',
+                'http://bokeh.pydata.org/static/snake2.png',
+                'http://bokeh.pydata.org/static/snake3D.png',
+                'http://bokeh.pydata.org/static/snake4_TheRevenge.png',
+                'http://bokeh.pydata.org/static/snakebite.jpg'
+            ]
         )
     )
 
 hover = HoverTool(
         tooltips="""
         <div>
-            <span style="font-size: 17px; font-weight: bold;">@desc</span>
-            <span style="font-size: 15px; color: #966;">[$index]</span>
-        </div>
-        <div>
-            <span style="font-size: 15px;">Location</span>
-            <span style="font-size: 10px; color: #696;">($x, $y)</span>
+            <div>
+                <img
+                    src="@imgs" height="42" alt="@imgs" width="42"
+                    style="float: left; margin: 0px 15px 15px 0px;"
+                    border="2"
+                ></img>
+            </div>
+            <div>
+                <span style="font-size: 17px; font-weight: bold;">@desc</span>
+                <span style="font-size: 15px; color: #966;">[$index]</span>
+            </div>
+            <div>
+                <span style="font-size: 15px;">Location</span>
+                <span style="font-size: 10px; color: #696;">($x, $y)</span>
+            </div>
         </div>
         """
     )
@@ -30,5 +46,3 @@
 p.circle('x', 'y', size=20, source=source)
 
 show(p)
-
-    


Test patch:
Repository: bokeh/bokeh

Issue:
Charts donut NB example raise a long set of warning 
See attachment:

<img width="1187" alt="screen shot 2015-09-05 at 14 23 26" src="https://cloud.githubusercontent.com/assets/1084690/9699196/e2844850-53d9-11e5-8761-0605589e2125.png">



Discussion:

Resolving patch:
diff --git a/bokeh/charts/builder/donut_builder.py b/bokeh/charts/builder/donut_builder.py
--- a/bokeh/charts/builder/donut_builder.py
+++ b/bokeh/charts/builder/donut_builder.py
@@ -161,8 +161,7 @@ def draw_external_ring(self, colors=None):
             end = angles.tolist() + [end_angle]
             start = [start_angle] + end[:-1]
             base_color = colors[i]
-            #fill = [ base_color.lighten(i*0.05) for i in range(len(details) + 1) ]
-            fill = [base_color for i in range(len(details) + 1)]
+            fill = [base_color for i in start]
             text = [rowlabel for rowlabel in details.index]
             x, y = polar_to_cartesian(1.25, start, end)
 
@@ -186,8 +185,13 @@ def draw_external_ring(self, colors=None):
                 text_angle.insert(0, text_angle[0] - offset)
                 start.insert(0, start[0] - offset)
                 end.insert(0, end[0] - offset)
+                fill.insert(0, base_color)
                 x, y = polar_to_cartesian(1.25, start, end)
                 first = False
+
+            for i in range(len(text_angle)-len(text)):
+                text.append('')
+
             data = dict(text=text, x=x, y=y, angle=text_angle)
             text_source = ColumnDataSource(data)
             glyph = Text(


Test patch: