Fix: Black does its job

This commit is contained in:
2019-10-13 21:01:31 +02:00
parent aba43c9f19
commit 931e55c35e
14 changed files with 98 additions and 67 deletions

View File

@@ -26,6 +26,7 @@ def moify(token):
except MOError:
return token
@coroutine
def moify_cor(target):
""" Coroutine which try to convert a parsed token into an MO

View File

@@ -101,7 +101,6 @@ class MO(ABC):
raise NotImplementedError
class Atom(MO):
""" Base Math Object with only one component.

View File

@@ -110,6 +110,7 @@ class MOstrPower(Molecule):
'monome2'
"""
return f"monome{self.power}"
def differentiate(self):
""" differentiate a MOstrPower and get a tree
@@ -121,8 +122,10 @@ class MOstrPower(Molecule):
> x^2
"""
if self._power > 2:
return Tree('*', self.power, MOstrPower(self.variable, self._power._value-1))
return Tree('*', self.power, MOstr(self.variable))
return Tree(
"*", self.power, MOstrPower(self.variable, self._power._value - 1)
)
return Tree("*", self.power, MOstr(self.variable))
class MOMonomial(Molecule):

View File

@@ -27,6 +27,7 @@ multiply_doc = """ Multiply MOs
multiply = Dispatcher("multiply", doc=multiply_doc)
def multiply_filter(left, right):
""" Automatic multiply on MO
@@ -56,6 +57,7 @@ def multiply_filter(left, right):
except TypeError:
pass
@multiply.register((MOnumber, MOFraction), MOstr)
@special_case(multiply_filter)
def moscalar_mostr(left, right):
@@ -102,7 +104,7 @@ def moscalar_mostrpower(left, right):
>>> multiply(a, x)
<MOstrPower x^4>
"""
#if left == 1:
# if left == 1:
# return right
return MOMonomial(left, right)