Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d1672e31
Commit
d1672e31
authored
May 22, 2014
by
Sarina Canelake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Opaque-keys: fix pylint violations
parent
c535a6b9
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
59 additions
and
49 deletions
+59
-49
cms/djangoapps/contentstore/views/course.py
+1
-1
cms/djangoapps/contentstore/views/import_export.py
+0
-1
common/djangoapps/student/management/commands/anonymized_id_mapping.py
+0
-1
common/djangoapps/student/management/commands/create_random_users.py
+12
-10
common/djangoapps/student/management/commands/get_grades.py
+4
-0
common/djangoapps/student/roles.py
+0
-1
common/lib/xmodule/xmodule/modulestore/loc_mapper_store.py
+0
-1
lms/djangoapps/bulk_email/forms.py
+0
-1
lms/djangoapps/certificates/management/commands/cert_whitelist.py
+5
-1
lms/djangoapps/certificates/management/commands/ungenerated_certs.py
+5
-1
lms/djangoapps/courseware/models.py
+6
-1
lms/djangoapps/courseware/tests/test_video_handlers.py
+0
-1
lms/djangoapps/courseware/views.py
+0
-1
lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py
+3
-0
lms/djangoapps/instructor/management/commands/compute_grades.py
+5
-5
lms/djangoapps/instructor/management/commands/dump_grades.py
+7
-5
lms/djangoapps/instructor/management/commands/openended_post.py
+0
-1
lms/djangoapps/instructor/management/commands/openended_stats.py
+0
-1
lms/djangoapps/instructor/offline_gradecalc.py
+8
-7
lms/djangoapps/instructor/tests/test_api.py
+0
-1
lms/djangoapps/instructor/tests/test_enrollment.py
+0
-2
lms/djangoapps/instructor/tests/test_legacy_gradebook.py
+0
-1
lms/djangoapps/instructor/tests/test_legacy_reset.py
+0
-1
lms/djangoapps/notes/api.py
+3
-3
lms/djangoapps/psychometrics/management/commands/init_psychometrics.py
+0
-1
No files found.
cms/djangoapps/contentstore/views/course.py
View file @
d1672e31
...
...
@@ -21,7 +21,7 @@ from xmodule.modulestore.django import modulestore
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.tabs
import
PDFTextbookTabs
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
InvalidLocationError
,
InsufficientSpecificationError
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
InvalidLocationError
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore.locations
import
Location
,
SlashSeparatedCourseKey
...
...
cms/djangoapps/contentstore/views/import_export.py
View file @
d1672e31
...
...
@@ -30,7 +30,6 @@ from xmodule.modulestore.xml_exporter import export_to_xml
from
.access
import
has_course_access
from
.access
import
has_course_access
from
extract_tar
import
safetar_extractall
from
student
import
auth
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
GlobalStaff
...
...
common/djangoapps/student/management/commands/anonymized_id_mapping.py
View file @
d1672e31
...
...
@@ -13,7 +13,6 @@ import csv
from
django.contrib.auth.models
import
User
from
django.core.management.base
import
BaseCommand
,
CommandError
from
opaque_keys
import
InvalidKeyError
from
student.models
import
anonymous_id_for_user
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
...
...
common/djangoapps/student/management/commands/create_random_users.py
View file @
d1672e31
##
##
A script to create some dummy users
"""
A script to create some dummy users
"""
from
django.core.management.base
import
BaseCommand
from
student.models
import
CourseEnrollment
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore.keys
import
CourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
student.views
import
_do_create_account
,
get_random_post_override
def
create
(
n
,
course_key
):
"""Create n users, enrolling them in course_key if it's not None"""
for
i
in
range
(
n
):
(
user
,
user_profile
,
_
)
=
_do_create_account
(
get_random_post_override
())
def
create
(
n
um
,
course_key
):
"""Create n
um
users, enrolling them in course_key if it's not None"""
for
i
dx
in
range
(
num
):
(
user
,
user_profile
,
_
_
)
=
_do_create_account
(
get_random_post_override
())
if
course_key
is
not
None
:
CourseEnrollment
.
enroll
(
user
,
course_key
)
...
...
@@ -31,7 +33,7 @@ Examples:
print
Command
.
help
return
n
=
int
(
args
[
0
])
n
um
=
int
(
args
[
0
])
if
len
(
args
)
==
2
:
try
:
...
...
@@ -41,4 +43,4 @@ Examples:
else
:
course_key
=
None
create
(
n
,
course_key
)
create
(
n
um
,
course_key
)
common/djangoapps/student/management/commands/get_grades.py
View file @
d1672e31
"""
Management command to generate a list of grades for
all students that are enrolled in a course.
"""
from
courseware
import
grades
,
courses
from
certificates.models
import
GeneratedCertificate
from
django.test.client
import
RequestFactory
...
...
common/djangoapps/student/roles.py
View file @
d1672e31
...
...
@@ -7,7 +7,6 @@ from abc import ABCMeta, abstractmethod
from
django.contrib.auth.models
import
User
from
student.models
import
CourseAccessRole
from
xmodule_django.models
import
CourseKeyField
class
AccessRole
(
object
):
...
...
common/lib/xmodule/xmodule/modulestore/loc_mapper_store.py
View file @
d1672e31
...
...
@@ -10,7 +10,6 @@ import urllib
from
xmodule.modulestore.exceptions
import
InvalidLocationError
,
ItemNotFoundError
from
xmodule.modulestore.locator
import
BlockUsageLocator
,
CourseLocator
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.keys
import
UsageKey
class
LocMapperStore
(
object
):
...
...
lms/djangoapps/bulk_email/forms.py
View file @
d1672e31
...
...
@@ -11,7 +11,6 @@ from bulk_email.models import CourseEmailTemplate, COURSE_EMAIL_MESSAGE_BODY_TAG
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore
import
XML_MODULESTORE_TYPE
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore.keys
import
CourseKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
...
...
lms/djangoapps/certificates/management/commands/cert_whitelist.py
View file @
d1672e31
"""
Management command which sets or gets the certificate whitelist for a given
user/course
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
optparse
import
make_option
from
opaque_keys
import
InvalidKeyError
...
...
@@ -56,7 +60,7 @@ class Command(BaseCommand):
try
:
course
=
CourseKey
.
from_string
(
course_id
)
except
InvalidKeyError
:
log
.
warning
(
"Course id
%
s could not be parsed as a CourseKey; falling back to SSCK.from_dep_str"
,
course_id
)
print
(
"Course id {} could not be parsed as a CourseKey; falling back to SSCK.from_dep_str"
.
format
(
course_id
)
)
course
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
if
options
[
'add'
]
and
options
[
'del'
]:
...
...
lms/djangoapps/certificates/management/commands/ungenerated_certs.py
View file @
d1672e31
"""
Management command to find all students that need certificates for
courses that have finished, and put their cert requests on the queue.
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
certificates.models
import
certificate_status_for_student
from
certificates.queue
import
XQueueCertInterface
...
...
@@ -73,7 +77,7 @@ class Command(BaseCommand):
try
:
course
=
CourseKey
.
from_string
(
options
[
'course'
])
except
InvalidKeyError
:
log
.
warning
(
"Course id
%
s could not be parsed as a CourseKey; falling back to SSCK.from_dep_str"
,
course_id
)
print
(
"Course id {} could not be parsed as a CourseKey; falling back to SSCK.from_dep_str"
.
format
(
options
[
'course'
])
)
course
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
options
[
'course'
])
ended_courses
=
[
course
]
else
:
...
...
lms/djangoapps/courseware/models.py
View file @
d1672e31
...
...
@@ -113,7 +113,12 @@ class StudentModuleHistory(models.Model):
max_grade
=
models
.
FloatField
(
null
=
True
,
blank
=
True
)
@receiver
(
post_save
,
sender
=
StudentModule
)
def
save_history
(
sender
,
instance
,
**
kwargs
):
# pylint: disable=no-self-argument
def
save_history
(
sender
,
instance
,
**
kwargs
):
# pylint: disable=no-self-argument, unused-argument
"""
Checks the instance's module_type, and creates & saves a
StudentModuleHistory entry if the module_type is one that
we save.
"""
if
instance
.
module_type
in
StudentModuleHistory
.
HISTORY_SAVING_TYPES
:
history_entry
=
StudentModuleHistory
(
student_module
=
instance
,
version
=
None
,
...
...
lms/djangoapps/courseware/tests/test_video_handlers.py
View file @
d1672e31
...
...
@@ -22,7 +22,6 @@ from xmodule.video_module.transcripts_utils import (
TranscriptException
,
TranscriptsGenerationException
,
)
from
xmodule.modulestore.mongo.base
import
MongoModuleStore
from
xmodule.modulestore.locations
import
AssetLocation
SRT_content
=
textwrap
.
dedent
(
"""
...
...
lms/djangoapps/courseware/views.py
View file @
d1672e31
...
...
@@ -47,7 +47,6 @@ from opaque_keys import InvalidKeyError
from
microsite_configuration
import
microsite
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.keys
import
UsageKey
log
=
logging
.
getLogger
(
"edx.courseware"
)
...
...
lms/djangoapps/django_comment_client/management/commands/seed_permissions_roles.py
View file @
d1672e31
"""
Management command to seed default permissions and roles.
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django_comment_common.utils
import
seed_permissions_roles
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
...
...
lms/djangoapps/instructor/management/commands/compute_grades.py
View file @
d1672e31
#!/usr/bin/python
#
#
django management command: dump grades to csv files
#
for use by batch processes
"""
django management command: dump grades to csv files
for use by batch processes
"""
from
instructor.offline_gradecalc
import
offline_grade_calculation
from
courseware.courses
import
get_course_by_id
from
xmodule.modulestore.django
import
modulestore
...
...
@@ -37,7 +37,7 @@ class Command(BaseCommand):
except
InvalidKeyError
:
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
try
:
course
=
get_course_by_id
(
course_key
)
_
course
=
get_course_by_id
(
course_key
)
except
Exception
as
err
:
print
"-----------------------------------------------------------------------------"
print
"Sorry, cannot find course with id {}"
.
format
(
course_id
)
...
...
lms/djangoapps/instructor/management/commands/dump_grades.py
View file @
d1672e31
#!/usr/bin/python
#
#
django management command: dump grades to csv files
#
for use by batch processes
"""
django management command: dump grades to csv files
for use by batch processes
"""
import
csv
from
instructor.views.legacy
import
get_student_grade_summary_data
...
...
@@ -52,7 +52,9 @@ class Command(BaseCommand):
try
:
course
=
get_course_by_id
(
course_key
)
except
Exception
as
err
:
# Ok with catching general exception here because this is run as a management command
# and the exception is exposed right away to the user.
except
Exception
as
err
:
# pylint: disable=broad-except
print
"-----------------------------------------------------------------------------"
print
"Sorry, cannot find course with id {}"
.
format
(
course_id
)
print
"Got exception {}"
.
format
(
err
)
...
...
lms/djangoapps/instructor/management/commands/openended_post.py
View file @
d1672e31
...
...
@@ -6,7 +6,6 @@ from django.core.management.base import BaseCommand
from
optparse
import
make_option
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.keys
import
UsageKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
from
xmodule.open_ended_grading_classes.open_ended_module
import
OpenEndedModule
...
...
lms/djangoapps/instructor/management/commands/openended_stats.py
View file @
d1672e31
...
...
@@ -9,7 +9,6 @@ from optparse import make_option
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.keys
import
UsageKey
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.open_ended_grading_classes.openendedchild
import
OpenEndedChild
...
...
lms/djangoapps/instructor/offline_gradecalc.py
View file @
d1672e31
# ======== Offline calculation of grades =============================================================================
#
# Computing grades of a large number of students can take a long time. These routines allow grades to
# be computed offline, by a batch process (eg cronjob).
#
# The grades are stored in the OfflineComputedGrade table of the courseware model.
"""
======== Offline calculation of grades =============================================================
Computing grades of a large number of students can take a long time. These routines allow grades to
be computed offline, by a batch process (eg cronjob).
The grades are stored in the OfflineComputedGrade table of the courseware model.
"""
import
json
import
time
...
...
@@ -49,7 +50,7 @@ def offline_grade_calculation(course_key):
gradeset
=
grades
.
grade
(
student
,
request
,
course
,
keep_raw_scores
=
True
)
gs
=
enc
.
encode
(
gradeset
)
ocg
,
created
=
models
.
OfflineComputedGrade
.
objects
.
get_or_create
(
user
=
student
,
course_id
=
course_key
)
ocg
,
_
created
=
models
.
OfflineComputedGrade
.
objects
.
get_or_create
(
user
=
student
,
course_id
=
course_key
)
ocg
.
gradeset
=
gs
ocg
.
save
()
print
"
%
s done"
%
student
# print statement used because this is run by a management command
...
...
lms/djangoapps/instructor/tests/test_api.py
View file @
d1672e31
...
...
@@ -13,7 +13,6 @@ from nose.tools import raises
from
mock
import
Mock
,
patch
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.http
import
HttpRequest
,
HttpResponse
from
django_comment_common.models
import
FORUM_ROLE_COMMUNITY_TA
,
Role
...
...
lms/djangoapps/instructor/tests/test_enrollment.py
View file @
d1672e31
...
...
@@ -9,7 +9,6 @@ from courseware.models import StudentModule
from
django.conf
import
settings
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.test.client
import
RequestFactory
from
student.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
courseware.tests.modulestore_config
import
TEST_DATA_MIXED_MODULESTORE
...
...
@@ -27,7 +26,6 @@ from xmodule.modulestore.locations import SlashSeparatedCourseKey
from
submissions
import
api
as
sub_api
from
student.models
import
anonymous_id_for_user
from
.test_tools
import
msk_from_problem_urlname
class
TestSettableEnrollmentState
(
TestCase
):
...
...
lms/djangoapps/instructor/tests/test_legacy_gradebook.py
View file @
d1672e31
...
...
@@ -11,7 +11,6 @@ from courseware.tests.tests import TEST_DATA_MIXED_MODULESTORE
from
capa.tests.response_xml_factory
import
StringResponseXMLFactory
from
courseware.tests.factories
import
StudentModuleFactory
from
xmodule.modulestore
import
Location
from
xmodule.modulestore.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.django
import
modulestore
...
...
lms/djangoapps/instructor/tests/test_legacy_reset.py
View file @
d1672e31
...
...
@@ -16,7 +16,6 @@ from courseware.models import StudentModule
from
submissions
import
api
as
sub_api
from
student.models
import
anonymous_id_for_user
from
.test_tools
import
msk_from_problem_urlname
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
...
...
lms/djangoapps/notes/api.py
View file @
d1672e31
...
...
@@ -148,7 +148,7 @@ def create(request, course_key):
return
ApiResponse
(
http_response
=
response
,
data
=
None
)
def
read
(
request
,
course_key
,
note_id
):
def
read
(
request
,
course_key
,
note_id
):
# pylint: disable=unused-argument (course_key)
'''
Returns a single annotation object.
'''
...
...
@@ -163,7 +163,7 @@ def read(request, course_key, note_id):
return
ApiResponse
(
http_response
=
HttpResponse
(),
data
=
note
.
as_dict
())
def
update
(
request
,
course_key
,
note_id
):
def
update
(
request
,
course_key
,
note_id
):
# pylint: disable=unused-argument (course_key)
'''
Updates an annotation object and returns a 303 with the read location.
'''
...
...
@@ -247,7 +247,7 @@ def search(request, course_key):
return
ApiResponse
(
http_response
=
HttpResponse
(),
data
=
result
)
def
root
(
request
,
course_key
):
def
root
(
request
,
course_key
):
# pylint: disable=unused-argument (course_key, request)
'''
Returns version information about the API.
'''
...
...
lms/djangoapps/psychometrics/management/commands/init_psychometrics.py
View file @
d1672e31
...
...
@@ -7,7 +7,6 @@ import json
from
courseware.models
import
StudentModule
from
track.models
import
TrackingLog
from
psychometrics.models
import
PsychometricData
from
xmodule.modulestore.keys
import
UsageKey
from
django.conf
import
settings
from
django.core.management.base
import
BaseCommand
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment