From 7a4f5a4a5308688229bdf5f8517d590ca76678ab Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Fri, 7 Mar 2014 11:28:53 -0800 Subject: [PATCH] Minor var naming changes --- python/ycm/client/base_request.py | 26 +++++++++++++------------- python/ycm/youcompleteme.py | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/python/ycm/client/base_request.py b/python/ycm/client/base_request.py index 94ac8c0b..73850034 100644 --- a/python/ycm/client/base_request.py +++ b/python/ycm/client/base_request.py @@ -27,10 +27,10 @@ from ycm.unsafe_thread_pool_executor import UnsafeThreadPoolExecutor from ycm import vimsupport from ycm.server.responses import ServerError, UnknownExtraConf -HEADERS = {'content-type': 'application/json'} -EXECUTOR = UnsafeThreadPoolExecutor( max_workers = 30 ) +_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 +_DEFAULT_TIMEOUT_SEC = 30 class BaseRequest( object ): def __init__( self ): @@ -52,7 +52,7 @@ class BaseRequest( object ): # |timeout| is num seconds to tolerate no response from server before giving # up; see Requests docs for details (we just pass the param along). @staticmethod - def GetDataFromHandler( handler, timeout = DEFAULT_TIMEOUT_SEC ): + def GetDataFromHandler( handler, timeout = _DEFAULT_TIMEOUT_SEC ): return JsonFromFuture( BaseRequest._TalkToHandlerAsync( '', handler, 'GET', @@ -63,7 +63,7 @@ class BaseRequest( object ): # |timeout| is num seconds to tolerate no response from server before giving # up; see Requests docs for details (we just pass the param along). @staticmethod - def PostDataToHandler( data, handler, timeout = DEFAULT_TIMEOUT_SEC ): + def PostDataToHandler( data, handler, timeout = _DEFAULT_TIMEOUT_SEC ): return JsonFromFuture( BaseRequest.PostDataToHandlerAsync( data, handler, timeout ) ) @@ -73,7 +73,7 @@ class BaseRequest( object ): # |timeout| is num seconds to tolerate no response from server before giving # up; see Requests docs for details (we just pass the param along). @staticmethod - def PostDataToHandlerAsync( data, handler, timeout = DEFAULT_TIMEOUT_SEC ): + def PostDataToHandlerAsync( data, handler, timeout = _DEFAULT_TIMEOUT_SEC ): return BaseRequest._TalkToHandlerAsync( data, handler, 'POST', timeout ) @@ -85,16 +85,16 @@ class BaseRequest( object ): def _TalkToHandlerAsync( data, handler, method, - timeout = DEFAULT_TIMEOUT_SEC ): + timeout = _DEFAULT_TIMEOUT_SEC ): def SendRequest( data, handler, method, timeout ): if method == 'POST': return BaseRequest.session.post( _BuildUri( handler ), data = json.dumps( data ), - headers = HEADERS, + headers = _HEADERS, timeout = timeout ) if method == 'GET': return BaseRequest.session.get( _BuildUri( handler ), - headers = HEADERS, + headers = _HEADERS, timeout = timeout ) @retries( 5, delay = 0.5, backoff = 1.5 ) @@ -102,18 +102,18 @@ class BaseRequest( object ): if method == 'POST': return requests.post( _BuildUri( handler ), data = json.dumps( data ), - headers = HEADERS ) + headers = _HEADERS ) if method == 'GET': return requests.get( _BuildUri( handler ), - headers = HEADERS ) + headers = _HEADERS ) if not _CheckServerIsHealthyWithCache(): - return EXECUTOR.submit( DelayedSendRequest, data, handler, method ) + return _EXECUTOR.submit( DelayedSendRequest, data, handler, method ) return SendRequest( data, handler, method, timeout ) - session = FuturesSession( executor = EXECUTOR ) + session = FuturesSession( executor = _EXECUTOR ) server_location = 'http://localhost:6666' diff --git a/python/ycm/youcompleteme.py b/python/ycm/youcompleteme.py index c6e11be7..448236eb 100644 --- a/python/ycm/youcompleteme.py +++ b/python/ycm/youcompleteme.py @@ -115,7 +115,6 @@ class YouCompleteMe( object ): args.append('--keep_logfiles') self._server_popen = utils.SafePopen( args, stdout = PIPE, stderr = PIPE) - BaseRequest.server_location = 'http://localhost:' + str( server_port ) self._NotifyUserIfServerCrashed() @@ -151,6 +150,7 @@ class YouCompleteMe( object ): self._server_popen.terminate() utils.RemoveIfExists( self._temp_options_filename ) + def RestartServer( self ): vimsupport.PostVimMessage( 'Restarting ycmd server...' ) self._user_notified_about_crash = False