Skip to content

Commit c31b3b7

Browse files
committed
[qa] Reformat with openwisp-qa-format
Signed-off-by: Konrad Kreitmair <kkreitmair@tdt.de>
1 parent 0b10eef commit c31b3b7

File tree

4 files changed

+28
-35
lines changed

4 files changed

+28
-35
lines changed

netjsonconfig/backends/openwrt/converters/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from .ddns import Ddns
12
from .default import Default
23
from .general import General
34
from .interfaces import Interfaces
@@ -9,7 +10,6 @@
910
from .rules import Rules
1011
from .switch import Switch
1112
from .wireless import Wireless
12-
from .ddns import Ddns
1313

1414
__all__ = [
1515
'Default',

netjsonconfig/backends/openwrt/converters/ddns.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ class Ddns(OpenWrtConverter):
1313
def to_intermediate_loop(self, block, result, index=None):
1414
if block:
1515
provider_list = self.__intermediate_providers(block.pop('providers', {}))
16-
block.update({
17-
'.type': 'ddns',
18-
'.name': block.pop('id', 'global'),
19-
})
16+
block.update(
17+
{'.type': 'ddns', '.name': block.pop('id', 'global'),}
18+
)
2019
result.setdefault('ddns', [])
2120
result['ddns'] = [self.sorted_dict(block)] + provider_list
2221
return result
@@ -29,8 +28,7 @@ def __intermediate_providers(self, providers):
2928
result = []
3029
for provider in providers:
3130
uci_name = self._get_uci_name(provider['lookup_host'])
32-
resultdict = OrderedDict((('.name', uci_name),
33-
('.type', 'service')))
31+
resultdict = OrderedDict((('.name', uci_name), ('.type', 'service')))
3432
resultdict.update(provider)
3533
result.append(resultdict)
3634
return result

netjsonconfig/backends/openwrt/schema.py

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@
396396
"type": "boolean",
397397
"title": "upd_privateip",
398398
"description": "disallow/allow sending of private/special IP's to the DDNS provider; "
399-
"blocked IPv4: 0/8, 10/8, 100.64/10, 127/8, 169.254/16, 172.16/12, "
400-
"192.168/16; blocked IPv6: ::/32, f000::/4",
399+
"blocked IPv4: 0/8, 10/8, 100.64/10, 127/8, 169.254/16, 172.16/12, "
400+
"192.168/16; blocked IPv6: ::/32, f000::/4",
401401
"default": False,
402402
"format": "checkbox",
403403
"propertyOrder": 1,
@@ -434,7 +434,7 @@
434434
"type": "boolean",
435435
"title": "use_curl",
436436
"description": "if both wget and curl are installed, wget is used for communication "
437-
"by default",
437+
"by default",
438438
"default": False,
439439
"format": "checkbox",
440440
"propertyOrder": 6,
@@ -470,21 +470,16 @@
470470
"type": "string",
471471
"title": "interface",
472472
"description": "network from /etc/config/network to monitor for up/down "
473-
"events to start the ddns update script via hotplug",
473+
"events to start the ddns update script via hotplug",
474474
"propertyOrder": 2,
475475
},
476476
"ip_source": {
477477
"type": "string",
478478
"title": "ip_source",
479479
"description": "specifies the source to detect the local IP: 'network' uses "
480-
"'ip_network', 'web' uses 'ip_url', 'interface' uses "
481-
"'ip_interface', 'script' uses 'ip_script'",
482-
"enum": [
483-
"network",
484-
"web",
485-
"interface",
486-
"script"
487-
],
480+
"'ip_network', 'web' uses 'ip_url', 'interface' uses "
481+
"'ip_interface', 'script' uses 'ip_script'",
482+
"enum": ["network", "web", "interface", "script"],
488483
"default": "network",
489484
"propertyOrder": 3,
490485
},
@@ -498,8 +493,8 @@
498493
"type": "string",
499494
"title": "domain",
500495
"description": "the DNS name to update; this property can also be used for "
501-
"special multihost update configurations supported by"
502-
" some providers",
496+
"special multihost update configurations supported by"
497+
" some providers",
503498
"propertyOrder": 5,
504499
},
505500
"username": {
@@ -536,29 +531,29 @@
536531
"type": "string",
537532
"title": "ip_network",
538533
"description": "network from /etc/config/network to use for detecting the IP "
539-
"if 'ip_source' is set to 'network'",
534+
"if 'ip_source' is set to 'network'",
540535
"default": "wan",
541536
"propertyOrder": 11,
542537
},
543538
"ip_url": {
544539
"type": "string",
545540
"title": "ip_url",
546541
"description": "url to use for detecting the IP if 'ip_source' is set to "
547-
"'web'",
542+
"'web'",
548543
"propertyOrder": 12,
549544
},
550545
"ip_interface": {
551546
"type": "string",
552547
"title": "ip_interface",
553548
"description": "local interface to use for detecting the IP if 'ip_source' is"
554-
" set to 'interface'",
549+
" set to 'interface'",
555550
"propertyOrder": 13,
556551
},
557552
"ip_script": {
558553
"type": "string",
559554
"title": "ip_script",
560555
"description": "script to use for detecting the IP if 'ip_source' is set to "
561-
"'script'",
556+
"'script'",
562557
"propertyOrder": 14,
563558
},
564559
"use_syslog": {
@@ -572,7 +567,7 @@
572567
"1 - info, notice, warning, errors",
573568
"2 - notice, warning, errors",
574569
"3 - warning, errors",
575-
"4 - errors"
570+
"4 - errors",
576571
]
577572
},
578573
"default": 0,
@@ -584,14 +579,14 @@
584579
"description": "disable/enable logging to logfile",
585580
"default": True,
586581
"propertyOrder": 16,
587-
}
588-
}
589-
}
590-
}
591-
}
592-
}
593-
}
594-
}
582+
},
583+
},
584+
},
585+
},
586+
},
587+
},
588+
},
589+
},
595590
)
596591

597592

tests/openwrt/test_ddns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class TestDdns(unittest.TestCase, _TabsMixin):
1313
"ddns_loglines": 250,
1414
"ddns_rundir": "/var/run/ddns",
1515
"upd_privateip": False,
16-
"use_curl": False
16+
"use_curl": False,
1717
}
1818
}
1919
_ddns_uci_global = """package ddns

0 commit comments

Comments
 (0)