curry.utility.strings module

curry.utility.strings.ensure_binary(s, encoding='utf-8', errors='strict')[source]

Coerce s to bytes.

  • str -> encoded to bytes

  • bytes -> bytes

curry.utility.strings.ensure_binary_safe(arg, encoding='utf-8', errors='strict')[source]

Like ensure_binary, but passes non-string-like objects through.

curry.utility.strings.ensure_str(s, encoding='utf-8', errors='strict')[source]

Coerce s to str.

  • str -> str

  • bytes -> decoded to str

curry.utility.strings.ensure_str_safe(arg, encoding='utf-8', errors='strict')[source]

Like ensure_str, but passes non-string-like objects through.

curry.utility.strings.ensure_text(s, encoding='utf-8', errors='strict')[source]

Coerce s to str.

  • str -> str

  • bytes -> decoded to str

curry.utility.strings.ensure_text_safe(arg, encoding='utf-8', errors='strict')[source]

Like ensure_text, but passes non-string-like objects through.