Skip to content

Commit 3a2a9af

Browse files
committed
Bump mypy
1 parent fa89aff commit 3a2a9af

File tree

9 files changed

+16
-20
lines changed

9 files changed

+16
-20
lines changed

domdf_python_tools/bases.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def __deepcopy__(self, memodict={}):
116116

117117
@property
118118
@abstractmethod
119-
def __dict__(self):
119+
def __dict__(self): # type: ignore[override]
120120
return dict() # pragma: no cover (abc)
121121

122122
def __eq__(self, other) -> bool:
@@ -422,7 +422,7 @@ def __sub__(self: _F, other: float) -> _F:
422422
def __mul__(self: _F, other: float) -> _F:
423423
return self.__class__(float(self).__mul__(other))
424424

425-
def __floordiv__(self: _F, other: float) -> _F: # type: ignore[override]
425+
def __floordiv__(self: _F, other: float) -> _F:
426426
return self.__class__(float(self).__floordiv__(other))
427427

428428
def __truediv__(self: _F, other: float) -> _F:
@@ -446,7 +446,7 @@ def __rsub__(self: _F, other: float) -> _F:
446446
def __rmul__(self: _F, other: float) -> _F:
447447
return self.__class__(float(self).__rmul__(other))
448448

449-
def __rfloordiv__(self: _F, other: float) -> _F: # type: ignore[override]
449+
def __rfloordiv__(self: _F, other: float) -> _F:
450450
return self.__class__(float(self).__rfloordiv__(other))
451451

452452
def __rtruediv__(self: _F, other: float) -> _F:
@@ -538,8 +538,8 @@ def __float__(self) -> float:
538538
def __abs__(self: _F) -> _F:
539539
return self.__class__(float(self).__abs__())
540540

541-
def __hash__(self) -> int:
542-
return float(self).__hash__()
541+
# def __hash__(self) -> int:
542+
# return float(self).__hash__()
543543

544544
def __repr__(self) -> str:
545545
return str(self)

domdf_python_tools/pretty_print.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
# stdlib
4040
import sys
4141
from io import StringIO
42-
from typing import IO, Any, Callable, Iterator, MutableMapping, Optional, Tuple, Type, TypeVar
42+
from typing import IO, Any, Callable, ClassVar, Iterator, MutableMapping, Optional, Tuple, Type, TypeVar
4343

4444
try: # pragma: no cover
4545

@@ -106,7 +106,7 @@ def __init__(
106106

107107
_dispatch: MutableMapping[Callable, Callable]
108108
_indent_per_level: int
109-
_format_items: Callable[[PrettyPrinter, Any, Any, Any, Any, Any, Any], None]
109+
_format_items: ClassVar[Callable[[PrettyPrinter, Any, Any, Any, Any, Any, Any], None]]
110110
_dispatch = dict(PrettyPrinter._dispatch) # type: ignore
111111

112112
def _make_open(self, char: str, indent: int, obj):

domdf_python_tools/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def head(obj: Union[Tuple, List, "DataFrame", "Series", String, HasHead], n: int
431431
if len(obj) <= n:
432432
return repr(obj)
433433
else:
434-
head_of_namedtuple = {k: v for k, v in zip(obj._fields[:n], obj[:n])} # type: ignore
434+
head_of_namedtuple = {k: v for k, v in zip(obj._fields[:n], obj[:n])}
435435
repr_fmt = '(' + ", ".join(f"{k}={v!r}" for k, v in head_of_namedtuple.items()) + f", {etc})"
436436
return obj.__class__.__name__ + repr_fmt
437437

domdf_python_tools/versions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def patch(self): # noqa: D102
9090
return self[2]
9191

9292
def __new__(cls: Type[_V], major=0, minor=0, patch=0) -> _V: # noqa: D102
93-
t: _V = super().__new__(cls, (int(major), int(minor), int(patch))) # type: ignore
93+
t: _V = super().__new__(cls, (int(major), int(minor), int(patch)))
9494

9595
return t
9696

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
def foo_in_init() -> str:
2-
pass
2+
return ''

tests/mypy_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@
88
class MyDictable(Dictable):
99

1010
def __init__(self, foo: str, bar: int):
11-
super().__init__()
12-
1311
self.foo: str = foo
1412
self.bar: float = float(bar)
1513

1614
@property
17-
def __dict__(self):
15+
def __dict__(self): # type: ignore[override]
1816
return dict(foo=self.foo, bar=self.bar)
1917

2018

tests/test_bases.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,12 @@
2323
class Person(Dictable):
2424

2525
def __init__(self, name, age, occupation=None):
26-
super().__init__()
27-
2826
self.name = str(name)
2927
self.age = int(age)
3028
self.occupation = occupation
3129

3230
@property
33-
def __dict__(self):
31+
def __dict__(self): # type: ignore[override]
3432
return dict(
3533
name=self.name,
3634
age=self.age,
@@ -46,7 +44,7 @@ def __init__(self, name, age, school):
4644
self.school = "school"
4745

4846
@property
49-
def __dict__(self):
47+
def __dict__(self): # type: ignore[override]
5048
class_dict = super().__dict__
5149
class_dict["School"] = self.school
5250
return class_dict

tests/test_delegators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
def f(a: int = 1, b: float = 1.1, c: int = 2, d: list = [], e: tuple = (), f: str = '', g: bytes = b'') -> int:
10-
pass
10+
return 0
1111

1212

1313
def test_delegate_kwargs():
@@ -84,7 +84,7 @@ class F:
8484

8585
@delegates(f)
8686
def g(self, *args, **kwargs) -> str:
87-
pass
87+
return ''
8888

8989
sig = inspect.signature(F.g)
9090
assert list(sig.parameters.keys()) == ["self", 'a', 'b', 'c', 'd', 'e', 'f', 'g']

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ ignore_errors = True
148148
changedir = {toxinidir}
149149
extras = all
150150
deps =
151-
mypy==0.971
151+
mypy==1.17.1
152152
-r{toxinidir}/tests/requirements.txt
153153
-r{toxinidir}/stubs.txt
154154
pprint36

0 commit comments

Comments
 (0)