Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f35478e
Fix Pylint: E0101(return-in-init)
stvstnfrd Feb 16, 2015
3311ce9
Fix Pylint: E0211(no-method-argument)
stvstnfrd Feb 16, 2015
6389c6f
Fix Pylint: C0103(invalid-name)
stvstnfrd Feb 16, 2015
1ffd1f1
Fix Pylint: W0611(unused-import)
stvstnfrd Feb 16, 2015
17d0f0e
Fix Pylint: W0105(pointless-string-statement)
stvstnfrd Feb 16, 2015
b5516a2
Fix Pylint: W0108(unnecessary-lambda)
stvstnfrd Feb 16, 2015
1185ef5
Fix Pylint: W1304(unused-format-string-argument)
stvstnfrd Feb 16, 2015
71d0b17
Fix Pylint: W1503(redundant-unittest-assert)
stvstnfrd Feb 16, 2015
b236f11
Fix Pylint: E1305(too-many-format-args)
stvstnfrd Feb 16, 2015
5fdbf55
Fix Pylint: C0112(empty-docstring)
stvstnfrd Feb 16, 2015
0a06f1f
Fix Pylint: C0326(bad-whitespace)
stvstnfrd Feb 16, 2015
3365249
Fix Pylint: W1201(logging-not-lazy)
stvstnfrd Feb 16, 2015
2acf19b
Fix Pylint: C0330(bad-continuation)
stvstnfrd Feb 16, 2015
e063c10
Fix Pylint: W0107(unnecessary-pass)
stvstnfrd Feb 16, 2015
3feb6d9
Fix Pylint: W0109(duplicate-key)
stvstnfrd Feb 16, 2015
25ef633
Fix Pylint: W0403(relative-import)
stvstnfrd Feb 16, 2015
0f97b01
Fix Pylint: E1102(not-callable)
stvstnfrd Feb 16, 2015
a8c7792
Fix Pylint: W0612(unused-variable)
stvstnfrd Feb 16, 2015
453a183
Fix Pylint: E1121(too-many-function-args)
stvstnfrd Feb 16, 2015
fd5d54d
Fix Pylint: F0010(parse-error)
stvstnfrd Feb 16, 2015
693b070
Fix Pylint: I0010(bad-inline-option)
stvstnfrd Feb 16, 2015
e35a5c4
Fix Pylint: I0022(deprecated-pragma)
stvstnfrd Feb 16, 2015
382508e
Fix Pylint: C0202(bad-classmethod-argument)
stvstnfrd Feb 16, 2015
36be46a
Fix Pylint: W0631(undefined-loop-variable)
stvstnfrd Feb 16, 2015
831eda9
Fix Pylint: E0012(bad-option-value)
stvstnfrd Feb 16, 2015
b516253
Fix Pylint: W0102(dangerous-default-value)
stvstnfrd Feb 16, 2015
835ed3f
Fix Pylint: C1001(old-style-class)
stvstnfrd Feb 16, 2015
1d1498f
Fix Pylint: W0622(redefined-builtin)
stvstnfrd Feb 16, 2015
a9f4fff
Fix Pylint: W0702(bare-except)
stvstnfrd Feb 16, 2015
389991d
Fix Pylint: E0110(abstract-class-instantiated)
stvstnfrd Feb 16, 2015
6bf71d1
Fix Pylint: W0613(unused-argument)
stvstnfrd Feb 16, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cms/djangoapps/contentstore/git_export_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ def export_to_git(course_id, repo, user='', rdir=None):
ident = GIT_EXPORT_DEFAULT_IDENT
time_stamp = timezone.now()
cwd = os.path.abspath(rdirp)
commit_msg = 'Export from Studio at {1}'.format(user, time_stamp)
commit_msg = "Export from Studio at {time_stamp}".format(
time_stamp=time_stamp,
)
try:
cmd_log(['git', 'config', 'user.email', ident['email']], cwd)
cmd_log(['git', 'config', 'user.name', ident['name']], cwd)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ def parse_args(self, *args):
try:
user = user_from_str(args[1])
except User.DoesNotExist:
raise CommandError("No user {} found: expected args are ".format(args[1], self.args))
raise CommandError(
"No user {user} found: expected args are {args}".format(
user=args[1],
args=self.args,
),
)

org = args[2]
course = args[3]
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/management/commands/import.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def handle(self, *args, **options):
self.stdout.write("Importing. Data_dir={data}, course_dirs={courses}\n".format(
data=data_dir,
courses=course_dirs,
dis=do_import_static))
))
mstore = modulestore()

course_items = import_from_xml(
Expand Down
6 changes: 4 additions & 2 deletions cms/djangoapps/contentstore/tests/test_contentstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -1728,8 +1728,10 @@ def test_rerun_with_permission_denied(self):
def test_rerun_error(self):
error_message = "Mock Error Message"
with mock.patch(
'xmodule.modulestore.mixed.MixedModuleStore.clone_course',
mock.Mock(side_effect=Exception(error_message))
'xmodule.modulestore.mixed.MixedModuleStore.clone_course',
mock.Mock(
side_effect=Exception(error_message),
),
):
source_course = CourseFactory.create()
destination_course_key = self.post_rerun_request(source_course.id)
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/tests/test_core_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from django.test import TestCase


class Content:
class Content(object):
def __init__(self, location, content):
self.location = location
self.content = content
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/tests/test_course_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from django.test import RequestFactory

from contentstore.views.course import _accessible_courses_list, _accessible_courses_list_from_groups, AccessListFallback
from contentstore.utils import delete_course_and_groups, reverse_course_url
from contentstore.utils import delete_course_and_groups
from contentstore.tests.utils import AjaxEnabledTestClient
from student.tests.factories import UserFactory
from student.roles import CourseInstructorRole, CourseStaffRole, GlobalStaff, OrgStaffRole, OrgInstructorRole
Expand Down
1 change: 0 additions & 1 deletion cms/djangoapps/contentstore/tests/test_orphan.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import json
from contentstore.tests.utils import CourseTestCase
from student.models import CourseEnrollment
from xmodule.modulestore.django import modulestore
from contentstore.utils import reverse_course_url


Expand Down
2 changes: 0 additions & 2 deletions cms/djangoapps/contentstore/tests/test_transcripts_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import textwrap
from mock import patch, Mock

from pymongo import MongoClient

from django.test.utils import override_settings
from django.conf import settings
from django.utils import translation
Expand Down
1 change: 0 additions & 1 deletion cms/djangoapps/contentstore/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from opaque_keys.edx.locations import SlashSeparatedCourseKey

from xmodule.modulestore.django import modulestore
from opaque_keys.edx.locator import CourseLocator


class LMSLinksTestCase(TestCase):
Expand Down
2 changes: 0 additions & 2 deletions cms/djangoapps/contentstore/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django.conf import settings
from django.contrib.auth.models import User
from django.test.client import Client
from django.test.utils import override_settings
from opaque_keys.edx.locations import SlashSeparatedCourseKey, AssetLocation

from contentstore.utils import reverse_url
Expand All @@ -17,7 +16,6 @@
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.inheritance import own_metadata
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.xml_importer import import_from_xml

Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/views/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _update_asset(request, course_key, asset_key):
contentstore().delete(thumbnail_content.get_id())
# remove from any caching
del_cached_content(thumbnail_location)
except:
except Exception:
logging.warning('Could not delete thumbnail: %s', thumbnail_location)

# delete the original
Expand Down
12 changes: 6 additions & 6 deletions cms/djangoapps/contentstore/views/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@
from django.utils.translation import ugettext as _
from models.settings.course_grading import CourseGradingModel

__all__ = ['OPEN_ENDED_COMPONENT_TYPES',
'ADVANCED_COMPONENT_POLICY_KEY',
'container_handler',
'component_handler'
]
__all__ = [
'OPEN_ENDED_COMPONENT_TYPES',
'ADVANCED_COMPONENT_POLICY_KEY',
'container_handler',
'component_handler'
]

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -331,7 +332,6 @@ def create_template_dict(name, cat, boilerplate_name=None, is_common=False):
"Advanced component %s does not exist. It will not be added to the Studio new component menu.",
category
)
pass
else:
log.error(
"Improper format for course advanced keys! %s",
Expand Down
15 changes: 11 additions & 4 deletions cms/djangoapps/contentstore/views/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,8 +653,15 @@ def _create_or_rerun_course(request):
'course number so that it is unique.'),
})
except InvalidKeyError as error:
return JsonResponse({
"ErrMsg": _("Unable to create course '{name}'.\n\n{err}").format(name=display_name, err=error.message)}
return JsonResponse(
{
'ErrMsg': _(
"Unable to create course '{name}'.\n\n{err}"
).format(
name=display_name,
err=error.message,
),
},
)


Expand Down Expand Up @@ -804,7 +811,7 @@ def course_info_update_handler(request, course_key_string, provided_id=None):
elif request.method == 'DELETE':
try:
return JsonResponse(delete_course_update(usage_key, request.json, provided_id, request.user))
except:
except Exception:
return HttpResponseBadRequest(
"Failed to delete",
content_type="text/plain"
Expand All @@ -813,7 +820,7 @@ def course_info_update_handler(request, course_key_string, provided_id=None):
elif request.method in ('POST', 'PUT'):
try:
return JsonResponse(update_course_updates(usage_key, request.json, provided_id, request.user))
except:
except Exception:
return HttpResponseBadRequest(
"Failed to save",
content_type="text/plain"
Expand Down
1 change: 0 additions & 1 deletion cms/djangoapps/contentstore/views/entrance_exam.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from django.contrib.auth.decorators import login_required
from django_future.csrf import ensure_csrf_cookie
from django.http import HttpResponse
from django.test import RequestFactory

from contentstore.views.helpers import create_xblock
from contentstore.views.item import delete_item
Expand Down
4 changes: 2 additions & 2 deletions cms/djangoapps/contentstore/views/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from xblock.fragment import Fragment

import xmodule
from xmodule.tabs import StaticTab, CourseTabList
from xmodule.tabs import CourseTabList
from xmodule.modulestore import ModuleStoreEnum, EdxJSONEncoder
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError, InvalidLocationError
Expand All @@ -47,7 +47,7 @@
from edxmako.shortcuts import render_to_string
from models.settings.course_grading import CourseGradingModel
from cms.lib.xblock.runtime import handler_url, local_resource_url
from opaque_keys.edx.keys import UsageKey, CourseKey
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import LibraryUsageLocator
from cms.lib.xblock.authoring_mixin import VISIBILITY_VIEW

Expand Down
1 change: 0 additions & 1 deletion cms/djangoapps/contentstore/views/tests/test_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from mock import Mock
from xblock.core import XBlock

from django.test import TestCase
from django.test.client import RequestFactory

from xblock.core import XBlockAside
Expand Down
1 change: 0 additions & 1 deletion cms/djangoapps/contentstore/views/tests/test_tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import json
from contentstore.views import tabs
from contentstore.tests.utils import CourseTestCase
from django.test import TestCase
from xmodule.x_module import STUDENT_VIEW
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from uuid import uuid4
import copy
import textwrap
from pymongo import MongoClient

from django.core.urlresolvers import reverse
from django.test.utils import override_settings
Expand Down
6 changes: 3 additions & 3 deletions cms/djangoapps/contentstore/views/videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ def videos_post(course, request):
edx_video_id = unicode(uuid4())
key = storage_service_key(bucket, file_name=edx_video_id)
for metadata_name, value in [
("course_video_upload_token", course_video_upload_token),
("client_video_id", file_name),
("course_key", unicode(course.id)),
('course_video_upload_token', course_video_upload_token),
('client_video_id', file_name),
('course_key', unicode(course.id)),
]:
key.set_metadata(metadata_name, value)
upload_url = key.generate_url(
Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/contentstore/views/xblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def xblock_resource(request, block_type, uri): # pylint: disable=unused-argumen
except IOError:
log.info('Failed to load xblock resource', exc_info=True)
raise Http404
except Exception: # pylint: disable-msg=broad-except
except Exception: # pylint: disable=broad-except
log.error('Failed to load xblock resource', exc_info=True)
raise Http404

Expand Down
2 changes: 1 addition & 1 deletion cms/djangoapps/course_creators/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def send_user_notification_callback(sender, **kwargs):

try:
user.email_user(subject, message, studio_request_email)
except:
except Exception:
log.warning("Unable to send course creator status e-mail to %s", user.email)


Expand Down
28 changes: 15 additions & 13 deletions cms/djangoapps/models/settings/course_grading.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,14 @@ def fetch_grader(course_key, index):

# return empty model
else:
return {"id": index,
"type": "",
"min_count": 0,
"drop_count": 0,
"short_label": None,
"weight": 0
}
return {
'id': index,
'type': '',
'min_count': 0,
'drop_count': 0,
'short_label': None,
'weight': 0,
}

@staticmethod
def update_from_json(course_key, jsondict, user):
Expand Down Expand Up @@ -194,12 +195,13 @@ def convert_set_grace_period(descriptor):
@staticmethod
def parse_grader(json_grader):
# manual to clear out kruft
result = {"type": json_grader["type"],
"min_count": int(json_grader.get('min_count', 0)),
"drop_count": int(json_grader.get('drop_count', 0)),
"short_label": json_grader.get('short_label', None),
"weight": float(json_grader.get('weight', 0)) / 100.0
}
result = {
'type': json_grader['type'],
'min_count': int(json_grader.get('min_count', 0)),
'drop_count': int(json_grader.get('drop_count', 0)),
'short_label': json_grader.get('short_label', None),
'weight': float(json_grader.get('weight', 0)) / 100.0,
}

return result

Expand Down
3 changes: 0 additions & 3 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@
# Prerequisite courses feature flag
'ENABLE_PREREQUISITE_COURSES': False,

# Toggle course milestones app/feature
'MILESTONES_APP': False,

# Toggle course entrance exams feature
'ENTRANCE_EXAMS': False,

Expand Down
Loading