Selaa lähdekoodia

Use future.utils iterkeys; fix some more style issues

dhleong 8 vuotta sitten
vanhempi
commit
4c53e5d006
1 muutettua tiedostoa jossa 5 lisäystä ja 4 poistoa
  1. 5 4
      python/ycm/diagnostic_filter.py

+ 5 - 4
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 )