summaryrefslogtreecommitdiff
path: root/src/virtual_table.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2015-09-04 13:01:50 +0200
committeremkael <emkael@tlen.pl>2015-09-04 13:01:50 +0200
commitfed0a2ee7110551bf23583a3f47daa84e7b36786 (patch)
tree6cb7a2dc3b0cadd4dc4ca278ca8d6ec418ba05d3 /src/virtual_table.py
parentabcd2ce3d300bc83e4454c00934407f165c861ed (diff)
* record file reads optimized
Diffstat (limited to 'src/virtual_table.py')
-rw-r--r--src/virtual_table.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/virtual_table.py b/src/virtual_table.py
index 819d8be..abdb49a 100644
--- a/src/virtual_table.py
+++ b/src/virtual_table.py
@@ -59,21 +59,21 @@ class JFRVirtualTable:
for record_file_path in self.__pair_records_files:
with file(record_file_path) as record_file:
record = bs4(record_file, 'lxml')
- # first <td class="o1"> with content matching
- # pair header is what we're after
- header = [con for con
- in record.select('td.o1')[0].contents
- if type(con) is NavigableString and re.match(
- pair_header_match, con)]
- if len(header):
- header_match = re.match(pair_header_match, header[0])
- pair_number = int(header_match.group(1))
- names = filter(len,
- [header_match.group(2).strip(),
- header_match.group(3).strip()])
- # virtual pair does not have any names filled
- if len(names) == 0:
- virtual_pairs.append(pair_number)
+ # first <td class="o1"> with content matching
+ # pair header is what we're after
+ header = [con for con
+ in record.select('td.o1')[0].contents
+ if type(con) is NavigableString and re.search(
+ pair_header_match, con)]
+ if len(header):
+ header_match = re.match(pair_header_match, header[0])
+ pair_number = int(header_match.group(1))
+ names = filter(len,
+ [header_match.group(2).strip(),
+ header_match.group(3).strip()])
+ # virtual pair does not have any names filled
+ if len(names) == 0:
+ virtual_pairs.append(pair_number)
if len(virtual_pairs) == 0:
log.getLogger('detect').warning('No virtual pairs detected')
else: