1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/bcc9c7aa5569/ changeset: bcc9c7aa5569 user: richard_burhans date: 2011-06-07 20:36:46 summary: allow lines starting with arbitrary characters to be excluded from the peek affected #: 1 file (243 bytes) --- a/lib/galaxy/datatypes/data.py Tue Jun 07 14:31:58 2011 -0400 +++ b/lib/galaxy/datatypes/data.py Tue Jun 07 14:36:46 2011 -0400 @@ -417,13 +417,13 @@ if line and not line.startswith( '#' ): data_lines += 1 return data_lines - def set_peek( self, dataset, line_count=None, is_multi_byte=False ): + def set_peek( self, dataset, line_count=None, is_multi_byte=False, skipchars=[] ): """ Set the peek. This method is used by various subclasses of Text. """ if not dataset.dataset.purged: # The file must exist on disk for the get_file_peek() method - dataset.peek = get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte ) + dataset.peek = get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte, skipchars=skipchars ) if line_count is None: # See if line_count is stored in the metadata if dataset.metadata.data_lines: @@ -461,7 +461,7 @@ path, name = os.path.split(__file__) full_path = os.path.join( path, 'test', fname ) return full_path -def get_file_peek( file_name, is_multi_byte=False, WIDTH=256, LINE_COUNT=5 ): +def get_file_peek( file_name, is_multi_byte=False, WIDTH=256, LINE_COUNT=5, skipchars=[] ): """ Returns the first LINE_COUNT lines wrapped to WIDTH @@ -489,8 +489,14 @@ data_checked = True if file_type in [ 'gzipped', 'binary' ]: break - lines.append( line ) - count += 1 + skip_line = False + for skipchar in skipchars: + if line.startswith( skipchar ): + skip_line = True + break + if not skip_line: + lines.append( line ) + count += 1 temp.close() if file_type in [ 'gzipped', 'binary' ]: text = "%s file" % file_type Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.