Fix Python 3 support
This commit is contained in:
parent
d5ca169334
commit
c8cbdabfab
|
@ -367,9 +367,9 @@ class InteractiveMigrationQuestioner(MigrationQuestioner):
|
||||||
return result[0].lower() == "y"
|
return result[0].lower() == "y"
|
||||||
|
|
||||||
def _choice_input(self, question, choices):
|
def _choice_input(self, question, choices):
|
||||||
print question
|
print(question)
|
||||||
for i, choice in enumerate(choices):
|
for i, choice in enumerate(choices):
|
||||||
print " %s) %s" % (i + 1, choice)
|
print(" %s) %s" % (i + 1, choice))
|
||||||
result = input("Select an option: ")
|
result = input("Select an option: ")
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -70,7 +70,7 @@ class MigrationGraph(object):
|
||||||
"""
|
"""
|
||||||
roots = set()
|
roots = set()
|
||||||
for node in self.nodes:
|
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)
|
roots.add(node)
|
||||||
return roots
|
return roots
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class MigrationGraph(object):
|
||||||
"""
|
"""
|
||||||
leaves = set()
|
leaves = set()
|
||||||
for node in self.nodes:
|
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)
|
leaves.add(node)
|
||||||
return leaves
|
return leaves
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,7 @@ class MigrationWriter(object):
|
||||||
elif isinstance(value, (datetime.datetime, datetime.date)):
|
elif isinstance(value, (datetime.datetime, datetime.date)):
|
||||||
return repr(value), set(["import datetime"])
|
return repr(value), set(["import datetime"])
|
||||||
# Simple types
|
# 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()
|
return repr(value), set()
|
||||||
# Django fields
|
# Django fields
|
||||||
elif isinstance(value, models.Field):
|
elif isinstance(value, models.Field):
|
||||||
|
|
Loading…
Reference in New Issue