From fa8edf03828238cfa91883fed7e8c76958e5e24c Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Tue, 1 Mar 2022 22:50:29 +0000 Subject: [PATCH] CLN: Remove object parent class, only needed in py2 --- asv/benchmark.py | 6 +++--- asv/build_cache.py | 2 +- asv/commands/__init__.py | 2 +- asv/console.py | 2 +- asv/environment.py | 2 +- asv/extern/asizeof.py | 16 ++++++++-------- asv/feed.py | 2 +- asv/graph.py | 4 ++-- asv/machine.py | 4 ++-- asv/plugin_manager.py | 2 +- asv/plugins/regressions.py | 2 +- asv/profiling.py | 2 +- asv/publishing.py | 2 +- asv/repo.py | 2 +- asv/results.py | 2 +- asv/runner.py | 2 +- asv/statistics.py | 2 +- asv/step_detect.py | 2 +- asv/util.py | 2 +- docs/source/benchmarks.rst | 2 +- test/benchmark/params_examples.py | 4 ++-- test/benchmark/time_examples.py | 6 +++--- test/benchmark/timeraw_examples.py | 2 +- test/test_runner.py | 4 ++-- test/tools.py | 4 ++-- 25 files changed, 41 insertions(+), 41 deletions(-) diff --git a/asv/benchmark.py b/asv/benchmark.py index 5f4a7ec33..57d0fb2e6 100644 --- a/asv/benchmark.py +++ b/asv/benchmark.py @@ -420,7 +420,7 @@ def _repr_no_address(obj): return result -class Benchmark(object): +class Benchmark: """ Represents a single benchmark. """ @@ -737,7 +737,7 @@ def too_slow(num_samples): return samples, number -class _SeparateProcessTimer(object): +class _SeparateProcessTimer: subprocess_tmpl = textwrap.dedent(''' from __future__ import print_function from timeit import timeit, default_timer as timer @@ -862,7 +862,7 @@ def run(self, *param): ] -class SpecificImporter(object): +class SpecificImporter: """ Module importer that only allows loading a given module from the given path. diff --git a/asv/build_cache.py b/asv/build_cache.py index 1fd5db600..9ca89b245 100644 --- a/asv/build_cache.py +++ b/asv/build_cache.py @@ -5,7 +5,7 @@ from . import util -class BuildCache(object): +class BuildCache: """ Build cache diff --git a/asv/commands/__init__.py b/asv/commands/__init__.py index 6e3e2c7c1..02f51317a 100644 --- a/asv/commands/__init__.py +++ b/asv/commands/__init__.py @@ -27,7 +27,7 @@ ] -class Command(object): +class Command: @classmethod def setup_arguments(cls, subparsers): # TODO: Document me diff --git a/asv/console.py b/asv/console.py index 2e100eb85..ae5c5ab4e 100644 --- a/asv/console.py +++ b/asv/console.py @@ -193,7 +193,7 @@ def truncate_left(s, l): return s -class Log(object): +class Log: def __init__(self): self._indent = 1 self._total = 0 diff --git a/asv/environment.py b/asv/environment.py index 5626f2075..30d74fa12 100644 --- a/asv/environment.py +++ b/asv/environment.py @@ -454,7 +454,7 @@ class EnvironmentUnavailable(BaseException): pass -class Environment(object): +class Environment: """ Manage a single environment -- a combination of a particular version of Python and a set of dependencies for the benchmarked diff --git a/asv/extern/asizeof.py b/asv/extern/asizeof.py index 74251a0ca..f9792fba8 100644 --- a/asv/extern/asizeof.py +++ b/asv/extern/asizeof.py @@ -1004,7 +1004,7 @@ def _len_unicode(obj): _new_style = '' # no marker -class _Claskey(object): +class _Claskey: '''Wrapper for class objects. ''' __slots__ = ('_obj', '_sty') @@ -1053,7 +1053,7 @@ def _claskey(obj, style): _Types_ClassType = Types.ClassType _Types_InstanceType = Types.InstanceType - class _Instkey(object): + class _Instkey: '''Wrapper for old-style class (instances). ''' __slots__ = ('_obj',) @@ -1120,7 +1120,7 @@ def _objkey(obj): # PYCHOK expected return k -class _NamedRef(object): +class _NamedRef: '''Store referred object along with the name of the referent. ''' @@ -1151,7 +1151,7 @@ def __init__(self, name, ref): _Not_vari = '' # non-variable item size -class _Typedef(object): +class _Typedef: '''Type definition class. ''' __slots__ = { @@ -1736,7 +1736,7 @@ def _typedef(obj, derive=False, frames=False, infer=False): # MCCABE 25 return v -class _Prof(object): +class _Prof: '''Internal type profile class. ''' high = 0 # largest size @@ -1789,7 +1789,7 @@ def update(self, obj, size): self.objref, self.weak = obj, False -class _Rank(object): +class _Rank: '''Internal largest object class. ''' __slots__ = { @@ -1841,7 +1841,7 @@ def again(self, key): # Public classes -class Asized(object): +class Asized: '''Stores the results of an **asized** object in the following 4 attributes: @@ -1900,7 +1900,7 @@ def get(self, name, dflt=None): return dflt -class Asizer(object): +class Asizer: '''Sizer state and options to accumulate sizes. ''' _above_ = 1024 # rank only objs of 1K+ size diff --git a/asv/feed.py b/asv/feed.py index da90dacaf..1d69dab79 100644 --- a/asv/feed.py +++ b/asv/feed.py @@ -16,7 +16,7 @@ XML_NS = "{http://www.w3.org/XML/1998/namespace}" -class FeedEntry(object): +class FeedEntry: """ Atom feed entry. diff --git a/asv/graph.py b/asv/graph.py index 8dd95b1de..7f1432935 100644 --- a/asv/graph.py +++ b/asv/graph.py @@ -19,7 +19,7 @@ RESAMPLED_POINTS = (3840 / 5 / 2) -class GraphSet(object): +class GraphSet: """Manage multiple `Graph`""" def __init__(self): @@ -78,7 +78,7 @@ def __len__(self): return len(self._graphs) -class Graph(object): +class Graph: """ Manages a single "line" in the resulting plots for the front end. diff --git a/asv/machine.py b/asv/machine.py index 25167d8ca..01e5dccaa 100644 --- a/asv/machine.py +++ b/asv/machine.py @@ -27,7 +27,7 @@ def _get_unique_machine_name(): return node -class MachineCollection(object): +class MachineCollection: """ Stores information about 1 or more machines in the ~/.asv-machine.json file. @@ -80,7 +80,7 @@ def update(cls, _path=None): util.update_json(cls, path, cls.api_version) -class Machine(object): +class Machine: """ Stores information about a particular machine. """ diff --git a/asv/plugin_manager.py b/asv/plugin_manager.py index 24a47ee93..64c633a7e 100644 --- a/asv/plugin_manager.py +++ b/asv/plugin_manager.py @@ -7,7 +7,7 @@ from . import plugins -class PluginManager(object): +class PluginManager: """ A class to load and manage plugins. diff --git a/asv/plugins/regressions.py b/asv/plugins/regressions.py index e67988bf7..bfc0dd844 100644 --- a/asv/plugins/regressions.py +++ b/asv/plugins/regressions.py @@ -216,7 +216,7 @@ def _save_feed(cls, conf, benchmarks, data, revisions, revision_to_hash): address='{0}.asv'.format(conf.project)) -class _GraphDataFilter(object): +class _GraphDataFilter: """ Obtain data sets from graphs, following configuration settings. """ diff --git a/asv/profiling.py b/asv/profiling.py index b31334ef8..b52269e48 100644 --- a/asv/profiling.py +++ b/asv/profiling.py @@ -1,6 +1,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -class ProfilerGui(object): +class ProfilerGui: """ A base class to define a Profiler GUI that is available through the ``asv profile`` command. diff --git a/asv/publishing.py b/asv/publishing.py index dd70f081f..9325f4c27 100644 --- a/asv/publishing.py +++ b/asv/publishing.py @@ -1,6 +1,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -class OutputPublisher(object): +class OutputPublisher: """ A base class for pages displaying output in the JS application """ diff --git a/asv/repo.py b/asv/repo.py index ecbc08562..702bd6f06 100644 --- a/asv/repo.py +++ b/asv/repo.py @@ -12,7 +12,7 @@ class NoSuchNameError(RuntimeError): pass -class Repo(object): +class Repo: """ Base class for repository handlers. diff --git a/asv/results.py b/asv/results.py index e8ab04bc3..43ea2c95f 100644 --- a/asv/results.py +++ b/asv/results.py @@ -179,7 +179,7 @@ def _compatible_results(result, result_params, params): return new_results -class Results(object): +class Results: """ Manage a set of benchmark results for a single machine and commit hash. diff --git a/asv/runner.py b/asv/runner.py index 0d1ef2e50..c130c7901 100644 --- a/asv/runner.py +++ b/asv/runner.py @@ -663,7 +663,7 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx, util.long_path_rmtree(real_cwd, True) -class Spawner(object): +class Spawner: """ Manage launching individual benchmark.py commands """ diff --git a/asv/statistics.py b/asv/statistics.py index 1a4651d11..9f413dd7c 100644 --- a/asv/statistics.py +++ b/asv/statistics.py @@ -433,7 +433,7 @@ def binom(n, k): return num // den -class LaplacePosterior(object): +class LaplacePosterior: """ Univariate distribution:: diff --git a/asv/step_detect.py b/asv/step_detect.py index 8727dbae8..f392b9fdb 100644 --- a/asv/step_detect.py +++ b/asv/step_detect.py @@ -852,7 +852,7 @@ def merge_pieces(gamma, right, values, dists, mu_dist, max_size): return right, values, dists -class L1Dist(object): +class L1Dist: """ Fast computations for:: diff --git a/asv/util.py b/asv/util.py index 87e11738a..a21a9b491 100644 --- a/asv/util.py +++ b/asv/util.py @@ -405,7 +405,7 @@ def check_call(args, valid_return_codes=(0,), timeout=600, dots=True, cwd=cwd) -class DebugLogBuffer(object): +class DebugLogBuffer: def __init__(self, log): self.buf = [] self.first = True diff --git a/docs/source/benchmarks.rst b/docs/source/benchmarks.rst index 7a1e3a424..8b19e054d 100644 --- a/docs/source/benchmarks.rst +++ b/docs/source/benchmarks.rst @@ -31,7 +31,7 @@ Benchmark attributes can either be applied directly to the benchmark function:: or appear as class attributes:: - class SomeBenchmarks(object): + class SomeBenchmarks: timeout = 123 def time_something(self): diff --git a/test/benchmark/params_examples.py b/test/benchmark/params_examples.py index 0476cbcf5..dae8dc8fd 100644 --- a/test/benchmark/params_examples.py +++ b/test/benchmark/params_examples.py @@ -1,10 +1,10 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -class ClassOne(object): +class ClassOne: pass -class ClassTwo(object): +class ClassTwo: pass diff --git a/test/benchmark/time_examples.py b/test/benchmark/time_examples.py index 838f18fd0..326943be2 100644 --- a/test/benchmark/time_examples.py +++ b/test/benchmark/time_examples.py @@ -47,7 +47,7 @@ def time_with_timeout(): time_with_timeout.timeout = 0.1 -class TimeWithRepeat(object): +class TimeWithRepeat: # Check that setup is re-run on each repeat called = None number = 1 @@ -70,7 +70,7 @@ def time_it(self): self.count += 1 -class TimeWithRepeatCalibrate(object): +class TimeWithRepeatCalibrate: # Check that setup is re-run on each repeat, apart from # autodetection of suitable `number` repeat = 1 @@ -84,7 +84,7 @@ def time_it(self): pass -class TimeWithBadTimer(object): +class TimeWithBadTimer: # Check that calibration of number is robust against bad timers repeat = 1 number = 0 diff --git a/test/benchmark/timeraw_examples.py b/test/benchmark/timeraw_examples.py index 883305ca3..edacf7061 100644 --- a/test/benchmark/timeraw_examples.py +++ b/test/benchmark/timeraw_examples.py @@ -1,6 +1,6 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst -class TimerawSuite(object): +class TimerawSuite: def timeraw_fresh(self): # The test interpreter should not be polluted with anything. return """ diff --git a/test/test_runner.py b/test/test_runner.py index ac6cb72fa..ffc2f63d6 100644 --- a/test/test_runner.py +++ b/test/test_runner.py @@ -25,7 +25,7 @@ ON_PYPY = hasattr(sys, 'pypy_version_info') -class ResultsWrapper(object): +class ResultsWrapper: tuple_type = collections.namedtuple('tuple_type', ['result', 'stats', 'samples', 'params', 'stderr', 'errcode', 'profile', 'started_at', 'duration']) @@ -198,7 +198,7 @@ def test_skip_param_selection(): d.update(ASV_CONF_JSON) conf = config.Config.from_json(d) - class DummyEnv(object): + class DummyEnv: name = 'env' d = [ diff --git a/test/tools.py b/test/tools.py index 6f8146b53..acbd6048c 100644 --- a/test/tools.py +++ b/test/tools.py @@ -168,7 +168,7 @@ def run_asv_with_conf(conf, *argv, **kwargs): # operations to the repository, and the others should be read-only for # safety. -class Git(object): +class Git: def __init__(self, path): self.path = abspath(path) self._git = util.which('git') @@ -236,7 +236,7 @@ def get_commit_message(self, commit_hash): """ -class Hg(object): +class Hg: encoding = 'utf-8' def __init__(self, path):