MCPcopy Index your code
hub / github.com/python/cpython / _to_bytes

Function _to_bytes

Lib/urllib/parse.py:1209–1220  ·  view source on GitHub ↗

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

(url)

Source from the content-addressed store, hash-verified

1207
1208
1209def _to_bytes(url):
1210 """to_bytes(u"URL") --> 'URL'."""
1211 # Most URL schemes require ASCII. If that changes, the conversion
1212 # can be relaxed.
1213 # XXX get rid of to_bytes()
1214 if isinstance(url, str):
1215 try:
1216 url = url.encode("ASCII").decode()
1217 except UnicodeError:
1218 raise UnicodeError("URL " + repr(url) +
1219 " contains non-ASCII characters")
1220 return url
1221
1222
1223def unwrap(url):

Callers 1

to_bytesFunction · 0.85

Calls 2

decodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…