From 521c2d869b869a5b5cb9a7194a2e05694311fd82 Mon Sep 17 00:00:00 2001 From: Avasam Date: Wed, 6 Nov 2024 19:26:27 -0500 Subject: [PATCH] Fix all reportInvalidTypeForm --- pyproject.toml | 1 - stubs/matplotlib/font_manager.pyi | 13 +++++++++++-- stubs/sympy-stubs/core/evalf.pyi | 5 ++--- stubs/sympy-stubs/testing/runtests.pyi | 3 ++- stubs/vispy/scene/visuals.pyi | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e58dfaff..9e5351a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,7 +112,6 @@ reportUnsupportedDunderAll = "error" reportAssertTypeFailure = "none" # TODO reportAttributeAccessIssue = "none" # TODO reportGeneralTypeIssues = "none" # TODO -reportInvalidTypeForm = "none" # TODO reportMissingImports = "none" # TODO reportUndefinedVariable = "none" # TODO diff --git a/stubs/matplotlib/font_manager.pyi b/stubs/matplotlib/font_manager.pyi index f3a67a8f..c28095b7 100644 --- a/stubs/matplotlib/font_manager.pyi +++ b/stubs/matplotlib/font_manager.pyi @@ -25,8 +25,17 @@ def win32FontDirectory(): ... def win32InstalledFonts(directory=..., fontext=...): ... def get_fontconfig_fonts(fontext=...): ... def findSystemFonts(fontpaths=..., fontext=...): ... - -FontEntry = ... +@dataclass +class FontEntry: + fname: str = ... + name: str = ... + style: str = ... + variant: str = ... + weight: str | int = ... + stretch: str = ... + size: str = ... + def _repr_html_(self) -> str: ... + def _repr_png_(self) -> bytes: ... def ttfFontProperty(font: FT2Font) -> FontEntry: ... def afmFontProperty(fontpath, font: AFM) -> FontEntry: ... diff --git a/stubs/sympy-stubs/core/evalf.pyi b/stubs/sympy-stubs/core/evalf.pyi index d7fb438d..840df7d3 100644 --- a/stubs/sympy-stubs/core/evalf.pyi +++ b/stubs/sympy-stubs/core/evalf.pyi @@ -1,6 +1,5 @@ from typing import Any, Callable, Dict as tDict, List, Optional, Self, Tuple as tTuple, Type, Union as tUnion, overload -from mpmath import mpc, mpf from sympy.concrete.products import Product from sympy.concrete.summations import Sum from sympy.core.add import Add @@ -67,11 +66,11 @@ def evalf_atan(v: atan, prec: int, options: OPT_DICT) -> TMP_RES: ... def evalf_subs(prec: int, subs: dict) -> dict: ... def evalf_piecewise(expr: Expr, prec: int, options: OPT_DICT) -> TMP_RES: ... def evalf_alg_num(a: AlgebraicNumber, prec: int, options: OPT_DICT) -> TMP_RES: ... -def as_mpmath(x: Any, prec: int, options: OPT_DICT) -> tUnion[mpc, mpf]: ... +def as_mpmath(x: Any, prec: int, options: OPT_DICT): ... def do_integral(expr: Integral, prec: int, options: OPT_DICT) -> TMP_RES: ... def evalf_integral(expr: Integral, prec: int, options: OPT_DICT) -> TMP_RES: ... def check_convergence(numer: Expr, denom: Expr, n: Symbol) -> tTuple[int, Any, Any]: ... -def hypsum(expr: Expr, n: Symbol, start: int, prec: int) -> mpf: ... +def hypsum(expr: Expr, n: Symbol, start: int, prec: int): ... def evalf_prod(expr: Product, prec: int, options: OPT_DICT) -> TMP_RES: ... def evalf_sum(expr: Sum, prec: int, options: OPT_DICT) -> TMP_RES: ... def evalf_symbol(x: Expr, prec: int, options: OPT_DICT) -> TMP_RES: ... diff --git a/stubs/sympy-stubs/testing/runtests.pyi b/stubs/sympy-stubs/testing/runtests.pyi index ee9df77f..19182764 100644 --- a/stubs/sympy-stubs/testing/runtests.pyi +++ b/stubs/sympy-stubs/testing/runtests.pyi @@ -1,4 +1,5 @@ import doctest as pdoctest +from collections import namedtuple from contextlib import contextmanager from doctest import DocTestFinder, DocTestRunner from typing import Any, Generator, Literal @@ -32,7 +33,7 @@ sp = ... def split_list(l, split, density=...): ... -SymPyTestResults = ... +SymPyTestResults = namedtuple("SymPyTestResults", "failed attempted") def sympytestfile( filename, diff --git a/stubs/vispy/scene/visuals.pyi b/stubs/vispy/scene/visuals.pyi index e1ff06c3..f021d8af 100644 --- a/stubs/vispy/scene/visuals.pyi +++ b/stubs/vispy/scene/visuals.pyi @@ -10,7 +10,7 @@ from ..scene.node import Node from ..visuals.filters import Alpha, PickingFilter from .node import Node -_T = ... +_T = TypeVar("_T") class VisualNode(Node): _next_id: int = ...