# typing

Python API: `luxonis_ml.typing`

Common type aliases and utility functions for type checking.

## Classes

### BaseModelExtraForbid

Base model with extra fields forbidden.

#### Attributes

##### model_config

Pydantic model configuration with `extra` set to `"forbid"`.

### ConfigItem

Configuration schema for dynamic object instantiation. Typically used to instantiate objects stored in registries.

A dictionary with a name and a dictionary of parameters.

> **Example**
> ```pycon
>>> ConfigItem(name="Resize", params={"height": 256}).name
'Resize'
>>> ConfigItem(name="Normalize").params
{}
```

#### Attributes

##### name

Name of the object this configuration applies to.

##### params

Additional parameters for instantiating the object.

### LoaderOutput

#### Attributes

##### image

Returns the first image in the images dictionary.

##### images

##### labels

##### metadata

## Functions

### all_not_none

```python
def all_not_none(values: Iterable[Any]) -> bool:
```

Check whether all values in a collection are not `None`.

> **Examples**
> ```pycon
>>> all_not_none([1, "x", 0])
True
>>> all_not_none([1, None, 0])
False
>>> all_not_none([])
True
```

Parameters

 * `values` (`Iterable[Any]`): Iterable of values to check.

Returns

 * `bool`: `True` if all values are not `None`, otherwise `False`.

### any_not_none

```python
def any_not_none(values: Iterable[Any]) -> bool:
```

Check whether at least one value in a collection is not `None`.

> **Examples**
> ```pycon
>>> any_not_none([None, "x"])
True
>>> any_not_none([None, None])
False
>>> any_not_none([])
False
```

Parameters

 * `values` (`Iterable[Any]`): Iterable of values to check.

Returns

 * `bool`: `True` if at least one value is not `None`, otherwise `False`.

### check_type

```python
def check_type(value: Any, typ: type[T]) -> TypeGuard[T]:
```

Check whether a value has the expected type.

> **Note**
> This function acts as a [type guard](https://typing.python.org/en/latest/spec/narrowing.html#typeguard), allowing type checkers to narrow the type of a variable when the function returns `True`.

> **Examples**
> ```pycon
>>> check_type("oak", str)
True
>>> check_type("oak", int)
False
>>> check_type([1, 2, 3], list)
True
```

Parameters

 * `value` (`Any`): Value to check.
 * `typ` (`type[T]`): Type to check against.

Returns

 * `TypeGuard[T]`: `True` if `value` conforms to `typ`, otherwise `False`.

## Attributes

### Color

Color type alias.

Can be either a string (e.g. "red", "#FF5512"), a tuple of RGB values, or a single value (in which case it is interpreted as a
grayscale value).

### HSV

### Kwargs

A keyword dictionary of arbitrary parameters.

### Labels

Dictionary mapping task names to the annotations as C{np.ndarray}

### LoaderMultiOutput

C{LoaderMultiOutput} is a tuple containing a dictionary mapping image names to C{np.ndarray} and a dictionary of task group names
and their annotations as L{Labels}.

### LoaderSingleOutput

C{LoaderSingleOutput} is a tuple containing a single image as a C{np.ndarray} and a dictionary of task group names and their
annotations as L{Labels}.

### Params

A keyword dictionary of additional parameters.

Usually loaded from a YAML file.

### ParamValue

### PathType

A string or a [pathlib.Path](https://docs.python.org/3/library/pathlib.html#pathlib.Path) object.

### PosixPathType

A string or a [pathlib.PurePosixPath](https://docs.python.org/3/library/pathlib.html#pathlib.PurePosixPath) object.

### PrimitiveType

Primitive types in Python.

### RGB

### T

### TaskType
