Only import the ast module on demand

This commit is contained in:
Kovid Goyal 2018-08-27 12:43:20 +05:30
parent d19b29ced0
commit 1d275c6b35
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -2,7 +2,6 @@
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import ast
import os
import re
import shlex
@ -40,6 +39,7 @@ def to_cmdline(x):
def python_string(text):
import ast
return ast.literal_eval("'''" + text.replace("'''", "'\\''") + "'''")