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

Method pushd

IPython/core/magics/osm.py:496–509  ·  view source on GitHub ↗

Place the current dir on stack and change directory. Usage:\\ %pushd ['dirname']

(self, parameter_s='')

Source from the content-addressed store, hash-verified

494
495 @line_magic
496 def pushd(self, parameter_s=''):
497 """Place the current dir on stack and change directory.
498
499 Usage:\\
500 %pushd ['dirname']
501 """
502
503 dir_s = self.shell.dir_stack
504 tgt = os.path.expanduser(parameter_s)
505 cwd = os.getcwd().replace(self.shell.home_dir,'~')
506 if tgt:
507 self.cd(parameter_s)
508 dir_s.insert(0,cwd)
509 return self.shell.magic('dirs')
510
511 @line_magic
512 def popd(self, parameter_s=''):

Callers

nothing calls this directly

Calls 2

cdMethod · 0.95
magicMethod · 0.45

Tested by

no test coverage detected