Skip to content

Commit

Permalink
Merge pull request #237 from sigma67/fix-312-deprecations
Browse files Browse the repository at this point in the history
fix 3.12 deprecations
  • Loading branch information
cblakkan authored Mar 5, 2024
2 parents d7f9657 + b6a17d4 commit f8aa2b0
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.6, 3.8]
python-version: [3.8, 3.10]

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ to the syntax [here](https://github.com/Animosity/CraftIRC/wiki/Complete-idiot's

Requirements
------------
* Python 3.6+
* Python 3.8+
* PyYAML
* ruamel.yaml (optional)

Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
packages=find_packages(),
include_package_data=True,
install_requires=['pyyaml'],
python_requires='>=3.6',
python_requires='>=3.8',
entry_points={
'console_scripts': ['yamale=yamale.command_line:main'],
},
Expand All @@ -29,9 +29,10 @@
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
)
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[tox]
envlist = py36,py38
envlist = py38, py310

[gh-actions]
python =
3.6: py36
3.8: py38
3.10: py310

[testenv]
commands = py.test --cov yamale --cov-report term-missing yamale
Expand Down
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 f8aa2b0

Please sign in to comment.