forked from VimPlug/jedi
Remove queue compatibility
This commit is contained in:
@@ -355,12 +355,6 @@ def utf8_repr(func):
|
|||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
if is_py3:
|
|
||||||
import queue
|
|
||||||
else:
|
|
||||||
import Queue as queue # noqa: F401
|
|
||||||
|
|
||||||
|
|
||||||
def pickle_load(file):
|
def pickle_load(file):
|
||||||
try:
|
try:
|
||||||
return pickle.load(file)
|
return pickle.load(file)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ goals:
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import queue
|
||||||
import subprocess
|
import subprocess
|
||||||
import socket
|
import socket
|
||||||
import errno
|
import errno
|
||||||
@@ -16,12 +17,8 @@ import traceback
|
|||||||
import weakref
|
import weakref
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
try:
|
|
||||||
from queue import Queue, Empty
|
|
||||||
except ImportError:
|
|
||||||
from Queue import Queue, Empty # python 2.7
|
|
||||||
|
|
||||||
from jedi._compatibility import queue, is_py3, force_unicode, \
|
from jedi._compatibility import is_py3, force_unicode, \
|
||||||
pickle_dump, pickle_load, GeneralizedPopen
|
pickle_dump, pickle_load, GeneralizedPopen
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi.cache import memoize_method
|
from jedi.cache import memoize_method
|
||||||
@@ -34,9 +31,9 @@ from jedi.api.exceptions import InternalError
|
|||||||
_MAIN_PATH = os.path.join(os.path.dirname(__file__), '__main__.py')
|
_MAIN_PATH = os.path.join(os.path.dirname(__file__), '__main__.py')
|
||||||
|
|
||||||
|
|
||||||
def _enqueue_output(out, queue):
|
def _enqueue_output(out, queue_):
|
||||||
for line in iter(out.readline, b''):
|
for line in iter(out.readline, b''):
|
||||||
queue.put(line)
|
queue_.put(line)
|
||||||
|
|
||||||
|
|
||||||
def _add_stderr_to_debug(stderr_queue):
|
def _add_stderr_to_debug(stderr_queue):
|
||||||
@@ -47,7 +44,7 @@ def _add_stderr_to_debug(stderr_queue):
|
|||||||
line = stderr_queue.get_nowait()
|
line = stderr_queue.get_nowait()
|
||||||
line = line.decode('utf-8', 'replace')
|
line = line.decode('utf-8', 'replace')
|
||||||
debug.warning('stderr output: %s' % line.rstrip('\n'))
|
debug.warning('stderr output: %s' % line.rstrip('\n'))
|
||||||
except Empty:
|
except queue.Empty:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
@@ -202,7 +199,7 @@ class CompiledSubprocess(object):
|
|||||||
bufsize=-1,
|
bufsize=-1,
|
||||||
env=self._env_vars
|
env=self._env_vars
|
||||||
)
|
)
|
||||||
self._stderr_queue = Queue()
|
self._stderr_queue = queue.Queue()
|
||||||
self._stderr_thread = t = Thread(
|
self._stderr_thread = t = Thread(
|
||||||
target=_enqueue_output,
|
target=_enqueue_output,
|
||||||
args=(process.stderr, self._stderr_queue)
|
args=(process.stderr, self._stderr_queue)
|
||||||
|
|||||||
Reference in New Issue
Block a user