def normalize_pattern ( pattern ) : if not ( pattern . startswith ( 'RE:' ) or pattern . startswith ( '!RE:' ) ) : pattern = _slashes . sub ( '/' , pattern ) if len ( pattern ) > 1 : pattern = pattern . rstrip ( '/' ) return pattern
replace a pattern with single slash in python
Converts backslashes in path patterns to forward slashes .
def normalize_pattern(pattern):
    """Converts backslashes in path patterns to forward slashes.

    Doesn't normalize regular expressions - they may contain escapes.
    """
    if not (pattern.startswith('RE:') or pattern.startswith('!RE:')):
        pattern = _slashes.sub('/', pattern)
    if len(pattern) > 1:
        pattern = pattern.rstrip('/')
    return pattern