def get_heuristics(): """ Scan all python modules in the "heuristics" directory for classes ending with "Heuristic". """ heuristics = [] src_dir = os.path.dirname(os.path.abspath(__file__)) heuristics_dir = os.path.abspath(os.path.join(src_dir, 'heuristics')) for filename in os.listdir(heuristics_dir): if not filename.endswith('.py'): continue module = tools.import_python_file(os.path.join(heuristics_dir, filename)) heuristics.extend([getattr(module, cls) for cls in dir(module) if cls.endswith('Heuristic') and cls != 'Heuristic' and not cls.startswith('_')]) return heuristics
def get_heuristics(): """ Scan all python modules in the "heuristics" directory for classes ending with "Heuristic". """ heuristics = [] src_dir = os.path.dirname(os.path.abspath(__file__)) heuristics_dir = os.path.abspath(os.path.join(src_dir, 'heuristics')) for filename in os.listdir(heuristics_dir): if not filename.endswith('.py'): continue module = tools.import_python_file(os.path.join(heuristics_dir, filename)) heuristics.extend([getattr(module, cls) for cls in dir(module) if cls.endswith('Heuristic') and cls != 'Heuristic' and not cls.startswith('_')]) return heuristics