Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

__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