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

Issue:
remove hard dependency on scipy in mpl_helpers
Imports are here:

https://github.com/bokeh/bokeh/blob/master/bokeh/compat/mpl_helpers.py#L19

They are used by `xkcd_line`. Moving them inside the function (perhaps with a `try`, `except` and a more informative error message) should fix. 



Discussion:

Resolving patch:
diff --git a/bokeh/compat/mpl_helpers.py b/bokeh/compat/mpl_helpers.py
--- a/bokeh/compat/mpl_helpers.py
+++ b/bokeh/compat/mpl_helpers.py
@@ -16,7 +16,6 @@
 import numpy as np
 
 from itertools import cycle, islice
-from scipy import interpolate, signal
 
 from ..models import GlyphRenderer
 
@@ -117,6 +116,12 @@ def xkcd_line(x, y, xlim=None, ylim=None, mag=1.0, f1=30, f2=0.001, f3=5):
     x, y : ndarrays
         The modified lines
     """
+    try:
+        from scipy import interpolate, signal
+    except ImportError:
+        print("\nThe SciPy package is required to use the xkcd_line function.\n")
+        raise
+
     x = np.asarray(x)
     y = np.asarray(y)
 


Test patch:
Repository: bokeh/bokeh

Issue:
Have glyph methods return the glyph renderer, not the plot
Currently, glyph methods return the plot they are on, which allows for chaining:

```
p = figure()
p.circle(...).line(...)
```

But my guess is this is rarely done, by anyone. It has been suggested that it would be more useful if the glyph method returned the renderer instead:

```
p = figure()
cr = p.circle(...)

# easily use `cr` in tools, set its properties, etc.
hover.renderers = [cr]
cr.nonselection_glyph.fill_alpha = 0.2
```

@bokeh/dev  thoughts? I would even suggest changing this for `0.10` if we are in agreement.



Discussion:
Setting as discussion for now but will change to `feature` if there is agreement. 

+10 on this and +1 for sticking it in `0.10`... it is a very nice shortcut. 

(sorry @damianavila .. I know you like the method chaining pattern :stuck_out_tongue_closed_eyes: )

I'm :+1: on this also. I've never chained glyph methods (i.e. taken advantage of the returned plot obj). I do like the easier way to "get" the renderer than using the select syntax we have.

Good bye chained method... I :heart: you, but there is no place for you here... :stuck_out_tongue_winking_eye: 

Trend seems to be towards agreement then. Planning for `0.10` unless there is some strenuous objection. 

+1

:+1: yay - i might even start liking the `plotting` interface :wink: 

+1


Resolving patch:
diff --git a/bokeh/_glyph_functions.py b/bokeh/_glyph_functions.py
--- a/bokeh/_glyph_functions.py
+++ b/bokeh/_glyph_functions.py
@@ -48,7 +48,7 @@ def func(plot, *args, **kwargs):
 
         plot.renderers.append(glyph_renderer)
         plot._dirty = True
-        return plot
+        return glyph_renderer
 
     func.__name__ = glyphclass.__view_model__
     func.__doc__ = docstring
diff --git a/sphinx/source/docs/user_guide/source_examples/styling_glyph_properties.py b/sphinx/source/docs/user_guide/source_examples/styling_glyph_properties.py
--- a/sphinx/source/docs/user_guide/source_examples/styling_glyph_properties.py
+++ b/sphinx/source/docs/user_guide/source_examples/styling_glyph_properties.py
@@ -3,9 +3,9 @@
 output_file("axes.html")
 
 p = figure(plot_width=400, plot_height=400)
-p.circle([1,2,3,4,5], [2,5,8,2,7], name="mycircle")
+r = p.circle([1,2,3,4,5], [2,5,8,2,7])
 
-glyph = p.select(name="mycircle")[0].glyph
+glyph = r.glyph
 glyph.size = 60
 glyph.fill_alpha = 0.2
 glyph.line_color = "firebrick"


Test patch:
Repository: bokeh/bokeh

Issue:
Scrolling on Info page of User Guide is broken
On the Learning More page ( _http://bokeh.pydata.org/en/latest/docs/user_guide/info.html_ ), scrolling down with lock the sidebar in a strange position.  At this point, scrolling is no longer possible.

<img width="1055" alt="screen shot 2015-07-13 at 12 07 08 pm" src="https://cloud.githubusercontent.com/assets/1417520/8655633/187f29cc-2958-11e5-9311-1f3a9bc3f603.png">



Discussion:

Resolving patch:
diff --git a/sphinx/source/conf.py b/sphinx/source/conf.py
--- a/sphinx/source/conf.py
+++ b/sphinx/source/conf.py
@@ -161,7 +161,7 @@
 
     # Fix navigation bar to top of page?
     # Values: "true" (default) or "false"
-    'navbar_fixed_top': "true",
+    'navbar_fixed_top': "false",
 
     # Location of link to source.
     # Options are "nav" (default), "footer" or anything else to exclude.


Test patch:
Repository: bokeh/bokeh

Issue:
Make .clone private
Ref: https://github.com/bokeh/bokeh/pull/2909#issuecomment-151256258



Discussion:

Resolving patch:
diff --git a/bokeh/charts/builder.py b/bokeh/charts/builder.py
--- a/bokeh/charts/builder.py
+++ b/bokeh/charts/builder.py
@@ -277,11 +277,11 @@ def _setup_attrs(self, data, kws):
 
             # if we are given columns, use those
             elif isinstance(attr, str) or isinstance(attr, list):
-                attributes[attr_name] = self.default_attributes[attr_name].clone()
+                attributes[attr_name] = self.default_attributes[attr_name]._clone()
                 attributes[attr_name].setup(data=source, columns=attr)
 
             else:
-                attributes[attr_name] = self.default_attributes[attr_name].clone()
+                attributes[attr_name] = self.default_attributes[attr_name]._clone()
 
         # make sure all have access to data source
         for attr_name in attr_names:
diff --git a/bokeh/properties.py b/bokeh/properties.py
--- a/bokeh/properties.py
+++ b/bokeh/properties.py
@@ -460,7 +460,7 @@ 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 clone(self):
+    def _clone(self):
         """ Returns a duplicate of this object with all its properties
         set appropriately.  Values which are containers are shallow-copied.
         """


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
@@ -993,7 +993,7 @@ def test_HasProps_clone():
     from bokeh.models import Plot
     p1 = Plot(plot_width=1000)
     c1 = p1.changed_properties()
-    p2 = p1.clone()
+    p2 = p1._clone()
     c2 = p2.changed_properties()
     assert c1 == c2
Repository: bokeh/bokeh

Issue:
Selection of lines need improvements
The support for selection/picking of lines could do with some improvements:
- The distance threshold to determine if the pick was close enough to the line is expressed in data coordinates. This should be in pixels, and probably scaled with line width.
- The hit test result should include a reference to the line being clicked.
- I can imagine that optimiziations are possible when the line contains many points.

Some of the above might apply to other glyphs as well.



Discussion:

Resolving patch:
diff --git a/examples/plotting/file/line_select.py b/examples/plotting/file/line_select.py
new file mode 100644
--- /dev/null
+++ b/examples/plotting/file/line_select.py
@@ -0,0 +1,36 @@
+"""
+Example demonstrating the picking of line objects.
+"""
+
+import numpy as np
+from bokeh.plotting import output_file, show, figure, Figure
+from bokeh.models import TapTool, CustomJS, ColumnDataSource
+
+# The data is setup to have very different scales in x and y, to verify
+# that picking happens in pixels. Different widths are used to test that
+# you can click anywhere on the visible line.
+
+code = """
+d0 = cb_obj.get("selected")["0d"];
+if (d0.glyph) {
+    var color = d0.glyph.visuals.line.color.value();
+    var data = source.get('data');
+    data['text'] = ['Selected the ' + color + ' line'];
+    source.trigger('change');
+}
+"""
+
+p = figure()
+t = np.linspace(0, 0.1, 100)
+l1 = p.line(t, 100*np.sin(t*50), color='red', line_width=25)
+l2 = p.line(t, 100*np.sin(t*50+1), color='green', line_width=5)
+l3 = p.line(t, 100*np.sin(t*50+2), color='blue',  line_width=1)
+
+# We use a source to easily update the text of the text-glyph
+source = ColumnDataSource(data=dict(x=[0], y=[-100], text=['no line selected']))
+t = p.text(source=source)
+
+p.tools.append(TapTool(plot=p, callback=CustomJS(code=code, args={'source': source})))
+
+output_file("line_select.html")
+show(p)


Test patch:
Repository: bokeh/bokeh

Issue:
Remove GeoJSPlot
More precisely:

```
ReferenceError: Can't find variable: vec3
    http://opengeoscience.github.io/geojs/lib/geo.js?_=1412857616442: 324
```

Do we really depend on an unspecified version of `geo.js`?



Discussion:
This is support some immediate term memex work collaboration going on right now and will be tightened up in follow on prs. 

@pzwang following up on recent OOB discussion, I would actually like to remove `GeoJSPlot`. 

OK, can we stick it in an attic or somewhere so we don't completely lose it?  

I've never understood "attics" isn't that what revision history is for?

@mattpap - glyphs/map.py is now working - but I don't think we're pinned to a specific version of `geo.js` yet. want to close?

`glyphs/map.py` uses `GMapPlot`  


Resolving patch:
diff --git a/bokeh/models/map_plots.py b/bokeh/models/map_plots.py
--- a/bokeh/models/map_plots.py
+++ b/bokeh/models/map_plots.py
@@ -84,34 +84,3 @@ def _check_no_glyph_renderers(self):
     """)
 
     border_fill_color = Override(default="#ffffff")
-
-class GeoJSOptions(MapOptions):
-    """ Options for GeoJSPlot objects.
-
-    """
-
-class GeoJSPlot(MapPlot):
-    """ A Bokeh Plot with a `GeoJS Map`_ displayed underneath.
-
-    .. warning::
-        GeoJSPlot support should be considered experimental, a subject
-        to revision or removal.
-
-    .. _GeoJS Map: https://github.com/OpenGeoscience/geojs
-
-    """
-
-    # TODO (bev) map plot might not have these
-    @validation.error(REQUIRED_RANGE)
-    def _check_required_range(self):
-        pass
-    @validation.warning(MISSING_RENDERERS)
-    def _check_missing_renderers(self):
-        pass
-    @validation.warning(NO_GLYPH_RENDERERS)
-    def _check_no_glyph_renderers(self):
-        pass
-
-    map_options = Instance(GeoJSOptions, help="""
-    Options for displaying the plot.
-    """)


Test patch:
Repository: bokeh/bokeh

Issue:
large object graphs
when a single bokeh document has a larg-ish number of objects (80 line plots) we reach maximum recursion depth trying to traverse them all



Discussion:
This can be reproduced with:

``` python
In [24]: from bokeh.plotting import *

In [25]: output_file("some.html")

In [26]: for i in xrange(55): line([0, i+1], [0, i+1])

In [27]: show()
```

Fails in `recursively_traverse_plot_object()`.


Resolving patch:
diff --git a/bokeh/model.py b/bokeh/model.py
--- a/bokeh/model.py
+++ b/bokeh/model.py
@@ -209,17 +209,24 @@ def collect_models(cls, *input_values):
         is duplicate-free based on objects' identifiers.
         """
         ids = set([])
-        objs = []
+        collected = []
+        queued = []
 
-        def collect_one(obj):
+        def queue_one(obj):
             if obj._id not in ids:
-                ids.add(obj._id)
-                cls._visit_immediate_value_references(obj, collect_one)
-                objs.append(obj)
+                queued.append(obj)
 
         for value in input_values:
-            cls._visit_value_and_its_immediate_references(value, collect_one)
-        return objs
+            cls._visit_value_and_its_immediate_references(value, queue_one)
+
+        while queued:
+            obj = queued.pop(0)
+            if obj._id not in ids:
+                ids.add(obj._id)
+                collected.append(obj)
+                cls._visit_immediate_value_references(obj, queue_one)
+
+        return collected
 
     def references(self):
         """Returns all ``Models`` that this object has references to. """


Test patch:
diff --git a/bokeh/tests/test_objects.py b/bokeh/tests/test_objects.py
--- a/bokeh/tests/test_objects.py
+++ b/bokeh/tests/test_objects.py
@@ -77,10 +77,27 @@ def test_get_class(self):
         self.assertTrue(hasattr(tclass, 'foo'))
         self.assertRaises(KeyError, self.viewable.get_class, 'Imaginary_Class')
 
+class DeepModel(Model):
+    child = Instance(Model)
+
 class TestCollectModels(unittest.TestCase):
 
     def test_references_large(self):
-        root, objects = large_plot(500)
+        root, objects = large_plot(10)
+        self.assertEqual(set(root.references()), objects)
+
+    def test_references_deep(self):
+        root = DeepModel()
+        objects = set([root])
+        parent = root
+        # in a previous implementation, about 400 would blow max
+        # recursion depth, so we double that and a little bit,
+        # here.
+        for i in xrange(900):
+            model = DeepModel()
+            objects.add(model)
+            parent.child = model
+            parent = model
         self.assertEqual(set(root.references()), objects)
 
 class SomeModelToJson(Model):
Repository: bokeh/bokeh

Issue:
Document does not maintain object insertion order
This is because `roots` in a `Document` is a set. This behavior is easily visible in, e.g., `glyphs/gears` example.



Discussion:

Resolving patch:
diff --git a/bokeh/document.py b/bokeh/document.py
--- a/bokeh/document.py
+++ b/bokeh/document.py
@@ -187,7 +187,7 @@ def get_all(self, k):
 class Document(object):
 
     def __init__(self, **kwargs):
-        self._roots = set()
+        self._roots = list()
         self._theme = kwargs.pop('theme', default_theme)
         # use _title directly because we don't need to trigger an event
         self._title = kwargs.pop('title', DEFAULT_TITLE)
@@ -272,7 +272,7 @@ def _recompute_all_models(self):
 
     @property
     def roots(self):
-        return set(self._roots)
+        return list(self._roots)
 
     @property
     def title(self):
@@ -320,7 +320,7 @@ def add_root(self, model):
             return
         self._push_all_models_freeze()
         try:
-            self._roots.add(model)
+            self._roots.append(model)
         finally:
             self._pop_all_models_freeze()
         self._trigger_on_change(RootAddedEvent(self, model))


Test patch:
diff --git a/bokeh/tests/test_document.py b/bokeh/tests/test_document.py
--- a/bokeh/tests/test_document.py
+++ b/bokeh/tests/test_document.py
@@ -30,6 +30,23 @@ def test_add_roots(self):
         assert len(d.roots) == 1
         assert next(iter(d.roots)).document == d
 
+    def test_roots_preserves_insertion_order(self):
+        d = document.Document()
+        assert not d.roots
+        roots = [
+            AnotherModelInTestDocument(),
+            AnotherModelInTestDocument(),
+            AnotherModelInTestDocument(),
+        ]
+        for r in roots:
+            d.add_root(r)
+        assert len(d.roots) == 3
+        assert type(d.roots) is list
+        roots_iter = iter(d.roots)
+        assert next(roots_iter) is roots[0]
+        assert next(roots_iter) is roots[1]
+        assert next(roots_iter) is roots[2]
+
     def test_set_title(self):
         d = document.Document()
         assert d.title == document.DEFAULT_TITLE
Repository: bokeh/bokeh

Issue:
Bokeh CDN doesn't support HTTPS
I just uploaded a plot rendered with `output_file('plot.html', mode='cdn')` to an HTTPS-enabled website. But the plot doesn't show up in Chrome and Firefox. Here is the error message in Chrome:

> Mixed Content: The page at '……/plot.html' was loaded over HTTPS, but requested an insecure stylesheet 'http://cdn.pydata.org/bokeh/release/bokeh-0.9.1.min.css'. This request has been blocked; the content must be served over HTTPS.

and in Firefox:

> Blocked loading mixed active content "http://cdn.pydata.org/bokeh/release/bokeh-0.9.1.min.css"1 simple-plot-one.html

Please add support for HTTPS. Many websites have enabled HTTPS and HTTPS can't be selectively disabled for some pages. 



Discussion:
Thanks for reporting this. I think we should support it.

Hopefully you know in the meantime how to host this content yourself so that you can serve your bokeh plots over https. If not, feel free to ask.

Thanks for your quick response! I'm looking forward to it.

(By using the 'inline' mode I managed to host it over https. However I'm using http right now to make use of the cdn, so that the generated html files can be much smaller.)

I've started a conversation with the IT folks who will have to help with this. A quick look at the current cloud files interface it's not as simple as just flipping a switch. 

BokehJS is now available through https:

https://cdn.pydata.org/bokeh/release/bokeh-0.10.0.min.js

Next steps, to update the default CDN resources to always use this. I would suggest doing this _after_ the new server PR lands to avoid conflicts. 

ping @havocp @damianavila @mattpap 


Resolving patch:
diff --git a/bokeh/resources.py b/bokeh/resources.py
--- a/bokeh/resources.py
+++ b/bokeh/resources.py
@@ -58,7 +58,7 @@ def server_url_for_websocket_url(url):
 
 
 def _cdn_base_url():
-    return "http://cdn.pydata.org"
+    return "https://cdn.pydata.org"
 
 
 def _get_cdn_urls(components, version=None, minified=True):


Test patch:
Repository: bokeh/bokeh

Issue:
Server breaks with tornado versions < 4.3
Using server callbacks with tornado version < `4.3`  raises the following error:

```
  File "/Users/fpliger/dev/repos/bokeh/bokeh/util/tornado.py", line 41, in schedule
    return gen.multi([sleep_future, callback_future])
AttributeError: 'module' object has no attribute 'multi'
```



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -512,7 +512,7 @@ def parse_jsargs():
         'python-dateutil>=2.1',
         'Jinja2>=2.7',
         'numpy>=1.7.1',
-        'tornado>=4.0.1',
+        'tornado>=4.3',
     ]
 
 if sys.version_info[:2] == (2, 7):


Test patch:
Repository: bokeh/bokeh

Issue:
Boxplot whisker, marker styles ignored
```
examples/charts/file/boxplot_multi.py:
 whisker color ignored, marker style ignored
```

ping @fpliger @rothnic Could consider this for a fix if it is e.g., one-line-ish totally in `bokeh.charts`



Discussion:

Resolving patch:
diff --git a/bokeh/charts/builder.py b/bokeh/charts/builder.py
--- a/bokeh/charts/builder.py
+++ b/bokeh/charts/builder.py
@@ -487,8 +487,11 @@ def _get_label(raw_label):
         return str(raw_label)
 
     def collect_attr_kwargs(self):
-        attrs = set(self.default_attributes.keys()) - set(
-            self.__class__.default_attributes.keys())
+        if hasattr(super(self.__class__, self), 'default_attributes'):
+            attrs = set(self.default_attributes.keys()) - set(
+                (super(self.__class__, self).default_attributes or {}).keys())
+        else:
+            attrs = set()
         return attrs
 
     def get_group_kwargs(self, group, attrs):
diff --git a/bokeh/charts/builders/bar_builder.py b/bokeh/charts/builders/bar_builder.py
--- a/bokeh/charts/builders/bar_builder.py
+++ b/bokeh/charts/builders/bar_builder.py
@@ -179,13 +179,24 @@ def yield_renderers(self):
             glyph_kwargs = self.get_group_kwargs(group, attrs)
             group_kwargs = kwargs.copy()
             group_kwargs.update(glyph_kwargs)
+            props = self.glyph.properties().difference(set(['label']))
+
+            # make sure we always pass the color and line color
+            for k in ['color', 'line_color']:
+                group_kwargs[k] = group[k]
+
+            # TODO(fpliger): we shouldn't need to do this to ensure we don't
+            #               have extra kwargs... this is needed now because
+            #               of label, group and stack being "special"
+            for k in set(group_kwargs):
+                if k not in props:
+                    group_kwargs.pop(k)
+
             bg = self.glyph(label=group.label,
                             x_label=self._get_label(group['label']),
                             values=group.data[self.values.selection].values,
                             agg=stats[self.agg](),
                             width=self.bar_width,
-                            color=group['color'],
-                            line_color=group['line_color'],
                             fill_alpha=self.fill_alpha,
                             stack_label=self._get_label(group['stack']),
                             dodge_label=self._get_label(group['group']),
diff --git a/bokeh/charts/glyphs.py b/bokeh/charts/glyphs.py
--- a/bokeh/charts/glyphs.py
+++ b/bokeh/charts/glyphs.py
@@ -119,6 +119,8 @@ def __init__(self, x=None, y=None, color=None, line_color=None, fill_color=None,
                  marker=None, size=None, **kwargs):
         kwargs['x'] = x
         kwargs['y'] = y
+        if marker is not None: kwargs['marker'] = marker
+        if size is not None: kwargs['size'] = size
 
         if color:
             line_color = color


Test patch:
Repository: bokeh/bokeh

Issue:
bokeh.resources.INLINE.render_js() unnecessarily exposes minor info about server in HTML (0.11.0.dev7)
Hello, I am using bokeh.resources.INLINE.render_js() to embed bokeh's required JS resources.
I've noticed quite a few comments of the form:

```
/* BEGIN /path/to/bokeh_js_file.js */
\<js code here\>
/* END /path/to/bokeh_js_file.js */ 
```

This path exposes things like the username of the computer, path to python libraries, whether or not a virtual env is used, etc... None of this is a major security concern per se, but I don't think it should be available in the HTML for the world to see. It looks like this is done by the _inline method BaseResources (https://github.com/bokeh/bokeh/blob/master/bokeh/resources.py#L305), so I assume the same problem occurs with bokeh.resources.INLINE.render_css().

Can we have this disabled by default?



Discussion:
Agreed, always providing full path is unnecessary.

+1 


Resolving patch:
diff --git a/bokeh/resources.py b/bokeh/resources.py
--- a/bokeh/resources.py
+++ b/bokeh/resources.py
@@ -16,7 +16,7 @@
 logger = logging.getLogger(__name__)
 
 import copy
-from os.path import join, relpath
+from os.path import basename, join, relpath
 import re
 
 from . import __version__
@@ -303,13 +303,13 @@ def _resolve(self, kind):
         return (files, raw)
 
     def _inline(self, path):
-        begin = "/* BEGIN %s */" % path
+        begin = "/* BEGIN %s */" % basename(path)
         try:
             with open(path, 'rb') as f:
                 middle = f.read().decode("utf-8")
         except IOError:
             middle = ""
-        end = "/* END %s */" % path
+        end = "/* END %s */"  % basename(path)
         return "%s\n%s\n%s" % (begin, middle, end)
 
 class JSResources(BaseResources):


Test patch:
Repository: bokeh/bokeh

Issue:
ImageURL example in reference guide is broken
The example doesn't render an image, just a gridded, empty plot.

http://bokeh.pydata.org/en/latest/docs/reference/models/glyphs.html#bokeh.models.glyphs.ImageURL



Discussion:

Resolving patch:
diff --git a/examples/glyphs/image_url.py b/examples/glyphs/image_url.py
--- a/examples/glyphs/image_url.py
+++ b/examples/glyphs/image_url.py
@@ -8,7 +8,7 @@
 from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
 from bokeh.resources import INLINE
 
-url = "http://bokeh.pydata.org/en/latest/_static/bokeh-transparent.png"
+url = "http://bokeh.pydata.org/en/latest/_static/images/logo.png"
 N = 5
 
 source = ColumnDataSource(dict(


Test patch:
diff --git a/tests/glyphs/ImageURL.py b/tests/glyphs/ImageURL.py
--- a/tests/glyphs/ImageURL.py
+++ b/tests/glyphs/ImageURL.py
@@ -6,7 +6,7 @@
 from bokeh.models.glyphs import ImageURL
 from bokeh.plotting import show
 
-url = "http://bokeh.pydata.org/en/latest/_static/bokeh-transparent.png"
+url = "http://bokeh.pydata.org/en/latest/_static/images/logo.png"
 N = 5
 
 source = ColumnDataSource(dict(