Replace all unsafe uses of eval with ast.literal_eval and hasattr/getatt...

...r