diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2017-02-16 16:53:14 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2017-02-16 16:53:14 -0500 |
commit | c4e712ba3cc40d1deed87f56c71b337193597422 (patch) | |
tree | 99b0531dbf294253771cb0ec6c313e569640ba70 /roles/lib_utils/src | |
parent | d4db2dd279916c2a1f73c236deed444fed5cc740 (diff) | |
download | openshift-c4e712ba3cc40d1deed87f56c71b337193597422.tar.gz openshift-c4e712ba3cc40d1deed87f56c71b337193597422.tar.bz2 openshift-c4e712ba3cc40d1deed87f56c71b337193597422.tar.xz openshift-c4e712ba3cc40d1deed87f56c71b337193597422.zip |
Pleasing the linting gods.
Diffstat (limited to 'roles/lib_utils/src')
-rw-r--r-- | roles/lib_utils/src/class/yedit.py | 16 | ||||
-rw-r--r-- | roles/lib_utils/src/lib/import.py | 2 |
2 files changed, 12 insertions, 6 deletions
diff --git a/roles/lib_utils/src/class/yedit.py b/roles/lib_utils/src/class/yedit.py index cecc1ed4f..5275e84eb 100644 --- a/roles/lib_utils/src/class/yedit.py +++ b/roles/lib_utils/src/class/yedit.py @@ -194,12 +194,12 @@ class Yedit(object): if self.backup and self.file_exists(): shutil.copy(self.filename, self.filename + '.orig') - # pylint: disable=no-member - if hasattr(self.yaml_dict, 'fa'): - self.yaml_dict.fa.set_block_style() - - # pylint: disable=no-member if hasattr(yaml, 'RoundTripDumper'): + # pylint: disable=no-member + if hasattr(self.yaml_dict, 'fa'): + self.yaml_dict.fa.set_block_style() + + # pylint: disable=no-member Yedit._write(self.filename, yaml.dump(self.yaml_dict, Dumper=yaml.RoundTripDumper)) else: Yedit._write(self.filename, yaml.safe_dump(self.yaml_dict, default_flow_style=False)) @@ -242,13 +242,16 @@ class Yedit(object): # check if it is yaml try: if content_type == 'yaml' and contents: + # pylint: disable=no-member if hasattr(yaml, 'RoundTripLoader'): self.yaml_dict = yaml.load(contents, yaml.RoundTripLoader) else: self.yaml_dict = yaml.safe_load(contents) + # pylint: disable=no-member if hasattr(self.yaml_dict, 'fa'): self.yaml_dict.fa.set_block_style() + elif content_type == 'json' and contents: self.yaml_dict = json.loads(contents) except yaml.YAMLError as err: @@ -414,6 +417,7 @@ class Yedit(object): # deepcopy didn't work if hasattr(yaml, 'round_trip_dump'): + # pylint: disable=no-member tmp_copy = yaml.load(yaml.round_trip_dump(self.yaml_dict, default_flow_style=False), yaml.RoundTripLoader) @@ -438,8 +442,10 @@ class Yedit(object): if not self.file_exists(): # deepcopy didn't work if hasattr(yaml, 'round_trip_dump'): + # pylint: disable=no-member tmp_copy = yaml.load(yaml.round_trip_dump(self.yaml_dict, default_flow_style=False), # noqa: E501 yaml.RoundTripLoader) + # pylint: disable=no-member if hasattr(self.yaml_dict, 'fa'): tmp_copy.fa.set_block_style() diff --git a/roles/lib_utils/src/lib/import.py b/roles/lib_utils/src/lib/import.py index ea9fb8ce5..ed57a68c9 100644 --- a/roles/lib_utils/src/lib/import.py +++ b/roles/lib_utils/src/lib/import.py @@ -14,6 +14,6 @@ import shutil # noqa: F401 try: import ruamel.yaml as yaml # noqa: F401 except ImportError: - import yaml + import yaml # noqa: F401 from ansible.module_utils.basic import AnsibleModule |