def _load_filter_group(self, s, group):
        # Work regular expression magic to extract method names and code
        s = s.replace('    ', '\t')
        nl = '(?:\n|\r|\r\n)'  # Different possibilities for newline
        it = re.finditer('^def filter\\(%s(?P<plural>s?)\\)'
                         ':(?P<flags>\s*#.*)?%s\t"""(?P<name>[^"]*)"""'
                         '%s(?P<body>(?:\t.*%s)*)'
                         % (self.signature, nl, nl, nl), s, re.M)
        for i in it:
            name = i.group('name')
            # Remove starting tabs
            body = [x[1:] for x in re.split(nl, i.group('body'))]
            if body[-1] == '':
                body = body[:-1]

            flag_string = i.group('flags')
            active = False
            on_exception = False
            combined = (i.group('plural') == 's')
            if flag_string:
                flags = flag_string.strip()[1:].split(',')
                for f in flags:
                    f = f.strip()
                    if f == 'ACTIVE':
                        active = True
                    elif f == 'EXCEPTION_TRUE':
                        on_exception = True
            self.add_filter(name, body, active, combined, on_exception, group)
dataset/ETHPy150Open rproepp/spykeviewer/spykeviewer/plugin_framework/filter_manager.py/FilterManager._load_filter_group/original