Permalink
Browse files

Fix Python 3 support

  • Loading branch information...
1 parent d5ca169 commit c8cbdabfab3a150904a2214930e82112d0231ff2 @andrewgodwin andrewgodwin committed Jul 26, 2013
Showing with 5 additions and 5 deletions.
  1. +2 −2 django/db/migrations/autodetector.py
  2. +2 −2 django/db/migrations/graph.py
  3. +1 −1 django/db/migrations/writer.py
@@ -367,9 +367,9 @@ def _boolean_input(self, question):
return result[0].lower() == "y"
def _choice_input(self, question, choices):
- print question
+ print(question)
for i, choice in enumerate(choices):
- print " %s) %s" % (i + 1, choice)
+ print(" %s) %s" % (i + 1, choice))
result = input("Select an option: ")
while True:
try:
@@ -70,7 +70,7 @@ def root_nodes(self):
"""
roots = set()
for node in self.nodes:
- if not filter(lambda key: key[0] == node[0], self.dependencies.get(node, set())):
+ if not any(key[0] == node[0] for key in self.dependencies.get(node, set())):
roots.add(node)
return roots
@@ -84,7 +84,7 @@ def leaf_nodes(self):
"""
leaves = set()
for node in self.nodes:
- if not filter(lambda key: key[0] == node[0], self.dependents.get(node, set())):
+ if not any(key[0] == node[0] for key in self.dependents.get(node, set())):
leaves.add(node)
return leaves
@@ -109,7 +109,7 @@ def serialize(cls, value):
elif isinstance(value, (datetime.datetime, datetime.date)):
return repr(value), set(["import datetime"])
# Simple types
- elif isinstance(value, (int, long, float, six.binary_type, six.text_type, bool, types.NoneType)):
+ elif isinstance(value, six.integer_types + (float, six.binary_type, six.text_type, bool, type(None))):
return repr(value), set()
# Django fields
elif isinstance(value, models.Field):

0 comments on commit c8cbdab

Please sign in to comment.