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

Function quote

Lib/email/_parseaddr.py:205–212  ·  view source on GitHub ↗

Prepare string to be used in a quoted string. Turns backslash and double quote characters into quoted pairs. These are the only characters that need to be quoted inside a quoted string. Does not add the surrounding double quotes.

(str)

Source from the content-addressed store, hash-verified

203
204
205def quote(str):
206 """Prepare string to be used in a quoted string.
207
208 Turns backslash and double quote characters into quoted pairs. These
209 are the only characters that need to be quoted inside a quoted string.
210 Does not add the surrounding double quotes.
211 """
212 return str.replace('\\', '\\\\').replace('"', '\\"')
213
214
215class AddrlistClass:

Callers 2

decode_paramsFunction · 0.90
getaddrspecMethod · 0.70

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…