From c85be6cbd48dfae40ad8ec5ae3636cf3635d7a6a Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Mon, 5 May 2025 12:34:59 -0700 Subject: [PATCH] Fix reportInvalidTypeForm diags in sympy --- stubs/sympy-stubs/polys/domains/algebraicfield.pyi | 5 ++--- stubs/sympy-stubs/polys/domains/expressiondomain.pyi | 3 +-- stubs/sympy-stubs/polys/domains/integerring.pyi | 9 ++++----- stubs/sympy-stubs/polys/domains/old_fractionfield.pyi | 5 ++--- .../sympy-stubs/polys/domains/old_polynomialring.pyi | 4 +--- stubs/sympy-stubs/polys/domains/rationalfield.pyi | 11 +++++------ 6 files changed, 15 insertions(+), 22 deletions(-) diff --git a/stubs/sympy-stubs/polys/domains/algebraicfield.pyi b/stubs/sympy-stubs/polys/domains/algebraicfield.pyi index a0e13fc0..d9e0f9fa 100644 --- a/stubs/sympy-stubs/polys/domains/algebraicfield.pyi +++ b/stubs/sympy-stubs/polys/domains/algebraicfield.pyi @@ -9,13 +9,12 @@ from sympy.utilities import public @public class AlgebraicField(Field, CharacteristicZero, SimpleDomain): - dtype = ANP is_Algebraic = ... is_Numerical = ... has_assoc_Ring = ... has_assoc_Field = ... def __init__(self, dom, *ext, alias=...) -> None: ... - def new(self, element) -> dtype: ... + def new(self, element) -> ANP: ... def __hash__(self) -> int: ... def __eq__(self, other) -> bool: ... def algebraic_field(self, *extension, alias=...) -> Any: ... @@ -40,7 +39,7 @@ class AlgebraicField(Field, CharacteristicZero, SimpleDomain): def from_GaussianIntegerRing(K1, a, K0): ... def from_GaussianRationalField(K1, a, K0): ... def maximal_order(self) -> Any | None: ... - def integral_basis(self, fmt=...) -> list[Any | Order] | list[Any] | list[dtype]: ... + def integral_basis(self, fmt=...) -> list[Any | Order] | list[Any] | list[ANP]: ... def discriminant(self) -> Any | None: ... def primes_above(self, p) -> Any: ... def galois_group(self, by_name=..., max_tries=..., randomize=...) -> Any: ... diff --git a/stubs/sympy-stubs/polys/domains/expressiondomain.pyi b/stubs/sympy-stubs/polys/domains/expressiondomain.pyi index 3ac0e8c7..fc78ca25 100644 --- a/stubs/sympy-stubs/polys/domains/expressiondomain.pyi +++ b/stubs/sympy-stubs/polys/domains/expressiondomain.pyi @@ -39,7 +39,6 @@ class ExpressionDomain(Field, CharacteristicZero, SimpleDomain): def gcd(f, g) -> Self: ... def lcm(f, g) -> Self: ... - dtype = Expression zero = ... one = ... rep = ... @@ -47,7 +46,7 @@ class ExpressionDomain(Field, CharacteristicZero, SimpleDomain): has_assoc_Field = ... def __init__(self) -> None: ... def to_sympy(self, a): ... - def from_sympy(self, a) -> dtype: ... + def from_sympy(self, a) -> Expression: ... def from_ZZ(K1, a, K0): ... def from_ZZ_python(K1, a, K0): ... def from_QQ(K1, a, K0): ... diff --git a/stubs/sympy-stubs/polys/domains/integerring.pyi b/stubs/sympy-stubs/polys/domains/integerring.pyi index 49330afa..0c9a7b3e 100644 --- a/stubs/sympy-stubs/polys/domains/integerring.pyi +++ b/stubs/sympy-stubs/polys/domains/integerring.pyi @@ -10,10 +10,9 @@ from sympy.utilities import public class IntegerRing(Ring, CharacteristicZero, SimpleDomain): # type: ignore rep = ... alias = ... - dtype = MPZ - zero = dtype(0) - one = dtype(1) - tp: type[dtype] + zero = MPZ(0) + one = MPZ(1) + tp: type[MPZ] is_ZZ = ... is_Numerical = ... is_PID = ... @@ -25,7 +24,7 @@ class IntegerRing(Ring, CharacteristicZero, SimpleDomain): # type: ignore def get_field(self) -> Any: ... def algebraic_field(self, *extension, alias=...) -> Any: ... def from_AlgebraicField(K1, a, K0) -> None: ... - def log(self, a, b) -> dtype: ... + def log(self, a, b) -> MPZ: ... def from_FF(K1, a, K0) -> int: ... def from_FF_python(K1, a, K0) -> int: ... def from_ZZ(K1, a, K0) -> int: ... diff --git a/stubs/sympy-stubs/polys/domains/old_fractionfield.pyi b/stubs/sympy-stubs/polys/domains/old_fractionfield.pyi index 8a85a77d..096695a6 100644 --- a/stubs/sympy-stubs/polys/domains/old_fractionfield.pyi +++ b/stubs/sympy-stubs/polys/domains/old_fractionfield.pyi @@ -6,12 +6,11 @@ from sympy.polys.domains.field import Field from sympy.polys.polyclasses import DMF class FractionField(Field, CharacteristicZero, CompositeDomain): - dtype = DMF is_Frac = ... has_assoc_Ring = ... has_assoc_Field = ... def __init__(self, dom, *gens) -> None: ... - def new(self, element) -> dtype: ... + def new(self, element) -> DMF: ... def __hash__(self) -> int: ... def __eq__(self, other) -> bool: ... def to_sympy(self, a): ... @@ -33,4 +32,4 @@ class FractionField(Field, CharacteristicZero, CompositeDomain): def is_nonnegative(self, a): ... def numer(self, a): ... def denom(self, a): ... - def factorial(self, a) -> dtype: ... + def factorial(self, a) -> DMF: ... diff --git a/stubs/sympy-stubs/polys/domains/old_polynomialring.pyi b/stubs/sympy-stubs/polys/domains/old_polynomialring.pyi index 54201867..6d28cae6 100644 --- a/stubs/sympy-stubs/polys/domains/old_polynomialring.pyi +++ b/stubs/sympy-stubs/polys/domains/old_polynomialring.pyi @@ -39,7 +39,6 @@ class PolynomialRingBase(Ring, CharacteristicZero, CompositeDomain): @public class GlobalPolynomialRing(PolynomialRingBase): is_Poly = ... - dtype = DMP def from_FractionField(K1, a, K0) -> None: ... def to_sympy(self, a) -> Order: ... def from_sympy(self, a): ... @@ -49,8 +48,7 @@ class GlobalPolynomialRing(PolynomialRingBase): def is_nonnegative(self, a): ... class GeneralizedPolynomialRing(PolynomialRingBase): - dtype = DMF - def new(self, a) -> dtype: ... + def new(self, a) -> DMF: ... def __contains__(self, a) -> Literal[False]: ... def from_FractionField(K1, a, K0): ... def to_sympy(self, a): ... diff --git a/stubs/sympy-stubs/polys/domains/rationalfield.pyi b/stubs/sympy-stubs/polys/domains/rationalfield.pyi index 0832bc6b..aef328a4 100644 --- a/stubs/sympy-stubs/polys/domains/rationalfield.pyi +++ b/stubs/sympy-stubs/polys/domains/rationalfield.pyi @@ -16,10 +16,9 @@ class RationalField(Field, CharacteristicZero, SimpleDomain): is_Numerical = ... has_assoc_Ring = ... has_assoc_Field = ... - dtype = MPQ - zero = dtype(0) - one = dtype(1) - tp: type[dtype] + zero = MPQ(0) + one = MPQ(1) + tp: type[MPQ] def __init__(self) -> None: ... def get_ring(self) -> Any: ... def to_sympy(self, a) -> Rational | Integer: ... @@ -36,8 +35,8 @@ class RationalField(Field, CharacteristicZero, SimpleDomain): def from_RealField(K1, a, K0) -> PythonMPQ: ... def exquo(self, a, b) -> NotImplementedType | Self: ... def quo(self, a, b) -> NotImplementedType | Self: ... - def rem(self, a, b) -> dtype: ... - def div(self, a, b) -> tuple[NotImplementedType | Self, dtype]: ... + def rem(self, a, b) -> MPQ: ... + def div(self, a, b) -> tuple[NotImplementedType | Self, MPQ]: ... def numer(self, a): ... def denom(self, a): ...