Common type aliases and utility functions for type checking.
| Class | |
Configuration schema for dynamic object instantiation. Typically used to instantiate objects stored in registries. |
| Class | |
No class docstring; 1/1 property, 0/3 class variable, 0/2 method documented |
| Function | all |
Check whether all values in a collection are not None. |
| Function | any |
Check whether at least one value in a collection is not None. |
| Function | check |
Check whether a value has the expected type. |
| Type Variable | T |
Undocumented |
| Type Alias | |
Color type alias. |
| Type Alias | HSV |
Undocumented |
| Type Alias | |
A keyword dictionary of arbitrary parameters. |
| Type Alias | |
Dictionary mapping task names to the annotations as C{np.ndarray} |
| Type Alias | |
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}. |
| Type Alias | |
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}. |
| Type Alias | |
A keyword dictionary of additional parameters. |
| Type Alias | |
Undocumented |
| Type Alias | |
A string or a pathlib.Path object. |
| Type Alias | |
A string or a pathlib.PurePosixPath object. |
| Type Alias | |
Primitive types in Python. |
| Type Alias | RGB |
Undocumented |
| Type Alias | |
Undocumented |
Check whether all values in a collection are not None.
Examples
>>> all_not_none([1, "x", 0]) True >>> all_not_none([1, None, 0]) False >>> all_not_none([]) True
| Parameters | |
values:Iterable[ | Iterable of values to check. |
| Returns | |
bool | True if all values are not None, otherwise False. |
Check whether at least one value in a collection is not None.
Examples
>>> any_not_none([None, "x"]) True >>> any_not_none([None, None]) False >>> any_not_none([]) False
| Parameters | |
values:Iterable[ | Iterable of values to check. |
| Returns | |
bool | True if at least one value is not None, otherwise False. |
Check whether a value has the expected type.
Note
This function acts as a type guard, allowing type checkers to narrow the type of a variable when the function returns True.
Examples
>>> 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[ | Type to check against. |
| Returns | |
TypeGuard[ | True if value conforms to typ, otherwise False. |
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).
| Value |
|
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}.
| Value |
|
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}.
| Value |
|
A keyword dictionary of additional parameters.
Usually loaded from a YAML file.
| Value |
|