|
a/OSSEval/OSSEval/utils.py |
|
b/OSSEval/OSSEval/utils.py |
|
... |
|
... |
40 |
try:
|
40 |
try:
|
41 |
return xmldoc.attributes[tag].firstChild.data
|
41 |
return xmldoc.attributes[tag].firstChild.data
|
42 |
except:
|
42 |
except:
|
43 |
return ""
|
43 |
return ""
|
44 |
|
44 |
|
45 |
@staticmethod
|
45 |
@staticmethod
|
46 |
def getNaturalAttribute(xmldoc, tag):
|
46 |
def getNaturalAttribute(xmldoc, tag):
|
47 |
'''
|
47 |
'''
|
48 |
a natural number; if it's not there -1 is returned
|
48 |
a natural number; if it's not there None is returned
|
49 |
'''
|
49 |
'''
|
50 |
try:
|
50 |
try:
|
51 |
return int(xmldoc.attributes[tag].firstChild.data)
|
51 |
return int(xmldoc.attributes[tag].firstChild.data)
|
|
|
52 |
except:
|
|
|
53 |
return None
|
|
|
54 |
|
|
|
55 |
@staticmethod
|
|
|
56 |
def getFloatAttribute(xmldoc, tag):
|
|
|
57 |
'''
|
|
|
58 |
a float number; if it's not there None is returned
|
|
|
59 |
'''
|
|
|
60 |
try:
|
|
|
61 |
return float(xmldoc.attributes[tag].firstChild.data)
|
52 |
except:
|
62 |
except:
|
53 |
return None
|
63 |
return None
|
54 |
|
64 |
|
55 |
class SearchEngine():
|
65 |
class SearchEngine():
|
56 |
@staticmethod
|
66 |
@staticmethod
|