We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
syntax error in util/deprecation.py
line 24:
    message += " " + extra.trim()
results in error: AttributeError: 'str' object has no attribute 'trim'

it should be instead:
    message += " " + extra.strip()

that fixes the problem.  I needed that change to get the happiness demo to run

Helmut Strey


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `bokeh/util/deprecation.py`
Content:
```
1 import six
2 import warnings
3 
4 class BokehDeprecationWarning(DeprecationWarning):
5     """ A specific ``DeprecationWarning`` subclass for Bokeh deprecations.
6     Used to selectively filter Bokeh deprecations for unconditional display.
7 
8     """
9 
10 def warn(message, stacklevel=2):
11     warnings.warn(message, BokehDeprecationWarning, stacklevel=stacklevel)
12 
13 def deprecated(since_or_msg, old=None, new=None, extra=None):
14     """ Issue a nicely formatted deprecation warning. """
15 
16     if isinstance(since_or_msg, tuple):
17         if old is None or new is None:
18             raise ValueError("deprecated entity and a replacement are required")
19 
20         since = "%d.%d.%d" % since_or_msg
21         message = "%(old)s was deprecated in Bokeh %(since)s and will be removed, use %(new)s instead."
22         message = message % dict(old=old, since=since, new=new)
23         if extra is not None:
24             message += " " + extra.trim()
25     elif isinstance(since_or_msg, six.string_types):
26         if not (old is None and new is None and extra is None):
27             raise ValueError("deprecated(message) signature doesn't allow extra arguments")
28 
29         message = since_or_msg
30     else:
31         raise ValueError("expected a version tuple or string message")
32 
33     warn(message)
34
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/bokeh/util/deprecation.py b/bokeh/util/deprecation.py
--- a/bokeh/util/deprecation.py
+++ b/bokeh/util/deprecation.py
@@ -17,11 +17,14 @@
         if old is None or new is None:
             raise ValueError("deprecated entity and a replacement are required")
 
+        if len(since_or_msg) != 3 or not all(isinstance(x, int) and x >=0 for x in since_or_msg):
+            raise ValueError("invalid version tuple: %r" % (since_or_msg,))
+
         since = "%d.%d.%d" % since_or_msg
         message = "%(old)s was deprecated in Bokeh %(since)s and will be removed, use %(new)s instead."
         message = message % dict(old=old, since=since, new=new)
         if extra is not None:
-            message += " " + extra.trim()
+            message += " " + extra.strip()
     elif isinstance(since_or_msg, six.string_types):
         if not (old is None and new is None and extra is None):
             raise ValueError("deprecated(message) signature doesn't allow extra arguments")

{"golden_diff": "diff --git a/bokeh/util/deprecation.py b/bokeh/util/deprecation.py\n--- a/bokeh/util/deprecation.py\n+++ b/bokeh/util/deprecation.py\n@@ -17,11 +17,14 @@\n         if old is None or new is None:\n             raise ValueError(\"deprecated entity and a replacement are required\")\n \n+        if len(since_or_msg) != 3 or not all(isinstance(x, int) and x >=0 for x in since_or_msg):\n+            raise ValueError(\"invalid version tuple: %r\" % (since_or_msg,))\n+\n         since = \"%d.%d.%d\" % since_or_msg\n         message = \"%(old)s was deprecated in Bokeh %(since)s and will be removed, use %(new)s instead.\"\n         message = message % dict(old=old, since=since, new=new)\n         if extra is not None:\n-            message += \" \" + extra.trim()\n+            message += \" \" + extra.strip()\n     elif isinstance(since_or_msg, six.string_types):\n         if not (old is None and new is None and extra is None):\n             raise ValueError(\"deprecated(message) signature doesn't allow extra arguments\")\n", "issue": "syntax error in util/deprecation.py\nline 24:\n    message += \" \" + extra.trim()\nresults in error: AttributeError: 'str' object has no attribute 'trim'\n\nit should be instead:\n    message += \" \" + extra.strip()\n\nthat fixes the problem.  I needed that change to get the happiness demo to run\n\nHelmut Strey\n\n", "before_files": [{"content": "import six\nimport warnings\n\nclass BokehDeprecationWarning(DeprecationWarning):\n    \"\"\" A specific ``DeprecationWarning`` subclass for Bokeh deprecations.\n    Used to selectively filter Bokeh deprecations for unconditional display.\n\n    \"\"\"\n\ndef warn(message, stacklevel=2):\n    warnings.warn(message, BokehDeprecationWarning, stacklevel=stacklevel)\n\ndef deprecated(since_or_msg, old=None, new=None, extra=None):\n    \"\"\" Issue a nicely formatted deprecation warning. \"\"\"\n\n    if isinstance(since_or_msg, tuple):\n        if old is None or new is None:\n            raise ValueError(\"deprecated entity and a replacement are required\")\n\n        since = \"%d.%d.%d\" % since_or_msg\n        message = \"%(old)s was deprecated in Bokeh %(since)s and will be removed, use %(new)s instead.\"\n        message = message % dict(old=old, since=since, new=new)\n        if extra is not None:\n            message += \" \" + extra.trim()\n    elif isinstance(since_or_msg, six.string_types):\n        if not (old is None and new is None and extra is None):\n            raise ValueError(\"deprecated(message) signature doesn't allow extra arguments\")\n\n        message = since_or_msg\n    else:\n        raise ValueError(\"expected a version tuple or string message\")\n\n    warn(message)\n", "path": "bokeh/util/deprecation.py"}], "after_files": [{"content": "import six\nimport warnings\n\nclass BokehDeprecationWarning(DeprecationWarning):\n    \"\"\" A specific ``DeprecationWarning`` subclass for Bokeh deprecations.\n    Used to selectively filter Bokeh deprecations for unconditional display.\n\n    \"\"\"\n\ndef warn(message, stacklevel=2):\n    warnings.warn(message, BokehDeprecationWarning, stacklevel=stacklevel)\n\ndef deprecated(since_or_msg, old=None, new=None, extra=None):\n    \"\"\" Issue a nicely formatted deprecation warning. \"\"\"\n\n    if isinstance(since_or_msg, tuple):\n        if old is None or new is None:\n            raise ValueError(\"deprecated entity and a replacement are required\")\n\n        if len(since_or_msg) != 3 or not all(isinstance(x, int) and x >=0 for x in since_or_msg):\n            raise ValueError(\"invalid version tuple: %r\" % (since_or_msg,))\n\n        since = \"%d.%d.%d\" % since_or_msg\n        message = \"%(old)s was deprecated in Bokeh %(since)s and will be removed, use %(new)s instead.\"\n        message = message % dict(old=old, since=since, new=new)\n        if extra is not None:\n            message += \" \" + extra.strip()\n    elif isinstance(since_or_msg, six.string_types):\n        if not (old is None and new is None and extra is None):\n            raise ValueError(\"deprecated(message) signature doesn't allow extra arguments\")\n\n        message = since_or_msg\n    else:\n        raise ValueError(\"expected a version tuple or string message\")\n\n    warn(message)\n", "path": "bokeh/util/deprecation.py"}]}