From d4b3a42f945f752c0188e3dfd6dc87b7bb9b3ea2 Mon Sep 17 00:00:00 2001 From: Beichi-CHs Date: Thu, 18 Nov 2021 12:56:16 +0800 Subject: [PATCH] fix flake8 standard problems --- account/views/admin.py | 2 +- account/views/oj.py | 2 +- conf/tests.py | 2 +- problem/views/admin.py | 2 +- run_test.py | 2 +- utils/management/commands/inituser.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/account/views/admin.py b/account/views/admin.py index 77b305ae..b207db92 100644 --- a/account/views/admin.py +++ b/account/views/admin.py @@ -151,7 +151,7 @@ class GenerateUserAPI(APIView): raw_data = f.read() os.remove(file_path) response = HttpResponse(raw_data) - response["Content-Disposition"] = f"attachment; filename=users.xlsx" + response["Content-Disposition"] = "attachment; filename=users.xlsx" response["Content-Type"] = "application/xlsx" return response diff --git a/account/views/oj.py b/account/views/oj.py index 2d26e484..2a3c2e09 100644 --- a/account/views/oj.py +++ b/account/views/oj.py @@ -305,7 +305,7 @@ class ApplyResetPasswordAPI(APIView): send_email_async.send(from_name=SysOptions.website_name_shortcut, to_email=user.email, to_name=user.username, - subject=f"Reset your password", + subject="Reset your password", content=email_html) return self.success("Succeeded") diff --git a/conf/tests.py b/conf/tests.py index dce80c68..f0c1abb5 100644 --- a/conf/tests.py +++ b/conf/tests.py @@ -71,7 +71,7 @@ class WebsiteConfigAPITest(APITestCase): "allow_register": True, "submission_list_show_all": False} resp = self.client.post(url, data=data) self.assertSuccess(resp) - self.assertEqual(SysOptions.website_footer, "") + self.assertEqual(SysOptions.website_footer, '') def test_get_website_config(self): # do not need to login diff --git a/problem/views/admin.py b/problem/views/admin.py index 280e4fa1..5ce9413b 100644 --- a/problem/views/admin.py +++ b/problem/views/admin.py @@ -542,7 +542,7 @@ class ExportProblemAPI(APIView): delete_files.send_with_options(args=(path,), delay=300_000) resp = FileResponse(open(path, "rb")) resp["Content-Type"] = "application/zip" - resp["Content-Disposition"] = f"attachment;filename=problem-export.zip" + resp["Content-Disposition"] = "attachment;filename=problem-export.zip" return resp diff --git a/run_test.py b/run_test.py index cb4c6300..1c1cfb2e 100644 --- a/run_test.py +++ b/run_test.py @@ -21,7 +21,7 @@ print("running flake8...") if os.system("flake8 --statistics ."): exit() -ret = os.system("coverage run --include=\"$PWD/*\" manage.py test {module} --settings={setting}".format(module=test_module, setting=setting)) +ret = os.system('coverage run --include=\"$PWD/*\" manage.py test {module} --settings={setting}'.format(module=test_module, setting=setting)) if not ret and is_coverage: os.system("coverage html && open htmlcov/index.html") diff --git a/utils/management/commands/inituser.py b/utils/management/commands/inituser.py index a1ca73c8..e7769367 100644 --- a/utils/management/commands/inituser.py +++ b/utils/management/commands/inituser.py @@ -36,7 +36,7 @@ class Command(BaseCommand): user = User.objects.get(username=username) user.set_password(password) user.save() - self.stdout.write(self.style.SUCCESS(f"Password is rested")) + self.stdout.write(self.style.SUCCESS("Password is rested")) except User.DoesNotExist: self.stdout.write(self.style.ERROR(f"User {username} doesnot exist, operation ignored")) exit(1)