[elbe-devel] [PATCH 1/3] treeutils:move check_boolean out of class etree
Akash Satamkar
akash at linutronix.de
Wed Sep 18 15:28:28 CEST 2019
Move the check_boolean method out of class etree.
No use of self parameter in check_boolean().
Signed-off-by: Akash Satamkar <akash at linutronix.de>
---
elbepack/treeutils.py | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/elbepack/treeutils.py b/elbepack/treeutils.py
index b1ac3711..e65f575f 100644
--- a/elbepack/treeutils.py
+++ b/elbepack/treeutils.py
@@ -13,7 +13,9 @@ from lxml.etree import XMLParser, parse
# ElementTree helpers
+
class eiter(object):
+
def __init__(self, it):
self.it = it
@@ -149,15 +151,16 @@ class etree(ebase):
self.et._setroot(retval.et)
return retval
- def check_boolean(self, node, attributename):
- attr = node.get(attributename)
- if attr is None:
- return False
- elif attr in ['true', '1']:
- return True
- elif attr in ['false', '0']:
- return False
-
@property
def root(self):
return elem(self.et.getroot())
+
+
+def check_boolean(node, attributename):
+ attr = node.get(attributename)
+ if attr is None:
+ return False
+ elif attr in ['true', '1']:
+ return True
+ elif attr in ['false', '0']:
+ return False
--
2.20.1
More information about the elbe-devel
mailing list