Skip to content

Commit 1ad2f78

Browse files
committed
mypy fix all operator issues
1 parent dcb5c8c commit 1ad2f78

File tree

7 files changed

+29
-17
lines changed

7 files changed

+29
-17
lines changed

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,8 @@ disable_error_code = [
133133
"misc",
134134
"name-defined",
135135
"no-redef",
136-
"operator",
137136
"override",
138137
"return",
139-
"valid-type",
138+
"valid-type", # 967 errors in 115 files
140139
"var-annotated",
141140
]

stubs/networkx/algorithms/community/quality.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
from collections.abc import Sequence
1+
from collections.abc import Callable, Sequence
22
from itertools import combinations
3+
from typing import TypeVar
34

45
from networkx import NetworkXError
56

@@ -13,7 +14,7 @@ __all__ = ["coverage", "modularity", "performance", "partition_quality"]
1314
class NotAPartition(NetworkXError):
1415
def __init__(self, G: Graph, collection): ...
1516

16-
require_partition = ...
17+
require_partition: argmap
1718

1819
def intra_community_edges(G: Graph, partition): ...
1920
def inter_community_edges(G: Graph, partition): ...

stubs/sympy-stubs/core/cache.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
from typing import Callable
1+
from typing import Callable, TypeVar
2+
3+
_CallableT = TypeVar("_CallableT", bound=Callable)
24

35
class _cache(list):
46
def print_cache(self) -> None: ...
@@ -10,8 +12,8 @@ clear_cache = ...
1012
USE_CACHE = ...
1113
scs = ...
1214
SYMPY_CACHE_SIZE = ...
13-
cacheit = ...
1415

16+
def cacheit(func: _CallableT) -> _CallableT: ...
1517
def cached_property(func) -> property: ...
1618
def lazy_function(module: str, name: str) -> Callable:
1719
class LazyFunctionMeta(type): ...

stubs/sympy-stubs/integrals/meijerint.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
from collections.abc import Callable
2+
from typing import TypeVar
3+
14
from sympy.core.basic import Basic
25
from sympy.core.symbol import Dummy
36
from sympy.functions.elementary.piecewise import Piecewise
47

8+
_CallableT = TypeVar("_CallableT", bound=Callable)
9+
510
z = ...
6-
timeit = ...
11+
12+
def timeit(func: _CallableT) -> _CallableT: ...
713

814
class _CoeffExpValueError(ValueError): ...
915

stubs/sympy-stubs/polys/domains/gaussiandomains.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ class GaussianDomain:
7676
class GaussianIntegerRing(GaussianDomain, Ring):
7777
dom = ...
7878
dtype = GaussianInteger
79-
zero = dtype(ZZ(0), ZZ(0))
80-
one = dtype(ZZ(1), ZZ(0))
81-
imag_unit = dtype(ZZ(0), ZZ(1))
79+
zero: GaussianInteger
80+
one: GaussianInteger
81+
imag_unit: GaussianInteger
8282
units = ...
8383
rep = ...
8484
is_GaussianRing = ...
@@ -95,9 +95,9 @@ class GaussianIntegerRing(GaussianDomain, Ring):
9595
class GaussianRationalField(GaussianDomain, Field):
9696
dom = ...
9797
dtype = GaussianRational
98-
zero = dtype(QQ(0), QQ(0))
99-
one = dtype(QQ(1), QQ(0))
100-
imag_unit = dtype(QQ(0), QQ(1))
98+
zero: GaussianInteger
99+
one: GaussianInteger
100+
imag_unit: GaussianInteger
101101
units = ...
102102
rep = ...
103103
is_GaussianField = ...

stubs/sympy-stubs/series/gruntz.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
from typing import Any, Literal
1+
from collections.abc import Callable
2+
from typing import Any, Literal, TypeVar
23

34
from sympy.core.basic import Basic
45
from sympy.core.cache import cacheit
56
from sympy.core.function import UndefinedFunction
67
from sympy.utilities.misc import debug_decorator as debug
78

8-
timeit = ...
9+
_CallableT = TypeVar("_CallableT", bound=Callable)
910

11+
def timeit(func: _CallableT) -> _CallableT: ...
1012
def compare(a, b, x) -> Literal["<", ">", "="]: ...
1113

1214
class SubsSet(dict):

stubs/sympy-stubs/utilities/misc.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
from typing import Any, Callable
1+
from typing import Any, Callable, TypeVar
22
from typing_extensions import LiteralString
33

4+
_CallableT = TypeVar("_CallableT", bound=Callable)
5+
46
class Undecidable(ValueError): ...
57

68
def filldedent(s, w=..., **kwargs) -> str: ...
@@ -12,7 +14,7 @@ HASH_RANDOMIZATION = ...
1214
_debug_tmp: list[str] = ...
1315
_debug_iter = ...
1416

15-
def debug_decorator(func) -> Callable[..., Any]: ...
17+
def debug_decorator(func: _CallableT) -> _CallableT: ...
1618
def debug(*args) -> None: ...
1719
def debugf(string, args) -> None: ...
1820
def find_executable(executable, path=...) -> str | None: ...

0 commit comments

Comments
 (0)