Reverse of :func:`os.path.expanduser`
(path: str)
| 67 | |
| 68 | |
| 69 | def 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 | |
| 76 | def get_py_filename(name): |
| 77 | """Return a valid python filename in the current directory. |