Cleanup: quiet character escape warnings

This commit is contained in:
Campbell Barton 2021-12-01 11:05:16 +11:00
parent 1d91e8c12a
commit a444e8cc19
10 changed files with 19 additions and 19 deletions

View File

@ -509,7 +509,7 @@ class IsKeyFreeRunExportKeys(Operator):
if new_name in list_txt:
from re import findall
test_num = [findall("\d+", words) for words in list_txt]
test_num = [findall(r"\d+", words) for words in list_txt]
suffix += max([int(l[-1]) for l in test_num])
new_name = "{}_{}{}".format(def_name, suffix, ext)
return new_name

View File

@ -61,7 +61,7 @@ def first_letters(text):
"""Iterator over the first letter of each word"""
for match in first_letters.pattern.finditer(text):
yield text[match.start()]
first_letters.pattern = re_compile("((?<!\w)\w)|\d")
first_letters.pattern = re_compile(r"((?<!\w)\w)|\d")
def is_upsidedown_wrong(name):

View File

@ -1637,7 +1637,7 @@ class Do:
if type(self.pScene) is TransverseMercator:
scene['SRID'] = "tmerc"
elif self.pScene is not None: # assume Proj
scene['SRID'] = re.findall("\+init=(.+)\s", self.pScene.srs)[0]
scene['SRID'] = re.findall(r"\+init=(.+)\s", self.pScene.srs)[0]
#bpy.context.screen.scene = scene

View File

@ -60,7 +60,7 @@ def check_world_name(name_id="Dynamic"):
test_num = []
from re import findall
for words in name_list:
test_num.append(findall("\d+", words))
test_num.append(findall(r"\d+", words))
suffix += max([int(l[-1]) for l in test_num])
new_name = "{}_{}".format(name_id, suffix)

View File

@ -576,7 +576,7 @@ class Offset(object):
return ans
def SplitJoinFaces(self, newfaces, ev):
"""Use event ev to split or join faces.
r"""Use event ev to split or join faces.
Given ev, an edge event, use the ev spoke to split the
other spoke's inner edge.

View File

@ -3221,7 +3221,7 @@ class NWAddPrincipledSetup(Operator, NWBase, ImportHelper):
# Remove digits
fname = ''.join(i for i in fname if not i.isdigit())
# Separate CamelCase by space
fname = re.sub("([a-z])([A-Z])","\g<1> \g<2>",fname)
fname = re.sub(r"([a-z])([A-Z])", r"\g<1> \g<2>",fname)
# Replace common separators with SPACE
seperators = ['_', '.', '-', '__', '--', '#']
for sep in seperators:

View File

@ -258,7 +258,7 @@ class Generator(base_generate.BaseGenerator):
for tar in var.targets:
# If a custom property
if var.type == 'SINGLE_PROP' \
and re.match('^pose.bones\["[^"\]]*"\]\["[^"\]]*"\]$', tar.data_path):
and re.match(r'^pose.bones\["[^"\]]*"\]\["[^"\]]*"\]$', tar.data_path):
tar.data_path = "RIGIFY-" + tar.data_path

View File

@ -71,8 +71,8 @@ class Rig:
# RE pattern match right or left parts
# match the letter "L" (or "R"), followed by an optional dot (".")
# and 0 or more digits at the end of the the string
left_pattern = 'L\.?\d*$'
right_pattern = 'R\.?\d*$'
left_pattern = r'L\.?\d*$'
right_pattern = r'R\.?\d*$'
left = sorted( [ name for name in bones if re.search( left_pattern, name ) ] )
right = sorted( [ name for name in bones if re.search( right_pattern, name ) ] )

View File

@ -77,7 +77,7 @@ class Rig(BaseRig):
self.order = 'YXZ' if 'X' in self.palm_rotation_axis else 'YZX'
# Figure out the name for the control bone (remove the last .##)
self.ctrl_name = re.sub("([0-9]+\.)", "", strip_org(self.bones.org[-1])[::-1], count=1)[::-1]
self.ctrl_name = re.sub(r"([0-9]+\.)", "", strip_org(self.bones.org[-1])[::-1], count=1)[::-1]
def parent_bones(self):
self.rig_parent_bone = self.get_bone_parent(self.bones.org[0])

View File

@ -51,7 +51,7 @@ class Parser:
# build pattern with subgroups
sub_dict = {}
subpattern_names = []
for s in re.finditer("%\(.*?\)s", self.raw_patterns[pattern_name]):
for s in re.finditer(r"%\(.*?\)s", self.raw_patterns[pattern_name]):
subpattern_name = s.group()[2:-2]
if not self.virtual[subpattern_name]:
sub_dict[subpattern_name] = "(" + self.patterns[
@ -108,7 +108,7 @@ position_parser.add("minutes", r"%(number)s\s*%(minutes_symbol)s")
position_parser.add("seconds", r"%(number)s\s*%(seconds_symbol)s")
position_parser.add(
"degree_coordinates",
"(?:%(sign)s\s*)?%(degrees)s(?:[+\s]*%(minutes)s)?(?:[+\s]*%(seconds)s)?|(?:%(sign)s\s*)%(minutes)s(?:[+\s]*%(seconds)s)?|(?:%(sign)s\s*)%(seconds)s"
r"(?:%(sign)s\s*)?%(degrees)s(?:[+\s]*%(minutes)s)?(?:[+\s]*%(seconds)s)?|(?:%(sign)s\s*)%(minutes)s(?:[+\s]*%(seconds)s)?|(?:%(sign)s\s*)%(seconds)s"
)
position_parser.add(
@ -119,13 +119,13 @@ position_parser.add(
r"%(nmea_style)s|%(plain_degrees)s|%(degree_coordinates)s")
position_parser.add(
"position", """\
\s*%(direction_ns)s\s*%(coordinates_ns)s[,;\s]*%(direction_ew)s\s*%(coordinates_ew)s\s*|\
\s*%(direction_ew)s\s*%(coordinates_ew)s[,;\s]*%(direction_ns)s\s*%(coordinates_ns)s\s*|\
\s*%(coordinates_ns)s\s*%(direction_ns)s[,;\s]*%(coordinates_ew)s\s*%(direction_ew)s\s*|\
\s*%(coordinates_ew)s\s*%(direction_ew)s[,;\s]*%(coordinates_ns)s\s*%(direction_ns)s\s*|\
\s*%(coordinates_ns)s[,;\s]+%(coordinates_ew)s\s*\
""")
"position", (
r"\s*%(direction_ns)s\s*%(coordinates_ns)s[,;\s]*%(direction_ew)s\s*%(coordinates_ew)s\s*|"
r"\s*%(direction_ew)s\s*%(coordinates_ew)s[,;\s]*%(direction_ns)s\s*%(coordinates_ns)s\s*|"
r"\s*%(coordinates_ns)s\s*%(direction_ns)s[,;\s]*%(coordinates_ew)s\s*%(direction_ew)s\s*|"
r"\s*%(coordinates_ew)s\s*%(direction_ew)s[,;\s]*%(coordinates_ns)s\s*%(direction_ns)s\s*|"
r"\s*%(coordinates_ns)s[,;\s]+%(coordinates_ew)s\s*"
))
def get_number(b):