File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ Contributors:
8
8
* Alvin Francis (alvinfrancis);
9
9
* Anler Hp (ikame);
10
10
* Anton Parkhomenko (chuwy);
11
+ * Ashley Hewson (ashleyh);
11
12
* Benjamin Ruston (bruston);
12
13
* Boris Filippov (frenzykryger);
13
14
* David Vogt (winged);
Original file line number Diff line number Diff line change 1
1
""" Pylama integration. """
2
2
3
3
import vim # noqa
4
- from .utils import pymode_message
4
+ from .utils import pymode_message , silence_stderr
5
5
6
6
import os .path
7
7
@@ -31,7 +31,8 @@ def code_check():
31
31
vim .command ('return' )
32
32
return False
33
33
34
- errors = check_path (path , options = options )
34
+ with silence_stderr ():
35
+ errors = check_path (path , options = options )
35
36
sort_rules = vim .eval ('g:pymode_lint_sort' )
36
37
37
38
def sort (e ):
Original file line number Diff line number Diff line change 5
5
6
6
import vim # noqa
7
7
8
+ try :
9
+ from StringIO import StringIO
10
+ except ImportError :
11
+ from io import StringIO
12
+
13
+ from contextlib import contextmanager
14
+ import threading
15
+
8
16
9
17
PY2 = sys .version_info [0 ] == 2
10
18
@@ -123,3 +131,18 @@ def wrapper(*args, **kwargs):
123
131
pymode_error (e )
124
132
return None
125
133
return wrapper
134
+
135
+
136
+ @contextmanager
137
+ def silence_stderr ():
138
+
139
+ """ Redirect stderr. """
140
+
141
+ with threading .Lock ():
142
+ stderr = sys .stderr
143
+ sys .stderr = StringIO ()
144
+
145
+ yield
146
+
147
+ with threading .Lock ():
148
+ sys .stderr = stderr
You can’t perform that action at this time.
0 commit comments