# Path: mugen/exceptions.py
# class ParameterError(MugenError):
#     """
#     Exception class for mal-formed inputs
#     """
# 
#     pass
# 
# Path: mugen/utilities/location.py
# def intervals_from_locations(locations: List[float]) -> List[float]:
# def locations_from_intervals(intervals: List[float]) -> List[float]:
# def start_end_locations_from_locations(
#     locations: List[float],
# ) -> Tuple[List[float], List[float]]:
# def start_end_locations_from_intervals(
#     intervals: List[float],
# ) -> Tuple[List[float], List[float]]:
# 
# Path: mugen/utilities/system.py
# TEMP_PATH_BASE = tempfile.TemporaryDirectory().name
# def touch(filename):
# def ensure_directory_exists(*directories):
# def recreate_directory(*directories):
# def list_directory(path, include_hidden=False):
# def list_directory_files(directory: str, include_hidden=False) -> List[str]:
# def run_command(command) -> CompletedProcess:
# def generate_temp_file_path(extension: str) -> str:
# def use_temporary_file_fallback(path_var: str, extension: str):
#     def _use_temporary_file_path(path_variable):
# 
# Path: mugen/utilities/system.py
# def use_temporary_file_fallback(path_var: str, extension: str):
#     """
#     Decorator to set path_var to a temporary file path if it is None. Does not create the file.
# 
#     Parameters
#     ----------
#     path_var
#         A variable expecting a file path
# 
#     extension
#         extension for the temporary file
#     """
# 
#     def _use_temporary_file_path(path_variable):
#         return path_variable or generate_temp_file_path(extension)
# 
#     return preprocess_args(_use_temporary_file_path, [path_var])


from subprocess import CalledProcessError
from typing import Any, List, NamedTuple, Optional
from mugen.exceptions import ParameterError
from mugen.utilities import location, system
from mugen.utilities.system import use_temporary_file_fallback
import pysrt
    start_time: float
    end_time: float


class SubtitleTrack:
    name: str
    subtitles: List[Subtitle]
    default: bool

    def __init__(self, subtitles: List[Subtitle], name: str, *, default: bool = False):
        self.subtitles = subtitles
        self.name = name
        self.default = default

    @classmethod
    def create(
        cls,
        texts: List[Any],
        name: str,
        *,
        locations: Optional[List[float]] = None,
        durations: Optional[List[float]] = None,
        default: bool = False,
    ) -> "SubtitleTrack":
        subtitles = []
        if locations:
            start_times, end_times = location.start_end_locations_from_locations(
                locations
            )
        elif durations:

# Path: mugen/exceptions.py
# class ParameterError(MugenError):
#     """
#     Exception class for mal-formed inputs
#     """
# 
#     pass
# 
# Path: mugen/utilities/location.py
# def intervals_from_locations(locations: List[float]) -> List[float]:
# def locations_from_intervals(intervals: List[float]) -> List[float]:
# def start_end_locations_from_locations(
#     locations: List[float],
# ) -> Tuple[List[float], List[float]]:
# def start_end_locations_from_intervals(
#     intervals: List[float],
# ) -> Tuple[List[float], List[float]]:
# 
# Path: mugen/utilities/system.py
# TEMP_PATH_BASE = tempfile.TemporaryDirectory().name
# def touch(filename):
# def ensure_directory_exists(*directories):
# def recreate_directory(*directories):
# def list_directory(path, include_hidden=False):
# def list_directory_files(directory: str, include_hidden=False) -> List[str]:
# def run_command(command) -> CompletedProcess:
# def generate_temp_file_path(extension: str) -> str:
# def use_temporary_file_fallback(path_var: str, extension: str):
#     def _use_temporary_file_path(path_variable):
# 
# Path: mugen/utilities/system.py
# def use_temporary_file_fallback(path_var: str, extension: str):
#     """
#     Decorator to set path_var to a temporary file path if it is None. Does not create the file.
# 
#     Parameters
#     ----------
#     path_var
#         A variable expecting a file path
# 
#     extension
#         extension for the temporary file
#     """
# 
#     def _use_temporary_file_path(path_variable):
#         return path_variable or generate_temp_file_path(extension)
# 
#     return preprocess_args(_use_temporary_file_path, [path_var])


# Path: mugen/video/io/tracks.py
from subprocess import CalledProcessError
from typing import Any, List, NamedTuple, Optional
from mugen.exceptions import ParameterError
from mugen.utilities import location, system
from mugen.utilities.system import use_temporary_file_fallback
import pysrt

    start_time: float
    end_time: float


class SubtitleTrack:
    name: str
    subtitles: List[Subtitle]
    default: bool

    def __init__(self, subtitles: List[Subtitle], name: str, *, default: bool = False):
        self.subtitles = subtitles
        self.name = name
        self.default = default

    @classmethod
    def create(
        cls,
        texts: List[Any],
        name: str,
        *,
        locations: Optional[List[float]] = None,
        durations: Optional[List[float]] = None,
        default: bool = False,
    ) -> "SubtitleTrack":
        subtitles = []
        if locations:
            start_times, end_times = location.start_end_locations_from_locations(
                locations
            )
        elif durations:

            start_times, end_times = location.start_end_locations_from_intervals(