Mercurial > public > mercurial-scm > hg-stable
diff mercurial/windows.py @ 43554: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 | c59eb1560c44 |
children | fe73ec69350e |
line wrap: on
line diff
--- a/mercurial/windows.py Sun Nov 10 07:30:14 2019 -0800 +++ b/mercurial/windows.py Fri Nov 08 11:19:20 2019 -0800 @@ -32,7 +32,7 @@ except ImportError: import winreg -osutil = policy.importmod(r'osutil') +osutil = policy.importmod('osutil') getfsmountpoint = win32.getvolumename getfstype = win32.getfstype @@ -70,8 +70,8 @@ OPWRITE = 2 def __init__(self, fp): - object.__setattr__(self, r'_fp', fp) - object.__setattr__(self, r'_lastop', 0) + object.__setattr__(self, '_fp', fp) + object.__setattr__(self, '_lastop', 0) def __enter__(self): self._fp.__enter__() @@ -90,42 +90,42 @@ self._fp.seek(0, os.SEEK_CUR) def seek(self, *args, **kwargs): - object.__setattr__(self, r'_lastop', self.OPNONE) + object.__setattr__(self, '_lastop', self.OPNONE) return self._fp.seek(*args, **kwargs) def write(self, d): if self._lastop == self.OPREAD: self._noopseek() - object.__setattr__(self, r'_lastop', self.OPWRITE) + object.__setattr__(self, '_lastop', self.OPWRITE) return self._fp.write(d) def writelines(self, *args, **kwargs): if self._lastop == self.OPREAD: self._noopeseek() - object.__setattr__(self, r'_lastop', self.OPWRITE) + object.__setattr__(self, '_lastop', self.OPWRITE) return self._fp.writelines(*args, **kwargs) def read(self, *args, **kwargs): if self._lastop == self.OPWRITE: self._noopseek() - object.__setattr__(self, r'_lastop', self.OPREAD) + object.__setattr__(self, '_lastop', self.OPREAD) return self._fp.read(*args, **kwargs) def readline(self, *args, **kwargs): if self._lastop == self.OPWRITE: self._noopseek() - object.__setattr__(self, r'_lastop', self.OPREAD) + object.__setattr__(self, '_lastop', self.OPREAD) return self._fp.readline(*args, **kwargs) def readlines(self, *args, **kwargs): if self._lastop == self.OPWRITE: self._noopseek() - object.__setattr__(self, r'_lastop', self.OPREAD) + object.__setattr__(self, '_lastop', self.OPREAD) return self._fp.readlines(*args, **kwargs) @@ -176,7 +176,7 @@ except WindowsError as err: # convert to a friendlier exception raise IOError( - err.errno, r'%s: %s' % (encoding.strfromlocal(name), err.strerror) + err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror) ) @@ -215,7 +215,7 @@ if inst.errno != 0 and not win32.lasterrorwaspipeerror(inst): raise self.close() - raise IOError(errno.EPIPE, r'Broken pipe') + raise IOError(errno.EPIPE, 'Broken pipe') def flush(self): try: @@ -223,7 +223,7 @@ except IOError as inst: if not win32.lasterrorwaspipeerror(inst): raise - raise IOError(errno.EPIPE, r'Broken pipe') + raise IOError(errno.EPIPE, 'Broken pipe') def _is_win_9x(): @@ -686,4 +686,4 @@ def bindunixsocket(sock, path): - raise NotImplementedError(r'unsupported platform') + raise NotImplementedError('unsupported platform')