"Fossies" - the Fresh Open Source Software Archive

Member "NZMATH-1.2.0/nzmath/plugins.py" (19 Nov 2012, 1162 Bytes) of package /linux/misc/old/NZMATH-1.2.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "plugins.py" see the Fossies "Dox" file reference documentation.

    1 """
    2 plugins -- plug-in mechanism
    3 
    4 Some function, such as floating point arithmetic, could have several
    5 choices of modules. The 'plugins' module provides the mechanism to
    6 choose one among these choices.  One can *plug-in* one module or
    7 another for the function.
    8 
    9 Usage:
   10 The choice among plug-in modules is made through nzmath.config.
   11 See the plug-in section of it for detail.
   12 
   13 One can import all plugged-in constants as:
   14   from nzmath.plugins import *
   15 but if he/she would like to select among features, it is possible:
   16   from nzmath.plugins import MATHMODULE as math
   17 or something.
   18 
   19 For Developers:
   20 You should provide wrapper modules for plug-ins to ensure they have
   21 the common interface.  Those plug-in wrapper modules should go into
   22 the 'plugin' sub-package.
   23 """
   24 from nzmath.config import PLUGIN_MATH
   25 
   26 # math plug-ins
   27 MATH_PLUGIN_CHOICE = ('mpmath', None)
   28 
   29 if PLUGIN_MATH == MATH_PLUGIN_CHOICE[0]:
   30     from nzmath.plugin.math._mpmath import *
   31 else:
   32     from nzmath.plugin.math.default import *
   33 
   34 
   35 _MATH = ['MATHMODULE', 'CMATHMODULE', 'FLOATTYPE', 'COMPLEXTYPE',
   36          'CHECK_REAL_OR_COMPLEX',
   37          'PRECISION_CHANGEABLE', 'SETPRECISION']
   38 
   39 __all__ = _MATH