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

Method _string_to_bytes

Lib/mailbox.py:197–205  ·  view source on GitHub ↗
(self, message)

Source from the content-addressed store, hash-verified

195 raise NotImplementedError('Method must be implemented by subclass')
196
197 def _string_to_bytes(self, message):
198 # If a message is not 7bit clean, we refuse to handle it since it
199 # likely came from reading invalid messages in text mode, and that way
200 # lies mojibake.
201 try:
202 return message.encode('ascii')
203 except UnicodeError:
204 raise ValueError("String input must be ASCII-only; "
205 "use bytes or a Message instead")
206
207 # Whether each message must end in a newline
208 _append_newline = False

Callers 3

_dump_messageMethod · 0.95
_install_messageMethod · 0.80
_install_messageMethod · 0.80

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected