b.g.Replacer(object) : class documentation

Part of bzrlib.globbing View In Hierarchy

Do a multiple-pattern substitution.

The patterns and substitutions are combined into one, so the result of one replacement is never substituted again. Add the patterns and replacements via the add method and then call the object. The patterns must not contain capturing groups.

Method __init__ Undocumented
Method add Add a pattern and replacement.
Method add_replacer Add all patterns from another replacer.
Method __call__ Undocumented
Method _do_sub Undocumented
def __init__(self, source=None):
Undocumented
def add(self, pat, fun):
Add a pattern and replacement.

The pattern must not contain capturing groups. The replacement might be either a string template in which & will be replaced with the match, or a function that will get the matching text as argument. It does not get match object, because capturing is forbidden anyway.

def add_replacer(self, replacer):
Add all patterns from another replacer.

All patterns and replacements from replacer are appended to the ones already defined.

def __call__(self, text):
Undocumented
def _do_sub(self, m):
Undocumented
API Documentation for Bazaar, generated by pydoctor at 2022-06-16 00:25:16.