From 37b90e202678731659e4076d7f30ede3c9881610 Mon Sep 17 00:00:00 2001 From: Dylan Verheul Date: Fri, 6 Oct 2023 15:14:37 +0200 Subject: [PATCH] Fix codestyle, update ruff and black --- pyproject.toml | 4 ++-- src/bootstrap3/renderers.py | 16 ++-------------- tests/test_templatetags.py | 4 +--- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fd3251b4..d7886385 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -123,8 +123,8 @@ clean = "rm -rf docs/_build" [tool.hatch.envs.lint] dependencies = [ - "black>=23.3.0", - "ruff>=0.0.270", + "black>=23.9.1", + "ruff>=0.0.292", ] detached = true diff --git a/src/bootstrap3/renderers.py b/src/bootstrap3/renderers.py index 1dda58a7..55680988 100644 --- a/src/bootstrap3/renderers.py +++ b/src/bootstrap3/renderers.py @@ -382,20 +382,8 @@ def make_input_group(self, html): if (self.addon_before or self.addon_after) and isinstance( self.widget, (TextInput, NumberInput, EmailInput, URLInput, DateInput, Select, PasswordInput) ): - before = ( - '{addon}'.format( - input_class=self.addon_before_class, addon=self.addon_before - ) - if self.addon_before - else "" - ) - after = ( - '{addon}'.format( - input_class=self.addon_after_class, addon=self.addon_after - ) - if self.addon_after - else "" - ) + before = f'{self.addon_before}' if self.addon_before else "" + after = f'{self.addon_after}' if self.addon_after else "" html = f'
{before}{html}{after}
' return html diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py index a2a61830..65f76029 100644 --- a/tests/test_templatetags.py +++ b/tests/test_templatetags.py @@ -496,9 +496,7 @@ def assertFieldHasAddons(self, field): addon_after = "af" res = render_template_with_form( - '{{% bootstrap_field form.{} addon_before="{}" addon_after="{}" %}}'.format( - field, addon_before, addon_after - ) + f'{{% bootstrap_field form.{field} addon_before="{addon_before}" addon_after="{addon_after}" %}}' ) self.assertIn('class="input-group"', res)