Skip to content

Commit 0d075f0

Browse files
committed
Feature Constructor: lint
1 parent a73dec0 commit 0d075f0

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

Orange/widgets/data/owfeatureconstructor.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def data(self, index, role=Qt.DisplayRole):
292292
return super().data(index, role)
293293

294294

295-
class FeatureConstructorSettingsHandler(DomainContextHandler):
295+
class FeatureConstructorHandler(DomainContextHandler):
296296
"""Context handler that filters descriptors"""
297297

298298
def is_valid_item(self, setting, descriptor, attrs, metas):
@@ -326,7 +326,7 @@ class OWFeatureConstructor(OWWidget):
326326

327327
want_main_area = False
328328

329-
settingsHandler = FeatureConstructorSettingsHandler()
329+
settingsHandler = FeatureConstructorHandler()
330330
descriptors = ContextSetting([])
331331
currentIndex = ContextSetting(-1)
332332

@@ -850,7 +850,7 @@ def make_arg(name):
850850
if sys.version_info >= (3, 0):
851851
return ast.arg(arg=name, annotation=None)
852852
else:
853-
return ast.Name(id=arg, ctx=ast.Param(), lineno=1, col_offset=0)
853+
return ast.Name(id=name, ctx=ast.Param(), lineno=1, col_offset=0)
854854

855855
lambda_ = ast.Lambda(
856856
args=ast.arguments(
@@ -902,7 +902,7 @@ def make_arg(name):
902902
"weibullvariate": random.weibullvariate,
903903
"triangular": random.triangular,
904904
"uniform": random.uniform}
905-
)
905+
)
906906

907907

908908
class FeatureFunc:
@@ -930,8 +930,10 @@ def unique(seq):
930930
return unique_el
931931

932932

933-
def main(argv=sys.argv):
933+
def main(argv=None):
934934
from AnyQt.QtWidgets import QApplication
935+
if argv is None:
936+
argv = sys.argv
935937
app = QApplication(list(argv))
936938
argv = app.arguments()
937939
if len(argv) > 1:

Orange/widgets/data/tests/test_owfeatureconstructor.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
StringDescriptor,
1414
construct_variables, OWFeatureConstructor)
1515

16-
from Orange.widgets.data.owfeatureconstructor import (
17-
freevars, make_lambda, validate_exp
18-
)
16+
from Orange.widgets.data.owfeatureconstructor import freevars, validate_exp
1917

2018
import dill as pickle # Import dill after Orange because patched
2119

@@ -99,11 +97,11 @@ class PicklingTest(unittest.TestCase):
9997
def test_lambdas_pickle(self):
10098
NONLOCAL_CONST = 5
10199

102-
lambda_func = lambda x, LOCAL_CONST=7: \
103-
x * LOCAL_CONST * NONLOCAL_CONST * self.CLASS_CONST * GLOBAL_CONST
100+
lambda_func = lambda x, local_const=7: \
101+
x * local_const * NONLOCAL_CONST * self.CLASS_CONST * GLOBAL_CONST
104102

105-
def nested_func(x, LOCAL_CONST=7):
106-
return x * LOCAL_CONST * NONLOCAL_CONST * self.CLASS_CONST * GLOBAL_CONST
103+
def nested_func(x, local_const=7):
104+
return x * local_const * NONLOCAL_CONST * self.CLASS_CONST * GLOBAL_CONST
107105

108106
self.assertEqual(lambda_func(11),
109107
pickle.loads(pickle.dumps(lambda_func))(11))

0 commit comments

Comments
 (0)