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

Issue:
Better message when the you have forgot to start the bokeh-server
If you try a server example, and you did not start the bokeh-server previously, you get something like this (not informative enough):

```
(bokeh-dev)damian@damian-S400CA:/media/datos/Desarrollos/bokeh/examples/embed$ python animated.py 
Using saved session configuration for http://localhost:5006/
To override, pass 'load_from_config=False' to Session
Traceback (most recent call last):
  File "animated.py", line 23, in <module>
    output_server("animated")
  File "/media/datos/Desarrollos/bokeh/bokeh/plotting.py", line 131, in output_server
    session.use_doc(docname)
  File "/media/datos/Desarrollos/bokeh/bokeh/session.py", line 314, in use_doc
    self.docid = self.find_doc(name)
  File "/media/datos/Desarrollos/bokeh/bokeh/session.py", line 295, in find_doc
    docs = self.userinfo.get('docs')
  File "/media/datos/Desarrollos/bokeh/bokeh/session.py", line 258, in userinfo
    self._userinfo = self.get_json(url)
  File "/media/datos/Desarrollos/bokeh/bokeh/session.py", line 249, in get_json
    return self.execute_json('get', url, headers=headers, **kwargs)
  File "/media/datos/Desarrollos/bokeh/bokeh/session.py", line 241, in execute_json
    resp = func(url, headers=headers, **kwargs)
  File "/media/datos/virtualenvs/bokeh-dev/local/lib/python2.7/site-packages/requests/sessions.py", line 395, in get
    return self.request('GET', url, **kwargs)
  File "/media/datos/virtualenvs/bokeh-dev/local/lib/python2.7/site-packages/requests/sessions.py", line 383, in request
    resp = self.send(prep, **send_kwargs)
  File "/media/datos/virtualenvs/bokeh-dev/local/lib/python2.7/site-packages/requests/sessions.py", line 486, in send
    r = adapter.send(request, **kwargs)
  File "/media/datos/virtualenvs/bokeh-dev/local/lib/python2.7/site-packages/requests/adapters.py", line 378, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=5006): Max retries exceeded with url: /bokeh/userinfo/ (Caused by <class 'socket.error'>: [Errno 111] Connection refused)
```

Maybe we can try to catch this exception and warn the user about starting the bokeh-server before trying again...



Discussion:

Resolving patch:
diff --git a/bokeh/session.py b/bokeh/session.py
--- a/bokeh/session.py
+++ b/bokeh/session.py
@@ -238,7 +238,13 @@ def execute_json(self, method, url, headers=None, **kwargs):
         if headers is None:
             headers={'content-type':'application/json'}
         func = getattr(self.http_session, method)
-        resp = func(url, headers=headers, **kwargs)
+        import requests
+        import warnings
+        try:
+            resp = func(url, headers=headers, **kwargs)
+        except requests.exceptions.ConnectionError as e:
+            warnings.warn("You need to start the bokeh-server to see this example.")
+            raise e
         if resp.status_code == 409:
             raise DataIntegrityException
         if resp.status_code == 401:


Test patch:
Repository: bokeh/bokeh

Issue:
update fails on python3
`$ pip install -U bokeh` on python3 fails because of `val = raw_input("found existing bokeh install, remove it?[y|N]")` in `setup.py` (line 257).



Discussion:
I don't think your fix in master is the best option, you are using six... but six is installed by `setup.py`, so I did not try it yet... but it will probably fail in a new environment.

wait i don't get it - I thought someone already fixed this, because that section of code checks for python versions and dispatches between input and raw_input?

Why doesn't this work?

https://github.com/ContinuumIO/bokeh/pull/818/files

Using `six` was my idea, did not occur to my that it might not already be installed.

@vanzaj did you get this error installing off of master? or one of the tags?  

Whatever gets pushed to pypi. I did a `pip install -U` to upgrade to 0.5.0 from 0.4.4. 

Can you run try the following lines in your ipython/python interpreter:

``` python
import bokeh
bokeh.report_issue(873)
```

This interactive function will guide you and print (automatically) the current version and architecture in this issue.

I think this was a problem in 0.5 and fixed after. Should revert before 0.5.1 release. 

Bryan

> On Jul 21, 2014, at 5:37, Damián Avila notifications@github.com wrote:
> 
> Can you run try the following lines in your ipython/python interpreter:
> 
> import bokeh
> bokeh.report_issue(873)
> This interactive function will guide you and print (automatically) the current version and architecture in this issue.
> 
> —
> Reply to this email directly or view it on GitHub.

@damianavila, it's already been fixed. It was just a case that got triggered only when you tried to upgrade an already installed package.

OK, will revert master then... Closing here...


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,6 @@
 import platform
 import shutil
 import site
-from six.moves import input
 import subprocess
 import sys
 
@@ -256,13 +255,13 @@ def getsitepackages():
 bokeh_path = join(site_packages, "bokeh")
 if exists(bokeh_path) and isdir(bokeh_path):
     if sys.version_info[0] < 3:
-        val = input("found existing bokeh install, remove it?[y|N]")
+        val = raw_input("found existing bokeh install, remove it?[y|N]")
     else:
         val = input("found existing bokeh install, remove it?[y|N]")
     if val == "y":
-        print("removing old bokeh install")
+        print ("removing old bokeh install")
         shutil.rmtree(bokeh_path)
-    print("not removing old bokeh install")
+    print ("not removing old bokeh install")
 
 path_file = join(site_packages, "bokeh.pth")
 path = abspath(dirname(__file__))


Test patch:
Repository: bokeh/bokeh

Issue:
Add HoverTool for patches
It would be useful to have a HoverTool in patches to display more information using maps. Similar to the Periodic Table, but for countries/states...

Here are some of Peter's thoughts on what would it be needed:

> So, what is needed in order for this to work is for patches.coffee renderer to create an rbush() in its initializer (just like circle.coffee does). It needs to insert the bounding box of each patch into the rbush and then in hit testing, it needs to retrieve the candidate patches and then do a full point-in-polygon test via e.g. http://jsfromhell.com/math/is-point-in-poly . In general, for GIS applications, the amount of bounding-box overlap is not usually a problem unless you zoom waaaay out eventually it may behoove us to have some optimizations to compute simplified outlines of polygons



Discussion:
I tried to do this today and was sad when it didn't work; +1 on usefulness.


Resolving patch:
diff --git a/examples/plotting/file/texas.py b/examples/plotting/file/texas.py
--- a/examples/plotting/file/texas.py
+++ b/examples/plotting/file/texas.py
@@ -1,6 +1,8 @@
 
 from bokeh.sampledata import us_counties, unemployment
 from bokeh.plotting import *
+from bokeh.objects import HoverTool
+from collections import OrderedDict
 
 county_xs=[
     us_counties.data[code]['lons'] for code in us_counties.data
@@ -26,7 +28,17 @@
 
 output_file("texas.html", title="texas.py example")
 
-patches(county_xs, county_ys, fill_color=county_colors, fill_alpha=0.7,
+TOOLS="pan,wheel_zoom,box_zoom,reset,hover,previewsave"
+
+patches(county_xs, county_ys, fill_color=county_colors, fill_alpha=0.7, tools=TOOLS,
         line_color="white", line_width=0.5, title="Texas Unemployment 2009")
 
+hover = [t for t in curplot().tools if isinstance(t, HoverTool)][0]
+
+hover.tooltips = OrderedDict([
+    ("index", "$index"),
+    ("(x,y)", "($x, $y)"),
+    ("fill color", "$color[hex, swatch]:fill_color"),
+])
+
 show()


Test patch:
Repository: bokeh/bokeh

Issue:
All plots in Charts.ipynb get the yaxis label cut in ipython notebook (dev-0.5.2)
![screen shot 2014-08-03 at 4 23 18 am](https://cloud.githubusercontent.com/assets/4940549/3790204/f3ac1316-1aef-11e4-8a8b-5b81ece3a8f7.png)



Discussion:
This is a dupe. 

> On Aug 3, 2014, at 10:25, chdoig notifications@github.com wrote:
> 
> —
> Reply to this email directly or view it on GitHub.

What's the issue number?

In fact, I forgot to open the issue... it was discussed in FD... assigning to myself.


Resolving patch:
diff --git a/bokeh/charts/_charts.py b/bokeh/charts/_charts.py
--- a/bokeh/charts/_charts.py
+++ b/bokeh/charts/_charts.py
@@ -258,7 +258,9 @@ def start_plot(self):
 
         # Add axis
         xaxis = self.make_axis("bottom", self.xscale, self.xlabel)
+        self.plot.below.append(xaxis)
         yaxis = self.make_axis("left", self.yscale, self.ylabel)
+        self.plot.left.append(yaxis)
 
         # Add grids
         self.make_grid(xaxis, 0)


Test patch:
Repository: bokeh/bokeh

Issue:
examples/glyphs/daylight contains duplicated yaxis
Since a25e912f7f82803692c5580ddb366da6eeb23d6a.



Discussion:
@mattpap I am not seeing this? This is on master:

![screen shot 2014-08-12 at 9 56 38 am](https://cloud.githubusercontent.com/assets/1078448/3892260/fa7257a8-2230-11e4-9528-b29afec8a013.png)

Can you provide more information?

The title might be misleading. See here: https://github.com/ContinuumIO/bokeh/blob/master/examples/glyphs/daylight.py#L86.

@Maggie-M please create a branch and PR that removes the duplicated line. 


Resolving patch:
diff --git a/examples/glyphs/daylight.py b/examples/glyphs/daylight.py
--- a/examples/glyphs/daylight.py
+++ b/examples/glyphs/daylight.py
@@ -83,7 +83,6 @@
 plot.below.append(xaxis)
 yaxis = DatetimeAxis(plot=plot, location="left")
 plot.left.append(yaxis)
-yaxis = DatetimeAxis(plot=plot, location="left")
 xgrid = Grid(plot=plot, dimension=0, axis=xaxis)
 ygrid = Grid(plot=plot, dimension=1, axis=yaxis)
 


Test patch:
Repository: bokeh/bokeh

Issue:
Multiple plots in a notebook not showing content in the first plot.
Affected examples:
- glucose.ipynb
- correlation.ipynb 
- rect.ipynb
- scatter.ipynb
- glyphs.ipynb
- stocks.ipynb
- vector.ipynb



Discussion:
Here is what I see...

![glucose](https://cloud.githubusercontent.com/assets/1640669/3957252/1389d5f8-2714-11e4-8ec8-a9bdd9138df6.png)

OK, further investigation point to this merged PR as the "guilty" commit: https://github.com/ContinuumIO/bokeh/pull/997


Resolving patch:
diff --git a/bokeh/plotting.py b/bokeh/plotting.py
--- a/bokeh/plotting.py
+++ b/bokeh/plotting.py
@@ -241,7 +241,10 @@ def show(obj=None, browser=None, new="tab", url=None):
 
     controller = browserlib.get_browser_controller(browser=browser)
     if obj is None:
-        plot = curdoc()
+        if notebook:
+            plot = curplot()
+        else:
+            plot = curdoc()
     else:
         plot = obj
     if not plot:


Test patch:
Repository: bokeh/bokeh

Issue:
pip install/upgrade hides prompt to remove old Bokeh install
Which, to the end user, looks like pip hangs for no reason and without any output to the pip log. (see https://github.com/ContinuumIO/bokeh/issues/882)

Specifically occurs in this code block:

```
if exists(bokeh_path) and isdir(bokeh_path):
    prompt = "\nFound existing bokeh install: %s\nRemove it? [y|N] " % bokeh_path
    if sys.version_info[0] < 3:
        val = raw_input(prompt)
    else:
        val = input(prompt)
    if val == "y":
        print ("Removing old bokeh install...")
        try:
            shutil.rmtree(bokeh_path)
            print ("Removed.")
        except (IOError, OSError):
            print ("Unable to remove old bokeh at: %s" % bokeh_path)
            sys.exit(-1)
    else:
        print ("Not removing old bokeh install")
```

I don't think there is a way to tell if pip is doing the upgrade; should we assume the user intends to overwrite the old bokeh installation and drop the prompt? What is the rationale for keeping the prompt?



Discussion:
It only needs to do the check on a `setup.py develop`,  I think that will solve the problem. The reason for doing the check is that doing `python setup.py develop` and leaving an existing `bokeh` installation causes annoying and sometime hard to figure out errors (until you do figure it out and slap yourself for the wasted half hour).


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -233,23 +233,24 @@ def getsitepackages():
 else:
     site_packages = getsitepackages()[0]
 
-bokeh_path = join(site_packages, "bokeh")
-if exists(bokeh_path) and isdir(bokeh_path):
-    prompt = "\nFound existing bokeh install: %s\nRemove it? [y|N] " % bokeh_path
-    if sys.version_info[0] < 3:
-        val = raw_input(prompt)
-    else:
-        val = input(prompt)
-    if val == "y":
-        print ("Removing old bokeh install...")
-        try:
-            shutil.rmtree(bokeh_path)
-            print ("Removed.")
-        except (IOError, OSError):
-            print ("Unable to remove old bokeh at: %s" % bokeh_path)
-            sys.exit(-1)
-    else:
-        print ("Not removing old bokeh install")
+if 'develop' in sys.argv:
+    bokeh_path = join(site_packages, "bokeh")
+    if exists(bokeh_path) and isdir(bokeh_path):
+        prompt = "\nFound existing bokeh install: %s\nRemove it? [y|N] " % bokeh_path
+        if sys.version_info[0] < 3:
+            val = raw_input(prompt)
+        else:
+            val = input(prompt)
+        if val == "y":
+            print ("Removing old bokeh install...")
+            try:
+                shutil.rmtree(bokeh_path)
+                print ("Removed.")
+            except (IOError, OSError):
+                print ("Unable to remove old bokeh at: %s" % bokeh_path)
+                sys.exit(-1)
+        else:
+            print ("Not removing old bokeh install")
 
 path_file = join(site_packages, "bokeh.pth")
 path = abspath(dirname(__file__))


Test patch:
Repository: bokeh/bokeh

Issue:
Plots in bokeh/examples/app/downloads not showing in dev-0.5.2
![screen shot 2014-08-03 at 4 00 32 am](https://cloud.githubusercontent.com/assets/4940549/3790173/ae087172-1aec-11e4-8ac8-7d30ca5084ce.png)

Error in Console:

```
 Uncaught TypeError: Cannot read property 'get' of undefined 
```

Problem coming from this line in `bokeh.js`:

```
range_bounds = [range.get('min'), range.get('max')];
```

Also getting this error:

```
INFO:bokeh.server.start:GET /static/jquery.min.map 404 NOT FOUND 342 3.4ms
```



Discussion:
Related with the new layout (the jquery error does not seem related)...


Resolving patch:
diff --git a/examples/app/downloads/downloads.py b/examples/app/downloads/downloads.py
--- a/examples/app/downloads/downloads.py
+++ b/examples/app/downloads/downloads.py
@@ -144,10 +144,12 @@ def make_downloads_plot(self, source):
         plot.tools.append(hover)
         xformatter = DatetimeTickFormatter(formats=dict(months=["%b %Y"]))
         yformatter = BasicTickFormatter(precision=None, use_scientific=False)
-        xaxis = DatetimeAxis(plot=plot, dimension=0, formatter=xformatter)
-        yaxis = LinearAxis(plot=plot, dimension=1, formatter=yformatter)
-        xgrid = Grid(plot=plot, dimension=0, axis=xaxis)
-        ygrid = Grid(plot=plot, dimension=1, axis=yaxis)
+        xaxis = DatetimeAxis(plot=plot, formatter=xformatter)
+        plot.below.append(xaxis)
+        yaxis = LinearAxis(plot=plot, formatter=yformatter)
+        plot.left.append(yaxis)
+        xgrid = Grid(plot=plot, dimension=0, ticker=xaxis.ticker)
+        ygrid = Grid(plot=plot, dimension=1, ticker=yaxis.ticker)
         return plot
 
     def make_punchcard_plot(self, source):
@@ -160,8 +162,10 @@ def make_punchcard_plot(self, source):
         plot.renderers.append(rect_glyph)
         hover = HoverTool(plot=plot, tooltips=dict(downloads="@counts"))
         plot.tools.append(hover)
-        xaxis = CategoricalAxis(plot=plot, dimension=0)
-        yaxis = CategoricalAxis(plot=plot, dimension=1)
+        xaxis = CategoricalAxis(plot=plot)
+        plot.below.append(xaxis)
+        yaxis = CategoricalAxis(plot=plot)
+        plot.left.append(yaxis)
         return plot
 
     def input_change(self, obj, attrname, old, new):


Test patch:
Repository: bokeh/bokeh

Issue:
Support iPython 2.2.0 in bokeh_magic
I get the following error:

```
>>> import bokeh.bokeh_magic
...
Exception: This version of IPython is not currently supported.

Currently supported version are: 1.0.0, 1.1.1, 1.1.2, 1.2.0, 1.2.1 and 2.0.0-dev, 2.0.0-b1, 2.0.0-wakari, 2.0.0, 2.1.0, 3.0.0-dev.
```

Workaround: Adding '2.2.0' to line 32 in `bokeh_magic` seems to work ok:

```
ipytwos = ['2.0.0-dev', '2.0.0-b1', '2.0.0-wakari', '2.0.0', '2.1.0', '2.2.0', '3.0.0-dev']
```



Discussion:
@damianavila I think we can remove the pre-release 2.0.0 ones as well

In fact, I will redo this in a more intelligent way to not be bitten again...


Resolving patch:
diff --git a/extensions/bokeh_magic.py b/extensions/bokeh_magic.py
--- a/extensions/bokeh_magic.py
+++ b/extensions/bokeh_magic.py
@@ -27,17 +27,10 @@
 class BokehMagics(Magics):
     """Magic to embed Bokeh into the IPython notebook."""
 
-    ipyones = ['1.0.0', '1.1.1', '1.1.2', '1.2.0', '1.2.1']
-    ipytwos = ['2.0.0-dev', '2.0.0-b1', '2.0.0-wakari', '2.0.0', '2.1.0', '3.0.0-dev']
-    if IPython.__version__ in ipyones:
+    if IPython.__version__.startswith("1"):
         is_ipytwo = False
-    elif IPython.__version__ in ipytwos:
-        is_ipytwo = True
     else:
-        message = """This version of IPython is not currently supported.
-
-Currently supported version are: %s and %s.""" % (', '.join(ipyones), ', '.join(ipytwos))
-        raise Exception(message)
+        is_ipytwo = True
 
     has_run = False
 


Test patch:
Repository: bokeh/bokeh

Issue:
build_palettes.py not Python 3 compatable
```
Traceback (most recent call last):
  File "build_palettes.py", line 24, in <module>
    s = build()
  File "build_palettes.py", line 6, in build
    for i, (k, v) in enumerate(pl.brewer.iteritems()):
AttributeError: 'dict' object has no attribute 'iteritems'
```



Discussion:

Resolving patch:
diff --git a/bokeh/utils.py b/bokeh/utils.py
--- a/bokeh/utils.py
+++ b/bokeh/utils.py
@@ -9,6 +9,7 @@
 import uuid
 
 from six.moves.urllib.parse import urljoin as sys_urljoin
+from six import iteritems
 
 _simple_id = 1000
 
@@ -76,7 +77,7 @@ def helper(json_obj):
             for idx, x in enumerate(json_obj):
                 json_obj[idx] = convert(x)
         if isinstance(json_obj, dict):
-            for k, x in json_obj.iteritems():
+            for k, x in iteritems(json_obj):
                 json_obj[k] = convert(x)
     json_apply(json_obj, helper)
     return json_obj
diff --git a/sphinx/build_palettes.py b/sphinx/build_palettes.py
--- a/sphinx/build_palettes.py
+++ b/sphinx/build_palettes.py
@@ -1,10 +1,10 @@
 from bokeh import palettes as pl
-
+from six import iteritems
 
 def build():
     s = "<table>"
-    for i, (k, v) in enumerate(pl.brewer.iteritems()):
-        for k1, v1 in v.iteritems():
+    for i, (k, v) in enumerate(iteritems(pl.brewer)):
+        for k1, v1 in iteritems(v):
             s += """
                 <tr><td height='20px' width='80px' style='font-size: 12px'>%s</td>
             """ % (k+str(k1))


Test patch:
Repository: bokeh/bokeh

Issue:
bokeh.charts.Bar displays overlapping bars
This is pretty minor, but the Bar class makes bar charts with overlapping bars if there are more than 4 values.

The widths are currently hardcoded, but it would be nice if they were adjusted based on the data and/or adjustable through a keyword argument, etc.

https://github.com/ContinuumIO/bokeh/blob/8ddcb1bde4c52be89c4ba23ec14dbe7293176f48/bokeh/charts/bar.py#L177

Here's a modified version of the example in the class docstring.  It just duplicates categories so that there are "too many" categories.

```
import numpy as np
from collections import OrderedDict
from bokeh.charts import Bar
from bokeh.sampledata.olympics2014 import data

from bokeh.sampledata.olympics2014 import data
data = {d['abbr']: d['medals'] for d in data['data'] if d['medals']['total'] > 0}
countries = sorted(data.keys(), key=lambda x: data[x]['total'], reverse=True)[:5]
gold = np.array([data[abbr]['gold'] for abbr in countries], dtype=np.float)
silver = np.array([data[abbr]['silver'] for abbr in countries], dtype=np.float)
bronze = np.array([data[abbr]['bronze'] for abbr in countries], dtype=np.float)
medals = OrderedDict(bronze=bronze, silver=silver, gold=gold, gold2=gold, gold3=gold, gold4=gold)

bar = Bar(medals, countries)
bar.title("stacked, dict_input").xlabel("countries").ylabel("medals")\
.legend(True).width(800).height(400).notebook().show()
```



Discussion:
Thank for the report... do you want to take a stab on it :wink:?

Hmm, I kinda already tried for a little bit and couldn't really figure out how the current version works.   Sorry to just post the issue and not offer to help, but I figured it was better than not posting it at all :-/

Sure... I will try to fix it soon, thanks for the report!


Resolving patch:
diff --git a/bokeh/charts/bar.py b/bokeh/charts/bar.py
--- a/bokeh/charts/bar.py
+++ b/bokeh/charts/bar.py
@@ -174,7 +174,10 @@ def get_data(self, cat, **value):
         """
         self.cat = cat
         self.width = [0.8] * len(self.cat)
-        self.width_cat = [0.2] * len(self.cat)
+        # width should decrease proportionally to the value length.
+        # 1./len(value) doesn't work well as the width needs to decrease a
+        # little bit faster
+        self.width_cat = [min(0.2, (1./len(value))**1.1)] * len(self.cat)
         self.zero = np.zeros(len(self.cat))
         self.data = dict(cat=self.cat, width=self.width, width_cat=self.width_cat, zero=self.zero)
 


Test patch:
Repository: bokeh/bokeh

Issue:
Cannot style minor ticks
Axis objects do not have minor tick properties.



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
@@ -27,11 +27,15 @@ class Axis(GuideRenderer):
     major_label_props = Include(TextProps)
 
     axis_props = Include(LineProps)
-    major_tick_props = Include(LineProps)
 
+    major_tick_props = Include(LineProps)
     major_tick_in = Int
     major_tick_out = Int
 
+    minor_tick_props = Include(LineProps)
+    minor_tick_in = Int
+    minor_tick_out = Int
+
 class ContinuousAxis(Axis):
     pass
 


Test patch: