File: 0002-Fix-invalid-string-escapes.patch

package info (click to toggle)
uranium 5.0.0-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,328 kB
  • sloc: python: 31,765; sh: 132; makefile: 12
file content (81 lines) | stat: -rw-r--r-- 3,998 bytes parent folder | download | duplicates (3)
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
From 19159681695b062e9fd984af378883adaf76e185 Mon Sep 17 00:00:00 2001
From: Patrick Mischke <mischke@physik.uni-kl.de>
Date: Thu, 20 Jan 2022 09:13:12 +0100
Subject: [PATCH 1/1] Fix invalid string escapes

Invalid string escapes print ugly DeprecationWarnings, but might result
in SyntaxErrors somewhen in the future. I'd rather fix them, so my Log
files aren't cluttered with pointless warnings.
---
 UM/Settings/InstanceContainer.py |  6 +++---
 UM/VersionUpgrade.py             |  4 ++--
 UM/VersionUpgradeManager.py      | 14 +++++++-------
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/UM/Settings/InstanceContainer.py b/UM/Settings/InstanceContainer.py
index 0f3a163b0..b196c50de 100644
--- a/UM/Settings/InstanceContainer.py
+++ b/UM/Settings/InstanceContainer.py
@@ -50,9 +50,9 @@ class InstanceContainer(QObject, ContainerInterface, PluginObject):
     """A container for SettingInstance objects."""
 
     Version = 4
-    version_regex = re.compile("\nversion ?= ?(\d+)")
-    setting_version_regex = re.compile("\nsetting_version ?= ?(\d+)")
-    type_regex = re.compile("\ntype ?= ?(\w+)")
+    version_regex = re.compile(r"\nversion ?= ?(\d+)")
+    setting_version_regex = re.compile(r"\nsetting_version ?= ?(\d+)")
+    type_regex = re.compile(r"\ntype ?= ?(\w+)")
 
     def __init__(self, container_id: str, parent: QObject = None, *args: Any, **kwargs: Any) -> None:
         """Constructor
diff --git a/UM/VersionUpgrade.py b/UM/VersionUpgrade.py
index 2b561ce79..f6a6d796e 100644
--- a/UM/VersionUpgrade.py
+++ b/UM/VersionUpgrade.py
@@ -19,8 +19,8 @@ class VersionUpgrade(PluginObject):
         """Initialises a version upgrade plugin instance."""
 
         super().__init__()
-        self._version_regex = re.compile("\nversion ?= ?(\d+)")
-        self._setting_version_regex = re.compile("\nsetting_version ?= ?(\d+)")
+        self._version_regex = re.compile(r"\nversion ?= ?(\d+)")
+        self._setting_version_regex = re.compile(r"\nsetting_version ?= ?(\d+)")
 
     def getCfgVersion(self, serialised: str) -> int:
         """
diff --git a/UM/VersionUpgradeManager.py b/UM/VersionUpgradeManager.py
index a1883e851..dc37875d1 100644
--- a/UM/VersionUpgradeManager.py
+++ b/UM/VersionUpgradeManager.py
@@ -95,11 +95,11 @@ class VersionUpgradeManager:
 
         #Regular expressions of the files that should not be checked, such as log files.
         self._ignored_files = [
-            ".*\.lock",       # Don't upgrade the configuration file lock. It's not persistent.
-            "plugins\.json",  # plugins.json and packages.json need to remain the same for the version upgrade plug-ins.
-            "packages\.json",
-            ".*\.log",        # Don't process the log. It's not needed and it could be really big.
-            ".*\.log.?",      # Don't process the backup of the log. It's not needed and it could be really big.
+            ".*\\.lock",       # Don't upgrade the configuration file lock. It's not persistent.
+            "plugins\\.json",  # plugins.json and packages.json need to remain the same for the version upgrade plug-ins.
+            "packages\\.json",
+            ".*\\.log",        # Don't process the log. It's not needed and it could be really big.
+            ".*\\.log.?",      # Don't process the backup of the log. It's not needed and it could be really big.
             "3.[0-3]\\.*",    # Don't upgrade folders that are back-ups from older version upgrades. Until v3.3 we stored the back-up in the config folder itself.
             "3.[0-3]/.*",
             "2.[0-7]\\.*",
@@ -108,8 +108,8 @@ class VersionUpgradeManager:
             "cura/.*",
             "plugins\\.*",    # Don't upgrade manually installed plug-ins.
             "plugins/.*",
-            "./*packages\.json",
-            "./*plugins\.json"
+            "./*packages\\.json",
+            "./*plugins\\.json"
         ]  # type: List[str]
 
     def registerIgnoredFile(self, file_name: str) -> None:
-- 
2.47.2