Skip to content

Commit 9c143cd

Browse files
authored
Merge pull request #13 from BlockResearchGroup/test
fix lint error
2 parents 0b515d0 + d2deb68 commit 9c143cd

File tree

5 files changed

+12
-13
lines changed

5 files changed

+12
-13
lines changed

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ compas>=1.17
22
compas_cloud
33
compas_tna
44
compas_ags
5-
compas_triangle
65
compas_skeleton

src/compas_tno/rhino/formartist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def draw_from_attributes(self, attribute='target', name='mesh', displacement=Non
473473
vertex_xyz = self.vertex_xyz
474474
for key in vertex_xyz:
475475
z = self.diagram.vertex_attribute(key, attribute) # Check my forms and remove this
476-
if type(z) == list:
476+
if isinstance(z, list):
477477
z = z[0]
478478
vertex_xyz[key][2] = z
479479
if displacement:

src/compas_tno/rhino/forms/attributesform.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def create_force_table(cls, sceneNode, dual=[]):
9494
attributes = filter(lambda attr: attr in Allowed, attributes)
9595

9696
for attr in attributes:
97-
checkbox = type(datastructure.default_edge_attributes[attr]) == bool
97+
checkbox = isinstance(datastructure.default_edge_attributes[attr], bool)
9898
attr = attr.replace("_", "-")
9999
table.add_column(attr, Editable=False, checkbox=checkbox)
100100

@@ -129,7 +129,7 @@ def create_vertices_table(cls, sceneNode):
129129
attributes = table.sort_attributes(attributes)
130130
for attr in attributes:
131131
editable = attr[0] != '_'
132-
checkbox = type(datastructure.default_vertex_attributes[attr]) == bool
132+
checkbox = isinstance(datastructure.default_vertex_attributes[attr], bool)
133133
if not editable:
134134
attr = attr[1:]
135135
table.add_column(attr, Editable=editable, checkbox=checkbox)
@@ -155,7 +155,7 @@ def create_edges_table(cls, sceneNode):
155155

156156
for attr in attributes:
157157
editable = attr[0] != '_'
158-
checkbox = type(datastructure.default_edge_attributes[attr]) == bool
158+
checkbox = isinstance(datastructure.default_edge_attributes[attr], bool)
159159
if not editable:
160160
attr = attr[1:]
161161
table.add_column(attr, Editable=editable, checkbox=checkbox)
@@ -252,10 +252,10 @@ def on_edited(sender, event):
252252

253253
original_value = get_set_attributes(key, attr)
254254

255-
if type(original_value) == float and type(new_value) == int:
255+
if isinstance(original_value, float) and isinstance(new_value, int):
256256
new_value = float(new_value)
257257
if new_value != original_value:
258-
if type(new_value) == type(original_value):
258+
if type(new_value) is type(original_value):
259259
print('will update key: %s, attr: %s, value: %s' % (key, attr, new_value))
260260
self.to_update[(key, attr)] = (get_set_attributes, new_value)
261261
else:

src/compas_tno/rhino/scene.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def save(self): # This has to be updated to reflect the new Shape
166166
state = []
167167
for guid, obj in self.objects.items():
168168
print(type(obj))
169-
if type(obj) == DiagramObject:
169+
if isinstance(obj, DiagramObject):
170170
state.append({
171171
'object': {
172172
'name': obj.name,
@@ -182,7 +182,7 @@ def save(self): # This has to be updated to reflect the new Shape
182182
'data': obj.diagram.to_data(),
183183
},
184184
})
185-
elif type(obj) == Object:
185+
elif isinstance(obj, Object):
186186
state.append({
187187
'object': {
188188
'name': obj.name,

src/compas_tno/rhino/settings.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ def from_settings(cls, object_name, settings):
5858
for postfix in postfixies:
5959
key, value = sections[prefix][postfix]
6060

61-
if type(value) == bool:
61+
if isinstance(value, bool):
6262
control = forms.CheckBox()
6363
control.Checked = value
6464
control.CheckedChanged += tab.EditEvent(key)
65-
elif (type(value) == list or type(value) == tuple) and len(value) == 3:
65+
elif (isinstance(value, list) or isinstance(value, tuple)) and len(value) == 3:
6666
control = forms.ColorPicker()
6767
control.Value = drawing.Color.FromArgb(*value)
6868
control.ValueChanged += tab.EditEvent(key)
69-
elif type(value) == float or type(value) == int:
69+
elif isinstance(value, float) or isinstance(value, int):
7070
control = forms.NumericUpDown()
71-
if type(value) == float:
71+
if isinstance(value, float):
7272
digits = len(str(value).split('.')[-1])
7373
control.DecimalPlaces = digits
7474
control.Increment = 0.1 ** digits

0 commit comments

Comments
 (0)