Skip to content

brainhops._core.typing

Internal module

brainhops._core.typing is internal. It is documented here only to explain the type hints that appear in the public API. Do not import it, and do not rely on anything in it: its contents can change or disappear without notice.

Attributes

Const module-attribute

Const = tx.Annotated[T, Frozen(), NoInit()]

A field that is frozen and cannot be set through the constructor.

HiddenConst module-attribute

HiddenConst = tx.Annotated[Const[T], NoRepr()]

A Const field that is also hidden from the generated __repr__.

npscalar module-attribute

npscalar = T | ndarray[tuple[()], dtype[T]]

A plain scalar, or a zero-dimensional array holding one.

npvector module-attribute

npvector = ndarray[tuple[int], dtype[T]]

A one-dimensional array.

npmatrix module-attribute

npmatrix = ndarray[tuple[int, int], dtype[T]]

A two-dimensional array.

Functions:

is_instance_or_subclass

is_instance_or_subclass(
    obj: Any, cls: type | tuple[type, ...]
) -> bool

Whether obj is an instance of cls, or a class that subclasses it.

False for anything else, such as None or a class outside cls.