diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 28f5c9c2..eb7cbc01 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,14 +5,14 @@ ci: repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.9 + rev: v0.11.8 hooks: - id: ruff args: [--fix, --unsafe-fixes] - id: ruff-format - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.23 + rev: v0.24.1 hooks: - id: validate-pyproject diff --git a/src/superqt/fonticon/_qfont_icon.py b/src/superqt/fonticon/_qfont_icon.py index 72f6bf11..fd6fbd48 100644 --- a/src/superqt/fonticon/_qfont_icon.py +++ b/src/superqt/fonticon/_qfont_icon.py @@ -132,7 +132,7 @@ class IconOpts: def dict(self) -> IconOptionDict: # not using asdict due to pickle errors on animation d = {k: v for k, v in vars(self).items() if v is not _Unset} - return cast(IconOptionDict, d) + return cast("IconOptionDict", d) @dataclass @@ -151,7 +151,7 @@ def _update(self, icon_opts: IconOpts) -> _IconOptions: def dict(self) -> IconOptionDict: # not using asdict due to pickle errors on animation - return cast(IconOptionDict, vars(self)) + return cast("IconOptionDict", vars(self)) class _QFontIconEngine(QIconEngine): @@ -167,7 +167,7 @@ def __init__(self, options: _IconOptions): @property def _default_opts(self) -> _IconOptions: - return cast(_IconOptions, self._opts[QIcon.State.Off][QIcon.Mode.Normal]) + return cast("_IconOptions", self._opts[QIcon.State.Off][QIcon.Mode.Normal]) def _add_opts(self, state: QIcon.State, mode: QIcon.Mode, opts: IconOpts) -> None: self._opts[state][mode] = self._default_opts._update(opts) @@ -358,7 +358,7 @@ class QFontIconStore(QObject): def __init__(self, parent: QObject | None = None) -> None: super().__init__(parent=parent) - if tuple(cast(str, QT_VERSION).split(".")) < ("6", "0"): + if tuple(cast("str", QT_VERSION).split(".")) < ("6", "0"): # QT6 drops this QApplication.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps) @@ -480,7 +480,7 @@ def addFont( # in Qt6, everything becomes a static member QFd: QFontDatabase | type[QFontDatabase] = ( QFontDatabase() - if tuple(cast(str, QT_VERSION).split(".")) < ("6", "0") + if tuple(cast("str", QT_VERSION).split(".")) < ("6", "0") else QFontDatabase ) diff --git a/src/superqt/sliders/_sliders.py b/src/superqt/sliders/_sliders.py index 65c85ccd..28663fc7 100644 --- a/src/superqt/sliders/_sliders.py +++ b/src/superqt/sliders/_sliders.py @@ -10,7 +10,7 @@ def __init__(self, *args, **kwargs): self._singleStep = 1 def _type_cast(self, value) -> int: - return int(round(value)) + return round(value) class _FloatMixin: