TE-2689 Remove useless pylint suppressions part 5

This commit is contained in:
Jeremy Bowman
2018-08-21 10:25:28 -04:00
parent 56392c7f2c
commit d90afa4cde
45 changed files with 60 additions and 75 deletions

View File

@@ -100,7 +100,7 @@ class Bookmark(TimeStampedModel):
"""
Return the resource id: {username,usage_id}.
"""
return u"{0},{1}".format(self.user.username, self.usage_key) # pylint: disable=no-member
return u"{0},{1}".format(self.user.username, self.usage_key)
@property
def display_name(self):
@@ -174,7 +174,7 @@ class Bookmark(TimeStampedModel):
path_data = []
for ancestor_usage_key in path:
if ancestor_usage_key != usage_key and ancestor_usage_key.block_type != 'course': # pylint: disable=no-member
if ancestor_usage_key != usage_key and ancestor_usage_key.block_type != 'course':
try:
block = modulestore().get_item(ancestor_usage_key)
except ItemNotFoundError:

View File

@@ -9,7 +9,7 @@ from xmodule.modulestore.django import SignalHandler
@receiver(SignalHandler.course_published)
def trigger_update_xblocks_cache_task(sender, course_key, **kwargs): # pylint: disable=invalid-name,unused-argument
def trigger_update_xblocks_cache_task(sender, course_key, **kwargs): # pylint: disable=unused-argument
"""
Trigger update_xblocks_cache() when course_published signal is fired.
"""

View File

@@ -3,7 +3,7 @@ Tasks for bookmarks.
"""
import logging
from celery.task import task # pylint: disable=import-error,no-name-in-module
from celery.task import task
from django.db import transaction
from opaque_keys.edx.keys import CourseKey

View File

@@ -32,7 +32,7 @@ class BookmarkApiEventTestMixin(object):
"""
Assert no events were emitted.
"""
self.assertFalse(mock_tracker.called) # pylint: disable=maybe-no-member
self.assertFalse(mock_tracker.called)
@ddt.ddt
@@ -110,7 +110,7 @@ class BookmarksAPITests(BookmarkApiEventTestMixin, BookmarksTestsBase):
with self.assertNumQueries(1):
bookmarks = api.get_bookmarks(user=self.user, course_key=course.id, serialized=False)
self.assertEqual(len(bookmarks), count)
self.assertIs(bookmarks.model, Bookmark) # pylint: disable=no-member
self.assertIs(bookmarks.model, Bookmark)
@patch('openedx.core.djangoapps.bookmarks.api.tracker.emit')
def test_create_bookmark(self, mock_tracker):

View File

@@ -131,7 +131,7 @@ class BookmarksTestsBase(ModuleStoreTestCase):
# self.other_vertical_1 has two parents
self.other_sequential_2.children.append(self.other_vertical_1.location)
modulestore().update_item(self.other_sequential_2, self.admin.id) # pylint: disable=no-member
modulestore().update_item(self.other_sequential_2, self.admin.id)
self.other_bookmark_1 = BookmarkFactory.create(
user=self.user,
@@ -393,7 +393,7 @@ class BookmarkModelTests(BookmarksTestsBase):
# Block is an orphan
self.other_sequential_1.children = []
modulestore().update_item(self.other_sequential_1, self.admin.id) # pylint: disable=no-member
modulestore().update_item(self.other_sequential_1, self.admin.id)
bookmark_data = self.get_bookmark_data(self.other_vertical_2, user=user)
bookmark, __ = Bookmark.create(bookmark_data)

View File

@@ -62,7 +62,7 @@ class XBlockCacheTaskTests(BookmarksTestsBase):
],
}
self.other_course_expected_cache_data = { # pylint: disable=invalid-name
self.other_course_expected_cache_data = {
self.other_course.location: [
[],
], self.other_chapter_1.location: [

View File

@@ -174,7 +174,7 @@ class BookmarksListViewTests(BookmarksViewsTestsBase):
bookmarks_data = response.data['results']
self.assertEqual(len(bookmarks_data), 0)
self.assertFalse(mock_tracker.emit.called) # pylint: disable=maybe-no-member
self.assertFalse(mock_tracker.emit.called)
@patch('eventtracking.tracker.emit')
def test_get_all_bookmarks_when_course_id_not_given(self, mock_tracker):

View File

@@ -87,7 +87,7 @@ class BookmarksViewMixin(object):
return Response(
{
"developer_message": developer_message,
"user_message": _(user_message) # pylint: disable=translation-of-non-string
"user_message": _(user_message)
},
status=error_status
)
@@ -318,7 +318,7 @@ class BookmarksDetailView(APIView, BookmarksViewMixin):
log.error(error_message)
return self.error_response(error_message, error_status=status.HTTP_404_NOT_FOUND)
def get(self, request, username=None, usage_id=None): # pylint: disable=unused-argument
def get(self, request, username=None, usage_id=None):
"""
GET /api/bookmarks/v1/bookmarks/{username},{usage_id}?fields=display_name,path
"""