aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2020-01-31 02:59:37 -0700
committerTim Harder <radhermit@gmail.com>2020-01-31 02:59:37 -0700
commitac8820a69e8e6cd0062dd8596f2995815cf021dd (patch)
treecf4cfd6038b254374f0fc1b42465446a940ccd77
parentbump version and update news (diff)
downloadsnakeoil-ac8820a69e8e6cd0062dd8596f2995815cf021dd.tar.gz
snakeoil-ac8820a69e8e6cd0062dd8596f2995815cf021dd.tar.bz2
snakeoil-ac8820a69e8e6cd0062dd8596f2995815cf021dd.zip
drop unnecessary object class inheritance for py3
-rw-r--r--src/snakeoil/_fileutils.py2
-rw-r--r--src/snakeoil/caching.py2
-rw-r--r--src/snakeoil/chksum/__init__.py2
-rw-r--r--src/snakeoil/chksum/defaults.py4
-rw-r--r--src/snakeoil/cli/arghparse.py4
-rw-r--r--src/snakeoil/cli/tool.py2
-rw-r--r--src/snakeoil/compatibility.py2
-rw-r--r--src/snakeoil/compression/__init__.py4
-rw-r--r--src/snakeoil/containers.py2
-rw-r--r--src/snakeoil/contexts.py2
-rw-r--r--src/snakeoil/currying.py2
-rw-r--r--src/snakeoil/data_source.py2
-rw-r--r--src/snakeoil/demandload.py2
-rw-r--r--src/snakeoil/dependant_methods.py2
-rw-r--r--src/snakeoil/descriptors.py4
-rw-r--r--src/snakeoil/dist/generate_man_rsts.py2
-rw-r--r--src/snakeoil/fileutils.py4
-rw-r--r--src/snakeoil/formatters.py8
-rw-r--r--src/snakeoil/iterables.py4
-rw-r--r--src/snakeoil/klass.py30
-rw-r--r--src/snakeoil/mappings.py8
-rw-r--r--src/snakeoil/obj.py4
-rw-r--r--src/snakeoil/osutils/__init__.py2
-rw-r--r--src/snakeoil/sequences.py2
-rw-r--r--src/snakeoil/test/__init__.py4
-rw-r--r--src/snakeoil/test/argparse_helpers.py4
-rw-r--r--src/snakeoil/test/fixtures.py4
-rw-r--r--src/snakeoil/test/mixins.py4
-rw-r--r--tests/module/cli/test_arghparse.py14
-rw-r--r--tests/module/cli/test_input.py2
-rw-r--r--tests/module/test_bash.py6
-rw-r--r--tests/module/test_caching.py14
-rw-r--r--tests/module/test_chksum.py2
-rw-r--r--tests/module/test_chksum_defaults.py2
-rw-r--r--tests/module/test_containers.py12
-rw-r--r--tests/module/test_contexts.py4
-rw-r--r--tests/module/test_currying.py12
-rw-r--r--tests/module/test_decorators.py6
-rw-r--r--tests/module/test_demandload.py10
-rw-r--r--tests/module/test_dependant_methods.py4
-rw-r--r--tests/module/test_descriptors.py4
-rw-r--r--tests/module/test_fileutils.py2
-rw-r--r--tests/module/test_formatters.py6
-rw-r--r--tests/module/test_iterables.py8
-rw-r--r--tests/module/test_klass.py86
-rw-r--r--tests/module/test_mappings.py28
-rw-r--r--tests/module/test_obj.py12
-rw-r--r--tests/module/test_osutils.py6
-rw-r--r--tests/module/test_process.py2
-rw-r--r--tests/module/test_sequences.py16
-rw-r--r--tests/module/test_stringio.py2
-rw-r--r--tests/module/test_version.py6
-rw-r--r--tests/module/test_weakrefs.py4
53 files changed, 194 insertions, 194 deletions
diff --git a/src/snakeoil/_fileutils.py b/src/snakeoil/_fileutils.py
index 70cb7f0..51f82c7 100644
--- a/src/snakeoil/_fileutils.py
+++ b/src/snakeoil/_fileutils.py
@@ -29,7 +29,7 @@ def mmap_and_close(fd, *args, **kwargs):
pass
-class readlines_iter(object):
+class readlines_iter:
__slots__ = ("iterable", "mtime", "source")
def __init__(self, iterable, mtime, close=True, source=None):
if source is None:
diff --git a/src/snakeoil/caching.py b/src/snakeoil/caching.py
index 68e936f..3325872 100644
--- a/src/snakeoil/caching.py
+++ b/src/snakeoil/caching.py
@@ -25,7 +25,7 @@ There are some caveats to be aware of in using this metaclass:
Simple usage example:
>>> from snakeoil.caching import WeakInstMeta
->>> class myfoo(object, metaclass=WeakInstMeta):
+>>> class myfoo(metaclass=WeakInstMeta):
... __inst_caching__ = True # safety measure turning caching on
... counter = 0
...
diff --git a/src/snakeoil/chksum/__init__.py b/src/snakeoil/chksum/__init__.py
index dc75039..c4b770d 100644
--- a/src/snakeoil/chksum/__init__.py
+++ b/src/snakeoil/chksum/__init__.py
@@ -131,7 +131,7 @@ def get_chksums(location, *chksums, **kwds):
parallelize=parallelize, can_mmap=can_mmap)
-class LazilyHashedPath(object, metaclass=klass.immutable_instance):
+class LazilyHashedPath(metaclass=klass.immutable_instance):
"""Given a pathway, compute chksums on demand via attribute access."""
def __init__(self, path, **initial_values):
diff --git a/src/snakeoil/chksum/defaults.py b/src/snakeoil/chksum/defaults.py
index 6b27650..16ae74f 100644
--- a/src/snakeoil/chksum/defaults.py
+++ b/src/snakeoil/chksum/defaults.py
@@ -113,7 +113,7 @@ def loop_over_file(handle, callbacks, parallelize=True, can_mmap=True):
f.close()
-class Chksummer(object):
+class Chksummer:
def __init__(self, chf_type, obj, str_size, can_mmap=True):
self.obj = obj
@@ -299,7 +299,7 @@ for k, v, str_size in (
del k, v
-class SizeUpdater(object):
+class SizeUpdater:
def __init__(self):
self.count = 0
diff --git a/src/snakeoil/cli/arghparse.py b/src/snakeoil/cli/arghparse.py
index 7edf3f3..1507015 100644
--- a/src/snakeoil/cli/arghparse.py
+++ b/src/snakeoil/cli/arghparse.py
@@ -308,7 +308,7 @@ class Verbosity(argparse.Action):
setattr(namespace, self.dest, new)
-class DelayedValue(object):
+class DelayedValue:
def __init__(self, invokable, priority=0):
self.priority = priority
@@ -1232,7 +1232,7 @@ class ArgumentParser(OptionalsParser, CsvActionsParser):
return functor
-class ArgparseCommand(object):
+class ArgparseCommand:
def bind_to_parser(self, parser):
parser.bind_main_func(self)
diff --git a/src/snakeoil/cli/tool.py b/src/snakeoil/cli/tool.py
index c16695c..f966be1 100644
--- a/src/snakeoil/cli/tool.py
+++ b/src/snakeoil/cli/tool.py
@@ -14,7 +14,7 @@ from ..contexts import nullcontext
from ..log import suppress_logging
-class Tool(object):
+class Tool:
"""Abstraction for commandline tools."""
def __init__(self, parser, outfile=None, errfile=None):
diff --git a/src/snakeoil/compatibility.py b/src/snakeoil/compatibility.py
index 66df84f..29fa1c8 100644
--- a/src/snakeoil/compatibility.py
+++ b/src/snakeoil/compatibility.py
@@ -15,7 +15,7 @@ if hasattr(sys, 'getPlatform'):
def sorted_key_from_cmp(cmp_func, key_func=None):
- class _key_proxy(object):
+ class _key_proxy:
__slots__ = ('_obj',)
diff --git a/src/snakeoil/compression/__init__.py b/src/snakeoil/compression/__init__.py
index 6addd22..1b62f46 100644
--- a/src/snakeoil/compression/__init__.py
+++ b/src/snakeoil/compression/__init__.py
@@ -7,7 +7,7 @@ from ..process import find_binary, CommandNotFound
from ..process.spawn import spawn_get_output
-class _transform_source(object):
+class _transform_source:
def __init__(self, name):
self.name = name
@@ -73,7 +73,7 @@ class _RegisterCompressionFormat(type):
return new_cls
-class ArComp(object):
+class ArComp:
"""Generic archive and compressed file format support."""
binary = None
diff --git a/src/snakeoil/containers.py b/src/snakeoil/containers.py
index c9c3eae..11a224e 100644
--- a/src/snakeoil/containers.py
+++ b/src/snakeoil/containers.py
@@ -38,7 +38,7 @@ class InvertedContains(set):
raise TypeError("InvertedContains cannot be iterated over")
-class SetMixin(object):
+class SetMixin:
"""
Base class for implementing set classes
diff --git a/src/snakeoil/contexts.py b/src/snakeoil/contexts.py
index 0e9ddaf..4b54fba 100644
--- a/src/snakeoil/contexts.py
+++ b/src/snakeoil/contexts.py
@@ -40,7 +40,7 @@ from .process import namespaces
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
-class SplitExec(object):
+class SplitExec:
"""Context manager separating code execution across parent/child processes.
This is done by forking and doing some magic on the stack so the contents
diff --git a/src/snakeoil/currying.py b/src/snakeoil/currying.py
index 8f42dfe..72a0318 100644
--- a/src/snakeoil/currying.py
+++ b/src/snakeoil/currying.py
@@ -11,7 +11,7 @@ is this
... return arg, self
>>> curry = pre_curry(func, True)
>>> part = partial(func, True)
->>> class Test(object):
+>>> class Test:
... curry = pre_curry(func, True)
... part = partial(func, True)
... def __repr__(self):
diff --git a/src/snakeoil/data_source.py b/src/snakeoil/data_source.py
index ec67ab0..3e45960 100644
--- a/src/snakeoil/data_source.py
+++ b/src/snakeoil/data_source.py
@@ -122,7 +122,7 @@ def open_file(*args, **kwds):
return handle
-class base(object):
+class base:
"""
base data_source class; implementations of the protocol are advised
to derive from this.
diff --git a/src/snakeoil/demandload.py b/src/snakeoil/demandload.py
index ac9374d..00b83a3 100644
--- a/src/snakeoil/demandload.py
+++ b/src/snakeoil/demandload.py
@@ -123,7 +123,7 @@ else:
_noisy_protection = _noisy_protection_enabled
-class Placeholder(object):
+class Placeholder:
"""Object that knows how to replace itself when first accessed.
diff --git a/src/snakeoil/dependant_methods.py b/src/snakeoil/dependant_methods.py
index 62c25f1..551af1e 100644
--- a/src/snakeoil/dependant_methods.py
+++ b/src/snakeoil/dependant_methods.py
@@ -17,7 +17,7 @@ all necessary steps will be ran in the correct order.
Example usage:
>>> from snakeoil.dependant_methods import ForcedDepends
->>> class foo(object, metaclass=ForcedDepends):
+>>> class foo(metaclass=ForcedDepends):
... stage_depends = {"finish": ("do_step1", "do_step2"),
... "do_step1":"start", "do_step2": "start"}
...
diff --git a/src/snakeoil/descriptors.py b/src/snakeoil/descriptors.py
index b328901..12f51cb 100644
--- a/src/snakeoil/descriptors.py
+++ b/src/snakeoil/descriptors.py
@@ -3,7 +3,7 @@
__all__ = ("classproperty",)
-class classproperty(object):
+class classproperty:
"""Like the builtin :py:func:`property` but takes a single classmethod.
@@ -13,7 +13,7 @@ class classproperty(object):
Used like this:
>>> from snakeoil.descriptors import classproperty
- >>> class foo(object):
+ >>> class foo:
...
... @classproperty
... def test(cls):
diff --git a/src/snakeoil/dist/generate_man_rsts.py b/src/snakeoil/dist/generate_man_rsts.py
index d2ecc92..7309a1f 100644
--- a/src/snakeoil/dist/generate_man_rsts.py
+++ b/src/snakeoil/dist/generate_man_rsts.py
@@ -41,7 +41,7 @@ class RawTextFormatter(argparse.RawTextHelpFormatter):
return super()._format_action(action)
-class ManConverter(object):
+class ManConverter:
"""Convert argparse help docs into rST man pages."""
positional_re = re.compile("^([^: \t]+)")
diff --git a/src/snakeoil/fileutils.py b/src/snakeoil/fileutils.py
index 33510a9..ff4bcba 100644
--- a/src/snakeoil/fileutils.py
+++ b/src/snakeoil/fileutils.py
@@ -68,7 +68,7 @@ def mmap_or_open_for_read(path):
raise
-class UnbufferedWriteHandle(object):
+class UnbufferedWriteHandle:
"""Class designed to work around py3k buffering issues
see http://stackoverflow.com/questions/107705/python-output-buffering
@@ -84,7 +84,7 @@ class UnbufferedWriteHandle(object):
__getattr__ = GetAttrProxy("stream")
-class AtomicWriteFile_mixin(object):
+class AtomicWriteFile_mixin:
"""File class that stores the changes in a tempfile.
diff --git a/src/snakeoil/formatters.py b/src/snakeoil/formatters.py
index 74c13fc..3021911 100644
--- a/src/snakeoil/formatters.py
+++ b/src/snakeoil/formatters.py
@@ -30,7 +30,7 @@ class native_StreamClosed(KeyboardInterrupt):
# pylint: disable=C0103
-class Formatter(object):
+class Formatter:
"""
Abstract formatter base class.
@@ -363,7 +363,7 @@ try:
except ImportError:
TerminfoColor = None
else:
- class TerminfoColor(object):
+ class TerminfoColor:
"""
class encapsulating a specific terminfo entry for a color
@@ -405,7 +405,7 @@ else:
raise AttributeError("%s instances are immutable" %
(self.__class__.__name__,))
- class TerminfoCode(object):
+ class TerminfoCode:
"""
Encapsulates specific terminfo entry commands, reset for example.
@@ -568,7 +568,7 @@ else:
self.stream.flush()
-class ObserverFormatter(object):
+class ObserverFormatter:
def __init__(self, real_formatter):
self._formatter = real_formatter
diff --git a/src/snakeoil/iterables.py b/src/snakeoil/iterables.py
index 12f0aed..9b5bb26 100644
--- a/src/snakeoil/iterables.py
+++ b/src/snakeoil/iterables.py
@@ -25,7 +25,7 @@ def partition(iterable, predicate=bool):
(x for pred, x in b if pred))
-class expandable_chain(object):
+class expandable_chain:
"""
chained iterables, with the ability to add new iterables to the chain
as long as the instance hasn't raised StopIteration already. This is
@@ -94,7 +94,7 @@ class expandable_chain(object):
self.iterables.extendleft(iter(x) for x in iterables)
-class caching_iter(object):
+class caching_iter:
"""
On demand consumes from an iterable so as to appear like a tuple
diff --git a/src/snakeoil/klass.py b/src/snakeoil/klass.py
index e794a9c..c59c835 100644
--- a/src/snakeoil/klass.py
+++ b/src/snakeoil/klass.py
@@ -127,7 +127,7 @@ def _native_internal_jit_attr(
use_singleton=use_singleton)
-class _raw_native_internal_jit_attr(object):
+class _raw_native_internal_jit_attr:
"""See _native_internal_jit_attr; this is an implementation detail of that"""
__slots__ = ("storage_attr", "function", "_setter", "singleton", "use_singleton")
@@ -205,7 +205,7 @@ def generic_equality(name, bases, scope, real_type=type,
:raise: TypeError if __attr_comparison__ is incorrectly defined
>>> from snakeoil.klass import generic_equality
- >>> class foo(object, metaclass=generic_equality):
+ >>> class foo(metaclass=generic_equality):
... __attr_comparison__ = ("a", "b", "c")
... def __init__(self, a=1, b=2, c=3):
... self.a, self.b, self.c = a, b, c
@@ -276,7 +276,7 @@ def inject_richcmp_methods_from_cmp(scope, inject_always=False):
>>> from snakeoil.klass import inject_richcmp_methods_from_cmp
>>> from snakeoil.compatibility import cmp
- >>> class foo(object):
+ >>> class foo:
...
... # note that for this example, we inject always since we're
... # explicitly accessing __ge__ methods- under py2k, they wouldn't
@@ -310,7 +310,7 @@ def inject_richcmp_methods_from_cmp(scope, inject_always=False):
scope.setdefault(key, func)
-class chained_getter(object, metaclass=partial(generic_equality, real_type=caching.WeakInstMeta)):
+class chained_getter(metaclass=partial(generic_equality, real_type=caching.WeakInstMeta)):
"""
object that will do multi part lookup, regardless of if it's in the context
@@ -329,7 +329,7 @@ class chained_getter(object, metaclass=partial(generic_equality, real_type=cachi
>>> print(chained_getter("extend")(list).__name__)
extend
>>>
- >>> class foo(object):
+ >>> class foo:
...
... seq = (1,2,3)
...
@@ -379,7 +379,7 @@ instance_attrgetter = chained_getter
# we suppress the repr since if it's unmodified, it'll expose the id;
# this annoyingly means our docs have to be recommited every change,
# even if no real code changed (since the id() continually moves)...
-class _singleton_kls(object):
+class _singleton_kls:
def __str__(self):
return "uncached singleton instance"
@@ -454,7 +454,7 @@ def cached_property(func, kls=_internal_jit_attr, use_cls_setattr=False):
Example Usage:
>>> from snakeoil.klass import cached_property
- >>> class foo(object):
+ >>> class foo:
...
... @cached_property
... def attr(self):
@@ -480,7 +480,7 @@ def cached_property_named(name, kls=_internal_jit_attr, use_cls_setattr=False):
Example Usage:
>>> from snakeoil.klass import cached_property_named
- >>> class foo(object):
+ >>> class foo:
...
... @cached_property_named("attr")
... def attr(self):
@@ -505,7 +505,7 @@ def alias_attr(target_attr):
Example Usage:
>>> from snakeoil.klass import alias_attr
- >>> class foo(object):
+ >>> class foo:
...
... seq = (1,2,3)
...
@@ -535,7 +535,7 @@ def cached_hash(func):
if you know it cannot change.
>>> from snakeoil.klass import cached_hash
- >>> class foo(object):
+ >>> class foo:
... def __init__(self):
... self.hash_invocations = 0
...
@@ -694,7 +694,7 @@ def inject_immutable_instance(scope):
scope.setdefault("__delattr__", _immutable_delattr)
-class ImmutableInstance(object):
+class ImmutableInstance:
"""Class that disables surface-level attribute modifications."""
__setattr__ = _immutable_setattr
@@ -720,7 +720,7 @@ def alias_method(attr, name=None, doc=None):
:param doc: ``__doc__`` to force for the new method if desired
>>> from snakeoil.klass import alias_method
- >>> class foon(object):
+ >>> class foon:
... def orig(self):
... return 1
... alias = alias_method("orig")
@@ -742,7 +742,7 @@ def alias_method(attr, name=None, doc=None):
return _asecond_level_call
-class alias(object):
+class alias:
"""Decorator for making methods callable through aliases.
This decorator must be used inside a class decorated with @aliased.
@@ -751,7 +751,7 @@ class alias(object):
>>> from snakeoil.klass import aliased, alias
>>> @aliased
- >>> class Speak(object):
+ >>> class Speak:
... @alias('yell', 'scream')
... def shout(message):
... return message.upper()
@@ -784,7 +784,7 @@ def aliased(cls):
return cls
-class SlotsPicklingMixin(object):
+class SlotsPicklingMixin:
"""Default pickling support for classes that use __slots__."""
__slots__ = ()
diff --git a/src/snakeoil/mappings.py b/src/snakeoil/mappings.py
index e044ea1..7c3d526 100644
--- a/src/snakeoil/mappings.py
+++ b/src/snakeoil/mappings.py
@@ -18,7 +18,7 @@ import operator
from .klass import get, contains, steal_docs, _sentinel
-class DictMixin(object):
+class DictMixin:
"""
new style class replacement for :py:func:`UserDict.DictMixin`
designed around iter* methods rather then forcing lists as DictMixin does
@@ -346,7 +346,7 @@ class ImmutableDict(Mapping):
return hash(tuple(sorted(self._dict.items(), key=operator.itemgetter(0))))
-class IndeterminantDict(object):
+class IndeterminantDict:
"""A wrapped dict with constant defaults, and a function for other keys.
The primary use for this class is to make a JIT loaded mapping- for instance, a
@@ -605,7 +605,7 @@ class ProxiedAttrs(DictMixin):
Example usage:
- >>> class foo(object):
+ >>> class foo:
... pass
>>> obj = foo()
>>> obj.x, obj.y = 1, 2
@@ -665,7 +665,7 @@ def native_attr_contains(self, key):
# python issue 7604; depending on the python version, delattr'ing an empty slot
# doesn't throw AttributeError; we vary our implementation for efficiency
# dependent on a onetime runtime test of that.
-class foo(object):
+class foo:
__slots__ = ("slot",)
# track which is required since if we can use extensions, we'll have
diff --git a/src/snakeoil/obj.py b/src/snakeoil/obj.py
index 35118b9..a5d67db 100644
--- a/src/snakeoil/obj.py
+++ b/src/snakeoil/obj.py
@@ -26,7 +26,7 @@ By and large, this proxying is transparent if dealing in python objects (newstyl
for example,
>>> from snakeoil.obj import DelayedInstantiation_kls
->>> class foo(object):
+>>> class foo:
... def __init__(self, value):
... print("instance was created")
... self.attribute = value
@@ -108,7 +108,7 @@ def popattr(obj, name, default=klass._sentinel):
getattr(obj, name)
-class BaseDelayedObject(object):
+class BaseDelayedObject:
"""
Base proxying object
diff --git a/src/snakeoil/osutils/__init__.py b/src/snakeoil/osutils/__init__.py
index 0e29a4e..4a4544f 100644
--- a/src/snakeoil/osutils/__init__.py
+++ b/src/snakeoil/osutils/__init__.py
@@ -314,7 +314,7 @@ class GenericFailed(LockException):
# IMO, it shouldn't, but opening/closing everytime around is expensive
-class FsLock(object):
+class FsLock:
"""fnctl based filesystem lock"""
__slots__ = ("path", "fd", "create")
diff --git a/src/snakeoil/sequences.py b/src/snakeoil/sequences.py
index 6ee263c..5239d0a 100644
--- a/src/snakeoil/sequences.py
+++ b/src/snakeoil/sequences.py
@@ -148,7 +148,7 @@ except ImportError:
iflatten_func = native_iflatten_func
-class ChainedLists(object):
+class ChainedLists:
"""Given a set of sequences, this will act as a proxy to them without collapsing them into a single list.
This is primarily useful when you're dealing in large sets (or custom
diff --git a/src/snakeoil/test/__init__.py b/src/snakeoil/test/__init__.py
index a69ec26..51d64b4 100644
--- a/src/snakeoil/test/__init__.py
+++ b/src/snakeoil/test/__init__.py
@@ -79,7 +79,7 @@ def not_a_test(obj):
not_a_test = not_a_test(not_a_test)
-class Todo(object):
+class Todo:
def __init__(self, reason, errors=None):
self.reason = reason
@@ -106,7 +106,7 @@ class Todo(object):
return False
-class TestCase(unittest.TestCase, object):
+class TestCase(unittest.TestCase):
"""Our additions to the standard TestCase.
diff --git a/src/snakeoil/test/argparse_helpers.py b/src/snakeoil/test/argparse_helpers.py
index 34326cf..bcb0679 100644
--- a/src/snakeoil/test/argparse_helpers.py
+++ b/src/snakeoil/test/argparse_helpers.py
@@ -41,7 +41,7 @@ def mangle_parser(parser):
return parser
-class FormatterObject(object, metaclass=WeakInstMeta):
+class FormatterObject(metaclass=WeakInstMeta):
__inst_caching__ = True
def __call__(self, formatter):
@@ -116,7 +116,7 @@ class FakeStreamFormatter(PlainTextFormatter):
if not isinstance(x, FormatterObject)]).decode('ascii')
-class ArgParseMixin(object):
+class ArgParseMixin:
"""Provide some utility methods for testing the parser and main.
:cvar parser: ArgumentParser subclass to test.
diff --git a/src/snakeoil/test/fixtures.py b/src/snakeoil/test/fixtures.py
index 3262e0a..2526b14 100644
--- a/src/snakeoil/test/fixtures.py
+++ b/src/snakeoil/test/fixtures.py
@@ -5,7 +5,7 @@ import pytest
from . import random_str
-class TempDir(object):
+class TempDir:
"""Provide temporary directory to every test method."""
@pytest.fixture(autouse=True)
@@ -13,7 +13,7 @@ class TempDir(object):
self.dir = str(tmpdir)
-class RandomPath(object):
+class RandomPath:
"""Provide random path in a temporary directory to every test method."""
@pytest.fixture(autouse=True)
diff --git a/src/snakeoil/test/mixins.py b/src/snakeoil/test/mixins.py
index 45bba41..270a71d 100644
--- a/src/snakeoil/test/mixins.py
+++ b/src/snakeoil/test/mixins.py
@@ -48,7 +48,7 @@ def mk_named_tempfile(*args, **kwds):
return io.TextIOWrapper(tmp_f)
-class PythonNamespaceWalker(object):
+class PythonNamespaceWalker:
ignore_all_import_failures = False
@@ -178,7 +178,7 @@ class TargetedNamespaceWalker(PythonNamespaceWalker):
for _mod in self.walk_namespace(namespace):
pass
-class _classWalker(object):
+class _classWalker:
cls_blacklist = frozenset()
diff --git a/tests/module/cli/test_arghparse.py b/tests/module/cli/test_arghparse.py
index 703ae1b..4c581df 100644
--- a/tests/module/cli/test_arghparse.py
+++ b/tests/module/cli/test_arghparse.py
@@ -11,7 +11,7 @@ from snakeoil.cli import arghparse
from snakeoil.test import argparse_helpers
-class TestArgparseDocs(object):
+class TestArgparseDocs:
def test_add_argument_docs(self):
# force using an unpatched version of argparse
@@ -64,7 +64,7 @@ class TestArgparseDocs(object):
assert getattr(tuple_action, 'help', None) == 'foo\nbar'
-class TestCopyableParser(object):
+class TestCopyableParser:
# TODO: move this to a generic argparse fixture
@pytest.fixture(autouse=True)
@@ -203,7 +203,7 @@ class TestCopyableParser(object):
assert args.arg == 'def'
-class TestOptionalsParser(object):
+class TestOptionalsParser:
# TODO: move this to a generic argparse fixture
@pytest.fixture(autouse=True)
@@ -265,7 +265,7 @@ class TestOptionalsParser(object):
assert unknown == ['arg', '--opt1', 'yes']
-class TestCsvActionsParser(object):
+class TestCsvActionsParser:
# TODO: move this to a generic argparse fixture
@pytest.fixture(autouse=True)
@@ -354,7 +354,7 @@ class TestArgumentParser(TestCsvActionsParser, TestOptionalsParser):
assert not hasattr(namespace, 'verbosity')
-class BaseArgparseOptions(object):
+class BaseArgparseOptions:
def setup_method(self, method):
self.parser = argparse_helpers.mangle_parser(arghparse.ArgumentParser())
@@ -594,7 +594,7 @@ class TestExistentDirType(BaseArgparseOptions):
assert namespace.path == str(tmp_path)
-class TestNamespace(object):
+class TestNamespace:
def setup_method(self, method):
self.parser = argparse_helpers.mangle_parser(arghparse.ArgumentParser())
@@ -625,7 +625,7 @@ class TestNamespace(object):
assert namespace
-class TestManHelpAction(object):
+class TestManHelpAction:
def test_help(self, capsys):
parser = argparse_helpers.mangle_parser(arghparse.ArgumentParser())
diff --git a/tests/module/cli/test_input.py b/tests/module/cli/test_input.py
index 8e098b3..128c210 100644
--- a/tests/module/cli/test_input.py
+++ b/tests/module/cli/test_input.py
@@ -14,7 +14,7 @@ def mocked_input():
yield mocked_input
-class TestUserQuery(object):
+class TestUserQuery:
@pytest.fixture(autouse=True)
def __setup(self):
diff --git a/tests/module/test_bash.py b/tests/module/test_bash.py
index a72b213..f98606c 100644
--- a/tests/module/test_bash.py
+++ b/tests/module/test_bash.py
@@ -9,7 +9,7 @@ from snakeoil.fileutils import write_file
from snakeoil.test.mixins import mk_named_tempfile
-class TestBashCommentStripping(object):
+class TestBashCommentStripping:
def test_iter_read_bash(self):
output = iter_read_bash(StringIO(
@@ -90,7 +90,7 @@ class TestBashCommentStripping(object):
assert output == ['I am not']
-class TestReadDictConfig(object):
+class TestReadDictConfig:
def test_read_dict(self):
bash_dict = read_dict(StringIO(
@@ -115,7 +115,7 @@ class TestReadDictConfig(object):
assert bash_dict == {}.fromkeys(('foo', 'foo2', 'foo3'), 'blah')
-class TestReadBashDict(object):
+class TestReadBashDict:
def setup_method(self, method):
self.valid_file = mk_named_tempfile()
diff --git a/tests/module/test_caching.py b/tests/module/test_caching.py
index 387d379..d83a72b 100644
--- a/tests/module/test_caching.py
+++ b/tests/module/test_caching.py
@@ -8,11 +8,11 @@ from snakeoil import caching
def gen_test(WeakInstMeta):
- class weak_slotted(object, metaclass=WeakInstMeta):
+ class weak_slotted(metaclass=WeakInstMeta):
__inst_caching__ = True
__slots__ = ('one',)
- class weak_inst(object, metaclass=WeakInstMeta):
+ class weak_inst(metaclass=WeakInstMeta):
__inst_caching__ = True
counter = 0
def __new__(cls, *args, **kwargs):
@@ -33,7 +33,7 @@ def gen_test(WeakInstMeta):
class reenabled_weak_inst(automatic_disabled_weak_inst):
__inst_caching__ = True
- class TestWeakInstMeta(object):
+ class TestWeakInstMeta:
def test_reuse(self, kls=weak_inst):
kls.reset()
@@ -103,7 +103,7 @@ def gen_test(WeakInstMeta):
weak_inst.reset()
# This name is *important*, see above.
- class RaisingHashForTestUncachable(object):
+ class RaisingHashForTestUncachable:
def __init__(self, error):
self.error = error
def __hash__(self):
@@ -118,7 +118,7 @@ def gen_test(WeakInstMeta):
@pytest.mark.filterwarnings('error::UserWarning')
def test_uncachable_warning_msg(self):
# This name is *important*, see above.
- class RaisingHashForTestUncachableWarnings(object):
+ class RaisingHashForTestUncachableWarnings:
def __init__(self, error):
self.error = error
def __hash__(self):
@@ -129,7 +129,7 @@ def gen_test(WeakInstMeta):
weak_inst(RaisingHashForTestUncachableWarnings(x))
def test_hash_collision(self):
- class BrokenHash(object):
+ class BrokenHash:
def __hash__(self):
return 1
assert weak_inst(BrokenHash()) is not weak_inst(BrokenHash())
@@ -144,7 +144,7 @@ def gen_test(WeakInstMeta):
def test_existing_weakref_slot(self):
# The actual test is that the class definition works.
- class ExistingWeakrefSlot(object):
+ class ExistingWeakrefSlot:
__inst_caching__ = True
__slots__ = ('one', '__weakref__')
diff --git a/tests/module/test_chksum.py b/tests/module/test_chksum.py
index 5ef7d6c..b21a0c8 100644
--- a/tests/module/test_chksum.py
+++ b/tests/module/test_chksum.py
@@ -3,7 +3,7 @@ import pytest
from snakeoil import chksum
-class Test_funcs(object):
+class Test_funcs:
def setup_method(self, method):
chksum.__inited__ = False
diff --git a/tests/module/test_chksum_defaults.py b/tests/module/test_chksum_defaults.py
index 388d616..4d1a2a9 100644
--- a/tests/module/test_chksum_defaults.py
+++ b/tests/module/test_chksum_defaults.py
@@ -21,7 +21,7 @@ def require_chf(func):
return subfunc
-class base(object):
+class base:
def get_chf(self):
try:
diff --git a/tests/module/test_containers.py b/tests/module/test_containers.py
index 49f025e..e4d3a12 100644
--- a/tests/module/test_containers.py
+++ b/tests/module/test_containers.py
@@ -5,7 +5,7 @@ import pytest
from snakeoil import containers
-class TestInvertedContains(object):
+class TestInvertedContains:
def setup_method(self, method):
self.set = containers.InvertedContains(range(12))
@@ -43,7 +43,7 @@ class BasicSet(containers.SetMixin):
return not self == other
-class TestSetMethods(object):
+class TestSetMethods:
def test_and(self):
c = BasicSet(range(100))
@@ -81,7 +81,7 @@ class TestSetMethods(object):
assert c - s == r1
assert s - c == r2
-class TestLimitedChangeSet(object):
+class TestLimitedChangeSet:
def setup_method(self, method):
self.set = containers.LimitedChangeSet(range(12))
@@ -199,7 +199,7 @@ class TestLimitedChangeSet(object):
assert containers.LimitedChangeSet([]) != object()
-class TestLimitedChangeSetWithBlacklist(object):
+class TestLimitedChangeSetWithBlacklist:
def setup_method(self, method):
self.set = containers.LimitedChangeSet(range(12), [3, 13])
@@ -222,7 +222,7 @@ class TestLimitedChangeSetWithBlacklist(object):
self.set.remove(3)
-class TestProtectedSet(object):
+class TestProtectedSet:
def setup_method(self, method):
self.set = containers.ProtectedSet(set(range(12)))
@@ -247,7 +247,7 @@ class TestProtectedSet(object):
assert 13 == len(self.set)
-class TestRefCountingSet(object):
+class TestRefCountingSet:
kls = containers.RefCountingSet
diff --git a/tests/module/test_contexts.py b/tests/module/test_contexts.py
index f83f165..302e382 100644
--- a/tests/module/test_contexts.py
+++ b/tests/module/test_contexts.py
@@ -44,7 +44,7 @@ def test_syspath(tmpdir):
assert mangled_syspath == tuple(sys.path)
-class TestSplitExec(object):
+class TestSplitExec:
def test_context_process(self):
# code inside the with statement is run in a separate process
@@ -108,7 +108,7 @@ class TestSplitExec(object):
@pytest.mark.skipif(not sys.platform.startswith('linux'), reason='supported on Linux only')
-class TestNamespace(object):
+class TestNamespace:
@pytest.mark.skipif(not os.path.exists('/proc/self/ns/user'),
reason='user namespace support required')
diff --git a/tests/module/test_currying.py b/tests/module/test_currying.py
index 0fe6470..a9b705d 100644
--- a/tests/module/test_currying.py
+++ b/tests/module/test_currying.py
@@ -12,7 +12,7 @@ def documented():
"""original docstring"""
-class TestPreCurry(object):
+class TestPreCurry:
pre_curry = staticmethod(currying.pre_curry)
@@ -45,13 +45,13 @@ class TestPreCurry(object):
assert self.pre_curry(passthrough).func is passthrough
def test_instancemethod(self):
- class Test(object):
+ class Test:
method = self.pre_curry(passthrough, 'test')
test = Test()
assert (('test', test), {}) == test.method()
-class Test_pretty_docs(object):
+class Test_pretty_docs:
currying_targets = (currying.pre_curry, currying.post_curry)
@@ -70,7 +70,7 @@ class Test_pretty_docs(object):
assert currying.pretty_docs(target(func)).__doc__ is func.__doc__
-class TestPostCurry(object):
+class TestPostCurry:
def test_post_curry(self):
noop = currying.post_curry(passthrough)
@@ -101,13 +101,13 @@ class TestPostCurry(object):
assert currying.post_curry(passthrough).func is passthrough
def test_instancemethod(self):
- class Test(object):
+ class Test:
method = currying.post_curry(passthrough, 'test')
test = Test()
assert ((test, 'test'), {}) == test.method()
-class Test_wrap_exception(object):
+class Test_wrap_exception:
def test_wrap_exception_complex(self):
inner, outer = [], []
diff --git a/tests/module/test_decorators.py b/tests/module/test_decorators.py
index c47b83d..647c611 100644
--- a/tests/module/test_decorators.py
+++ b/tests/module/test_decorators.py
@@ -8,7 +8,7 @@ import pytest
from snakeoil.decorators import namespace, splitexec, coroutine
-class TestSplitExecDecorator(object):
+class TestSplitExecDecorator:
def setup_method(self, method):
self.pid = os.getpid()
@@ -20,7 +20,7 @@ class TestSplitExecDecorator(object):
@pytest.mark.skipif(not sys.platform.startswith('linux'), reason='supported on Linux only')
-class TestNamespaceDecorator(object):
+class TestNamespaceDecorator:
@pytest.mark.skipif(not os.path.exists('/proc/self/ns/user'),
reason='user namespace support required')
@@ -49,7 +49,7 @@ class TestNamespaceDecorator(object):
pytest.skip('No permission to use user and uts namespace')
-class TestCoroutineDecorator(object):
+class TestCoroutineDecorator:
def test_coroutine(self):
@coroutine
diff --git a/tests/module/test_demandload.py b/tests/module/test_demandload.py
index 311c6b6..bd78e82 100644
--- a/tests/module/test_demandload.py
+++ b/tests/module/test_demandload.py
@@ -26,7 +26,7 @@ def reset_globals(functor):
return f
-class TestParser(object):
+class TestParser:
@reset_globals
def test_parse(self):
@@ -45,7 +45,7 @@ class TestParser(object):
pytest.raises(ValueError, list, demandload.parse_imports([' b_x']))
-class TestPlaceholder(object):
+class TestPlaceholder:
@reset_globals
def test_getattr(self):
@@ -80,7 +80,7 @@ class TestPlaceholder(object):
@reset_globals
def test_setattr(self):
- class Struct(object):
+ class Struct:
pass
scope = {}
@@ -92,7 +92,7 @@ class TestPlaceholder(object):
assert 7 == scope['foo'].val
-class TestImport(object):
+class TestImport:
@reset_globals
def test_demandload(self):
@@ -109,7 +109,7 @@ class TestImport(object):
assert demandload is scope['demandload']
-class TestDemandCompileRegexp(object):
+class TestDemandCompileRegexp:
@reset_globals
def test_demand_compile_regexp(self):
diff --git a/tests/module/test_dependant_methods.py b/tests/module/test_dependant_methods.py
index 01d25c9..ffd6d36 100644
--- a/tests/module/test_dependant_methods.py
+++ b/tests/module/test_dependant_methods.py
@@ -7,11 +7,11 @@ def func(self, seq, data, val=True):
return val
-class TestDependantMethods(object):
+class TestDependantMethods:
@staticmethod
def generate_instance(methods, dependencies):
- class Class(object, metaclass=dm.ForcedDepends):
+ class Class(metaclass=dm.ForcedDepends):
stage_depends = dict(dependencies)
locals().update(list(methods.items()))
diff --git a/tests/module/test_descriptors.py b/tests/module/test_descriptors.py
index e1393f1..1720e31 100644
--- a/tests/module/test_descriptors.py
+++ b/tests/module/test_descriptors.py
@@ -1,7 +1,7 @@
from snakeoil import descriptors
-class ClassProp(object):
+class ClassProp:
@descriptors.classproperty
def test(cls):
@@ -9,7 +9,7 @@ class ClassProp(object):
return 'good', cls
-class TestDescriptor(object):
+class TestDescriptor:
def test_classproperty(self):
assert ('good', ClassProp) == ClassProp.test
diff --git a/tests/module/test_fileutils.py b/tests/module/test_fileutils.py
index ca63814..065f234 100644
--- a/tests/module/test_fileutils.py
+++ b/tests/module/test_fileutils.py
@@ -277,7 +277,7 @@ for case in ("ascii", "bytes", "utf8"):
mk_readlines_test(locals(), case)
-class TestBrokenStats(object):
+class TestBrokenStats:
test_cases = ['/proc/crypto', '/sys/devices/system/cpu/present']
diff --git a/tests/module/test_formatters.py b/tests/module/test_formatters.py
index c472293..e7f498f 100644
--- a/tests/module/test_formatters.py
+++ b/tests/module/test_formatters.py
@@ -18,7 +18,7 @@ from snakeoil.test import mk_cpy_loadable_testcase, protect_process
issue7567 = protect_process
-class Test_native_PlainTextFormatter(object):
+class Test_native_PlainTextFormatter:
kls = staticmethod(formatters.native_PlainTextFormatter)
@@ -159,7 +159,7 @@ class Test_cpy_PlainTextFormatter(Test_native_PlainTextFormatter):
kls = staticmethod(formatters.PlainTextFormatter)
-class TerminfoFormatterTest(object):
+class TerminfoFormatterTest:
def _test_stream(self, stream, formatter, inputs, output):
stream.seek(0)
@@ -230,7 +230,7 @@ def _get_pty_pair(encoding='ascii'):
return master, out
-class TestGetFormatter(object):
+class TestGetFormatter:
@issue7567
def test_dumb_terminal(self):
diff --git a/tests/module/test_iterables.py b/tests/module/test_iterables.py
index f64bf31..75c09bf 100644
--- a/tests/module/test_iterables.py
+++ b/tests/module/test_iterables.py
@@ -5,7 +5,7 @@ import pytest
from snakeoil.iterables import partition, expandable_chain, caching_iter, iter_sort
-class TestPartition(object):
+class TestPartition:
def test_empty(self):
a, b = partition(())
@@ -22,7 +22,7 @@ class TestPartition(object):
assert list(b) == [5, 6, 7, 8, 9]
-class TestExpandableChain(object):
+class TestExpandableChain:
def test_normal_function(self):
i = [iter(range(100)) for x in range(3)]
@@ -61,7 +61,7 @@ class TestExpandableChain(object):
e.appendleft([])
-class TestCachingIter(object):
+class TestCachingIter:
def test_iter_consumption(self):
i = iter(range(100))
@@ -149,7 +149,7 @@ class TestCachingIter(object):
assert str(caching_iter(range(10)))
-class Test_iter_sort(object):
+class Test_iter_sort:
def test_ordering(self):
def f(l):
return sorted(l, key=operator.itemgetter(0))
diff --git a/tests/module/test_klass.py b/tests/module/test_klass.py
index ffb0a57..4a5f4a3 100644
--- a/tests/module/test_klass.py
+++ b/tests/module/test_klass.py
@@ -9,16 +9,16 @@ from snakeoil import klass
from snakeoil.test import mk_cpy_loadable_testcase
-class Test_native_GetAttrProxy(object):
+class Test_native_GetAttrProxy:
kls = staticmethod(klass.native_GetAttrProxy)
def test_it(self):
- class foo1(object):
+ class foo1:
def __init__(self, obj):
self.obj = obj
__getattr__ = self.kls('obj')
- class foo2(object):
+ class foo2:
pass
o2 = foo2()
@@ -33,7 +33,7 @@ class Test_native_GetAttrProxy(object):
def test_attrlist(self):
def make_class(attr_list=None):
- class foo(object, metaclass=self.kls):
+ class foo(metaclass=self.kls):
if attr_list is not None:
locals()['__attr_comparison__'] = attr_list
@@ -45,10 +45,10 @@ class Test_native_GetAttrProxy(object):
make_class([None])
def test_instancemethod(self):
- class foo(object):
+ class foo:
bar = "baz"
- class Test(object):
+ class Test:
method = self.kls('test')
test = foo()
@@ -69,7 +69,7 @@ class Test_CPY_GetAttrProxy(Test_native_GetAttrProxy):
# results in a segfault.. so if it's horked, this will bail the test
# runner.
- class c(object):
+ class c:
__getattr__ = self.kls("obj")
o = c()
@@ -79,19 +79,19 @@ class Test_CPY_GetAttrProxy(Test_native_GetAttrProxy):
getattr(o, "hooey")
-class TestDirProxy(object):
+class TestDirProxy:
@staticmethod
def noninternal_attrs(obj):
return sorted(x for x in dir(obj) if not re.match(r'__\w+__', x))
def test_combined(self):
- class foo1(object):
+ class foo1:
def __init__(self, obj):
self.obj = obj
__dir__ = klass.DirProxy('obj')
- class foo2(object):
+ class foo2:
def __init__(self):
self.attr = 'foo'
@@ -100,12 +100,12 @@ class TestDirProxy(object):
assert self.noninternal_attrs(o) == ['attr', 'obj']
def test_empty(self):
- class foo1(object):
+ class foo1:
def __init__(self, obj):
self.obj = obj
__dir__ = klass.DirProxy('obj')
- class foo2(object):
+ class foo2:
pass
o2 = foo2()
@@ -114,13 +114,13 @@ class TestDirProxy(object):
assert self.noninternal_attrs(o) == ['obj']
def test_slots(self):
- class foo1(object):
+ class foo1:
__slots__ = ('obj',)
def __init__(self, obj):
self.obj = obj
__dir__ = klass.DirProxy('obj')
- class foo2(object):
+ class foo2:
__slots__ = ('attr',)
def __init__(self):
self.attr = 'foo'
@@ -130,7 +130,7 @@ class TestDirProxy(object):
assert self.noninternal_attrs(o) == ['attr', 'obj']
-class Test_native_contains(object):
+class Test_native_contains:
func = staticmethod(klass.native_contains)
def test_it(self):
@@ -147,7 +147,7 @@ class Test_CPY_contains(Test_native_contains):
func = staticmethod(klass.contains)
-class Test_native_get(object):
+class Test_native_get:
func = staticmethod(klass.native_get)
def test_it(self):
@@ -166,7 +166,7 @@ class Test_CPY_get(Test_native_get):
func = staticmethod(klass.get)
-class Test_chained_getter(object):
+class Test_chained_getter:
kls = klass.chained_getter
@@ -186,7 +186,7 @@ class Test_chained_getter(object):
self.kls("asdf", disable_inst_caching=True)
def test_it(self):
- class maze(object):
+ class maze:
def __init__(self, kwargs):
self.__data__ = kwargs
@@ -205,7 +205,7 @@ class Test_chained_getter(object):
f('foon.dar')(m)
-class Test_native_jit_attr(object):
+class Test_native_jit_attr:
kls = staticmethod(klass._native_internal_jit_attr)
@@ -231,7 +231,7 @@ class Test_native_jit_attr(object):
self._invokes.append(self)
return 54321
- class cls(object):
+ class cls:
def __init__(self):
sf = partial(object.__setattr__, self)
@@ -285,7 +285,7 @@ class Test_native_jit_attr(object):
def test_jit_attr(self):
now = time()
- class cls(object):
+ class cls:
@self.jit_attr
def my_attr(self):
return now
@@ -294,7 +294,7 @@ class Test_native_jit_attr(object):
assert o.my_attr == now
assert o._my_attr == now
- class cls(object):
+ class cls:
@self.jit_attr
def attr2(self):
return now
@@ -313,7 +313,7 @@ class Test_native_jit_attr(object):
now = time()
# check attrname control and default object.__setattr__ avoidance
- class cls(object):
+ class cls:
@self.jit_attr_named("_blah")
def my_attr(self):
return now
@@ -325,7 +325,7 @@ class Test_native_jit_attr(object):
assert o.my_attr == now
assert o._blah == now
- class cls(object):
+ class cls:
@self.jit_attr_named("_blah2", use_cls_setattr=True)
def my_attr(self):
return now
@@ -344,7 +344,7 @@ class Test_native_jit_attr(object):
now = time()
now2 = now + 100
- class base(object):
+ class base:
def f1(self):
return now
@@ -393,7 +393,7 @@ class Test_native_jit_attr(object):
def throw_assert(*args, **kwds):
raise AssertionError("I shouldn't be invoked: %s, %s" % (args, kwds,))
- class puker(object):
+ class puker:
__eq__ = throw_assert
puker_singleton = puker()
@@ -406,7 +406,7 @@ class Test_native_jit_attr(object):
def test_cached_property(self):
l = []
- class foo(object):
+ class foo:
@klass.cached_property
def blah(self, l=l, i=iter(range(5))):
l.append(None)
@@ -427,7 +427,7 @@ class Test_native_jit_attr(object):
l.append(None)
return next(i)
- class foo(object):
+ class foo:
blah = klass.cached_property_named("blah")(named)
f = foo()
@@ -446,12 +446,12 @@ class Test_cpy_jit_attr(Test_native_jit_attr):
kls = staticmethod(klass._internal_jit_attr)
-class Test_aliased_attr(object):
+class Test_aliased_attr:
func = staticmethod(klass.alias_attr)
def test_it(self):
- class cls(object):
+ class cls:
attr = self.func("dar.blah")
o = cls()
@@ -467,10 +467,10 @@ class Test_aliased_attr(object):
assert o.attr == 'monkey'
# verify it'll cross properties...
- class blah(object):
+ class blah:
target = object()
- class cls(object):
+ class cls:
@property
def foon(self):
return blah()
@@ -480,12 +480,12 @@ class Test_aliased_attr(object):
assert o.alias is blah.target
-class Test_cached_hash(object):
+class Test_cached_hash:
func = staticmethod(klass.cached_hash)
def test_it(self):
now = int(time())
- class cls(object):
+ class cls:
invoked = []
@self.func
def __hash__(self):
@@ -500,11 +500,11 @@ class Test_cached_hash(object):
assert o._hash == now
-class Test_native_reflective_hash(object):
+class Test_native_reflective_hash:
func = staticmethod(klass.native_reflective_hash)
def test_it(self):
- class cls(object):
+ class cls:
__hash__ = self.func('_hash')
obj = cls()
@@ -519,7 +519,7 @@ class Test_native_reflective_hash(object):
with pytest.raises(AttributeError):
hash(obj)
- class cls2(object):
+ class cls2:
__hash__ = self.func('_dar')
obj = cls2()
with pytest.raises(AttributeError):
@@ -538,7 +538,7 @@ cpy_loaded_Test = mk_cpy_loadable_testcase(
"snakeoil._klass", "snakeoil.klass", "reflective_hash", "reflective_hash")
-class TestImmutableInstance(object):
+class TestImmutableInstance:
def test_metaclass(self):
self.common_test(lambda x: x, metaclass=klass.immutable_instance)
@@ -550,7 +550,7 @@ class TestImmutableInstance(object):
self.common_test(f)
def common_test(self, modify_kls, **kwargs):
- class kls(object, **kwargs):
+ class kls(**kwargs):
modify_kls(locals())
o = kls()
@@ -565,7 +565,7 @@ class TestImmutableInstance(object):
# ensure it only sets it if nothing is in place already.
- class kls(object, **kwargs):
+ class kls(**kwargs):
def __setattr__(self, attr, value):
raise TypeError(self)
@@ -578,12 +578,12 @@ class TestImmutableInstance(object):
delattr(o, "dar")
-class TestAliasMethod(object):
+class TestAliasMethod:
func = staticmethod(klass.alias_method)
def test_alias_method(self):
- class kls(object):
+ class kls:
__len__ = lambda s: 3
lfunc = self.func("__len__")
@@ -593,7 +593,7 @@ class TestAliasMethod(object):
assert c.__len__() == c.lfunc()
-class TestPatch(object):
+class TestPatch:
def setup_method(self, method):
# cache original methods
diff --git a/tests/module/test_mappings.py b/tests/module/test_mappings.py
index c0d7f41..2063571 100644
--- a/tests/module/test_mappings.py
+++ b/tests/module/test_mappings.py
@@ -36,7 +36,7 @@ class ImmutableDict(BasicDict):
__externally_mutable__ = False
-class TestDictMixin(object):
+class TestDictMixin:
def test_immutability(self):
d = ImmutableDict()
@@ -80,7 +80,7 @@ class TestDictMixin(object):
assert not d
-class RememberingNegateMixin(object):
+class RememberingNegateMixin:
def setup_method(self, method):
self.negate_calls = []
@@ -94,7 +94,7 @@ class RememberingNegateMixin(object):
del self.negate_calls
-class LazyValDictTestMixin(object):
+class LazyValDictTestMixin:
def test_invalid_operations(self):
pytest.raises(AttributeError, operator.setitem, self.dict, 7, 7)
@@ -155,7 +155,7 @@ class TestLazyValDictWithFunc(LazyValDictTestMixin, RememberingNegateMixin):
self.dict = mappings.LazyValDict(a_dozen, self.negate)
-class TestLazyValDict(object):
+class TestLazyValDict:
def test_invalid_init_args(self):
pytest.raises(TypeError, mappings.LazyValDict, [1], 42)
@@ -164,7 +164,7 @@ class TestLazyValDict(object):
# TODO check for valid values for dict.new, since that seems to be
# part of the interface?
-class TestProtectedDict(object):
+class TestProtectedDict:
def setup_method(self, method):
self.orig = {1: -1, 2: -2}
@@ -214,7 +214,7 @@ class TestProtectedDict(object):
assert 1 not in self.dict
-class TestImmutableDict(object):
+class TestImmutableDict:
def test_init_iterator(self):
d = mappings.ImmutableDict((x, x) for x in range(3))
@@ -288,7 +288,7 @@ class TestImmutableDict(object):
assert initial_hash == hash(d)
-class TestStackedDict(object):
+class TestStackedDict:
orig_dict = dict.fromkeys(range(100))
new_dict = dict.fromkeys(range(100, 200))
@@ -337,7 +337,7 @@ class TestStackedDict(object):
sorted(list(self.orig_dict.keys()) + list(self.new_dict.keys()))
-class TestIndeterminantDict(object):
+class TestIndeterminantDict:
def test_disabled_methods(self):
d = mappings.IndeterminantDict(lambda *a: None)
@@ -390,7 +390,7 @@ class TestIndeterminantDict(object):
assert d.get(3) == True
-class TestFoldingDict(object):
+class TestFoldingDict:
def test_preserve(self):
dct = mappings.PreservingFoldingDict(
@@ -440,7 +440,7 @@ class TestFoldingDict(object):
assert {} == dict(dct)
-class Testdefaultdictkey(object):
+class Testdefaultdictkey:
kls = mappings.defaultdictkey
@@ -453,7 +453,7 @@ class Testdefaultdictkey(object):
assert d[0] is val
-class Test_attr_to_item_mapping(object):
+class Test_attr_to_item_mapping:
kls = mappings.AttrAccessible
inject = staticmethod(mappings.inject_getitem_as_getattr)
@@ -488,12 +488,12 @@ class Test_attr_to_item_mapping(object):
self.test_AttrAccessible(foon)
-class Test_ProxiedAttrs(object):
+class Test_ProxiedAttrs:
kls = mappings.ProxiedAttrs
def test_it(self):
- class foo(object):
+ class foo:
def __init__(self, **kwargs):
for attr, val in kwargs.items():
setattr(self, attr, val)
@@ -523,7 +523,7 @@ class Test_ProxiedAttrs(object):
operator.__delitem__(d, 'x')
-class TestSlottedDict(object):
+class TestSlottedDict:
kls = staticmethod(mappings.make_SlottedDict_kls)
diff --git a/tests/module/test_obj.py b/tests/module/test_obj.py
index 4c09253..03b100c 100644
--- a/tests/module/test_obj.py
+++ b/tests/module/test_obj.py
@@ -7,7 +7,7 @@ make_DI = obj.DelayedInstantiation
make_DIkls = obj.DelayedInstantiation_kls
-class TestDelayedInstantiation(object):
+class TestDelayedInstantiation:
def test_simple(self):
t = tuple([1, 2, 3])
@@ -58,14 +58,14 @@ class TestDelayedInstantiation(object):
# it must always be a custom
o = make_DI(object, object)
assert object.__getattribute__(o, '__class__') is not obj.BaseDelayedObject
- class foon(object):
+ class foon:
pass
o = make_DI(foon, foon)
cls = object.__getattribute__(o, '__class__')
assert cls is obj.BaseDelayedObject
# now ensure we always get the same kls back for derivatives
- class foon(object):
+ class foon:
def __bool__(self):
return True
@@ -90,7 +90,7 @@ class TestDelayedInstantiation(object):
def f():
l.append(True)
return foon()
- class foon(object):
+ class foon:
__doc__ = "monkey"
o = make_DI(foon, f)
@@ -101,9 +101,9 @@ class TestDelayedInstantiation(object):
"trigger instantiation")
-class TestPopattr(object):
+class TestPopattr:
- class Object(object):
+ class Object:
pass
def setup_method(self, method):
diff --git a/tests/module/test_osutils.py b/tests/module/test_osutils.py
index a90dff8..843b659 100644
--- a/tests/module/test_osutils.py
+++ b/tests/module/test_osutils.py
@@ -237,7 +237,7 @@ class TestAbsSymlink(TempDir):
assert osutils.abssymlink(linkname) == target
-class Test_Native_NormPath(object):
+class Test_Native_NormPath:
func = staticmethod(osutils.native_normpath)
@@ -278,7 +278,7 @@ class Test_Cpy_NormPath(Test_Native_NormPath):
@pytest.mark.skipif(osutils.join is osutils.native_join, reason="extension isn't compiled")
-class Test_Cpy_Join(object):
+class Test_Cpy_Join:
def test_reimplementation(self):
vals = [
@@ -437,7 +437,7 @@ class Test_unlink_if_exists(TempDir):
f(path)
-class TestSupportedSystems(object):
+class TestSupportedSystems:
def test_supported_system(self):
@supported_systems('supported')
diff --git a/tests/module/test_process.py b/tests/module/test_process.py
index 9ca14a0..445e238 100644
--- a/tests/module/test_process.py
+++ b/tests/module/test_process.py
@@ -63,7 +63,7 @@ class TestFindBinary(TempDir):
process.find_binary(self.dir)
-class TestIsRunning(object):
+class TestIsRunning:
def test_is_running(self):
# confirm we're running
diff --git a/tests/module/test_sequences.py b/tests/module/test_sequences.py
index cbb5541..2e542de 100644
--- a/tests/module/test_sequences.py
+++ b/tests/module/test_sequences.py
@@ -15,7 +15,7 @@ class UnhashableComplex(complex):
raise TypeError
-class TestStableUnique(object):
+class TestStableUnique:
def common_check(self, func):
# silly
@@ -51,7 +51,7 @@ class TestStableUnique(object):
assert sorted(sequences.unstable_unique(self._generator())) == sorted(range(6))
-class TestChainedLists(object):
+class TestChainedLists:
@staticmethod
def gen_cl():
@@ -104,7 +104,7 @@ class TestChainedLists(object):
assert len(cl) == 150
-class Test_iflatten_instance(object):
+class Test_iflatten_instance:
func = staticmethod(sequences.native_iflatten_instance)
def test_it(self):
@@ -144,7 +144,7 @@ class Test_iflatten_instance(object):
assert self.func((), **{})
-class Test_iflatten_func(object):
+class Test_iflatten_func:
func = staticmethod(sequences.native_iflatten_func)
def test_it(self):
@@ -192,7 +192,7 @@ class Test_CPY_iflatten_func(Test_iflatten_func):
func = staticmethod(sequences.iflatten_func)
-class Test_predicate_split(object):
+class Test_predicate_split:
kls = staticmethod(sequences.predicate_split)
def test_simple(self):
@@ -211,7 +211,7 @@ cpy_loaded_Test = mk_cpy_loadable_testcase(
"snakeoil._sequences", "snakeoil.sequences", "iflatten_func", "iflatten_func")
-class TestNamedTuple(object):
+class TestNamedTuple:
def setup_method(self, method):
self.point = namedtuple('Point', ('x', 'y', 'z'))
@@ -249,7 +249,7 @@ class TestNamedTuple(object):
q = self.point(x=1, y=2, z=3)
-class TestSplitNegations(object):
+class TestSplitNegations:
def test_empty(self):
# empty input
@@ -290,7 +290,7 @@ class TestSplitNegations(object):
assert split_negations(seq, int) == (tuple(range(100)), tuple(range(100)))
-class TestSplitElements(object):
+class TestSplitElements:
def test_empty(self):
# empty input
diff --git a/tests/module/test_stringio.py b/tests/module/test_stringio.py
index 188348a..5cbefb2 100644
--- a/tests/module/test_stringio.py
+++ b/tests/module/test_stringio.py
@@ -5,7 +5,7 @@ import pytest
from snakeoil import stringio
-class base(object):
+class base:
encoding = None
kls = None
diff --git a/tests/module/test_version.py b/tests/module/test_version.py
index 8d35e74..46b841d 100644
--- a/tests/module/test_version.py
+++ b/tests/module/test_version.py
@@ -9,7 +9,7 @@ from snakeoil import __version__
from snakeoil import version
-class TestVersion(object):
+class TestVersion:
def setup_method(self, method):
# reset the cached version in the module
@@ -49,7 +49,7 @@ class TestVersion(object):
}
# fake snakeoil._verinfo module object
- class Verinfo(object):
+ class Verinfo:
version_info=verinfo
with mock.patch('snakeoil.version.import_module') as import_module:
@@ -78,7 +78,7 @@ class TestVersion(object):
assert not import_module.called
-class TestGitVersion(object):
+class TestGitVersion:
def test_get_git_version_not_available(self):
with mock.patch('snakeoil.version._run_git') as run_git:
diff --git a/tests/module/test_weakrefs.py b/tests/module/test_weakrefs.py
index 894219d..79b2a34 100644
--- a/tests/module/test_weakrefs.py
+++ b/tests/module/test_weakrefs.py
@@ -5,7 +5,7 @@ import pytest
from snakeoil.weakrefs import WeakValCache
-class RefObj(object):
+class RefObj:
pass
@@ -13,7 +13,7 @@ class RefObj(object):
WeakValueDictionary is WeakValCache,
reason="WeakValCache is weakref.WeakValueDictionary; indicates "
"snakeoil._caching isn't compiled")
-class TestWeakValCache(object):
+class TestWeakValCache:
def setup_method(self, method):
self.o = RefObj()