Applied pylint-amnesty to course_wiki
This commit is contained in:
@@ -27,7 +27,7 @@ class CodeMirrorWidget(forms.Widget):
|
||||
}
|
||||
if attrs:
|
||||
default_attrs.update(attrs)
|
||||
super(CodeMirrorWidget, self).__init__(default_attrs)
|
||||
super(CodeMirrorWidget, self).__init__(default_attrs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def render(self, name, value, attrs=None, renderer=None):
|
||||
if value is None:
|
||||
@@ -51,10 +51,10 @@ class CodeMirror(BaseEditor):
|
||||
"""
|
||||
editor_id = 'codemirror'
|
||||
|
||||
def get_admin_widget(self, instance=None):
|
||||
def get_admin_widget(self, instance=None): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
|
||||
return MarkItUpAdminWidget()
|
||||
|
||||
def get_widget(self, instance=None):
|
||||
def get_widget(self, instance=None): # lint-amnesty, pylint: disable=unused-argument
|
||||
return CodeMirrorWidget()
|
||||
|
||||
class AdminMedia(object): # pylint: disable=missing-class-docstring
|
||||
|
||||
@@ -35,12 +35,12 @@ class WikiAccessMiddleware(MiddlewareMixin):
|
||||
# See if we are able to view the course. If we are, redirect to it
|
||||
try:
|
||||
get_course_overview_with_access(request.user, 'load', course_id)
|
||||
return redirect("/courses/{course_id}/wiki/{path}".format(course_id=text_type(course_id), path=wiki_path))
|
||||
return redirect("/courses/{course_id}/wiki/{path}".format(course_id=text_type(course_id), path=wiki_path)) # lint-amnesty, pylint: disable=line-too-long
|
||||
except Http404:
|
||||
# Even though we came from the course, we can't see it. So don't worry about it.
|
||||
pass
|
||||
|
||||
def process_view(self, request, view_func, view_args, view_kwargs):
|
||||
def process_view(self, request, view_func, view_args, view_kwargs): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
This function handles authentication logic for wiki urls and redirects from
|
||||
the "root wiki" to the "course wiki" if the user accesses the wiki from a course url
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Make sure wiki_plugin.py gets run.
|
||||
# Make sure wiki_plugin.py gets run. # lint-amnesty, pylint: disable=missing-module-docstring
|
||||
|
||||
|
||||
from lms.djangoapps.course_wiki.plugins.markdownedx.wiki_plugin import ExtendMarkdownPlugin
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Source: https://github.com/mayoff/python-markdown-mathjax
|
||||
# Source: https://github.com/mayoff/python-markdown-mathjax # lint-amnesty, pylint: disable=missing-module-docstring
|
||||
|
||||
|
||||
import markdown
|
||||
@@ -7,11 +7,11 @@ try:
|
||||
# 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
|
||||
from markdown.util import etree, AtomicString
|
||||
except:
|
||||
except: # lint-amnesty, pylint: disable=bare-except
|
||||
from markdown import etree, AtomicString
|
||||
|
||||
|
||||
class MathJaxPattern(markdown.inlinepatterns.Pattern):
|
||||
class MathJaxPattern(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
|
||||
def __init__(self):
|
||||
markdown.inlinepatterns.Pattern.__init__(self, r'(?<!\\)(\$\$?)(.+?)\2')
|
||||
@@ -23,7 +23,7 @@ class MathJaxPattern(markdown.inlinepatterns.Pattern):
|
||||
|
||||
|
||||
class MathJaxExtension(markdown.Extension):
|
||||
def extendMarkdown(self, md, md_globals):
|
||||
def extendMarkdown(self, md, md_globals): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
|
||||
# Needs to come before escape matching because \ is pretty important in LaTeX
|
||||
md.inlinePatterns.add('mathjax', MathJaxPattern(), '<escape')
|
||||
|
||||
|
||||
@@ -142,7 +142,7 @@ except ImportError:
|
||||
version = "0.1.6"
|
||||
|
||||
|
||||
class VideoExtension(markdown.Extension):
|
||||
class VideoExtension(markdown.Extension): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def __init__(self, **kwargs):
|
||||
self.config = {
|
||||
'bliptv_width': ['480', 'Width for Blip.tv videos'],
|
||||
@@ -164,7 +164,7 @@ class VideoExtension(markdown.Extension):
|
||||
}
|
||||
|
||||
# Override defaults with user settings
|
||||
super(VideoExtension, self).__init__(**kwargs)
|
||||
super(VideoExtension, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def add_inline(self, md, name, klass, re): # pylint: disable=invalid-name
|
||||
"""Adds the inline link"""
|
||||
@@ -173,7 +173,7 @@ class VideoExtension(markdown.Extension):
|
||||
pattern.ext = self
|
||||
md.inlinePatterns.add(name, pattern, "<reference")
|
||||
|
||||
def extendMarkdown(self, md, md_globals):
|
||||
def extendMarkdown(self, md, md_globals): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
|
||||
self.add_inline(md, 'bliptv', Bliptv,
|
||||
r'([^(]|^)http://(\w+\.|)blip.tv/file/get/(?P<bliptvfile>\S+.flv)')
|
||||
self.add_inline(md, 'dailymotion', Dailymotion,
|
||||
@@ -192,7 +192,7 @@ class VideoExtension(markdown.Extension):
|
||||
r'([^(]|^)http://www\.youtube\.com/watch\?\S*v=(?P<youtubeargs>[A-Za-z0-9_&=-]+)\S*')
|
||||
|
||||
|
||||
class Bliptv(markdown.inlinepatterns.Pattern):
|
||||
class Bliptv(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def handleMatch(self, m):
|
||||
url = 'http://blip.tv/scripts/flash/showplayer.swf?file=http://blip.tv/file/get/%s' % m.group('bliptvfile')
|
||||
# pylint: disable=no-member
|
||||
@@ -201,7 +201,7 @@ class Bliptv(markdown.inlinepatterns.Pattern):
|
||||
return flash_object(url, width, height)
|
||||
|
||||
|
||||
class Dailymotion(markdown.inlinepatterns.Pattern):
|
||||
class Dailymotion(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def handleMatch(self, m):
|
||||
url = 'http://www.dailymotion.com/swf/%s' % m.group('dailymotionid').split('/')[-1]
|
||||
# pylint: disable=no-member
|
||||
@@ -210,7 +210,7 @@ class Dailymotion(markdown.inlinepatterns.Pattern):
|
||||
return flash_object(url, width, height)
|
||||
|
||||
|
||||
class Gametrailers(markdown.inlinepatterns.Pattern):
|
||||
class Gametrailers(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def handleMatch(self, m):
|
||||
url = 'http://www.gametrailers.com/remote_wrap.php?mid=%s' % \
|
||||
m.group('gametrailersid').split('/')[-1]
|
||||
@@ -220,7 +220,7 @@ class Gametrailers(markdown.inlinepatterns.Pattern):
|
||||
return flash_object(url, width, height)
|
||||
|
||||
|
||||
class Metacafe(markdown.inlinepatterns.Pattern):
|
||||
class Metacafe(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def handleMatch(self, m):
|
||||
url = 'http://www.metacafe.com/fplayer/%s.swf' % m.group('metacafeid')
|
||||
# pylint: disable=no-member
|
||||
@@ -229,7 +229,7 @@ class Metacafe(markdown.inlinepatterns.Pattern):
|
||||
return flash_object(url, width, height)
|
||||
|
||||
|
||||
class Veoh(markdown.inlinepatterns.Pattern):
|
||||
class Veoh(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def handleMatch(self, m):
|
||||
url = 'http://www.veoh.com/videodetails2.swf?permalinkId=%s' % m.group('veohid')
|
||||
# pylint: disable=no-member
|
||||
@@ -238,7 +238,7 @@ class Veoh(markdown.inlinepatterns.Pattern):
|
||||
return flash_object(url, width, height)
|
||||
|
||||
|
||||
class Vimeo(markdown.inlinepatterns.Pattern):
|
||||
class Vimeo(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def handleMatch(self, m):
|
||||
url = 'http://vimeo.com/moogaloop.swf?clip_id=%s&server=vimeo.com' % m.group('vimeoid')
|
||||
# pylint: disable=no-member
|
||||
@@ -247,7 +247,7 @@ class Vimeo(markdown.inlinepatterns.Pattern):
|
||||
return flash_object(url, width, height)
|
||||
|
||||
|
||||
class Yahoo(markdown.inlinepatterns.Pattern):
|
||||
class Yahoo(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def handleMatch(self, m):
|
||||
url = "http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.40"
|
||||
# pylint: disable=no-member
|
||||
@@ -262,7 +262,7 @@ class Yahoo(markdown.inlinepatterns.Pattern):
|
||||
return obj
|
||||
|
||||
|
||||
class Youtube(markdown.inlinepatterns.Pattern):
|
||||
class Youtube(markdown.inlinepatterns.Pattern): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
def handleMatch(self, m):
|
||||
url = 'http://www.youtube.com/v/%s' % m.group('youtubeargs')
|
||||
# pylint: disable=no-member
|
||||
@@ -271,7 +271,7 @@ class Youtube(markdown.inlinepatterns.Pattern):
|
||||
return flash_object(url, width, height)
|
||||
|
||||
|
||||
def flash_object(url, width, height):
|
||||
def flash_object(url, width, height): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
obj = etree.Element('object')
|
||||
obj.set('type', 'application/x-shockwave-flash')
|
||||
obj.set('width', width)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*- # lint-amnesty, pylint: disable=missing-module-docstring
|
||||
|
||||
|
||||
from wiki.core.plugins import registry as plugin_registry
|
||||
|
||||
@@ -18,11 +18,11 @@ from xmodule.modulestore.tests.factories import CourseFactory
|
||||
class TestWikiAccessBase(ModuleStoreTestCase):
|
||||
"""Base class for testing wiki access."""
|
||||
def setUp(self):
|
||||
super(TestWikiAccessBase, self).setUp()
|
||||
super(TestWikiAccessBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.wiki = get_or_create_root()
|
||||
|
||||
self.course_math101 = CourseFactory.create(org='org', number='math101', display_name='Course', metadata={'use_unique_wiki_id': 'false'})
|
||||
self.course_math101 = CourseFactory.create(org='org', number='math101', display_name='Course', metadata={'use_unique_wiki_id': 'false'}) # lint-amnesty, pylint: disable=line-too-long
|
||||
self.course_math101_staff = self.create_staff_for_course(self.course_math101)
|
||||
|
||||
wiki_math101 = self.create_urlpath(self.wiki, course_wiki_slug(self.course_math101))
|
||||
@@ -30,7 +30,7 @@ class TestWikiAccessBase(ModuleStoreTestCase):
|
||||
wiki_math101_page_page = self.create_urlpath(wiki_math101_page, 'Grandchild')
|
||||
self.wiki_math101_pages = [wiki_math101, wiki_math101_page, wiki_math101_page_page]
|
||||
|
||||
self.course_math101b = CourseFactory.create(org='org', number='math101b', display_name='Course', metadata={'use_unique_wiki_id': 'true'})
|
||||
self.course_math101b = CourseFactory.create(org='org', number='math101b', display_name='Course', metadata={'use_unique_wiki_id': 'true'}) # lint-amnesty, pylint: disable=line-too-long
|
||||
self.course_math101b_staff = self.create_staff_for_course(self.course_math101b)
|
||||
|
||||
wiki_math101b = self.create_urlpath(self.wiki, course_wiki_slug(self.course_math101b))
|
||||
@@ -54,7 +54,7 @@ class TestWikiAccessBase(ModuleStoreTestCase):
|
||||
class TestWikiAccess(TestWikiAccessBase):
|
||||
"""Test wiki access for course staff."""
|
||||
def setUp(self):
|
||||
super(TestWikiAccess, self).setUp()
|
||||
super(TestWikiAccess, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.course_310b = CourseFactory.create(org='org', number='310b', display_name='Course')
|
||||
self.course_310b_staff = self.create_staff_for_course(self.course_310b)
|
||||
@@ -114,7 +114,7 @@ class TestWikiAccess(TestWikiAccessBase):
|
||||
class TestWikiAccessForStudent(TestWikiAccessBase):
|
||||
"""Test access for students."""
|
||||
def setUp(self):
|
||||
super(TestWikiAccessForStudent, self).setUp()
|
||||
super(TestWikiAccessForStudent, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.student = UserFactory.create()
|
||||
|
||||
@@ -129,7 +129,7 @@ class TestWikiAccessForStudent(TestWikiAccessBase):
|
||||
class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase):
|
||||
"""Test staff has access if course number is numerical and wiki slug has an underscore appended."""
|
||||
def setUp(self):
|
||||
super(TestWikiAccessForNumericalCourseNumber, self).setUp()
|
||||
super(TestWikiAccessForNumericalCourseNumber, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.course_200 = CourseFactory.create(org='org', number='200', display_name='Course')
|
||||
self.course_200_staff = self.create_staff_for_course(self.course_200)
|
||||
@@ -148,7 +148,7 @@ class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase):
|
||||
class TestWikiAccessForOldFormatCourseStaffGroups(TestWikiAccessBase):
|
||||
"""Test staff has access if course group has old format."""
|
||||
def setUp(self):
|
||||
super(TestWikiAccessForOldFormatCourseStaffGroups, self).setUp()
|
||||
super(TestWikiAccessForOldFormatCourseStaffGroups, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.course_math101c = CourseFactory.create(org='org', number='math101c', display_name='Course')
|
||||
Group.objects.get_or_create(name='instructor_math101c')
|
||||
|
||||
@@ -20,7 +20,7 @@ class TestComprehensiveTheming(ModuleStoreTestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Test setup."""
|
||||
super(TestComprehensiveTheming, self).setUp()
|
||||
super(TestComprehensiveTheming, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.wiki = get_or_create_root()
|
||||
|
||||
|
||||
@@ -17,12 +17,12 @@ class TestWikiAccessMiddleware(ModuleStoreTestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Test setup."""
|
||||
super(TestWikiAccessMiddleware, self).setUp()
|
||||
super(TestWikiAccessMiddleware, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.wiki = get_or_create_root()
|
||||
|
||||
self.course_math101 = CourseFactory.create(org='edx', number='math101', display_name='2014', metadata={'use_unique_wiki_id': 'false'})
|
||||
self.course_math101_instructor = InstructorFactory(course_key=self.course_math101.id, username='instructor', password='secret')
|
||||
self.course_math101 = CourseFactory.create(org='edx', number='math101', display_name='2014', metadata={'use_unique_wiki_id': 'false'}) # lint-amnesty, pylint: disable=line-too-long
|
||||
self.course_math101_instructor = InstructorFactory(course_key=self.course_math101.id, username='instructor', password='secret') # lint-amnesty, pylint: disable=line-too-long
|
||||
self.wiki_math101 = URLPath.create_article(self.wiki, 'math101', title='math101')
|
||||
|
||||
self.client = Client()
|
||||
|
||||
@@ -16,7 +16,7 @@ class WikiTabTestCase(ModuleStoreTestCase):
|
||||
"""Test cases for Wiki Tab."""
|
||||
|
||||
def setUp(self):
|
||||
super(WikiTabTestCase, self).setUp()
|
||||
super(WikiTabTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course = CourseFactory.create()
|
||||
self.instructor = AdminFactory.create()
|
||||
self.user = UserFactory()
|
||||
|
||||
@@ -20,7 +20,7 @@ class WikiRedirectTestCase(EnterpriseTestConsentRequired, LoginEnrollmentTestCas
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(WikiRedirectTestCase, self).setUp()
|
||||
super(WikiRedirectTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.toy = CourseFactory.create(org='edX', course='toy', display_name='2012_Fall')
|
||||
|
||||
# Create two accounts
|
||||
@@ -227,4 +227,4 @@ class WikiRedirectTestCase(EnterpriseTestConsentRequired, LoginEnrollmentTestCas
|
||||
(reverse('course_wiki', kwargs={'course_id': course_id}), 302),
|
||||
('/courses/{}/wiki/'.format(course_id), 200),
|
||||
):
|
||||
self.verify_consent_required(self.client, url, status_code=status_code)
|
||||
self.verify_consent_required(self.client, url, status_code=status_code) # lint-amnesty, pylint: disable=no-value-for-parameter
|
||||
|
||||
@@ -46,7 +46,7 @@ def course_wiki_redirect(request, course_id, wiki_path=""):
|
||||
log.exception("This course is improperly configured. The slug cannot be empty.")
|
||||
valid_slug = False
|
||||
if re.match(r'^[-\w\.]+$', course_slug) is None:
|
||||
log.exception("This course is improperly configured. The slug can only contain letters, numbers, periods or hyphens.")
|
||||
log.exception("This course is improperly configured. The slug can only contain letters, numbers, periods or hyphens.") # lint-amnesty, pylint: disable=line-too-long
|
||||
valid_slug = False
|
||||
|
||||
if not valid_slug:
|
||||
|
||||
Reference in New Issue
Block a user