Skip to content

Commit

Permalink
change type() check to isinstance()
Browse files Browse the repository at this point in the history
  • Loading branch information
C.A.P. Linssen committed Aug 8, 2023
1 parent c0b21ea commit da9f323
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pynestml/symbols/variable_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def has_delay_parameter(self):
Returns whether this variable has a delay value associated with it.
:return: bool
"""
return self.delay_parameter is not None and type(self.delay_parameter) == str
return self.delay_parameter is not None and isinstance(self.delay_parameter, str)

def get_block_type(self):
"""
Expand Down Expand Up @@ -425,7 +425,7 @@ def equals(self, other):
:return: True if equal, otherwise False.
:rtype: bool
"""
return (type(self) != type(other)
return (isinstance(other, type(self))
and self.get_referenced_object() == other.get_referenced_object()
and self.get_symbol_name() == other.get_symbol_name()
and self.get_corresponding_scope() == other.get_corresponding_scope()
Expand Down
2 changes: 1 addition & 1 deletion pynestml/utils/ast_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ def get_expr_from_kernel_var(cls, kernel: ASTKernel, var_name: str) -> Union[AST
"""
Get the expression using the kernel variable
"""
assert type(var_name) == str
assert instanceof(var_name, str)
for var, expr in zip(kernel.get_variables(), kernel.get_expressions()):
if var.get_complete_name() == var_name:
return expr
Expand Down

0 comments on commit da9f323

Please sign in to comment.