Skip to content

Commit 6e8457b

Browse files
authored
Silence mypy error (#903)
Staring with mypy 1.1.1, mypy started complaining about `__new__` of for example `Tuple[float, ...]`, which we are using in spatial and temporal types.
1 parent 47d2aab commit 6e8457b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/neo4j/_spatial/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,10 @@ def y(self) -> float: ...
6060
def z(self) -> float: ...
6161

6262
def __new__(cls, iterable: t.Iterable[float]) -> Point:
63-
return tuple.__new__(cls, map(float, iterable))
63+
# mypy issue https://github.com/python/mypy/issues/14890
64+
return tuple.__new__( # type: ignore[type-var]
65+
cls, map(float, iterable)
66+
)
6467

6568
def __repr__(self) -> str:
6669
return "POINT(%s)" % " ".join(map(str, self))

src/neo4j/time/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ def __new__(
415415
if not MIN_INT64 <= avg_total_seconds <= MAX_INT64:
416416
raise ValueError("Duration value out of range: %r",
417417
tuple.__repr__((mo, d, s, ns)))
418-
return tuple.__new__(cls, (mo, d, s, ns))
418+
# mypy issue https://github.com/python/mypy/issues/14890
419+
return tuple.__new__(cls, (mo, d, s, ns)) # type: ignore[type-var]
419420

420421
def __bool__(self) -> bool:
421422
"""Falsy if all primary instance attributes are."""

0 commit comments

Comments
 (0)