This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 5.0.
模式匹配注册表- kombu.matcher
¶
模式匹配注册表。
- class kombu.matcher.MatcherRegistry[源代码]¶
模式匹配功能注册表。
- exception MatcherNotInstalled¶
未安装/找到匹配器。
- match(data: bytes, pattern: bytes, matcher: str | None = None, matcher_kwargs: dict[str, str] | None = None) bool [源代码]¶
打电话给火柴工。
- matcher_pattern_first = ['pcre']¶
- kombu.matcher.match(data: bytes, pattern: bytes, matcher: str | None = None, matcher_kwargs: dict[str, str] | None = None) bool ¶
- register(name, matcher):
- Register a new matching method.
- 参数:
name -- 数学方法的一个方便的名字。
matcher -- 将传递数据和模式的方法。
- kombu.matcher.register(name: str, matcher: Callable[[str, str], bool]) None ¶
- unregister(name):
- Unregister registered matching method.
- 参数:
name -- 已注册的匹配方法名称。
- kombu.matcher.registry = <kombu.matcher.MatcherRegistry object>¶
- match(data, pattern, matcher=default_matcher,
- matcher_kwargs=None):
火柴 data 通过 pattern 使用 matcher 。
- 参数:
data -- 应该匹配的数据。必须是字符串。
pattern -- 应该应用的模式。必须是字符串。
- 关键字参数:
matcher -- 表示数学计算方法的可选字符串(例如, glob 或 pcre )。如果
None
(默认),然后 glob 将会被使用。matcher_kwargs -- 将传递给指定的 matcher 。
- 返回:
True
如果 data 与模式相匹配,False
否则的话。- 抛出:
MatcherNotInstalled -- 如果请求的匹配方法不可用。