Skip to content

Commit

Permalink
Rely on Py3 kwonly args to make the signature of Pipeline explicit.
Browse files Browse the repository at this point in the history
... instead of hiding it behind kwargs-popping.

Also remove now-unnecessary future imports.
  • Loading branch information
anntzer committed Jan 24, 2023
1 parent 8669c26 commit 9f2085b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions slicerator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from __future__ import (absolute_import, division, print_function,
unicode_literals)

import collections.abc
import itertools
from functools import wraps
Expand Down Expand Up @@ -361,7 +358,8 @@ def _index_generator(new_indices, old_indices):


class Pipeline(object):
def __init__(self, proc_func, *ancestors, **kwargs):
def __init__(self, proc_func, *ancestors,
propagate_attrs=None, propagate_how='first'):
"""A class to support lazy function evaluation on an iterable.
When a ``Pipeline`` object is indexed, it returns an element of its
Expand Down Expand Up @@ -401,15 +399,6 @@ def __init__(self, proc_func, *ancestors, **kwargs):
--------
pipeline
"""
# Python 2 does not allow default arguments in combination with
# variable arguments; work around that
propagate_attrs = kwargs.pop('propagate_attrs', None)
propagate_how = kwargs.pop('propagate_how', 'first')
if kwargs:
# There are some left. This is an error.
raise TypeError("Unexpected keyword argument '{}'.".format(
next(iter(kwargs))))

# Only accept ancestors of the same length are accepted
self._len = len(ancestors[0])
if not all(len(a) == self._len for a in ancestors):
Expand Down

0 comments on commit 9f2085b

Please sign in to comment.