Use future.utils iterkeys; fix some more style issues

This commit is contained in:
dhleong 2016-10-10 19:50:34 -04:00
parent abc0dd5e31
commit 4c53e5d006

View File

@ -23,6 +23,7 @@ from future import standard_library
standard_library.install_aliases()
from builtins import * # noqa
from future.utils import iterkeys
import re
@ -30,13 +31,13 @@ class DiagnosticFilter( object ):
def __init__( self, config ):
self._filters = []
for filter_type in config.iterkeys():
for filter_type in iterkeys( config ):
wrapper = _AsIs
actual_filter_type = filter_type
if filter_type[0] == '!':
if filter_type[ 0 ] == '!':
wrapper = _Not
filter_type = filter_type[1:]
filter_type = filter_type[ 1 : ]
compiler = FILTER_COMPILERS.get( filter_type )
if compiler is not None:
@ -96,7 +97,7 @@ def _CompileLevel( level ):
# valid kinds are WARNING and ERROR;
# expected input levels are `warnings` and `errors`
# NB: we don't validate the input...
expected_kind = level.upper()[:-1]
expected_kind = level.upper()[ : -1 ]
def FilterLevel( diagnostic ):
print( diagnostic, 'matches?', expected_kind )