Rename method for clarity and tweak style
This commit is contained in:
parent
68cf0220e5
commit
3869830a65
@ -46,8 +46,8 @@ class DiagnosticFilter( object ):
|
|||||||
self._filters.append( fn )
|
self._filters.append( fn )
|
||||||
|
|
||||||
|
|
||||||
def Accept( self, diagnostic ):
|
def IsAllowed( self, diagnostic ):
|
||||||
# NB: we Accept() the diagnostic ONLY if
|
# NOTE: a diagnostic IsAllowed() ONLY if
|
||||||
# no filters match it
|
# no filters match it
|
||||||
for f in self._filters:
|
for f in self._filters:
|
||||||
if f( diagnostic ):
|
if f( diagnostic ):
|
||||||
@ -105,5 +105,5 @@ def _CompileLevel( level ):
|
|||||||
return FilterLevel
|
return FilterLevel
|
||||||
|
|
||||||
|
|
||||||
FILTER_COMPILERS = { 'regex' : _CompileRegex,
|
FILTER_COMPILERS = { 'regex' : _CompileRegex,
|
||||||
'level' : _CompileLevel }
|
'level' : _CompileLevel }
|
||||||
|
@ -70,7 +70,7 @@ class DiagnosticInterface( object ):
|
|||||||
self._user_options,
|
self._user_options,
|
||||||
vimsupport.CurrentFiletypes() )
|
vimsupport.CurrentFiletypes() )
|
||||||
normalized_diags = [ _NormalizeDiagnostic( x ) for x in diags
|
normalized_diags = [ _NormalizeDiagnostic( x ) for x in diags
|
||||||
if diag_filter.Accept(x) ]
|
if diag_filter.IsAllowed( x ) ]
|
||||||
self._buffer_number_to_line_to_diags = _ConvertDiagListToDict(
|
self._buffer_number_to_line_to_diags = _ConvertDiagListToDict(
|
||||||
normalized_diags )
|
normalized_diags )
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ def _assert_accept_equals( filter, text_or_obj, expected ):
|
|||||||
if not isinstance( text_or_obj, dict ):
|
if not isinstance( text_or_obj, dict ):
|
||||||
text_or_obj = { 'text': text_or_obj }
|
text_or_obj = { 'text': text_or_obj }
|
||||||
|
|
||||||
assert_that( filter.Accept( text_or_obj ), equal_to( expected ) )
|
assert_that( filter.IsAllowed( text_or_obj ), equal_to( expected ) )
|
||||||
|
|
||||||
|
|
||||||
def _assert_accepts( filter, text ):
|
def _assert_accepts( filter, text ):
|
||||||
|
Loading…
Reference in New Issue
Block a user