[Bf-extensions-cvs] [a444e8cc] master: Cleanup: quiet character escape warnings

Campbell Barton noreply at git.blender.org
Wed Dec 1 01:06:24 CET 2021


Commit: a444e8cc19a4353ce35ecdec9bb7894ee73a204a
Author: Campbell Barton
Date:   Wed Dec 1 11:05:16 2021 +1100
Branches: master
https://developer.blender.org/rBAa444e8cc19a4353ce35ecdec9bb7894ee73a204a

Cleanup: quiet character escape warnings

===================================================================

M	development_iskeyfree.py
M	io_export_paper_model.py
M	io_import_dxf/dxfimport/do.py
M	lighting_dynamic_sky.py
M	mesh_inset/offset.py
M	node_wrangler.py
M	rigify/generate.py
M	rigify/rigs/faces/super_face.py
M	rigify/rigs/limbs/super_palm.py
M	sun_position/geo.py

===================================================================

diff --git a/development_iskeyfree.py b/development_iskeyfree.py
index e8215497..c2c338f4 100644
--- a/development_iskeyfree.py
+++ b/development_iskeyfree.py
@@ -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
diff --git a/io_export_paper_model.py b/io_export_paper_model.py
index 8ea8cf9f..f92d940f 100644
--- a/io_export_paper_model.py
+++ b/io_export_paper_model.py
@@ -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):
diff --git a/io_import_dxf/dxfimport/do.py b/io_import_dxf/dxfimport/do.py
index 127160c0..65f9c079 100644
--- a/io_import_dxf/dxfimport/do.py
+++ b/io_import_dxf/dxfimport/do.py
@@ -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
 
diff --git a/lighting_dynamic_sky.py b/lighting_dynamic_sky.py
index 1b22a3a4..4152277d 100644
--- a/lighting_dynamic_sky.py
+++ b/lighting_dynamic_sky.py
@@ -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)
diff --git a/mesh_inset/offset.py b/mesh_inset/offset.py
index 3c6a7c76..6bc81787 100644
--- a/mesh_inset/offset.py
+++ b/mesh_inset/offset.py
@@ -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.
diff --git a/node_wrangler.py b/node_wrangler.py
index 1cfb9bbd..fd29a46b 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -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:
diff --git a/rigify/generate.py b/rigify/generate.py
index a2d9a5d1..501c335f 100644
--- a/rigify/generate.py
+++ b/rigify/generate.py
@@ -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
 
 
diff --git a/rigify/rigs/faces/super_face.py b/rigify/rigs/faces/super_face.py
index 312ecf56..32d013a7 100644
--- a/rigify/rigs/faces/super_face.py
+++ b/rigify/rigs/faces/super_face.py
@@ -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 ) ] )
diff --git a/rigify/rigs/limbs/super_palm.py b/rigify/rigs/limbs/super_palm.py
index 47d5eaf3..7573e4a7 100644
--- a/rigify/rigs/limbs/super_palm.py
+++ b/rigify/rigs/limbs/super_palm.py
@@ -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])
diff --git a/sun_position/geo.py b/sun_position/geo.py
index 59c27e39..72404195 100644
--- a/sun_position/geo.py
+++ b/sun_position/geo.py
@@ -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):



More information about the Bf-extensions-cvs mailing list