Utils
Functions
Get the type of a registered model using its litteral type
Name | Type | Default value | Description |
---|---|---|---|
type_str | str |
Optional |
Name | Type | Default value | Description |
---|---|---|---|
type_str | str |
bool |
Name | Type | Default value | Description |
---|---|---|---|
type_ | Type | ||
include_module | bool | False |
Assert a json with possibility to ignore key
Name | Type | Default value | Description |
---|---|---|---|
json_1 | Union | ||
json_2 | Union | ||
ignore_keys | List |
Generate a unique str for a list of str. Append _1, _2... at the end if the str is already in the list
Name | Type | Default value | Description |
---|---|---|---|
list_ | List | ||
str_ | str |
str |
Return all the subclasses type of a class, it does not include the main class
Name | Type | Default value | Description |
---|---|---|---|
class_ | Type | Class to retrieve the subclasses |
Set |
Return the list of literal values
Name | Type | Default value | Description |
---|---|---|---|
literal_type | Any |
List |
Return a list of parent class of class_ arg (containing class_).
Name | Type | Default value | Description |
---|---|---|---|
class_ | Type | [description] | |
max_parent | Type | If provided, doesn't return parent of max_parent class, defaults to none , optional |
List |
Check if an object is a json. Ok is type is primitive or a list or a dict containing list dict or primitive...
Name | Type | Default value | Description |
---|---|---|---|
obj | Any |
bool |
Check if an object is a primitive type
Name | Type | Default value | Description |
---|---|---|---|
obj | Any |
bool |
issubclass safe that check the input is a class and avoid exception
Name | Type | Default value | Description |
---|---|---|---|
_Utils__cls | type | ||
_Utils__class_or_tuple | Union |
bool |
Check if two json are equals
Name | Type | Default value | Description |
---|---|---|---|
json1 | Any | ||
json2 | Any |
bool |
Assert a json with possibility to ignore key
Name | Type | Default value | Description |
---|---|---|---|
json_1 | Union | ||
json_2 | Union | ||
ignore_keys | List |
bool |
Rename all duplicated element in a list of str with _1, _2... at the end
Name | Type | Default value | Description |
---|---|---|---|
list_ | List |
List |
Name | Type | Default value | Description |
---|---|---|---|
json_dict | Any |
Check wheter a value in in a listeral list
Name | Type | Default value | Description |
---|---|---|---|
value | Any | ||
literal_type | Any |
bool |
Name | Type | Default value | Description |
---|---|---|---|
path | Any |
Tuple |