Skip to content

Commit

Permalink
Prepare support for python 3.8 (#702)
Browse files Browse the repository at this point in the history
* closes #701

* best practice for handling copmat here is a try..except import
  • Loading branch information
a-recknagel authored and philippjfr committed Oct 13, 2019
1 parent 793420f commit 483a042
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion panel/_testing/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def hv_mpl():
@pytest.yield_fixture
def tmpdir(request, tmpdir_factory):
name = request.node.name
name = re.sub("[\W]", "_", name)
name = re.sub(r"[\W]", "_", name)
MAXVAL = 30
if len(name) > MAXVAL:
name = name[:MAXVAL]
Expand Down
8 changes: 6 additions & 2 deletions panel/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
import numbers
import datetime as dt

from collections import defaultdict, MutableSequence, MutableMapping, OrderedDict
from datetime import datetime
from six import string_types
from collections import defaultdict, OrderedDict
try:
from collections.abc import MutableSequence, MutableMapping
except ImportError: # support for python>3.8
from collections import MutableSequence, MutableMapping

import param
import numpy as np
Expand Down Expand Up @@ -77,7 +81,7 @@ def param_name(name):
"""
Removes the integer id from a Parameterized class name.
"""
match = re.match('(.)+(\d){5}', name)
match = re.match(r'(.)+(\d){5}', name)
return name[:-5] if match else name


Expand Down
2 changes: 1 addition & 1 deletion panel/viewable.py
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ def _cleanup(self, root):
return

customjs = model.select({'type': CustomJS})
pattern = "data\['comm_id'\] = \"(.*)\""
pattern = r"data\['comm_id'\] = \"(.*)\""
for js in customjs:
comm_ids = list(re.findall(pattern, js.code))
if not comm_ids:
Expand Down

0 comments on commit 483a042

Please sign in to comment.