From e379f44effa9a72e5da6d01db6e2ee6d7f56e949 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Mon, 3 Jul 2017 13:15:38 +0200 Subject: [PATCH] Remove outer try/except in Eland sniffer Exceptions in a sniffer are already caught in galaxy.datatypes.sniff.guess_ext() and are equivalent to `return False`. Thanks @nsoranzo! --- lib/galaxy/datatypes/tabular.py | 59 ++++++++++++++++----------------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/lib/galaxy/datatypes/tabular.py b/lib/galaxy/datatypes/tabular.py index 16cde383c38..4eb3a2764f3 100644 --- a/lib/galaxy/datatypes/tabular.py +++ b/lib/galaxy/datatypes/tabular.py @@ -787,37 +787,34 @@ class Eland( Tabular ): - LANE, TILEm X, Y, INDEX, READ_NO, SEQ, QUAL, POSITION, *STRAND, FILT must be correct - We will only check that up to the first 5 alignments are correctly formatted. """ - try: - with compression_utils.get_fileobj(filename, gzip_only=True) as fh: - count = 0 - while True: - line = fh.readline() - line = line.strip() - if not line: - break # EOF - if line: - line_pieces = line.split('\t') - if len(line_pieces) != 22: - return False - try: - if long(line_pieces[1]) < 0: - raise Exception('Out of range') - if long(line_pieces[2]) < 0: - raise Exception('Out of range') - if long(line_pieces[3]) < 0: - raise Exception('Out of range') - int(line_pieces[4]) - int(line_pieces[5]) - # can get a lot more specific - except ValueError: - return False - count += 1 - if count == 5: - break - if count > 0: - return True - except Exception: - pass + with compression_utils.get_fileobj(filename, gzip_only=True) as fh: + count = 0 + while True: + line = fh.readline() + line = line.strip() + if not line: + break # EOF + if line: + line_pieces = line.split('\t') + if len(line_pieces) != 22: + return False + try: + if long(line_pieces[1]) < 0: + raise Exception('Out of range') + if long(line_pieces[2]) < 0: + raise Exception('Out of range') + if long(line_pieces[3]) < 0: + raise Exception('Out of range') + int(line_pieces[4]) + int(line_pieces[5]) + # can get a lot more specific + except ValueError: + return False + count += 1 + if count == 5: + break + if count > 0: + return True return False def set_meta( self, dataset, overwrite=True, skip=None, max_data_lines=5, **kwd ):