File: py3.12-use-raw-strings-to-avoid-warning.patch

package info (click to toggle)
python-passlib 1.7.4-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,920 kB
  • sloc: python: 23,094; makefile: 3
file content (143 lines) | stat: -rw-r--r-- 7,198 bytes parent folder | download
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
Description: Python 3.12: Use raw strings to avoid warning
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2023-12-23

--- python-passlib-1.7.4.orig/passlib/_setup/stamp.py
+++ python-passlib-1.7.4/passlib/_setup/stamp.py
@@ -55,7 +55,7 @@ def stamp_source(base_dir, version, dry_
     #
     path = os.path.join(base_dir, "passlib", "__init__.py")
     content = _get_file(path)
-    content, count = re.subn('(?m)^__version__\s*=.*$',
+    content, count = re.subn(r'(?m)^__version__\s*=.*$',
                     '__version__ = ' + repr(version),
                     content)
     assert count == 1, "failed to replace version string"
@@ -68,7 +68,7 @@ def stamp_source(base_dir, version, dry_
     path = os.path.join(base_dir, "setup.py")
     if os.path.exists(path):
         content = _get_file(path)
-        content, count = re.subn('(?m)^stamp_build\s*=.*$',
+        content, count = re.subn(r'(?m)^stamp_build\s*=.*$',
                         'stamp_build = False', content)
         assert count == 1, "failed to update 'stamp_build' flag"
         _replace_file(path, content, dry_run=dry_run)
--- python-passlib-1.7.4.orig/passlib/tests/test_apache.py
+++ python-passlib-1.7.4/passlib/tests/test_apache.py
@@ -207,7 +207,7 @@ class HtpasswdFileTest(TestCase):
         self.assertRaises(ValueError, ht.set_password, "user:", "pass")
 
         # test that legacy update() still works
-        with self.assertWarningList("update\(\) is deprecated"):
+        with self.assertWarningList(r"update\(\) is deprecated"):
             ht.update("user2", "test")
         self.assertTrue(ht.check_password("user2", "test"))
 
@@ -277,7 +277,7 @@ class HtpasswdFileTest(TestCase):
         self.assertRaises(ValueError, ht.check_password, "user:", "pass")
 
         # test that legacy verify() still works
-        with self.assertWarningList(["verify\(\) is deprecated"]*2):
+        with self.assertWarningList([r"verify\(\) is deprecated"]*2):
             self.assertTrue(ht.verify("user1", "pass1"))
             self.assertFalse(ht.verify("user1", "pass2"))
 
@@ -367,7 +367,7 @@ class HtpasswdFileTest(TestCase):
         self.assertEqual(ht.get_hash("user4"), b"pass4")
         self.assertEqual(ht.get_hash("user5"), None)
 
-        with self.assertWarningList("find\(\) is deprecated"):
+        with self.assertWarningList(r"find\(\) is deprecated"):
             self.assertEqual(ht.find("user4"), b"pass4")
 
     def test_09_to_string(self):
@@ -603,7 +603,7 @@ class HtdigestFileTest(TestCase):
         self.assertRaises(ValueError, ht.set_password, "user", "r"*256, "pass")
 
         # test that legacy update() still works
-        with self.assertWarningList("update\(\) is deprecated"):
+        with self.assertWarningList(r"update\(\) is deprecated"):
             ht.update("user2", "realm2", "test")
         self.assertTrue(ht.check_password("user2", "test"))
 
@@ -637,7 +637,7 @@ class HtdigestFileTest(TestCase):
         self.assertIs(ht.check_password("user5", "pass5"), None)
 
         # test that legacy verify() still works
-        with self.assertWarningList(["verify\(\) is deprecated"]*2):
+        with self.assertWarningList([r"verify\(\) is deprecated"]*2):
             self.assertTrue(ht.verify("user1", "realm", "pass1"))
             self.assertFalse(ht.verify("user1", "realm", "pass2"))
 
@@ -725,7 +725,7 @@ class HtdigestFileTest(TestCase):
         self.assertEqual(ht.get_hash("user4", "realm"), "ab7b5d5f28ccc7666315f508c7358519")
         self.assertEqual(ht.get_hash("user5", "realm"), None)
 
-        with self.assertWarningList("find\(\) is deprecated"):
+        with self.assertWarningList(r"find\(\) is deprecated"):
             self.assertEqual(ht.find("user4", "realm"), "ab7b5d5f28ccc7666315f508c7358519")
 
     def test_09_encodings(self):
--- python-passlib-1.7.4.orig/passlib/tests/test_context_deprecated.py
+++ python-passlib-1.7.4/passlib/tests/test_context_deprecated.py
@@ -551,7 +551,7 @@ class CryptContextTest(TestCase):
                                 r"CryptContext\(\)\.replace\(\) has been deprecated.*")
         warnings.filterwarnings("ignore",
                                 r"The CryptContext ``policy`` keyword has been deprecated.*")
-        warnings.filterwarnings("ignore", ".*(CryptPolicy|context\.policy).*(has|have) been deprecated.*")
+        warnings.filterwarnings("ignore", r".*(CryptPolicy|context\.policy).*(has|have) been deprecated.*")
         warnings.filterwarnings("ignore",
                                 r"the method.*hash_needs_update.*is deprecated")
 
@@ -704,7 +704,7 @@ class LazyCryptContextTest(TestCase):
         # silence some warnings
         warnings.filterwarnings("ignore",
                                 r"CryptContext\(\)\.replace\(\) has been deprecated")
-        warnings.filterwarnings("ignore", ".*(CryptPolicy|context\.policy).*(has|have) been deprecated.*")
+        warnings.filterwarnings("ignore", r".*(CryptPolicy|context\.policy).*(has|have) been deprecated.*")
 
     def test_kwd_constructor(self):
         """test plain kwds"""
--- python-passlib-1.7.4.orig/passlib/tests/test_ext_django.py
+++ python-passlib-1.7.4/passlib/tests/test_ext_django.py
@@ -913,7 +913,7 @@ class DjangoExtensionTest(_ExtensionTest
         # mess with User.set_password, make sure it's detected
         orig = models.User.set_password
         models.User.set_password = dummy
-        with self.assertWarningList("another library has patched.*User\.set_password"):
+        with self.assertWarningList(r"another library has patched.*User\.set_password"):
             adapter._manager.check_all()
         models.User.set_password = orig
 
--- python-passlib-1.7.4.orig/passlib/tests/test_handlers.py
+++ python-passlib-1.7.4/passlib/tests/test_handlers.py
@@ -1520,7 +1520,7 @@ class _sha256_crypt_test(HandlerCase):
     filter_config_warnings = True # rounds too low, salt too small
 
     platform_crypt_support = [
-        ("freebsd(9|1\d)|linux", True),
+        (r"freebsd(9|1\d)|linux", True),
         ("freebsd8", None),  # added in freebsd 8.3
         ("freebsd|openbsd|netbsd|darwin", False),
         ("solaris", None),  # depends on policy
@@ -1758,7 +1758,7 @@ class unix_disabled_test(HandlerCase):
 
     def test_90_special(self):
         """test marker option & special behavior"""
-        warnings.filterwarnings("ignore", "passing settings to .*.hash\(\) is deprecated")
+        warnings.filterwarnings("ignore", r"passing settings to .*.hash\(\) is deprecated")
         handler = self.handler
 
         # preserve hash if provided
--- python-passlib-1.7.4.orig/passlib/tests/test_utils.py
+++ python-passlib-1.7.4/passlib/tests/test_utils.py
@@ -141,7 +141,7 @@ class MiscTest(TestCase):
     def test_generate_password(self):
         """generate_password()"""
         from passlib.utils import generate_password
-        warnings.filterwarnings("ignore", "The function.*generate_password\(\) is deprecated")
+        warnings.filterwarnings("ignore", r"The function.*generate_password\(\) is deprecated")
         self.assertEqual(len(generate_password(15)), 15)
 
     def test_is_crypt_context(self):