From f7cbe49393054a34078dfbd2ded5e261faf138b4 Mon Sep 17 00:00:00 2001 From: Piotr Gawron <piotr.gawron@uni.lu> Date: Fri, 20 Aug 2021 15:10:08 +0200 Subject: [PATCH] "pylint: disable=unused-variable" removed --- smash/web/api_views/daily_planning.py | 4 ++-- smash/web/models/worker.py | 8 ++++---- smash/web/tests/importer/test_importer_cron_job.py | 4 ++-- smash/web/tests/models/test_study_subject.py | 2 +- smash/web/views/auth.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/smash/web/api_views/daily_planning.py b/smash/web/api_views/daily_planning.py index 8886ea16..5892dcd3 100644 --- a/smash/web/api_views/daily_planning.py +++ b/smash/web/api_views/daily_planning.py @@ -177,7 +177,7 @@ def get_conflicts(worker, date): location__in=get_filter_locations(worker), status=Appointment.APPOINTMENT_STATUS_SCHEDULED, visit__isnull=False).all() - for i, appointment in enumerate(appointments): # pylint: disable=unused-variable + for _, appointment in enumerate(appointments): if appointment.worker_assigned is not None: link_when = appointment.datetime_when link_when = link_when.replace(tzinfo=None) @@ -196,7 +196,7 @@ def get_conflicts(worker, date): links = AppointmentTypeLink.objects.filter( appointment=appointment).all() - for j, link in enumerate(links): # pylint: disable=unused-variable + for _, link in enumerate(links): link_when = link.date_when if link_when is not None: link_when = link_when.replace(tzinfo=None) diff --git a/smash/web/models/worker.py b/smash/web/models/worker.py index 7b87a8e5..e2b8d6a1 100644 --- a/smash/web/models/worker.py +++ b/smash/web/models/worker.py @@ -28,7 +28,7 @@ def roles_by_worker_type(worker_type): roles = [] - for role_type, role_name in role_choices: # pylint: disable=unused-variable + for role_type, _ in role_choices: roles.append(role_type) return roles @@ -49,13 +49,13 @@ def worker_type_by_worker(worker): if roles.count() == 0: return WORKER_STAFF role = roles[0].name - for role_type, role_name in STUDY_ROLE_CHOICES: # pylint: disable=unused-variable + for role_type, _ in STUDY_ROLE_CHOICES: if role_type == role: return WORKER_STAFF - for role_type, role_name in HEALTH_PARTNER_ROLE_CHOICES: + for role_type, _ in HEALTH_PARTNER_ROLE_CHOICES: if role_type == role: return WORKER_HEALTH_PARTNER - for role_type, role_name in VOUCHER_PARTNER_ROLE_CHOICES: + for role_type, _ in VOUCHER_PARTNER_ROLE_CHOICES: if role_type == role: return WORKER_VOUCHER_PARTNER raise TypeError("Unknown worker role") diff --git a/smash/web/tests/importer/test_importer_cron_job.py b/smash/web/tests/importer/test_importer_cron_job.py index aa53e001..d133ac7d 100644 --- a/smash/web/tests/importer/test_importer_cron_job.py +++ b/smash/web/tests/importer/test_importer_cron_job.py @@ -44,7 +44,7 @@ class TestCronJobImporter(TestCase): def test_import(self): filename = get_resource_path('tns_subjects_import.csv') - new_file, tmp = tempfile.mkstemp() # pylint: disable=unused-variable + _, tmp = tempfile.mkstemp() copyfile(filename, tmp) settings.ETL_ROOT = os.path.dirname(tmp) @@ -59,7 +59,7 @@ class TestCronJobImporter(TestCase): def test_import_visit(self): filename = get_resource_path('tns_vouchers_3_import.csv') - new_file, tmp = tempfile.mkstemp() # pylint: disable=unused-variable + _, tmp = tempfile.mkstemp() copyfile(filename, tmp) settings.ETL_ROOT = os.path.dirname(tmp) diff --git a/smash/web/tests/models/test_study_subject.py b/smash/web/tests/models/test_study_subject.py index c94b46a3..30247a05 100644 --- a/smash/web/tests/models/test_study_subject.py +++ b/smash/web/tests/models/test_study_subject.py @@ -127,7 +127,7 @@ class SubjectModelTests(TestCase): def create_result(phrase, subject_id=1): phrase = phrase.format(subject_id=subject_id) phrase = phrase.split(';') - for i, r in enumerate(phrase): # pylint: disable=unused-variable + for i, _ in enumerate(phrase): letter, num = phrase[i].strip().split('-') phrase[i] = (letter, int(num)) return phrase diff --git a/smash/web/views/auth.py b/smash/web/views/auth.py index 95a552eb..ae1688b8 100644 --- a/smash/web/views/auth.py +++ b/smash/web/views/auth.py @@ -37,7 +37,7 @@ def login(request): return render(request, "login.html", context) def logout(request): - state, message = do_logout(request) # pylint: disable=unused-variable + _, message = do_logout(request) response = redirect(login_url) response['Location'] += "?error={}".format(message) return response -- GitLab