diff options
Diffstat (limited to 'src/mailman/Utils.py')
| -rw-r--r-- | src/mailman/Utils.py | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/mailman/Utils.py b/src/mailman/Utils.py index e10a9fde5..18b7a8b95 100644 --- a/src/mailman/Utils.py +++ b/src/mailman/Utils.py @@ -352,58 +352,3 @@ def oneline(s, cset='us-ascii', in_unicode=False): except (LookupError, UnicodeError, ValueError, HeaderParseError): # possibly charset problem. return with undecoded string in one line. return EMPTYSTRING.join(s.splitlines()) - - -def strip_verbose_pattern(pattern): - # Remove white space and comments from a verbose pattern and return a - # non-verbose, equivalent pattern. Replace CR and NL in the result - # with '\\r' and '\\n' respectively to avoid multi-line results. - if not isinstance(pattern, str): - return pattern - newpattern = '' - i = 0 - inclass = False - skiptoeol = False - copynext = False - while i < len(pattern): - c = pattern[i] - if copynext: - if c == NL: - newpattern += '\\n' - elif c == CR: - newpattern += '\\r' - else: - newpattern += c - copynext = False - elif skiptoeol: - if c == NL: - skiptoeol = False - elif c == '#' and not inclass: - skiptoeol = True - elif c == '[' and not inclass: - inclass = True - newpattern += c - copynext = True - elif c == ']' and inclass: - inclass = False - newpattern += c - elif re.search('\s', c): - if inclass: - if c == NL: - newpattern += '\\n' - elif c == CR: - newpattern += '\\r' - else: - newpattern += c - elif c == '\\' and not inclass: - newpattern += c - copynext = True - else: - if c == NL: - newpattern += '\\n' - elif c == CR: - newpattern += '\\r' - else: - newpattern += c - i += 1 - return newpattern |
