remove solve todo
This commit is contained in:
parent
9dd42d2151
commit
1352f90f7d
@ -8,7 +8,6 @@ class Stack(object):
|
|||||||
"""Docstring for Stack """
|
"""Docstring for Stack """
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""@todo: to be defined1 """
|
|
||||||
self.items = []
|
self.items = []
|
||||||
|
|
||||||
def pushFromList(self, list):
|
def pushFromList(self, list):
|
||||||
@ -21,7 +20,6 @@ class Stack(object):
|
|||||||
|
|
||||||
def isEmpty(self):
|
def isEmpty(self):
|
||||||
""" Says if the stack is empty
|
""" Says if the stack is empty
|
||||||
:returns: @todo
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self.items == []
|
return self.items == []
|
||||||
@ -29,9 +27,6 @@ class Stack(object):
|
|||||||
def push(self, item):
|
def push(self, item):
|
||||||
"""Push an item in the stack
|
"""Push an item in the stack
|
||||||
|
|
||||||
:param item: @todo
|
|
||||||
:returns: @todo
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.items.append(item)
|
self.items.append(item)
|
||||||
|
|
||||||
|
@ -116,7 +116,6 @@ class Operator(str):
|
|||||||
:*args: Operands for this operation
|
:*args: Operands for this operation
|
||||||
:returns: list with the operator surrounded by operands
|
:returns: list with the operator surrounded by operands
|
||||||
|
|
||||||
# TODO: order doctest |lun. nov. 24 07:17:29 CET 2014
|
|
||||||
>>> op.mul.__p2i__(1,2)
|
>>> op.mul.__p2i__(1,2)
|
||||||
[1, '*', 2]
|
[1, '*', 2]
|
||||||
>>> f = save_mainOp([2, op.add, 3],op.add)
|
>>> f = save_mainOp([2, op.add, 3],op.add)
|
||||||
@ -131,9 +130,7 @@ class Operator(str):
|
|||||||
>>> op.sub1.__p2i__(f)
|
>>> op.sub1.__p2i__(f)
|
||||||
['-', '(', 2, '+', 3, ')']
|
['-', '(', 2, '+', 3, ')']
|
||||||
"""
|
"""
|
||||||
# TODO: Attention à gestion des fractions qui se comportent chelou avec les parenthèses |dim. nov. 9 09:21:52 CET 2014
|
|
||||||
if self.arity == 1:
|
if self.arity == 1:
|
||||||
# TODO: Marche juste avec -, il faudra voir quand il y aura d'autres operateurs unitaires |dim. nov. 9 09:24:53 CET 2014
|
|
||||||
op1 = self.l_parenthesis(args[0])
|
op1 = self.l_parenthesis(args[0])
|
||||||
ans = flatten_list([self, op1])
|
ans = flatten_list([self, op1])
|
||||||
|
|
||||||
@ -165,7 +162,6 @@ class Operator(str):
|
|||||||
|
|
||||||
def r_parenthesis(self, op, str_join=False):
|
def r_parenthesis(self, op, str_join=False):
|
||||||
""" Add parenthesis for rigth operand if necessary """
|
""" Add parenthesis for rigth operand if necessary """
|
||||||
# TODO: /!\ Parenthèses pour -2abc et l'opérateur * |lun. mars 9 19:02:32 CET 2015
|
|
||||||
try:
|
try:
|
||||||
if op.mainOp.priority < self.priority:
|
if op.mainOp.priority < self.priority:
|
||||||
op = flatten_list(["(", op, ")"])
|
op = flatten_list(["(", op, ")"])
|
||||||
|
@ -77,11 +77,12 @@ if __name__ == '__main__':
|
|||||||
from itertools import permutations
|
from itertools import permutations
|
||||||
from pymath import Polynom
|
from pymath import Polynom
|
||||||
from pymath import Expression
|
from pymath import Expression
|
||||||
|
from pymath import Fraction
|
||||||
coefs_p = [[(i-2),(j-2)] for i,j in permutations(range(5),2)]
|
coefs_p = [[(i-2),(j-2)] for i,j in permutations(range(5),2)]
|
||||||
coefs_q = [[2*(i-2),2*(j-2)] for i,j in permutations(range(5),2)]
|
coefs_q = [[2*(i-2),2*(j-2)] for i,j in permutations(range(5),2)]
|
||||||
l_p = [Polynom(i) for i in coefs_p]
|
l_p = [Polynom(i) for i in coefs_p]
|
||||||
l_q = [Polynom(i) for i in coefs_q]
|
l_q = [Fraction(i,j) for i,j in coefs_q if j!=0]
|
||||||
operations = [Expression([l_p[i],l_q[j],op.pw]) for i,j in permutations(range(len(coefs_p)),2)]
|
operations = [Expression([l_p[i],l_q[j],op.mul]) for i,j in permutations(range(len(l_q)),2)]
|
||||||
for i in operations:
|
for i in operations:
|
||||||
print(i)
|
print(i)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user