Skip to content

Commit

Permalink
fix types and docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
wochinge committed Nov 2, 2020
1 parent 781d977 commit 4f5c697
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion rasa/core/policies/ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def probabilities_using_best_policy(
domain, prediction.probabilities, policy_name
)

logger.debug(f"Predicted next action using {policy_name}")
logger.debug(f"Predicted next action using {policy_name}.")
return prediction.probabilities, policy_name


Expand Down
2 changes: 1 addition & 1 deletion rasa/core/policies/sklearn_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def predict_action_probabilities(
)

def persist(self, path: Union[Text, Path]) -> None:
"""Persist the policy properties (see parent class for more information)."""
"""Persists the policy properties (see parent class for more information)."""
if self.model:
self.featurizer.persist(path)

Expand Down
8 changes: 5 additions & 3 deletions rasa/core/policies/ted_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,12 +373,14 @@ def predict_action_probabilities(
interpreter: NaturalLanguageInterpreter,
**kwargs: Any,
) -> PolicyPrediction:
"""Predict the next action the bot should take.
"""Predicts the next action the bot should take.
Return the list of probabilities for the next actions.
See the docstring of the parent class `Policy` for more information.
"""
if self.model is None:
return PolicyPrediction(self._default_predictions(domain))
return PolicyPrediction(
self._default_predictions(domain), policy_priority=self.priority
)

# create model data from tracker
tracker_state_features = self.featurizer.create_state_features(
Expand Down
4 changes: 2 additions & 2 deletions tests/core/test_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def test_policy_loading_simple(tmp_path: Path):
class ConstantPolicy(Policy):
def __init__(
self,
priority: int = None,
predict_index: int = None,
priority: Optional[int] = None,
predict_index: Optional[int] = None,
confidence: float = 1,
is_end_to_end_prediction: bool = False,
events: Optional[List[Event]] = None,
Expand Down

0 comments on commit 4f5c697

Please sign in to comment.