def uriparse(uri, strict=False):
    """Given a valid URI, return a 5-tuple of (scheme, authority, path,
    query, fragment). The query part is a URLQuery object, the rest are
    strings.
    Raises ValueError if URI is malformed.
    """
    key = uri, strict
    try:
        scheme, authority, path, q, fragment = _parse_cache[key]
        return (scheme, authority, path, q.copy(), fragment)
    except __HOLE__:
        pass
    if len(_parse_cache) >= MAX_CACHE_SIZE:
        _parse_cache.clear()
    if strict:
        mo = URI_RE_STRICT.search(uri)
        if mo:
            _, scheme, _, authority, path, _, query, _, fragment = mo.groups()
        else:
            raise ValueError("Invalid URI: %r" % (uri,))
    else:
        mo = URI_RE.search(uri)
        if mo:
            _, scheme, authority, path, _, query, _, fragment = mo.groups()
        else:
            raise ValueError("Invalid URI: %r" % (uri,))
    if query:
        q = queryparse(query)
    else:
        q = URLQuery()
    t = (scheme, authority, path, q, fragment)
    _parse_cache[key] = (scheme, authority, path, q.copy(), fragment)
    return (scheme, authority, path, q, fragment)
dataset/ETHPy150Open kdart/pycopia/aid/pycopia/urlparse.py/uriparse