Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

Commit

Permalink
Fix new pylint 1.5.0 violations
Browse files Browse the repository at this point in the history
  • Loading branch information
bdero committed Dec 1, 2015
1 parent 739179a commit 59a1657
Show file tree
Hide file tree
Showing 15 changed files with 37 additions and 35 deletions.
6 changes: 2 additions & 4 deletions exporter/tests/test_export.py
Expand Up @@ -21,16 +21,14 @@
from learningresources.api import (
update_description_path,
create_static_asset,
create_resource,
create_course,
)
from exporter.api import (
export_resources_to_directory,
export_resources_to_tarball,
)
from exporter.tasks import export_resources
from learningresources.api import (
create_resource,
create_course,
)
from importer.tasks import import_file


Expand Down
5 changes: 3 additions & 2 deletions importer/api/__init__.py
Expand Up @@ -4,13 +4,14 @@

from __future__ import unicode_literals

from bs4 import BeautifulSoup
from shutil import rmtree
import logging
from tempfile import mkdtemp
from os.path import join, exists
from os import listdir

from bs4 import BeautifulSoup

from archive import Archive, ArchiveException
from django.core.files.storage import default_storage
from django.db import transaction
Expand Down Expand Up @@ -194,7 +195,7 @@ def import_children(course, element, parent, parent_dpath):
# temp variable to store static assets for bulk insert
static_assets_to_save = set()
target = "/static/"
if element.tag == "video":
if element.tag == "video": # pylint: disable=too-many-nested-blocks
subname = get_video_sub(element)
if subname != "":
assets = StaticAsset.objects.filter(
Expand Down
2 changes: 1 addition & 1 deletion importer/tests/test_import.py
Expand Up @@ -16,6 +16,7 @@
import mock
from lxml import etree

from xbundle import XBundle
from importer.api import (
import_course_from_file,
import_course_from_path,
Expand All @@ -33,7 +34,6 @@
)
from learningresources.tests.base import LoreTestCase
from lore import settings
from xbundle import XBundle

log = logging.getLogger(__name__)

Expand Down
5 changes: 3 additions & 2 deletions learningresources/tests/test_api.py
Expand Up @@ -5,12 +5,14 @@
from __future__ import unicode_literals

import logging
import tempfile

from django.core.files import File
from django.core.files.storage import default_storage
from django.core.management import call_command
from django.db.utils import IntegrityError
import tempfile

from mock import patch

from importer.api import import_course_from_file
from learningresources import api
Expand All @@ -19,7 +21,6 @@
LearningResource,
static_asset_basepath,
)
from mock import patch
from .base import LoreTestCase

log = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion learningresources/tests/test_models.py
Expand Up @@ -88,7 +88,7 @@ def test_unicode(self):
name="first"
)

self.assertEquals("first", str(first))
self.assertEqual("first", str(first))

def test_repo_slug(self):
"""Test behavior saving a repository slug"""
Expand Down
2 changes: 1 addition & 1 deletion learningresources/tests/test_utils.py
Expand Up @@ -33,7 +33,7 @@ def test_sub_language(self):
("de", "de_subs_CCxmtcICYNc.srt.sjson"),
)
for lang, sub in values:
self.assertEquals(sub, _subs_filename("CCxmtcICYNc", lang))
self.assertEqual(sub, _subs_filename("CCxmtcICYNc", lang))

def test_get_sub_name(self):
"""Test getting subtitle names."""
Expand Down
2 changes: 1 addition & 1 deletion lore/settings.py
Expand Up @@ -415,5 +415,5 @@ def get_var(name, default):
GOOGLE_ANALYTICS_ID = get_var('LORE_GOOGLE_ANALYTICS_ID', None)

# This is needed to connect the signals properly.
# pylint: disable=unused-import
# pylint: disable=unused-import,wrong-import-position
import search.signals # noqa
11 changes: 6 additions & 5 deletions rest/views.py
Expand Up @@ -24,10 +24,6 @@
from rest_framework.viewsets import GenericViewSet
from statsd.defaults.django import statsd

from learningresources.api import (
PermissionDenied,
NotFound,
)
from roles.permissions import GroupTypes, BaseGroupTypes
from roles.api import (
assign_user_to_repo_group,
Expand Down Expand Up @@ -77,6 +73,11 @@
from search.api import construct_queryset
from search.tasks import index_resources
from taxonomy.models import Vocabulary

from learningresources.api import (
PermissionDenied,
NotFound,
)
from learningresources.models import (
Repository,
Course,
Expand Down Expand Up @@ -654,7 +655,7 @@ def get_queryset(self):
exports = []
return [{"id": lr_id} for lr_id in exports]

def create(self, request, *args, **kwargs):
def create(self, request, *args, **kwargs): # noqa pylint: disable=unused-argument
try:
lr_id = int(request.data['id'])
except ValueError:
Expand Down
4 changes: 2 additions & 2 deletions roles/tests/test_user_models.py
Expand Up @@ -49,8 +49,8 @@ class FooObject(object):
def __init__(self, foo_var):
self.foo_var = foo_var

user_group2 = FooObject('bar')
self.assertFalse(user_group1.__eq__(user_group2))
foo_object = FooObject('bar')
self.assertFalse(user_group1.__eq__(foo_object))

def test_user_group_hash(self):
"""Test for UserGroup __hash__"""
Expand Down
2 changes: 1 addition & 1 deletion search/tasks.py
Expand Up @@ -4,8 +4,8 @@

from __future__ import unicode_literals

from lore.celery import async
from statsd.defaults.django import statsd
from lore.celery import async


@async.task
Expand Down
3 changes: 2 additions & 1 deletion search/utils.py
Expand Up @@ -5,10 +5,11 @@
from __future__ import unicode_literals

from collections import defaultdict
from lxml import etree
import logging
from itertools import islice

from lxml import etree

from django.conf import settings
from elasticsearch.helpers import bulk
from elasticsearch.exceptions import NotFoundError
Expand Down
14 changes: 7 additions & 7 deletions taxonomy/tests/test_api.py
Expand Up @@ -10,20 +10,20 @@
NotFound,
PermissionDenied,
)

from taxonomy.models import (
Vocabulary,
Term,
)
from learningresources.models import (
LearningResource,
LearningResourceType,
Course,
)

from taxonomy.api import (
get_term,
get_vocabulary,
)
from taxonomy.models import (
Vocabulary,
Term,
)


class TestApi(LoreTestCase):
Expand Down Expand Up @@ -69,7 +69,7 @@ def test_get_term(self):
self.vocabulary.slug,
self.term.slug
)
self.assertEquals(self.term, actual_term)
self.assertEqual(self.term, actual_term)
with self.assertRaises(NotFound):
get_term('missing', self.user.id,
self.vocabulary.slug, self.term.slug)
Expand All @@ -90,7 +90,7 @@ def test_get_vocabulary(self):

actual_vocabulary = get_vocabulary(
self.repo.slug, self.user.id, self.vocabulary.slug)
self.assertEquals(self.vocabulary, actual_vocabulary)
self.assertEqual(self.vocabulary, actual_vocabulary)

with self.assertRaises(NotFound):
get_vocabulary("missing", self.user.id, self.vocabulary.slug)
Expand Down
5 changes: 2 additions & 3 deletions tests/test_urls.py
Expand Up @@ -3,17 +3,16 @@
"""

from __future__ import unicode_literals
import ssl
from urltools import compare # noqa

from django.core.urlresolvers import reverse
from django.test import TestCase

import ssl

if hasattr(ssl, '_create_unverified_context'):
ssl._create_default_https_context = ssl._create_unverified_context # noqa pylint: disable=protected-access

from urltools import compare # noqa


class TestURLs(TestCase):
"""Verify project level URL configuration."""
Expand Down
4 changes: 2 additions & 2 deletions ui/tests/test_ga.py
Expand Up @@ -3,10 +3,10 @@
"""
from __future__ import unicode_literals

from learningresources.tests.base import LoreTestCase

from django.test.utils import override_settings

from learningresources.tests.base import LoreTestCase


class TestGoogleAnalytics(LoreTestCase):
"""Test the Google Analytics setting."""
Expand Down
5 changes: 3 additions & 2 deletions ui/tests/test_learningresources_views.py
Expand Up @@ -12,14 +12,15 @@
from django.core.files.storage import default_storage
from django.core.urlresolvers import resolve

from six.moves import reload_module # pylint: disable=import-error

import ui.urls
from learningresources.tests.base import LoreTestCase
from learningresources.models import Repository, StaticAsset
from roles.api import assign_user_to_repo_group, remove_user_from_repo_group
from roles.permissions import GroupTypes
from search.sorting import LoreSortingFields
from six.moves import reload_module # pylint: disable=import-error

from learningresources.tests.base import LoreTestCase

HTTP_OK = 200
UNAUTHORIZED = 403
Expand Down

0 comments on commit 59a1657

Please sign in to comment.