Skip to content

Commit b55c3f8

Browse files
committed
Fix deprecation warnings by using raw string to specify regexes
1 parent a123026 commit b55c3f8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Diff for: packages/python/plotly/_plotly_utils/basevalidators.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1033,9 +1033,9 @@ class ColorValidator(BaseValidator):
10331033
]
10341034
},
10351035
"""
1036-
re_hex = re.compile('#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})')
1037-
re_rgb_etc = re.compile('(rgb|hsl|hsv)a?\([\d.]+%?(,[\d.]+%?){2,3}\)')
1038-
re_ddk = re.compile('var\(\-\-.*\)')
1036+
re_hex = re.compile(r'#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})')
1037+
re_rgb_etc = re.compile(r'(rgb|hsl|hsv)a?\([\d.]+%?(,[\d.]+%?){2,3}\)')
1038+
re_ddk = re.compile(r'var\(\-\-.*\)')
10391039

10401040
named_colors = [
10411041
"aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
@@ -1456,9 +1456,9 @@ def __init__(self, plotly_name,
14561456
self.base = dflt
14571457
else:
14581458
# e.g. regex == '/^y([2-9]|[1-9][0-9]+)?$/'
1459-
self.base = re.match('/\^(\w+)', regex).group(1)
1459+
self.base = re.match(r'/\^(\w+)', regex).group(1)
14601460

1461-
self.regex = self.base + "(\d*)"
1461+
self.regex = self.base + r"(\d*)"
14621462

14631463
def description(self):
14641464

0 commit comments

Comments
 (0)