wand.compat — Compatibility layer¶
This module provides several subtle things to support multiple Python versions (2.6, 2.7, 3.3+) and VM implementations (CPython, PyPy).
- wand.compat.abc = <module 'collections.abc' from '/home/user/.pyenv/versions/3.7.17/lib/python3.7/collections/abc.py'>¶
(
module) Module containing abstract base classes.collectionsin Python 2 andcollections.abcin Python 3.
- wand.compat.binary(string, var=None)¶
Makes
stringtostrin Python 2. Makesstringtobytesin Python 3.- Parameters:
string (
bytes,str,unicode) – a string to cast it tobinary_typevar (
str) – an optional variable name to be used for error message
- wand.compat.binary_type¶
(
type) Type for representing binary data.strin Python 2 andbytesin Python 3.
- wand.compat.encode_filename(filename)¶
If
filenameis atext_type, encode it tobinary_typeaccording to filesystem’s default encoding.Changed in version 0.5.3: Added support for PEP-519 https://github.com/emcconville/wand/pull/339