run python modernize
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Defines an endpoint for gradebook data related to a course.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
import logging
|
||||
from collections import namedtuple
|
||||
from contextlib import contextmanager
|
||||
@@ -67,6 +68,7 @@ from track.event_transaction_utils import (
|
||||
)
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.util.misc import get_default_short_labeler
|
||||
import six
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -740,8 +742,8 @@ class GradebookBulkUpdateView(GradeViewMixin, PaginatedAPIView):
|
||||
only_if_higher=False,
|
||||
expected_modified_time=to_timestamp(override.modified),
|
||||
score_deleted=False,
|
||||
event_transaction_id=unicode(get_event_transaction_id()),
|
||||
event_transaction_type=unicode(get_event_transaction_type()),
|
||||
event_transaction_id=six.text_type(get_event_transaction_id()),
|
||||
event_transaction_type=six.text_type(get_event_transaction_type()),
|
||||
score_db_table=grades_constants.ScoreDatabaseTableEnum.overrides,
|
||||
force_update_subsections=True,
|
||||
)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Mixins classes being used by all test classes within this folder
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from datetime import datetime
|
||||
|
||||
from pytz import UTC
|
||||
@@ -10,6 +11,7 @@ from openedx.core.djangoapps.content.course_overviews.tests.factories import Cou
|
||||
from student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE
|
||||
from six.moves import range
|
||||
|
||||
|
||||
class GradeViewTestMixin(SharedModuleStoreTestCase):
|
||||
@@ -98,7 +100,7 @@ class GradeViewTestMixin(SharedModuleStoreTestCase):
|
||||
# create a problem for each type and minimum count needed by the grading policy
|
||||
# A section is not considered if the student answers less than "min_count" problems
|
||||
for grading_type, min_count in (("Homework", 12), ("Lab", 12), ("Midterm Exam", 1), ("Final Exam", 1)):
|
||||
for num in xrange(min_count):
|
||||
for num in range(min_count):
|
||||
section = ItemFactory.create(
|
||||
category='sequential',
|
||||
parent_location=chapter.location,
|
||||
|
||||
@@ -3,6 +3,7 @@ Tests for the course grading API view
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from __future__ import absolute_import
|
||||
import json
|
||||
from collections import OrderedDict, namedtuple
|
||||
from datetime import datetime
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Tests for the views
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from datetime import datetime
|
||||
|
||||
import ddt
|
||||
@@ -14,6 +15,7 @@ from student.tests.factories import UserFactory
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
import six
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -36,7 +38,7 @@ class GradingPolicyTestMixin(object):
|
||||
def create_course_data(cls):
|
||||
cls.invalid_course_id = 'foo/bar/baz'
|
||||
cls.course = CourseFactory.create(display_name='An Introduction to API Testing', raw_grader=cls.raw_grader)
|
||||
cls.course_id = unicode(cls.course.id)
|
||||
cls.course_id = six.text_type(cls.course.id)
|
||||
with cls.store.bulk_operations(cls.course.id, emit_signals=False):
|
||||
cls.sequential = ItemFactory.create(
|
||||
category="sequential",
|
||||
@@ -150,7 +152,7 @@ class GradingPolicyTestMixin(object):
|
||||
org="MTD",
|
||||
default_store=modulestore_type,
|
||||
)
|
||||
self.assert_get_for_course(course_id=unicode(course.id))
|
||||
self.assert_get_for_course(course_id=six.text_type(course.id))
|
||||
|
||||
|
||||
class CourseGradingPolicyTests(GradingPolicyTestMixin, SharedModuleStoreTestCase):
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
Tests for v1 views
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import absolute_import
|
||||
from collections import OrderedDict
|
||||
|
||||
import ddt
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
""" Grades API v1 URLs. """
|
||||
from __future__ import absolute_import
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""
|
||||
Define some view level utility functions here that multiple view modules will share
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from contextlib import contextmanager
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
""" API v0 views. """
|
||||
from __future__ import absolute_import
|
||||
import logging
|
||||
from contextlib import contextmanager
|
||||
|
||||
|
||||
Reference in New Issue
Block a user