Skip to content

generic

Classes:

ClipLengthError

Bases: CustomOverflowError

Raised when a generic clip length error occurs.

FormatsMismatchError

FormatsMismatchError(
    func: FuncExcept,
    formats: Iterable[VideoFormatLike | HoldsVideoFormat],
    message: SupportsString = "All specified formats must be equal!",
    **kwargs: Any
)

Bases: MismatchError

Raised when clips with different formats are given.

Methods:

Source code in vstools/exceptions/generic.py
521
522
523
524
525
526
527
528
def __init__(
    self,
    func: FuncExcept,
    formats: Iterable[VideoFormatLike | HoldsVideoFormat],
    message: SupportsString = "All specified formats must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, formats, message, **kwargs)

check classmethod

check(
    func: FuncExcept,
    /,
    *formats: VideoFormatLike | HoldsVideoFormat,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
532
533
@classmethod
def check(cls, func: FuncExcept, /, *formats: VideoFormatLike | HoldsVideoFormat, **kwargs: Any) -> None: ...

FormatsRefClipMismatchError

FormatsRefClipMismatchError(
    func: FuncExcept,
    clip: VideoFormatLike | HoldsVideoFormat,
    ref: VideoFormatLike | HoldsVideoFormat,
    message: SupportsString = "The format of ref and main clip must be equal!",
    **kwargs: Any
)

Bases: MismatchRefError, FormatsMismatchError

Raised when a ref clip and the main clip have different formats.

Methods:

Source code in vstools/exceptions/generic.py
541
542
543
544
545
546
547
548
549
def __init__(
    self,
    func: FuncExcept,
    clip: VideoFormatLike | HoldsVideoFormat,
    ref: VideoFormatLike | HoldsVideoFormat,
    message: SupportsString = "The format of ref and main clip must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, clip, ref, message, **kwargs)

check classmethod

check(
    func: FuncExcept,
    clip: VideoFormatLike | HoldsVideoFormat,
    ref: VideoFormatLike | HoldsVideoFormat,
    /,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
553
554
555
556
557
558
559
560
561
@classmethod
def check(  # type: ignore[override]
    cls,
    func: FuncExcept,
    clip: VideoFormatLike | HoldsVideoFormat,
    ref: VideoFormatLike | HoldsVideoFormat,
    /,
    **kwargs: Any,
) -> None: ...

FramePropError

FramePropError(
    func: FuncExcept,
    key: str,
    message: SupportsString = 'Error while trying to get frame prop "{key}"!',
    **kwargs: Any
)

Bases: CustomKeyError

Raised when there is an error with the frame props.

Source code in vstools/exceptions/generic.py
721
722
723
724
725
726
727
728
def __init__(
    self,
    func: FuncExcept,
    key: str,
    message: SupportsString = 'Error while trying to get frame prop "{key}"!',
    **kwargs: Any,
) -> None:
    super().__init__(message, func, key=key, **kwargs)

FramerateMismatchError

FramerateMismatchError(
    func: FuncExcept,
    framerates: Iterable[VideoNode | Fraction | tuple[int, int] | float],
    message: SupportsString = "All the framerates must be equal!",
    **kwargs: Any
)

Bases: MismatchError

Raised when clips with a different framerate are given.

Methods:

Source code in vstools/exceptions/generic.py
671
672
673
674
675
676
677
678
def __init__(
    self,
    func: FuncExcept,
    framerates: Iterable[vs.VideoNode | Fraction | tuple[int, int] | float],
    message: SupportsString = "All the framerates must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, framerates, message, **kwargs)

check classmethod

check(
    func: FuncExcept,
    /,
    *framerates: VideoNode | Fraction | tuple[int, int] | float,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
682
683
684
685
@classmethod
def check(
    cls, func: FuncExcept, /, *framerates: vs.VideoNode | Fraction | tuple[int, int] | float, **kwargs: Any
) -> None: ...

FramerateRefClipMismatchError

FramerateRefClipMismatchError(
    func: FuncExcept,
    clip: VideoNode | Fraction | tuple[int, int] | float,
    ref: VideoNode | Fraction | tuple[int, int] | float,
    message: SupportsString = "The framerate of the ref and main clip must be equal!",
    **kwargs: Any
)

Bases: MismatchRefError, FramerateMismatchError

Raised when a ref clip and the main clip have a different framerate.

Methods:

Source code in vstools/exceptions/generic.py
693
694
695
696
697
698
699
700
701
def __init__(
    self,
    func: FuncExcept,
    clip: vs.VideoNode | Fraction | tuple[int, int] | float,
    ref: vs.VideoNode | Fraction | tuple[int, int] | float,
    message: SupportsString = "The framerate of the ref and main clip must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, clip, ref, message, **kwargs)

check classmethod

check(
    func: FuncExcept,
    clip: VideoNode | Fraction | tuple[int, int] | float,
    ref: VideoNode | Fraction | tuple[int, int] | float,
    /,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
705
706
707
708
709
710
711
712
713
@classmethod
def check(  # type: ignore[override]
    cls,
    func: FuncExcept,
    clip: vs.VideoNode | Fraction | tuple[int, int] | float,
    ref: vs.VideoNode | Fraction | tuple[int, int] | float,
    /,
    **kwargs: Any,
) -> None: ...

FramesLengthError

FramesLengthError(
    func: FuncExcept,
    var_name: str,
    message: SupportsString = '"{var_name}" can\'t be greater than the clip length!',
    **kwargs: Any
)

Bases: CustomOverflowError

Source code in vstools/exceptions/generic.py
51
52
53
54
55
56
57
58
def __init__(
    self,
    func: FuncExcept,
    var_name: str,
    message: SupportsString = '"{var_name}" can\'t be greater than the clip length!',
    **kwargs: Any,
) -> None:
    super().__init__(message, func, var_name=var_name, **kwargs)

LengthMismatchError

LengthMismatchError(
    func: FuncExcept,
    lengths: Iterable[int | Sized],
    message: SupportsString = "All the lengths must be equal!",
    **kwargs: Any
)

Bases: MismatchError

Raised when clips with a different number of total frames are given.

Methods:

Source code in vstools/exceptions/generic.py
622
623
624
625
626
627
628
629
def __init__(
    self,
    func: FuncExcept,
    lengths: Iterable[int | Sized],
    message: SupportsString = "All the lengths must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, lengths, message, iter(map(self._item_to_name, lengths)), **kwargs)

check classmethod

check(func: FuncExcept, /, *lengths: int | Sized, **kwargs: Any) -> None
Source code in vstools/exceptions/generic.py
633
634
@classmethod
def check(cls, func: FuncExcept, /, *lengths: int | Sized, **kwargs: Any) -> None: ...

LengthRefClipMismatchError

LengthRefClipMismatchError(
    func: FuncExcept,
    clip: int | RawNode,
    ref: int | RawNode,
    message: SupportsString = "The main clip and ref clip length must be equal!",
    **kwargs: Any
)

Bases: MismatchRefError, LengthMismatchError

Raised when a ref clip and the main clip have a different number of total frames.

Methods:

Source code in vstools/exceptions/generic.py
642
643
644
645
646
647
648
649
650
def __init__(
    self,
    func: FuncExcept,
    clip: int | vs.RawNode,
    ref: int | vs.RawNode,
    message: SupportsString = "The main clip and ref clip length must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, clip, ref, message, **kwargs)

check classmethod

check(
    func: FuncExcept, clip: int | RawNode, ref: int | RawNode, /, **kwargs: Any
) -> None
Source code in vstools/exceptions/generic.py
654
655
656
657
@classmethod
def check(  # type: ignore[override]
    cls, func: FuncExcept, clip: int | vs.RawNode, ref: int | vs.RawNode, /, **kwargs: Any
) -> None: ...

ResolutionsMismatchError

ResolutionsMismatchError(
    func: FuncExcept,
    resolutions: Iterable[Resolution | VideoNode],
    message: SupportsString = "All the resolutions must be equal!",
    **kwargs: Any
)

Bases: MismatchError

Raised when clips with different resolutions are given.

Methods:

Source code in vstools/exceptions/generic.py
575
576
577
578
579
580
581
582
def __init__(
    self,
    func: FuncExcept,
    resolutions: Iterable[Resolution | vs.VideoNode],
    message: SupportsString = "All the resolutions must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, resolutions, message, **kwargs)

check classmethod

check(
    func: FuncExcept, /, *resolutions: Resolution | VideoNode, **kwargs: Any
) -> None
Source code in vstools/exceptions/generic.py
586
587
@classmethod
def check(cls, func: FuncExcept, /, *resolutions: Resolution | vs.VideoNode, **kwargs: Any) -> None: ...

ResolutionsRefClipMismatchError

ResolutionsRefClipMismatchError(
    func: FuncExcept,
    clip: Resolution | VideoNode,
    ref: Resolution | VideoNode,
    message: SupportsString = "The resolution of ref and main clip must be equal!",
    **kwargs: Any
)

Bases: MismatchRefError, ResolutionsMismatchError

Raised when a ref clip and the main clip have different resolutions.

Methods:

Source code in vstools/exceptions/generic.py
595
596
597
598
599
600
601
602
603
def __init__(
    self,
    func: FuncExcept,
    clip: Resolution | vs.VideoNode,
    ref: Resolution | vs.VideoNode,
    message: SupportsString = "The resolution of ref and main clip must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, clip, ref, message, **kwargs)

check classmethod

check(
    func: FuncExcept,
    clip: Resolution | VideoNode,
    ref: Resolution | VideoNode,
    /,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
607
608
609
610
@classmethod
def check(  # type: ignore[override]
    cls, func: FuncExcept, clip: Resolution | vs.VideoNode, ref: Resolution | vs.VideoNode, /, **kwargs: Any
) -> None: ...

TopFieldFirstError

TopFieldFirstError(
    func: FuncExcept,
    message: SupportsString = "You must set `tff` for this clip!",
    **kwargs: Any
)

Bases: CustomValueError

Raised when the user must pass a TFF argument.

Source code in vstools/exceptions/generic.py
736
737
738
739
def __init__(
    self, func: FuncExcept, message: SupportsString = "You must set `tff` for this clip!", **kwargs: Any
) -> None:
    super().__init__(message, func, **kwargs)

UnsupportedColorFamilyError

UnsupportedColorFamilyError(
    func: FuncExcept | None,
    wrong: (
        VideoFormatLike
        | HoldsVideoFormat
        | ColorFamily
        | Iterable[VideoFormatLike | HoldsVideoFormat | ColorFamily]
    ),
    correct: (
        VideoFormatLike
        | HoldsVideoFormat
        | ColorFamily
        | Iterable[VideoFormatLike | HoldsVideoFormat | ColorFamily]
    ) = YUV,
    message: SupportsString = "Input clip must be of {correct} color family, not {wrong}.",
    **kwargs: Any
)

Bases: _UnsupportedError

Raised when an color family value is not supported.

Initialize the exception.

Parameters:

Methods:

  • check

    Ensure that the given color family(ies) match the expected family(ies).

Source code in vstools/exceptions/generic.py
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
def __init__(
    self,
    func: FuncExcept | None,
    wrong: VideoFormatLike
    | HoldsVideoFormat
    | vs.ColorFamily
    | Iterable[VideoFormatLike | HoldsVideoFormat | vs.ColorFamily],
    correct: VideoFormatLike
    | HoldsVideoFormat
    | vs.ColorFamily
    | Iterable[VideoFormatLike | HoldsVideoFormat | vs.ColorFamily] = vs.YUV,
    message: SupportsString = "Input clip must be of {correct} color family, not {wrong}.",
    **kwargs: Any,
) -> None:
    """
    Initialize the exception.

    Args:
        func: Function where the exception was raised.
        wrong: The unsupported color family(ies).
        correct: The expected color family(ies).
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.
    """
    from ..utils import get_color_family

    super().__init__(
        func,
        {get_color_family(c).name for c in to_arr(wrong)},  # type: ignore[arg-type]
        {get_color_family(c).name for c in to_arr(correct)},  # type: ignore[arg-type]
        message,
        **kwargs,
    )

check classmethod

check(
    to_check: (
        VideoFormatLike
        | HoldsVideoFormat
        | ColorFamily
        | Iterable[VideoFormatLike | HoldsVideoFormat | ColorFamily]
    ),
    correct: (
        VideoFormatLike
        | HoldsVideoFormat
        | ColorFamily
        | Iterable[VideoFormatLike | HoldsVideoFormat | ColorFamily]
    ),
    func: FuncExcept | None = None,
    message: SupportsString | None = None,
    **kwargs: Any
) -> None

Ensure that the given color family(ies) match the expected family(ies).

Parameters:

Raises:

Source code in vstools/exceptions/generic.py
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
@classmethod
def check(
    cls,
    to_check: VideoFormatLike
    | HoldsVideoFormat
    | vs.ColorFamily
    | Iterable[VideoFormatLike | HoldsVideoFormat | vs.ColorFamily],
    correct: VideoFormatLike
    | HoldsVideoFormat
    | vs.ColorFamily
    | Iterable[VideoFormatLike | HoldsVideoFormat | vs.ColorFamily],
    func: FuncExcept | None = None,
    message: SupportsString | None = None,
    **kwargs: Any,
) -> None:
    """
    Ensure that the given color family(ies) match the expected family(ies).

    Args:
        to_check: The color family(ies) to check.
        correct: The expected color family(ies).
        func: Function where the exception was raised.
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.

    Raises:
        UnsupportedColorFamilyError: If any given color family does not match the expected color family(ies).
    """
    from ..utils import get_color_family

    cls._check_builder(get_color_family, to_check, correct, func, message, **kwargs)  # type: ignore[arg-type]

UnsupportedFramerateError

UnsupportedFramerateError(
    func: FuncExcept,
    wrong: VideoNode | Fraction | Iterable[VideoNode | Fraction],
    correct: VideoNode | Fraction | Iterable[VideoNode | Fraction],
    message: SupportsString = "Input clip must be of {correct} framerate, not {wrong}.",
    **kwargs: Any
)

Bases: _UnsupportedError

Raised when a clip's framerate does not match the expected framerate.

Initialize the exception.

Parameters:

  • func

    (FuncExcept) –

    Function where the exception was raised.

  • wrong

    (VideoNode | Fraction | Iterable[VideoNode | Fraction]) –

    The unsupported framerate(s).

  • correct

    (VideoNode | Fraction | Iterable[VideoNode | Fraction]) –

    The expected framerate(s).

  • message

    (SupportsString, default: 'Input clip must be of {correct} framerate, not {wrong}.' ) –

    Exception message template supporting {correct} and {wrong} placeholders.

  • **kwargs

    (Any, default: {} ) –

    Additional keyword arguments passed to the exception.

Methods:

  • check

    Ensure that the given framerate(s) match the expected framerate(s).

Source code in vstools/exceptions/generic.py
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
def __init__(
    self,
    func: FuncExcept,
    wrong: vs.VideoNode | Fraction | Iterable[vs.VideoNode | Fraction],
    correct: vs.VideoNode | Fraction | Iterable[vs.VideoNode | Fraction],
    message: SupportsString = "Input clip must be of {correct} framerate, not {wrong}.",
    **kwargs: Any,
) -> None:
    """
    Initialize the exception.

    Args:
        func: Function where the exception was raised.
        wrong: The unsupported framerate(s).
        correct: The expected framerate(s).
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.
    """
    from ..utils import get_framerate

    super().__init__(
        func,
        {get_framerate(f) for f in to_arr(wrong)},  # type: ignore[arg-type]
        {get_framerate(f) for f in to_arr(correct)},  # type: ignore[arg-type]
        message,
        **kwargs,
    )

check classmethod

check(
    to_check: (
        VideoNode
        | Fraction
        | tuple[int, int]
        | float
        | Iterable[VideoNode | Fraction | tuple[int, int] | float]
    ),
    correct: (
        VideoNode
        | Fraction
        | tuple[int, int]
        | float
        | Iterable[VideoNode | Fraction | tuple[int, int] | float]
    ),
    func: FuncExcept | None = None,
    message: SupportsString = "Input clip must have {correct} framerate, not {wrong}!",
    **kwargs: Any
) -> None

Ensure that the given framerate(s) match the expected framerate(s).

Parameters:

  • to_check

    (VideoNode | Fraction | tuple[int, int] | float | Iterable[VideoNode | Fraction | tuple[int, int] | float]) –

    The framerate(s) to check.

  • correct

    (VideoNode | Fraction | tuple[int, int] | float | Iterable[VideoNode | Fraction | tuple[int, int] | float]) –

    The expected framerate(s).

  • func

    (FuncExcept | None, default: None ) –

    Function where the exception was raised.

  • message

    (SupportsString, default: 'Input clip must have {correct} framerate, not {wrong}!' ) –

    Exception message template supporting {correct} and {wrong} placeholders.

  • **kwargs

    (Any, default: {} ) –

    Additional keyword arguments passed to the exception.

Raises:

Source code in vstools/exceptions/generic.py
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
@classmethod
def check(
    cls,
    to_check: vs.VideoNode
    | Fraction
    | tuple[int, int]
    | float
    | Iterable[vs.VideoNode | Fraction | tuple[int, int] | float],
    correct: vs.VideoNode
    | Fraction
    | tuple[int, int]
    | float
    | Iterable[vs.VideoNode | Fraction | tuple[int, int] | float],
    func: FuncExcept | None = None,
    message: SupportsString = "Input clip must have {correct} framerate, not {wrong}!",
    **kwargs: Any,
) -> None:
    """
    Ensure that the given framerate(s) match the expected framerate(s).

    Args:
        to_check: The framerate(s) to check.
        correct: The expected framerate(s).
        func: Function where the exception was raised.
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.

    Raises:
        UnsupportedFramerateError: If any given format does not match the expected format(s).
    """
    from ..utils import get_framerate

    def _resolve_correct(val: Any) -> Iterable[vs.VideoNode | Fraction | tuple[int, int] | float]:
        if isinstance(val, Iterable):
            if isinstance(val, tuple) and len(val) == 2 and all(isinstance(x, int) for x in val):
                return [val]
            return val
        return [val]

    cls._check_builder(
        get_framerate, _resolve_correct(to_check), _resolve_correct(correct), func, message, **kwargs
    )

UnsupportedSampleTypeError

UnsupportedSampleTypeError(
    func: FuncExcept | None,
    wrong: (
        VideoFormatLike
        | HoldsVideoFormat
        | SampleType
        | Iterable[VideoFormatLike | HoldsVideoFormat | SampleType]
    ),
    correct: (
        VideoFormatLike
        | HoldsVideoFormat
        | SampleType
        | Iterable[VideoFormatLike | HoldsVideoFormat | SampleType]
    ),
    message: SupportsString = "Input clip must be of {correct} sample type, not {wrong}.",
    **kwargs: Any
)

Bases: _UnsupportedError

Raised when an sample type value is not supported.

Initialize the exception.

Parameters:

Methods:

  • check

    Ensure that the given sample type(s) match the expected type(s).

Source code in vstools/exceptions/generic.py
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
def __init__(
    self,
    func: FuncExcept | None,
    wrong: VideoFormatLike
    | HoldsVideoFormat
    | vs.SampleType
    | Iterable[VideoFormatLike | HoldsVideoFormat | vs.SampleType],
    correct: VideoFormatLike
    | HoldsVideoFormat
    | vs.SampleType
    | Iterable[VideoFormatLike | HoldsVideoFormat | vs.SampleType],
    message: SupportsString = "Input clip must be of {correct} sample type, not {wrong}.",
    **kwargs: Any,
) -> None:
    """
    Initialize the exception.

    Args:
        func: Function where the exception was raised.
        wrong: The unsupported sample type(s).
        correct: The expected sample type(s).
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.
    """
    from ..utils import get_sample_type

    super().__init__(
        func,
        {get_sample_type(c).name for c in to_arr(wrong)},  # type: ignore[arg-type]
        {get_sample_type(c).name for c in to_arr(correct)},  # type: ignore[arg-type]
        message,
        **kwargs,
    )

check classmethod

check(
    to_check: (
        VideoFormatLike
        | HoldsVideoFormat
        | SampleType
        | Iterable[VideoFormatLike | HoldsVideoFormat | SampleType]
    ),
    correct: (
        VideoFormatLike
        | HoldsVideoFormat
        | SampleType
        | Iterable[VideoFormatLike | HoldsVideoFormat | SampleType]
    ),
    func: FuncExcept | None = None,
    message: SupportsString | None = None,
    **kwargs: Any
) -> None

Ensure that the given sample type(s) match the expected type(s).

Parameters:

Raises:

Source code in vstools/exceptions/generic.py
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
@classmethod
def check(
    cls,
    to_check: VideoFormatLike
    | HoldsVideoFormat
    | vs.SampleType
    | Iterable[VideoFormatLike | HoldsVideoFormat | vs.SampleType],
    correct: VideoFormatLike
    | HoldsVideoFormat
    | vs.SampleType
    | Iterable[VideoFormatLike | HoldsVideoFormat | vs.SampleType],
    func: FuncExcept | None = None,
    message: SupportsString | None = None,
    **kwargs: Any,
) -> None:
    """
    Ensure that the given sample type(s) match the expected type(s).

    Args:
        to_check: The sample type(s) to check.
        correct: The expected sample type(s).
        func: Function where the exception was raised.
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.

    Raises:
        UnsupportedSampleTypeError: If any given color family does not match the expected sample type(s).
    """
    from ..utils import get_sample_type

    cls._check_builder(get_sample_type, to_check, correct, func, message, **kwargs)  # type: ignore[arg-type]

UnsupportedSubsamplingError

UnsupportedSubsamplingError(
    func: FuncExcept,
    wrong: (
        str
        | VideoFormatLike
        | HoldsVideoFormat
        | Iterable[str | VideoFormatLike | HoldsVideoFormat]
    ),
    correct: (
        str
        | VideoFormatLike
        | HoldsVideoFormat
        | Iterable[str | VideoFormatLike | HoldsVideoFormat]
    ),
    message: SupportsString = "Input clip must be of {correct} subsampling, not {wrong}.",
    **kwargs: Any
)

Bases: _UnsupportedError

Raised when an subsampling value is not supported.

Initialize the exception.

Parameters:

Methods:

  • check

    Ensure that the given subsampling(s) match the expected subsampling(s).

Source code in vstools/exceptions/generic.py
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
def __init__(
    self,
    func: FuncExcept,
    wrong: str | VideoFormatLike | HoldsVideoFormat | Iterable[str | VideoFormatLike | HoldsVideoFormat],
    correct: str | VideoFormatLike | HoldsVideoFormat | Iterable[str | VideoFormatLike | HoldsVideoFormat],
    message: SupportsString = "Input clip must be of {correct} subsampling, not {wrong}.",
    **kwargs: Any,
) -> None:
    """
    Initialize the exception.

    Args:
        func: Function where the exception was raised.
        wrong: The unsupported subsampling(s).
        correct: The expected subsampling(s).
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.
    """
    from ..utils import get_subsampling

    super().__init__(
        func,
        {f if isinstance(f, str) else get_subsampling(f) for f in to_arr(wrong)},  # type: ignore[arg-type]
        {f if isinstance(f, str) else get_subsampling(f) for f in to_arr(correct)},  # type: ignore[arg-type]
        message,
        **kwargs,
    )

check classmethod

check(
    to_check: (
        VideoFormatLike
        | HoldsVideoFormat
        | Iterable[VideoFormatLike | HoldsVideoFormat]
    ),
    correct: (
        VideoFormatLike
        | HoldsVideoFormat
        | Iterable[VideoFormatLike | HoldsVideoFormat]
    ),
    func: FuncExcept | None = None,
    message: SupportsString | None = None,
    **kwargs: Any
) -> None

Ensure that the given subsampling(s) match the expected subsampling(s).

Parameters:

Raises:

Source code in vstools/exceptions/generic.py
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
@classmethod
def check(
    cls,
    to_check: VideoFormatLike | HoldsVideoFormat | Iterable[VideoFormatLike | HoldsVideoFormat],
    correct: VideoFormatLike | HoldsVideoFormat | Iterable[VideoFormatLike | HoldsVideoFormat],
    func: FuncExcept | None = None,
    message: SupportsString | None = None,
    **kwargs: Any,
) -> None:
    """
    Ensure that the given subsampling(s) match the expected subsampling(s).

    Args:
        to_check: The subsampling(s) to check.
        correct: The expected subsampling(s).
        func: Function where the exception was raised.
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.

    Raises:
        UnsupportedSubsamplingError: If any given format does not match the expected format(s).
    """
    from ..utils import get_subsampling

    cls._check_builder(get_subsampling, to_check, correct, func, message, **kwargs)  # type: ignore[arg-type]

UnsupportedTimecodeVersionError

UnsupportedTimecodeVersionError(
    func: FuncExcept,
    wrong: SupportsInt | Iterable[SupportsInt],
    correct: SupportsInt | Iterable[SupportsInt] = (1, 2),
    message: SupportsString = "Timecodes version be in {correct}, not {wrong}.",
    **kwargs: Any
)

Bases: _UnsupportedError

Raised when a timecode version does not match the expected version.

Initialize the exception.

Parameters:

  • func

    (FuncExcept) –

    Function where the exception was raised.

  • wrong

    (SupportsInt | Iterable[SupportsInt]) –

    The unsupported timecode(s).

  • correct

    (SupportsInt | Iterable[SupportsInt], default: (1, 2) ) –

    The expected timecode(s).

  • message

    (SupportsString, default: 'Timecodes version be in {correct}, not {wrong}.' ) –

    Exception message template supporting {correct} and {wrong} placeholders.

  • **kwargs

    (Any, default: {} ) –

    Additional keyword arguments passed to the exception.

Methods:

  • check

    Ensure that the given timecode(s) match the expected timecode(s).

Source code in vstools/exceptions/generic.py
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
def __init__(
    self,
    func: FuncExcept,
    wrong: SupportsInt | Iterable[SupportsInt],
    correct: SupportsInt | Iterable[SupportsInt] = (1, 2),
    message: SupportsString = "Timecodes version be in {correct}, not {wrong}.",
    **kwargs: Any,
) -> None:
    """
    Initialize the exception.

    Args:
        func: Function where the exception was raised.
        wrong: The unsupported timecode(s).
        correct: The expected timecode(s).
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.
    """
    super().__init__(func, {int(t) for t in to_arr(wrong)}, {int(t) for t in to_arr(correct)}, message, **kwargs)

check classmethod

check(
    func: FuncExcept,
    to_check: SupportsInt | Iterable[SupportsInt],
    correct: SupportsInt | Iterable[SupportsInt] = (1, 2),
    message: SupportsString | None = None,
    **kwargs: Any
) -> None

Ensure that the given timecode(s) match the expected timecode(s).

Parameters:

  • to_check

    (SupportsInt | Iterable[SupportsInt]) –

    The timecode(s) to check.

  • correct

    (SupportsInt | Iterable[SupportsInt], default: (1, 2) ) –

    The expected timecode(s).

  • func

    (FuncExcept) –

    Function where the exception was raised.

  • message

    (SupportsString | None, default: None ) –

    Exception message template supporting {correct} and {wrong} placeholders.

  • **kwargs

    (Any, default: {} ) –

    Additional keyword arguments passed to the exception.

Raises:

Source code in vstools/exceptions/generic.py
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
@classmethod
def check(
    cls,
    func: FuncExcept,
    to_check: SupportsInt | Iterable[SupportsInt],
    correct: SupportsInt | Iterable[SupportsInt] = (1, 2),
    message: SupportsString | None = None,
    **kwargs: Any,
) -> None:
    """
    Ensure that the given timecode(s) match the expected timecode(s).

    Args:
        to_check: The timecode(s) to check.
        correct: The expected timecode(s).
        func: Function where the exception was raised.
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.

    Raises:
        UnsupportedTimecodeVersionError: If any given format does not match the expected format(s).
    """
    cls._check_builder(int, to_check, correct, func, message, **kwargs)

UnsupportedVideoFormatError

UnsupportedVideoFormatError(
    func: FuncExcept | None,
    wrong: (
        VideoFormatLike
        | HoldsVideoFormat
        | Iterable[VideoFormatLike | HoldsVideoFormat]
    ),
    correct: (
        VideoFormatLike
        | HoldsVideoFormat
        | Iterable[VideoFormatLike | HoldsVideoFormat]
    ),
    message: SupportsString = "Input clip must be of {correct} format, not {wrong}.",
    **kwargs: Any
)

Bases: _UnsupportedError

Raised when an video format value is not supported.

Initialize the exception.

Parameters:

Methods:

  • check

    Ensure that the given video format(s) match the expected format(s).

Source code in vstools/exceptions/generic.py
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
def __init__(
    self,
    func: FuncExcept | None,
    wrong: VideoFormatLike | HoldsVideoFormat | Iterable[VideoFormatLike | HoldsVideoFormat],
    correct: VideoFormatLike | HoldsVideoFormat | Iterable[VideoFormatLike | HoldsVideoFormat],
    message: SupportsString = "Input clip must be of {correct} format, not {wrong}.",
    **kwargs: Any,
) -> None:
    """
    Initialize the exception.

    Args:
        func: Function where the exception was raised.
        wrong: The unsupported video format(s).
        correct: The expected video format(s).
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.
    """
    from ..utils import get_video_format

    super().__init__(
        func,
        {get_video_format(f).name for f in to_arr(wrong)},  # type: ignore[arg-type]
        {get_video_format(f).name for f in to_arr(correct)},  # type: ignore[arg-type]
        message,
        **kwargs,
    )

check classmethod

check(
    to_check: (
        VideoFormatLike
        | HoldsVideoFormat
        | Iterable[VideoFormatLike | HoldsVideoFormat]
    ),
    correct: (
        VideoFormatLike
        | HoldsVideoFormat
        | Iterable[VideoFormatLike | HoldsVideoFormat]
    ),
    func: FuncExcept | None = None,
    message: SupportsString | None = None,
    **kwargs: Any
) -> None

Ensure that the given video format(s) match the expected format(s).

Parameters:

Raises:

Source code in vstools/exceptions/generic.py
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
@classmethod
def check(
    cls,
    to_check: VideoFormatLike | HoldsVideoFormat | Iterable[VideoFormatLike | HoldsVideoFormat],
    correct: VideoFormatLike | HoldsVideoFormat | Iterable[VideoFormatLike | HoldsVideoFormat],
    func: FuncExcept | None = None,
    message: SupportsString | None = None,
    **kwargs: Any,
) -> None:
    """
    Ensure that the given video format(s) match the expected format(s).

    Args:
        to_check: The video format(s) to check.
        correct: The expected video format(s).
        func: Function where the exception was raised.
        message: Exception message template supporting `{correct}` and `{wrong}` placeholders.
        **kwargs: Additional keyword arguments passed to the exception.

    Raises:
        UnsupportedVideoFormatError: If any given format does not match the expected format(s).
    """
    from ..utils import get_video_format

    cls._check_builder(get_video_format, to_check, correct, func, message, **kwargs)  # type: ignore[arg-type]

VariableFormatError

VariableFormatError(
    func: FuncExcept,
    message: SupportsString = "Variable-format clips not supported!",
    **kwargs: Any
)

Bases: CustomValueError

Raised when clip is of a variable format.

Source code in vstools/exceptions/generic.py
72
73
74
75
def __init__(
    self, func: FuncExcept, message: SupportsString = "Variable-format clips not supported!", **kwargs: Any
) -> None:
    super().__init__(message, func, **kwargs)

VariableResolutionError

VariableResolutionError(
    func: FuncExcept,
    message: SupportsString = "Variable-resolution clips not supported!",
    **kwargs: Any
)

Bases: CustomValueError

Raised when clip is of a variable resolution.

Source code in vstools/exceptions/generic.py
83
84
85
86
def __init__(
    self, func: FuncExcept, message: SupportsString = "Variable-resolution clips not supported!", **kwargs: Any
) -> None:
    super().__init__(message, func, **kwargs)