def _watch_pattern(self, include): pattern = u'' a = [] for entry in include: e = textutil.toRegExpS(entry) a.append(e) pattern = '|'.join(a) return pattern
def __init__(self, matchlist): assert isinstance(matchlist, types.ListType) self.matchlist = matchlist # ["a.b.c.*", "d.e.Foo"] elems = [] for elem in matchlist: assert isinstance(elem, types.StringTypes) if elem != "": regexp = textutil.toRegExpS(elem) elems.append(regexp) if elems: self.__regexp = re.compile("|".join(elems)) else: self.__regexp = re.compile(r".\A") # match none
def setFilter(self, filterPatternsList=[]): if not filterPatternsList: self.filter_pattern = "" return re_patts = [textutil.toRegExpS(x) for x in filterPatternsList] self.filter_pattern = re.compile("|".join(re_patts))