def __new__(meta, cls_name, bases, attrs):
entries = {<EOL>'<STR_LIT:name>': '<STR_LIT>',<EOL>'<STR_LIT>': [],<EOL>'<STR_LIT>': "<STR_LIT>",<EOL>}<EOL>for plugin in (pl for pl in PLUGINS if not pl.startswith('<STR_LIT:_>')):<EOL><INDENT>try:<EOL><INDENT>myplugin = __import__(<EOL>'<STR_LIT>' + plugin,<EOL>globals(),<EOL>locals(),<EOL>['<STR_LIT>'],<EOL>)<EOL><DEDENT>except ImportError:<EOL><INDENT>logger.error('<STR_LIT>', plugin)<EOL>continue<EOL><DEDENT>for http_method, funcs in six.iteritems(myplugin.DEFS):<EOL><INDENT>methods = MetaForeman.convert_plugin_def(http_method, funcs)<EOL>entries['<STR_LIT>'].extend(methods)<EOL><DEDENT><DEDENT>def _init(self, foreman):<EOL><INDENT>super(self.__class__, self).__init__(foreman)<EOL>for name, value in six.iteritems(self.__class__.__dict__):<EOL><INDENT>if isinstance(value, types.FunctionType) and name[<NUM_LIT:0>] != '<STR_LIT:_>':<EOL><INDENT>logger.debug(<EOL>'<STR_LIT>',<EOL>name,<EOL>)<EOL>setattr(self._foreman, name, getattr(self, name))<EOL><DEDENT><DEDENT><DEDENT>resource_data, foreigns = parse_resource_definition('<STR_LIT>', entries)<EOL>for mname, method_dict in six.iteritems(foreigns):<EOL><INDENT>resource_data[mname] = tuple(method_dict.values())[<NUM_LIT:0>]<EOL>resource_data['<STR_LIT>'].add(mname)<EOL><DEDENT>logger.info(resource_data)<EOL>plugins_cls = ResourceMeta.__new__(<EOL>ResourceMeta,<EOL>'<STR_LIT>',<EOL>(Resource,),<EOL>resource_data,<EOL>)<EOL>plugins_cls.__init__ = _init<EOL>attrs['<STR_LIT>'] = plugins_cls<EOL>return type.__new__(meta, cls_name, bases, attrs)<EOL>
This class is called when defining the Foreman class, and populates it
with the defined methods.
:param meta: This metaclass
:param cls_name: Name of the class that is going to be created
:param bases: Bases for the new class
:param attrs: Attributes of the new class