From de99c7efe2d6c540d6388206ae7673a54204d85d Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Sun, 26 Jun 2016 12:02:50 -0400 Subject: [PATCH] Python3: lib/galaxy/visualization/ --- .ci/py3_sources.txt | 1 + .../data_providers/phyloviz/newickparser.py | 10 +++++----- lib/galaxy/visualization/genomes.py | 10 +++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.ci/py3_sources.txt b/.ci/py3_sources.txt index 21759162474..084d0f539a4 100644 --- a/.ci/py3_sources.txt +++ b/.ci/py3_sources.txt @@ -57,6 +57,7 @@ lib/galaxy/tools/parser/ lib/galaxy/tools/toolbox/ lib/galaxy/tours/ lib/galaxy/util/ +lib/galaxy/visualization/ lib/galaxy/work/ lib/galaxy_ext/ lib/galaxy_utils/ diff --git a/lib/galaxy/visualization/data_providers/phyloviz/newickparser.py b/lib/galaxy/visualization/data_providers/phyloviz/newickparser.py index 521cb63d83b..fe17cfc53aa 100644 --- a/lib/galaxy/visualization/data_providers/phyloviz/newickparser.py +++ b/lib/galaxy/visualization/data_providers/phyloviz/newickparser.py @@ -1,5 +1,5 @@ -from __future__ import with_statement -from baseparser import Base_Parser, PhyloTree + +from .baseparser import Base_Parser, PhyloTree import re @@ -81,7 +81,7 @@ class Newick_Parser(Base_Parser): start = 0 end = 0 - for i in xrange(len(newickString)): + for i in range(len(newickString)): if newickString[i] == "(" or newickString[i] == ",": if re.match(r"[,(]", newickString[i + 1:]): continue @@ -89,7 +89,7 @@ class Newick_Parser(Base_Parser): end = i + 1 # i now refers to the starting position of the term to be replaced, # we will next find j which is the ending pos of the term - for j in xrange(i + 1, len(newickString)): + for j in range(i + 1, len(newickString)): enclosingSymbol = newickString[j] # the immediate symbol after a common or left bracket which denotes the end of a term if enclosingSymbol == ")" or enclosingSymbol == ":" or enclosingSymbol == ",": termToReplace = newickString[end:j] @@ -124,7 +124,7 @@ class Newick_Parser(Base_Parser): lenOfPreceedingInternalNodeString = 0 bracketStack = [] - for j in xrange(len(string)): + for j in range(len(string)): if string[j] == "(": # finding the positions of all the open brackets bracketStack.append(j) continue diff --git a/lib/galaxy/visualization/genomes.py b/lib/galaxy/visualization/genomes.py index 6a43139b34f..9c73573f5ae 100644 --- a/lib/galaxy/visualization/genomes.py +++ b/lib/galaxy/visualization/genomes.py @@ -101,7 +101,7 @@ class Genome( object ): if num: num = int( num ) else: - num = sys.maxint + num = sys.maxsize # just a big number if low: low = int( low ) @@ -163,14 +163,14 @@ class Genome( object ): # Set flag to indicate whether there are more chroms after list. next_chroms = False try: - len_file_enumerate.next() + next(len_file_enumerate) next_chroms = True except: # No more chroms to read. pass - to_sort = [{ 'chrom': chrm, 'len': length } for chrm, length in chroms.iteritems()] - to_sort.sort(lambda a, b: cmp( split_by_number(a['chrom']), split_by_number(b['chrom']) )) + to_sort = [{ 'chrom': chrm, 'len': length } for chrm, length in chroms.items()] + to_sort.sort(key=lambda _: split_by_number(_['chrom'])) return { 'id': self.key, 'reference': self.twobit_file is not None, @@ -232,7 +232,7 @@ class Genomes( object ): def check_and_reload( self ): # Check if tables have been modified, if so reload - for table_name, table_version in self._table_versions.iteritems(): + for table_name, table_version in self._table_versions.items(): table = self.app.tool_data_tables.get( table_name, None ) if table is not None and not table.is_current_version( table_version ): return self.reload_genomes()