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

Issue:
Task: Make ColumnDataSource.column_names attribute a property method
Task: Make ColumnDataSource.column_names attribute a property method

It's duplicated data that's easy to get ColumnDataSource.column_names out-of-sync with the source.data.keys(). I don't know the historical reason for having it, but it's not likely necessary any more.


Discussion:

Resolving patch:
diff --git a/bokeh/models/sources.py b/bokeh/models/sources.py
--- a/bokeh/models/sources.py
+++ b/bokeh/models/sources.py
@@ -36,10 +36,6 @@ class ColumnarDataSource(DataSource):
 
     '''
 
-    column_names = List(String, help="""
-    An list of names for all the columns in this DataSource.
-    """)
-
     selection_policy = Instance(SelectionPolicy, help="""
     An instance of a SelectionPolicy that determines how selections are set.
     """)
@@ -132,9 +128,15 @@ def __init__(self, *args, **kw):
             else:
                 raise ValueError("expected a dict or pandas.DataFrame, got %s" % raw_data)
         super(ColumnDataSource, self).__init__(**kw)
-        self.column_names[:] = list(raw_data.keys())
         self.data.update(raw_data)
 
+    @property
+    def column_names(self):
+        ''' A list of the column names in this data source.
+
+        '''
+        return list(self.data)
+
     @staticmethod
     def _data_from_df(df):
         ''' Create a ``dict`` of columns from a Pandas DataFrame,
@@ -243,20 +245,13 @@ def from_groupby(cls, data):
     def to_df(self):
         ''' Convert this data source to pandas dataframe.
 
-        If ``column_names`` is set, use those. Otherwise let Pandas
-        infer the column names. The ``column_names`` property can be
-        used both to order and filter the columns.
-
         Returns:
             DataFrame
 
         '''
         if not pd:
             raise RuntimeError('Pandas must be installed to convert to a Pandas Dataframe')
-        if self.column_names:
-            return pd.DataFrame(self.data, columns=self.column_names)
-        else:
-            return pd.DataFrame(self.data)
+        return pd.DataFrame(self.data)
 
     def add(self, data, name=None):
         ''' Appends a new column of data to the data source.
@@ -275,7 +270,6 @@ def add(self, data, name=None):
             while "Series %d"%n in self.data:
                 n += 1
             name = "Series %d"%n
-        self.column_names.append(name)
         self.data[name] = data
         return name
 
@@ -294,7 +288,6 @@ def remove(self, name):
 
         '''
         try:
-            self.column_names.remove(name)
             del self.data[name]
         except (ValueError, KeyError):
             import warnings


Test patch:
Repository: bokeh/bokeh

Issue:
remove pytest-rerunfailures from CI tests
Tests are more stable now, and removing will allow deletion of the package from the bokeh channel as well. 


Discussion:

Resolving patch:
diff --git a/bokeh/io/export.py b/bokeh/io/export.py
--- a/bokeh/io/export.py
+++ b/bokeh/io/export.py
@@ -25,7 +25,6 @@
 #-----------------------------------------------------------------------------
 
 # Standard library imports
-import os
 import io
 import signal
 from os.path import abspath, devnull
@@ -269,8 +268,14 @@ def is_bokeh_render_complete(driver):
 
 @dev((1,0,0))
 def terminate_web_driver(driver):
-    driver.service.process.send_signal(signal.SIGTERM)
-    driver.quit()
+    if driver.name == "phantomjs":
+        # https://github.com/seleniumhq/selenium/issues/767
+        driver.service.process.send_signal(signal.SIGTERM)
+
+    try:
+        driver.quit()
+    except (IOError, OSError): # IOError for Python 2.7
+        pass
 
 #-----------------------------------------------------------------------------
 # Private API
@@ -320,7 +325,7 @@ def _create_default_webdriver():
     return webdriver.PhantomJS(executable_path=phantomjs_path, service_log_path=devnull)
 
 def _tmp_html():
-    return NamedTemporaryFile(prefix=".bokeh", suffix=".html", dir=os.getcwd())
+    return NamedTemporaryFile(prefix=".bokeh", suffix=".html")
 
 #-----------------------------------------------------------------------------
 # Code


Test patch:
Repository: bokeh/bokeh

Issue:
Switch Python versions between full and partial examples' travis ci jobs
Just to establish that Python 3 is the future and 2 will finally go away at some point. This doesn't change anything from testing standpoint.


Discussion:
Also to note, in case some one runs into this trap, code quality tests don't work on Python 2.

Resolving patch:
diff --git a/bokeh/command/subcommands/info.py b/bokeh/command/subcommands/info.py
--- a/bokeh/command/subcommands/info.py
+++ b/bokeh/command/subcommands/info.py
@@ -11,10 +11,12 @@
 
 .. code-block:: none
 
-    Python version      :  2.7.11
-    IPython version     :  4.0.1
-    Bokeh version       :  0.11.0
-    BokehJS static path :  /opt/anaconda/lib/python3.4/site-packages/bokeh/server/static
+    Python version      :  3.6.5
+    IPython version     :  6.3.1
+    Bokeh version       :  0.12.15
+    BokehJS static path :  /opt/anaconda/lib/python3.6/site-packages/bokeh/server/static
+    node.js version     :  v8.11.1
+    npm version         :  5.8.0
 
 Sometimes it can be useful to get just paths to the BokehJS static files in order
 to configure other servers or processes. To do this, use the ``--static`` option
@@ -27,7 +29,7 @@
 
 .. code-block:: none
 
-    /opt/anaconda/lib/python3.4/site-packages/bokeh/server/static
+    /opt/anaconda/lib/python3.6/site-packages/bokeh/server/static
 
 '''
 from __future__ import absolute_import


Test patch:
Repository: bokeh/bokeh

Issue:
Missing docstring for get_screenshot_as_png
#### ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
bokeh 0.12.16dev

#### Description of expected behavior and the observed behavior
Missing docstring for `bokeh.io.exports` function `get_screenshot_as_png`.


Discussion:

Resolving patch:
diff --git a/bokeh/io/export.py b/bokeh/io/export.py
--- a/bokeh/io/export.py
+++ b/bokeh/io/export.py
@@ -75,9 +75,6 @@ def export_png(obj, filename=None, height=None, width=None, webdriver=None):
         Responsive sizing_modes may generate layouts with unexpected size and
         aspect ratios. It is recommended to use the default ``fixed`` sizing mode.
 
-    .. warning::
-        Glyphs that are rendered via webgl won't be included in the generated PNG.
-
     '''
 
     image = get_screenshot_as_png(obj, height=height, width=width, driver=webdriver)
@@ -149,8 +146,23 @@ def export_svgs(obj, filename=None, height=None, width=None, webdriver=None):
 # Dev API
 #-----------------------------------------------------------------------------
 
+
 def get_screenshot_as_png(obj, driver=None, **kwargs):
-    '''
+    ''' Get a screenshot of a LayoutDOM object.
+
+    Args:
+        obj (LayoutDOM or Document) : a Layout (Row/Column), Plot or Widget
+            object or Document to export.
+
+        driver (selenium.webdriver) : a selenium webdriver instance to use
+            to export the image.
+
+    Returns:
+        cropped_image (PIL.Image.Image) : a pillow image loaded from PNG.
+
+    .. warning::
+        Responsive sizing_modes may generate layouts with unexpected size and
+        aspect ratios. It is recommended to use the default ``fixed`` sizing mode.
 
     '''
     Image = import_required('PIL.Image',


Test patch:
Repository: bokeh/bokeh

Issue:
Rename bokehjs/src/coffee
Given that we don't use CoffeeScript anymore, this should be finally renamed. This change must not affect existing PRs.


Discussion:
Reopening, because I missed a few spots.

Resolving patch:
diff --git a/bokeh/io/export.py b/bokeh/io/export.py
--- a/bokeh/io/export.py
+++ b/bokeh/io/export.py
@@ -159,7 +159,7 @@ def get_screenshot_as_png(obj, driver=None, **kwargs):
 
     with _tmp_html() as tmp:
         html = get_layout_html(obj, **kwargs)
-        with io.open(tmp.fd, mode="wb", closefd=False) as file:
+        with io.open(tmp.path, mode="wb") as file:
             file.write(b(html))
 
         web_driver = driver if driver is not None else create_webdriver()
@@ -191,7 +191,7 @@ def get_svgs(obj, driver=None, **kwargs):
     '''
     with _tmp_html() as tmp:
         html = get_layout_html(obj, **kwargs)
-        with io.open(tmp.fd, mode="wb", closefd=False) as file:
+        with io.open(tmp.path, mode="wb") as file:
             file.write(b(html))
 
         web_driver = driver if driver is not None else create_webdriver()
@@ -330,6 +330,8 @@ def _crop_image(image, left=0, top=0, right=0, bottom=0, **kwargs):
 
 class _TempFile(object):
 
+    _closed = False
+
     def __init__(self, prefix="tmp", suffix=""):
         self.fd, self.path = mkstemp(prefix=prefix, suffix=suffix)
 
@@ -343,15 +345,24 @@ def __del__(self):
         self.close()
 
     def close(self):
+        if self._closed:
+            return
+
         try:
             os.close(self.fd)
         except (OSError, IOError):
             pass
+        finally:
+            self.fd = None
 
         try:
             os.unlink(self.path)
         except (OSError, IOError):
             pass
+        finally:
+            self.path = None
+
+        self._closed = True
 
 def _tmp_html():
     return _TempFile(prefix="bokeh", suffix=".html")
diff --git a/scripts/deploy.py b/scripts/deploy.py
--- a/scripts/deploy.py
+++ b/scripts/deploy.py
@@ -307,7 +307,7 @@ def commit(filename, version):
 def update_bokehjs_versions():
 
     filenames = [
-        'bokehjs/src/coffee/version.ts',
+        'bokehjs/src/lib/version.ts',
         'bokehjs/package.json',
         'bokehjs/package-lock.json',
     ]


Test patch:
diff --git a/bokehjs/test/unit.coffee b/bokehjs/test/unit.coffee
--- a/bokehjs/test/unit.coffee
+++ b/bokehjs/test/unit.coffee
@@ -1,6 +1,6 @@
 # if adding or removing tests, remember to update
 #
-#     gulp/tasks/test.coffee
+#     gulp/tasks/test.ts
 
 require "./client"
 require "./core"
Repository: bokeh/bokeh

Issue:
Missing documentation of `--show` option for command line `bokeh serve`
The [documentation of the bokeh server](https://bokeh.pydata.org/en/latest/docs/user_guide/server.html) mentions the `--show` options to open automatically a browser tap with the application. This works as expected. However, the command line help of the `bokeh` command line does not mention this option:

```
$ bokeh --help
usage: /home/ajw/.local/anaconda/bin/bokeh [-h] [-v]
                                           {html,info,json,png,sampledata,secret,serve,static,svg}
                                           ...

positional arguments:
  {html,info,json,png,sampledata,secret,serve,static,svg}
                        Sub-commands
    html                Create standalone HTML files for one or more
                        applications
    info                print information about Bokeh and Bokeh server
                        configuration
    json                Create JSON files for one or more applications
    png                 Create standalone PNG files for one or more
                        applications
    sampledata          Download the bokeh sample data sets
    secret              Create a Bokeh secret key for use with Bokeh server
    serve               Run a Bokeh server hosting one or more applications
    static              Serve bokehjs' static assets (JavaScript, CSS, images,
                        fonts, etc.)
    svg                 Create standalone SVG files for one or more
                        applications

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
```
I'm running bokeh 0.12.13 and Python 3.6, from a standard Anaconda installation.




Discussion:
Use `bokeh serve --help`.
@mattpap Thanks. So perhaps saying something like "See 'bokeh \<command\> --help' to read about a specific subcommand'" (inspiration from `git --help`) when running `bokeh --help` might be clearer?
@aweinstein AFAIK this kind of setup for `--help` for commands with subcommands is fairly typical, but certainly often good to be as explicit as possible. If you'd like to submit a PR to set `parser.description` or `parser.usage` here:

https://github.com/bokeh/bokeh/blob/master/bokeh/command/bootstrap.py#L55

We'd be happy to have your contribution. 

Resolving patch:
diff --git a/bokeh/command/bootstrap.py b/bokeh/command/bootstrap.py
--- a/bokeh/command/bootstrap.py
+++ b/bokeh/command/bootstrap.py
@@ -51,7 +51,9 @@ def main(argv):
     if len(argv) == 1:
         die("ERROR: Must specify subcommand, one of: %s" % nice_join(x.name for x in subcommands.all))
 
-    parser = argparse.ArgumentParser(prog=argv[0])
+    parser = argparse.ArgumentParser(
+        prog=argv[0],
+        epilog="See '<command> --help' to read about a specific subcommand.")
 
     # we don't use settings.version() because the point of this option
     # is to report the actual version of Bokeh, while settings.version()


Test patch:
Repository: bokeh/bokeh

Issue:
Update docstring for on_change
#### Bokeh 0.12.15

#### Update documentation

Update docstrings in the snippet below (https://github.com/bokeh/bokeh/blob/master/bokeh/model.py#L404) to make it clear that handler is able to support multiple callback functions. Ex: `widget.on_change('value', callback1, callback2, ..., callback_n)`

```
    def on_change(self, attr, *callbacks):
        ''' Add a callback on this object to trigger when ``attr`` changes.
        Args:
            attr (str) : an attribute name on this object
            callback (callable) : a callback function to register
        Returns:
            None
        '''

```




Discussion:
@imiu setting expectations, do you intend to submit a PR for this?

Resolving patch:
diff --git a/bokeh/model.py b/bokeh/model.py
--- a/bokeh/model.py
+++ b/bokeh/model.py
@@ -406,11 +406,17 @@ def on_change(self, attr, *callbacks):
 
         Args:
             attr (str) : an attribute name on this object
-            callback (callable) : a callback function to register
+            *callbacks (callable) : callback functions to register
 
         Returns:
             None
 
+        Example:
+
+        .. code-block:: python
+
+            widget.on_change('value', callback1, callback2, ..., callback_n)
+
         '''
         if attr not in self.properties():
             raise ValueError("attempted to add a callback on nonexistent %s.%s property" % (self.__class__.__name__, attr))


Test patch:
Repository: bokeh/bokeh

Issue:
detect_phantomjs() is broken on py3 when phantomjs is not available
`shutil.which()` may return `None`, but the code doesn't account for this.



Discussion:

Resolving patch:
diff --git a/bokeh/util/dependencies.py b/bokeh/util/dependencies.py
--- a/bokeh/util/dependencies.py
+++ b/bokeh/util/dependencies.py
@@ -68,10 +68,10 @@ def detect_phantomjs(version='2.1'):
     if settings.phantomjs_path() is not None:
         phantomjs_path = settings.phantomjs_path()
     else:
-        try:
-            phantomjs_path = shutil.which('phantomjs')
-        # Python 2 relies on Environment variable in PATH - attempt to use as follows
-        except AttributeError:
+        if hasattr(shutil, "which"):
+            phantomjs_path = shutil.which("phantomjs") or "phantomjs"
+        else:
+            # Python 2 relies on Environment variable in PATH - attempt to use as follows
             phantomjs_path = "phantomjs"
 
     try:


Test patch:
Repository: bokeh/bokeh

Issue:
Typo in the image_url documentation
In the `image_url` documentation, both the `h` and `w` parameters are documented as the `height` where the image will be located. For the `w` parameter should be the `width`.


Discussion:

Resolving patch:
diff --git a/bokeh/models/glyphs.py b/bokeh/models/glyphs.py
--- a/bokeh/models/glyphs.py
+++ b/bokeh/models/glyphs.py
@@ -531,7 +531,7 @@ class ImageURL(XYGlyph):
     """)
 
     w = DistanceSpec(default=None, help="""
-    The height of the plot region that the image will occupy in data space.
+    The width of the plot region that the image will occupy in data space.
 
     The default value is ``None``, in which case the image will be displayed
     at its actual image size (regardless of the units specified here).


Test patch:
Repository: bokeh/bokeh

Issue:
Improve computing of available space for responsive layouts



Discussion:

Resolving patch:
diff --git a/examples/plotting/file/custom_layout.py b/examples/plotting/file/custom_layout.py
--- a/examples/plotting/file/custom_layout.py
+++ b/examples/plotting/file/custom_layout.py
@@ -4,11 +4,12 @@
 template = """
 {% block preamble %}
 <style>
-.plots { display: flex; flex-direction: row; }
-.p0, .p1, .p2 { width: 300px; padding: 50px; }
-.p0 { background-color: red;   }
-.p1 { background-color: green; }
-.p2 { background-color: blue;  }
+* { box-sizing: border-box; }
+.plots { display: flex; flex-direction: row; width: 100%; }
+.p { width: 33.3%; padding: 50px; }
+.p:nth-child(1) { background-color: red; }
+.p:nth-child(2) { background-color: green; }
+.p:nth-child(3) { background-color: blue; }
 </style>
 {% endblock %}
 {% block body %}
@@ -18,15 +19,10 @@
 {% endblock %}
 {% block contents %}
 <div class="plots">
-    <div class="p0">
-        {{ embed(roots.p0) }}
-    </div>
-    <div class="p1">
-        {{ embed(roots.p1) }}
-    </div>
-    <div class="p2">
-        {{ embed(roots.p2) }}
-    </div>
+    <div class="p">{{ embed(roots.p0) }}</div>
+    <div class="p">{{ embed(roots.p1) }}</div>
+    <div class="p">{{ embed(roots.p2) }}</div>
+</div>
 </div>
 {% endblock %}
 """


Test patch:
Repository: bokeh/bokeh

Issue:
Add an option to disable column titles in DataTable
# READ AND FOLLOW THESE INSTRUCTIONS CAREFULLY

This issue is being reported for bokeh version 0.12.6.

DataTable widgets do not include an option to hide column titles. It would be nice to have that option.  

Coincidentally, the `row_headers` property is poorly named. It turns on/off the index column, but its name seems to suggest it would toggle column titles. Perhaps that option should be redefined.

#### Complete, minimal, self-contained example code that reproduces the issue

```
data = dict(
        dates=[date(2014, 3, i+1) for i in range(10)],
        downloads=[randint(0, 100) for i in range(10)],
    )
source = ColumnDataSource(data)

columns = [
        TableColumn(field="dates", title="Date", formatter=DateFormatter()),
        TableColumn(field="downloads", title="Downloads"),
    ]

data_table = DataTable(source=source, columns=columns, row_headers=False, editable=True)
```

#### Screenshots or screencasts of the bug in action

<img width="463" alt="screenshot" src="https://user-images.githubusercontent.com/1383911/27066925-73e0f548-4fbc-11e7-90c7-3761de80b990.png">


Discussion:
Apparently one reason this may not have been done is that slick grid does not support it directly. But there may be some workarounds

https://stackoverflow.com/questions/19580402/show-or-hide-slickgrid-header-filter-row-at-runtime
https://stackoverflow.com/questions/2728265/how-to-remove-the-header-in-slickgrid

Whenever this issue s tackled, we should repurpose `row_header` property for it, and make a new property to show/hide the index column

Resolving patch:
diff --git a/bokeh/models/widgets/tables.py b/bokeh/models/widgets/tables.py
--- a/bokeh/models/widgets/tables.py
+++ b/bokeh/models/widgets/tables.py
@@ -571,4 +571,8 @@ class DataTable(TableWidget):
     in the viewport.
     """)
 
+    header_row = Bool(True, help="""
+    Whether to show a header row with column names at the top of the table.
+    """)
+
     height = Override(default=400)


Test patch:
Repository: bokeh/bokeh

Issue:
Simplify pie example
pie chart example -http://bokeh.pydata.org/en/latest/docs/gallery/pie_chart.html can be simplified by 
 removing `Counter` and use `data['value'].sum()`

This example can be refactored to.

```python
from math import pi

import pandas as pd

from bokeh.io import output_file, show
from bokeh.palettes import Category20c
from bokeh.plotting import figure
from bokeh.transform import cumsum

output_file("pie.html")

x = {
    'United States': 157,
    'United Kingdom': 93,
    'Japan': 89,
    'China': 63,
    'Germany': 44,
    'India': 42,
    'Italy': 40,
    'Australia': 35,
    'Brazil': 32,
    'France': 31,
    'Taiwan': 31,
    'Spain': 29
}

data = pd.Series(x).reset_index(name='value').rename(columns={'index':'country'})
data['angle'] = data['value']/data['value'].sum() * 2*pi
data['color'] = Category20c[len(x)]

p = figure(plot_height=350, title="Pie Chart", toolbar_location=None,
           tools="hover", tooltips="@country: @value")

p.wedge(x=0, y=1, radius=0.4,
        start_angle=cumsum('angle', include_zero=True), end_angle=cumsum('angle'),
        line_color="white", fill_color='color', legend='country', source=data)

p.axis.axis_label=None
p.axis.visible=False
p.grid.grid_line_color = None

show(p)
```


Discussion:

Resolving patch:
diff --git a/examples/plotting/file/pie.py b/examples/plotting/file/pie.py
--- a/examples/plotting/file/pie.py
+++ b/examples/plotting/file/pie.py
@@ -1,4 +1,3 @@
-from collections import Counter
 from math import pi
 
 import pandas as pd
@@ -10,7 +9,7 @@
 
 output_file("pie.html")
 
-x = Counter({
+x = {
     'United States': 157,
     'United Kingdom': 93,
     'Japan': 89,
@@ -23,10 +22,10 @@
     'France': 31,
     'Taiwan': 31,
     'Spain': 29
-})
+}
 
-data = pd.DataFrame.from_dict(dict(x), orient='index').reset_index().rename(index=str, columns={0:'value', 'index':'country'})
-data['angle'] = data['value']/sum(x.values()) * 2*pi
+data = pd.Series(x).reset_index(name='value').rename(columns={'index':'country'})
+data['angle'] = data['value']/data['value'].sum() * 2*pi
 data['color'] = Category20c[len(x)]
 
 p = figure(plot_height=350, title="Pie Chart", toolbar_location=None,


Test patch:
Repository: bokeh/bokeh

Issue:
box_annotation example .ix method is deprecated
In https://bokeh.pydata.org/en/latest/docs/gallery/box_annotation.html

`.ix` is deprecated, use `.loc`
box_annotation example .ix method is deprecated
In https://bokeh.pydata.org/en/latest/docs/gallery/box_annotation.html

`.ix` is deprecated, use `.loc`


Discussion:

Resolving patch:
diff --git a/examples/plotting/file/box_annotation.py b/examples/plotting/file/box_annotation.py
--- a/examples/plotting/file/box_annotation.py
+++ b/examples/plotting/file/box_annotation.py
@@ -5,7 +5,7 @@
 TOOLS = "pan,wheel_zoom,box_zoom,reset,save"
 
 # reduce data size
-data = data.ix['2010-10-06':'2010-10-13']
+data = data.loc['2010-10-06':'2010-10-13']
 
 p = figure(x_axis_type="datetime", tools=TOOLS, title="Glocose Range")
 p.xgrid.grid_line_color=None


Test patch: