diff --git a/doc/hgmanpage.py b/doc/hgmanpage.py --- a/doc/hgmanpage.py +++ b/doc/hgmanpage.py @@ -168,7 +168,7 @@ class Translator(nodes.NodeVisitor): - """""" + """ """ words_and_spaces = re.compile(r'\S+| +|\n') document_start = """Man page generated from reStructuredText.""" diff --git a/hgext/convert/git.py b/hgext/convert/git.py --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -527,5 +527,5 @@ return bookmarks def checkrevformat(self, revstr, mapname=b'splicemap'): - """ git revision string is a 40 byte hex """ + """git revision string is a 40 byte hex""" self.checkhexformat(revstr, mapname) diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -729,5 +729,5 @@ return bookmarks.listbookmarks(self.repo) def checkrevformat(self, revstr, mapname=b'splicemap'): - """ Mercurial, revision string is a 40 byte hex """ + """Mercurial, revision string is a 40 byte hex""" self.checkhexformat(revstr, mapname) diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -778,7 +778,7 @@ return revcommit def checkrevformat(self, revstr, mapname=b'splicemap'): - """ fails if revision format does not match the correct format""" + """fails if revision format does not match the correct format""" if not re.match( br'svn:[0-9a-f]{8,8}-[0-9a-f]{4,4}-' br'[0-9a-f]{4,4}-[0-9a-f]{4,4}-[0-9a-f]' diff --git a/hgext/convert/transport.py b/hgext/convert/transport.py --- a/hgext/convert/transport.py +++ b/hgext/convert/transport.py @@ -37,7 +37,7 @@ def _create_auth_baton(pool): - """Create a Subversion authentication baton. """ + """Create a Subversion authentication baton.""" import svn.client # Give the client context baton a suite of authentication diff --git a/hgext/fsmonitor/pywatchman/__init__.py b/hgext/fsmonitor/pywatchman/__init__.py --- a/hgext/fsmonitor/pywatchman/__init__.py +++ b/hgext/fsmonitor/pywatchman/__init__.py @@ -221,7 +221,7 @@ def _win32_strerror(err): - """ expand a win32 error code into a human readable message """ + """expand a win32 error code into a human readable message""" # FormatMessage will allocate memory and assign it here buf = ctypes.c_char_p() @@ -303,20 +303,20 @@ class Transport(object): - """ communication transport to the watchman server """ + """communication transport to the watchman server""" buf = None def close(self): - """ tear it down """ + """tear it down""" raise NotImplementedError() def readBytes(self, size): - """ read size bytes """ + """read size bytes""" raise NotImplementedError() def write(self, buf): - """ write some data """ + """write some data""" raise NotImplementedError() def setTimeout(self, value): @@ -348,7 +348,7 @@ class Codec(object): - """ communication encoding for the watchman server """ + """communication encoding for the watchman server""" transport = None @@ -366,7 +366,7 @@ class UnixSocketTransport(Transport): - """ local unix domain socket transport """ + """local unix domain socket transport""" sock = None @@ -449,7 +449,7 @@ class WindowsNamedPipeTransport(Transport): - """ connect to a named pipe """ + """connect to a named pipe""" def __init__(self, sockpath, timeout): self.sockpath = sockpath @@ -700,7 +700,7 @@ class BserCodec(Codec): - """ use the BSER encoding. This is the default, preferred codec """ + """use the BSER encoding. This is the default, preferred codec""" def __init__(self, transport, value_encoding, value_errors): super(BserCodec, self).__init__(transport) @@ -752,7 +752,7 @@ class Bser2WithFallbackCodec(BserCodec): - """ use BSER v2 encoding """ + """use BSER v2 encoding""" def __init__(self, transport, value_encoding, value_errors): super(Bser2WithFallbackCodec, self).__init__( @@ -824,7 +824,7 @@ class JsonCodec(Codec): - """ Use json codec. This is here primarily for testing purposes """ + """Use json codec. This is here primarily for testing purposes""" json = None @@ -861,7 +861,7 @@ class client(object): - """ Handles the communication with the watchman service """ + """Handles the communication with the watchman service""" sockpath = None transport = None @@ -1011,7 +1011,7 @@ return result["sockname"] def _connect(self): - """ establish transport connection """ + """establish transport connection""" if self.recvConn: if self.pid != os.getpid(): @@ -1176,7 +1176,7 @@ raise def capabilityCheck(self, optional=None, required=None): - """ Perform a server capability check """ + """Perform a server capability check""" res = self.query( "version", {"optional": optional or [], "required": required or []} ) diff --git a/hgext/gpg.py b/hgext/gpg.py --- a/hgext/gpg.py +++ b/hgext/gpg.py @@ -76,7 +76,7 @@ return procutil.filter(data, gpgcmd) def verify(self, data, sig): - """ returns of the good and bad signatures""" + """returns of the good and bad signatures""" sigfile = datafile = None try: # create temporary files diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -510,7 +510,7 @@ return cls(state, rev) def verify(self, prev, expected, seen): - """ Verifies semantic correctness of the rule""" + """Verifies semantic correctness of the rule""" repo = self.repo ha = hex(self.node) self.node = scmutil.resolvehexnodeidprefix(repo, ha) @@ -819,7 +819,7 @@ @action([b'fold', b'f'], _(b'use commit, but combine it with the one above')) class fold(histeditaction): def verify(self, prev, expected, seen): - """ Verifies semantic correctness of the fold rule""" + """Verifies semantic correctness of the fold rule""" super(fold, self).verify(prev, expected, seen) repo = self.repo if not prev: @@ -2403,7 +2403,7 @@ def parserules(rules, state): - """Read the histedit rules string and return list of action objects """ + """Read the histedit rules string and return list of action objects""" rules = [ l for l in (r.strip() for r in rules.splitlines()) diff --git a/hgext/remotenames.py b/hgext/remotenames.py --- a/hgext/remotenames.py +++ b/hgext/remotenames.py @@ -102,7 +102,7 @@ self.loaded = False def _load(self): - """ Read the remotenames file, store entries matching selected kind """ + """Read the remotenames file, store entries matching selected kind""" self.loaded = True repo = self._repo for node, rpath, rname in logexchange.readremotenamefile( @@ -112,7 +112,7 @@ self.potentialentries[name] = (node, rpath, name) def _resolvedata(self, potentialentry): - """ Check that the node for potentialentry exists and return it """ + """Check that the node for potentialentry exists and return it""" if not potentialentry in self.potentialentries: return None node, remote, name = self.potentialentries[potentialentry] @@ -160,13 +160,13 @@ return None def keys(self): - """ Get a list of bookmark or branch names """ + """Get a list of bookmark or branch names""" if not self.loaded: self._load() return self.potentialentries.keys() def iteritems(self): - """ Iterate over (name, node) tuples """ + """Iterate over (name, node) tuples""" if not self.loaded: self._load() @@ -190,7 +190,7 @@ self.clearnames() def clearnames(self): - """ Clear all remote names state """ + """Clear all remote names state""" self.bookmarks = lazyremotenamedict(b"bookmarks", self._repo) self.branches = lazyremotenamedict(b"branches", self._repo) self._invalidatecache() diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -220,7 +220,7 @@ self._hasnode = lambda x: True def _verifyclosed(self): - """ verify the closed nodes we have """ + """verify the closed nodes we have""" if self._closedverified: return for node in self._closednodes: @@ -230,7 +230,7 @@ self._closedverified = True def _verifybranch(self, branch): - """ verify head nodes for the given branch. """ + """verify head nodes for the given branch.""" if branch not in self._entries or branch in self._verifiedbranches: return for n in self._entries[branch]: @@ -240,7 +240,7 @@ self._verifiedbranches.add(branch) def _verifyall(self): - """ verifies nodes of all the branches """ + """verifies nodes of all the branches""" needverification = set(self._entries.keys()) - self._verifiedbranches for b in needverification: self._verifybranch(b) @@ -267,7 +267,7 @@ items = iteritems def hasbranch(self, label): - """ checks whether a branch of this name exists or not """ + """checks whether a branch of this name exists or not""" self._verifybranch(label) return label in self._entries @@ -385,7 +385,7 @@ yield (bn, heads) + self._branchtip(heads) def iterheads(self): - """ returns all the heads """ + """returns all the heads""" self._verifyall() return pycompat.itervalues(self._entries) @@ -784,7 +784,7 @@ wlock.release() def _writenames(self, repo): - """ write the new branch names to revbranchcache """ + """write the new branch names to revbranchcache""" if self._rbcnamescount != 0: f = repo.cachevfs.open(_rbcnames, b'ab') if f.tell() == self._rbcsnameslen: @@ -809,7 +809,7 @@ self._rbcnamescount = len(self._names) def _writerevs(self, repo, start): - """ write the new revs to revbranchcache """ + """write the new revs to revbranchcache""" revs = min(len(repo.changelog), len(self._rbcrevs) // _rbcrecsize) with repo.cachevfs.open(_rbcrevs, b'ab') as f: if f.tell() != start: diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -829,7 +829,7 @@ return params def _processallparams(self, paramsblock): - """""" + """ """ params = util.sortdict() for p in paramsblock.split(b' '): p = p.split(b'=', 1) diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -326,7 +326,7 @@ def checknotesize(ui, opts): - """ make sure note is of valid format """ + """make sure note is of valid format""" note = opts.get(b'note') if not note: @@ -972,7 +972,7 @@ def changebranch(ui, repo, revs, label, opts): - """ Change the branch name of given revs to label """ + """Change the branch name of given revs to label""" with repo.wlock(), repo.lock(), repo.transaction(b'branches'): # abort in case of uncommitted merge or dirty wdir @@ -1108,7 +1108,7 @@ def logmessage(ui, opts): - """ get the log message according to -m and -l option """ + """get the log message according to -m and -l option""" check_at_most_one_arg(opts, b'message', b'logfile') @@ -3920,7 +3920,7 @@ def hgabortgraft(ui, repo): - """ abort logic for aborting graft using 'hg abort'""" + """abort logic for aborting graft using 'hg abort'""" with repo.wlock(): graftstate = statemod.cmdstate(repo, b'graftstate') return abortgraft(ui, repo, graftstate) diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -366,7 +366,7 @@ os.chdir(self.cwd) def getencoding(self): - """ writes the current encoding to the result channel """ + """writes the current encoding to the result channel""" self.cresult.write(encoding.encoding) def serveone(self): diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -331,7 +331,7 @@ class uihunk(patchnode): - """ui patch hunk, wraps a hunk and keep track of ui behavior """ + """ui patch hunk, wraps a hunk and keep track of ui behavior""" maxcontext = 3 diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -2909,7 +2909,7 @@ @command(b'debugrequires|debugrequirements', [], b'') def debugrequirements(ui, repo): - """ print the current repo requirements """ + """print the current repo requirements""" for r in sorted(repo.requirements): ui.write(b"%s\n" % r) diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -269,7 +269,7 @@ def codec2iana(cs): # type: (str) -> str - '''''' + ''' ''' cs = email.charset.Charset(cs).input_charset.lower() # "latin1" normalizes to "iso8859-1", standard calls for "iso-8859-1" diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py --- a/mercurial/mergestate.py +++ b/mercurial/mergestate.py @@ -307,11 +307,11 @@ yield f def allextras(self): - """ return all extras information stored with the mergestate """ + """return all extras information stored with the mergestate""" return self._stateextras def extras(self, filename): - """ return extras stored with the mergestate for the given filename """ + """return extras stored with the mergestate for the given filename""" return self._stateextras[filename] def _resolve(self, preresolve, dfile, wctx): diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -133,7 +133,7 @@ def delete_nodemap(tr, repo, revlog): - """ Delete nodemap data on disk for a given revlog""" + """Delete nodemap data on disk for a given revlog""" if revlog.nodemap_file is None: msg = "calling persist nodemap on a revlog without the feature enabled" raise error.ProgrammingError(msg) diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -1563,7 +1563,7 @@ def istreemanifest(repo): - """ returns whether the repository is using treemanifest or not """ + """returns whether the repository is using treemanifest or not""" return requirementsmod.TREEMANIFEST_REQUIREMENT in repo.requirements diff --git a/mercurial/state.py b/mercurial/state.py --- a/mercurial/state.py +++ b/mercurial/state.py @@ -188,7 +188,7 @@ return self._cmdmsg def continuemsg(self): - """ returns appropriate continue message corresponding to command""" + """returns appropriate continue message corresponding to command""" return _(b'hg %s --continue') % (self._opname) def isunfinished(self, repo): diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -629,7 +629,7 @@ fp.close() def _checkentries(self, fp, warn): - """ make sure there is no empty string in entries """ + """make sure there is no empty string in entries""" if b'' in self.entries: fp.seek(0) for n, line in enumerate(util.iterfile(fp)): diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -847,11 +847,11 @@ self.ui.status(_(b'%s\n %s\n\n') % (i.name, i.description)) def has_upgrade_action(self, name): - """ Check whether the upgrade operation will perform this action """ + """Check whether the upgrade operation will perform this action""" return name in self._upgrade_actions_names def print_post_op_messages(self): - """ print post upgrade operation warning messages """ + """print post upgrade operation warning messages""" for a in self.upgrade_actions: if a.postupgrademessage is not None: self.ui.warn(b'%s\n' % a.postupgrademessage) diff --git a/mercurial/upgrade_utils/engine.py b/mercurial/upgrade_utils/engine.py --- a/mercurial/upgrade_utils/engine.py +++ b/mercurial/upgrade_utils/engine.py @@ -134,7 +134,7 @@ sidedatacompanion, oncopiedrevision, ): - """ returns the new revlog object created""" + """returns the new revlog object created""" newrl = None if matchrevlog(upgrade_op.revlogs_to_process, rl_type): ui.note( diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -143,7 +143,7 @@ def setumask(val): # type: (int) -> None - ''' updates the umask. used by chg server ''' + '''updates the umask. used by chg server''' if pycompat.iswindows: return os.umask(val)