Skip to content

Commit

Permalink
Remove explicit inheritence from object
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Sep 2, 2024
1 parent c128887 commit d37e851
Show file tree
Hide file tree
Showing 24 changed files with 49 additions and 49 deletions.
2 changes: 1 addition & 1 deletion dev/backwards_incompatiblity_examples_inthewild.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# Note, if we put a # after the empty line, the code still breaks, so that is
# something we can/should fix.

# >>> class NamesFilter(object):
# >>> class NamesFilter:
# ... def __init__(self, allowed):
# ... self._allowed = allowed
# ...
Expand Down
2 changes: 1 addition & 1 deletion dev/demo/demo_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def demo3():
pass


class Demo5(object):
class Demo5:
"""
CommandLine:
xdoctest -m ~/code/xdoctest/dev/demo/demo_errors.py Demo5
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Create the most singleton object ever to avoid reload issues
# this is based on ubelt.NoParam, which has more docs on how this works
class _NOT_EVAL_TYPE(object):
class _NOT_EVAL_TYPE:
"""
This is a singleton object used as a sentinel value. The value of
:data:`NoParam` is robust to reloading, pickling, and copying. See
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def myfunc():
return 123


class MyClass(object):
class MyClass:
"""
Example:
>>> self = MyClass.demo()
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/doctest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def getvalue(self, key, given=None):
return given


class DocTest(object):
class DocTest:
"""
Holds information necessary to execute and verify a doctest
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/doctest_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""


class DoctestPart(object):
class DoctestPart:
"""
The result of parsing that represents a "logical block" of code.
If a want statement is defined, it is stored here.
Expand Down
4 changes: 2 additions & 2 deletions src/xdoctest/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class IncompleteParseError(SyntaxError):
import _pytest.outcomes
except ImportError: # nocover
# Define dummy skipped exception if pytest is not available
class _pytest(object): # type: ignore
class outcomes(object):
class _pytest: # type: ignore
class outcomes:
class Skipped(Exception):
pass
2 changes: 1 addition & 1 deletion src/xdoctest/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
NEED_16806_WORKAROUND = sys.version_info[0:2] < (3, 8)


class DoctestParser(object):
class DoctestParser:
r"""
Breaks docstrings into parts using the `parse` method.
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class _XDoctestBase(pytest.Module):

def _prepare_internal_config(self):

class NamespaceLike(object):
class NamespaceLike:
def __init__(self, config):
self.config = config
def __getitem__(self, attr):
Expand Down
4 changes: 2 additions & 2 deletions src/xdoctest/static_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import tokenize


class CallDefNode(object):
class CallDefNode:
"""
Attributes:
lineno_end (None | int):
Expand Down Expand Up @@ -105,7 +105,7 @@ def subfunc():
pass
def bar():
pass
class Spam(object):
class Spam:
def eggs(self):
pass
@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/utils/util_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def _pkgutil_modname_to_modpath(modname): # nocover
return modpath


class PythonPathContext(object):
class PythonPathContext:
"""
Context for temporarily adding a dir to the PYTHONPATH.
Expand Down
4 changes: 2 additions & 2 deletions src/xdoctest/utils/util_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .util_path import TempDir


class TempDoctest(object):
class TempDoctest:
"""
Creates a temporary file containing a module-level doctest for testing
Expand All @@ -30,7 +30,7 @@ def __init__(self, docstr, modname=None):
file.write("'''\n%s'''" % self.docstr)


class TempModule(object):
class TempModule:
"""
Creates a temporary directory with a python module.
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/utils/util_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""


class NiceRepr(object):
class NiceRepr:
"""
Defines `__str__` and `__repr__` in terms of `__nice__` function
Classes that inherit `NiceRepr` must define `__nice__`
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/utils/util_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def visit(self, node):
return None


class NotebookLoader(object):
class NotebookLoader:
""" Module Loader for Jupyter Notebooks. """

default_options = {
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/utils/util_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import shutil


class TempDir(object):
class TempDir:
"""
Context for creating and cleaning up temporary files. Used in testing.
Expand Down
2 changes: 1 addition & 1 deletion src/xdoctest/utils/util_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def flush(self): # nocover
return super(TeeStringIO, self).flush()


class CaptureStream(object):
class CaptureStream:
"""
Generic class for capturing streaming output from stdout or stderr
"""
Expand Down
10 changes: 5 additions & 5 deletions tests/test_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_properties():
"""
text = _run_case(utils.codeblock(
'''
class Test(object):
class Test:
@property
def test(self):
"""
Expand All @@ -30,7 +30,7 @@ def test(self, s):

text = _run_case(utils.codeblock(
'''
class Test(object):
class Test:
@property
def test(self):
"""
Expand All @@ -45,7 +45,7 @@ def test(self):

text = _run_case(utils.codeblock(
'''
class Test(object):
class Test:
@property
def test(self):
"""
Expand All @@ -69,7 +69,7 @@ def test(self, s):

text = _run_case(utils.codeblock(
'''
class Test(object):
class Test:
@property
def test(self):
return 3.14
Expand All @@ -87,7 +87,7 @@ def test(self, s):

text = _run_case(utils.codeblock(
'''
class Test(object):
class Test:
@property
def test(self):
return 3.14
Expand Down
2 changes: 1 addition & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_mod_lineno():
modpath = join(dpath, 'test_mod_lineno.py')
source = utils.codeblock(
'''
class Fun(object): #1
class Fun: #1
@property
def test(self):
""" # 4
Expand Down
4 changes: 2 additions & 2 deletions tests/test_doctest_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_continue_ambiguity():
"""
string = utils.codeblock(
'''
>>> class Lowerer(object):
>>> class Lowerer:
... def __init__(self):
... self.cache = LRI()
...
Expand All @@ -62,7 +62,7 @@ def test_contination_want_ambiguity():
"""
string = utils.codeblock(
'''
>>> class Lowerer(object):
>>> class Lowerer:
... def __init__(self):
... self.cache = LRI()
...
Expand Down
4 changes: 2 additions & 2 deletions tests/test_dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
TopLevelVisitor = static.TopLevelVisitor


class SimpleDescriptor(object):
class SimpleDescriptor:
def __init__(self):
self.value = 0

Expand All @@ -24,7 +24,7 @@ def __set__(self, instance, value):
self.value = float(value)


class SimpleClass(object):
class SimpleClass:
"""
Example:
>>> pass
Expand Down
2 changes: 1 addition & 1 deletion tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def test_extract_got_exception():

source = utils.codeblock(
'''
class MyObj(object):
class MyObj:
"""
Example:
>>> a = MyObj()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_limitations.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def setter(self, x):
return x
return Foo()
class Test(object):
class Test:
@property
def test(self):
"""
Expand Down
Loading

0 comments on commit d37e851

Please sign in to comment.