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
mock >= 1.0.1
nose >= 1.3.7
PyHamcrest >= 1.8.0
flake8 >= 3.0.0
flake8-comprehensions >= 1.4.1
mock >= 1.0.1
nose >= 1.3.7
PyHamcrest >= 1.8.0
# This needs to be kept in sync with submodule checkout in
# 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.
# This leads to incorrect coverage from codecov as it relies on this attribute
# to find the source file.
coverage < 4.4
codecov >= 2.0.5
coverage < 4.4
codecov >= 2.0.5

View File

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

View File

@ -181,7 +181,7 @@ def _FilterToMatchingCompletions( completed_item, completions ):
return ( ToUnicode( completed_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 )
return matched_completions

View File

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

View File

@ -670,7 +670,7 @@ def CurrentFiletypesEnabled( disabled_filetypes ):
filetypes and values are unimportant. The special key '*' matches all
filetypes."""
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 ):

View File

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