From b9ed4b6561dc7e4de88626ef6e0d845cd4488630 Mon Sep 17 00:00:00 2001 From: stv Date: Sun, 15 Feb 2015 19:58:09 -0800 Subject: [PATCH] Fix Pylint: E1305(too-many-format-args) --- cms/djangoapps/contentstore/git_export_utils.py | 4 +++- .../contentstore/management/commands/create_course.py | 7 ++++++- common/lib/xmodule/xmodule/modulestore/exceptions.py | 7 +++++-- lms/djangoapps/licenses/tests.py | 5 ++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/cms/djangoapps/contentstore/git_export_utils.py b/cms/djangoapps/contentstore/git_export_utils.py index d2b77b49a4..9cefdcc287 100644 --- a/cms/djangoapps/contentstore/git_export_utils.py +++ b/cms/djangoapps/contentstore/git_export_utils.py @@ -161,7 +161,9 @@ def export_to_git(course_id, repo, user='', rdir=None): ident = GIT_EXPORT_DEFAULT_IDENT time_stamp = timezone.now() cwd = os.path.abspath(rdirp) - commit_msg = 'Export from Studio at {1}'.format(user, time_stamp) + commit_msg = "Export from Studio at {time_stamp}".format( + time_stamp=time_stamp, + ) try: cmd_log(['git', 'config', 'user.email', ident['email']], cwd) cmd_log(['git', 'config', 'user.name', ident['name']], cwd) diff --git a/cms/djangoapps/contentstore/management/commands/create_course.py b/cms/djangoapps/contentstore/management/commands/create_course.py index 12c7054d2a..19d88a597e 100644 --- a/cms/djangoapps/contentstore/management/commands/create_course.py +++ b/cms/djangoapps/contentstore/management/commands/create_course.py @@ -40,7 +40,12 @@ class Command(BaseCommand): try: user = user_from_str(args[1]) except User.DoesNotExist: - raise CommandError("No user {} found: expected args are ".format(args[1], self.args)) + raise CommandError( + "No user {user} found: expected args are {args}".format( + user=args[1], + args=self.args, + ), + ) org = args[2] course = args[3] diff --git a/common/lib/xmodule/xmodule/modulestore/exceptions.py b/common/lib/xmodule/xmodule/modulestore/exceptions.py index d98c744009..12be4c398b 100644 --- a/common/lib/xmodule/xmodule/modulestore/exceptions.py +++ b/common/lib/xmodule/xmodule/modulestore/exceptions.py @@ -50,8 +50,11 @@ class DuplicateItemError(Exception): """ Print info about what's duplicated """ - return '{0.store}[{0.collection}] already has {0.element_id}'.format( - self, Exception.__str__(self, *args, **kwargs) + return "{store}[{collection}] already has {element_id} ({exception})".format( + store=self.store, + collection=self.collection, + element_id=self.element_id, + exception=Exception.__str__(self, *args, **kwargs), ) diff --git a/lms/djangoapps/licenses/tests.py b/lms/djangoapps/licenses/tests.py index 0c37798b84..c5185ccb5b 100644 --- a/lms/djangoapps/licenses/tests.py +++ b/lms/djangoapps/licenses/tests.py @@ -184,7 +184,10 @@ class CommandTest(ModuleStoreTestCase): software_count = CourseSoftware.objects.all().count() self.assertEqual(2, software_count) - log.debug('Now we should have 3 sets of 20 serials'.format(size)) + log.debug( + "Now we should have 3 sets of %s serials", + size, + ) licenses_count = UserLicense.objects.all().count() self.assertEqual(3 * size, licenses_count)