Skip to content

Commit

Permalink
Add ignore to Match.holes method
Browse files Browse the repository at this point in the history
  • Loading branch information
Toilal committed Oct 23, 2015
1 parent e734151 commit b7ed583
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions rebulk/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import copy
import six

from .loose import ensure_list, filter_index
from .loose import ensure_list, filter_index, call
from .utils import is_iterable


Expand Down Expand Up @@ -185,7 +185,7 @@ def range(self, start=0, end=None, predicate=None, index=None):
ret.append(match)
return filter_index(ret, predicate, index)

def holes(self, start=0, end=None, formatter=None, predicate=None, index=None): # pylint: disable=too-many-branches
def holes(self, start=0, end=None, formatter=None, ignore=None, predicate=None, index=None): # pylint: disable=too-many-branches
"""
Retrieves a set of Match objects that are not defined in given range.
:param start:
Expand All @@ -194,6 +194,8 @@ def holes(self, start=0, end=None, formatter=None, predicate=None, index=None):
:type end:
:param formatter:
:type formatter:
:param ignore:
:type ignore:
:param predicate:
:type predicate:
:param index:
Expand All @@ -218,7 +220,7 @@ def holes(self, start=0, end=None, formatter=None, predicate=None, index=None):

for rindex in range(loop_start, end):
for starting in self.starting(rindex):
if starting not in current:
if starting not in current and (not ignore or not call(ignore, starting, rindex, loop_start)):
current.append(starting)
for ending in self.ending(rindex):
if ending in current:
Expand Down

0 comments on commit b7ed583

Please sign in to comment.