Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Mouwrice committed Apr 11, 2024
1 parent d8c6719 commit 319d8a5
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions drumpy/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from drumpy.app.fps_display import FPSDisplay
from drumpy.app.video_source import CameraSource, VideoFileSource, Source
from drumpy.mediapipe_pose import MediaPipePose, LandmarkerModel
from options.landmark_type import LandmarkType
from mediapipe.landmark_type import LandmarkType


class App:
Expand All @@ -25,7 +25,7 @@ def __init__(
running_mode: RunningMode = RunningMode.LIVE_STREAM,
model: LandmarkerModel = LandmarkerModel.FULL,
delegate: BaseOptions.Delegate = BaseOptions.Delegate.GPU,
log_file: None | str = None,
log_file: Optional[str] = None,
landmark_type: LandmarkType = LandmarkType.WORLD_LANDMARKS,
) -> None:
"""
Expand Down
4 changes: 2 additions & 2 deletions drumpy/app/video_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_fps(self: Self) -> float:
"""
return self.source_fps

def get_frame(self: Self) -> ndarray | None:
def get_frame(self: Self) -> Optional[ndarray]:
"""
Get the next frame from the video
:return: The frame and the timestamp
Expand Down Expand Up @@ -153,7 +153,7 @@ def get_fps(self: Self) -> float:
"""
return 60

def get_frame(self: Self) -> ndarray | None:
def get_frame(self: Self) -> Optional[ndarray]:
"""
Get the next frame from the video
:return: The frame and the timestamp
Expand Down
6 changes: 3 additions & 3 deletions drumpy/drum/drum.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from enum import auto, Enum
from time import sleep
from typing import Self
from typing import Self, Optional

import numpy as np
import numpy.typing as npt
Expand Down Expand Up @@ -50,7 +50,7 @@ def __init__(
self: Self,
margin: float,
min_margin: float,
presets: dict[str, tuple[float, float, float]] | None = None,
presets: Optional[dict[str, tuple[float, float, float]]] = None,
sleep_option: SleepOption = SleepOption.SLEEP,
) -> None:
snare_drum = Sound(
Expand Down Expand Up @@ -162,7 +162,7 @@ def find_and_play_sound(
f"with distance {closest_distance:.3f}"
)

def auto_calibrate(self: Self, sounds: list[int] | None = None) -> None:
def auto_calibrate(self: Self, sounds: Optional[list[int]] = None) -> None:
"""
Automatically calibrate all sounds
:param sounds: List of sounds to calibrate, if None, all sounds will be calibrated in order
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from drumpy.landmarkermodel import LandmarkerModel
from drumpy.trajectory_file import TrajectoryFile
from options.landmark_type import LandmarkType
from mediapipe.landmark_type import LandmarkType


def visualize_landmarks(
Expand Down
2 changes: 1 addition & 1 deletion drumpy/trajectory_file.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import csv
from typing import Optional, Self

from options.landmark_type import LandmarkType
from mediapipe.landmark_type import LandmarkType


class TrajectoryFile:
Expand Down

0 comments on commit 319d8a5

Please sign in to comment.