Skip to content

Types Module ​

Provides custom type definitions and TypeVars used throughout the library.
Includes type aliases for structured color formats, path representations, and generic nested data structures.

Seq ​

python
type Seq[T] = list[T] | tuple[T, ...]

Union of all built-in sequence types (list, tuple).

is_seq() ​

python
def is_seq(obj: object, item_type: type[Any] | tuple[type[Any], ...] | None = None, /) -> bool

Returns true if obj is an instance that matches the Seq type, optionally checking if all contained elements are instances of item_type.


  • obj – The object to check.
  • item_type – An optional type or tuple of types to check each contained element against.

SeqOrSet ​

python
type SeqOrSet[T] = list[T] | tuple[T, ...] | set[T] | frozenset[T]

Union of all built-in sequence and set types (list, tuple, set, frozenset).

is_seq_or_set() ​

python
def is_seq_or_set(obj: object, item_type: type[Any] | tuple[type[Any], ...] | None = None, /) -> bool

Returns true if obj is an instance that matches the SeqOrSet type, optionally checking if all contained elements are instances of item_type.


  • obj – The object to check.
  • item_type – An optional type or tuple of types to check each contained element against.

DataObj ​

python
type DataObj = list[Any] | tuple[Any, ...] | set[Any] | frozenset[Any] | dict[Any, Any]

Union of supported data structures used in the data module.

is_data_obj() ​

python
def is_data_obj(obj: object, /) -> TypeIs[DataObj]

Returns true if obj is an instance that matches the DataObj type.

is_dict() ​

python
def is_dict(obj: object, /) -> TypeIs[dict[Any, Any]]

Returns true if obj is an instance that matches the dict type.

PathsList ​

python
type PathsList = list[Path] | list[str] | list[Path | str] | tuple[Path, ...] | tuple[str, ...] | tuple[Path | str, ...]

Union of all supported collection types for paths.

is_paths_list() ​

python
def is_paths_list(obj: object, /) -> TypeIs[PathsList]

Returns true if obj is an instance that matches the PathsList type.

RgbaDict ​

python
class RgbaDict

Dictionary schema for RGBA color components.

.red ​

python
red: int

The red channel in range [0, 255] inclusive.

.green ​

python
green: int

The green channel in range [0, 255] inclusive.

.blue ​

python
blue: int

The blue channel in range [0, 255] inclusive.

.alpha ​

python
alpha: NotRequired[float]

The alpha channel in range [0.0, 1.0] inclusive.

HslaDict ​

python
class HslaDict

Dictionary schema for HSLA color components.

.hue ​

python
hue: int

The hue channel in range [0, 360] inclusive.

.sat ​

python
sat: int

The saturation channel in range [0, 100] inclusive.

.light ​

python
light: int

The lightness channel in range [0, 100] inclusive.

.alpha ​

python
alpha: NotRequired[float]

The alpha channel in range [0.0, 1.0] inclusive.

HexaDict ​

python
class HexaDict

Dictionary schema for hex color components.

.red ​

python
red: str

The red channel in range [0, 255] inclusive.

.green ​

python
green: str

The green channel in range [0, 255] inclusive.

.blue ​

python
blue: str

The blue channel in range [0, 255] inclusive.

.alpha ​

python
alpha: NotRequired[str]

The alpha channel in range [0.0, 1.0] inclusive.

Rgba ​

python
type Rgba = tuple[int, int, int] | tuple[int, int, int, float] | list[int] | list[int | float] | RgbaDict | _RgbaObj

Structured RGBA color representations:
3- or 4-item tuple or list (RGB[A]), RgbaDict, or an RGBA protocol-compatible object.

Hsla ​

python
type Hsla = tuple[int, int, int] | tuple[int, int, int, float] | list[int] | list[int | float] | HslaDict | _HslaObj

Structured HSLA color representations:
3- or 4-item tuple or list (HSL[A]), HslaDict, or an HSLA protocol-compatible object.

Hexa ​

python
type Hexa = str | int | _HexaObj

Hexadecimal color representations:
Hex str (with or without prefix), 24-bit hex int, or a hex protocol-compatible object.

AllTextChars ​

python
class AllTextChars

Sentinel class indicating all characters are allowed.

MissingLibsMsgs ​

python
class MissingLibsMsgs

Configuration schema for custom messages in system.check_libs() when checking library dependencies.

.found_missing ​

python
found_missing: str

Message to display when one or more libraries are missing.

.should_install ​

python
should_install: str

Confirmation message to ask the user if they want to install the missing libraries.

ProgressUpdater ​

python
class ProgressUpdater

Protocol for a progress updater function used in terminal progress bars.

Released under the MIT License.