Famcy/_util_/_fmanager.py
def importclassdir(self, header_url, module_url, file_import_mode, import_arg, 
			exclude=[], recursive=False, otherwise=None):
		"""
		This is the helper function to import
		all classes from a directory. The way
		the file is imported is depend on file_import_mode. 
		Usage assume the top level directory is full of folders
		and we are looking for name or fixed module in all of
		these folders. 

		name:
			* import the module that is the same name as
			the folder itself.
		fixed:
			* import the module with the name import_arg

		- Input:
			* header_url: a string that defines the url to the module. 
				the path must be separated with / and ends without /.
				Need to prune when importing modules
			* module_url: a string that defines the url to the module. 
				the path must be separated with / and ends without /
			* file_import_mode: FamcyFileImportMode
			* import_arg: arg for specific import mode.
		"""
		# Default return
		ret_list = otherwise

		# Get all dir path
		dir_list = self.listdir_exclude(header_url, module_url, exclude_list=exclude, 
				recursive=recursive, only_dir=True)

		import_dir_list = []
		for dir_path in dir_list:
			# Switch the file import mode. 
			if file_import_mode == FamcyFileImportMode.name:
				module_name = dir_path.split("/")[-1]
			elif file_import_mode == FamcyFileImportMode.fixed:
				module_name = import_arg

			# Import class instance. 
			# Prune root directory
			pruned_url = dir_path + "/" + module_name
			module_string = pruned_url.replace("/", ".").replace("\\", ".")
			try:
				class_inst = importlib.import_module(module_string)
			except Exception as e:
				# Continue if no import lib
				print("Import Error: ", module_string, e)
				continue

			if class_inst:
				import_dir_list.append(class_inst)

		# I think aliasing is ok here
		if import_dir_list != []:
			ret_list = import_dir_list

		return ret_list

		This is the helper function to import
		all classes from a directory. The way
		the file is imported is depend on file_import_mode. 
		Usage assume the top level directory is full of folders
		and we are looking for name or fixed module in all of
		these folders. 

		name:
			* import the module that is the same name as
			the folder itself.
		fixed:
			* import the module with the name import_arg

		- Input:
			* header_url: a string that defines the url to the module. 
				the path must be separated with / and ends without /.
				Need to prune when importing modules
			* module_url: a string that defines the url to the module. 
				the path must be separated with / and ends without /
			* file_import_mode: FamcyFileImportMode
			* import_arg: arg for specific import mode.
		
This is the helper function to import
all classes from a directory. The way
the file is imported is depend on file_import_mode.
Usage assume the top level directory is full of folders
and we are looking for name or fixed module in all of
these folders.

import the module that is the same name as
the folder itself.
fixed:
import the module with the name import_arg

a string that defines the url to the module.
the path must be separated with / and ends without /.
Need to prune when importing modules
module_url: a string that defines the url to the module.
the path must be separated with / and ends without
file_import_mode: FamcyFileImportMode
import_arg: arg for specific import mode.
This is the helper function to import all classes from a directory . The way the file is imported is depend on file_import_mode . Usage assume the top level directory is full of folders and we are looking for name or fixed module in all of these folders . import the module that is the same name as the folder itself . fixed : import the module with the name import_arg a string that defines the url to the module . the path must be separated with / and ends without / . Need to prune when importing modules module_url : a string that defines the url to the module . the path must be separated with / and ends without file_import_mode : FamcyFileImportMode import_arg : arg for specific import mode .
def importclassdir(self, header_url, module_url, file_import_mode, import_arg, 
			exclude=[], recursive=False, otherwise=None):
		ret_list = otherwise
		dir_list = self.listdir_exclude(header_url, module_url, exclude_list=exclude, 
				recursive=recursive, only_dir=True)
		import_dir_list = []
		for dir_path in dir_list:
			if file_import_mode == FamcyFileImportMode.name:
				module_name = dir_path.split("/")[-1]
			elif file_import_mode == FamcyFileImportMode.fixed:
				module_name = import_arg
			pruned_url = dir_path + "/" + module_name
			module_string = pruned_url.replace("/", ".").replace("\\", ".")
			try:
				class_inst = importlib.import_module(module_string)
			except Exception as e:
				print("Import Error: ", module_string, e)
				continue
			if class_inst:
				import_dir_list.append(class_inst)
		if import_dir_list != []:
			ret_list = import_dir_list
		return ret_list
def importclassdir ( self , header_url , module_url , file_import_mode , import_arg , exclude = [ ] , recursive = False , otherwise = None ) : ret_list = otherwise dir_list = self . listdir_exclude ( header_url , module_url , exclude_list = exclude , recursive = recursive , only_dir = True ) import_dir_list = [ ] for dir_path in dir_list : if file_import_mode == FamcyFileImportMode . name : module_name = dir_path . split ( "/" ) [ - 1 ] elif file_import_mode == FamcyFileImportMode . fixed : module_name = import_arg pruned_url = dir_path + "/" + module_name module_string = pruned_url . replace ( "/" , "." ) . replace ( "\\" , "." ) try : class_inst = importlib . import_module ( module_string ) except Exception as e : print ( "Import Error: " , module_string , e ) continue if class_inst : import_dir_list . append ( class_inst ) if import_dir_list != [ ] : ret_list = import_dir_list return ret_list
This is the helper function to import
all classes from a directory.
This is the helper function to import all classes from a directory .
"""
		This is the helper function to import
		all classes from a directory. The way
		the file is imported is depend on file_import_mode. 
		Usage assume the top level directory is full of folders
		and we are looking for name or fixed module in all of
		these folders. 

		name:
			* import the module that is the same name as
			the folder itself.
		fixed:
			* import the module with the name import_arg

		- Input:
			* header_url: a string that defines the url to the module. 
				the path must be separated with / and ends without /.
				Need to prune when importing modules
			* module_url: a string that defines the url to the module. 
				the path must be separated with / and ends without /
			* file_import_mode: FamcyFileImportMode
			* import_arg: arg for specific import mode.
		""" # Default return # Get all dir path # Switch the file import mode.  # Import class instance.  # Prune root directory # Continue if no import lib # I think aliasing is ok here
self
header_url
module_url
file_import_mode
import_arg
exclude
recursive
otherwise