Skip to content

Commit

Permalink
Fix all reportUnsupportedDunderAll and set as error (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Nov 7, 2024
1 parent d7adc46 commit 9911ac0
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 51 deletions.
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ reportPropertyTypeMismatch = false
reportOverlappingOverload = false
# The name of the self/cls parameter is out of third-party stubs' control.
reportSelfClsParameterName = false
# Not an error by default in standard mode
reportUnsupportedDunderAll = "error"

# Error reports to fix in code
reportAssertTypeFailure = "none" # TODO
Expand Down
3 changes: 1 addition & 2 deletions stubs/matplotlib/dates.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import datetime

import numpy as np
from dateutil import rrule
from dateutil.relativedelta import relativedelta

from .ticker import Formatter, Locator
from .units import ConversionInterface
Expand Down Expand Up @@ -174,8 +175,6 @@ __all__ = (
"num2date",
"num2timedelta",
"drange",
"epoch2num",
"num2epoch",
"set_epoch",
"get_epoch",
"DateFormatter",
Expand Down
1 change: 1 addition & 0 deletions stubs/sklearn/utils/_joblib.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import warnings as _warnings

import joblib
from joblib import (
Memory,
Parallel,
Expand Down
12 changes: 11 additions & 1 deletion stubs/sympy-stubs/printing/lambdarepr.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@ from typing import Any

from sympy.printing.pycode import MpmathPrinter, PythonCodePrinter

__all__ = ["PythonCodePrinter", "MpmathPrinter", "NumPyPrinter", "LambdaPrinter", "NumPyPrinter", "IntervalPrinter", "lambdarepr"]
from .numpy import NumPyPrinter # NumPyPrinter is imported for backward compatibility

__all__ = [
"PythonCodePrinter",
"MpmathPrinter", # MpmathPrinter is published for backward compatibility
"NumPyPrinter",
"LambdaPrinter",
"NumPyPrinter", # Duplicate, see https://github.com/sympy/sympy/pull/27229
"IntervalPrinter",
"lambdarepr",
]

class LambdaPrinter(PythonCodePrinter):
printmethod = ...
Expand Down
54 changes: 33 additions & 21 deletions stubs/vispy/gloo/wrappers.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -97,35 +97,17 @@ class BaseGlooFunctions(object):

# glBlendFunc(Separate), glBlendColor, glBlendEquation(Separate)

def set_blend_func(
self,
srgb: str = "one",
drgb: str = "zero",
salpha: str | None = None,
dalpha: str | None = None,
): ...
def set_blend_func(self, srgb: str = "one", drgb: str = "zero", salpha: str | None = None, dalpha: str | None = None): ...
def set_blend_color(self, color): ...
def set_blend_equation(self, mode_rgb: str, mode_alpha: str | None = None): ...

# glScissor, glStencilFunc(Separate), glStencilMask(Separate),
# glStencilOp(Separate),

def set_scissor(self, x: int, y: int, w: int, h: int): ...
def set_stencil_func(
self,
func: str = "always",
ref: int = 0,
mask: int = 8,
face: str = "front_and_back",
): ...
def set_stencil_func(self, func: str = "always", ref: int = 0, mask: int = 8, face: str = "front_and_back"): ...
def set_stencil_mask(self, mask: int = 8, face: str = "front_and_back"): ...
def set_stencil_op(
self,
sfail: str = "keep",
dpfail: str = "keep",
dppass: str = "keep",
face: str = "front_and_back",
): ...
def set_stencil_op(self, sfail: str = "keep", dpfail: str = "keep", dppass: str = "keep", face: str = "front_and_back"): ...

# glDepthFunc, glDepthMask, glColorMask, glSampleCoverage

Expand Down Expand Up @@ -161,6 +143,36 @@ class GlooFunctions(BaseGlooFunctions):
# GlooFunctions without queue: use queue of canvas that is current at call-time
global_gloo_functions = ...

# Create global functions object and inject names here

# GlooFunctions without queue: use queue of canvas that is current at call-time
def set_viewport(*args): ...
def set_depth_range(near: float = 0.0, far: float = 1.0): ...
def set_front_face(mode: str = "ccw"): ...
def set_cull_face(mode: str = "back"): ...
def set_line_width(width: float = 1.0): ...
def set_polygon_offset(factor: float = 0.0, units: float = 0.0): ...
def clear(color=True, depth: bool | float = True, stencil: bool | int = True): ...
def set_clear_color(color="black", alpha: None | float = None): ...
def set_clear_depth(depth: float = 1.0): ...
def set_clear_stencil(index: int = 0): ...
def set_blend_func(srgb: str = "one", drgb: str = "zero", salpha: str | None = None, dalpha: str | None = None): ...
def set_blend_color(color): ...
def set_blend_equation(mode_rgb: str, mode_alpha: str | None = None): ...
def set_scissor(x: int, y: int, w: int, h: int): ...
def set_stencil_func(func: str = "always", ref: int = 0, mask: int = 8, face: str = "front_and_back"): ...
def set_stencil_mask(mask: int = 8, face: str = "front_and_back"): ...
def set_stencil_op(sfail: str = "keep", dpfail: str = "keep", dppass: str = "keep", face: str = "front_and_back"): ...
def set_depth_func(func: str = "less"): ...
def set_depth_mask(flag: bool): ...
def set_color_mask(red: bool, green: bool, blue: bool, alpha: bool): ...
def set_sample_coverage(value: float = 1.0, invert: bool = False): ...
def get_state_presets() -> Mapping: ...
def set_state(preset: Literal["opaque", "translucent", "additive"] | None = None, **kwargs): ...
def finish(): ...
def flush(): ...
def set_hint(target: str, mode: str): ...

# Functions that do not use the glir queue

def read_pixels(
Expand Down
4 changes: 2 additions & 2 deletions stubs/vispy/util/dpi/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# -----------------------------------------------------------------------------

import sys as sys

__all__ = ["get_dpi"]

def get_dpi(raise_error: bool = True) -> float: ...
16 changes: 0 additions & 16 deletions stubs/vispy/util/dpi/_linux.pyi

This file was deleted.

9 changes: 0 additions & 9 deletions stubs/vispy/util/dpi/_quartz.pyi

This file was deleted.

0 comments on commit 9911ac0

Please sign in to comment.