From 4c53e5d006ef6307beb8991e0747f0b131cca9f1 Mon Sep 17 00:00:00 2001 From: dhleong Date: Mon, 10 Oct 2016 19:50:34 -0400 Subject: [PATCH] Use future.utils iterkeys; fix some more style issues --- python/ycm/diagnostic_filter.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/ycm/diagnostic_filter.py b/python/ycm/diagnostic_filter.py index 67ac8c38..4c6a1c4d 100644 --- a/python/ycm/diagnostic_filter.py +++ b/python/ycm/diagnostic_filter.py @@ -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 )