Login
Back to bricks list
Introduction Version

Utils

Functions

GET_MODEL_TYPE - @classmethod

Get the type of a registered model using its litteral type

Parameters:
NameTypeDefault valueDescription
type_strstr
Return type:
Optional
MODEL_TYPE_EXISTS - @classmethod
Parameters:
NameTypeDefault valueDescription
type_strstr
Return type:
bool
STRINGIFY_TYPE - @classmethod
Parameters:
NameTypeDefault valueDescription
type_Type
include_modulebool False
ASSERT_JSON_EQUALS - @staticmethod

Assert a json with possibility to ignore key

Parameters:
NameTypeDefault valueDescription
json_1Union
json_2Union
ignore_keysList
GENERATE_UNIQUE_STR_FOR_LIST - @staticmethod

Generate a unique str for a list of str. Append _1, _2... at the end if the str is already in the list

Parameters:
NameTypeDefault valueDescription
list_List
str_str
Return type:
str
GET_ALL_SUBCLASSES - @staticmethod

Return all the subclasses type of a class, it does not include the main class

Parameters:
NameTypeDefault valueDescription
class_Type Class to retrieve the subclasses
Return type:
Set
GET_LITERAL_VALUES - @staticmethod

Return the list of literal values

Parameters:
NameTypeDefault valueDescription
literal_typeAny
Return type:
List
GET_PARENT_CLASSES - @staticmethod

Return a list of parent class of class_ arg (containing class_).

Parameters:
NameTypeDefault valueDescription
class_Type [description]
max_parentType If provided, doesn't return parent of max_parent class, defaults to none , optional
Return type:
List
IS_JSON - @staticmethod

Check if an object is a json. Ok is type is primitive or a list or a dict containing list dict or primitive...

Parameters:
NameTypeDefault valueDescription
objAny
Return type:
bool
IS_PRIMITIVE - @staticmethod

Check if an object is a primitive type

Parameters:
NameTypeDefault valueDescription
objAny
Return type:
bool
ISSUBCLASS - @staticmethod

issubclass safe that check the input is a class and avoid exception

Parameters:
NameTypeDefault valueDescription
_Utils__clstype
_Utils__class_or_tupleUnion
Return type:
bool
JSON_ARE_EQUALS - @staticmethod

Check if two json are equals

Parameters:
NameTypeDefault valueDescription
json1Any
json2Any
Return type:
bool
JSON_EQUALS - @staticmethod

Assert a json with possibility to ignore key

Parameters:
NameTypeDefault valueDescription
json_1Union
json_2Union
ignore_keysList
Return type:
bool
RENAME_DUPLICATE_IN_STR_LIST - @staticmethod

Rename all duplicated element in a list of str with _1, _2... at the end

Parameters:
NameTypeDefault valueDescription
list_List
Return type:
List
SORT_DICT_BY_KEY - @staticmethod
Parameters:
NameTypeDefault valueDescription
json_dictAny
VALUE_IS_IN_LITERAL - @staticmethod

Check wheter a value in in a listeral list

Parameters:
NameTypeDefault valueDescription
valueAny
literal_typeAny
Return type:
bool
WALK_DIR - @staticmethod
Parameters:
NameTypeDefault valueDescription
pathAny
Return type:
Tuple