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

Issue:
HasProps.clone() should use changed_properties_with_values()



Discussion:

Resolving patch:
diff --git a/bokeh/properties.py b/bokeh/properties.py
--- a/bokeh/properties.py
+++ b/bokeh/properties.py
@@ -521,14 +521,11 @@ def __setattr__(self, name, value):
             raise AttributeError("unexpected attribute '%s' to %s, %s attributes are %s" %
                 (name, self.__class__.__name__, text, nice_join(matches)))
 
-    def to_dict(self):
-        return dict((prop, getattr(self, prop)) for prop in self.properties())
-
     def clone(self):
         """ Returns a duplicate of this object with all its properties
         set appropriately.  Values which are containers are shallow-copied.
         """
-        return self.__class__(**self.to_dict())
+        return self.__class__(**self.changed_properties_with_values())
 
     @classmethod
     def lookup(cls, name):
@@ -599,8 +596,11 @@ def reset_changed_vars(self):
     def properties_with_values(self):
         return dict([ (attr, getattr(self, attr)) for attr in self.properties() ])
 
+    def changed_properties(self):
+        return self.changed_vars()
+
     def changed_properties_with_values(self):
-        return dict([ (attr, getattr(self, attr)) for attr in self.changed_vars() ])
+        return dict([ (attr, getattr(self, attr)) for attr in self.changed_properties() ])
 
     @classmethod
     def class_properties(cls, withbases=True):
diff --git a/bokeh/protocol.py b/bokeh/protocol.py
--- a/bokeh/protocol.py
+++ b/bokeh/protocol.py
@@ -101,7 +101,7 @@ def default(self, obj):
         elif isinstance(obj, PlotObject):
             return obj.ref
         elif isinstance(obj, HasProps):
-            return obj.to_dict()
+            return obj.changed_properties_with_values()
         elif isinstance(obj, Color):
             return obj.to_css()
         else:


Test patch:
diff --git a/bokeh/tests/test_properties.py b/bokeh/tests/test_properties.py
--- a/bokeh/tests/test_properties.py
+++ b/bokeh/tests/test_properties.py
@@ -842,5 +842,13 @@ def test_Angle(self):
         self.assertFalse(prop.is_valid({}))
         self.assertFalse(prop.is_valid(Foo()))
 
+def test_HasProps_clone():
+    from bokeh.models import Plot
+    p1 = Plot(plot_width=1000)
+    c1 = p1.changed_properties()
+    p2 = p1.clone()
+    c2 = p2.changed_properties()
+    assert c1 == c2
+
 if __name__ == "__main__":
     unittest.main()
Repository: bokeh/bokeh

Issue:
Tools get lost on Grid Plots
JS logic error prevents all tools from showing up in the toolbar. (cf. comment in #1342)



Discussion:

Resolving patch:
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")


Test patch:
Repository: bokeh/bokeh

Issue:
Fix spectrogram issues
New spectrogram has the following issues:
- [x] refresh seems slower than previous iteration
- [x] loud noises cause app to "hiccup" (`nan` or `inf` issue?)



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
@@ -61,14 +61,16 @@ def root():
 @app.route("/params")
 def params():
     return json.dumps({
-        "FREQ_SAMPLES" : FREQ_SAMPLES,
-        "MAX_FREQ" : MAX_FREQ,
-        "NGRAMS" : NGRAMS,
-        "NUM_SAMPLES" : NUM_SAMPLES,
-        "SAMPLING_RATE" : SAMPLING_RATE,
-        "SPECTROGRAM_LENGTH" : SPECTROGRAM_LENGTH,
-        "TILE_WIDTH" : TILE_WIDTH,
-        "TIMESLICE" : TIMESLICE,
+        "FREQ_SAMPLES": FREQ_SAMPLES,
+        "MAX_FREQ": MAX_FREQ,
+        "NGRAMS": NGRAMS,
+        "NUM_SAMPLES": NUM_SAMPLES,
+        "SAMPLING_RATE": SAMPLING_RATE,
+        "SPECTROGRAM_LENGTH": SPECTROGRAM_LENGTH,
+        "TILE_WIDTH": TILE_WIDTH,
+        "TIMESLICE": TIMESLICE,
+        "EQ_CLAMP": 20,
+        "FRAMES_PER_SECOND": 20
     })
 
 
@@ -196,7 +198,7 @@ def get_audio_data():
             fft = sp.fft(signal)
             spectrum = abs(fft)[:NUM_SAMPLES/2]
             power = spectrum**2
-            bins = [simps(a)*4 for a in np.split(power, 16)]
+            bins = [simps(a) for a in np.split(power, 16)]
             with mutex:
                 data = signal.tolist(), spectrum.tolist(), bins
         except:


Test patch:
Repository: bokeh/bokeh

Issue:
Add option (maybe default?) for Bokeh logo to be de-saturated and placed on the RHS of the toolbar
Right now the color logo is very pretty and helpful for promoting our project, when used on individual plots.  But when multiple plots are involved, it gets to be a bit much.



Discussion:
As long as we are tweaking the logo, it should also be:
- centered with the tool icons
- maybe smaller


Resolving patch:
diff --git a/bokeh/models/plots.py b/bokeh/models/plots.py
--- a/bokeh/models/plots.py
+++ b/bokeh/models/plots.py
@@ -174,6 +174,7 @@ def add_glyph(self, source, glyph, **kw):
     below = List(Instance(PlotObject))
 
     toolbar_location = Enum(Location)
+    logo = Enum("normal", "grey")
 
     plot_height = Int(600)
     plot_width = Int(600)
diff --git a/examples/plotting/file/elements.py b/examples/plotting/file/elements.py
--- a/examples/plotting/file/elements.py
+++ b/examples/plotting/file/elements.py
@@ -21,7 +21,7 @@
 
 TOOLS = "pan,wheel_zoom,box_zoom,reset,resize,save"
 
-p = figure(tools=TOOLS, toolbar_location="left", plot_width=1200)
+p = figure(tools=TOOLS, toolbar_location="left", logo="grey", plot_width=1200)
 p.title = "Density vs Atomic Weight of Elements (colored by melting point)"
 p.background_fill= "#cccccc"
 


Test patch:
Repository: bokeh/bokeh

Issue:
Some matplotlib markers are not handled correctly
Certain matplotlib markers (full set described here http://matplotlib.org/api/markers_api.html) seem to not be handled by the "mpl.to_bokeh()" function, and cause a KeyError.

I specifically observed the issue with the "thin diamond" marker:

``` python
  File "/path/to/bokeh/mpl.py", line 187, in draw_markers
    marker = marker_map[style['marker']]()
KeyError: 'd'
```



Discussion:
I'm not sure how likely it is that we can ever support that full list. Anything that gets added to BokehJS is paid for by everyone in terms of JS library size (which is already quite large). So, we have to balance adding features with the client library size,  and only add what most people are likely to use. Perhaps some day we could add a (slower) generic marker renderer that accepts a arbitrary path definition, to handle cases like this. 

Sure, that makes sense.  Would it be possible to change the behavior of bokeh such that, instead of crashing, it would display a warning message and fall back to a "default" marker style?  This would allow certain matplotlib plots to be at least displayed, even if the formatting would be slightly different.

Yes, that is absolutely a reasonable thing to do!

@varunus Would you be interested in working up a PR for this? It should be quick and easy. No worries if you do not have the time, etc. but I thought I would ask first in case you were interested in contributing. 


Resolving patch:
diff --git a/bokeh/mpl.py b/bokeh/mpl.py
--- a/bokeh/mpl.py
+++ b/bokeh/mpl.py
@@ -201,10 +201,14 @@ def draw_markers(self, data, coordinates, style, label, mplobj=None):
             "D": Diamond,
             "*": Asterisk,
         }
-        if style['marker'] not in marker_map:
-            warnings.warn("Unable to handle marker: %s" % style['marker'])
-
-        marker = marker_map[style['marker']]()
+       
+        # Not all matplotlib markers are currently handled; fall back to Circle if we encounter an
+        # unhandled marker.  See http://matplotlib.org/api/markers_api.html for a list of markers.
+        try:
+            marker = marker_map[style['marker']]()
+        except KeyError:
+            warnings.warn("Unable to handle marker: %s; defaulting to Circle" % style['marker'])
+            marker = Circle()
         marker.x = self.source.add(x)
         marker.y = self.source.add(y)
         self.xdr.sources.append(self.source.columns(marker.x))


Test patch:
Repository: bokeh/bokeh

Issue:
provide hooks to easily dump models with all properties 
This is to support #1579



Discussion:

Resolving patch:
diff --git a/bokeh/plot_object.py b/bokeh/plot_object.py
--- a/bokeh/plot_object.py
+++ b/bokeh/plot_object.py
@@ -222,9 +222,18 @@ def references(self):
     # Many of the calls one would expect in a rich client map instead to
     # batched updates on the M-VM-V approach.
     #---------------------------------------------------------------------
-    def vm_props(self):
-        """ Returns the ViewModel-related properties of this object. """
-        props = self.changed_properties_with_values()
+    def vm_props(self, changed_only=True):
+        """ Returns the ViewModel-related properties of this object.
+
+        Args:
+            changed_only (bool, optional) : whether to return only properties
+                that have had their values changed at some point (default: True)
+
+        """
+        if changed_only:
+            props = self.changed_properties_with_values()
+        else:
+            props = self.properties_with_values()
         props.pop("session", None)
 
         # XXX: For dataspecs, getattr() returns a meaningless value
@@ -236,19 +245,28 @@ def vm_props(self):
 
         return props
 
-    def vm_serialize(self):
+    def vm_serialize(self, changed_only=True):
         """ Returns a dictionary of the attributes of this object, in
         a layout corresponding to what BokehJS expects at unmarshalling time.
+
+        Args:
+            changed_only (bool, optional) : whether to include only attributes
+                that have had their values changed at some point (default: True)
+
         """
-        attrs = self.vm_props()
+        attrs = self.vm_props(changed_only)
         attrs['id'] = self._id
         return attrs
 
-    def dump(self, docid=None):
+    def dump(self, docid=None, changed_only=True):
         """convert all references to json
+
+        Args:
+            changed_only (bool, optional) : whether to dump only attributes
+                that have had their values changed at some point (default: True)
         """
         models = self.references()
-        return dump(models, docid=docid)
+        return dump(models, docid=docid, changed_only=changed_only)
 
     def update(self, **kwargs):
         for k,v in kwargs.items():
diff --git a/bokeh/utils.py b/bokeh/utils.py
--- a/bokeh/utils.py
+++ b/bokeh/utils.py
@@ -82,11 +82,17 @@ def helper(json_obj):
     json_apply(json_obj, helper)
     return json_obj
 
-def dump(objs, docid):
+def dump(objs, docid, changed_only=True):
+    """ Dump a sequence of objects into JSON
+
+        Args:
+            changed_only (bool, optional) : whether to dump only attributes
+                that have had their values changed at some point (default: True)
+    """
     json_objs = []
     for obj in objs:
         ref = obj.ref
-        ref["attributes"] = obj.vm_serialize()
+        ref["attributes"] = obj.vm_serialize(changed_only=changed_only)
         ref["attributes"].update({"id": ref["id"], "doc" : docid})
         json_objs.append(ref)
     return json_objs


Test patch:
Repository: bokeh/bokeh

Issue:
BokehJS unrecoverable errors in notebook 
It seems easy to get the notebook into an unrecoverable state when using `push_notebook` and IPython interactors. Must close the session entirely and start again to regain plots. Executing all the cells in the notebook stored in this gist:

https://gist.github.com/bryevdv/b4e9eb68a6234a67a570

should reproduce the problem.

To be specific, by "unrecoverable" I mean that clearing all cells and restarting the kernel from the menu does not fix the problem. It is still impossible to generate plots. I have had to close the tab and shutdown from the IPython home notebook list, then re-open a new tab to be able to plot again. 

@damianavila this is a pretty serious bug. We should try to fix it for 0.7.1 for sure. I will take a look and add any findings but I may need your input/assistance. 



Discussion:
Screen shot of unrecoverable error:

![screen shot 2014-12-24 at 7 46 55 pm](https://cloud.githubusercontent.com/assets/1078448/5551749/ae56f156-8ba5-11e4-98a3-2861637087f5.png)

The problem appears to be caused by setting the `name` attribute on the renderer. This `name` is used as the `modelid` in `Bokeh.Collections` and having that same id re-used appears to be the cause of serious problems. As mentioned elsewhere, `name` should not be used this way, it should be a useful attribute that can be searched for, but all models should get a standard UUID for an id. 

@mattpap thoughts?


Resolving patch:
diff --git a/bokeh/_glyph_functions.py b/bokeh/_glyph_functions.py
--- a/bokeh/_glyph_functions.py
+++ b/bokeh/_glyph_functions.py
@@ -49,8 +49,6 @@ def func(document_or_plot, *args, **kwargs):
             raise ValueError("expected document or plot object for first argument")
 
         name = kwargs.pop('name', None)
-        if name:
-            plot._id = name
 
         select_tool = _get_select_tool(plot)
 


Test patch:
Repository: bokeh/bokeh

Issue:
Plot.add_tool wrong error message
Error messages raised when adding a tool that alread has a 'plot' attribute to another plot raises an error that should refer to `tool` and not `tools`. See https://github.com/bokeh/bokeh/blob/master/bokeh/models/plots.py#L124



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
@@ -121,7 +121,7 @@ def add_tools(self, *tools):
 
         for tool in tools:
             if tool.plot is not None:
-                 raise ValueError("tool %s to be added already has 'plot' attribute set" % tools)
+                 raise ValueError("tool %s to be added already has 'plot' attribute set" % tool)
             tool.plot = self
             self.tools.append(tool)
 


Test patch:
Repository: bokeh/bokeh

Issue:
Resources(..., minified=False) in bokeh.plotting
Pointed out in #1605.



Discussion:

Resolving patch:
diff --git a/bokeh/plotting.py b/bokeh/plotting.py
--- a/bokeh/plotting.py
+++ b/bokeh/plotting.py
@@ -474,7 +474,7 @@ def output_file(filename, title="Bokeh Plot", autosave=False, mode="inline", roo
     global _default_file
     _default_file = {
         'filename'  : filename,
-        'resources' : Resources(mode=mode, root_dir=root_dir, minified=False),
+        'resources' : Resources(mode=mode, root_dir=root_dir),
         'autosave'  : autosave,
         'title'     : title,
     }


Test patch:
diff --git a/bokeh/tests/test_plotting.py b/bokeh/tests/test_plotting.py
--- a/bokeh/tests/test_plotting.py
+++ b/bokeh/tests/test_plotting.py
@@ -121,5 +121,11 @@ def test_grid(self):
         p = plt.circle([1,2,3], [1,2,3])
         self.assertEqual(len(plt.grid()), 2)
 
+    def test_default_resources_minified(self):
+        plt.output_file("foo.html")
+        self.assertEqual(plt._default_file['resources'].minified, True)
+        plt.reset_output()
+
+
Repository: bokeh/bokeh

Issue:
Update release notes on pydata.org
The release notes are a bit spare, they could be fleshed out more, with more information than just a bullet list. Might consider a separate page for every release that basically contains what would go in a blog post. 



Discussion:

Resolving patch:
diff --git a/bokeh/plotting.py b/bokeh/plotting.py
--- a/bokeh/plotting.py
+++ b/bokeh/plotting.py
@@ -384,7 +384,7 @@ def figure(**kwargs):
     This function accepts all plot style keyword parameters.
 
     Returns:
-        None
+       figure : a new :class:`Plot <bokeh.models.plots.Plot>`
 
     '''
     fig = Figure(**kwargs)
@@ -847,14 +847,14 @@ def gridplot(plot_arrangement, name=None, **kwargs):
     """ Generate a plot that arranges several subplots into a grid.
 
     Args:
-        plot_arrangement (list[:class:`Plot <bokeh.models.Plot>`]) : plots to arrange in a grid
+        plot_arrangement (nested list of Plots) : plots to arrange in a grid
         name (str) : name for this plot
         **kwargs: additional attributes to pass in to GridPlot() constructor
 
     .. note:: `plot_arrangement` can be nested, e.g [[p1, p2], [p3, p4]]
 
     Returns:
-        grid_plot: the current :class:`GridPlot <bokeh.models.GridPlot>`
+        grid_plot: a new :class:`GridPlot <bokeh.models.plots.GridPlot>`
     """
     grid = GridPlot(children=plot_arrangement, **kwargs)
     if name:


Test patch:
Repository: bokeh/bokeh

Issue:
Add missing properties to ticker classes
Many configurable properties of tickers are not currently exposed to the python side. For instance, `LogTicker` should accept `mantissas = Seq(Int)`



Discussion:

Resolving patch:
diff --git a/bokeh/models/axes.py b/bokeh/models/axes.py
--- a/bokeh/models/axes.py
+++ b/bokeh/models/axes.py
@@ -52,7 +52,7 @@ def __init__(self, ticker=None, formatter=None, **kwargs):
         if ticker is None:
             ticker = LogTicker(num_minor_ticks=10)
         if formatter is None:
-            formatter = LogTickFormatter()
+            formatter = LogTickFormatter(ticker=ticker)
         super(LogAxis, self).__init__(ticker=ticker, formatter=formatter, **kwargs)
 
 class CategoricalAxis(Axis):
diff --git a/bokeh/models/formatters.py b/bokeh/models/formatters.py
--- a/bokeh/models/formatters.py
+++ b/bokeh/models/formatters.py
@@ -1,7 +1,8 @@
 from __future__ import absolute_import
 
+from .tickers import Ticker
 from ..plot_object import PlotObject
-from ..properties import Bool, Int, String, Enum, Auto, List, Dict, Either
+from ..properties import Bool, Int, String, Enum, Auto, List, Dict, Either, Instance
 from ..enums import DatetimeUnits
 
 class TickFormatter(PlotObject):
@@ -30,7 +31,7 @@ class LogTickFormatter(TickFormatter):
     Often useful in conjuction with a `LogTicker`
 
     """
-    pass
+    ticker = Instance(Ticker)
 
 class CategoricalTickFormatter(TickFormatter):
     """ Format ticks as categories from categorical ranges"""
diff --git a/bokeh/models/tickers.py b/bokeh/models/tickers.py
--- a/bokeh/models/tickers.py
+++ b/bokeh/models/tickers.py
@@ -51,7 +51,7 @@ class SingleIntervalTicker(Ticker):
     """
     interval = Float
 
-class DaysTicker(Ticker):
+class DaysTicker(SingleIntervalTicker):
     """ Generate ticks spaced apart by specific, even multiples of days.
 
     Attributes:
@@ -60,7 +60,7 @@ class DaysTicker(Ticker):
     """
     days = List(Int)
 
-class MonthsTicker(Ticker):
+class MonthsTicker(SingleIntervalTicker):
     """ Generate ticks spaced apart by specific, even multiples of months.
 
     Attributes:
@@ -69,15 +69,15 @@ class MonthsTicker(Ticker):
     """
     months = List(Int)
 
-class YearsTicker(Ticker):
+class YearsTicker(SingleIntervalTicker):
     """ Generate ticks spaced even numbers of years apart. """
     pass
 
-class BasicTicker(Ticker):
+class BasicTicker(AdaptiveTicker):
     """ Generate ticks on a linear scale. """
     pass
 
-class LogTicker(Ticker):
+class LogTicker(AdaptiveTicker):
     """ Generate ticks on a log scale. """
     pass
 


Test patch:
Repository: bokeh/bokeh

Issue:
GridPlot should accept None for empty positions
Should be able to write:

```
GridPlot(Children=[a, b, c], [d, None, f])
```



Discussion:

Resolving patch:
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
@@ -1,6 +1,6 @@
 import numpy as np
 
-from bokeh.plotting import *
+from bokeh.plotting import figure, gridplot, output_file, show
 
 N = 50
 
@@ -11,20 +11,21 @@
 
 TOOLS = "pan,wheel_zoom,box_zoom,reset,save,crosshair"
 
-l = figure(title="line", tools=TOOLS)
+l = figure(title="line", tools=TOOLS, plot_width=300, plot_height=300)
 l.line(x,y, line_width=3, color="gold")
 
-aw = figure(title="annular wedge", tools=TOOLS)
+aw = figure(title="annular wedge", tools=TOOLS, plot_width=300, plot_height=300)
 aw.annular_wedge(x, y, 10, 20, 0.6, 4.1, color="navy", alpha=0.5,
     inner_radius_units="screen", outer_radius_units="screen")
 
-bez = figure(title="bezier", tools=TOOLS)
+bez = figure(title="bezier", tools=TOOLS, plot_width=300, plot_height=300)
 bez.bezier(x, y, x+0.4, y, x+0.1, y+0.2, x-0.1, y-0.2,
     line_width=2, color="olive")
 
-q = figure(title="quad", tools=TOOLS)
+q = figure(title="quad", tools=TOOLS, plot_width=300, plot_height=300)
 q.quad(x, x-0.2, y, y-0.2, color="tomato", alpha=0.4)
 
-p = gridplot([[l,aw],[bez,q]])
+# specify "empty" grid cells with None
+p = gridplot([[l, None, aw], [bez, q, None]])
 
 show(p)
diff --git a/examples/plotting/server/grid.py b/examples/plotting/server/grid.py
--- a/examples/plotting/server/grid.py
+++ b/examples/plotting/server/grid.py
@@ -3,7 +3,7 @@
 
 import numpy as np
 
-from bokeh.plotting import *
+from bokeh.plotting import figure, gridplot, output_server, show
 
 N = 50
 
@@ -14,19 +14,21 @@
 
 TOOLS = "pan,wheel_zoom,box_zoom,reset,save"
 
-l = figure(title="line", tools=TOOLS)
+l = figure(title="line", tools=TOOLS, plot_width=300, plot_height=300)
 l.line(x,y, line_width=3, color="gold")
 
-aw = figure(title="annular wedge", tools=TOOLS)
+aw = figure(title="annular wedge", tools=TOOLS, plot_width=300, plot_height=300)
 aw.annular_wedge(x, y, 10, 20, 0.6, 4.1, color="navy", alpha=0.5,
     inner_radius_units="screen", outer_radius_units="screen")
 
-bez = figure(title="bezier", tools=TOOLS)
+bez = figure(title="bezier", tools=TOOLS, plot_width=300, plot_height=300)
 bez.bezier(x, y, x+0.4, y, x+0.1, y+0.2, x-0.1, y-0.2,
     line_width=2, color="olive")
 
-q = figure(title="quad", tools=TOOLS)
+q = figure(title="quad", tools=TOOLS, plot_width=300, plot_height=300)
 q.quad(x, x-0.2, y, y-0.2, color="tomato", alpha=0.4)
 
-p = gridplot([[l,aw],[bez,q]])
+# specify "empty" grid cells with None
+p = gridplot([[l, None, aw], [bez, q, None]])
+
 show(p)


Test patch: