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

Issue:
Use utf-8 encoding to open notebook file.
Currently,  `ipynb` file is opened by following code:

```
        with open(filename) as f:
            pass
```

https://github.com/bokeh/bokeh/blob/master/bokeh/application/handlers/notebook.py#L117

I suggest to open the file with `encoding="utf-8"`, otherwise the serve command will raise error on Windows system.


Discussion:
@ruoyu0088 would you like to submit a PR for us to consider?

Resolving patch:
diff --git a/bokeh/application/handlers/notebook.py b/bokeh/application/handlers/notebook.py
--- a/bokeh/application/handlers/notebook.py
+++ b/bokeh/application/handlers/notebook.py
@@ -21,8 +21,6 @@
 #-----------------------------------------------------------------------------
 from __future__ import absolute_import, division, print_function, unicode_literals
 
-import re
-import sys
 import logging
 log = logging.getLogger(__name__)
 
@@ -31,6 +29,9 @@
 #-----------------------------------------------------------------------------
 
 # Standard library imports
+import io
+import re
+import sys
 
 # External imports
 
@@ -114,7 +115,7 @@ def __call__(self, nb, resources):
         preprocessors=[StripMagicsProcessor()]
         filename = kwargs['filename']
 
-        with open(filename) as f:
+        with io.open(filename, encoding="utf-8") as f:
             nb = nbformat.read(f, nbformat.NO_CONVERT)
             exporter = nbconvert.PythonExporter()
 


Test patch:
diff --git a/bokeh/_testing/util/examples.py b/bokeh/_testing/util/examples.py
--- a/bokeh/_testing/util/examples.py
+++ b/bokeh/_testing/util/examples.py
@@ -236,15 +236,15 @@ def diff_url(self):
 
     @property
     def img_url_path(self):
-        return join("travis", JOB_ID, __version__, self.relpath_no_ext) + '.png'
+        return join("travis", "image_refs", __version__, self.relpath_no_ext) + '.png'
 
     @property
     def ref_url_path(self):
-        return join(self._diff_ref, self.relpath_no_ext) + '.png'
+        return join("travis", "image_refs", self._diff_ref, self.relpath_no_ext) + '.png'
 
     @property
     def diff_url_path(self):
-        return join("travis", JOB_ID, __version__, self.relpath_no_ext) + self._diff_ref + '-diff.png'
+        return join("travis", "image_refs", __version__, self.relpath_no_ext) + self._diff_ref + '-diff.png'
 
     @property
     def has_ref(self):
diff --git a/scripts/ci/install.test b/scripts/ci/install.test
--- a/scripts/ci/install.test
+++ b/scripts/ci/install.test
@@ -24,11 +24,11 @@ else
     pushd ${HOME}
 
     # download the pre-built Bokeh package from the build phase
-    wget -nv "https://ci.bokeh.org/builds/${TRAVIS_BUILD_ID}/conda-bld-noarch.tgz"
+    wget -nv "https://ci.bokeh.org/travis/${TRAVIS_BUILD_ID}/build/conda-bld-noarch.tgz"
     tar xzf conda-bld-noarch.tgz
 
     # download the previous BokehJS build directory to run tests
-    wget -nv "https://ci.bokeh.org/builds/${TRAVIS_BUILD_ID}/bokehjs-build.tgz"
+    wget -nv "https://ci.bokeh.org/travis/${TRAVIS_BUILD_ID}/build/bokehjs-build.tgz"
     tar xzf bokehjs-build.tgz
 
     popd
Repository: bokeh/bokeh

Issue:
Typo in plots.py
# READ AND FOLLOW THESE INSTRUCTIONS CAREFULLY

*ISSUES THAT DO NOT CONTAIN NECESSARY INFORMATION MAY BE CLOSED, IMMEDIATELY*

The issue tracker is NOT the place for general support. For questions and
technical assistance, come ask the [Bokeh mailing list](https://groups.google.com/a/continuum.io/forum/#!forum/bokeh) or join the chat on [Gitter](https://gitter.im/bokeh/bokeh). For feature requests, please provide a detailed description or proposal of the new capability or behavior.

For defects or deficiencies, please provide ALL OF THE FOLLOWING:

#### ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
Bokeh 1.0.2
#### Description of expected behavior and the observed behavior

#### Complete, minimal, self-contained example code that reproduces the issue

```
/Users/BenjaminLee/.virtualenvs/squiggle/lib/python3.6/site-packages/bokeh/models/plots.py:55: UserWarning:
You are attemptings to set `plot.legend.location` on a plot that has zero legends added, this will have no effect.

Before legend properties can be set, you must add a Legend explicitly, or call a glyph method with the 'legend' parameter set.
```

In this case, `attemptings` is a misspelling of `attempting`.
#### Stack traceback and/or browser JavaScript console output

#### Screenshots or screencasts of the bug in action



Discussion:

Resolving patch:
diff --git a/bokeh/models/plots.py b/bokeh/models/plots.py
--- a/bokeh/models/plots.py
+++ b/bokeh/models/plots.py
@@ -728,7 +728,7 @@ def __dir__(self):
             return dir(self)
 
 _LEGEND_EMPTY_WARNING = """
-You are attemptings to set `plot.legend.%s` on a plot that has zero legends added, this will have no effect.
+You are attempting to set `plot.legend.%s` on a plot that has zero legends added, this will have no effect.
 
 Before legend properties can be set, you must add a Legend explicitly, or call a glyph method with the 'legend' parameter set.
 """


Test patch:
diff --git a/bokeh/models/tests/test_plots.py b/bokeh/models/tests/test_plots.py
--- a/bokeh/models/tests/test_plots.py
+++ b/bokeh/models/tests/test_plots.py
@@ -39,7 +39,7 @@
 #-----------------------------------------------------------------------------
 
 _LEGEND_EMPTY_WARNING = """
-You are attemptings to set `plot.legend.location` on a plot that has zero legends added, this will have no effect.
+You are attempting to set `plot.legend.location` on a plot that has zero legends added, this will have no effect.
 
 Before legend properties can be set, you must add a Legend explicitly, or call a glyph method with the 'legend' parameter set.
 """
Repository: bokeh/bokeh

Issue:
Bokeh Panel(closable=True) doesn't make 'x' appear on the Panel title and closable by user
Hi, 
I am running your example for Panel and Tabs in bokeh. The 'closable=True' not working as expected.
Tested on Ubuntu 16.04, Chrome and Firefox browsers.
Using Bokeh 0.12.13 server and Python 3.6. 
Nothing special showed in the debugging.

Thanks

```
from bokeh.models.widgets import Panel, Tabs
from bokeh.io import output_file, show
from bokeh.plotting import figure
from bokeh.io import curdoc


output_file("slider.html")

p1 = figure(plot_width=300, plot_height=300)
p1.circle([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], size=20, color="navy", alpha=0.5)
tab1 = Panel(child=p1, title="circle")

p2 = figure(plot_width=300, plot_height=300)
p2.line([1, 2, 3, 4, 5], [6, 7, 2, 4, 5], line_width=3, color="navy", alpha=0.5)
tab2 = Panel(child=p2, title="line", closable=True)

tabs = Tabs(tabs=[ tab1, tab2 ])

curdoc().add_root(tabs)
```




Discussion:
This attribute was completely ignored during implementation.
It appears `closable` was removed before 1.0 @mattpap should this be changed to `feature` or just closed?
I'd love to have the ability to close tabs. I'd vote to keep this open as a feature request.
What should be the desired behavior? Should it remove panels from children or mark them as hidden (in some way) or both (configurable)?
`closable` wasn't ever implemented. I must have removed it from the API when moving tabs from widgets to layouts.
Good question, I guess I'd expect it to drop the child by default, marking it as hidden is an interesting idea but raises the question of how you would then restore it.

Resolving patch:
diff --git a/bokeh/models/layouts.py b/bokeh/models/layouts.py
--- a/bokeh/models/layouts.py
+++ b/bokeh/models/layouts.py
@@ -412,6 +412,12 @@ class Panel(Model):
     The child widget. If you need more children, use a layout widget, e.g. a ``Column``.
     """)
 
+    closable = Bool(False, help="""
+    Whether this panel is closable or not. If True, an "x" button will appear.
+
+    Closing a panel is equivalent to removing it from its parent container (e.g. tabs).
+    """)
+
 class Tabs(LayoutDOM):
     ''' A panel widget with navigation tabs.
 
diff --git a/examples/models/file/glyphs.py b/examples/models/file/glyphs.py
--- a/examples/models/file/glyphs.py
+++ b/examples/models/file/glyphs.py
@@ -101,7 +101,7 @@ def make_tab(title, glyph):
 
     plot.add_tools(HoverTool())
 
-    tab = Panel(child=plot, title=title)
+    tab = Panel(child=plot, title=title, closable=True)
 
     return tab
 


Test patch:
Repository: bokeh/bokeh

Issue:
Windows phantomjs not killed on selenium termination
I reinstalled a fresh python environment on windows with python 3.7 and pythonenv
I use only pip for package dependencies
When I tried to run tests some failed because temp files were locked.
<img width="726" alt="win32error" src="https://user-images.githubusercontent.com/18531147/54091987-214f4580-4387-11e9-9584-6a117a356ad2.png">
<img width="257" alt="test_failures" src="https://user-images.githubusercontent.com/18531147/54091989-24e2cc80-4387-11e9-9c42-3573dabd1813.PNG">


When driver terminate phantomjs is not correctly killed:
<img width="294" alt="proc_pantomjs" src="https://user-images.githubusercontent.com/18531147/54092002-45128b80-4387-11e9-9967-bf74b1e41bd7.PNG">



Discussion:

Resolving patch:
diff --git a/bokeh/io/webdriver.py b/bokeh/io/webdriver.py
--- a/bokeh/io/webdriver.py
+++ b/bokeh/io/webdriver.py
@@ -21,6 +21,7 @@
 #-----------------------------------------------------------------------------
 
 # Standard library imports
+import sys
 import atexit
 import signal
 import warnings
@@ -29,7 +30,7 @@
 # External imports
 
 # Bokeh imports
-from ..util.dependencies import import_required, detect_phantomjs
+from ..util.dependencies import import_required, detect_phantomjs, import_optional
 
 #-----------------------------------------------------------------------------
 # Globals and constants
@@ -49,6 +50,20 @@
 # Dev API
 #-----------------------------------------------------------------------------
 
+
+def kill_proc_tree(pid, including_parent=True):
+    psutil = import_optional('psutil')
+    if psutil is not None:
+        parent = psutil.Process(pid)
+        children = parent.children(recursive=True)
+        for child in children:
+            child.kill()
+        psutil.wait_procs(children)
+        if including_parent:
+            parent.kill()
+            parent.wait(5)
+
+
 def create_phantomjs_webdriver():
     with warnings.catch_warnings():
         warnings.filterwarnings("ignore", ".*", UserWarning, "selenium.webdriver.phantomjs.webdriver")
@@ -60,21 +75,25 @@ def create_phantomjs_webdriver():
         phantomjs_path = detect_phantomjs()
         return webdriver.PhantomJS(executable_path=phantomjs_path, service_log_path=devnull)
 
+
 def terminate_webdriver(driver):
     if driver.name == "phantomjs":
         # https://github.com/seleniumhq/selenium/issues/767
         if driver.service.process:
+            if sys.platform == 'win32':
+                kill_proc_tree(driver.service.process.pid, including_parent=False)
             driver.service.process.send_signal(signal.SIGTERM)
 
     try:
         driver.quit()
-    except (IOError, OSError): # IOError for Python 2.7
+    except (IOError, OSError):  # IOError for Python 2.7
         pass
 
 #-----------------------------------------------------------------------------
 # Private API
 #-----------------------------------------------------------------------------
 
+
 class _WebdriverState(object):
     '''
 


Test patch:
Repository: bokeh/bokeh

Issue:
Make error reporting from `export_png()` more robust
Currently if it fails, it does this with very unhelpful error messages like:

> fig throws error: Message: {"errorMessage":"undefined is not an object (evaluating 'document.getElementsByClassName('bk-root')[0].children[0].getBoundingClientRect')","request":{"headers":{"Accept":"application/json","Accept-Encoding":"identity","Connection":"close","Content-Length":"171","Content-Type":"application/json;charset=UTF-8","Host":"127.0.0.1:49953","User-Agent":"Python http auth"},"httpVersion":"1.1","method":"POST","post":"{"script": "\nreturn document.getElementsByClassName('bk-root')[0].children[0].getBoundingClientRect()\n", "args": [], "sessionId": "060e11a0-788c-11e8-83b8-2779613502fa"}","url":"/execute","urlParsed":{"anchor":"","query":"","file":"execute","directory":"/","path":"/execute","relative":"/execute","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/execute","queryKey":{},"chunks":["execute"]},"urlOriginal":"/session/060e11a0-788c-11e8-83b8-2779613502fa/execute"}}

(see issue #8020).



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
@@ -92,6 +92,9 @@ def export_png(obj, filename=None, height=None, width=None, webdriver=None):
     if filename is None:
         filename = default_filename("png")
 
+    if image.width == 0 or image.height == 0:
+        raise ValueError("unable to save an empty image")
+
     image.save(filename)
 
     return abspath(filename)
@@ -287,14 +290,16 @@ def is_bokeh_render_complete(driver):
     try:
         WebDriverWait(driver, 5, poll_frequency=0.1).until(is_bokeh_render_complete)
     except TimeoutException:
-        log.warning("The webdriver raised a TimeoutException while waiting for \
-                     a 'bokeh:idle' event to signify that the layout has rendered. \
-                     Something may have gone wrong.")
+        log.warning("The webdriver raised a TimeoutException while waiting for "
+                    "a 'bokeh:idle' event to signify that the layout has rendered. "
+                    "Something may have gone wrong.")
     finally:
         browser_logs = driver.get_log('browser')
-        severe_errors = [l for l in browser_logs if l.get('level') == 'SEVERE']
-        if len(severe_errors) > 0:
-            log.warning("There were severe browser errors that may have affected your export: {}".format(severe_errors))
+        messages = [ l.get("message") for l in browser_logs if l.get('level') in ['WARNING', 'ERROR', 'SEVERE'] ]
+        if len(messages) > 0:
+            log.warning("There were browser warnings and/or errors that may have affected your export")
+            for message in messages:
+                log.warning(message)
 
 #-----------------------------------------------------------------------------
 # Private API


Test patch:
Repository: bokeh/bokeh

Issue:
"WARNING:bokeh.resources:root_url should end with a /, adding one" spam
# READ AND FOLLOW THESE INSTRUCTIONS CAREFULLY

*ISSUES THAT DO NOT CONTAIN NECESSARY INFORMATION MAY BE CLOSED, IMMEDIATELY*

The issue tracker is NOT the place for general support. For questions and
technical assistance, come ask the [Bokeh mailing list](https://groups.google.com/a/continuum.io/forum/#!forum/bokeh) or join the chat on [Gitter](https://gitter.im/bokeh/bokeh). For feature requests, please provide a detailed description or proposal of the new capability or behavior.

For defects or deficiencies, please provide ALL OF THE FOLLOWING:

#### ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)

bokeh 1.0.2
python 3.6.5
OS CentOS-7.5.1804

#### Description of expected behavior and the observed behavior

After adding the "prefix" parameter to a bokeh.server.server.Server, the logs get "WARNING:bokeh.resources:root_url should end with a /, adding one" on autoload.js requests.

I think this is because in tornado.py it normalizes the prefix to have a slash only at the beginning:

https://github.com/bokeh/bokeh/blob/master/bokeh/server/tornado.py#L161-L165

then uses this prefix value when initializing the Resources object:

https://github.com/bokeh/bokeh/blob/master/bokeh/server/tornado.py#L377-L379

and then the Resources object complains about the lack of slash at the end:

https://github.com/bokeh/bokeh/blob/master/bokeh/resources.py#L89-L91

#### Complete, minimal, self-contained example code that reproduces the issue

N/A

#### Stack traceback and/or browser JavaScript console output

N/A

#### Screenshots or screencasts of the bug in action

N/A



Discussion:
also, the slash at the beginning of the prefix doubles up with the slash at the end of the root_url, added here:

https://github.com/bokeh/bokeh/blob/master/bokeh/server/views/autoload_js_handler.py#L34-L40

producing a double slash in static urls here:

https://github.com/bokeh/bokeh/blob/master/bokeh/resources.py#L502
Ugh. The totality of these codepaths was made by different people and there is pretty inconsistent handling of expectations of URL formats throughout. I'm tempted to just disable this warning for now, and save a thorough review of URL handling for later.  

Resolving patch:
diff --git a/bokeh/resources.py b/bokeh/resources.py
--- a/bokeh/resources.py
+++ b/bokeh/resources.py
@@ -86,7 +86,7 @@ def __init__(self, mode='inline', version=None, root_dir=None,
         self.path_versioner = path_versioner;           del path_versioner
 
         if root_url and not root_url.endswith("/"):
-            log.warning("root_url should end with a /, adding one")
+            # root_url should end with a /, adding one
             root_url = root_url + "/"
         self._root_url = root_url
         if self.mode not in ['inline', 'cdn', 'server', 'server-dev', 'relative', 'relative-dev', 'absolute', 'absolute-dev']:


Test patch:
Repository: bokeh/bokeh

Issue:
[BUG] Color mapping bug in crossfilter example
### FOLLOW THESE INSTRUCTIONS CAREFULLY

*ISSUES THAT DO NOT CONTAIN NECESSARY INFORMATION MAY BE CLOSED, IMMEDIATELY*

The issue tracker is NOT the place for general support. For questions and technical assistance, come ask the [Bokeh mailing list](https://groups.google.com/a/continuum.io/forum/#!forum/bokeh) or join the chat on [Gitter](https://gitter.im/bokeh/bokeh).

For defects or deficiencies, please provide *ALL OF THE FOLLOWING*:

#### ALL software version info (bokeh, python, notebook, OS, browser, any other relevant packages)
Not relevant

#### Description of expected behavior and the observed behavior

#### Complete, minimal, self-contained example code that reproduces the issue
Line 55 - color mapping is done based on number of values in column name. The check should be based on max colors in Spectral5, which is N_COLORS

```
# code goes here between backticks
len(set(df[color.value])) > N_SIZES
```

#### Stack traceback and/or browser JavaScript console output

#### Screenshots or screencasts of the bug in action



Discussion:

Resolving patch:
diff --git a/examples/app/crossfilter/main.py b/examples/app/crossfilter/main.py
--- a/examples/app/crossfilter/main.py
+++ b/examples/app/crossfilter/main.py
@@ -52,7 +52,7 @@ def create_figure():
 
     c = "#31AADE"
     if color.value != 'None':
-        if len(set(df[color.value])) > N_SIZES:
+        if len(set(df[color.value])) > N_COLORS:
             groups = pd.qcut(df[color.value].values, N_COLORS, duplicates='drop')
         else:
             groups = pd.Categorical(df[color.value])


Test patch:
Repository: bokeh/bokeh

Issue:
[BUG] exports do not work with Firefox webdriver
Firefox webdriver does not currently support logs: https://github.com/SeleniumHQ/selenium/issues/2972

It makes it impossible to export figures with Firefox as a webdriver.
Fixing this issue may allow to fix this one: https://github.com/bokeh/bokeh/issues/8176


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
@@ -274,6 +274,7 @@ def wait_until_render_complete(driver):
     '''
     from selenium.webdriver.support.ui import WebDriverWait
     from selenium.common.exceptions import TimeoutException
+    from selenium.webdriver import Firefox
 
     def is_bokeh_loaded(driver):
         return driver.execute_script('''
@@ -298,12 +299,14 @@ def is_bokeh_render_complete(driver):
                     "a 'bokeh:idle' event to signify that the layout has rendered. "
                     "Something may have gone wrong.")
     finally:
-        browser_logs = driver.get_log('browser')
-        messages = [ l.get("message") for l in browser_logs if l.get('level') in ['WARNING', 'ERROR', 'SEVERE'] ]
-        if len(messages) > 0:
-            log.warning("There were browser warnings and/or errors that may have affected your export")
-            for message in messages:
-                log.warning(message)
+        # Firefox webdriver does not currently support logs
+        if not isinstance(driver, Firefox):
+            browser_logs = driver.get_log('browser')
+            messages = [ l.get("message") for l in browser_logs if l.get('level') in ['WARNING', 'ERROR', 'SEVERE'] ]
+            if len(messages) > 0:
+                log.warning("There were browser warnings and/or errors that may have affected your export")
+                for message in messages:
+                    log.warning(message)
 
 #-----------------------------------------------------------------------------
 # Private API


Test patch:
Repository: bokeh/bokeh

Issue:
Update Tile Provider example for "Mapping Geo Data" User Guide
Currently the provided example generates a deprecation warning for importing the `CARTODBPOSITRON` tile provider from `bokeh.tile_providers`.
Update Tile Provider example for "Mapping Geo Data" User Guide
Currently the provided example generates a deprecation warning for importing the `CARTODBPOSITRON` tile provider from `bokeh.tile_providers`.


Discussion:

Resolving patch:
diff --git a/sphinx/source/docs/user_guide/examples/geo_tile_source.py b/sphinx/source/docs/user_guide/examples/geo_tile_source.py
--- a/sphinx/source/docs/user_guide/examples/geo_tile_source.py
+++ b/sphinx/source/docs/user_guide/examples/geo_tile_source.py
@@ -1,11 +1,13 @@
 from bokeh.plotting import figure, show, output_file
-from bokeh.tile_providers import CARTODBPOSITRON
+from bokeh.tile_providers import get_provider, Vendors
 
 output_file("tile.html")
 
+tile_provider = get_provider(Vendors.CARTODBPOSITRON)
+
 # range bounds supplied in web mercator coordinates
 p = figure(x_range=(-2000000, 6000000), y_range=(-1000000, 7000000),
            x_axis_type="mercator", y_axis_type="mercator")
-p.add_tile(CARTODBPOSITRON)
+p.add_tile(tile_provider)
 
 show(p)


Test patch: