MCPcopy Create free account
hub / github.com/ipython/ipython / protect_filename

Function protect_filename

IPython/core/completer.py:233–241  ·  view source on GitHub ↗

Escape a string to protect certain characters.

(s, protectables=PROTECTABLES)

Source from the content-addressed store, hash-verified

231
232
233def protect_filename(s, protectables=PROTECTABLES):
234 """Escape a string to protect certain characters."""
235 if set(s) & set(protectables):
236 if sys.platform == "win32":
237 return '"' + s + '"'
238 else:
239 return "".join(("\\" + c if c in protectables else c) for c in s)
240 else:
241 return s
242
243
244def expand_user(path:str) -> Tuple[str, bool, str]:

Callers 1

file_matchesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected