Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
if: (success() || failure()) && steps.deps.outcome == 'success'
run: |
uv run --frozen --only-group lint -- ruff check --output-format github --ignore E402,E721,E731,E741,E742,E743,F401,F402,F403,F405,F821,F841,I001,PLC0206,PLC0208,PLC1802,PLC2401,PLC3002,PLC0415,PLE0302,PLR0124,PLR0402,PLR0911,PLR0912,PLR0913,PLR0915,PLR1704,PLR1711,PLR1714,PLR1716,PLR1733,PLR1736,PLR2004,PLR5501,PLW0120,PLW0211,PLW0602,PLW0603,PLW0642,PLW1508,PLW1510,PLW1641,PLW2901,PLW3301
uv run --frozen --only-group lint -- ruff check --output-format github --preview --select E111,E115,E21,E221,E222,E225,E227,E228,E25,E271,E272,E275,E302,E303,E305,E306,E401,E502,E701,E702,E703,E71,W291,W293,W391,W605,TC src/sage/
uv run --frozen --only-group lint -- ruff check --output-format github --preview --select E111,E115,E21,E221,E222,E225,E227,E228,E25,E271,E272,E275,E302,E303,E305,E306,E401,E502,E701,E702,E703,E71,W291,W293,W391,W605,TC,UP006 src/sage/

- name: Code style check with relint
if: (success() || failure()) && steps.deps.outcome == 'success'
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ select = [
"I", # isort - https://docs.astral.sh/ruff/rules/#isort-i
"PL", # pylint - https://docs.astral.sh/ruff/rules/#pylint-pl
"TC", # flake8-type-checking - https://docs.astral.sh/ruff/rules/#flake8-type-checking-tc
"UP006", # pyupgrade -- https://docs.astral.sh/ruff/rules/#pyupgrade-up
]

[tool.ruff.lint.per-file-ignores]
Expand Down
6 changes: 3 additions & 3 deletions src/sage/misc/abstract_method.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Callable, Dict, List, Type, Union
from typing import Callable, Union

def abstract_method(f: Callable = None, optional: bool = False) -> Callable:
...
Expand All @@ -13,11 +13,11 @@ class AbstractMethod:
def _sage_src_lines_(self) -> Union[str, int]:
...

def __get__(self, instance: object, cls: Type) -> Union[Callable, NotImplementedError]:
def __get__(self, instance: object, cls: type) -> Union[Callable, NotImplementedError]:
...

def is_optional(self) -> bool:
...

def abstract_methods_of_class(cls: Type) -> Dict[str, List[str]]:
def abstract_methods_of_class(cls: type) -> dict[str, list[str]]:
...
8 changes: 4 additions & 4 deletions src/sage/misc/binary_tree.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, List
from typing import Optional

class binary_tree_node:
key: int
Expand Down Expand Up @@ -39,7 +39,7 @@ LIST_INORDER: int
LIST_KEYS: int
LIST_VALUES: int

def binary_tree_list(node: binary_tree_node, behavior: int) -> List[object]:
def binary_tree_list(node: binary_tree_node, behavior: int) -> list[object]:
...

class BinaryTree:
Expand Down Expand Up @@ -78,10 +78,10 @@ class BinaryTree:
def is_empty(self) -> bool:
...

def keys(self, order: str = 'inorder') -> List[int]:
def keys(self, order: str = 'inorder') -> list[int]:
...

def values(self, order: str = 'inorder') -> List[object]:
def values(self, order: str = 'inorder') -> list[object]:
...

def _headkey_(self) -> int:
Expand Down
3 changes: 1 addition & 2 deletions src/sage/misc/c3.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import List

def C3_algorithm(start: object, bases: str, attribute: str, proper: bool) -> List[object]:
def C3_algorithm(start: object, bases: str, attribute: str, proper: bool) -> list[object]:
...
10 changes: 5 additions & 5 deletions src/sage/misc/cachefunc.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, Tuple
from typing import Any, Callable

def dict_key(o: Any) -> Any:
...
Expand Down Expand Up @@ -45,7 +45,7 @@ class CachedMethod:
def __call__(self, inst: Any, *args: Any, **kwds: Any) -> Any:
...

def _get_instance_cache(self, inst: Any) -> Dict:
def _get_instance_cache(self, inst: Any) -> dict:
...

def __get__(self, inst: Any, cls: Any) -> Any:
Expand All @@ -60,15 +60,15 @@ class CachedInParentMethod(CachedMethod):
do_pickle: bool | None = None) -> None:
...

def _get_instance_cache(self, inst: Any) -> Dict:
def _get_instance_cache(self, inst: Any) -> dict:
...

def __get__(self, inst: Any, cls: Any) -> Any:
...

class CachedMethodCaller(CachedFunction):
def __init__(self, cachedmethod: CachedMethod, inst: Any,
cache: Dict | None = None, name: str | None = None,
cache: dict | None = None, name: str | None = None,
key: Callable | None = None,
do_pickle: bool | None = None) -> None:
...
Expand Down Expand Up @@ -113,5 +113,5 @@ class CachedMethodCallerNoArgs(CachedFunction):
...

class GloballyCachedMethodCaller(CachedMethodCaller):
def get_key_args_kwds(self, args: Tuple, kwds: Dict) -> Any:
def get_key_args_kwds(self, args: tuple, kwds: dict) -> Any:
...
3 changes: 1 addition & 2 deletions src/sage/misc/citation.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import List

def get_systems(cmd: str) -> List[str]:
def get_systems(cmd: str) -> list[str]:
...

def cython_profile_enabled() -> bool:
Expand Down
6 changes: 3 additions & 3 deletions src/sage/rings/abc.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Type, Union, Callable, Dict, List
from typing import Union, Callable

def abc(f: Callable = None, optional: bool = False) -> Callable:
...
Expand All @@ -13,11 +13,11 @@ class ABC:
def _sage_src_lines_(self) -> Union[str, int]:
...

def __get__(self, instance: object, cls: Type) -> Union[Callable, NotImplementedError]:
def __get__(self, instance: object, cls: type) -> Union[Callable, NotImplementedError]:
...

def is_optional(self) -> bool:
...

def abstract_methods_of_class(cls: Type) -> Dict[str, List[str]]:
def abstract_methods_of_class(cls: type) -> dict[str, list[str]]:
...
5 changes: 2 additions & 3 deletions src/sage/rings/bernoulli_mod_p.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import List

def verify_bernoulli_mod_p(data: List[int]) -> bool:
def verify_bernoulli_mod_p(data: list[int]) -> bool:
...

def bernoulli_mod_p(p: int) -> List[int]:
def bernoulli_mod_p(p: int) -> list[int]:
...

def bernoulli_mod_p_single(p: int, k: int) -> int:
Expand Down
5 changes: 2 additions & 3 deletions src/sage/rings/factorint.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from typing import List, Tuple

def aurifeuillian(n: int, m: int, F: int = None, check: bool = True) -> List[int]:
def aurifeuillian(n: int, m: int, F: int = None, check: bool = True) -> list[int]:
...

def factor_aurifeuillian(n: int, check: bool = True) -> List[int]:
def factor_aurifeuillian(n: int, check: bool = True) -> list[int]:
...

def factor_cunningham(m: int, proof: bool = None) -> int:
Expand Down
3 changes: 1 addition & 2 deletions src/sage/rings/factorint_flint.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import List, Tuple

def factor_using_flint(n: int) -> List[Tuple[int, int]]:
def factor_using_flint(n: int) -> list[tuple[int, int]]:
...
4 changes: 2 additions & 2 deletions src/sage/rings/factorint_pari.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Tuple, Union
from typing import Union

def factor_using_pari(n: Union[int, Integer], int_: bool = False, debug_level: int = 0, proof: bool = None) -> List[Tuple[Union[int, Integer], int]]:
def factor_using_pari(n: Union[int, Integer], int_: bool = False, debug_level: int = 0, proof: bool = None) -> list[tuple[Union[int, Integer], int]]:
...
19 changes: 9 additions & 10 deletions src/sage/rings/fast_arith.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import List, Tuple

def prime_range(start: int, stop: int = None, algorithm: str = None, py_ints: bool = False) -> List[int]:
def prime_range(start: int, stop: int = None, algorithm: str = None, py_ints: bool = False) -> list[int]:
...

class arith_int:
Expand All @@ -16,10 +15,10 @@ class arith_int:
def gcd_int(self, a: int, b: int) -> int:
...

def c_xgcd_int(self, a: int, b: int) -> Tuple[int, int, int]:
def c_xgcd_int(self, a: int, b: int) -> tuple[int, int, int]:
...

def xgcd_int(self, a: int, b: int) -> Tuple[int, int, int]:
def xgcd_int(self, a: int, b: int) -> tuple[int, int, int]:
...

def c_inverse_mod_int(self, a: int, m: int) -> int:
Expand All @@ -28,10 +27,10 @@ class arith_int:
def inverse_mod_int(self, a: int, m: int) -> int:
...

def c_rational_recon_int(self, a: int, m: int) -> Tuple[int, int]:
def c_rational_recon_int(self, a: int, m: int) -> tuple[int, int]:
...

def rational_recon_int(self, a: int, m: int) -> Tuple[int, int]:
def rational_recon_int(self, a: int, m: int) -> tuple[int, int]:
...

class arith_llong:
Expand All @@ -47,10 +46,10 @@ class arith_llong:
def gcd_longlong(self, a: int, b: int) -> int:
...

def c_xgcd_longlong(self, a: int, b: int) -> Tuple[int, int, int]:
def c_xgcd_longlong(self, a: int, b: int) -> tuple[int, int, int]:
...

def xgcd_longlong(self, a: int, b: int) -> Tuple[int, int, int]:
def xgcd_longlong(self, a: int, b: int) -> tuple[int, int, int]:
...

def c_inverse_mod_longlong(self, a: int, m: int) -> int:
Expand All @@ -59,8 +58,8 @@ class arith_llong:
def inverse_mod_longlong(self, a: int, m: int) -> int:
...

def c_rational_recon_longlong(self, a: int, m: int) -> Tuple[int, int]:
def c_rational_recon_longlong(self, a: int, m: int) -> tuple[int, int]:
...

def rational_recon_longlong(self, a: int, m: int) -> Tuple[int, int]:
def rational_recon_longlong(self, a: int, m: int) -> tuple[int, int]:
...
30 changes: 15 additions & 15 deletions src/sage/rings/fraction_field_FpT.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, Tuple, Union
from typing import Any

def is_FpTElement(x: Any) -> bool:
...
Expand Down Expand Up @@ -33,7 +33,7 @@ class FpTElement:
def __call__(self, *args: Any, **kwds: Any) -> 'FpTElement':
...

def subs(self, in_dict: Dict = None, *args: Any, **kwds: Any) -> 'FpTElement':
def subs(self, in_dict: dict = None, *args: Any, **kwds: Any) -> 'FpTElement':
...

def valuation(self, v: Any) -> int:
Expand Down Expand Up @@ -126,16 +126,16 @@ class Polyring_FpT_coerce:
def __init__(self, R: Any) -> None:
...

def _extra_slots(self) -> Dict:
def _extra_slots(self) -> dict:
...

def _update_slots(self, _slots: Dict) -> None:
def _update_slots(self, _slots: dict) -> None:
...

def _call_(self, _x: Any) -> FpTElement:
...

def _call_with_args(self, _x: Any, args: Tuple = (), kwds: Dict = {}) -> FpTElement:
def _call_with_args(self, _x: Any, args: tuple = (), kwds: dict = {}) -> FpTElement:
...

def section(self) -> 'FpT_Polyring_section':
Expand All @@ -147,10 +147,10 @@ class FpT_Polyring_section:
def __init__(self, f: Polyring_FpT_coerce) -> None:
...

def _extra_slots(self) -> Dict:
def _extra_slots(self) -> dict:
...

def _update_slots(self, _slots: Dict) -> None:
def _update_slots(self, _slots: dict) -> None:
...

def _call_(self, _x: Any) -> Any:
Expand All @@ -162,16 +162,16 @@ class Fp_FpT_coerce:
def __init__(self, R: Any) -> None:
...

def _extra_slots(self) -> Dict:
def _extra_slots(self) -> dict:
...

def _update_slots(self, _slots: Dict) -> None:
def _update_slots(self, _slots: dict) -> None:
...

def _call_(self, _x: Any) -> FpTElement:
...

def _call_with_args(self, _x: Any, args: Tuple = (), kwds: Dict = {}) -> FpTElement:
def _call_with_args(self, _x: Any, args: tuple = (), kwds: dict = {}) -> FpTElement:
...

def section(self) -> 'FpT_Fp_section':
Expand All @@ -183,10 +183,10 @@ class FpT_Fp_section:
def __init__(self, f: Fp_FpT_coerce) -> None:
...

def _extra_slots(self) -> Dict:
def _extra_slots(self) -> dict:
...

def _update_slots(self, _slots: Dict) -> None:
def _update_slots(self, _slots: dict) -> None:
...

def _call_(self, _x: Any) -> Any:
Expand All @@ -198,16 +198,16 @@ class ZZ_FpT_coerce:
def __init__(self, R: Any) -> None:
...

def _extra_slots(self) -> Dict:
def _extra_slots(self) -> dict:
...

def _update_slots(self, _slots: Dict) -> None:
def _update_slots(self, _slots: dict) -> None:
...

def _call_(self, _x: Any) -> FpTElement:
...

def _call_with_args(self, _x: Any, args: Tuple = (), kwds: Dict = {}) -> FpTElement:
def _call_with_args(self, _x: Any, args: tuple = (), kwds: dict = {}) -> FpTElement:
...

def section(self) -> Any:
Expand Down
10 changes: 5 additions & 5 deletions src/sage/rings/fraction_field_element.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, Dict, Tuple, Union
from typing import Any, Union

def is_FractionFieldElement(x: Any) -> bool:
...
Expand Down Expand Up @@ -26,7 +26,7 @@ class FractionFieldElement:
def denominator(self) -> Any:
...

def is_square(self, root: bool = False) -> Union[bool, Tuple[bool, Any]]:
def is_square(self, root: bool = False) -> Union[bool, tuple[bool, Any]]:
...

def nth_root(self, n: int) -> 'FractionFieldElement':
Expand All @@ -38,7 +38,7 @@ class FractionFieldElement:
def __call__(self, *x: Any, **kwds: Any) -> 'FractionFieldElement':
...

def subs(self, in_dict: Dict = None, *args: Any, **kwds: Any) -> 'FractionFieldElement':
def subs(self, in_dict: dict = None, *args: Any, **kwds: Any) -> 'FractionFieldElement':
...

def _is_atomic(self) -> bool:
Expand Down Expand Up @@ -107,7 +107,7 @@ class FractionFieldElement:
def _symbolic_(self, ring: Any) -> 'FractionFieldElement':
...

def __reduce__(self) -> Tuple:
def __reduce__(self) -> tuple:
...

def _evaluate_polynomial(self, pol: Any) -> 'FractionFieldElement':
Expand Down Expand Up @@ -135,5 +135,5 @@ class FractionFieldElement_1poly_field(FractionFieldElement):
def make_element(parent: Any, numerator: Any, denominator: Any) -> FractionFieldElement:
...

def make_element_old(parent: Any, cdict: Dict) -> FractionFieldElement:
def make_element_old(parent: Any, cdict: dict) -> FractionFieldElement:
...
6 changes: 3 additions & 3 deletions src/sage/rings/function_field/element.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any, List
from typing import Any
from sage.structure.element import FieldElement

class FunctionFieldElement(FieldElement):
Expand Down Expand Up @@ -59,10 +59,10 @@ class FunctionFieldElement(FieldElement):
def divisor_of_poles(self) -> Any:
...

def zeros(self) -> List[Any]:
def zeros(self) -> list[Any]:
...

def poles(self) -> List[Any]:
def poles(self) -> list[Any]:
...

def valuation(self, place: Any) -> int:
Expand Down
Loading
Loading