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

Function quote

tools/python-3.11.9-amd64/Lib/shlex.py:325–334  ·  view source on GitHub ↗

Return a shell-escaped version of the string *s*.

(s)

Source from the content-addressed store, hash-verified

323_find_unsafe = re.compile(r'[^\w@%+=:,./-]', re.ASCII).search
324
325def quote(s):
326 """Return a shell-escaped version of the string *s*."""
327 if not s:
328 return "''"
329 if _find_unsafe(s) is None:
330 return s
331
332 # use single quotes, and put single quotes into double quotes
333 # the string $'b is then quoted as '$'"'"'b'
334 return "'" + s.replace("'", "'\"'\"'") + "'"
335
336
337def _print_tokens(lexer):

Callers 2

makepipelineFunction · 0.90
joinFunction · 0.70

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected