ice.py
def _normalize_pattern(pattern):
        """Return a normalized form of the pattern.

        Normalize the pattern by removing pattern type prefix if it
        exists in the pattern. Then return the pattern type and the
        pattern as a tuple of two strings.

        Arguments:
          pattern (str): Route pattern to match request paths

        Returns:
          tuple: Ruple of pattern type (str) and pattern (str)
        """
        if pattern.startswith('regex:'):
            pattern_type = 'regex'
            pattern = pattern[len('regex:'):]
        elif pattern.startswith('wildcard:'):
            pattern_type = 'wildcard'
            pattern = pattern[len('wildcard:'):]
        elif pattern.startswith('literal:'):
            pattern_type = 'literal'
            pattern = pattern[len('literal:'):]
        elif RegexRoute.like(pattern):
            pattern_type = 'regex'
        elif WildcardRoute.like(pattern):
            pattern_type = 'wildcard'
        else:
            pattern_type = 'literal'
        return pattern_type, pattern
def _normalize_pattern(pattern):
        if pattern.startswith('regex:'):
            pattern_type = 'regex'
            pattern = pattern[len('regex:'):]
        elif pattern.startswith('wildcard:'):
            pattern_type = 'wildcard'
            pattern = pattern[len('wildcard:'):]
        elif pattern.startswith('literal:'):
            pattern_type = 'literal'
            pattern = pattern[len('literal:'):]
        elif RegexRoute.like(pattern):
            pattern_type = 'regex'
        elif WildcardRoute.like(pattern):
            pattern_type = 'wildcard'
        else:
            pattern_type = 'literal'
        return pattern_type, pattern
def _normalize_pattern ( pattern ) : if pattern . startswith ( 'regex:' ) : pattern_type = 'regex' pattern = pattern [ len ( 'regex:' ) : ] elif pattern . startswith ( 'wildcard:' ) : pattern_type = 'wildcard' pattern = pattern [ len ( 'wildcard:' ) : ] elif pattern . startswith ( 'literal:' ) : pattern_type = 'literal' pattern = pattern [ len ( 'literal:' ) : ] elif RegexRoute . like ( pattern ) : pattern_type = 'regex' elif WildcardRoute . like ( pattern ) : pattern_type = 'wildcard' else : pattern_type = 'literal' return pattern_type , pattern
Return a normalized form of the pattern.

        Normalize the pattern by removing pattern type prefix if it
        exists in the pattern. Then return the pattern type and the
        pattern as a tuple of two strings.

        Arguments:
          pattern (str): Route pattern to match request paths

        Returns:
          tuple: Ruple of pattern type (str) and pattern (str)
Return a normalized form of the pattern .