Skip to content

Commit

Permalink
doc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jackx111 committed Jan 25, 2024
1 parent bb31fcf commit 05bdc61
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 49 deletions.
6 changes: 3 additions & 3 deletions howso/client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Union,
)

from howso.utilities.reaction import Reaction
from pandas import DataFrame, Index

if TYPE_CHECKING:
Expand All @@ -18,7 +19,6 @@
Metrics,
TraineeInformation,
)
from howso.utilities.reaction import Reaction


class AbstractHowsoClient(ABC):
Expand Down Expand Up @@ -278,7 +278,7 @@ def react_series(
use_case_weights=False,
use_regional_model_residuals=True,
weight_feature=None
) -> "Reaction":
) -> Reaction:
"""React in a series until a stop condition is met."""

@abstractmethod
Expand Down Expand Up @@ -370,7 +370,7 @@ def react(
use_case_weights=False,
use_regional_model_residuals=True,
weight_feature=None
) -> "Reaction":
) -> Reaction:
"""Send a `react` to the Howso engine."""

@abstractmethod
Expand Down
24 changes: 8 additions & 16 deletions howso/client/pandas/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def react_series(
*args,
series_index: str = '.series',
**kwargs
) -> "Reaction":
) -> Reaction:
"""
Base: :func:`howso.client.AbstractHowsoClient.react_series`.
Expand All @@ -223,13 +223,9 @@ def react_series(
Returns
-------
Reaction:
A MutableMapping (dict) with these keys -> values:
actions -> pandas.DataFrame
A data frame with columns specified in
``features_to_generate`` list (or list of lists).
If ``features_to_generate`` is not specified all features
will be generated.
A MutableMapping (dict-like) with these keys -> values:
action -> pandas.DataFrame
A data frame of action values.
details -> Dict or List
An aggregated list of any requested details.
Expand All @@ -242,20 +238,16 @@ def react_series(

return response

def react(self, trainee_id, *args, **kwargs) -> "Reaction":
def react(self, trainee_id, *args, **kwargs) -> Reaction:
"""
Base: :func:`howso.client.AbstractHowsoClient.react`.
Returns
-------
Reaction:
A MutableMapping (dict) with these keys -> values:
actions -> pandas.DataFrame
A data frame with columns specified in
``features_to_generate`` list (or list of lists).
If ``features_to_generate`` is not specified all features
will be generated.
A MutableMapping (dict-like) with these keys -> values:
action -> pandas.DataFrame
A data frame of action values.
details -> Dict or List
An aggregated list of any requested details.
Expand Down
20 changes: 6 additions & 14 deletions howso/direct/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1925,7 +1925,7 @@ def react_series( # noqa: C901
use_case_weights: bool = False,
use_regional_model_residuals: bool = True,
weight_feature: Optional[str] = None
) -> "Reaction":
) -> Reaction:
"""
React in a series until a series_stop_map condition is met.
Expand Down Expand Up @@ -2088,13 +2088,9 @@ def react_series( # noqa: C901
Returns
-------
Reaction:
A MutableMapping (dict) with these keys -> values:
A MutableMapping (dict-like) with these keys -> values:
action -> pandas.DataFrame
A data frame with columns specified in
``features_to_generate`` list (or list of lists).
If ``features_to_generate`` is not specified all features
will be generated.
A data frame of action values.
details -> Dict or List
An aggregated list of any requested details.
Expand Down Expand Up @@ -2584,7 +2580,7 @@ def react( # noqa: C901
use_case_weights: bool = False,
use_regional_model_residuals: bool = True,
weight_feature: Optional[str] = None,
) -> "Reaction":
) -> Reaction:
r"""
React to supplied values and cases contained within the Trainee.
Expand Down Expand Up @@ -3000,13 +2996,9 @@ def react( # noqa: C901
Returns
-------
Reaction:
A MutableMapping (dict) with these keys -> values:
A MutableMapping (dict-like) with these keys -> values:
action -> pandas.DataFrame
A data frame with columns specified in
``features_to_generate`` list (or list of lists).
If ``features_to_generate`` is not specified all features
will be generated.
A data frame of action values.
details -> Dict or List
An aggregated list of any requested details.
Expand Down
20 changes: 6 additions & 14 deletions howso/engine/trainee.py
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ def react(
use_case_weights: bool = False,
use_regional_model_residuals: bool = True,
weight_feature: Optional[str] = None,
) -> "Reaction":
) -> Reaction:
"""
React to the trainee.
Expand Down Expand Up @@ -1599,13 +1599,9 @@ def react(
Returns
-------
Reaction:
A MutableMapping (dict) with these keys -> values:
A MutableMapping (dict-like) with these keys -> values:
action -> pandas.DataFrame
A data frame with columns specified in
``features_to_generate`` list (or list of lists).
If ``features_to_generate`` is not specified all features
will be generated.
A data frame of action values.
details -> Dict or List
An aggregated list of any requested details.
Expand Down Expand Up @@ -1687,7 +1683,7 @@ def react_series(
use_case_weights: bool = False,
use_regional_model_residuals: bool = True,
weight_feature: Optional[str] = None,
) -> "Reaction":
) -> Reaction:
"""
React to the trainee in a series until a stop condition is met.
Expand Down Expand Up @@ -1834,13 +1830,9 @@ def react_series(
Returns
-------
Reaction:
A MutableMapping (dict) with these keys -> values:
A MutableMapping (dict-like) with these keys -> values:
action -> pandas.DataFrame
A data frame with columns specified in
``features_to_generate`` list (or list of lists).
If ``features_to_generate`` is not specified all features
will be generated.
A data frame of action values.
details -> Dict or List
An aggregated list of any requested details.
Expand Down
5 changes: 3 additions & 2 deletions howso/utilities/reaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _validate_key(self, key) -> str:
# "action" and "explanations" to "details".
if key in ("series", "explanation"):
warnings.warn(
"The keys 'series' and 'explanation' are deprecated will be "
"The keys 'series' and 'explanation' are deprecated and will be "
"removed in a future release. Please use 'action' and 'details'.",
DeprecationWarning
)
Expand All @@ -111,7 +111,7 @@ def _validate_key(self, key) -> str:
if key == "explanation":
key = "details"
if key not in ('action', 'details'):
raise KeyError(f"Invalid Key: {key}. Keys can only be 'action' or 'details'.")
raise KeyError(f"Invalid Key: {key}. Valid keys are 'action' or 'details'.")

return key

Expand Down Expand Up @@ -288,6 +288,7 @@ def _reorganize_details(cls, details: t.MutableMapping[str, t.List]
return per_case_details


# Doesn't work if this is inside the `Reaction` class.
@Reaction.add_reaction.register
def _(self, reaction: "Reaction"):
"""Add another `Reaction` to Reaction."""
Expand Down

0 comments on commit 05bdc61

Please sign in to comment.