Skip to content

Commit

Permalink
Fix all reportMissingImports
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Nov 7, 2024
1 parent 27cb9ac commit 97b7a6c
Show file tree
Hide file tree
Showing 71 changed files with 134 additions and 111 deletions.
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools >= 69.0"] # v69 includes type information by default
build-backend = "setuptools.build_meta"

[project]
name="microsoft-python-type-stubs"
name = "microsoft-python-type-stubs"
dynamic = ["version"]

# Allow these stubs to be installed from GitHub
Expand Down Expand Up @@ -113,7 +113,6 @@ reportAssertTypeFailure = "none" # TODO
reportAttributeAccessIssue = "none" # TODO
reportGeneralTypeIssues = "none" # TODO
reportInvalidTypeForm = "none" # TODO
reportMissingImports = "none" # TODO
reportUndefinedVariable = "none" # TODO

[tool.mypy]
Expand Down
5 changes: 2 additions & 3 deletions stubs/matplotlib/axis.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ from datetime import timezone
from typing import Any, Callable, Literal, Type

import numpy as np
from units.basic_units import BasicUnit

from .artist import Artist, allow_rasterization
from .axes import Axes
Expand Down Expand Up @@ -185,8 +184,8 @@ class Axis(Artist):
def update_units(self, data: Any) -> bool: ...
def have_units(self) -> bool: ...
def convert_units(self, x): ...
def set_units(self, u: None | timezone | float | BasicUnit) -> None: ...
def get_units(self) -> None | timezone | float | BasicUnit: ...
def set_units(self, u) -> None: ...
def get_units(self): ...
def set_label_text(self, label: str, fontdict: dict = ..., **kwargs): ...
def set_major_formatter(self, formatter: Formatter | str | Callable) -> None: ...
def set_minor_formatter(self, formatter: Formatter | str | Callable) -> None: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/matplotlib/backends/backend_gtk3.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Callable, Type

from gi.repository import Gtk
# 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
Expand Down
2 changes: 0 additions & 2 deletions stubs/matplotlib/colorbar.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from typing import Literal, Sequence, Type

from libcst import For

from .axes import Axes
from .axis import Tick
from .backend_bases import RendererBase
Expand Down
3 changes: 1 addition & 2 deletions stubs/skimage/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ __version__: str = ...
submodules: list = ...

from ._shared import lazy as lazy
from ._shared.tester import PytestTester as PytestTester # noqa
from ._shared.version_requirements import ensure_python_version as ensure_python_version

__getattr__, __lazy_dir__, _ = ...
Expand All @@ -18,6 +19,4 @@ _STANDARD_MSG: str = ...

def _raise_build_error(e): ...

from skimage._shared.tester import PytestTester as PytestTester # noqa

test = ...
6 changes: 3 additions & 3 deletions stubs/skimage/_shared/filters.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ from typing import Literal
import numpy as np
from numpy.typing import ArrayLike, NDArray
from scipy import ndimage as ndi
from skimage._typing import Scalar

from .._shared import utils
from .._shared.utils import _supported_float_type, convert_to_float, warn
from .._typing import Scalar
from . import utils
from .utils import _supported_float_type, convert_to_float, warn

@utils.deprecate_multichannel_kwarg(multichannel_position=5)
def gaussian(
Expand Down
3 changes: 2 additions & 1 deletion stubs/skimage/feature/_basic_features.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ from itertools import combinations_with_replacement

import numpy as np
from numpy.typing import NDArray
from skimage._shared import utils

from .._shared import utils

def _texture_filter(gaussian_filtered): ...
def _singlescale_basic_features_singlechannel(img, sigma, intensity=True, edges=True, texture=True): ...
Expand Down
17 changes: 17 additions & 0 deletions stubs/skimage/feature/_cascade.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from typing import Any, ClassVar

__reduce_cython__: Any
__setstate_cython__: Any
__test__: dict

class Cascade:
__pyx_vtable__: ClassVar[Any] = ...
eps: Any
features_number: Any
stages_number: Any
stumps_number: Any
window_height: Any
window_width: Any
def __init__(self, *args, **kwargs) -> None: ...
def detect_multi_scale(self, *args, **kwargs): ...
def __reduce__(self): ...
3 changes: 2 additions & 1 deletion stubs/skimage/future/graph/_ncut.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import networkx as nx
import numpy as np
from numpy.typing import NDArray
from scipy import sparse
from skimage.future.graph.rag import RAG

from .rag import RAG

def DW_matrices(graph: RAG): ...
def ncut_cost(cut: NDArray, D, W) -> float: ...
2 changes: 1 addition & 1 deletion stubs/skimage/future/graph/graph_cut.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import networkx as nx
import numpy as np
from numpy.typing import ArrayLike, NDArray
from scipy.sparse import linalg
from skimage.future.graph.rag import RAG

from . import _ncut
from .rag import RAG

def cut_threshold(labels: NDArray, rag: RAG, thresh: float, in_place: bool = True) -> NDArray: ...
def cut_normalized(
Expand Down
3 changes: 2 additions & 1 deletion stubs/skimage/future/graph/graph_merge.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ from typing import Callable

import numpy as np
from numpy.typing import NDArray
from skimage.future.graph.rag import RAG

from .rag import RAG

def _revalidate_node_edges(rag, node, heap_list): ...
def _rename_node(graph, node_id, copy_id): ...
Expand Down
2 changes: 1 addition & 1 deletion stubs/skimage/future/graph/rag.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import networkx as nx
import numpy as np
from numpy.lib.stride_tricks import as_strided
from scipy import ndimage as ndi, sparse
from skimage.future.graph.rag import RAG

from ..._shared.version_requirements import require
from .rag import RAG

def _edge_generator_from_csr(csr_matrix): ...
def min_weight(graph: RAG, src: int, dst: int, n: int) -> Mapping: ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/skimage/future/trainable_segmentation.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from numpy.typing import NDArray
from skimage.feature import multiscale_basic_features

from ..feature import multiscale_basic_features

class TrainableSegmenter(object):
def __init__(self, clf=None, features_func=None): ...
Expand Down
3 changes: 2 additions & 1 deletion stubs/skimage/measure/_find_contours.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from collections import deque

import numpy as np
from skimage._shared.utils import deprecate_kwarg

from .._shared.utils import deprecate_kwarg

_param_options = ...

Expand Down
1 change: 1 addition & 0 deletions stubs/skimage/measure/_regionprops.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ from scipy.spatial.distance import pdist
from . import _moments
from ._find_contours import find_contours
from ._marching_cubes_lewiner import marching_cubes
from ._regionprops import RegionProperties
from ._regionprops_utils import euler_number, perimeter, perimeter_crofton

__all__ = ["regionprops", "euler_number", "perimeter", "perimeter_crofton"]
Expand Down
3 changes: 2 additions & 1 deletion stubs/skimage/transform/integral.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import numpy as np
from numpy import ndarray
from numpy.typing import NDArray
from skimage._typing import Scalar

from .._typing import Scalar

def integral_image(image: NDArray, *, dtype=None) -> NDArray: ...
def integrate(ii: NDArray, start, end) -> Scalar | np.ndarray: ...
2 changes: 0 additions & 2 deletions stubs/sklearn/_build_utils/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import contextlib as contextlib
import os as os

import sklearn as sklearn
from Cython import Tempita as Tempita
from Cython.Build import cythonize as cythonize

from .._min_dependencies import CYTHON_MIN_VERSION as CYTHON_MIN_VERSION
from ..externals._packaging.version import parse as parse
Expand Down
5 changes: 2 additions & 3 deletions stubs/sklearn/utils/estimator_checks.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ from typing import Sequence

import joblib
import numpy as np
from _pytest.mark.structures import MarkDecorator
from pytest.mark import parameterize
from _pytest.mark.structures import _ParametrizeMarkDecorator
from scipy import sparse as sparse
from scipy.stats import rankdata as rankdata

Expand Down Expand Up @@ -82,7 +81,7 @@ CROSS_DECOMPOSITION: list = ...
def check_supervised_y_no_nan(name, estimator_orig): ...
def parametrize_with_checks(
estimators: Sequence[BaseEstimator],
) -> MarkDecorator | parameterize: ...
) -> _ParametrizeMarkDecorator: ...
def check_estimator(
estimator: None | BaseEstimator = None,
generate_only: bool = False,
Expand Down
2 changes: 0 additions & 2 deletions stubs/vispy/app/application.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import sys
from .. import config
from ..util import logger
from . import backends
from ._detect_eventloop import _get_running_interactive_framework
from .backends import BACKEND_NAMES, BACKENDMAP, CORE_BACKENDS, TRIED_BACKENDS
from .base import BaseApplicationBackend as ApplicationBackend # noqa

class Application(object):
Expand Down
7 changes: 3 additions & 4 deletions stubs/vispy/app/canvas.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@ from typing import Callable, Mapping

import numpy as np
from numpy.typing import ArrayLike
from vispy.app.application import Application
from vispy.gloo.context import GLContext
from vispy.scene.widgets.widget import Widget
from vispy.util.keys import Key

from ..gloo import FrameBuffer, RenderBuffer
from ..gloo.context import GLContext, forget_canvas, set_current_canvas
from ..scene.widgets.widget import Widget
from ..util import config as util_config, logger
from ..util.dpi import get_dpi
from ..util.event import EmitterGroup, Event, WarningEmitter
from ..util.keys import Key
from ..util.ptime import time
from . import Application, use_app
from .application import Application

# todo: add functions for asking about current mouse/keyboard state
# todo: add hover enter/exit events
Expand Down
26 changes: 26 additions & 0 deletions stubs/vispy/app/timer.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
from typing import Any

from . import Application
from .base import BaseTimerBackend as TimerBackend # noqa

class Timer:
def __init__(self, interval=..., connect=..., iterations=..., start=..., app=...) -> None: ...
@property
def app(self) -> Application: ...
@property
def interval(self) -> float: ...
@interval.setter
def interval(self, val) -> None: ...
@property
def elapsed(self) -> float: ...
@property
def running(self) -> bool: ...
def start(self, interval=..., iterations=...) -> None: ...
def stop(self) -> None: ...
@property
def native(self) -> Any: ...
def connect(self, callback): ...
def disconnect(self, callback=...): ...
1 change: 0 additions & 1 deletion stubs/vispy/color/colormap.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import warnings
from typing import Sequence

import numpy as np
import vispy.gloo
from numpy.typing import ArrayLike, NDArray

from .._typing import Scalar
Expand Down
3 changes: 2 additions & 1 deletion stubs/vispy/io/stl.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import IO

import numpy as np
from vispy._typing import FileLike

from .._typing import FileLike

# -*- coding: utf-8 -*-
# Copyright (c) 2015 Michael Dawson-Haggerty
Expand Down
3 changes: 1 addition & 2 deletions stubs/vispy/plot/fig.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from vispy.util.svg.color import Color

from ..scene import SceneCanvas
from ..util.svg.color import Color
from .plotwidget import PlotWidget

# -*- coding: utf-8 -*-
Expand Down
3 changes: 1 addition & 2 deletions stubs/vispy/scene/cameras/base_camera.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from typing import Literal, Mapping

from numpy.typing import ArrayLike
from vispy.scene.node import Node
from vispy.util.event import Event

from ...util import keys
from ...util.event import Event
from ...visuals.transforms import MatrixTransform, NullTransform, STTransform, TransformCache
from ..node import Node

Expand Down
2 changes: 1 addition & 1 deletion stubs/vispy/scene/cameras/fly.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import math

import numpy as np
from vispy.util.event import Event

from ...util import keys
from ...util.event import Event
from ...util.quaternion import Quaternion
from .perspective import PerspectiveCamera

Expand Down
2 changes: 1 addition & 1 deletion stubs/vispy/scene/cameras/magnify.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from vispy.util.event import Event

from ...util.event import Event
from ...visuals.transforms.nonlinear import Magnify1DTransform, MagnifyTransform
from .panzoom import PanZoomCamera

Expand Down
3 changes: 1 addition & 2 deletions stubs/vispy/scene/cameras/panzoom.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import numpy as np
from vispy.util.event import Event
from vispy.util.svg.shapes import Rect

from ...geometry import Rect
from ...util.event import Event
from ...visuals.transforms import MatrixTransform, STTransform
from .base_camera import BaseCamera

Expand Down
4 changes: 2 additions & 2 deletions stubs/vispy/scene/cameras/perspective.pyi
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import math

import numpy as np
from vispy._typing import Scalar
from vispy.util.event import Event

from ..._typing import Scalar
from ...util import keys, transforms
from ...util.event import Event
from ...visuals.transforms import MatrixTransform
from .base_camera import BaseCamera

Expand Down
4 changes: 2 additions & 2 deletions stubs/vispy/scene/widgets/axis.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------
import numpy as np
from vispy.scene.widgets.viewbox import ViewBox
from vispy.util.event import Event

from ...util.event import Event
from ...visuals import AxisVisual
from .viewbox import ViewBox
from .widget import Widget

class AxisWidget(Widget):
Expand Down
4 changes: 2 additions & 2 deletions stubs/vispy/scene/widgets/colorbar.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Literal

import numpy as np
from vispy.color import Color, Colormap
from vispy.util.event import Event

from ...color import Color, Colormap
from ...util.event import Event
from ...visuals import ColorBarVisual
from .widget import Widget

Expand Down
4 changes: 2 additions & 2 deletions stubs/vispy/scene/widgets/console.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import numpy as np
from vispy.util.event import Event
from vispy.util.svg.color import Color

from ...color import Color
from ...gloo import VertexBuffer
from ...util.event import Event
from ...util.svg.color import Color
from ...visuals import Visual
from .widget import Widget

Expand Down
2 changes: 0 additions & 2 deletions stubs/vispy/scene/widgets/grid.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import numpy as np
from kiwisolver import Solver, UnsatisfiableConstraint, Variable
from vispy.geometry import Rect
from vispy.scene.widgets.widget import Widget

from .viewbox import ViewBox
from .widget import Widget
Expand Down
Loading

0 comments on commit 97b7a6c

Please sign in to comment.