m RAR&R=R:R9RBR?((Rtimport_modules{s*       cCs||||d|dS(s Does a subpackages scan using find_subpackages(module) and then imports all submodules found into module. The module location is found by looking at the __file__ attribute that non-builtin modules define. The function uses the __all__ attribute from the package __init__ module if available. If reload is true (default is false), all already modules among the list will be forced to reload. R@N(RFR)R7R@(R7R@RFR)((Rtimport_subpackagesscCsg}|i} ti} x|D]}| i|p d} nd} y;||||dg} |o| o|| } nWnLt j o@} |djoqq|djo t | qtdnX| | qW|S(sv Imports all modules in modnames using the given namespaces and returns list of corresponding module objects. If errors is 'strict' (default), then ImportErrors are raised. If set to 'ignore', they are silently ignored. If reload is true (default is false), all already modules among the list will be forced to reload. iiR5R6R4sunkown errors valueN(R2RR1R:R;R&R<R=R>R9R?R@RARRBRCRD(R;R9tglobalsRCR@R>RAR&R2R=RR:RBR?((Rt load_moduless*       cCs"|||||d|d|S(s Same as import_subpackages but with load_modules functionality, i.e. imports the modules and also returns a list of module objects. If errors is 'strict' (default), then ImportErrors are raised. If set to 'ignore', they are silently ignored. If reload is true (default is false), all already modules among the list will be forced to reload. RCR@N(RIR)R7R9RHRCR@(R7R9RHRCR@RIR)((Rtload_subpackagesscCs|ti|S(sv Converts a list of module names into a list of module objects. The modules must already be loaded. N(textractR1R2tnames(RLRK((RR2scCsy|d}t|}ti|g}xLtiiD];\}}|| |jo|dj o|i |q6q6W|S(s Returns a list of all modules belonging to the package with the given name. The package must already be loaded. Only the currently registered modules are included in the list. RN( tpkgnameRtlent match_lenR1R2tmodstitemstktvR R(RMRORPRRRSR((Rtpackage_moduless   c Csg}x|D]}x|iiD]p\}}t||joQ|o||| oq#n|o|i |||fq|i |q#q#Wq W|S(sY Find all subclasses of baseclass or simply all classes (if baseclass is None) defined by the module objects in list mods. If annotated is true the returned list will contain tuples (module_object,name,class_object) for each class found where module_object is the module where the class is defined. N( tclassesRPR?R8RQR&tobjttypet ClassTypet baseclasst issubclasst annotatedR( RPRYR[RXRZRVR&RUR?((Rt find_classes s  c Cs}g}xp|D]h}x_|iiD]N\}}t||o2|o|i |||fqq|i |q#q#Wq W|S(s7 Find all instances of baseclass defined by the module objects in list mods. If annotated is true the returned list will contain tuples (module_object,name,instances_object) for each instances found where module_object is the module where the instances is defined. N( t instancesRPR?R8RQR&RVt isinstanceRYR[R( RPRYR[t InstanceTypeRZRVR&R]R?((Rtfind_instances!s  (,t__doc__t __version__RttypesR1tstringtretimpt __builtin__tmx.Tools.NewBuiltinstmxt projectiont get_suffixestsuffixestcompileRR RtcurdirR RRRRRR'R)R*R-R3t __import__R@RFRGRIRJRKR2RTRXRZR\R_R`(R3RRgRFRJReRTR`R)RGRfRbRdR1R\RIRRcR2R RRiRl((Rt? s"? ##B3($