From d6cba77e3f6c2ce0565fb39d5c61b3fd057ecbf5 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Wed, 16 Aug 2023 10:12:17 +0200 Subject: [PATCH] misc: apply double-quote-string-fixer (#79788) --- lingo/invoicing/forms.py | 2 +- lingo/invoicing/utils.py | 4 +- lingo/invoicing/views/home.py | 2 +- lingo/pricing/forms.py | 4 +- lingo/pricing/views.py | 6 +-- lingo/wsgi.py | 2 +- manage.py | 4 +- tests/agendas/test_chrono.py | 60 ++++++++++++++-------------- tests/api/test_invoicing.py | 4 +- tests/pricing/manager/test_agenda.py | 2 +- tests/settings.py | 4 +- 11 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lingo/invoicing/forms.py b/lingo/invoicing/forms.py index 49dedbb..3c6d51f 100644 --- a/lingo/invoicing/forms.py +++ b/lingo/invoicing/forms.py @@ -110,7 +110,7 @@ class CampaignForm(forms.ModelForm): Campaign.objects.filter(regie=self.instance.regie) .exclude(pk=self.instance.pk) .extra( - where=["(date_start, date_end) OVERLAPS (%s, %s)"], + where=['(date_start, date_end) OVERLAPS (%s, %s)'], params=[new_date_start, new_date_end], ) ) diff --git a/lingo/invoicing/utils.py b/lingo/invoicing/utils.py index 588e498..bd95ea0 100644 --- a/lingo/invoicing/utils.py +++ b/lingo/invoicing/utils.py @@ -40,7 +40,7 @@ def get_agendas(pool): agendas_pricings = AgendaPricing.objects.filter( flat_fee_schedule=False, agendas__regie=pool.campaign.regie, agendas__in=pool.campaign.agendas.all() ).extra( - where=["(date_start, date_end) OVERLAPS (%s, %s)"], + where=['(date_start, date_end) OVERLAPS (%s, %s)'], params=[pool.campaign.date_start, pool.campaign.date_end], ) return Agenda.objects.filter(pk__in=agendas_pricings.values('agendas')).order_by('pk') @@ -263,7 +263,7 @@ def get_all_invoice_lines(agendas, users, pool): agendas_pricings = ( AgendaPricing.objects.filter(flat_fee_schedule=False) .extra( - where=["(date_start, date_end) OVERLAPS (%s, %s)"], + where=['(date_start, date_end) OVERLAPS (%s, %s)'], params=[pool.campaign.date_start, pool.campaign.date_end], ) .prefetch_related('agendas', 'pricing__criterias', 'pricing__categories') diff --git a/lingo/invoicing/views/home.py b/lingo/invoicing/views/home.py index 63ac9d3..5fac476 100644 --- a/lingo/invoicing/views/home.py +++ b/lingo/invoicing/views/home.py @@ -116,7 +116,7 @@ class ConfigImportView(FormView): message2 = import_messages[obj_name]['update'](count) % {'count': count} if message1: - obj_results['messages'] = "%s %s" % (message1, message2) + obj_results['messages'] = '%s %s' % (message1, message2) else: obj_results['messages'] = message2 diff --git a/lingo/pricing/forms.py b/lingo/pricing/forms.py index 9f3b186..937f908 100644 --- a/lingo/pricing/forms.py +++ b/lingo/pricing/forms.py @@ -209,7 +209,7 @@ class AgendaPricingForm(NewAgendaPricingForm): AgendaPricing.objects.filter(flat_fee_schedule=new_flat_fee_schedule) .exclude(pk=self.instance.pk) .extra( - where=["(date_start, date_end) OVERLAPS (%s, %s)"], + where=['(date_start, date_end) OVERLAPS (%s, %s)'], params=[new_date_start, new_date_end], ) ) @@ -255,7 +255,7 @@ class AgendaPricingAgendaAddForm(forms.Form): overlapping_qs = AgendaPricing.objects.filter( flat_fee_schedule=self.agenda_pricing.flat_fee_schedule, agendas=agenda ).extra( - where=["(date_start, date_end) OVERLAPS (%s, %s)"], + where=['(date_start, date_end) OVERLAPS (%s, %s)'], params=[self.agenda_pricing.date_start, self.agenda_pricing.date_end], ) if overlapping_qs.exists(): diff --git a/lingo/pricing/views.py b/lingo/pricing/views.py index abd3b0b..f416e6a 100644 --- a/lingo/pricing/views.py +++ b/lingo/pricing/views.py @@ -194,7 +194,7 @@ class ConfigImportView(FormView): message2 = import_messages[obj_name]['update'](count) % {'count': count} if message1: - obj_results['messages'] = "%s %s" % (message1, message2) + obj_results['messages'] = '%s %s' % (message1, message2) else: obj_results['messages'] = message2 @@ -732,7 +732,7 @@ class AgendaBookingCheckSettingsView(AgendaMixin, UpdateView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['form_url'] = reverse('lingo-manager-agenda-booking-check-settings', args=[self.agenda.pk]) - context['title'] = _("Configure booking check options") + context['title'] = _('Configure booking check options') return context @@ -748,7 +748,7 @@ class AgendaInvoicingSettingsView(AgendaMixin, UpdateView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['form_url'] = reverse('lingo-manager-agenda-invoicing-settings', args=[self.agenda.pk]) - context['title'] = _("Configure invoicing options") + context['title'] = _('Configure invoicing options') return context diff --git a/lingo/wsgi.py b/lingo/wsgi.py index 2847f27..ad00367 100644 --- a/lingo/wsgi.py +++ b/lingo/wsgi.py @@ -18,6 +18,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lingo.settings") +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lingo.settings') application = get_wsgi_application() diff --git a/manage.py b/manage.py index edab5bb..91e89e0 100755 --- a/manage.py +++ b/manage.py @@ -2,8 +2,8 @@ import os import sys -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lingo.settings") +if __name__ == '__main__': + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lingo.settings') from django.core.management import execute_from_command_line diff --git a/tests/agendas/test_chrono.py b/tests/agendas/test_chrono.py index fd9c3ed..a71cecf 100644 --- a/tests/agendas/test_chrono.py +++ b/tests/agendas/test_chrono.py @@ -25,32 +25,32 @@ pytestmark = pytest.mark.django_db AGENDA_DATA = [ { - "slug": "events-a", - "kind": "events", - "text": "Events A", - "category": None, - "category_label": None, + 'slug': 'events-a', + 'kind': 'events', + 'text': 'Events A', + 'category': None, + 'category_label': None, }, { - "slug": "events-b", - "kind": "events", - "text": "Events B", - "category": "foo", - "category_label": "Foo", + 'slug': 'events-b', + 'kind': 'events', + 'text': 'Events B', + 'category': 'foo', + 'category_label': 'Foo', }, { - "slug": "meetings-a", - "kind": "meetings", - "text": "Meetings A", - "category": None, - "category_label": None, + 'slug': 'meetings-a', + 'kind': 'meetings', + 'text': 'Meetings A', + 'category': None, + 'category_label': None, }, { - "slug": "virtual-b", - "kind": "virtual", - "text": "Virtual B", - "category": "foo", - "category_label": "Foo", + 'slug': 'virtual-b', + 'kind': 'virtual', + 'text': 'Virtual B', + 'category': 'foo', + 'category_label': 'Foo', }, ] @@ -127,21 +127,21 @@ def test_refresh_agendas(mock_collect): assert Agenda.objects.count() == 2 agenda1 = Agenda.objects.all().order_by('pk')[0] agenda2 = Agenda.objects.all().order_by('pk')[1] - assert agenda1.label == "Events A" - assert agenda1.slug == "events-a" + assert agenda1.label == 'Events A' + assert agenda1.slug == 'events-a' assert agenda1.category_label is None assert agenda1.category_slug is None - assert agenda2.label == "Events B" - assert agenda2.slug == "events-b" + assert agenda2.label == 'Events B' + assert agenda2.slug == 'events-b' assert agenda2.category_label == 'Foo' assert agenda2.category_slug == 'foo' # again, but some attributes are wrong - agenda1.label = "Wrong" + agenda1.label = 'Wrong' agenda1.category_label = 'Foo' agenda1.category_slug = 'foo' agenda1.save() - agenda2.label = "Wrong" + agenda2.label = 'Wrong' agenda2.category_label is None agenda2.category_slug is None agenda2.save() @@ -150,13 +150,13 @@ def test_refresh_agendas(mock_collect): new_agenda1 = Agenda.objects.all().order_by('pk')[0] new_agenda2 = Agenda.objects.all().order_by('pk')[1] assert new_agenda1.pk == agenda1.pk - assert new_agenda1.label == "Events A" - assert new_agenda1.slug == "events-a" + assert new_agenda1.label == 'Events A' + assert new_agenda1.slug == 'events-a' assert new_agenda1.category_label is None assert new_agenda1.category_slug is None assert new_agenda2.pk == agenda2.pk - assert new_agenda2.label == "Events B" - assert new_agenda2.slug == "events-b" + assert new_agenda2.label == 'Events B' + assert new_agenda2.slug == 'events-b' assert new_agenda2.category_label == 'Foo' assert new_agenda2.category_slug == 'foo' diff --git a/tests/api/test_invoicing.py b/tests/api/test_invoicing.py index 75cc98f..b2a2a43 100644 --- a/tests/api/test_invoicing.py +++ b/tests/api/test_invoicing.py @@ -47,8 +47,8 @@ def test_regies(app, user): def test_payment_types(app, user): regie = Regie.objects.create(label='Bar') PaymentType.create_defaults(regie) - PaymentType.objects.create(regie=regie, label="Foo") - PaymentType.objects.create(regie=regie, label="Disabled", disabled=True) + PaymentType.objects.create(regie=regie, label='Foo') + PaymentType.objects.create(regie=regie, label='Disabled', disabled=True) app.get('/api/regie/%s/payment-types/' % regie.slug, status=403) app.authorization = ('Basic', ('john.doe', 'password')) diff --git a/tests/pricing/manager/test_agenda.py b/tests/pricing/manager/test_agenda.py index 9aae004..b823de2 100644 --- a/tests/pricing/manager/test_agenda.py +++ b/tests/pricing/manager/test_agenda.py @@ -16,7 +16,7 @@ def test_refresh_agendas(mock_refresh, app, admin_user): resp = resp.click('Refresh agendas') assert resp.location.endswith('/manage/pricing/agendas/') resp = resp.follow() - assert "Agendas refreshed." in resp + assert 'Agendas refreshed.' in resp assert mock_refresh.call_args_list == [mock.call()] diff --git a/tests/settings.py b/tests/settings.py index 6eeda1e..4beb0c6 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -19,7 +19,7 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'TEST': { - 'NAME': ('lingo-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-'))[:63], + 'NAME': ('lingo-test-%s' % os.environ.get('BRANCH_NAME', '').replace('/', '-'))[:63], }, } } @@ -54,7 +54,7 @@ KNOWN_SERVICES = { }, } -PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"] +PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher'] REST_FRAMEWORK = { 'EXCEPTION_HANDLER': 'lingo.api.utils.exception_handler', # this is the default value but by explicitely setting it