What happened?
dimensions.py runs full partition-checking for the windows:
if node.name in ('shift', 'sum_back', 'sum_forward'):
...
partition = node.kwargs.get('by')
if partition is not None:
# two carefully-worded DimensionErrors about partitioning
Neither window's Builtin has lookup_kwargs, so call_shape_error rejects by= first and that code can never run:
constraints:
c:
foreach: [unit, hour]
expression: sum_back(x, over=hour, within=3, by=day_of) <= 1
SchemaError: Constraint 'c': sum_back() expects sum_back(<expr>, over=<dim>, within=<n|parameter>[, edge='wrap'])
The module docstring in operators.py also states the opposite of what the signature allows:
by= on shift and sum_back partitions the axis the operator walks, which is the same lookup in a different position
What it should be
One of three, and the choice is a design decision rather than a cleanup:
- Support it — add
lookup_kwargs=('by',)/optional_kwargs=('by',) to both windows and the existing checks light up. "The next n hours inside this representative day" is a real ask, and it is the same by= as shift's.
- Refuse it — drop the dead branch and correct the docstring.
- Support it on neither and say why in the docstring.
Worth settling for the pair at once rather than twice. Whichever way it goes, the docstring and the signature should agree.
Version
v0.0.0-alpha.10 (and sum_forward inherits it — #56)
What happened?
dimensions.pyruns full partition-checking for the windows:Neither window's
Builtinhaslookup_kwargs, socall_shape_errorrejectsby=first and that code can never run:The module docstring in
operators.pyalso states the opposite of what the signature allows:What it should be
One of three, and the choice is a design decision rather than a cleanup:
lookup_kwargs=('by',)/optional_kwargs=('by',)to both windows and the existing checks light up. "The nextnhours inside this representative day" is a real ask, and it is the sameby=asshift's.Worth settling for the pair at once rather than twice. Whichever way it goes, the docstring and the signature should agree.
Version
v0.0.0-alpha.10 (and
sum_forwardinherits it — #56)