# Path: mugen/mixins/Filterable.py
# class Filterable:
#     """
#     Mixin for running filters against an object and caching the results
#     """
# 
#     passed_filters: List[Filter]
#     failed_filters: List[Filter]
# 
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
# 
#         self.passed_filters = []
#         self.failed_filters = []
# 
#     def apply_filters(
#         self, filters: List[Filter], short_circuit: bool = True
#     ) -> Tuple[List[Filter], List[Filter]]:
#         """
#         Parameters
#         ----------
#         filters
#             Filters to test
# 
#         short_circuit
#             Whether or not the function should exit early on a filter failure
# 
#         Returns
#         -------
#         True if all filters passed, false otherwise
#         """
#         passed_filters = []
#         failed_filters = []
#         for filter in filters:
#             if filter(self):
#                 passed_filters.append(filter)
#             else:
#                 failed_filters.append(filter)
# 
#                 if short_circuit:
#                     break
# 
#         return passed_filters, failed_filters
# 
# Path: mugen/mixins/Persistable.py
# class Persistable:
#     """
#     Mixin for persisting objects
#     """
# 
#     @use_temporary_file_fallback("output_path", PICKLE_EXTENSION)
#     def save(self, output_path: Optional[str] = None):
#         with open(output_path, "wb") as output_file:
#             dill.dump(self, output_file)
# 
#         return output_path
# 
#     @classmethod
#     def load(cls, input_path: str):
#         with open(input_path, "rb") as input_file:
#             persistable = dill.load(input_file)
# 
#         return persistable
# 
# Path: mugen/utilities/conversion.py
# def float_to_fraction(float_var: float) -> Fraction:
# def time_to_seconds(time: TIME_FORMAT) -> float:
# def seconds_to_time_code(seconds: float) -> str:
# def hex_to_rgb(hex_value) -> List[int]:
# def color_to_hex_code(color):
# def convert_float_to_fraction(*variable_names: str):
# def convert_time_to_seconds(*variable_names: str):
# def convert_color_to_hex_code(*variable_names: str):
# 
# Path: mugen/video/constants.py
# LIST_3D = numpy.ndarray
# 
# Path: mugen/video/effects.py
# class VideoEffectList(MugenList):
#     """
#     Wrapper for a list of Effects, providing convenience methods
#     """
# 
#     def __init__(self, effects: Optional[List[VideoEffect]] = None):
#         super().__init__(effects)
# 
#     def add_crossfade(self, duration: float = ONE_SECOND):
#         """
#         Adds a crossfade effect to the beginning of the video segment.
# 
#         Parameters
#         ----------
#         duration
#             duration of the effect
#         """
#         self.append(CrossFade(duration))
# 
#     def add_fadein(self, duration: float = ONE_SECOND, color: str = Color.BLACK):
#         """
#         Adds a fade-in effect to the video segment.
# 
#         Parameters
#         ----------
#         duration
#             duration of the effect
# 
#         color
#             hex code of the color to fade in from, i.e. #000000 for black.
#             OR the special inputs 'black' and 'white'.
#         """
#         self.append(FadeIn(duration, color))
# 
#     def add_fadeout(self, duration: float = ONE_SECOND, color: str = Color.BLACK):
#         """
#         Adds a fade-out effect to the video segment.
# 
#         Parameters
#         ----------
#         duration
#             duration of the effect
# 
#         color
#             hex code of the color to fade out to, i.e. #000000 for black.
#             OR the special inputs 'black' and 'white'.
#         """
#         self.append(FadeOut(duration, color))
# 
# Path: mugen/video/sizing.py
# class Dimensions(DimensionsBase):
#     __slots__ = ()
# 
#     @property
#     def aspect_ratio(self) -> float:
#         return self.width / self.height
# 
#     @property
#     def resolution(self) -> int:
#         return self.width * self.height


import copy
import mugen.video.effects as video_effects
import mugen.video.sizing as video_sizing
from abc import ABC, abstractmethod
from typing import List, Tuple
from moviepy.editor import VideoClip
from mugen.mixins.Filterable import Filterable
from mugen.mixins.Persistable import Persistable
from mugen.utilities import conversion
from mugen.video.constants import LIST_3D
from mugen.video.effects import VideoEffectList
from mugen.video.sizing import Dimensions




class Segment(Filterable, Persistable, ABC):
    """
    A segment of content in a video.
    Simulates a wrapper for moviepy's VideoClip class.

    Attributes
    ----------
    effects
        A list of effects to apply to the segment when composed
    """

    effects: VideoEffectList

    DEFAULT_VIDEO_FPS = 24

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)


# Path: mugen/mixins/Filterable.py
# class Filterable:
#     """
#     Mixin for running filters against an object and caching the results
#     """
# 
#     passed_filters: List[Filter]
#     failed_filters: List[Filter]
# 
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
# 
#         self.passed_filters = []
#         self.failed_filters = []
# 
#     def apply_filters(
#         self, filters: List[Filter], short_circuit: bool = True
#     ) -> Tuple[List[Filter], List[Filter]]:
#         """
#         Parameters
#         ----------
#         filters
#             Filters to test
# 
#         short_circuit
#             Whether or not the function should exit early on a filter failure
# 
#         Returns
#         -------
#         True if all filters passed, false otherwise
#         """
#         passed_filters = []
#         failed_filters = []
#         for filter in filters:
#             if filter(self):
#                 passed_filters.append(filter)
#             else:
#                 failed_filters.append(filter)
# 
#                 if short_circuit:
#                     break
# 
#         return passed_filters, failed_filters
# 
# Path: mugen/mixins/Persistable.py
# class Persistable:
#     """
#     Mixin for persisting objects
#     """
# 
#     @use_temporary_file_fallback("output_path", PICKLE_EXTENSION)
#     def save(self, output_path: Optional[str] = None):
#         with open(output_path, "wb") as output_file:
#             dill.dump(self, output_file)
# 
#         return output_path
# 
#     @classmethod
#     def load(cls, input_path: str):
#         with open(input_path, "rb") as input_file:
#             persistable = dill.load(input_file)
# 
#         return persistable
# 
# Path: mugen/utilities/conversion.py
# def float_to_fraction(float_var: float) -> Fraction:
# def time_to_seconds(time: TIME_FORMAT) -> float:
# def seconds_to_time_code(seconds: float) -> str:
# def hex_to_rgb(hex_value) -> List[int]:
# def color_to_hex_code(color):
# def convert_float_to_fraction(*variable_names: str):
# def convert_time_to_seconds(*variable_names: str):
# def convert_color_to_hex_code(*variable_names: str):
# 
# Path: mugen/video/constants.py
# LIST_3D = numpy.ndarray
# 
# Path: mugen/video/effects.py
# class VideoEffectList(MugenList):
#     """
#     Wrapper for a list of Effects, providing convenience methods
#     """
# 
#     def __init__(self, effects: Optional[List[VideoEffect]] = None):
#         super().__init__(effects)
# 
#     def add_crossfade(self, duration: float = ONE_SECOND):
#         """
#         Adds a crossfade effect to the beginning of the video segment.
# 
#         Parameters
#         ----------
#         duration
#             duration of the effect
#         """
#         self.append(CrossFade(duration))
# 
#     def add_fadein(self, duration: float = ONE_SECOND, color: str = Color.BLACK):
#         """
#         Adds a fade-in effect to the video segment.
# 
#         Parameters
#         ----------
#         duration
#             duration of the effect
# 
#         color
#             hex code of the color to fade in from, i.e. #000000 for black.
#             OR the special inputs 'black' and 'white'.
#         """
#         self.append(FadeIn(duration, color))
# 
#     def add_fadeout(self, duration: float = ONE_SECOND, color: str = Color.BLACK):
#         """
#         Adds a fade-out effect to the video segment.
# 
#         Parameters
#         ----------
#         duration
#             duration of the effect
# 
#         color
#             hex code of the color to fade out to, i.e. #000000 for black.
#             OR the special inputs 'black' and 'white'.
#         """
#         self.append(FadeOut(duration, color))
# 
# Path: mugen/video/sizing.py
# class Dimensions(DimensionsBase):
#     __slots__ = ()
# 
#     @property
#     def aspect_ratio(self) -> float:
#         return self.width / self.height
# 
#     @property
#     def resolution(self) -> int:
#         return self.width * self.height


# Path: mugen/video/segments/Segment.py
import copy
import mugen.video.effects as video_effects
import mugen.video.sizing as video_sizing
from abc import ABC, abstractmethod
from typing import List, Tuple
from moviepy.editor import VideoClip
from mugen.mixins.Filterable import Filterable
from mugen.mixins.Persistable import Persistable
from mugen.utilities import conversion
from mugen.video.constants import LIST_3D
from mugen.video.effects import VideoEffectList
from mugen.video.sizing import Dimensions





class Segment(Filterable, Persistable, ABC):
    """
    A segment of content in a video.
    Simulates a wrapper for moviepy's VideoClip class.

    Attributes
    ----------
    effects
        A list of effects to apply to the segment when composed
    """

    effects: VideoEffectList

    DEFAULT_VIDEO_FPS = 24

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)


        self.effects = VideoEffectList()