/usr/lib/python3/dist-packages/twython/helpers.py is in python3-twython 3.1.2-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 25 26 27 28 29 30 31 32 33 34 | # -*- coding: utf-8 -*-
"""
twython.helpers
~~~~~~~~~~~~~~~
This module contains functions that are repeatedly used throughout
the Twython library.
"""
from .compat import basestring, numeric_types
def _transparent_params(_params):
params = {}
files = {}
for k, v in _params.items():
if hasattr(v, 'read') and callable(v.read):
files[k] = v # pragma: no cover
elif isinstance(v, bool):
if v:
params[k] = 'true'
else:
params[k] = 'false'
elif isinstance(v, basestring) or isinstance(v, numeric_types):
params[k] = v
elif isinstance(v, list):
try:
params[k] = ','.join(v)
except TypeError:
params[k] = ','.join(map(str,v))
else:
continue # pragma: no cover
return params, files
|