-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get_classes now allows top-level apps.
Fixes #614
- Loading branch information
1 parent
602eb61
commit cdd8af3
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import sys | ||
|
||
|
||
class temporary_python_path(object): | ||
""" | ||
Acts as a context manager to temporarily append a list of paths to sys.path | ||
""" | ||
|
||
def __init__(self, paths): | ||
self.paths = paths | ||
|
||
def __enter__(self): | ||
self.original_paths = sys.path[:] | ||
sys.path = self.paths + self.original_paths | ||
|
||
def __exit__(self, exc_type, exc_value, traceback): | ||
sys.path = self.original_paths |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters