We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Broken image link in Django user guide
The link https://panel.pyviz.org/apps/django2/sliders.png in https://panel.pyviz.org/user_guide/Django_Apps.html doesn't seem to go anywhere; was that meant to point to https://parambokeh.pyviz.org/assets/sliders.png ?
Broken image link in Django user guide
The link https://panel.pyviz.org/apps/django2/sliders.png in https://panel.pyviz.org/user_guide/Django_Apps.html doesn't seem to go anywhere; was that meant to point to https://parambokeh.pyviz.org/assets/sliders.png ?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `panel/util.py`
Content:
```
1 """
2 Various general utilities used in the panel codebase.
3 """
4 from __future__ import absolute_import, division, unicode_literals
5 
6 import re
7 import sys
8 import inspect
9 import numbers
10 import datetime as dt
11 
12 from datetime import datetime
13 from six import string_types
14 from collections import defaultdict, OrderedDict
15 try:
16     from collections.abc import MutableSequence, MutableMapping
17 except ImportError:  # support for python>3.8
18     from collections import MutableSequence, MutableMapping
19 
20 import param
21 import numpy as np
22 
23 datetime_types = (np.datetime64, dt.datetime, dt.date)
24 
25 if sys.version_info.major > 2:
26     unicode = str
27 
28 
29 def hashable(x):
30     if isinstance(x, MutableSequence):
31         return tuple(x)
32     elif isinstance(x, MutableMapping):
33         return tuple([(k,v) for k,v in x.items()])
34     else:
35         return x
36 
37 
38 def isIn(obj, objs):
39     """
40     Checks if the object is in the list of objects safely.
41     """
42     for o in objs:
43         if o is obj:
44             return True
45         try:
46             if o == obj:
47                 return True
48         except:
49             pass
50     return False
51 
52 
53 def indexOf(obj, objs):
54     """
55     Returns the index of an object in a list of objects. Unlike the
56     list.index method this function only checks for identity not
57     equality.
58     """
59     for i, o in enumerate(objs):
60         if o is obj:
61             return i
62         try:
63             if o == obj:
64                 return i
65         except:
66             pass
67     raise ValueError('%s not in list' % obj)
68 
69 
70 def as_unicode(obj):
71     """
72     Safely casts any object to unicode including regular string
73     (i.e. bytes) types in python 2.
74     """
75     if sys.version_info.major < 3 and isinstance(obj, str):
76         obj = obj.decode('utf-8')
77     return unicode(obj)
78 
79 
80 def param_name(name):
81     """
82     Removes the integer id from a Parameterized class name.
83     """
84     match = re.match(r'(.)+(\d){5}', name)
85     return name[:-5] if match else name
86 
87 
88 def unicode_repr(obj):
89     """
90     Returns a repr without the unicode prefix.
91     """
92     if sys.version_info.major == 2 and isinstance(obj, unicode):
93         return repr(obj)[1:]
94     return repr(obj)
95 
96 
97 def abbreviated_repr(value, max_length=25, natural_breaks=(',', ' ')):
98     """
99     Returns an abbreviated repr for the supplied object. Attempts to
100     find a natural break point while adhering to the maximum length.
101     """
102     vrepr = repr(value)
103     if len(vrepr) > max_length:
104         # Attempt to find natural cutoff point
105         abbrev = vrepr[max_length//2:]
106         natural_break = None
107         for brk in natural_breaks:
108             if brk in abbrev:
109                 natural_break = abbrev.index(brk) + max_length//2
110                 break
111         if natural_break and natural_break < max_length:
112             max_length = natural_break + 1
113 
114         end_char = ''
115         if isinstance(value, list):
116             end_char = ']'
117         elif isinstance(value, OrderedDict):
118             end_char = '])'
119         elif isinstance(value, (dict, set)):
120             end_char = '}'
121         return vrepr[:max_length+1] + '...' + end_char
122     return vrepr
123 
124 
125 def param_reprs(parameterized, skip=None):
126     """
127     Returns a list of reprs for parameters on the parameterized object.
128     Skips default and empty values.
129     """
130     cls = type(parameterized).__name__
131     param_reprs = []
132     for p, v in sorted(parameterized.get_param_values()):
133         if v is parameterized.param[p].default: continue
134         elif v is None: continue
135         elif isinstance(v, string_types) and v == '': continue
136         elif isinstance(v, list) and v == []: continue
137         elif isinstance(v, dict) and v == {}: continue
138         elif (skip and p in skip) or (p == 'name' and v.startswith(cls)): continue
139         param_reprs.append('%s=%s' % (p, abbreviated_repr(v)))
140     return param_reprs
141 
142 
143 def full_groupby(l, key=lambda x: x):
144     """
145     Groupby implementation which does not require a prior sort
146     """
147     d = defaultdict(list)
148     for item in l:
149         d[key(item)].append(item)
150     return d.items()
151 
152 
153 def get_method_owner(meth):
154     """
155     Returns the instance owning the supplied instancemethod or
156     the class owning the supplied classmethod.
157     """
158     if inspect.ismethod(meth):
159         if sys.version_info < (3,0):
160             return meth.im_class if meth.im_self is None else meth.im_self
161         else:
162             return meth.__self__
163 
164 
165 def is_parameterized(obj):
166     """
167     Whether an object is a Parameterized class or instance.
168     """
169     return (isinstance(obj, param.Parameterized) or
170             (isinstance(obj, type) and issubclass(obj, param.Parameterized)))
171 
172 
173 def isdatetime(value):
174     """
175     Whether the array or scalar is recognized datetime type.
176     """
177     if isinstance(value, np.ndarray):
178         return (value.dtype.kind == "M" or
179                 (value.dtype.kind == "O" and len(value) and
180                  isinstance(value[0], datetime_types)))
181     elif isinstance(value, list):
182         return all(isinstance(d, datetime_types) for d in value)
183     else:
184         return isinstance(value, datetime_types)
185 
186 def value_as_datetime(value):
187     """
188     Retrieve the value tuple as a tuple of datetime objects.
189     """
190     if isinstance(value, numbers.Number):
191         value = datetime.utcfromtimestamp(value / 1000)
192     return value
193 
194 
195 def value_as_date(value):
196     if isinstance(value, numbers.Number):
197         value = datetime.utcfromtimestamp(value / 1000).date()
198     elif isinstance(value, datetime):
199         value = value.date()
200     return value
201
```

Path: `doc/conf.py`
Content:
```
1 # -*- coding: utf-8 -*-
2 
3 from nbsite.shared_conf import *
4 
5 project = u'Panel'
6 authors = u'Panel contributors'
7 copyright = u'2019 ' + authors
8 description = 'High-level dashboarding for python visualization libraries'
9 
10 import panel
11 version = release = str(panel.__version__)
12 
13 html_static_path += ['_static']
14 html_theme = 'sphinx_ioam_theme'
15 html_theme_options = {
16     'logo': 'logo_horizontal.png',
17     'favicon': 'favicon.ico',
18     'css': 'site.css'    
19 }
20 
21 extensions += ['nbsite.gallery']
22 
23 nbsite_gallery_conf = {
24     'github_org': 'pyviz',
25     'github_project': 'panel',
26     'galleries': {
27         'gallery': {
28             'title': 'Gallery',
29             'sections': [
30                 {'path': 'demos',
31                  'title': 'Demos',
32                  'description': 'A set of sophisticated apps built to demonstrate the features of Panel.'},
33                 {'path': 'simple',
34                  'title': 'Simple Apps',
35                  'description': 'Simple example apps meant to provide a quick introduction to Panel.'},
36                 {'path': 'apis',
37                  'title': 'APIs',
38                  'description': ('Examples meant to demonstrate the usage of different Panel APIs '
39                                  'such as interact and reactive functions.')},
40                 {'path': 'layout',
41                  'title': 'Layouts',
42                  'description': 'How to leverage Panel layout components to achieve complex layouts.'},
43                 {'path': 'dynamic',
44                  'title': 'Dynamic UIs',
45                  'description': ('Examples demonstrating how to build dynamic UIs with components that'
46                                  'are added or removed interactively.')},
47                 {'path': 'param',
48                  'title': 'Param based apps',
49                  'description': 'Using the Param library to express UIs independently of Panel.'},
50                 {'path': 'links',
51                  'title': 'Linking',
52                  'description': ('Using Javascript based links to define interactivity without '
53                                  'without requiring a live kernel.')},
54                 {'path': 'external',
55                  'title': 'External libraries',
56                  'description': 'Wrapping external libraries with Panel.'}
57             ]
58         },
59         'reference': {
60             'title': 'Reference Gallery',
61             'sections': [
62                 'panes',
63                 'layouts',
64                 'widgets'
65             ]
66         }
67     },
68     'thumbnail_url': 'https://assets.holoviews.org/panel/thumbnails',
69     'deployment_url': 'https://panel-gallery.pyviz.demo.anaconda.com/'
70 }
71 
72 _NAV =  (
73     ('Getting started', 'getting_started/index'),
74     ('User Guide', 'user_guide/index'),
75     ('Gallery', 'gallery/index'),
76     ('Reference Gallery', 'reference/index'),
77     ('Developer Guide', 'developer_guide/index'),
78     ('FAQ', 'FAQ'),
79     ('About', 'about')
80 )
81 
82 templates_path = ['_templates']
83 
84 html_context.update({
85     'PROJECT': project,
86     'DESCRIPTION': description,
87     'AUTHOR': authors,
88     'VERSION': version,
89     'WEBSITE_URL': 'https://panel.pyviz.org',
90     'WEBSITE_SERVER': 'https://panel.pyviz.org',
91     'VERSION': version,
92     'NAV': _NAV,
93     'LINKS': _NAV,
94     'SOCIAL': (
95         ('Gitter', '//gitter.im/pyviz/pyviz'),
96         ('Github', '//github.com/pyviz/panel'),
97     )
98 })
99 
100 nbbuild_patterns_to_take_along = ["simple.html"]
101
```
--- 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/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -69,7 +69,7 @@
     'deployment_url': 'https://panel-gallery.pyviz.demo.anaconda.com/'
 }
 
-_NAV =  (
+_NAV = (
     ('Getting started', 'getting_started/index'),
     ('User Guide', 'user_guide/index'),
     ('Gallery', 'gallery/index'),
@@ -88,7 +88,6 @@
     'VERSION': version,
     'WEBSITE_URL': 'https://panel.pyviz.org',
     'WEBSITE_SERVER': 'https://panel.pyviz.org',
-    'VERSION': version,
     'NAV': _NAV,
     'LINKS': _NAV,
     'SOCIAL': (
diff --git a/panel/util.py b/panel/util.py
--- a/panel/util.py
+++ b/panel/util.py
@@ -12,9 +12,9 @@
 from datetime import datetime
 from six import string_types
 from collections import defaultdict, OrderedDict
-try:
+try:  # python >= 3.3
     from collections.abc import MutableSequence, MutableMapping
-except ImportError:  # support for python>3.8
+except ImportError:
     from collections import MutableSequence, MutableMapping
 
 import param

{"golden_diff": "diff --git a/doc/conf.py b/doc/conf.py\n--- a/doc/conf.py\n+++ b/doc/conf.py\n@@ -69,7 +69,7 @@\n     'deployment_url': 'https://panel-gallery.pyviz.demo.anaconda.com/'\n }\n \n-_NAV =  (\n+_NAV = (\n     ('Getting started', 'getting_started/index'),\n     ('User Guide', 'user_guide/index'),\n     ('Gallery', 'gallery/index'),\n@@ -88,7 +88,6 @@\n     'VERSION': version,\n     'WEBSITE_URL': 'https://panel.pyviz.org',\n     'WEBSITE_SERVER': 'https://panel.pyviz.org',\n-    'VERSION': version,\n     'NAV': _NAV,\n     'LINKS': _NAV,\n     'SOCIAL': (\ndiff --git a/panel/util.py b/panel/util.py\n--- a/panel/util.py\n+++ b/panel/util.py\n@@ -12,9 +12,9 @@\n from datetime import datetime\n from six import string_types\n from collections import defaultdict, OrderedDict\n-try:\n+try:  # python >= 3.3\n     from collections.abc import MutableSequence, MutableMapping\n-except ImportError:  # support for python>3.8\n+except ImportError:\n     from collections import MutableSequence, MutableMapping\n \n import param\n", "issue": "Broken image link in Django user guide\nThe link https://panel.pyviz.org/apps/django2/sliders.png in https://panel.pyviz.org/user_guide/Django_Apps.html doesn't seem to go anywhere; was that meant to point to https://parambokeh.pyviz.org/assets/sliders.png ?\nBroken image link in Django user guide\nThe link https://panel.pyviz.org/apps/django2/sliders.png in https://panel.pyviz.org/user_guide/Django_Apps.html doesn't seem to go anywhere; was that meant to point to https://parambokeh.pyviz.org/assets/sliders.png ?\n", "before_files": [{"content": "\"\"\"\nVarious general utilities used in the panel codebase.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n\nimport re\nimport sys\nimport inspect\nimport numbers\nimport datetime as dt\n\nfrom datetime import datetime\nfrom six import string_types\nfrom collections import defaultdict, OrderedDict\ntry:\n    from collections.abc import MutableSequence, MutableMapping\nexcept ImportError:  # support for python>3.8\n    from collections import MutableSequence, MutableMapping\n\nimport param\nimport numpy as np\n\ndatetime_types = (np.datetime64, dt.datetime, dt.date)\n\nif sys.version_info.major > 2:\n    unicode = str\n\n\ndef hashable(x):\n    if isinstance(x, MutableSequence):\n        return tuple(x)\n    elif isinstance(x, MutableMapping):\n        return tuple([(k,v) for k,v in x.items()])\n    else:\n        return x\n\n\ndef isIn(obj, objs):\n    \"\"\"\n    Checks if the object is in the list of objects safely.\n    \"\"\"\n    for o in objs:\n        if o is obj:\n            return True\n        try:\n            if o == obj:\n                return True\n        except:\n            pass\n    return False\n\n\ndef indexOf(obj, objs):\n    \"\"\"\n    Returns the index of an object in a list of objects. Unlike the\n    list.index method this function only checks for identity not\n    equality.\n    \"\"\"\n    for i, o in enumerate(objs):\n        if o is obj:\n            return i\n        try:\n            if o == obj:\n                return i\n        except:\n            pass\n    raise ValueError('%s not in list' % obj)\n\n\ndef as_unicode(obj):\n    \"\"\"\n    Safely casts any object to unicode including regular string\n    (i.e. bytes) types in python 2.\n    \"\"\"\n    if sys.version_info.major < 3 and isinstance(obj, str):\n        obj = obj.decode('utf-8')\n    return unicode(obj)\n\n\ndef param_name(name):\n    \"\"\"\n    Removes the integer id from a Parameterized class name.\n    \"\"\"\n    match = re.match(r'(.)+(\\d){5}', name)\n    return name[:-5] if match else name\n\n\ndef unicode_repr(obj):\n    \"\"\"\n    Returns a repr without the unicode prefix.\n    \"\"\"\n    if sys.version_info.major == 2 and isinstance(obj, unicode):\n        return repr(obj)[1:]\n    return repr(obj)\n\n\ndef abbreviated_repr(value, max_length=25, natural_breaks=(',', ' ')):\n    \"\"\"\n    Returns an abbreviated repr for the supplied object. Attempts to\n    find a natural break point while adhering to the maximum length.\n    \"\"\"\n    vrepr = repr(value)\n    if len(vrepr) > max_length:\n        # Attempt to find natural cutoff point\n        abbrev = vrepr[max_length//2:]\n        natural_break = None\n        for brk in natural_breaks:\n            if brk in abbrev:\n                natural_break = abbrev.index(brk) + max_length//2\n                break\n        if natural_break and natural_break < max_length:\n            max_length = natural_break + 1\n\n        end_char = ''\n        if isinstance(value, list):\n            end_char = ']'\n        elif isinstance(value, OrderedDict):\n            end_char = '])'\n        elif isinstance(value, (dict, set)):\n            end_char = '}'\n        return vrepr[:max_length+1] + '...' + end_char\n    return vrepr\n\n\ndef param_reprs(parameterized, skip=None):\n    \"\"\"\n    Returns a list of reprs for parameters on the parameterized object.\n    Skips default and empty values.\n    \"\"\"\n    cls = type(parameterized).__name__\n    param_reprs = []\n    for p, v in sorted(parameterized.get_param_values()):\n        if v is parameterized.param[p].default: continue\n        elif v is None: continue\n        elif isinstance(v, string_types) and v == '': continue\n        elif isinstance(v, list) and v == []: continue\n        elif isinstance(v, dict) and v == {}: continue\n        elif (skip and p in skip) or (p == 'name' and v.startswith(cls)): continue\n        param_reprs.append('%s=%s' % (p, abbreviated_repr(v)))\n    return param_reprs\n\n\ndef full_groupby(l, key=lambda x: x):\n    \"\"\"\n    Groupby implementation which does not require a prior sort\n    \"\"\"\n    d = defaultdict(list)\n    for item in l:\n        d[key(item)].append(item)\n    return d.items()\n\n\ndef get_method_owner(meth):\n    \"\"\"\n    Returns the instance owning the supplied instancemethod or\n    the class owning the supplied classmethod.\n    \"\"\"\n    if inspect.ismethod(meth):\n        if sys.version_info < (3,0):\n            return meth.im_class if meth.im_self is None else meth.im_self\n        else:\n            return meth.__self__\n\n\ndef is_parameterized(obj):\n    \"\"\"\n    Whether an object is a Parameterized class or instance.\n    \"\"\"\n    return (isinstance(obj, param.Parameterized) or\n            (isinstance(obj, type) and issubclass(obj, param.Parameterized)))\n\n\ndef isdatetime(value):\n    \"\"\"\n    Whether the array or scalar is recognized datetime type.\n    \"\"\"\n    if isinstance(value, np.ndarray):\n        return (value.dtype.kind == \"M\" or\n                (value.dtype.kind == \"O\" and len(value) and\n                 isinstance(value[0], datetime_types)))\n    elif isinstance(value, list):\n        return all(isinstance(d, datetime_types) for d in value)\n    else:\n        return isinstance(value, datetime_types)\n\ndef value_as_datetime(value):\n    \"\"\"\n    Retrieve the value tuple as a tuple of datetime objects.\n    \"\"\"\n    if isinstance(value, numbers.Number):\n        value = datetime.utcfromtimestamp(value / 1000)\n    return value\n\n\ndef value_as_date(value):\n    if isinstance(value, numbers.Number):\n        value = datetime.utcfromtimestamp(value / 1000).date()\n    elif isinstance(value, datetime):\n        value = value.date()\n    return value\n", "path": "panel/util.py"}, {"content": "# -*- coding: utf-8 -*-\n\nfrom nbsite.shared_conf import *\n\nproject = u'Panel'\nauthors = u'Panel contributors'\ncopyright = u'2019 ' + authors\ndescription = 'High-level dashboarding for python visualization libraries'\n\nimport panel\nversion = release = str(panel.__version__)\n\nhtml_static_path += ['_static']\nhtml_theme = 'sphinx_ioam_theme'\nhtml_theme_options = {\n    'logo': 'logo_horizontal.png',\n    'favicon': 'favicon.ico',\n    'css': 'site.css'    \n}\n\nextensions += ['nbsite.gallery']\n\nnbsite_gallery_conf = {\n    'github_org': 'pyviz',\n    'github_project': 'panel',\n    'galleries': {\n        'gallery': {\n            'title': 'Gallery',\n            'sections': [\n                {'path': 'demos',\n                 'title': 'Demos',\n                 'description': 'A set of sophisticated apps built to demonstrate the features of Panel.'},\n                {'path': 'simple',\n                 'title': 'Simple Apps',\n                 'description': 'Simple example apps meant to provide a quick introduction to Panel.'},\n                {'path': 'apis',\n                 'title': 'APIs',\n                 'description': ('Examples meant to demonstrate the usage of different Panel APIs '\n                                 'such as interact and reactive functions.')},\n                {'path': 'layout',\n                 'title': 'Layouts',\n                 'description': 'How to leverage Panel layout components to achieve complex layouts.'},\n                {'path': 'dynamic',\n                 'title': 'Dynamic UIs',\n                 'description': ('Examples demonstrating how to build dynamic UIs with components that'\n                                 'are added or removed interactively.')},\n                {'path': 'param',\n                 'title': 'Param based apps',\n                 'description': 'Using the Param library to express UIs independently of Panel.'},\n                {'path': 'links',\n                 'title': 'Linking',\n                 'description': ('Using Javascript based links to define interactivity without '\n                                 'without requiring a live kernel.')},\n                {'path': 'external',\n                 'title': 'External libraries',\n                 'description': 'Wrapping external libraries with Panel.'}\n            ]\n        },\n        'reference': {\n            'title': 'Reference Gallery',\n            'sections': [\n                'panes',\n                'layouts',\n                'widgets'\n            ]\n        }\n    },\n    'thumbnail_url': 'https://assets.holoviews.org/panel/thumbnails',\n    'deployment_url': 'https://panel-gallery.pyviz.demo.anaconda.com/'\n}\n\n_NAV =  (\n    ('Getting started', 'getting_started/index'),\n    ('User Guide', 'user_guide/index'),\n    ('Gallery', 'gallery/index'),\n    ('Reference Gallery', 'reference/index'),\n    ('Developer Guide', 'developer_guide/index'),\n    ('FAQ', 'FAQ'),\n    ('About', 'about')\n)\n\ntemplates_path = ['_templates']\n\nhtml_context.update({\n    'PROJECT': project,\n    'DESCRIPTION': description,\n    'AUTHOR': authors,\n    'VERSION': version,\n    'WEBSITE_URL': 'https://panel.pyviz.org',\n    'WEBSITE_SERVER': 'https://panel.pyviz.org',\n    'VERSION': version,\n    'NAV': _NAV,\n    'LINKS': _NAV,\n    'SOCIAL': (\n        ('Gitter', '//gitter.im/pyviz/pyviz'),\n        ('Github', '//github.com/pyviz/panel'),\n    )\n})\n\nnbbuild_patterns_to_take_along = [\"simple.html\"]\n", "path": "doc/conf.py"}], "after_files": [{"content": "\"\"\"\nVarious general utilities used in the panel codebase.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n\nimport re\nimport sys\nimport inspect\nimport numbers\nimport datetime as dt\n\nfrom datetime import datetime\nfrom six import string_types\nfrom collections import defaultdict, OrderedDict\ntry:  # python >= 3.3\n    from collections.abc import MutableSequence, MutableMapping\nexcept ImportError:\n    from collections import MutableSequence, MutableMapping\n\nimport param\nimport numpy as np\n\ndatetime_types = (np.datetime64, dt.datetime, dt.date)\n\nif sys.version_info.major > 2:\n    unicode = str\n\n\ndef hashable(x):\n    if isinstance(x, MutableSequence):\n        return tuple(x)\n    elif isinstance(x, MutableMapping):\n        return tuple([(k,v) for k,v in x.items()])\n    else:\n        return x\n\n\ndef isIn(obj, objs):\n    \"\"\"\n    Checks if the object is in the list of objects safely.\n    \"\"\"\n    for o in objs:\n        if o is obj:\n            return True\n        try:\n            if o == obj:\n                return True\n        except:\n            pass\n    return False\n\n\ndef indexOf(obj, objs):\n    \"\"\"\n    Returns the index of an object in a list of objects. Unlike the\n    list.index method this function only checks for identity not\n    equality.\n    \"\"\"\n    for i, o in enumerate(objs):\n        if o is obj:\n            return i\n        try:\n            if o == obj:\n                return i\n        except:\n            pass\n    raise ValueError('%s not in list' % obj)\n\n\ndef as_unicode(obj):\n    \"\"\"\n    Safely casts any object to unicode including regular string\n    (i.e. bytes) types in python 2.\n    \"\"\"\n    if sys.version_info.major < 3 and isinstance(obj, str):\n        obj = obj.decode('utf-8')\n    return unicode(obj)\n\n\ndef param_name(name):\n    \"\"\"\n    Removes the integer id from a Parameterized class name.\n    \"\"\"\n    match = re.match(r'(.)+(\\d){5}', name)\n    return name[:-5] if match else name\n\n\ndef unicode_repr(obj):\n    \"\"\"\n    Returns a repr without the unicode prefix.\n    \"\"\"\n    if sys.version_info.major == 2 and isinstance(obj, unicode):\n        return repr(obj)[1:]\n    return repr(obj)\n\n\ndef abbreviated_repr(value, max_length=25, natural_breaks=(',', ' ')):\n    \"\"\"\n    Returns an abbreviated repr for the supplied object. Attempts to\n    find a natural break point while adhering to the maximum length.\n    \"\"\"\n    vrepr = repr(value)\n    if len(vrepr) > max_length:\n        # Attempt to find natural cutoff point\n        abbrev = vrepr[max_length//2:]\n        natural_break = None\n        for brk in natural_breaks:\n            if brk in abbrev:\n                natural_break = abbrev.index(brk) + max_length//2\n                break\n        if natural_break and natural_break < max_length:\n            max_length = natural_break + 1\n\n        end_char = ''\n        if isinstance(value, list):\n            end_char = ']'\n        elif isinstance(value, OrderedDict):\n            end_char = '])'\n        elif isinstance(value, (dict, set)):\n            end_char = '}'\n        return vrepr[:max_length+1] + '...' + end_char\n    return vrepr\n\n\ndef param_reprs(parameterized, skip=None):\n    \"\"\"\n    Returns a list of reprs for parameters on the parameterized object.\n    Skips default and empty values.\n    \"\"\"\n    cls = type(parameterized).__name__\n    param_reprs = []\n    for p, v in sorted(parameterized.get_param_values()):\n        if v is parameterized.param[p].default: continue\n        elif v is None: continue\n        elif isinstance(v, string_types) and v == '': continue\n        elif isinstance(v, list) and v == []: continue\n        elif isinstance(v, dict) and v == {}: continue\n        elif (skip and p in skip) or (p == 'name' and v.startswith(cls)): continue\n        param_reprs.append('%s=%s' % (p, abbreviated_repr(v)))\n    return param_reprs\n\n\ndef full_groupby(l, key=lambda x: x):\n    \"\"\"\n    Groupby implementation which does not require a prior sort\n    \"\"\"\n    d = defaultdict(list)\n    for item in l:\n        d[key(item)].append(item)\n    return d.items()\n\n\ndef get_method_owner(meth):\n    \"\"\"\n    Returns the instance owning the supplied instancemethod or\n    the class owning the supplied classmethod.\n    \"\"\"\n    if inspect.ismethod(meth):\n        if sys.version_info < (3,0):\n            return meth.im_class if meth.im_self is None else meth.im_self\n        else:\n            return meth.__self__\n\n\ndef is_parameterized(obj):\n    \"\"\"\n    Whether an object is a Parameterized class or instance.\n    \"\"\"\n    return (isinstance(obj, param.Parameterized) or\n            (isinstance(obj, type) and issubclass(obj, param.Parameterized)))\n\n\ndef isdatetime(value):\n    \"\"\"\n    Whether the array or scalar is recognized datetime type.\n    \"\"\"\n    if isinstance(value, np.ndarray):\n        return (value.dtype.kind == \"M\" or\n                (value.dtype.kind == \"O\" and len(value) and\n                 isinstance(value[0], datetime_types)))\n    elif isinstance(value, list):\n        return all(isinstance(d, datetime_types) for d in value)\n    else:\n        return isinstance(value, datetime_types)\n\ndef value_as_datetime(value):\n    \"\"\"\n    Retrieve the value tuple as a tuple of datetime objects.\n    \"\"\"\n    if isinstance(value, numbers.Number):\n        value = datetime.utcfromtimestamp(value / 1000)\n    return value\n\n\ndef value_as_date(value):\n    if isinstance(value, numbers.Number):\n        value = datetime.utcfromtimestamp(value / 1000).date()\n    elif isinstance(value, datetime):\n        value = value.date()\n    return value\n", "path": "panel/util.py"}, {"content": "# -*- coding: utf-8 -*-\n\nfrom nbsite.shared_conf import *\n\nproject = u'Panel'\nauthors = u'Panel contributors'\ncopyright = u'2019 ' + authors\ndescription = 'High-level dashboarding for python visualization libraries'\n\nimport panel\nversion = release = str(panel.__version__)\n\nhtml_static_path += ['_static']\nhtml_theme = 'sphinx_ioam_theme'\nhtml_theme_options = {\n    'logo': 'logo_horizontal.png',\n    'favicon': 'favicon.ico',\n    'css': 'site.css'    \n}\n\nextensions += ['nbsite.gallery']\n\nnbsite_gallery_conf = {\n    'github_org': 'pyviz',\n    'github_project': 'panel',\n    'galleries': {\n        'gallery': {\n            'title': 'Gallery',\n            'sections': [\n                {'path': 'demos',\n                 'title': 'Demos',\n                 'description': 'A set of sophisticated apps built to demonstrate the features of Panel.'},\n                {'path': 'simple',\n                 'title': 'Simple Apps',\n                 'description': 'Simple example apps meant to provide a quick introduction to Panel.'},\n                {'path': 'apis',\n                 'title': 'APIs',\n                 'description': ('Examples meant to demonstrate the usage of different Panel APIs '\n                                 'such as interact and reactive functions.')},\n                {'path': 'layout',\n                 'title': 'Layouts',\n                 'description': 'How to leverage Panel layout components to achieve complex layouts.'},\n                {'path': 'dynamic',\n                 'title': 'Dynamic UIs',\n                 'description': ('Examples demonstrating how to build dynamic UIs with components that'\n                                 'are added or removed interactively.')},\n                {'path': 'param',\n                 'title': 'Param based apps',\n                 'description': 'Using the Param library to express UIs independently of Panel.'},\n                {'path': 'links',\n                 'title': 'Linking',\n                 'description': ('Using Javascript based links to define interactivity without '\n                                 'without requiring a live kernel.')},\n                {'path': 'external',\n                 'title': 'External libraries',\n                 'description': 'Wrapping external libraries with Panel.'}\n            ]\n        },\n        'reference': {\n            'title': 'Reference Gallery',\n            'sections': [\n                'panes',\n                'layouts',\n                'widgets'\n            ]\n        }\n    },\n    'thumbnail_url': 'https://assets.holoviews.org/panel/thumbnails',\n    'deployment_url': 'https://panel-gallery.pyviz.demo.anaconda.com/'\n}\n\n_NAV = (\n    ('Getting started', 'getting_started/index'),\n    ('User Guide', 'user_guide/index'),\n    ('Gallery', 'gallery/index'),\n    ('Reference Gallery', 'reference/index'),\n    ('Developer Guide', 'developer_guide/index'),\n    ('FAQ', 'FAQ'),\n    ('About', 'about')\n)\n\ntemplates_path = ['_templates']\n\nhtml_context.update({\n    'PROJECT': project,\n    'DESCRIPTION': description,\n    'AUTHOR': authors,\n    'VERSION': version,\n    'WEBSITE_URL': 'https://panel.pyviz.org',\n    'WEBSITE_SERVER': 'https://panel.pyviz.org',\n    'NAV': _NAV,\n    'LINKS': _NAV,\n    'SOCIAL': (\n        ('Gitter', '//gitter.im/pyviz/pyviz'),\n        ('Github', '//github.com/pyviz/panel'),\n    )\n})\n\nnbbuild_patterns_to_take_along = [\"simple.html\"]\n", "path": "doc/conf.py"}]}