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

Function abbrev_cwd

IPython/utils/process.py:53–69  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers 2

init_term_titleMethod · 0.90
cdMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected