Mercurial > hg
changeset 43503:313e3a279828
cleanup: remove pointless r-prefixes on double-quoted strings
This is only double-quoted strings. I'll do single-quoted strings as a
second step. 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 -- \[\^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/D7305
author | Augie Fackler <augie@google.com> |
---|---|
date | Thu, 07 Nov 2019 13:18:19 -0500 |
parents | c093cc6e6c99 |
children | a78a65c33b5a |
files | contrib/check-code.py contrib/perf.py doc/gendoc.py hgdemandimport/demandimportpy2.py hgext/convert/common.py hgext/convert/cvsps.py hgext/githelp.py hgext/lfs/wireprotolfsserver.py hgext/narrow/narrowwirepeer.py hgext/record.py hgext/remotefilelog/shallowutil.py hgext/zeroconf/__init__.py mercurial/changegroup.py mercurial/context.py mercurial/debugcommands.py mercurial/dirstate.py mercurial/encoding.py mercurial/extensions.py mercurial/filemerge.py mercurial/hgweb/server.py mercurial/hgweb/wsgiheaders.py mercurial/hook.py mercurial/httppeer.py mercurial/lock.py mercurial/lsprof.py mercurial/patch.py mercurial/policy.py mercurial/pure/osutil.py mercurial/pycompat.py mercurial/statprof.py mercurial/utils/procutil.py mercurial/win32.py |
diffstat | 32 files changed, 102 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-code.py Thu Nov 07 03:59:22 2019 -0800 +++ b/contrib/check-code.py Thu Nov 07 13:18:19 2019 -0500 @@ -281,10 +281,10 @@ for tp in testpats[i]: p = tp[0] m = tp[1] - if p.startswith(r'^'): - p = r"^ [$>] (%s)" % p[1:] + if p.startswith('^'): + p = "^ [$>] (%s)" % p[1:] else: - p = r"^ [$>] .*(%s)" % p + p = "^ [$>] .*(%s)" % p utestpats[i].append((p, m) + tp[2:]) # don't transform the following rules:
--- a/contrib/perf.py Thu Nov 07 03:59:22 2019 -0800 +++ b/contrib/perf.py Thu Nov 07 13:18:19 2019 -0500 @@ -1658,7 +1658,7 @@ ) else: os.environ[r'HGRCPATH'] = r' ' - os.system(r"%s version -q > NUL" % sys.argv[0]) + os.system("%s version -q > NUL" % sys.argv[0]) timer(d) fm.end()
--- a/doc/gendoc.py Thu Nov 07 03:59:22 2019 -0800 +++ b/doc/gendoc.py Thu Nov 07 13:18:19 2019 -0500 @@ -22,7 +22,7 @@ # available. Relax C module requirements. os.environ[r'HGMODULEPOLICY'] = r'allow' # import from the live mercurial repo -sys.path.insert(0, r"..") +sys.path.insert(0, "..") from mercurial import demandimport demandimport.enable()
--- a/hgdemandimport/demandimportpy2.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgdemandimport/demandimportpy2.py Thu Nov 07 13:18:19 2019 -0500 @@ -70,9 +70,9 @@ head = name after = [] object.__setattr__( - self, r"_data", (head, globals, locals, after, level, set()) + self, "_data", (head, globals, locals, after, level, set()) ) - object.__setattr__(self, r"_module", None) + object.__setattr__(self, "_module", None) def _extend(self, name): """add to the list of submodules to load""" @@ -143,7 +143,7 @@ if modref and getattr(modref, head, None) is self: setattr(modref, head, mod) - object.__setattr__(self, r"_module", mod) + object.__setattr__(self, "_module", mod) def __repr__(self): if self._module:
--- a/hgext/convert/common.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgext/convert/common.py Thu Nov 07 13:18:19 2019 -0500 @@ -493,7 +493,7 @@ # POSIX requires at least 4096 bytes for ARG_MAX argmax = 4096 try: - argmax = os.sysconf(r"SC_ARG_MAX") + argmax = os.sysconf("SC_ARG_MAX") except (AttributeError, ValueError): pass
--- a/hgext/convert/cvsps.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgext/convert/cvsps.py Thu Nov 07 13:18:19 2019 -0500 @@ -54,10 +54,8 @@ self.__dict__.update(entries) def __repr__(self): - items = ( - r"%s=%r" % (k, self.__dict__[k]) for k in sorted(self.__dict__) - ) - return r"%s(%s)" % (type(self).__name__, r", ".join(items)) + items = ("%s=%r" % (k, self.__dict__[k]) for k in sorted(self.__dict__)) + return "%s(%s)" % (type(self).__name__, ", ".join(items)) class logerror(Exception):
--- a/hgext/githelp.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgext/githelp.py Thu Nov 07 13:18:19 2019 -0500 @@ -90,7 +90,7 @@ args = fancyopts.fancyopts(list(args), cmdoptions, opts, True) break except getopt.GetoptError as ex: - if r"requires argument" in ex.msg: + if "requires argument" in ex.msg: raise if (r'--' + ex.opt) in ex.msg: flag = b'--' + pycompat.bytestr(ex.opt)
--- a/hgext/lfs/wireprotolfsserver.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgext/lfs/wireprotolfsserver.py Thu Nov 07 13:18:19 2019 -0500 @@ -249,7 +249,7 @@ if not exists: rsp[r'error'] = { r'code': 404, - r'message': r"The object does not exist", + r'message': "The object does not exist", } yield rsp continue @@ -257,7 +257,7 @@ elif not verifies: rsp[r'error'] = { r'code': 422, # XXX: is this the right code? - r'message': r"The object is corrupt", + r'message': "The object is corrupt", } yield rsp continue @@ -287,7 +287,7 @@ b'%s%s/.hg/lfs/objects/%s' % (req.baseurl, req.apppath, oid) ), # datetime.isoformat() doesn't include the 'Z' suffix - r"expires_at": expiresat.strftime(r'%Y-%m-%dT%H:%M:%SZ'), + "expires_at": expiresat.strftime(r'%Y-%m-%dT%H:%M:%SZ'), r'header': _buildheader(), } }
--- a/hgext/narrow/narrowwirepeer.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgext/narrow/narrowwirepeer.py Thu Nov 07 13:18:19 2019 -0500 @@ -33,8 +33,8 @@ # TODO: don't blindly add include/exclude wireproto # arguments to unbundle. include, exclude = repo.narrowpats - kwargs[r"includepats"] = b','.join(include) - kwargs[r"excludepats"] = b','.join(exclude) + kwargs["includepats"] = b','.join(include) + kwargs["excludepats"] = b','.join(exclude) return orig(cmd, *args, **kwargs) extensions.wrapfunction(peer, b'_calltwowaystream', wrapped)
--- a/hgext/record.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgext/record.py Thu Nov 07 13:18:19 2019 -0500 @@ -72,7 +72,7 @@ _(b'running non-interactively, use %s instead') % b'commit' ) - opts[r"interactive"] = True + opts["interactive"] = True overrides = {(b'experimental', b'crecord'): False} with ui.configoverride(overrides, b'record'): return commands.commit(ui, repo, *pats, **opts)
--- a/hgext/remotefilelog/shallowutil.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgext/remotefilelog/shallowutil.py Thu Nov 07 13:18:19 2019 -0500 @@ -260,9 +260,9 @@ # v0, str(int(size)) is the header size = int(header) except ValueError: - raise RuntimeError(r"unexpected remotefilelog header: illegal format") + raise RuntimeError("unexpected remotefilelog header: illegal format") if size is None: - raise RuntimeError(r"unexpected remotefilelog header: no size found") + raise RuntimeError("unexpected remotefilelog header: no size found") return index + 1, size, flags
--- a/hgext/zeroconf/__init__.py Thu Nov 07 03:59:22 2019 -0800 +++ b/hgext/zeroconf/__init__.py Thu Nov 07 13:18:19 2019 -0500 @@ -95,7 +95,7 @@ hostname = socket.gethostname().split(r'.')[0] host = hostname + r".local" - name = r"%s-%s" % (hostname, name) + name = "%s-%s" % (hostname, name) # advertise to browsers svc = Zeroconf.ServiceInfo( @@ -180,10 +180,10 @@ server.close() for value in l.found.values(): name = value.name[: value.name.index(b'.')] - url = r"http://%s:%s%s" % ( + url = "http://%s:%s%s" % ( socket.inet_ntoa(value.address), value.port, - value.properties.get(r"path", r"/"), + value.properties.get("path", "/"), ) yield b"zc-" + name, pycompat.bytestr(url)
--- a/mercurial/changegroup.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/changegroup.py Thu Nov 07 13:18:19 2019 -0500 @@ -85,7 +85,7 @@ fh = open(filename, b"wb", 131072) else: fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg") - fh = os.fdopen(fd, r"wb") + fh = os.fdopen(fd, "wb") cleanup = filename for c in chunks: fh.write(c)
--- a/mercurial/context.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/context.py Thu Nov 07 13:18:19 2019 -0500 @@ -71,7 +71,7 @@ __str__ = encoding.strmethod(__bytes__) def __repr__(self): - return r"<%s %s>" % (type(self).__name__, str(self)) + return "<%s %s>" % (type(self).__name__, str(self)) def __eq__(self, other): try: @@ -789,7 +789,7 @@ __str__ = encoding.strmethod(__bytes__) def __repr__(self): - return r"<%s %s>" % (type(self).__name__, str(self)) + return "<%s %s>" % (type(self).__name__, str(self)) def __hash__(self): try:
--- a/mercurial/debugcommands.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/debugcommands.py Thu Nov 07 13:18:19 2019 -0500 @@ -651,7 +651,7 @@ ) def debugdate(ui, date, range=None, **opts): """parse and display a date""" - if opts[r"extended"]: + if opts["extended"]: d = dateutil.parsedate(date, util.extendeddateformats) else: d = dateutil.parsedate(date) @@ -877,7 +877,7 @@ timestr = b'set ' else: timestr = time.strftime( - r"%Y-%m-%d %H:%M:%S ", time.localtime(ent[3]) + "%Y-%m-%d %H:%M:%S ", time.localtime(ent[3]) ) timestr = encoding.strtolocal(timestr) if ent[1] & 0o20000:
--- a/mercurial/dirstate.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/dirstate.py Thu Nov 07 13:18:19 2019 -0500 @@ -368,7 +368,7 @@ rereads the dirstate. Use localrepo.invalidatedirstate() if you want to check whether the dirstate has changed before rereading it.''' - for a in (r"_map", r"_branch", r"_ignore"): + for a in ("_map", "_branch", "_ignore"): if a in self.__dict__: delattr(self, a) self._lastnormaltime = 0 @@ -1399,9 +1399,9 @@ def addfile(self, f, oldstate, state, mode, size, mtime): """Add a tracked file to the dirstate.""" - if oldstate in b"?r" and r"_dirs" in self.__dict__: + if oldstate in b"?r" and "_dirs" in self.__dict__: self._dirs.addpath(f) - if oldstate == b"?" and r"_alldirs" in self.__dict__: + if oldstate == b"?" and "_alldirs" in self.__dict__: self._alldirs.addpath(f) self._map[f] = dirstatetuple(state, mode, size, mtime) if state != b'n' or mtime == -1: @@ -1417,11 +1417,11 @@ the file's previous state. In the future, we should refactor this to be more explicit about what that state is. """ - if oldstate not in b"?r" and r"_dirs" in self.__dict__: + if oldstate not in b"?r" and "_dirs" in self.__dict__: self._dirs.delpath(f) - if oldstate == b"?" and r"_alldirs" in self.__dict__: + if oldstate == b"?" and "_alldirs" in self.__dict__: self._alldirs.addpath(f) - if r"filefoldmap" in self.__dict__: + if "filefoldmap" in self.__dict__: normed = util.normcase(f) self.filefoldmap.pop(normed, None) self._map[f] = dirstatetuple(b'r', 0, size, 0) @@ -1434,11 +1434,11 @@ """ exists = self._map.pop(f, None) is not None if exists: - if oldstate != b"r" and r"_dirs" in self.__dict__: + if oldstate != b"r" and "_dirs" in self.__dict__: self._dirs.delpath(f) - if r"_alldirs" in self.__dict__: + if "_alldirs" in self.__dict__: self._alldirs.delpath(f) - if r"filefoldmap" in self.__dict__: + if "filefoldmap" in self.__dict__: normed = util.normcase(f) self.filefoldmap.pop(normed, None) self.nonnormalset.discard(f)
--- a/mercurial/encoding.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/encoding.py Thu Nov 07 13:18:19 2019 -0500 @@ -182,7 +182,7 @@ if encoding == b'UTF-8': # fast path return s - r = u.encode(_sysstr(encoding), r"replace") + r = u.encode(_sysstr(encoding), "replace") if u == r.decode(_sysstr(encoding)): # r is a safe, non-lossy encoding of s return safelocalstr(r) @@ -191,7 +191,7 @@ # we should only get here if we're looking at an ancient changeset try: u = s.decode(_sysstr(fallbackencoding)) - r = u.encode(_sysstr(encoding), r"replace") + r = u.encode(_sysstr(encoding), "replace") if u == r.decode(_sysstr(encoding)): # r is a safe, non-lossy encoding of s return safelocalstr(r) @@ -199,7 +199,7 @@ except UnicodeDecodeError: u = s.decode("utf-8", "replace") # last ditch # can't round-trip - return u.encode(_sysstr(encoding), r"replace") + return u.encode(_sysstr(encoding), "replace") except LookupError as k: raise error.Abort(k, hint=b"please check your locale settings")
--- a/mercurial/extensions.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/extensions.py Thu Nov 07 13:18:19 2019 -0500 @@ -591,9 +591,7 @@ break if currcls is object: - raise AttributeError( - r"type '%s' has no property '%s'" % (cls, propname) - ) + raise AttributeError("type '%s' has no property '%s'" % (cls, propname)) class wrappedfunction(object):
--- a/mercurial/filemerge.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/filemerge.py Thu Nov 07 13:18:19 2019 -0500 @@ -934,10 +934,10 @@ name = os.path.join(tmproot, pre) if ext: name += ext - f = open(name, r"wb") + f = open(name, "wb") else: fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext) - f = os.fdopen(fd, r"wb") + f = os.fdopen(fd, "wb") return f, name def tempfromcontext(prefix, ctx):
--- a/mercurial/hgweb/server.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/hgweb/server.py Thu Nov 07 13:18:19 2019 -0500 @@ -62,7 +62,7 @@ def writelines(self, seq): for msg in seq: - self.handler.log_error(r"HG error: %s", encoding.strfromlocal(msg)) + self.handler.log_error("HG error: %s", encoding.strfromlocal(msg)) class _httprequesthandler(httpservermod.basehttprequesthandler): @@ -128,20 +128,20 @@ isinstance(e, (OSError, socket.error)) and e.errno == errno.ECONNRESET ): - tb = r"".join(traceback.format_exception(*sys.exc_info())) + tb = "".join(traceback.format_exception(*sys.exc_info())) # We need a native-string newline to poke in the log # message, because we won't get a newline when using an # r-string. This is the easy way out. newline = chr(10) self.log_error( r"Exception happened during processing " - r"request '%s':%s%s", + "request '%s':%s%s", self.path, newline, tb, ) - self._start_response(r"500 Internal Server Error", []) + self._start_response("500 Internal Server Error", []) self._write(b"Internal Server Error") self._done() @@ -335,8 +335,8 @@ def setup(self): self.connection = self.request - self.rfile = self.request.makefile(r"rb", self.rbufsize) - self.wfile = self.request.makefile(r"wb", self.wbufsize) + self.rfile = self.request.makefile("rb", self.rbufsize) + self.wfile = self.request.makefile("wb", self.wbufsize) try:
--- a/mercurial/hgweb/wsgiheaders.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/hgweb/wsgiheaders.py Thu Nov 07 13:18:19 2019 -0500 @@ -129,7 +129,7 @@ return self._headers[:] def __repr__(self): - return r"%s(%r)" % (self.__class__.__name__, self._headers) + return "%s(%r)" % (self.__class__.__name__, self._headers) def __str__(self): """str() returns the formatted headers, complete with end line,
--- a/mercurial/hook.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/hook.py Thu Nov 07 13:18:19 2019 -0500 @@ -38,7 +38,7 @@ if callable(funcname): obj = funcname - funcname = pycompat.sysbytes(obj.__module__ + r"." + obj.__name__) + funcname = pycompat.sysbytes(obj.__module__ + "." + obj.__name__) else: d = funcname.rfind(b'.') if d == -1: @@ -61,7 +61,7 @@ e1 = sys.exc_info() try: # extensions are loaded with hgext_ prefix - obj = __import__(r"hgext_%s" % pycompat.sysstr(modname)) + obj = __import__("hgext_%s" % pycompat.sysstr(modname)) except (ImportError, SyntaxError): e2 = sys.exc_info() if ui.tracebackflag:
--- a/mercurial/httppeer.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/httppeer.py Thu Nov 07 13:18:19 2019 -0500 @@ -543,7 +543,7 @@ try: # dump bundle to disk fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg") - with os.fdopen(fd, r"wb") as fh: + with os.fdopen(fd, "wb") as fh: d = fp.read(4096) while d: fh.write(d)
--- a/mercurial/lock.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/lock.py Thu Nov 07 13:18:19 2019 -0500 @@ -238,7 +238,7 @@ def __del__(self): if self.held: warnings.warn( - r"use lock.release instead of del lock", + "use lock.release instead of del lock", category=DeprecationWarning, stacklevel=2, )
--- a/mercurial/lsprof.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/lsprof.py Thu Nov 07 13:18:19 2019 -0500 @@ -31,7 +31,7 @@ def __init__(self, data): self.data = data - def sort(self, crit=r"inlinetime"): + def sort(self, crit="inlinetime"): """XXX docstring""" # profiler_entries isn't defined when running under PyPy. if profiler_entry:
--- a/mercurial/patch.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/patch.py Thu Nov 07 13:18:19 2019 -0500 @@ -383,7 +383,7 @@ return self._ispatchinga(afile) and self._ispatchingb(bfile) def __repr__(self): - return r"<patchmeta %s %r>" % (self.op, self.path) + return "<patchmeta %s %r>" % (self.op, self.path) def readgitpatch(lr):
--- a/mercurial/policy.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/policy.py Thu Nov 07 13:18:19 2019 -0500 @@ -154,4 +154,4 @@ except AttributeError: if _isrustpermissive(): return default - raise ImportError(r"Cannot import name %s" % member) + raise ImportError("Cannot import name %s" % member)
--- a/mercurial/pure/osutil.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/pure/osutil.py Thu Nov 07 13:18:19 2019 -0500 @@ -257,7 +257,7 @@ creation = _OPEN_ALWAYS flags |= _O_APPEND else: - raise ValueError(r"invalid mode: %s" % pycompat.sysstr(mode)) + raise ValueError("invalid mode: %s" % pycompat.sysstr(mode)) fh = _kernel32.CreateFileA( name,
--- a/mercurial/pycompat.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/pycompat.py Thu Nov 07 13:18:19 2019 -0500 @@ -423,7 +423,7 @@ if isinstance(filename, str): return filename else: - raise TypeError(r"expect str, not %s" % type(filename).__name__) + raise TypeError("expect str, not %s" % type(filename).__name__) # In Python 2, fsdecode() has a very chance to receive bytes. So it's # better not to touch Python 2 part as it's already working fine.
--- a/mercurial/statprof.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/statprof.py Thu Nov 07 13:18:19 2019 -0500 @@ -126,20 +126,20 @@ __all__ = [b'start', b'stop', b'reset', b'display', b'profile'] skips = { - r"util.py:check", - r"extensions.py:closure", - r"color.py:colorcmd", - r"dispatch.py:checkargs", - r"dispatch.py:<lambda>", - r"dispatch.py:_runcatch", - r"dispatch.py:_dispatch", - r"dispatch.py:_runcommand", - r"pager.py:pagecmd", - r"dispatch.py:run", - r"dispatch.py:dispatch", - r"dispatch.py:runcommand", - r"hg.py:<module>", - r"evolve.py:warnobserrors", + "util.py:check", + "extensions.py:closure", + "color.py:colorcmd", + "dispatch.py:checkargs", + "dispatch.py:<lambda>", + "dispatch.py:_runcatch", + "dispatch.py:_dispatch", + "dispatch.py:_runcommand", + "pager.py:pagecmd", + "dispatch.py:run", + "dispatch.py:dispatch", + "dispatch.py:runcommand", + "hg.py:<module>", + "evolve.py:warnobserrors", } ########################################################################### @@ -1061,15 +1061,15 @@ displayargs[b'limit'] = 0.05 path = None for o, value in opts: - if o in (r"-l", r"--limit"): + if o in ("-l", "--limit"): displayargs[b'limit'] = float(value) - elif o in (r"-f", r"--file"): + elif o in ("-f", "--file"): path = value - elif o in (r"-o", r"--output-file"): + elif o in ("-o", "--output-file"): displayargs[b'outputfile'] = value - elif o in (r"-p", r"--script-path"): + elif o in ("-p", "--script-path"): displayargs[b'scriptpath'] = value - elif o in (r"-h", r"help"): + elif o in ("-h", "help"): printusage() return 0 else: @@ -1086,5 +1086,5 @@ return 0 -if __name__ == r"__main__": +if __name__ == "__main__": sys.exit(main())
--- a/mercurial/utils/procutil.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/utils/procutil.py Thu Nov 07 13:18:19 2019 -0500 @@ -263,7 +263,7 @@ return ( pycompat.safehasattr(sys, "frozen") or pycompat.safehasattr(sys, "importers") # new py2exe - or imp.is_frozen(r"__main__") # old py2exe + or imp.is_frozen("__main__") # old py2exe ) # tools/freeze
--- a/mercurial/win32.py Thu Nov 07 03:59:22 2019 -0800 +++ b/mercurial/win32.py Thu Nov 07 13:18:19 2019 -0500 @@ -167,39 +167,39 @@ # These structs are only complete enough to achieve what we need. class CERT_CHAIN_CONTEXT(ctypes.Structure): _fields_ = ( - (r"cbSize", _DWORD), + ("cbSize", _DWORD), # CERT_TRUST_STATUS struct - (r"dwErrorStatus", _DWORD), - (r"dwInfoStatus", _DWORD), - (r"cChain", _DWORD), - (r"rgpChain", ctypes.c_void_p), - (r"cLowerQualityChainContext", _DWORD), - (r"rgpLowerQualityChainContext", ctypes.c_void_p), - (r"fHasRevocationFreshnessTime", _BOOL), - (r"dwRevocationFreshnessTime", _DWORD), + ("dwErrorStatus", _DWORD), + ("dwInfoStatus", _DWORD), + ("cChain", _DWORD), + ("rgpChain", ctypes.c_void_p), + ("cLowerQualityChainContext", _DWORD), + ("rgpLowerQualityChainContext", ctypes.c_void_p), + ("fHasRevocationFreshnessTime", _BOOL), + ("dwRevocationFreshnessTime", _DWORD), ) class CERT_USAGE_MATCH(ctypes.Structure): _fields_ = ( - (r"dwType", _DWORD), + ("dwType", _DWORD), # CERT_ENHKEY_USAGE struct - (r"cUsageIdentifier", _DWORD), - (r"rgpszUsageIdentifier", ctypes.c_void_p), # LPSTR * + ("cUsageIdentifier", _DWORD), + ("rgpszUsageIdentifier", ctypes.c_void_p), # LPSTR * ) class CERT_CHAIN_PARA(ctypes.Structure): _fields_ = ( - (r"cbSize", _DWORD), - (r"RequestedUsage", CERT_USAGE_MATCH), - (r"RequestedIssuancePolicy", CERT_USAGE_MATCH), - (r"dwUrlRetrievalTimeout", _DWORD), - (r"fCheckRevocationFreshnessTime", _BOOL), - (r"dwRevocationFreshnessTime", _DWORD), - (r"pftCacheResync", ctypes.c_void_p), # LPFILETIME - (r"pStrongSignPara", ctypes.c_void_p), # PCCERT_STRONG_SIGN_PARA - (r"dwStrongSignFlags", _DWORD), + ("cbSize", _DWORD), + ("RequestedUsage", CERT_USAGE_MATCH), + ("RequestedIssuancePolicy", CERT_USAGE_MATCH), + ("dwUrlRetrievalTimeout", _DWORD), + ("fCheckRevocationFreshnessTime", _BOOL), + ("dwRevocationFreshnessTime", _DWORD), + ("pftCacheResync", ctypes.c_void_p), # LPFILETIME + ("pStrongSignPara", ctypes.c_void_p), # PCCERT_STRONG_SIGN_PARA + ("dwStrongSignFlags", _DWORD), ) @@ -732,7 +732,7 @@ if e.errno != errno.EEXIST: raise else: - raise IOError(errno.EEXIST, r"No usable temporary filename found") + raise IOError(errno.EEXIST, "No usable temporary filename found") try: os.unlink(temp)