I was continuously running flake8 on my project to clean lint. Suddenly, flake8 starts crashing:
~/P/r/otter: flake8 | grep cass 17:36:35
Process Process-3:
Traceback (most recent call last):
File "/Users/lvh/.pyenv/versions/2.7.8/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/Users/lvh/.pyenv/versions/2.7.8/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/flake8/reporter.py", line 74, in process_main
self._process_main()
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/flake8/reporter.py", line 50, in _process_main
self.input_file(filename)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/flake8/engine.py", line 92, in input_file
return fchecker.check_all(expected=expected, line_offset=line_offset)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/pep8.py", line 1412, in check_all
self.check_ast()
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/pep8.py", line 1358, in check_ast
checker = cls(tree, self.filename)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/flake8/_pyflakes.py", line 43, in __init__
withDoctest=self.withDoctest)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/pyflakes/checker.py", line 294, in __init__
self.handleChildren(tree)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/pyflakes/checker.py", line 547, in handleChildren
self.handleNode(node, tree)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/pyflakes/checker.py", line 589, in handleNode
handler(node)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/pyflakes/checker.py", line 812, in CLASSDEF
self.handleNode(stmt, node)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/pyflakes/checker.py", line 589, in handleNode
handler(node)
File "/Users/lvh/.pyenv/versions/otter/lib/python2.7/site-packages/pyflakes/checker.py", line 696, in RETURN
if node.value and not self.scope.returnValue:
AttributeError: 'ClassScope' object has no attribute 'returnValue'
I started seeing weird things come out of flake8; ISTR some tracebacks getting weirdly truncated, not actually having exceptions, et cetera. Typical multiprocessing stuff.
426daf4c7c7c4ab512264ea3f4c0878ad50ae5bc bad
Author: Laurens Van Houtven <[email protected]>
Date: Wed Jan 21 17:21:29 2015 -0800
Break up a lambda
1 file changed, 4 insertions(+), 3 deletions(-)
otter/models/cass.py | 7 ++++---
Modified otter/models/cass.py
diff --git a/otter/models/cass.py b/otter/models/cass.py
index 6b9c6d0..1e7f417 100644
--- a/otter/models/cass.py
+++ b/otter/models/cass.py
@@ -1471,9 +1471,10 @@ class CassScalingGroupCollection:
_cql_health_check.format(cf=self.group_table), {},
ConsistencyLevel.ONE)
- d.addCallback(
- lambda _: (True, {'cassandra_time': (self.reactor.seconds() - start_time)}))
- return d
+ d.addCallback(lambda _:
+ (True, {'cassandra_time':
+ (self.reactor.seconds() - start_time)}))
+ return d
@implementer(IAdmin)
So, basically it looks like flake8 doesn't deal nicely with a return being in a class body?