Changeset 3781a2 in git


Ignore:
Timestamp:
Jun 24, 2005, 3:49:43 PM (18 years ago)
Author:
Michael Brickenstein <bricken@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
77f48383612238705c6d4aced9da57ed67fbb727
Parents:
936ad6e7b43877925b9627e6c3c2fed178961312
Message:
*bricken: beautified


git-svn-id: file:///usr/local/Singular/svn/trunk@8404 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
modules/openmathserver
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • modules/openmathserver/cd.py

    r936ad6 r3781a2  
    22from omexceptions import *
    33class OMCD(object):
    4     def __init__(self,name, base="http://www.openmath.org/cd"):
    5         self.name=name
    6         self.base=base
     4    def __init__(self, name, base="http://www.openmath.org/cd"):
     5        self.name = name
     6        self.base = base
    77    def  __eq__(self, other):
    88        try:
    9             return (self.name==other.name) and (self.base==other.base)
     9            return (self.name == other.name) and (self.base == other.base)
    1010        except:
    1111            return False
     
    1515class OMCDImplementation(object):
    1616    def __init__(self,cd):
    17         self.cd=cd
    18         self.implementations={}
     17        self.cd = cd
     18        self.implementations = {}
    1919    def __getitem__(self, name):
    2020        return self.implementations[name]
    2121    def __setitem__(self,name,value):
    22         self.implementations[name]=value
     22        self.implementations[name] = value
    2323    def implement(self,symbolname, func):
    2424        symbol=OMSymbol(symbolname,self.cd)
    25         impl=ImplementedOMSymbol(symbol,func)
     25        impl = ImplementedOMSymbol(symbol,func)
    2626        self[symbol]=impl
    2727       
     
    3131    def __init__(self,symbol, func):
    3232        super(ImplementedOMSymbol,self).__init__(symbol.name, symbol.cd)
    33         self.implementation=func
     33        self.implementation = func
    3434    def __str__(self):
    3535        return "ImplementedOMS("+self.name+", " + self.cd.name +")"
  • modules/openmathserver/objects.py

    r936ad6 r3781a2  
    1 from omexceptions import *
    2 from exceptions import *
     1"""Implementation of openmath basic objects"""
     2from omexceptions import UnsupportedOperationError
     3from  omexceptions import OutOfScopeError, EvaluationFailedError
     4from exceptions import NotImplementedError
    35from copy import copy
    46import base64
     
    194196
    195197class OMint(SimpleValue):
    196     def __init__(self,value):
    197         if not isinstance(value,int):
     198    def __init__(self, value):
     199        if not isinstance(value, int):
    198200            value = self.parse(value)
    199         super(OMint,self).__init__(value)
    200     def parse(self,value):
     201        super(OMint, self).__init__(value)
     202    def parse(self, value):
    201203        """FIXME: Not fully standard compliant,
    202204        -> hex encodings"""
    203         return int(value,10)
     205        return int(value, 10)
    204206    def __str__(self):
    205207        return "OMint("+repr(self.value)+")"
     
    208210    def setBody(self, value):
    209211        raise UnsupportedOperationError
    210     XMLtag="OMI"
     212    XMLtag = "OMI"
    211213class OMfloat(SimpleValue):
    212214    def __init__(self, value):
     
    220222    XMLtag = "OMF"
    221223    def getXMLAttributes(self):
    222         return [XMLAttribute("dec",str(self.value))]
     224        return [XMLAttribute("dec" ,str(self.value))]
    223225class OMString(SimpleValue):
    224226    def __init__(self,value):
     
    230232        return self.value
    231233class OMByteArray(SimpleValue):
    232     def __init__(self,value):
     234    def __init__(self, value):
    233235        super(OMByteArray,self).__init__(value)
    234236    def __str__(self):
     
    236238    def parse(self, value):
    237239        return value
    238     XMLtag="OMB"
     240    XMLtag = "OMB"
    239241    def getBody(self):
    240242        return base64.encodestring(self.value)
     
    276278    XMLtag = "OMATTR"
    277279if __name__ == '__main__':
    278     from context import *
    279 
    280     from binding import *
     280    from context import Context
     281
     282    from binding import OMBinding, lambdasym
    281283
    282284    context = Context()
Note: See TracChangeset for help on using the changeset viewer.