diff options
author | Dag Wieers <dag@wieers.com> | 2017-06-02 13:14:11 +0200 |
---|---|---|
committer | John R Barker <john@johnrbarker.com> | 2017-06-02 12:14:11 +0100 |
commit | 5553b208281d723ead1e61be5c37227ec2b2736e (patch) | |
tree | 2f81e684e9f4451a3b1b58b95e1d00125b34e439 /lib/ansible/module_utils/netcfg.py | |
parent | 2f33c1a1a1d0c74d31445984fd85d877f0d8ab59 (diff) | |
download | ansible-5553b208281d723ead1e61be5c37227ec2b2736e.tar.gz |
Collated PEP8 fixes (#25293)
- Make PEP8 compliant
Diffstat (limited to 'lib/ansible/module_utils/netcfg.py')
-rw-r--r-- | lib/ansible/module_utils/netcfg.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/ansible/module_utils/netcfg.py b/lib/ansible/module_utils/netcfg.py index 5d2a4a91d2..d4f4a5ff4a 100644 --- a/lib/ansible/module_utils/netcfg.py +++ b/lib/ansible/module_utils/netcfg.py @@ -92,13 +92,20 @@ class ConfigLine(object): assert isinstance(obj, ConfigLine), 'child must be of type `ConfigLine`' self._children.append(obj) + def ignore_line(text, tokens=None): for item in (tokens or DEFAULT_COMMENT_TOKENS): if text.startswith(item): return True -_obj_to_text = lambda x: [o.text for o in x] -_obj_to_raw = lambda x: [o.raw for o in x] + +def _obj_to_text(x): + return [o.text for o in x] + + +def _obj_to_raw(x): + return [o.raw for o in x] + def _obj_to_block(objects, visited=None): items = list() @@ -110,6 +117,7 @@ def _obj_to_block(objects, visited=None): items.append(child) return _obj_to_raw(items) + def dumps(objects, output='block', comments=False): if output == 'block': items = _obj_to_block(objects) @@ -130,6 +138,7 @@ def dumps(objects, output='block', comments=False): return '\n'.join(items) + class NetworkConfig(object): def __init__(self, indent=1, contents=None): @@ -328,7 +337,7 @@ class NetworkConfig(object): offset = 0 obj = None - ## global config command + # global config command if not parents: for line in lines: item = ConfigLine(line) |