Annotation Type Hints#

colour.hints

ArrayLike

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

NDArray

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

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()

Iterable()

Iterator()

List

A generic version of list.

Literal

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

Mapping()

A Mapping is a generic container for associating key/value pairs.

Optional

Optional type.

Protocol()

Base class for protocol classes.

Sequence()

All the operations on a read-only 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.

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,

ProtocolInterpolator(*args, **kwargs)

ProtocolExtrapolator(*args, **kwargs)

ProtocolLUTSequenceItem(*args, **kwargs)

LiteralWarning

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