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

Method pushd

IPython/core/magics/osm.py:495–508  ·  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

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

Callers

nothing calls this directly

Calls 3

cdMethod · 0.95
replaceMethod · 0.80
run_line_magicMethod · 0.80

Tested by

no test coverage detected