Fix: Black does its job
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -101,7 +101,6 @@ class MO(ABC):
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
|
||||
class Atom(MO):
|
||||
|
||||
""" Base Math Object with only one component.
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user