Ejemplo n.º 1
0
def test_unused_input():
    this_path = current_path / "cwl" / "misc" / "wf-unused-input.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)
    assert len(doc.problems) == 1
    namespace_problem = next(p for p in doc.problems
                             if p.range.start.line == 4)
    assert namespace_problem.message.startswith("Unused input")
Ejemplo n.º 2
0
def test_implicit_inputs():
    this_path = current_path / "cwl" / "misc" / "wf-when-input.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)
    assert len(doc.problems) == 0

    cmpl = doc.completion(Position(12, 8))
    assert "new_input" in [c.label for c in cmpl]
Ejemplo n.º 3
0
def test_docs_on_hover():
    this_path = current_path / "cwl" / "misc" / "wf-when-input.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    hov = doc.hover(Position(10, 6))
    assert "Sibling" in hov.contents.value
    assert hov.contents.kind == "markdown"
Ejemplo n.º 4
0
def test_definition():
    doc = load(doc_path=path, type_dicts=type_dicts)
    linked_uri = pathlib.Path(current_path / "cwl" / "ebi" / "utils" /
                              "concatenate.cwl")
    doc_def_loc = doc.definition(loc=Position(50, 20))
    assert isinstance(doc_def_loc, Location)
    assert doc_def_loc.uri == linked_uri.as_uri()
Ejemplo n.º 5
0
def test_missing_name_space():
    this_path = current_path / "cwl" / "misc" / "cl-missing-namespace.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)
    assert len(doc.problems) == 1
    namespace_problem = next(p for p in doc.problems
                             if p.range.start.line == 15)
    assert namespace_problem.message.startswith("Expecting one of")
Ejemplo n.º 6
0
def test_mass_wf_load():
    type_dicts = load_type_dicts()
    for wf_dir in [
            "ebi/workflows", "mgi/subworkflows", "mgi/pipelines", "cwl-v1.2"
    ]:
        path = current_path / "cwl" / wf_dir
        for fname in path.glob("*.cwl"):
            _ = load(doc_path=fname, type_dicts=type_dicts)
Ejemplo n.º 7
0
def test_plain_text_include():
    this_path = current_path / "cwl" / "misc" / "cl-include-text.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    assert len(doc.problems) == 0

    hov = doc.hover(Position(9, 21))
    assert "We hold" in hov.contents.value
Ejemplo n.º 8
0
def test_requirements_completion():
    this_path = current_path / "cwl" / "misc" / "cl-hints-dict.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    cmpl = doc.completion(Position(12, 8))
    assert "dockerLoad" in [c.label for c in cmpl]

    this_path = current_path / "cwl" / "misc" / "cl-hints-list.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    cmpl = doc.completion(Position(12, 8))
    assert "dockerImport" in [c.label for c in cmpl]

    this_path = current_path / "cwl" / "misc" / "cl-hints-dict-start.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    cmpl = doc.completion(Position(12, 5))
    assert "dockerLoad" in [c.label for c in cmpl]
Ejemplo n.º 9
0
def test_hints_imports():
    this_path = current_path / "cwl" / "misc" / "cl-hints-import.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    assert len(doc.problems) == 1

    missing_error = next(p for p in doc.problems if p.range.start.line == 4)
    assert missing_error.message.startswith("Missing document:")

    cmpl = doc.completion(Position(4, 20))
    assert "cl-schemadef-import.cwl" in [c.label for c in cmpl]
Ejemplo n.º 10
0
def test_remote_files():
    this_path = current_path / "cwl" / "misc" / "wf-remote-steps.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    # Refers to an earlier commit
    hov = doc.hover(Position(13, 32))
    assert "class:" in hov.contents.value

    # Non existent commit
    hov = doc.hover(Position(19, 32))
    assert hov.contents.value == "```\n\n```"
Ejemplo n.º 11
0
def test_basic_JS():
    path = current_path / "cwl" / "misc" / "clt1.cwl"
    doc = load(doc_path=path, type_dicts=type_dicts)

    hov = doc.hover(loc=Position(7, 25))
    assert isinstance(hov.contents.value, str)
    assert hov.contents.value.startswith("```\nA_")

    hov = doc.hover(loc=Position(10, 19))
    assert isinstance(hov.contents.value, str)
    assert "outdirSize" in hov.contents.value
Ejemplo n.º 12
0
def test_schemadef_include():
    this_path = current_path / "cwl" / "misc" / "cl-schemadef-include.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    assert len(doc.problems) == 2

    syntax_error = next(p for p in doc.problems if p.range.start.line == 12)
    assert syntax_error.message == "Expecting an $import"

    type_error = next(p for p in doc.problems if p.range.start.line == 4)
    assert type_error.message.startswith("Expecting one of")
Ejemplo n.º 13
0
def test_ebi_wf_cmsearch_multimodel():
    path = current_path / "cwl" / "ebi" / "workflows" / "cmsearch-multimodel-wf.cwl"
    doc = load(doc_path=path, type_dicts=load_type_dicts())

    step_symbols = next((symb for symb in doc.symbols if symb.name == "steps"),
                        None)
    assert isinstance(step_symbols.children, list)

    cmsearch_symbol = next(
        (symb for symb in step_symbols.children if symb.name == "cmsearch"),
        None)
    assert cmsearch_symbol.range.start.line == 33
Ejemplo n.º 14
0
def test_port_completer():
    this_path = current_path / "cwl" / "misc" / "wf-port-completer.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    cmpl = doc.completion(Position(10, 14))  # Not a list
    assert "in1" in [c.label for c in cmpl]

    cmpl = doc.completion(Position(23, 11))  # Is a list
    assert "out1" in [c.label for c in cmpl]

    cmpl = doc.completion(Position(24, 9))  # Is a list
    assert "in1" in [c.label for c in cmpl]
Ejemplo n.º 15
0
def test_v1_1_runtime():

    # No exitcode in runtime in v1.0 ever
    path = current_path / "cwl" / "misc" / "clt1.cwl"
    doc = load(doc_path=path, type_dicts=type_dicts)

    hov = doc.hover(loc=Position(10, 19))
    assert "exitCode" not in hov.contents.value

    hov = doc.hover(loc=Position(17, 33))
    assert "exitCode" not in hov.contents.value

    # Exitcode in runtime in v1.1 when in output
    path = current_path / "cwl" / "misc" / "clt2.cwl"
    doc = load(doc_path=path, type_dicts=type_dicts)

    hov = doc.hover(loc=Position(24, 20))
    assert "exitCode" not in hov.contents.value

    hov = doc.hover(loc=Position(31, 34))
    assert "exitCode" in hov.contents.value
Ejemplo n.º 16
0
Archivo: init.py Proyecto: znavy/zkdash
 def __init__(self):
     routes = load('handler')
     settings = {
         'static_path': os.path.join(os.path.dirname(__file__), "static"),
         'template_path': os.path.join(os.path.dirname(__file__), "tpl"),
         'xsrf_cookies': True,
         'cookie_secret': 'tokyo',
         'site_title': 'zkdash',
         'ui_modules': uimodule,
         'ui_methods': uimethods,
         'debug': OPTIONS.debug,
     }
     tornado.web.Application.__init__(self, routes, **settings)
Ejemplo n.º 17
0
 def __init__(self):
     routes = load('handler')
     settings = {
         'static_path': os.path.join(os.path.dirname(__file__), "static"),
         'template_path': os.path.join(os.path.dirname(__file__), "tpl"),
         'xsrf_cookies': True,
         'cookie_secret': 'tokyo',
         'site_title': 'zkdash',
         'ui_modules': uimodule,
         'ui_methods': uimethods,
         'debug': OPTIONS.debug,
     }
     tornado.web.Application.__init__(self, routes, **settings)
Ejemplo n.º 18
0
def test_schemadef_import():
    this_path = current_path / "cwl" / "misc" / "cl-schemadef-import.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)

    assert len(doc.problems) == 0

    cmpl = doc.completion(Position(12, 21))
    assert "cl-schemadef-import.cwl" in [c.label for c in cmpl]
    # The completer should look for all files in the current directory

    cmpl = doc.completion(Position(4, 11))
    assert "./paired_end_record.yml#paired_end_options" in [
        c.label for c in cmpl
    ]
Ejemplo n.º 19
0
	def __enter__(self):
		if self.dummy:
			return self

		self.lib = lib.load(os.getcwd() + "/librpicnc/build/cnc.so")
		
		c_axesinfo = (lib.AxisInfo*len(self.config["axes"]))()
		for i, (axis, ac) in enumerate(zip(self.config["axes"], self.cache["axes"])):
			c_axesinfo[i] = lib.AxisInfo(pins=axis["pins"], pos=ac["pos"], len_=ac["len"])

		r = self.lib.cnc_init(len(c_axesinfo), c_axesinfo)
		if r != 0:
			raise CNCException("cnc_init error")

		return self
Ejemplo n.º 20
0
def test_connections():
    path = current_path / "cwl" / "misc" / "wf-port-completer.cwl"
    doc = load(doc_path=path, type_dicts=load_type_dicts())

    assert len(doc.problems) == 0
Ejemplo n.º 21
0
def test_requirement_completion():
    doc = load(doc_path=path, type_dicts=type_dicts)
    cmpl = doc.completion(Position(8, 16))
    assert "InlineJavascriptRequirement" in [c.label for c in cmpl]
Ejemplo n.º 22
0
def test_troublesome_tool_load():
    type_dicts = load_type_dicts()
    path = current_path / "cwl" / "misc"
    for fname in path.glob("*.cwl"):
        _ = load(doc_path=fname, type_dicts=type_dicts)
Ejemplo n.º 23
0
#!-*-coding:utf-8-*-
import lib
import sys
import numpy as np
"""
3 Multiple Regression
"""
lib.title("#############3 Multiple Regression#############")
#####データを読み取る#####
CEOSAL2_dataset = lib.load(filename="CEOSAL2.csv")
explanatories = ["const", "lsales", "lmktval"]
explained = ["lsalary"]
"""
3-1の解答
"""
lib.chaper("大問3.1の回答")
X = lib.df2mat(df=CEOSAL2_dataset, columns=explanatories)
Y = lib.df2mat(df=CEOSAL2_dataset, columns=explained)
b = lib.reg(X=X, Y=Y)
lib.add_suffix(coefs=b, labels=explanatories)
print("\n")
"""
3-2の解答
"""
lib.chaper("大問3.2の回答")
CEOSAL2_dataset = lib.load(filename="CEOSAL2.csv")
explanatories = ["const", "lsales", "lmktval", "profits"]
explained = ["lsalary"]

X = lib.df2mat(df=CEOSAL2_dataset, columns=explanatories)
Y = lib.df2mat(df=CEOSAL2_dataset, columns=explained)
Ejemplo n.º 24
0
#!-*-coding:utf-8-*-
import lib
import sys
import numpy as np
"""
8 Instrumental Variable And 2SLS
"""
lib.title("#############8 Instrumental Variable And 2SLS#############")

FERTIL2_dataset = lib.load( filename="FERTIL2.csv" )
FERTIL2_dataset = lib.cross_var( df=FERTIL2_dataset , var1="age" , var2="age" )

"""
8-1の解答
"""
lib.chaper("<8.1の解答>")
#####説明変数を定義#####
explanatories = ["const","educ","age","age*age"]
explained = ["children"]

X = lib.df2mat( df=FERTIL2_dataset , columns=explanatories )
Y = lib.df2mat( df=FERTIL2_dataset , columns=explained )
b = lib.reg( X=X , Y=Y )
lib.add_suffix( coefs=b , labels=explanatories )
const , educ , age , age_aqure = b[0] , b[1] , b[2] , b[3]
y = educ * 100

print( y )
print( "9人減る" )

print("\n")
Ejemplo n.º 25
0
def test_mass_tool_load():
    type_dicts = load_type_dicts()
    for wf_dir in ["ebi/tools", "mgi/tools"]:
        path = current_path / "cwl" / wf_dir
        for fname in path.glob("*.cwl"):
            _ = load(doc_path=fname, type_dicts=type_dicts)
Ejemplo n.º 26
0
import lib
import ROOT

lib.load()
crootprob3pp = ROOT.crootprob3pp
Probability = crootprob3pp.Probability


class Flavour:
    NU_E = 1
    NU_MU = 2
    NU_TAU = 3


class CP:
    MATTER = 1
    ANTI_MATTER = -1
Ejemplo n.º 27
0
def test_step_input_completion():
    doc = load(doc_path=path, type_dicts=type_dicts)
    cmpl = doc.completion(Position(37, 38))
    assert "covariance_models" in [c.label for c in cmpl]
Ejemplo n.º 28
0
#!-*-coding:utf-8-*-
import lib
import sys
import numpy as np
"""
1 Matrix Calculus
"""
lib.title("#############1 Matrix Calculus#############")
#####データを読み取る#####
artifical_dataset = lib.load(filename="artificial.csv")
explanatories = ["x1", "x2"]
explained = ["y"]

#####各変数を定義#####
X = lib.df2mat(df=artifical_dataset, columns=explanatories)
Y = lib.df2mat(df=artifical_dataset, columns=explained)
b = lib.reg(X=X, Y=Y)
"""
1-1の解答
"""
lib.chaper("<大問1.1の回答>")

#####解答#####
lib.add_suffix(b)
print("\n")
"""
1-2の解答
"""
lib.chaper("<大問1.2の回答>")

#####各変数を定義#####
Ejemplo n.º 29
0
def test_invalid_input():
    this_path = current_path / "cwl" / "misc" / "wf-invalid-input.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)
    assert len(doc.problems) == 1
Ejemplo n.º 30
0
def main(argv):
    # pylint: disable=W0612
    try:
        argv = FLAGS(argv)  # parse flags
    except gflags.FlagsError, e:
        print '%s\\nUsage: %s ARGS\\n%s' % (e, sys.argv[0], FLAGS)
        sys.exit(1)

    gl.set_runtime_config('GRAPHLAB_DEFAULT_NUM_GRAPH_LAMBDA_WORKERS', 16)
    for flag_name in sorted(FLAGS.RegisteredFlags()):
        if flag_name not in ["?", "help", "helpshort", "helpxml"]:
            fl = FLAGS.FlagDict()[flag_name]
            with open('output/main.out', 'a') as f:
                f.write(
                    "# " + fl.help + " (" + flag_name + "): " + str(fl.value) + '\n')

    X_train, X_test = load(FLAGS.dataset)
    g = get_graph(X_train, FLAGS.rank)

    rmse_train, rmse_test, L, R, wu, wm, bu, bm = \
        sgd_gl_edge(g, X_train, X_test,
                    FLAGS.lamb, FLAGS.rank, FLAGS.eta, Niter=FLAGS.maxit,
                    unified=FLAGS.unified, lambduh_w=FLAGS.lamb_w, output="main")

    print 'rmse_train', rmse_train
    print 'rmse_test', rmse_test

if __name__ == '__main__':
    main(sys.argv)
    # overnightRun()
Ejemplo n.º 31
0
#!-*-coding:utf-8-*-
import lib
import sys
import numpy as np
"""
6 Inference2
"""
lib.title("#############6 Inference2#############")
#####データを読み取る#####
HPRICE_dataset = lib.load(filename="HPRICE1.csv")
explanatories = ["const", "sqrft", "bdrms"]
explained = ["lprice"]

#####各変数を定義#####
X = lib.df2mat(df=HPRICE_dataset, columns=explanatories)
Y = lib.df2mat(df=HPRICE_dataset, columns=explained)
b = lib.reg(X=X, Y=Y)
"""
6-1の解答
"""
lib.chaper("<6.1の解答>")
#####解答#####
lib.add_suffix(b, labels=explanatories)
print("\n")
"""
6-2の解答
"""
lib.chaper("<6.2の解答>")
#####回帰係数の取得#####
const, sqrft, bdrms = b[0], b[1], b[2]
y_bdrms = bdrms
Ejemplo n.º 32
0
def test_requirement_sub_completion():
    this_path = current_path / "cwl" / "ebi" / "workflows" / "InterProScan-v5-chunked-wf.cwl"
    doc = load(doc_path=this_path, type_dicts=type_dicts)
    cmpl = doc.completion(Position(8, 10))
    assert "InlineJavascriptRequirement" in [c.label for c in cmpl]