All Samples(107) | Call(3) | Derive(4) | Import(100)
float(x) -> floating point number Convert a string or number to a floating point number, if possible.
src/a/l/alexandria-HEAD/src/alexandria/sessions/db/models.py alexandria(Download)
DESERIALIZERS = [
('Boolean', lambda v: v == 'True'),
('Dict', lambda v: simplejson.loads(v)),
('Float', lambda v: types.FloatType(v)),
('Int', lambda v: types.IntType(v)),
('List', lambda v: simplejson.loads(v)),
('Long', lambda v: types.LongType(v)),
src/p/y/PyXB-base-1.1.0/pyxb/binding/datatypes.py PyXB(Download)
class decimal (basis.simpleTypeDefinition, types.FloatType):
"""decimal.
U{http://www.w3.org/TR/xmlschema-2/#decimal}
@todo: The Python base type for this is wrong. Consider
U{http://code.google.com/p/mpmath/}.
class float (basis.simpleTypeDefinition, types.FloatType):
"""float.
U{http://www.w3.org/TR/xmlschema-2/#float}"""
_XsdBaseType = anySimpleType
_ExpandedName = pyxb.namespace.XMLSchema.createExpandedName('float')
@classmethod
def XsdLiteral (cls, value):
return '%s' % (value,)
_PrimitiveDatatypes.append(float)
class double (basis.simpleTypeDefinition, types.FloatType):
fractional_seconds = 0.0
if match_map.get('fracsec', None) is not None:
fractional_seconds = types.FloatType('0%s' % (match_map['fracsec'],))
usec = types.IntType(1000000 * fractional_seconds)
if negative_duration:
kw['microseconds'] = - usec
if '-' == match_map.get('negYear', None):
kw['year'] = - kw['year']
if match_map.get('fracsec', None) is not None:
kw['microsecond'] = types.IntType(1000000 * types.FloatType('0%s' % (match_map['fracsec'],)))
else:
# Discard any bogosity passed in by the caller
kw.pop('microsecond', None)