Fixing python-modernize issues.

This commit is contained in:
arbisoft
2019-07-09 15:13:41 +05:00
parent 9d856c4cec
commit 32e89b48bc
9 changed files with 28 additions and 10 deletions

View File

@@ -1,6 +1,8 @@
"""
Tests for the course import API views
"""
from __future__ import absolute_import
import os
import tarfile
import tempfile
@@ -9,10 +11,10 @@ from django.urls import reverse
from path import Path as path
from rest_framework import status
from rest_framework.test import APITestCase
from user_tasks.models import UserTaskStatus
from lms.djangoapps.courseware.tests.factories import StaffFactory
from student.tests.factories import UserFactory
from user_tasks.models import UserTaskStatus
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory

View File

@@ -1,6 +1,8 @@
"""
Tests for the course import API views
"""
from __future__ import absolute_import
from rest_framework import status
from .base import BaseCourseViewTest

View File

@@ -3,11 +3,13 @@ A single-use management command that provides an interactive way to remove
erroneous certificate names.
"""
from __future__ import absolute_import
from collections import namedtuple
from six.moves import input
from six import text_type
from django.core.management.base import BaseCommand
from six import text_type
from six.moves import input, range, zip
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.django import modulestore

View File

@@ -6,7 +6,7 @@
# Run it this way:
# ./manage.py cms --settings dev edit_course_tabs --course Stanford/CS99/2013_spring
#
from __future__ import print_function
from __future__ import absolute_import, print_function
from django.core.management.base import BaseCommand, CommandError
from opaque_keys.edx.keys import CourseKey

View File

@@ -1,4 +1,8 @@
from django.core.management.base import BaseCommand, CommandError
"""Script to Empty the trashcan"""
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from opaque_keys.edx.keys import CourseKey
from xmodule.contentstore.utils import empty_asset_trashcan
@@ -8,6 +12,9 @@ from .prompt import query_yes_no
class Command(BaseCommand):
"""
Command to Empty the trashcan.
"""
help = 'Empty the trashcan. Can pass an optional course_id to limit the damage.'
def add_arguments(self, parser):

View File

@@ -1,10 +1,10 @@
"""
Script for exporting all courseware from Mongo to a directory and listing the courses which failed to export
"""
from __future__ import print_function
from six import text_type
from __future__ import absolute_import, print_function
from django.core.management.base import BaseCommand
from six import text_type
from xmodule.contentstore.django import contentstore
from xmodule.modulestore.django import modulestore

View File

@@ -1,7 +1,8 @@
"""
Script for exporting a content library from Mongo to a tar.gz file
"""
from __future__ import print_function
from __future__ import absolute_import, print_function
import os
import shutil
@@ -9,9 +10,9 @@ from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import LibraryLocator
from xmodule.modulestore.django import modulestore
from cms.djangoapps.contentstore import tasks
from xmodule.modulestore.django import modulestore
class Command(BaseCommand):

View File

@@ -13,13 +13,15 @@ This functionality is also available as an export view in studio if the giturl
attribute is set and the FEATURE['ENABLE_EXPORT_GIT'] is set.
"""
from __future__ import absolute_import
import logging
from six import text_type
from django.core.management.base import BaseCommand, CommandError
from django.utils.translation import ugettext as _
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from six import text_type
import contentstore.git_export_utils as git_export_utils
from contentstore.git_export_utils import GitExportError

View File

@@ -2,6 +2,8 @@
Django management command to migrate a course from the old Mongo modulestore
to the new split-Mongo modulestore.
"""
from __future__ import absolute_import
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError