app.utils
Description
Collection of functions and classes which make common patterns shorter and easier.
Modules
Module for creating a Peewee filter query via dynamic way. |
Functions
|
|
|
|
|
Get attribute from a module. |
|
|
|
|
|
|
|
- app.utils.filter_by_keys(data: dict, keys: list) dict
- app.utils.find_longest_word(word_list: list) str
- app.utils.get_attr_from_module(module: str, attr: str) any
Get attribute from a module.
- Parameters
module (str) – Module absolute path.
attr (str) – Module’s attribute. It could be any kind of variable belongs to module.
Examples
>>> from app.utils import get_attr_from_module >>> module_path = 'app.blueprints.base' >>> module_attr = 'blueprint' >>> get_attr_from_module(module_path, module_attr) <flask.blueprints.Blueprint object at ...>
- Raises
ImportError – Module doesn’t exist.
AttributeError – Attribute doesn’t exist in module.
- app.utils.get_request_file(field_name: Optional[str] = None) dict
- app.utils.ignore_keys(data: dict, exclude: list) dict
- app.utils.pos_to_char(pos: int) str
- app.utils.to_readable(obj: object) object