def Executor(cls): try: return cls.executor except AttributeError: from ycm.unsafe_thread_pool_executor import UnsafeThreadPoolExecutor cls.executor = UnsafeThreadPoolExecutor(max_workers=30) return cls.executor
def Session(cls): try: return cls.session except AttributeError: from ycm.unsafe_thread_pool_executor import UnsafeThreadPoolExecutor from requests_futures.sessions import FuturesSession executor = UnsafeThreadPoolExecutor(max_workers=30) cls.session = FuturesSession(executor=executor) return cls.session
# along with YouCompleteMe. If not, see <http://www.gnu.org/licenses/>. import vim import requests import urlparse from base64 import b64decode, b64encode from retries import retries from requests_futures.sessions import FuturesSession from ycm.unsafe_thread_pool_executor import UnsafeThreadPoolExecutor from ycm import vimsupport from ycmd import utils from ycmd.utils import ToUtf8Json from ycmd.responses import ServerError, UnknownExtraConf _HEADERS = {'content-type': 'application/json'} _EXECUTOR = UnsafeThreadPoolExecutor(max_workers=30) # Setting this to None seems to screw up the Requests/urllib3 libs. _DEFAULT_TIMEOUT_SEC = 30 _HMAC_HEADER = 'x-ycm-hmac' class BaseRequest(object): def __init__(self): pass def Start(self): pass def Done(self): return True