/usr/lib/python3/dist-packages/tunigo/utils.py is in python3-tunigo 1.0.0-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 | from __future__ import unicode_literals
from tunigo import translator
def set_instance_variables(instance, keys, values, convert):
for key_underscore in keys:
key_camelcase = translator.underscore_to_camelcase(key_underscore)
if key_camelcase in values:
setattr(instance, key_underscore, convert(values[key_camelcase]))
else:
setattr(instance, key_underscore, convert(None))
def set_instance_array_variables(instance, keys, values):
set_instance_variables(instance, keys, values, lambda x: x or [])
def set_instance_int_variables(instance, keys, values):
set_instance_variables(
instance, keys, values, lambda x: int(x) if x else 0)
def set_instance_string_variables(instance, keys, values):
set_instance_variables(instance, keys, values, lambda x: x or '')
|