<reponame>ericsubach/stow-lite
import os


class cd:
   '''
   Context manager for changing the current working directory.

   Author: <NAME>
   From: http://stackoverflow.com/questions/431684/how-do-i-cd-in-python
   '''
   def __init__(self, newPath):
      self.newPath = newPath

   def __enter__(self):
      self.savedPath = os.getcwd()
      os.chdir(self.newPath)

   def __exit__(self, etype, value, traceback):
      os.chdir(self.savedPath)

import os


class cd:
   '''
   Context manager for changing the current working directory.

   Author: <NAME>
   From: http://stackoverflow.com/questions/431684/how-do-i-cd-in-python
   '''
   def __init__(self, newPath):
      self.newPath = newPath

   def __enter__(self):
      self.savedPath = os.getcwd()
      os.chdir(self.newPath)

   def __exit__(self, etype, value, traceback):
      os.chdir(self.savedPath)
Context manager for changing the current working directory.     Author: <NAME>    From: http://stackoverflow.com/questions/431684/how-do-i-cd-in-python