diff --git a/contrib/debugshell.py b/contrib/debugshell.py --- a/contrib/debugshell.py +++ b/contrib/debugshell.py @@ -34,9 +34,9 @@ @command('debugshell|dbsh', []) def debugshell(ui, repo, **opts): - bannermsg = "loaded repo : %s\n" \ - "using source: %s" % (repo.root, - mercurial.__path__[0]) + bannermsg = ("loaded repo : %s\n" + "using source: %s" % (repo.root, + mercurial.__path__[0])) pdbmap = { 'pdb' : 'code', diff --git a/contrib/packaging/hg-docker b/contrib/packaging/hg-docker --- a/contrib/packaging/hg-docker +++ b/contrib/packaging/hg-docker @@ -76,7 +76,7 @@ p.communicate(input=dockerfile) if p.returncode: raise subprocess.CalledProcessException( - p.returncode, 'failed to build docker image: %s %s' \ + p.returncode, 'failed to build docker image: %s %s' % (p.stdout, p.stderr)) def command_build(args): diff --git a/hgext/acl.py b/hgext/acl.py --- a/hgext/acl.py +++ b/hgext/acl.py @@ -293,15 +293,15 @@ # if ug is a user name: !username # if ug is a group name: !@groupname ug = ug[1:] - if not ug.startswith('@') and user != ug \ - or ug.startswith('@') and user not in _getusers(ui, ug[1:]): + if (not ug.startswith('@') and user != ug + or ug.startswith('@') and user not in _getusers(ui, ug[1:])): return True # Test for user or group. Format: # if ug is a user name: username # if ug is a group name: @groupname - elif user == ug \ - or ug.startswith('@') and user in _getusers(ui, ug[1:]): + elif (user == ug + or ug.startswith('@') and user in _getusers(ui, ug[1:])): return True return False diff --git a/hgext/bugzilla.py b/hgext/bugzilla.py --- a/hgext/bugzilla.py +++ b/hgext/bugzilla.py @@ -600,8 +600,8 @@ def __init__(self, ui): bzmysql.__init__(self, ui) - self.default_notify = \ - "cd %(bzdir)s && perl -T contrib/sendbugmail.pl %(id)s %(user)s" + self.default_notify = ( + "cd %(bzdir)s && perl -T contrib/sendbugmail.pl %(id)s %(user)s") class bzmysql_3_0(bzmysql_2_18): '''support for bugzilla 3.0 series.''' diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -776,8 +776,8 @@ # Ensure no changeset has a synthetic changeset as a parent. while p.synthetic: - assert len(p.parents) <= 1, \ - _('synthetic changeset cannot have multiple parents') + assert len(p.parents) <= 1, ( + _('synthetic changeset cannot have multiple parents')) if p.parents: p = p.parents[0] else: @@ -954,12 +954,12 @@ # have we seen the start tag? if revisions and off: - if revisions[0] == (b"%d" % cs.id) or \ - revisions[0] in cs.tags: + if (revisions[0] == (b"%d" % cs.id) or + revisions[0] in cs.tags): off = False # see if we reached the end tag if len(revisions) > 1 and not off: - if revisions[1] == (b"%d" % cs.id) or \ - revisions[1] in cs.tags: + if (revisions[1] == (b"%d" % cs.id) or + revisions[1] in cs.tags): break diff --git a/hgext/convert/git.py b/hgext/convert/git.py --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -387,7 +387,7 @@ def numcommits(self): output, ret = self.gitrunlines('rev-list', '--all') if ret: - raise error.Abort(_('cannot retrieve number of commits in %s') \ + raise error.Abort(_('cannot retrieve number of commits in %s') % self.path) return len(output) diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py --- a/hgext/convert/p4.py +++ b/hgext/convert/p4.py @@ -198,8 +198,8 @@ for filename in copiedfiles: oldname = depotname[filename] - flcmd = 'p4 -G filelog %s' \ - % procutil.shellquote(oldname) + flcmd = ('p4 -G filelog %s' + % procutil.shellquote(oldname)) flstdout = procutil.popen(flcmd, mode='rb') copiedfilename = None @@ -272,8 +272,8 @@ return self.heads def getfile(self, name, rev): - cmd = 'p4 -G print %s' \ - % procutil.shellquote("%s#%s" % (self.depotname[name], rev)) + cmd = ('p4 -G print %s' + % procutil.shellquote("%s#%s" % (self.depotname[name], rev))) lasterror = None while True: diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -790,7 +790,7 @@ if childpath: removed.add(self.recode(childpath)) else: - self.ui.debug('unknown path in revision %d: %s\n' % \ + self.ui.debug('unknown path in revision %d: %s\n' % (revnum, path)) elif kind == svn.core.svn_node_dir: if ent.action == 'M': diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -1782,7 +1782,7 @@ state.write(tr=tr) actobj = state.actions[0] progress.increment(item=actobj.torule()) - ui.debug('histedit: processing %s %s\n' % (actobj.verb,\ + ui.debug('histedit: processing %s %s\n' % (actobj.verb, actobj.torule())) parentctx, replacement_ = actobj.run() state.parentctxnode = parentctx.node() @@ -1881,7 +1881,7 @@ else: rules = _readfile(ui, rules) actions = parserules(rules, state) - ctxs = [repo[act.node] \ + ctxs = [repo[act.node] for act in state.actions if act.node] warnverifyactions(ui, repo, actions, state, ctxs) state.actions = actions diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -282,8 +282,8 @@ scratchbranchpat = ui.config('infinitepush', 'branchpattern') if scratchbranchpat: global _scratchbranchmatcher - kind, pat, _scratchbranchmatcher = \ - stringutil.stringmatcher(scratchbranchpat) + kind, pat, _scratchbranchmatcher = ( + stringutil.stringmatcher(scratchbranchpat)) def serverextsetup(ui): origpushkeyhandler = bundle2.parthandlermapping['pushkey'] @@ -294,8 +294,8 @@ bundle2.parthandlermapping['pushkey'] = newpushkeyhandler orighandlephasehandler = bundle2.parthandlermapping['phase-heads'] - newphaseheadshandler = lambda *args, **kwargs: \ - bundle2handlephases(orighandlephasehandler, *args, **kwargs) + newphaseheadshandler = lambda *args, **kwargs: bundle2handlephases( + orighandlephasehandler, *args, **kwargs) newphaseheadshandler.params = orighandlephasehandler.params bundle2.parthandlermapping['phase-heads'] = newphaseheadshandler @@ -754,10 +754,10 @@ nametype_idx = 1 remote_idx = 2 name_idx = 3 - remotenames = [remotename for remotename in \ - remotenamesext.readremotenames(repo) \ + remotenames = [remotename for remotename in + remotenamesext.readremotenames(repo) if remotename[remote_idx] == path] - remote_bm_names = [remotename[name_idx] for remotename in \ + remote_bm_names = [remotename[name_idx] for remotename in remotenames if remotename[nametype_idx] == "bookmarks"] for name in names: diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -76,8 +76,8 @@ if path: return path if pycompat.iswindows: - appdata = encoding.environ.get('LOCALAPPDATA',\ - encoding.environ.get('APPDATA')) + appdata = encoding.environ.get('LOCALAPPDATA', + encoding.environ.get('APPDATA')) if appdata: return os.path.join(appdata, name) elif pycompat.isdarwin: diff --git a/hgext/largefiles/reposetup.py b/hgext/largefiles/reposetup.py --- a/hgext/largefiles/reposetup.py +++ b/hgext/largefiles/reposetup.py @@ -174,8 +174,8 @@ if standin not in ctx1: # from second parent modified.append(lfile) - elif lfutil.readasstandin(ctx1[standin]) \ - != lfutil.hashfile(self.wjoin(lfile)): + elif (lfutil.readasstandin(ctx1[standin]) + != lfutil.hashfile(self.wjoin(lfile))): modified.append(lfile) else: if listclean: diff --git a/hgext/record.py b/hgext/record.py --- a/hgext/record.py +++ b/hgext/record.py @@ -134,12 +134,12 @@ except KeyError: return - cmdtable["qrecord"] = \ - (qrecord, - # same options as qnew, but copy them so we don't get - # -i/--interactive for qrecord and add white space diff options - mq.cmdtable['qnew'][1][:] + cmdutil.diffwsopts, - _('hg qrecord [OPTION]... PATCH [FILE]...')) + cmdtable["qrecord"] = ( + qrecord, + # same options as qnew, but copy them so we don't get + # -i/--interactive for qrecord and add white space diff options + mq.cmdtable['qnew'][1][:] + cmdutil.diffwsopts, + _('hg qrecord [OPTION]... PATCH [FILE]...')) _wrapcmd('qnew', mq.cmdtable, qnew, _("interactively record a new patch")) _wrapcmd('qrefresh', mq.cmdtable, qrefresh, diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -107,8 +107,9 @@ "releasenotes is disabled\n")) for section in other: - existingnotes = converttitled(self.titledforsection(section)) + \ - convertnontitled(self.nontitledforsection(section)) + existingnotes = ( + converttitled(self.titledforsection(section)) + + convertnontitled(self.nontitledforsection(section))) for title, paragraphs in other.titledforsection(section): if self.hastitledinsection(section, title): # TODO prompt for resolution if different and running in diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py --- a/hgext/remotefilelog/fileserverclient.py +++ b/hgext/remotefilelog/fileserverclient.py @@ -138,8 +138,8 @@ def connect(self, cachecommand): if self.pipeo: raise error.Abort(_("cache connection already open")) - self.pipei, self.pipeo, self.pipee, self.subprocess = \ - procutil.popen4(cachecommand) + self.pipei, self.pipeo, self.pipee, self.subprocess = ( + procutil.popen4(cachecommand)) self.connected = True def close(self): diff --git a/hgext/shelve.py b/hgext/shelve.py --- a/hgext/shelve.py +++ b/hgext/shelve.py @@ -248,8 +248,8 @@ if version < cls._version: d = cls._readold(repo) elif version == cls._version: - d = scmutil.simplekeyvaluefile(repo.vfs, cls._filename)\ - .read(firstlinenonkeyval=True) + d = scmutil.simplekeyvaluefile( + repo.vfs, cls._filename).read(firstlinenonkeyval=True) else: raise error.Abort(_('this version of shelve is incompatible ' 'with the version used in this repo')) @@ -287,8 +287,9 @@ "keep": cls._keep if keep else cls._nokeep, "activebook": activebook or cls._noactivebook } - scmutil.simplekeyvaluefile(repo.vfs, cls._filename)\ - .write(info, firstline=("%d" % cls._version)) + scmutil.simplekeyvaluefile( + repo.vfs, cls._filename).write(info, + firstline=("%d" % cls._version)) @classmethod def clear(cls, repo): diff --git a/i18n/posplit b/i18n/posplit --- a/i18n/posplit +++ b/i18n/posplit @@ -77,7 +77,7 @@ continue else: # lines following directly, unexpected - print('Warning: text follows line with directive' \ + print('Warning: text follows line with directive' ' %s' % directive) comment = 'do not translate: .. %s::' % directive if not newentry.comment: diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -229,7 +229,7 @@ - True when cache is up to date or a subset of current repo.""" try: return ((self.tipnode == repo.changelog.node(self.tiprev)) - and (self.filteredhash == \ + and (self.filteredhash == scmutil.filteredhash(repo, self.tiprev))) except IndexError: return False diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -1397,8 +1397,8 @@ assert chunknum == 0, 'Must start with chunk 0' self._chunkindex.append((0, self._tellfp())) else: - assert chunknum < len(self._chunkindex), \ - 'Unknown chunk %d' % chunknum + assert chunknum < len(self._chunkindex), ( + 'Unknown chunk %d' % chunknum) self._seekfp(self._chunkindex[chunknum][1]) pos = self._chunkindex[chunknum][0] diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -179,8 +179,8 @@ def newandmodified(chunks, originalchunks): newlyaddedandmodifiedfiles = set() for chunk in chunks: - if ishunk(chunk) and chunk.header.isnewfile() and chunk not in \ - originalchunks: + if (ishunk(chunk) and chunk.header.isnewfile() and chunk not in + originalchunks): newlyaddedandmodifiedfiles.add(chunk.header.filename()) return newlyaddedandmodifiedfiles @@ -322,8 +322,8 @@ if backupall: tobackup = changed else: - tobackup = [f for f in newfiles if f in modified or f in \ - newlyaddedandmodifiedfiles] + tobackup = [f for f in newfiles if f in modified or f in + newlyaddedandmodifiedfiles] backups = {} if tobackup: backupdir = repo.vfs.join('record-backups') diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1676,8 +1676,8 @@ if not bheads: raise error.Abort(_('can only close branch heads')) elif opts.get('amend'): - if repo['.'].p1().branch() != branch and \ - repo['.'].p2().branch() != branch: + if (repo['.'].p1().branch() != branch and + repo['.'].p2().branch() != branch): raise error.Abort(_('can only close branch heads')) if opts.get('amend'): @@ -4822,8 +4822,8 @@ opts = pycompat.byteskwargs(opts) confirm = ui.configbool('commands', 'resolve.confirm') flaglist = 'all mark unmark list no_status re_merge'.split() - all, mark, unmark, show, nostatus, remerge = \ - [opts.get(o) for o in flaglist] + all, mark, unmark, show, nostatus, remerge = [ + opts.get(o) for o in flaglist] actioncount = len(list(filter(None, [show, mark, unmark, remerge]))) if actioncount > 1: @@ -4952,8 +4952,8 @@ if mark: if markcheck: fdata = repo.wvfs.tryread(f) - if filemerge.hasconflictmarkers(fdata) and \ - ms[f] != mergemod.MERGE_RECORD_RESOLVED: + if (filemerge.hasconflictmarkers(fdata) and + ms[f] != mergemod.MERGE_RECORD_RESOLVED): hasconflictmarkers.append(f) ms.mark(f, mergemod.MERGE_RECORD_RESOLVED) elif unmark: diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -983,9 +983,9 @@ assert (changeid is not None or fileid is not None - or changectx is not None), \ - ("bad args: changeid=%r, fileid=%r, changectx=%r" - % (changeid, fileid, changectx)) + or changectx is not None), ( + "bad args: changeid=%r, fileid=%r, changectx=%r" + % (changeid, fileid, changectx)) if filelog is not None: self._filelog = filelog diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -1442,8 +1442,8 @@ if host == socket.gethostname(): locker = 'user %s, process %s' % (user or b'None', pid) else: - locker = 'user %s, process %s, host %s' \ - % (user or b'None', pid, host) + locker = ('user %s, process %s, host %s' + % (user or b'None', pid, host)) ui.write(("%-6s %s (%ds)\n") % (name + ":", locker, age)) return 1 except OSError as e: diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -2547,8 +2547,8 @@ return True # Stream clone v2 - if (bundlespec.wirecompression == 'UN' and \ - bundlespec.wireversion == '02' and \ + if (bundlespec.wirecompression == 'UN' and + bundlespec.wireversion == '02' and bundlespec.contentopts.get('streamv2')): return True diff --git a/mercurial/httpconnection.py b/mercurial/httpconnection.py --- a/mercurial/httpconnection.py +++ b/mercurial/httpconnection.py @@ -109,10 +109,10 @@ schemes, prefix = [p[0]], p[1] else: schemes = (auth.get('schemes') or 'https').split() - if (prefix == '*' or hostpath.startswith(prefix)) and \ - (len(prefix) > bestlen or (len(prefix) == bestlen and \ - not bestuser and 'username' in auth)) \ - and scheme in schemes: + if ((prefix == '*' or hostpath.startswith(prefix)) and + (len(prefix) > bestlen or (len(prefix) == bestlen and + not bestuser and 'username' in auth)) + and scheme in schemes): bestlen = len(prefix) bestauth = group, auth bestuser = auth.get('username') diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -391,9 +391,9 @@ """ # Check local variables before looking at filesystem for performance # reasons. - return bool(self._local) or bool(self._state) or \ - self._repo.vfs.exists(self.statepathv1) or \ - self._repo.vfs.exists(self.statepathv2) + return (bool(self._local) or bool(self._state) or + self._repo.vfs.exists(self.statepathv1) or + self._repo.vfs.exists(self.statepathv2)) def commit(self): """Write current state on disk (if necessary)""" diff --git a/mercurial/minirst.py b/mercurial/minirst.py --- a/mercurial/minirst.py +++ b/mercurial/minirst.py @@ -114,9 +114,9 @@ # Partially minimized form: remove space and both # colons. blocks[i]['lines'][-1] = blocks[i]['lines'][-1][:-3] - elif len(blocks[i]['lines']) == 1 and \ - blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and \ - blocks[i]['lines'][0].find(' ', 3) == -1: + elif (len(blocks[i]['lines']) == 1 and + blocks[i]['lines'][0].lstrip(' ').startswith('.. ') and + blocks[i]['lines'][0].find(' ', 3) == -1): # directive on its own line, not a literal block i += 1 continue @@ -790,8 +790,8 @@ if section['type'] != 'margin': sindent = section['indent'] if len(section['lines']) > 1: - sindent += len(section['lines'][1]) - \ - len(section['lines'][1].lstrip(' ')) + sindent += (len(section['lines'][1]) - + len(section['lines'][1].lstrip(' '))) if bindent >= sindent: break pointer += 1 diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -925,8 +925,8 @@ # if they have some content as we want to be able to change it nocontent = len(self.header) == 2 emptynewfile = self.isnewfile() and nocontent - return emptynewfile or \ - any(self.special_re.match(h) for h in self.header) + return (emptynewfile + or any(self.special_re.match(h) for h in self.header)) class recordhunk(object): """patch hunk @@ -2283,8 +2283,8 @@ # If the file has been removed, fctx2 is None; but this should # not occur here since we catch removed files early in # logcmdutil.getlinerangerevs() for 'hg log -L'. - assert fctx2 is not None, \ - 'fctx2 unexpectly None in diff hunks filtering' + assert fctx2 is not None, ( + 'fctx2 unexpectly None in diff hunks filtering') hunks = hunksfilterfn(fctx2, hunks) text = ''.join(sum((list(hlines) for hrange, hlines in hunks), [])) if hdr and (text or len(hdr) > 1): diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py --- a/mercurial/simplemerge.py +++ b/mercurial/simplemerge.py @@ -289,15 +289,15 @@ # find matches at the front ii = 0 - while ii < alen and ii < blen and \ - self.a[a1 + ii] == self.b[b1 + ii]: + while (ii < alen and ii < blen and + self.a[a1 + ii] == self.b[b1 + ii]): ii += 1 startmatches = ii # find matches at the end ii = 0 - while ii < alen and ii < blen and \ - self.a[a2 - ii - 1] == self.b[b2 - ii - 1]: + while (ii < alen and ii < blen and + self.a[a2 - ii - 1] == self.b[b2 - ii - 1]): ii += 1 endmatches = ii @@ -350,8 +350,8 @@ aend = asub + intlen bend = bsub + intlen - assert self.base[intbase:intend] == self.a[asub:aend], \ - (self.base[intbase:intend], self.a[asub:aend]) + assert self.base[intbase:intend] == self.a[asub:aend], ( + (self.base[intbase:intend], self.a[asub:aend])) assert self.base[intbase:intend] == self.b[bsub:bend] diff --git a/mercurial/sparse.py b/mercurial/sparse.py --- a/mercurial/sparse.py +++ b/mercurial/sparse.py @@ -643,8 +643,8 @@ for kindpat in pats: kind, pat = matchmod._patsplit(kindpat, None) if kind in matchmod.cwdrelativepatternkinds or kind is None: - ap = (kind + ':' if kind else '') +\ - pathutil.canonpath(root, cwd, pat) + ap = ((kind + ':' if kind else '') + + pathutil.canonpath(root, cwd, pat)) abspats.append(ap) else: abspats.append(kindpat) diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -369,8 +369,8 @@ return 1 def revert(self, substate, *pats, **opts): - self.ui.warn(_('%s: reverting %s subrepos is unsupported\n') \ - % (substate[0], substate[2])) + self.ui.warn(_('%s: reverting %s subrepos is unsupported\n') + % (substate[0], substate[2])) return [] def shortid(self, revid): @@ -697,7 +697,7 @@ ctx = urepo[revision] if ctx.hidden(): urepo.ui.warn( - _('revision %s in subrepository "%s" is hidden\n') \ + _('revision %s in subrepository "%s" is hidden\n') % (revision[0:12], self._path)) repo = urepo hg.updaterepo(repo, revision, overwrite) @@ -1787,8 +1787,8 @@ cmd.append('--ignore-all-space') if diffopts.ignorewsamount: cmd.append('--ignore-space-change') - if self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) \ - and diffopts.ignoreblanklines: + if (self._gitversion(self._gitcommand(['--version'])) >= (1, 8, 4) + and diffopts.ignoreblanklines): cmd.append('--ignore-blank-lines') cmd.append(node1) diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -188,8 +188,8 @@ return alltags for head in reversed(heads): # oldest to newest - assert head in repo.changelog.nodemap, \ - "tag cache returned bogus head %s" % short(head) + assert head in repo.changelog.nodemap, ( + "tag cache returned bogus head %s" % short(head)) fnodes = _filterfnodes(tagfnode, reversed(heads)) alltags = _tagsfromfnodes(ui, repo, fnodes) diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -344,8 +344,8 @@ try: yield finally: - self._blockedtimes[key + '_blocked'] += \ - (util.timer() - starttime) * 1000 + self._blockedtimes[key + '_blocked'] += ( + (util.timer() - starttime) * 1000) @contextlib.contextmanager def uninterruptible(self): @@ -1027,8 +1027,8 @@ except IOError as err: raise error.StdioError(err) finally: - self._blockedtimes['stdio_blocked'] += \ - (util.timer() - starttime) * 1000 + self._blockedtimes['stdio_blocked'] += ( + (util.timer() - starttime) * 1000) def write_err(self, *args, **opts): self._write(self._ferr, *args, **opts) @@ -1078,8 +1078,8 @@ return raise error.StdioError(err) finally: - self._blockedtimes['stdio_blocked'] += \ - (util.timer() - starttime) * 1000 + self._blockedtimes['stdio_blocked'] += ( + (util.timer() - starttime) * 1000) def _writemsg(self, dest, *args, **opts): _writemsgwith(self._write, dest, *args, **opts) @@ -1103,8 +1103,8 @@ if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF): raise error.StdioError(err) finally: - self._blockedtimes['stdio_blocked'] += \ - (util.timer() - starttime) * 1000 + self._blockedtimes['stdio_blocked'] += ( + (util.timer() - starttime) * 1000) def _isatty(self, fh): if self.configbool('ui', 'nontty'): diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -437,10 +437,9 @@ pure = False cffi = ispypy - global_options = Distribution.global_options + \ - [('pure', None, "use pure (slow) Python " - "code instead of C extensions"), - ] + global_options = Distribution.global_options + [ + ('pure', None, "use pure (slow) Python code instead of C extensions"), + ] def has_ext_modules(self): # self.ext_modules is emptied in hgbuildpy.finalize_options which is diff --git a/tests/hghave.py b/tests/hghave.py --- a/tests/hghave.py +++ b/tests/hghave.py @@ -343,8 +343,8 @@ @check("svn", "subversion client and admin tools") def has_svn(): - return matchoutput('svn --version 2>&1', br'^svn, version') and \ - matchoutput('svnadmin --version 2>&1', br'^svnadmin, version') + return (matchoutput('svn --version 2>&1', br'^svn, version') and + matchoutput('svnadmin --version 2>&1', br'^svnadmin, version')) @check("svn-bindings", "subversion python bindings") def has_svn_bindings(): diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -929,8 +929,8 @@ self.fail('no result code from test') elif out != self._refout: # Diff generation may rely on written .err file. - if (ret != 0 or out != self._refout) and not self._skipped \ - and not self._debug: + if ((ret != 0 or out != self._refout) and not self._skipped + and not self._debug): with open(self.errpath, 'wb') as f: for line in out: f.write(line) @@ -978,8 +978,8 @@ # files are deleted shutil.rmtree(self._chgsockdir, True) - if (self._ret != 0 or self._out != self._refout) and not self._skipped \ - and not self._debug and self._out: + if ((self._ret != 0 or self._out != self._refout) and not self._skipped + and not self._debug and self._out): with open(self.errpath, 'wb') as f: for line in self._out: f.write(line) @@ -1105,8 +1105,8 @@ if 'HGTESTCATAPULTSERVERPIPE' not in env: # If we don't have HGTESTCATAPULTSERVERPIPE explicitly set, pull the # non-test one in as a default, otherwise set to devnull - env['HGTESTCATAPULTSERVERPIPE'] = \ - env.get('HGCATAPULTSERVERPIPE', os.devnull) + env['HGTESTCATAPULTSERVERPIPE'] = env.get( + 'HGCATAPULTSERVERPIPE', os.devnull) extraextensions = [] for opt in self._extraconfigopts: diff --git a/tests/test-duplicateoptions.py b/tests/test-duplicateoptions.py --- a/tests/test-duplicateoptions.py +++ b/tests/test-duplicateoptions.py @@ -41,8 +41,8 @@ seenshort = globalshort.copy() seenlong = globallong.copy() for option in entry[1]: - if (option[0] and option[0] in seenshort) or \ - (option[1] and option[1] in seenlong): + if ((option[0] and option[0] in seenshort) or + (option[1] and option[1] in seenlong)): print("command '" + cmd + "' has duplicate option " + str(option)) seenshort.add(option[0]) seenlong.add(option[1]) diff --git a/tests/test-run-tests.py b/tests/test-run-tests.py --- a/tests/test-run-tests.py +++ b/tests/test-run-tests.py @@ -37,8 +37,8 @@ """ assert (expected.endswith(b'\n') and output.endswith(b'\n')), 'missing newline' - assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), \ - b'single backslash or unknown char' + assert not re.search(br'[^ \w\\/\r\n()*?]', expected + output), ( + b'single backslash or unknown char') test = run_tests.TTest(b'test-run-test.t', b'.', b'.') match, exact = test.linematch(expected, output) if isinstance(match, str): diff --git a/tests/test-simplekeyvaluefile.py b/tests/test-simplekeyvaluefile.py --- a/tests/test-simplekeyvaluefile.py +++ b/tests/test-simplekeyvaluefile.py @@ -82,8 +82,8 @@ dw = {b'key1': b'value1'} scmutil.simplekeyvaluefile(self.vfs, b'fl').write(dw, firstline=b'1.0') self.assertEqual(self.vfs.read(b'fl'), b'1.0\nkey1=value1\n') - dr = scmutil.simplekeyvaluefile(self.vfs, b'fl')\ - .read(firstlinenonkeyval=True) + dr = scmutil.simplekeyvaluefile( + self.vfs, b'fl').read(firstlinenonkeyval=True) self.assertEqual(dr, {b'__firstline': b'1.0', b'key1': b'value1'}) if __name__ == "__main__":