--- a/OSSEval/OSSEval/utils.py
+++ b/OSSEval/OSSEval/utils.py
@@ -42,13 +42,23 @@
except:
return ""
- @staticmethod
+ @staticmethod
def getNaturalAttribute(xmldoc, tag):
'''
- a natural number; if it's not there -1 is returned
+ a natural number; if it's not there None is returned
'''
try:
return int(xmldoc.attributes[tag].firstChild.data)
+ except:
+ return None
+
+ @staticmethod
+ def getFloatAttribute(xmldoc, tag):
+ '''
+ a float number; if it's not there None is returned
+ '''
+ try:
+ return float(xmldoc.attributes[tag].firstChild.data)
except:
return None