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

Function urldefrag

Lib/urllib/parse.py:652–666  ·  view source on GitHub ↗

Removes any existing fragment from URL. Returns a tuple of the defragmented URL and the fragment. If the URL contained no fragments, the second element is the empty string.

(url)

Source from the content-addressed store, hash-verified

650
651
652def urldefrag(url):
653 """Removes any existing fragment from URL.
654
655 Returns a tuple of the defragmented URL and the fragment. If
656 the URL contained no fragments, the second element is the
657 empty string.
658 """
659 url, _coerce_result = _coerce_args(url)
660 if '#' in url:
661 s, n, p, q, frag = _urlsplit(url)
662 defrag = _urlunsplit(s, n, p, q, None)
663 else:
664 frag = ''
665 defrag = url
666 return _coerce_result(DefragResult(defrag, frag or ''))
667
668_hexdig = '0123456789ABCDEFabcdef'
669_hextobyte = None

Callers

nothing calls this directly

Calls 4

_coerce_argsFunction · 0.85
_urlsplitFunction · 0.85
_urlunsplitFunction · 0.85
DefragResultClass · 0.85

Tested by

no test coverage detected