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

Function _to_bytes

tools/python-3.11.9-amd64/Lib/urllib/parse.py:1029–1040  ·  view source on GitHub ↗

to_bytes(u"URL") --> 'URL'.

(url)

Source from the content-addressed store, hash-verified

1027
1028
1029def _to_bytes(url):
1030 """to_bytes(u"URL") --> 'URL'."""
1031 # Most URL schemes require ASCII. If that changes, the conversion
1032 # can be relaxed.
1033 # XXX get rid of to_bytes()
1034 if isinstance(url, str):
1035 try:
1036 url = url.encode("ASCII").decode()
1037 except UnicodeError:
1038 raise UnicodeError("URL " + repr(url) +
1039 " contains non-ASCII characters")
1040 return url
1041
1042
1043def unwrap(url):

Callers 3

openMethod · 0.90
retrieveMethod · 0.90
to_bytesFunction · 0.70

Calls 2

decodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected