prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Customize warning formatter
  I'm trying out the imminent bokeh release with the dask dashboard.  I get hundreds of lines like the following:
  
  ```python
  /home/mrocklin/Software/anaconda/lib/python3.6/site-packages/bokeh/models/sources.py:91: BokehUserWarning: ColumnD)
    "Current lengths: %s" % ", ".join(sorted(str((k, len(v))) for k, v in data.items())), BokehUserWarning))
  ```
  
  Clearly I'm doing something wrong in my code, and it's great to know about it.  However, two things would make this nicer:
  
  1.  Getting some sort of information about the cause of the failure.  It looks like an informative error message was attempted, but rather than getting a nice result I get the code instead.
  2.  These are filling up my terminal at the rate that I update my plots.  It might be nice to only warn once or twice.
  
  </issue>
  <code>
  [start of bokeh/__init__.py]
  1 #-----------------------------------------------------------------------------
  2 # Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
  3 #
  4 # Powered by the Bokeh Development Team.
  5 #
  6 # The full license is in the file LICENSE.txt, distributed with this software.
  7 #-----------------------------------------------------------------------------
  8 ''' Bokeh is a Python interactive visualization library that targets modern
  9 web browsers for presentation.
  10 
  11 Its goal is to provide elegant, concise construction of versatile graphics,
  12 and also deliver this capability with high-performance interactivity over large
  13 or streaming datasets. Bokeh can help anyone who would like to quickly and
  14 easily create interactive plots, dashboards, and data applications.
  15 
  16 For full documentation, please visit: https://bokeh.pydata.org
  17 
  18 '''
  19 
  20 #-----------------------------------------------------------------------------
  21 # Boilerplate
  22 #-----------------------------------------------------------------------------
  23 from __future__ import absolute_import, division, print_function, unicode_literals
  24 
  25 import logging
  26 log = logging.getLogger(__name__)
  27 
  28 #-----------------------------------------------------------------------------
  29 # General API
  30 #-----------------------------------------------------------------------------
  31 
  32 __all__ = (
  33     '__version__',
  34     'license',
  35     'sampledata',
  36 )
  37 
  38 # configure Bokeh version
  39 from .util.version import __version__; __version__
  40 
  41 def license():
  42     ''' Print the Bokeh license to the console.
  43 
  44     Returns:
  45         None
  46 
  47     '''
  48     from os.path import join
  49     with open(join(__path__[0], 'LICENSE.txt')) as lic:
  50         print(lic.read())
  51 
  52 # expose sample data module
  53 from . import sampledata; sampledata
  54 
  55 #-----------------------------------------------------------------------------
  56 # Code
  57 #-----------------------------------------------------------------------------
  58 
  59 # configure Bokeh logger
  60 from .util import logconfig
  61 del logconfig
  62 
  63 # Configure warnings to always show, despite Python's active efforts to hide them from users.
  64 import warnings
  65 from .util.warnings import BokehDeprecationWarning, BokehUserWarning
  66 warnings.simplefilter('always', BokehDeprecationWarning)
  67 warnings.simplefilter('always', BokehUserWarning)
  68 del BokehDeprecationWarning, BokehUserWarning
  69 del warnings
  70
  [end of bokeh/__init__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/bokeh/__init__.py b/bokeh/__init__.py
  --- a/bokeh/__init__.py
  +++ b/bokeh/__init__.py
  @@ -60,10 +60,21 @@
   from .util import logconfig
   del logconfig
   
  -# Configure warnings to always show, despite Python's active efforts to hide them from users.
  +# Configure warnings to always show nice mssages, despite Python's active
  +# efforts to hide them from users.
   import warnings
   from .util.warnings import BokehDeprecationWarning, BokehUserWarning
   warnings.simplefilter('always', BokehDeprecationWarning)
   warnings.simplefilter('always', BokehUserWarning)
  +
  +original_formatwarning = warnings.formatwarning
  +def _formatwarning(message, category, filename, lineno, line=None):
  +    from .util.warnings import BokehDeprecationWarning, BokehUserWarning
  +    if category not in (BokehDeprecationWarning, BokehUserWarning):
  +        return original_formatwarning(message, category, filename, lineno, line)
  +    return "%s: %s\n" % (category.__name__, message)
  +warnings.formatwarning = _formatwarning
  +
  +del _formatwarning
   del BokehDeprecationWarning, BokehUserWarning
   del warnings
  
verification_info: {"golden_diff": "diff --git a/bokeh/__init__.py b/bokeh/__init__.py\n--- a/bokeh/__init__.py\n+++ b/bokeh/__init__.py\n@@ -60,10 +60,21 @@\n from .util import logconfig\n del logconfig\n \n-# Configure warnings to always show, despite Python's active efforts to hide them from users.\n+# Configure warnings to always show nice mssages, despite Python's active\n+# efforts to hide them from users.\n import warnings\n from .util.warnings import BokehDeprecationWarning, BokehUserWarning\n warnings.simplefilter('always', BokehDeprecationWarning)\n warnings.simplefilter('always', BokehUserWarning)\n+\n+original_formatwarning = warnings.formatwarning\n+def _formatwarning(message, category, filename, lineno, line=None):\n+    from .util.warnings import BokehDeprecationWarning, BokehUserWarning\n+    if category not in (BokehDeprecationWarning, BokehUserWarning):\n+        return original_formatwarning(message, category, filename, lineno, line)\n+    return \"%s: %s\\n\" % (category.__name__, message)\n+warnings.formatwarning = _formatwarning\n+\n+del _formatwarning\n del BokehDeprecationWarning, BokehUserWarning\n del warnings\n", "issue": "Customize warning formatter\nI'm trying out the imminent bokeh release with the dask dashboard.  I get hundreds of lines like the following:\r\n\r\n```python\r\n/home/mrocklin/Software/anaconda/lib/python3.6/site-packages/bokeh/models/sources.py:91: BokehUserWarning: ColumnD)\r\n  \"Current lengths: %s\" % \", \".join(sorted(str((k, len(v))) for k, v in data.items())), BokehUserWarning))\r\n```\r\n\r\nClearly I'm doing something wrong in my code, and it's great to know about it.  However, two things would make this nicer:\r\n\r\n1.  Getting some sort of information about the cause of the failure.  It looks like an informative error message was attempted, but rather than getting a nice result I get the code instead.\r\n2.  These are filling up my terminal at the rate that I update my plots.  It might be nice to only warn once or twice.\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.\n#\n# Powered by the Bokeh Development Team.\n#\n# The full license is in the file LICENSE.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n''' Bokeh is a Python interactive visualization library that targets modern\nweb browsers for presentation.\n\nIts goal is to provide elegant, concise construction of versatile graphics,\nand also deliver this capability with high-performance interactivity over large\nor streaming datasets. Bokeh can help anyone who would like to quickly and\neasily create interactive plots, dashboards, and data applications.\n\nFor full documentation, please visit: https://bokeh.pydata.org\n\n'''\n\n#-----------------------------------------------------------------------------\n# Boilerplate\n#-----------------------------------------------------------------------------\nfrom __future__ import absolute_import, division, print_function, unicode_literals\n\nimport logging\nlog = logging.getLogger(__name__)\n\n#-----------------------------------------------------------------------------\n# General API\n#-----------------------------------------------------------------------------\n\n__all__ = (\n    '__version__',\n    'license',\n    'sampledata',\n)\n\n# configure Bokeh version\nfrom .util.version import __version__; __version__\n\ndef license():\n    ''' Print the Bokeh license to the console.\n\n    Returns:\n        None\n\n    '''\n    from os.path import join\n    with open(join(__path__[0], 'LICENSE.txt')) as lic:\n        print(lic.read())\n\n# expose sample data module\nfrom . import sampledata; sampledata\n\n#-----------------------------------------------------------------------------\n# Code\n#-----------------------------------------------------------------------------\n\n# configure Bokeh logger\nfrom .util import logconfig\ndel logconfig\n\n# Configure warnings to always show, despite Python's active efforts to hide them from users.\nimport warnings\nfrom .util.warnings import BokehDeprecationWarning, BokehUserWarning\nwarnings.simplefilter('always', BokehDeprecationWarning)\nwarnings.simplefilter('always', BokehUserWarning)\ndel BokehDeprecationWarning, BokehUserWarning\ndel warnings\n", "path": "bokeh/__init__.py"}]}