Skip to content

Commit

Permalink
Turned some functions into constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Valloric committed May 29, 2014
1 parent 1beec04 commit 18145cc
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions examples/example_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
MAX_SERVER_WAIT_TIME_SECONDS = 5
INCLUDE_YCMD_OUTPUT = True
CODE_COMPLETIONS_HANDLER = '/completions'
DIR_OF_THIS_SCRIPT = os.path.dirname( os.path.abspath( __file__ ) )
PATH_TO_YCMD = os.path.join( DIR_OF_THIS_SCRIPT, '..', 'ycmd' )


class ServerError( Exception ):
Expand Down Expand Up @@ -66,7 +68,7 @@ def StartYcmdAndReturnHandle( cls ):
options_file.flush()
server_port = GetUnusedLocalhostPort()
ycmd_args = [ sys.executable,
PathToYcmd(),
PATH_TO_YCMD,
'--port={0}'.format( server_port ),
'--options_file={0}'.format( options_file.name ),
'--idle_suicide_seconds={0}'.format(
Expand Down Expand Up @@ -228,20 +230,12 @@ def ToUtf8Json( data ):
encoding = 'utf-8' )


def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )


def PathToTestFile( filename ):
return os.path.join( DirectoryOfThisScript(), filename )


def PathToYcmd():
return os.path.join( DirectoryOfThisScript(), '..', 'ycmd' )
return os.path.join( DIR_OF_THIS_SCRIPT, filename )


def DefaultSettings():
default_options_path = os.path.join( DirectoryOfThisScript(),
default_options_path = os.path.join( DIR_OF_THIS_SCRIPT,
'..',
'ycmd',
'default_settings.json' )
Expand Down

0 comments on commit 18145cc

Please sign in to comment.