wand.compat
— Compatibility layer¶
This module provides several subtle things to support multiple Python versions (2.6, 2.7, 3.2–3.5) and VM implementations (CPython, PyPy).
-
wand.compat.
PY3
= True¶ (
bool
) Whether it is Python 3.x or not.
-
wand.compat.
binary
(string, var=None)¶ Makes
string
tostr
in Python 2. Makesstring
tobytes
in Python 3.Parameters: - string (
bytes
,str
,unicode
) – a string to cast it tobinary_type
- var (
str
) – an optional variable name to be used for error message
- string (
-
wand.compat.
binary_type
¶ alias of
builtins.bytes
-
wand.compat.
encode_filename
(filename)¶ If
filename
is atext_type
, encode it tobinary_type
according to filesystem’s default encoding.
-
wand.compat.
file_types
¶ alias of
io.RawIOBase
-
wand.compat.
string_type
¶ alias of
builtins.str
-
wand.compat.
text_type
¶ alias of
builtins.str
-
wand.compat.
xrange
¶ alias of
builtins.range