Skip to content

Commit

Permalink
Added typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Framba-Luca committed Apr 23, 2024
1 parent a23f415 commit 6683dba
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions unified_planning/io/pddl_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from collections import OrderedDict
from fractions import Fraction
import re
from typing import Dict, Union, Callable, List, cast, Tuple
from typing import Dict, Mapping, Union, Callable, List, cast, Tuple
import typing
import unified_planning as up
import unified_planning.model.htn as htn
Expand Down Expand Up @@ -1643,7 +1643,7 @@ def declare_type(
and optimization == "minimize"
and metric_exp == self._totalcost
):
costs = {}
costs: Dict[up.model.Action, up.model.Expression] = {}
problem._fluents.remove(self._totalcost.fluent())
if self._totalcost in problem._initial_value:
problem._initial_value.pop(self._totalcost)
Expand All @@ -1670,8 +1670,8 @@ def declare_type(
assert isinstance(a, up.model.DurativeAction)

Check warning on line 1670 in unified_planning/io/pddl_reader.py

View check run for this annotation

Codecov / codecov/patch

unified_planning/io/pddl_reader.py#L1670

Added line #L1670 was not covered by tests
use_plan_length = False
cost, effects_list = None, None
for t, el in a.effects.items():
if t in (start_timing, end_timing):
for timing, el in a.effects.items():
if timing in (start_timing, end_timing):
for e in el:
if e.fluent == self._totalcost:
if cost is not None:
Expand All @@ -1681,6 +1681,7 @@ def declare_type(
cost, effects_list = e, el
break
if cost is not None:
assert effects_list is not None
costs[a] = cost.value
effects_list.remove(cost)

Check warning on line 1686 in unified_planning/io/pddl_reader.py

View check run for this annotation

Codecov / codecov/patch

unified_planning/io/pddl_reader.py#L1681-L1686

Added lines #L1681 - L1686 were not covered by tests
else:
Expand Down

0 comments on commit 6683dba

Please sign in to comment.