run isort
This commit is contained in:
@@ -2,51 +2,44 @@
|
||||
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
|
||||
from functools import wraps
|
||||
|
||||
import six
|
||||
from django.urls import reverse
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from rest_framework import status
|
||||
from rest_framework.generics import GenericAPIView
|
||||
from rest_framework.response import Response
|
||||
from rest_framework.views import APIView
|
||||
from six import text_type
|
||||
from util.date_utils import to_timestamp
|
||||
|
||||
from courseware.courses import get_course_by_id
|
||||
from lms.djangoapps.grades.api import (
|
||||
CourseGradeFactory,
|
||||
is_writable_gradebook_enabled,
|
||||
prefetch_course_and_subsection_grades,
|
||||
clear_prefetched_course_and_subsection_grades,
|
||||
constants as grades_constants,
|
||||
context as grades_context,
|
||||
events as grades_events,
|
||||
)
|
||||
from lms.djangoapps.grades.api import CourseGradeFactory, clear_prefetched_course_and_subsection_grades
|
||||
from lms.djangoapps.grades.api import constants as grades_constants
|
||||
from lms.djangoapps.grades.api import context as grades_context
|
||||
from lms.djangoapps.grades.api import events as grades_events
|
||||
from lms.djangoapps.grades.api import is_writable_gradebook_enabled, prefetch_course_and_subsection_grades
|
||||
from lms.djangoapps.grades.course_data import CourseData
|
||||
from lms.djangoapps.grades.grade_utils import are_grades_frozen
|
||||
# TODO these imports break abstraction of the core Grades layer. This code needs
|
||||
# to be refactored so Gradebook views only access public Grades APIs.
|
||||
from lms.djangoapps.grades.models import (
|
||||
PersistentSubsectionGrade,
|
||||
PersistentSubsectionGradeOverride,
|
||||
PersistentSubsectionGradeOverrideHistory,
|
||||
PersistentSubsectionGradeOverrideHistory
|
||||
)
|
||||
from lms.djangoapps.grades.rest_api.serializers import (
|
||||
StudentGradebookEntrySerializer,
|
||||
SubsectionGradeResponseSerializer,
|
||||
)
|
||||
from lms.djangoapps.grades.rest_api.v1.utils import (
|
||||
USER_MODEL,
|
||||
CourseEnrollmentPagination,
|
||||
GradeViewMixin,
|
||||
SubsectionGradeResponseSerializer
|
||||
)
|
||||
from lms.djangoapps.grades.rest_api.v1.utils import USER_MODEL, CourseEnrollmentPagination, GradeViewMixin
|
||||
from lms.djangoapps.grades.subsection_grade import CreateSubsectionGrade
|
||||
from lms.djangoapps.grades.tasks import recalculate_subsection_grade_v3
|
||||
from lms.djangoapps.grades.grade_utils import are_grades_frozen
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey, UsageKey
|
||||
from openedx.core.djangoapps.course_groups import cohorts
|
||||
from openedx.core.djangoapps.util.forms import to_bool
|
||||
from openedx.core.lib.api.view_utils import (
|
||||
@@ -54,7 +47,7 @@ from openedx.core.lib.api.view_utils import (
|
||||
PaginatedAPIView,
|
||||
get_course_key,
|
||||
verify_course_exists,
|
||||
view_auth_classes,
|
||||
view_auth_classes
|
||||
)
|
||||
from openedx.core.lib.cache_utils import request_cached
|
||||
from student.auth import has_course_author_access
|
||||
@@ -66,9 +59,9 @@ from track.event_transaction_utils import (
|
||||
get_event_transaction_type,
|
||||
set_event_transaction_type
|
||||
)
|
||||
from util.date_utils import to_timestamp
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.util.misc import get_default_short_labeler
|
||||
import six
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -2,16 +2,17 @@
|
||||
Mixins classes being used by all test classes within this folder
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pytz import UTC
|
||||
from six.moves import range
|
||||
|
||||
from lms.djangoapps.courseware.tests.factories import GlobalStaffFactory
|
||||
from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory
|
||||
from student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
|
||||
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):
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
"""
|
||||
Tests for the course grading API view
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from __future__ import absolute_import
|
||||
import json
|
||||
from collections import OrderedDict, namedtuple
|
||||
from datetime import datetime
|
||||
@@ -19,6 +18,7 @@ from rest_framework.test import APITestCase
|
||||
from six import text_type
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from lms.djangoapps.certificates.models import CertificateStatuses, GeneratedCertificate
|
||||
from lms.djangoapps.courseware.tests.factories import InstructorFactory, StaffFactory
|
||||
from lms.djangoapps.grades.config.waffle import WRITABLE_GRADEBOOK, waffle_flags
|
||||
from lms.djangoapps.grades.constants import GradeOverrideFeatureEnum
|
||||
@@ -29,14 +29,10 @@ from lms.djangoapps.grades.models import (
|
||||
BlockRecordList,
|
||||
PersistentSubsectionGrade,
|
||||
PersistentSubsectionGradeOverride,
|
||||
PersistentSubsectionGradeOverrideHistory,
|
||||
PersistentSubsectionGradeOverrideHistory
|
||||
)
|
||||
from lms.djangoapps.grades.rest_api.v1.tests.mixins import GradeViewTestMixin
|
||||
from lms.djangoapps.grades.rest_api.v1.views import CourseEnrollmentPagination
|
||||
from lms.djangoapps.certificates.models import (
|
||||
GeneratedCertificate,
|
||||
CertificateStatuses,
|
||||
)
|
||||
from lms.djangoapps.grades.subsection_grade import ReadSubsectionGrade
|
||||
from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory
|
||||
from openedx.core.djangoapps.course_groups.tests.helpers import CohortFactory
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
Tests for the views
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
import ddt
|
||||
import six
|
||||
from django.urls import reverse
|
||||
from edx_oauth2_provider.tests.factories import AccessTokenFactory, ClientFactory
|
||||
from pytz import UTC
|
||||
@@ -15,7 +17,6 @@ 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
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
"""
|
||||
Tests for v1 views
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import absolute_import
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
import ddt
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
""" Grades API v1 URLs. """
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf import settings
|
||||
from django.conf.urls import url
|
||||
|
||||
from lms.djangoapps.grades.rest_api.v1 import gradebook_views, views
|
||||
|
||||
|
||||
app_name = 'lms.djangoapps.grades'
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
@@ -2,6 +2,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,23 +1,21 @@
|
||||
""" API v0 views. """
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
from contextlib import contextmanager
|
||||
|
||||
from rest_framework import status
|
||||
from rest_framework.generics import ListAPIView
|
||||
from rest_framework.response import Response
|
||||
|
||||
from edx_rest_framework_extensions import permissions
|
||||
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
|
||||
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
|
||||
from lms.djangoapps.courseware.access import has_access
|
||||
from lms.djangoapps.grades.rest_api.serializers import GradingPolicySerializer
|
||||
from lms.djangoapps.grades.rest_api.v1.utils import (
|
||||
CourseEnrollmentPagination,
|
||||
GradeViewMixin,
|
||||
)
|
||||
from lms.djangoapps.grades.api import CourseGradeFactory, prefetch_course_grades, clear_prefetched_course_grades
|
||||
from opaque_keys import InvalidKeyError
|
||||
from rest_framework import status
|
||||
from rest_framework.generics import ListAPIView
|
||||
from rest_framework.response import Response
|
||||
|
||||
from lms.djangoapps.courseware.access import has_access
|
||||
from lms.djangoapps.grades.api import CourseGradeFactory, clear_prefetched_course_grades, prefetch_course_grades
|
||||
from lms.djangoapps.grades.rest_api.serializers import GradingPolicySerializer
|
||||
from lms.djangoapps.grades.rest_api.v1.utils import CourseEnrollmentPagination, GradeViewMixin
|
||||
from openedx.core.lib.api.authentication import OAuth2AuthenticationAllowInactiveUser
|
||||
from openedx.core.lib.api.view_utils import PaginatedAPIView, get_course_key, verify_course_exists
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
Reference in New Issue
Block a user