Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ruff linting to python 3.9 #224

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions napari_animation/frame_sequence.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import annotations

from collections import deque
from typing import TYPE_CHECKING, Dict, Iterator, Sequence, Tuple
from collections.abc import Iterator, Sequence
from typing import TYPE_CHECKING

import numpy as np
from napari.utils.events import EmitterGroup
Expand Down Expand Up @@ -84,10 +85,10 @@ def __init__(self, key_frames: KeyFrameList, cache_size: int = 10) -> None:
}

# cache of interpolated viewer states
self._cache: Dict[int, ViewerState] = LRUDict(cache_size=cache_size)
self._cache: dict[int, ViewerState] = LRUDict(cache_size=cache_size)

# map of frame number -> (kf0, kf1, fraction)
self._keyframe_index: Dict[int, Tuple[KeyFrame, KeyFrame, float]] = {}
self._keyframe_index: dict[int, tuple[KeyFrame, KeyFrame, float]] = {}
self._rebuild_keyframe_index()

def _rebuild_keyframe_index(self, event=None):
Expand Down
9 changes: 5 additions & 4 deletions napari_animation/interpolation/base_interpolation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from collections.abc import Sequence
from numbers import Integral, Number, Real
from typing import Sequence, Tuple, TypeVar
from typing import TypeVar

import numpy as np
from scipy.spatial.transform import Rotation as R
Expand Down Expand Up @@ -135,10 +136,10 @@ def interpolate_log(a: float, b: float, fraction: float) -> float:


def slerp(
a: Tuple[float, float, float],
b: Tuple[float, float, float],
a: tuple[float, float, float],
b: tuple[float, float, float],
fraction: float,
) -> Tuple[float, float, float]:
) -> tuple[float, float, float]:
"""Compute Spherical linear interpolation from Euler angles,
compatible with the napari view.

Expand Down
4 changes: 1 addition & 3 deletions napari_animation/interpolation/typing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Dict

from .interpolation_constants import Interpolation

InterpolationMap = Dict[str, Interpolation]
InterpolationMap = dict[str, Interpolation]
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ ignore = [
"SIM117", # flake8-simplify - some of merged with statements are not looking great with black, reanble after drop python 3.9
]

target-version = "py38"
target-version = "py39"
fix = true
Loading