Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sympy stubs to enable CI checks #310

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions stubs/sklearn/externals/_packaging/version.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import collections
import itertools
import re
import warnings
from typing import ClassVar, Optional, Tuple, Union
from typing import Callable, ClassVar, Optional, Tuple, Union

from ._structures import (
Infinity as Infinity,
Expand Down Expand Up @@ -37,13 +33,23 @@ from ._structures import (

__all__ = ["parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"]

InfiniteTypes = ...
PrePostDevType = ...
SubLocalType = ...
LocalType = ...
CmpKey = ...
LegacyCmpKey = ...
VersionComparisonMethod = ...
InfiniteTypes = Union[InfinityType, NegativeInfinityType]
PrePostDevType = Union[InfiniteTypes, Tuple[str, int]]
SubLocalType = Union[InfiniteTypes, int, str]
LocalType = Union[
NegativeInfinityType,
Tuple[
Union[
SubLocalType,
Tuple[SubLocalType, str],
Tuple[NegativeInfinityType, SubLocalType],
],
...,
],
]
CmpKey = Tuple[int, Tuple[int, ...], PrePostDevType, PrePostDevType, PrePostDevType, LocalType]
LegacyCmpKey = Tuple[int, Tuple[str, ...]]
VersionComparisonMethod = Callable[[Union[CmpKey, LegacyCmpKey], Union[CmpKey, LegacyCmpKey]], bool]

_Version = ...

Expand Down
4 changes: 2 additions & 2 deletions stubs/sympy-stubs/algebras/quaternion.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from types import NotImplementedType
from typing import Any, Literal, Self
from typing import Any, Literal
from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.core.expr import Expr
from sympy.core.function import UndefinedFunction
from sympy.core.power import Pow
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/assumptions/assume.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from contextlib import contextmanager
from typing import Any, Callable, Generator, Self
from typing import Any, Callable, Generator
from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.logic.boolalg import Boolean
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/assumptions/cnf.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Self
from typing import Any
from typing_extensions import Self

from sympy.core.logic import And

Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/assumptions/handlers/common.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Literal, Self
from typing import Literal
from typing_extensions import Self

from sympy.assumptions import AppliedPredicate
from sympy.assumptions.predicates.common import CommutativePredicate, IsTruePredicate
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/assumptions/predicates/matrices.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import LiteralString
from typing_extensions import LiteralString

from sympy.assumptions import Predicate
from sympy.multipledispatch import Dispatcher
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/assumptions/predicates/ntheory.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import LiteralString
from typing_extensions import LiteralString

from sympy.assumptions import Predicate
from sympy.multipledispatch import Dispatcher
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/assumptions/predicates/order.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, LiteralString
from typing_extensions import LiteralString

from sympy.assumptions import Predicate
from sympy.multipledispatch import Dispatcher
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/assumptions/relation/binrel.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Optional, Self
from typing import Optional
from typing_extensions import Self

from sympy.assumptions import AppliedPredicate, Predicate
from sympy.core.basic import Basic
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/assumptions/wrapper.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Callable, Self
from typing import Callable
from typing_extensions import Self

from sympy.core.basic import Basic

Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/calculus/accumulationbounds.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from types import NotImplementedType
from typing import Self
from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.core.expr import Expr
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/categories/baseclasses.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Self
from typing import Any
from typing_extensions import Self

from sympy.core import Basic, Symbol
from sympy.sets import Set
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/codegen/ast.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Callable, Iterator, Literal, Self
from typing import Any, Callable, Iterator, Literal
from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.core.expr import Atom, Expr
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/codegen/cnodes.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Self
from typing_extensions import Self

from sympy.codegen.ast import FunctionCall, Node, String, Token
from sympy.core.basic import Basic
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/codegen/fnodes.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from ast import Attribute
from typing import Self
from typing_extensions import Self

from sympy.codegen.ast import FunctionCall, Node, String, Token, Variable
from sympy.core.basic import Basic
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/coset_table.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Self
from typing import Any
from typing_extensions import Self

from sympy.printing.defaults import DefaultPrinting

Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/fp_groups.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Callable
from typing_extensions import Unpack

from sympy.combinatorics.coset_table import CosetTable
from sympy.combinatorics.free_groups import FreeGroupElement
Expand All @@ -7,7 +8,7 @@ from sympy.printing.defaults import DefaultPrinting
from sympy.utilities import public

@public
def fp_group(fr_grp, relators=...) -> tuple[FpGroup, *tuple[Any, ...]]: ...
def fp_group(fr_grp, relators=...) -> tuple[FpGroup, Unpack[tuple[Any, ...]]]: ...
@public
def xfp_group(fr_grp, relators=...) -> tuple[FpGroup, Callable[[], Any]]: ...
@public
Expand Down
5 changes: 3 additions & 2 deletions stubs/sympy-stubs/combinatorics/free_groups.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from types import NotImplementedType
from typing import Any, Literal, Self
from typing import Any, Literal
from typing_extensions import Self, Unpack

from sympy.core.expr import Expr
from sympy.core.sympify import CantSympify
from sympy.printing.defaults import DefaultPrinting
from sympy.utilities import public

@public
def free_group(symbols) -> tuple[FreeGroup, *tuple[Any, ...]]: ...
def free_group(symbols) -> tuple[FreeGroup, Unpack[tuple[Any, ...]]]: ...
@public
def xfree_group(symbols) -> tuple[FreeGroup, Any]: ...
@public
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/graycode.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Generator, LiteralString, Self
from typing import Any, Generator
from typing_extensions import LiteralString, Self

from sympy.core import Basic

Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/partitions.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Literal, LiteralString, Self
from typing import Any, Literal
from typing_extensions import LiteralString, Self

from sympy.core import Basic
from sympy.core.function import UndefinedFunction
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/perm_groups.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Generator, Literal, Self
from typing import Any, Generator, Literal
from typing_extensions import Self

from sympy.combinatorics.fp_groups import FpGroup
from sympy.combinatorics.pc_groups import PolycyclicGroup
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/permutations.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Generator, Literal, Self
from typing import Any, Generator, Literal
from typing_extensions import Self

from sympy.combinatorics.perm_groups import Coset
from sympy.core.basic import Atom
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/polyhedron.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Self
from typing import Any
from typing_extensions import Self

from sympy.core import Basic
from sympy.sets.sets import FiniteSet
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/prufer.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Literal, Self
from typing import Any, Literal
from typing_extensions import Self

from sympy.core import Basic

Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/combinatorics/rewritingsystem_fsm.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import LiteralString
from typing_extensions import LiteralString

class State:
def __init__(self, name, state_machine, state_type=..., rh_rule=...) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/combinatorics/subsets.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from itertools import combinations
from typing import Any, Self
from typing import Any
from typing_extensions import Self

class Subset:
_rank_binary = ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/concrete/expr_with_intlimits.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Self
from typing_extensions import Self

from sympy.concrete.expr_with_limits import ExprWithLimits

Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/concrete/expr_with_limits.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Self
from typing import Any
from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.core.expr import Expr
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/concrete/products.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Self, Tuple as tTuple
from typing import Any
from typing_extensions import Self, Tuple as tTuple

from sympy.concrete.expr_with_intlimits import ExprWithIntLimits
from sympy.core.basic import Basic
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/concrete/summations.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Self, Tuple as tTuple
from typing import Any
from typing_extensions import Self, Tuple as tTuple

from sympy.concrete.expr_with_intlimits import ExprWithIntLimits
from sympy.concrete.expr_with_limits import AddWithLimits
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/add.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Literal, Self, Tuple as tTuple
from typing import Any, Literal
from typing_extensions import Self, Tuple as tTuple

from sympy.core.cache import cacheit
from sympy.core.expr import Expr
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/assumptions.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Self
from typing import Any
from typing_extensions import Self

from sympy.core.facts import FactKB

Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/basic.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Literal, Self
from typing import Any, Literal
from typing_extensions import Self

from sympy import Symbol
from sympy.core._print_helpers import Printable
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/containers.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from collections.abc import MutableSet
from types import NotImplementedType
from typing import Any, Callable, Generator, Iterator, Self
from typing import Any, Callable, Generator, Iterator
from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.core.kind import Kind
Expand Down
16 changes: 1 addition & 15 deletions stubs/sympy-stubs/core/evalf.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict as tDict,
List,
Optional,
Self,
Tuple as tTuple,
Type,
Union as tUnion,
overload,
)
from typing import Any, Callable, Dict as tDict, List, Optional, Self, Tuple as tTuple, Type, Union as tUnion, overload

from mpmath import mpc, mpf
from sympy.concrete.products import Product
Expand All @@ -27,8 +15,6 @@ from sympy.functions.elementary.integers import ceiling, floor
from sympy.functions.elementary.trigonometric import atan
from sympy.integrals.integrals import Integral

if TYPE_CHECKING:
...
LG10 = ...
rnd = ...

Expand Down
6 changes: 2 additions & 4 deletions stubs/sympy-stubs/core/expr.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import defaultdict
from typing import TYPE_CHECKING, Any, Literal, Self
from typing import Any, Literal
from typing_extensions import Self

from sympy import Derivative, Equality, Integer, Mul, Order, Pow
from sympy.core.basic import Atom, Basic
Expand All @@ -13,9 +14,6 @@ from sympy.series.formal import FormalPowerSeries
from sympy.series.fourier import FiniteFourierSeries, FourierSeries
from sympy.tensor.array.array_derivatives import ArrayDerivative

if TYPE_CHECKING:
...

@sympify_method_args
class Expr(Basic, EvalfMixin):
__slots__: tuple[str, ...] = ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/exprtools.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from types import NotImplementedType
from typing import Any, Dict, LiteralString, Tuple as tTuple
from typing import Any, Dict, Tuple as tTuple
from typing_extensions import LiteralString

from sympy import Order
from sympy.core.add import Add
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/function.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from inspect import Signature
from types import NotImplementedType
from typing import Any, Callable, Dict, Literal, Self
from typing import Any, Callable, Dict, Literal
from typing_extensions import Self

from sympy.core.basic import Basic
from sympy.core.cache import cacheit
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/kind.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Callable, Literal, LiteralString, Self
from typing import Callable, Literal
from typing_extensions import LiteralString, Self

from sympy.core.cache import cacheit

Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/logic.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, Optional, Self
from typing import Any, Optional
from typing_extensions import Self

FuzzyBool = Optional[bool]

Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/mul.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections import defaultdict
from typing import Any, Literal, Self, Tuple as tTuple
from typing import Any, Literal
from typing_extensions import Self, Tuple as tTuple

from sympy.core.cache import cacheit
from sympy.core.expr import Expr
Expand Down
4 changes: 2 additions & 2 deletions stubs/sympy-stubs/core/numbers.pyi
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from functools import lru_cache
from types import NotImplementedType
from typing import Any, Literal, Self, Tuple
from typing import Any, Literal
from typing_extensions import Self, Tuple

from sympy.core.basic import Basic
from sympy.core.cache import cacheit
from sympy.core.decorators import _sympifyit
from sympy.core.expr import AtomicExpr, Expr
from sympy.core.mul import Mul
from sympy.core.singleton import Singleton
from sympy.external.gmpy import gmpy
from sympy.series.order import Order

_LOG2 = ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/operations.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import Any, LiteralString, Self
from typing import Any
from typing_extensions import LiteralString, Self

from sympy.core.basic import Basic
from sympy.core.cache import cacheit
Expand Down
Loading
Loading