Module rules
Match messages by rules of arbitrary specificity.
A message-matching rule, represented by Rule object, is a
series of pattern matches to be applied to the message, leading to the
decision of whether or not the rule as whole matches the message.
Patterns can be of different kinds, act on different parts of the
message, and be applied in a boolean-like combinations.
See doc/user/lingo.docbook#sec-lgrules
for detailed
discussion of rules.
- Authors:
-
Sébastien Renard <sebastien.renard@digitalfox.org>,
Chusslove Illich (Часлав Илић) <caslav.ilic@gmx.net>
License:
GPLv3
|
Rule
Represent a single rule
|
|
printStat(rules)
Print rules match statistics |
|
|
|
loadRules(lang,
envs=[ ] ,
envOnly=False,
ruleFiles=None,
stat=False)
Load rules for a given language |
|
|
|
loadRulesFromFile(filePath,
stat,
envs=set([ ]) ,
seenMsgFilters={ } )
Load rule file and return list of Rule objects |
|
|
|
TIMEOUT = 8
|
|
__package__ = ' pology '
|
Print rules match statistics
- Parameters:
rules - list of rule files
|
loadRules(lang,
envs=[ ] ,
envOnly=False,
ruleFiles=None,
stat=False)
|
|
Load rules for a given language
- Parameters:
lang - lang as a string in two caracter (i.e. fr). If none or empty, try
to autodetect language
envs - also load rules applicable in these environments
envOnly - load only rules applicable in given environments
ruleFiles - a list of rule files to load instead of internal
stat - stat is a boolean to indicate if rule should gather count and
time execution
- Returns:
- list of rules objects or None if rules cannot be found (with
complaints on stdout)
|
loadRulesFromFile(filePath,
stat,
envs=set([ ]) ,
seenMsgFilters={ } )
|
|
Load rule file and return list of Rule objects
- Parameters:
filePath - full path to rule file
stat - stat is a boolean to indicate if rule should gather count and
time execution
envs - environments in which the rules are to be applied
seenMsgFilters - dictionary of previously encountered message filter functions, by
their signatures; to avoid constructing same filters over
different files
- Returns:
- list of Rule object
|