# copied from fix_tuple_params.py
def is_docstring(stmt):
- return isinstance(stmt, pytree.Node) and \
- stmt.children[0].type == token.STRING
+ return isinstance(stmt, pytree.Node) and stmt.children[0].type == token.STRING
class FixFutureImports(fixer_base.BaseFix):
if __name__ == '__main__':
parse_command_line()
app = Application([
- ('/', EchoHandler),
+ ('/', EchoHandler),
])
app.listen(options.port, address='127.0.0.1')
IOLoop.instance().start()
# We know this future will resolve on the IOLoop, so we don't
# need the extra thread-safety of IOLoop.add_future (and we also
# don't care about StackContext here.
- future_add_done_callback(future,
- lambda future: io_loop.remove_timeout(timeout_handle))
+ future_add_done_callback(
+ future, lambda future: io_loop.remove_timeout(timeout_handle))
else:
# concurrent.futures.Futures may resolve on any thread, so we
# need to route them back to the IOLoop.
try:
yielded.start(self)
if yielded.is_ready():
- future_set_result_unless_cancelled(self.future,
- yielded.get_result())
+ future_set_result_unless_cancelled(self.future, yielded.get_result())
else:
self.yield_point = yielded
except Exception:
# but if they do, leave it alone.
'Transfer-Encoding' not in headers)
# If connection to a 1.1 client will be closed, inform client
- if (self._request_start_line.version == 'HTTP/1.1' and
- self._disconnect_on_finish):
+ if (self._request_start_line.version == 'HTTP/1.1' and self._disconnect_on_finish):
headers['Connection'] = 'close'
# If a 1.0 client asked for keep-alive, add the header.
if (self._request_start_line.version == 'HTTP/1.0' and
- (self._request_headers.get('Connection', '').lower() ==
- 'keep-alive')):
+ self._request_headers.get('Connection', '').lower() == 'keep-alive'):
headers['Connection'] = 'Keep-Alive'
if self._chunking_output:
headers['Transfer-Encoding'] = 'chunked'
"""
assert is_future(future)
callback = stack_context.wrap(callback)
- future_add_done_callback(future,
- lambda future: self.add_callback(callback, future))
+ future_add_done_callback(
+ future, lambda future: self.add_callback(callback, future))
def run_in_executor(self, executor, func, *args):
"""Runs a function in a ``concurrent.futures.Executor``. If
return
stream, future = self.connect(af, addr)
self.streams.add(stream)
- future_add_done_callback(future, functools.partial(self.on_connect_done,
- addrs, af, addr))
+ future_add_done_callback(
+ future, functools.partial(self.on_connect_done, addrs, af, addr))
def on_connect_done(self, addrs, af, addr, future):
self.remaining -= 1
# logged anything at info level or above (except for the one
# allowed info message "PASS")
if (log_counter.info_count > 1 or
- log_counter.warning_count > 0 or
- log_counter.error_count > 0):
+ log_counter.warning_count > 0 or
+ log_counter.error_count > 0):
logging.error("logged %d infos, %d warnings, and %d errors",
log_counter.info_count, log_counter.warning_count,
log_counter.error_count)
self._write_buffer = []
self.set_status(304)
if (self._status_code in (204, 304) or
- (self._status_code >= 100 and self._status_code < 200)):
+ (self._status_code >= 100 and self._status_code < 200)):
assert not self._write_buffer, "Cannot send body with %s" % self._status_code
self._clear_headers_for_304()
elif "Content-Length" not in self._headers: