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

模式匹配注册表。

exception kombu.matcher.MatcherNotInstalled[源代码]

未安装/找到匹配器。

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']
register(name: str, matcher: Callable[[str, str], bool]) None[源代码]

按名称将Matcher添加到注册表。

unregister(name: str) None[源代码]

按名称从注册表中删除匹配器。

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.register_glob() None[源代码]

将GLOB注册到默认注册表。

kombu.matcher.register_pcre() None[源代码]

将PCRE注册到默认注册表。

kombu.matcher.registry = <kombu.matcher.MatcherRegistry object>
match(data, pattern, matcher=default_matcher,
matcher_kwargs=None):

火柴 data 通过 pattern 使用 matcher

参数:
  • data -- 应该匹配的数据。必须是字符串。

  • pattern -- 应该应用的模式。必须是字符串。

关键字参数:
  • matcher -- 表示数学计算方法的可选字符串(例如, globpcre )。如果 None (默认),然后 glob 将会被使用。

  • matcher_kwargs -- 将传递给指定的 matcher

返回:

True 如果 data 与模式相匹配, False 否则的话。

抛出:

MatcherNotInstalled -- 如果请求的匹配方法不可用。

kombu.matcher.unregister(name: str) None

按名称从注册表中删除匹配器。