Skip to content

Commit 41dc85f

Browse files
committed
fix some type hints
1 parent b0a154d commit 41dc85f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

refinery/lib/argformats.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,15 +1402,14 @@ def reduce(self, it: Iterable[int], reduction: str, seed: str | None = None) ->
14021402
integer sequence and assigned back to `S`. The starting value of `S` is given by `seed`,
14031403
which has a default value of `0` and must also be given as a Python expression.
14041404
"""
1405-
seed = seed and PythonExpression.Lazy(seed)
1406-
reduction = PythonExpression.Lazy(reduction)
1405+
_seed = PythonExpression.Lazy(seed or '0')
1406+
_fold = PythonExpression.Lazy(reduction)
14071407

14081408
def finalize(data: Chunk | None = None):
14091409
def _reduction(S, B):
1410-
v = reduction(args, S=S, B=B)
1411-
return v
1412-
args = dict(metavars(data))
1413-
return reduce(_reduction, it, seed and seed(args) or 0)
1410+
return _fold(args, S=S, B=B)
1411+
args = {} if data is None else dict(metavars(data))
1412+
return reduce(_reduction, it, _seed(args))
14141413

14151414
try:
14161415
return finalize()

0 commit comments

Comments
 (0)