Compare commits
No commits in common. "1a20e6927d5a2871c2b61bb429fd0bfe3049f0b3" and "bb43611f670ea49aa846c42f37a9de283fe0e671" have entirely different histories.
1a20e6927d
...
bb43611f67
@ -64,10 +64,25 @@ class Token(object):
|
||||
yield self
|
||||
|
||||
def __repr__(self):
|
||||
return f"<{self.__class__.__name__} {renders['txt'](self._mo)}>"
|
||||
return f"<{self.__class__.__name__} {self.__txt__}>"
|
||||
|
||||
def __str__(self):
|
||||
return renders[self.RENDER](self._mo)
|
||||
if self.RENDER == "tex":
|
||||
return self.__tex__
|
||||
elif self.RENDER == "txt":
|
||||
return self.__txt__
|
||||
else:
|
||||
raise ValueError(f"Unknow render {self.RENDER}")
|
||||
|
||||
# return renders[self.RENDER](self._mo)
|
||||
|
||||
@property
|
||||
def __txt__(self):
|
||||
return self._mo.__txt__
|
||||
|
||||
@property
|
||||
def __tex__(self):
|
||||
return self._mo.__tex__
|
||||
|
||||
@property
|
||||
def raw(self):
|
||||
@ -250,6 +265,7 @@ class Token(object):
|
||||
"""
|
||||
return self._operate(other, "^")
|
||||
|
||||
|
||||
def _roperate(self, other, operation):
|
||||
""" Make a operation between 2 Tokens """
|
||||
from ..expression import Expression
|
||||
@ -299,7 +315,6 @@ class Token(object):
|
||||
<Linear x - 3>
|
||||
"""
|
||||
return self._roperate(other, "-")
|
||||
|
||||
def __rmul__(self, other):
|
||||
""" Multiply 2 Tokens or a Token and a Expression
|
||||
|
||||
@ -327,6 +342,7 @@ class Token(object):
|
||||
"""
|
||||
return self._roperate(other, "/")
|
||||
|
||||
|
||||
def _get_soul(self, other=None):
|
||||
""" Get the builtin soul of self or other """
|
||||
if isinstance(other, Token):
|
||||
|
Loading…
Reference in New Issue
Block a user