Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 3.12 deprecations #237

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading