##// END OF EJS Templates
cleanup: remove pointless r-prefixes on double-quoted strings...
Augie Fackler -
r43809:313e3a27 default
parent child Browse files
Show More
@@ -281,10 +281,10 b' for i in [0, 1]:'
281 for tp in testpats[i]:
281 for tp in testpats[i]:
282 p = tp[0]
282 p = tp[0]
283 m = tp[1]
283 m = tp[1]
284 if p.startswith(r'^'):
284 if p.startswith('^'):
285 p = r"^ [$>] (%s)" % p[1:]
285 p = "^ [$>] (%s)" % p[1:]
286 else:
286 else:
287 p = r"^ [$>] .*(%s)" % p
287 p = "^ [$>] .*(%s)" % p
288 utestpats[i].append((p, m) + tp[2:])
288 utestpats[i].append((p, m) + tp[2:])
289
289
290 # don't transform the following rules:
290 # don't transform the following rules:
@@ -1658,7 +1658,7 b' def perfstartup(ui, repo, **opts):'
1658 )
1658 )
1659 else:
1659 else:
1660 os.environ[r'HGRCPATH'] = r' '
1660 os.environ[r'HGRCPATH'] = r' '
1661 os.system(r"%s version -q > NUL" % sys.argv[0])
1661 os.system("%s version -q > NUL" % sys.argv[0])
1662
1662
1663 timer(d)
1663 timer(d)
1664 fm.end()
1664 fm.end()
@@ -22,7 +22,7 b' except ImportError:'
22 # available. Relax C module requirements.
22 # available. Relax C module requirements.
23 os.environ[r'HGMODULEPOLICY'] = r'allow'
23 os.environ[r'HGMODULEPOLICY'] = r'allow'
24 # import from the live mercurial repo
24 # import from the live mercurial repo
25 sys.path.insert(0, r"..")
25 sys.path.insert(0, "..")
26 from mercurial import demandimport
26 from mercurial import demandimport
27
27
28 demandimport.enable()
28 demandimport.enable()
@@ -70,9 +70,9 b' class _demandmod(object):'
70 head = name
70 head = name
71 after = []
71 after = []
72 object.__setattr__(
72 object.__setattr__(
73 self, r"_data", (head, globals, locals, after, level, set())
73 self, "_data", (head, globals, locals, after, level, set())
74 )
74 )
75 object.__setattr__(self, r"_module", None)
75 object.__setattr__(self, "_module", None)
76
76
77 def _extend(self, name):
77 def _extend(self, name):
78 """add to the list of submodules to load"""
78 """add to the list of submodules to load"""
@@ -143,7 +143,7 b' class _demandmod(object):'
143 if modref and getattr(modref, head, None) is self:
143 if modref and getattr(modref, head, None) is self:
144 setattr(modref, head, mod)
144 setattr(modref, head, mod)
145
145
146 object.__setattr__(self, r"_module", mod)
146 object.__setattr__(self, "_module", mod)
147
147
148 def __repr__(self):
148 def __repr__(self):
149 if self._module:
149 if self._module:
@@ -493,7 +493,7 b' class commandline(object):'
493 # POSIX requires at least 4096 bytes for ARG_MAX
493 # POSIX requires at least 4096 bytes for ARG_MAX
494 argmax = 4096
494 argmax = 4096
495 try:
495 try:
496 argmax = os.sysconf(r"SC_ARG_MAX")
496 argmax = os.sysconf("SC_ARG_MAX")
497 except (AttributeError, ValueError):
497 except (AttributeError, ValueError):
498 pass
498 pass
499
499
@@ -54,10 +54,8 b' class logentry(object):'
54 self.__dict__.update(entries)
54 self.__dict__.update(entries)
55
55
56 def __repr__(self):
56 def __repr__(self):
57 items = (
57 items = ("%s=%r" % (k, self.__dict__[k]) for k in sorted(self.__dict__))
58 r"%s=%r" % (k, self.__dict__[k]) for k in sorted(self.__dict__)
58 return "%s(%s)" % (type(self).__name__, ", ".join(items))
59 )
60 return r"%s(%s)" % (type(self).__name__, r", ".join(items))
61
59
62
60
63 class logerror(Exception):
61 class logerror(Exception):
@@ -90,7 +90,7 b' def parseoptions(ui, cmdoptions, args):'
90 args = fancyopts.fancyopts(list(args), cmdoptions, opts, True)
90 args = fancyopts.fancyopts(list(args), cmdoptions, opts, True)
91 break
91 break
92 except getopt.GetoptError as ex:
92 except getopt.GetoptError as ex:
93 if r"requires argument" in ex.msg:
93 if "requires argument" in ex.msg:
94 raise
94 raise
95 if (r'--' + ex.opt) in ex.msg:
95 if (r'--' + ex.opt) in ex.msg:
96 flag = b'--' + pycompat.bytestr(ex.opt)
96 flag = b'--' + pycompat.bytestr(ex.opt)
@@ -249,7 +249,7 b' def _batchresponseobjects(req, objects, '
249 if not exists:
249 if not exists:
250 rsp[r'error'] = {
250 rsp[r'error'] = {
251 r'code': 404,
251 r'code': 404,
252 r'message': r"The object does not exist",
252 r'message': "The object does not exist",
253 }
253 }
254 yield rsp
254 yield rsp
255 continue
255 continue
@@ -257,7 +257,7 b' def _batchresponseobjects(req, objects, '
257 elif not verifies:
257 elif not verifies:
258 rsp[r'error'] = {
258 rsp[r'error'] = {
259 r'code': 422, # XXX: is this the right code?
259 r'code': 422, # XXX: is this the right code?
260 r'message': r"The object is corrupt",
260 r'message': "The object is corrupt",
261 }
261 }
262 yield rsp
262 yield rsp
263 continue
263 continue
@@ -287,7 +287,7 b' def _batchresponseobjects(req, objects, '
287 b'%s%s/.hg/lfs/objects/%s' % (req.baseurl, req.apppath, oid)
287 b'%s%s/.hg/lfs/objects/%s' % (req.baseurl, req.apppath, oid)
288 ),
288 ),
289 # datetime.isoformat() doesn't include the 'Z' suffix
289 # datetime.isoformat() doesn't include the 'Z' suffix
290 r"expires_at": expiresat.strftime(r'%Y-%m-%dT%H:%M:%SZ'),
290 "expires_at": expiresat.strftime(r'%Y-%m-%dT%H:%M:%SZ'),
291 r'header': _buildheader(),
291 r'header': _buildheader(),
292 }
292 }
293 }
293 }
@@ -33,8 +33,8 b' def reposetup(repo):'
33 # TODO: don't blindly add include/exclude wireproto
33 # TODO: don't blindly add include/exclude wireproto
34 # arguments to unbundle.
34 # arguments to unbundle.
35 include, exclude = repo.narrowpats
35 include, exclude = repo.narrowpats
36 kwargs[r"includepats"] = b','.join(include)
36 kwargs["includepats"] = b','.join(include)
37 kwargs[r"excludepats"] = b','.join(exclude)
37 kwargs["excludepats"] = b','.join(exclude)
38 return orig(cmd, *args, **kwargs)
38 return orig(cmd, *args, **kwargs)
39
39
40 extensions.wrapfunction(peer, b'_calltwowaystream', wrapped)
40 extensions.wrapfunction(peer, b'_calltwowaystream', wrapped)
@@ -72,7 +72,7 b' def record(ui, repo, *pats, **opts):'
72 _(b'running non-interactively, use %s instead') % b'commit'
72 _(b'running non-interactively, use %s instead') % b'commit'
73 )
73 )
74
74
75 opts[r"interactive"] = True
75 opts["interactive"] = True
76 overrides = {(b'experimental', b'crecord'): False}
76 overrides = {(b'experimental', b'crecord'): False}
77 with ui.configoverride(overrides, b'record'):
77 with ui.configoverride(overrides, b'record'):
78 return commands.commit(ui, repo, *pats, **opts)
78 return commands.commit(ui, repo, *pats, **opts)
@@ -260,9 +260,9 b' def parsesizeflags(raw):'
260 # v0, str(int(size)) is the header
260 # v0, str(int(size)) is the header
261 size = int(header)
261 size = int(header)
262 except ValueError:
262 except ValueError:
263 raise RuntimeError(r"unexpected remotefilelog header: illegal format")
263 raise RuntimeError("unexpected remotefilelog header: illegal format")
264 if size is None:
264 if size is None:
265 raise RuntimeError(r"unexpected remotefilelog header: no size found")
265 raise RuntimeError("unexpected remotefilelog header: no size found")
266 return index + 1, size, flags
266 return index + 1, size, flags
267
267
268
268
@@ -95,7 +95,7 b' def publish(name, desc, path, port):'
95
95
96 hostname = socket.gethostname().split(r'.')[0]
96 hostname = socket.gethostname().split(r'.')[0]
97 host = hostname + r".local"
97 host = hostname + r".local"
98 name = r"%s-%s" % (hostname, name)
98 name = "%s-%s" % (hostname, name)
99
99
100 # advertise to browsers
100 # advertise to browsers
101 svc = Zeroconf.ServiceInfo(
101 svc = Zeroconf.ServiceInfo(
@@ -180,10 +180,10 b' def getzcpaths():'
180 server.close()
180 server.close()
181 for value in l.found.values():
181 for value in l.found.values():
182 name = value.name[: value.name.index(b'.')]
182 name = value.name[: value.name.index(b'.')]
183 url = r"http://%s:%s%s" % (
183 url = "http://%s:%s%s" % (
184 socket.inet_ntoa(value.address),
184 socket.inet_ntoa(value.address),
185 value.port,
185 value.port,
186 value.properties.get(r"path", r"/"),
186 value.properties.get("path", "/"),
187 )
187 )
188 yield b"zc-" + name, pycompat.bytestr(url)
188 yield b"zc-" + name, pycompat.bytestr(url)
189
189
@@ -85,7 +85,7 b' def writechunks(ui, chunks, filename, vf'
85 fh = open(filename, b"wb", 131072)
85 fh = open(filename, b"wb", 131072)
86 else:
86 else:
87 fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg")
87 fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg")
88 fh = os.fdopen(fd, r"wb")
88 fh = os.fdopen(fd, "wb")
89 cleanup = filename
89 cleanup = filename
90 for c in chunks:
90 for c in chunks:
91 fh.write(c)
91 fh.write(c)
@@ -71,7 +71,7 b' class basectx(object):'
71 __str__ = encoding.strmethod(__bytes__)
71 __str__ = encoding.strmethod(__bytes__)
72
72
73 def __repr__(self):
73 def __repr__(self):
74 return r"<%s %s>" % (type(self).__name__, str(self))
74 return "<%s %s>" % (type(self).__name__, str(self))
75
75
76 def __eq__(self, other):
76 def __eq__(self, other):
77 try:
77 try:
@@ -789,7 +789,7 b' class basefilectx(object):'
789 __str__ = encoding.strmethod(__bytes__)
789 __str__ = encoding.strmethod(__bytes__)
790
790
791 def __repr__(self):
791 def __repr__(self):
792 return r"<%s %s>" % (type(self).__name__, str(self))
792 return "<%s %s>" % (type(self).__name__, str(self))
793
793
794 def __hash__(self):
794 def __hash__(self):
795 try:
795 try:
@@ -651,7 +651,7 b' def debugdata(ui, repo, file_, rev=None,'
651 )
651 )
652 def debugdate(ui, date, range=None, **opts):
652 def debugdate(ui, date, range=None, **opts):
653 """parse and display a date"""
653 """parse and display a date"""
654 if opts[r"extended"]:
654 if opts["extended"]:
655 d = dateutil.parsedate(date, util.extendeddateformats)
655 d = dateutil.parsedate(date, util.extendeddateformats)
656 else:
656 else:
657 d = dateutil.parsedate(date)
657 d = dateutil.parsedate(date)
@@ -877,7 +877,7 b' def debugstate(ui, repo, **opts):'
877 timestr = b'set '
877 timestr = b'set '
878 else:
878 else:
879 timestr = time.strftime(
879 timestr = time.strftime(
880 r"%Y-%m-%d %H:%M:%S ", time.localtime(ent[3])
880 "%Y-%m-%d %H:%M:%S ", time.localtime(ent[3])
881 )
881 )
882 timestr = encoding.strtolocal(timestr)
882 timestr = encoding.strtolocal(timestr)
883 if ent[1] & 0o20000:
883 if ent[1] & 0o20000:
@@ -368,7 +368,7 b' class dirstate(object):'
368 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
368 rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
369 check whether the dirstate has changed before rereading it.'''
369 check whether the dirstate has changed before rereading it.'''
370
370
371 for a in (r"_map", r"_branch", r"_ignore"):
371 for a in ("_map", "_branch", "_ignore"):
372 if a in self.__dict__:
372 if a in self.__dict__:
373 delattr(self, a)
373 delattr(self, a)
374 self._lastnormaltime = 0
374 self._lastnormaltime = 0
@@ -1399,9 +1399,9 b' class dirstatemap(object):'
1399
1399
1400 def addfile(self, f, oldstate, state, mode, size, mtime):
1400 def addfile(self, f, oldstate, state, mode, size, mtime):
1401 """Add a tracked file to the dirstate."""
1401 """Add a tracked file to the dirstate."""
1402 if oldstate in b"?r" and r"_dirs" in self.__dict__:
1402 if oldstate in b"?r" and "_dirs" in self.__dict__:
1403 self._dirs.addpath(f)
1403 self._dirs.addpath(f)
1404 if oldstate == b"?" and r"_alldirs" in self.__dict__:
1404 if oldstate == b"?" and "_alldirs" in self.__dict__:
1405 self._alldirs.addpath(f)
1405 self._alldirs.addpath(f)
1406 self._map[f] = dirstatetuple(state, mode, size, mtime)
1406 self._map[f] = dirstatetuple(state, mode, size, mtime)
1407 if state != b'n' or mtime == -1:
1407 if state != b'n' or mtime == -1:
@@ -1417,11 +1417,11 b' class dirstatemap(object):'
1417 the file's previous state. In the future, we should refactor this
1417 the file's previous state. In the future, we should refactor this
1418 to be more explicit about what that state is.
1418 to be more explicit about what that state is.
1419 """
1419 """
1420 if oldstate not in b"?r" and r"_dirs" in self.__dict__:
1420 if oldstate not in b"?r" and "_dirs" in self.__dict__:
1421 self._dirs.delpath(f)
1421 self._dirs.delpath(f)
1422 if oldstate == b"?" and r"_alldirs" in self.__dict__:
1422 if oldstate == b"?" and "_alldirs" in self.__dict__:
1423 self._alldirs.addpath(f)
1423 self._alldirs.addpath(f)
1424 if r"filefoldmap" in self.__dict__:
1424 if "filefoldmap" in self.__dict__:
1425 normed = util.normcase(f)
1425 normed = util.normcase(f)
1426 self.filefoldmap.pop(normed, None)
1426 self.filefoldmap.pop(normed, None)
1427 self._map[f] = dirstatetuple(b'r', 0, size, 0)
1427 self._map[f] = dirstatetuple(b'r', 0, size, 0)
@@ -1434,11 +1434,11 b' class dirstatemap(object):'
1434 """
1434 """
1435 exists = self._map.pop(f, None) is not None
1435 exists = self._map.pop(f, None) is not None
1436 if exists:
1436 if exists:
1437 if oldstate != b"r" and r"_dirs" in self.__dict__:
1437 if oldstate != b"r" and "_dirs" in self.__dict__:
1438 self._dirs.delpath(f)
1438 self._dirs.delpath(f)
1439 if r"_alldirs" in self.__dict__:
1439 if "_alldirs" in self.__dict__:
1440 self._alldirs.delpath(f)
1440 self._alldirs.delpath(f)
1441 if r"filefoldmap" in self.__dict__:
1441 if "filefoldmap" in self.__dict__:
1442 normed = util.normcase(f)
1442 normed = util.normcase(f)
1443 self.filefoldmap.pop(normed, None)
1443 self.filefoldmap.pop(normed, None)
1444 self.nonnormalset.discard(f)
1444 self.nonnormalset.discard(f)
@@ -182,7 +182,7 b' def tolocal(s):'
182 if encoding == b'UTF-8':
182 if encoding == b'UTF-8':
183 # fast path
183 # fast path
184 return s
184 return s
185 r = u.encode(_sysstr(encoding), r"replace")
185 r = u.encode(_sysstr(encoding), "replace")
186 if u == r.decode(_sysstr(encoding)):
186 if u == r.decode(_sysstr(encoding)):
187 # r is a safe, non-lossy encoding of s
187 # r is a safe, non-lossy encoding of s
188 return safelocalstr(r)
188 return safelocalstr(r)
@@ -191,7 +191,7 b' def tolocal(s):'
191 # we should only get here if we're looking at an ancient changeset
191 # we should only get here if we're looking at an ancient changeset
192 try:
192 try:
193 u = s.decode(_sysstr(fallbackencoding))
193 u = s.decode(_sysstr(fallbackencoding))
194 r = u.encode(_sysstr(encoding), r"replace")
194 r = u.encode(_sysstr(encoding), "replace")
195 if u == r.decode(_sysstr(encoding)):
195 if u == r.decode(_sysstr(encoding)):
196 # r is a safe, non-lossy encoding of s
196 # r is a safe, non-lossy encoding of s
197 return safelocalstr(r)
197 return safelocalstr(r)
@@ -199,7 +199,7 b' def tolocal(s):'
199 except UnicodeDecodeError:
199 except UnicodeDecodeError:
200 u = s.decode("utf-8", "replace") # last ditch
200 u = s.decode("utf-8", "replace") # last ditch
201 # can't round-trip
201 # can't round-trip
202 return u.encode(_sysstr(encoding), r"replace")
202 return u.encode(_sysstr(encoding), "replace")
203 except LookupError as k:
203 except LookupError as k:
204 raise error.Abort(k, hint=b"please check your locale settings")
204 raise error.Abort(k, hint=b"please check your locale settings")
205
205
@@ -591,9 +591,7 b' def wrapfilecache(cls, propname, wrapper'
591 break
591 break
592
592
593 if currcls is object:
593 if currcls is object:
594 raise AttributeError(
594 raise AttributeError("type '%s' has no property '%s'" % (cls, propname))
595 r"type '%s' has no property '%s'" % (cls, propname)
596 )
597
595
598
596
599 class wrappedfunction(object):
597 class wrappedfunction(object):
@@ -934,10 +934,10 b' def _maketempfiles(repo, fco, fca, local'
934 name = os.path.join(tmproot, pre)
934 name = os.path.join(tmproot, pre)
935 if ext:
935 if ext:
936 name += ext
936 name += ext
937 f = open(name, r"wb")
937 f = open(name, "wb")
938 else:
938 else:
939 fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext)
939 fd, name = pycompat.mkstemp(prefix=pre + b'.', suffix=ext)
940 f = os.fdopen(fd, r"wb")
940 f = os.fdopen(fd, "wb")
941 return f, name
941 return f, name
942
942
943 def tempfromcontext(prefix, ctx):
943 def tempfromcontext(prefix, ctx):
@@ -62,7 +62,7 b' class _error_logger(object):'
62
62
63 def writelines(self, seq):
63 def writelines(self, seq):
64 for msg in seq:
64 for msg in seq:
65 self.handler.log_error(r"HG error: %s", encoding.strfromlocal(msg))
65 self.handler.log_error("HG error: %s", encoding.strfromlocal(msg))
66
66
67
67
68 class _httprequesthandler(httpservermod.basehttprequesthandler):
68 class _httprequesthandler(httpservermod.basehttprequesthandler):
@@ -128,20 +128,20 b' class _httprequesthandler(httpservermod.'
128 isinstance(e, (OSError, socket.error))
128 isinstance(e, (OSError, socket.error))
129 and e.errno == errno.ECONNRESET
129 and e.errno == errno.ECONNRESET
130 ):
130 ):
131 tb = r"".join(traceback.format_exception(*sys.exc_info()))
131 tb = "".join(traceback.format_exception(*sys.exc_info()))
132 # We need a native-string newline to poke in the log
132 # We need a native-string newline to poke in the log
133 # message, because we won't get a newline when using an
133 # message, because we won't get a newline when using an
134 # r-string. This is the easy way out.
134 # r-string. This is the easy way out.
135 newline = chr(10)
135 newline = chr(10)
136 self.log_error(
136 self.log_error(
137 r"Exception happened during processing "
137 r"Exception happened during processing "
138 r"request '%s':%s%s",
138 "request '%s':%s%s",
139 self.path,
139 self.path,
140 newline,
140 newline,
141 tb,
141 tb,
142 )
142 )
143
143
144 self._start_response(r"500 Internal Server Error", [])
144 self._start_response("500 Internal Server Error", [])
145 self._write(b"Internal Server Error")
145 self._write(b"Internal Server Error")
146 self._done()
146 self._done()
147
147
@@ -335,8 +335,8 b' class _httprequesthandlerssl(_httpreques'
335
335
336 def setup(self):
336 def setup(self):
337 self.connection = self.request
337 self.connection = self.request
338 self.rfile = self.request.makefile(r"rb", self.rbufsize)
338 self.rfile = self.request.makefile("rb", self.rbufsize)
339 self.wfile = self.request.makefile(r"wb", self.wbufsize)
339 self.wfile = self.request.makefile("wb", self.wbufsize)
340
340
341
341
342 try:
342 try:
@@ -129,7 +129,7 b' class Headers(object):'
129 return self._headers[:]
129 return self._headers[:]
130
130
131 def __repr__(self):
131 def __repr__(self):
132 return r"%s(%r)" % (self.__class__.__name__, self._headers)
132 return "%s(%r)" % (self.__class__.__name__, self._headers)
133
133
134 def __str__(self):
134 def __str__(self):
135 """str() returns the formatted headers, complete with end line,
135 """str() returns the formatted headers, complete with end line,
@@ -38,7 +38,7 b' def pythonhook(ui, repo, htype, hname, f'
38
38
39 if callable(funcname):
39 if callable(funcname):
40 obj = funcname
40 obj = funcname
41 funcname = pycompat.sysbytes(obj.__module__ + r"." + obj.__name__)
41 funcname = pycompat.sysbytes(obj.__module__ + "." + obj.__name__)
42 else:
42 else:
43 d = funcname.rfind(b'.')
43 d = funcname.rfind(b'.')
44 if d == -1:
44 if d == -1:
@@ -61,7 +61,7 b' def pythonhook(ui, repo, htype, hname, f'
61 e1 = sys.exc_info()
61 e1 = sys.exc_info()
62 try:
62 try:
63 # extensions are loaded with hgext_ prefix
63 # extensions are loaded with hgext_ prefix
64 obj = __import__(r"hgext_%s" % pycompat.sysstr(modname))
64 obj = __import__("hgext_%s" % pycompat.sysstr(modname))
65 except (ImportError, SyntaxError):
65 except (ImportError, SyntaxError):
66 e2 = sys.exc_info()
66 e2 = sys.exc_info()
67 if ui.tracebackflag:
67 if ui.tracebackflag:
@@ -543,7 +543,7 b' class httppeer(wireprotov1peer.wirepeer)'
543 try:
543 try:
544 # dump bundle to disk
544 # dump bundle to disk
545 fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg")
545 fd, filename = pycompat.mkstemp(prefix=b"hg-bundle-", suffix=b".hg")
546 with os.fdopen(fd, r"wb") as fh:
546 with os.fdopen(fd, "wb") as fh:
547 d = fp.read(4096)
547 d = fp.read(4096)
548 while d:
548 while d:
549 fh.write(d)
549 fh.write(d)
@@ -238,7 +238,7 b' class lock(object):'
238 def __del__(self):
238 def __del__(self):
239 if self.held:
239 if self.held:
240 warnings.warn(
240 warnings.warn(
241 r"use lock.release instead of del lock",
241 "use lock.release instead of del lock",
242 category=DeprecationWarning,
242 category=DeprecationWarning,
243 stacklevel=2,
243 stacklevel=2,
244 )
244 )
@@ -31,7 +31,7 b' class Stats(object):'
31 def __init__(self, data):
31 def __init__(self, data):
32 self.data = data
32 self.data = data
33
33
34 def sort(self, crit=r"inlinetime"):
34 def sort(self, crit="inlinetime"):
35 """XXX docstring"""
35 """XXX docstring"""
36 # profiler_entries isn't defined when running under PyPy.
36 # profiler_entries isn't defined when running under PyPy.
37 if profiler_entry:
37 if profiler_entry:
@@ -383,7 +383,7 b' class patchmeta(object):'
383 return self._ispatchinga(afile) and self._ispatchingb(bfile)
383 return self._ispatchinga(afile) and self._ispatchingb(bfile)
384
384
385 def __repr__(self):
385 def __repr__(self):
386 return r"<patchmeta %s %r>" % (self.op, self.path)
386 return "<patchmeta %s %r>" % (self.op, self.path)
387
387
388
388
389 def readgitpatch(lr):
389 def readgitpatch(lr):
@@ -154,4 +154,4 b' def importrust(modname, member=None, def'
154 except AttributeError:
154 except AttributeError:
155 if _isrustpermissive():
155 if _isrustpermissive():
156 return default
156 return default
157 raise ImportError(r"Cannot import name %s" % member)
157 raise ImportError("Cannot import name %s" % member)
@@ -257,7 +257,7 b' else:'
257 creation = _OPEN_ALWAYS
257 creation = _OPEN_ALWAYS
258 flags |= _O_APPEND
258 flags |= _O_APPEND
259 else:
259 else:
260 raise ValueError(r"invalid mode: %s" % pycompat.sysstr(mode))
260 raise ValueError("invalid mode: %s" % pycompat.sysstr(mode))
261
261
262 fh = _kernel32.CreateFileA(
262 fh = _kernel32.CreateFileA(
263 name,
263 name,
@@ -423,7 +423,7 b' else:'
423 if isinstance(filename, str):
423 if isinstance(filename, str):
424 return filename
424 return filename
425 else:
425 else:
426 raise TypeError(r"expect str, not %s" % type(filename).__name__)
426 raise TypeError("expect str, not %s" % type(filename).__name__)
427
427
428 # In Python 2, fsdecode() has a very chance to receive bytes. So it's
428 # In Python 2, fsdecode() has a very chance to receive bytes. So it's
429 # better not to touch Python 2 part as it's already working fine.
429 # better not to touch Python 2 part as it's already working fine.
@@ -126,20 +126,20 b' contextmanager = contextlib.contextmanag'
126 __all__ = [b'start', b'stop', b'reset', b'display', b'profile']
126 __all__ = [b'start', b'stop', b'reset', b'display', b'profile']
127
127
128 skips = {
128 skips = {
129 r"util.py:check",
129 "util.py:check",
130 r"extensions.py:closure",
130 "extensions.py:closure",
131 r"color.py:colorcmd",
131 "color.py:colorcmd",
132 r"dispatch.py:checkargs",
132 "dispatch.py:checkargs",
133 r"dispatch.py:<lambda>",
133 "dispatch.py:<lambda>",
134 r"dispatch.py:_runcatch",
134 "dispatch.py:_runcatch",
135 r"dispatch.py:_dispatch",
135 "dispatch.py:_dispatch",
136 r"dispatch.py:_runcommand",
136 "dispatch.py:_runcommand",
137 r"pager.py:pagecmd",
137 "pager.py:pagecmd",
138 r"dispatch.py:run",
138 "dispatch.py:run",
139 r"dispatch.py:dispatch",
139 "dispatch.py:dispatch",
140 r"dispatch.py:runcommand",
140 "dispatch.py:runcommand",
141 r"hg.py:<module>",
141 "hg.py:<module>",
142 r"evolve.py:warnobserrors",
142 "evolve.py:warnobserrors",
143 }
143 }
144
144
145 ###########################################################################
145 ###########################################################################
@@ -1061,15 +1061,15 b' def main(argv=None):'
1061 displayargs[b'limit'] = 0.05
1061 displayargs[b'limit'] = 0.05
1062 path = None
1062 path = None
1063 for o, value in opts:
1063 for o, value in opts:
1064 if o in (r"-l", r"--limit"):
1064 if o in ("-l", "--limit"):
1065 displayargs[b'limit'] = float(value)
1065 displayargs[b'limit'] = float(value)
1066 elif o in (r"-f", r"--file"):
1066 elif o in ("-f", "--file"):
1067 path = value
1067 path = value
1068 elif o in (r"-o", r"--output-file"):
1068 elif o in ("-o", "--output-file"):
1069 displayargs[b'outputfile'] = value
1069 displayargs[b'outputfile'] = value
1070 elif o in (r"-p", r"--script-path"):
1070 elif o in ("-p", "--script-path"):
1071 displayargs[b'scriptpath'] = value
1071 displayargs[b'scriptpath'] = value
1072 elif o in (r"-h", r"help"):
1072 elif o in ("-h", "help"):
1073 printusage()
1073 printusage()
1074 return 0
1074 return 0
1075 else:
1075 else:
@@ -1086,5 +1086,5 b' def main(argv=None):'
1086 return 0
1086 return 0
1087
1087
1088
1088
1089 if __name__ == r"__main__":
1089 if __name__ == "__main__":
1090 sys.exit(main())
1090 sys.exit(main())
@@ -263,7 +263,7 b' def mainfrozen():'
263 return (
263 return (
264 pycompat.safehasattr(sys, "frozen")
264 pycompat.safehasattr(sys, "frozen")
265 or pycompat.safehasattr(sys, "importers") # new py2exe
265 or pycompat.safehasattr(sys, "importers") # new py2exe
266 or imp.is_frozen(r"__main__") # old py2exe
266 or imp.is_frozen("__main__") # old py2exe
267 ) # tools/freeze
267 ) # tools/freeze
268
268
269
269
@@ -167,39 +167,39 b' PKCS_7_ASN_ENCODING = 0x00010000'
167 # These structs are only complete enough to achieve what we need.
167 # These structs are only complete enough to achieve what we need.
168 class CERT_CHAIN_CONTEXT(ctypes.Structure):
168 class CERT_CHAIN_CONTEXT(ctypes.Structure):
169 _fields_ = (
169 _fields_ = (
170 (r"cbSize", _DWORD),
170 ("cbSize", _DWORD),
171 # CERT_TRUST_STATUS struct
171 # CERT_TRUST_STATUS struct
172 (r"dwErrorStatus", _DWORD),
172 ("dwErrorStatus", _DWORD),
173 (r"dwInfoStatus", _DWORD),
173 ("dwInfoStatus", _DWORD),
174 (r"cChain", _DWORD),
174 ("cChain", _DWORD),
175 (r"rgpChain", ctypes.c_void_p),
175 ("rgpChain", ctypes.c_void_p),
176 (r"cLowerQualityChainContext", _DWORD),
176 ("cLowerQualityChainContext", _DWORD),
177 (r"rgpLowerQualityChainContext", ctypes.c_void_p),
177 ("rgpLowerQualityChainContext", ctypes.c_void_p),
178 (r"fHasRevocationFreshnessTime", _BOOL),
178 ("fHasRevocationFreshnessTime", _BOOL),
179 (r"dwRevocationFreshnessTime", _DWORD),
179 ("dwRevocationFreshnessTime", _DWORD),
180 )
180 )
181
181
182
182
183 class CERT_USAGE_MATCH(ctypes.Structure):
183 class CERT_USAGE_MATCH(ctypes.Structure):
184 _fields_ = (
184 _fields_ = (
185 (r"dwType", _DWORD),
185 ("dwType", _DWORD),
186 # CERT_ENHKEY_USAGE struct
186 # CERT_ENHKEY_USAGE struct
187 (r"cUsageIdentifier", _DWORD),
187 ("cUsageIdentifier", _DWORD),
188 (r"rgpszUsageIdentifier", ctypes.c_void_p), # LPSTR *
188 ("rgpszUsageIdentifier", ctypes.c_void_p), # LPSTR *
189 )
189 )
190
190
191
191
192 class CERT_CHAIN_PARA(ctypes.Structure):
192 class CERT_CHAIN_PARA(ctypes.Structure):
193 _fields_ = (
193 _fields_ = (
194 (r"cbSize", _DWORD),
194 ("cbSize", _DWORD),
195 (r"RequestedUsage", CERT_USAGE_MATCH),
195 ("RequestedUsage", CERT_USAGE_MATCH),
196 (r"RequestedIssuancePolicy", CERT_USAGE_MATCH),
196 ("RequestedIssuancePolicy", CERT_USAGE_MATCH),
197 (r"dwUrlRetrievalTimeout", _DWORD),
197 ("dwUrlRetrievalTimeout", _DWORD),
198 (r"fCheckRevocationFreshnessTime", _BOOL),
198 ("fCheckRevocationFreshnessTime", _BOOL),
199 (r"dwRevocationFreshnessTime", _DWORD),
199 ("dwRevocationFreshnessTime", _DWORD),
200 (r"pftCacheResync", ctypes.c_void_p), # LPFILETIME
200 ("pftCacheResync", ctypes.c_void_p), # LPFILETIME
201 (r"pStrongSignPara", ctypes.c_void_p), # PCCERT_STRONG_SIGN_PARA
201 ("pStrongSignPara", ctypes.c_void_p), # PCCERT_STRONG_SIGN_PARA
202 (r"dwStrongSignFlags", _DWORD),
202 ("dwStrongSignFlags", _DWORD),
203 )
203 )
204
204
205
205
@@ -732,7 +732,7 b' def unlink(f):'
732 if e.errno != errno.EEXIST:
732 if e.errno != errno.EEXIST:
733 raise
733 raise
734 else:
734 else:
735 raise IOError(errno.EEXIST, r"No usable temporary filename found")
735 raise IOError(errno.EEXIST, "No usable temporary filename found")
736
736
737 try:
737 try:
738 os.unlink(temp)
738 os.unlink(temp)
General Comments 0
You need to be logged in to leave comments. Login now