Skip to content

Commit

Permalink
Merge pull request #13 from BlockResearchGroup/test
Browse files Browse the repository at this point in the history
fix lint error
  • Loading branch information
Licini authored Sep 4, 2023
2 parents 0b515d0 + d2deb68 commit 9c143cd
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ compas>=1.17
compas_cloud
compas_tna
compas_ags
compas_triangle
compas_skeleton
2 changes: 1 addition & 1 deletion src/compas_tno/rhino/formartist.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def draw_from_attributes(self, attribute='target', name='mesh', displacement=Non
vertex_xyz = self.vertex_xyz
for key in vertex_xyz:
z = self.diagram.vertex_attribute(key, attribute) # Check my forms and remove this
if type(z) == list:
if isinstance(z, list):
z = z[0]
vertex_xyz[key][2] = z
if displacement:
Expand Down
10 changes: 5 additions & 5 deletions src/compas_tno/rhino/forms/attributesform.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def create_force_table(cls, sceneNode, dual=[]):
attributes = filter(lambda attr: attr in Allowed, attributes)

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

Expand Down Expand Up @@ -129,7 +129,7 @@ def create_vertices_table(cls, sceneNode):
attributes = table.sort_attributes(attributes)
for attr in attributes:
editable = attr[0] != '_'
checkbox = type(datastructure.default_vertex_attributes[attr]) == bool
checkbox = isinstance(datastructure.default_vertex_attributes[attr], bool)
if not editable:
attr = attr[1:]
table.add_column(attr, Editable=editable, checkbox=checkbox)
Expand All @@ -155,7 +155,7 @@ def create_edges_table(cls, sceneNode):

for attr in attributes:
editable = attr[0] != '_'
checkbox = type(datastructure.default_edge_attributes[attr]) == bool
checkbox = isinstance(datastructure.default_edge_attributes[attr], bool)
if not editable:
attr = attr[1:]
table.add_column(attr, Editable=editable, checkbox=checkbox)
Expand Down Expand Up @@ -252,10 +252,10 @@ def on_edited(sender, event):

original_value = get_set_attributes(key, attr)

if type(original_value) == float and type(new_value) == int:
if isinstance(original_value, float) and isinstance(new_value, int):
new_value = float(new_value)
if new_value != original_value:
if type(new_value) == type(original_value):
if type(new_value) is type(original_value):
print('will update key: %s, attr: %s, value: %s' % (key, attr, new_value))
self.to_update[(key, attr)] = (get_set_attributes, new_value)
else:
Expand Down
4 changes: 2 additions & 2 deletions src/compas_tno/rhino/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def save(self): # This has to be updated to reflect the new Shape
state = []
for guid, obj in self.objects.items():
print(type(obj))
if type(obj) == DiagramObject:
if isinstance(obj, DiagramObject):
state.append({
'object': {
'name': obj.name,
Expand All @@ -182,7 +182,7 @@ def save(self): # This has to be updated to reflect the new Shape
'data': obj.diagram.to_data(),
},
})
elif type(obj) == Object:
elif isinstance(obj, Object):
state.append({
'object': {
'name': obj.name,
Expand Down
8 changes: 4 additions & 4 deletions src/compas_tno/rhino/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,17 @@ def from_settings(cls, object_name, settings):
for postfix in postfixies:
key, value = sections[prefix][postfix]

if type(value) == bool:
if isinstance(value, bool):
control = forms.CheckBox()
control.Checked = value
control.CheckedChanged += tab.EditEvent(key)
elif (type(value) == list or type(value) == tuple) and len(value) == 3:
elif (isinstance(value, list) or isinstance(value, tuple)) and len(value) == 3:
control = forms.ColorPicker()
control.Value = drawing.Color.FromArgb(*value)
control.ValueChanged += tab.EditEvent(key)
elif type(value) == float or type(value) == int:
elif isinstance(value, float) or isinstance(value, int):
control = forms.NumericUpDown()
if type(value) == float:
if isinstance(value, float):
digits = len(str(value).split('.')[-1])
control.DecimalPlaces = digits
control.Increment = 0.1 ** digits
Expand Down

0 comments on commit 9c143cd

Please sign in to comment.