]> Devi Nivas Git - chevron.git/commitdiff
Flake8 cleanup
authorDaniel Morrison <dan@morrison.ph>
Tue, 16 Apr 2019 23:26:34 +0000 (19:26 -0400)
committerDaniel Morrison <dan@morrison.ph>
Tue, 16 Apr 2019 23:26:34 +0000 (19:26 -0400)
chevron/renderer.py
test_spec.py

index 43e97dc1f36fa5d426fdbbd9ab0b1d53c651c8b1..80c06817231472dc9b5a8780782607746d8982c2 100644 (file)
@@ -68,13 +68,14 @@ def _get_key(key, scopes):
                     try:
                         # Try the dictionary (Complex types)
                         scope = scope.__dict__[child]
-                    except:
+                    except (TypeError, AttributeError):
                         # Try as a list
                         scope = scope[int(child)]
 
             # Return an empty string if falsy, with two exceptions
             # 0 should return 0, and False should return False
-            if scope is 0:
+            # While using is for this check is undefined it works and is fast
+            if scope is 0:  # noqa: F632
                 return 0
             if scope is False:
                 return False
index 72ef263bc26430801aad0869471e47e1715c18df..9030ce0edf2f5320b7c1e93db23fb24fedff0b3d 100755 (executable)
@@ -120,7 +120,9 @@ class ExpandedCoverage(unittest.TestCase):
     def test_missing_key_partial(self):
         args = {
             'template': 'before, {{> with_missing_key }}, after',
-            'partials_dict': {'with_missing_key': '{{#missing_key}}bloop{{/missing_key}}'}
+            'partials_dict': {
+                'with_missing_key': '{{#missing_key}}bloop{{/missing_key}}',
+            },
         }
 
         result = chevron.render(**args)
@@ -363,7 +365,7 @@ class ExpandedCoverage(unittest.TestCase):
             'template': 'count {{count.0}}, {{count.1}}, '
                         '{{count.100}}, {{nope.0}}',
             'data': {
-                "count": [5,4,3,2,1],
+                "count": [5, 4, 3, 2, 1],
             }
         }