Annotation Type Hints#

colour.hints

ModuleType

alias of module

Any(*args, **kwargs)

Special type indicating an unconstrained type.

Callable

Callable type; Callable[[int], str] is a function of (int) -> str.

Dict

A generic version of dict.

Generator

A generic version of collections.abc.Generator.

Iterable

A generic version of collections.abc.Iterable.

Iterator

A generic version of collections.abc.Iterator.

List

A generic version of list.

Literal

Special typing form to define literal types (a.k.a.

Mapping

A generic version of collections.abc.Mapping.

Optional

Optional type.

Protocol()

Base class for protocol classes.

Sequence

A generic version of collections.abc.Sequence.

TYPE_CHECKING

bool(x) -> bool

TextIO()

Typed version of the return of open() in text mode.

Tuple

Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

Type

A special construct usable to annotate class objects.

TypeVar(name, *constraints[, bound, ...])

Type variable.

TypedDict(typename[, fields, total])

A simple typed namespace.

Union

Union type; Union[X, Y] means either X or Y.

cast(typ, val)

Cast a value to a type.

runtime_checkable(cls)

Mark a protocol class as a runtime protocol.

Self

Used to spell the type of "self" in classes.

ArrayLike

alias of Union[_SupportsArray[dtype], _NestedSequence[_SupportsArray[dtype]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]

NDArray

ndarray(shape, dtype=float, buffer=None, offset=0,

RegexFlag

NewType creates simple unique types with almost zero runtime overhead. NewType(name, tp) is considered a subtype of tp by static type checkers. At runtime, NewType(name, tp) returns a dummy callable that simply returns its argument. Usage::.

DTypeInt

alias of Union[int8, int16, int32, int64, uint8, uint16, uint32, uint64]

DTypeFloat

alias of Union[float16, float32, float64]

DTypeNumber

alias of Union[int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64]

DTypeComplex

alias of Union[complex64, complex128]

DTypeBoolean

alias of bool_

DType

alias of Union[bool_, int8, int16, int32, int64, uint8, uint16, uint32, uint64, float16, float32, float64, complex64, complex128]

Number

alias of Union[int, float]

Dataclass

alias of Any

NDArrayInt

ndarray(shape, dtype=float, buffer=None, offset=0,

NDArrayFloat

ndarray(shape, dtype=float, buffer=None, offset=0,

NDArrayComplex

ndarray(shape, dtype=float, buffer=None, offset=0,

NDArrayBoolean

ndarray(shape, dtype=float, buffer=None, offset=0,

NDArrayStr

ndarray(shape, dtype=float, buffer=None, offset=0,

TypeInterpolator(*args, **kwargs)

TypeExtrapolator(*args, **kwargs)

TypeLUTSequenceItem(*args, **kwargs)

LiteralWarning

alias of Literal['default', 'error', 'ignore', 'always', 'module', 'once']