pyupgrade: modernize calls to superclass methods
This is the `legacy` fixer in `pyupgrade`, with the loop yielding the offset of
`yield` statements commented out.
--- a/contrib/python-zstandard/tests/common.py Sun Jan 05 22:12:02 2025 -0500
+++ b/contrib/python-zstandard/tests/common.py Sun Jan 05 22:23:31 2025 -0500
@@ -102,18 +102,18 @@
"""
def __init__(self, *args, **kwargs):
- super(NonClosingBytesIO, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self._saved_buffer = None
def close(self):
self._saved_buffer = self.getvalue()
- return super(NonClosingBytesIO, self).close()
+ return super().close()
def getvalue(self):
if self.closed:
return self._saved_buffer
else:
- return super(NonClosingBytesIO, self).getvalue()
+ return super().getvalue()
class OpCountingBytesIO(NonClosingBytesIO):
@@ -121,19 +121,19 @@
self._flush_count = 0
self._read_count = 0
self._write_count = 0
- return super(OpCountingBytesIO, self).__init__(*args, **kwargs)
+ return super().__init__(*args, **kwargs)
def flush(self):
self._flush_count += 1
- return super(OpCountingBytesIO, self).flush()
+ return super().flush()
def read(self, *args):
self._read_count += 1
- return super(OpCountingBytesIO, self).read(*args)
+ return super().read(*args)
def write(self, data):
self._write_count += 1
- return super(OpCountingBytesIO, self).write(data)
+ return super().write(data)
_source_files = []
--- a/contrib/testparseutil.py Sun Jan 05 22:12:02 2025 -0500
+++ b/contrib/testparseutil.py Sun Jan 05 22:23:31 2025 -0500
@@ -304,7 +304,7 @@
_prefix = ' > '
def __init__(self, desc, namepat):
- super(fileheredocmatcher, self).__init__(desc)
+ super().__init__(desc)
# build the pattern to match against cases below (and ">>"
# variants), and to return a target filename string as 'name'
@@ -426,7 +426,7 @@
_outputre = re.compile(r' {2}$| {2}[^$]')
def __init__(self):
- super(pydoctestmatcher, self).__init__("doctest style python code")
+ super().__init__("doctest style python code")
def startsat(self, line):
# ctx is "True"
@@ -500,7 +500,7 @@
)
def __init__(self):
- super(pyheredocmatcher, self).__init__("heredoc python invocation")
+ super().__init__("heredoc python invocation")
def startsat(self, line):
# ctx is END-LINE-OF-EMBEDDED-CODE
--- a/hgext/clonebundles.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/clonebundles.py Sun Jan 05 22:23:31 2025 -0500
@@ -442,7 +442,7 @@
def __init__(self, bundle_type, revs, tip_rev, tip_node, head_revs, op_id):
self.head_revs = head_revs
self.op_id = op_id
- super(RequestedBundle, self).__init__(
+ super().__init__(
bundle_type,
revs,
tip_rev,
@@ -512,9 +512,7 @@
self.hostname = hostname
self.pid = pid
self.filepath = filepath
- super(GeneratingBundle, self).__init__(
- bundle_type, revs, tip_rev, tip_node
- )
+ super().__init__(bundle_type, revs, tip_rev, tip_node)
@classmethod
def from_line(cls, line):
@@ -554,7 +552,7 @@
return templ % data
def __eq__(self, other):
- if not super(GeneratingBundle, self).__eq__(other):
+ if not super().__eq__(other):
return False
left = (self.hostname, self.pid, self.filepath)
right = (other.hostname, other.pid, other.filepath)
@@ -591,9 +589,7 @@
):
self.file_url = file_url
self.basename = basename
- super(GeneratedBundle, self).__init__(
- bundle_type, revs, tip_rev, tip_node
- )
+ super().__init__(bundle_type, revs, tip_rev, tip_node)
@classmethod
def from_line(cls, line):
@@ -634,7 +630,7 @@
return templ % (self.file_url, self.bundle_type)
def __eq__(self, other):
- if not super(GeneratedBundle, self).__eq__(other):
+ if not super().__eq__(other):
return False
return self.file_url == other.file_url
@@ -964,7 +960,7 @@
class autobundlesrepo(repo.__class__):
def transaction(self, *args, **kwargs):
- tr = super(autobundlesrepo, self).transaction(*args, **kwargs)
+ tr = super().transaction(*args, **kwargs)
enabled = repo.ui.configbool(
b'clone-bundles',
b'auto-generate.on-change',
--- a/hgext/commitextras.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/commitextras.py Sun Jan 05 22:23:31 2025 -0500
@@ -82,7 +82,7 @@
)
raise error.InputError(msg % k)
inneropts['extra'][k] = v
- return super(repoextra, self).commit(*innerpats, **inneropts)
+ return super().commit(*innerpats, **inneropts)
repo.__class__ = repoextra
return orig(ui, repo, *pats, **opts)
--- a/hgext/convert/bzr.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/bzr.py Sun Jan 05 22:23:31 2025 -0500
@@ -62,7 +62,7 @@
"""Reads Bazaar repositories by using the Bazaar Python libraries"""
def __init__(self, ui, repotype, path, revs=None):
- super(bzr_source, self).__init__(ui, repotype, path, revs=revs)
+ super().__init__(ui, repotype, path, revs=revs)
if not os.path.exists(os.path.join(path, b'.bzr')):
raise common.NoRepo(
--- a/hgext/convert/common.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/common.py Sun Jan 05 22:23:31 2025 -0500
@@ -562,7 +562,7 @@
class mapfile(dict):
def __init__(self, ui: "uimod.ui", path: bytes) -> None:
- super(mapfile, self).__init__()
+ super().__init__()
self.ui = ui
self.path = path
self.fp = None
@@ -592,7 +592,7 @@
)
if key not in self:
self.order.append(key)
- super(mapfile, self).__setitem__(key, value)
+ super().__setitem__(key, value)
finally:
fp.close()
@@ -607,7 +607,7 @@
)
self.fp.write(util.tonativeeol(b'%s %s\n' % (key, value)))
self.fp.flush()
- super(mapfile, self).__setitem__(key, value)
+ super().__setitem__(key, value)
def close(self) -> None:
if self.fp:
--- a/hgext/convert/cvs.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/cvs.py Sun Jan 05 22:23:31 2025 -0500
@@ -38,7 +38,7 @@
class convert_cvs(converter_source):
def __init__(self, ui, repotype, path, revs=None):
- super(convert_cvs, self).__init__(ui, repotype, path, revs=revs)
+ super().__init__(ui, repotype, path, revs=revs)
cvs = os.path.join(path, b"CVS")
if not os.path.exists(cvs):
--- a/hgext/convert/darcs.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/darcs.py Sun Jan 05 22:23:31 2025 -0500
@@ -103,7 +103,7 @@
# encode into ASCII. We convert them back to str to get
# recode's normal conversion behavior.
s = s.encode('latin-1')
- return super(darcs_source, self).recode(s, encoding)
+ return super().recode(s, encoding)
def xml(self, cmd, **kwargs):
# NOTE: darcs is currently encoding agnostic and will print
--- a/hgext/convert/filemap.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/filemap.py Sun Jan 05 22:23:31 2025 -0500
@@ -221,7 +221,7 @@
def __init__(
self, ui: "uimod.ui", baseconverter, filemap: Optional[bytes]
) -> None:
- super(filemap_source, self).__init__(ui, baseconverter.repotype)
+ super().__init__(ui, baseconverter.repotype)
self.base = baseconverter
self.filemapper = filemapper(ui, filemap)
self.commits = {}
--- a/hgext/convert/git.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/git.py Sun Jan 05 22:23:31 2025 -0500
@@ -71,7 +71,7 @@
return self._gitcmd(self._run3, *args, **kwargs)
def __init__(self, ui, repotype, path, revs=None):
- super(convert_git, self).__init__(ui, repotype, path, revs=revs)
+ super().__init__(ui, repotype, path, revs=revs)
common.commandline.__init__(self, ui, b'git')
# Pass an absolute path to git to prevent from ever being interpreted
--- a/hgext/convert/gnuarch.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/gnuarch.py Sun Jan 05 22:23:31 2025 -0500
@@ -43,7 +43,7 @@
self.ren_dirs = {}
def __init__(self, ui, repotype, path, revs=None):
- super(gnuarch_source, self).__init__(ui, repotype, path, revs=revs)
+ super().__init__(ui, repotype, path, revs=revs)
if not os.path.exists(os.path.join(path, b'{arch}')):
raise common.NoRepo(
--- a/hgext/convert/p4.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/p4.py Sun Jan 05 22:23:31 2025 -0500
@@ -61,7 +61,7 @@
# avoid import cycle
from . import convcmd
- super(p4_source, self).__init__(ui, repotype, path, revs=revs)
+ super().__init__(ui, repotype, path, revs=revs)
if b"/" in path and not path.startswith(b'//'):
raise common.NoRepo(
--- a/hgext/convert/subversion.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/convert/subversion.py Sun Jan 05 22:23:31 2025 -0500
@@ -462,7 +462,7 @@
#
class svn_source(converter_source):
def __init__(self, ui, repotype, url, revs=None):
- super(svn_source, self).__init__(ui, repotype, url, revs=revs)
+ super().__init__(ui, repotype, url, revs=revs)
init_fsencoding()
if not (
--- a/hgext/eol.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/eol.py Sun Jan 05 22:23:31 2025 -0500
@@ -477,7 +477,7 @@
raise errormod.Abort(
_(b"inconsistent newline style in %s\n") % f
)
- return super(eolrepo, self).commitctx(ctx, error, origctx)
+ return super().commitctx(ctx, error, origctx)
repo.__class__ = eolrepo
repo._hgcleardirstate()
--- a/hgext/fastannotate/formatter.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/fastannotate/formatter.py Sun Jan 05 22:23:31 2025 -0500
@@ -130,7 +130,7 @@
class jsonformatter(defaultformatter):
def __init__(self, ui, repo, opts):
- super(jsonformatter, self).__init__(ui, repo, opts)
+ super().__init__(ui, repo, opts)
self.ui.write(b'[')
self.needcomma = False
--- a/hgext/fsmonitor/__init__.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/fsmonitor/__init__.py Sun Jan 05 22:23:31 2025 -0500
@@ -726,18 +726,18 @@
self._repo = weakref.proxy(repo)
def walk(self, *args, **kwargs):
- orig = super(fsmonitordirstate, self).walk
+ orig = super().walk
if self._fsmonitordisable:
return orig(*args, **kwargs)
return overridewalk(orig, self, *args, **kwargs)
def rebuild(self, *args, **kwargs):
self._fsmonitorstate.invalidate()
- return super(fsmonitordirstate, self).rebuild(*args, **kwargs)
+ return super().rebuild(*args, **kwargs)
def invalidate(self, *args, **kwargs):
self._fsmonitorstate.invalidate()
- return super(fsmonitordirstate, self).invalidate(*args, **kwargs)
+ return super().invalidate(*args, **kwargs)
dirstate.__class__ = fsmonitordirstate
dirstate._fsmonitorinit(repo)
@@ -979,14 +979,14 @@
class fsmonitorrepo(repo.__class__):
def status(self, *args, **kwargs):
- orig = super(fsmonitorrepo, self).status
+ orig = super().status
return overridestatus(orig, self, *args, **kwargs)
def wlocknostateupdate(self, *args, **kwargs):
- return super(fsmonitorrepo, self).wlock(*args, **kwargs)
+ return super().wlock(*args, **kwargs)
def wlock(self, *args, **kwargs):
- l = super(fsmonitorrepo, self).wlock(*args, **kwargs)
+ l = super().wlock(*args, **kwargs)
if not ui.configbool(
b"experimental", b"fsmonitor.transaction_notify"
):
--- a/hgext/fsmonitor/pywatchman/__init__.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/fsmonitor/pywatchman/__init__.py Sun Jan 05 22:23:31 2025 -0500
@@ -264,16 +264,14 @@
class WatchmanEnvironmentError(WatchmanError):
def __init__(self, msg, errno, errmsg, cmd=None):
- super(WatchmanEnvironmentError, self).__init__(
+ super().__init__(
"{0}: errno={1} errmsg={2}".format(msg, errno, errmsg), cmd
)
class SocketConnectError(WatchmanError):
def __init__(self, sockpath, exc):
- super(SocketConnectError, self).__init__(
- "unable to connect to %s: %s" % (sockpath, exc)
- )
+ super().__init__("unable to connect to %s: %s" % (sockpath, exc))
self.sockpath = sockpath
self.exc = exc
@@ -295,9 +293,7 @@
"""
def __init__(self, msg, cmd=None):
- super(CommandError, self).__init__(
- "watchman command error: %s" % (msg,), cmd
- )
+ super().__init__("watchman command error: %s" % (msg,), cmd)
class Transport:
@@ -701,7 +697,7 @@
"""use the BSER encoding. This is the default, preferred codec"""
def __init__(self, transport, value_encoding, value_errors):
- super(BserCodec, self).__init__(transport)
+ super().__init__(transport)
self._value_encoding = value_encoding
self._value_errors = value_errors
@@ -753,9 +749,7 @@
"""use BSER v2 encoding"""
def __init__(self, transport, value_encoding, value_errors):
- super(Bser2WithFallbackCodec, self).__init__(
- transport, value_encoding, value_errors
- )
+ super().__init__(transport, value_encoding, value_errors)
if compat.PYTHON3:
bserv2_key = "required"
else:
@@ -827,7 +821,7 @@
json = None
def __init__(self, transport):
- super(JsonCodec, self).__init__(transport)
+ super().__init__(transport)
# optional dep on json, only if JsonCodec is used
import json
--- a/hgext/fsmonitor/watchmanclient.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/fsmonitor/watchmanclient.py Sun Jan 05 22:23:31 2025 -0500
@@ -41,7 +41,7 @@
class WatchmanNoRoot(Unavailable):
def __init__(self, root, msg):
self.root = root
- super(WatchmanNoRoot, self).__init__(msg)
+ super().__init__(msg)
class client:
--- a/hgext/git/gitlog.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/git/gitlog.py Sun Jan 05 22:23:31 2025 -0500
@@ -580,7 +580,7 @@
class filelog(baselog, repository.ifilestorage):
def __init__(self, gr, db, path):
- super(filelog, self).__init__(gr, db)
+ super().__init__(gr, db)
assert isinstance(path, bytes)
self.path = path
self.nullid = sha1nodeconstants.nullid
--- a/hgext/histedit.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/histedit.py Sun Jan 05 22:23:31 2025 -0500
@@ -797,7 +797,7 @@
self.repo.ui.debug(b'node %s unchanged\n' % short(self.node))
return rulectx, []
- return super(pick, self).run()
+ return super().run()
@action(
@@ -826,7 +826,7 @@
class fold(histeditaction):
def verify(self, prev, expected, seen):
"""Verifies semantic correctness of the fold rule"""
- super(fold, self).verify(prev, expected, seen)
+ super().verify(prev, expected, seen)
repo = self.repo
if not prev:
c = repo[self.node].p1()
--- a/hgext/keyword.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/keyword.py Sun Jan 05 22:23:31 2025 -0500
@@ -398,13 +398,13 @@
"""
def __init__(self, opener, kwt, path):
- super(kwfilelog, self).__init__(opener, path)
+ super().__init__(opener, path)
self.kwt = kwt
self.path = path
def read(self, node):
'''Expands keywords when reading filelog.'''
- data = super(kwfilelog, self).read(node)
+ data = super().read(node)
if self.renamed(node):
return data
return self.kwt.expand(self.path, node, data)
@@ -412,12 +412,12 @@
def add(self, text, meta, tr, link, p1=None, p2=None):
'''Removes keyword substitutions when adding to filelog.'''
text = self.kwt.shrink(self.path, text)
- return super(kwfilelog, self).add(text, meta, tr, link, p1, p2)
+ return super().add(text, meta, tr, link, p1, p2)
def cmp(self, node, text):
'''Removes keyword substitutions for comparison.'''
text = self.kwt.shrink(self.path, text)
- return super(kwfilelog, self).cmp(node, text)
+ return super().cmp(node, text)
def _status(ui, repo, wctx, kwt, *pats, **opts):
@@ -854,7 +854,7 @@
return kwfilelog(self.svfs, kwt, f)
def wread(self, filename):
- data = super(kwrepo, self).wread(filename)
+ data = super().wread(filename)
return kwt.wread(filename, data)
def commit(self, *args, **opts):
@@ -862,12 +862,12 @@
# other extensions can still wrap repo.commitctx directly
self.commitctx = self.kwcommitctx
try:
- return super(kwrepo, self).commit(*args, **opts)
+ return super().commit(*args, **opts)
finally:
del self.commitctx
def kwcommitctx(self, ctx, error=False, origctx=None):
- n = super(kwrepo, self).commitctx(ctx, error, origctx)
+ n = super().commitctx(ctx, error, origctx)
# no lock needed, only called from repo.commit() which already locks
if not kwt.postcommit:
restrict = kwt.restrict
@@ -884,7 +884,7 @@
try:
if not dryrun:
changed = self[b'.'].files()
- ret = super(kwrepo, self).rollback(dryrun, force)
+ ret = super().rollback(dryrun, force)
if not dryrun:
ctx = self[b'.']
modified, added = _preselect(ctx.status(), changed)
--- a/hgext/largefiles/lfcommands.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/largefiles/lfcommands.py Sun Jan 05 22:23:31 2025 -0500
@@ -171,12 +171,12 @@
class lfsource(filemap.filemap_source):
def __init__(self, ui, source):
- super(lfsource, self).__init__(ui, source, None)
+ super().__init__(ui, source, None)
self.filemapper.rename[lfutil.shortname] = b'.'
def getfile(self, name, rev):
realname, realrev = rev
- f = super(lfsource, self).getfile(name, rev)
+ f = super().getfile(name, rev)
if (
not realname.startswith(lfutil.shortnameslash)
@@ -199,9 +199,7 @@
def __init__(self, ui, source, dest, revmapfile, opts):
src = lfsource(ui, source)
- super(converter, self).__init__(
- ui, src, dest, revmapfile, opts
- )
+ super().__init__(ui, src, dest, revmapfile, opts)
found, missing = downloadlfiles(ui, rsrc)
if missing != 0:
--- a/hgext/largefiles/lfutil.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/largefiles/lfutil.py Sun Jan 05 22:23:31 2025 -0500
@@ -167,12 +167,10 @@
# be in unix form for the superclass?
def set_tracked(self, f, reset_copy=False):
- return super(largefilesdirstate, self).set_tracked(
- unixpath(f), reset_copy=reset_copy
- )
+ return super().set_tracked(unixpath(f), reset_copy=reset_copy)
def set_untracked(self, f):
- return super(largefilesdirstate, self).set_untracked(unixpath(f))
+ return super().set_untracked(unixpath(f))
def _dirignore(self, f):
return False
@@ -183,7 +181,7 @@
# (2) avoid develwarn 'use dirstate.write with ....'
if tr:
tr.addbackup(b'largefiles/dirstate', location=b'plain')
- super(largefilesdirstate, self).write(None)
+ super().write(None)
def openlfdirstate(ui, repo, create=True):
--- a/hgext/largefiles/localstore.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/largefiles/localstore.py Sun Jan 05 22:23:31 2025 -0500
@@ -26,7 +26,7 @@
def __init__(self, ui, repo, remote):
self.remote = remote.local()
- super(localstore, self).__init__(ui, repo, self.remote.url())
+ super().__init__(ui, repo, self.remote.url())
def put(self, source, hash):
if lfutil.instore(self.remote, hash):
--- a/hgext/largefiles/remotestore.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/largefiles/remotestore.py Sun Jan 05 22:23:31 2025 -0500
@@ -34,7 +34,7 @@
'''a largefile store accessed over a network'''
def __init__(self, ui, repo, url):
- super(remotestore, self).__init__(ui, repo, url)
+ super().__init__(ui, repo, url)
self._lstore = None
if repo is not None:
self._lstore = localstore.localstore(self.ui, self.repo, self.repo)
--- a/hgext/largefiles/reposetup.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/largefiles/reposetup.py Sun Jan 05 22:23:31 2025 -0500
@@ -48,7 +48,7 @@
# identifies the largefiles as always binary, regardless of
# their actual contents.
def __getitem__(self, changeid):
- ctx = super(lfilesrepo, self).__getitem__(changeid)
+ ctx = super().__getitem__(changeid)
if self.lfstatus:
def files(orig):
@@ -62,7 +62,7 @@
class lfilesmanifest(man1.__class__):
def __contains__(self, filename):
- orig = super(lfilesmanifest, self).__contains__
+ orig = super().__contains__
return orig(filename) or orig(
lfutil.standin(filename)
)
@@ -111,7 +111,7 @@
listsubrepos=False,
):
listignored, listclean, listunknown = ignored, clean, unknown
- orig = super(lfilesrepo, self).status
+ orig = super().status
if not self.lfstatus:
return orig(
node1,
@@ -331,11 +331,11 @@
return scmutil.status(*result)
def commitctx(self, ctx, *args, **kwargs):
- node = super(lfilesrepo, self).commitctx(ctx, *args, **kwargs)
+ node = super().commitctx(ctx, *args, **kwargs)
class lfilesctx(ctx.__class__):
def markcommitted(self, node):
- orig = super(lfilesctx, self).markcommitted
+ orig = super().markcommitted
return lfutil.markcommitted(orig, self, node)
ctx.__class__ = lfilesctx
@@ -356,7 +356,7 @@
):
if extra is None:
extra = {}
- orig = super(lfilesrepo, self).commit
+ orig = super().commit
with self.wlock():
lfcommithook = self._lfcommithooks[-1]
--- a/hgext/largefiles/wirestore.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/largefiles/wirestore.py Sun Jan 05 22:23:31 2025 -0500
@@ -22,7 +22,7 @@
if b'serve' not in storetypes:
raise lfutil.storeprotonotcapable(storetypes)
self.remote = remote
- super(wirestore, self).__init__(ui, repo, remote.url())
+ super().__init__(ui, repo, remote.url())
def _put(self, hash, fd):
return self.remote.putlfile(hash, fd)
--- a/hgext/lfs/__init__.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/lfs/__init__.py Sun Jan 05 22:23:31 2025 -0500
@@ -252,7 +252,7 @@
@localrepo.unfilteredmethod
def commitctx(self, ctx, error=False, origctx=None):
repo.svfs.options[b'lfstrack'] = _trackedmatcher(self)
- return super(lfsrepo, self).commitctx(ctx, error, origctx=origctx)
+ return super().commitctx(ctx, error, origctx=origctx)
repo.__class__ = lfsrepo
--- a/hgext/lfs/blobstore.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/lfs/blobstore.py Sun Jan 05 22:23:31 2025 -0500
@@ -49,7 +49,7 @@
"""split the path at first two characters, like: XX/XXXXX..."""
if not _lfsre.match(path):
raise error.ProgrammingError(b'unexpected lfs path: %s' % path)
- return super(lfsvfs, self).join(path[0:2], path[2:], *insidef)
+ return super().join(path[0:2], path[2:], *insidef)
def walk(self, path=None, onerror=None):
"""Yield (dirpath, [], oids) tuple for blobs under path
@@ -104,7 +104,7 @@
"""a file-like object that supports keepalive."""
def __init__(self, ui, filename):
- super(lfsuploadfile, self).__init__(ui, filename, b'rb')
+ super().__init__(ui, filename, b'rb')
self.read = self._data.read
def _makeprogress(self):
--- a/hgext/lfs/pointer.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/lfs/pointer.py Sun Jan 05 22:23:31 2025 -0500
@@ -27,7 +27,7 @@
def __init__(self, *args, **kwargs):
self[b'version'] = self.VERSION
- super(gitlfspointer, self).__init__(*args)
+ super().__init__(*args)
self.update(pycompat.byteskwargs(kwargs))
@classmethod
--- a/hgext/lfs/wrapper.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/lfs/wrapper.py Sun Jan 05 22:23:31 2025 -0500
@@ -291,7 +291,7 @@
full,
cleanp2,
):
- pc = super(lfssink, self).putcommit
+ pc = super().putcommit
node = pc(
files,
copies,
--- a/hgext/mq.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/mq.py Sun Jan 05 22:23:31 2025 -0500
@@ -4086,7 +4086,7 @@
return queue(self.ui, self.baseui, self.path)
def invalidateall(self):
- super(mqrepo, self).invalidateall()
+ super().invalidateall()
if localrepo.hasunfilteredcache(self, 'mq'):
# recreate mq in case queue path was changed
delattr(self.unfiltered(), 'mq')
@@ -4114,9 +4114,7 @@
_(b'cannot commit over an applied mq patch'), force
)
- return super(mqrepo, self).commit(
- text, user, date, match, force, editor, extra
- )
+ return super().commit(text, user, date, match, force, editor, extra)
def checkpush(self, pushop):
if self.mq.applied and self.mq.checkapplied and not pushop.force:
@@ -4136,11 +4134,11 @@
if self[node].phase() < phases.secret:
raise error.Abort(_(b'source has mq patches applied'))
# no non-secret patches pushed
- super(mqrepo, self).checkpush(pushop)
+ super().checkpush(pushop)
def _findtags(self):
'''augment tags from base class with patch tags'''
- result = super(mqrepo, self)._findtags()
+ result = super()._findtags()
q = self.mq
if not q.applied:
--- a/hgext/narrow/narrowdirstate.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/narrow/narrowdirstate.py Sun Jan 05 22:23:31 2025 -0500
@@ -35,42 +35,42 @@
# sparse checkout
@_editfunc
def normal(self, *args, **kwargs):
- return super(narrowdirstate, self).normal(*args, **kwargs)
+ return super().normal(*args, **kwargs)
@_editfunc
def set_tracked(self, *args, **kwargs):
- return super(narrowdirstate, self).set_tracked(*args, **kwargs)
+ return super().set_tracked(*args, **kwargs)
@_editfunc
def set_untracked(self, *args):
- return super(narrowdirstate, self).set_untracked(*args)
+ return super().set_untracked(*args)
@_editfunc
def add(self, *args):
- return super(narrowdirstate, self).add(*args)
+ return super().add(*args)
@_editfunc
def normallookup(self, *args):
- return super(narrowdirstate, self).normallookup(*args)
+ return super().normallookup(*args)
@_editfunc
def copy(self, *args):
- return super(narrowdirstate, self).copy(*args)
+ return super().copy(*args)
@_editfunc
def remove(self, *args):
- return super(narrowdirstate, self).remove(*args)
+ return super().remove(*args)
@_editfunc
def merge(self, *args):
- return super(narrowdirstate, self).merge(*args)
+ return super().merge(*args)
def rebuild(self, parent, allfiles, changedfiles=None):
if changedfiles is None:
# Rebuilding entire dirstate, let's filter allfiles to match the
# narrowspec.
allfiles = [f for f in allfiles if repo.narrowmatch()(f)]
- super(narrowdirstate, self).rebuild(parent, allfiles, changedfiles)
+ super().rebuild(parent, allfiles, changedfiles)
dirstate.__class__ = narrowdirstate
return dirstate
--- a/hgext/narrow/narrowrepo.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/narrow/narrowrepo.py Sun Jan 05 22:23:31 2025 -0500
@@ -17,11 +17,11 @@
class narrowrepository(repo.__class__):
def _makedirstate(self):
- dirstate = super(narrowrepository, self)._makedirstate()
+ dirstate = super()._makedirstate()
return narrowdirstate.wrapdirstate(self, dirstate)
def peer(self, *args, **kwds):
- peer = super(narrowrepository, self).peer(*args, **kwds)
+ peer = super().peer(*args, **kwds)
peer._caps.add(wireprototypes.NARROWCAP)
peer._caps.add(wireprototypes.ELLIPSESCAP)
return peer
--- a/hgext/remotefilelog/connectionpool.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/connectionpool.py Sun Jan 05 22:23:31 2025 -0500
@@ -49,7 +49,7 @@
# open (i.e. us).
if hasattr(self, 'pipee'):
self.pipee.close()
- return super(mypeer, self)._cleanup()
+ return super()._cleanup()
peer.__class__ = mypeer
--- a/hgext/remotefilelog/contentstore.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/contentstore.py Sun Jan 05 22:23:31 2025 -0500
@@ -37,7 +37,7 @@
class unioncontentstore(basestore.baseunionstore):
def __init__(self, *args, **kwargs):
- super(unioncontentstore, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self.stores = args
self.writestore = kwargs.get('writestore')
@@ -159,7 +159,7 @@
class remotefilelogcontentstore(basestore.basestore):
def __init__(self, *args, **kwargs):
- super(remotefilelogcontentstore, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self._threaddata = threading.local()
def get(self, name, node):
--- a/hgext/remotefilelog/datapack.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/datapack.py Sun Jan 05 22:23:31 2025 -0500
@@ -32,7 +32,7 @@
PACKSUFFIX = PACKSUFFIX
def __init__(self, ui, path):
- super(datapackstore, self).__init__(ui, path)
+ super().__init__(ui, path)
def getpack(self, path):
return datapack(path)
--- a/hgext/remotefilelog/fileserverclient.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/fileserverclient.py Sun Jan 05 22:23:31 2025 -0500
@@ -127,15 +127,13 @@
def _sendrequest(self, command, args, **opts):
self._updatecallstreamopts(command, args)
- return super(remotefilepeer, self)._sendrequest(
- command, args, **opts
- )
+ return super()._sendrequest(command, args, **opts)
def _callstream(self, command, **opts):
- supertype = super(remotefilepeer, self)
+ supertype = super()
if not hasattr(supertype, '_sendrequest'):
self._updatecallstreamopts(command, pycompat.byteskwargs(opts))
- return super(remotefilepeer, self)._callstream(command, **opts)
+ return super()._callstream(command, **opts)
peer.__class__ = remotefilepeer
--- a/hgext/remotefilelog/historypack.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/historypack.py Sun Jan 05 22:23:31 2025 -0500
@@ -90,7 +90,7 @@
SUPPORTED_VERSIONS = [2]
def __init__(self, path):
- super(historypack, self).__init__(path)
+ super().__init__(path)
self.INDEXFORMAT = INDEXFORMAT2
self.INDEXENTRYLENGTH = INDEXENTRYLENGTH2
@@ -430,7 +430,7 @@
SUPPORTED_VERSIONS = [2]
def __init__(self, ui, packpath, version=2):
- super(mutablehistorypack, self).__init__(ui, packpath, version=version)
+ super().__init__(ui, packpath, version=version)
self.files = {}
self.entrylocations = {}
self.fileentries = {}
@@ -510,7 +510,7 @@
self._write()
- return super(mutablehistorypack, self).close(ledger=ledger)
+ return super().close(ledger=ledger)
def createindex(self, nodelocations, indexoffset):
fileindexformat = self.INDEXFORMAT
--- a/hgext/remotefilelog/metadatastore.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/metadatastore.py Sun Jan 05 22:23:31 2025 -0500
@@ -12,7 +12,7 @@
class unionmetadatastore(basestore.baseunionstore):
def __init__(self, *args, **kwargs):
- super(unionmetadatastore, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self.stores = args
self.writestore = kwargs.get('writestore')
--- a/hgext/remotefilelog/remotefilectx.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/remotefilectx.py Sun Jan 05 22:23:31 2025 -0500
@@ -39,9 +39,7 @@
fileid = repo.nullid
if fileid and len(fileid) == 40:
fileid = bin(fileid)
- super(remotefilectx, self).__init__(
- repo, path, changeid, fileid, filelog, changectx
- )
+ super().__init__(repo, path, changeid, fileid, filelog, changectx)
self._ancestormap = ancestormap
def size(self):
@@ -485,7 +483,7 @@
)
if fetch:
self._repo.fileservice.prefetch(fetch)
- return super(remotefilectx, self).annotate(*args, **kwargs)
+ return super().annotate(*args, **kwargs)
# Return empty set so that the hg serve and thg don't stack trace
def children(self):
@@ -495,9 +493,7 @@
class remoteworkingfilectx(context.workingfilectx, remotefilectx):
def __init__(self, repo, path, filelog=None, workingctx=None):
self._ancestormap = None
- super(remoteworkingfilectx, self).__init__(
- repo, path, filelog, workingctx
- )
+ super().__init__(repo, path, filelog, workingctx)
def parents(self):
return remotefilectx.parents(self)
--- a/hgext/remotefilelog/shallowbundle.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/shallowbundle.py Sun Jan 05 22:23:31 2025 -0500
@@ -58,7 +58,7 @@
if shallowutil.isenabled(self._repo):
fastpathlinkrev = False
- return super(shallowcg1packer, self).generate(
+ return super().generate(
commonrevs, clnodes, fastpathlinkrev, source, **kwargs
)
@@ -92,9 +92,7 @@
[f for f in changedfiles if not repo.shallowmatch(f)]
)
- return super(shallowcg1packer, self).generatefiles(
- changedfiles, *args, **kwargs
- )
+ return super().generatefiles(changedfiles, *args, **kwargs)
def shouldaddfilegroups(self, source):
repo = self._repo
@@ -129,9 +127,7 @@
def prune(self, rlog, missing, commonrevs):
if not isinstance(rlog, remotefilelog.remotefilelog):
- return super(shallowcg1packer, self).prune(
- rlog, missing, commonrevs
- )
+ return super().prune(rlog, missing, commonrevs)
repo = self._repo
results = []
--- a/hgext/remotefilelog/shallowrepo.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/remotefilelog/shallowrepo.py Sun Jan 05 22:23:31 2025 -0500
@@ -183,15 +183,13 @@
if self.shallowmatch(f):
return remotefilelog.remotefilelog(self.svfs, f, self)
else:
- return super(shallowrepository, self).file(f)
+ return super().file(f)
def filectx(self, path, *args, **kwargs):
if self.shallowmatch(path):
return remotefilectx.remotefilectx(self, path, *args, **kwargs)
else:
- return super(shallowrepository, self).filectx(
- path, *args, **kwargs
- )
+ return super().filectx(path, *args, **kwargs)
@localrepo.unfilteredmethod
def commitctx(self, ctx, error=False, origctx=None):
@@ -211,9 +209,7 @@
if fparent1 != self.nullid:
files.append((f, hex(fparent1)))
self.fileservice.prefetch(files)
- return super(shallowrepository, self).commitctx(
- ctx, error=error, origctx=origctx
- )
+ return super().commitctx(ctx, error=error, origctx=origctx)
def backgroundprefetch(
self, revs, base=None, repack=False, pats=None, opts=None
@@ -324,7 +320,7 @@
repo.fileservice.prefetch(results)
def close(self):
- super(shallowrepository, self).close()
+ super().close()
self.connectionpool.close()
repo.__class__ = shallowrepository
--- a/hgext/sqlitestore.py Sun Jan 05 22:12:02 2025 -0500
+++ b/hgext/sqlitestore.py Sun Jan 05 22:23:31 2025 -0500
@@ -1147,7 +1147,7 @@
def transaction(self, *args, **kwargs):
current = self.currenttransaction()
- tr = super(sqliterepository, self).transaction(*args, **kwargs)
+ tr = super().transaction(*args, **kwargs)
if current:
return tr
--- a/i18n/polib.py Sun Jan 05 22:12:02 2025 -0500
+++ b/i18n/polib.py Sun Jan 05 22:23:31 2025 -0500
@@ -408,7 +408,7 @@
"""
if self.check_for_duplicates and entry in self:
raise ValueError('Entry "%s" already exists' % entry.msgid)
- super(_BaseFile, self).append(entry)
+ super().append(entry)
def insert(self, index, entry):
"""
@@ -426,7 +426,7 @@
"""
if self.check_for_duplicates and entry in self:
raise ValueError('Entry "%s" already exists' % entry.msgid)
- super(_BaseFile, self).insert(index, entry)
+ super().insert(index, entry)
def metadata_as_entry(self):
"""
--- a/mercurial/bundle2.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/bundle2.py Sun Jan 05 22:23:31 2025 -0500
@@ -853,7 +853,7 @@
self.ui = ui
self._compengine = util.compengines.forbundletype(b'UN')
self._compressed = None
- super(unbundle20, self).__init__(fp)
+ super().__init__(fp)
@util.propertycache
def params(self):
@@ -1269,7 +1269,7 @@
Part processed in this manner only have access to a ui object,"""
def __init__(self, ui, fp):
- super(interrupthandler, self).__init__(fp)
+ super().__init__(fp)
self.ui = ui
def _readpartheader(self):
@@ -1390,7 +1390,7 @@
"""a bundle part read from a bundle"""
def __init__(self, ui, header, fp):
- super(unbundlepart, self).__init__(fp)
+ super().__init__(fp)
self._seekable = hasattr(fp, 'seek') and hasattr(fp, 'tell')
self.ui = ui
# unbundle state attr
@@ -1526,7 +1526,7 @@
# (payload, file) offsets for chunk starts.
self._chunkindex = []
- super(seekableunbundlepart, self).__init__(ui, header, fp)
+ super().__init__(ui, header, fp)
def _payloadchunks(self, chunknum=0):
'''seek to specified chunk and start yielding data'''
--- a/mercurial/bundlerepo.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/bundlerepo.py Sun Jan 05 22:23:31 2025 -0500
@@ -128,7 +128,7 @@
# delta base, not against rev - 1
# XXX: could use some caching
if rev <= self.repotiprev:
- return super(bundlerevlog, self)._inner._chunk(rev)
+ return super()._inner._chunk(rev)
self.bundle.seek(self.start(rev))
return self.bundle.read(self.length(rev))
@@ -164,7 +164,7 @@
if iterrev == nullrev:
rawtext = b''
elif rawtext is None:
- r = super(bundlerevlog, self)._rawtext(
+ r = super()._rawtext(
self.node(iterrev),
iterrev,
)
@@ -242,7 +242,7 @@
self._dirlogstarts,
dir=d,
)
- return super(bundlemanifest, self).dirlog(d)
+ return super().dirlog(d)
class bundlefilelog(filelog.filelog):
@@ -265,7 +265,7 @@
class bundlephasecache(phases.phasecache):
def __init__(self, *args, **kwargs):
- super(bundlephasecache, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
if hasattr(self, 'opener'):
self.opener = vfsmod.readonlyvfs(self.opener)
@@ -499,7 +499,7 @@
linkmapper = self.unfiltered().changelog.rev
return bundlefilelog(self.svfs, f, self._cgunpacker, linkmapper)
else:
- return super(bundlerepository, self).file(f)
+ return super().file(f)
def close(self):
"""Close assigned bundle file immediately."""
@@ -529,7 +529,7 @@
self.ui.warn(msg % hex(p1))
if self.changelog.repotiprev < p2rev:
self.ui.warn(msg % hex(p2))
- return super(bundlerepository, self).setparents(p1, p2)
+ return super().setparents(p1, p2)
def instance(ui, path, create, intents=None, createopts=None):
--- a/mercurial/changegroup.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/changegroup.py Sun Jan 05 22:23:31 2025 -0500
@@ -828,7 +828,7 @@
debug_info=None,
delta_base_reuse_policy=None,
):
- super(cg3unpacker, self)._unpackmanifests(
+ super()._unpackmanifests(
repo,
revmap,
trp,
@@ -868,7 +868,7 @@
return node, p1, p2, deltabase, cs, flags, protocol_flags
def deltachunk(self, prevnode):
- res = super(cg4unpacker, self).deltachunk(prevnode)
+ res = super().deltachunk(prevnode)
if not res:
return res
--- a/mercurial/changelog.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/changelog.py Sun Jan 05 22:23:31 2025 -0500
@@ -136,7 +136,7 @@
if not text:
return _changelogrevision(extra=_defaultextra, manifest=cl.nullid)
- self = super(changelogrevision, cls).__new__(cls)
+ self = super().__new__(cls)
# We could return here and implement the following as an __init__.
# But doing it here is equivalent and saves an extra function call.
@@ -352,7 +352,7 @@
def _write_docket(self, tr):
if not self._v2_delayed:
- super(changelog, self)._write_docket(tr)
+ super()._write_docket(tr)
def delayupdate(self, tr):
"""delay visibility of index updates to other readers"""
--- a/mercurial/chgserver.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/chgserver.py Sun Jan 05 22:23:31 2025 -0500
@@ -223,7 +223,7 @@
def _newchgui(srcui, csystem, attachio):
class chgui(srcui.__class__):
def __init__(self, src=None):
- super(chgui, self).__init__(src)
+ super().__init__(src)
if src:
self._csystem = getattr(src, '_csystem', csystem)
else:
@@ -359,7 +359,7 @@
def __init__(
self, ui, repo, fin, fout, sock, prereposetups, hashstate, baseaddress
):
- super(chgcmdserver, self).__init__(
+ super().__init__(
_newchgui(ui, channeledsystem(fin, fout, b'S'), self.attachio),
repo,
fin,
@@ -376,7 +376,7 @@
self.capabilities[b'validate'] = chgcmdserver.validate
def cleanup(self):
- super(chgcmdserver, self).cleanup()
+ super().cleanup()
# dispatch._runcatch() does not flush outputs if exception is not
# handled by dispatch._dispatch()
self.ui.flush()
@@ -572,7 +572,7 @@
globaloldios = self._oldios
self._oldios = []
try:
- return super(chgcmdserver, self).runcommand()
+ return super().runcommand()
finally:
self._restoreio()
self._oldios = globaloldios
--- a/mercurial/commandserver.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/commandserver.py Sun Jan 05 22:23:31 2025 -0500
@@ -721,7 +721,7 @@
class unixcmdserverrepo(repo.__class__):
def close(self):
- super(unixcmdserverrepo, self).close()
+ super().close()
try:
self._cmdserveripc.send(self.root)
except OSError:
--- a/mercurial/configitems.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/configitems.py Sun Jan 05 22:23:31 2025 -0500
@@ -80,20 +80,20 @@
"""A specialized dictionary that can handle wild-card selection"""
def __init__(self):
- super(itemregister, self).__init__()
+ super().__init__()
self._generics = set()
def update(self, other): # pytype: disable=signature-mismatch
- super(itemregister, self).update(other)
+ super().update(other)
self._generics.update(other._generics)
def __setitem__(self, key, item):
- super(itemregister, self).__setitem__(key, item)
+ super().__setitem__(key, item)
if item.generic:
self._generics.add(item)
def get(self, key):
- baseitem = super(itemregister, self).get(key)
+ baseitem = super().get(key)
if baseitem is not None and not baseitem.generic:
return baseitem
--- a/mercurial/context.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/context.py Sun Jan 05 22:23:31 2025 -0500
@@ -505,7 +505,7 @@
the repo."""
def __init__(self, repo, rev, node, maybe_filtered=True):
- super(changectx, self).__init__(repo)
+ super().__init__(repo)
self._rev = rev
self._node = node
# When maybe_filtered is True, the revision might be affected by
@@ -660,7 +660,7 @@
p1copies = p2copies = None
if p1copies is None:
if compute_on_none:
- p1copies, p2copies = super(changectx, self)._copies
+ p1copies, p2copies = super()._copies
else:
if p1copies is None:
p1copies = {}
@@ -1400,7 +1400,7 @@
changes=None,
branch=None,
):
- super(committablectx, self).__init__(repo)
+ super().__init__(repo)
self._rev = None
self._node = None
self._text = text
@@ -1574,9 +1574,7 @@
branch = repo.dirstate.branch()
except UnicodeDecodeError:
raise error.Abort(_(b'branch name not in UTF-8!'))
- super(workingctx, self).__init__(
- repo, text, user, date, extra, changes, branch=branch
- )
+ super().__init__(repo, text, user, date, extra, changes, branch=branch)
def __iter__(self):
d = self._repo.dirstate
@@ -1626,7 +1624,7 @@
def _fileinfo(self, path):
# populate __dict__['_manifest'] as workingctx has no _manifestdelta
self._manifest
- return super(workingctx, self)._fileinfo(path)
+ return super()._fileinfo(path)
def _buildflagfunc(self):
# Create a fallback function for getting file flags when the
@@ -2018,7 +2016,7 @@
# they are supposed to be linking to.
s.modified[:] = self._filtersuspectsymlink(s.modified)
if other != self._repo[b'.']:
- s = super(workingctx, self)._buildstatus(
+ s = super()._buildstatus(
other, s, match, listignored, listclean, listunknown
)
return s
@@ -2157,7 +2155,7 @@
file in the working directory convenient."""
def __init__(self, repo, path, filelog=None, workingctx=None):
- super(workingfilectx, self).__init__(repo, path, filelog, workingctx)
+ super().__init__(repo, path, filelog, workingctx)
@propertycache
def _changectx(self):
@@ -2260,7 +2258,7 @@
"""
def __init__(self, repo):
- super(overlayworkingctx, self).__init__(repo)
+ super().__init__(repo)
self.clean()
def setbase(self, wrappedctx):
@@ -2668,7 +2666,7 @@
cache, which can be flushed through later by calling ``flush()``."""
def __init__(self, repo, path, filelog=None, parent=None):
- super(overlayworkingfilectx, self).__init__(repo, path, filelog, parent)
+ super().__init__(repo, path, filelog, parent)
self._repo = repo
self._parent = parent
self._path = path
@@ -2730,9 +2728,7 @@
def __init__(
self, repo, changes, text=b"", user=None, date=None, extra=None
):
- super(workingcommitctx, self).__init__(
- repo, text, user, date, extra, changes
- )
+ super().__init__(repo, text, user, date, extra, changes)
def _dirstatestatus(
self, match, ignored=False, clean=False, unknown=False
@@ -2875,9 +2871,7 @@
branch=None,
editor=None,
):
- super(memctx, self).__init__(
- repo, text, user, date, extra, branch=branch
- )
+ super().__init__(repo, text, user, date, extra, branch=branch)
self._rev = None
self._node = None
parents = [(p or self._repo.nodeconstants.nullid) for p in parents]
@@ -2984,7 +2978,7 @@
isexec is True if the file is executable.
copied is the source file path if current file was copied in the
revision being committed, or None."""
- super(memfilectx, self).__init__(repo, path, None, changectx)
+ super().__init__(repo, path, None, changectx)
self._data = data
if islink:
self._flags = b'l'
@@ -3042,7 +3036,7 @@
):
if text is None:
text = originalctx.description()
- super(metadataonlyctx, self).__init__(repo, text, user, date, extra)
+ super().__init__(repo, text, user, date, extra)
self._rev = None
self._node = None
self._originalctx = originalctx
--- a/mercurial/dirstateutils/timestamp.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/dirstateutils/timestamp.py Sun Jan 05 22:23:31 2025 -0500
@@ -38,7 +38,7 @@
def __new__(cls, value):
truncated_seconds, subsec_nanos, second_ambiguous = value
value = (truncated_seconds & rangemask, subsec_nanos, second_ambiguous)
- return super(timestamp, cls).__new__(cls, value)
+ return super().__new__(cls, value)
def __eq__(self, other):
raise error.ProgrammingError(
--- a/mercurial/encoding.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/encoding.py Sun Jan 05 22:23:31 2025 -0500
@@ -130,7 +130,7 @@
if typing.TYPE_CHECKING:
# pseudo implementation to help pytype see localstr() constructor
def __init__(self, u: bytes, l: bytes) -> None:
- super(localstr, self).__init__(l)
+ super().__init__(l)
self._utf8 = u
def __hash__(self):
--- a/mercurial/error.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/error.py Sun Jan 05 22:23:31 2025 -0500
@@ -46,7 +46,7 @@
def __init__(self, *args, **kw):
self.hint: Optional[bytes] = kw.pop('hint', None)
- super(Hint, self).__init__(*args, **kw)
+ super().__init__(*args, **kw)
class Error(Hint, Exception):
@@ -150,7 +150,7 @@
def __init__(self, command: Optional[bytes], message: bytes) -> None:
self.command = command
self.message = message
- super(CommandError, self).__init__()
+ super().__init__()
__bytes__ = _tobytes
@@ -165,7 +165,7 @@
) -> None:
self.command = command
self.all_commands = all_commands
- super(UnknownCommand, self).__init__()
+ super().__init__()
__bytes__ = _tobytes
@@ -176,7 +176,7 @@
def __init__(self, prefix: bytes, matches: List[bytes]) -> None:
self.prefix = prefix
self.matches = matches
- super(AmbiguousCommand, self).__init__()
+ super().__init__()
__bytes__ = _tobytes
@@ -187,7 +187,7 @@
def __init__(self, status_code: int) -> None:
self.status_code = status_code
# Pass status code to superclass just so it becomes part of __bytes__
- super(WorkerError, self).__init__(status_code)
+ super().__init__(status_code)
__bytes__ = _tobytes
@@ -285,7 +285,7 @@
location: Optional[bytes] = None,
hint: Optional[bytes] = None,
) -> None:
- super(ConfigError, self).__init__(message, hint=hint)
+ super().__init__(message, hint=hint)
self.location = location
def format(self) -> bytes:
@@ -349,7 +349,7 @@
message = _(b"remote error:\n%s") % message.rstrip(b'\n')
else:
message = _(b"remote error")
- super(OutOfBandError, self).__init__(message, hint=hint)
+ super().__init__(message, hint=hint)
class ParseError(Abort):
@@ -363,7 +363,7 @@
location: Optional[Union[bytes, int]] = None,
hint: Optional[bytes] = None,
):
- super(ParseError, self).__init__(message, hint=hint)
+ super().__init__(message, hint=hint)
self.location = location
def format(self) -> bytes:
@@ -481,7 +481,7 @@
version: Optional[bytes] = None,
) -> None:
self.version = version
- super(UnknownVersion, self).__init__(msg, hint=hint)
+ super().__init__(msg, hint=hint)
class LockError(IOError):
@@ -549,7 +549,7 @@
# an internal-only error that won't be printed except in a
# stack traces.
msg = pycompat.sysstr(msg)
- super(ProgrammingError, self).__init__(msg, *args, **kwargs)
+ super().__init__(msg, *args, **kwargs)
__bytes__ = _tobytes
--- a/mercurial/fancyopts.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/fancyopts.py Sun Jan 05 22:23:31 2025 -0500
@@ -241,7 +241,7 @@
class _callableopt(customopt):
def __init__(self, callablefn):
self.callablefn = callablefn
- super(_callableopt, self).__init__(None)
+ super().__init__(None)
def newstate(self, oldstate, newparam, abort):
return self.callablefn(newparam)
--- a/mercurial/filelog.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/filelog.py Sun Jan 05 22:23:31 2025 -0500
@@ -274,11 +274,11 @@
"""Filelog variation to be used with narrow stores."""
def __init__(self, opener, path, narrowmatch, try_split=False):
- super(narrowfilelog, self).__init__(opener, path, try_split=try_split)
+ super().__init__(opener, path, try_split=try_split)
self._narrowmatch = narrowmatch
def renamed(self, node):
- res = super(narrowfilelog, self).renamed(node)
+ res = super().renamed(node)
# Renames that come from outside the narrowspec are problematic
# because we may lack the base text for the rename. This can result
@@ -303,10 +303,10 @@
# Because we have a custom renamed() that may lie, we need to call
# the base renamed() to report accurate results.
node = self.node(rev)
- if super(narrowfilelog, self).renamed(node):
+ if super().renamed(node):
return len(self.read(node))
else:
- return super(narrowfilelog, self).size(rev)
+ return super().size(rev)
def cmp(self, node, text):
# We don't call `super` because narrow parents can be buggy in case of a
--- a/mercurial/hgweb/server.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/hgweb/server.py Sun Jan 05 22:23:31 2025 -0500
@@ -386,7 +386,7 @@
def __init__(self, *args, **kwargs):
if self.address_family is None:
raise error.RepoError(_(b'IPv6 is not available on this system'))
- super(IPv6HTTPServer, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def create_server(ui, app):
--- a/mercurial/httppeer.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/httppeer.py Sun Jan 05 22:23:31 2025 -0500
@@ -320,7 +320,7 @@
class RedirectedRepoError(error.RepoError):
def __init__(self, msg, respurl):
- super(RedirectedRepoError, self).__init__(msg)
+ super().__init__(msg)
self.respurl = respurl
--- a/mercurial/keepalive.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/keepalive.py Sun Jan 05 22:23:31 2025 -0500
@@ -537,7 +537,7 @@
self.receivedbytescount = 0
def __repr__(self):
- base = super(HTTPConnection, self).__repr__()
+ base = super().__repr__()
local = "(unconnected)"
s = self.sock
if s:
--- a/mercurial/localrepo.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/localrepo.py Sun Jan 05 22:23:31 2025 -0500
@@ -124,17 +124,17 @@
return unfi.__dict__[self.sname]
except KeyError:
pass
- return super(_basefilecache, self).__get__(unfi, type)
+ return super().__get__(unfi, type)
def set(self, repo, value):
- return super(_basefilecache, self).set(repo.unfiltered(), value)
+ return super().set(repo.unfiltered(), value)
class repofilecache(_basefilecache):
"""filecache for files in .hg but outside of .hg/store"""
def __init__(self, *paths):
- super(repofilecache, self).__init__(*paths)
+ super().__init__(*paths)
for path in paths:
_cachedfiles.add((path, b'plain'))
@@ -146,7 +146,7 @@
"""filecache for files in the store"""
def __init__(self, *paths):
- super(storecache, self).__init__(*paths)
+ super().__init__(*paths)
for path in paths:
_cachedfiles.add((path, b''))
@@ -158,7 +158,7 @@
"""filecache for the changelog"""
def __init__(self):
- super(changelogcache, self).__init__()
+ super().__init__()
_cachedfiles.add((b'00changelog.i', b''))
_cachedfiles.add((b'00changelog.n', b''))
@@ -173,7 +173,7 @@
"""filecache for the manifestlog"""
def __init__(self):
- super(manifestlogcache, self).__init__()
+ super().__init__()
_cachedfiles.add((b'00manifest.i', b''))
_cachedfiles.add((b'00manifest.n', b''))
@@ -190,7 +190,7 @@
def __init__(self, *pathsandlocations):
# scmutil.filecache only uses the path for passing back into our
# join(), so we can safely pass a list of paths and locations
- super(mixedrepostorecache, self).__init__(*pathsandlocations)
+ super().__init__(*pathsandlocations)
_cachedfiles.update(pathsandlocations)
def join(self, obj, fnameandlocation):
@@ -222,7 +222,7 @@
def __get__(self, repo, type=None):
unfi = repo.unfiltered()
if unfi is repo:
- return super(unfilteredpropertycache, self).__get__(unfi)
+ return super().__get__(unfi)
return getattr(unfi, self.name)
@@ -308,9 +308,7 @@
'''peer for a local repo; reflects only the most recent API'''
def __init__(self, repo, caps=None, path=None, remotehidden=False):
- super(localpeer, self).__init__(
- repo.ui, path=path, remotehidden=remotehidden
- )
+ super().__init__(repo.ui, path=path, remotehidden=remotehidden)
if caps is None:
caps = moderncaps.copy()
@@ -467,7 +465,7 @@
restricted capabilities"""
def __init__(self, repo, path=None, remotehidden=False):
- super(locallegacypeer, self).__init__(
+ super().__init__(
repo, caps=legacycaps, path=path, remotehidden=remotehidden
)
--- a/mercurial/logcmdutil.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/logcmdutil.py Sun Jan 05 22:23:31 2025 -0500
@@ -633,7 +633,7 @@
if not self.footer:
self.footer = b""
self.footer += self.t.render(self._parts[b'docfooter'], {})
- return super(changesettemplater, self).close()
+ return super().close()
def _show(self, ctx, copies, props):
'''show a single changeset or file revision'''
--- a/mercurial/manifest.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/manifest.py Sun Jan 05 22:23:31 2025 -0500
@@ -1556,7 +1556,7 @@
_file = b'manifestfulltextcache'
def __init__(self, max):
- super(manifestfulltextcache, self).__init__(max)
+ super().__init__(max)
self._dirty = False
self._read = False
self._opener = None
@@ -1567,7 +1567,7 @@
try:
with self._opener(self._file) as fp:
- set = super(manifestfulltextcache, self).__setitem__
+ set = super().__setitem__
# ignore trailing data, this is a cache, corruption is skipped
while True:
# TODO do we need to do work here for sha1 portability?
@@ -1620,24 +1620,24 @@
def __len__(self):
if not self._read:
self.read()
- return super(manifestfulltextcache, self).__len__()
+ return super().__len__()
def __contains__(self, k):
if not self._read:
self.read()
- return super(manifestfulltextcache, self).__contains__(k)
+ return super().__contains__(k)
def __iter__(self):
if not self._read:
self.read()
- return super(manifestfulltextcache, self).__iter__()
+ return super().__iter__()
def __getitem__(self, k):
if not self._read:
self.read()
# the cache lru order can change on read
setdirty = self._cache.get(k) is not self._head
- value = super(manifestfulltextcache, self).__getitem__(k)
+ value = super().__getitem__(k)
if setdirty:
self._dirty = True
return value
@@ -1645,22 +1645,22 @@
def __setitem__(self, k, v):
if not self._read:
self.read()
- super(manifestfulltextcache, self).__setitem__(k, v)
+ super().__setitem__(k, v)
self._dirty = True
def __delitem__(self, k):
if not self._read:
self.read()
- super(manifestfulltextcache, self).__delitem__(k)
+ super().__delitem__(k)
self._dirty = True
def get(self, k, default=None):
if not self._read:
self.read()
- return super(manifestfulltextcache, self).get(k, default=default)
+ return super().get(k, default=default)
def clear(self, clear_persisted_data=False):
- super(manifestfulltextcache, self).clear()
+ super().clear()
if clear_persisted_data:
self._dirty = True
self.write()
@@ -2667,7 +2667,7 @@
_flags: Dict[bytes, bytes]
def __init__(self, nodeconstants, dir, node):
- super(excludeddir, self).__init__(nodeconstants, dir)
+ super().__init__(nodeconstants, dir)
self._node = node
# Add an empty file, which will be included by iterators and such,
# appearing as the directory itself (i.e. something like "dir/")
--- a/mercurial/match.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/match.py Sun Jan 05 22:23:31 2025 -0500
@@ -532,7 +532,7 @@
'''Matches everything.'''
def __init__(self, badfn=None):
- super(alwaysmatcher, self).__init__(badfn)
+ super().__init__(badfn)
def always(self):
return True
@@ -554,7 +554,7 @@
'''Matches nothing.'''
def __init__(self, badfn=None):
- super(nevermatcher, self).__init__(badfn)
+ super().__init__(badfn)
# It's a little weird to say that the nevermatcher is an exact matcher
# or a prefix matcher, but it seems to make sense to let callers take
@@ -581,7 +581,7 @@
"""A matcher adapter for a simple boolean function"""
def __init__(self, predfn, predrepr=None, badfn=None):
- super(predicatematcher, self).__init__(badfn)
+ super().__init__(badfn)
self.matchfn = predfn
self._predrepr = predrepr
@@ -654,7 +654,7 @@
"""
def __init__(self, root, kindpats, badfn=None):
- super(patternmatcher, self).__init__(badfn)
+ super().__init__(badfn)
kindpats.sort()
if rustmod is not None:
@@ -742,7 +742,7 @@
class includematcher(basematcher):
def __init__(self, root, kindpats, badfn=None):
- super(includematcher, self).__init__(badfn)
+ super().__init__(badfn)
if rustmod is not None:
# We need to pass the patterns to Rust because they can contain
# patterns from the user interface
@@ -823,7 +823,7 @@
"""
def __init__(self, files, badfn=None):
- super(exactmatcher, self).__init__(badfn)
+ super().__init__(badfn)
if isinstance(files, list):
self._files = files
@@ -898,7 +898,7 @@
"""
def __init__(self, m1, m2):
- super(differencematcher, self).__init__()
+ super().__init__()
self._m1 = m1
self._m2 = m2
self.bad = m1.bad
@@ -988,7 +988,7 @@
class intersectionmatcher(basematcher):
def __init__(self, m1, m2):
- super(intersectionmatcher, self).__init__()
+ super().__init__()
self._m1 = m1
self._m2 = m2
self.bad = m1.bad
@@ -1082,7 +1082,7 @@
"""
def __init__(self, path: bytes, matcher: basematcher) -> None:
- super(subdirmatcher, self).__init__()
+ super().__init__()
self._path = path
self._matcher = matcher
self._always = matcher.always()
@@ -1174,7 +1174,7 @@
"""
def __init__(self, path, matcher, badfn=None):
- super(prefixdirmatcher, self).__init__(badfn)
+ super().__init__(badfn)
if not path:
raise error.ProgrammingError(b'prefix path must not be empty')
self._path = path
@@ -1233,7 +1233,7 @@
def __init__(self, matchers):
m1 = matchers[0]
- super(unionmatcher, self).__init__()
+ super().__init__()
self.traversedir = m1.traversedir
self._matchers = matchers
--- a/mercurial/mergestate.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/mergestate.py Sun Jan 05 22:23:31 2025 -0500
@@ -768,7 +768,7 @@
class memmergestate(_mergestate_base):
def __init__(self, repo):
- super(memmergestate, self).__init__(repo)
+ super().__init__(repo)
self._backups = {}
def _make_backup(self, fctx, localkey):
--- a/mercurial/obsutil.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/obsutil.py Sun Jan 05 22:23:31 2025 -0500
@@ -520,7 +520,7 @@
"""small class to represent a successors with some metadata about it"""
def __init__(self, *args, **kwargs):
- super(_succs, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self.markers = set()
def copy(self):
--- a/mercurial/patch.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/patch.py Sun Jan 05 22:23:31 2025 -0500
@@ -491,7 +491,7 @@
class fsbackend(abstractbackend):
def __init__(self, ui, basedir):
- super(fsbackend, self).__init__(ui)
+ super().__init__(ui)
self.opener = vfsmod.vfs(basedir)
def getfile(self, fname):
@@ -540,7 +540,7 @@
class workingbackend(fsbackend):
def __init__(self, ui, repo, similarity):
- super(workingbackend, self).__init__(ui, repo.root)
+ super().__init__(ui, repo.root)
self.repo = repo
self.similarity = similarity
self.removed = set()
@@ -557,14 +557,14 @@
def setfile(self, fname, data, mode, copysource):
self._checkknown(fname)
- super(workingbackend, self).setfile(fname, data, mode, copysource)
+ super().setfile(fname, data, mode, copysource)
if copysource is not None:
self.copied.append((copysource, fname))
self.changed.add(fname)
def unlink(self, fname):
self._checkknown(fname)
- super(workingbackend, self).unlink(fname)
+ super().unlink(fname)
self.removed.add(fname)
self.changed.add(fname)
@@ -628,7 +628,7 @@
class repobackend(abstractbackend):
def __init__(self, ui, repo, ctx, store):
- super(repobackend, self).__init__(ui)
+ super().__init__(ui)
self.repo = repo
self.ctx = ctx
self.store = store
--- a/mercurial/repoview.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/repoview.py Sun Jan 05 22:23:31 2025 -0500
@@ -282,7 +282,7 @@
def revs(self, start=0, stop=None):
"""filtered version of revlog.revs"""
- for i in super(filteredchangelogmixin, self).revs(start, stop):
+ for i in super().revs(start, stop):
if i not in self.filteredrevs:
yield i
@@ -317,17 +317,17 @@
assert stop_rev is None
revs = self._checknofilteredinrevs(revs)
- return super(filteredchangelogmixin, self).headrevs(revs)
+ return super().headrevs(revs)
def strip(self, *args, **kwargs):
# XXX make something better than assert
# We can't expect proper strip behavior if we are filtered.
assert not self.filteredrevs
- super(filteredchangelogmixin, self).strip(*args, **kwargs)
+ super().strip(*args, **kwargs)
def rev(self, node):
"""filtered version of revlog.rev"""
- r = super(filteredchangelogmixin, self).rev(node)
+ r = super().rev(node)
if r in self.filteredrevs:
raise error.FilteredLookupError(
hex(node), self.display_id, _(b'filtered node')
@@ -338,25 +338,25 @@
"""filtered version of revlog.node"""
if rev in self.filteredrevs:
raise error.FilteredIndexError(rev)
- return super(filteredchangelogmixin, self).node(rev)
+ return super().node(rev)
def linkrev(self, rev):
"""filtered version of revlog.linkrev"""
if rev in self.filteredrevs:
raise error.FilteredIndexError(rev)
- return super(filteredchangelogmixin, self).linkrev(rev)
+ return super().linkrev(rev)
def parentrevs(self, rev):
"""filtered version of revlog.parentrevs"""
if rev in self.filteredrevs:
raise error.FilteredIndexError(rev)
- return super(filteredchangelogmixin, self).parentrevs(rev)
+ return super().parentrevs(rev)
def flags(self, rev):
"""filtered version of revlog.flags"""
if rev in self.filteredrevs:
raise error.FilteredIndexError(rev)
- return super(filteredchangelogmixin, self).flags(rev)
+ return super().flags(rev)
class repoview:
--- a/mercurial/revlogutils/nodemap.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/revlogutils/nodemap.py Sun Jan 05 22:23:31 2025 -0500
@@ -464,7 +464,7 @@
contains up to 16 entry indexed from 0 to 15"""
def __init__(self):
- super(Block, self).__init__()
+ super().__init__()
# If this block exist on disk, here is its ID
self.ondisk_id = None
--- a/mercurial/revlogutils/revlogv0.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/revlogutils/revlogv0.py Sun Jan 05 22:23:31 2025 -0500
@@ -72,14 +72,14 @@
def append(self, tup):
self._nodemap[tup[7]] = len(self)
- super(revlogoldindex, self).append(tup)
+ super().append(tup)
def __delitem__(self, i):
if not isinstance(i, slice) or not i.stop == -1 or i.step is not None:
raise ValueError(b"deleting slices only supports a:-1 with step 1")
for r in range(i.start, len(self)):
del self._nodemap[self[r][7]]
- super(revlogoldindex, self).__delitem__(i)
+ super().__delitem__(i)
def clearcaches(self):
self.__dict__.pop('_nodemap', None)
--- a/mercurial/smartset.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/smartset.py Sun Jan 05 22:23:31 2025 -0500
@@ -355,7 +355,7 @@
)
s._ascending = self._ascending
else:
- s = getattr(super(baseset, self), op)(other)
+ s = getattr(super(), op)(other)
return s
def __and__(self, other):
@@ -786,7 +786,7 @@
else:
typ = _generatorsetdesc
- return super(generatorset, cls).__new__(typ)
+ return super().__new__(typ)
def __init__(self, gen, iterasc=None):
"""
@@ -1093,7 +1093,7 @@
def _slice(self, start, stop):
if self._hiddenrevs:
# unoptimized since all hidden revisions in range has to be scanned
- return super(_spanset, self)._slice(start, stop)
+ return super()._slice(start, stop)
if self._ascending:
x = min(self._start + start, self._end)
y = min(self._start + stop, self._end)
@@ -1116,9 +1116,7 @@
"""
def __init__(self, repo):
- super(fullreposet, self).__init__(
- 0, len(repo), True, repo.changelog.filteredrevs
- )
+ super().__init__(0, len(repo), True, repo.changelog.filteredrevs)
def __and__(self, other):
"""As self contains the whole repo, all of the other set should also be
--- a/mercurial/statichttprepo.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/statichttprepo.py Sun Jan 05 22:23:31 2025 -0500
@@ -241,7 +241,7 @@
self._dirstate = None
def _restrictcapabilities(self, caps):
- caps = super(statichttprepository, self)._restrictcapabilities(caps)
+ caps = super()._restrictcapabilities(caps)
return caps.difference([b"pushkey"])
def url(self):
--- a/mercurial/store.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/store.py Sun Jan 05 22:23:31 2025 -0500
@@ -986,9 +986,7 @@
def data_entries(
self, matcher=None, undecodable=None
) -> Generator[BaseStoreEntry, None, None]:
- entries = super(encodedstore, self).data_entries(
- undecodable=undecodable
- )
+ entries = super().data_entries(undecodable=undecodable)
for entry in entries:
if _match_tracked_entry(entry, matcher):
yield entry
--- a/mercurial/subrepo.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/subrepo.py Sun Jan 05 22:23:31 2025 -0500
@@ -454,7 +454,7 @@
class hgsubrepo(abstractsubrepo):
def __init__(self, ctx, path, state, allowcreate):
- super(hgsubrepo, self).__init__(ctx, path)
+ super().__init__(ctx, path)
self._state = state
r = ctx.repo()
root = r.wjoin(util.localpath(path))
@@ -1117,7 +1117,7 @@
class svnsubrepo(abstractsubrepo):
def __init__(self, ctx, path, state, allowcreate):
- super(svnsubrepo, self).__init__(ctx, path)
+ super().__init__(ctx, path)
self._state = state
self._exe = procutil.findexe(b'svn')
if not self._exe:
@@ -1378,7 +1378,7 @@
class gitsubrepo(abstractsubrepo):
def __init__(self, ctx, path, state, allowcreate):
- super(gitsubrepo, self).__init__(ctx, path)
+ super().__init__(ctx, path)
self._state = state
self._abspath = ctx.repo().wjoin(path)
self._subparent = ctx.repo()
--- a/mercurial/templateutil.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/templateutil.py Sun Jan 05 22:23:31 2025 -0500
@@ -549,7 +549,7 @@
"""
def __init__(self, make, args=(), name=None, tmpl=None, sep=b''):
- super(mappinggenerator, self).__init__(name, tmpl, sep)
+ super().__init__(name, tmpl, sep)
self._make = make
self._args = args
@@ -564,7 +564,7 @@
"""Wrapper for list of template mappings"""
def __init__(self, mappings, name=None, tmpl=None, sep=b''):
- super(mappinglist, self).__init__(name, tmpl, sep)
+ super().__init__(name, tmpl, sep)
self._mappings = mappings
def itermaps(self, context):
@@ -582,7 +582,7 @@
"""
def __init__(self, mapping, name=None, tmpl=None):
- super(mappingdict, self).__init__(name, tmpl)
+ super().__init__(name, tmpl)
self._mapping = mapping
def tomap(self, context):
@@ -595,7 +595,7 @@
return True
def tovalue(self, context, mapping):
- return super(mappingdict, self).tovalue(context, mapping)[0]
+ return super().tovalue(context, mapping)[0]
class mappingnone(wrappedvalue):
@@ -606,7 +606,7 @@
"""
def __init__(self):
- super(mappingnone, self).__init__(None)
+ super().__init__(None)
def itermaps(self, context):
return iter([])
--- a/mercurial/unionrepo.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/unionrepo.py Sun Jan 05 22:23:31 2025 -0500
@@ -137,7 +137,7 @@
def _chunk(self, rev):
if rev <= self.repotiprev:
- return super(unionrevlog, self)._inner._chunk(rev)
+ return super()._inner._chunk(rev)
return self.revlog2._chunk(self.node(rev))
def revdiff(self, rev1, rev2):
@@ -148,7 +148,7 @@
self.revlog2.rev(self.node(rev2)),
)
elif rev1 <= self.repotiprev and rev2 <= self.repotiprev:
- return super(unionrevlog, self).revdiff(rev1, rev2)
+ return super().revdiff(rev1, rev2)
return mdiff.textdiff(self.rawdata(rev1), self.rawdata(rev2))
@@ -165,7 +165,7 @@
revlog2 = getattr(self.revlog2, '_revlog', self.revlog2)
func = revlog2._revisiondata
else:
- func = super(unionrevlog, self)._revisiondata
+ func = super()._revisiondata
return func(node, raw=raw)
def addrevision(
--- a/mercurial/util.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/util.py Sun Jan 05 22:23:31 2025 -0500
@@ -370,7 +370,7 @@
if isinstance(fh, fileobjectproxy):
cls = observedbufferedinputpipe
- return super(bufferedinputpipe, cls).__new__(cls)
+ return super().__new__(cls)
def __init__(self, input):
self._input = input
@@ -712,7 +712,7 @@
"""
def _fillbuffer(self, size=_chunksize):
- res = super(observedbufferedinputpipe, self)._fillbuffer(size=size)
+ res = super()._fillbuffer(size=size)
fn = getattr(self._input._observer, 'osread', None)
if fn:
@@ -723,7 +723,7 @@
# We use different observer methods because the operation isn't
# performed on the actual file object but on us.
def read(self, size):
- res = super(observedbufferedinputpipe, self).read(size)
+ res = super().read(size)
fn = getattr(self._input._observer, 'bufferedread', None)
if fn:
@@ -732,7 +732,7 @@
return res
def readline(self, *args, **kwargs):
- res = super(observedbufferedinputpipe, self).readline(*args, **kwargs)
+ res = super().readline(*args, **kwargs)
fn = getattr(self._input._observer, 'bufferedreadline', None)
if fn:
@@ -923,7 +923,7 @@
def __init__(
self, fh, name, reads=True, writes=True, logdata=False, logdataapis=True
):
- super(fileobjectobserver, self).__init__(fh, name, logdata, logdataapis)
+ super().__init__(fh, name, logdata, logdataapis)
self.reads = reads
self.writes = writes
@@ -1046,7 +1046,7 @@
logdata=False,
logdataapis=True,
):
- super(socketobserver, self).__init__(fh, name, logdata, logdataapis)
+ super().__init__(fh, name, logdata, logdataapis)
self.reads = reads
self.writes = writes
self.states = states
@@ -1358,7 +1358,7 @@
def __setitem__(self, key, value):
if key in self:
del self[key]
- super(sortdict, self).__setitem__(key, value)
+ super().__setitem__(key, value)
if pycompat.ispypy:
# __setitem__() isn't called as of PyPy 5.8.0
--- a/mercurial/utils/compression.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/utils/compression.py Sun Jan 05 22:23:31 2025 -0500
@@ -379,7 +379,7 @@
class _GzipCompressedStreamReader(_CompressedStreamReader):
def __init__(self, fh):
- super(_GzipCompressedStreamReader, self).__init__(fh)
+ super().__init__(fh)
self._decompobj = zlib.decompressobj()
def _decompress(self, chunk):
@@ -398,7 +398,7 @@
class _BZ2CompressedStreamReader(_CompressedStreamReader):
def __init__(self, fh):
- super(_BZ2CompressedStreamReader, self).__init__(fh)
+ super().__init__(fh)
self._decompobj = bz2.BZ2Decompressor()
def _decompress(self, chunk):
@@ -418,7 +418,7 @@
class _TruncatedBZ2CompressedStreamReader(_BZ2CompressedStreamReader):
def __init__(self, fh):
- super(_TruncatedBZ2CompressedStreamReader, self).__init__(fh)
+ super().__init__(fh)
newbuf = self._decompobj.decompress(b'BZ')
if newbuf:
self._pending.append(newbuf)
@@ -426,7 +426,7 @@
class _ZstdCompressedStreamReader(_CompressedStreamReader):
def __init__(self, fh, zstd):
- super(_ZstdCompressedStreamReader, self).__init__(fh)
+ super().__init__(fh)
self._zstd = zstd
self._decompobj = zstd.ZstdDecompressor().decompressobj()
--- a/mercurial/vfs.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/vfs.py Sun Jan 05 22:23:31 2025 -0500
@@ -786,7 +786,7 @@
"""
def __init__(self, fh, closer) -> None:
- super(delayclosedfile, self).__init__(fh)
+ super().__init__(fh)
object.__setattr__(self, '_closer', closer)
def __exit__(self, exc_type, exc_value, exc_tb) -> None:
@@ -900,7 +900,7 @@
"""
def __init__(self, fh) -> None:
- super(checkambigatclosing, self).__init__(fh)
+ super().__init__(fh)
object.__setattr__(self, '_oldstat', util.filestat.frompath(fh.name))
def _checkambig(self) -> None:
--- a/mercurial/wireprotoframing.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/wireprotoframing.py Sun Jan 05 22:23:31 2025 -0500
@@ -798,7 +798,7 @@
class zstd8mbencoder(zstdbaseencoder):
def __init__(self, ui):
- super(zstd8mbencoder, self).__init__(3)
+ super().__init__(3)
class zstdbasedecoder:
@@ -819,7 +819,7 @@
_(b'zstd8mb decoder received unexpected additional values')
)
- super(zstd8mbdecoder, self).__init__(maxwindowsize=8 * 1048576)
+ super().__init__(maxwindowsize=8 * 1048576)
# We lazily populate this to avoid excessive module imports when importing
@@ -877,7 +877,7 @@
"""Represents a stream used for receiving data."""
def __init__(self, streamid, active=False):
- super(inputstream, self).__init__(streamid, active=active)
+ super().__init__(streamid, active=active)
self._decoder = None
def setdecoder(self, ui, name, extraobjs):
@@ -910,7 +910,7 @@
"""Represents a stream used for sending data."""
def __init__(self, streamid, active=False):
- super(outputstream, self).__init__(streamid, active=active)
+ super().__init__(streamid, active=active)
self.streamsettingssent = False
self._encoder = None
self._encodername = None
--- a/mercurial/wireprototypes.py Sun Jan 05 22:12:02 2025 -0500
+++ b/mercurial/wireprototypes.py Sun Jan 05 22:23:31 2025 -0500
@@ -346,7 +346,7 @@
b'or 2-tuples'
)
- return super(commanddict, self).__setitem__(k, v)
+ return super().__setitem__(k, v)
def commandavailable(self, command, proto):
"""Determine if a command is available for the requested protocol."""
--- a/tests/basic_test_result.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/basic_test_result.py Sun Jan 05 22:23:31 2025 -0500
@@ -9,7 +9,7 @@
class TestResult(base_class):
def __init__(self, options, *args, **kwargs):
- super(TestResult, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self._options = options
# unittest.TestResult didn't have skipped until 2.7. We need to
@@ -53,4 +53,4 @@
return False
def stopTest(self, test, interrupted=False):
- super(TestResult, self).stopTest(test)
+ super().stopTest(test)
--- a/tests/drawdag.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/drawdag.py Sun Jan 05 22:23:31 2025 -0500
@@ -293,7 +293,7 @@
'date': b'0 0',
'extra': {b'branch': b'default'},
}
- super(simplecommitctx, self).__init__(repo, name, **opts)
+ super().__init__(repo, name, **opts)
self._added = added
self._parents = parentctxs
while len(self._parents) < 2:
--- a/tests/flagprocessorext.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/flagprocessorext.py Sun Jan 05 22:23:31 2025 -0500
@@ -96,7 +96,7 @@
if b'[FAIL]' in text:
flags |= REVIDX_FAIL
- return super(wrappedfile, self).addrevision(
+ return super().addrevision(
text,
transaction,
link,
@@ -113,7 +113,7 @@
def reposetup(ui, repo):
class wrappingflagprocessorrepo(repo.__class__):
def file(self, f):
- orig = super(wrappingflagprocessorrepo, self).file(f)
+ orig = super().file(f)
makewrappedfile(orig)
return orig
--- a/tests/lockdelay.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/lockdelay.py Sun Jan 05 22:23:31 2025 -0500
@@ -13,7 +13,7 @@
delay = float(os.environ.get('HGPRELOCKDELAY', '0.0'))
if delay:
time.sleep(delay)
- res = super(delayedlockrepo, self).lock(wait=wait)
+ res = super().lock(wait=wait)
delay = float(os.environ.get('HGPOSTLOCKDELAY', '0.0'))
if delay:
time.sleep(delay)
--- a/tests/run-tests.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/run-tests.py Sun Jan 05 22:23:31 2025 -0500
@@ -1756,7 +1756,7 @@
case = kwds.pop('case', [])
self._case = case
self._allcases = {x for y in parsettestcases(path) for x in y}
- super(TTest, self).__init__(path, *args, **kwds)
+ super().__init__(path, *args, **kwds)
if case:
casepath = b'#'.join(case)
self.name = '%s#%s' % (self.name, _bytes2sys(casepath))
@@ -2318,7 +2318,7 @@
"""Holds results when executing via unittest."""
def __init__(self, options, *args, **kwargs):
- super(TestResult, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self._options = options
@@ -2484,7 +2484,7 @@
return accepted
def startTest(self, test):
- super(TestResult, self).startTest(test)
+ super().startTest(test)
# os.times module computes the user time and system time spent by
# child's processes along with real elapsed time taken by a process.
@@ -2498,7 +2498,7 @@
self._firststarttime = test.started_time
def stopTest(self, test, interrupted=False):
- super(TestResult, self).stopTest(test)
+ super().stopTest(test)
test.stopped_times = os.times()
stopped_time = time.time()
@@ -2578,7 +2578,7 @@
loop denotes whether to loop over tests forever.
"""
- super(TestSuite, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self._jobs = jobs
self._whitelist = whitelist
@@ -2805,7 +2805,7 @@
"""Custom unittest test runner that uses appropriate settings."""
def __init__(self, runner, *args, **kwargs):
- super(TextTestRunner, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
self._runner = runner
--- a/tests/simplestorerepo.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/simplestorerepo.py Sun Jan 05 22:23:31 2025 -0500
@@ -669,7 +669,7 @@
class simplestore(store.encodedstore):
def data_entries(self, undecodable=None):
- for x in super(simplestore, self).data_entries():
+ for x in super().data_entries():
yield x
# Supplement with non-revlog files.
--- a/tests/sshprotoext.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/sshprotoext.py Sun Jan 05 22:23:31 2025 -0500
@@ -32,7 +32,7 @@
for i in range(10):
self._ui.fout.write(b'banner: line %d\n' % i)
- super(bannerserver, self).serve_forever()
+ super().serve_forever()
class prehelloserver(wireprotoserver.sshserver):
@@ -56,7 +56,7 @@
rsp = wireprotov1server.dispatch(self._repo, proto, b'between')
wireprotoserver._sshv1respondbytes(ui.fout, rsp.data)
- super(prehelloserver, self).serve_forever()
+ super().serve_forever()
def performhandshake(orig, ui, stdin, stdout, stderr):
--- a/tests/test-lock.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/test-lock.py Sun Jan 05 22:23:31 2025 -0500
@@ -29,10 +29,10 @@
# lock.lock.__init__() calls lock(), so the pidoffset assignment needs
# to be earlier
self._pidoffset = pidoffset
- super(lockwrapper, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def _getpid(self):
- return super(lockwrapper, self)._getpid() + self._pidoffset
+ return super()._getpid() + self._pidoffset
class teststate:
--- a/tests/test-verify-repo-operations.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/test-verify-repo-operations.py Sun Jan 05 22:23:31 2025 -0500
@@ -168,7 +168,7 @@
committimes = Bundle('committimes')
def __init__(self):
- super(verifyingstatemachine, self).__init__()
+ super().__init__()
self.repodir = os.path.join(testtmp, "repos")
if os.path.exists(self.repodir):
shutil.rmtree(self.repodir)
@@ -192,7 +192,7 @@
We then test it in a number of other configurations, verifying that
each passes the same test."""
- super(verifyingstatemachine, self).teardown()
+ super().teardown()
try:
shutil.rmtree(self.repodir)
except OSError:
@@ -255,7 +255,7 @@
def execute_step(self, step):
try:
- return super(verifyingstatemachine, self).execute_step(step)
+ return super().execute_step(step)
except (HypothesisException, KeyboardInterrupt):
raise
except Exception:
--- a/tests/testlib/badserverext.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/testlib/badserverext.py Sun Jan 05 22:23:31 2025 -0500
@@ -376,7 +376,7 @@
class badserver(server.MercurialHTTPServer):
def __init__(self, ui, *args, **kwargs):
self._ui = ui
- super(badserver, self).__init__(ui, *args, **kwargs)
+ super().__init__(ui, *args, **kwargs)
all_recv_bytes = self._ui.config(
b'badserver', b'close-after-recv-bytes'
@@ -410,9 +410,7 @@
elif name.lower() == 'server':
value = 'badhttpserver'
- return super(badrequesthandler, self).send_header(
- name, value
- )
+ return super().send_header(name, value)
self.RequestHandlerClass = badrequesthandler
@@ -428,11 +426,11 @@
raise OSError('close before accept')
if self._ui.configbool(b'badserver', b'close-after-accept'):
- request, client_address = super(badserver, self).get_request()
+ request, client_address = super().get_request()
request.close()
raise OSError('close after accept')
- return super(badserver, self).get_request()
+ return super().get_request()
# Does heavy lifting of processing a request. Invokes
# self.finish_request() which calls self.RequestHandlerClass() which
@@ -446,6 +444,6 @@
socket, self.errorlog, condition_tracked=self._cond
)
- return super(badserver, self).process_request(socket, address)
+ return super().process_request(socket, address)
server.MercurialHTTPServer = badserver
--- a/tests/testlib/crash_transaction_late.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/testlib/crash_transaction_late.py Sun Jan 05 22:23:31 2025 -0500
@@ -18,7 +18,7 @@
def reposetup(ui, repo):
class LateAbortRepo(repo.__class__):
def transaction(self, *args, **kwargs):
- tr = super(LateAbortRepo, self).transaction(*args, **kwargs)
+ tr = super().transaction(*args, **kwargs)
tr.addfilegenerator(
b'late-abort',
[b'late-abort'],
--- a/tests/testlib/ext-phase-report.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/testlib/ext-phase-report.py Sun Jan 05 22:23:31 2025 -0500
@@ -18,7 +18,7 @@
class reportphaserepo(repo.__class__):
def transaction(self, *args, **kwargs):
- tr = super(reportphaserepo, self).transaction(*args, **kwargs)
+ tr = super().transaction(*args, **kwargs)
tr.addpostclose(b'report-phase', reportphasemove)
return tr
--- a/tests/testlib/persistent-nodemap-race-ext.py Sun Jan 05 22:12:02 2025 -0500
+++ b/tests/testlib/persistent-nodemap-race-ext.py Sun Jan 05 22:23:31 2025 -0500
@@ -219,7 +219,7 @@
print_nodemap_details(cl)
testing.wait_file(FILE_LEFT_CL_NODEMAP_WRITE)
print('nodemap-race: right side ready to wait for the lock')
- ret = super(RacedRepo, self).lock(wait=wait)
+ ret = super().lock(wait=wait)
if newlock and _role(self) == LEFT:
print('nodemap-race: left side locked and ready to commit')
testing.write_file(FILE_LEFT_LOCKED)
@@ -234,7 +234,7 @@
def transaction(self, *args, **kwargs):
# duck punch the role on the transaction to help other pieces of code
- tr = super(RacedRepo, self).transaction(*args, **kwargs)
+ tr = super().transaction(*args, **kwargs)
tr._race_role = _role(self)
return tr
@@ -261,7 +261,7 @@
print('reader ready to read the changelog, waiting for right')
testing.write_file(FILE_READER_READY)
testing.wait_file(FILE_RIGHT_CL_NODEMAP_PRE_WRITE)
- return super(ReaderRepo, self).changelog
+ return super().changelog
repo.__class__ = ReaderRepo