From 5646d9960fa43c1c3c215522b023171321d5028d Mon Sep 17 00:00:00 2001 From: Dag Wieers Date: Thu, 21 Sep 2017 14:32:10 +0200 Subject: [PATCH] xml: pylint fixes and docs This PR includes; - pylint fixes - Documentation updates --- lib/ansible/modules/files/xml.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/files/xml.py b/lib/ansible/modules/files/xml.py index 933371fce3a..0548ecab8f4 100644 --- a/lib/ansible/modules/files/xml.py +++ b/lib/ansible/modules/files/xml.py @@ -456,9 +456,9 @@ def nsnameToClark(name, namespaces): (nsname, rawname) = name.split(":") # return "{{%s}}%s" % (namespaces[nsname], rawname) return "{{{0}}}{1}".format(namespaces[nsname], rawname) - else: - # no namespace name here - return name + + # no namespace name here + return name def check_or_make_target(module, tree, xpath, namespaces): @@ -548,7 +548,7 @@ def set_target_inner(module, tree, xpath, namespaces, attribute, value): missing_namespace = "" # NOTE: This checks only the namespaces defined in root element! # TODO: Implement a more robust check to check for child namespaces' existance - if len(tree.getroot().nsmap) > 0 and ":" not in xpath: + if tree.getroot().nsmap and ":" not in xpath: missing_namespace = "XML document has namespace(s) defined, but no namespace prefix(es) used in xpath!\n" module.fail_json(msg="%sXpath %s causes a failure: %s\n -- tree is %s" % (missing_namespace, xpath, e, etree.tostring(tree, pretty_print=True)), exception=traceback.format_exc())