Package recsql :: Module convert
[hide private]
[frames] | no frames]

Module convert

source code


:mod:`recsql.convert` --- converting entries of tables
======================================================

.. autoclass:: Autoconverter
   :members: __init__
.. function:: Autoconverter.convert(x)
 
              Convert *x* (if in the active state)
.. attribute:: Autoconverter.active

               If set  to ``True`` then conversion takes place; ``False`` 
               just returns :func:`besttype` applid to the value.

.. autofunction:: besttype
.. autofunction:: to_unicode

Classes [hide private]
  Autoconverter
Automatically convert an input value to a special python object.
Functions [hide private]
 
to_unicode(obj, encoding='utf-8')
Convert obj to unicode (if it can be be converted)
source code
 
besttype(x, encoding="utf-8")
Convert string x to the most useful type, i.e.
source code
 
to_int64(a)
Return view of the recarray with all int32 cast to int64.
source code
Function Details [hide private]

to_unicode(obj, encoding='utf-8')

source code 

Convert obj to unicode (if it can be be converted)

from http://farmdev.com/talks/unicode/

besttype(x, encoding="utf-8")

source code 
Convert string x to the most useful type, i.e. int, float or unicode string.

If x is a quoted string (single or double quotes) then the quotes
are stripped and the enclosed string returned.

.. Note:: Strings will be returned as Unicode strings (using
          :func:`unicode`), based on the *encoding* argument, which is
          utf-8 by default.