Skip to content

Commit 588026f

Browse files
committed
Avoid inheritance from object
Avoid inheritance from object to fix WPS306 linting errors. ``` WPS306 Found explicit `object` base class: ... ```
1 parent ba5babc commit 588026f

File tree

11 files changed

+18
-17
lines changed

11 files changed

+18
-17
lines changed

classes/_typeclass.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
110110
.. code:: python
111111
112-
>>> class WithField(object):
112+
>>> class WithField:
113113
... field: str = 'with field'
114114
115115
>>> assert example(WithField()) == 'with field'
@@ -256,7 +256,7 @@ class Supports(Generic[_AssociatedTypeDef]):
256256
257257
>>> from classes import typeclass, Supports
258258
259-
>>> class ToJson(object):
259+
>>> class ToJson:
260260
... ...
261261
262262
>>> @typeclass(ToJson)

classes/contrib/mypy/features/supports.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313

1414
@final
15-
class VariadicGeneric(object):
15+
class VariadicGeneric:
1616
"""
1717
Variadic generic support for ``Supports`` type.
1818

classes/contrib/mypy/features/typeclass.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131

3232
@final
33-
class TypeClassReturnType(object):
33+
class TypeClassReturnType:
3434
"""
3535
Adjust argument types when we define typeclasses via ``typeclass`` function.
3636
@@ -105,7 +105,7 @@ def _process_typeclass_def_return_type(
105105

106106

107107
@final
108-
class TypeClassDefReturnType(object):
108+
class TypeClassDefReturnType:
109109
"""
110110
Callback for cases like ``@typeclass(SomeType)``.
111111
@@ -172,7 +172,7 @@ def instance_return_type(ctx: MethodContext) -> MypyType:
172172

173173

174174
@final
175-
class InstanceDefReturnType(object):
175+
class InstanceDefReturnType:
176176
"""
177177
Class to check how instance definition is created.
178178

classes/contrib/mypy/typeops/call_signatures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818

1919
@final
20-
class SmartCallSignature(object):
20+
class SmartCallSignature:
2121
"""
2222
Infers the ``__call__`` signature of a typeclass.
2323

classes/contrib/mypy/typeops/mro.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212

1313
@final
14-
class MetadataInjector(object):
14+
class MetadataInjector:
1515
"""
1616
Injects fake ``Supports[TypeClass]`` parent classes into ``mro``.
1717

docs/pages/concept.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ In other words, it can fallback to more common types:
310310
... def example(instance) -> str:
311311
... ...
312312
313-
>>> class A(object):
313+
>>> class A:
314314
... ...
315315
316316
>>> class B(A):
@@ -505,7 +505,7 @@ to have only subtypes of some specific types during typechecking
505505
506506
>>> from classes import typeclass
507507
508-
>>> class A(object):
508+
>>> class A:
509509
... ...
510510
511511
>>> class B(A):

docs/pages/why.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ super type to make ``len`` method available to your type:
5858
5959
>>> import abc
6060
61-
>>> class HasLength(object):
61+
>>> class HasLength:
6262
... @abc.abstractmethod
6363
... def len(self) -> int:
6464
... """You have to implement this method to get the length."""
@@ -96,7 +96,7 @@ For example, imagine you have a typical domain ``Person`` class:
9696
9797
>>> from typing import Sequence
9898
99-
>>> class Person(object):
99+
>>> class Person:
100100
... def become_friends(self, friend: 'Person') -> None:
101101
... ...
102102
...
@@ -111,7 +111,7 @@ And our library requires this extra API:
111111

112112
.. code:: diff
113113
114-
--- class Person(object):
114+
--- class Person:
115115
+++ class Person(JSONSerializable):
116116
117117
+++ def to_json(self) -> str:

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ ignore_errors = false
100100
ignore_missing_imports = true
101101
implicit_reexport = false
102102
local_partial_types = true
103+
strict = true
103104
strict_optional = true
104105
strict_equality = true
105106
no_implicit_optional = true

tests/test_typeclass/test_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def my_typeclass(instance) -> int:
88
"""Example typeclass."""
99

1010

11-
class _MyABC(object, metaclass=ABCMeta):
11+
class _MyABC(metaclass=ABCMeta):
1212
@abstractmethod
1313
def get_number(self) -> int:
1414
"""Example abstract method."""
@@ -20,7 +20,7 @@ def get_number(self) -> int:
2020
return 1
2121

2222

23-
class _MyRegistered(object):
23+
class _MyRegistered:
2424
def get_number(self) -> int:
2525
"""Would be registered in ``_MyABC`` later."""
2626
return 2

tests/test_typeclass/test_protocols.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def _str_type(instance: str, other: str) -> str:
1818
return instance + other
1919

2020

21-
class _CustomSized(object):
21+
class _CustomSized:
2222
def __len__(self) -> int:
2323
return 2
2424

0 commit comments

Comments
 (0)