Permalink
Browse files

Turn on __future__ division too.

All existing uses of division were already using a float for at least
one operand (except the tests that just do 1/0 as a quick way to throw
an exception).

We have now turned on all the __future__ options available in python2.5.
  • Loading branch information...
1 parent 837da79 commit 58a7ff10a80b08f1b95d5eb410d91501e97f1d39 @bdarnell bdarnell committed Feb 9, 2012
Showing with 50 additions and 49 deletions.
  1. +1 −0 maint/scripts/custom_fixers/fix_future_imports.py
  2. +1 −1 tornado/__init__.py
  3. +1 −1 tornado/auth.py
  4. +1 −1 tornado/autoreload.py
  5. +1 −1 tornado/curl_httpclient.py
  6. +1 −1 tornado/database.py
  7. +1 −1 tornado/escape.py
  8. +1 −1 tornado/gen.py
  9. +1 −1 tornado/httpclient.py
  10. +1 −1 tornado/httpserver.py
  11. +1 −1 tornado/httputil.py
  12. +1 −1 tornado/ioloop.py
  13. +1 −1 tornado/iostream.py
  14. +1 −1 tornado/locale.py
  15. +1 −1 tornado/netutil.py
  16. +1 −1 tornado/options.py
  17. +1 −1 tornado/platform/auto.py
  18. +1 −1 tornado/platform/interface.py
  19. +1 −1 tornado/platform/posix.py
  20. +1 −1 tornado/platform/twisted.py
  21. +1 −1 tornado/platform/windows.py
  22. +1 −1 tornado/process.py
  23. +1 −1 tornado/simple_httpclient.py
  24. +1 −1 tornado/stack_context.py
  25. +1 −1 tornado/template.py
  26. +1 −1 tornado/test/auth_test.py
  27. +1 −1 tornado/test/curl_httpclient_test.py
  28. +1 −1 tornado/test/escape_test.py
  29. +1 −1 tornado/test/gen_test.py
  30. +1 −1 tornado/test/httpclient_test.py
  31. +1 −1 tornado/test/httpserver_test.py
  32. +1 −1 tornado/test/httputil_test.py
  33. +1 −1 tornado/test/import_test.py
  34. +1 −1 tornado/test/ioloop_test.py
  35. +1 −1 tornado/test/iostream_test.py
  36. +1 −1 tornado/test/process_test.py
  37. +1 −1 tornado/test/run_pyversion_tests.py
  38. +1 −1 tornado/test/runtests.py
  39. +1 −1 tornado/test/simple_httpclient_test.py
  40. +1 −1 tornado/test/stack_context_test.py
  41. +1 −1 tornado/test/template_test.py
  42. +1 −1 tornado/test/testing_test.py
  43. +1 −1 tornado/test/twisted_test.py
  44. +1 −1 tornado/test/web_test.py
  45. +1 −1 tornado/test/wsgi_test.py
  46. +1 −1 tornado/testing.py
  47. +1 −1 tornado/util.py
  48. +1 −1 tornado/web.py
  49. +1 −1 tornado/websocket.py
  50. +1 −1 tornado/wsgi.py
View
1 maint/scripts/custom_fixers/fix_future_imports.py
@@ -21,6 +21,7 @@ def start_tree(self, tree, filename):
def new_future_import(self, old):
new = FromImport("__future__",
[Name("absolute_import", prefix=" "), Comma(),
+ Name("division", prefix=" "), Comma(),
Name("with_statement", prefix=" ")])
if old is not None:
new.prefix = old.prefix
View
2 tornado/__init__.py
@@ -16,7 +16,7 @@
"""The Tornado web server and tools."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
# version is a human-readable version number.
View
2 tornado/auth.py
@@ -44,7 +44,7 @@ def _on_auth(self, user):
# Save the user with, e.g., set_secure_cookie()
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import base64
import binascii
View
2 tornado/autoreload.py
@@ -26,7 +26,7 @@
multi-process mode is used.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import functools
import logging
View
2 tornado/curl_httpclient.py
@@ -16,7 +16,7 @@
"""Blocking and non-blocking HTTP client implementations using pycurl."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import cStringIO
import collections
View
2 tornado/database.py
@@ -16,7 +16,7 @@
"""A lightweight wrapper around MySQLdb."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import copy
import MySQLdb.constants
View
2 tornado/escape.py
@@ -20,7 +20,7 @@
have crept in over time.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import htmlentitydefs
import re
View
2 tornado/gen.py
@@ -62,7 +62,7 @@ def get(self):
called with more than one argument or any keyword arguments, the result
is an `Arguments` object, which is a named tuple ``(args, kwargs)``.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import functools
import operator
View
2 tornado/httpclient.py
@@ -29,7 +29,7 @@
supported version is 7.18.2, and the recommended version is 7.21.1 or newer.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import calendar
import email.utils
View
2 tornado/httpserver.py
@@ -24,7 +24,7 @@ class except to start a server at the beginning of the process
`tornado.web.RequestHandler.request`.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import Cookie
import logging
View
2 tornado/httputil.py
@@ -16,7 +16,7 @@
"""HTTP utility code shared by clients and servers."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import logging
import urllib
View
2 tornado/ioloop.py
@@ -26,7 +26,7 @@
`IOLoop.add_timeout` is a non-blocking alternative to `time.sleep`.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import datetime
import errno
View
2 tornado/iostream.py
@@ -16,7 +16,7 @@
"""A utility class to write to and read from a non-blocking socket."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import collections
import errno
View
2 tornado/locale.py
@@ -39,7 +39,7 @@
the locale.translate method will simply return the original string.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import csv
import datetime
View
2 tornado/netutil.py
@@ -16,7 +16,7 @@
"""Miscellaneous network utility code."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import errno
import logging
View
2 tornado/options.py
@@ -48,7 +48,7 @@ def connect():
for define() below.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import datetime
import logging
View
2 tornado/platform/auto.py
@@ -23,7 +23,7 @@
from tornado.platform.auto import set_close_exec
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import os
View
2 tornado/platform/interface.py
@@ -21,7 +21,7 @@
implementation from `tornado.platform.auto`.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
def set_close_exec(fd):
"""Sets the close-on-exec bit (``FD_CLOEXEC``)for a file descriptor."""
View
2 tornado/platform/posix.py
@@ -16,7 +16,7 @@
"""Posix implementations of platform-specific functionality."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import fcntl
import os
View
2 tornado/platform/twisted.py
@@ -44,7 +44,7 @@
This module has been tested with Twisted versions 11.0.0 and 11.1.0.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import functools
import logging
View
2 tornado/platform/windows.py
@@ -2,7 +2,7 @@
# for production use.
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import ctypes
import ctypes.wintypes
import socket
View
2 tornado/process.py
@@ -16,7 +16,7 @@
"""Utilities for working with multiple processes."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import errno
import logging
View
2 tornado/simple_httpclient.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from tornado.escape import utf8, _unicode, native_str
from tornado.httpclient import HTTPRequest, HTTPResponse, HTTPError, AsyncHTTPClient, main
View
2 tornado/stack_context.py
@@ -66,7 +66,7 @@ def die_on_error():
block that references your `StackContext`.
'''
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import contextlib
import functools
View
2 tornado/template.py
@@ -172,7 +172,7 @@ def add(x, y):
Same as the python ``while`` statement.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import cStringIO
import datetime
View
2 tornado/test/auth_test.py
@@ -4,7 +4,7 @@
# python 3)
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from tornado.auth import OpenIdMixin, OAuthMixin, OAuth2Mixin
from tornado.escape import json_decode
from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase
View
2 tornado/test/curl_httpclient_test.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from tornado.test.httpclient_test import HTTPClientCommonTestCase
try:
View
2 tornado/test/escape_test.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import tornado.escape
import unittest
View
2 tornado/test/gen_test.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import functools
from tornado.escape import url_escape
from tornado.httpclient import AsyncHTTPClient
View
2 tornado/test/httpclient_test.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import base64
import binascii
View
2 tornado/test/httpserver_test.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from tornado import httpclient, simple_httpclient, netutil
from tornado.escape import json_decode, utf8, _unicode, recursive_unicode, native_str
from tornado.httpserver import HTTPServer
View
2 tornado/test/httputil_test.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from tornado.httputil import url_concat, parse_multipart_form_data, HTTPHeaders
from tornado.escape import utf8
from tornado.testing import LogTrapTestCase
View
2 tornado/test/import_test.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import unittest
class ImportTest(unittest.TestCase):
View
2 tornado/test/ioloop_test.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import datetime
import unittest
import time
View
2 tornado/test/iostream_test.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from tornado import netutil
from tornado.ioloop import IOLoop
from tornado.iostream import IOStream
View
2 tornado/test/process_test.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import logging
import os
import signal
View
2 tornado/test/run_pyversion_tests.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
"""Runs the tornado test suite with all supported python interpreters."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import os
import subprocess
View
2 tornado/test/runtests.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import unittest
TEST_MODULES = [
View
2 tornado/test/simple_httpclient_test.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import collections
import gzip
View
2 tornado/test/stack_context_test.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from tornado.stack_context import StackContext, wrap
from tornado.testing import AsyncHTTPTestCase, AsyncTestCase, LogTrapTestCase
View
2 tornado/test/template_test.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import traceback
View
2 tornado/test/testing_test.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import unittest
from tornado.testing import AsyncTestCase, LogTrapTestCase
View
2 tornado/test/twisted_test.py
@@ -17,7 +17,7 @@
Unittest for the twisted-style reactor.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import os
import thread
View
2 tornado/test/web_test.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from tornado.escape import json_decode, utf8, to_unicode, recursive_unicode, native_str
from tornado.iostream import IOStream
from tornado.template import DictLoader
View
2 tornado/test/wsgi_test.py
@@ -1,4 +1,4 @@
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from wsgiref.validate import validator
from tornado.testing import AsyncHTTPTestCase, LogTrapTestCase
View
2 tornado/testing.py
@@ -18,7 +18,7 @@
information.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
from cStringIO import StringIO
try:
View
2 tornado/util.py
@@ -1,6 +1,6 @@
"""Miscellaneous utility functions."""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
class ObjectDict(dict):
"""Makes a dictionary behave like an object."""
View
2 tornado/web.py
@@ -49,7 +49,7 @@ def get(self):
back to the main thread before finishing the request.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import Cookie
import base64
View
2 tornado/websocket.py
@@ -17,7 +17,7 @@
documentation for caveats).
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
# Author: Jacob Kristhammar, 2010
import array
View
2 tornado/wsgi.py
@@ -29,7 +29,7 @@
and Tornado handlers in a single server.
"""
-from __future__ import absolute_import, with_statement
+from __future__ import absolute_import, division, with_statement
import Cookie
import cgi

0 comments on commit 58a7ff1

Please sign in to comment.