Skip to content

Commit

Permalink
Use "equals" instead of undefined "==" (#908)
Browse files Browse the repository at this point in the history
* Moved from "==" to "equals" comparison

* fix static code check

---------

Co-authored-by: C.A.P. Linssen <[email protected]>
  • Loading branch information
le-schmidt and C.A.P. Linssen authored Jul 21, 2023
1 parent a5189c1 commit 78f64f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pynestml/symbols/unit_type_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def print_nestml_type(self):
def equals(self, other=None):
basic_equals = super(UnitTypeSymbol, self).equals(other)
if basic_equals is True:
return self.unit == other.unit
return self.unit.equals(other.unit)

return False

Expand Down
7 changes: 2 additions & 5 deletions pynestml/utils/ast_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1304,14 +1304,11 @@ def is_delta_kernel(cls, kernel: ASTKernel) -> bool:

rhs_is_delta_kernel = type(expr) is ASTSimpleExpression \
and expr.is_function_call() \
and expr.get_function_call().get_scope().resolve_to_symbol(
expr.get_function_call().get_name(), SymbolKind.FUNCTION) == PredefinedFunctions.name2function["delta"]
and expr.get_function_call().get_scope().resolve_to_symbol(expr.get_function_call().get_name(), SymbolKind.FUNCTION).equals(PredefinedFunctions.name2function["delta"])
rhs_is_multiplied_delta_kernel = type(expr) is ASTExpression \
and type(expr.get_rhs()) is ASTSimpleExpression \
and expr.get_rhs().is_function_call() \
and expr.get_rhs().get_function_call().get_scope().resolve_to_symbol(
expr.get_rhs().get_function_call().get_name(), SymbolKind.FUNCTION) == PredefinedFunctions.name2function[
"delta"]
and expr.get_rhs().get_function_call().get_scope().resolve_to_symbol(expr.get_rhs().get_function_call().get_name(), SymbolKind.FUNCTION).equals(PredefinedFunctions.name2function["delta"])
return rhs_is_delta_kernel or rhs_is_multiplied_delta_kernel

@classmethod
Expand Down

0 comments on commit 78f64f8

Please sign in to comment.