<s> __all__ = [ "<STR_LIT>" ] <EOL> import sys <EOL> from openmdao . main . factory import Factory <EOL> from openmdao . util . log import logger <EOL> class ImportFactory ( Factory ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> super ( ImportFactory , self ) . __init__ ( ) <EOL> self . _ctors = { } <EOL> def create ( self , typ , version = None , server = None , <EOL> res_desc = None , ** ctor_args ) : <EOL> """<STR_LIT>""" <EOL> if server is not None or version is not None : <EOL> return None <EOL> if res_desc is not None and len ( res_desc ) > <NUM_LIT:0> : <EOL> return None <EOL> ctor = self . _import ( typ ) <EOL> if ctor is None : <EOL> return None <EOL> else : <EOL> return ctor ( ** ctor_args ) <EOL> def _import ( self , typ ) : <EOL> """<STR_LIT>""" <EOL> if typ not in self . _ctors : <EOL> parts = typ . split ( '<STR_LIT:.>' ) <EOL> cname = parts [ - <NUM_LIT:1> ] <EOL> modname = '<STR_LIT:.>' . join ( parts [ : - <NUM_LIT:1> ] ) <EOL> try : <EOL> __import__ ( modname , globals ( ) , locals ( ) , [ cname ] ) <EOL> mod = sys . modules [ modname ] <EOL> except ( ImportError , KeyError ) as err : <EOL> logger . error ( str ( err ) ) <EOL> return None <EOL> try : <EOL> self . _ctors [ typ ] = getattr ( mod , cname ) <EOL> except AttributeError as err : <EOL> logger . error ( str ( err ) ) <EOL> return None <EOL> return self . _ctors [ typ ] <EOL> def get_available_types ( self , groups = None ) : <EOL> """<STR_LIT>""" <EOL> return [ ] <EOL> def get_signature ( self , typname , version = None ) : <EOL> """<STR_LIT>""" <EOL> if version is not None : <EOL> return None <EOL> cls = self . _import ( typname ) <EOL> if cls is None : <EOL> return None <EOL> else : <EOL> return self . form_signature ( cls ) </s>
