diff --git a/openedx/core/djangoapps/coursegraph/apps.py b/openedx/core/djangoapps/coursegraph/apps.py index ff9ac4a7d3..7fbb659ee4 100644 --- a/openedx/core/djangoapps/coursegraph/apps.py +++ b/openedx/core/djangoapps/coursegraph/apps.py @@ -3,6 +3,7 @@ Coursegraph Application Configuration Signal handlers are connected here. """ +from __future__ import absolute_import from django.apps import AppConfig diff --git a/openedx/core/djangoapps/coursegraph/management/commands/dump_to_neo4j.py b/openedx/core/djangoapps/coursegraph/management/commands/dump_to_neo4j.py index b6dc896547..47b1cc5b5d 100644 --- a/openedx/core/djangoapps/coursegraph/management/commands/dump_to_neo4j.py +++ b/openedx/core/djangoapps/coursegraph/management/commands/dump_to_neo4j.py @@ -2,7 +2,7 @@ This file contains a management command for exporting the modulestore to neo4j, a graph database. """ -from __future__ import unicode_literals, print_function +from __future__ import absolute_import, print_function, unicode_literals import logging diff --git a/openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py b/openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py index 840bfd373b..5156428876 100644 --- a/openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py +++ b/openedx/core/djangoapps/coursegraph/management/commands/tests/test_dump_to_neo4j.py @@ -2,7 +2,7 @@ """ Tests for the dump_to_neo4j management command. """ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals from datetime import datetime @@ -247,16 +247,16 @@ class TestModuleStoreSerializer(TestDumpToNeo4jCommandBase): """ fields, label = serialize_item(self.course) self.assertEqual(label, "course") - self.assertIn("edited_on", fields.keys()) - self.assertIn("display_name", fields.keys()) - self.assertIn("org", fields.keys()) - self.assertIn("course", fields.keys()) - self.assertIn("run", fields.keys()) - self.assertIn("course_key", fields.keys()) - self.assertIn("location", fields.keys()) - self.assertIn("block_type", fields.keys()) - self.assertIn("detached", fields.keys()) - self.assertNotIn("checklist", fields.keys()) + self.assertIn("edited_on", list(fields.keys())) + self.assertIn("display_name", list(fields.keys())) + self.assertIn("org", list(fields.keys())) + self.assertIn("course", list(fields.keys())) + self.assertIn("run", list(fields.keys())) + self.assertIn("course_key", list(fields.keys())) + self.assertIn("location", list(fields.keys())) + self.assertIn("block_type", list(fields.keys())) + self.assertIn("detached", list(fields.keys())) + self.assertNotIn("checklist", list(fields.keys())) def test_serialize_course(self): """ diff --git a/openedx/core/djangoapps/coursegraph/management/commands/tests/utils.py b/openedx/core/djangoapps/coursegraph/management/commands/tests/utils.py index 4a963baa8b..1ff642debe 100644 --- a/openedx/core/djangoapps/coursegraph/management/commands/tests/utils.py +++ b/openedx/core/djangoapps/coursegraph/management/commands/tests/utils.py @@ -1,7 +1,7 @@ """ Utilities for testing the dump_to_neo4j management command """ -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals from py2neo import Node diff --git a/openedx/core/djangoapps/coursegraph/tasks.py b/openedx/core/djangoapps/coursegraph/tasks.py index 834ac1d4e5..72cfc7d1a0 100644 --- a/openedx/core/djangoapps/coursegraph/tasks.py +++ b/openedx/core/djangoapps/coursegraph/tasks.py @@ -2,7 +2,7 @@ This file contains a management command for exporting the modulestore to neo4j, a graph database. """ -from __future__ import unicode_literals, print_function +from __future__ import absolute_import, print_function, unicode_literals import logging @@ -12,7 +12,7 @@ from django.utils import six, timezone from edx_django_utils.cache import RequestCache from opaque_keys.edx.keys import CourseKey from py2neo import Graph, Node, Relationship, authenticate, NodeSelector -from py2neo.compat import integer, string, unicode as neo4j_unicode +from py2neo.compat import integer, string log = logging.getLogger(__name__) @@ -23,7 +23,7 @@ celery_log = logging.getLogger('edx.celery.task') bolt_log = logging.getLogger('neo4j.bolt') # pylint: disable=invalid-name bolt_log.setLevel(logging.ERROR) -PRIMITIVE_NEO4J_TYPES = (integer, string, neo4j_unicode, float, bool) +PRIMITIVE_NEO4J_TYPES = (integer, string, six.text_type, float, bool) def serialize_item(item): @@ -211,7 +211,7 @@ def serialize_course(course_id): relationships.append(ordering_relationship) previous_child_node = child_node - nodes = location_to_node.values() + nodes = list(location_to_node.values()) return nodes, relationships diff --git a/openedx/core/djangoapps/self_paced/admin.py b/openedx/core/djangoapps/self_paced/admin.py index 0745cc57b8..a114d049ef 100644 --- a/openedx/core/djangoapps/self_paced/admin.py +++ b/openedx/core/djangoapps/self_paced/admin.py @@ -2,6 +2,8 @@ Admin site bindings for self-paced courses. """ +from __future__ import absolute_import + from config_models.admin import ConfigurationModelAdmin from django.contrib import admin diff --git a/openedx/core/djangoapps/self_paced/migrations/0001_initial.py b/openedx/core/djangoapps/self_paced/migrations/0001_initial.py index e95596b041..b6f3df0fe5 100644 --- a/openedx/core/djangoapps/self_paced/migrations/0001_initial.py +++ b/openedx/core/djangoapps/self_paced/migrations/0001_initial.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals from django.db import migrations, models import django.db.models.deletion diff --git a/openedx/core/djangoapps/self_paced/models.py b/openedx/core/djangoapps/self_paced/models.py index 1f7bf706d9..48614f33e7 100644 --- a/openedx/core/djangoapps/self_paced/models.py +++ b/openedx/core/djangoapps/self_paced/models.py @@ -2,6 +2,8 @@ Configuration for self-paced courses. """ +from __future__ import absolute_import + from config_models.models import ConfigurationModel from django.db.models import BooleanField from django.utils.translation import ugettext_lazy as _