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

[MNT] Remove use of deprecated ast classes #6851

Merged
merged 2 commits into from
Jul 12, 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
9 changes: 0 additions & 9 deletions Orange/widgets/data/owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import builtins
import math
import random
import logging
import ast
import types
import unicodedata
Expand Down Expand Up @@ -448,8 +447,6 @@ def freevars(exp: ast.AST, env: List[str]):
elif etype == ast.Starred:
# a 'starred' call parameter (e.g. a and b in `f(x, *a, *b)`
return freevars(exp.value, env)
elif etype in [ast.Num, ast.Str, ast.Ellipsis, ast.Bytes, ast.NameConstant]:
return []
elif etype == ast.Constant:
return []
elif etype == ast.Attribute:
Expand All @@ -466,10 +463,6 @@ def freevars(exp: ast.AST, env: List[str]):
return sum((freevars(e, env)
for e in filter(None, [exp.lower, exp.upper, exp.step])),
[])
elif etype == ast.ExtSlice:
return sum((freevars(e, env) for e in exp.dims), [])
elif etype == ast.Index:
return freevars(exp.value, env)
elif etype == ast.keyword:
return freevars(exp.value, env)
else:
Expand Down Expand Up @@ -997,8 +990,6 @@ def validate_exp(exp):
return all(map(validate_exp, subexp))
elif etype == ast.Starred:
return validate_exp(exp.value)
elif etype in [ast.Num, ast.Str, ast.Bytes, ast.Ellipsis, ast.NameConstant]:
return True
elif etype == ast.Constant:
return True
elif etype == ast.Attribute:
Expand Down
8 changes: 5 additions & 3 deletions Orange/widgets/data/tests/test_owfeatureconstructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,15 @@ def freevars_(source, env=None):
self.assertEqual(freevars_("a + b", ["a", "b"]), [])
self.assertEqual(freevars_("a[b]"), ["a", "b"])
self.assertEqual(freevars_("a[b]", ["a", "b"]), [])
self.assertEqual(freevars_("a[b:3]", ["a", "b"]), [])
self.assertEqual(freevars_("a[b:c:d]", ["a", "b", "c", "d"]), [])

self.assertEqual(freevars_("f(x, *a)", ["f"]), ["x", "a"])
self.assertEqual(freevars_("f(x, *a, y=1)", ["f"]), ["x", "a"])
self.assertEqual(freevars_("f(x, *a, y=1, **k)", ["f"]),
["x", "a", "k"])
if sys.version_info >= (3, 5):
self.assertEqual(freevars_("f(*a, *b, k=c, **d, **e)", ["f"]),
["a", "b", "c", "d", "e"])
self.assertEqual(freevars_("f(*a, *b, k=c, **d, **e)", ["f"]),
["a", "b", "c", "d", "e"])

self.assertEqual(freevars_("True"), [])
self.assertEqual(freevars_("'True'"), [])
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from distutils.command import config, build
from distutils.core import Extension

if sys.version_info < (3, 4):
sys.exit('Orange requires Python >= 3.4')

try:
import numpy
Expand Down Expand Up @@ -81,6 +79,9 @@
'Intended Audience :: Developers',
]

PYTHON_REQUIRES = ">=3.9"


requirements = ['requirements-core.txt', 'requirements-gui.txt']


Expand Down Expand Up @@ -512,6 +513,7 @@ def setup_package():
data_files=DATA_FILES,
install_requires=INSTALL_REQUIRES,
extras_require=EXTRAS_REQUIRE,
python_requires=PYTHON_REQUIRES,
entry_points=ENTRY_POINTS,
zip_safe=False,
test_suite='Orange.tests.suite',
Expand Down
Loading