Skip to content

Commit e50d114

Browse files
committed
Tree adapters: Pylint
1 parent dafc0ee commit e50d114

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

Orange/widgets/visualize/tests/test_owpythagoreanforest.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
from Orange.widgets.tests.base import WidgetTest
1111
from Orange.widgets.tests.utils import simulate
1212
from Orange.widgets.visualize.owpythagoreanforest import OWPythagoreanForest
13-
from Orange.widgets.visualize.pythagorastreeviewer import (
14-
PythagorasTreeViewer,
15-
SquareGraphicsItem
16-
)
13+
from Orange.widgets.visualize.pythagorastreeviewer import PythagorasTreeViewer
1714

1815

1916
class TestOWPythagoreanForest(WidgetTest):

Orange/widgets/visualize/utils/tree/skltreeadapter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ def short_rule(self, node):
151151

152152
def attribute(self, node):
153153
feature_idx = self.splitting_attribute(node)
154-
if feature_idx != self.FEATURE_UNDEFINED:
155-
return self.domain.attributes[self.splitting_attribute(node)]
154+
if feature_idx == self.FEATURE_UNDEFINED:
155+
return None
156+
return self.domain.attributes[self.splitting_attribute(node)]
156157

157158
def splitting_attribute(self, node):
158159
return self._tree.feature[node]

Orange/widgets/visualize/utils/tree/treeadapter.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def weight(self, node):
4141
The weight of the node relative to its siblings.
4242
4343
"""
44-
pass
4544

4645
@abstractmethod
4746
def num_samples(self, node):
@@ -57,7 +56,6 @@ def num_samples(self, node):
5756
int
5857
5958
"""
60-
pass
6159

6260
@abstractmethod
6361
def parent(self, node):
@@ -72,7 +70,6 @@ def parent(self, node):
7270
object
7371
7472
"""
75-
pass
7673

7774
@abstractmethod
7875
def has_children(self, node):
@@ -87,7 +84,6 @@ def has_children(self, node):
8784
bool
8885
8986
"""
90-
pass
9187

9288
def is_leaf(self, node):
9389
"""Check if the given node is a leaf node.
@@ -117,7 +113,6 @@ def children(self, node):
117113
A iterable object containing the labels of the child nodes.
118114
119115
"""
120-
pass
121116

122117
def reverse_children(self, node):
123118
"""Reverse children of a given node.
@@ -126,12 +121,10 @@ def reverse_children(self, node):
126121
----------
127122
node : object
128123
"""
129-
pass
130124

131125
def shuffle_children(self):
132126
"""Randomly shuffle node's children in the entire tree.
133127
"""
134-
pass
135128

136129
@abstractmethod
137130
def get_distribution(self, node):
@@ -152,7 +145,6 @@ def get_distribution(self, node):
152145
the number of nodes that belong to a given class inside the node.
153146
154147
"""
155-
pass
156148

157149
@abstractmethod
158150
def get_impurity(self, node):
@@ -167,7 +159,6 @@ def get_impurity(self, node):
167159
object
168160
169161
"""
170-
pass
171162

172163
@abstractmethod
173164
def rules(self, node):
@@ -183,7 +174,6 @@ def rules(self, node):
183174
A list of Rule objects, can be of any type.
184175
185176
"""
186-
pass
187177

188178
@abstractmethod
189179
def short_rule(self, node):
@@ -201,7 +191,6 @@ def attribute(self, node):
201191
-------
202192
203193
"""
204-
pass
205194

206195
def is_root(self, node):
207196
"""Check if a given node is the root node.
@@ -228,7 +217,6 @@ def leaves(self, node):
228217
-------
229218
230219
"""
231-
pass
232220

233221
@abstractmethod
234222
def get_instances_in_nodes(self, dataset, nodes):
@@ -246,7 +234,6 @@ def get_instances_in_nodes(self, dataset, nodes):
246234
-------
247235
248236
"""
249-
pass
250237

251238
@abstractmethod
252239
def get_indices(self, nodes):
@@ -262,7 +249,6 @@ def max_depth(self):
262249
int
263250
264251
"""
265-
pass
266252

267253
@property
268254
@abstractmethod
@@ -277,7 +263,6 @@ def num_nodes(self):
277263
int
278264
279265
"""
280-
pass
281266

282267
@property
283268
@abstractmethod
@@ -289,7 +274,6 @@ def root(self):
289274
object
290275
291276
"""
292-
pass
293277

294278

295279
class TreeAdapter(BaseTreeAdapter):

0 commit comments

Comments
 (0)