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). With from pyneric.future import *, it can be referenced with future.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 value is not text
  • str – decode option used if value is not text
  • coerce (bool) – whether to attempt to coerce value to text
Returns:

text representation of value

Return type:

unicode if Python 2; otherwise, str

Raises:

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.

class pyneric.future.basestring[source]

Bases: object

A minimal backport of the Python 2 basestring type to Py3