Skip to content

Commit ba733cf

Browse files
committed
[qa] Switched to double quotes (black formatter)
1 parent 4836913 commit ba733cf

File tree

274 files changed

+10644
-10650
lines changed

Some content is hidden

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

274 files changed

+10644
-10650
lines changed

docs/developer/extending.rst

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,7 @@ Once you have created the models, add the following to your
342342
CONFIG_TEMPLATE_MODEL = "sample_config.Template"
343343
CONFIG_VPN_MODEL = "sample_config.Vpn"
344344
CONFIG_VPNCLIENT_MODEL = "sample_config.VpnClient"
345-
CONFIG_ORGANIZATIONCONFIGSETTINGS_MODEL = (
346-
"sample_config.OrganizationConfigSettings"
347-
)
345+
CONFIG_ORGANIZATIONCONFIGSETTINGS_MODEL = "sample_config.OrganizationConfigSettings"
348346
CONFIG_ORGANIZATIONLIMITS_MODEL = "sample_config.OrganizationLimits"
349347
DJANGO_X509_CA_MODEL = "sample_pki.Ca"
350348
DJANGO_X509_CERT_MODEL = "sample_pki.Cert"
@@ -354,12 +352,8 @@ Once you have created the models, add the following to your
354352
CONNECTION_CREDENTIALS_MODEL = "sample_connection.Credentials"
355353
CONNECTION_DEVICECONNECTION_MODEL = "sample_connection.DeviceConnection"
356354
CONNECTION_COMMAND_MODEL = "sample_connection.Command"
357-
SUBNET_DIVISION_SUBNETDIVISIONRULE_MODEL = (
358-
"sample_subnet_division.SubnetDivisionRule"
359-
)
360-
SUBNET_DIVISION_SUBNETDIVISIONINDEX_MODEL = (
361-
"sample_subnet_division.SubnetDivisionIndex"
362-
)
355+
SUBNET_DIVISION_SUBNETDIVISIONRULE_MODEL = "sample_subnet_division.SubnetDivisionRule"
356+
SUBNET_DIVISION_SUBNETDIVISIONINDEX_MODEL = "sample_subnet_division.SubnetDivisionIndex"
363357
364358
Substitute ``sample_config``, ``sample_pki``, ``sample_connection``,
365359
``sample_geo`` & ``sample_subnet_division`` with the name you chose in
@@ -483,9 +477,7 @@ For example:
483477
SubnetDivisionRuleInlineAdmin,
484478
)
485479
486-
SubnetDivisionRuleInlineAdmin.fields += [
487-
"example"
488-
] # <-- monkey patching example
480+
SubnetDivisionRuleInlineAdmin.fields += ["example"] # <-- monkey patching example
489481
490482
14.2. Inheriting admin classes
491483
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -843,9 +835,7 @@ them upon deletion for that device.
843835
# performs no operation for existing objects.
844836
@classmethod
845837
def provision_for_existing_objects(cls, rule_obj):
846-
for device in Device.objects.filter(
847-
organization=rule_obj.organization
848-
):
838+
for device in Device.objects.filter(organization=rule_obj.organization):
849839
cls.provision_receiver(device, created=True)
850840
851841
After creating a class for your custom rule type, you will need to set

openwisp_controller/__init__.py

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

44

55
def get_version():
6-
version = f'{VERSION[0]}.{VERSION[1]}'
6+
version = f"{VERSION[0]}.{VERSION[1]}"
77
if VERSION[2]:
8-
version = f'{version}.{VERSION[2]}'
9-
if VERSION[3:] == ('alpha', 0):
10-
version = f'{version} pre-alpha'
11-
if 'post' in VERSION[3]:
12-
version = f'{version}.{VERSION[3]}'
8+
version = f"{version}.{VERSION[2]}"
9+
if VERSION[3:] == ("alpha", 0):
10+
version = f"{version} pre-alpha"
11+
if "post" in VERSION[3]:
12+
version = f"{version}.{VERSION[3]}"
1313
else:
14-
if VERSION[3] != 'final':
14+
if VERSION[3] != "final":
1515
try:
1616
rev = VERSION[4]
1717
except IndexError:
1818
rev = 0
19-
version = f'{version}{VERSION[3][0:1]}{rev}'
19+
version = f"{version}{VERSION[3][0:1]}{rev}"
2020
return version

openwisp_controller/base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ def _clean_name(self):
2727
if not self._state.adding:
2828
qs = qs.exclude(id=self.id)
2929
shared_message = _(
30-
'Shared objects are visible to all organizations and '
31-
'must have unique names to avoid confusion.'
30+
"Shared objects are visible to all organizations and "
31+
"must have unique names to avoid confusion."
3232
)
3333

3434
if qs.filter(organization=None).exists():
35-
msg = _(f'There is already another shared {model_name} with this name.')
36-
raise ValidationError({'name': f'{msg} {shared_message}'})
35+
msg = _(f"There is already another shared {model_name} with this name.")
36+
raise ValidationError({"name": f"{msg} {shared_message}"})
3737

3838
if not self.organization and qs.filter(organization__isnull=False).exists():
3939
msg = _(
40-
f'There is already a {model_name} of '
41-
'another organization with this name.'
40+
f"There is already a {model_name} of "
41+
"another organization with this name."
4242
)
43-
raise ValidationError({'name': f'{msg} {shared_message}'})
43+
raise ValidationError({"name": f"{msg} {shared_message}"})

openwisp_controller/checks.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,42 @@ def check_cors_configuration(app_configs, **kwargs):
1010
return errors
1111

1212
if not (
13-
'corsheaders' in settings.INSTALLED_APPS
14-
and 'corsheaders.middleware.CorsMiddleware' in settings.MIDDLEWARE
13+
"corsheaders" in settings.INSTALLED_APPS
14+
and "corsheaders.middleware.CorsMiddleware" in settings.MIDDLEWARE
1515
):
1616
errors.append(
1717
checks.Warning(
18-
msg='Improperly Configured',
18+
msg="Improperly Configured",
1919
hint=(
2020
'"django-cors-headers" is either not installed or improperly '
21-
'configured. CORS configuration is required for using '
21+
"configured. CORS configuration is required for using "
2222
'"OPENWISP_CONTROLLER_API_HOST" settings. '
23-
' Configure equivalent CORS rules on your server '
23+
" Configure equivalent CORS rules on your server "
2424
'if you are not using "django-cors-headers".'
2525
),
26-
obj='Settings',
26+
obj="Settings",
2727
)
2828
)
2929
return errors
3030

3131

3232
def check_openwisp_controller_ctx_processor(app_config, **kwargs):
3333
errors = []
34-
ctx_processor = 'openwisp_controller.context_processors.controller_api_settings'
34+
ctx_processor = "openwisp_controller.context_processors.controller_api_settings"
3535

3636
if not app_settings.OPENWISP_CONTROLLER_API_HOST:
3737
return errors
3838

39-
if not (ctx_processor in settings.TEMPLATES[0]['OPTIONS']['context_processors']):
39+
if not (ctx_processor in settings.TEMPLATES[0]["OPTIONS"]["context_processors"]):
4040
errors.append(
4141
checks.Warning(
42-
msg='Improperly Configured',
42+
msg="Improperly Configured",
4343
hint=(
4444
f'"{ctx_processor} is absent from context processors.'
4545
'It is required to be added in TEMPLATES["context_processor"] '
4646
'for "OPENWISP_CONTROLLER_API_HOST" to work properly.'
4747
),
48-
obj='Settings',
48+
obj="Settings",
4949
)
5050
)
5151
return errors

0 commit comments

Comments
 (0)