Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
lafrite 2015-06-19 14:26:37 +02:00
commit 3252716cfa
3 changed files with 8 additions and 4 deletions

View File

@ -89,7 +89,8 @@ class Expression(Explicable):
if type(exp) == str:
expression.postfix_tokens = str2tokens(exp)
elif type(exp) == list:
exp_mod_op = [op.get_op(i) if (str(i) in "+-*/^" and not isOperator(i)) else i for i in exp]
# Ici on ne peut convertir les "+" en opérateur que s'ils sont d'arité 2.
exp_mod_op = [op.get_op(i) if op.can_be_operator(i) else i for i in exp]
expression.postfix_tokens = flatten_list([tok.postfix_tokens if Expression.isExpression(tok) else tok for tok in exp_mod_op])
elif type(exp) == Expression:
return exp

View File

@ -268,7 +268,10 @@ class op(object):
@classmethod
def can_be_operator(cls, symbole):
""" Tell if the symbole can be an operator """
return symbole in [i[0] for i in cls._operators]
if type(symbole) == str:
return symbole in [i[0] for i in cls._operators]
else:
return False
@ClassProperty

View File

@ -156,9 +156,9 @@ class Polynom_deg2(Polynom):
def tbl_sgn_header(self):
""" Return header of the sign line for tkzTabLine"""
if self.delta > 0:
return "{$-\\infty$, " + str(min(self.roots())) + " , " + str( max(self.roots())) + " , $+\\infty$}"
return "{$-\\infty$, $" + str(min(self.roots())) + "$ , $" + str( max(self.roots())) + "$ , $+\\infty$}"
elif self.delta == 0:
return "{$-\\infty$, " + str(self.roots()[0]) + " , $+\\infty$}"
return "{$-\\infty$, $" + str(self.roots()[0]) + "$ , $+\\infty$}"
else:
return "{$-\\infty$, $+\\infty$}"