Add r prefix to re.match() strings (#837)

This commit is contained in:
William Reynolds 2022-12-06 12:27:50 +00:00 committed by GitHub
parent e709e46d91
commit 64e1fb8571
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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):

View File

@ -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))