Push new rule to the end of chain. :param ruleName: new rule will be added to the end of chain. :param fn: new rule function. :param options: new rule options (not mandatory).
(
self, ruleName: str, fn: RuleFuncTv, options: RuleOptionsType | None = None
)
| 174 | self.__cache__ = None |
| 175 | |
| 176 | def push( |
| 177 | self, ruleName: str, fn: RuleFuncTv, options: RuleOptionsType | None = None |
| 178 | ) -> None: |
| 179 | """Push new rule to the end of chain. |
| 180 | |
| 181 | :param ruleName: new rule will be added to the end of chain. |
| 182 | :param fn: new rule function. |
| 183 | :param options: new rule options (not mandatory). |
| 184 | |
| 185 | """ |
| 186 | self.__rules__.append( |
| 187 | Rule[RuleFuncTv](ruleName, True, fn, (options or {}).get("alt", [])) |
| 188 | ) |
| 189 | self.__cache__ = None |
| 190 | |
| 191 | def enable( |
| 192 | self, names: str | Iterable[str], ignoreInvalid: bool = False |