diff options
author | James Falcon <james.falcon@canonical.com> | 2021-12-15 20:16:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-15 19:16:38 -0700 |
commit | bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf (patch) | |
tree | 1fbb3269fc87e39832e3286ef42eefd2b23fcd44 /cloudinit/net/renderer.py | |
parent | 2bcf4fa972fde686c2e3141c58e640640b44dd00 (diff) | |
download | vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.tar.gz vyos-cloud-init-bae9b11da9ed7dd0b16fe5adeaf4774b7cc628cf.zip |
Adopt Black and isort (SC-700) (#1157)
Applied Black and isort, fixed any linting issues, updated tox.ini
and CI.
Diffstat (limited to 'cloudinit/net/renderer.py')
-rw-r--r-- | cloudinit/net/renderer.py | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/cloudinit/net/renderer.py b/cloudinit/net/renderer.py index 54a83b51..34b74b80 100644 --- a/cloudinit/net/renderer.py +++ b/cloudinit/net/renderer.py @@ -13,18 +13,18 @@ from cloudinit.net.udev import generate_udev_rule def filter_by_type(match_type): - return lambda iface: match_type == iface['type'] + return lambda iface: match_type == iface["type"] def filter_by_name(match_name): - return lambda iface: match_name == iface['name'] + return lambda iface: match_name == iface["name"] def filter_by_attr(match_name): return lambda iface: (match_name in iface and iface[match_name]) -filter_by_physical = filter_by_type('physical') +filter_by_physical = filter_by_type("physical") class Renderer(object): @@ -39,22 +39,27 @@ class Renderer(object): content = io.StringIO() for iface in network_state.iter_interfaces(filter_by_physical): # for physical interfaces write out a persist net udev rule - if 'name' in iface and iface.get('mac_address'): - driver = iface.get('driver', None) - content.write(generate_udev_rule(iface['name'], - iface['mac_address'], - driver=driver)) + if "name" in iface and iface.get("mac_address"): + driver = iface.get("driver", None) + content.write( + generate_udev_rule( + iface["name"], iface["mac_address"], driver=driver + ) + ) return content.getvalue() @abc.abstractmethod - def render_network_state(self, network_state, templates=None, - target=None): + def render_network_state(self, network_state, templates=None, target=None): """Render network state.""" - def render_network_config(self, network_config, templates=None, - target=None): + def render_network_config( + self, network_config, templates=None, target=None + ): return self.render_network_state( network_state=parse_net_config_data(network_config), - templates=templates, target=target) + templates=templates, + target=target, + ) + # vi: ts=4 expandtab |