Utilities - cihai.utils
¶
Utility and helper methods for cihai.
- cihai.utils.supports_wide()[source]¶
Return affirmative if python interpreter supports wide characters.
- cihai.utils.import_string(import_name, silent=False)[source]¶
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.
- Return type:
- Parameters:
import_name (string) – the dotted name for the object to import.
silent (bool) – if set to True import errors are ignored and None is returned instead.
- Return type:
imported object
- 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