MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / needsquoting

Function needsquoting

tools/python-3.11.9-amd64/Lib/quopri.py:21–34  ·  view source on GitHub ↗

Decide whether a particular byte ordinal needs to be quoted. The 'quotetabs' flag indicates whether embedded tabs and spaces should be quoted. Note that line-ending tabs and spaces are always encoded, as per RFC 1521.

(c, quotetabs, header)

Source from the content-addressed store, hash-verified

19
20
21def needsquoting(c, quotetabs, header):
22 """Decide whether a particular byte ordinal needs to be quoted.
23
24 The 'quotetabs' flag indicates whether embedded tabs and spaces should be
25 quoted. Note that line-ending tabs and spaces are always encoded, as per
26 RFC 1521.
27 """
28 assert isinstance(c, bytes)
29 if c in b' \t':
30 return quotetabs
31 # if header, we have to escape _ because _ is used to escape space
32 if c == b'_':
33 return header
34 return c == ESCAPE or not (b' ' <= c <= b'~')
35
36def quote(c):
37 """Quote a single character."""

Callers 1

encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected