Exemplo n.º 1
0
    def setUp(self):
        remote_dir = '/riseml/workspace/engine/exp/lls-new-data-v3-try1-wp500-adaptive-on-telis-chatbot/expr1-mwer/1pass_recog/chatbot_test_v3-lp0.10-beam16'

        local_dir = base.mkdir('/Users/lls/tmp/run_wer_test')

        remote.download(remote.ali_ssh, remote_dir + '.*', local_dir)

        name = base.path_file_name(remote_dir)
        self.nbest = local_dir + '/' + name + '.nbest'
        self.refer = local_dir + '/' + name + '.refer'
        self.best = local_dir + '/' + name + '.best'
        self.log = local_dir + '/' + name + '.local.log'

        base.GetBest(self.nbest, None, self.best)
Exemplo n.º 2
0
 OpsProject.delete(project.project_uuid)
 if request.POST.get('project_model', None) == "rollback":
     project_content = "回滚项目"
     if project.project_model == 'branch':
         verName = request.POST.get('project_version')
         trueDir = project.project_dir + project.project_env + '/' + request.POST.get(
             'project_version') + '/'
         OpsProject.lpush(project.project_uuid, data="[PULL] Start Rollback branch:%s  vesion: %s" % (
             request.POST.get('project_branch'), request.POST.get('project_version')))
     elif project.project_model == 'tag':
         verName = request.POST.get('project_branch')
         trueDir = project.project_dir + project.project_env + '/' + request.POST.get('project_branch') + '/'
         OpsProject.lpush(project.project_uuid,
                          data="[PULL] Start Rollback tag:%s" % request.POST.get('project_branch'))
     # 创建版本目录
     base.mkdir(dirPath=trueDir)
     OpsProject.lpush(project.project_uuid,
                      data="[PULL] Mkdir version dir: {dir} ".format(dir=trueDir))
     # 创建快捷方式
     softdir = project.project_dir + project.project_name + '/'
     result = base.lns(spath=trueDir, dpath=softdir.rstrip('/'))
     OpsProject.lpush(project.project_uuid,
                      data="[PULL] Make softlink cmd:  ln -s  {sdir} {ddir} info: {info}".format(
                          sdir=trueDir, ddir=softdir, info=result[1]))
     if result[0] > 0: return JsonResponse({'msg': result[1], "code": 500, 'data': []})
     # 获取要排除的文件
     exclude = None
     if project.project_exclude:
         try:
             exclude = ''
             for s in project.project_exclude.split(','):
Exemplo n.º 3
0
ignoreDirs = ['.git', 'bin-debug', '__pycache__', 'bin-release']
ignoreFiles = [
    'test.py', 'createPrj.bat', 'as大全.js', 'readme.md', 'as-api-doc.docx'
]

#
tmpPrjPath = os.getcwd()
prjName = input('请输入新项目名:')
newPrjPath = '..\\' + prjName + '\\'

#
if os.path.exists(newPrjPath):
    print('项目-' + newPrjPath + '-已经存在')
    os._exit(0)
else:
    base.mkdir(newPrjPath)


#
def checkIsIgnore(iLst, name):
    for item in iLst:
        if name.find(item) != -1:
            return True
    return False


#
for path in os.listdir(tmpPrjPath):
    subPath = os.path.join(tmpPrjPath, path)
    subDestPath = os.path.join(newPrjPath, path)
    if os.path.isfile(subPath):
Exemplo n.º 4
0
import os
import unittest
import base

testdata = os.path.join(os.path.dirname(__file__), 'testdata')
outdir = base.mkdir('/Users/lls/tmp/wblibTestOutput')


class BaseTest(unittest.TestCase):
    def setUp(self):
        self.wp_tools_dir = '/Users/lls/tools/subword-nmt'
        self.wp_bpe_codes = testdata + '/trans.bpe.codes'
        self.wp_vocabulary = testdata + '/vocab.wp'

    def test_generate_wp(self):
        self.assertEqual(
            base.generate_wp(self.wp_tools_dir,
                             ['this is a cat', ''],
                             self.wp_bpe_codes,
                             self.wp_vocabulary),
            ['this is a ca@@ t',
             '']
        )

        self.assertEqual(
            base.generate_wp(self.wp_tools_dir,
                             ['', '', ''],
                             self.wp_bpe_codes,
                             self.wp_vocabulary),
            ['', '', '']
        )
Exemplo n.º 5
0
# step 压缩并拷贝 public/carry.js 到包中 ########################################################
filePath = prjPath + '\public\carry.js'
if base.checkHaLet(filePath):
    print("error : carry.js 有 let")
    os._exit(0)
#
os.chdir('node')
os.system('cd')
st = os.system('gulp')
if st != 0:
    print("error : carry.js gulp 失败")
    os._exit(0)
os.chdir('..')
#
shutil.copy(filePath, base.mkdir(dirPath + '\public'))
shutil.copy(filePath.replace('.js', '.min.js'), dirPath + '\public')

# step : 拷贝 css/index.css 到包中 ##################################################
# st = os.system('lessc --clean-css --autoprefix --source-map index.less index.css')
filePath = prjPath + '\css\index.css'
base.addCssVer(filePath, resVer)
shutil.copy(filePath, base.mkdir(dirPath + '\css'))

# step : 拷贝其他引入的文件 ##########################################################
shutil.copy(prjPath + '//public//sarea.js', dirPath + '//public')  #拷贝其他js
shutil.copy(prjPath + '//public//areaData.js', dirPath + '//public')
shutil.copy(prjPath + '//css//sarea.css', dirPath + '//css')  #拷贝其他css
shutil.copy(prjPath + '//public//qrcode.min.js', dirPath + '//public')

# step : 拷贝包到对应git目录上 ########################################################