Skip to content

Commit

Permalink
Fix: safename not needed in AST, cause inconsistencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhorcas committed Oct 9, 2024
1 parent 4ae1d5c commit d7b0219
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions flamapy/core/models/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def is_binary_op(self) -> bool:
return not self.is_unique_term() and not self.is_unary_op()

def __str__(self) -> str:
data = self.data.value if self.is_op() else safename(str(self.data))
data = self.data.value if self.is_op() else str(self.data)
if self.left and self.right:
return f'{data}[{self.left}][{self.right}]'
if self.left and not self.right:
Expand All @@ -77,7 +77,7 @@ def _get_pretty_str_node(node: 'Node') -> str:
return res

def pretty_str(self) -> str:
data = self.data.value if self.is_op() else safename(str(self.data))
data = self.data.value if self.is_op() else str(self.data)
left = Node._get_pretty_str_node(self.left) if self.left is not None else ''
right = Node._get_pretty_str_node(self.right) if self.right is not None else ''

Expand Down Expand Up @@ -302,7 +302,3 @@ def get_clause_from_or_node(node: Node) -> list[Any]:
term = node.right.data if node.right.is_term() else f'-{node.right.left.data}'
clause.append(term)
return clause


def safename(name: str) -> str:
return f'"{name}"' if ' ' in name else name

0 comments on commit d7b0219

Please sign in to comment.