Fix issues reported by flake8-comprehensions

This commit is contained in:
micbou 2018-05-03 13:11:19 +02:00
parent 36f716db43
commit 29231e839d
No known key found for this signature in database
GPG Key ID: C7E8FD1F3BDA1E05
6 changed files with 23 additions and 24 deletions

View File

@ -1,12 +1,13 @@
flake8 >= 3.0.0 flake8 >= 3.0.0
mock >= 1.0.1 flake8-comprehensions >= 1.4.1
nose >= 1.3.7 mock >= 1.0.1
PyHamcrest >= 1.8.0 nose >= 1.3.7
PyHamcrest >= 1.8.0
# This needs to be kept in sync with submodule checkout in # This needs to be kept in sync with submodule checkout in
# third_party/ycmd/third_party # third_party/ycmd/third_party
future == 0.15.2 future == 0.15.2
# coverage.py 4.4 removed the path from the filename attribute in its reports. # coverage.py 4.4 removed the path from the filename attribute in its reports.
# This leads to incorrect coverage from codecov as it relies on this attribute # This leads to incorrect coverage from codecov as it relies on this attribute
# to find the source file. # to find the source file.
coverage < 4.4 coverage < 4.4
codecov >= 2.0.5 codecov >= 2.0.5

View File

@ -27,9 +27,8 @@ from ycm.client.event_notification import EventNotification
from ycm.diagnostic_interface import DiagnosticInterface from ycm.diagnostic_interface import DiagnosticInterface
DIAGNOSTIC_UI_FILETYPES = set( [ 'cpp', 'cs', 'c', 'objc', 'objcpp', DIAGNOSTIC_UI_FILETYPES = { 'cpp', 'cs', 'c', 'objc', 'objcpp', 'typescript' }
'typescript' ] ) DIAGNOSTIC_UI_ASYNC_FILETYPES = { 'java' }
DIAGNOSTIC_UI_ASYNC_FILETYPES = set( [ 'java' ] )
# Emulates Vim buffer # Emulates Vim buffer
@ -131,8 +130,7 @@ class BufferDict( dict ):
new_value = self[ key ] = Buffer( new_value = self[ key ] = Buffer(
key, key,
self._user_options, self._user_options,
any( [ x in DIAGNOSTIC_UI_ASYNC_FILETYPES any( x in DIAGNOSTIC_UI_ASYNC_FILETYPES
for x in for x in vimsupport.GetBufferFiletypes( key ) ) )
vimsupport.GetBufferFiletypes( key ) ] ) )
return new_value return new_value

View File

@ -181,7 +181,7 @@ def _FilterToMatchingCompletions( completed_item, completions ):
return ( ToUnicode( completed_item.get( key, "" ) ) == return ( ToUnicode( completed_item.get( key, "" ) ) ==
ToUnicode( item.get( key, "" ) ) ) ToUnicode( item.get( key, "" ) ) )
if all( [ matcher( i ) for i in match_keys ] ): if all( matcher( i ) for i in match_keys ):
matched_completions.append( completion ) matched_completions.append( completion )
return matched_completions return matched_completions

View File

@ -45,20 +45,20 @@ SYNTAX_REGION_ARGUMENT_REGEX = re.compile(
r"^(?:matchgroup|start)=.*$") r"^(?:matchgroup|start)=.*$")
# See ":h syn-nextgroup". # See ":h syn-nextgroup".
SYNTAX_NEXTGROUP_ARGUMENTS = set([ SYNTAX_NEXTGROUP_ARGUMENTS = {
'skipwhite', 'skipwhite',
'skipnl', 'skipnl',
'skipempty' 'skipempty'
]) }
# These are the parent groups from which we want to extract keywords. # These are the parent groups from which we want to extract keywords.
ROOT_GROUPS = set([ ROOT_GROUPS = {
'Boolean', 'Boolean',
'Identifier', 'Identifier',
'Statement', 'Statement',
'PreProc', 'PreProc',
'Type' 'Type'
]) }
class SyntaxGroup( object ): class SyntaxGroup( object ):

View File

@ -670,7 +670,7 @@ def CurrentFiletypesEnabled( disabled_filetypes ):
filetypes and values are unimportant. The special key '*' matches all filetypes and values are unimportant. The special key '*' matches all
filetypes.""" filetypes."""
return ( '*' not in disabled_filetypes and return ( '*' not in disabled_filetypes and
not any( [ x in disabled_filetypes for x in CurrentFiletypes() ] ) ) not any( x in disabled_filetypes for x in CurrentFiletypes() ) )
def GetBufferFiletypes( bufnr ): def GetBufferFiletypes( bufnr ):

View File

@ -357,8 +357,8 @@ class YouCompleteMe( object ):
def NativeFiletypeCompletionAvailable( self ): def NativeFiletypeCompletionAvailable( self ):
return any( [ self.FiletypeCompleterExistsForFiletype( x ) for x in return any( self.FiletypeCompleterExistsForFiletype( x ) for x in
vimsupport.CurrentFiletypes() ] ) vimsupport.CurrentFiletypes() )
def NativeFiletypeCompletionUsable( self ): def NativeFiletypeCompletionUsable( self ):
@ -498,9 +498,9 @@ class YouCompleteMe( object ):
def DiagnosticUiSupportedForCurrentFiletype( self ): def DiagnosticUiSupportedForCurrentFiletype( self ):
return any( [ x in DIAGNOSTIC_UI_FILETYPES or return any( x in DIAGNOSTIC_UI_FILETYPES or
x in DIAGNOSTIC_UI_ASYNC_FILETYPES x in DIAGNOSTIC_UI_ASYNC_FILETYPES
for x in vimsupport.CurrentFiletypes() ] ) for x in vimsupport.CurrentFiletypes() )
def ShouldDisplayDiagnostics( self ): def ShouldDisplayDiagnostics( self ):