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

Issue:
Docstrings not clear for dimension property for Band, Span and Whisker class
In using Whisker to plot error bars on figures there is a lack of information associated with the ``dimension`` property - it is not clear how you should use it. 

The correct method is to specify ``dimension=height`` for error bars aligned in the ``y``-direction and ``dimension=weight`` for error bars aligned in the ``x``-direction. 

The docstrings should be updated for this property to help users on how to use it. 


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
@@ -528,7 +528,8 @@ class Band(Annotation):
     """)
 
     dimension = Enum(Dimension, default='height', help="""
-    The direction of the band.
+    The direction of the band can be specified by setting this property
+    to "height" (``y`` direction) or "width" (``x`` direction).
     """)
 
     source = Instance(DataSource, default=lambda: ColumnDataSource(), help="""
@@ -856,7 +857,8 @@ class Span(Annotation):
     """)
 
     dimension = Enum(Dimension, default='width', help="""
-    The direction of the span.
+    The direction of the span can be specified by setting this property
+    to "height" (``y`` direction) or "width" (``x`` direction).
     """)
 
     x_range_name = String('default', help="""
@@ -1019,7 +1021,8 @@ class Whisker(Annotation):
     """)
 
     dimension = Enum(Dimension, default='height', help="""
-    The direction of the band.
+    The direction of the whisker can be specified by setting this property
+    to "height" (``y`` direction) or "width" (``x`` direction).
     """)
 
     source = Instance(DataSource, default=lambda: ColumnDataSource(), help="""


Test patch:
Repository: bokeh/bokeh

Issue:
Bokeh doesn't work with Tornado master
```pytz
distributed/bokeh/core.py:7: in <module>
    from bokeh.server.server import Server
../../Software/anaconda/lib/python3.6/site-packages/bokeh/server/server.py:35: in <module>
    from .tornado import BokehTornado, DEFAULT_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES
../../Software/anaconda/lib/python3.6/site-packages/bokeh/server/tornado.py:24: in <module>
    from .urls import per_app_patterns, toplevel_patterns
../../Software/anaconda/lib/python3.6/site-packages/bokeh/server/urls.py:39: in <module>
    from .views.ws import WSHandler
../../Software/anaconda/lib/python3.6/site-packages/bokeh/server/views/ws.py:20: in <module>
    from ...protocol.receiver import Receiver
../../Software/anaconda/lib/python3.6/site-packages/bokeh/protocol/receiver.py:8: in <module>
    from tornado.concurrent import return_future
E   ImportError: cannot import name 'return_future'
```

Also cc @bdarnell in case he's interested in downstream testing


Discussion:

Resolving patch:
diff --git a/bokeh/protocol/receiver.py b/bokeh/protocol/receiver.py
--- a/bokeh/protocol/receiver.py
+++ b/bokeh/protocol/receiver.py
@@ -5,7 +5,7 @@
 from __future__ import absolute_import
 
 import six
-from tornado.concurrent import return_future
+from tornado import gen
 
 from .exceptions import ValidationError
 
@@ -70,8 +70,8 @@ def __init__(self, protocol):
         self._message = None
         self._buf_header = None
 
-    @return_future
-    def consume(self, fragment, callback=None):
+    @gen.coroutine
+    def consume(self, fragment):
         ''' Consume individual protocol message fragments.
 
         Args:
@@ -80,12 +80,9 @@ def consume(self, fragment, callback=None):
                 assembled, the receiver state will reset to begin consuming a
                 new message.
 
-            callback (callable, optional)
-                Argument required by ``return_future`` decorator
-
         '''
         self._current_consumer(fragment)
-        callback(self._message)
+        raise gen.Return(self._message)
 
     def _HEADER(self, fragment):
         self._assume_text(fragment)


Test patch:
Repository: bokeh/bokeh

Issue:
Remove the arguments parameter from server_session
As per the title, can the arguments parameter from the server_session class, found in bokeh.embed be removed?

[the problem was initially highlighted here](https://groups.google.com/a/continuum.io/forum/#!topic/bokeh/QeU4uthUvgM)

[Link to docs server_session in docs](https://bokeh.pydata.org/en/latest/docs/reference/embed.html#bokeh.embed.server_session)





Discussion:
TLDR; `server_session` loads an existing session, which means the handler code is already executed. There is nothing left to see or do anything with arguments, at least in the main hander code. 

It does occur to me just now that perhaps *callbacks* could refer to the arguments. This might be justification to keep it, however I think the docstring would needs to be updated to be explicitly clear that this is the case. 
No, the request arguments are not updated after the fact when `server_session` is called, so the argument is completely useless. 

I would argue that it should just be removed immediately, prior to 1.0  Thoughts @mattpap ?

As an aside I am not sure there is any workflow that supports both sending HTTP args, *and* using `pull_session` to customize a session. But that's a pretty obscure/advanced case, and making that possible would be a different issue. (Solution is to allow `pull_session` to accept an `aguments` param)

Resolving patch:
diff --git a/bokeh/embed/server.py b/bokeh/embed/server.py
--- a/bokeh/embed/server.py
+++ b/bokeh/embed/server.py
@@ -104,7 +104,7 @@ def server_document(url="default", relative_urls=False, resources="default", arg
 
     return encode_utf8(tag)
 
-def server_session(model=None, session_id=None, url="default", relative_urls=False, resources="default", arguments=None):
+def server_session(model=None, session_id=None, url="default", relative_urls=False, resources="default"):
     ''' Return a script tag that embeds content from a specific existing session on
     a Bokeh server.
 
@@ -153,10 +153,6 @@ def server_session(model=None, session_id=None, url="default", relative_urls=Fal
             files you'll load separately are of the same version as that of the
             server's, otherwise the rendering may not work correctly.
 
-        arguments (dict[str, str], optional) :
-            A dictionary of key/values to be passed as HTTP request arguments
-            to Bokeh application code (default: None)
-
     Returns:
         A ``<script>`` tag that will embed content from a Bokeh Server.
 
@@ -182,7 +178,6 @@ def server_session(model=None, session_id=None, url="default", relative_urls=Fal
     src_path += _process_relative_urls(relative_urls, url)
     src_path += _process_session_id(session_id)
     src_path += _process_resources(resources)
-    src_path += _process_arguments(arguments)
 
     tag = AUTOLOAD_TAG.render(
         src_path  = src_path,


Test patch:
Repository: bokeh/bokeh

Issue:
patch_app.py is broken
Bisection reveals https://github.com/bokeh/bokeh/pull/8224

running the app repeatedly shows
```
2018-09-10 19:07:29,992 Exception in callback functools.partial(<function wrap.<locals>.null_wrapper at 0x1202aa6a8>, <Future finished exception=ValueError('assignment destination is read-only',)>)
Traceback (most recent call last):
  File "/Users/bryanv/anaconda/lib/python3.6/site-packages/tornado/ioloop.py", line 759, in _run_callback
    ret = callback()
  File "/Users/bryanv/anaconda/lib/python3.6/site-packages/tornado/stack_context.py", line 276, in null_wrapper
    return fn(*args, **kwargs)
  File "/Users/bryanv/work/bokeh/bokeh/util/tornado.py", line 95, in on_done
    log.error("".join(format_exception(*future.exc_info())))
AttributeError: '_asyncio.Future' object has no attribute 'exc_info'
```
which is also actually a secondary issue causing the exception to not be reported correctly. 


Discussion:

Resolving patch:
diff --git a/bokeh/util/serialization.py b/bokeh/util/serialization.py
--- a/bokeh/util/serialization.py
+++ b/bokeh/util/serialization.py
@@ -513,7 +513,7 @@ def decode_base64_dict(data):
 
     '''
     b64 = base64.b64decode(data['__ndarray__'])
-    array = np.frombuffer(b64, dtype=data['dtype'])
+    array = np.copy(np.frombuffer(b64, dtype=data['dtype']))
     if len(data['shape']) > 1:
         array = array.reshape(data['shape'])
     return array
diff --git a/bokeh/util/tornado.py b/bokeh/util/tornado.py
--- a/bokeh/util/tornado.py
+++ b/bokeh/util/tornado.py
@@ -11,6 +11,7 @@
 
 from traceback import format_exception
 
+import six
 from tornado import gen
 from ..util.serialization import make_id
 
@@ -90,16 +91,20 @@ def invoke():
         def on_done(future):
             if not self._stopped:
                 self._loop.add_future(invoke(), on_done)
-            if future.exception() is not None:
+            ex = future.exception()
+            if ex is not None:
                 log.error("Error thrown from periodic callback:")
-                log.error("".join(format_exception(*future.exc_info())))
+                if six.PY2:
+                    lines = format_exception(*future.exc_info())
+                else:
+                    lines = format_exception(ex.__class__, ex, ex.__traceback__)
+                log.error("".join(lines))
 
         self._loop.add_future(self.sleep(), on_done)
 
     def stop(self):
         self._stopped = True
 
-
 class _CallbackGroup(object):
     """ A collection of callbacks added to a Tornado IOLoop that we may
     want to remove as a group. """


Test patch:
diff --git a/bokeh/util/tests/test_serialization.py b/bokeh/util/tests/test_serialization.py
--- a/bokeh/util/tests/test_serialization.py
+++ b/bokeh/util/tests/test_serialization.py
@@ -354,6 +354,8 @@ def test_decode_base64_dict(dt, shape):
 
     assert np.array_equal(a, aa)
 
+    assert aa.flags['WRITEABLE']
+
 @pytest.mark.parametrize('dt', [np.float32, np.float64, np.int64])
 @pytest.mark.parametrize('shape', [(12,), (2, 6), (2,2,3)])
 @pytest.mark.unit
Repository: bokeh/bokeh

Issue:
User Guide, tweak to "ranges" doc
### Description of expected behavior and the observed behavior
In the ["User Guide" > "Plotting with Basic Glyphs" > "Setting ranges"](https://bokeh.pydata.org/en/latest/docs/user_guide/plotting.html#setting-ranges), it says at the bottom of the section:

> Ranges can also accept a min and max property that allow you to specify the edges of the plot that you do not want the user to be able to pan/zoom beyond.

1. As someone new to Bokeh, this isn't super helpful.
2. This doesn't seem entirely accurate, as I can't find a `min` or `max` property
3. There is no example code.

### Suggested fix
I suggest something like the following, with added links to relevant documentation pages.

> [Ranges](https://bokeh.pydata.org/en/latest/docs/reference/models/ranges.html) can also accept a `bounds` property that allow you to specify the edges of the plot that you do not want the user to be able to pan/zoom beyond. 
> 
> ```
> # set a range using a Range1d
>  p.y_range = Range1d(0, 15, bounds=(0, None))
>  ```

As a suggestion, perhaps moving this code snip and explanation up and combining it with the previous example would make the most sense.

### Two related notes
I'm happy to open these as separate issues, but perhaps they can most easily be solved in the comments here.

1. The [Developer Guide](https://bokeh.pydata.org/en/latest/docs/dev_guide/documentation.html#devguide-documentation) has some instructions for proposing issues and pull requests for what I assume is the [auto-generated documentation](https://bokeh.pydata.org/en/latest/docs/reference.html). However, I cannot find the [User Guide](https://bokeh.pydata.org/en/latest/docs/user_guide.html) in the repository, and thus don't know how to best propose changes to that documentation. Hence this Issue.

2. There isn't a great explanation for the difference between `DataRange1d` and `Range1d` in the [auto-generated documentation](https://bokeh.pydata.org/en/latest/docs/reference/models/ranges.html). It'd be nice to have a sentence explaining the difference. (The answer *is* there, but it requires a bit of textual parsing, and flipping back and forth comparing the two. A simple contrasting sentence would be super helpful.)


Discussion:
@tag If you would like to submit edits to the docs that would certainly be helpful and appreciated. The small core team is fairly underwater so user contributions are critically important. The Sphinx ReST source files for the user's guide are here:

https://github.com/bokeh/bokeh/tree/master/sphinx/source/docs/user_guide


Resolving patch:
diff --git a/bokeh/models/ranges.py b/bokeh/models/ranges.py
--- a/bokeh/models/ranges.py
+++ b/bokeh/models/ranges.py
@@ -122,7 +122,9 @@ class DataRange(Range):
 
 class DataRange1d(DataRange):
     ''' An auto-fitting range in a continuous scalar dimension.
-    The upper and lower bounds are set to the min and max of the data.
+
+    By default the ``start`` and ``end`` of the range automatically
+    assume min and max values of the data for associated renderers.
 
     '''
 


Test patch:
Repository: bokeh/bokeh

Issue:
Add note of  BOKEH_PHANTOMJS_PATH environment variable on missing phantomjs 
I'm using bokeh 0.13.0 with python 3.6 to auto-generate charts in an AWS lambda environment to send to SLACK.

The AWS lambda environment is a bit restrictive and it's not *easy* to install packages or set the system PATH.  (or I couldn't find an easy way)

I looked for a way to set the phantomjs path, but didn't come across anything.  I just ran across this issue mentioning the existence of `BOKEH_PHANTOMJS_PATH`.

It would be helpful if this was available in the exception raised.


*dependencies.py detect_phantomjs*
```
...
    except OSError:
        raise RuntimeError('PhantomJS is not present in PATH or BOKEH_PHANTOMJS_PATH. Try "conda install phantomjs" or \
            "npm install -g phantomjs-prebuilt"')

    return phantomjs_path
```

Add note of  BOKEH_PHANTOMJS_PATH environment variable on missing phantomjs 
I'm using bokeh 0.13.0 with python 3.6 to auto-generate charts in an AWS lambda environment to send to SLACK.

The AWS lambda environment is a bit restrictive and it's not *easy* to install packages or set the system PATH.  (or I couldn't find an easy way)

I looked for a way to set the phantomjs path, but didn't come across anything.  I just ran across this issue mentioning the existence of `BOKEH_PHANTOMJS_PATH`.

It would be helpful if this was available in the exception raised.


*dependencies.py detect_phantomjs*
```
...
    except OSError:
        raise RuntimeError('PhantomJS is not present in PATH or BOKEH_PHANTOMJS_PATH. Try "conda install phantomjs" or \
            "npm install -g phantomjs-prebuilt"')

    return phantomjs_path
```



Discussion:
@monkut please submit the small PR to add this and I will merge it
@monkut please submit the small PR to add this and I will merge it

Resolving patch:
diff --git a/bokeh/util/dependencies.py b/bokeh/util/dependencies.py
--- a/bokeh/util/dependencies.py
+++ b/bokeh/util/dependencies.py
@@ -88,7 +88,7 @@ def detect_phantomjs(version='2.1'):
             raise RuntimeError('PhantomJS version to old. Version>=%s required, installed: %s' % (required, installed))
 
     except OSError:
-        raise RuntimeError('PhantomJS is not present in PATH. Try "conda install phantomjs" or \
+        raise RuntimeError('PhantomJS is not present in PATH or BOKEH_PHANTOMJS_PATH. Try "conda install phantomjs" or \
             "npm install -g phantomjs-prebuilt"')
 
     return phantomjs_path


Test patch:
Repository: bokeh/bokeh

Issue:
plotting/file/image_url.py doesn't work without setting {x,y}_range
Fails with "could not set initial ranges" from `common/plot.coffee`.



Discussion:
Still an issue in `0.12.15` noting example is in `models/file` now and code must be updated to use `DataRange1d`

Resolving patch:
diff --git a/examples/models/file/image_url.py b/examples/models/file/image_url.py
--- a/examples/models/file/image_url.py
+++ b/examples/models/file/image_url.py
@@ -4,7 +4,7 @@
 from bokeh.document import Document
 from bokeh.embed import file_html
 from bokeh.models.glyphs import ImageURL
-from bokeh.models import ColumnDataSource, Range1d, Plot, LinearAxis, Grid
+from bokeh.models import ColumnDataSource, Plot, LinearAxis, Grid
 from bokeh.resources import INLINE
 
 url = "https://bokeh.pydata.org/en/latest/_static/images/logo.png"
@@ -20,17 +20,14 @@
     y2  = np.linspace(  0, 200, N),
 ))
 
-xdr = Range1d(start=-100, end=200)
-ydr = Range1d(start=-100, end=200)
-
-plot = Plot(x_range=xdr, y_range=ydr)
+plot = Plot()
 plot.title.text = "ImageURL"
 plot.toolbar_location = None
 
 image1 = ImageURL(url="url", x="x1", y="y1", w="w1", h="h1", anchor="center", global_alpha=0.2)
 plot.add_glyph(source, image1)
 
-image2 = ImageURL(url="url", x="x2", y="y2", w=20, h=20, anchor="top_left")
+image2 = ImageURL(url="url", x="x2", y="y2", w=20, h=20, anchor="top_left", w_units="screen", h_units="screen")
 plot.add_glyph(source, image2)
 
 image3 = ImageURL(url=dict(value=url), x=200, y=-100, anchor="bottom_right")


Test patch:
Repository: bokeh/bokeh

Issue:
[Document] Add (or update) an example to demonstrate  converting node/edge attributes in from_networkx 
Add (or update) an example to demonstrate  converting node/edge attributes in `from_networkx`.

**Related an issue/PR:**
* Issue #8183
* PR #8210

I think that it is easier to understand that node / edge attributes are being converted in `from_networkx` by adding an example that displays node hover information at the end of this page.
**Visualizing Network Graphs**
https://bokeh.pydata.org/en/latest/docs/user_guide/graph.html

# Draft
The example draft to be added is as follows.
http://nbviewer.jupyter.org/github/komo-fr/networkx2bokeh_note/blob/master/notebooks/graph_example_hovering_node_attributes.ipynb

If there is not particularly big problem with this content, I will send a PR.


Discussion:
@komo-fr That looks like a nice example, would be glad to accept a PR to add it. 
It would also be very helpful if the procedure for accessing edge attributes / labelling them was more clearly documented

Resolving patch:
diff --git a/sphinx/source/docs/user_guide/examples/graph_node_and_edge_attributes.py b/sphinx/source/docs/user_guide/examples/graph_node_and_edge_attributes.py
new file mode 100644
--- /dev/null
+++ b/sphinx/source/docs/user_guide/examples/graph_node_and_edge_attributes.py
@@ -0,0 +1,35 @@
+import networkx as nx
+
+from bokeh.io import show, output_file
+from bokeh.models import Plot, Range1d, MultiLine, Circle, HoverTool, BoxZoomTool, ResetTool
+from bokeh.models.graphs import from_networkx
+from bokeh.palettes import Spectral4
+
+# Prepare Data
+G = nx.karate_club_graph()
+
+SAME_CLUB_COLOR, DIFFERENT_CLUB_COLOR = "black", "red"
+edge_attrs = {}
+
+for start_node, end_node, _ in G.edges(data=True):
+    edge_color = SAME_CLUB_COLOR if G.nodes[start_node]["club"] == G.nodes[end_node]["club"] else DIFFERENT_CLUB_COLOR
+    edge_attrs[(start_node, end_node)] = edge_color
+
+nx.set_edge_attributes(G, edge_attrs, "edge_color")
+
+# Show with Bokeh
+plot = Plot(plot_width=400, plot_height=400,
+            x_range=Range1d(-1.1, 1.1), y_range=Range1d(-1.1, 1.1))
+plot.title.text = "Graph Interaction Demonstration"
+
+node_hover_tool = HoverTool(tooltips=[("index", "@index"), ("club", "@club")])
+plot.add_tools(node_hover_tool, BoxZoomTool(), ResetTool())
+
+graph_renderer = from_networkx(G, nx.spring_layout, scale=1, center=(0, 0))
+
+graph_renderer.node_renderer.glyph = Circle(size=15, fill_color=Spectral4[0])
+graph_renderer.edge_renderer.glyph = MultiLine(line_color="edge_color", line_alpha=0.8, line_width=1)
+plot.renderers.append(graph_renderer)
+
+output_file("interactive_graphs.html")
+show(plot)


Test patch:
Repository: bokeh/bokeh

Issue:
FixedTicker does not accept minor ticks
This is a feature request. 

The current default implementation of FixedTicker ignores minor ticks, so is only able to accept a list of values that correspond to major tick locations. The desire to have minor ticks stems from enhancing FixedTicker into a more flexible custom ticker, particularly in the realm of custom axes transformations, where it is helpful to use a combination of major/minor ticks along with label overrides to visually observe the non-intuitive effects of the dimension transform. 

Because FixedTicker is based off of ContinuousTicker, the option to handle minor ticks is already mostly there. I couldn't see a strong reason not to enable the minor_ticks option. Hence, laying out the thought process here for a PR.

### Existing behavior
To stay backwards compatible, users should still be able to call FixedTicker one of two ways: 

Shorthand way ([simply calls FixedTicker](https://github.com/bokeh/bokeh/blob/13baccbb2835f7d5831c22b5cf68214e89c02618/bokeh/models/axes.py#L63))
```
p.axis.ticker = [0, 5, 10]
```
Long way
```
p.axis.ticker = FixedTicker(ticks=[0, 5, 10])
```

### Requested behavior

```
p.axis.ticker = FixedTicker(ticks=[0, 5, 10], minor_ticks=[1,2,3,4, 6,7,8,9])

#by default, minor_ticks=[] would not have to be specified
```
the choice of `minor_ticks` as the attribute spelling follows the javascript side convention, as used on the [bokehjs side, here](https://github.com/bokeh/bokeh/blob/f9a4013a3640da3c73fc49ed906f6d202a30a489/bokehjs/src/lib/models/tickers/continuous_ticker.ts#L80)
however, in the bokeh folder, the tickers do not specify "minor_ticks" as it is relegated for the javascript side to handle, but for completeness sake, need to doublecheck whether this would be a different convention as "minor_ticks" is used elsewhere on the [python side, here](https://github.com/bokeh/bokeh/blob/99632902efdfe628809ee02b8fc1abd829c280b7/bokeh/plotting/helpers.py#L475)


Discussion:

Resolving patch:
diff --git a/bokeh/models/tickers.py b/bokeh/models/tickers.py
--- a/bokeh/models/tickers.py
+++ b/bokeh/models/tickers.py
@@ -47,7 +47,11 @@ class FixedTicker(ContinuousTicker):
     '''
 
     ticks = Seq(Float, default=[], help="""
-    List of tick locations.
+    List of major tick locations.
+    """)
+
+    minor_ticks = Seq(Float, default=[], help="""
+    List of minor tick locations.
     """)
 
 class AdaptiveTicker(ContinuousTicker):


Test patch:
Repository: bokeh/bokeh

Issue:
A tiny typo in the document about GraphRenderer
I found a tiny typo in the document about `GraphRenderer` while working on other PRs.

**attr y_range_name**
https://bokeh.pydata.org/en/latest/docs/reference/models/renderers.html#bokeh.models.renderers.GraphRenderer.y_range_name
> A particular (named) y-range to use for computing screen locations when rendering graphs on the plot. If unset, use the default -range.

It seems that it is '"y-range", not "-range”.

I think that this line is to be modified.
If there is not problem, I will send a PR.
https://github.com/bokeh/bokeh/blob/a01ae6ecb6726cb97ae1997e57d62f0cdf6adacc/bokeh/models/renderers.py#L205-L206



Discussion:
@komo-fr absolutely, also I would say for small changes like this it's also fine to just submit a PR directly. We have a preference for separate issue+PR in most cases, but we can also accommodate combined "issue PRs" and for very small things it should reduce the burden on contributors. 

Thanks for your attention and contributions!

Resolving patch:
diff --git a/bokeh/models/renderers.py b/bokeh/models/renderers.py
--- a/bokeh/models/renderers.py
+++ b/bokeh/models/renderers.py
@@ -132,7 +132,7 @@ def __init__(self, **kw):
     y_range_name = String('default', help="""
     A particular (named) y-range to use for computing screen
     locations when rendering glyphs on the plot. If unset, use the
-    default -range.
+    default y-range.
     """)
 
     glyph = Instance(Glyph, help="""
@@ -203,7 +203,7 @@ def _check_malformed_graph_source(self):
     y_range_name = String('default', help="""
     A particular (named) y-range to use for computing screen
     locations when rendering graphs on the plot. If unset, use the
-    default -range.
+    default y-range.
     """)
 
     layout_provider = Instance(LayoutProvider, help="""


Test patch: