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

Function _quote

Lib/http/cookies.py:183–193  ·  view source on GitHub ↗

r"""Quote a string for use in a cookie header. If the string does not need to be double-quoted, then just return the string. Otherwise, surround the string in doublequotes and quote (with a \) special characters.

(str)

Source from the content-addressed store, hash-verified

181
182
183def _quote(str):
184 r"""Quote a string for use in a cookie header.
185
186 If the string does not need to be double-quoted, then just return the
187 string. Otherwise, surround the string in doublequotes and quote
188 (with a \) special characters.
189 """
190 if str is None or _is_legal_key(str):
191 return str
192 else:
193 return '"' + str.translate(_Translator) + '"'
194
195
196_unquote_sub = re.compile(r'\\(?:([0-3][0-7][0-7])|(.))').sub

Callers 2

OutputStringMethod · 0.85
value_encodeMethod · 0.85

Calls 1

translateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…