1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
From: Agathe Porte <gagath@debian.org>
Date: Fri, 6 Jun 2025 16:07:06 +0200
Subject: fix SyntaxWarning: invalid escape sequence
Fixed in upstream commit 4cec48c7881d4a249ceb6f540e22e60d3e4f2040,
but since it is a very big cleanup commit manually fix the escape
sequences so that the warning disappears upon install.
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085358
Forwarded: not-needed
Applied-Upstream: https://github.com/vlachoudis/bCNC/commit/4cec48c7881d4a249ceb6f540e22e60d3e4f2040
---
bCNC/CNC.py | 2 +-
bCNC/CNCList.py | 2 +-
bCNC/lib/svg_elements.py | 6 +++---
bCNC/plugins/driller.py | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/bCNC/CNC.py b/bCNC/CNC.py
index 72dd0d1..9f62318 100644
--- a/bCNC/CNC.py
+++ b/bCNC/CNC.py
@@ -1984,7 +1984,7 @@ class Block(list):
pat = OPPAT.match(name)
if pat is not None:
ops = pat.group(2)
- ops = re.split('\W+', ops)
+ ops = re.split(r'\W+', ops)
if op in ops: return True
return False
diff --git a/bCNC/CNCList.py b/bCNC/CNCList.py
index 80108cc..2c9ed72 100644
--- a/bCNC/CNCList.py
+++ b/bCNC/CNCList.py
@@ -635,7 +635,7 @@ class CNCListbox(Listbox):
if not self._items: return
all_items = self._items
sel_items = list(map(int,self.curselection()))
- mreg = re.compile("^\((.*)\)$")
+ mreg = re.compile(r"^\((.*)\)$")
change = False
for i in sel_items:
my_item = all_items[i]
diff --git a/bCNC/lib/svg_elements.py b/bCNC/lib/svg_elements.py
index 016093f..15350b5 100644
--- a/bCNC/lib/svg_elements.py
+++ b/bCNC/lib/svg_elements.py
@@ -145,7 +145,7 @@ SVG_VALUE_NON_SCALING_STROKE = 'non-scaling-stroke'
PATTERN_WS = r'[\s\t\n]*'
PATTERN_COMMA = r'(?:\s*,\s*|\s+|(?=-))'
PATTERN_COMMAWSP = r'[ ,\t\n\x09\x0A\x0C\x0D]+'
-PATTERN_FLOAT = '[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?'
+PATTERN_FLOAT = r'[-+]?[0-9]*\.?[0-9]+(?:[eE][-+]?[0-9]+)?'
PATTERN_LENGTH_UNITS = 'cm|mm|Q|in|pt|pc|px|em|cx|ch|rem|vw|vh|vmin|vmax'
PATTERN_ANGLE_UNITS = 'deg|grad|rad|turn'
PATTERN_TIME_UNITS = 's|ms'
@@ -167,10 +167,10 @@ PATTERN_TRANSFORM_UNITS = PATTERN_LENGTH_UNITS + '|' \
+ PATTERN_ANGLE_UNITS + '|' \
+ PATTERN_PERCENT
-REGEX_IRI = re.compile('url\(#?(.*)\)')
+REGEX_IRI = re.compile(r'url\(#?(.*)\)')
REGEX_FLOAT = re.compile(PATTERN_FLOAT)
REGEX_COORD_PAIR = re.compile('(%s)%s(%s)' % (PATTERN_FLOAT, PATTERN_COMMA, PATTERN_FLOAT))
-REGEX_TRANSFORM_TEMPLATE = re.compile('(?u)(%s)%s\(([^)]+)\)' % (PATTERN_TRANSFORM, PATTERN_WS))
+REGEX_TRANSFORM_TEMPLATE = re.compile(r'(?u)(%s)%s\(([^)]+)\)' % (PATTERN_TRANSFORM, PATTERN_WS))
REGEX_TRANSFORM_PARAMETER = re.compile('(%s)%s(%s)?' % (PATTERN_FLOAT, PATTERN_WS, PATTERN_TRANSFORM_UNITS))
REGEX_COLOR_HEX = re.compile(r'^#?([0-9A-Fa-f]{3,8})$')
REGEX_COLOR_RGB = re.compile(
diff --git a/bCNC/plugins/driller.py b/bCNC/plugins/driller.py
index c25fdd3..43a2cf5 100644
--- a/bCNC/plugins/driller.py
+++ b/bCNC/plugins/driller.py
@@ -92,7 +92,7 @@ class Tool(Plugin):
if (line=="M95" or line=="%"): header = False
if line[0]=="T":
# Tools
- m = re.match('(T\d+)C(.+)',line)
+ m = re.match(r'(T\d+)C(.+)',line)
data["tools"][m.group(1)]={"diameter":float(m.group(2)),"holes":[]}
if line=="ICI": incrementcoord = True
if header==False:
|