Pylint fixes to make diff-quality happy
This commit is contained in:
@@ -14,7 +14,6 @@ from django.core.cache import get_cache, InvalidCacheBackendError
|
||||
import django.utils
|
||||
|
||||
import re
|
||||
import threading
|
||||
|
||||
from xmodule.util.django import get_current_request_hostname
|
||||
import xmodule.modulestore # pylint: disable=unused-import
|
||||
@@ -53,13 +52,13 @@ def load_function(path):
|
||||
|
||||
|
||||
def create_modulestore_instance(
|
||||
engine,
|
||||
content_store,
|
||||
doc_store_config,
|
||||
options,
|
||||
i18n_service=None,
|
||||
fs_service=None,
|
||||
user_service=None,
|
||||
engine,
|
||||
content_store,
|
||||
doc_store_config,
|
||||
options,
|
||||
i18n_service=None,
|
||||
fs_service=None,
|
||||
user_service=None,
|
||||
):
|
||||
"""
|
||||
This will return a new instance of a modulestore given an engine and options
|
||||
|
||||
@@ -100,15 +100,15 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
|
||||
ModuleStore knows how to route requests to the right persistence ms
|
||||
"""
|
||||
def __init__(
|
||||
self,
|
||||
contentstore,
|
||||
mappings,
|
||||
stores,
|
||||
i18n_service=None,
|
||||
fs_service=None,
|
||||
user_service=None,
|
||||
create_modulestore_instance=None,
|
||||
**kwargs
|
||||
self,
|
||||
contentstore,
|
||||
mappings,
|
||||
stores,
|
||||
i18n_service=None,
|
||||
fs_service=None,
|
||||
user_service=None,
|
||||
create_modulestore_instance=None,
|
||||
**kwargs
|
||||
):
|
||||
"""
|
||||
Initialize a MixedModuleStore. Here we look into our passed in kwargs which should be a
|
||||
@@ -314,7 +314,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
|
||||
|
||||
:param course_key: must be a CourseKey
|
||||
"""
|
||||
assert(isinstance(course_key, CourseKey))
|
||||
assert isinstance(course_key, CourseKey)
|
||||
store = self._get_modulestore_for_courseid(course_key)
|
||||
try:
|
||||
return store.get_course(course_key, depth=depth, **kwargs)
|
||||
@@ -351,7 +351,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
|
||||
* ignore_case (bool): If True, do a case insensitive search. If
|
||||
False, do a case sensitive search
|
||||
"""
|
||||
assert(isinstance(course_id, CourseKey))
|
||||
assert isinstance(course_id, CourseKey)
|
||||
store = self._get_modulestore_for_courseid(course_id)
|
||||
return store.has_course(course_id, ignore_case, **kwargs)
|
||||
|
||||
@@ -359,7 +359,7 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase):
|
||||
"""
|
||||
See xmodule.modulestore.__init__.ModuleStoreWrite.delete_course
|
||||
"""
|
||||
assert(isinstance(course_key, CourseKey))
|
||||
assert isinstance(course_key, CourseKey)
|
||||
store = self._get_modulestore_for_courseid(course_key)
|
||||
return store.delete_course(course_key, user_id)
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ class CachingDescriptorSystem(MakoDescriptorSystem, EditInfoRuntimeMixin):
|
||||
# decache any computed pending field settings
|
||||
module.save()
|
||||
return module
|
||||
except:
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.warning("Failed to load descriptor from %s", json_data, exc_info=True)
|
||||
return ErrorDescriptor.from_json(
|
||||
json_data,
|
||||
@@ -937,7 +937,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
|
||||
"""
|
||||
Get the course with the given courseid (org/course/run)
|
||||
"""
|
||||
assert(isinstance(course_key, CourseKey))
|
||||
assert isinstance(course_key, CourseKey)
|
||||
course_key = self.fill_in_run(course_key)
|
||||
location = course_key.make_usage_key('course', course_key.run)
|
||||
try:
|
||||
@@ -954,7 +954,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
|
||||
If ignore_case is True, do a case insensitive search,
|
||||
otherwise, do a case sensitive search
|
||||
"""
|
||||
assert(isinstance(course_key, CourseKey))
|
||||
assert isinstance(course_key, CourseKey)
|
||||
if isinstance(course_key, LibraryLocator):
|
||||
return None # Libraries require split mongo
|
||||
course_key = self.fill_in_run(course_key)
|
||||
@@ -1606,7 +1606,7 @@ class MongoModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase, Mongo
|
||||
elif isinstance(course_assets['assets'], list):
|
||||
# This record is in the old course assets format.
|
||||
# Ensure that no data exists before updating the format.
|
||||
assert(len(course_assets['assets']) == 0)
|
||||
assert len(course_assets['assets']) == 0
|
||||
# Update the format to a dict.
|
||||
self.asset_collection.update(
|
||||
{'_id': doc_id},
|
||||
|
||||
@@ -28,13 +28,13 @@ def load_function(path):
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def create_modulestore_instance(
|
||||
engine,
|
||||
contentstore,
|
||||
doc_store_config,
|
||||
options,
|
||||
i18n_service=None,
|
||||
fs_service=None,
|
||||
user_service=None
|
||||
engine,
|
||||
contentstore,
|
||||
doc_store_config,
|
||||
options,
|
||||
i18n_service=None,
|
||||
fs_service=None,
|
||||
user_service=None
|
||||
):
|
||||
"""
|
||||
This will return a new instance of a modulestore given an engine and options
|
||||
@@ -77,7 +77,7 @@ class MixedSplitTestCase(TestCase):
|
||||
Stripped-down version of ModuleStoreTestCase that can be used without Django
|
||||
(i.e. for testing in common/lib/ ). Sets up MixedModuleStore and Split.
|
||||
"""
|
||||
RENDER_TEMPLATE = lambda t_n, d, ctx = None, nsp = 'main': u'{}: {}, {}'.format(t_n, repr(d), repr(ctx))
|
||||
RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': u'{}: {}, {}'.format(t_n, repr(d), repr(ctx))
|
||||
modulestore_options = {
|
||||
'default_class': 'xmodule.raw_module.RawDescriptor',
|
||||
'fs_root': DATA_DIR,
|
||||
|
||||
@@ -64,7 +64,8 @@ class ImportSystem(XMLParsingSystem, MakoDescriptorSystem):
|
||||
self.unnamed = defaultdict(int) # category -> num of new url_names for that category
|
||||
self.used_names = defaultdict(set) # category -> set of used url_names
|
||||
|
||||
# cdodge: adding the course_id as passed in for later reference rather than having to recomine the org/course/url_name
|
||||
# Adding the course_id as passed in for later reference rather than
|
||||
# having to recombine the org/course/url_name
|
||||
self.course_id = course_id
|
||||
self.load_error_modules = load_error_modules
|
||||
self.modulestore = xmlstore
|
||||
@@ -292,8 +293,8 @@ class XMLModuleStore(ModuleStoreReadBase):
|
||||
An XML backed ModuleStore
|
||||
"""
|
||||
def __init__(
|
||||
self, data_dir, default_class=None, course_dirs=None, course_ids=None,
|
||||
load_error_modules=True, i18n_service=None, fs_service=None, user_service=None, **kwargs
|
||||
self, data_dir, default_class=None, course_dirs=None, course_ids=None,
|
||||
load_error_modules=True, i18n_service=None, fs_service=None, user_service=None, **kwargs
|
||||
):
|
||||
"""
|
||||
Initialize an XMLModuleStore from data_dir
|
||||
@@ -304,8 +305,8 @@ class XMLModuleStore(ModuleStoreReadBase):
|
||||
default_class (str): dot-separated string defining the default descriptor
|
||||
class to use if none is specified in entry_points
|
||||
|
||||
course_dirs or course_ids (list of str): If specified, the list of course_dirs or course_ids to load. Otherwise,
|
||||
load all courses. Note, providing both
|
||||
course_dirs or course_ids (list of str): If specified, the list of course_dirs or course_ids to load.
|
||||
Otherwise, load all courses. Note, providing both
|
||||
"""
|
||||
super(XMLModuleStore, self).__init__(**kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user