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

Issue:
Transform docstring ends abruptly
```
    Bases: bokeh.model.Model
    Base class for Transform models that represent a computation to be carried out on the client-side.
    JavaScript implementations should implement the following methods:
```
<img width="879" alt="screen shot 2017-02-17 at 2 43 31 am" src="https://cloud.githubusercontent.com/assets/1796208/23058499/e52042e8-f4ba-11e6-8f8a-596498e00084.png">

Should add the methods that need to be implemented.



Discussion:

Resolving patch:
diff --git a/bokeh/models/transforms.py b/bokeh/models/transforms.py
--- a/bokeh/models/transforms.py
+++ b/bokeh/models/transforms.py
@@ -19,11 +19,11 @@ class Transform(Model):
 
     .. code-block: coffeescript
 
-        compute: (x) ->
-            # compute the transform of a single value
+       compute: (x) ->
+           # compute the transform of a single value
 
-        v_compute: (xs) ->
-            # compute the transform of an array of values
+       v_compute: (xs) ->
+           # compute the transform of an array of values
 
     '''
     pass


Test patch:
Repository: bokeh/bokeh

Issue:
Tweak defaults for interactive legend inactive labels
![bokeh_plot](https://cloud.githubusercontent.com/assets/1796208/23741950/85887de4-0470-11e7-94a3-8187b9df836e.png)

I think using white, can better fake an inactive look in an elegant way for the default white background on everything.



Discussion:

Resolving patch:
diff --git a/bokeh/models/annotations.py b/bokeh/models/annotations.py
--- a/bokeh/models/annotations.py
+++ b/bokeh/models/annotations.py
@@ -120,9 +120,9 @@ class Legend(Annotation):
 
     background_fill_alpha = Override(default=0.95)
 
-    inactive_fill_color = Override(default="lightgrey")
+    inactive_fill_color = Override(default="white")
 
-    inactive_fill_alpha = Override(default=0.4)
+    inactive_fill_alpha = Override(default=0.9)
 
     label_props = Include(TextProps, help="""
     The %s for the legend labels.
diff --git a/examples/plotting/file/interactive_legend.py b/examples/plotting/file/interactive_legend.py
--- a/examples/plotting/file/interactive_legend.py
+++ b/examples/plotting/file/interactive_legend.py
@@ -3,19 +3,19 @@
 from bokeh.palettes import Spectral4
 from bokeh.plotting import figure, output_file, show
 
-p = figure(plot_width=800, plot_height=250, x_axis_type="datetime")
+p = figure(plot_width=800, plot_height=250, x_axis_type='datetime')
 p.title.text = 'Click on legend entries to hide lines'
 
 for name, color in zip(['AAPL', 'IBM', 'MSFT', 'GOOG'], Spectral4):
     df = pd.read_csv(
-        "http://ichart.yahoo.com/table.csv?s=%s&a=0&b=1&c=2005&d=0&e=1&f=2014" % name,
+        'http://ichart.yahoo.com/table.csv?s=%s&a=0&b=1&c=2005&d=0&e=1&f=2014' % name,
         parse_dates=['Date']
     )
     p.line(df['Date'], df['Close'], line_width=2, color=color, alpha=0.8, legend=name)
 
-p.legend.location = "top_left"
-p.legend.click_policy="hide"
+p.legend.location = 'top_left'
+p.legend.click_policy = 'hide'
 
-output_file("interactive_legend.html", title="interactive_legend.py example")
+output_file('interactive_legend.html', title='interactive_legend.py example')
 
 show(p)


Test patch:
Repository: bokeh/bokeh

Issue:
Wrong data shown in Gapminder example app / slider update failing
The Gapminder example app as provided in the latest release (0.12.2) shows the same data for 1964 _and_ 1965 after the slider is moved once from 1964 to 1965. The data shown remains that for 1965, even if the slider is moved back to 1964. Data for other years seem to be shown fine, when moving the slider. This is very easy to reproduce.



Discussion:
@deeplook there are several different examples based of the gapminder data, can you be more specific about exactly which one you mean?

@bryevdv Ok, this is what I did to make the issue more reproducible right now (on Mac OS X).

``` bash
# Install Miniconda for Python 3.5 on Linux
# wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
# bash Miniconda3-latest-Linux-x86_64.sh -b -f -p ~/mc3

# Install Miniconda for Python 3.5 on Mac OS X
wget https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
bash Miniconda3-latest-MacOSX-x86_64.sh -b -f -p ~/mc3

~/mc3/bin/conda install -y bokeh==0.12.2
~/mc3/bin/conda install -y pandas # needed by gapminder demo

wget https://github.com/bokeh/bokeh/archive/0.12.2.tar.gz
tar xfz 0.12.2.tar.gz
cd bokeh-0.12.2/examples/app
~/mc3/bin/bokeh serve gapminder

# Then open http://localhost with indicated port (:5006).
# Then move year slider from 1964 to 1965.
# Any further moves between 1964 and 1965 will always show data from 1965
# and no longer from 1964.
```

@deeplook thanks for the info. Fairly heads down with some other responsibilities this week but will take a look as soon as I can. 

Can confirm this is happening.  Not sure yet whether it is a problem just in the app logic, of if there is some more general problem.

Resolving patch:
diff --git a/examples/app/gapminder/main.py b/examples/app/gapminder/main.py
--- a/examples/app/gapminder/main.py
+++ b/examples/app/gapminder/main.py
@@ -15,7 +15,7 @@
 
 fertility_df, life_expectancy_df, population_df_size, regions_df, years, regions_list = process_data()
 
-sources = {}
+data = {}
 
 region_name = regions_df.Group
 region_name.name = 'region'
@@ -29,9 +29,9 @@
     population.name = 'population'
     df = pd.concat([fertility, life, population, region_name], axis=1)
     df = df.fillna('NaN')
-    sources[year] = ColumnDataSource(df)
+    data[year] = df.to_dict('series')
 
-source = sources[years[0]]
+source = ColumnDataSource(data=data[years[0]])
 
 plot = figure(x_range=(1, 9), y_range=(20, 100), title='Gapminder Data', plot_height=300)
 plot.xaxis.ticker = SingleIntervalTicker(interval=1)
@@ -68,7 +68,7 @@ def animate_update():
 def slider_update(attrname, old, new):
     year = slider.value
     label.text = str(year)
-    source.data = sources[year].data
+    source.data = data[year]
 
 slider = Slider(start=years[0], end=years[-1], value=years[0], step=1, title="Year")
 slider.on_change('value', slider_update)


Test patch:
Repository: bokeh/bokeh

Issue:
Event handler for width/height change of plot
Good morning. Is there an event for size change of a plot? For x range, there is an event like
`fig.x_range.on_change('start', myfun)`

But none of the following works
`fig.on_change('plot_width', myfun)
  fig.on_change('width', myfun)
  fig.frame.on_change('width', myfun) #this one causes an error`

Any advice on how to capture the event of size change? Thank you.



Discussion:
No, that's not currently an event, but it would be reasonable to add one. I'm marking this as a feature.

The PR for read-only properties was merged, so this should be easy to add by simply adding readonly properties (which support the standard callback machinery)

Resolving patch:
diff --git a/bokeh/models/plots.py b/bokeh/models/plots.py
--- a/bokeh/models/plots.py
+++ b/bokeh/models/plots.py
@@ -507,6 +507,28 @@ def _check_snapped_toolbar_and_axis(self):
 
     """)
 
+    layout_width = Int(readonly=True, help="""
+    This is the exact width of the layout, i.e. the height of
+    the actual plot, with toolbars etc. Note this is computed in a
+    web browser, so this property will work only in backends capable of
+    bidirectional communication (server, notebook).
+
+    .. note::
+        This is an experimental feature and the API may change in near future.
+
+    """)
+
+    layout_height = Int(readonly=True, help="""
+    This is the exact height of the layout, i.e. the height of
+    the actual plot, with toolbars etc. Note this is computed in a
+    web browser, so this property will work only in backends capable of
+    bidirectional communication (server, notebook).
+
+    .. note::
+        This is an experimental feature and the API may change in near future.
+
+    """)
+
     background_props = Include(FillProps, help="""
     The %s for the plot background style.
     """)


Test patch:
Repository: bokeh/bokeh

Issue:
sdists prompting for BokehJS build will block pip installs

I am currently trying to run a python file on a remote server. In my local machine I can just ran the command: bokeh serve --show myApp.py

However, on my remote host, when I ran bokeh serve, the error message "bokeh: command not found" was shown. I tried pip install bokeh, and finished installation, however, still bokeh command is not found.


Discussion:
After a brief test, there may be something wrong with the `0.12.4` pip packages. However, you can always run the server this way instead:
```
$ python -m bokeh serve 
2017-03-19 13:53:04,394 Starting Bokeh server version 0.12.4
2017-03-19 13:53:04,400 Starting Bokeh server on port 5006 with applications at paths ['/']
2017-03-19 13:53:04,400 Starting Bokeh server with process id: 75330
```
which is guaranteed to work whether the `bokeh` entry point is installed or not. Alternatively you can use `conda` instead of `pip`.

I will try to do some testing before the `0.12.5` release comes out. There have been several changes to out build/packaging machinery since then, so it's possible this issue has simply resolved itself. Unfortunately it's unlikely that anything can be done about existing releases, we simply don't have the resources to go back and address things directly in old releases (except to make new releases). 
Should test creation of and installation from`sdist` locally with new `setup.py` machinery. 
Actually on further investigation, things did work correctly from a pip install for me:
```
(testpip) [bryan:.../bokeh/examples/models/file]$ which bokeh                                                                           
/Users/bryan/anaconda/bin/bokeh
(testpip) [bryan:.../bokeh/examples/models/file]$ rehash                                                                                
(testpip) [bryan:.../bokeh/examples/models/file]$ which bokeh                                                                           
/Users/bryan/anaconda/envs/testpip/bin/bokeh
(testpip) [bryan:.../bokeh/examples/models/file]$ bokeh                                                                                
ERROR: Must specify subcommand, one of: html, info, json, sampledata, secret, serve or static
```
I had to run `rehash` to get the new path to the test environment to take effect, but once I did the correct bokeh command showed up. @LuckyGem this is almost certainly some path configuration issue on your system. 
@bokeh/dev I think there is actually an issue with our new sdists, they are prompting for whether to build BokehJS but should not. 
Junk typo in `_setup_support.py`:

https://github.com/bokeh/bokeh/blob/master/_setup_support.py#L185


Resolving patch:
diff --git a/_setup_support.py b/_setup_support.py
--- a/_setup_support.py
+++ b/_setup_support.py
@@ -182,7 +182,7 @@ def fixup_for_packaged():
         None
 
     '''
-    if exists(join(ROOT, 'PKG-INFOvi ')):
+    if exists(join(ROOT, 'PKG-INFO')):
         if "--build-js" in sys.argv or "--install-js" in sys.argv:
             print(SDIST_BUILD_WARNING)
             if "--build-js" in sys.argv:


Test patch:
Repository: bokeh/bokeh

Issue:
Sprint prints NaN for seleted names set to None
The recent change to have CDS store real numpy arrays for data frame columns instead of lists means that `None` values are sent as real `NaN` values. This is probably an improvement but the `models/file/sprint.py` relied on this behavior, so now it looks like this:

<img width="1020" alt="screen shot 2017-03-19 at 16 39 31" src="https://cloud.githubusercontent.com/assets/1078448/24085044/ba61e92e-0cc2-11e7-8db9-69b3e4b9e44b.png">

Changing the `selected_name` function as shown below (returning the empty string instead `None`) fixes the problem
```
def selected_name(name, medal, year):
    return name if medal == "gold" and year in [1988, 1968, 1936, 1896] else ""
```

@jsignell can you make a quick PR to update the example, and also perhaps add a migration note about this change?


Discussion:
It's probably also a good idea to revisit the overall approach here (i.e. have a different smaller CDS that just has the names to print and not none/empty string for all the rest) but that can happen later. 

Resolving patch:
diff --git a/examples/models/file/sprint.py b/examples/models/file/sprint.py
--- a/examples/models/file/sprint.py
+++ b/examples/models/file/sprint.py
@@ -43,7 +43,7 @@
 line_color = { "gold": gold_line, "silver": silver_line, "bronze": bronze_line }
 
 def selected_name(name, medal, year):
-    return name if medal == "gold" and year in [1988, 1968, 1936, 1896] else None
+    return name if medal == "gold" and year in [1988, 1968, 1936, 1896] else ""
 
 t0 = sprint.Time[0]
 


Test patch:
Repository: bokeh/bokeh

Issue:
Issues with examples/plotting/server/animated.py
bokeh 0.12.5rc1
osx
Chrome | Firefox | Safari
![out](https://cloud.githubusercontent.com/assets/4806877/24259201/96ef7414-0fc6-11e7-907a-0a346c038901.gif)

 - missing glyph in Chrome and FF
 - color doesn't match across browsers
 - FF animation is jerky
 - screen size of figures is different in different browsers




Discussion:
some comments:

* The current update rate is pushing capability a bit. It could probably be reduced to 50-60 hz instead. 
* the different screen size maybe safari/OSX scaling? i.e. I can `apple +` and `apple -` to make canvas's bigger or smaller in safari, but the "scaled" number of pixels is always correct 
* not sure I see a color difference?
* the missing glyph is weird, that should be run down
> not sure I see a color difference?

there is a yellow column in safari that shows as green in the other two. 
You can also see that at x=0 and y in [5, 10] there is an invisible bar. I'm pretty sure that the behavior shown in Safari is the correct one.
I can reproduce this in Chrome 57 on Linux.

Resolving patch:
diff --git a/examples/plotting/server/animated.py b/examples/plotting/server/animated.py
--- a/examples/plotting/server/animated.py
+++ b/examples/plotting/server/animated.py
@@ -14,7 +14,7 @@
 rmin = r_base - cos(r_x) - 1
 rmax = r_base + sin(r_x) + 1
 
-colors = ["FFFFCC", "#C7E9B4", "#7FCDBB", "#41B6C4", "#2C7FB8", "#253494", "#2C7FB8", "#41B6C4", "#7FCDBB", "#C7E9B4"] * M
+colors = ["#FFFFCC", "#C7E9B4", "#7FCDBB", "#41B6C4", "#2C7FB8", "#253494", "#2C7FB8", "#41B6C4", "#7FCDBB", "#C7E9B4"] * M
 
 # figure() function auto-adds the figure to curdoc()
 p = figure(x_range=(-11, 11), y_range=(-11, 11))
@@ -31,7 +31,7 @@ def update():
     rmax = roll(ds.data["outer_radius"], -1)
     ds.data.update(inner_radius=rmin, outer_radius=rmax)
 
-curdoc().add_periodic_callback(update, 30)
+curdoc().add_periodic_callback(update, 60)
 
 session.show(p) # open the document in a browser
 


Test patch:
Repository: bokeh/bokeh

Issue:
setup.py auto-generates a bad empty string classifier
Currently `setup.py` does this:
```
classifiers=open("classifiers.txt").read().split('\n'),
```
But this results in an empty string `''` in the list, which pypi rejects on upload with a 400 error. Need to change to 
```
classifiers=open("classifiers.txt").read().strip().split('\n'),
```
or otherwise ensure that there are no empty strings in the classifiers list.  (Another solution would be to exclude `classifiers.txt` from code quality checks and remove the trailing newline, or both)


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -127,7 +127,7 @@
     author='Continuum Analytics',
     author_email='info@continuum.io',
     url='http://github.com/bokeh/bokeh',
-    classifiers=open("classifiers.txt").read().split('\n'),
+    classifiers=open("classifiers.txt").read().strip().split('\n'),
 
     # details needed by setup
     install_requires=REQUIRES,


Test patch:
Repository: bokeh/bokeh

Issue:
twine upload in build/upload release script incorrect
Currently it does:
```
run("twine register upload dist/*")
```

I believe it needs to do instead simply:
```
run("twine upload dist/*")
```


Discussion:

Resolving patch:
diff --git a/scripts/build_upload.py b/scripts/build_upload.py
--- a/scripts/build_upload.py
+++ b/scripts/build_upload.py
@@ -381,7 +381,7 @@ def upload_anaconda(token, dev):
 
 @upload_wrapper('pypi')
 def upload_pypi():
-    run("twine register upload dist/*")
+    run("twine upload dist/bokeh-%s.tar.gz" % CONFIG.version)
 
 @upload_wrapper('docs')
 def upload_docs():


Test patch:
Repository: bokeh/bokeh

Issue:
Have deploy script use Github API token to avoid rate-limiting issues
Currently if there are release issues and the deploy script has to be run more than once, the script fails due to GitHub API rate-limiting. This is because the deploy script queries a bunch of issues to make sure they're resolved.

It was suggested that API called with a GitHub token aren't rate-limited, so a solution would be to have the deploy check if a ``GITHUB_API_KEY`` env var is set and, if so, use it.


Discussion:
I think the best way is to modify `read_url` to check for `os.environ.get("BOKEH_GITHUB_API_TOKEN", None)` and use proper `Request` as described here:

http://stackoverflow.com/questions/23659744/access-github-api-using-personal-access-token-with-python-urllib2

if the token is not `None` add the value as "token" as that link describes, otherwise leave it off. 

Resolving patch:
diff --git a/scripts/issues.py b/scripts/issues.py
--- a/scripts/issues.py
+++ b/scripts/issues.py
@@ -9,13 +9,14 @@
 import gzip
 import json
 import logging
+import os
 import pickle
 import sys
 
 from collections import OrderedDict
 from functools import partial
 from itertools import count, groupby
-from six.moves.urllib.request import urlopen
+from six.moves.urllib.request import urlopen, Request
 
 logging.basicConfig(level=logging.INFO)
 
@@ -184,8 +185,13 @@ def parse_timestamp(timestamp):
 def read_url(url):
     """Reads given URL as JSON and returns data as loaded python object."""
     logging.debug('reading {url} ...'.format(url=url))
-    r = urlopen(url).read()
-    return json.loads(r.decode("UTF-8"))
+    token = os.environ.get("BOKEH_GITHUB_API_TOKEN")
+    headers = {}
+    if token:
+        headers['Authorization'] = 'token %s' % token
+    request = Request(url, headers=headers)
+    response = urlopen(request).read()
+    return json.loads(response.decode("UTF-8"))
 
 
 def query_tags():


Test patch:
Repository: bokeh/bokeh

Issue:
prefix bug on "Active Bokeh Applications" page
I use a command like "bokeh serve --prefix=prefix app1.py app2.py" to serve my applications.
If I then access ip_address/prefix I can see a list of my applications running but the link points to ip_address/app1 instead of ip_address/prefix/app1.
I think this can be solved by changing  [bokeh/bokeh/server/views/root_handler.py](https://github.com/bokeh/bokeh/blob/master/bokeh/server/views/root_handler.py), line 32
from
`self.render("app_index.html", items=self.applications.keys())`
to
`self.render("app_index.html", items=[self.prefix+k for k in self.applications.keys()])`

regards.



Discussion:
@aguayoff would you be interested in submitting a PR for this?

Resolving patch:
diff --git a/bokeh/server/views/root_handler.py b/bokeh/server/views/root_handler.py
--- a/bokeh/server/views/root_handler.py
+++ b/bokeh/server/views/root_handler.py
@@ -24,9 +24,10 @@ def initialize(self, *args, **kw):
 
     @gen.coroutine
     def get(self, *args, **kwargs):
+        prefix = "" if self.prefix is None else self.prefix
         if self.use_redirect and len(self.applications) == 1:
             app_names = list(self.applications.keys())
-            redirect_to = (self.prefix if self.prefix else "") + app_names[0]
+            redirect_to = prefix + app_names[0]
             self.redirect(redirect_to)
         else:
-            self.render("app_index.html", items=self.applications.keys())
+            self.render("app_index.html", prefix=prefix, items=self.applications.keys())


Test patch:
Repository: bokeh/bokeh

Issue:
Why I can't use OperURL in widget callback (e.g. button callback)?
See the following code, clicking the button does not open 'http://www.cnn.com/'

from bokeh.models.widgets import Button
from bokeh.io import output_file, show, vform
from bokeh.models import OpenURL, TapTool

output_file("button.html")
button = Button(label="Foo", callback=OpenURL(url='http://www.cnn.com/'), type="success")
show(vform(button))


Discussion:
`OpenURL` is specifically designed and only useful for opening URLs in response to *selection* events. It is not a general purpose thing. Perhaps we need to make that more clear in the documentation. For something like this you can just use a `CustomJS` callback with a single line of JS (e.g. `window.open("some.url.com");`)

Resolving patch:
diff --git a/sphinx/source/docs/user_guide/examples/interaction_open_url.py b/sphinx/source/docs/user_guide/examples/interaction_open_url.py
--- a/sphinx/source/docs/user_guide/examples/interaction_open_url.py
+++ b/sphinx/source/docs/user_guide/examples/interaction_open_url.py
@@ -14,6 +14,9 @@
 
 p.circle('x', 'y', color='color', size=20, source=source)
 
+# use the "color" column of the CDS to complete the URL
+# e.g. if the glyph at index 10 is selected, then @color
+# will be replaced with source.data['color'][10]
 url = "http://www.colors.commutercreative.com/@color/"
 taptool = p.select(type=TapTool)
 taptool.callback = OpenURL(url=url)


Test patch:
Repository: bokeh/bokeh

Issue:
For Interactive Legends, a note about `muted_color` would be helpful
For the [Interactive Legend guide](https://github.com/bokeh/bokeh/blob/d8fcffa1c472bf641517ef81698bb6d057cbd30f/sphinx/source/docs/user_guide/interaction/legends.rst#id7), in addition to the note about `muted_alpha`, it would be helpful to also demonstrate `muted_color`.


Discussion:

Resolving patch:
diff --git a/sphinx/source/docs/user_guide/examples/interaction_legend_mute.py b/sphinx/source/docs/user_guide/examples/interaction_legend_mute.py
--- a/sphinx/source/docs/user_guide/examples/interaction_legend_mute.py
+++ b/sphinx/source/docs/user_guide/examples/interaction_legend_mute.py
@@ -11,7 +11,8 @@
         "http://ichart.yahoo.com/table.csv?s=%s&a=0&b=1&c=2005&d=0&e=1&f=2014" % name,
         parse_dates=['Date']
     )
-    p.line(df['Date'], df['Close'], line_width=2, color=color, alpha=0.8, muted_alpha=0.2, legend=name)
+    p.line(df['Date'], df['Close'], line_width=2, color=color, alpha=0.8,
+           muted_color=color, muted_alpha=0.2, legend=name)
 
 p.legend.location = "top_left"
 p.legend.click_policy="mute"


Test patch:
Repository: bokeh/bokeh

Issue:
Extend hit testing and hover support to Segment
Currently possible to hit test and have hover tools for lines and multi-lines. Should implement hit-testing methods on the `Segment` glyph as well. Doing so will allow hover tools on graphs. 


Discussion:

Resolving patch:
diff --git a/bokeh/models/tools.py b/bokeh/models/tools.py
--- a/bokeh/models/tools.py
+++ b/bokeh/models/tools.py
@@ -675,12 +675,10 @@ class HoverTool(Inspection):
             * image
             * image_rgba
             * image_url
-            * multi_line
             * oval
             * patch
             * quadratic
             * ray
-            * segment
             * text
 
     .. |hover_icon| image:: /_images/icons/Hover.png


Test patch: