new properties in parse_properties now use dictionary syntax
This commit is contained in:
parent
93a6f098a9
commit
87282fc572
@ -38,12 +38,13 @@ class ChemSpider(Parser):
|
||||
prop_names = td_list[::2]
|
||||
prop_values = td_list[1::2]
|
||||
for i, prop_name in enumerate(prop_names):
|
||||
new_prop = Result()
|
||||
new_prop['attribute'] = prop_name.extract().encode('utf-8')
|
||||
new_prop['value'] = prop_values[i].extract().encode('utf-8')
|
||||
new_prop['source'] = 'ChemSpider Predicted - ACD/Labs Tab'
|
||||
new_prop['reliability'] = ''
|
||||
new_prop['conditions'] = ''
|
||||
new_prop = Result({
|
||||
'attribute': prop_name.extract().encode('utf-8'),
|
||||
'value': prop_values[i].extract().encode('utf-8'),
|
||||
'source': 'ChemSpider Predicted - ACD/Labs Tab',
|
||||
'reliability': '',
|
||||
'conditions': ''
|
||||
})
|
||||
properties.append(new_prop)
|
||||
log.msg('CS prop: |%s| |%s| |%s|' \
|
||||
% (new_prop['attribute'],new_prop['value'], new_prop['source']),
|
||||
@ -57,12 +58,13 @@ class ChemSpider(Parser):
|
||||
if line.xpath('span/text()'):
|
||||
property_name = line.xpath('span/text()').extract()[0].rstrip()
|
||||
else:
|
||||
new_prop = Result()
|
||||
new_prop['attribute'] = property_name
|
||||
new_prop['value'] = line.xpath('text()').extract()[0].rstrip()
|
||||
new_prop['source'] = line.xpath('strong/text()').extract()[0].rstrip()
|
||||
new_prop['reliability'] = ''
|
||||
new_prop['conditions'] = ''
|
||||
new_prop = Result({
|
||||
'attribute': property_name,
|
||||
'value': line.xpath('text()').extract()[0].rstrip(),
|
||||
'source': line.xpath('strong/text()').extract()[0].rstrip(),
|
||||
'reliability': '',
|
||||
'conditions': ''
|
||||
})
|
||||
properties.append(new_prop)
|
||||
log.msg('CS prop: |%s| |%s| |%s|' \
|
||||
% (new_prop['attribute'],new_prop['value'], new_prop['source']),
|
||||
|
Reference in New Issue
Block a user