mirror of
https://github.com/clearml/clearml
synced 2025-03-03 10:42:00 +00:00
Add r prefix to re.match() strings (#837)
This commit is contained in:
parent
e709e46d91
commit
64e1fb8571
@ -134,7 +134,7 @@ class BaseField(object):
|
||||
def _validate_name(self):
|
||||
if self.name is None:
|
||||
return
|
||||
if not re.match('^[A-Za-z_](([\w\-]*)?\w+)?$', self.name): # noqa: W605
|
||||
if not re.match(r'^[A-Za-z_](([\w\-]*)?\w+)?$', self.name): # noqa: W605
|
||||
raise ValueError('Wrong name', self.name)
|
||||
|
||||
def structue_name(self, default):
|
||||
|
@ -338,7 +338,7 @@ class ConfigTree(OrderedDict):
|
||||
elif isinstance(value, ConfigTree):
|
||||
lst = []
|
||||
for k, v in sorted(value.items(), key=lambda kv: kv[0]):
|
||||
if re.match('^[1-9][0-9]*$|0', k):
|
||||
if re.match(r'^[1-9][0-9]*$|0', k):
|
||||
lst.append(v)
|
||||
else:
|
||||
raise ConfigException(u"{key} does not translate to a list".format(key=key))
|
||||
|
Loading…
Reference in New Issue
Block a user