提交 72ab665b 编写于 作者: L lyuwenyu

update comments

上级 abf5bce4
...@@ -20,6 +20,15 @@ import sys ...@@ -20,6 +20,15 @@ import sys
class _SysPathG(object): class _SysPathG(object):
"""
_SysPathG used to add/clean path for sys.path. Making sure minimal pkgs dependents by skiping parent dirs.
__enter__
add path into sys.path
__exit__
clean user's sys.path to avoid unexpect behaviors
"""
def __init__(self, path): def __init__(self, path):
self.path = path self.path = path
...@@ -28,7 +37,8 @@ class _SysPathG(object): ...@@ -28,7 +37,8 @@ class _SysPathG(object):
def __exit__(self, type, value, traceback): def __exit__(self, type, value, traceback):
_p = sys.path.pop(0) _p = sys.path.pop(0)
assert _p == self.path, 'make sure pop {} correctly.'.format(self.path) assert _p == self.path, 'Make sure sys.path cleaning {} correctly.'.format(
self.path)
with _SysPathG( with _SysPathG(
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册