diff --git a/contrib/check-code.py b/contrib/check-code.py --- a/contrib/check-code.py +++ b/contrib/check-code.py @@ -758,7 +758,7 @@ preparefilters(filters) -class norepeatlogger(object): +class norepeatlogger: def __init__(self): self._lastseen = None diff --git a/contrib/fuzz/mpatch_corpus.py b/contrib/fuzz/mpatch_corpus.py --- a/contrib/fuzz/mpatch_corpus.py +++ b/contrib/fuzz/mpatch_corpus.py @@ -20,7 +20,7 @@ if sys.version_info[0] < 3: - class py2reprhack(object): + class py2reprhack: def __repr__(self): """Py2 calls __repr__ for `bytes(foo)`, forward to __bytes__""" return self.__bytes__() @@ -28,7 +28,7 @@ else: - class py2reprhack(object): + class py2reprhack: """Not needed on py3.""" diff --git a/contrib/hgclient.py b/contrib/hgclient.py --- a/contrib/hgclient.py +++ b/contrib/hgclient.py @@ -49,7 +49,7 @@ return server -class unixconnection(object): +class unixconnection: def __init__(self, sockpath): self.sock = sock = socket.socket(socket.AF_UNIX) sock.connect(sockpath) @@ -62,7 +62,7 @@ self.sock.close() -class unixserver(object): +class unixserver: def __init__(self, sockpath, logpath=None, repopath=None): self.sockpath = sockpath cmdline = [b'hg', b'serve', b'--cmdserver', b'unix', b'-a', sockpath] diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -369,7 +369,7 @@ return len -class noop(object): +class noop: """dummy context manager""" def __enter__(self): @@ -413,7 +413,7 @@ # available since 2.2 (or ae5f92e154d3) from mercurial import node - class defaultformatter(object): + class defaultformatter: """Minimized composition of baseformatter and plainformatter""" def __init__(self, ui, topic, opts): @@ -652,7 +652,7 @@ origvalue = getattr(obj, _sysstr(name)) - class attrutil(object): + class attrutil: def set(self, newvalue): setattr(obj, _sysstr(name), newvalue) @@ -2942,7 +2942,7 @@ fm.end() -class _faketr(object): +class _faketr: def add(s, x, y, z=None): return None diff --git a/contrib/testparseutil.py b/contrib/testparseutil.py --- a/contrib/testparseutil.py +++ b/contrib/testparseutil.py @@ -79,7 +79,7 @@ #################### -class embeddedmatcher(object): # pytype: disable=ignored-metaclass +class embeddedmatcher: # pytype: disable=ignored-metaclass """Base class to detect embedded code fragments in *.t test script""" __metaclass__ = abc.ABCMeta @@ -156,7 +156,7 @@ :ends: line number (1-origin), at which embedded code ends (exclusive) :code: extracted embedded code, which is single-stringified - >>> class ambigmatcher(object): + >>> class ambigmatcher: ... # mock matcher class to examine implementation of ... # "ambiguous matching" corner case ... def __init__(self, desc, matchfunc): diff --git a/doc/hgmanpage.py b/doc/hgmanpage.py --- a/doc/hgmanpage.py +++ b/doc/hgmanpage.py @@ -112,7 +112,7 @@ self.output = visitor.astext() -class Table(object): +class Table: def __init__(self): self._rows = [] self._options = ['center'] @@ -312,7 +312,7 @@ pass def list_start(self, node): - class enum_char(object): + class enum_char: enum_style = { 'bullet': '\\(bu', 'emdash': '\\(em', diff --git a/hgdemandimport/demandimportpy2.py b/hgdemandimport/demandimportpy2.py --- a/hgdemandimport/demandimportpy2.py +++ b/hgdemandimport/demandimportpy2.py @@ -54,7 +54,7 @@ return importfunc(hgextname, globals, *args, **kwargs) -class _demandmod(object): +class _demandmod: """module demand-loader and proxy Specify 1 as 'level' argument at construction, to import module diff --git a/hgdemandimport/demandimportpy3.py b/hgdemandimport/demandimportpy3.py --- a/hgdemandimport/demandimportpy3.py +++ b/hgdemandimport/demandimportpy3.py @@ -54,7 +54,7 @@ super().exec_module(module) -class LazyFinder(object): +class LazyFinder: """A wrapper around a ``MetaPathFinder`` that makes loaders lazy. ``sys.meta_path`` finders have their ``find_spec()`` called to locate a diff --git a/hgext/absorb.py b/hgext/absorb.py --- a/hgext/absorb.py +++ b/hgext/absorb.py @@ -83,7 +83,7 @@ defaultdict = collections.defaultdict -class nullui(object): +class nullui: """blank ui object doing nothing""" debugflag = False @@ -97,7 +97,7 @@ return nullfunc -class emptyfilecontext(object): +class emptyfilecontext: """minimal filecontext representing an empty file""" def __init__(self, repo): @@ -277,7 +277,7 @@ ) -class filefixupstate(object): +class filefixupstate: """state needed to apply fixups to a single file internally, it keeps file contents of several revisions and a linelog. @@ -655,7 +655,7 @@ ) -class fixupstate(object): +class fixupstate: """state needed to run absorb internally, it keeps paths and filefixupstates. diff --git a/hgext/blackbox.py b/hgext/blackbox.py --- a/hgext/blackbox.py +++ b/hgext/blackbox.py @@ -105,7 +105,7 @@ _lastlogger = loggingutil.proxylogger() -class blackboxlogger(object): +class blackboxlogger: def __init__(self, ui, repo): self._repo = repo self._trackedevents = set(ui.configlist(b'blackbox', b'track')) diff --git a/hgext/bugzilla.py b/hgext/bugzilla.py --- a/hgext/bugzilla.py +++ b/hgext/bugzilla.py @@ -434,7 +434,7 @@ ) -class bzaccess(object): +class bzaccess: '''Base class for access to Bugzilla.''' def __init__(self, ui): @@ -690,7 +690,7 @@ # Bugzilla via XMLRPC interface. -class cookietransportrequest(object): +class cookietransportrequest: """A Transport request method that retains cookies over its lifetime. The regular xmlrpclib transports ignore cookies. Which causes @@ -1095,7 +1095,7 @@ pass -class bugzilla(object): +class bugzilla: # supported versions of bugzilla. different versions have # different schemas. _versions = { diff --git a/hgext/convert/common.py b/hgext/convert/common.py --- a/hgext/convert/common.py +++ b/hgext/convert/common.py @@ -34,7 +34,7 @@ return d.encode('latin1') -class _shlexpy3proxy(object): +class _shlexpy3proxy: def __init__(self, l): self._l = l @@ -127,7 +127,7 @@ SKIPREV = b'SKIP' -class commit(object): +class commit: def __init__( self, author, @@ -157,7 +157,7 @@ self.ctx = ctx # for hg to hg conversions -class converter_source(object): +class converter_source: """Conversion source interface""" def __init__(self, ui, repotype, path=None, revs=None): @@ -307,7 +307,7 @@ return True -class converter_sink(object): +class converter_sink: """Conversion sink (target) interface""" def __init__(self, ui, repotype, path): @@ -403,7 +403,7 @@ raise NotImplementedError -class commandline(object): +class commandline: def __init__(self, ui, command): self.ui = ui self.command = command diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py +++ b/hgext/convert/convcmd.py @@ -176,7 +176,7 @@ raise error.Abort(_(b'%s: unknown repository type') % path) -class progresssource(object): +class progresssource: def __init__(self, ui, source, filecount): self.ui = ui self.source = source @@ -198,7 +198,7 @@ self.progress.complete() -class converter(object): +class converter: def __init__(self, ui, source, dest, revmapfile, opts): self.source = source diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -26,7 +26,7 @@ ) -class logentry(object): +class logentry: """Class logentry has the following attributes: .author - author name as CVS knows it .branch - name of branch this revision is on @@ -577,7 +577,7 @@ return log -class changeset(object): +class changeset: """Class changeset has the following attributes: .id - integer identifying this changeset (list index) .author - author name as CVS knows it diff --git a/hgext/convert/filemap.py b/hgext/convert/filemap.py --- a/hgext/convert/filemap.py +++ b/hgext/convert/filemap.py @@ -41,7 +41,7 @@ return posixpath.normpath(path) -class filemapper(object): +class filemapper: """Map and filter filenames when importing. A name can be mapped to itself, a new name, or None (omit from new repository).""" diff --git a/hgext/convert/git.py b/hgext/convert/git.py --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -19,7 +19,7 @@ from . import common -class submodule(object): +class submodule: def __init__(self, path, node, url): self.path = path self.node = node diff --git a/hgext/convert/gnuarch.py b/hgext/convert/gnuarch.py --- a/hgext/convert/gnuarch.py +++ b/hgext/convert/gnuarch.py @@ -27,7 +27,7 @@ class gnuarch_source(common.converter_source, common.commandline): - class gnuarch_rev(object): + class gnuarch_rev: def __init__(self, rev): self.rev = rev self.summary = b'' diff --git a/hgext/convert/subversion.py b/hgext/convert/subversion.py --- a/hgext/convert/subversion.py +++ b/hgext/convert/subversion.py @@ -180,7 +180,7 @@ return optrev -class changedpath(object): +class changedpath: def __init__(self, p): self.copyfrom_path = p.copyfrom_path self.copyfrom_rev = p.copyfrom_rev @@ -248,7 +248,7 @@ get_log_child(ui.fout, *args) -class logstream(object): +class logstream: """Interruptible revision log iterator.""" def __init__(self, stdout): diff --git a/hgext/convert/transport.py b/hgext/convert/transport.py --- a/hgext/convert/transport.py +++ b/hgext/convert/transport.py @@ -70,7 +70,7 @@ pass -class SvnRaTransport(object): +class SvnRaTransport: """ Open an ra connection to a Subversion repository. """ @@ -107,7 +107,7 @@ self.ra = ra svn.ra.reparent(self.ra, self.svn_url.encode('utf8')) - class Reporter(object): + class Reporter: def __init__(self, reporter_data): self._reporter, self._baton = reporter_data diff --git a/hgext/eol.py b/hgext/eol.py --- a/hgext/eol.py +++ b/hgext/eol.py @@ -185,7 +185,7 @@ } -class eolfile(object): +class eolfile: def __init__(self, ui, root, data): self._decode = { b'LF': b'to-lf', diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -695,7 +695,7 @@ return dodiff(ui, repo, cmdline, pats, opts) -class savedcmd(object): +class savedcmd: """use external program to diff repository (or selected files) Show differences between revisions for the specified files, using diff --git a/hgext/fastannotate/context.py b/hgext/fastannotate/context.py --- a/hgext/fastannotate/context.py +++ b/hgext/fastannotate/context.py @@ -159,7 +159,7 @@ _defaultdiffopthash = hashdiffopts(mdiff.defaultopts) -class annotateopts(object): +class annotateopts: """like mercurial.mdiff.diffopts, but is for annotate followrename: follow renames, like "hg annotate -f" @@ -196,7 +196,7 @@ defaultopts = annotateopts() -class _annotatecontext(object): +class _annotatecontext: """do not use this class directly as it does not use lock to protect writes. use "with annotatecontext(...)" instead. """ @@ -783,7 +783,7 @@ pass -class pathhelper(object): +class pathhelper: """helper for getting paths for lockfile, linelog and revmap""" def __init__(self, repo, path, opts=defaultopts): diff --git a/hgext/fastannotate/formatter.py b/hgext/fastannotate/formatter.py --- a/hgext/fastannotate/formatter.py +++ b/hgext/fastannotate/formatter.py @@ -19,7 +19,7 @@ # imitating mercurial.commands.annotate, not using the vanilla formatter since # the data structures are a bit different, and we have some fast paths. -class defaultformatter(object): +class defaultformatter: """the default formatter that does leftpad and support some common flags""" def __init__(self, ui, repo, opts): diff --git a/hgext/fastannotate/revmap.py b/hgext/fastannotate/revmap.py --- a/hgext/fastannotate/revmap.py +++ b/hgext/fastannotate/revmap.py @@ -48,7 +48,7 @@ _hshlen = 20 -class revmap(object): +class revmap: """trivial hg bin hash - linelog rev bidirectional map also stores a flag (uint8) for each revision, and track renames. diff --git a/hgext/fastannotate/support.py b/hgext/fastannotate/support.py --- a/hgext/fastannotate/support.py +++ b/hgext/fastannotate/support.py @@ -22,7 +22,7 @@ ) -class _lazyfctx(object): +class _lazyfctx: """delegates to fctx but do not construct fctx when unnecessary""" def __init__(self, repo, node, path): diff --git a/hgext/fix.py b/hgext/fix.py --- a/hgext/fix.py +++ b/hgext/fix.py @@ -903,7 +903,7 @@ return names -class Fixer(object): +class Fixer: """Wraps the raw config values for a fixer with methods""" def __init__( diff --git a/hgext/fsmonitor/__init__.py b/hgext/fsmonitor/__init__.py --- a/hgext/fsmonitor/__init__.py +++ b/hgext/fsmonitor/__init__.py @@ -681,7 +681,7 @@ ) -class poststatus(object): +class poststatus: def __init__(self, startclock): self._startclock = pycompat.sysbytes(startclock) @@ -756,7 +756,7 @@ pass -class state_update(object): +class state_update: """This context manager is responsible for dispatching the state-enter and state-leave signals to the watchman service. The enter and leave methods can be invoked manually (for scenarios where context manager diff --git a/hgext/fsmonitor/pywatchman/__init__.py b/hgext/fsmonitor/pywatchman/__init__.py --- a/hgext/fsmonitor/pywatchman/__init__.py +++ b/hgext/fsmonitor/pywatchman/__init__.py @@ -301,7 +301,7 @@ ) -class Transport(object): +class Transport: """communication transport to the watchman server""" buf = None @@ -346,7 +346,7 @@ self.buf.append(b) -class Codec(object): +class Codec: """communication encoding for the watchman server""" transport = None @@ -859,7 +859,7 @@ self.transport.write(cmd + b"\n") -class client(object): +class client: """Handles the communication with the watchman service""" sockpath = None diff --git a/hgext/fsmonitor/pywatchman/pybser.py b/hgext/fsmonitor/pywatchman/pybser.py --- a/hgext/fsmonitor/pywatchman/pybser.py +++ b/hgext/fsmonitor/pywatchman/pybser.py @@ -93,7 +93,7 @@ return ret -class _bser_buffer(object): +class _bser_buffer: def __init__(self, version): self.bser_version = version self.buf = ctypes.create_string_buffer(8192) @@ -324,7 +324,7 @@ # This is a quack-alike with the bserObjectType in bser.c # It provides by getattr accessors and getitem for both index # and name. -class _BunserDict(object): +class _BunserDict: __slots__ = ("_keys", "_values") def __init__(self, keys, values): @@ -350,7 +350,7 @@ return len(self._keys) -class Bunser(object): +class Bunser: def __init__(self, mutable=True, value_encoding=None, value_errors=None): self.mutable = mutable self.value_encoding = value_encoding diff --git a/hgext/fsmonitor/state.py b/hgext/fsmonitor/state.py --- a/hgext/fsmonitor/state.py +++ b/hgext/fsmonitor/state.py @@ -22,7 +22,7 @@ _versionformat = b">I" -class state(object): +class state: def __init__(self, repo): self._vfs = repo.vfs self._ui = repo.ui diff --git a/hgext/fsmonitor/watchmanclient.py b/hgext/fsmonitor/watchmanclient.py --- a/hgext/fsmonitor/watchmanclient.py +++ b/hgext/fsmonitor/watchmanclient.py @@ -43,7 +43,7 @@ super(WatchmanNoRoot, self).__init__(msg) -class client(object): +class client: def __init__(self, ui, root, timeout=1.0): err = None if not self._user: diff --git a/hgext/git/__init__.py b/hgext/git/__init__.py --- a/hgext/git/__init__.py +++ b/hgext/git/__init__.py @@ -47,7 +47,7 @@ # TODO: extract an interface for this in core -class gitstore(object): # store.basicstore): +class gitstore: # store.basicstore): def __init__(self, path, vfstype): self.vfs = vfstype(path) self.opener = self.vfs @@ -129,7 +129,7 @@ return orig(requirements, storebasepath, vfstype) -class gitfilestorage(object): +class gitfilestorage: def file(self, path): if path[0:1] == b'/': path = path[1:] @@ -161,7 +161,7 @@ _BMS_PREFIX = 'refs/heads/' -class gitbmstore(object): +class gitbmstore: def __init__(self, gitrepo): self.gitrepo = gitrepo self._aclean = True diff --git a/hgext/git/dirstate.py b/hgext/git/dirstate.py --- a/hgext/git/dirstate.py +++ b/hgext/git/dirstate.py @@ -66,7 +66,7 @@ @interfaceutil.implementer(intdirstate.idirstate) -class gitdirstate(object): +class gitdirstate: def __init__(self, ui, root, gitrepo): self._ui = ui self._root = os.path.dirname(root) diff --git a/hgext/git/gitlog.py b/hgext/git/gitlog.py --- a/hgext/git/gitlog.py +++ b/hgext/git/gitlog.py @@ -29,7 +29,7 @@ pygit2 = gitutil.get_pygit2() -class baselog(object): # revlog.revlog): +class baselog: # revlog.revlog): """Common implementations between changelog and manifestlog.""" def __init__(self, gr, db): @@ -69,7 +69,7 @@ return t is not None -class baselogindex(object): +class baselogindex: def __init__(self, log): self._log = log diff --git a/hgext/git/manifest.py b/hgext/git/manifest.py --- a/hgext/git/manifest.py +++ b/hgext/git/manifest.py @@ -15,7 +15,7 @@ @interfaceutil.implementer(repository.imanifestdict) -class gittreemanifest(object): +class gittreemanifest: """Expose git trees (and optionally a builder's overlay) as a manifestdict. Very similar to mercurial.manifest.treemanifest. @@ -258,7 +258,7 @@ @interfaceutil.implementer(repository.imanifestrevisionstored) -class gittreemanifestctx(object): +class gittreemanifestctx: def __init__(self, repo, gittree): self._repo = repo self._tree = gittree @@ -279,7 +279,7 @@ @interfaceutil.implementer(repository.imanifestrevisionwritable) -class memgittreemanifestctx(object): +class memgittreemanifestctx: def __init__(self, repo, tree): self._repo = repo self._tree = tree diff --git a/hgext/githelp.py b/hgext/githelp.py --- a/hgext/githelp.py +++ b/hgext/githelp.py @@ -122,7 +122,7 @@ return args, opts -class Command(object): +class Command: def __init__(self, name): self.name = name self.args = [] @@ -163,7 +163,7 @@ return AndCommand(self, other) -class AndCommand(object): +class AndCommand: def __init__(self, left, right): self.left = left self.right = right diff --git a/hgext/gpg.py b/hgext/gpg.py --- a/hgext/gpg.py +++ b/hgext/gpg.py @@ -64,7 +64,7 @@ help.CATEGORY_NAMES[_HELP_CATEGORY] = b'Signing changes (GPG)' -class gpg(object): +class gpg: def __init__(self, path, key=None): self.path = path self.key = (key and b" --local-user \"%s\"" % key) or b"" diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -351,7 +351,7 @@ return b''.join([b'# %s\n' % l if l else b'#\n' for l in lines]) -class histeditstate(object): +class histeditstate: def __init__(self, repo): self.repo = repo self.actions = None @@ -490,7 +490,7 @@ return self.repo.vfs.exists(b'histedit-state') -class histeditaction(object): +class histeditaction: def __init__(self, state, node): self.state = state self.repo = state.repo @@ -1142,7 +1142,7 @@ return struct.unpack(b'hh', fcntl.ioctl(1, termios.TIOCGWINSZ, b' ')) -class histeditrule(object): +class histeditrule: def __init__(self, ui, ctx, pos, action=b'pick'): self.ui = ui self.ctx = ctx @@ -1242,7 +1242,7 @@ return line[: n - 2] + b' >' -class _chistedit_state(object): +class _chistedit_state: def __init__( self, repo, diff --git a/hgext/infinitepush/__init__.py b/hgext/infinitepush/__init__.py --- a/hgext/infinitepush/__init__.py +++ b/hgext/infinitepush/__init__.py @@ -286,7 +286,7 @@ return remotebookmark -class bundlestore(object): +class bundlestore: def __init__(self, repo): self._repo = repo storetype = self._repo.ui.config(b'infinitepush', b'storetype') diff --git a/hgext/infinitepush/bundleparts.py b/hgext/infinitepush/bundleparts.py --- a/hgext/infinitepush/bundleparts.py +++ b/hgext/infinitepush/bundleparts.py @@ -101,7 +101,7 @@ return -class copiedpart(object): +class copiedpart: """a copy of unbundlepart content that can be consumed later""" def __init__(self, part): diff --git a/hgext/infinitepush/indexapi.py b/hgext/infinitepush/indexapi.py --- a/hgext/infinitepush/indexapi.py +++ b/hgext/infinitepush/indexapi.py @@ -6,7 +6,7 @@ # GNU General Public License version 2 or any later version. -class indexapi(object): +class indexapi: """Class that manages access to infinitepush index. This class is a context manager and all write operations (like diff --git a/hgext/infinitepush/store.py b/hgext/infinitepush/store.py --- a/hgext/infinitepush/store.py +++ b/hgext/infinitepush/store.py @@ -25,7 +25,7 @@ pass -class abstractbundlestore(object): # pytype: disable=ignored-metaclass +class abstractbundlestore: # pytype: disable=ignored-metaclass """Defines the interface for bundle stores. A bundle store is an entity that stores raw bundle data. It is a simple @@ -56,7 +56,7 @@ """ -class filebundlestore(object): +class filebundlestore: """bundle store in filesystem meant for storing bundles somewhere on disk and on network filesystems diff --git a/hgext/journal.py b/hgext/journal.py --- a/hgext/journal.py +++ b/hgext/journal.py @@ -282,7 +282,7 @@ __str__ = encoding.strmethod(__bytes__) -class journalstorage(object): +class journalstorage: """Storage for journal entries Entries are divided over two files; one with entries that pertain to the diff --git a/hgext/keyword.py b/hgext/keyword.py --- a/hgext/keyword.py +++ b/hgext/keyword.py @@ -235,7 +235,7 @@ return modified, added -class kwtemplater(object): +class kwtemplater: """ Sets up keyword templates, corresponding keyword regex, and provides keyword substitution functions. diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py --- a/hgext/largefiles/basestore.py +++ b/hgext/largefiles/basestore.py @@ -41,7 +41,7 @@ return b"%s: %s" % (urlutil.hidepassword(self.url), self.detail) -class basestore(object): +class basestore: def __init__(self, ui, repo, url): self.ui = ui self.repo = repo diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py +++ b/hgext/largefiles/lfutil.py @@ -756,7 +756,7 @@ return match -class automatedcommithook(object): +class automatedcommithook: """Stateful hook to update standins at the 1st commit of resuming For efficiency, updating standins in the working directory should diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py --- a/hgext/largefiles/overrides.py +++ b/hgext/largefiles/overrides.py @@ -492,7 +492,7 @@ large = opts.pop('large', False) if large: - class fakerepo(object): + class fakerepo: dirstate = lfutil.openlfdirstate(ui, repo) orig(ui, fakerepo, *pats, **opts) diff --git a/hgext/lfs/blobstore.py b/hgext/lfs/blobstore.py --- a/hgext/lfs/blobstore.py +++ b/hgext/lfs/blobstore.py @@ -108,7 +108,7 @@ return None # progress is handled by the worker client -class local(object): +class local: """Local blobstore for large file contents. This blobstore is used both as a cache and as a staging area for large blobs @@ -306,7 +306,7 @@ return None -class _gitlfsremote(object): +class _gitlfsremote: def __init__(self, repo, url): ui = repo.ui self.ui = ui @@ -642,7 +642,7 @@ getattr(h, "close_all", lambda: None)() -class _dummyremote(object): +class _dummyremote: """Dummy store storing blobs to temp directory.""" def __init__(self, repo, url): @@ -661,7 +661,7 @@ tostore.download(p.oid(), fp, None) -class _nullremote(object): +class _nullremote: """Null store storing blobs to /dev/null.""" def __init__(self, repo, url): @@ -674,7 +674,7 @@ pass -class _promptremote(object): +class _promptremote: """Prompt user to set lfs.url when accessed.""" def __init__(self, repo, url): diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py --- a/hgext/logtoprocess.py +++ b/hgext/logtoprocess.py @@ -44,7 +44,7 @@ testedwith = b'ships-with-hg-core' -class processlogger(object): +class processlogger: """Map log events to external commands Arguments are passed on as environment variables. diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -150,7 +150,7 @@ except KeyError: # note: load is lazy so we could avoid the try-except, # but I (marmoute) prefer this explicit code. - class dummyui(object): + class dummyui: def debug(self, msg): pass @@ -183,7 +183,7 @@ normname = util.normpath -class statusentry(object): +class statusentry: def __init__(self, node, name): self.node, self.name = node, name @@ -293,7 +293,7 @@ return lines -class patchheader(object): +class patchheader: def __init__(self, pf, plainmode=False): def eatdiff(lines): while lines: @@ -495,7 +495,7 @@ pass -class queue(object): +class queue: def __init__(self, ui, baseui, path, patchdir=None): self.basepath = path try: diff --git a/hgext/notify.py b/hgext/notify.py --- a/hgext/notify.py +++ b/hgext/notify.py @@ -314,7 +314,7 @@ } -class notifier(object): +class notifier: '''email notification class.''' def __init__(self, ui, repo, hooktype): diff --git a/hgext/phabricator.py b/hgext/phabricator.py --- a/hgext/phabricator.py +++ b/hgext/phabricator.py @@ -668,7 +668,7 @@ return output.getvalue() -class DiffChangeType(object): +class DiffChangeType: ADD = 1 CHANGE = 2 DELETE = 3 @@ -679,7 +679,7 @@ MULTICOPY = 8 -class DiffFileType(object): +class DiffFileType: TEXT = 1 IMAGE = 2 BINARY = 3 @@ -700,7 +700,7 @@ @attr.s -class phabchange(object): +class phabchange: """Represents a Differential change, owns Differential hunks and owned by a Differential diff. Each one represents one file in a diff. """ @@ -741,7 +741,7 @@ @attr.s -class phabdiff(object): +class phabdiff: """Represents a Differential diff, owns Differential changes. Corresponds to a commit. """ diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -159,7 +159,7 @@ ) -class rebaseruntime(object): +class rebaseruntime: """This class is a container for rebase runtime state""" def __init__(self, repo, ui, inmemory=False, dryrun=False, opts=None): diff --git a/hgext/releasenotes.py b/hgext/releasenotes.py --- a/hgext/releasenotes.py +++ b/hgext/releasenotes.py @@ -77,7 +77,7 @@ BULLET_SECTION = _(b'Other Changes') -class parsedreleasenotes(object): +class parsedreleasenotes: def __init__(self): self.sections = {} @@ -170,7 +170,7 @@ self.addnontitleditem(section, paragraphs) -class releasenotessections(object): +class releasenotessections: def __init__(self, ui, repo=None): if repo: sections = util.sortdict(DEFAULT_SECTIONS) diff --git a/hgext/remotefilelog/basepack.py b/hgext/remotefilelog/basepack.py --- a/hgext/remotefilelog/basepack.py +++ b/hgext/remotefilelog/basepack.py @@ -63,7 +63,7 @@ PACKOPENMODE = b'rb' -class _cachebackedpacks(object): +class _cachebackedpacks: def __init__(self, packs, cachesize): self._packs = set(packs) self._lrucache = util.lrucachedict(cachesize) @@ -109,7 +109,7 @@ self._lastpack = None -class basepackstore(object): +class basepackstore: # Default cache size limit for the pack files. DEFAULTCACHESIZE = 100 @@ -267,7 +267,7 @@ return newpacks -class versionmixin(object): +class versionmixin: # Mix-in for classes with multiple supported versions VERSION = None SUPPORTED_VERSIONS = [2] @@ -526,7 +526,7 @@ self.idxfp.write(struct.pack(b'!BB', self.VERSION, config)) -class indexparams(object): +class indexparams: __slots__ = ( 'fanoutprefix', 'fanoutstruct', diff --git a/hgext/remotefilelog/basestore.py b/hgext/remotefilelog/basestore.py --- a/hgext/remotefilelog/basestore.py +++ b/hgext/remotefilelog/basestore.py @@ -19,7 +19,7 @@ ) -class basestore(object): +class basestore: def __init__(self, repo, path, reponame, shared=False): """Creates a remotefilelog store object for the given repo name. @@ -412,7 +412,7 @@ ) -class baseunionstore(object): +class baseunionstore: def __init__(self, *args, **kwargs): # If one of the functions that iterates all of the stores is about to # throw a KeyError, try this many times with a full refresh between diff --git a/hgext/remotefilelog/connectionpool.py b/hgext/remotefilelog/connectionpool.py --- a/hgext/remotefilelog/connectionpool.py +++ b/hgext/remotefilelog/connectionpool.py @@ -15,7 +15,7 @@ _sshv1peer = sshpeer.sshv1peer -class connectionpool(object): +class connectionpool: def __init__(self, repo): self._repo = repo self._pool = dict() @@ -65,7 +65,7 @@ del pathpool[:] -class connection(object): +class connection: def __init__(self, pool, peer): self._pool = pool self.peer = peer diff --git a/hgext/remotefilelog/contentstore.py b/hgext/remotefilelog/contentstore.py --- a/hgext/remotefilelog/contentstore.py +++ b/hgext/remotefilelog/contentstore.py @@ -17,7 +17,7 @@ ) -class ChainIndicies(object): +class ChainIndicies: """A static class for easy reference to the delta chain indicies.""" # The filename of this revision delta @@ -229,7 +229,7 @@ self._threaddata.metacache = (node, meta) -class remotecontentstore(object): +class remotecontentstore: def __init__(self, ui, fileservice, shared): self._fileservice = fileservice # type(shared) is usually remotefilelogcontentstore @@ -274,7 +274,7 @@ pass -class manifestrevlogstore(object): +class manifestrevlogstore: def __init__(self, repo): self._store = repo.store self._svfs = repo.svfs diff --git a/hgext/remotefilelog/debugcommands.py b/hgext/remotefilelog/debugcommands.py --- a/hgext/remotefilelog/debugcommands.py +++ b/hgext/remotefilelog/debugcommands.py @@ -81,7 +81,7 @@ os.remove(temppath) r = filelog.filelog(repo.svfs, b'temprevlog') - class faket(object): + class faket: def add(self, a, b, c): pass diff --git a/hgext/remotefilelog/fileserverclient.py b/hgext/remotefilelog/fileserverclient.py --- a/hgext/remotefilelog/fileserverclient.py +++ b/hgext/remotefilelog/fileserverclient.py @@ -139,7 +139,7 @@ peer.__class__ = remotefilepeer -class cacheconnection(object): +class cacheconnection: """The connection for communicating with the remote cache. Performs gets and sets by communicating with an external process that has the cache-specific implementation. @@ -302,7 +302,7 @@ pipeo.flush() -class fileserverclient(object): +class fileserverclient: """A client for requesting files from the remote file server.""" def __init__(self, repo): @@ -517,7 +517,7 @@ # returns cache misses. This enables tests to run easily # and may eventually allow us to be a drop in replacement # for the largefiles extension. - class simplecache(object): + class simplecache: def __init__(self): self.missingids = [] self.connected = True diff --git a/hgext/remotefilelog/metadatastore.py b/hgext/remotefilelog/metadatastore.py --- a/hgext/remotefilelog/metadatastore.py +++ b/hgext/remotefilelog/metadatastore.py @@ -141,7 +141,7 @@ ) -class remotemetadatastore(object): +class remotemetadatastore: def __init__(self, ui, fileservice, shared): self._fileservice = fileservice self._shared = shared diff --git a/hgext/remotefilelog/remotefilelog.py b/hgext/remotefilelog/remotefilelog.py --- a/hgext/remotefilelog/remotefilelog.py +++ b/hgext/remotefilelog/remotefilelog.py @@ -27,7 +27,7 @@ ) -class remotefilelognodemap(object): +class remotefilelognodemap: def __init__(self, filename, store): self._filename = filename self._store = store @@ -42,7 +42,7 @@ return node -class remotefilelog(object): +class remotefilelog: _generaldelta = True _flagserrorclass = error.RevlogError diff --git a/hgext/remotefilelog/remotefilelogserver.py b/hgext/remotefilelog/remotefilelogserver.py --- a/hgext/remotefilelog/remotefilelogserver.py +++ b/hgext/remotefilelog/remotefilelogserver.py @@ -93,7 +93,7 @@ b'x_rfl_getfile', b'file node', permission=b'pull' )(getfile) - class streamstate(object): + class streamstate: match = None shallowremote = False noflatmf = False diff --git a/hgext/remotefilelog/repack.py b/hgext/remotefilelog/repack.py --- a/hgext/remotefilelog/repack.py +++ b/hgext/remotefilelog/repack.py @@ -498,7 +498,7 @@ return keepkeys -class repacker(object): +class repacker: """Class for orchestrating the repack of data and history information into a new format. """ @@ -819,7 +819,7 @@ return sortednodes -class repackledger(object): +class repackledger: """Storage for all the bookkeeping that happens during a repack. It contains the list of revisions being repacked, what happened to each revision, and which source store contained which revision originally (for later cleanup). @@ -867,7 +867,7 @@ self.created.add(value) -class repackentry(object): +class repackentry: """Simple class representing a single revision entry in the repackledger.""" __slots__ = ( diff --git a/hgext/remotenames.py b/hgext/remotenames.py --- a/hgext/remotenames.py +++ b/hgext/remotenames.py @@ -176,7 +176,7 @@ items = iteritems -class remotenames(object): +class remotenames: """ This class encapsulates all the remotenames state. It also contains methods to access that state in convenient ways. Remotenames are lazy diff --git a/hgext/schemes.py b/hgext/schemes.py --- a/hgext/schemes.py +++ b/hgext/schemes.py @@ -67,7 +67,7 @@ _partre = re.compile(br'{(\d+)\}') -class ShortRepository(object): +class ShortRepository: def __init__(self, url, scheme, templater): self.scheme = scheme self.templater = templater diff --git a/hgext/sqlitestore.py b/hgext/sqlitestore.py --- a/hgext/sqlitestore.py +++ b/hgext/sqlitestore.py @@ -264,7 +264,7 @@ @attr.s -class revisionentry(object): +class revisionentry: rid = attr.ib() rev = attr.ib() node = attr.ib() @@ -278,7 +278,7 @@ @interfaceutil.implementer(repository.irevisiondelta) @attr.s(slots=True) -class sqliterevisiondelta(object): +class sqliterevisiondelta: node = attr.ib() p1node = attr.ib() p2node = attr.ib() @@ -294,14 +294,14 @@ @interfaceutil.implementer(repository.iverifyproblem) @attr.s(frozen=True) -class sqliteproblem(object): +class sqliteproblem: warning = attr.ib(default=None) error = attr.ib(default=None) node = attr.ib(default=None) @interfaceutil.implementer(repository.ifilestorage) -class sqlitefilestore(object): +class sqlitefilestore: """Implements storage for an individual tracked path.""" def __init__(self, db, path, compression): @@ -1249,7 +1249,7 @@ @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) -class sqlitefilestorage(object): +class sqlitefilestorage: """Repository file storage backed by SQLite.""" def file(self, path): diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -75,13 +75,13 @@ ) -class transplantentry(object): +class transplantentry: def __init__(self, lnode, rnode): self.lnode = lnode self.rnode = rnode -class transplants(object): +class transplants: def __init__(self, path=None, transplantfile=None, opener=None): self.path = path self.transplantfile = transplantfile @@ -128,7 +128,7 @@ self.dirty = True -class transplanter(object): +class transplanter: def __init__(self, ui, repo, opts): self.ui = ui self.repo = repo diff --git a/hgext/zeroconf/Zeroconf.py b/hgext/zeroconf/Zeroconf.py --- a/hgext/zeroconf/Zeroconf.py +++ b/hgext/zeroconf/Zeroconf.py @@ -231,7 +231,7 @@ # implementation classes -class DNSEntry(object): +class DNSEntry: """A DNS entry""" def __init__(self, name, type, clazz): @@ -506,7 +506,7 @@ return self.toString(b"%s:%s" % (self.server, self.port)) -class DNSIncoming(object): +class DNSIncoming: """Object representation of an incoming DNS packet""" def __init__(self, data): @@ -702,7 +702,7 @@ return result -class DNSOutgoing(object): +class DNSOutgoing: """Object representation of an outgoing packet""" def __init__(self, flags, multicast=1): @@ -864,7 +864,7 @@ return b''.join(self.data) -class DNSCache(object): +class DNSCache: """A cache of DNS entries""" def __init__(self): @@ -982,7 +982,7 @@ self.condition.release() -class Listener(object): +class Listener: """A Listener is used by this module to listen on the multicast group to which DNS messages are sent, allowing the implementation to cache information as it arrives. @@ -1127,7 +1127,7 @@ event(self.zeroconf) -class ServiceInfo(object): +class ServiceInfo: """Service information""" def __init__( @@ -1386,7 +1386,7 @@ return result -class Zeroconf(object): +class Zeroconf: """Implementation of Zeroconf Multicast DNS Service Discovery Supports registration, unregistration, queries and browsing. diff --git a/hgext/zeroconf/__init__.py b/hgext/zeroconf/__init__.py --- a/hgext/zeroconf/__init__.py +++ b/hgext/zeroconf/__init__.py @@ -158,7 +158,7 @@ # listen -class listener(object): +class listener: def __init__(self): self.found = {} diff --git a/i18n/polib.py b/i18n/polib.py --- a/i18n/polib.py +++ b/i18n/polib.py @@ -42,7 +42,7 @@ except ImportError: # replacement of io.open() for python < 2.6 # we use codecs instead - class io(object): + class io: @staticmethod def open(fpath, mode='r', encoding=None): return codecs.open(fpath, mode, encoding) @@ -816,7 +816,7 @@ # class _BaseEntry {{{ -class _BaseEntry(object): +class _BaseEntry: """ Base class for :class:`~polib.POEntry` and :class:`~polib.MOEntry` classes. This class should **not** be instanciated directly. @@ -1227,7 +1227,7 @@ # class _POFileParser {{{ -class _POFileParser(object): +class _POFileParser: """ A finite state machine to parse efficiently and correctly po file format. @@ -1706,7 +1706,7 @@ # class _MOFileParser {{{ -class _MOFileParser(object): +class _MOFileParser: """ A class to parse binary mo files. """ diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py --- a/mercurial/ancestor.py +++ b/mercurial/ancestor.py @@ -146,7 +146,7 @@ return deepest(gca) -class incrementalmissingancestors(object): +class incrementalmissingancestors: """persistent state used to calculate missing ancestors incrementally Although similar in spirit to lazyancestors below, this is a separate class @@ -316,7 +316,7 @@ see(p2) -class lazyancestors(object): +class lazyancestors: def __init__(self, pfunc, revs, stoprev=0, inclusive=False): """Create a new object generating ancestors for the given revs. Does not generate revs lower than stoprev. diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -132,7 +132,7 @@ return out.getvalue() -class tarit(object): +class tarit: """write archive to tar file or stream. can write uncompressed, or compress with gzip or bzip2.""" @@ -193,7 +193,7 @@ self.fileobj.close() -class zipit(object): +class zipit: """write archive to zip file or stream. can write uncompressed, or compressed with deflate.""" @@ -240,7 +240,7 @@ self.z.close() -class fileit(object): +class fileit: '''write archive as files in directory.''' def __init__(self, name, mtime): diff --git a/mercurial/bookmarks.py b/mercurial/bookmarks.py --- a/mercurial/bookmarks.py +++ b/mercurial/bookmarks.py @@ -58,7 +58,7 @@ return fp -class bmstore(object): +class bmstore: r"""Storage for bookmarks. This object should do all bookmark-related reads and writes, so diff --git a/mercurial/branchmap.py b/mercurial/branchmap.py --- a/mercurial/branchmap.py +++ b/mercurial/branchmap.py @@ -62,7 +62,7 @@ unpack_from = struct.unpack_from -class BranchMapCache(object): +class BranchMapCache: """mapping of filtered views of repo with their branchcache""" def __init__(self): @@ -169,7 +169,7 @@ return b'branch cache' -class branchcache(object): +class branchcache: """A dict like object that hold branches heads cache. This cache is used to avoid costly computations to determine all the @@ -631,7 +631,7 @@ _rbccloseflag = 0x80000000 -class revbranchcache(object): +class revbranchcache: """Persistent cache, mapping from revision number to branch name and close. This is a low level cache, independent of filtering. diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py --- a/mercurial/bundle2.py +++ b/mercurial/bundle2.py @@ -251,7 +251,7 @@ return _decorator -class unbundlerecords(object): +class unbundlerecords: """keep record of what happens during and unbundle New records are added using `records.add('cat', obj)`. Where 'cat' is a @@ -299,7 +299,7 @@ __bool__ = __nonzero__ -class bundleoperation(object): +class bundleoperation: """an object that represents a single bundling process Its purpose is to carry unbundle-related objects and states. @@ -379,7 +379,7 @@ return op -class partiterator(object): +class partiterator: def __init__(self, repo, op, unbundler): self.repo = repo self.op = op @@ -626,7 +626,7 @@ bundlepriority = [b'HG10GZ', b'HG10BZ', b'HG10UN'] -class bundle20(object): +class bundle20: """represent an outgoing bundle2 container Use the `addparam` method to add stream level parameter. and `newpart` to @@ -750,7 +750,7 @@ return salvaged -class unpackermixin(object): +class unpackermixin: """A mixin to extract bytes and struct data from a stream""" def __init__(self, fp): @@ -983,7 +983,7 @@ unbundler._compressed = True -class bundlepart(object): +class bundlepart: """A bundle2 part contains application level payload The part `type` is used to route the part to the application level @@ -1273,7 +1273,7 @@ ) -class interruptoperation(object): +class interruptoperation: """A limited operation to be use by part handler during interruption It only have access to an ui object. diff --git a/mercurial/bundlecaches.py b/mercurial/bundlecaches.py --- a/mercurial/bundlecaches.py +++ b/mercurial/bundlecaches.py @@ -21,7 +21,7 @@ @attr.s -class bundlespec(object): +class bundlespec: compression = attr.ib() wirecompression = attr.ib() version = attr.ib() @@ -343,7 +343,7 @@ return newentries -class clonebundleentry(object): +class clonebundleentry: """Represents an item in a clone bundles manifest. This rich class is needed to support sorting since sorted() in Python 3 diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py --- a/mercurial/bundlerepo.py +++ b/mercurial/bundlerepo.py @@ -270,7 +270,7 @@ return filespos -class bundlerepository(object): +class bundlerepository: """A repository instance that is a union of a local repo and a bundle. Instances represent a read-only repository composed of a local repository @@ -550,7 +550,7 @@ return repo -class bundletransactionmanager(object): +class bundletransactionmanager: def transaction(self): return None diff --git a/mercurial/cffi/osutil.py b/mercurial/cffi/osutil.py --- a/mercurial/cffi/osutil.py +++ b/mercurial/cffi/osutil.py @@ -33,7 +33,7 @@ attrkinds[lib.VFIFO] = statmod.S_IFIFO attrkinds[lib.VSOCK] = statmod.S_IFSOCK - class stat_res(object): + class stat_res: def __init__(self, st_mode, st_mtime, st_size): self.st_mode = st_mode self.st_mtime = st_mtime diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py --- a/mercurial/changegroup.py +++ b/mercurial/changegroup.py @@ -105,7 +105,7 @@ os.unlink(cleanup) -class cg1unpacker(object): +class cg1unpacker: """Unpacker for cg1 changegroup streams. A changegroup unpacker handles the framing of the revision data in @@ -691,7 +691,7 @@ ) -class headerlessfixup(object): +class headerlessfixup: def __init__(self, fh, h): self._h = h self._fh = fh @@ -1003,7 +1003,7 @@ progress.complete() -class cgpacker(object): +class cgpacker: def __init__( self, repo, diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -91,7 +91,7 @@ return b'\n'.join([l.rstrip() for l in desc.splitlines()]).strip(b'\n') -class appender(object): +class appender: """the changelog index must be updated last on disk, so we use this class to delay writes to it""" @@ -161,7 +161,7 @@ return self.fp.__exit__(*args) -class _divertopener(object): +class _divertopener: def __init__(self, opener, target): self._opener = opener self._target = target @@ -188,7 +188,7 @@ @attr.s -class _changelogrevision(object): +class _changelogrevision: # Extensions might modify _defaultextra, so let the constructor below pass # it in extra = attr.ib() @@ -204,7 +204,7 @@ branchinfo = attr.ib(default=(_defaultextra[b'branch'], False)) -class changelogrevision(object): +class changelogrevision: """Holds results of a parsed changelog revision. Changelog revisions consist of multiple pieces of data, including diff --git a/mercurial/chgserver.py b/mercurial/chgserver.py --- a/mercurial/chgserver.py +++ b/mercurial/chgserver.py @@ -196,7 +196,7 @@ return _hashlist(pycompat.maplist(trystat, paths))[:12] -class hashstate(object): +class hashstate: """a structure storing confighash, mtimehash, paths used for mtimehash""" def __init__(self, confighash, mtimehash, mtimepaths): @@ -292,7 +292,7 @@ return (newui, newlui) -class channeledsystem(object): +class channeledsystem: """Propagate ui.system() request in the following format: payload length (unsigned int), @@ -623,7 +623,7 @@ return b'%s-%s' % (os.path.join(dirname, basename), hashstr) -class chgunixservicehandler(object): +class chgunixservicehandler: """Set of operations for chg services""" pollinterval = 1 # [sec] diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -666,7 +666,7 @@ return commit(ui, repo, recordinwlock, pats, opts) -class dirnode(object): +class dirnode: """ Represent a directory in user working copy with information required for the purpose of tersing its status. @@ -832,7 +832,7 @@ @attr.s(frozen=True) -class morestatus(object): +class morestatus: reporoot = attr.ib() unfinishedop = attr.ib() unfinishedmsg = attr.ib() @@ -1343,7 +1343,7 @@ return not pat or pat == b'-' -class _unclosablefile(object): +class _unclosablefile: def __init__(self, fp): self._fp = fp diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py --- a/mercurial/commandserver.py +++ b/mercurial/commandserver.py @@ -39,7 +39,7 @@ ) -class channeledoutput(object): +class channeledoutput: """ Write data to out in the following format: @@ -68,7 +68,7 @@ return getattr(self.out, attr) -class channeledmessage(object): +class channeledmessage: """ Write encoded message and metadata to out in the following format: @@ -97,7 +97,7 @@ return getattr(self._cout, attr) -class channeledinput(object): +class channeledinput: """ Read data from in_. @@ -200,7 +200,7 @@ ) -class server(object): +class server: """ Listens for commands on fin, runs them and writes the output on a channel based stream to fout. @@ -450,7 +450,7 @@ u.setlogger(b'cmdserver', logger) -class pipeservice(object): +class pipeservice: def __init__(self, ui, repo, opts): self.ui = ui self.repo = repo @@ -525,7 +525,7 @@ raise -class unixservicehandler(object): +class unixservicehandler: """Set of pluggable operations for unix-mode services Almost all methods except for createcmdserver() are called in the main @@ -559,7 +559,7 @@ return server(self.ui, repo, fin, fout, prereposetups) -class unixforkingservice(object): +class unixforkingservice: """ Listens on unix domain socket and forks server per connection """ diff --git a/mercurial/config.py b/mercurial/config.py --- a/mercurial/config.py +++ b/mercurial/config.py @@ -18,7 +18,7 @@ ) -class config(object): +class config: def __init__(self, data=None): self._current_source_level = 0 self._data = {} diff --git a/mercurial/configitems.py b/mercurial/configitems.py --- a/mercurial/configitems.py +++ b/mercurial/configitems.py @@ -29,7 +29,7 @@ knownitems.update(items) -class configitem(object): +class configitem: """represent a known config item :section: the official config section where to find this item, diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -51,7 +51,7 @@ propertycache = util.propertycache -class basectx(object): +class basectx: """A basectx object represents the common logic for its children: changectx: read-only context that is already present in the repo, workingctx: a context that represents the working directory and can @@ -796,7 +796,7 @@ return self.walk(match) -class basefilectx(object): +class basefilectx: """A filecontext object represents the common logic for its children: filectx: read-only access to a filerevision that is already present in the repo, @@ -3104,7 +3104,7 @@ return scmutil.status(modified, added, removed, [], [], [], []) -class arbitraryfilectx(object): +class arbitraryfilectx: """Allows you to use filectx-like functions on a file in an arbitrary location on disk, possibly not in the working directory. """ diff --git a/mercurial/copies.py b/mercurial/copies.py --- a/mercurial/copies.py +++ b/mercurial/copies.py @@ -887,7 +887,7 @@ copy[dst] = src -class branch_copies(object): +class branch_copies: """Information about copies made on one side of a merge/graft. "copy" is a mapping from destination name -> source name, diff --git a/mercurial/crecord.py b/mercurial/crecord.py --- a/mercurial/crecord.py +++ b/mercurial/crecord.py @@ -82,7 +82,7 @@ return curses and ui.interface(b"chunkselector") == b"curses" -class patchnode(object): +class patchnode: """abstract class for patch graph nodes (i.e. patchroot, header, hunk, hunkline) """ @@ -601,7 +601,7 @@ """ chunkselector = curseschunkselector(headerlist, ui, operation) - class dummystdscr(object): + class dummystdscr: def clear(self): pass @@ -628,7 +628,7 @@ } -class curseschunkselector(object): +class curseschunkselector: def __init__(self, headerlist, ui, operation=None): # put the headers into a patch object self.headerlist = patch(headerlist) diff --git a/mercurial/dagop.py b/mercurial/dagop.py --- a/mercurial/dagop.py +++ b/mercurial/dagop.py @@ -271,7 +271,7 @@ break -class subsetparentswalker(object): +class subsetparentswalker: r"""Scan adjacent ancestors in the graph given by the subset This computes parent-child relations in the sub graph filtered by @@ -647,7 +647,7 @@ @attr.s(slots=True, frozen=True) -class annotateline(object): +class annotateline: fctx = attr.ib() lineno = attr.ib() # Whether this annotation was the result of a skip-annotate. @@ -656,7 +656,7 @@ @attr.s(slots=True, frozen=True) -class _annotatedfile(object): +class _annotatedfile: # list indexed by lineno - 1 fctxs = attr.ib() linenos = attr.ib() diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -90,7 +90,7 @@ @interfaceutil.implementer(intdirstate.idirstate) -class dirstate(object): +class dirstate: def __init__( self, opener, diff --git a/mercurial/dirstatemap.py b/mercurial/dirstatemap.py --- a/mercurial/dirstatemap.py +++ b/mercurial/dirstatemap.py @@ -34,7 +34,7 @@ rangemask = 0x7FFFFFFF -class _dirstatemapcommon(object): +class _dirstatemapcommon: """ Methods that are identical for both implementations of the dirstatemap class, with and without Rust extensions enabled. diff --git a/mercurial/dirstateutils/docket.py b/mercurial/dirstateutils/docket.py --- a/mercurial/dirstateutils/docket.py +++ b/mercurial/dirstateutils/docket.py @@ -28,7 +28,7 @@ ) -class DirstateDocket(object): +class DirstateDocket: data_filename_pattern = b'dirstate.%s' def __init__(self, parents, data_size, tree_metadata, uuid): diff --git a/mercurial/dirstateutils/v2.py b/mercurial/dirstateutils/v2.py --- a/mercurial/dirstateutils/v2.py +++ b/mercurial/dirstateutils/v2.py @@ -125,7 +125,7 @@ @attr.s -class Node(object): +class Node: path = attr.ib() entry = attr.ib() parent = attr.ib(default=None) diff --git a/mercurial/discovery.py b/mercurial/discovery.py --- a/mercurial/discovery.py +++ b/mercurial/discovery.py @@ -73,7 +73,7 @@ return (list(common), anyinc, heads or list(srvheads)) -class outgoing(object): +class outgoing: """Represents the result of a findcommonoutgoing() call. Members: diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -53,7 +53,7 @@ ) -class request(object): +class request: def __init__( self, args, @@ -557,7 +557,7 @@ return r.sub(lambda x: replacemap[x.group()], cmd) -class cmdalias(object): +class cmdalias: def __init__(self, ui, name, definition, cmdtable, source): self.name = self.cmd = name self.cmdname = b'' @@ -740,7 +740,7 @@ raise -class lazyaliasentry(object): +class lazyaliasentry: """like a typical command entry (func, opts, help), but is lazy""" def __init__(self, ui, name, definition, cmdtable, source): diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -510,7 +510,7 @@ return u + ellipsis -class normcasespecs(object): +class normcasespecs: """what a platform's normcase does to ASCII strings This is specified per platform, and should be consistent with what normcase diff --git a/mercurial/error.py b/mercurial/error.py --- a/mercurial/error.py +++ b/mercurial/error.py @@ -39,7 +39,7 @@ return b'(%s)' % b', '.join(b"'%s'" % pycompat.bytestr(a) for a in exc.args) -class Hint(object): +class Hint: """Mix-in to provide a hint of an error This should come first in the inheritance list to consume a hint and diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -222,7 +222,7 @@ return forcebundle1 or not op.remote.capable(b'bundle2') -class pushoperation(object): +class pushoperation: """A object that represent a single push operation Its purpose is to carry push related state and very common operations. @@ -1371,7 +1371,7 @@ pushop.bkresult = 1 -class pulloperation(object): +class pulloperation: """A object that represent a single pull operation It purpose is to carry pull related state and very common operation. diff --git a/mercurial/extensions.py b/mercurial/extensions.py --- a/mercurial/extensions.py +++ b/mercurial/extensions.py @@ -621,7 +621,7 @@ raise AttributeError("type '%s' has no property '%s'" % (cls, propname)) -class wrappedfunction(object): +class wrappedfunction: '''context manager for temporarily wrapping a function''' def __init__(self, container, funcname, wrapper): diff --git a/mercurial/exthelper.py b/mercurial/exthelper.py --- a/mercurial/exthelper.py +++ b/mercurial/exthelper.py @@ -20,7 +20,7 @@ from hgdemandimport import tracing -class exthelper(object): +class exthelper: """Helper for modular extension setup A single helper should be instantiated for each module of an diff --git a/mercurial/fancyopts.py b/mercurial/fancyopts.py --- a/mercurial/fancyopts.py +++ b/mercurial/fancyopts.py @@ -204,7 +204,7 @@ return parsedopts, parsedargs -class customopt(object): # pytype: disable=ignored-metaclass +class customopt: # pytype: disable=ignored-metaclass """Manage defaults and mutations for any type of opt.""" __metaclass__ = abc.ABCMeta diff --git a/mercurial/filelog.py b/mercurial/filelog.py --- a/mercurial/filelog.py +++ b/mercurial/filelog.py @@ -24,7 +24,7 @@ @interfaceutil.implementer(repository.ifilestorage) -class filelog(object): +class filelog: def __init__(self, opener, path): self._revlog = revlog.revlog( opener, diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py --- a/mercurial/filemerge.py +++ b/mercurial/filemerge.py @@ -84,7 +84,7 @@ ) -class absentfilectx(object): +class absentfilectx: """Represents a file that's ostensibly in a context but is actually not present in it. diff --git a/mercurial/fileset.py b/mercurial/fileset.py --- a/mercurial/fileset.py +++ b/mercurial/fileset.py @@ -503,7 +503,7 @@ } -class matchctx(object): +class matchctx: def __init__(self, basectx, ctx, cwd, badfn=None): self._basectx = basectx self.ctx = ctx diff --git a/mercurial/formatter.py b/mercurial/formatter.py --- a/mercurial/formatter.py +++ b/mercurial/formatter.py @@ -144,7 +144,7 @@ return isinstance(obj, (type(None), bool, int, int, float, bytes)) -class _nullconverter(object): +class _nullconverter: '''convert non-primitive data types to be processed by formatter''' # set to True if context object should be stored as item @@ -175,7 +175,7 @@ return list(data) -class baseformatter(object): +class baseformatter: # set to True if the formater output a strict format that does not support # arbitrary output in the stream. @@ -297,7 +297,7 @@ return data -class _plainconverter(object): +class _plainconverter: '''convert non-primitive data types to text''' storecontext = False @@ -452,7 +452,7 @@ self._out.write(b"\n]\n") -class _templateconverter(object): +class _templateconverter: '''convert non-primitive data types to be processed by templater''' storecontext = True @@ -541,7 +541,7 @@ @attr.s(frozen=True) -class templatespec(object): +class templatespec: ref = attr.ib() tmpl = attr.ib() mapfile = attr.ib() diff --git a/mercurial/graphmod.py b/mercurial/graphmod.py --- a/mercurial/graphmod.py +++ b/mercurial/graphmod.py @@ -358,7 +358,7 @@ @attr.s -class asciistate(object): +class asciistate: """State of ascii() graph rendering""" seen = attr.ib(init=False, default=attr.Factory(list)) diff --git a/mercurial/grep.py b/mercurial/grep.py --- a/mercurial/grep.py +++ b/mercurial/grep.py @@ -35,7 +35,7 @@ yield linenum, mstart - lstart, mend - lstart, body[lstart:lend] -class linestate(object): +class linestate: def __init__(self, line, linenum, colstart, colend): self.line = line self.linenum = linenum @@ -79,7 +79,7 @@ yield (b'+', b[i]) -class grepsearcher(object): +class grepsearcher: """Search files and revisions for lines matching the given pattern Options: diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -1534,7 +1534,7 @@ ] -class cachedlocalrepo(object): +class cachedlocalrepo: """Holds a localrepository that can be cached and reused.""" def __init__(self, repo): diff --git a/mercurial/hgweb/__init__.py b/mercurial/hgweb/__init__.py --- a/mercurial/hgweb/__init__.py +++ b/mercurial/hgweb/__init__.py @@ -54,7 +54,7 @@ return hgwebdir_mod.hgwebdir(config, baseui=baseui) -class httpservice(object): +class httpservice: def __init__(self, ui, app, opts): self.ui = ui self.app = app diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py +++ b/mercurial/hgweb/common.py @@ -115,7 +115,7 @@ self.message = message -class continuereader(object): +class continuereader: """File object wrapper to handle HTTP 100-continue. This is used by servers so they automatically handle Expect: 100-continue diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -110,7 +110,7 @@ return templateutil.mappinglist(reversed(breadcrumb)) -class requestcontext(object): +class requestcontext: """Holds state/context for an individual request. Servers can be multi-threaded. Holding state on the WSGI application @@ -235,7 +235,7 @@ return self.res.sendresponse() -class hgweb(object): +class hgweb: """HTTP server for individual repositories. Instances of this class serve HTTP responses for a particular diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py +++ b/mercurial/hgweb/hgwebdir_mod.py @@ -268,7 +268,7 @@ return templateutil.mappinggenerator(_indexentriesgen, args=args) -class hgwebdir(object): +class hgwebdir: """HTTP server for multiple repositories. Given a configuration, different repositories will be served depending diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -21,7 +21,7 @@ ) -class multidict(object): +class multidict: """A dict like object that can store multiple values for a key. Used to store parsed request parameters. @@ -81,7 +81,7 @@ @attr.s(frozen=True) -class parsedrequest(object): +class parsedrequest: """Represents a parsed WSGI request. Contains both parsed parameters as well as a handle on the input stream. @@ -355,7 +355,7 @@ ) -class offsettrackingwriter(object): +class offsettrackingwriter: """A file object like object that is append only and tracks write count. Instances are bound to a callable. This callable is called with data @@ -388,7 +388,7 @@ return self._offset -class wsgiresponse(object): +class wsgiresponse: """Represents a response to a WSGI request. A response consists of a status line, headers, and a body. diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py --- a/mercurial/hgweb/server.py +++ b/mercurial/hgweb/server.py @@ -52,7 +52,7 @@ return urlreq.unquote(path), query -class _error_logger(object): +class _error_logger: def __init__(self, handler): self.handler = handler @@ -343,7 +343,7 @@ _mixin = socketserver.ForkingMixIn else: - class _mixin(object): + class _mixin: pass diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -46,7 +46,7 @@ commands = {} -class webcommand(object): +class webcommand: """Decorator used to register a web command handler. The decorator takes as its positional arguments the name/path the diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -99,7 +99,7 @@ step *= 10 -class revnav(object): +class revnav: def __init__(self, repo): """Navigation generation object diff --git a/mercurial/hgweb/wsgiheaders.py b/mercurial/hgweb/wsgiheaders.py --- a/mercurial/hgweb/wsgiheaders.py +++ b/mercurial/hgweb/wsgiheaders.py @@ -29,7 +29,7 @@ return param -class Headers(object): +class Headers: """Manage a collection of HTTP response headers""" def __init__(self, headers=None): diff --git a/mercurial/httpconnection.py b/mercurial/httpconnection.py --- a/mercurial/httpconnection.py +++ b/mercurial/httpconnection.py @@ -26,7 +26,7 @@ urlreq = util.urlreq # moved here from url.py to avoid a cycle -class httpsendfile(object): +class httpsendfile: """This is a wrapper around the objects returned by python's "open". Its purpose is to send file-like objects via HTTP. diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py --- a/mercurial/httppeer.py +++ b/mercurial/httppeer.py @@ -62,7 +62,7 @@ return result -class _multifile(object): +class _multifile: def __init__(self, *fileobjs): for f in fileobjs: if not util.safehasattr(f, b'length'): diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py --- a/mercurial/interfaces/repository.py +++ b/mercurial/interfaces/repository.py @@ -388,7 +388,7 @@ @interfaceutil.implementer(ipeerbase) -class peer(object): +class peer: """Base class for peer repositories.""" limitedarguments = False diff --git a/mercurial/interfaces/util.py b/mercurial/interfaces/util.py --- a/mercurial/interfaces/util.py +++ b/mercurial/interfaces/util.py @@ -20,11 +20,11 @@ implementer = zi.implementer else: - class Attribute(object): + class Attribute: def __init__(self, __name__, __doc__=b''): pass - class Interface(object): + class Interface: def __init__( self, name, bases=(), attrs=None, __doc__=None, __module__=None ): diff --git a/mercurial/keepalive.py b/mercurial/keepalive.py --- a/mercurial/keepalive.py +++ b/mercurial/keepalive.py @@ -107,7 +107,7 @@ DEBUG = None -class ConnectionManager(object): +class ConnectionManager: """ The connection manager must be able to: * keep track of all existing @@ -170,7 +170,7 @@ return dict(self._hostmap) -class KeepAliveHandler(object): +class KeepAliveHandler: def __init__(self, timeout=None): self._cm = ConnectionManager() self._timeout = timeout @@ -789,7 +789,7 @@ global DEBUG dbbackup = DEBUG - class FakeLogger(object): + class FakeLogger: def debug(self, msg, *args): print(msg % args) diff --git a/mercurial/linelog.py b/mercurial/linelog.py --- a/mercurial/linelog.py +++ b/mercurial/linelog.py @@ -33,7 +33,7 @@ @attr.s -class lineinfo(object): +class lineinfo: # Introducing revision of this line. rev = attr.ib() # Line number for this line in its introducing revision. @@ -43,7 +43,7 @@ @attr.s -class annotateresult(object): +class annotateresult: rev = attr.ib() lines = attr.ib() _eof = attr.ib() @@ -52,7 +52,7 @@ return iter(self.lines) -class _llinstruction(object): # pytype: disable=ignored-metaclass +class _llinstruction: # pytype: disable=ignored-metaclass __metaclass__ = abc.ABCMeta @@ -233,7 +233,7 @@ raise NotImplementedError(b'Unimplemented opcode %r' % opcode) -class linelog(object): +class linelog: """Efficient cache for per-line history information.""" def __init__(self, program=None, maxrev=0): diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -251,7 +251,7 @@ @interfaceutil.implementer(repository.ipeercommandexecutor) -class localcommandexecutor(object): +class localcommandexecutor: def __init__(self, peer): self._peer = peer self._sent = False @@ -1215,7 +1215,7 @@ @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) -class revlogfilestorage(object): +class revlogfilestorage: """File storage when using revlogs.""" def file(self, path): @@ -1226,7 +1226,7 @@ @interfaceutil.implementer(repository.ilocalrepositoryfilestorage) -class revlognarrowfilestorage(object): +class revlognarrowfilestorage: """File storage when using revlogs and narrow files.""" def file(self, path): @@ -1259,7 +1259,7 @@ @interfaceutil.implementer(repository.ilocalrepositorymain) -class localrepository(object): +class localrepository: """Main class for representing local repositories. All local repositories are instances of this class. @@ -2044,7 +2044,7 @@ # This simplifies its cache management by having one decorated # function (this one) and the rest simply fetch things from it. - class tagscache(object): + class tagscache: def __init__(self): # These two define the set of tags for this repository. tags # maps tag name to node; tagtypes maps tag name to 'global' or @@ -3912,7 +3912,7 @@ # # But we have to allow the close() method because some constructors # of repos call close() on repo references. - class poisonedrepository(object): + class poisonedrepository: def __getattribute__(self, item): if item == 'close': return object.__getattribute__(self, item) diff --git a/mercurial/lock.py b/mercurial/lock.py --- a/mercurial/lock.py +++ b/mercurial/lock.py @@ -173,7 +173,7 @@ return l -class lock(object): +class lock: """An advisory lock held by one process to control access to a set of files. Non-cooperating processes or incorrectly written scripts can ignore Mercurial's locking scheme and stomp all over the diff --git a/mercurial/logcmdutil.py b/mercurial/logcmdutil.py --- a/mercurial/logcmdutil.py +++ b/mercurial/logcmdutil.py @@ -227,7 +227,7 @@ ) -class changesetdiffer(object): +class changesetdiffer: """Generate diff of changeset with pre-configured filtering functions""" def _makefilematcher(self, ctx): @@ -261,7 +261,7 @@ return b' '.join(labels) -class changesetprinter(object): +class changesetprinter: '''show changeset information when templating not requested.''' def __init__(self, ui, repo, differ=None, diffopts=None, buffered=False): @@ -706,7 +706,7 @@ @attr.s -class walkopts(object): +class walkopts: """Options to configure a set of revisions and file matcher factory to scan revision/file history """ diff --git a/mercurial/loggingutil.py b/mercurial/loggingutil.py --- a/mercurial/loggingutil.py +++ b/mercurial/loggingutil.py @@ -73,7 +73,7 @@ return b'*' in tracked or event in tracked -class filelogger(object): +class filelogger: """Basic logger backed by physical file with optional rotation""" def __init__(self, vfs, name, tracked, maxfiles=0, maxsize=0): @@ -104,7 +104,7 @@ ) -class fileobjectlogger(object): +class fileobjectlogger: """Basic logger backed by file-like object""" def __init__(self, fp, tracked): @@ -129,7 +129,7 @@ ) -class proxylogger(object): +class proxylogger: """Forward log events to another logger to be set later""" def __init__(self): diff --git a/mercurial/lsprof.py b/mercurial/lsprof.py --- a/mercurial/lsprof.py +++ b/mercurial/lsprof.py @@ -22,7 +22,7 @@ return Stats(p.getstats()) -class Stats(object): +class Stats: """XXX docstring""" def __init__(self, data): diff --git a/mercurial/lsprofcalltree.py b/mercurial/lsprofcalltree.py --- a/mercurial/lsprofcalltree.py +++ b/mercurial/lsprofcalltree.py @@ -26,7 +26,7 @@ ) -class KCacheGrind(object): +class KCacheGrind: def __init__(self, profiler): self.data = profiler.getstats() self.out_file = None diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -84,7 +84,7 @@ return b''.join(lines) -class lazymanifestiter(object): +class lazymanifestiter: def __init__(self, lm): self.pos = 0 self.lm = lm @@ -107,7 +107,7 @@ __next__ = next -class lazymanifestiterentries(object): +class lazymanifestiterentries: def __init__(self, lm): self.lm = lm self.pos = 0 @@ -158,7 +158,7 @@ _manifestflags = {b'', b'l', b't', b'x'} -class _lazymanifest(object): +class _lazymanifest: """A pure python manifest backed by a byte string. It is supplimented with internal lists as it is modified, until it is compacted back to a pure byte string. @@ -473,7 +473,7 @@ @interfaceutil.implementer(repository.imanifestdict) -class manifestdict(object): +class manifestdict: def __init__(self, nodelen, data=b''): self._nodelen = nodelen self._lm = _lazymanifest(nodelen, data) @@ -796,7 +796,7 @@ @interfaceutil.implementer(repository.imanifestdict) -class treemanifest(object): +class treemanifest: def __init__(self, nodeconstants, dir=b'', text=b''): self._dir = dir self.nodeconstants = nodeconstants @@ -1550,7 +1550,7 @@ @interfaceutil.implementer(repository.imanifeststorage) -class manifestrevlog(object): +class manifestrevlog: """A revlog that stores manifest texts. This is responsible for caching the full-text manifest contents. """ @@ -1908,7 +1908,7 @@ @interfaceutil.implementer(repository.imanifestlog) -class manifestlog(object): +class manifestlog: """A collection class representing the collection of manifest snapshots referenced by commits in the repository. @@ -2007,7 +2007,7 @@ @interfaceutil.implementer(repository.imanifestrevisionwritable) -class memmanifestctx(object): +class memmanifestctx: def __init__(self, manifestlog): self._manifestlog = manifestlog self._manifestdict = manifestdict(manifestlog.nodeconstants.nodelen) @@ -2037,7 +2037,7 @@ @interfaceutil.implementer(repository.imanifestrevisionstored) -class manifestctx(object): +class manifestctx: """A class representing a single revision of a manifest, including its contents, its parent revs, and its linkrev. """ @@ -2117,7 +2117,7 @@ @interfaceutil.implementer(repository.imanifestrevisionwritable) -class memtreemanifestctx(object): +class memtreemanifestctx: def __init__(self, manifestlog, dir=b''): self._manifestlog = manifestlog self._dir = dir @@ -2152,7 +2152,7 @@ @interfaceutil.implementer(repository.imanifestrevisionstored) -class treemanifestctx(object): +class treemanifestctx: def __init__(self, manifestlog, dir, node): self._manifestlog = manifestlog self._dir = dir diff --git a/mercurial/match.py b/mercurial/match.py --- a/mercurial/match.py +++ b/mercurial/match.py @@ -382,7 +382,7 @@ return kindpats -class basematcher(object): +class basematcher: def __init__(self, badfn=None): if badfn is not None: self.bad = badfn @@ -659,7 +659,7 @@ # This is basically a reimplementation of pathutil.dirs that stores the # children instead of just a count of them, plus a small optional optimization # to avoid some directories we don't need. -class _dirchildren(object): +class _dirchildren: def __init__(self, paths, onlyinclude=None): self._dirs = {} self._onlyinclude = onlyinclude or [] diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py --- a/mercurial/mdiff.py +++ b/mercurial/mdiff.py @@ -37,7 +37,7 @@ # TODO: this looks like it could be an attrs, which might help pytype -class diffopts(object): +class diffopts: """context is the number of context lines text treats all files as text showfunc enables diff -p output diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -66,7 +66,7 @@ ) -class _unknowndirschecker(object): +class _unknowndirschecker: """ Look for any unknown files or directories that may have a path conflict with a file. If any path prefix of the file exists as a file or link, @@ -537,7 +537,7 @@ raise error.StateError(msg % f) -class mergeresult(object): +class mergeresult: """An object representing result of merging manifests. It has information about what actions need to be performed on dirstate @@ -1467,7 +1467,7 @@ @attr.s(frozen=True) -class updateresult(object): +class updateresult: updatedcount = attr.ib() mergedcount = attr.ib() removedcount = attr.ib() diff --git a/mercurial/mergestate.py b/mercurial/mergestate.py --- a/mercurial/mergestate.py +++ b/mercurial/mergestate.py @@ -100,7 +100,7 @@ CHANGE_MODIFIED = b'modified' -class MergeAction(object): +class MergeAction: """represent an "action" merge need to take for a given file Attributes: @@ -194,7 +194,7 @@ ) -class _mergestate_base(object): +class _mergestate_base: """track 3-way merge state of individual files The merge state is stored on disk when needed. Two files are used: one with diff --git a/mercurial/metadata.py b/mercurial/metadata.py --- a/mercurial/metadata.py +++ b/mercurial/metadata.py @@ -22,7 +22,7 @@ ) -class ChangingFiles(object): +class ChangingFiles: """A class recording the changes made to files by a changeset Actions performed on files are gathered into 3 sets: diff --git a/mercurial/namespaces.py b/mercurial/namespaces.py --- a/mercurial/namespaces.py +++ b/mercurial/namespaces.py @@ -16,7 +16,7 @@ return [val] -class namespaces(object): +class namespaces: """provides an interface to register and operate on multiple namespaces. See the namespace class below for details on the namespace object. @@ -124,7 +124,7 @@ raise KeyError(_(b'no such name: %s') % name) -class namespace(object): +class namespace: """provides an interface to a namespace Namespaces are basically generic many-to-many mapping between some diff --git a/mercurial/node.py b/mercurial/node.py --- a/mercurial/node.py +++ b/mercurial/node.py @@ -31,7 +31,7 @@ wdirrev = 0x7FFFFFFF -class sha1nodeconstants(object): +class sha1nodeconstants: nodelen = 20 # In hex, this is '0000000000000000000000000000000000000000' diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py --- a/mercurial/obsolete.py +++ b/mercurial/obsolete.py @@ -541,7 +541,7 @@ ) -class obsstore(object): +class obsstore: """Store obsolete markers Markers can be accessed with two mappings: diff --git a/mercurial/obsutil.py b/mercurial/obsutil.py --- a/mercurial/obsutil.py +++ b/mercurial/obsutil.py @@ -56,7 +56,7 @@ usingsha256 = 2 -class marker(object): +class marker: """Wrap obsolete marker raw data""" def __init__(self, repo, data): diff --git a/mercurial/parser.py b/mercurial/parser.py --- a/mercurial/parser.py +++ b/mercurial/parser.py @@ -25,7 +25,7 @@ from .utils import stringutil -class parser(object): +class parser: def __init__(self, elements, methods=None): self._elements = elements self._methods = methods @@ -415,7 +415,7 @@ return inst.message -class alias(object): +class alias: """Parsed result of alias""" def __init__(self, name, args, err, replacement): @@ -429,7 +429,7 @@ self.warned = False -class basealiasrules(object): +class basealiasrules: """Parsing and expansion rule set of aliases This is a helper for fileset/revset/template aliases. A concrete rule set diff --git a/mercurial/patch.py b/mercurial/patch.py --- a/mercurial/patch.py +++ b/mercurial/patch.py @@ -149,7 +149,7 @@ def remainder(cur): yield chunk(cur) - class fiter(object): + class fiter: def __init__(self, fp): self.fp = fp @@ -342,7 +342,7 @@ return data -class patchmeta(object): +class patchmeta: """Patched file metadata 'op' is the performed operation within ADD, DELETE, RENAME, MODIFY @@ -435,7 +435,7 @@ return gitpatches -class linereader(object): +class linereader: # simple class to allow pushing lines back into the input stream def __init__(self, fp): self.fp = fp @@ -456,7 +456,7 @@ return iter(self.readline, b'') -class abstractbackend(object): +class abstractbackend: def __init__(self, ui): self.ui = ui @@ -592,7 +592,7 @@ return sorted(self.changed) -class filestore(object): +class filestore: def __init__(self, maxsize=None): self.opener = None self.files = {} @@ -681,7 +681,7 @@ eolmodes = [b'strict', b'crlf', b'lf', b'auto'] -class patchfile(object): +class patchfile: def __init__(self, ui, gp, backend, store, eolmode=b'strict'): self.fname = gp.path self.eolmode = eolmode @@ -914,7 +914,7 @@ return len(self.rej) -class header(object): +class header: """patch header""" diffgit_re = re.compile(b'diff --git a/(.*) b/(.*)$') @@ -994,7 +994,7 @@ ) -class recordhunk(object): +class recordhunk: """patch hunk XXX shouldn't we merge this with the other hunk class? @@ -1349,7 +1349,7 @@ ) -class hunk(object): +class hunk: def __init__(self, desc, num, lr, context): self.number = num self.desc = desc @@ -1577,7 +1577,7 @@ return old, oldstart, new, newstart -class binhunk(object): +class binhunk: """A binary patch file.""" def __init__(self, lr, fname): @@ -1758,7 +1758,7 @@ +9 """ - class parser(object): + class parser: """patch parsing state machine""" def __init__(self): diff --git a/mercurial/pathutil.py b/mercurial/pathutil.py --- a/mercurial/pathutil.py +++ b/mercurial/pathutil.py @@ -31,7 +31,7 @@ return encoding.hfsignoreclean(s.lower()) -class pathauditor(object): +class pathauditor: """ensure that a filesystem path contains no banned components. the following properties of a path are checked: @@ -314,7 +314,7 @@ yield b'' -class dirs(object): +class dirs: '''a multiset of directory names from a set of file paths''' def __init__(self, map, only_tracked=False): diff --git a/mercurial/phases.py b/mercurial/phases.py --- a/mercurial/phases.py +++ b/mercurial/phases.py @@ -343,7 +343,7 @@ data.insert(low + 1, (pycompat.xrange(rev, rev + 1), t)) -class phasecache(object): +class phasecache: def __init__(self, repo, phasedefaults, _load=True): # type: (localrepo.localrepository, Optional[Phasedefaults], bool) -> None if _load: @@ -879,7 +879,7 @@ return publicheads, draftroots -class remotephasessummary(object): +class remotephasessummary: """summarize phase information on the remote side :publishing: True is the remote is publishing diff --git a/mercurial/posix.py b/mercurial/posix.py --- a/mercurial/posix.py +++ b/mercurial/posix.py @@ -664,7 +664,7 @@ pass -class cachestat(object): +class cachestat: def __init__(self, path): self.stat = os.stat(path) diff --git a/mercurial/profiling.py b/mercurial/profiling.py --- a/mercurial/profiling.py +++ b/mercurial/profiling.py @@ -173,7 +173,7 @@ statprof.display(fp, data=data, format=displayformat, **kwargs) -class profile(object): +class profile: """Start profiling. Profiling is active when the context manager is active. When the context @@ -231,7 +231,7 @@ self._fp = open(path, b'wb') elif pycompat.iswindows: # parse escape sequence by win32print() - class uifp(object): + class uifp: def __init__(self, ui): self._ui = ui diff --git a/mercurial/progress.py b/mercurial/progress.py --- a/mercurial/progress.py +++ b/mercurial/progress.py @@ -84,7 +84,7 @@ raise -class progbar(object): +class progbar: def __init__(self, ui): self.ui = ui self._refreshlock = threading.Lock() diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py --- a/mercurial/pure/osutil.py +++ b/mercurial/pure/osutil.py @@ -220,7 +220,7 @@ err.errno, '%s: %s' % (encoding.strfromlocal(name), err.strerror) ) - class posixfile(object): + class posixfile: """a file object aiming for POSIX-like semantics CPython's open() returns a file that was opened *without* setting the diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -63,7 +63,7 @@ @attr.s(slots=True, init=False) -class DirstateItem(object): +class DirstateItem: """represent a dirstate entry It hold multiple attributes @@ -560,7 +560,7 @@ return int(q & 0xFFFF) -class BaseIndexObject(object): +class BaseIndexObject: # Can I be passed to an algorithme implemented in Rust ? rust_ext_compat = 0 # Format of an index entry according to Python's `struct` language diff --git a/mercurial/pvec.py b/mercurial/pvec.py --- a/mercurial/pvec.py +++ b/mercurial/pvec.py @@ -180,7 +180,7 @@ return pvec(util.b85encode(bs)) -class pvec(object): +class pvec: def __init__(self, hashorctx): if isinstance(hashorctx, bytes): self._bs = hashorctx diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -163,7 +163,7 @@ __bytes__() should be called if provided: - >>> class bytesable(object): + >>> class bytesable: ... def __bytes__(self): ... return b'bytes' >>> bytestr(bytesable()) diff --git a/mercurial/registrar.py b/mercurial/registrar.py --- a/mercurial/registrar.py +++ b/mercurial/registrar.py @@ -21,7 +21,7 @@ configitem = configitems.getitemregister -class _funcregistrarbase(object): +class _funcregistrarbase: """Base of decorator to register a function for specific purpose This decorator stores decorated functions into own dict 'table'. diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -379,7 +379,7 @@ return [c.node() for c in repo.set(b'roots(%ld)', tostrip)] -class stripcallback(object): +class stripcallback: """used as a transaction postclose callback""" def __init__(self, ui, repo, backup, topic): diff --git a/mercurial/repocache.py b/mercurial/repocache.py --- a/mercurial/repocache.py +++ b/mercurial/repocache.py @@ -19,7 +19,7 @@ ) -class repoloader(object): +class repoloader: """Load repositories in background thread This is designed for a forking server. A cached repo cannot be obtained diff --git a/mercurial/repoview.py b/mercurial/repoview.py --- a/mercurial/repoview.py +++ b/mercurial/repoview.py @@ -261,7 +261,7 @@ return cl -class filteredchangelogmixin(object): +class filteredchangelogmixin: def tiprev(self): """filtered version of revlog.tiprev""" for i in pycompat.xrange(len(self) - 1, -2, -1): @@ -361,7 +361,7 @@ return super(filteredchangelogmixin, self).flags(rev) -class repoview(object): +class repoview: """Provide a read/write view of a repo through a filtered changelog This object is used to access a filtered version of a repository without diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -171,7 +171,7 @@ @interfaceutil.implementer(repository.irevisiondelta) @attr.s(slots=True) -class revlogrevisiondelta(object): +class revlogrevisiondelta: node = attr.ib() p1node = attr.ib() p2node = attr.ib() @@ -187,7 +187,7 @@ @interfaceutil.implementer(repository.iverifyproblem) @attr.s(frozen=True) -class revlogproblem(object): +class revlogproblem: warning = attr.ib(default=None) error = attr.ib(default=None) node = attr.ib(default=None) @@ -237,7 +237,7 @@ ) -class revlog(object): +class revlog: """ the underlying revision storage object @@ -1042,7 +1042,7 @@ heads = [self.rev(n) for n in heads] # we want the ancestors, but inclusive - class lazyset(object): + class lazyset: def __init__(self, lazyvalues): self.addedvalues = set() self.lazyvalues = lazyvalues diff --git a/mercurial/revlogutils/__init__.py b/mercurial/revlogutils/__init__.py --- a/mercurial/revlogutils/__init__.py +++ b/mercurial/revlogutils/__init__.py @@ -62,7 +62,7 @@ @attr.s(slots=True, frozen=True) -class revisioninfo(object): +class revisioninfo: """Information about a revision that allows building its fulltext node: expected hash of the revision p1, p2: parent revs of the revision diff --git a/mercurial/revlogutils/deltas.py b/mercurial/revlogutils/deltas.py --- a/mercurial/revlogutils/deltas.py +++ b/mercurial/revlogutils/deltas.py @@ -38,7 +38,7 @@ LIMIT_DELTA2TEXT = 2 -class _testrevlog(object): +class _testrevlog: """minimalist fake revlog to use in doctests""" def __init__(self, data, density=0.5, mingap=0, snapshot=()): @@ -544,7 +544,7 @@ @attr.s(slots=True, frozen=True) -class _deltainfo(object): +class _deltainfo: distance = attr.ib() deltalen = attr.ib() data = attr.ib() @@ -927,7 +927,7 @@ yield (prev,) -class deltacomputer(object): +class deltacomputer: def __init__(self, revlog): self.revlog = revlog diff --git a/mercurial/revlogutils/docket.py b/mercurial/revlogutils/docket.py --- a/mercurial/revlogutils/docket.py +++ b/mercurial/revlogutils/docket.py @@ -99,7 +99,7 @@ S_OLD_UID = struct.Struct('>BL') -class RevlogDocket(object): +class RevlogDocket: """metadata associated with revlog""" def __init__( diff --git a/mercurial/revlogutils/nodemap.py b/mercurial/revlogutils/nodemap.py --- a/mercurial/revlogutils/nodemap.py +++ b/mercurial/revlogutils/nodemap.py @@ -113,7 +113,7 @@ tr.addfinalize(callback_id, lambda tr: persist_nodemap(tr, revlog)) -class _NoTransaction(object): +class _NoTransaction: """transaction like object to update the nodemap outside a transaction""" def __init__(self): @@ -304,7 +304,7 @@ S_HEADER = struct.Struct(">BQQQQ") -class NodeMapDocket(object): +class NodeMapDocket: """metadata associated with persistent nodemap data The persistent data may come from disk or be on their way to disk. diff --git a/mercurial/revlogutils/randomaccessfile.py b/mercurial/revlogutils/randomaccessfile.py --- a/mercurial/revlogutils/randomaccessfile.py +++ b/mercurial/revlogutils/randomaccessfile.py @@ -23,7 +23,7 @@ return (n & (n - 1) == 0) and n != 0 -class randomaccessfile(object): +class randomaccessfile: """Accessing arbitrary chuncks of data within a file, with some caching""" def __init__( diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -62,7 +62,7 @@ @attr.s(slots=True, repr=False) -class status(object): +class status: """Struct with a list of files per status. The 'deleted', 'unknown' and 'ignored' properties are only @@ -323,7 +323,7 @@ return abort, warn -class casecollisionauditor(object): +class casecollisionauditor: def __init__(self, ui, abort, dirstate): self._ui = ui self._abort = abort @@ -1019,7 +1019,7 @@ return origvfs.join(filepath) -class _containsnode(object): +class _containsnode: """proxy __contains__(node) to container.__contains__ which accepts revs""" def __init__(self, repo, revcontainer): @@ -1567,7 +1567,7 @@ fp.write(b"%s\n" % r) -class filecachesubentry(object): +class filecachesubentry: def __init__(self, path, stat): self.path = path self.cachestat = None @@ -1623,7 +1623,7 @@ raise -class filecacheentry(object): +class filecacheentry: def __init__(self, paths, stat=True): self._entries = [] for path in paths: @@ -1641,7 +1641,7 @@ entry.refresh() -class filecache(object): +class filecache: """A property like decorator that tracks files under .hg/ for updates. On first access, the files defined as arguments are stat()ed and the @@ -1798,7 +1798,7 @@ return data -class progress(object): +class progress: def __init__(self, ui, updatebar, topic, unit=b"", total=None): self.ui = ui self.pos = 0 @@ -1863,7 +1863,7 @@ return ui.configbool(b'format', b'generaldelta') -class simplekeyvaluefile(object): +class simplekeyvaluefile: """A simple file with key=value lines Keys must be alphanumerics and start with a letter, values must not diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -106,7 +106,7 @@ return set(sample[:desiredlen]) -class partialdiscovery(object): +class partialdiscovery: """an object representing ongoing discovery Feed with data from the remote repository, this object keep track of the diff --git a/mercurial/shelve.py b/mercurial/shelve.py --- a/mercurial/shelve.py +++ b/mercurial/shelve.py @@ -68,7 +68,7 @@ shelveuser = b'shelve@localhost' -class ShelfDir(object): +class ShelfDir: def __init__(self, repo, for_backups=False): if for_backups: self.vfs = vfsmod.vfs(repo.vfs.join(backupdir)) @@ -101,7 +101,7 @@ return sorted(info, reverse=True) -class Shelf(object): +class Shelf: """Represents a shelf, including possibly multiple files storing it. Old shelves will have a .patch and a .hg file. Newer shelves will @@ -213,7 +213,7 @@ self.vfs.tryunlink(self.name + b'.' + ext) -class shelvedstate(object): +class shelvedstate: """Handle persistence during unshelving operations. Handles saving and restoring a shelved state. Ensures that different diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py --- a/mercurial/simplemerge.py +++ b/mercurial/simplemerge.py @@ -62,7 +62,7 @@ return True -class Merge3Text(object): +class Merge3Text: """3-way merge of texts. Given strings BASE, OTHER, THIS, tries to produce a combined text @@ -468,7 +468,7 @@ return lines -class MergeInput(object): +class MergeInput: def __init__(self, fctx, label=None, label_detail=None): self.fctx = fctx self.label = label diff --git a/mercurial/smartset.py b/mercurial/smartset.py --- a/mercurial/smartset.py +++ b/mercurial/smartset.py @@ -20,7 +20,7 @@ return pycompat.sysbytes(type(o).__name__).lstrip(b'_') -class abstractsmartset(object): +class abstractsmartset: def __nonzero__(self): """True if the smartset is not empty""" raise NotImplementedError() diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py --- a/mercurial/sshpeer.py +++ b/mercurial/sshpeer.py @@ -47,7 +47,7 @@ display(_(b"remote: "), l, b'\n') -class doublepipe(object): +class doublepipe: """Operate a side-channel pipe in addition of a main one The side-channel pipe contains server output to be forwarded to the user diff --git a/mercurial/state.py b/mercurial/state.py --- a/mercurial/state.py +++ b/mercurial/state.py @@ -39,7 +39,7 @@ assert t -class cmdstate(object): +class cmdstate: """a wrapper class to store the state of commands like `rebase`, `graft`, `histedit`, `shelve` etc. Extensions can also use this to write state files. @@ -102,7 +102,7 @@ return self._repo.vfs.exists(self.fname) -class _statecheck(object): +class _statecheck: """a utility class that deals with multistep operations like graft, histedit, bisect, update etc and check whether such commands are in an unfinished conditition or not and return appropriate message diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py --- a/mercurial/statichttprepo.py +++ b/mercurial/statichttprepo.py @@ -34,7 +34,7 @@ urlreq = util.urlreq -class httprangereader(object): +class httprangereader: def __init__(self, url, opener): # we assume opener has HTTPRangeHandler self.url = url diff --git a/mercurial/statprof.py b/mercurial/statprof.py --- a/mercurial/statprof.py +++ b/mercurial/statprof.py @@ -154,7 +154,7 @@ ## Collection data structures -class ProfileState(object): +class ProfileState: def __init__(self, frequency=None): self.reset(frequency) self.track = b'cpu' @@ -202,7 +202,7 @@ state = ProfileState() -class CodeSite(object): +class CodeSite: cache = {} __slots__ = ('path', 'lineno', 'function', 'source') @@ -260,7 +260,7 @@ return '%s:%s' % (self.filename(), self.function) -class Sample(object): +class Sample: __slots__ = ('stack', 'time') def __init__(self, stack, time): @@ -434,7 +434,7 @@ ## Reporting API -class SiteStats(object): +class SiteStats: def __init__(self, site): self.site = site self.selfcount = 0 @@ -708,7 +708,7 @@ def display_hotpath(data, fp, limit=0.05, **kwargs): - class HotNode(object): + class HotNode: def __init__(self, site): self.site = site self.count = 0 diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -455,7 +455,7 @@ FILETYPE_OTHER = FILEFLAGS_OTHER -class basicstore(object): +class basicstore: '''base class for local repository stores''' def __init__(self, path, vfstype): @@ -601,7 +601,7 @@ return [b'requires', b'00changelog.i'] + [b'store/' + f for f in _data] -class fncache(object): +class fncache: # the filename used to be partially encoded # hence the encodedir/decodedir dance def __init__(self, vfs): diff --git a/mercurial/streamclone.py b/mercurial/streamclone.py --- a/mercurial/streamclone.py +++ b/mercurial/streamclone.py @@ -516,7 +516,7 @@ nodemap.post_stream_cleanup(repo) -class streamcloneapplier(object): +class streamcloneapplier: """Class to manage applying streaming clone bundles. We need to wrap ``applybundlev1()`` in a dedicated type to enable bundle diff --git a/mercurial/subrepo.py b/mercurial/subrepo.py --- a/mercurial/subrepo.py +++ b/mercurial/subrepo.py @@ -220,7 +220,7 @@ # subrepo classes need to implement the following abstract class: -class abstractsubrepo(object): +class abstractsubrepo: def __init__(self, ctx, path): """Initialize abstractsubrepo part diff --git a/mercurial/tags.py b/mercurial/tags.py --- a/mercurial/tags.py +++ b/mercurial/tags.py @@ -684,7 +684,7 @@ _fnodesmissingrec = b'\xff' * 24 -class hgtagsfnodescache(object): +class hgtagsfnodescache: """Persistent cache mapping revisions to .hgtags filenodes. The cache is an array of records. Each item in the array corresponds to diff --git a/mercurial/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -626,7 +626,7 @@ return s[1:-1] -class resourcemapper(object): # pytype: disable=ignored-metaclass +class resourcemapper: # pytype: disable=ignored-metaclass """Mapper of internal template resources""" __metaclass__ = abc.ABCMeta @@ -663,7 +663,7 @@ return {} -class engine(object): +class engine: """template expansion engine. template expansion works like this. a map file contains key=value @@ -919,7 +919,7 @@ return cache, tmap, aliases -class loader(object): +class loader: """Load template fragments optionally from a map file""" def __init__(self, cache, aliases): @@ -994,7 +994,7 @@ return syms -class templater(object): +class templater: def __init__( self, filters=None, diff --git a/mercurial/templateutil.py b/mercurial/templateutil.py --- a/mercurial/templateutil.py +++ b/mercurial/templateutil.py @@ -31,7 +31,7 @@ pass -class wrapped(object): # pytype: disable=ignored-metaclass +class wrapped: # pytype: disable=ignored-metaclass """Object requiring extra conversion prior to displaying or processing as value @@ -108,7 +108,7 @@ """ -class mappable(object): # pytype: disable=ignored-metaclass +class mappable: # pytype: disable=ignored-metaclass """Object which can be converted to a single template mapping""" __metaclass__ = abc.ABCMeta diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -169,7 +169,7 @@ return pycompat.rapply(pycompat.bytesurl, maybestr) -class httppasswordmgrdbproxy(object): +class httppasswordmgrdbproxy: """Delays loading urllib2 until it's needed.""" def __init__(self): @@ -207,7 +207,7 @@ _reqexithandlers = [] -class ui(object): +class ui: def __init__(self, src=None): """Create a fresh new ui object if no src given diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py --- a/mercurial/unionrepo.py +++ b/mercurial/unionrepo.py @@ -209,7 +209,7 @@ return False -class unionrepository(object): +class unionrepository: """Represents the union of data in 2 repositories. Instances are not usable if constructed directly. Use ``instance()`` diff --git a/mercurial/upgrade_utils/actions.py b/mercurial/upgrade_utils/actions.py --- a/mercurial/upgrade_utils/actions.py +++ b/mercurial/upgrade_utils/actions.py @@ -45,7 +45,7 @@ OPTIMISATION = b'optimization' -class improvement(object): +class improvement: """Represents an improvement that can be made as part of an upgrade.""" ### The following attributes should be defined for each subclass: @@ -684,7 +684,7 @@ return newactions -class UpgradeOperation(object): +class UpgradeOperation: """represent the work to be done during an upgrade""" def __init__( diff --git a/mercurial/url.py b/mercurial/url.py --- a/mercurial/url.py +++ b/mercurial/url.py @@ -50,7 +50,7 @@ return s -class passwordmgr(object): +class passwordmgr: def __init__(self, ui, passwddb): self.ui = ui self.passwddb = passwddb diff --git a/mercurial/urllibcompat.py b/mercurial/urllibcompat.py --- a/mercurial/urllibcompat.py +++ b/mercurial/urllibcompat.py @@ -17,7 +17,7 @@ _sysstr = pycompat.sysstr -class _pycompatstub(object): +class _pycompatstub: def __init__(self): self._aliases = {} diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -231,7 +231,7 @@ assert k in DIGESTS -class digester(object): +class digester: """helper to compute digests. This helper can be used to compute one or more digests given their name. @@ -279,7 +279,7 @@ return None -class digestchecker(object): +class digestchecker: """file handle wrapper that additionally checks content against a given size and digests. @@ -329,7 +329,7 @@ _chunksize = 4096 -class bufferedinputpipe(object): +class bufferedinputpipe: """a manually buffered input pipe Python will not let us use buffered IO and lazy reading with 'polling' at @@ -457,7 +457,7 @@ raise -class fileobjectproxy(object): +class fileobjectproxy: """A proxy around file objects that tells a watcher when events occur. This type is intended to only be used for testing purposes. Think hard @@ -693,7 +693,7 @@ } -class socketproxy(object): +class socketproxy: """A proxy around a socket that tells a watcher when events occur. This is like ``fileobjectproxy`` except for sockets. @@ -816,7 +816,7 @@ ) -class baseproxyobserver(object): +class baseproxyobserver: def __init__(self, fh, name, logdata, logdataapis): self.fh = fh self.name = name @@ -1256,7 +1256,7 @@ return f -class cow(object): +class cow: """helper class to make copy-on-write easier Call preparewrite before doing any writes. @@ -1349,7 +1349,7 @@ """ -class transactional(object): # pytype: disable=ignored-metaclass +class transactional: # pytype: disable=ignored-metaclass """Base class for making a transactional type into a context manager.""" __metaclass__ = abc.ABCMeta @@ -1400,7 +1400,7 @@ yield enter_result -class _lrucachenode(object): +class _lrucachenode: """A node in a doubly linked list. Holds a reference to nodes on either side as well as a key-value @@ -1424,7 +1424,7 @@ self.cost = 0 -class lrucachedict(object): +class lrucachedict: """Dict that caches most recent accesses and sets. The dict consists of an actual backing dict - indexed by original @@ -1755,7 +1755,7 @@ return f -class propertycache(object): +class propertycache: def __init__(self, func): self.func = func self.name = func.__name__ @@ -2214,7 +2214,7 @@ _re2 = False -class _re(object): +class _re: def _checkre2(self): global _re2 global _re2_input @@ -2416,7 +2416,7 @@ return temp -class filestat(object): +class filestat: """help to exactly detect change of a file 'stat' attribute is result of 'os.stat()' if specified 'path' @@ -2522,7 +2522,7 @@ return not self == other -class atomictempfile(object): +class atomictempfile: """writable file object that atomically updates a file All writes will go to a temporary copy of the original file. Call @@ -2665,7 +2665,7 @@ fp.write(text) -class chunkbuffer(object): +class chunkbuffer: """Allow arbitrary sized chunks of data to be efficiently read from an iterator over chunks of arbitrary size.""" @@ -2770,7 +2770,7 @@ yield s -class cappedreader(object): +class cappedreader: """A file object proxy that allows reading up to N bytes. Given a source file object, instances of this type allow reading up to @@ -2858,7 +2858,7 @@ ) -class transformingwriter(object): +class transformingwriter: """Writable file wrapper to transform data by function""" def __init__(self, fp, encode): @@ -2966,7 +2966,7 @@ @attr.s -class timedcmstats(object): +class timedcmstats: """Stats information produced by the timedcm context manager on entering.""" # the starting value of the timer as a float (meaning and resulution is @@ -3067,7 +3067,7 @@ raise error.ParseError(_(b"couldn't parse size: %s") % s) -class hooks(object): +class hooks: """A collection of hook functions that can be used to extend a function's behavior. Hooks are called in lexicographic order, based on the names of their sources.""" diff --git a/mercurial/utils/cborutil.py b/mercurial/utils/cborutil.py --- a/mercurial/utils/cborutil.py +++ b/mercurial/utils/cborutil.py @@ -483,7 +483,7 @@ return self -class sansiodecoder(object): +class sansiodecoder: """A CBOR decoder that doesn't perform its own I/O. To use, construct an instance and feed it segments containing @@ -976,7 +976,7 @@ return l -class bufferingdecoder(object): +class bufferingdecoder: """A CBOR decoder that buffers undecoded input. This is a glorified wrapper around ``sansiodecoder`` that adds a buffering diff --git a/mercurial/utils/compression.py b/mercurial/utils/compression.py --- a/mercurial/utils/compression.py +++ b/mercurial/utils/compression.py @@ -32,7 +32,7 @@ ) -class propertycache(object): +class propertycache: def __init__(self, func): self.func = func self.name = func.__name__ @@ -47,7 +47,7 @@ obj.__dict__[self.name] = value -class compressormanager(object): +class compressormanager: """Holds registrations of various compression engines. This class essentially abstracts the differences between compression @@ -219,7 +219,7 @@ compengines = compressormanager() -class compressionengine(object): +class compressionengine: """Base class for compression engines. Compression engines must implement the interface defined by this class. @@ -338,7 +338,7 @@ raise NotImplementedError() -class _CompressedStreamReader(object): +class _CompressedStreamReader: def __init__(self, fh): if safehasattr(fh, 'unbufferedread'): self._reader = fh.unbufferedread @@ -482,7 +482,7 @@ def decompressorreader(self, fh): return _GzipCompressedStreamReader(fh) - class zlibrevlogcompressor(object): + class zlibrevlogcompressor: def __init__(self, level=None): self._level = level @@ -626,7 +626,7 @@ def decompressorreader(self, fh): return fh - class nooprevlogcompressor(object): + class nooprevlogcompressor: def compress(self, data): return None @@ -698,7 +698,7 @@ def decompressorreader(self, fh): return _ZstdCompressedStreamReader(fh, self._module) - class zstdrevlogcompressor(object): + class zstdrevlogcompressor: def __init__(self, zstd, level=3): # TODO consider omitting frame magic to save 4 bytes. # This writes content sizes into the frame header. That is @@ -782,7 +782,7 @@ # We need to format the docstring. So use a dummy object/type to hold it # rather than mutating the original. - class docobject(object): + class docobject: pass for name in compengines: diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -59,7 +59,7 @@ raise IOError(errno.EBADF, 'Bad file descriptor') -class LineBufferedWrapper(object): +class LineBufferedWrapper: def __init__(self, orig): self.orig = orig @@ -98,7 +98,7 @@ return stream -class WriteAllWrapper(object): +class WriteAllWrapper: def __init__(self, orig): self.orig = orig @@ -193,7 +193,7 @@ return _(b"killed by signal %d") % -code -class _pfile(object): +class _pfile: """File-like wrapper for a stream opened by subprocess.Popen()""" def __init__(self, proc, fp): diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -496,7 +496,7 @@ @attr.s(hash=True) -class mailmapping(object): +class mailmapping: """Represents a username/email key or value in a mailmap file""" diff --git a/mercurial/utils/urlutil.py b/mercurial/utils/urlutil.py --- a/mercurial/utils/urlutil.py +++ b/mercurial/utils/urlutil.py @@ -54,7 +54,7 @@ ) -class url(object): +class url: r"""Reliable URL parser. This parses URLs and provides attributes for the following @@ -832,7 +832,7 @@ return new_paths -class path(object): +class path: """Represents an individual path and its configuration.""" def __init__( diff --git a/mercurial/verify.py b/mercurial/verify.py --- a/mercurial/verify.py +++ b/mercurial/verify.py @@ -54,7 +54,7 @@ ) -class verifier(object): +class verifier: def __init__(self, repo, level=None): self.repo = repo.unfiltered() self.ui = repo.ui diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -46,7 +46,7 @@ checkandavoid() -class abstractvfs(object): +class abstractvfs: """Abstract base class; cannot be instantiated""" # default directory separator for vfs @@ -606,7 +606,7 @@ return self.vfs.join(path, *insidef) -class closewrapbase(object): +class closewrapbase: """Base class of wrapper, which hooks closing Do not instantiate outside of the vfs layer. @@ -652,7 +652,7 @@ self._closer.close(self._origfh) -class backgroundfilecloser(object): +class backgroundfilecloser: """Coordinates background closing of file handles on multiple threads.""" def __init__(self, ui, expectedcount=-1): diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -53,7 +53,7 @@ umask = 0o022 -class mixedfilemodewrapper(object): +class mixedfilemodewrapper: """Wraps a file handle when it is opened in read/write mode. fopen() and fdopen() on Windows have a specific-to-Windows requirement @@ -130,7 +130,7 @@ return self._fp.readlines(*args, **kwargs) -class fdproxy(object): +class fdproxy: """Wraps osutil.posixfile() to override the name attribute to reflect the underlying file name. """ @@ -214,7 +214,7 @@ return encoding.unitolocal(pw) -class winstdout(object): +class winstdout: """Some files on Windows misbehave. When writing to a broken pipe, EINVAL instead of EPIPE may be raised. @@ -658,7 +658,7 @@ return False -class cachestat(object): +class cachestat: def __init__(self, path): pass diff --git a/mercurial/wireprotoframing.py b/mercurial/wireprotoframing.py --- a/mercurial/wireprotoframing.py +++ b/mercurial/wireprotoframing.py @@ -134,7 +134,7 @@ @attr.s(slots=True) -class frameheader(object): +class frameheader: """Represents the data in a frame header.""" length = attr.ib() @@ -146,7 +146,7 @@ @attr.s(slots=True, repr=False) -class frame(object): +class frame: """Represents a parsed frame.""" requestid = attr.ib() @@ -589,7 +589,7 @@ ) -class bufferingcommandresponseemitter(object): +class bufferingcommandresponseemitter: """Helper object to emit command response frames intelligently. Raw command response data is likely emitted in chunks much smaller @@ -699,7 +699,7 @@ # mechanism. -class identityencoder(object): +class identityencoder: """Encoder for the "identity" stream encoding profile.""" def __init__(self, ui): @@ -715,7 +715,7 @@ return b'' -class identitydecoder(object): +class identitydecoder: """Decoder for the "identity" stream encoding profile.""" def __init__(self, ui, extraobjs): @@ -728,7 +728,7 @@ return data -class zlibencoder(object): +class zlibencoder: def __init__(self, ui): import zlib @@ -749,7 +749,7 @@ return res -class zlibdecoder(object): +class zlibdecoder: def __init__(self, ui, extraobjs): import zlib @@ -764,7 +764,7 @@ return self._decompressor.decompress(data) -class zstdbaseencoder(object): +class zstdbaseencoder: def __init__(self, level): from . import zstd @@ -792,7 +792,7 @@ super(zstd8mbencoder, self).__init__(3) -class zstdbasedecoder(object): +class zstdbasedecoder: def __init__(self, maxwindowsize): from . import zstd @@ -842,7 +842,7 @@ STREAM_ENCODERS_ORDER.append(b'identity') -class stream(object): +class stream: """Represents a logical unidirectional series of frames.""" def __init__(self, streamid, active=False): @@ -995,7 +995,7 @@ } -class serverreactor(object): +class serverreactor: """Holds state of a server handling frame-based protocol requests. This class is the "brain" of the unified frame-based protocol server @@ -1683,7 +1683,7 @@ return self._makeerrorresult(_(b'server already errored')) -class commandrequest(object): +class commandrequest: """Represents a request to run a command.""" def __init__(self, requestid, name, args, datafh=None, redirect=None): @@ -1695,7 +1695,7 @@ self.state = b'pending' -class clientreactor(object): +class clientreactor: """Holds state of a client issuing frame-based protocol requests. This is like ``serverreactor`` but for client-side state. diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py --- a/mercurial/wireprotoserver.py +++ b/mercurial/wireprotoserver.py @@ -56,7 +56,7 @@ @interfaceutil.implementer(wireprototypes.baseprotocolhandler) -class httpv1protocolhandler(object): +class httpv1protocolhandler: def __init__(self, req, ui, checkperm): self._req = req self._ui = ui @@ -374,7 +374,7 @@ @interfaceutil.implementer(wireprototypes.baseprotocolhandler) -class sshv1protocolhandler(object): +class sshv1protocolhandler: """Handler for requests services via version 1 of SSH protocol.""" def __init__(self, ui, fin, fout): @@ -520,7 +520,7 @@ ) -class sshserver(object): +class sshserver: def __init__(self, ui, repo, logfh=None): self._ui = ui self._repo = repo diff --git a/mercurial/wireprototypes.py b/mercurial/wireprototypes.py --- a/mercurial/wireprototypes.py +++ b/mercurial/wireprototypes.py @@ -39,14 +39,14 @@ } -class bytesresponse(object): +class bytesresponse: """A wire protocol response consisting of raw bytes.""" def __init__(self, data): self.data = data -class ooberror(object): +class ooberror: """wireproto reply: failure of a batch of operation Something failed during a batch call. The error message is stored in @@ -57,7 +57,7 @@ self.message = message -class pushres(object): +class pushres: """wireproto reply: success with simple integer return The call was successful and returned an integer contained in `self.res`. @@ -68,7 +68,7 @@ self.output = output -class pusherr(object): +class pusherr: """wireproto reply: failure The call failed. The `self.res` attribute contains the error message. @@ -79,7 +79,7 @@ self.output = output -class streamres(object): +class streamres: """wireproto reply: binary stream The call was successful and the result is a stream. @@ -96,7 +96,7 @@ self.prefer_uncompressed = prefer_uncompressed -class streamreslegacy(object): +class streamreslegacy: """wireproto reply: uncompressed binary stream The call was successful and the result is a stream. @@ -243,7 +243,7 @@ """ -class commandentry(object): +class commandentry: """Represents a declared wire protocol command.""" def __init__( @@ -406,7 +406,7 @@ @attr.s -class encodedresponse(object): +class encodedresponse: """Represents response data that is already content encoded. Wire protocol version 2 only. @@ -420,7 +420,7 @@ @attr.s -class alternatelocationresponse(object): +class alternatelocationresponse: """Represents a response available at an alternate location. Instances are sent in place of actual response objects when the server @@ -439,7 +439,7 @@ @attr.s -class indefinitebytestringresponse(object): +class indefinitebytestringresponse: """Represents an object to be encoded to an indefinite length bytestring. Instances are initialized from an iterable of chunks, with each chunk being diff --git a/mercurial/wireprotov1peer.py b/mercurial/wireprotov1peer.py --- a/mercurial/wireprotov1peer.py +++ b/mercurial/wireprotov1peer.py @@ -109,7 +109,7 @@ @interfaceutil.implementer(repository.ipeercommandexecutor) -class peerexecutor(object): +class peerexecutor: def __init__(self, peer): self._peer = peer self._sent = False diff --git a/mercurial/worker.py b/mercurial/worker.py --- a/mercurial/worker.py +++ b/mercurial/worker.py @@ -68,7 +68,7 @@ return threading.current_thread() == threading.main_thread() -class _blockingreader(object): +class _blockingreader: def __init__(self, wrapped): self._wrapped = wrapped diff --git a/setup.py b/setup.py --- a/setup.py +++ b/setup.py @@ -213,7 +213,7 @@ return p.returncode, out, err -class hgcommand(object): +class hgcommand: def __init__(self, cmd, env): self.cmd = cmd self.env = env @@ -1528,7 +1528,7 @@ # the cygwinccompiler package is not available on some Python # distributions like the ones from the optware project for Synology # DiskStation boxes - class HackedMingw32CCompiler(object): + class HackedMingw32CCompiler: pass diff --git a/tests/drawdag.py b/tests/drawdag.py --- a/tests/drawdag.py +++ b/tests/drawdag.py @@ -265,7 +265,7 @@ return dict(edges) -class simplefilectx(object): +class simplefilectx: def __init__(self, path, data): self._data = data self._path = path diff --git a/tests/dumbhttp.py b/tests/dumbhttp.py --- a/tests/dumbhttp.py +++ b/tests/dumbhttp.py @@ -37,7 +37,7 @@ sys.stderr.flush() -class simplehttpservice(object): +class simplehttpservice: def __init__(self, host, port): self.address = (host, port) diff --git a/tests/httpserverauth.py b/tests/httpserverauth.py --- a/tests/httpserverauth.py +++ b/tests/httpserverauth.py @@ -16,7 +16,7 @@ return parsed -class digestauthserver(object): +class digestauthserver: def __init__(self): self._user_hashes = {} diff --git a/tests/mocktime.py b/tests/mocktime.py --- a/tests/mocktime.py +++ b/tests/mocktime.py @@ -2,7 +2,7 @@ import time -class mocktime(object): +class mocktime: def __init__(self, increment): self.time = 0 self.increment = [float(s) for s in increment.split()] diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -171,7 +171,7 @@ # Windows lacks os.environb, for instance. A proxy over the real thing # instead of a copy allows the environment to be updated via bytes on # all platforms. - class environbytes(object): + class environbytes: def __init__(self, strenv): self.__len__ = strenv.__len__ self.clear = strenv.clear @@ -2983,7 +2983,7 @@ testdescs.sort(key=sortkey) -class TestRunner(object): +class TestRunner: """Holds context for executing tests. Tests rely on a lot of state. This object holds it for them. diff --git a/tests/simplestorerepo.py b/tests/simplestorerepo.py --- a/tests/simplestorerepo.py +++ b/tests/simplestorerepo.py @@ -70,7 +70,7 @@ @interfaceutil.implementer(repository.irevisiondelta) @attr.s(slots=True) -class simplestorerevisiondelta(object): +class simplestorerevisiondelta: node = attr.ib() p1node = attr.ib() p2node = attr.ib() @@ -84,14 +84,14 @@ @interfaceutil.implementer(repository.iverifyproblem) @attr.s(frozen=True) -class simplefilestoreproblem(object): +class simplefilestoreproblem: warning = attr.ib(default=None) error = attr.ib(default=None) node = attr.ib(default=None) @interfaceutil.implementer(repository.ifilestorage) -class filestorage(object): +class filestorage: """Implements storage for a tracked path. Data is stored in the VFS in a directory corresponding to the tracked diff --git a/tests/test-absorb-filefixupstate.py b/tests/test-absorb-filefixupstate.py --- a/tests/test-absorb-filefixupstate.py +++ b/tests/test-absorb-filefixupstate.py @@ -3,7 +3,7 @@ from hgext import absorb -class simplefctx(object): +class simplefctx: def __init__(self, content): self.content = content diff --git a/tests/test-ancestor.py b/tests/test-ancestor.py --- a/tests/test-ancestor.py +++ b/tests/test-ancestor.py @@ -62,7 +62,7 @@ return ancs -class naiveincrementalmissingancestors(object): +class naiveincrementalmissingancestors: def __init__(self, ancs, bases): self.ancs = ancs self.bases = set(bases) diff --git a/tests/test-batching.py b/tests/test-batching.py --- a/tests/test-batching.py +++ b/tests/test-batching.py @@ -20,7 +20,7 @@ # equivalent of repo.repository -class thing(object): +class thing: def hello(self): return b"Ready." @@ -107,7 +107,7 @@ # server side # equivalent of wireproto's global functions -class server(object): +class server: def __init__(self, local): self.local = local diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py --- a/tests/test-check-interfaces.py +++ b/tests/test-check-interfaces.py @@ -80,7 +80,7 @@ # Facilitates testing localpeer. -class dummyrepo(object): +class dummyrepo: def __init__(self): self.ui = uimod.ui() self._wanted_sidedata = set() @@ -92,7 +92,7 @@ pass -class dummyopener(object): +class dummyopener: handlers = [] @@ -108,7 +108,7 @@ pass -class dummypipe(object): +class dummypipe: def close(self): pass diff --git a/tests/test-extensions-wrapfunction.py b/tests/test-extensions-wrapfunction.py --- a/tests/test-extensions-wrapfunction.py +++ b/tests/test-extensions-wrapfunction.py @@ -16,7 +16,7 @@ wrappers = [genwrapper(i) for i in range(5)] -class dummyclass(object): +class dummyclass: def getstack(self): return ['orig'] @@ -67,7 +67,7 @@ print('context manager', dummy.getstack()) # Wrap callable object which has no __name__ -class callableobj(object): +class callableobj: def __call__(self): return ['orig'] diff --git a/tests/test-fastannotate-revmap.py b/tests/test-fastannotate-revmap.py --- a/tests/test-fastannotate-revmap.py +++ b/tests/test-fastannotate-revmap.py @@ -169,7 +169,7 @@ os.unlink(path2) -class fakefctx(object): +class fakefctx: def __init__(self, node, path=None): self._node = node self._path = path diff --git a/tests/test-filecache.py b/tests/test-filecache.py --- a/tests/test-filecache.py +++ b/tests/test-filecache.py @@ -35,11 +35,11 @@ xrange = range -class fakerepo(object): +class fakerepo: def __init__(self): self._filecache = {} - class fakevfs(object): + class fakevfs: def join(self, p): return p diff --git a/tests/test-hashutil.py b/tests/test-hashutil.py --- a/tests/test-hashutil.py +++ b/tests/test-hashutil.py @@ -12,7 +12,7 @@ sha1dc = None -class hashertestsbase(object): +class hashertestsbase: def test_basic_hash(self): h = self.hasher() h.update(b'foo') diff --git a/tests/test-lock.py b/tests/test-lock.py --- a/tests/test-lock.py +++ b/tests/test-lock.py @@ -35,7 +35,7 @@ return super(lockwrapper, self)._getpid() + self._pidoffset -class teststate(object): +class teststate: def __init__(self, testcase, dir, pidoffset=0): self._testcase = testcase self._acquirecalled = False diff --git a/tests/test-manifest.py b/tests/test-manifest.py --- a/tests/test-manifest.py +++ b/tests/test-manifest.py @@ -74,7 +74,7 @@ ) -class basemanifesttests(object): +class basemanifesttests: def parsemanifest(self, text): raise NotImplementedError('parsemanifest not implemented by test case') diff --git a/tests/test-remotefilelog-datapack.py b/tests/test-remotefilelog-datapack.py --- a/tests/test-remotefilelog-datapack.py +++ b/tests/test-remotefilelog-datapack.py @@ -35,7 +35,7 @@ ) -class datapacktestsbase(object): +class datapacktestsbase: def __init__(self, datapackreader, paramsavailable): self.datapackreader = datapackreader self.paramsavailable = paramsavailable diff --git a/tests/test-revlog-raw.py b/tests/test-revlog-raw.py --- a/tests/test-revlog-raw.py +++ b/tests/test-revlog-raw.py @@ -19,7 +19,7 @@ ) -class _NoTransaction(object): +class _NoTransaction: """transaction like object to update the nodemap outside a transaction""" def __init__(self): @@ -150,7 +150,7 @@ code path, which is not covered by "appendrev" alone. """ - class dummychangegroup(object): + class dummychangegroup: @staticmethod def deltachunk(pnode): pnode = pnode or rlog.nullid diff --git a/tests/test-rust-discovery.py b/tests/test-rust-discovery.py --- a/tests/test-rust-discovery.py +++ b/tests/test-rust-discovery.py @@ -31,12 +31,12 @@ ) -class fakechangelog(object): +class fakechangelog: def __init__(self, idx): self.index = idx -class fakerepo(object): +class fakerepo: def __init__(self, idx): """Just make so that self.changelog.index is the given idx.""" self.changelog = fakechangelog(idx) diff --git a/tests/test-simplekeyvaluefile.py b/tests/test-simplekeyvaluefile.py --- a/tests/test-simplekeyvaluefile.py +++ b/tests/test-simplekeyvaluefile.py @@ -7,7 +7,7 @@ ) -class mockfile(object): +class mockfile: def __init__(self, name, fs): self.name = name self.fs = fs @@ -25,7 +25,7 @@ return self.fs.contents[self.name] -class mockvfs(object): +class mockvfs: def __init__(self): self.contents = {} diff --git a/tests/test-sshserver.py b/tests/test-sshserver.py --- a/tests/test-sshserver.py +++ b/tests/test-sshserver.py @@ -38,12 +38,12 @@ return wireprotoserver.sshserver(ui, repo) -class mockrepo(object): +class mockrepo: def __init__(self, ui): self.ui = ui -class mockui(object): +class mockui: def __init__(self, inbytes): self.fin = io.BytesIO(inbytes) self.fout = io.BytesIO() diff --git a/tests/test-wireproto.py b/tests/test-wireproto.py --- a/tests/test-wireproto.py +++ b/tests/test-wireproto.py @@ -14,7 +14,7 @@ stringio = util.stringio -class proto(object): +class proto: def __init__(self, args): self.args = args self.name = 'dummyproto' @@ -76,7 +76,7 @@ return {b'name': mangle(name)}, unmangle -class serverrepo(object): +class serverrepo: def __init__(self, ui): self.ui = ui diff --git a/tests/testlib/badserverext.py b/tests/testlib/badserverext.py --- a/tests/testlib/badserverext.py +++ b/tests/testlib/badserverext.py @@ -90,7 +90,7 @@ ) -class ConditionTracker(object): +class ConditionTracker: def __init__( self, close_after_recv_bytes, @@ -256,7 +256,7 @@ # We can't adjust __class__ on a socket instance. So we define a proxy type. -class socketproxy(object): +class socketproxy: __slots__ = ('_orig', '_logfp', '_cond') def __init__(self, obj, logfp, condition_tracked): @@ -300,7 +300,7 @@ # We can't adjust __class__ on socket._fileobject, so define a proxy. -class fileobjectproxy(object): +class fileobjectproxy: __slots__ = ('_orig', '_logfp', '_cond') def __init__(self, obj, logfp, condition_tracked):