コード例 #1
0
ファイル: csafe.py プロジェクト: ed-aicradle/monotone
 def __str__(self):
     answer = '[' + MagnitudeInterface.__str__(self) + ','
     if self.units is None:
         answer += 'None]'
     else:
         answer += "'" + str(int(self.units)) + "']"
     return answer
コード例 #2
0
ファイル: csafe.py プロジェクト: ed-aicradle/monotone
 def __init__(self, value=None, units=None):
     self.units = units
     #if units:
         #self.units = units_text[units]
     MagnitudeInterface.__init__(self, value)
コード例 #3
0
ファイル: example.py プロジェクト: ed-aicradle/monotone
print dumps((StringClass("Text with ]]>"), ))

print """
#
# The StringMarshaller is more advanced then the built in string marshelling.
# We could remove our escape hack and replace the string marshalling.
#
>>> Marshaller.dispatch[types.StringType] = \\
    Marshaller.dispatch[types.InstanceType]
"""
Marshaller.dispatch[types.StringType] = Marshaller.dispatch[types.InstanceType]
print """
#
# We could do a cleaner reimplementation, but this just show that now the str
# marshaller uses the InstanceType, which I've extended to support registerring
# handlers, blah, blah, blah...
#
>>> print dumps(('this is a test.',)) # Look ma, CDATA goodies!
"""
print dumps(('this is a test.', ))

from mpx.lib import EnumeratedValue

print dumps((EnumeratedValue(2, "asdf"), ))

from mpx.lib.magnitude import MagnitudeInterface

print dumps((MagnitudeInterface(1), ))
print dumps((MagnitudeInterface(2L), ))
print dumps((MagnitudeInterface(3.0), ))