pixano.utils.python
estimate_folder_size(folder_path)
Estimate a folder size and return it as a human-readable string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder_path
|
Path
|
Folder path. |
required |
Returns:
Type | Description |
---|---|
str
|
Folder size as a human-readable string. |
Source code in pixano/utils/python.py
fn_sort_dict(dict_, order_by, descending)
Function to sort a dictionary by multiple keys in different orders.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dict_
|
dict[str, Any]
|
Dictionary to sort. |
required |
order_by
|
list[str]
|
List of keys to sort by. |
required |
descending
|
list[bool]
|
List of booleans indicating the order for each key. |
required |
Source code in pixano/utils/python.py
get_super_type_from_dict(sub_type, dict_types)
Get the first super type in a dictionary of types for the given type.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sub_type
|
type
|
Sub type to find the super type for. |
required |
dict_types
|
dict[str, type]
|
Dictionary of types. |
required |
Returns:
Type | Description |
---|---|
type | None
|
Super type if found, None otherwise. |
Source code in pixano/utils/python.py
natural_key(string)
to_sql_list(ids)
Convert a list of IDs to a SQL-friendly string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ids
|
str | Sequence[str] | set[str]
|
List of IDs. |
required |
Returns:
Type | Description |
---|---|
str
|
SQL-friendly string of IDs. |