diff --git a/hgdemandimport/demandimportpy2.py b/hgdemandimport/demandimportpy2.py --- a/hgdemandimport/demandimportpy2.py +++ b/hgdemandimport/demandimportpy2.py @@ -303,18 +303,18 @@ def isenabled(): def enable(): - "enable global demand-loading of modules" + """enable global demand-loading of modules""" builtins.__import__ = _demandimport def disable(): - "disable global demand-loading of modules" + """disable global demand-loading of modules""" builtins.__import__ = _origimport @contextmanager def deactivated(): - "context manager for disabling demandimport in 'with' blocks" + """context manager for disabling demandimport in 'with' blocks""" demandenabled = isenabled() if demandenabled: disable() diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -110,7 +110,7 @@ def createlog(ui, directory=None, root=b _scache = {} def scache(s): - b"return a shared version of a string" + """return a shared version of a string""" return _scache.setdefault(s, s) ui.status(_(b'collecting CVS rlog\n')) @@ -711,7 +711,7 @@ def createchangeset(ui, log, fuzz=60, me # Sort files in each changeset def entitycompare(l, r): - b'Mimic cvsps sorting order' + """Mimic cvsps sorting order""" l = l.file.split(b'/') r = r.file.split(b'/') nl = len(l) diff --git a/hgext/convert/p4.py b/hgext/convert/p4.py --- a/hgext/convert/p4.py +++ b/hgext/convert/p4.py @@ -24,7 +24,7 @@ from . import common def loaditer(f): - b"Yield the dictionary objects generated by p4" + """Yield the dictionary objects generated by p4""" try: while True: d = marshal.load(f) @@ -105,7 +105,7 @@ class p4_source(common.converter_source) self.revmap = revmap def _parse_view(self, path): - b"Read changes affecting the path" + """Read changes affecting the path""" cmd = b'p4 -G changes -s submitted %s' % procutil.shellquote(path) stdout = procutil.popen(cmd, mode=b'rb') p4changes = {} @@ -116,7 +116,7 @@ class p4_source(common.converter_source) return p4changes def _parse(self, ui, path): - b"Prepare list of P4 filenames and revisions to import" + """Prepare list of P4 filenames and revisions to import""" p4changes = {} changeset = {} files_map = {} diff --git a/hgext/hgk.py b/hgext/hgk.py --- a/hgext/hgk.py +++ b/hgext/hgk.py @@ -373,7 +373,7 @@ def revlist(ui, repo, *revs, **opts): helpcategory=command.CATEGORY_CHANGE_NAVIGATION, ) def view(ui, repo, *etc, **opts): - b"start interactive history viewer" + """start interactive history viewer""" opts = pycompat.byteskwargs(opts) os.chdir(repo.root) optstr = b' '.join( diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1497,7 +1497,7 @@ def commitnode(repo, p1, p2, editor, ext def rebasenode(repo, rev, p1, base, collapse, dest, wctx): - b'Rebase a single revision rev on top of p1 using base as merge ancestor' + """Rebase a single revision rev on top of p1 using base as merge ancestor""" # Merge phase # Update to destination and merge it with local if wctx.isinmemory(): @@ -1853,7 +1853,7 @@ def defineparents(repo, rev, destmap, st def isagitpatch(repo, patchname): - b'Return true if the given patch is in git format' + """Return true if the given patch is in git format""" mqpatch = os.path.join(repo.mq.path, patchname) for line in patch.linereader(open(mqpatch, b'rb')): if line.startswith(b'diff --git'): @@ -1862,7 +1862,7 @@ def isagitpatch(repo, patchname): def updatemq(repo, state, skipped, **opts): - b'Update rebased mq patches - finalize and then import them' + """Update rebased mq patches - finalize and then import them""" mqrebase = {} mq = repo.mq original_series = mq.fullseries[:] @@ -1916,7 +1916,7 @@ def updatemq(repo, state, skipped, **opt def storecollapsemsg(repo, collapsemsg): - b'Store the collapse message to allow recovery' + """Store the collapse message to allow recovery""" collapsemsg = collapsemsg or b'' f = repo.vfs(b"last-message.txt", b"w") f.write(b"%s\n" % collapsemsg) @@ -1924,12 +1924,12 @@ def storecollapsemsg(repo, collapsemsg): def clearcollapsemsg(repo): - b'Remove collapse message file' + """Remove collapse message file""" repo.vfs.unlinkpath(b"last-message.txt", ignoremissing=True) def restorecollapsemsg(repo, isabort): - b'Restore previously stored collapse message' + """Restore previously stored collapse message""" try: f = repo.vfs(b"last-message.txt") collapsemsg = f.readline().strip() @@ -1946,7 +1946,7 @@ def restorecollapsemsg(repo, isabort): def clearstatus(repo): - b'Remove the status files' + """Remove the status files""" # Make sure the active transaction won't write the state file tr = repo.currenttransaction() if tr: @@ -2127,7 +2127,7 @@ def clearrebased( def pullrebase(orig, ui, repo, *args, **opts): - b'Call rebase after pull if the latter has been invoked with --rebase' + """Call rebase after pull if the latter has been invoked with --rebase""" if opts.get('rebase'): if ui.configbool(b'commands', b'rebase.requiredest'): msg = _(b'rebase destination required by configuration') diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -405,7 +405,7 @@ class changelog(revlog.revlog): self._copiesstorage = opener.options.get(b'copies-storage') def delayupdate(self, tr): - b"delay visibility of index updates to other readers" + """delay visibility of index updates to other readers""" if not self._delayed: if len(self) == 0: @@ -423,7 +423,7 @@ class changelog(revlog.revlog): tr.addfinalize(b'cl-%i' % id(self), self._finalize) def _finalize(self, tr): - b"finalize index updates" + """finalize index updates""" self._delayed = False self.opener = self._realopener # move redirected index data back into place @@ -443,7 +443,8 @@ class changelog(revlog.revlog): self._enforceinlinesize(tr) def _writepending(self, tr): - b"create a file containing the unfinalized state for pretxnchangegroup" + """create a file containing the unfinalized state for + pretxnchangegroup""" if self._delaybuf: # make a temporary copy of the index fp1 = self._realopener(self.indexfile) diff --git a/mercurial/color.py b/mercurial/color.py --- a/mercurial/color.py +++ b/mercurial/color.py @@ -330,7 +330,7 @@ def _activeeffects(ui): def valideffect(ui, effect): - b'Determine if the effect is valid or not.' + """Determine if the effect is valid or not.""" return (not ui._terminfoparams and effect in _activeeffects(ui)) or ( effect in ui._terminfoparams or effect[:-11] in ui._terminfoparams ) @@ -377,7 +377,7 @@ def _mergeeffects(text, start, stop): def _render_effects(ui, text, effects): - b'Wrap text in commands to turn on each effect.' + """Wrap text in commands to turn on each effect.""" if not text: return text if ui._terminfoparams: diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -1587,7 +1587,7 @@ class workingctx(committablectx): ) def dirty(self, missing=False, merge=True, branch=True): - b"check whether a working directory is modified" + """check whether a working directory is modified""" # check subrepos first for s in sorted(self.substate): if self.sub(s).dirty(missing=missing): diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -102,7 +102,7 @@ class patchnode(object): raise NotImplementedError(b"method must be implemented by subclass") def allchildren(self): - b"Return a list of all of the direct children of this node" + """Return a list of all of the direct children of this node""" raise NotImplementedError(b"method must be implemented by subclass") def nextsibling(self): @@ -264,21 +264,23 @@ class uiheader(patchnode): return None def firstchild(self): - b"return the first child of this item, if one exists. otherwise None." + """return the first child of this item, if one exists. otherwise + None.""" if len(self.hunks) > 0: return self.hunks[0] else: return None def lastchild(self): - b"return the last child of this item, if one exists. otherwise None." + """return the last child of this item, if one exists. otherwise + None.""" if len(self.hunks) > 0: return self.hunks[-1] else: return None def allchildren(self): - b"return a list of all of the direct children of this node" + """return a list of all of the direct children of this node""" return self.hunks def __getattr__(self, name): @@ -286,7 +288,7 @@ class uiheader(patchnode): class uihunkline(patchnode): - b"represents a changed line in a hunk" + """represents a changed line in a hunk""" def __init__(self, linetext, hunk): self.linetext = linetext @@ -319,16 +321,18 @@ class uihunkline(patchnode): return None def parentitem(self): - b"return the parent to the current item" + """return the parent to the current item""" return self.hunk def firstchild(self): - b"return the first child of this item, if one exists. otherwise None." + """return the first child of this item, if one exists. otherwise + None.""" # hunk-lines don't have children return None def lastchild(self): - b"return the last child of this item, if one exists. otherwise None." + """return the last child of this item, if one exists. otherwise + None.""" # hunk-lines don't have children return None @@ -372,25 +376,27 @@ class uihunk(patchnode): return None def parentitem(self): - b"return the parent to the current item" + """return the parent to the current item""" return self.header def firstchild(self): - b"return the first child of this item, if one exists. otherwise None." + """return the first child of this item, if one exists. otherwise + None.""" if len(self.changedlines) > 0: return self.changedlines[0] else: return None def lastchild(self): - b"return the last child of this item, if one exists. otherwise None." + """return the last child of this item, if one exists. otherwise + None.""" if len(self.changedlines) > 0: return self.changedlines[-1] else: return None def allchildren(self): - b"return a list of all of the direct children of this node" + """return a list of all of the direct children of this node""" return self.changedlines def countchanges(self): @@ -853,7 +859,7 @@ class curseschunkselector(object): self.currentselecteditem = currentitem def updatescroll(self): - b"scroll the screen to fully show the currently-selected" + """scroll the screen to fully show the currently-selected""" selstart = self.selecteditemstartline selend = self.selecteditemendline @@ -871,7 +877,7 @@ class curseschunkselector(object): self.scrolllines(selstart - padstartbuffered) def scrolllines(self, numlines): - b"scroll the screen up (down) by numlines when numlines >0 (<0)." + """scroll the screen up (down) by numlines when numlines >0 (<0).""" self.firstlineofpadtoprint += numlines if self.firstlineofpadtoprint < 0: self.firstlineofpadtoprint = 0 @@ -973,7 +979,7 @@ class curseschunkselector(object): ) def toggleall(self): - b"toggle the applied flag of all items." + """toggle the applied flag of all items.""" if self.waslasttoggleallapplied: # then unapply them this time for item in self.headerlist: if item.applied: @@ -985,7 +991,8 @@ class curseschunkselector(object): self.waslasttoggleallapplied = not self.waslasttoggleallapplied def toggleallbetween(self): - b"toggle applied on or off for all items in range [lastapplied,current]." + """toggle applied on or off for all items in range [lastapplied, + current]. """ if ( not self.lastapplieditem or self.currentselecteditem == self.lastapplieditem @@ -1026,7 +1033,8 @@ class curseschunkselector(object): nextitem = nextitem.nextitem() def togglefolded(self, item=None, foldparent=False): - b"toggle folded flag of specified item (defaults to currently selected)" + """toggle folded flag of specified item (defaults to currently + selected)""" if item is None: item = self.currentselecteditem if foldparent or (isinstance(item, uiheader) and item.neverunfolded): @@ -1320,7 +1328,7 @@ class curseschunkselector(object): def printhunklinesbefore( self, hunk, selected=False, towin=True, ignorefolding=False ): - b"includes start/end line indicator" + """includes start/end line indicator""" outstr = b"" # where hunk is in list of siblings hunkindex = hunk.header.hunks.index(hunk) @@ -1529,7 +1537,7 @@ class curseschunkselector(object): return numlines def sigwinchhandler(self, n, frame): - b"handle window resizing" + """handle window resizing""" try: curses.endwin() self.xscreensize, self.yscreensize = scmutil.termsize(self.ui) @@ -1599,11 +1607,11 @@ class curseschunkselector(object): return colorpair def initcolorpair(self, *args, **kwargs): - b"same as getcolorpair." + """same as getcolorpair.""" self.getcolorpair(*args, **kwargs) def helpwindow(self): - b"print a help window to the screen. exit after any keypress." + """print a help window to the screen. exit after any keypress.""" helptext = _( """ [press any key to return to the patch-display] @@ -1654,7 +1662,7 @@ the following are valid keystrokes: pass def commitMessageWindow(self): - b"Create a temporary commit message editing window on the screen." + """Create a temporary commit message editing window on the screen.""" curses.raw() curses.def_prog_mode() @@ -1704,7 +1712,8 @@ the following are valid keystrokes: self.recenterdisplayedarea() def confirmationwindow(self, windowtext): - b"display an informational window, then wait for and return a keypress." + """display an informational window, then wait for and return a + keypress.""" confirmwin = curses.newwin(self.yscreensize, 0, 0, 0) try: diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -102,7 +102,7 @@ class request(object): def run(): - b"run the command in sys.argv" + """run the command in sys.argv""" initstdio() with tracing.log('parse args into request'): req = request(pycompat.sysargv[1:]) diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -312,13 +312,13 @@ else: def colwidth(s): # type: (bytes) -> int - b"Find the column width of a string for display in the local encoding" + """Find the column width of a string for display in the local encoding""" return ucolwidth(s.decode(_sysstr(encoding), 'replace')) def ucolwidth(d): # type: (Text) -> int - b"Find the column width of a Unicode string for display" + """Find the column width of a Unicode string for display""" eaw = getattr(unicodedata, 'east_asian_width', None) if eaw is not None: return sum([eaw(c) in _wide and 2 or 1 for c in d]) @@ -436,7 +436,7 @@ def trim(s, width, ellipsis=b'', leftsid def lower(s): # type: (bytes) -> bytes - b"best-effort encoding-aware case-folding of local string s" + """best-effort encoding-aware case-folding of local string s""" try: return asciilower(s) except UnicodeDecodeError: @@ -459,7 +459,7 @@ def lower(s): def upper(s): # type: (bytes) -> bytes - b"best-effort encoding-aware case-folding of local string s" + """best-effort encoding-aware case-folding of local string s""" try: return asciiupper(s) except UnicodeDecodeError: diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -279,7 +279,7 @@ def _picktool(repo, ui, path, binary, sy def _eoltype(data): - b"Guess the EOL type of a file" + """Guess the EOL type of a file""" if b'\0' in data: # binary return None if b'\r\n' in data: # Windows @@ -292,7 +292,7 @@ def _eoltype(data): def _matcheol(file, back): - b"Convert EOL markers in a file to match origfile" + """Convert EOL markers in a file to match origfile""" tostyle = _eoltype(back.data()) # No repo.wread filters? if tostyle: data = util.readfile(file) diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1345,7 +1345,7 @@ def verify(repo, level=None): def remoteui(src, opts): - b'build a remote ui from ui or repo and opts' + """build a remote ui from ui or repo and opts""" if util.safehasattr(src, b'baseui'): # looks like a repository dst = src.baseui.copy() # drop repo-specific config src = src.ui # copy target options from repo diff --git a/mercurial/interfaces/dirstate.py b/mercurial/interfaces/dirstate.py --- a/mercurial/interfaces/dirstate.py +++ b/mercurial/interfaces/dirstate.py @@ -24,7 +24,7 @@ class idirstate(interfaceutil.Interface) """Return a list of files containing patterns to ignore.""" def _ignorefileandline(f): - b"Given a file `f`, return the ignore file and line that ignores it." + """Given a file `f`, return the ignore file and line that ignores it.""" _checklink = interfaceutil.Attribute("""Callable for checking symlinks.""") _checkexec = interfaceutil.Attribute("""Callable for checking exec bits.""") diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -2093,7 +2093,7 @@ def applyupdates( def recordupdates(repo, actions, branchmerge, getfiledata): - b"record merge actions to the dirstate" + """record merge actions to the dirstate""" # remove (must come first) for f, args, msg in actions.get(ACTION_REMOVE, []): if branchmerge: diff --git a/mercurial/parser.py b/mercurial/parser.py --- a/mercurial/parser.py +++ b/mercurial/parser.py @@ -34,17 +34,17 @@ class parser(object): self.current = None def _advance(self): - b'advance the tokenizer' + """advance the tokenizer""" t = self.current self.current = next(self._iter, None) return t def _hasnewterm(self): - b'True if next token may start new term' + """True if next token may start new term""" return any(self._elements[self.current[0]][1:3]) def _match(self, m): - b'make sure the tokenizer matches an end condition' + """make sure the tokenizer matches an end condition""" if self.current[0] != m: raise error.ParseError( _(b"unexpected token: %s") % self.current[0], self.current[2] @@ -52,7 +52,8 @@ class parser(object): self._advance() def _parseoperand(self, bind, m=None): - b'gather right-hand-side operand until an end condition or binding met' + """gather right-hand-side operand until an end condition or binding + met""" if m and self.current[0] == m: expr = None else: @@ -85,7 +86,7 @@ class parser(object): return expr def parse(self, tokeniter): - b'generate a parse tree from tokens' + """generate a parse tree from tokens""" self._iter = tokeniter self._advance() res = self._parse() @@ -93,13 +94,13 @@ class parser(object): return res, pos def eval(self, tree): - b'recursively evaluate a parse tree using node methods' + """recursively evaluate a parse tree using node methods""" if not isinstance(tree, tuple): return tree return self._methods[tree[0]](*[self.eval(t) for t in tree[1:]]) def __call__(self, tokeniter): - b'parse tokens into a parse tree and evaluate if methods given' + """parse tokens into a parse tree and evaluate if methods given""" t = self.parse(tokeniter) if self._methods: return self.eval(t) diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -1570,7 +1570,7 @@ class hunk(object): class binhunk(object): - b'A binary patch file.' + """A binary patch file.""" def __init__(self, lr, fname): self.text = None diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -1528,7 +1528,7 @@ class gitsubrepo(abstractsubrepo): return branch2rev, rev2branch def _gittracking(self, branches): - b'return map of remote branch to local tracking branch' + """return map of remote branch to local tracking branch""" # assumes no more than one local tracking branch for each remote tracking = {} for b in branches: diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -653,7 +653,8 @@ class ui(object): return main, sub def configpath(self, section, name, default=_unset, untrusted=False): - b'get a path config item, expanded relative to repo root or config file' + """get a path config item, expanded relative to repo root or config + file""" v = self.config(section, name, default, untrusted) if v is None: return None diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -249,7 +249,8 @@ def tempfilter(s, cmd): def filter(s, cmd): - b"filter a string through a command that transforms its input to its output" + """filter a string through a command that transforms its input to its + output""" for name, fn in pycompat.iteritems(_filtertable): if cmd.startswith(name): return fn(s, cmd[len(name) :].lstrip()) @@ -347,7 +348,7 @@ def shellenviron(environ=None): """return environ with optional override, useful for shelling out""" def py2shell(val): - b'convert python object into string that is useful to shell' + """convert python object into string that is useful to shell""" if val is None or val is False: return b'0' if val is True: diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -507,7 +507,7 @@ def findexe(command): pathexts = [b''] def findexisting(pathcommand): - b'Will append extension (if needed) and return existing file' + """Will append extension (if needed) and return existing file""" for ext in pathexts: executable = pathcommand + ext if os.path.exists(executable):