示例#1
0
文件: project.py 项目: ubaniak/emel
def main(argv):
    '''
    '''
    if not argv:
        check_project_status(True)
    else:
        parser = setup_arg_parser()
        options = parser.parse_args(argv)
        if not check_directory_status(True):
            exit()

        if options.new:
            __new_project__(options.new)
        elif options.listProjs:
            __list_projects__(verbose=True)
        elif options.change_project is not None:
            __change_project__(options.change_project)
示例#2
0
def __get_list__():
    the_list = DEFULT
    if check_project_status():
        depFile = create_path([emel_project_path(), DEPENDENCY_FILE])
        if os.path.exists(depFile):
            the_list = []
            with open(depFile, 'r') as f:
                for line in f.readlines():
                    if not line.startswith('#'):
                        line = line.split('#')
                        the_list.append(line[0].strip())
    return the_list
示例#3
0
def __get_emel_file_path__(fileType):
    allowed_types = ['raw','processed','train','tools_']
    if fileType.lower() not in allowed_types: raise TypeError( 'unknown file type {}. Only use {}'.format(fileType, ','.join(allowed_types)) )
    
    config = ConfigObj(EMEL_CONFIG_FILE)
    
    if not check_directory_status(): exit(1)
    if not check_project_status(): exit(1)

    currData = config[Data.SECTION][Data.CURRENT] 
    dataDir = config[Data.SECTION][Data.ALL][currData]
    project = config[Project.SECTION][Project.CURRENT]
    return create_path( [dataDir, project,  fileType] )
示例#4
0
文件: tools.py 项目: ubaniak/emel
def main(argv):
    '''
    '''
    parser = setup_arg_parser()
    options = parser.parse_args(argv)

    if not check_directory_status(True) or not check_project_status(True):
        exit()

    if options.new:
        __create_tool__(options.new[0], options.new[1])
    elif options.show_catagories:
        __get_catagories__()
    elif options.list_tools:
        __list_tools__()
    elif options.edit is not None:
        __edit_tool__(options.edit)
示例#5
0
文件: train.py 项目: ubaniak/emel
def main(argv):
    '''
    '''
    parser = setup_arg_parser()
    if not check_directory_status(True):
        exit()
    if not check_project_status(True):
        exit()
    options = parser.parse_args(argv)

    if options.new:
        __create_train__()
    elif options.run != 'donotuse':
        __run_train__(options.run)
    elif options.edit != 'donotuse':
        __edit_train__(options.edit)
    elif options.list_ != 'donotuse':
        __ls_train__(options.list_)
示例#6
0
def __create_dep_list__(check_first=True):
    if not check_directory_status(True):
        exit()
    if not check_project_status(True):
        exit()
    create = True
    if check_first:
        message = 'Creatint dependency file for project.\n [WARNING] will overrite existing file. Continue?'
        create = yes_no_option(message)

    if create:
        depFile = create_path([emel_project_path(), DEPENDENCY_FILE])
        with open(depFile, 'w') as f:
            f.write('# emel default packages #\n')
            for module in DEFULT:
                f.write(module)
                f.write('\n')
            f.write('# End emel defaults #')