comparison mercurial/win32.py @ 43506:9f70512ae2cf

cleanup: remove pointless r-prefixes on single-quoted strings This is the promised second step on single-quoted strings. These had existed because our source transformer didn't turn r'' into b'', so we had tagged some strings as r-strings to get "native" strings on both Pythons. Now that the transformer is gone, we can dispense with this nonsense. Methodology: I ran hg locate 'set:added() or modified() or clean()' | egrep '.*\.py$' | xargs egrep --color=never -n -- \[\^b\]\[\^a-z\]r\'\[\^\'\\\\\]\*\'\[\^\'\ in an emacs grep-mode buffer, and then used a keyboard macro to iterate over the results and remove the r prefix as needed. # skip-blame removing unneeded r prefixes left over from Python 3 migration. Differential Revision: https://phab.mercurial-scm.org/D7306
author Augie Fackler <augie@google.com>
date Fri, 08 Nov 2019 11:19:20 -0800
parents 313e3a279828
children 89a2afe31e82
comparison
equal deleted inserted replaced
43505:47fac1692ede 43506:9f70512ae2cf
55 _WPARAM = ctypes.c_ulonglong 55 _WPARAM = ctypes.c_ulonglong
56 _LPARAM = ctypes.c_longlong 56 _LPARAM = ctypes.c_longlong
57 57
58 58
59 class _FILETIME(ctypes.Structure): 59 class _FILETIME(ctypes.Structure):
60 _fields_ = [(r'dwLowDateTime', _DWORD), (r'dwHighDateTime', _DWORD)] 60 _fields_ = [('dwLowDateTime', _DWORD), ('dwHighDateTime', _DWORD)]
61 61
62 62
63 class _BY_HANDLE_FILE_INFORMATION(ctypes.Structure): 63 class _BY_HANDLE_FILE_INFORMATION(ctypes.Structure):
64 _fields_ = [ 64 _fields_ = [
65 (r'dwFileAttributes', _DWORD), 65 ('dwFileAttributes', _DWORD),
66 (r'ftCreationTime', _FILETIME), 66 ('ftCreationTime', _FILETIME),
67 (r'ftLastAccessTime', _FILETIME), 67 ('ftLastAccessTime', _FILETIME),
68 (r'ftLastWriteTime', _FILETIME), 68 ('ftLastWriteTime', _FILETIME),
69 (r'dwVolumeSerialNumber', _DWORD), 69 ('dwVolumeSerialNumber', _DWORD),
70 (r'nFileSizeHigh', _DWORD), 70 ('nFileSizeHigh', _DWORD),
71 (r'nFileSizeLow', _DWORD), 71 ('nFileSizeLow', _DWORD),
72 (r'nNumberOfLinks', _DWORD), 72 ('nNumberOfLinks', _DWORD),
73 (r'nFileIndexHigh', _DWORD), 73 ('nFileIndexHigh', _DWORD),
74 (r'nFileIndexLow', _DWORD), 74 ('nFileIndexLow', _DWORD),
75 ] 75 ]
76 76
77 77
78 # CreateFile 78 # CreateFile
79 _FILE_SHARE_READ = 0x00000001 79 _FILE_SHARE_READ = 0x00000001
95 _STILL_ACTIVE = 259 95 _STILL_ACTIVE = 259
96 96
97 97
98 class _STARTUPINFO(ctypes.Structure): 98 class _STARTUPINFO(ctypes.Structure):
99 _fields_ = [ 99 _fields_ = [
100 (r'cb', _DWORD), 100 ('cb', _DWORD),
101 (r'lpReserved', _LPSTR), 101 ('lpReserved', _LPSTR),
102 (r'lpDesktop', _LPSTR), 102 ('lpDesktop', _LPSTR),
103 (r'lpTitle', _LPSTR), 103 ('lpTitle', _LPSTR),
104 (r'dwX', _DWORD), 104 ('dwX', _DWORD),
105 (r'dwY', _DWORD), 105 ('dwY', _DWORD),
106 (r'dwXSize', _DWORD), 106 ('dwXSize', _DWORD),
107 (r'dwYSize', _DWORD), 107 ('dwYSize', _DWORD),
108 (r'dwXCountChars', _DWORD), 108 ('dwXCountChars', _DWORD),
109 (r'dwYCountChars', _DWORD), 109 ('dwYCountChars', _DWORD),
110 (r'dwFillAttribute', _DWORD), 110 ('dwFillAttribute', _DWORD),
111 (r'dwFlags', _DWORD), 111 ('dwFlags', _DWORD),
112 (r'wShowWindow', _WORD), 112 ('wShowWindow', _WORD),
113 (r'cbReserved2', _WORD), 113 ('cbReserved2', _WORD),
114 (r'lpReserved2', ctypes.c_char_p), 114 ('lpReserved2', ctypes.c_char_p),
115 (r'hStdInput', _HANDLE), 115 ('hStdInput', _HANDLE),
116 (r'hStdOutput', _HANDLE), 116 ('hStdOutput', _HANDLE),
117 (r'hStdError', _HANDLE), 117 ('hStdError', _HANDLE),
118 ] 118 ]
119 119
120 120
121 class _PROCESS_INFORMATION(ctypes.Structure): 121 class _PROCESS_INFORMATION(ctypes.Structure):
122 _fields_ = [ 122 _fields_ = [
123 (r'hProcess', _HANDLE), 123 ('hProcess', _HANDLE),
124 (r'hThread', _HANDLE), 124 ('hThread', _HANDLE),
125 (r'dwProcessId', _DWORD), 125 ('dwProcessId', _DWORD),
126 (r'dwThreadId', _DWORD), 126 ('dwThreadId', _DWORD),
127 ] 127 ]
128 128
129 129
130 _CREATE_NO_WINDOW = 0x08000000 130 _CREATE_NO_WINDOW = 0x08000000
131 _SW_HIDE = 0 131 _SW_HIDE = 0
132 132
133 133
134 class _COORD(ctypes.Structure): 134 class _COORD(ctypes.Structure):
135 _fields_ = [(r'X', ctypes.c_short), (r'Y', ctypes.c_short)] 135 _fields_ = [('X', ctypes.c_short), ('Y', ctypes.c_short)]
136 136
137 137
138 class _SMALL_RECT(ctypes.Structure): 138 class _SMALL_RECT(ctypes.Structure):
139 _fields_ = [ 139 _fields_ = [
140 (r'Left', ctypes.c_short), 140 ('Left', ctypes.c_short),
141 (r'Top', ctypes.c_short), 141 ('Top', ctypes.c_short),
142 (r'Right', ctypes.c_short), 142 ('Right', ctypes.c_short),
143 (r'Bottom', ctypes.c_short), 143 ('Bottom', ctypes.c_short),
144 ] 144 ]
145 145
146 146
147 class _CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure): 147 class _CONSOLE_SCREEN_BUFFER_INFO(ctypes.Structure):
148 _fields_ = [ 148 _fields_ = [
149 (r'dwSize', _COORD), 149 ('dwSize', _COORD),
150 (r'dwCursorPosition', _COORD), 150 ('dwCursorPosition', _COORD),
151 (r'wAttributes', _WORD), 151 ('wAttributes', _WORD),
152 (r'srWindow', _SMALL_RECT), 152 ('srWindow', _SMALL_RECT),
153 (r'dwMaximumWindowSize', _COORD), 153 ('dwMaximumWindowSize', _COORD),
154 ] 154 ]
155 155
156 156
157 _STD_OUTPUT_HANDLE = _DWORD(-11).value 157 _STD_OUTPUT_HANDLE = _DWORD(-11).value
158 _STD_ERROR_HANDLE = _DWORD(-12).value 158 _STD_ERROR_HANDLE = _DWORD(-12).value
357 code = _kernel32.GetLastError() 357 code = _kernel32.GetLastError()
358 if code > 0x7FFFFFFF: 358 if code > 0x7FFFFFFF:
359 code -= 2 ** 32 359 code -= 2 ** 32
360 err = ctypes.WinError(code=code) 360 err = ctypes.WinError(code=code)
361 raise OSError( 361 raise OSError(
362 err.errno, r'%s: %s' % (encoding.strfromlocal(name), err.strerror) 362 err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror)
363 ) 363 )
364 364
365 365
366 def _getfileinfo(name): 366 def _getfileinfo(name):
367 fh = _kernel32.CreateFileA( 367 fh = _kernel32.CreateFileA(