Skip to content

Commit c7c8e26

Browse files
authored
Fix all reportAttributeAccessIssue (#336)
1 parent 431162b commit c7c8e26

30 files changed

+556
-50
lines changed

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ reportUnsupportedDunderAll = "error"
110110

111111
# Error reports to fix in code
112112
reportAssertTypeFailure = "none" # TODO
113-
reportAttributeAccessIssue = "none" # TODO
114113
reportGeneralTypeIssues = "none" # TODO
115114

116115
[tool.mypy]

stubs/matplotlib/_mathtext.pyi

+1-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ from sre_parse import State
44
from tkinter.tix import HList
55
from typing import Literal
66

7-
from matplotlib.mathtext import MathtextBackend
8-
97
from .font_manager import FontProperties
8+
from .mathtext import MathtextBackend
109

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

stubs/matplotlib/axes/_axes.pyi

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ from matplotlib.artist import Artist
99
from matplotlib.axes._secondary_axes import SecondaryAxis
1010
from matplotlib.axis import XAxis, YAxis
1111
from matplotlib.backend_tools import Cursors
12-
from matplotlib.collections import (
13-
BrokenBarHCollection,
14-
Collection,
15-
EventCollection,
16-
LineCollection,
17-
PathCollection,
18-
PolyCollection,
19-
QuadMesh,
20-
)
2112
from matplotlib.colors import Colormap, Normalize
2213
from matplotlib.container import BarContainer, ErrorbarContainer, StemContainer
2314
from matplotlib.contour import QuadContourSet
@@ -34,6 +25,15 @@ from matplotlib.text import Annotation, Text
3425
from matplotlib.ticker import Formatter
3526
from matplotlib.transforms import Bbox, BboxTransformTo, Transform
3627

28+
from ..collections import (
29+
BrokenBarHCollection,
30+
Collection,
31+
EventCollection,
32+
LineCollection,
33+
PathCollection,
34+
PolyCollection,
35+
QuadMesh,
36+
)
3737
from ._base import _AxesBase
3838

3939
class Axes(_AxesBase):

stubs/matplotlib/backends/_backend_tk.pyi

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import tkinter as tk
22
from typing import Literal, Sequence
33

4-
from matplotlib import backend_tools
54
from matplotlib._api import classproperty
65
from matplotlib._typing import *
76
from matplotlib.backend_bases import (
@@ -13,6 +12,8 @@ from matplotlib.backend_bases import (
1312
_Backend,
1413
)
1514

15+
from .. import backend_tools
16+
1617
backend_version: float = ...
1718
cursord: dict[backend_tools.Cursors, str] = ...
1819

@@ -50,8 +51,8 @@ class FigureCanvasTk(FigureCanvasBase):
5051
class FigureManagerTk(FigureManagerBase):
5152
canvas: FigureCanvasBase
5253
num: int | str
53-
toolbar: tk.Toolbar
54-
window: tk.Window
54+
toolbar: NavigationToolbar2
55+
window: tk.Tk
5556

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

6667
class NavigationToolbar2Tk(NavigationToolbar2, tk.Frame):
67-
window: tk.Window = ...
68+
window: tk.Tk = ...
6869
def __init__(self, canvas: FigureCanvasBase, window=..., *, pack_toolbar: bool = True) -> None: ...
6970
def pan(self, *args) -> None: ...
7071
def zoom(self, *args) -> None: ...

stubs/matplotlib/backends/backend_gtk3.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ from typing import Callable, Type
22

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

8+
from .. import backend_tools
99
from ._backend_gtk import TimerGTK as TimerGTK3, _BackendGTK, _FigureManagerGTK, _NavigationToolbar2GTK
1010

1111
class __getattr__:

stubs/matplotlib/backends/backend_qt.pyi

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from typing import Any, Type
22

3-
from matplotlib import backend_tools
43
from matplotlib._api import classproperty
54
from matplotlib.backend_bases import (
65
FigureCanvasBase,
@@ -11,15 +10,15 @@ from matplotlib.backend_bases import (
1110
ToolContainerBase,
1211
_Backend,
1312
)
14-
from matplotlib.backend_tools import Cursors
1513
from matplotlib.transforms import Bbox
1614

15+
from .. import backend_tools
1716
from .qt_compat import QtCore, QtWidgets
1817

1918
backend_version = ...
2019
SPECIAL_KEYS: dict = ...
2120

22-
cursord: dict[Cursors, Any] = ...
21+
cursord: dict[backend_tools.Cursors, Any] = ...
2322

2423
class __getattr__:
2524
qApp = ...
@@ -36,7 +35,7 @@ class FigureCanvasQT(QtWidgets.QWidget, FigureCanvasBase):
3635

3736
def __init__(self, figure=...) -> None: ...
3837
def showEvent(self, event) -> None: ...
39-
def set_cursor(self, cursor: Cursors) -> None: ...
38+
def set_cursor(self, cursor: backend_tools.Cursors) -> None: ...
4039
def enterEvent(self, event) -> None: ...
4140
def leaveEvent(self, event) -> None: ...
4241
def mouseEventCoords(self, pos) -> tuple[float, float]: ...
+6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
from typing import Any, TypeAlias
2+
13
QT_API_PYQT6: str = ...
24
QT_API_PYSIDE6: str = ...
35
QT_API_PYQT5: str = ...
46
QT_API_PYSIDE2: str = ...
57
QT_API_ENV: str = ...
8+
9+
__version__: str
10+
QtCore: TypeAlias = Any
11+
QtWidgets: Any

stubs/matplotlib/widgets.pyi

-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ from numpy import float64, ndarray
1515
from numpy.typing import ArrayLike
1616
from PIL.Image import Image
1717

18-
from . import _api, _docstring, backend_tools, cbook, colors, ticker, transforms
1918
from ._typing import Color
2019
from .artist import Artist
2120
from .lines import Line2D
@@ -374,9 +373,6 @@ class LassoSelector(_SelectorWidget):
374373
props: Mapping | None = None,
375374
button: MouseButton | Sequence[MouseButton] | None = None,
376375
): ...
377-
@_api.deprecated("3.5", alternative="press")
378-
def onpress(self, event): ...
379-
def onrelease(self, event): ...
380376

381377
class PolygonSelector(_SelectorWidget):
382378
def __init__(

stubs/sklearn/_build_utils/pre_build_helpers.pyi

-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,5 @@ import sys
55
import tempfile
66
import textwrap
77

8-
from setuptools.command.build_ext import customize_compiler as customize_compiler, new_compiler as new_compiler
9-
108
def compile_test_program(code, extra_preargs: list = [], extra_postargs: list = []): ...
119
def basic_check_build(): ...

stubs/sklearn/cross_decomposition/_pls.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ from numbers import Integral as Integral, Real as Real
33
from typing import ClassVar, Literal, TypeVar
44

55
from numpy import ndarray
6-
from scipy.linalg import pinv as pinv2, pinv2 as pinv2, svd
76

87
from .._typing import ArrayLike, Float, Int, MatrixLike
98
from ..base import BaseEstimator, ClassNamePrefixFeaturesOutMixin, MultiOutputMixin, RegressorMixin, TransformerMixin

stubs/sklearn/utils/fixes.pyi

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import sklearn
99
import threadpoolctl
1010
from numpy import percentile as percentile
1111
from scipy.linalg import eigh as _eigh
12-
from scipy.optimize.linesearch import line_search_wolfe1 as line_search_wolfe1, line_search_wolfe2 as line_search_wolfe2
12+
from scipy.optimize._linesearch import ( # explicitly re-exported
13+
line_search_wolfe1 as line_search_wolfe1,
14+
line_search_wolfe2 as line_search_wolfe2,
15+
)
1316
from threadpoolctl import _ThreadpoolLimiter
1417

1518
from ..externals._lobpcg import lobpcg as lobpcg

stubs/sklearn/utils/optimize.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import warnings
33
import numpy as np
44

55
from ..exceptions import ConvergenceWarning as ConvergenceWarning
6-
from .fixes import line_search_wolfe1 as line_search_wolfe1, line_search_wolfe2 as line_search_wolfe2
76

87
# This is a modified file from scipy.optimize
98
# Original authors: Travis Oliphant, Eric Jones

stubs/sklearn/utils/validation.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ from numpy import ndarray
1515
from numpy.core.numeric import ComplexWarning as ComplexWarning
1616
from numpy.random.mtrand import RandomState
1717
from pandas import DataFrame
18-
from pandas.api.types import is_sparse as is_sparse
1918
from scipy.sparse import spmatrix
2019
from scipy.sparse._coo import coo_matrix
2120

stubs/sympy-stubs/__init__.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ from sympy.core import (
122122
seterr,
123123
symbols,
124124
sympify,
125+
trailing,
125126
use,
126127
var,
127128
vectorize,
@@ -526,7 +527,6 @@ from sympy.ntheory import (
526527
sqrt_mod,
527528
sqrt_mod_iter,
528529
totient,
529-
trailing,
530530
)
531531
from sympy.parsing import parse_expr
532532
from sympy.plotting import plot, plot_backends, plot_implicit, plot_parametric, textplot

stubs/sympy-stubs/core/__init__.pyi

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ from sympy.core.function import (
2828
expand_trig,
2929
nfloat,
3030
)
31+
from sympy.core.intfunc import integer_log, integer_nthroot
3132
from sympy.core.kind import BooleanKind, NumberKind, UndefinedKind
3233
from sympy.core.mod import Mod
3334
from sympy.core.mul import Mul, prod
@@ -53,7 +54,7 @@ from sympy.core.numbers import (
5354
zoo,
5455
)
5556
from sympy.core.parameters import evaluate
56-
from sympy.core.power import Pow, integer_log, integer_nthroot
57+
from sympy.core.power import Pow
5758
from sympy.core.relational import (
5859
Eq,
5960
Equality,

stubs/sympy-stubs/core/evalf.pyi

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Any, Callable, Dict as tDict, List, Optional, Self, Tuple as tTuple, Type, Union as tUnion, overload
1+
from typing import Any, Callable, Dict as tDict, List, Optional, Tuple as tTuple, Type, Union as tUnion, overload
2+
from typing_extensions import Self
23

34
from sympy.concrete.products import Product
45
from sympy.concrete.summations import Sum

stubs/sympy-stubs/matrices/__init__.pyi

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from sympy.matrices.common import MatrixKind, NonSquareMatrixError, ShapeError
1+
from sympy.matrices.common import NonSquareMatrixError, ShapeError
22
from sympy.matrices.dense import (
33
GramSchmidt,
44
MutableDenseMatrix,
@@ -63,7 +63,8 @@ from sympy.matrices.expressions import (
6363
trace,
6464
)
6565
from sympy.matrices.immutable import ImmutableDenseMatrix, ImmutableSparseMatrix
66-
from sympy.matrices.matrices import DeferredVector, MatrixBase
66+
from sympy.matrices.kind import MatrixKind
67+
from sympy.matrices.matrixbase import DeferredVector, MatrixBase
6768
from sympy.matrices.sparse import MutableSparseMatrix
6869
from sympy.matrices.sparsetools import banded
6970
from sympy.matrices.utilities import dotprodsimp

0 commit comments

Comments
 (0)