Utilities¶
Utility helpers cover small behaviors shared across cihai internals. The most common advanced entry
point is cihai.utils.import_string(), which resolves configured import paths into Python
objects.
Utility and helper methods for cihai.
-
cihai.utils.supports_wide()¶cihai.utils.supports_wide()¶
Return affirmative if python interpreter supports wide characters.
- Returns:
True if python supports wide character sets
- Return type:
-
cihai.utils.import_string(import_name, silent=False)¶cihai.utils.import_string(import_name, silent=False)¶
Import an object based on a string.
This is useful if you want to use import paths as endpoints or something similar. An import path can be specified either in dotted notation (
xml.sax.saxutils.escape) or with a colon as object delimiter (xml.sax.saxutils:escape).If silent is True the return value will be None if the import fails.
- Parameters:
- Return type:
- Raises:
cihai.exc.ImportStringError(ImportError,cihai.exc.CihaiException) –
Notes
This is from werkzeug.utils d36aaf1 on May 23, 2022, LICENSE BSD. https://github.com/pallets/werkzeug
Changes: - Exception raised is cihai.exc.ImportStringError - Format with black