This document describes the current stable version of Kombu (4.5). For development docs, go here.

Pattern matching registry - kombu.matcher

Pattern matching registry.

exception kombu.matcher.MatcherNotInstalled[source]

Matcher not installed/found.

class kombu.matcher.MatcherRegistry[source]

Pattern matching function registry.

exception MatcherNotInstalled

Matcher not installed/found.

match(data, pattern, matcher=None, matcher_kwargs=None)[source]

Call the matcher.

matcher_pattern_first = ['pcre']
register(name, matcher)[source]

Add matcher by name to the registry.

unregister(name)[source]

Remove matcher by name from the registry.

kombu.matcher.match = <bound method MatcherRegistry.match of <kombu.matcher.MatcherRegistry object>>

Register a new matching method.

Parameters:
  • name – A convience name for the mathing method.
  • matcher – A method that will be passed data and pattern.
Type:
kombu.matcher.register(name, matcher)
kombu.matcher.register = <bound method MatcherRegistry.register of <kombu.matcher.MatcherRegistry object>>

Unregister registered matching method.

Parameters:

name – Registered matching method name.

Type:
kombu.matcher.unregister(name)
kombu.matcher.register_glob()[source]

Register glob into default registry.

kombu.matcher.register_pcre()[source]

Register pcre into default registry.

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

Match data by pattern using matcher.

Parameters:
  • data – The data that should be matched. Must be string.
  • pattern – The pattern that should be applied. Must be string.
Keyword Arguments:
 
  • matcher

    An optional string representing the mathcing method (for example, glob or pcre).

    If None (default), then glob will be used.

  • matcher_kwargs – Additional keyword arguments that will be passed to the specified matcher.
Returns:

True if data matches pattern, False otherwise.

Raises:

MatcherNotInstalled – If the matching method requested is not available.