From 78b35fe28ced595fb8a0d81e806e388c3dfd5b3f Mon Sep 17 00:00:00 2001 From: kiblik <5609770+kiblik@users.noreply.github.com> Date: Fri, 3 Jan 2025 13:40:28 +0100 Subject: [PATCH] Ruff: Fix RUF051 --- dojo/forms.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/dojo/forms.py b/dojo/forms.py index 334a958e93f..3837b4d3933 100644 --- a/dojo/forms.py +++ b/dojo/forms.py @@ -1951,9 +1951,7 @@ class MetricsFilterForm(forms.Form): # add the ability to exclude the exclude_product_types field def __init__(self, *args, **kwargs): - exclude_product_types = kwargs.get("exclude_product_types", False) - if "exclude_product_types" in kwargs: - del kwargs["exclude_product_types"] + exclude_product_types = kwargs.pop("exclude_product_types", False) super().__init__(*args, **kwargs) if exclude_product_types: del self.fields["exclude_product_types"] @@ -3208,10 +3206,7 @@ def __init__(self, *args, **kwargs): self.helper.form_method = "post" # If true crispy-forms will render a
..
tags - self.helper.form_tag = kwargs.get("form_tag", True) - - if "form_tag" in kwargs: - del kwargs["form_tag"] + self.helper.form_tag = kwargs.pop("form_tag", True) self.engagement_survey = kwargs.get("engagement_survey") @@ -3223,13 +3218,12 @@ def __init__(self, *args, **kwargs): self.helper.form_class = kwargs.get("form_class", "") - self.question = kwargs.get("question") + self.question = kwargs.pop("question", None) if not self.question: msg = "Need a question to render" raise ValueError(msg) - del kwargs["question"] super().__init__(*args, **kwargs)