Commit ee4ab205 by Sarina Canelake

Merge pull request #10986 from edx/sc/pylint

Remove Pylint violations
parents 11762146 96ddf544
#!/usr/bin/env python #!/usr/bin/env python
# TODO: Is this file still used? If so it should be refactored and tests added.
# pylint: disable=line-too-long, invalid-name
""" """
Embeds web videos using URLs. For instance, if a URL to an youtube video is Embeds web videos using URLs. For instance, if a URL to an youtube video is
found in the text submitted to markdown and it isn't enclosed in parenthesis found in the text submitted to markdown and it isn't enclosed in parenthesis
...@@ -132,8 +133,8 @@ try: ...@@ -132,8 +133,8 @@ try:
# Markdown 2.1.0 changed from 2.0.3. We try importing the new version first, # Markdown 2.1.0 changed from 2.0.3. We try importing the new version first,
# but import the 2.0.3 version if it fails # but import the 2.0.3 version if it fails
from markdown.util import etree from markdown.util import etree
except: # pylint: disable=bare-except except ImportError:
from markdown import etree from markdown import etree # pylint: disable=no-name-in-module
version = "0.1.6" version = "0.1.6"
...@@ -164,7 +165,8 @@ class VideoExtension(markdown.Extension): ...@@ -164,7 +165,8 @@ class VideoExtension(markdown.Extension):
for key, value in configs: for key, value in configs:
self.setConfig(key, value) self.setConfig(key, value)
def add_inline(self, md, name, klass, re): def add_inline(self, md, name, klass, re): # pylint: disable=invalid-name
"""Adds the inline link"""
pattern = klass(re) pattern = klass(re)
pattern.md = md pattern.md = md
pattern.ext = self pattern.ext = self
...@@ -192,6 +194,7 @@ class VideoExtension(markdown.Extension): ...@@ -192,6 +194,7 @@ class VideoExtension(markdown.Extension):
class Bliptv(markdown.inlinepatterns.Pattern): class Bliptv(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
url = 'http://blip.tv/scripts/flash/showplayer.swf?file=http://blip.tv/file/get/%s' % m.group('bliptvfile') url = 'http://blip.tv/scripts/flash/showplayer.swf?file=http://blip.tv/file/get/%s' % m.group('bliptvfile')
# pylint: disable=no-member
width = self.ext.config['bliptv_width'][0] width = self.ext.config['bliptv_width'][0]
height = self.ext.config['bliptv_height'][0] height = self.ext.config['bliptv_height'][0]
return flash_object(url, width, height) return flash_object(url, width, height)
...@@ -200,6 +203,7 @@ class Bliptv(markdown.inlinepatterns.Pattern): ...@@ -200,6 +203,7 @@ class Bliptv(markdown.inlinepatterns.Pattern):
class Dailymotion(markdown.inlinepatterns.Pattern): class Dailymotion(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
url = 'http://www.dailymotion.com/swf/%s' % m.group('dailymotionid').split('/')[-1] url = 'http://www.dailymotion.com/swf/%s' % m.group('dailymotionid').split('/')[-1]
# pylint: disable=no-member
width = self.ext.config['dailymotion_width'][0] width = self.ext.config['dailymotion_width'][0]
height = self.ext.config['dailymotion_height'][0] height = self.ext.config['dailymotion_height'][0]
return flash_object(url, width, height) return flash_object(url, width, height)
...@@ -209,6 +213,7 @@ class Gametrailers(markdown.inlinepatterns.Pattern): ...@@ -209,6 +213,7 @@ class Gametrailers(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
url = 'http://www.gametrailers.com/remote_wrap.php?mid=%s' % \ url = 'http://www.gametrailers.com/remote_wrap.php?mid=%s' % \
m.group('gametrailersid').split('/')[-1] m.group('gametrailersid').split('/')[-1]
# pylint: disable=no-member
width = self.ext.config['gametrailers_width'][0] width = self.ext.config['gametrailers_width'][0]
height = self.ext.config['gametrailers_height'][0] height = self.ext.config['gametrailers_height'][0]
return flash_object(url, width, height) return flash_object(url, width, height)
...@@ -217,6 +222,7 @@ class Gametrailers(markdown.inlinepatterns.Pattern): ...@@ -217,6 +222,7 @@ class Gametrailers(markdown.inlinepatterns.Pattern):
class Metacafe(markdown.inlinepatterns.Pattern): class Metacafe(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
url = 'http://www.metacafe.com/fplayer/%s.swf' % m.group('metacafeid') url = 'http://www.metacafe.com/fplayer/%s.swf' % m.group('metacafeid')
# pylint: disable=no-member
width = self.ext.config['metacafe_width'][0] width = self.ext.config['metacafe_width'][0]
height = self.ext.config['metacafe_height'][0] height = self.ext.config['metacafe_height'][0]
return flash_object(url, width, height) return flash_object(url, width, height)
...@@ -225,6 +231,7 @@ class Metacafe(markdown.inlinepatterns.Pattern): ...@@ -225,6 +231,7 @@ class Metacafe(markdown.inlinepatterns.Pattern):
class Veoh(markdown.inlinepatterns.Pattern): class Veoh(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
url = 'http://www.veoh.com/videodetails2.swf?permalinkId=%s' % m.group('veohid') url = 'http://www.veoh.com/videodetails2.swf?permalinkId=%s' % m.group('veohid')
# pylint: disable=no-member
width = self.ext.config['veoh_width'][0] width = self.ext.config['veoh_width'][0]
height = self.ext.config['veoh_height'][0] height = self.ext.config['veoh_height'][0]
return flash_object(url, width, height) return flash_object(url, width, height)
...@@ -233,6 +240,7 @@ class Veoh(markdown.inlinepatterns.Pattern): ...@@ -233,6 +240,7 @@ class Veoh(markdown.inlinepatterns.Pattern):
class Vimeo(markdown.inlinepatterns.Pattern): class Vimeo(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
url = 'http://vimeo.com/moogaloop.swf?clip_id=%s&server=vimeo.com' % m.group('vimeoid') url = 'http://vimeo.com/moogaloop.swf?clip_id=%s&server=vimeo.com' % m.group('vimeoid')
# pylint: disable=no-member
width = self.ext.config['vimeo_width'][0] width = self.ext.config['vimeo_width'][0]
height = self.ext.config['vimeo_height'][0] height = self.ext.config['vimeo_height'][0]
return flash_object(url, width, height) return flash_object(url, width, height)
...@@ -241,6 +249,7 @@ class Vimeo(markdown.inlinepatterns.Pattern): ...@@ -241,6 +249,7 @@ class Vimeo(markdown.inlinepatterns.Pattern):
class Yahoo(markdown.inlinepatterns.Pattern): class Yahoo(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
url = "http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40" url = "http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40"
# pylint: disable=no-member
width = self.ext.config['yahoo_width'][0] width = self.ext.config['yahoo_width'][0]
height = self.ext.config['yahoo_height'][0] height = self.ext.config['yahoo_height'][0]
obj = flash_object(url, width, height) obj = flash_object(url, width, height)
...@@ -255,6 +264,7 @@ class Yahoo(markdown.inlinepatterns.Pattern): ...@@ -255,6 +264,7 @@ class Yahoo(markdown.inlinepatterns.Pattern):
class Youtube(markdown.inlinepatterns.Pattern): class Youtube(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
url = 'http://www.youtube.com/v/%s' % m.group('youtubeargs') url = 'http://www.youtube.com/v/%s' % m.group('youtubeargs')
# pylint: disable=no-member
width = self.ext.config['youtube_width'][0] width = self.ext.config['youtube_width'][0]
height = self.ext.config['youtube_height'][0] height = self.ext.config['youtube_height'][0]
return flash_object(url, width, height) return flash_object(url, width, height)
......
...@@ -51,7 +51,7 @@ from instructor_task.tasks_helper import ( ...@@ -51,7 +51,7 @@ from instructor_task.tasks_helper import (
TASK_LOG = logging.getLogger('edx.celery.task') TASK_LOG = logging.getLogger('edx.celery.task')
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def rescore_problem(entry_id, xmodule_instance_args): def rescore_problem(entry_id, xmodule_instance_args):
"""Rescores a problem in a course, for all students or one specific student. """Rescores a problem in a course, for all students or one specific student.
...@@ -82,7 +82,7 @@ def rescore_problem(entry_id, xmodule_instance_args): ...@@ -82,7 +82,7 @@ def rescore_problem(entry_id, xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name) return run_main_task(entry_id, visit_fcn, action_name)
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def reset_problem_attempts(entry_id, xmodule_instance_args): def reset_problem_attempts(entry_id, xmodule_instance_args):
"""Resets problem attempts to zero for a particular problem for all students in a course. """Resets problem attempts to zero for a particular problem for all students in a course.
...@@ -104,7 +104,7 @@ def reset_problem_attempts(entry_id, xmodule_instance_args): ...@@ -104,7 +104,7 @@ def reset_problem_attempts(entry_id, xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name) return run_main_task(entry_id, visit_fcn, action_name)
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def delete_problem_state(entry_id, xmodule_instance_args): def delete_problem_state(entry_id, xmodule_instance_args):
"""Deletes problem state entirely for all students on a particular problem in a course. """Deletes problem state entirely for all students on a particular problem in a course.
...@@ -126,7 +126,7 @@ def delete_problem_state(entry_id, xmodule_instance_args): ...@@ -126,7 +126,7 @@ def delete_problem_state(entry_id, xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name) return run_main_task(entry_id, visit_fcn, action_name)
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def send_bulk_course_email(entry_id, _xmodule_instance_args): def send_bulk_course_email(entry_id, _xmodule_instance_args):
"""Sends emails to recipients enrolled in a course. """Sends emails to recipients enrolled in a course.
...@@ -147,7 +147,7 @@ def send_bulk_course_email(entry_id, _xmodule_instance_args): ...@@ -147,7 +147,7 @@ def send_bulk_course_email(entry_id, _xmodule_instance_args):
return run_main_task(entry_id, visit_fcn, action_name) return run_main_task(entry_id, visit_fcn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) @task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
def calculate_problem_responses_csv(entry_id, xmodule_instance_args): def calculate_problem_responses_csv(entry_id, xmodule_instance_args):
""" """
Compute student answers to a given problem and upload the CSV to Compute student answers to a given problem and upload the CSV to
...@@ -159,7 +159,7 @@ def calculate_problem_responses_csv(entry_id, xmodule_instance_args): ...@@ -159,7 +159,7 @@ def calculate_problem_responses_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) @task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
def calculate_grades_csv(entry_id, xmodule_instance_args): def calculate_grades_csv(entry_id, xmodule_instance_args):
""" """
Grade a course and push the results to an S3 bucket for download. Grade a course and push the results to an S3 bucket for download.
...@@ -175,7 +175,7 @@ def calculate_grades_csv(entry_id, xmodule_instance_args): ...@@ -175,7 +175,7 @@ def calculate_grades_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) @task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
def calculate_problem_grade_report(entry_id, xmodule_instance_args): def calculate_problem_grade_report(entry_id, xmodule_instance_args):
""" """
Generate a CSV for a course containing all students' problem Generate a CSV for a course containing all students' problem
...@@ -192,7 +192,7 @@ def calculate_problem_grade_report(entry_id, xmodule_instance_args): ...@@ -192,7 +192,7 @@ def calculate_problem_grade_report(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) @task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
def calculate_students_features_csv(entry_id, xmodule_instance_args): def calculate_students_features_csv(entry_id, xmodule_instance_args):
""" """
Compute student profile information for a course and upload the Compute student profile information for a course and upload the
...@@ -204,7 +204,7 @@ def calculate_students_features_csv(entry_id, xmodule_instance_args): ...@@ -204,7 +204,7 @@ def calculate_students_features_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def enrollment_report_features_csv(entry_id, xmodule_instance_args): def enrollment_report_features_csv(entry_id, xmodule_instance_args):
""" """
Compute student profile information for a course and upload the Compute student profile information for a course and upload the
...@@ -216,7 +216,7 @@ def enrollment_report_features_csv(entry_id, xmodule_instance_args): ...@@ -216,7 +216,7 @@ def enrollment_report_features_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def exec_summary_report_csv(entry_id, xmodule_instance_args): def exec_summary_report_csv(entry_id, xmodule_instance_args):
""" """
Compute executive summary report for a course and upload the Compute executive summary report for a course and upload the
...@@ -228,7 +228,7 @@ def exec_summary_report_csv(entry_id, xmodule_instance_args): ...@@ -228,7 +228,7 @@ def exec_summary_report_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def course_survey_report_csv(entry_id, xmodule_instance_args): def course_survey_report_csv(entry_id, xmodule_instance_args):
""" """
Compute the survey report for a course and upload the Compute the survey report for a course and upload the
...@@ -240,7 +240,7 @@ def course_survey_report_csv(entry_id, xmodule_instance_args): ...@@ -240,7 +240,7 @@ def course_survey_report_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def proctored_exam_results_csv(entry_id, xmodule_instance_args): def proctored_exam_results_csv(entry_id, xmodule_instance_args):
""" """
Compute proctored exam results report for a course and upload the Compute proctored exam results report for a course and upload the
...@@ -251,7 +251,7 @@ def proctored_exam_results_csv(entry_id, xmodule_instance_args): ...@@ -251,7 +251,7 @@ def proctored_exam_results_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) @task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
def calculate_may_enroll_csv(entry_id, xmodule_instance_args): def calculate_may_enroll_csv(entry_id, xmodule_instance_args):
""" """
Compute information about invited students who have not enrolled Compute information about invited students who have not enrolled
...@@ -264,7 +264,7 @@ def calculate_may_enroll_csv(entry_id, xmodule_instance_args): ...@@ -264,7 +264,7 @@ def calculate_may_enroll_csv(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) @task(base=BaseInstructorTask, routing_key=settings.GRADES_DOWNLOAD_ROUTING_KEY) # pylint: disable=not-callable
def generate_certificates(entry_id, xmodule_instance_args): def generate_certificates(entry_id, xmodule_instance_args):
""" """
Grade students and generate certificates. Grade students and generate certificates.
...@@ -280,7 +280,7 @@ def generate_certificates(entry_id, xmodule_instance_args): ...@@ -280,7 +280,7 @@ def generate_certificates(entry_id, xmodule_instance_args):
return run_main_task(entry_id, task_fn, action_name) return run_main_task(entry_id, task_fn, action_name)
@task(base=BaseInstructorTask) @task(base=BaseInstructorTask) # pylint: disable=not-callable
def cohort_students(entry_id, xmodule_instance_args): def cohort_students(entry_id, xmodule_instance_args):
""" """
Cohort students in bulk, and upload the results. Cohort students in bulk, and upload the results.
......
...@@ -11,7 +11,7 @@ set -e ...@@ -11,7 +11,7 @@ set -e
############################################################################### ###############################################################################
# Violations thresholds for failing the build # Violations thresholds for failing the build
export PYLINT_THRESHOLD=4999 export PYLINT_THRESHOLD=4700
export JSHINT_THRESHOLD=9080 export JSHINT_THRESHOLD=9080
doCheckVars() { doCheckVars() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment