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

Function _to_bytes

Lib/urllib/parse.py:1089–1100  ·  view source on GitHub ↗

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

(url)

Source from the content-addressed store, hash-verified

1087
1088
1089def _to_bytes(url):
1090 """to_bytes(u"URL") --> 'URL'."""
1091 # Most URL schemes require ASCII. If that changes, the conversion
1092 # can be relaxed.
1093 # XXX get rid of to_bytes()
1094 if isinstance(url, str):
1095 try:
1096 url = url.encode("ASCII").decode()
1097 except UnicodeError:
1098 raise UnicodeError("URL " + repr(url) +
1099 " contains non-ASCII characters")
1100 return url
1101
1102
1103def unwrap(url):

Callers 1

to_bytesFunction · 0.85

Calls 4

isinstanceFunction · 0.85
reprFunction · 0.85
decodeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected