def read_value(self, value, *args, **options):

        action = ''

        if options['eval']:
            action = 'evaluated from "%s"' % value
            value = eval(value,{},{})
        elif options['execute']:
            from importlib import import_module
            action = 'executed from "%s"' % value
            module_name = value.split('.')
            func_name = module_name.pop()
            module_name = ".".join(module_name)
            try:
                mod = import_module( module_name )
                if func_name not in dir(mod):
                    raise CommandError('Cannot find function "%s" in module "%s"' % (func_name,module_name))
            except ImportError:
                raise CommandError('Cannot find module "%s"' % module_name)

            value = getattr(mod, func_name)(*args)
        elif options['json']:
            import json
#            value = json.loads( value, cls=JSONDecoder)
            action = 'json > %s' % value
            value = json.loads( value )

        return value, action
dataset/ETHPy150Open joke2k/django-options/django_options/management/commands/options.py/Command.read_value/original