transform if to try/except in develop_steps

This commit is contained in:
Benjamin Bertrand 2016-02-09 10:14:54 +03:00
parent ba579c9ab3
commit 52ff23a749

View File

@ -218,14 +218,14 @@ class Expression(Explicable):
def develop_steps(self, tokenList): def develop_steps(self, tokenList):
""" From a list of tokens, it develops steps of each tokens """ """ From a list of tokens, it develops steps of each tokens """
# TODO: Attention les étapes sont dans le mauvais sens |lun. avril 20 10:06:03 CEST 2015
tmp_steps = [] tmp_steps = []
with Expression.tmp_render(): for t in tokenList:
for t in tokenList: try:
if hasattr(t, "explain"): with Expression.tmp_render():
tmp_steps.append([i for i in t.explain()]) tmp_steps.append([i for i in t.explain()])
else: except AttributeError:
tmp_steps.append([t]) tmp_steps.append([t])
if max([len(i) for i in tmp_steps]) == 1: if max([len(i) for i in tmp_steps]) == 1:
# Cas où rien n'a dû être expliqué. # Cas où rien n'a dû être expliqué.
return [] return []