Skip to content

Commit d26c5c8

Browse files
authored
Fix invalid and accidental escape sequences (#2112)
1 parent 309a8b0 commit d26c5c8

6 files changed

Lines changed: 14 additions & 13 deletions

File tree

Pythonwin/pywin/framework/scriptutils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def IsOnPythonPath(path):
9898

9999

100100
def GetPackageModuleName(fileName):
101-
"""Given a filename, return (module name, new path).
101+
r"""Given a filename, return (module name, new path).
102102
eg - given "c:\a\b\c\my.py", return ("b.c.my",None) if "c:\a" is on sys.path.
103103
If no package found, will return ("my", "c:\a\b\c")
104104
"""

com/win32com/client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __WrapDispatch(
5555

5656

5757
def GetObject(Pathname=None, Class=None, clsctx=None):
58-
"""
58+
r"""
5959
Mimic VB's GetObject() function.
6060
6161
ob = GetObject(Class = "ProgID") or GetObject(Class = clsid) will

com/win32comext/authorization/demos/EditServiceSecurity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""
1+
r"""
22
Implements a permissions editor for services.
33
Service can be specified as plain name for local machine,
44
or as a remote service of the form \\machinename\service

win32/scripts/regsetup.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -497,23 +497,24 @@ def RegisterShellInfo(searchPaths):
497497
of the registry.
498498
"""
499499

500-
examples = """\
500+
# Using raw string so that all paths meant to be copied read correctly inline and when printed
501+
examples = r"""
501502
Examples:
502-
"regsetup c:\\wierd\\spot\\1 c:\\wierd\\spot\\2"
503+
"regsetup c:\wierd\spot\1 c:\wierd\spot\2"
503504
Attempts to setup the core Python. Looks in some standard places,
504505
as well as the 2 wierd spots to locate the core Python files (eg, Python.exe,
505506
pythonXX.dll, the standard library and Win32 Extensions.
506507
507508
"regsetup -a myappname . .\subdir"
508-
Registers a new Pythonpath entry named myappname, with "C:\\I\\AM\\HERE" and
509-
"C:\\I\\AM\\HERE\subdir" added to the path (ie, all args are converted to
509+
Registers a new Pythonpath entry named myappname, with "C:\I\AM\HERE" and
510+
"C:\I\AM\HERE\subdir" added to the path (ie, all args are converted to
510511
absolute paths)
511512
512-
"regsetup -c c:\\my\\python\\files"
513-
Unconditionally add "c:\\my\\python\\files" to the 'core' Python path.
513+
"regsetup -c c:\my\python\files"
514+
Unconditionally add "c:\my\python\files" to the 'core' Python path.
514515
515-
"regsetup -m some.pyd \\windows\\system"
516-
Register the module some.pyd in \\windows\\system as a registered
516+
"regsetup -m some.pyd \windows\system"
517+
Register the module some.pyd in \windows\system as a registered
517518
module. This will allow some.pyd to be imported, even though the
518519
windows system directory is not (usually!) on the Python Path.
519520

win32/test/test_clipboard.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def tearDown(self):
6767
CloseClipboard()
6868

6969
def test_unicode(self):
70-
val = "test-\a9har"
70+
val = "test-\xa9har"
7171
SetClipboardData(win32con.CF_UNICODETEXT, val)
7272
self.assertEqual(GetClipboardData(win32con.CF_UNICODETEXT), val)
7373

win32/test/test_odbc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def testLongBinary(self):
207207

208208
def testRaw(self):
209209
## Test binary data
210-
self._test_val("rawfield", memoryview(b"\1\2\3\4\0\5\6\7\8"))
210+
self._test_val("rawfield", memoryview(b"\1\2\3\4\0\5\6\7"))
211211

212212
def test_widechar(self):
213213
"""Test a unicode character that would be mangled if bound as plain character.

0 commit comments

Comments
 (0)