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

Function abbrev_cwd

IPython/utils/process.py:60–76  ·  view source on GitHub ↗

Return abbreviated version of cwd, e.g. d:mydir

()

Source from the content-addressed store, hash-verified

58
59
60def abbrev_cwd():
61 """ Return abbreviated version of cwd, e.g. d:mydir """
62 cwd = os.getcwd().replace('\\','/')
63 drivepart = ''
64 tail = cwd
65 if sys.platform == 'win32':
66 if len(cwd) < 4:
67 return cwd
68 drivepart,tail = os.path.splitdrive(cwd)
69
70
71 parts = tail.split('/')
72 if len(parts) > 2:
73 tail = '/'.join(parts[-2:])
74
75 return (drivepart + (
76 cwd == '/' and '/' or tail))

Callers 2

init_term_titleMethod · 0.90
cdMethod · 0.90

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…