pyneric.future¶
pyneric.future module
This is equivalent to future.builtins with additions and customizations.
-
pyneric.future.python_2_unicode_compatible(cls)[source]¶ DEPRECATED: Use this method from its source (
future.utils). Withfrom pyneric.future import *, it can be referenced withfuture.python_2_unicode_compatible.
-
pyneric.future.ensure_text(value, encoding='utf-8', errors='strict', coerce=False)[source]¶ Return the text representation of the given string.
Parameters: - bytes/str/unicode (value) – string value
- str (errors) – name of encoding used if
valueis not text - str – decode option used if
valueis not text - coerce (bool) – whether to attempt to coerce
valueto text
Returns: text representation of
valueReturn type: unicodeif Python 2; otherwise,strRaises: - TypeError – if
valueis not a str, unicode, nor bytes - UnicodeDecodeError – if
valuecannot be decoded
The primary use case for this function is as a shortcut for a library providing support for Python 2 and 3 to ensure that a provided string value can be interpreted as text.