moved identifying and distribution of parsing of tables to a new function parse_tables
This commit is contained in:
parent
9c34267fb1
commit
1b7c0b44a9
@ -65,6 +65,21 @@ class NIST(Source):
|
|||||||
log.msg('NIST symbol: |%s|, name: |%s|' % (symbol, name),
|
log.msg('NIST symbol: |%s|, name: |%s|' % (symbol, name),
|
||||||
level=log.DEBUG)
|
level=log.DEBUG)
|
||||||
|
|
||||||
|
requests.extend(self.parse_tables(sel, symbol_table))
|
||||||
|
|
||||||
|
return requests
|
||||||
|
|
||||||
|
def parse_tables(self, sel, symbol_table):
|
||||||
|
"""
|
||||||
|
This function identifies and distributes parsing of tables to other
|
||||||
|
functions below.
|
||||||
|
:param sel: A Selector object of the whole page
|
||||||
|
:param symbol_table: a dictionary containing translations of raw HTML
|
||||||
|
tags to human readable names
|
||||||
|
:return: a list of Result items and Requests
|
||||||
|
"""
|
||||||
|
requests = []
|
||||||
|
|
||||||
for table in sel.xpath('//table[@class="data"]'):
|
for table in sel.xpath('//table[@class="data"]'):
|
||||||
summary = table.xpath('@summary').extract()[0]
|
summary = table.xpath('@summary').extract()[0]
|
||||||
if summary == 'One dimensional data':
|
if summary == 'One dimensional data':
|
||||||
|
Reference in New Issue
Block a user