@staticmethod<EOL><INDENT>def _get_classes(package_name, base_class):<DEDENT>
classes = {}<EOL>base_dir = os.getcwd()<EOL>root_module_name = base_dir.split('<STR_LIT:/>')[-<NUM_LIT:1>]<EOL>package_dir = base_dir + '<STR_LIT>' % package_name<EOL>if os.path.isdir(package_dir):<EOL><INDENT>for module_path in os.listdir(package_dir):<EOL><INDENT>if not module_path.endswith('<STR_LIT>'):<EOL><INDENT>continue<EOL><DEDENT>module_name = os.path.splitext(module_path)[<NUM_LIT:0>]<EOL>module_full_name = '<STR_LIT>' % (root_module_name, package_name, module_name)<EOL>__import__(module_full_name)<EOL>work_module = sys.modules[module_full_name]<EOL>for module_item in work_module.__dict__.values():<EOL><INDENT>if type(module_item) is typeand issubclass(module_item, base_class)and module_item is not base_classand hasattr(module_item, '<STR_LIT:name>') and module_item.name:<EOL><INDENT>classes.setdefault(module_item.name, []).append(module_item)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>for work_name, work_modules in classes.items():<EOL><INDENT>if len(work_modules) > <NUM_LIT:1>:<EOL><INDENT>raise DuplicatedNameException('<STR_LIT>' % (<EOL>'<STR_LIT>'.join(map(str, work_modules)),<EOL>work_name<EOL>))<EOL><DEDENT><DEDENT>return tuple([(work_name, work_modules[<NUM_LIT:0>]) for work_name, work_modules in classes.items()])<EOL>
search monits or works classes. Class must have 'name' attribute
:param package_name: 'monits' or 'works'
:param base_class: Monit or Work
:return: tuple of tuples monit/work-name and class