Skip to content

Commit

Permalink
reduce ast types from Num/Str/NameConstant to just Constant per warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bosh committed Dec 11, 2024
1 parent ab09c4f commit c4e791e
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions mpf/core/placeholder_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,7 @@ def __init__(self, machine):
"""Initialize."""
super().__init__(machine)
self._eval_methods = {
ast.Num: self._eval_num,
ast.Str: self._eval_str,
ast.NameConstant: self._eval_constant,
ast.Constant: self._eval_constant,
ast.BinOp: self._eval_bin_op,
ast.UnaryOp: self._eval_unary_op,
ast.Compare: self._eval_compare,
Expand All @@ -655,8 +653,6 @@ def __init__(self, machine):
ast.IfExp: self._eval_if,
ast.Tuple: self._eval_tuple,
}
if hasattr(ast, "Constant"):
self._eval_methods[ast.Constant] = self._eval_constant

def _eval_tuple(self, node, variables, subscribe):
return tuple([self._eval(x, variables, subscribe) for x in node.elts])
Expand All @@ -668,18 +664,6 @@ def _parse_template(template_str):
except SyntaxError:
raise AssertionError('Failed to parse template "{}"'.format(template_str))

@staticmethod
def _eval_num(node, variables, subscribe):
del variables
del subscribe
return node.n, []

@staticmethod
def _eval_str(node, variables, subscribe):
del variables
del subscribe
return node.s, []

@staticmethod
def _eval_constant(node, variables, subscribe):
del variables
Expand Down

0 comments on commit c4e791e

Please sign in to comment.