Skip to content

Commit c15b658

Browse files
guilyxactions-user
authored andcommitted
Apply formatting changes
1 parent 7f83a21 commit c15b658

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

jupyddl/automated_planner.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def __stringify_state(self, state):
112112
state_str = str(state).replace("<PyCall.jlwrap PDDL.State(", "")
113113
state_str = state_str.replace("Set(Julog.Term[", "")
114114
state_str = state_str.replace("])", "")
115-
state_str = state_str.replace('Dict{Symbol,Any}(Symbol("total-cost") =>', "total-cost =")
115+
state_str = state_str.replace(
116+
'Dict{Symbol,Any}(Symbol("total-cost") =>', "total-cost ="
117+
)
116118
state_str = state_str.replace("))>", "")
117119
return state_str
118120

jupyddl/node.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ def __stringify_state(self, state):
5656
state_str = str(state).replace("<PyCall.jlwrap PDDL.State(", "")
5757
state_str = state_str.replace("Set(Julog.Term[", "")
5858
state_str = state_str.replace("])", "")
59-
state_str = state_str.replace('Dict{Symbol,Any}(Symbol("total-cost") =>', "total-cost =")
59+
state_str = state_str.replace(
60+
'Dict{Symbol,Any}(Symbol("total-cost") =>', "total-cost ="
61+
)
6062
state_str = state_str.replace("))>", "")
6163
return state_str
6264

@@ -65,11 +67,18 @@ def __lt__(self, other):
6567

6668
def __str__(self):
6769
state = self.__stringify_state(self.state)
68-
return "Node { %s | g = %.2f | h = %.2f | open = %s | closed = %s }" % (state, self.g_cost, self.h_cost, self.is_open, self.is_closed)
70+
return "Node { %s | g = %.2f | h = %.2f | open = %s | closed = %s }" % (
71+
state,
72+
self.g_cost,
73+
self.h_cost,
74+
self.is_open,
75+
self.is_closed,
76+
)
77+
6978

7079
class Path:
7180
def __init__(self, nodes):
7281
self.nodes = nodes
73-
82+
7483
def __str__(self):
7584
return str([str(n) for n in self.nodes])

tests/test_node.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def test_node_equality_no_cost():
3737

3838
assert assertion and assertion2
3939

40+
4041
def test_stringified_node():
4142
apla = AutomatedPlanner(
4243
"pddl-examples/dinner/domain.pddl", "pddl-examples/dinner/problem.pddl"
@@ -45,7 +46,10 @@ def test_stringified_node():
4546
for act in actions:
4647
next_state = apla.transition(apla.initial_state, act)
4748
next_node = Node(next_state, apla, heuristic_based=True)
48-
assert "<PyCall.jlwrap PDDL.State" not in str(next_node) and "Set(Julog.Term" not in str(next_node)
49+
assert "<PyCall.jlwrap PDDL.State" not in str(
50+
next_node
51+
) and "Set(Julog.Term" not in str(next_node)
52+
4953

5054
def test_stringified_path():
5155
apla = AutomatedPlanner(
@@ -56,5 +60,7 @@ def test_stringified_path():
5660
for act in actions:
5761
next_state = apla.transition(apla.initial_state, act)
5862
path.append(Node(next_state, apla, heuristic_based=True))
59-
60-
assert "<PyCall.jlwrap PDDL.State" not in str(Path(path)) and "Set(Julog.Term" not in str(Path(path))
63+
64+
assert "<PyCall.jlwrap PDDL.State" not in str(
65+
Path(path)
66+
) and "Set(Julog.Term" not in str(Path(path))

0 commit comments

Comments
 (0)