diff --git a/pyproject.toml b/pyproject.toml index 42a5b3a8..00fdee31 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,6 @@ ignore = [ "F401", # TODO: Investigate and fix or configure - "PYI024", "PYI048", "PYI051", # Request for autofix: https://github.com/astral-sh/ruff/issues/14185 ] diff --git a/stubs/matplotlib/dviread.pyi b/stubs/matplotlib/dviread.pyi index 92d7d3e1..52a164d5 100644 --- a/stubs/matplotlib/dviread.pyi +++ b/stubs/matplotlib/dviread.pyi @@ -1,5 +1,7 @@ +from _typeshed import Incomplete from collections import namedtuple from functools import lru_cache +from typing import NamedTuple from ._typing import * from .path import Path @@ -7,7 +9,12 @@ from .path import Path Page = ... Box = ... -class Text(namedtuple("Text", "x y font glyph width")): +class Text(NamedTuple): + x: float + y: float + font: Incomplete + glyph: Incomplete + width: int @property def font_path(self) -> Path: ... @property diff --git a/stubs/sklearn/gaussian_process/kernels.pyi b/stubs/sklearn/gaussian_process/kernels.pyi index 1951b54e..8fe96e5e 100644 --- a/stubs/sklearn/gaussian_process/kernels.pyi +++ b/stubs/sklearn/gaussian_process/kernels.pyi @@ -1,10 +1,9 @@ import math import warnings from abc import ABCMeta, abstractmethod -from collections import namedtuple from collections.abc import Sequence from inspect import signature as signature -from typing import Callable, Literal +from typing import Callable, Literal, NamedTuple from typing_extensions import Self import numpy as np @@ -17,12 +16,12 @@ from ..base import clone as clone from ..exceptions import ConvergenceWarning as ConvergenceWarning from ..metrics.pairwise import pairwise_kernels as pairwise_kernels -class Hyperparameter(namedtuple("Hyperparameter", ("name", "value_type", "bounds", "n_elements", "fixed"))): - fixed: bool = ... - n_elements: int = ... - bounds: tuple[float, float] | str = ... - value_type: str = ... - name: str = ... +class Hyperparameter(NamedTuple): + fixed: bool + n_elements: int + bounds: tuple[float, float] | str + value_type: str + name: str # A raw namedtuple is very memory efficient as it packs the attributes # in a struct to get rid of the __dict__ of attributes in particular it diff --git a/stubs/sympy-stubs/testing/runtests.pyi b/stubs/sympy-stubs/testing/runtests.pyi index 5aac660e..c64ddc9d 100644 --- a/stubs/sympy-stubs/testing/runtests.pyi +++ b/stubs/sympy-stubs/testing/runtests.pyi @@ -3,7 +3,7 @@ from collections import namedtuple from collections.abc import Generator from contextlib import contextmanager from doctest import DocTestFinder, DocTestRunner -from typing import Any, Literal +from typing import Any, Literal, NamedTuple IS_WINDOWS = ... ON_CI = ... @@ -32,7 +32,9 @@ sp = ... def split_list(l, split, density=...): ... -SymPyTestResults = namedtuple("SymPyTestResults", "failed attempted") +class SymPyTestResults(NamedTuple): + failed: int + attempted: int def sympytestfile( filename,