Skip to content

Commit

Permalink
Fix all reportAttributeAccessIssue (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Nov 7, 2024
1 parent 431162b commit c7c8e26
Show file tree
Hide file tree
Showing 30 changed files with 556 additions and 50 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ reportUnsupportedDunderAll = "error"

# Error reports to fix in code
reportAssertTypeFailure = "none" # TODO
reportAttributeAccessIssue = "none" # TODO
reportGeneralTypeIssues = "none" # TODO

[tool.mypy]
Expand Down
3 changes: 1 addition & 2 deletions stubs/matplotlib/_mathtext.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ from sre_parse import State
from tkinter.tix import HList
from typing import Literal

from matplotlib.mathtext import MathtextBackend

from .font_manager import FontProperties
from .mathtext import MathtextBackend

def get_unicode_index(symbol: str, math: bool = True) -> int: ...

Expand Down
18 changes: 9 additions & 9 deletions stubs/matplotlib/axes/_axes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ from matplotlib.artist import Artist
from matplotlib.axes._secondary_axes import SecondaryAxis
from matplotlib.axis import XAxis, YAxis
from matplotlib.backend_tools import Cursors
from matplotlib.collections import (
BrokenBarHCollection,
Collection,
EventCollection,
LineCollection,
PathCollection,
PolyCollection,
QuadMesh,
)
from matplotlib.colors import Colormap, Normalize
from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
from matplotlib.contour import QuadContourSet
Expand All @@ -34,6 +25,15 @@ from matplotlib.text import Annotation, Text
from matplotlib.ticker import Formatter
from matplotlib.transforms import Bbox, BboxTransformTo, Transform

from ..collections import (
BrokenBarHCollection,
Collection,
EventCollection,
LineCollection,
PathCollection,
PolyCollection,
QuadMesh,
)
from ._base import _AxesBase

class Axes(_AxesBase):
Expand Down
9 changes: 5 additions & 4 deletions stubs/matplotlib/backends/_backend_tk.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import tkinter as tk
from typing import Literal, Sequence

from matplotlib import backend_tools
from matplotlib._api import classproperty
from matplotlib._typing import *
from matplotlib.backend_bases import (
Expand All @@ -13,6 +12,8 @@ from matplotlib.backend_bases import (
_Backend,
)

from .. import backend_tools

backend_version: float = ...
cursord: dict[backend_tools.Cursors, str] = ...

Expand Down Expand Up @@ -50,8 +51,8 @@ class FigureCanvasTk(FigureCanvasBase):
class FigureManagerTk(FigureManagerBase):
canvas: FigureCanvasBase
num: int | str
toolbar: tk.Toolbar
window: tk.Window
toolbar: NavigationToolbar2
window: tk.Tk

def __init__(self, canvas, num, window) -> None: ...
@classmethod
Expand All @@ -64,7 +65,7 @@ class FigureManagerTk(FigureManagerBase):
def full_screen_toggle(self) -> None: ...

class NavigationToolbar2Tk(NavigationToolbar2, tk.Frame):
window: tk.Window = ...
window: tk.Tk = ...
def __init__(self, canvas: FigureCanvasBase, window=..., *, pack_toolbar: bool = True) -> None: ...
def pan(self, *args) -> None: ...
def zoom(self, *args) -> None: ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/matplotlib/backends/backend_gtk3.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ from typing import Callable, Type

# PyGObject is not easily installable on Windows, let tests pass as-is
from gi.repository import Gtk # pyright: ignore[reportMissingImports]
from matplotlib import backend_tools
from matplotlib._api import classproperty
from matplotlib.backend_bases import FigureCanvasBase, ToolContainerBase

from .. import backend_tools
from ._backend_gtk import TimerGTK as TimerGTK3, _BackendGTK, _FigureManagerGTK, _NavigationToolbar2GTK

class __getattr__:
Expand Down
7 changes: 3 additions & 4 deletions stubs/matplotlib/backends/backend_qt.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from typing import Any, Type

from matplotlib import backend_tools
from matplotlib._api import classproperty
from matplotlib.backend_bases import (
FigureCanvasBase,
Expand All @@ -11,15 +10,15 @@ from matplotlib.backend_bases import (
ToolContainerBase,
_Backend,
)
from matplotlib.backend_tools import Cursors
from matplotlib.transforms import Bbox

from .. import backend_tools
from .qt_compat import QtCore, QtWidgets

backend_version = ...
SPECIAL_KEYS: dict = ...

cursord: dict[Cursors, Any] = ...
cursord: dict[backend_tools.Cursors, Any] = ...

class __getattr__:
qApp = ...
Expand All @@ -36,7 +35,7 @@ class FigureCanvasQT(QtWidgets.QWidget, FigureCanvasBase):

def __init__(self, figure=...) -> None: ...
def showEvent(self, event) -> None: ...
def set_cursor(self, cursor: Cursors) -> None: ...
def set_cursor(self, cursor: backend_tools.Cursors) -> None: ...
def enterEvent(self, event) -> None: ...
def leaveEvent(self, event) -> None: ...
def mouseEventCoords(self, pos) -> tuple[float, float]: ...
Expand Down
6 changes: 6 additions & 0 deletions stubs/matplotlib/backends/qt_compat.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
from typing import Any, TypeAlias

QT_API_PYQT6: str = ...
QT_API_PYSIDE6: str = ...
QT_API_PYQT5: str = ...
QT_API_PYSIDE2: str = ...
QT_API_ENV: str = ...

__version__: str
QtCore: TypeAlias = Any
QtWidgets: Any
4 changes: 0 additions & 4 deletions stubs/matplotlib/widgets.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ from numpy import float64, ndarray
from numpy.typing import ArrayLike
from PIL.Image import Image

from . import _api, _docstring, backend_tools, cbook, colors, ticker, transforms
from ._typing import Color
from .artist import Artist
from .lines import Line2D
Expand Down Expand Up @@ -374,9 +373,6 @@ class LassoSelector(_SelectorWidget):
props: Mapping | None = None,
button: MouseButton | Sequence[MouseButton] | None = None,
): ...
@_api.deprecated("3.5", alternative="press")
def onpress(self, event): ...
def onrelease(self, event): ...

class PolygonSelector(_SelectorWidget):
def __init__(
Expand Down
2 changes: 0 additions & 2 deletions stubs/sklearn/_build_utils/pre_build_helpers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ import sys
import tempfile
import textwrap

from setuptools.command.build_ext import customize_compiler as customize_compiler, new_compiler as new_compiler

def compile_test_program(code, extra_preargs: list = [], extra_postargs: list = []): ...
def basic_check_build(): ...
1 change: 0 additions & 1 deletion stubs/sklearn/cross_decomposition/_pls.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from numbers import Integral as Integral, Real as Real
from typing import ClassVar, Literal, TypeVar

from numpy import ndarray
from scipy.linalg import pinv as pinv2, pinv2 as pinv2, svd

from .._typing import ArrayLike, Float, Int, MatrixLike
from ..base import BaseEstimator, ClassNamePrefixFeaturesOutMixin, MultiOutputMixin, RegressorMixin, TransformerMixin
Expand Down
5 changes: 4 additions & 1 deletion stubs/sklearn/utils/fixes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import sklearn
import threadpoolctl
from numpy import percentile as percentile
from scipy.linalg import eigh as _eigh
from scipy.optimize.linesearch import line_search_wolfe1 as line_search_wolfe1, line_search_wolfe2 as line_search_wolfe2
from scipy.optimize._linesearch import ( # explicitly re-exported
line_search_wolfe1 as line_search_wolfe1,
line_search_wolfe2 as line_search_wolfe2,
)
from threadpoolctl import _ThreadpoolLimiter

from ..externals._lobpcg import lobpcg as lobpcg
Expand Down
1 change: 0 additions & 1 deletion stubs/sklearn/utils/optimize.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import warnings
import numpy as np

from ..exceptions import ConvergenceWarning as ConvergenceWarning
from .fixes import line_search_wolfe1 as line_search_wolfe1, line_search_wolfe2 as line_search_wolfe2

# This is a modified file from scipy.optimize
# Original authors: Travis Oliphant, Eric Jones
Expand Down
1 change: 0 additions & 1 deletion stubs/sklearn/utils/validation.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ from numpy import ndarray
from numpy.core.numeric import ComplexWarning as ComplexWarning
from numpy.random.mtrand import RandomState
from pandas import DataFrame
from pandas.api.types import is_sparse as is_sparse
from scipy.sparse import spmatrix
from scipy.sparse._coo import coo_matrix

Expand Down
2 changes: 1 addition & 1 deletion stubs/sympy-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ from sympy.core import (
seterr,
symbols,
sympify,
trailing,
use,
var,
vectorize,
Expand Down Expand Up @@ -526,7 +527,6 @@ from sympy.ntheory import (
sqrt_mod,
sqrt_mod_iter,
totient,
trailing,
)
from sympy.parsing import parse_expr
from sympy.plotting import plot, plot_backends, plot_implicit, plot_parametric, textplot
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ from sympy.core.function import (
expand_trig,
nfloat,
)
from sympy.core.intfunc import integer_log, integer_nthroot
from sympy.core.kind import BooleanKind, NumberKind, UndefinedKind
from sympy.core.mod import Mod
from sympy.core.mul import Mul, prod
Expand All @@ -53,7 +54,7 @@ from sympy.core.numbers import (
zoo,
)
from sympy.core.parameters import evaluate
from sympy.core.power import Pow, integer_log, integer_nthroot
from sympy.core.power import Pow
from sympy.core.relational import (
Eq,
Equality,
Expand Down
3 changes: 2 additions & 1 deletion stubs/sympy-stubs/core/evalf.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from typing import 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, Tuple as tTuple, Type, Union as tUnion, overload
from typing_extensions import Self

from sympy.concrete.products import Product
from sympy.concrete.summations import Sum
Expand Down
5 changes: 3 additions & 2 deletions stubs/sympy-stubs/matrices/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from sympy.matrices.common import MatrixKind, NonSquareMatrixError, ShapeError
from sympy.matrices.common import NonSquareMatrixError, ShapeError
from sympy.matrices.dense import (
GramSchmidt,
MutableDenseMatrix,
Expand Down Expand Up @@ -63,7 +63,8 @@ from sympy.matrices.expressions import (
trace,
)
from sympy.matrices.immutable import ImmutableDenseMatrix, ImmutableSparseMatrix
from sympy.matrices.matrices import DeferredVector, MatrixBase
from sympy.matrices.kind import MatrixKind
from sympy.matrices.matrixbase import DeferredVector, MatrixBase
from sympy.matrices.sparse import MutableSparseMatrix
from sympy.matrices.sparsetools import banded
from sympy.matrices.utilities import dotprodsimp
Expand Down
Loading

0 comments on commit c7c8e26

Please sign in to comment.