Commit e18507f1 by David Baumgold

fix pep8/pylint issues

parent 692502c0
...@@ -11,7 +11,7 @@ from xmodule.modulestore import InvalidLocationError ...@@ -11,7 +11,7 @@ from xmodule.modulestore import InvalidLocationError
from xmodule.modulestore.django import loc_mapper from xmodule.modulestore.django import loc_mapper
def user_from_str(s): def user_from_str(identifier):
""" """
Return a user identified by the given string. The string could be an email Return a user identified by the given string. The string could be an email
address, or a stringified integer corresponding to the ID of the user in address, or a stringified integer corresponding to the ID of the user in
...@@ -19,14 +19,16 @@ def user_from_str(s): ...@@ -19,14 +19,16 @@ def user_from_str(s):
will be raised. will be raised.
""" """
try: try:
user_id = int(s) user_id = int(identifier)
except ValueError: except ValueError:
return User.objects.get(email=s) return User.objects.get(email=identifier)
else: else:
return User.objects.get(id=user_id) return User.objects.get(id=user_id)
class Command(BaseCommand): class Command(BaseCommand):
"Migrate a course from old-Mongo to split-Mongo"
help = "Migrate a course from old-Mongo to split-Mongo" help = "Migrate a course from old-Mongo to split-Mongo"
args = "location email <locator>" args = "location email <locator>"
......
...@@ -11,9 +11,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase ...@@ -11,9 +11,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.persistent_factories import PersistentCourseFactory from xmodule.modulestore.tests.persistent_factories import PersistentCourseFactory
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError from xmodule.modulestore.exceptions import ItemNotFoundError
# pylint: disable=E1101
class TestArgParsing(unittest.TestCase): class TestArgParsing(unittest.TestCase):
"""
Tests for parsing arguments for the `delete_split_course` management command
"""
def setUp(self): def setUp(self):
self.command = Command() self.command = Command()
......
...@@ -12,9 +12,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase ...@@ -12,9 +12,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.django import modulestore from xmodule.modulestore.django import modulestore
from xmodule.modulestore.django import loc_mapper from xmodule.modulestore.django import loc_mapper
# pylint: disable=E1101
class TestArgParsing(unittest.TestCase): class TestArgParsing(unittest.TestCase):
"""
Tests for parsing arguments for the `migrate_to_split` management command
"""
def setUp(self): def setUp(self):
self.command = Command() self.command = Command()
......
...@@ -225,9 +225,9 @@ class ModuleStoreTestCase(TestCase): ...@@ -225,9 +225,9 @@ class ModuleStoreTestCase(TestCase):
if contentstore().fs_files: if contentstore().fs_files:
db = contentstore().fs_files.database db = contentstore().fs_files.database
db.connection.drop_database(db) db.connection.drop_database(db)
lm = loc_mapper() location_mapper = loc_mapper()
if lm.db: if location_mapper.db:
lm.location_map.drop() location_mapper.location_map.drop()
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
......
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