Skip to content

Commit 02c0cf8

Browse files
committed
[qa] Switched to double quotes (black formatter)
1 parent 069a9c9 commit 02c0cf8

File tree

95 files changed

+3091
-3103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3091
-3103
lines changed

docs/developer/django-rest-framework-utils.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,18 +323,14 @@ Usage example:
323323
324324
325325
class FloorPlanOrganizationFilter(FilterDjangoByOrgManaged):
326-
organization_slug = filters.CharFilter(
327-
field_name="organization__slug"
328-
)
326+
organization_slug = filters.CharFilter(field_name="organization__slug")
329327
330328
class Meta:
331329
model = FloorPlan
332330
fields = ["organization", "organization_slug"]
333331
334332
335-
class FloorPlanListCreateView(
336-
ProtectedAPIMixin, generics.ListCreateAPIView
337-
):
333+
class FloorPlanListCreateView(ProtectedAPIMixin, generics.ListCreateAPIView):
338334
serializer_class = FloorPlanSerializer
339335
queryset = FloorPlan.objects.select_related().order_by("-created")
340336
pagination_class = ListViewPagination
@@ -360,9 +356,7 @@ Usage example:
360356
model = FloorPlan
361357
362358
363-
class FloorPlanListCreateView(
364-
ProtectedAPIMixin, generics.ListCreateAPIView
365-
):
359+
class FloorPlanListCreateView(ProtectedAPIMixin, generics.ListCreateAPIView):
366360
serializer_class = FloorPlanSerializer
367361
queryset = FloorPlan.objects.select_related().order_by("-created")
368362
pagination_class = ListViewPagination

docs/developer/extending.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ Once you have created the models, add the following to your
176176
# but users are free to implement it in their projects if needed
177177
# for more information refer to the django-organizations docs:
178178
# https://django-organizations.readthedocs.io/
179-
OPENWISP_USERS_ORGANIZATIONINVITATION_MODEL = (
180-
"myusers.OrganizationInvitation"
181-
)
179+
OPENWISP_USERS_ORGANIZATIONINVITATION_MODEL = "myusers.OrganizationInvitation"
182180
183181
Substitute ``myusers`` with the name you chose in step 1.
184182

openwisp_users/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
VERSION = (1, 2, 0, 'alpha')
1+
VERSION = (1, 2, 0, "alpha")
22
__version__ = VERSION # alias
33

44

55
def get_version():
6-
version = '%s.%s.%s' % (VERSION[0], VERSION[1], VERSION[2])
7-
if VERSION[3] != 'final':
6+
version = "%s.%s.%s" % (VERSION[0], VERSION[1], VERSION[2])
7+
if VERSION[3] != "final":
88
first_letter = VERSION[3][0:1]
99
try:
1010
suffix = VERSION[4]
1111
except IndexError:
1212
suffix = 0
13-
version = '%s%s%s' % (version, first_letter, suffix)
13+
version = "%s%s%s" % (version, first_letter, suffix)
1414
return version

openwisp_users/accounts/adapter.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ def send_mail(self, template_prefix, email, context):
1313
subject = self.format_email_subject(subject)
1414
content = {}
1515
errors = {}
16-
for ext in ['html', 'txt']:
17-
template_name = '{0}_message.{1}'.format(template_prefix, ext)
18-
if 'activate_url' in context:
19-
context['call_to_action_url'] = context['activate_url']
20-
context['call_to_action_text'] = _('Confirm')
16+
for ext in ["html", "txt"]:
17+
template_name = "{0}_message.{1}".format(template_prefix, ext)
18+
if "activate_url" in context:
19+
context["call_to_action_url"] = context["activate_url"]
20+
context["call_to_action_text"] = _("Confirm")
2121
try:
22-
template_name = '{0}_message.{1}'.format(template_prefix, ext)
22+
template_name = "{0}_message.{1}".format(template_prefix, ext)
2323
content[ext] = render_to_string(
2424
template_name, context, self.request
2525
).strip()
2626
except TemplateDoesNotExist as e:
2727
errors[ext] = e
28-
text = content.get('txt', '')
29-
html = content.get('html', '')
28+
text = content.get("txt", "")
29+
html = content.get("html", "")
3030
# both templates fail to load, raise the exception
3131
if len(errors.keys()) >= 2:
32-
raise errors['txt'] from errors['html']
32+
raise errors["txt"] from errors["html"]
3333
send_email(subject, text, html, [email], context)

openwisp_users/accounts/urls.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,73 +16,73 @@
1616

1717
from .views import password_change, password_change_success
1818

19-
redirect_view = RedirectView.as_view(url=reverse_lazy('admin:index'))
19+
redirect_view = RedirectView.as_view(url=reverse_lazy("admin:index"))
2020

2121

2222
urlpatterns = [
23-
path('signup/', redirect_view, name='account_signup'),
24-
path('login/', views.login, name='account_login'),
25-
path('logout/', views.logout, name='account_logout'),
26-
path('inactive/', views.account_inactive, name='account_inactive'),
23+
path("signup/", redirect_view, name="account_signup"),
24+
path("login/", views.login, name="account_login"),
25+
path("logout/", views.logout, name="account_logout"),
26+
path("inactive/", views.account_inactive, name="account_inactive"),
2727
# E-mail
2828
path(
29-
'confirm-email/',
29+
"confirm-email/",
3030
views.email_verification_sent,
31-
name='account_email_verification_sent',
31+
name="account_email_verification_sent",
3232
),
3333
re_path(
34-
r'^confirm-email/(?P<key>[-:\w]+)/$',
34+
r"^confirm-email/(?P<key>[-:\w]+)/$",
3535
views.confirm_email,
36-
name='account_confirm_email',
36+
name="account_confirm_email",
3737
),
3838
# password change
3939
path(
40-
'password/change/',
40+
"password/change/",
4141
password_change,
4242
name="account_change_password",
4343
),
4444
path(
45-
'password/change/success/',
45+
"password/change/success/",
4646
password_change_success,
47-
name='account_change_password_success',
47+
name="account_change_password_success",
4848
),
4949
# password reset
50-
path('password/reset/', views.password_reset, name='account_reset_password'),
50+
path("password/reset/", views.password_reset, name="account_reset_password"),
5151
path(
52-
'password/reset/done/',
52+
"password/reset/done/",
5353
views.password_reset_done,
54-
name='account_reset_password_done',
54+
name="account_reset_password_done",
5555
),
5656
re_path(
57-
r'^password/reset/key/(?P<uidb36>[0-9A-Za-z]+)-(?P<key>.+)/$',
57+
r"^password/reset/key/(?P<uidb36>[0-9A-Za-z]+)-(?P<key>.+)/$",
5858
views.password_reset_from_key,
59-
name='account_reset_password_from_key',
59+
name="account_reset_password_from_key",
6060
),
6161
path(
62-
'password/reset/key/done/',
62+
"password/reset/key/done/",
6363
views.password_reset_from_key_done,
64-
name='account_reset_password_from_key_done',
64+
name="account_reset_password_from_key_done",
6565
),
6666
path(
67-
'email-verification-success/',
68-
TemplateView.as_view(template_name='account/email_verification_success.html'),
69-
name='email_confirmation_success',
67+
"email-verification-success/",
68+
TemplateView.as_view(template_name="account/email_verification_success.html"),
69+
name="email_confirmation_success",
7070
),
7171
path(
72-
'logout-success/',
73-
TemplateView.as_view(template_name='account/logout_success.html'),
74-
name='logout_success',
72+
"logout-success/",
73+
TemplateView.as_view(template_name="account/logout_success.html"),
74+
name="logout_success",
7575
),
7676
]
7777

7878
if app_settings.SOCIALACCOUNT_ENABLED:
79-
urlpatterns += [path('social/', include('allauth.socialaccount.urls'))]
79+
urlpatterns += [path("social/", include("allauth.socialaccount.urls"))]
8080

8181
for provider in providers.registry.get_class_list():
8282
try:
83-
prov_mod = import_module(provider.get_package() + '.urls')
83+
prov_mod = import_module(provider.get_package() + ".urls")
8484
except ImportError:
8585
continue
86-
prov_urlpatterns = getattr(prov_mod, 'urlpatterns', None)
86+
prov_urlpatterns = getattr(prov_mod, "urlpatterns", None)
8787
if prov_urlpatterns:
8888
urlpatterns += prov_urlpatterns

openwisp_users/accounts/views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class ChangePasswordForm(BaseChangePasswordForm):
1515

1616
class PasswordChangeView(BasePasswordChangeView):
1717
form_class = ChangePasswordForm
18-
template_name = 'account/password_change.html'
19-
success_url = reverse_lazy('account_change_password_success')
18+
template_name = "account/password_change.html"
19+
success_url = reverse_lazy("account_change_password_success")
2020

2121
def get_success_url(self):
2222
if self.request.POST.get(REDIRECT_FIELD_NAME):
@@ -25,17 +25,17 @@ def get_success_url(self):
2525

2626
def get_initial(self):
2727
data = super().get_initial()
28-
data['next'] = self.request.GET.get(REDIRECT_FIELD_NAME)
28+
data["next"] = self.request.GET.get(REDIRECT_FIELD_NAME)
2929
return data
3030

3131
@sensitive_post_parameters_m
3232
def dispatch(self, request, *args, **kwargs):
3333
if not self.request.user.has_usable_password():
34-
return render(self.request, 'account/password_not_required.html')
34+
return render(self.request, "account/password_not_required.html")
3535
return super().dispatch(request, *args, **kwargs)
3636

3737

3838
password_change = login_required(PasswordChangeView.as_view())
3939
password_change_success = login_required(
40-
TemplateView.as_view(template_name='account/password_change_success.html')
40+
TemplateView.as_view(template_name="account/password_change_success.html")
4141
)

0 commit comments

Comments
 (0)