Skip to content

Commit 6cb2395

Browse files
committed
remove elses when return in if
1 parent 8f888e9 commit 6cb2395

1 file changed

Lines changed: 6 additions & 12 deletions

File tree

jupyddl/automated_planner.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def satisfies(self, asserted_state, state):
4747
def state_has_term(self, state, term):
4848
if self.pddl.has_term_in_state(self.domain, state, term):
4949
return True
50-
else:
51-
return False
50+
return False
5251

5352
def __flatten_goal(self):
5453
return self.pddl.flatten_goal(self.problem)
@@ -74,8 +73,7 @@ def get_actions_from_path(self, path):
7473
cost = self.pddl.get_value(path[-1].state, "total-cost")
7574
if not cost:
7675
return actions
77-
else:
78-
return (actions, cost)
76+
return (actions, cost)
7977

8078
def get_state_def_from_path(self, path):
8179
if not path:
@@ -92,32 +90,28 @@ def breadth_first_search(self, time_it=False):
9290
path = self.__retrace_path(last_node)
9391
if time_it:
9492
return path, total_time
95-
else:
96-
return path, None
93+
return path, None
9794

9895
def depth_first_search(self, time_it=False):
9996
dfs = DepthFirstSearch(self)
10097
last_node, total_time = dfs.search()
10198
path = self.__retrace_path(last_node)
10299
if time_it:
103100
return path, total_time
104-
else:
105-
return path, None
101+
return path, None
106102

107103
def dijktra_best_first_search(self, time_it=False):
108104
dijkstra = DijkstraBestFirstSearch(self)
109105
last_node, total_time = dijkstra.search()
110106
path = self.__retrace_path(last_node)
111107
if time_it:
112108
return path, total_time
113-
else:
114-
return path, None
109+
return path, None
115110

116111
def astar_best_first_search(self, time_it=False, heuristic=goal_count_heuristic):
117112
astar = AStarBestFirstSearch(self, heuristic)
118113
last_node, total_time = astar.search()
119114
path = self.__retrace_path(last_node)
120115
if time_it:
121116
return path, total_time
122-
else:
123-
return path, None
117+
return path, None

0 commit comments

Comments
 (0)