Adding new stuff
This commit is contained in:
parent
cb028acf05
commit
7b21428a6d
451 changed files with 6 additions and 1 deletions
39
vim-plugins/python-mode/pymode/utils.py
Normal file
39
vim-plugins/python-mode/pymode/utils.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
""" Pymode utils. """
|
||||
import os.path
|
||||
import sys
|
||||
import threading
|
||||
import warnings
|
||||
from contextlib import contextmanager
|
||||
|
||||
import vim # noqa
|
||||
from ._compat import StringIO
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'libs'))
|
||||
Loading…
Add table
Add a link
Reference in a new issue