Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-analytics-dashboard
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-analytics-dashboard
Commits
15488cb6
Commit
15488cb6
authored
Dec 02, 2015
by
Dennis Jen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upgraded pylint to 1.5.0, fixed linting errors, removed obsolete settings.
parent
a4e7942e
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
29 additions
and
38 deletions
+29
-38
acceptance_tests/mixins.py
+2
-1
acceptance_tests/test_course_performance.py
+1
-1
analytics_dashboard/core/apps.py
+2
-1
analytics_dashboard/core/middleware.py
+1
-1
analytics_dashboard/core/tests/test_utils.py
+2
-1
analytics_dashboard/core/tests/test_views.py
+6
-4
analytics_dashboard/courses/middleware.py
+1
-1
analytics_dashboard/courses/permissions.py
+1
-1
analytics_dashboard/courses/presenters/engagement.py
+2
-1
analytics_dashboard/courses/presenters/performance.py
+1
-0
analytics_dashboard/courses/tests/factories.py
+3
-2
analytics_dashboard/courses/tests/test_middleware.py
+1
-1
analytics_dashboard/courses/views/__init__.py
+4
-3
analytics_dashboard/urls.py
+1
-1
pylintrc
+0
-18
requirements/test.txt
+1
-1
No files found.
acceptance_tests/mixins.py
View file @
15488cb6
...
@@ -372,12 +372,13 @@ class CourseDemographicsPageTestsMixin(CoursePageTestsMixin):
...
@@ -372,12 +372,13 @@ class CourseDemographicsPageTestsMixin(CoursePageTestsMixin):
self
.
fulfill_loading_promise
(
self
.
chart_selector
)
self
.
fulfill_loading_promise
(
self
.
chart_selector
)
self
.
assertElementHasContent
(
self
.
chart_selector
)
self
.
assertElementHasContent
(
self
.
chart_selector
)
# pylint: disable=unsubscriptable-object
def
_test_table
(
self
):
def
_test_table
(
self
):
self
.
assertTable
(
self
.
table_section_selector
,
self
.
table_columns
,
self
.
table_download_selector
)
self
.
assertTable
(
self
.
table_section_selector
,
self
.
table_columns
,
self
.
table_download_selector
)
rows
=
self
.
page
.
browser
.
find_elements_by_css_selector
(
'{} tbody tr'
.
format
(
self
.
table_section_selector
))
rows
=
self
.
page
.
browser
.
find_elements_by_css_selector
(
'{} tbody tr'
.
format
(
self
.
table_section_selector
))
self
.
assertGreater
(
len
(
rows
),
0
)
self
.
assertGreater
(
len
(
rows
),
0
)
sum_count
=
0
sum_count
=
0
.0
if
self
.
demographic_data
and
'count'
in
self
.
demographic_data
[
0
]:
if
self
.
demographic_data
and
'count'
in
self
.
demographic_data
[
0
]:
sum_count
=
float
(
sum
([
datum
[
'count'
]
for
datum
in
self
.
demographic_data
]))
sum_count
=
float
(
sum
([
datum
[
'count'
]
for
datum
in
self
.
demographic_data
]))
...
...
acceptance_tests/test_course_performance.py
View file @
15488cb6
...
@@ -353,7 +353,7 @@ class CoursePerformanceAnswerDistributionMixin(CoursePerformancePageTestsMixin):
...
@@ -353,7 +353,7 @@ class CoursePerformanceAnswerDistributionMixin(CoursePerformancePageTestsMixin):
actual
.
append
(
col
.
text
)
actual
.
append
(
col
.
text
)
expected
=
[
answer
[
value_field
]
if
answer
[
value_field
]
else
u'(empty)'
]
expected
=
[
answer
[
value_field
]
if
answer
[
value_field
]
else
u'(empty)'
]
correct
=
'-'
correct
=
u
'-'
if
answer
[
'correct'
]:
if
answer
[
'correct'
]:
correct
=
u'Correct'
correct
=
u'Correct'
expected
.
append
(
correct
)
expected
.
append
(
correct
)
...
...
analytics_dashboard/core/apps.py
View file @
15488cb6
import
re
from
django.apps
import
AppConfig
from
django.apps
import
AppConfig
from
django.conf
import
settings
from
django.conf
import
settings
import
re
class
AnalyticsDashboardConfig
(
AppConfig
):
class
AnalyticsDashboardConfig
(
AppConfig
):
...
...
analytics_dashboard/core/middleware.py
View file @
15488cb6
...
@@ -28,6 +28,6 @@ class ServiceUnavailableExceptionMiddleware(object):
...
@@ -28,6 +28,6 @@ class ServiceUnavailableExceptionMiddleware(object):
"""
"""
def
process_exception
(
self
,
request
,
exception
):
def
process_exception
(
self
,
request
,
exception
):
if
type
(
exception
)
is
ServiceUnavailableError
:
if
isinstance
(
exception
,
ServiceUnavailableError
)
:
logger
.
exception
(
exception
)
logger
.
exception
(
exception
)
return
TemplateResponse
(
request
,
'503.html'
,
status
=
503
)
return
TemplateResponse
(
request
,
'503.html'
,
status
=
503
)
analytics_dashboard/core/tests/test_utils.py
View file @
15488cb6
from
ddt
import
data
,
ddt
,
unpack
import
uuid
import
uuid
from
ddt
import
data
,
ddt
,
unpack
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth
import
get_user_model
from
django.contrib.auth
import
get_user_model
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
...
...
analytics_dashboard/core/tests/test_views.py
View file @
15488cb6
...
@@ -4,17 +4,19 @@ import logging
...
@@ -4,17 +4,19 @@ import logging
import
datetime
import
datetime
from
testfixtures
import
LogCapture
from
testfixtures
import
LogCapture
from
django.core.cache
import
cache
from
django.test.utils
import
override_settings
import
httpretty
import
httpretty
import
jwt
import
jwt
import
mock
import
mock
from
django.core.cache
import
cache
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.conf
import
settings
from
django.conf
import
settings
from
django.contrib.auth
import
get_user_model
from
django.contrib.auth
import
get_user_model
from
django.db
import
DatabaseError
from
django.db
import
DatabaseError
from
django_dynamic_fixture
import
G
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django_dynamic_fixture
import
G
from
analyticsclient.exceptions
import
TimeoutError
from
analyticsclient.exceptions
import
TimeoutError
from
social.exceptions
import
AuthException
from
social.exceptions
import
AuthException
from
social.utils
import
parse_qs
from
social.utils
import
parse_qs
...
...
analytics_dashboard/courses/middleware.py
View file @
15488cb6
...
@@ -34,6 +34,6 @@ class CoursePermissionsExceptionMiddleware(object):
...
@@ -34,6 +34,6 @@ class CoursePermissionsExceptionMiddleware(object):
"""
"""
def
process_exception
(
self
,
request
,
exception
):
def
process_exception
(
self
,
request
,
exception
):
if
type
(
exception
)
is
PermissionsRetrievalFailedError
:
if
isinstance
(
exception
,
PermissionsRetrievalFailedError
)
:
logger
.
exception
(
exception
)
logger
.
exception
(
exception
)
return
TemplateResponse
(
request
,
'courses/permissions-retrieval-failed.html'
,
status
=
500
)
return
TemplateResponse
(
request
,
'courses/permissions-retrieval-failed.html'
,
status
=
500
)
analytics_dashboard/courses/permissions.py
View file @
15488cb6
...
@@ -103,7 +103,7 @@ def _get_user_courses(access_token, backend):
...
@@ -103,7 +103,7 @@ def _get_user_courses(access_token, backend):
for
claim
in
claims
:
for
claim
in
claims
:
courses
.
update
(
data
.
get
(
claim
,
[]))
courses
.
update
(
data
.
get
(
claim
,
[]))
return
courses
return
list
(
courses
)
def
get_user_course_permissions
(
user
):
def
get_user_course_permissions
(
user
):
...
...
analytics_dashboard/courses/presenters/engagement.py
View file @
15488cb6
import
datetime
import
datetime
import
logging
import
math
import
math
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.utils.translation
import
ugettext_lazy
as
_
import
logging
from
waffle
import
switch_is_active
from
waffle
import
switch_is_active
from
analyticsclient.client
import
Client
from
analyticsclient.client
import
Client
...
...
analytics_dashboard/courses/presenters/performance.py
View file @
15488cb6
...
@@ -98,6 +98,7 @@ class CoursePerformancePresenter(CourseAPIPresenterMixin, BasePresenter):
...
@@ -98,6 +98,7 @@ class CoursePerformancePresenter(CourseAPIPresenterMixin, BasePresenter):
return
True
return
True
return
False
return
False
# pylint: disable=redefined-variable-type
def
_build_questions
(
self
,
answer_distributions
):
def
_build_questions
(
self
,
answer_distributions
):
"""
"""
Builds the questions and part_id from the answer distribution. Displayed
Builds the questions and part_id from the answer distribution. Displayed
...
...
analytics_dashboard/courses/tests/factories.py
View file @
15488cb6
from
slugify
import
slugify
import
urllib
import
urllib
import
uuid
import
uuid
from
slugify
import
slugify
from
common.tests.factories
import
CourseStructureFactory
from
common.tests.factories
import
CourseStructureFactory
from
courses.tests.utils
import
CREATED_DATETIME_STRING
from
courses.tests.utils
import
CREATED_DATETIME_STRING
...
@@ -25,7 +26,7 @@ class CoursePerformanceDataFactory(CourseStructureFactory):
...
@@ -25,7 +26,7 @@ class CoursePerformanceDataFactory(CourseStructureFactory):
part_id
=
'{}_1_2'
.
format
(
_id
)
part_id
=
'{}_1_2'
.
format
(
_id
)
correct_percent
=
1.0
correct_percent
=
1.0
if
problem_index
==
0
:
if
problem_index
==
0
:
correct_percent
=
0
correct_percent
=
0
.0
url_template
=
'/courses/{}/performance/graded_content/assignments/{}/problems/'
\
url_template
=
'/courses/{}/performance/graded_content/assignments/{}/problems/'
\
'{}/parts/{}/answer_distribution/'
'{}/parts/{}/answer_distribution/'
problems
.
append
({
problems
.
append
({
...
...
analytics_dashboard/courses/tests/test_middleware.py
View file @
15488cb6
import
ddt
import
logging
import
logging
import
ddt
from
django.template.response
import
TemplateResponse
from
django.template.response
import
TemplateResponse
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.keys
import
CourseKey
from
testfixtures
import
LogCapture
from
testfixtures
import
LogCapture
...
...
analytics_dashboard/courses/views/__init__.py
View file @
15488cb6
import
copy
import
copy
from
datetime
import
datetime
import
json
import
json
import
logging
import
logging
import
re
import
re
from
braces.views
import
LoginRequiredMixin
from
braces.views
import
LoginRequiredMixin
from
ccx_keys.locator
import
CCXLocator
from
ccx_keys.locator
import
CCXLocator
from
datetime
import
datetime
from
django.conf
import
settings
from
django.conf
import
settings
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.core.exceptions
import
PermissionDenied
from
django.core.exceptions
import
PermissionDenied
...
@@ -518,6 +518,7 @@ class CourseHome(CourseTemplateWithNavView):
...
@@ -518,6 +518,7 @@ class CourseHome(CourseTemplateWithNavView):
return
items
return
items
# pylint: disable=redefined-variable-type
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
CourseHome
,
self
)
.
get_context_data
(
**
kwargs
)
context
=
super
(
CourseHome
,
self
)
.
get_context_data
(
**
kwargs
)
context
.
update
({
context
.
update
({
...
@@ -598,8 +599,8 @@ class CourseIndex(CourseAPIMixin, LoginRequiredMixin, TrackedViewMixin, LazyEnco
...
@@ -598,8 +599,8 @@ class CourseIndex(CourseAPIMixin, LoginRequiredMixin, TrackedViewMixin, LazyEnco
# The user is probably not a course administrator and should not be using this application.
# The user is probably not a course administrator and should not be using this application.
raise
PermissionDenied
raise
PermissionDenied
courses
=
self
.
_create_course_list
(
courses
)
courses
_list
=
self
.
_create_course_list
(
courses
)
context
[
'courses'
]
=
courses
context
[
'courses'
]
=
courses
_list
context
[
'page_data'
]
=
self
.
get_page_data
(
context
)
context
[
'page_data'
]
=
self
.
get_page_data
(
context
)
return
context
return
context
...
...
analytics_dashboard/urls.py
View file @
15488cb6
...
@@ -46,7 +46,7 @@ if settings.DEBUG: # pragma: no cover
...
@@ -46,7 +46,7 @@ if settings.DEBUG: # pragma: no cover
)
)
if
os
.
environ
.
get
(
'ENABLE_DJANGO_TOOLBAR'
,
False
):
if
os
.
environ
.
get
(
'ENABLE_DJANGO_TOOLBAR'
,
False
):
import
debug_toolbar
# pylint: disable=import-error
import
debug_toolbar
# pylint: disable=import-error
, wrong-import-position, wrong-import-order
urlpatterns
+=
patterns
(
urlpatterns
+=
patterns
(
''
,
''
,
...
...
pylintrc
View file @
15488cb6
...
@@ -7,9 +7,6 @@
...
@@ -7,9 +7,6 @@
# pygtk.require().
# pygtk.require().
#init-hook=''
#init-hook=''
# Profiled execution.
profile=no
# Add files or directories to the blacklist. They should be base names, not
# Add files or directories to the blacklist. They should be base names, not
# paths.
# paths.
ignore=CVS, migrations, settings, wsgi.py
ignore=CVS, migrations, settings, wsgi.py
...
@@ -90,10 +87,6 @@ reports=no
...
@@ -90,10 +87,6 @@ reports=no
# (RP0004).
# (RP0004).
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
# Add a comment according to your evaluation note. This is used by the global
# evaluation report (RP0004).
comment=no
[TYPECHECK]
[TYPECHECK]
...
@@ -105,10 +98,6 @@ ignore-mixin-members=yes
...
@@ -105,10 +98,6 @@ ignore-mixin-members=yes
# (useful for classes with attributes dynamically set).
# (useful for classes with attributes dynamically set).
ignored-classes=SQLObject
ignored-classes=SQLObject
# When zope mode is activated, add a predefined set of Zope acquired attributes
# to generated-members.
zope=no
# List of members which are set dynamically and missed by pylint inference
# List of members which are set dynamically and missed by pylint inference
# system, and so shouldn't trigger E0201 when accessed. Python regular
# system, and so shouldn't trigger E0201 when accessed. Python regular
# expressions are accepted.
# expressions are accepted.
...
@@ -130,9 +119,6 @@ generated-members=
...
@@ -130,9 +119,6 @@ generated-members=
[BASIC]
[BASIC]
# Required attributes for module, separated by a comma
required-attributes=
# List of builtins function names that should not be used, separated by a comma
# List of builtins function names that should not be used, separated by a comma
bad-functions=map,filter,apply,input
bad-functions=map,filter,apply,input
...
@@ -274,10 +260,6 @@ max-public-methods=20
...
@@ -274,10 +260,6 @@ max-public-methods=20
[CLASSES]
[CLASSES]
# List of interface methods to ignore, separated by a comma. This is used for
# instance to not check methods defines in Zope's Interface base class.
ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
# List of method names used to declare (i.e. assign) instance attributes.
# List of method names used to declare (i.e. assign) instance attributes.
defining-attr-methods=__init__,__new__,setUp
defining-attr-methods=__init__,__new__,setUp
...
...
requirements/test.txt
View file @
15488cb6
...
@@ -14,7 +14,7 @@ nose-ignore-docstring==0.2
...
@@ -14,7 +14,7 @@ nose-ignore-docstring==0.2
nose==1.3.4
nose==1.3.4
pep257==0.4.1
pep257==0.4.1
pep8==1.6.0
pep8==1.6.0
pylint==1.
4.1
pylint==1.
5.0
logilab-common==0.61.0
logilab-common==0.61.0
selenium>=2.44.0
selenium>=2.44.0
sure==1.2.7
sure==1.2.7
...
...
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