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

Function escape

tools/python-3.11.9-amd64/Lib/glob.py:239–249  ·  view source on GitHub ↗

Escape all special characters.

(pathname)

Source from the content-addressed store, hash-verified

237 return pattern == '**'
238
239def escape(pathname):
240 """Escape all special characters.
241 """
242 # Escaping is done by wrapping any of "*?[" between square brackets.
243 # Metacharacters do not work in the drive part and shouldn't be escaped.
244 drive, pathname = os.path.splitdrive(pathname)
245 if isinstance(pathname, bytes):
246 pathname = magic_check_bytes.sub(br'[\1]', pathname)
247 else:
248 pathname = magic_check.sub(r'[\1]', pathname)
249 return drive + pathname
250
251
252_dir_open_flags = os.O_RDONLY | getattr(os, 'O_DIRECTORY', 0)

Callers 2

markupMethod · 0.70
normalizeFunction · 0.50

Calls 1

subMethod · 0.45

Tested by

no test coverage detected