Skip to content

Commit 5b53b55

Browse files
Clarify error message and add comment on builtin fallback
- Error message now says "one required positional argument" (functions with extra optional args are still valid) - Added comment explaining why builtins skip signature validation Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 548a8b4 commit 5b53b55

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

neat/aggregations.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ def validate_aggregation(function):
5656
try:
5757
signature = inspect.signature(function)
5858
except (TypeError, ValueError) as exc:
59+
# CPython builtins (e.g. max, sum) often lack introspectable signatures.
60+
# Skip signature validation for these; they are assumed correct.
5961
if isinstance(function, types.BuiltinFunctionType):
6062
return
6163
raise InvalidAggregationFunction("Unable to inspect aggregation callable signature.") from exc
@@ -64,7 +66,7 @@ def validate_aggregation(function):
6466
signature.bind(object())
6567
except TypeError as exc:
6668
raise InvalidAggregationFunction(
67-
"A function taking a single positional argument is required"
69+
"A callable with exactly one required positional argument is required"
6870
) from exc
6971

7072

0 commit comments

Comments
 (0)