/usr/lib/python2.7/dist-packages/vagrant/compat.py is in python-vagrant 0.5.15-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | """
vagrant.compat
--------------
Python 2/3 compatiblity module.
"""
# std
import locale
import sys
PY2 = sys.version_info[0] == 2
def decode(value):
"""Decode binary data to text if needed (for Python 3).
Use with the functions that return in Python 2 value of `str` type and for Python 3 encoded bytes.
:param value: Encoded bytes for Python 3 and `str` for Python 2.
:return: Value as a text.
"""
return value.decode(locale.getpreferredencoding()) if not PY2 else value
|