MCPcopy Index your code
hub / github.com/ipython/ipython / protect_filename

Function protect_filename

IPython/core/completer.py:360–368  ·  view source on GitHub ↗

Escape a string to protect certain characters.

(s: str, protectables: str = PROTECTABLES)

Source from the content-addressed store, hash-verified

358
359
360def protect_filename(s: str, protectables: str = PROTECTABLES) -> str:
361 """Escape a string to protect certain characters."""
362 if set(s) & set(protectables):
363 if sys.platform == "win32":
364 return '"' + s + '"'
365 else:
366 return "".join(("\\" + c if c in protectables else c) for c in s)
367 else:
368 return s
369
370
371def expand_user(path: str) -> tuple[str, bool, str]:

Callers 1

file_matcherMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…