From 64eb0725c0b826fe2f0612b520f8af8a9c947ccc Mon Sep 17 00:00:00 2001 From: Albert Julius Liu Date: Sat, 12 Oct 2024 21:35:36 -0700 Subject: [PATCH] rename `pointwise_highest` to `pointwise_max` --- src/icepool/__init__.py | 4 ++-- src/icepool/function.py | 12 ++++++------ tests/function_test.py | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/icepool/__init__.py b/src/icepool/__init__.py index 3ea8e198..cc136758 100644 --- a/src/icepool/__init__.py +++ b/src/icepool/__init__.py @@ -48,7 +48,7 @@ from icepool.function import (d, z, __getattr__, coin, stochastic_round, one_hot, iter_cartesian_product, from_cumulative, - from_rv, pointwise_highest, pointwise_lowest, min_outcome, + from_rv, pointwise_max, pointwise_min, min_outcome, max_outcome, consecutive, sorted_union, commonize_denominator, reduce, accumulate, map, map_function, map_and_time, map_to_pool) @@ -147,7 +147,7 @@ 'd', 'z', 'coin', 'stochastic_round', 'one_hot', 'Outcome', 'Die', 'Population', 'tupleize', 'vectorize', 'Vector', 'Symbols', 'Again', 'CountsKeysView', 'CountsValuesView', 'CountsItemsView', 'from_cumulative', - 'from_rv', 'pointwise_highest', 'pointwise_lowest', 'lowest', 'highest', 'middle', 'min_outcome', 'max_outcome', + 'from_rv', 'pointwise_max', 'pointwise_min', 'lowest', 'highest', 'middle', 'min_outcome', 'max_outcome', 'consecutive', 'sorted_union', 'commonize_denominator', 'reduce', 'accumulate', 'map', 'map_function', 'map_and_time', 'map_to_pool', 'Reroll', 'RerollType', 'Pool', 'standard_pool', 'MultisetGenerator', diff --git a/src/icepool/function.py b/src/icepool/function.py index d485a3ab..5e4d1f7c 100644 --- a/src/icepool/function.py +++ b/src/icepool/function.py @@ -236,14 +236,14 @@ def _iter_outcomes( yield arg @overload -def pointwise_highest(arg0: 'Iterable[icepool.Die[T]]', /,) -> 'icepool.Die[T]': +def pointwise_max(arg0: 'Iterable[icepool.Die[T]]', /,) -> 'icepool.Die[T]': ... @overload -def pointwise_highest(arg0: 'icepool.Die[T]', arg1: 'icepool.Die[T]', /, *args: 'icepool.Die[T]') -> 'icepool.Die[T]': +def pointwise_max(arg0: 'icepool.Die[T]', arg1: 'icepool.Die[T]', /, *args: 'icepool.Die[T]') -> 'icepool.Die[T]': ... -def pointwise_highest(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]': +def pointwise_max(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]': """Selects the highest chance of rolling >= each outcome among the arguments. Naming not finalized. @@ -273,14 +273,14 @@ def pointwise_highest(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]' return from_cumulative(outcomes, cumulative) @overload -def pointwise_lowest(arg0: 'Iterable[icepool.Die[T]]', /,) -> 'icepool.Die[T]': +def pointwise_min(arg0: 'Iterable[icepool.Die[T]]', /,) -> 'icepool.Die[T]': ... @overload -def pointwise_lowest(arg0: 'icepool.Die[T]', arg1: 'icepool.Die[T]', /, *args: 'icepool.Die[T]') -> 'icepool.Die[T]': +def pointwise_min(arg0: 'icepool.Die[T]', arg1: 'icepool.Die[T]', /, *args: 'icepool.Die[T]') -> 'icepool.Die[T]': ... -def pointwise_lowest(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]': +def pointwise_min(arg0, /, *more_args: 'icepool.Die[T]') -> 'icepool.Die[T]': """Selects the highest chance of rolling <= each outcome among the arguments. Naming not finalized. diff --git a/tests/function_test.py b/tests/function_test.py index e482c203..62326138 100644 --- a/tests/function_test.py +++ b/tests/function_test.py @@ -1,7 +1,7 @@ import icepool import pytest -from icepool import d4, d6, d8, d10, d12, d20, min_outcome, max_outcome, pointwise_highest, pointwise_lowest +from icepool import d4, d6, d8, d10, d12, d20, min_outcome, max_outcome, pointwise_max, pointwise_min def test_min_outcome_single_arg(): @@ -27,29 +27,29 @@ def test_max_outcome_multiple_arg(): def test_max_outcome_bare_outcome(): assert max_outcome(d6, d8, 10, 2) == 10 -def test_pointwise_highest(): - result = pointwise_highest(3 @ d6, d20) +def test_pointwise_max(): + result = pointwise_max(3 @ d6, d20) for outcome in range(1, 21): assert result.probability('>=', outcome) == max( (3 @ d6).probability('>=', outcome), d20.probability('>=', outcome)) -def test_pointwise_highest_single_argument(): - result = pointwise_highest([3 @ d6, d20]) +def test_pointwise_max_single_argument(): + result = pointwise_max([3 @ d6, d20]) for outcome in range(1, 21): assert result.probability('>=', outcome) == max( (3 @ d6).probability('>=', outcome), d20.probability('>=', outcome)) -def test_pointwise_lowest(): - result = pointwise_lowest(3 @ d6, d20) +def test_pointwise_min(): + result = pointwise_min(3 @ d6, d20) for outcome in range(1, 21): assert result.probability('<=', outcome) == max( (3 @ d6).probability('<=', outcome), d20.probability('<=', outcome)) -def test_pointwise_lowest_single_argument(): - result = pointwise_lowest([3 @ d6, d20]) +def test_pointwise_min_single_argument(): + result = pointwise_min([3 @ d6, d20]) for outcome in range(1, 21): assert result.probability('<=', outcome) == max( (3 @ d6).probability('<=', outcome),