Skip to content

Commit 291b565

Browse files
committed
typ: tweak from mypy --strict
1 parent 692e206 commit 291b565

File tree

8 files changed

+23
-16
lines changed

8 files changed

+23
-16
lines changed

src/flint/test/test_all.py

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

1717
ctx = flint.ctx
1818

19-
def raises(f, exception):
19+
def raises(f, exception) -> bool:
2020
try:
2121
f()
2222
except exception:

src/flint/types/fmpq.pyi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ ifmpq = int | fmpz | fmpq
1010

1111
class fmpq(flint_scalar):
1212
@overload
13-
def __init__(self): ...
13+
def __init__(self) -> None: ...
1414
@overload
15-
def __init__(self, arg: ifmpq | _str, /): ...
15+
def __init__(self, arg: ifmpq | _str, /) -> None: ...
1616
@overload
17-
def __init__(self, num: ifmpz, den: ifmpz, /): ...
17+
def __init__(self, num: ifmpz, den: ifmpz, /) -> None: ...
1818

1919
@property
2020
def p(self) -> fmpz: ...
@@ -53,6 +53,9 @@ class fmpq(flint_scalar):
5353
@overload
5454
def __round__(self) -> fmpz: ...
5555

56+
def __eq__(self, other: object, /) -> bool: ...
57+
def __hash__(self) -> int: ...
58+
5659
def __lt__(self, other: ifmpq, /) -> bool: ...
5760
def __le__(self, other: ifmpq, /) -> bool: ...
5861
def __gt__(self, other: ifmpq, /) -> bool: ...

src/flint/types/fmpq_poly.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class fmpq_poly(flint_poly[fmpq]):
1616
"""
1717

1818
@overload
19-
def __init__(self): ...
19+
def __init__(self) -> None: ...
2020
@overload
21-
def __init__(self, other: fmpq_poly | fmpz_poly | list[ifmpq] | ifmpq, /): ...
21+
def __init__(self, other: fmpq_poly | fmpz_poly | list[ifmpq] | ifmpq, /) -> None: ...
2222
@overload
2323
def __init__(self, other: fmpq_poly | fmpz_poly | list[ifmpq] | ifmpq,
24-
den: ifmpz, /): ...
24+
den: ifmpz, /) -> None: ...
2525

2626
def __len__(self) -> int: ...
2727
def length(self) -> int: ...

src/flint/types/fmpq_series.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import Any
12
from flint.flint_base.flint_base import flint_series
23
from flint.types.fmpz import fmpz, ifmpz
34
from flint.types.fmpq import fmpq, ifmpq
@@ -35,8 +36,8 @@ class fmpq_series(flint_series[fmpq]):
3536
def __getitem__(self, i: int, /) -> fmpq: ...
3637
def __setitem__(self, i: int, x: ifmpq, /) -> None: ...
3738

38-
def repr(self, **kwargs) -> str: ...
39-
def str(self, **kwargs) -> str: ...
39+
def repr(self, **kwargs: Any) -> str: ...
40+
def str(self, **kwargs: Any) -> str: ...
4041

4142
def __pos__(self) -> fmpq_series: ...
4243
def __neg__(self) -> fmpq_series: ...

src/flint/types/fmpz.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class fmpz(flint_scalar):
3232
def __trunc__(self) -> fmpz: ...
3333
def __round__(self, ndigits: int | None = None) -> fmpz: ...
3434

35+
def __eq__(self, other: object, /) -> bool: ...
36+
def __hash__(self) -> int: ...
37+
3538
def __lt__(self, other: ifmpz, /) -> bool: ...
3639
def __le__(self, other: ifmpz, /) -> bool: ...
3740
def __gt__(self, other: ifmpz, /) -> bool: ...
@@ -72,7 +75,7 @@ class fmpz(flint_scalar):
7275
def gcd(self, other: ifmpz, /) -> fmpz: ...
7376
def lcm(self, other: ifmpz, /) -> fmpz: ...
7477
def factor(self, trial_limit: int | None = None) -> list[tuple[fmpz, int]]: ...
75-
def factor_smooth(self, bits: int = 15, proved: int = -1): ...
78+
def factor_smooth(self, bits: int = 15, proved: int = -1) -> list[tuple[fmpz, int]]: ...
7679

7780
def is_prime(self) -> bool: ...
7881
def is_probable_prime(self) -> bool: ...

src/flint/types/fmpz_mod_mpoly.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class fmpz_mod_mpoly_ctx(flint_mod_mpoly_context[fmpz_mod_mpoly, fmpz_mod, ifmpz
2525
def ordering(self) -> Ordering: ...
2626
def modulus(self) -> int: ...
2727
def gen(self, i: int, /) -> fmpz_mod_mpoly: ...
28-
def constant(self, z) -> fmpz_mod_mpoly: ...
28+
def constant(self, z: ifmpz_mod) -> fmpz_mod_mpoly: ...
2929
def from_dict(self, d: Mapping[tuple[int, ...], ifmpz_mod]) -> fmpz_mod_mpoly: ...
3030

3131

src/flint/types/fmpz_poly.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ class fmpz_poly(flint_poly[fmpz]):
1515
"""
1616

1717
@overload
18-
def __init__(self): ...
18+
def __init__(self) -> None: ...
1919
@overload
20-
def __init__(self, arg: list[ifmpz] | fmpz | fmpz_poly, /): ...
20+
def __init__(self, arg: list[ifmpz] | fmpz | fmpz_poly, /) -> None: ...
2121

2222
def __len__(self) -> int: ...
2323
def length(self) -> int: ...
2424
def degree(self) -> int: ...
2525

2626
def __getitem__(self, i: int, /) -> fmpz: ...
27-
def __setitem__(self, i: int, x: ifmpz, /): ...
27+
def __setitem__(self, i: int, x: ifmpz, /) -> None: ...
2828

2929
def repr(self) -> str: ...
3030

@@ -98,7 +98,7 @@ class fmpz_poly(flint_poly[fmpz]):
9898
def chebyshev_t(n: int, /) -> fmpz_poly: ...
9999

100100
@staticmethod
101-
def chebyshev_u(n) -> fmpz_poly: ...
101+
def chebyshev_u(n: int, /) -> fmpz_poly: ...
102102

103103
@staticmethod
104104
def swinnerton_dyer(n: int, /, use_arb: bool = True) -> fmpz_poly: ...

src/flint/types/fmpz_series.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class fmpz_series(flint_series[fmpz]):
2525
def __setitem__(self, i: int, x: ifmpz, /) -> None: ...
2626

2727
def repr(self, **kwargs: Any) -> str: ...
28-
def str(self, **kwargs) -> str: ...
28+
def str(self, **kwargs: Any) -> str: ...
2929

3030
def __pos__(self) -> fmpz_series: ...
3131
def __neg__(self) -> fmpz_series: ...

0 commit comments

Comments
 (0)