typing

Typing helpers.

class deltona.typing.CDStatus(*values)

Bases: IntEnum

CD status codes.

DISC_OK = 4

Disc is OK.

DRIVE_NOT_READY = 3

Drive is not ready.

NO_DISC = 1

No disc in drive.

NO_INFO = 0

No information available.

TRAY_OPEN = 2

Tray is open.

deltona.typing.DecodeErrorsOption

Decode errors option for string decoding functions.

alias of Literal[‘ignore’, ‘replace’, ‘strict’]

deltona.typing.FileDescriptorOrPath : TypeAlias

File descriptor or path.

class deltona.typing.FormatDict

Bases: TypedDict

FFmpeg format dictionary.

duration : NotRequired[str]

Duration of the media in seconds.

tags : TagsDict

Tags dictionary.

deltona.typing.INCITS38Code

Two-letter state code according to INCITS 38-2009.

alias of Literal[‘AK’, ‘AL’, ‘AR’, ‘AS’, ‘AZ’, ‘CA’, ‘CO’, ‘CT’, ‘DC’, ‘DE’, ‘FL’, ‘FM’, ‘GA’, ‘GU’, ‘HI’, ‘IA’, ‘ID’, ‘IL’, ‘IN’, ‘KS’, ‘KY’, ‘LA’, ‘MA’, ‘MD’, ‘ME’, ‘MH’, ‘MI’, ‘MN’, ‘MO’, ‘MP’, ‘MS’, ‘MT’, ‘NC’, ‘ND’, ‘NE’, ‘NH’, ‘NJ’, ‘NM’, ‘NV’, ‘NY’, ‘OH’, ‘OK’, ‘OR’, ‘PA’, ‘PR’, ‘PW’, ‘RI’, ‘SC’, ‘SD’, ‘TN’, ‘TX’, ‘UM’, ‘UT’, ‘VA’, ‘VI’, ‘VT’, ‘WA’, ‘WI’, ‘WV’, ‘WY’]

class deltona.typing.ProbeDict

Bases: TypedDict

FFmpeg probe result returned by deltona.media.ffprobe().

format : FormatDict

Format dictionary.

streams : Sequence[StreamsDict]

Dictionary of streams.

deltona.typing.StrOrBytesPath : TypeAlias

String, bytes, PathLike[str] or PathLike[bytes].

deltona.typing.StrPath : TypeAlias

String or PathLike[str].

class deltona.typing.StreamDispositionDict

Bases: TypedDict

FFmpeg stream disposition dictionary.

default : Literal[0, 1]

Default stream.

class deltona.typing.StreamsDict

Bases: TypedDict

FFmpeg stream dictionary.

codec_type : Literal['audio', 'video']

Codec type.

disposition : StreamDispositionDict

Stream disposition dictionary.

duration : NotRequired[str]

Duration of the stream in seconds.

height : int

Height of the video stream.

tags : TagsDict

Tags dictionary.

width : int

Width of the video stream.

deltona.typing.UNIXStrPath

String or PathLike[str] that is a UNIX path.

alias of Annotated[str | PathLike[str], ‘unix’]

deltona.typing.assert_not_none(var: _T | None) _T

Assert the var is not None and return it.

This will remove None from type _T | None.

Parameters:
var : T | None

The variable to check.

Returns:

The variable, guaranteed to be not None.

Return type:

T

Raises:

AssertionError – If var is None.

deltona.typing.contains_type_path_like_str(type_hints: object) bool

Check if a type hint contains os.PathLike[str].

Parameters:
type_hints : object

The type hint to inspect.

Returns:

True if the type hint contains os.PathLike[str].

Return type:

bool