Update flake8 config

This commit is contained in:
Ben Jackson 2016-03-06 17:13:43 +00:00
parent 285c452831
commit edd2bdbe0f
18 changed files with 71 additions and 81 deletions

View File

@ -127,7 +127,7 @@ def AdjustCandidateInsertionText( candidates ):
if isinstance( candidate, dict ): if isinstance( candidate, dict ):
new_candidate = candidate.copy() new_candidate = candidate.copy()
if not 'abbr' in new_candidate: if 'abbr' not in new_candidate:
new_candidate[ 'abbr' ] = new_candidate[ 'word' ] new_candidate[ 'abbr' ] = new_candidate[ 'word' ]
new_candidate[ 'word' ] = NewCandidateInsertionText( new_candidate[ 'word' ] = NewCandidateInsertionText(

View File

@ -44,6 +44,7 @@ _HMAC_HEADER = 'x-ycm-hmac'
class BaseRequest( object ): class BaseRequest( object ):
def __init__( self ): def __init__( self ):
pass pass
@ -212,6 +213,7 @@ def _BuildUri( handler ):
SERVER_HEALTHY = False SERVER_HEALTHY = False
def _CheckServerIsHealthyWithCache(): def _CheckServerIsHealthyWithCache():
global SERVER_HEALTHY global SERVER_HEALTHY

View File

@ -29,6 +29,7 @@ from ycm.client.base_request import ( BaseRequest, BuildRequestData,
HandleServerException ) HandleServerException )
from ycmd.responses import ServerError from ycmd.responses import ServerError
class CompleterAvailableRequest( BaseRequest ): class CompleterAvailableRequest( BaseRequest ):
def __init__( self, filetypes ): def __init__( self, filetypes ):
super( CompleterAvailableRequest, self ).__init__() super( CompleterAvailableRequest, self ).__init__()

View File

@ -29,6 +29,7 @@ vim_mock = MockVimModule()
from .. import completion_request from .. import completion_request
class ConvertCompletionResponseToVimDatas_test( object ): class ConvertCompletionResponseToVimDatas_test( object ):
""" This class tests the """ This class tests the
completion_request._ConvertCompletionResponseToVimDatas method """ completion_request._ConvertCompletionResponseToVimDatas method """

View File

@ -177,7 +177,8 @@ def _GetKeptAndNewSigns( placed_signs, buffer_number_to_line_to_diags,
next_sign_id ): next_sign_id ):
new_signs = [] new_signs = []
kept_signs = [] kept_signs = []
for buffer_number, line_to_diags in iteritems( buffer_number_to_line_to_diags ): for buffer_number, line_to_diags in iteritems(
buffer_number_to_line_to_diags ):
if not vimsupport.BufferIsVisible( buffer_number ): if not vimsupport.BufferIsVisible( buffer_number ):
continue continue
@ -253,8 +254,9 @@ def _NormalizeDiagnostic( diag ):
return diag return diag
class _DiagSignPlacement( namedtuple( "_DiagSignPlacement", class _DiagSignPlacement(
[ 'id', 'line', 'buffer', 'is_error' ] ) ): namedtuple( "_DiagSignPlacement",
[ 'id', 'line', 'buffer', 'is_error' ] ) ):
# We want two signs that have different ids but the same location to compare # We want two signs that have different ids but the same location to compare
# equal. ID doesn't matter. # equal. ID doesn't matter.
def __eq__( self, other ): def __eq__( self, other ):

View File

@ -33,6 +33,7 @@ OMNIFUNC_RETURNED_BAD_VALUE = 'Omnifunc returned bad value to YCM!'
OMNIFUNC_NOT_LIST = ( 'Omnifunc did not return a list or a dict with a "words" ' OMNIFUNC_NOT_LIST = ( 'Omnifunc did not return a list or a dict with a "words" '
' list when expected.' ) ' list when expected.' )
class OmniCompleter( Completer ): class OmniCompleter( Completer ):
def __init__( self, user_options ): def __init__( self, user_options ):
super( OmniCompleter, self ).__init__( user_options ) super( OmniCompleter, self ).__init__( user_options )

View File

@ -222,5 +222,3 @@ def _ExtractKeywordsFromGroup( group ):
word = word[ :-1 ] word = word[ :-1 ]
keywords.append( word ) keywords.append( word )
return keywords return keywords

View File

@ -1 +0,0 @@

View File

@ -107,8 +107,7 @@ def AdjustCandidateInsertionText_MultipleStrings_test():
eq_( [ { 'abbr': 'foobar', 'word': 'foo' }, eq_( [ { 'abbr': 'foobar', 'word': 'foo' },
{ 'abbr': 'zobar', 'word': 'zo' }, { 'abbr': 'zobar', 'word': 'zo' },
{ 'abbr': 'qbar', 'word': 'q' }, { 'abbr': 'qbar', 'word': 'q' },
{ 'abbr': 'bar', 'word': '' }, { 'abbr': 'bar', 'word': '' }, ],
],
base.AdjustCandidateInsertionText( [ 'foobar', base.AdjustCandidateInsertionText( [ 'foobar',
'zobar', 'zobar',
'qbar', 'qbar',
@ -269,4 +268,3 @@ def CurrentIdentifierFinished_WhitespaceOnly_test():
with MockCurrentColumnAndLineContents( 3, '\t\t\t\t' ): with MockCurrentColumnAndLineContents( 3, '\t\t\t\t' ):
ok_( base.CurrentIdentifierFinished() ) ok_( base.CurrentIdentifierFinished() )

View File

@ -417,4 +417,3 @@ class EventNotification_test( object ):
] ) ] )
eq_( self.server_state.GetErrorCount(), 0 ) eq_( self.server_state.GetErrorCount(), 0 )
eq_( self.server_state.GetWarningCount(), 0 ) eq_( self.server_state.GetWarningCount(), 0 )

View File

@ -37,7 +37,7 @@ def BuildOmnicompletionRequest( results ):
request = OmniCompletionRequest( omni_completer, None ) request = OmniCompletionRequest( omni_completer, None )
request.Start() request.Start()
return request; return request
def Done_AlwaysTrue_test(): def Done_AlwaysTrue_test():

View File

@ -199,18 +199,19 @@ class PostComplete_test():
@patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ) @patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False )
@patch( 'ycm.vimsupport.TextBeforeCursor', return_value = " Te" ) @patch( 'ycm.vimsupport.TextBeforeCursor', return_value = " Te" )
def HasCompletionsThatCouldBeCompletedWithMoreText_OldVim_MatchIsReturned_test( def HasCompletionsThatCouldBeCompletedWithMoreText_OldVim_MatchIsReturned_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( "Test" ) ] completions = [ BuildCompletion( "Test" ) ]
result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText( completions ) result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText(
completions )
eq_( result, True ) eq_( result, True )
@patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ) @patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False )
@patch( 'ycm.vimsupport.TextBeforeCursor', return_value = "X" ) @patch( 'ycm.vimsupport.TextBeforeCursor', return_value = "X" )
def HasCompletionsThatCouldBeCompletedWithMoreText_OldVim_ShortTextDoesntRaise_test( def HasCompletionsThatCouldBeCompletedWithMoreText_OldVim_ShortTextDoesntRaise_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( "AAA" ) ] completions = [ BuildCompletion( "AAA" ) ]
@ -219,22 +220,24 @@ class PostComplete_test():
@patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ) @patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False )
@patch( 'ycm.vimsupport.TextBeforeCursor', return_value = "Test" ) @patch( 'ycm.vimsupport.TextBeforeCursor', return_value = "Test" )
def HasCompletionsThatCouldBeCompletedWithMoreText_OldVim_ExactMatchIsntReturned_test( def HasCompletionsThatCouldBeCompletedWithMoreText_OldVim_ExactMatchIsntReturned_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( "Test" ) ] completions = [ BuildCompletion( "Test" ) ]
result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText( completions ) result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText(
completions )
eq_( result, False ) eq_( result, False )
@patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False ) @patch( 'ycm.vimsupport.VimVersionAtLeast', return_value = False )
@patch( 'ycm.vimsupport.TextBeforeCursor', return_value = " Quote" ) @patch( 'ycm.vimsupport.TextBeforeCursor', return_value = " Quote" )
def HasCompletionsThatCouldBeCompletedWithMoreText_OldVim_NonMatchIsntReturned_test( def HasCompletionsThatCouldBeCompletedWithMoreText_OldVim_NonMatchIsntReturned_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( "A" ) ] completions = [ BuildCompletion( "A" ) ]
result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText( completions ) result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText(
completions )
eq_( result, False ) eq_( result, False )
@ -243,11 +246,12 @@ class PostComplete_test():
@patch( 'ycm.vimsupport.GetVariableValue', @patch( 'ycm.vimsupport.GetVariableValue',
GetVariableValue_CompleteItemIs( "Te") ) GetVariableValue_CompleteItemIs( "Te") )
@patch( 'ycm.vimsupport.TextBeforeCursor', return_value = " Quote" ) @patch( 'ycm.vimsupport.TextBeforeCursor', return_value = " Quote" )
def HasCompletionsThatCouldBeCompletedWithMoreText_NewVim_MatchIsReturned_test( def HasCompletionsThatCouldBeCompletedWithMoreText_NewVim_MatchIsReturned_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( "Test" ) ] completions = [ BuildCompletion( "Test" ) ]
result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText( completions ) result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText(
completions )
eq_( result, True ) eq_( result, True )
@ -256,7 +260,7 @@ class PostComplete_test():
@patch( 'ycm.vimsupport.GetVariableValue', @patch( 'ycm.vimsupport.GetVariableValue',
GetVariableValue_CompleteItemIs( "X") ) GetVariableValue_CompleteItemIs( "X") )
@patch( 'ycm.vimsupport.TextBeforeCursor', return_value = " Quote" ) @patch( 'ycm.vimsupport.TextBeforeCursor', return_value = " Quote" )
def HasCompletionsThatCouldBeCompletedWithMoreText_NewVim_ShortTextDoesntRaise_test( def HasCompletionsThatCouldBeCompletedWithMoreText_NewVim_ShortTextDoesntRaise_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( "AAA" ) ] completions = [ BuildCompletion( "AAA" ) ]
@ -267,11 +271,12 @@ class PostComplete_test():
@patch( 'ycm.vimsupport.GetVariableValue', @patch( 'ycm.vimsupport.GetVariableValue',
GetVariableValue_CompleteItemIs( "Test" ) ) GetVariableValue_CompleteItemIs( "Test" ) )
@patch( 'ycm.vimsupport.TextBeforeCursor', return_value = ' Quote' ) @patch( 'ycm.vimsupport.TextBeforeCursor', return_value = ' Quote' )
def HasCompletionsThatCouldBeCompletedWithMoreText_NewVim_ExactMatchIsntReturned_test( def HasCompletionsThatCouldBeCompletedWithMoreText_NewVim_ExactMatchIsntReturned_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( "Test" ) ] completions = [ BuildCompletion( "Test" ) ]
result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText( completions ) result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText(
completions )
eq_( result, False ) eq_( result, False )
@ -280,11 +285,12 @@ class PostComplete_test():
@patch( 'ycm.vimsupport.GetVariableValue', @patch( 'ycm.vimsupport.GetVariableValue',
GetVariableValue_CompleteItemIs( " Quote" ) ) GetVariableValue_CompleteItemIs( " Quote" ) )
@patch( 'ycm.vimsupport.TextBeforeCursor', return_value = ' Quote' ) @patch( 'ycm.vimsupport.TextBeforeCursor', return_value = ' Quote' )
def HasCompletionsThatCouldBeCompletedWithMoreText_NewVim_NonMatchIsntReturned_test( def HasCompletionsThatCouldBeCompletedWithMoreText_NewVim_NonMatchIsntReturned_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( "A" ) ] completions = [ BuildCompletion( "A" ) ]
result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText( completions ) result = self.ycm._HasCompletionsThatCouldBeCompletedWithMoreText(
completions )
eq_( result, False ) eq_( result, False )
@ -309,7 +315,7 @@ class PostComplete_test():
eq_( [], self.ycm.GetCompletionsUserMayHaveCompleted() ) eq_( [], self.ycm.GetCompletionsUserMayHaveCompleted() )
def GetCompletionsUserMayHaveCompleted_ReturnEmptyIfPendingMatches_NewVim_test( def GetCompletionsUserMayHaveCompleted_ReturnEmptyIfPendingMatches_NewVim_test( # noqa
self ): self ):
completions = [ BuildCompletion( None ) ] completions = [ BuildCompletion( None ) ]
with self._SetupForCsharpCompletionDone( completions ): with self._SetupForCsharpCompletionDone( completions ):
@ -319,7 +325,7 @@ class PostComplete_test():
eq_( [], self.ycm.GetCompletionsUserMayHaveCompleted() ) eq_( [], self.ycm.GetCompletionsUserMayHaveCompleted() )
def GetCompletionsUserMayHaveCompleted_ReturnEmptyIfPendingMatches_OldVim_test( def GetCompletionsUserMayHaveCompleted_ReturnEmptyIfPendingMatches_OldVim_test( # noqa
self, *args ): self, *args ):
completions = [ BuildCompletion( None ) ] completions = [ BuildCompletion( None ) ]
with self._SetupForCsharpCompletionDone( completions ): with self._SetupForCsharpCompletionDone( completions ):
@ -340,7 +346,7 @@ class PostComplete_test():
eq_( completions, self.ycm.GetCompletionsUserMayHaveCompleted() ) eq_( completions, self.ycm.GetCompletionsUserMayHaveCompleted() )
def GetCompletionsUserMayHaveCompleted_ReturnMatchIfExactMatchesEvenIfPartial_NewVim_test( def GetCompletionsUserMayHaveCompleted_ReturnMatchIfExactMatchesEvenIfPartial_NewVim_test( # noqa
self, *args ): self, *args ):
info = [ "NS", "Test", "Abbr", "Menu", "Info", "Kind" ] info = [ "NS", "Test", "Abbr", "Menu", "Info", "Kind" ]
completions = [ BuildCompletion( *info ), completions = [ BuildCompletion( *info ),
@ -353,7 +359,7 @@ class PostComplete_test():
self.ycm.GetCompletionsUserMayHaveCompleted() ) self.ycm.GetCompletionsUserMayHaveCompleted() )
def GetCompletionsUserMayHaveCompleted_DontReturnMatchIfNontExactMatchesAndPartial_NewVim_test( def GetCompletionsUserMayHaveCompleted_DontReturnMatchIfNontExactMatchesAndPartial_NewVim_test( # noqa
self ): self ):
info = [ "NS", "Test", "Abbr", "Menu", "Info", "Kind" ] info = [ "NS", "Test", "Abbr", "Menu", "Info", "Kind" ]
completions = [ BuildCompletion( insertion_text = info[ 0 ] ), completions = [ BuildCompletion( insertion_text = info[ 0 ] ),

View File

@ -146,9 +146,7 @@ def KeywordsFromSyntaxListOutput_Basic_test():
syntax_parse._KeywordsFromSyntaxListOutput( """ syntax_parse._KeywordsFromSyntaxListOutput( """
foogroup xxx foo bar foogroup xxx foo bar
zoo goo zoo goo
links to Statement""" links to Statement""" ) )
)
)
def KeywordsFromSyntaxListOutput_Function_test(): def KeywordsFromSyntaxListOutput_Function_test():
@ -156,16 +154,14 @@ def KeywordsFromSyntaxListOutput_Function_test():
syntax_parse._KeywordsFromSyntaxListOutput( """ syntax_parse._KeywordsFromSyntaxListOutput( """
foogroup xxx foo bar foogroup xxx foo bar
zoo goo zoo goo
links to Function""" links to Function""" ) )
)
)
def KeywordsFromSyntaxListOutput_ContainedArgAllowed_test(): def KeywordsFromSyntaxListOutput_ContainedArgAllowed_test():
assert_that( syntax_parse._KeywordsFromSyntaxListOutput( """ assert_that( syntax_parse._KeywordsFromSyntaxListOutput( """
phpFunctions xxx contained gzclose yaz_syntax html_entity_decode fbsql_read_blob png2wbmp mssql_init cpdf_set_title gztell fbsql_insert_id empty cpdf_restore mysql_field_type closelog swftext ldap_search curl_errno gmp_div_r mssql_data_seek getmyinode printer_draw_pie mcve_initconn ncurses_getmaxyx defined phpFunctions xxx contained gzclose yaz_syntax html_entity_decode fbsql_read_blob png2wbmp mssql_init cpdf_set_title gztell fbsql_insert_id empty cpdf_restore mysql_field_type closelog swftext ldap_search curl_errno gmp_div_r mssql_data_seek getmyinode printer_draw_pie mcve_initconn ncurses_getmaxyx defined
contained replace_child has_attributes specified insertdocument assign node_name hwstat addshape get_attribute_node html_dump_mem userlist contained replace_child has_attributes specified insertdocument assign node_name hwstat addshape get_attribute_node html_dump_mem userlist
links to Function""" ), links to Function""" ), # noqa
has_items( 'gzclose', 'userlist', 'ldap_search' ) ) has_items( 'gzclose', 'userlist', 'ldap_search' ) )
@ -177,9 +173,7 @@ foogroup xxx foo bar
zoo goo zoo goo
links to Statement links to Statement
Spell cluster=NONE Spell cluster=NONE
NoSpell cluster=NONE""" NoSpell cluster=NONE""" ) )
)
)
def KeywordsFromSyntaxListOutput_MultipleStatementGroups_test(): def KeywordsFromSyntaxListOutput_MultipleStatementGroups_test():
@ -188,9 +182,7 @@ def KeywordsFromSyntaxListOutput_MultipleStatementGroups_test():
foogroup xxx foo bar foogroup xxx foo bar
links to Statement links to Statement
bargroup xxx zoo goo bargroup xxx zoo goo
links to Statement""" links to Statement""" ) )
)
)
def KeywordsFromSyntaxListOutput_StatementAndTypeGroups_test(): def KeywordsFromSyntaxListOutput_StatementAndTypeGroups_test():
@ -199,9 +191,7 @@ def KeywordsFromSyntaxListOutput_StatementAndTypeGroups_test():
foogroup xxx foo bar foogroup xxx foo bar
links to Statement links to Statement
bargroup xxx zoo goo bargroup xxx zoo goo
links to Type""" links to Type""" ) )
)
)
def KeywordsFromSyntaxListOutput_StatementHierarchy_test(): def KeywordsFromSyntaxListOutput_StatementHierarchy_test():
@ -212,9 +202,7 @@ baa xxx foo bar
Foo xxx zoo goo Foo xxx zoo goo
links to Bar links to Bar
Bar xxx qux moo Bar xxx qux moo
links to Statement""" links to Statement""" ) )
)
)
def KeywordsFromSyntaxListOutput_TypeHierarchy_test(): def KeywordsFromSyntaxListOutput_TypeHierarchy_test():
@ -225,9 +213,7 @@ baa xxx foo bar
Foo xxx zoo goo Foo xxx zoo goo
links to Bar links to Bar
Bar xxx qux moo Bar xxx qux moo
links to Type""" links to Type""" ) )
)
)
def KeywordsFromSyntaxListOutput_StatementAndTypeHierarchy_test(): def KeywordsFromSyntaxListOutput_StatementAndTypeHierarchy_test():
@ -244,9 +230,7 @@ sBaa xxx na bar
sFoo xxx zoo nb sFoo xxx zoo nb
links to sBar links to sBar
sBar xxx qux nc sBar xxx qux nc
links to Statement""" links to Statement""" ) )
)
)
def SyntaxGroupsFromOutput_Basic_test(): def SyntaxGroupsFromOutput_Basic_test():
@ -263,8 +247,7 @@ def ExtractKeywordsFromGroup_Basic_test():
syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [ syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [
'foo bar', 'foo bar',
'zoo goo', 'zoo goo',
] ) ) ] ) ) )
)
def ExtractKeywordsFromGroup_Commas_test(): def ExtractKeywordsFromGroup_Commas_test():
@ -272,8 +255,7 @@ def ExtractKeywordsFromGroup_Commas_test():
syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [ syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [
'foo, bar,', 'foo, bar,',
'zoo goo', 'zoo goo',
] ) ) ] ) ) )
)
def ExtractKeywordsFromGroup_WithLinksTo_test(): def ExtractKeywordsFromGroup_WithLinksTo_test():
@ -282,8 +264,7 @@ def ExtractKeywordsFromGroup_WithLinksTo_test():
'foo bar', 'foo bar',
'zoo goo', 'zoo goo',
'links to Statement' 'links to Statement'
] ) ) ] ) ) )
)
def ExtractKeywordsFromGroup_KeywordStarts_test(): def ExtractKeywordsFromGroup_KeywordStarts_test():
@ -292,8 +273,7 @@ def ExtractKeywordsFromGroup_KeywordStarts_test():
'foo bar', 'foo bar',
'transparent boo baa', 'transparent boo baa',
'zoo goo', 'zoo goo',
] ) ) ] ) ) )
)
def ExtractKeywordsFromGroup_KeywordMiddle_test(): def ExtractKeywordsFromGroup_KeywordMiddle_test():
@ -301,8 +281,7 @@ def ExtractKeywordsFromGroup_KeywordMiddle_test():
syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [ syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [
'foo oneline bar', 'foo oneline bar',
'zoo goo', 'zoo goo',
] ) ) ] ) ) )
)
def ExtractKeywordsFromGroup_KeywordAssign_test(): def ExtractKeywordsFromGroup_KeywordAssign_test():
@ -310,8 +289,7 @@ def ExtractKeywordsFromGroup_KeywordAssign_test():
syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [ syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [
'foo end=zoo((^^//)) bar', 'foo end=zoo((^^//)) bar',
'zoo goo', 'zoo goo',
] ) ) ] ) ) )
)
def ExtractKeywordsFromGroup_KeywordAssignAndMiddle_test(): def ExtractKeywordsFromGroup_KeywordAssignAndMiddle_test():
@ -319,8 +297,7 @@ def ExtractKeywordsFromGroup_KeywordAssignAndMiddle_test():
syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [ syntax_parse._ExtractKeywordsFromGroup( syntax_parse.SyntaxGroup('', [
'foo end=zoo((^^//)) transparent bar', 'foo end=zoo((^^//)) transparent bar',
'zoo goo', 'zoo goo',
] ) ) ] ) ) )
)
def ExtractKeywordsFromGroup_ContainedSyntaxArgAllowed_test(): def ExtractKeywordsFromGroup_ContainedSyntaxArgAllowed_test():
@ -329,5 +306,4 @@ def ExtractKeywordsFromGroup_ContainedSyntaxArgAllowed_test():
'contained foo zoq', 'contained foo zoq',
'contained bar goo', 'contained bar goo',
'far', 'far',
] ) ) ] ) ) )
)

View File

@ -47,6 +47,7 @@ class _WorkItem(object):
else: else:
self.future.set_result(result) self.future.set_result(result)
def _worker(executor_reference, work_queue): def _worker(executor_reference, work_queue):
try: try:
while True: while True:
@ -66,6 +67,7 @@ def _worker(executor_reference, work_queue):
except BaseException: except BaseException:
_base.LOGGER.critical('Exception in worker', exc_info=True) _base.LOGGER.critical('Exception in worker', exc_info=True)
class UnsafeThreadPoolExecutor(_base.Executor): class UnsafeThreadPoolExecutor(_base.Executor):
def __init__(self, max_workers): def __init__(self, max_workers):
"""Initializes a new ThreadPoolExecutor instance. """Initializes a new ThreadPoolExecutor instance.
@ -116,4 +118,3 @@ class UnsafeThreadPoolExecutor(_base.Executor):
for t in self._threads: for t in self._threads:
t.join() t.join()
shutdown.__doc__ = _base.Executor.shutdown.__doc__ shutdown.__doc__ = _base.Executor.shutdown.__doc__

View File

@ -959,4 +959,3 @@ def _SetUpLoadedBuffer( command, filename, fix, position, watch ):
if position == 'end': if position == 'end':
vim.command( 'silent! normal G zz' ) vim.command( 'silent! normal G zz' )

View File

@ -55,6 +55,7 @@ try:
except ImportError: except ImportError:
USE_ULTISNIPS_DATA = False USE_ULTISNIPS_DATA = False
def PatchNoProxy(): def PatchNoProxy():
current_value = os.environ.get('no_proxy', '') current_value = os.environ.get('no_proxy', '')
additions = '127.0.0.1,localhost' additions = '127.0.0.1,localhost'
@ -372,7 +373,10 @@ class YouCompleteMe( object ):
item = ConvertCompletionDataToVimData( completion ) item = ConvertCompletionDataToVimData( completion )
match_keys = ( [ "word", "abbr", "menu", "info" ] if full_match_only match_keys = ( [ "word", "abbr", "menu", "info" ] if full_match_only
else [ 'word' ] ) else [ 'word' ] )
matcher = lambda key: completed.get( key, "" ) == item.get( key, "" )
def matcher( key ):
return completed.get( key, "" ) == item.get( key, "" )
if all( [ matcher( i ) for i in match_keys ] ): if all( [ matcher( i ) for i in match_keys ] ):
yield completion yield completion
@ -443,7 +447,7 @@ class YouCompleteMe( object ):
if len( namespaces ) > 1: if len( namespaces ) > 1:
choices = [ "{0} {1}".format( i + 1, n ) choices = [ "{0} {1}".format( i + 1, n )
for i,n in enumerate( namespaces ) ] for i, n in enumerate( namespaces ) ]
choice = vimsupport.PresentDialog( "Insert which namespace:", choices ) choice = vimsupport.PresentDialog( "Insert which namespace:", choices )
if choice < 0: if choice < 0:
return return
@ -664,6 +668,6 @@ def _AddUltiSnipsDataIfNeeded( extra_data ):
# UltiSnips_Manager._snips() returns a class instance where: # UltiSnips_Manager._snips() returns a class instance where:
# class.trigger - name of snippet trigger word ( e.g. defn or testcase ) # class.trigger - name of snippet trigger word ( e.g. defn or testcase )
# class.description - description of the snippet # class.description - description of the snippet
extra_data[ 'ultisnips_snippets' ] = [ { 'trigger': x.trigger, extra_data[ 'ultisnips_snippets' ] = [
'description': x.description { 'trigger': x.trigger, 'description': x.description } for x in rawsnips
} for x in rawsnips ] ]

View File

@ -34,12 +34,11 @@ sys.path.insert( 1, p.abspath( p.join( DIR_OF_YCMD_THIRD_PARTY,
import argparse import argparse
def RunFlake8(): def RunFlake8():
print( 'Running flake8' ) print( 'Running flake8' )
subprocess.check_call( [ subprocess.check_call( [
'flake8', 'flake8',
'--select=F,C9',
'--max-complexity=10',
p.join( DIR_OF_THIS_SCRIPT, 'python' ) p.join( DIR_OF_THIS_SCRIPT, 'python' )
] ) ] )

4
tox.ini Normal file
View File

@ -0,0 +1,4 @@
[flake8]
ignore = E111,E114,E121,E125,E126,E127,E128,E129,E131,E133,E201,E202,E203,E211,E221,E222,E241,E251,E261,E303,E402,W503
max-complexity = 10
max-line-length = 80