eval
PYL-W0123272 with open(filename) as f:
273 s = f.read()
274 ctx = globals()
275 CACHE = eval(s, ctx, ctx)276 return CACHE
277
278
28def t_H_EDIT_DESCRIPTOR(t):
29 r"\d+H.*" # This grabs all of the remaining text
30 i = t.value.index('H')
31 n = eval(t.value[:i])32
33 # Adjust the tokenizing position
34 t.lexer.lexpos -= len(t.value) - (i+1+n)
1563 for n, s in enumerate(syms):
1564 if s[0] in "'\"":
1565 try:
1566 c = eval(s)1567 if (len(c) > 1):
1568 raise GrammarError('%s:%d: Literal token %s in rule %r may only be a single character' %
1569 (file, line, s, prodname))
653 expr = expr.replace("!"," not ")
654 expr = expr.replace(" not ="," !=")
655 try:
656 result = eval(expr)657 except Exception:
658 self.error(self.source,tokens[0].lineno,"Couldn't evaluate expression")
659 result = 0
29def t_H_EDIT_DESCRIPTOR(t):
30 r"\d+H.*" # This grabs all of the remaining text
31 i = t.value.index('H')
32 n = eval(t.value[:i])33
34 # Adjust the tokenizing position
35 t.lexer.lexpos -= len(t.value) - (i + 1 + n)
Use of possibly insecure function - consider using safer ast.literal_eval
. Read more on why should eval
be avoided here.