ReFRACtor
__init__.py
Go to the documentation of this file.
1 from __future__ import absolute_import
2 import sys
3 import glob
4 import os
5 import re
6 
7 # Depending on how we are built, we might or might not have SWIG available.
8 # The python modules need to work either way, so we have this simple test
9 # and load if found.
10 try:
11  import refractor_swig as framework
12  have_refractor_swig = True
13 except ImportError:
14  have_refractor_swig = False
15 
16 # Make sure we can safely import matplotlib without getting an error
17 # (see this module for details on this)
18 from . import safe_matplotlib_import
19 
20 # Normal __all__ doesn't work here, because we also need to include the
21 # refractor_swig stuff (with __all__, *only* the listed modules are
22 # included). So we just explicitly import the modules we want here.
23 
24 # Don't automatically import these modules, they may use C interface
25 # stuff and should not be available unless directly imported
26 NO_AUTO_IMPORT = []
27 
28 for i in glob.glob(os.path.dirname(__file__) + "/*.py"):
29  mname = os.path.basename(i).split('.')[0]
30  # Don't automatically import test routines
31  if(not re.match('.*_test', mname)) and (not mname in NO_AUTO_IMPORT):
32  exec('from .%s import *' % mname)

Copyright © 2017, California Institute of Technology.
ALL RIGHTS RESERVED.
U.S. Government Sponsorship acknowledged.
Generated Fri Aug 24 2018 15:44:10