def _interp_limit(invalid, fw_limit, bw_limit):
<EOL>N = len(invalid)<EOL>f_idx = set()<EOL>b_idx = set()<EOL>def inner(invalid, limit):<EOL><INDENT>limit = min(limit, N)<EOL>windowed = _rolling_window(invalid, limit + <NUM_LIT:1>).all(<NUM_LIT:1>)<EOL>idx = (set(np.where(windowed)[<NUM_LIT:0>] + limit) |<EOL>set(np.where((~invalid[:limit + <NUM_LIT:1>]).cumsum() == <NUM_LIT:0>)[<NUM_LIT:0>]))<EOL>return idx<EOL><DEDENT>if fw_limit is not None:<EOL><INDENT>if fw_limit == <NUM_LIT:0>:<EOL><INDENT>f_idx = set(np.where(invalid)[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>f_idx = inner(invalid, fw_limit)<EOL><DEDENT><DEDENT>if bw_limit is not None:<EOL><INDENT>if bw_limit == <NUM_LIT:0>:<EOL><INDENT>return f_idx<EOL><DEDENT>else:<EOL><INDENT>b_idx = list(inner(invalid[::-<NUM_LIT:1>], bw_limit))<EOL>b_idx = set(N - <NUM_LIT:1> - np.asarray(b_idx))<EOL>if fw_limit == <NUM_LIT:0>:<EOL><INDENT>return b_idx<EOL><DEDENT><DEDENT><DEDENT>return f_idx & b_idx<EOL>
Get indexers of values that won't be filled
because they exceed the limits.

Parameters
----------
invalid : boolean ndarray
fw_limit : int or None
    forward limit to index
bw_limit : int or None
    backward limit to index

Returns
-------
set of indexers

Notes
-----
This is equivalent to the more readable, but slower

.. code-block:: python

    def _interp_limit(invalid, fw_limit, bw_limit):
        for x in np.where(invalid)[0]:
            if invalid[max(0, x - fw_limit):x + bw_limit + 1].all():
                yield x