/usr/lib/python2.7/dist-packages/argcomplete/compat.py is in python-argcomplete 1.8.1-1ubuntu1.
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 25 | from __future__ import absolute_import, division, print_function, unicode_literals
import locale
import sys
sys_encoding = locale.getpreferredencoding()
USING_PYTHON2 = True if sys.version_info < (3, 0) else False
if USING_PYTHON2:
str = unicode # noqa
else:
str = str
def ensure_bytes(x, encoding=sys_encoding):
if not isinstance(x, bytes):
x = x.encode(encoding)
return x
def ensure_str(x, encoding=sys_encoding):
if not isinstance(x, str):
x = x.decode(encoding)
return x
|