Class representing a byte quantity.
A byte quantity has both a quantity and a byte-related unit. Units
are maintained using the constants from util.py. If no units are
provided, UNIT_BYTES
is assumed.
The quantity is maintained internally as a string so that issues of
precision can be avoided. It really isn't possible to store a floating
point number here while being able to losslessly translate back and forth
between XML and object representations. (Perhaps the Python 2.4 Decimal
class would have been an option, but I originally wanted to stay
compatible with Python 2.3.)
Even though the quantity is maintained as a string, the string must be
in a valid floating point positive number. Technically, any floating
point string format supported by Python is allowble. However, it does
not make sense to have a negative quantity of bytes in this context.
|
|
|
|
|
|
|
|
|
__eq__(self,
other)
Equals operator, implemented in terms of Python 2-style compare
operator. |
source code
|
|
|
__lt__(self,
other)
Less-than operator, implemented in terms of Python 2-style compare
operator. |
source code
|
|
|
__gt__(self,
other)
Greater-than operator, implemented in terms of Python 2-style compare
operator. |
source code
|
|
|
_setQuantity(self,
value)
Property target used to set the quantity The value must be
interpretable as a float if it is not None |
source code
|
|
|
_getQuantity(self)
Property target used to get the quantity. |
source code
|
|
|
|
|
_getUnits(self)
Property target used to get the units value. |
source code
|
|
|
_getBytes(self)
Property target used to return the byte quantity as a floating point
number. |
source code
|
|
|
|
|
|
Inherited from object :
__delattr__ ,
__format__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__setattr__ ,
__sizeof__ ,
__subclasshook__
|