代码拉取完成,页面将自动刷新
"""Pymode utils."""
import os.path
import sys
import threading
import warnings
from contextlib import contextmanager
from io import StringIO
import vim # noqa
DEBUG = int(vim.eval('g:pymode_debug'))
warnings.filterwarnings('ignore')
@contextmanager
def silence_stderr():
"""Redirect stderr."""
if DEBUG:
yield
else:
with threading.Lock():
stderr = sys.stderr
sys.stderr = StringIO()
yield
with threading.Lock():
sys.stderr = stderr
def patch_paths():
"""Patch python sys.path.
Load required modules from the plugin's sources.
"""
dir_script = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(dir_script, 'libs'))
if sys.platform == 'win32' or sys.platform == 'msys':
dir_submodule = os.path.abspath(os.path.join(dir_script,
'..', 'submodules'))
sub_modules = os.listdir(dir_submodule)
for module in sub_modules:
module_full_path = os.path.join(dir_submodule, module)
if module_full_path not in sys.path:
sys.path.insert(0, module_full_path)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。