From 86fbaee27df88b2a4b2bd3a177fa6663a596e109 Mon Sep 17 00:00:00 2001 From: Carlo Costino Date: Tue, 28 Nov 2023 17:33:17 -0500 Subject: [PATCH] Adjust positional arguments flagged by flake8-bugbear The new release of flake8-bugbear is starting to flag positional argument unpacking that comes after keyword arguments in function calls as a style warning that fails. This is a good thing to catch because it can lead to unexpected side effects with function arguments and/or errors thrown by Python. See the following links for more details: - https://stackoverflow.com/questions/58961715/python-value-unpacking-order-in-method-parameters - https://github.com/python/cpython/issues/82741 This changeset fixes a couple of instances where the positional argument unpacking was happening after keyword arguments were being provided. Signed-off-by: Carlo Costino --- app/main/forms.py | 2 +- app/notify_client/status_api_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index a0febf390..fb9b7eeac 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -956,9 +956,9 @@ class OnOffField(GovukRadiosField): ] super().__init__( label, + *args, choices=choices, thing=f"{choices[0][1].lower()} or {choices[1][1].lower()}", - *args, **kwargs, ) diff --git a/app/notify_client/status_api_client.py b/app/notify_client/status_api_client.py index d1a0cffcd..943c1baf1 100644 --- a/app/notify_client/status_api_client.py +++ b/app/notify_client/status_api_client.py @@ -3,7 +3,7 @@ from app.notify_client import NotifyAdminAPIClient, cache class StatusApiClient(NotifyAdminAPIClient): def get_status(self, *params): - return self.get(url="/_status", *params) + return self.get(*params, url="/_status") @cache.set("live-service-and-organization-counts", ttl_in_seconds=3600) def get_count_of_live_services_and_organizations(self):