Skip to content

Commit

Permalink
fix 3.12 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
vibpz committed Mar 5, 2024
1 parent d7f9657 commit 8ad5dfd
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions yamale/syntax/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ def _validate_expr(call_node, validators):
# Validate that all args are constant literals, validator names, or other call nodes
arg_values = call_node.args + [kw.value for kw in call_node.keywords]
for arg in arg_values:
# In Python 3.8+, the following have been folded into ast.Constant.
constant_types = [
ast.Constant, ast.Num, ast.Str, ast.Bytes, ast.NameConstant]
base_arg = arg.operand if isinstance(arg, ast.UnaryOp) else arg
if any(isinstance(base_arg, type) for type in constant_types):
if isinstance(base_arg, ast.Constant):
continue
elif isinstance(base_arg, ast.Name) and base_arg.id in validators:
continue
Expand Down

0 comments on commit 8ad5dfd

Please sign in to comment.