Skip to content

generic

Classes:

ClipLengthError

ClipLengthError(
    message: SupportsString | None = None,
    func: FuncExcept | None = None,
    reason: Any = None,
    **kwargs: Any
)

Bases: CustomOverflowError

Raised when a generic clip length error occurs.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

Attributes:

Source code in jetpytools/exceptions/base.py
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
def __init__(
    self, message: SupportsString | None = None, func: FuncExcept | None = None, reason: Any = None, **kwargs: Any
) -> None:
    """
    Instantiate a new exception with pretty printing and more.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """

    self.message = message
    self.func = func
    self.reason = reason
    self.kwargs = kwargs

    super().__init__(message)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

Source code in vstools/exceptions/generic.py
518
519
520
521
522
523
524
525
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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

check(
    func: FuncExcept,
    /,
    *formats: VideoFormatLike | HoldsVideoFormat,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
529
530
@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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

Source code in vstools/exceptions/generic.py
538
539
540
541
542
543
544
545
546
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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

check(
    func: FuncExcept,
    clip: VideoFormatLike | HoldsVideoFormat,
    ref: VideoFormatLike | HoldsVideoFormat,
    /,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
550
551
552
553
554
555
556
557
558
@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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

Attributes:

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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

Attributes:

Source code in vstools/exceptions/generic.py
48
49
50
51
52
53
54
55
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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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: ...

MismatchError

MismatchError(
    func: FuncExcept,
    items: Iterable[Any],
    message: SupportsString = "All items must be equal!",
    reason: Any = "{reduced_items}",
    **kwargs: Any
)

Bases: CustomValueError

Raised when there's a mismatch between two or more values.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

Source code in jetpytools/exceptions/generic.py
22
23
24
25
26
27
28
29
30
def __init__(
    self,
    func: FuncExcept,
    items: Iterable[Any],
    message: SupportsString = "All items must be equal!",
    reason: Any = "{reduced_items}",
    **kwargs: Any,
) -> None:
    super().__init__(message, func, reason, **kwargs, reduced_items=iter(self._reduce(items)))

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

check(func: FuncExcept, /, *items: Any, **kwargs: Any) -> None
Source code in jetpytools/exceptions/generic.py
32
33
34
35
@classmethod
def check(cls, func: FuncExcept, /, *items: Any, **kwargs: Any) -> None:
    if len(cls._reduce(items)) != 1:
        raise cls(func, items, **kwargs)

MismatchRefError

MismatchRefError(
    func: FuncExcept,
    base: T,
    ref: T,
    message: SupportsString = "All items must be equal!",
    **kwargs: Any
)

Bases: MismatchError

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

Source code in jetpytools/exceptions/generic.py
39
40
41
42
def __init__[T](
    self, func: FuncExcept, base: T, ref: T, message: SupportsString = "All items must be equal!", **kwargs: Any
) -> None:
    super().__init__(func, [base, ref], message, **kwargs)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

check(func: FuncExcept, /, *items: Any, **kwargs: Any) -> None
Source code in jetpytools/exceptions/generic.py
44
45
46
47
@classmethod
def check(cls, func: FuncExcept, /, *items: Any, **kwargs: Any) -> None:
    if len(cls._reduce(items)) != 1:
        raise cls(func, *items, **kwargs)

ResolutionsMismatchError

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

Bases: MismatchError

Raised when clips with different resolutions are given.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

Source code in vstools/exceptions/generic.py
570
571
572
573
574
575
576
577
def __init__(
    self,
    func: FuncExcept,
    resolutions: Iterable[tuple[int, int] | vs.VideoNode],
    message: SupportsString = "All the resolutions must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, resolutions, message, **kwargs)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

check(
    func: FuncExcept,
    /,
    *resolutions: tuple[int, int] | VideoNode,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
581
582
@classmethod
def check(cls, func: FuncExcept, /, *resolutions: tuple[int, int] | vs.VideoNode, **kwargs: Any) -> None: ...

ResolutionsRefClipMismatchError

ResolutionsRefClipMismatchError(
    func: FuncExcept,
    clip: tuple[int, int] | VideoNode,
    ref: tuple[int, int] | 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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

Attributes:

Source code in vstools/exceptions/generic.py
590
591
592
593
594
595
596
597
598
def __init__(
    self,
    func: FuncExcept,
    clip: tuple[int, int] | vs.VideoNode,
    ref: tuple[int, int] | vs.VideoNode,
    message: SupportsString = "The resolution of ref and main clip must be equal!",
    **kwargs: Any,
) -> None:
    super().__init__(func, clip, ref, message, **kwargs)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

check(
    func: FuncExcept,
    clip: tuple[int, int] | VideoNode,
    ref: tuple[int, int] | VideoNode,
    /,
    **kwargs: Any,
) -> None
Source code in vstools/exceptions/generic.py
602
603
604
605
606
607
608
609
610
@classmethod
def check(  # type: ignore[override]
    cls,
    func: FuncExcept,
    clip: tuple[int, int] | vs.VideoNode,
    ref: tuple[int, int] | 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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

Attributes:

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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

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

Attributes:

Source code in vstools/exceptions/generic.py
181
182
183
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
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,
    )

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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
215
216
217
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
@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:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

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

Attributes:

Source code in vstools/exceptions/generic.py
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
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,
    )

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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:

Raises:

Source code in vstools/exceptions/generic.py
413
414
415
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
@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:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

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

Attributes:

Source code in vstools/exceptions/generic.py
253
254
255
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
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,
    )

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

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
287
288
289
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
@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:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

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

Attributes:

Source code in vstools/exceptions/generic.py
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
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,
    )

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

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

Parameters:

Raises:

Source code in vstools/exceptions/generic.py
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
@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:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

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

Attributes:

Source code in vstools/exceptions/generic.py
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
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)

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

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

Parameters:

Raises:

Source code in vstools/exceptions/generic.py
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
@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:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

  • check

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

Attributes:

Source code in vstools/exceptions/generic.py
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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,
    )

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

check classmethod

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

Parameters:

Raises:

Source code in vstools/exceptions/generic.py
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@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.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

Attributes:

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

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)

VariableResolutionError

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

Bases: CustomValueError

Raised when clip is of a variable resolution.

Instantiate a new exception with pretty printing and more.

Parameters:

  • message

    (SupportsString | None, default: None ) –

    Message of the error.

  • func

    (FuncExcept | None, default: None ) –

    Function this exception was raised from.

  • reason

    (Any, default: None ) –

    Reason of the exception. For example, an optional parameter.

Methods:

  • __call__

    Copy an existing exception with defaults and instantiate a new one.

  • catch

    Create a context manager that catches exceptions of this class type.

Attributes:

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

func instance-attribute

func = func

kwargs instance-attribute

kwargs = kwargs

message instance-attribute

message = message

reason instance-attribute

reason = reason

__call__

__call__(
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any
) -> Self

Copy an existing exception with defaults and instantiate a new one.

Parameters:

Source code in jetpytools/exceptions/base.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
def __call__(
    self,
    message: SupportsString | None | MissingT = MISSING,
    func: FuncExcept | None | MissingT = MISSING,
    reason: SupportsString | FuncExcept | None | MissingT = MISSING,
    **kwargs: Any,
) -> Self:
    """
    Copy an existing exception with defaults and instantiate a new one.

    Args:
        message: Message of the error.
        func: Function this exception was raised from.
        reason: Reason of the exception. For example, an optional parameter.
    """
    from copy import deepcopy

    err = deepcopy(self)

    if message is not MISSING:
        err.message = message

    if func is not MISSING:
        err.func = func

    if reason is not MISSING:
        err.reason = reason

    err.kwargs |= kwargs

    return err

catch classmethod

catch() -> CatchError[Self]

Create a context manager that catches exceptions of this class type.

Returns:

  • CatchError[Self]

    CatchError[Self]: A context manager that will catch and store exceptions of type cls when used in a with block.

Source code in jetpytools/exceptions/base.py
134
135
136
137
138
139
140
141
142
143
@classmethod
def catch(cls) -> CatchError[Self]:
    """
    Create a context manager that catches exceptions of this class type.

    Returns:
        CatchError[Self]: A context manager that will catch and store exceptions of type `cls`
            when used in a `with` block.
    """
    return CatchError(cls)