From 3f23cf82e20d7b4ab15fa617eb1758a5241bb6ad Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 5 May 2025 15:36:41 -0400 Subject: [PATCH 1/2] Fix pyright 1.1.400 typing issues --- stubs/sympy-stubs/polys/domains/algebraicfield.pyi | 4 ++-- stubs/sympy-stubs/polys/domains/expressiondomain.pyi | 2 +- stubs/sympy-stubs/polys/domains/integerring.pyi | 8 ++++---- stubs/sympy-stubs/polys/domains/old_fractionfield.pyi | 4 ++-- .../sympy-stubs/polys/domains/old_polynomialring.pyi | 2 +- stubs/sympy-stubs/polys/domains/rationalfield.pyi | 11 ++++++----- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/stubs/sympy-stubs/polys/domains/algebraicfield.pyi b/stubs/sympy-stubs/polys/domains/algebraicfield.pyi index a0e13fc0..124add8f 100644 --- a/stubs/sympy-stubs/polys/domains/algebraicfield.pyi +++ b/stubs/sympy-stubs/polys/domains/algebraicfield.pyi @@ -15,7 +15,7 @@ class AlgebraicField(Field, CharacteristicZero, SimpleDomain): 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 +40,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..26fcdf46 100644 --- a/stubs/sympy-stubs/polys/domains/expressiondomain.pyi +++ b/stubs/sympy-stubs/polys/domains/expressiondomain.pyi @@ -47,7 +47,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..70e8ce53 100644 --- a/stubs/sympy-stubs/polys/domains/integerring.pyi +++ b/stubs/sympy-stubs/polys/domains/integerring.pyi @@ -11,9 +11,9 @@ class IntegerRing(Ring, CharacteristicZero, SimpleDomain): # type: ignore rep = ... alias = ... dtype = MPZ - zero = dtype(0) - one = dtype(1) - tp: type[dtype] + zero = ... + one = ... + tp: type is_ZZ = ... is_Numerical = ... is_PID = ... @@ -25,7 +25,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): ... 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..7c5c8fa0 100644 --- a/stubs/sympy-stubs/polys/domains/old_fractionfield.pyi +++ b/stubs/sympy-stubs/polys/domains/old_fractionfield.pyi @@ -11,7 +11,7 @@ class FractionField(Field, CharacteristicZero, CompositeDomain): 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 +33,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..dc422c93 100644 --- a/stubs/sympy-stubs/polys/domains/old_polynomialring.pyi +++ b/stubs/sympy-stubs/polys/domains/old_polynomialring.pyi @@ -50,7 +50,7 @@ class GlobalPolynomialRing(PolynomialRingBase): 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..51978ffd 100644 --- a/stubs/sympy-stubs/polys/domains/rationalfield.pyi +++ b/stubs/sympy-stubs/polys/domains/rationalfield.pyi @@ -1,3 +1,4 @@ +from _typeshed import Incomplete from types import NotImplementedType from typing import Any from typing_extensions import Self @@ -17,9 +18,9 @@ class RationalField(Field, CharacteristicZero, SimpleDomain): has_assoc_Ring = ... has_assoc_Field = ... dtype = MPQ - zero = dtype(0) - one = dtype(1) - tp: type[dtype] + zero = ... + one = ... + tp: type def __init__(self) -> None: ... def get_ring(self) -> Any: ... def to_sympy(self, a) -> Rational | Integer: ... @@ -36,8 +37,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): ... + def div(self, a, b) -> tuple[NotImplementedType | Self, Incomplete]: ... def numer(self, a): ... def denom(self, a): ... From 29a3af0579a6b3deb88f604a7877641bc14dd258 Mon Sep 17 00:00:00 2001 From: Avasam Date: Mon, 5 May 2025 15:40:42 -0400 Subject: [PATCH 2/2] Fix pyright 1.1.400 `reportInvalidTypeForm` issues --- stubs/sympy-stubs/polys/domains/integerring.pyi | 4 ++-- stubs/sympy-stubs/polys/domains/rationalfield.pyi | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/stubs/sympy-stubs/polys/domains/integerring.pyi b/stubs/sympy-stubs/polys/domains/integerring.pyi index 70e8ce53..197e6db1 100644 --- a/stubs/sympy-stubs/polys/domains/integerring.pyi +++ b/stubs/sympy-stubs/polys/domains/integerring.pyi @@ -11,8 +11,8 @@ class IntegerRing(Ring, CharacteristicZero, SimpleDomain): # type: ignore rep = ... alias = ... dtype = MPZ - zero = ... - one = ... + zero = MPZ(0) + one = MPZ(1) tp: type is_ZZ = ... is_Numerical = ... diff --git a/stubs/sympy-stubs/polys/domains/rationalfield.pyi b/stubs/sympy-stubs/polys/domains/rationalfield.pyi index 51978ffd..01d6b784 100644 --- a/stubs/sympy-stubs/polys/domains/rationalfield.pyi +++ b/stubs/sympy-stubs/polys/domains/rationalfield.pyi @@ -18,8 +18,8 @@ class RationalField(Field, CharacteristicZero, SimpleDomain): has_assoc_Ring = ... has_assoc_Field = ... dtype = MPQ - zero = ... - one = ... + zero = MPQ(0) + one = MPQ(1) tp: type def __init__(self) -> None: ... def get_ring(self) -> Any: ...