diff --git a/src/icepool/collection/counts.py b/src/icepool/collection/counts.py index 3ecb7c09..035ac1f8 100644 --- a/src/icepool/collection/counts.py +++ b/src/icepool/collection/counts.py @@ -34,10 +34,10 @@ def __init__(self, items: Iterable[tuple[T, int]]): bool(first_key < first_key) except TypeError: raise TypeError( - 'Items do not appear to be sortable. ' - 'Tip: Sequences containing dice or decks are not sortable. ' - 'Use tupleize() or vectorize() to transform ' - 'a sequence of dice into a die with sequence outcomes ' + 'Items do not appear to be sortable.\n' + 'Tip: Sequences containing dice or decks are not sortable.\n' + 'Use tupleize() or vectorize() to transform\n' + 'a sequence of dice into a die with sequence outcomes\n' 'according to the Cartesian product.') mapping: MutableMapping[T, int] = {} diff --git a/src/icepool/evaluator/multiset_evaluator.py b/src/icepool/evaluator/multiset_evaluator.py index 721307be..8189e11f 100644 --- a/src/icepool/evaluator/multiset_evaluator.py +++ b/src/icepool/evaluator/multiset_evaluator.py @@ -271,7 +271,7 @@ def evaluate( outcome = self.final_outcome(state) if outcome is None: raise TypeError( - "None is not a valid final outcome. " + "None is not a valid final outcome.\n" "This may have been a result of not supplying any generator with an outcome." ) if outcome is not icepool.Reroll: diff --git a/src/icepool/expression/multiset_expression.py b/src/icepool/expression/multiset_expression.py index aee8689d..380bdb42 100644 --- a/src/icepool/expression/multiset_expression.py +++ b/src/icepool/expression/multiset_expression.py @@ -153,7 +153,7 @@ def _validate_output_arity(inner: 'MultisetExpression') -> None: if isinstance(inner, icepool.MultisetGenerator) and inner.output_arity() != 1: raise ValueError( - 'Only generators with output arity of 1 may be bound to expressions. Use a multiset_function to select individual outputs.' + 'Only generators with output arity of 1 may be bound to expressions.\nUse a multiset_function to select individual outputs.' ) # Binary operators. diff --git a/src/icepool/generator/pool.py b/src/icepool/generator/pool.py index 57b1d6c7..ce63908f 100644 --- a/src/icepool/generator/pool.py +++ b/src/icepool/generator/pool.py @@ -468,8 +468,8 @@ def middle(self, match tie: case 'error': raise IndexError( - f'The middle {keep} of {self.keep_size()} elements is ambiguous.' - " Specify tie='low' or tie='high' to determine what to pick." + f'The middle {keep} of {self.keep_size()} elements is ambiguous.\n' + "Specify tie='low' or tie='high' to determine what to pick." ) case 'high': start = (self.keep_size() + 1 - keep) // 2 diff --git a/src/icepool/population/die.py b/src/icepool/population/die.py index c6534a3a..7bca9550 100644 --- a/src/icepool/population/die.py +++ b/src/icepool/population/die.py @@ -1137,11 +1137,10 @@ def sign(self) -> 'Die[int]': def __bool__(self) -> bool: raise TypeError( - 'A `Die` only has a truth value if it is the result of == or !=. ' - 'This could result from trying to use a die in an if-statement, ' - 'in which case you should use `die.if_else()` instead. ' - 'Or it could result from trying to use a `Die` inside a tuple or ' - 'vector outcome, ' + 'A `Die` only has a truth value if it is the result of == or !=.\n' + 'This could result from trying to use a die in an if-statement,\n' + 'in which case you should use `die.if_else()` instead.\n' + 'Or it could result from trying to use a `Die` inside a tuple or vector outcome,\n' 'in which case you should use `tupleize()` or `vectorize().') @cached_property diff --git a/src/icepool/typing.py b/src/icepool/typing.py index 4fd7c86b..bf0ee36b 100644 --- a/src/icepool/typing.py +++ b/src/icepool/typing.py @@ -104,5 +104,6 @@ def guess_star(function, arg_count=1) -> bool: try: required_count, _ = count_positional_parameters(function) except ValueError: - raise ValueError(f'Could not guess whether to unpack the first argument to the function. You may need to specify star explicitly.') + raise ValueError(f'Could not guess whether to unpack the first argument to the function.\n' + 'You may need to specify `star` explicitly.') return required_count > arg_count