def download_and_install(self): logging.info('Will download buildout from %s' % BUILDOUT_URL) wget = local['wget'] cmd = wget[BUILDOUT_URL] cmd() python('bootstrap.py') os.remove('bootstrap.py')
def test(model, inf, keyin, keyout): test_path = get_xml_key_pair(inf, keyin) tempdir = tempfile.mkdtemp(prefix="ctx2vec") result_path = pjoin(tempdir, "results") with local.cwd("systems/context2vec"), local.env( PIPENV_IGNORE_VIRTUALENVS="1"): pipenv_python( "context2vec/eval/wsd/test.py", test_path, "model.params", model, result_path, ) python(__file__, "context2vec-key-to-unified", result_path, keyout)
def inner(paths, guess_fn): args = [ "lesk_pp.py", mean, paths["unified"], cwd_relpath(guess_fn), "--include-wfs", "--score-by", score_by, ] if do_expand: args.append("--expand") if exclude_cand: args.append("--exclude-cand") setup_paths() python(*args)
def full_wsd_main(modelin, trainin, keyin, testin, testkeyin, resultout): train_path = get_xml_key_pair(trainin, keyin) test_path = get_xml_key_pair(testin, testkeyin) tempdir = tempfile.mkdtemp(prefix="ctx2vec") result_path = pjoin(tempdir, "results") with local.cwd("systems/context2vec"), local.env( PIPENV_IGNORE_VIRTUALENVS="1"): pipenv_python( "context2vec/eval/wsd/wsd_main.py", train_path, test_path, result_path, modelin, "1", ) python(__file__, "context2vec-key-to-unified", result_path, resultout)
def test_run_code_locally(ctype, template_dir, cookies): project = cookies.bake(template=str(template_dir.absolute()), extra_context={ 'container_name': 'example', 'container_type': ctype }) cwd = os.getcwd() os.chdir(str(project.project)) # run script src/[submission|evaluation].py try: python(Path('src') / '{}.py'.format(ctype)) except plumbum.ProcessExecutionError as e: pytest.fail(e) finally: os.chdir(cwd) # test output out = project.project.join('data', 'output') assert os.path.isfile(str(out))
def run(paths, guess_fn): all_args = (["lesk.py", variety] + list(args) + [paths["suptag"], cwd_relpath(guess_fn)]) setup_paths() python(*all_args)
def run(paths, guess_fn): all_args = (["baselines.py"] + list(args) + [paths["unified"], cwd_relpath(guess_fn)]) setup_paths() python(*all_args)
def pipenv_python(*args): if os.environ.get("NO_CTX2VEC_PIPENV"): python(*args) else: pipenv("run", "python", *args)
def setuppy_version(project_name): return python(f"{project_name}/setup.py", "--version").strip()