INCR-149 (#20516)
* INCR-149: Run python-modernize on openedx/core/djangoapps [self_paced, coursegraph] * INCR-149: Groups to absolute_import and unicode_literals
This commit is contained in:
@@ -3,6 +3,7 @@ Coursegraph Application Configuration
|
||||
|
||||
Signal handlers are connected here.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 _
|
||||
|
||||
Reference in New Issue
Block a user