選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

__init__.py 425B

1234567891011121314151617
  1. import sys
  2. class temporary_python_path(object):
  3. """
  4. Acts as a context manager to temporarily prepend a list of paths to
  5. sys.path
  6. """
  7. def __init__(self, paths):
  8. self.paths = paths
  9. def __enter__(self):
  10. self.original_paths = sys.path[:]
  11. sys.path = self.paths + self.original_paths
  12. def __exit__(self, exc_type, exc_value, traceback):
  13. sys.path = self.original_paths