From 0f986e0ed3f39a3ca3d421b061de7ebe6c03ff10 Mon Sep 17 00:00:00 2001 From: Jordi Date: Thu, 7 Mar 2024 20:32:31 +0100 Subject: [PATCH] newick.pyx: In loads(), convert parser from int parser. This allows the common usage of calling loads() with an old-style int that specifies the parser to use. --- ete4/parser/newick.pyx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ete4/parser/newick.pyx b/ete4/parser/newick.pyx index b01c21ad..30f9b436 100644 --- a/ete4/parser/newick.pyx +++ b/ete4/parser/newick.pyx @@ -212,6 +212,9 @@ def loads(tree_text, parser=None, tree_class=Tree): if not tree_text.endswith(';'): raise NewickError('text ends with no ";"') + if type(parser) == int: # parser is an integer? (old-style/shortcut) + parser = INT_PARSERS[parser] # substitute it for the actual parser + if tree_text[0] == '(': nodes, pos = read_nodes(tree_text, parser, 0, tree_class) else: