MCPcopy Index your code
hub / github.com/RustPython/RustPython / urlsplit

Function urlsplit

Lib/urllib/parse.py:473–497  ·  view source on GitHub ↗

Parse a URL into 5 components: :// / ? # The result is a named 5-tuple with fields corresponding to the above. It is either a SplitResult or SplitResultBytes object, depending on the type of the url parameter. The username, password, hostname

(url, scheme='', allow_fragments=True)

Source from the content-addressed store, hash-verified

471# comparison since this API supports both bytes and str input.
472@functools.lru_cache(typed=True)
473def urlsplit(url, scheme='', allow_fragments=True):
474 """Parse a URL into 5 components:
475 <scheme>://<netloc>/<path>?<query>#<fragment>
476
477 The result is a named 5-tuple with fields corresponding to the
478 above. It is either a SplitResult or SplitResultBytes object,
479 depending on the type of the url parameter.
480
481 The username, password, hostname, and port sub-components of netloc
482 can also be accessed as attributes of the returned object.
483
484 The scheme argument provides the default value of the scheme
485 component when no scheme is found in url.
486
487 If allow_fragments is False, no attempt is made to separate the
488 fragment component from the previous component, which can be either
489 path or query.
490
491 Note that % escapes are not expanded.
492 """
493
494 url, scheme, _coerce_result = _coerce_args(url, scheme)
495 scheme, netloc, url, query, fragment = _urlsplit(url, scheme, allow_fragments)
496 v = SplitResult(scheme or '', netloc or '', url, query or '', fragment or '')
497 return _coerce_result(v)
498
499def _urlsplit(url, scheme=None, allow_fragments=True):
500 # Only lstrip url as some applications rely on preserving trailing space.

Callers 5

putrequestMethod · 0.90
test_fileMethod · 0.90
test_full_url_setterMethod · 0.90
reduce_uriMethod · 0.90
url2pathnameFunction · 0.90

Calls 3

_coerce_argsFunction · 0.85
_urlsplitFunction · 0.85
SplitResultClass · 0.85

Tested by 2

test_fileMethod · 0.72
test_full_url_setterMethod · 0.72