Skip to content

Commit a7b07c9

Browse files
committed
OWFeatureConstructor: Remove special cases for Python 3.4 and 3.5
1 parent d3b52f5 commit a7b07c9

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

Orange/widgets/data/owfeatureconstructor.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
of other variables.
66
77
"""
8-
import sys
98
import re
109
import copy
1110
import functools
@@ -714,25 +713,18 @@ def freevars(exp, env):
714713
elif etype == ast.Compare:
715714
return sum((freevars(v, env)
716715
for v in [exp.left] + exp.comparators), [])
717-
elif etype == ast.Call and sys.version_info < (3, 5):
718-
return sum((freevars(e, env)
719-
for e in [exp.func] + (exp.args or []) +
720-
([k.value for k in exp.keywords or []]) +
721-
([exp.starargs] if exp.starargs else []) +
722-
([exp.kwargs] if exp.kwargs else [])),
723-
[])
724716
elif etype == ast.Call:
725717
return sum(map(lambda e: freevars(e, env),
726718
chain([exp.func],
727719
exp.args or [],
728720
[k.value for k in exp.keywords or []])),
729721
[])
730-
elif sys.version_info >= (3, 5) and etype == ast.Starred:
722+
elif etype == ast.Starred:
731723
# a 'starred' call parameter (e.g. a and b in `f(x, *a, *b)`
732724
return freevars(exp.value, env)
733725
elif etype in [ast.Num, ast.Str, ast.Ellipsis, ast.Bytes]:
734726
return []
735-
elif sys.version_info >= (3, 4) and etype == ast.NameConstant:
727+
elif etype == ast.NameConstant:
736728
return []
737729
elif etype == ast.Attribute:
738730
return freevars(exp.value, env)
@@ -795,16 +787,13 @@ def validate_exp(exp):
795787
elif etype == ast.Call:
796788
subexp = chain([exp.func], exp.args or [],
797789
[k.value for k in exp.keywords or []])
798-
if sys.version_info < (3, 5):
799-
extra = [exp.starargs, exp.kwargs]
800-
subexp = chain(subexp, *filter(None, extra))
801790
return all(map(validate_exp, subexp))
802-
elif sys.version_info >= (3, 5) and etype == ast.Starred:
791+
elif etype == ast.Starred:
803792
assert isinstance(exp.ctx, ast.Load)
804793
return validate_exp(exp.value)
805794
elif etype in [ast.Num, ast.Str, ast.Bytes, ast.Ellipsis]:
806795
return True
807-
elif sys.version_info >= (3, 4) and etype == ast.NameConstant:
796+
elif etype == ast.NameConstant:
808797
return True
809798
elif etype == ast.Attribute:
810799
return True

0 commit comments

Comments
 (0)