def from_string(cls, raw_filter, rule_limit):
"""
Creates a new Filter instance from the given string.
*raw_filter* is the raw filter : a string that may contain several
regular expressions (separated by a newline char) and tags.
*rule_limit* is the Rule's limit above which the Action is executed.
Raises :class:`exceptions.ValueError` if the given string could not be
compiled in at least one suitable :class:`re.RegexObject`.
Returns a new :class:`Filter` instance.
"""
parsed_filter = cls.replace_tags(raw_filter)
regexes = cls.build_regex_list(parsed_filter, rule_limit)
return cls(regexes)
评论列表
文章目录