changeset 15:c4d18aa4ec4a draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/query_tabular commit dd35055c76d86fe98985b5825c1751efb8208242
author iuc
date Thu, 27 Jun 2024 17:23:20 +0000
parents f768f6183386
children
files filters.py load_db.py macros.xml sqlite_to_tabular.xml
diffstat 4 files changed, 21 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/filters.py	Wed Sep 13 12:15:59 2023 +0000
+++ b/filters.py	Thu Jun 27 17:23:20 2024 +0000
@@ -11,7 +11,7 @@
     def __init__(self, source, filter_dict):
         self.source = source
         self.filter_dict = filter_dict
-        self.func = lambda i, l: l.rstrip('\r\n') if l else None
+        self.func = lambda i, line: line.rstrip('\r\n') if line else None
         self.src_lines = []
         self.src_line_cnt = 0
 
@@ -28,23 +28,23 @@
         if filter_dict['filter'] == 'regex':
             rgx = re.compile(filter_dict['pattern'])
             if filter_dict['action'] == 'exclude_match':
-                self.func = lambda i, l: l if not rgx.match(l) else None
+                self.func = lambda i, line: line if not rgx.match(line) else None
             elif filter_dict['action'] == 'include_match':
-                self.func = lambda i, l: l if rgx.match(l) else None
+                self.func = lambda i, line: line if rgx.match(line) else None
             elif filter_dict['action'] == 'exclude_find':
-                self.func = lambda i, l: l if not rgx.search(l) else None
+                self.func = lambda i, line: line if not rgx.search(line) else None
             elif filter_dict['action'] == 'include_find':
-                self.func = lambda i, l: l if rgx.search(l) else None
+                self.func = lambda i, line: line if rgx.search(line) else None
         elif filter_dict['filter'] == 'select_columns':
             cols = [int(c) - 1 for c in filter_dict['columns']]
-            self.func = lambda i, l: self.select_columns(l, cols)
+            self.func = lambda i, line: self.select_columns(line, cols)
         elif filter_dict['filter'] == 'select_column_slices':
             cols = [x if isinstance(x, int) else [y if y is not None else None for y in [xint(k) for k in x.split(':')]] for x in [xint(c) for c in filter_dict['columns']]]
             if all([isinstance(x, int) for x in cols]):
-                self.func = lambda i, l: self.select_columns(l, cols)
+                self.func = lambda i, line: self.select_columns(line, cols)
             else:
                 cols = [slice(x[0], x[1], x[2] if len(x) > 2 else None) if isinstance(x, list) else x for x in cols]
-                self.func = lambda i, l: self.select_slices(l, cols)
+                self.func = lambda i, line: self.select_slices(line, cols)
         elif filter_dict['filter'] == 'replace':
             p = filter_dict['pattern']
             r = filter_dict['replace']
@@ -54,32 +54,32 @@
                                               'append',
                                               'before',
                                               'after']:
-                self.func = lambda i, l: '\t'.join(
+                self.func = lambda i, line: '\t'.join(
                     [x if j != c else re.sub(p, r, x)
-                     for j, x in enumerate(l.split('\t'))])
+                     for j, x in enumerate(line.split('\t'))])
             else:
                 a = 0 if filter_dict['add'] == 'prepend'\
                     else min(0, c - 1) if filter_dict['add'] == 'before'\
                     else c + 1 if filter_dict['add'] == 'after'\
                     else None
-                self.func = lambda i, l: self.replace_add(l, p, r, c, a)
+                self.func = lambda i, line: self.replace_add(line, p, r, c, a)
         elif filter_dict['filter'] == 'prepend_line_num':
-            self.func = lambda i, l: '%d\t%s' % (i, l)
+            self.func = lambda i, line: '%d\t%s' % (i, line)
         elif filter_dict['filter'] == 'append_line_num':
-            self.func = lambda i, l: '%s\t%d' % (l.rstrip('\r\n'), i)
+            self.func = lambda i, line: '%s\t%d' % (line.rstrip('\r\n'), i)
         elif filter_dict['filter'] == 'prepend_text':
             s = filter_dict['column_text']
-            self.func = lambda i, l: '%s\t%s' % (s, l)
+            self.func = lambda i, line: '%s\t%s' % (s, line)
         elif filter_dict['filter'] == 'append_text':
             s = filter_dict['column_text']
-            self.func = lambda i, l: '%s\t%s' % (l.rstrip('\r\n'), s)
+            self.func = lambda i, line: '%s\t%s' % (line.rstrip('\r\n'), s)
         elif filter_dict['filter'] == 'skip':
             cnt = filter_dict['count']
-            self.func = lambda i, l: l if i > cnt else None
+            self.func = lambda i, line: line if i > cnt else None
         elif filter_dict['filter'] == 'normalize':
             cols = [int(c) - 1 for c in filter_dict['columns']]
             sep = filter_dict['separator']
-            self.func = lambda i, l: self.normalize(l, cols, sep)
+            self.func = lambda i, line: self.normalize(line, cols, sep)
 
     def __iter__(self):
         return self
--- a/load_db.py	Wed Sep 13 12:15:59 2023 +0000
+++ b/load_db.py	Thu Jun 27 17:23:20 2024 +0000
@@ -328,4 +328,4 @@
         c.close()
     except Exception as e:
         print('Failed: %s err: %s' % (index_def, e), file=sys.stderr)
-        raise(e)
+        raise e
--- a/macros.xml	Wed Sep 13 12:15:59 2023 +0000
+++ b/macros.xml	Thu Jun 27 17:23:20 2024 +0000
@@ -8,8 +8,8 @@
       #set $skip_lines = None
       #if str($fi.filter.skip_lines) != '':
         #set $skip_lines = int($fi.filter.skip_lines)
-      #elif $tbl.table.metadata.comment_lines and $tbl.table.metadata.comment_lines > 0:
-        #set $skip_lines = int($tbl.table.metadata.comment_lines)
+      #elif $table.metadata.comment_lines and int($table.metadata.comment_lines) > 0:
+        #set $skip_lines = int($table.metadata.comment_lines)
       #end if
       #if $skip_lines is not None:
         #set $filter_dict = dict()
--- a/sqlite_to_tabular.xml	Wed Sep 13 12:15:59 2023 +0000
+++ b/sqlite_to_tabular.xml	Thu Jun 27 17:23:20 2024 +0000
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<tool id="sqlite_to_tabular" name="SQLite to tabular" version="3.2.0">
+<tool id="sqlite_to_tabular" name="SQLite to tabular" version="3.2.1">
     <description>for SQL query</description>
 
     <macros>