type filter for operations
This commit is contained in:
@@ -14,6 +14,7 @@ from ..tree import Tree
|
||||
from ..MO.mo import MO, MOnumber
|
||||
from ..MO.fraction import MOFraction
|
||||
from .exceptions import DivideError
|
||||
from .type_filter import args_are
|
||||
|
||||
|
||||
def divide(left, right):
|
||||
@@ -47,6 +48,7 @@ def divide(left, right):
|
||||
|
||||
return MULFUNCTIONS[(type(left), type(right))](left, right)
|
||||
|
||||
@args_are(MOnumber, MOnumber)
|
||||
def monumber_monumber(left, right):
|
||||
""" Divide 2 monumbers
|
||||
|
||||
@@ -61,6 +63,7 @@ def monumber_monumber(left, right):
|
||||
"""
|
||||
return MOFraction(left, right)
|
||||
|
||||
@args_are(MOnumber, MOFraction)
|
||||
def monumber_mofraction(left, right):
|
||||
""" Divide a monumber and a mofraction
|
||||
|
||||
@@ -92,6 +95,7 @@ def monumber_mofraction(left, right):
|
||||
|
||||
return Tree("*", left, right.inverse())
|
||||
|
||||
@args_are(MOFraction, MOnumber)
|
||||
def mofraction_monumber(left, right):
|
||||
""" Divide a monumber and a mofraction
|
||||
|
||||
@@ -118,6 +122,7 @@ def mofraction_monumber(left, right):
|
||||
right_fraction = MOFraction(1, right)
|
||||
return Tree("*", left, right_fraction)
|
||||
|
||||
@args_are(MOFraction, MOFraction)
|
||||
def mofraction_mofraction(left, right):
|
||||
""" Divide two mofractions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user