textTools: safeEval = ast.literal_eval
https://github.com/fonttools/fonttools/pull/1139#pullrequestreview-86720679
This commit is contained in:
parent
4a20899cb4
commit
2b13c47d3e
@ -7,15 +7,15 @@ import ast
|
||||
import string
|
||||
|
||||
|
||||
def safeEval(data):
|
||||
"""A (kindof) safe replacement for eval."""
|
||||
return ast.literal_eval(data)
|
||||
# alias kept for backward compatibility
|
||||
safeEval = ast.literal_eval
|
||||
|
||||
|
||||
def readHex(content):
|
||||
"""Convert a list of hex strings to binary data."""
|
||||
return deHexStr(strjoin(chunk for chunk in content if isinstance(chunk, basestring)))
|
||||
|
||||
|
||||
def deHexStr(hexdata):
|
||||
"""Convert a hex string to binary data."""
|
||||
hexdata = strjoin(hexdata.split())
|
||||
|
Loading…
x
Reference in New Issue
Block a user