MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / urldefrag

Function urldefrag

tools/python-3.11.9-amd64/Lib/urllib/parse.py:608–622  ·  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

606
607
608def urldefrag(url):
609 """Removes any existing fragment from URL.
610
611 Returns a tuple of the defragmented URL and the fragment. If
612 the URL contained no fragments, the second element is the
613 empty string.
614 """
615 url, _coerce_result = _coerce_args(url)
616 if '#' in url:
617 s, n, p, a, q, frag = urlparse(url)
618 defrag = urlunparse((s, n, p, a, q, ''))
619 else:
620 frag = ''
621 defrag = url
622 return _coerce_result(DefragResult(defrag, frag))
623
624_hexdig = '0123456789ABCDEFabcdef'
625_hextobyte = None

Callers

nothing calls this directly

Calls 4

_coerce_argsFunction · 0.85
urlparseFunction · 0.85
urlunparseFunction · 0.85
DefragResultClass · 0.85

Tested by

no test coverage detected