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"
|
||||
|
||||
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 @@ class MigrationGraph(object):
|
|||
"""
|
||||
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 @@ class MigrationGraph(object):
|
|||
"""
|
||||
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 @@ class MigrationWriter(object):
|
|||
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):
|
||||
|
|
Loading…
Reference in New Issue