Skip to content

Commit edff511

Browse files
author
Alexander Refsum Jensenius
committed
Fixing build issues
1 parent 9310aa5 commit edff511

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

musicalgestures/_utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from typing import Union
2+
13
class MgProgressbar():
24
"""
35
Calls in a loop to create terminal progress bar.
@@ -571,7 +573,7 @@ def cast_into_avi(filename, target_name=None, overwrite=False):
571573
def extract_frame(
572574
filename: str,
573575
frame: int=None,
574-
time: str|float=None,
576+
time: Union[str, float]=None,
575577
target_name: str=None,
576578
overwrite: bool=False,
577579
)-> str:
@@ -581,7 +583,7 @@ def extract_frame(
581583
Args:
582584
filename (str): Path to the input video file.
583585
frame (int): The frame number to extract.
584-
time (str|float): The time in HH:MM:ss.ms where to extract the frame from. If float, it is interpreted as seconds from the start of the video.
586+
time (Union[str, float]): The time in HH:MM:ss.ms where to extract the frame from. If float, it is interpreted as seconds from the start of the video.
585587
target_name (str, optional): The name for the output file. If None, the name will be \<input name\>FRAME\<frame number\>.\<file extension\>. Defaults to None.
586588
overwrite (bool, optional): Whether to allow overwriting existing files or to automatically increment target filename to avoid overwriting. Defaults to False.
587589
"""

musicalgestures/_video.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import glob
33
import numpy as np
4+
from typing import Union, List
45
from musicalgestures._input_test import mg_input_test
56
from musicalgestures._videoreader import mg_videoreader
67
from musicalgestures._flow import Flow
@@ -32,7 +33,7 @@ class MgVideo(MgAudio):
3233

3334
def __init__(
3435
self,
35-
filename: str|list[str],
36+
filename: Union[str, List[str]],
3637
array=None,
3738
fps=None,
3839
path=None,
@@ -60,7 +61,7 @@ def __init__(
6061
Initializes Musical Gestures data structure from a video file, and applies preprocesses if desired.
6162
6263
Args:
63-
filename (str|list[str]): Path to the video file. If input is a list, will merge all videos into one.
64+
filename (Union[str, List[str]]): Path to the video file. If input is a list, will merge all videos into one.
6465
array (np.ndarray, optional): Generates an MgVideo object from a video array. Defauts to None.
6566
fps (float, optional): The frequency at which consecutive images from the video array are captured or displayed. Defauts to None.
6667
path (str, optional): Path to save the output video file generated from a video array. Defaults to None.

0 commit comments

Comments
 (0)