openmath/convert.py
def to_python(self, omobj):
        """ Convert OpenMath object to Python """
        # general overrides
        if omobj.__class__ in self._omclass_to_py:
            return self._omclass_to_py[omobj.__class__](omobj)
        # oms
        elif isinstance(omobj, om.OMSymbol):
            return self._lookup_to_python(omobj.cdbase, omobj.cd, omobj.name)
        # oma
        elif isinstance(omobj, om.OMApplication):
            elem = self.to_python(omobj.elem)
            arguments = [self.to_python(x) for x in omobj.arguments]
            return elem(*arguments)
        raise ValueError('Cannot convert object of class %s to Python.' % omobj.__class__.__name__)
def to_python(self, omobj):
        """ Convert OpenMath object to Python """
        # general overrides
        if omobj.__class__ in self._omclass_to_py:
            return self._omclass_to_py[omobj.__class__](omobj)
        # oms
        elif isinstance(omobj, om.OMSymbol):
            return self._lookup_to_python(omobj.cdbase, omobj.cd, omobj.name)
        # oma
        elif isinstance(omobj, om.OMApplication):
            elem = self.to_python(omobj.elem)
            arguments = [self.to_python(x) for x in omobj.arguments]
            return elem(*arguments)
        raise ValueError('Cannot convert object of class %s to Python.' % omobj.__class__.__name__)
def to_python ( self , omobj ) : # general overrides if omobj . __class__ in self . _omclass_to_py : return self . _omclass_to_py [ omobj . __class__ ] ( omobj ) # oms elif isinstance ( omobj , om . OMSymbol ) : return self . _lookup_to_python ( omobj . cdbase , omobj . cd , omobj . name ) # oma elif isinstance ( omobj , om . OMApplication ) : elem = self . to_python ( omobj . elem ) arguments = [ self . to_python ( x ) for x in omobj . arguments ] return elem ( * arguments ) raise ValueError ( 'Cannot convert object of class %s to Python.' % omobj . __class__ . __name__ )
Convert OpenMath object to Python
Convert OpenMath object to Python