Merge pull request #22644 from edx/feanil/2to3_imports

Run `2to3 -f future . -w`
This commit is contained in:
Feanil Patel
2019-12-30 11:21:05 -05:00
committed by GitHub
2829 changed files with 2851 additions and 2851 deletions

View File

@@ -2,7 +2,7 @@
Celery needs to be loaded when the cms modules are so that task
registration and discovery can work correctly.
"""
from __future__ import absolute_import
# We monkey patch Kombu's entrypoints listing because scanning through this
# accounts for the majority of LMS/Studio startup time for tests, and we don't

View File

@@ -4,7 +4,7 @@ and auto discover tasks in all installed django apps.
Taken from: https://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
"""
from __future__ import absolute_import
import os

View File

@@ -6,7 +6,7 @@ pytest from looking for the conftest.py module in the parent directory when
only running cms tests.
"""
from __future__ import absolute_import, unicode_literals
import importlib
import os

View File

@@ -2,7 +2,7 @@
Configuration for Studio API Django application
"""
from __future__ import absolute_import
from django.apps import AppConfig

View File

@@ -2,7 +2,7 @@
URLs for the Studio API app
"""
from __future__ import absolute_import
from django.conf.urls import include, url

View File

@@ -1,5 +1,5 @@
""" Course run serializers. """
from __future__ import absolute_import
import logging
import time # pylint: disable=unused-import

View File

@@ -1,6 +1,6 @@
"""Tests for course run serializers"""
from __future__ import absolute_import
import datetime

View File

@@ -1,6 +1,6 @@
"""Tests for Course run views"""
from __future__ import absolute_import
import datetime

View File

@@ -2,7 +2,7 @@
URLs for the Studio API [Course Run]
"""
from __future__ import absolute_import
from rest_framework.routers import DefaultRouter

View File

@@ -1,6 +1,6 @@
"""HTTP endpoints for the Course Run API."""
from __future__ import absolute_import
from django.conf import settings
from django.http import Http404

View File

@@ -3,7 +3,7 @@ CMS user tasks application configuration
Signal handlers are connected here.
"""
from __future__ import absolute_import
from django.apps import AppConfig

View File

@@ -1,7 +1,7 @@
"""
Receivers of signals sent from django-user-tasks
"""
from __future__ import absolute_import, print_function, unicode_literals
import logging

View File

@@ -2,7 +2,7 @@
Celery tasks used by cms_user_tasks
"""
from __future__ import absolute_import
from boto.exception import NoAuthHandlerFound
from celery.exceptions import MaxRetriesExceededError

View File

@@ -2,7 +2,7 @@
Unit tests for integration of the django-user-tasks app and its REST API.
"""
from __future__ import absolute_import, print_function, unicode_literals
import logging
from uuid import uuid4

View File

@@ -2,7 +2,7 @@
Admin site bindings for contentstore
"""
from __future__ import absolute_import
from config_models.admin import ConfigurationModelAdmin
from django.contrib import admin

View File

@@ -1,7 +1,7 @@
"""
Base test case for the course API views.
"""
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from rest_framework.test import APITestCase

View File

@@ -1,7 +1,7 @@
"""
Tests for the course import API views
"""
from __future__ import absolute_import
import os
import tarfile

View File

@@ -1,7 +1,7 @@
"""
Tests for the course import API views
"""
from __future__ import absolute_import
from rest_framework import status

View File

@@ -1,7 +1,7 @@
"""
Tests for the course import API views
"""
from __future__ import absolute_import
from datetime import datetime

View File

@@ -1,5 +1,5 @@
""" Course API URLs. """
from __future__ import absolute_import
from django.conf import settings
from django.conf.urls import url

View File

@@ -1,7 +1,7 @@
"""
APIs related to Course Import.
"""
from __future__ import absolute_import
import base64
import logging

View File

@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring
from __future__ import absolute_import
import logging
import time

View File

@@ -1,5 +1,5 @@
# pylint: disable=missing-docstring
from __future__ import absolute_import
import logging

View File

@@ -1,7 +1,7 @@
"""
Common utilities for Contentstore APIs.
"""
from __future__ import absolute_import
from contextlib import contextmanager

View File

@@ -4,7 +4,7 @@ Contentstore Application Configuration
Above-modulestore level signal handlers are connected here.
"""
from __future__ import absolute_import
from django.apps import AppConfig

View File

@@ -2,7 +2,7 @@
This module contains various configuration settings via
waffle switches for the contentstore app.
"""
from __future__ import absolute_import
from openedx.core.djangoapps.waffle_utils import CourseWaffleFlag, WaffleFlagNamespace, WaffleSwitchNamespace

View File

@@ -1,6 +1,6 @@
"""Util methods for Waffle checks"""
from __future__ import absolute_import
from cms.djangoapps.contentstore.config.waffle import ENABLE_CHECKLISTS_QUALITY

View File

@@ -1,7 +1,7 @@
"""
Class for manipulating groups configuration on a course object.
"""
from __future__ import absolute_import
import json
import logging

View File

@@ -12,7 +12,7 @@ Current db representation:
}
"""
from __future__ import absolute_import
import logging
import re

View File

@@ -1,5 +1,5 @@
""" Code to allow module store to interface with courseware index """
from __future__ import absolute_import
import logging
import re

View File

@@ -1,6 +1,6 @@
""" Upload file handler to help test progress bars in uploads. """
from __future__ import absolute_import
import time

View File

@@ -3,7 +3,7 @@ Utilities for export a course's XML into a git repository,
committing and pushing the changes.
"""
from __future__ import absolute_import
import logging
import os

View File

@@ -3,7 +3,7 @@ A single-use management command that provides an interactive way to remove
erroneous certificate names.
"""
from __future__ import absolute_import
from collections import namedtuple

View File

@@ -2,7 +2,7 @@
Script for removing all redundant Mac OS metadata files (with filename ".DS_Store"
or with filename which starts with "._") for all courses
"""
from __future__ import absolute_import
import logging

View File

@@ -1,7 +1,7 @@
"""
Django management command to create a course in a specific modulestore
"""
from __future__ import absolute_import
from datetime import datetime, timedelta

View File

@@ -1,7 +1,7 @@
"""
Management Command to delete course.
"""
from __future__ import absolute_import, print_function
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError

View File

@@ -1,5 +1,5 @@
"""Script for deleting orphans"""
from __future__ import absolute_import, print_function
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError

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 absolute_import, print_function
from django.core.management.base import BaseCommand, CommandError
from opaque_keys.edx.keys import CourseKey

View File

@@ -1,6 +1,6 @@
"""Script to Empty the trashcan"""
from __future__ import absolute_import
from django.core.management.base import BaseCommand
from opaque_keys.edx.keys import CourseKey

View File

@@ -1,7 +1,7 @@
"""
Script for exporting courseware from Mongo to a tar.gz file
"""
from __future__ import absolute_import, print_function
import os

View File

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

View File

@@ -1,7 +1,7 @@
"""
Script for exporting a content library from Mongo to a tar.gz file
"""
from __future__ import absolute_import, print_function
import os
import shutil

View File

@@ -14,7 +14,7 @@ At present, it differs from Studio exports in several ways:
* It only supports the export of courses. It does not export libraries.
"""
from __future__ import absolute_import
import os
import re

View File

@@ -1,7 +1,7 @@
"""
Script for fixing the item not found errors in a course
"""
from __future__ import absolute_import
from django.core.management.base import BaseCommand, CommandError
from opaque_keys.edx.keys import CourseKey

View File

@@ -1,7 +1,7 @@
"""
Script for force publishing a course
"""
from __future__ import absolute_import, print_function
from django.core.management.base import BaseCommand, CommandError
from opaque_keys import InvalidKeyError

View File

@@ -1,7 +1,7 @@
"""
Django management command to generate a test course from a course config json
"""
from __future__ import absolute_import
import json
import logging

View File

@@ -13,7 +13,7 @@ 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

View File

@@ -1,7 +1,7 @@
"""
Script for importing courseware from XML format
"""
from __future__ import absolute_import
from django.core.management.base import BaseCommand

View File

@@ -1,7 +1,7 @@
"""
Script for importing a content library from a tar.gz file
"""
from __future__ import absolute_import, print_function
import base64
import os

View File

@@ -2,7 +2,7 @@
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

View File

@@ -2,7 +2,7 @@
Command to migrate transcripts to django storage.
"""
from __future__ import absolute_import
import logging

View File

@@ -1,7 +1,7 @@
"""
Takes user input.
"""
from __future__ import absolute_import
import sys

View File

@@ -1,5 +1,5 @@
""" Management command to update courses' search index """
from __future__ import absolute_import
import logging
from textwrap import dedent

View File

@@ -1,5 +1,5 @@
""" Management command to update libraries' search index """
from __future__ import absolute_import, print_function
from textwrap import dedent

View File

@@ -1,6 +1,6 @@
"""Management command to restore assets from trash"""
from __future__ import absolute_import
from django.core.management.base import BaseCommand

View File

@@ -2,7 +2,7 @@
Test for assets cleanup of courses for Mac OS metadata files (with filename ".DS_Store"
or with filename which starts with "._")
"""
from __future__ import absolute_import
from django.conf import settings
from django.core.management import call_command

View File

@@ -1,7 +1,7 @@
"""
Unittests for creating a course in an chosen modulestore
"""
from __future__ import absolute_import
from six import StringIO

View File

@@ -1,7 +1,7 @@
"""
Delete course tests.
"""
from __future__ import absolute_import
import mock
from django.core.management import CommandError, call_command

View File

@@ -1,6 +1,6 @@
"""Tests running the delete_orphan command"""
from __future__ import absolute_import
import ddt
import six

View File

@@ -1,7 +1,7 @@
"""
Tests for exporting courseware to the desired path
"""
from __future__ import absolute_import
import shutil
import unittest

View File

@@ -1,7 +1,7 @@
"""
Test for export all courses.
"""
from __future__ import absolute_import
import shutil
from tempfile import mkdtemp

View File

@@ -2,7 +2,7 @@
Tests for exporting OLX content.
"""
from __future__ import absolute_import
import shutil
import tarfile

View File

@@ -2,7 +2,7 @@
Tests for the fix_not_found management command
"""
from __future__ import absolute_import
import six
from django.core.management import CommandError, call_command

View File

@@ -1,7 +1,7 @@
"""
Tests for the force_publish management command
"""
from __future__ import absolute_import
import mock
import six

View File

@@ -1,7 +1,7 @@
"""
Unittest for generate a test course in an given modulestore
"""
from __future__ import absolute_import
import json

View File

@@ -2,7 +2,7 @@
Unittests for exporting to git via management command.
"""
from __future__ import absolute_import
import copy
import os

View File

@@ -2,7 +2,7 @@
Unittests for importing a course via management command
"""
from __future__ import absolute_import
import os
import shutil

View File

@@ -1,7 +1,7 @@
"""
Unittests for migrating a course to split mongo
"""
from __future__ import absolute_import
import six

View File

@@ -2,7 +2,7 @@
"""
Tests for course transcript migration management command.
"""
from __future__ import absolute_import
import itertools
import logging

View File

@@ -1,5 +1,5 @@
""" Tests for course reindex command """
from __future__ import absolute_import
import ddt
import mock

View File

@@ -1,5 +1,5 @@
""" Tests for library reindex command """
from __future__ import absolute_import
import ddt
import mock

View File

@@ -2,7 +2,7 @@
"""
Tests for course video thumbnails management command.
"""
from __future__ import absolute_import
import logging

View File

@@ -1,7 +1,7 @@
"""
Common methods for cms commands to use
"""
from __future__ import absolute_import
from django.contrib.auth.models import User
from opaque_keys.edx.keys import CourseKey

View File

@@ -1,7 +1,7 @@
"""
Command to scrape thumbnails and add them to the course-videos.
"""
from __future__ import absolute_import
import logging

View File

@@ -1,7 +1,7 @@
"""
Verify the structure of courseware as to it's suitability for import
"""
from __future__ import absolute_import, print_function
from argparse import REMAINDER

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import django.db.models.deletion
from django.conf import settings

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import django.db.models.deletion
from django.conf import settings

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.22 on 2019-07-26 20:12
from __future__ import unicode_literals
from django.db import migrations

View File

@@ -2,7 +2,7 @@
Models for contentstore
"""
from __future__ import absolute_import
from config_models.models import ConfigurationModel
from django.db.models.fields import TextField

View File

@@ -2,7 +2,7 @@
Code related to the handling of Proctored Exams in Studio
"""
from __future__ import absolute_import
import logging

View File

@@ -2,7 +2,7 @@
Authorization rules related to content management.
"""
from __future__ import absolute_import, unicode_literals
import user_tasks.rules

View File

@@ -1,6 +1,6 @@
""" receivers of course_published and library_updated events in order to trigger indexing task """
from __future__ import absolute_import
import logging
from datetime import datetime

View File

@@ -1,7 +1,7 @@
"""
Contentstore signals
"""
from __future__ import absolute_import
from django.dispatch import Signal

View File

@@ -1,7 +1,7 @@
"""
Storage backend for course import and export.
"""
from __future__ import absolute_import
from django.conf import settings
from django.core.files.storage import get_storage_class

View File

@@ -1,7 +1,7 @@
"""
This file contains celery tasks for contentstore views
"""
from __future__ import absolute_import
import base64
import json

View File

@@ -1,7 +1,7 @@
"""
Unit tests for cloning a course between the same and different module stores.
"""
from __future__ import absolute_import
import json

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import copy
import shutil

View File

@@ -2,7 +2,7 @@
Tests core caching facilities.
"""
from __future__ import absolute_import
from django.test import TestCase
from opaque_keys.edx.locator import AssetLocator, CourseLocator

View File

@@ -1,7 +1,7 @@
"""
Test view handler for rerun (and eventually create)
"""
from __future__ import absolute_import
import datetime

View File

@@ -2,7 +2,7 @@
Unit tests for getting the list of courses for a user through iterating all courses and
by reversing group name formats.
"""
from __future__ import absolute_import
import random

View File

@@ -1,7 +1,7 @@
"""
Tests for Studio Course Settings.
"""
from __future__ import absolute_import
import copy
import datetime

View File

@@ -1,7 +1,7 @@
"""
Testing indexing of the courseware as it is changed
"""
from __future__ import absolute_import, print_function
import json
import time

View File

@@ -1,6 +1,6 @@
"""Tests for CRUD Operations"""
from __future__ import absolute_import
from xmodule import templates
from xmodule.capa_module import ProblemBlock

View File

@@ -2,7 +2,7 @@
Test the ability to export courses to xml from studio
"""
from __future__ import absolute_import
import copy
import os

View File

@@ -1,7 +1,7 @@
"""
Unit tests for the gating feature in Studio
"""
from __future__ import absolute_import
from milestones.tests.utils import MilestonesTestCaseMixin
from mock import patch

View File

@@ -2,7 +2,7 @@
"""
Tests for validate Internationalization and Module i18n service.
"""
from __future__ import absolute_import
import gettext
from unittest import skip

View File

@@ -3,7 +3,7 @@
"""
Tests for import_course_from_xml using the mongo modulestore.
"""
from __future__ import absolute_import, print_function
import copy
from uuid import uuid4

View File

@@ -1,7 +1,7 @@
"""
Tests Draft import order.
"""
from __future__ import absolute_import
from django.conf import settings

View File

@@ -2,7 +2,7 @@
Integration tests for importing courses containing pure XBlocks.
"""
from __future__ import absolute_import
from django.conf import settings
from xblock.core import XBlock

Some files were not shown because too many files have changed in this diff Show More