From 38bfff8ba69769a43c742b278941c46b72f40c83 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Fri, 12 Jul 2024 11:17:33 +0200 Subject: [PATCH 1/2] owfeatureconstructor: Remove deperecated ast classes --- Orange/widgets/data/owfeatureconstructor.py | 9 --------- Orange/widgets/data/tests/test_owfeatureconstructor.py | 8 +++++--- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/Orange/widgets/data/owfeatureconstructor.py b/Orange/widgets/data/owfeatureconstructor.py index 5c22b338767..57eb0c784d7 100644 --- a/Orange/widgets/data/owfeatureconstructor.py +++ b/Orange/widgets/data/owfeatureconstructor.py @@ -11,7 +11,6 @@ import builtins import math import random -import logging import ast import types import unicodedata @@ -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: @@ -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: @@ -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: diff --git a/Orange/widgets/data/tests/test_owfeatureconstructor.py b/Orange/widgets/data/tests/test_owfeatureconstructor.py index ecca91de297..9c838803631 100644 --- a/Orange/widgets/data/tests/test_owfeatureconstructor.py +++ b/Orange/widgets/data/tests/test_owfeatureconstructor.py @@ -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'"), []) From 4466f94e75b8c7d6dc1a3d363d1354d8582c784a Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Fri, 12 Jul 2024 11:27:07 +0200 Subject: [PATCH 2/2] setup.py: Specify minimum supported python version --- setup.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 1409eacc521..6e65eafd118 100755 --- a/setup.py +++ b/setup.py @@ -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 @@ -81,6 +79,9 @@ 'Intended Audience :: Developers', ] +PYTHON_REQUIRES = ">=3.9" + + requirements = ['requirements-core.txt', 'requirements-gui.txt'] @@ -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',