Socon utils
This document covers all modules in socon.utils. Most of the
modules in socon.utils are designed for internal use but we believe
that it can be useful as well for your framework.
socon.utils.func
socon.utils.reshape
Read-only attributes
- TemplateEngine.content
The content of the file given at the instance creation.
Methods
- TemplateEngine.__init__(filepath: Union[str, PathLike])[source]
When you create
TemplateEngineinstance, you need to give the path to the file you want to work with. The file is then read and the content is saved inTemplateEngine.content.
- TemplateEngine.revert_modif()[source]
Revert the modification applied to the content of the file. Really useful when you have modified the content of a file for a moment but you want to get back to the original quickly after.
- TemplateEngine.write(content: str = None, dest: Union[str, Path] = None, **kwargs)[source]
Write content to the current file or to a another file using the
destparameter. Also, this method will allow to pass any parameters to the open function. If you don’t pass any content to the method,TemplateEnginewill use theTemplateEngine.contentof the current instance.
socon.utils.module_loading
Functions for working with Python modules.
- import_string(dotted_path: str)[source]
Imports a dotted module path and returns the attribute/class designated by the last name in the path. Raises
ImportErrorif the import failed. For example:from socon.utils.module_loading import import_string ImproperlyConfigured = import_string('socon.core.exceptions.ImproperlyConfigured')
is equivalent to:
from socon.core.exceptions import ImproperlyConfigured