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

Function compress_user

IPython/utils/path.py:69–74  ·  view source on GitHub ↗

Reverse of :func:`os.path.expanduser`

(path: str)

Source from the content-addressed store, hash-verified

67
68
69def compress_user(path: str) -> str:
70 """Reverse of :func:`os.path.expanduser`"""
71 home = os.path.expanduser("~")
72 if path.startswith(home):
73 path = "~" + path[len(home):]
74 return path
75
76def get_py_filename(name):
77 """Return a valid python filename in the current directory.

Callers 2

infoMethod · 0.90
test_infoFunction · 0.90

Calls

no outgoing calls

Tested by 1

test_infoFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…