Skip to content

Commit fdb3c6a

Browse files
committed
Continuize: PyLint
1 parent 927356f commit fdb3c6a

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

Orange/widgets/data/owcontinuize.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ def __layout(self):
229229

230230

231231
class OWContinuize(widget.OWWidget):
232+
# Many false positives for `hints`; pylint ignores type annotations
233+
# pylint: disable=unsubscriptable-object,unsupported-assignment-operation
234+
# pylint: disable=unsupported-membership-test, unsupported-delete-operation
232235
name = "Continuize"
233236
description = ("Transform categorical attributes into numeric and, " +
234237
"optionally, scale numeric values.")
@@ -341,11 +344,9 @@ def varkeys_for_selection(self, view) -> List[str]:
341344
def _update_radios(self, view):
342345
keys = self.varkeys_for_selection(view)
343346
if view is self.disc_view:
344-
group, buttons = self.disc_group, self.disc_radios
345-
hints = self.disc_var_hints
347+
group, hints = self.disc_group, self.disc_var_hints
346348
else:
347-
group, buttons = self.cont_group, self.cont_radios
348-
hints = self.cont_var_hints
349+
group, hints = self.cont_group, self.cont_var_hints
349350

350351
if keys == [DefaultKey]:
351352
self._check_button(group, hints[DefaultKey], True)
@@ -422,6 +423,7 @@ def setData(self, data):
422423
# disconnection
423424
for hints, type_ in ((self.cont_var_hints, ContinuousVariable),
424425
(self.disc_var_hints, DiscreteVariable)):
426+
# time is not continuous, pylint: disable=unidiomatic-typecheck
425427
filtered = {
426428
var.name: hints[var]
427429
for var in chain(domain.attributes, domain.metas)
@@ -459,6 +461,7 @@ def _prepare_output(self):
459461
return self.data.transform(Domain(attrs, class_vars, metas))
460462

461463
def _unsupported_sparse(self):
464+
# time is not continuous, pylint: disable=unidiomatic-typecheck
462465
domain = self.data.domain
463466
disc = set()
464467
cont = set()
@@ -490,6 +493,7 @@ def _unsupported_sparse(self):
490493
for method in methods.values() if method.id_ in problems]
491494

492495
def _create_vars(self, part):
496+
# time is not continuous, pylint: disable=unidiomatic-typecheck
493497
return reduce(
494498
add,
495499
(self._continuized_vars(var) if var.is_discrete
@@ -542,8 +546,9 @@ def _scaled_vars(self, var):
542546
var.name,
543547
compute_value=Normalizer(var, off, scale))]
544548

545-
def _continuized_vars(self, var):
546-
hint = self._hint_for_var(var)
549+
def _continuized_vars(self, var, hint=None):
550+
if hint is None:
551+
hint = self._hint_for_var(var)
547552

548553
# Single variable
549554
if hint == Continuize.Leave:
@@ -588,7 +593,6 @@ def send_report(self):
588593
@classmethod
589594
def migrate_settings(cls, settings, version):
590595
if version < 2:
591-
Normalize = cls.Normalize
592596
cont_treat = settings.pop("continuous_treatment", 0)
593597
zero_based = settings.pop("zero_based", True)
594598
if cont_treat == 1:

0 commit comments

Comments
 (0)