示例#1
0
def _create_class(install_path, doc=None):
    """helper method which creates a single class for the given install path"""
    new_class_name, baseclass_name = install_path.get_class_and_baseclass_names()
    baseclass_install_path = install_path.baseclass_install_path
    #print "baseclass_install_path=%s" % baseclass_install_path
    if baseclass_name == CommandInstallable.__name__ or baseclass_install_path == install_path:
        baseclass = CommandInstallable
    else:
        baseclass = get_or_create_class(baseclass_install_path)
    new_class = _create_class_type(new_class_name,
                                   baseclass,
                                   doc=str(doc) if doc else install_path.get_generic_doc_str(),
                                   init=get_class_init_from_path(install_path))
    set_installation(new_class, CommandInstallation(install_path, host_class_was_created=True))
    if install_path.is_entity and not install_path.full.startswith('_'):
        decorate_api_class(new_class)
    return new_class
示例#2
0
def _create_class(install_path, doc=None):
    """helper method which creates a single class for the given install path"""
    new_class_name, baseclass_name = install_path.get_class_and_baseclass_names(
    )
    baseclass_install_path = install_path.baseclass_install_path
    #print "baseclass_install_path=%s" % baseclass_install_path
    if baseclass_name == CommandInstallable.__name__ or baseclass_install_path == install_path:
        baseclass = CommandInstallable
    else:
        baseclass = get_or_create_class(baseclass_install_path)
    new_class = _create_class_type(
        new_class_name,
        baseclass,
        doc=str(doc) if doc else install_path.get_generic_doc_str(),
        init=get_class_init_from_path(install_path))
    set_installation(
        new_class,
        CommandInstallation(install_path, host_class_was_created=True))
    if install_path.is_entity and not install_path.full.startswith('_'):
        decorate_api_class(new_class)
    return new_class
示例#3
0
文件: metaprog.py 项目: rainiraj/atk
def create_entity_class(command_def):
    if not command_def.is_constructor:
        raise RuntimeError("Internal Error: algo was not a constructor command_def")
    new_class = _create_class(command_def.install_path, command_def.doc)
    decorate_api_class(new_class)
示例#4
0
文件: metaprog.py 项目: xoltar/atk
def create_entity_class(command_def):
    if not command_def.is_constructor:
        raise RuntimeError(
            "Internal Error: algo was not a constructor command_def")
    new_class = _create_class(command_def.install_path, command_def.doc)
    decorate_api_class(new_class)