Merge pull request #9502 from edx/ned/import-path-differently
Change imports from path to use the stablest name.
This commit is contained in:
@@ -5,7 +5,7 @@ to the archive format used by a different version of export.
|
||||
Sample invocation: ./manage.py export_convert_format mycourse.tar.gz ~/newformat/
|
||||
"""
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.core.management import call_command, CommandError
|
||||
from django.conf import settings
|
||||
from tempfile import mkdtemp
|
||||
import shutil
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from contentstore.management.commands.export_convert_format import Command, extract_source
|
||||
from xmodule.tests.helpers import directories_equal
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Unittests for importing a course via management command
|
||||
"""
|
||||
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import shutil
|
||||
import tempfile
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import ddt
|
||||
from datetime import timedelta
|
||||
from fs.osfs import OSFS
|
||||
from json import loads
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from textwrap import dedent
|
||||
from uuid import uuid4
|
||||
from functools import wraps
|
||||
|
||||
@@ -8,7 +8,7 @@ import os
|
||||
import re
|
||||
import shutil
|
||||
import tarfile
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from tempfile import mkdtemp
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
@@ -9,7 +9,7 @@ import os
|
||||
import shutil
|
||||
import tarfile
|
||||
import tempfile
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from uuid import uuid4
|
||||
|
||||
from django.test.utils import override_settings
|
||||
|
||||
@@ -18,7 +18,7 @@ from .common import *
|
||||
from openedx.core.lib.logsettings import get_logger_config
|
||||
import os
|
||||
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed
|
||||
|
||||
# SERVICE_VARIANT specifies name of the variant used, which decides what JSON
|
||||
|
||||
@@ -11,7 +11,7 @@ from the same directory.
|
||||
"""
|
||||
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
# Pylint gets confused by path.py instances, which report themselves as class
|
||||
# objects. As a result, pylint applies the wrong regex in validating names,
|
||||
|
||||
@@ -46,7 +46,7 @@ from lms.envs.common import (
|
||||
# display credit eligibility table on the CMS or not.
|
||||
ENABLE_CREDIT_ELIGIBILITY, YOUTUBE_API_KEY
|
||||
)
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from warnings import simplefilter
|
||||
|
||||
from lms.djangoapps.lms_xblock.mixin import LmsBlockMixin
|
||||
|
||||
@@ -20,7 +20,7 @@ sessions. Assumes structure:
|
||||
|
||||
from .common import *
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from warnings import filterwarnings, simplefilter
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ from openedx.core.lib.logsettings import get_logger_config
|
||||
from util.config_parse import convert_tokens
|
||||
import os
|
||||
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed
|
||||
|
||||
# https://stackoverflow.com/questions/2890146/how-to-force-pyyaml-to-load-strings-as-unicode-objects
|
||||
|
||||
@@ -7,7 +7,7 @@ from __future__ import unicode_literals
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from cStringIO import StringIO
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Test for asset XML generation / parsing.
|
||||
"""
|
||||
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from lxml import etree
|
||||
from contracts import ContractNotRespected
|
||||
import unittest
|
||||
|
||||
@@ -5,7 +5,7 @@ import logging
|
||||
from cStringIO import StringIO
|
||||
from math import exp
|
||||
from lxml import etree
|
||||
from path import path # NOTE (THK): Only used for detecting presence of syllabus
|
||||
from path import Path as path
|
||||
import requests
|
||||
from datetime import datetime
|
||||
import dateutil.parser
|
||||
|
||||
@@ -5,7 +5,7 @@ import copy
|
||||
import logging
|
||||
import textwrap
|
||||
from lxml import etree
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from fs.errors import ResourceNotFoundError
|
||||
from pkg_resources import resource_string
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ from bson.son import SON
|
||||
from datetime import datetime
|
||||
from fs.osfs import OSFS
|
||||
from mongodb_proxy import MongoProxy, autoretry_read
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from pytz import UTC
|
||||
from contracts import contract, new_contract
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""
|
||||
Performance test for asset metadata in the modulestore.
|
||||
"""
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import unittest
|
||||
from tempfile import mkdtemp
|
||||
import itertools
|
||||
|
||||
@@ -60,7 +60,7 @@ import logging
|
||||
from contracts import contract, new_contract
|
||||
from importlib import import_module
|
||||
from mongodb_proxy import autoretry_read
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from pytz import UTC
|
||||
from bson.objectid import ObjectId
|
||||
|
||||
|
||||
@@ -130,18 +130,18 @@ class TestContentstore(unittest.TestCase):
|
||||
Test export
|
||||
"""
|
||||
self.set_up_assets(deprecated)
|
||||
root_dir = path.path(mkdtemp())
|
||||
root_dir = path.Path(mkdtemp())
|
||||
try:
|
||||
self.contentstore.export_all_for_course(
|
||||
self.course1_key, root_dir,
|
||||
path.path(root_dir / "policy.json"),
|
||||
path.Path(root_dir / "policy.json"),
|
||||
)
|
||||
for filename in self.course1_files:
|
||||
filepath = path.path(root_dir / filename)
|
||||
filepath = path.Path(root_dir / filename)
|
||||
self.assertTrue(filepath.isfile(), "{} is not a file".format(filepath))
|
||||
for filename in self.course2_files:
|
||||
if filename not in self.course1_files:
|
||||
filepath = path.path(root_dir / filename)
|
||||
filepath = path.Path(root_dir / filename)
|
||||
self.assertFalse(filepath.isfile(), "{} is unexpected exported a file".format(filepath))
|
||||
finally:
|
||||
shutil.rmtree(root_dir)
|
||||
|
||||
@@ -14,7 +14,7 @@ and then for each combination of modulestores, performing the sequence:
|
||||
from contextlib import contextmanager, nested
|
||||
import itertools
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import random
|
||||
from shutil import rmtree
|
||||
from tempfile import mkdtemp
|
||||
|
||||
@@ -7,7 +7,7 @@ Unit tests for the Mongo modulestore
|
||||
from nose.tools import assert_equals, assert_raises, \
|
||||
assert_not_equals, assert_false, assert_true, assert_greater, assert_is_instance, assert_is_none
|
||||
# pylint: enable=E0611
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import pymongo
|
||||
import logging
|
||||
import shutil
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from mock import patch
|
||||
import datetime
|
||||
from importlib import import_module
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import random
|
||||
import re
|
||||
import unittest
|
||||
|
||||
@@ -12,7 +12,7 @@ from cStringIO import StringIO
|
||||
from fs.osfs import OSFS
|
||||
from importlib import import_module
|
||||
from lxml import etree
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from contextlib import contextmanager
|
||||
from lazy import lazy
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ from fs.osfs import OSFS
|
||||
from json import dumps
|
||||
import json
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import shutil
|
||||
from xmodule.modulestore.draft_and_published import DIRECT_ONLY_CATEGORIES
|
||||
from opaque_keys.edx.locator import CourseLocator, LibraryLocator
|
||||
|
||||
@@ -25,7 +25,7 @@ from abc import abstractmethod
|
||||
from opaque_keys.edx.locator import LibraryLocator
|
||||
import os
|
||||
import mimetypes
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import json
|
||||
import re
|
||||
from lxml import etree
|
||||
|
||||
@@ -11,7 +11,7 @@ import errno
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from docopt import docopt
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from xmodule.x_module import XModuleDescriptor
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from functools import wraps
|
||||
from lazy import lazy
|
||||
from mock import Mock, patch
|
||||
from operator import attrgetter
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey
|
||||
from xblock.field_data import DictFieldData
|
||||
|
||||
@@ -3,7 +3,7 @@ Utility methods for unit tests.
|
||||
"""
|
||||
|
||||
import filecmp
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
|
||||
def directories_equal(directory1, directory2):
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import os
|
||||
import unittest
|
||||
import ddt
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from xmodule.contentstore.content import StaticContent, StaticContentStream
|
||||
from xmodule.contentstore.content import ContentStore
|
||||
from opaque_keys.edx.locations import SlashSeparatedCourseKey, AssetLocation
|
||||
|
||||
@@ -14,7 +14,7 @@ import uuid
|
||||
|
||||
from datetime import datetime, timedelta, tzinfo
|
||||
from fs.osfs import OSFS
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from tempfile import mkdtemp
|
||||
from textwrap import dedent
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import datetime
|
||||
|
||||
from textwrap import dedent
|
||||
from collections import namedtuple
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Course Textbooks page.
|
||||
"""
|
||||
|
||||
import requests
|
||||
from path import path # pylint: disable=no-name-in-module
|
||||
from path import Path as path
|
||||
from .course_page import CoursePage
|
||||
from .utils import click_css
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import os
|
||||
import urlparse
|
||||
from contextlib import contextmanager
|
||||
from datetime import datetime
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from bok_choy.javascript import js_defined
|
||||
from bok_choy.web_app_test import WebAppTest
|
||||
from bok_choy.promise import EmptyPromise, Promise
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import sys
|
||||
import mock
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import sys
|
||||
import mock
|
||||
|
||||
|
||||
@@ -5,8 +5,7 @@ from django.core.files.images import ImageFile
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from nose.plugins.attrib import attr
|
||||
# pylint: disable=no-name-in-module
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from certificates.models import (
|
||||
|
||||
@@ -3,7 +3,7 @@ from fs.errors import ResourceNotFoundError
|
||||
import logging
|
||||
import inspect
|
||||
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from django.http import Http404
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import sys
|
||||
import traceback
|
||||
|
||||
from fs.osfs import OSFS
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import tarfile
|
||||
from tempfile import mktemp, mkdtemp
|
||||
from textwrap import dedent
|
||||
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import json
|
||||
from nose.plugins.attrib import attr
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import shutil
|
||||
from StringIO import StringIO
|
||||
import tarfile
|
||||
|
||||
@@ -28,7 +28,7 @@ from django.views.decorators.http import condition
|
||||
from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from edxmako.shortcuts import render_to_response
|
||||
import mongoengine
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from courseware.courses import get_course_by_id
|
||||
import dashboard.git_import as git_import
|
||||
|
||||
@@ -10,7 +10,7 @@ of each of its fields (including those fields that are set as default values).
|
||||
from __future__ import print_function
|
||||
|
||||
import json
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.conf import settings
|
||||
|
||||
@@ -9,7 +9,7 @@ import os
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import Group
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from lxml import etree
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ from .common import *
|
||||
from openedx.core.lib.logsettings import get_logger_config
|
||||
import os
|
||||
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from xmodule.modulestore.modulestore_settings import convert_module_store_setting_if_needed
|
||||
|
||||
# SERVICE_VARIANT specifies name of the variant used, which decides what JSON
|
||||
|
||||
@@ -11,7 +11,7 @@ from the same directory.
|
||||
"""
|
||||
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from tempfile import mkdtemp
|
||||
|
||||
# Pylint gets confused by path.py instances, which report themselves as class
|
||||
|
||||
@@ -33,7 +33,7 @@ import sys
|
||||
import os
|
||||
import imp
|
||||
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from warnings import simplefilter
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ sessions. Assumes structure:
|
||||
|
||||
from .common import *
|
||||
import os
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from uuid import uuid4
|
||||
from warnings import filterwarnings, simplefilter
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from openedx.core.lib.logsettings import get_logger_config
|
||||
from util.config_parse import convert_tokens
|
||||
import os
|
||||
|
||||
from path import path
|
||||
from path import Path as path
|
||||
|
||||
# https://stackoverflow.com/questions/2890146/how-to-force-pyyaml-to-load-strings-as-unicode-objects
|
||||
from yaml import Loader, SafeLoader
|
||||
|
||||
@@ -3,7 +3,7 @@ Internationalization tasks
|
||||
"""
|
||||
import sys
|
||||
import subprocess
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from paver.easy import task, cmdopts, needs, sh
|
||||
|
||||
try:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Tests for paver quality tasks
|
||||
"""
|
||||
import os
|
||||
from path import path # pylint: disable=no-name-in-module
|
||||
from path import Path as path
|
||||
import tempfile
|
||||
import unittest
|
||||
from mock import patch, MagicMock, mock_open
|
||||
|
||||
@@ -6,7 +6,7 @@ import os
|
||||
import sys
|
||||
import json
|
||||
from lazy import lazy
|
||||
from path import path
|
||||
from path import Path as path
|
||||
import memcache
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ set -e
|
||||
###############################################################################
|
||||
|
||||
# Violations thresholds for failing the build
|
||||
export PYLINT_THRESHOLD=6275
|
||||
export PYLINT_THRESHOLD=6175
|
||||
export JSHINT_THRESHOLD=3700
|
||||
|
||||
doCheckVars() {
|
||||
|
||||
@@ -14,7 +14,7 @@ import json
|
||||
import getpass
|
||||
|
||||
try:
|
||||
from path import path
|
||||
from path import Path as path
|
||||
from git import Repo, Commit
|
||||
from git.refs.symbolic import SymbolicReference
|
||||
from dateutil.parser import parse as parse_datestring
|
||||
|
||||
Reference in New Issue
Block a user