From 42a461353bc2dd07f60daf33a42e6d45ec7c86a8 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 21 Dec 2016 12:56:17 -0500 Subject: [PATCH 1/3] Fix linting of 16.07 broken with security patches. --- tools/filters/gff/gff_filter_by_attribute.py | 4 +++- tools/filters/gff/gff_filter_by_feature_count.py | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/filters/gff/gff_filter_by_attribute.py b/tools/filters/gff/gff_filter_by_attribute.py index cd6600cf916..3d4319bc152 100644 --- a/tools/filters/gff/gff_filter_by_attribute.py +++ b/tools/filters/gff/gff_filter_by_attribute.py @@ -6,8 +6,9 @@ from __future__ import division import sys -from json import loads + from ast import Module, parse, walk +from json import loads AST_NODE_TYPE_WHITELIST = [ 'Expr', 'Load', 'Str', 'Num', 'BoolOp', 'Compare', 'And', 'Eq', 'NotEq', @@ -152,6 +153,7 @@ def check_expression( text ): return True + # # Helper functions. # diff --git a/tools/filters/gff/gff_filter_by_feature_count.py b/tools/filters/gff/gff_filter_by_feature_count.py index 778527972bc..d0e65caa9f5 100644 --- a/tools/filters/gff/gff_filter_by_feature_count.py +++ b/tools/filters/gff/gff_filter_by_feature_count.py @@ -5,12 +5,15 @@ Filter a gff file using a criterion based on feature counts for a transcript. Usage: %prog input_name output_name feature_name condition """ +from __future__ import print_function + import sys +from ast import Module, parse, walk + from bx.intervals.io import GenomicInterval from galaxy.datatypes.util.gff_util import GFFReaderWrapper -from ast import Module, parse, walk AST_NODE_TYPE_WHITELIST = [ 'Expr', 'Load', 'Str', 'Num', 'BoolOp', 'Compare', 'And', 'Eq', 'NotEq', @@ -137,7 +140,7 @@ def __main__(): except: number = None if empty != "" or not number: - print >> sys.stderr, "Invalid condition: %s, cannot filter." % condition + print("Invalid condition: %s, cannot filter." % condition, file=sys.stderr) return break @@ -173,7 +176,7 @@ def __main__(): ( kept_features, i, float(kept_features) / i * 100.0, feature_name + condition ) if skipped_lines > 0: info_msg += "Skipped %d blank/comment/invalid lines starting with line #%d." % ( skipped_lines, first_skipped_line ) - print info_msg + print(info_msg) if __name__ == "__main__": __main__() From 69fe5ae83ae53cb84a2d0bdd9ea53389b8af5a3a Mon Sep 17 00:00:00 2001 From: John Chilton Date: Wed, 21 Dec 2016 12:56:56 -0500 Subject: [PATCH 2/3] Fix 16.07 linting of imports broken with release of flake8-import-order 0.11. This is pinned to 0.11 in release_16.10 and unpinned in dev, when merging forward keep these "forward" branches the same (i.e. do not revert to flake8-import-order 0.10). --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 561d0637f5d..c4822638555 100644 --- a/tox.ini +++ b/tox.ini @@ -41,7 +41,7 @@ whitelist_externals = bash skip_install = True deps = flake8 - flake8-import-order>=0.9 + flake8-import-order==0.9 [testenv:py27-lint-imports-include-list] commands = bash .ci/flake8_wrapper_imports.sh @@ -49,7 +49,7 @@ whitelist_externals = bash skip_install = True deps = flake8==3.0.4 - flake8-import-order>=0.9 + flake8-import-order==0.9 [testenv:qunit] commands = bash run_tests.sh -q From c3687114d6f2f14df49af9a3fee6dbebe08aa7e5 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Thu, 5 Jan 2017 09:07:16 -0500 Subject: [PATCH 3/3] Set metadata on HDAs from dynamically discovered collections. With test case that previously failed. Fixes #3267. --- lib/galaxy/tools/parameters/output_collect.py | 3 +++ test/api/test_tools.py | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/tools/parameters/output_collect.py b/lib/galaxy/tools/parameters/output_collect.py index 1fb52296c77..60875c0fae6 100644 --- a/lib/galaxy/tools/parameters/output_collect.py +++ b/lib/galaxy/tools/parameters/output_collect.py @@ -205,6 +205,9 @@ class JobContext( object ): else: primary_data.init_meta() + primary_data.set_meta() + primary_data.set_peek() + return primary_data diff --git a/test/api/test_tools.py b/test/api/test_tools.py index 82e310b06a9..672e6ff9960 100644 --- a/test/api/test_tools.py +++ b/test/api/test_tools.py @@ -465,10 +465,14 @@ class ToolsTestCase( api.ApiTestCase ): output_collection = get_collection_response.json() self._assert_has_keys( output_collection, "id", "name", "elements", "populated" ) assert output_collection[ "populated" ] - assert len( output_collection[ "elements" ] ) == 2 self.assertEquals( output_collection[ "name" ], "Table split on first column" ) - # TODO: verify element identifiers + assert len( output_collection[ "elements" ] ) == 2 + output_element_0 = output_collection["elements"][0] + assert output_element_0["element_index"] == 0 + assert output_element_0["element_identifier"] == "samp1" + output_element_hda_0 = output_element_0["object"] + assert output_element_hda_0["metadata_column_types"] is not None @skip_without_tool( "cat1" ) def test_run_cat1_with_two_inputs( self ):