partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
valid | trun_exit | Triggers when exiting the given testrun | modules/cij/runner.py | def trun_exit(trun):
"""Triggers when exiting the given testrun"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:trun:exit")
rcode = 0
for hook in reversed(trun["hooks"]["exit"]): # EXIT-hooks
rcode = script_run(trun, hook)
if rcode:
break
if trun["conf"]["VERBO... | def trun_exit(trun):
"""Triggers when exiting the given testrun"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:trun:exit")
rcode = 0
for hook in reversed(trun["hooks"]["exit"]): # EXIT-hooks
rcode = script_run(trun, hook)
if rcode:
break
if trun["conf"]["VERBO... | [
"Triggers",
"when",
"exiting",
"the",
"given",
"testrun"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L448-L463 | [
"def",
"trun_exit",
"(",
"trun",
")",
":",
"if",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"VERBOSE\"",
"]",
":",
"cij",
".",
"emph",
"(",
"\"rnr:trun:exit\"",
")",
"rcode",
"=",
"0",
"for",
"hook",
"in",
"reversed",
"(",
"trun",
"[",
"\"hooks\"",
"]",
"[... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | trun_enter | Triggers when entering the given testrun | modules/cij/runner.py | def trun_enter(trun):
"""Triggers when entering the given testrun"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:trun::enter")
trun["stamp"]["begin"] = int(time.time()) # Record start timestamp
rcode = 0
for hook in trun["hooks"]["enter"]: # ENTER-hooks
rcode = script_run(tr... | def trun_enter(trun):
"""Triggers when entering the given testrun"""
if trun["conf"]["VERBOSE"]:
cij.emph("rnr:trun::enter")
trun["stamp"]["begin"] = int(time.time()) # Record start timestamp
rcode = 0
for hook in trun["hooks"]["enter"]: # ENTER-hooks
rcode = script_run(tr... | [
"Triggers",
"when",
"entering",
"the",
"given",
"testrun"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L466-L483 | [
"def",
"trun_enter",
"(",
"trun",
")",
":",
"if",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"VERBOSE\"",
"]",
":",
"cij",
".",
"emph",
"(",
"\"rnr:trun::enter\"",
")",
"trun",
"[",
"\"stamp\"",
"]",
"[",
"\"begin\"",
"]",
"=",
"int",
"(",
"time",
".",
"ti... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | trun_setup | Setup the testrunner data-structure, embedding the parsed environment
variables and command-line arguments and continues with setup for testplans,
testsuites, and testcases | modules/cij/runner.py | def trun_setup(conf):
"""
Setup the testrunner data-structure, embedding the parsed environment
variables and command-line arguments and continues with setup for testplans,
testsuites, and testcases
"""
declr = None
try:
with open(conf["TESTPLAN_FPATH"]) as declr_fd:
dec... | def trun_setup(conf):
"""
Setup the testrunner data-structure, embedding the parsed environment
variables and command-line arguments and continues with setup for testplans,
testsuites, and testcases
"""
declr = None
try:
with open(conf["TESTPLAN_FPATH"]) as declr_fd:
dec... | [
"Setup",
"the",
"testrunner",
"data",
"-",
"structure",
"embedding",
"the",
"parsed",
"environment",
"variables",
"and",
"command",
"-",
"line",
"arguments",
"and",
"continues",
"with",
"setup",
"for",
"testplans",
"testsuites",
"and",
"testcases"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L486-L532 | [
"def",
"trun_setup",
"(",
"conf",
")",
":",
"declr",
"=",
"None",
"try",
":",
"with",
"open",
"(",
"conf",
"[",
"\"TESTPLAN_FPATH\"",
"]",
")",
"as",
"declr_fd",
":",
"declr",
"=",
"yaml",
".",
"safe_load",
"(",
"declr_fd",
")",
"except",
"AttributeError... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | main | CIJ Test Runner main entry point | modules/cij/runner.py | def main(conf):
"""CIJ Test Runner main entry point"""
fpath = yml_fpath(conf["OUTPUT"])
if os.path.exists(fpath): # YAML exists, we exit, it might be RUNNING!
cij.err("main:FAILED { fpath: %r }, exists" % fpath)
return 1
trun = trun_setup(conf) # Construct 'trun' from 'conf'... | def main(conf):
"""CIJ Test Runner main entry point"""
fpath = yml_fpath(conf["OUTPUT"])
if os.path.exists(fpath): # YAML exists, we exit, it might be RUNNING!
cij.err("main:FAILED { fpath: %r }, exists" % fpath)
return 1
trun = trun_setup(conf) # Construct 'trun' from 'conf'... | [
"CIJ",
"Test",
"Runner",
"main",
"entry",
"point"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/runner.py#L535-L594 | [
"def",
"main",
"(",
"conf",
")",
":",
"fpath",
"=",
"yml_fpath",
"(",
"conf",
"[",
"\"OUTPUT\"",
"]",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"fpath",
")",
":",
"# YAML exists, we exit, it might be RUNNING!",
"cij",
".",
"err",
"(",
"\"main:FAILE... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Nvm.get_chunk_meta | Get chunk meta table | deprecated/modules/cij/liblight.py | def get_chunk_meta(self, meta_file):
"""Get chunk meta table"""
chunks = self.envs["CHUNKS"]
if cij.nvme.get_meta(0, chunks * self.envs["CHUNK_META_SIZEOF"], meta_file):
raise RuntimeError("cij.liblight.get_chunk_meta: fail")
chunk_meta = cij.bin.Buffer(types=self.envs["CHUN... | def get_chunk_meta(self, meta_file):
"""Get chunk meta table"""
chunks = self.envs["CHUNKS"]
if cij.nvme.get_meta(0, chunks * self.envs["CHUNK_META_SIZEOF"], meta_file):
raise RuntimeError("cij.liblight.get_chunk_meta: fail")
chunk_meta = cij.bin.Buffer(types=self.envs["CHUN... | [
"Get",
"chunk",
"meta",
"table"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L65-L73 | [
"def",
"get_chunk_meta",
"(",
"self",
",",
"meta_file",
")",
":",
"chunks",
"=",
"self",
".",
"envs",
"[",
"\"CHUNKS\"",
"]",
"if",
"cij",
".",
"nvme",
".",
"get_meta",
"(",
"0",
",",
"chunks",
"*",
"self",
".",
"envs",
"[",
"\"CHUNK_META_SIZEOF\"",
"]... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Nvm.get_chunk_meta_item | Get item of chunk meta table | deprecated/modules/cij/liblight.py | def get_chunk_meta_item(self, chunk_meta, grp, pug, chk):
"""Get item of chunk meta table"""
num_chk = self.envs["NUM_CHK"]
num_pu = self.envs["NUM_PU"]
index = grp * num_pu * num_chk + pug * num_chk + chk
return chunk_meta[index] | def get_chunk_meta_item(self, chunk_meta, grp, pug, chk):
"""Get item of chunk meta table"""
num_chk = self.envs["NUM_CHK"]
num_pu = self.envs["NUM_PU"]
index = grp * num_pu * num_chk + pug * num_chk + chk
return chunk_meta[index] | [
"Get",
"item",
"of",
"chunk",
"meta",
"table"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L75-L80 | [
"def",
"get_chunk_meta_item",
"(",
"self",
",",
"chunk_meta",
",",
"grp",
",",
"pug",
",",
"chk",
")",
":",
"num_chk",
"=",
"self",
".",
"envs",
"[",
"\"NUM_CHK\"",
"]",
"num_pu",
"=",
"self",
".",
"envs",
"[",
"\"NUM_PU\"",
"]",
"index",
"=",
"grp",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Nvm.is_bad_chunk | Check the chunk is offline or not | deprecated/modules/cij/liblight.py | def is_bad_chunk(self, chunk_meta, grp, pug, chk):
"""Check the chunk is offline or not"""
meta = self.get_chunk_meta_item(chunk_meta, grp, pug, chk)
if meta.CS & 0x8 != 0:
return True
return False | def is_bad_chunk(self, chunk_meta, grp, pug, chk):
"""Check the chunk is offline or not"""
meta = self.get_chunk_meta_item(chunk_meta, grp, pug, chk)
if meta.CS & 0x8 != 0:
return True
return False | [
"Check",
"the",
"chunk",
"is",
"offline",
"or",
"not"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L103-L108 | [
"def",
"is_bad_chunk",
"(",
"self",
",",
"chunk_meta",
",",
"grp",
",",
"pug",
",",
"chk",
")",
":",
"meta",
"=",
"self",
".",
"get_chunk_meta_item",
"(",
"chunk_meta",
",",
"grp",
",",
"pug",
",",
"chk",
")",
"if",
"meta",
".",
"CS",
"&",
"0x8",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Nvm.s20_to_gen | S20 unit to generic address | deprecated/modules/cij/liblight.py | def s20_to_gen(self, pugrp, punit, chunk, sectr):
"""S20 unit to generic address"""
cmd = ["nvm_addr s20_to_gen", self.envs["DEV_PATH"],
"%d %d %d %d" % (pugrp, punit, chunk, sectr)]
status, stdout, _ = cij.ssh.command(cmd, shell=True)
if status:
raise RuntimeE... | def s20_to_gen(self, pugrp, punit, chunk, sectr):
"""S20 unit to generic address"""
cmd = ["nvm_addr s20_to_gen", self.envs["DEV_PATH"],
"%d %d %d %d" % (pugrp, punit, chunk, sectr)]
status, stdout, _ = cij.ssh.command(cmd, shell=True)
if status:
raise RuntimeE... | [
"S20",
"unit",
"to",
"generic",
"address"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L110-L118 | [
"def",
"s20_to_gen",
"(",
"self",
",",
"pugrp",
",",
"punit",
",",
"chunk",
",",
"sectr",
")",
":",
"cmd",
"=",
"[",
"\"nvm_addr s20_to_gen\"",
",",
"self",
".",
"envs",
"[",
"\"DEV_PATH\"",
"]",
",",
"\"%d %d %d %d\"",
"%",
"(",
"pugrp",
",",
"punit",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Nvm.gen_to_dev | Generic address to device address | deprecated/modules/cij/liblight.py | def gen_to_dev(self, address):
"""Generic address to device address"""
cmd = ["nvm_addr gen2dev", self.envs["DEV_PATH"], "0x{:x}".format(address)]
status, stdout, _ = cij.ssh.command(cmd, shell=True)
if status:
raise RuntimeError("cij.liblight.gen_to_dev: cmd fail")
... | def gen_to_dev(self, address):
"""Generic address to device address"""
cmd = ["nvm_addr gen2dev", self.envs["DEV_PATH"], "0x{:x}".format(address)]
status, stdout, _ = cij.ssh.command(cmd, shell=True)
if status:
raise RuntimeError("cij.liblight.gen_to_dev: cmd fail")
... | [
"Generic",
"address",
"to",
"device",
"address"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L120-L127 | [
"def",
"gen_to_dev",
"(",
"self",
",",
"address",
")",
":",
"cmd",
"=",
"[",
"\"nvm_addr gen2dev\"",
",",
"self",
".",
"envs",
"[",
"\"DEV_PATH\"",
"]",
",",
"\"0x{:x}\"",
".",
"format",
"(",
"address",
")",
"]",
"status",
",",
"stdout",
",",
"_",
"=",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Nvm.vblk_write | nvm_vblk write | deprecated/modules/cij/liblight.py | def vblk_write(self, address, meta=False):
"""nvm_vblk write"""
cmd = list()
if meta:
cmd.append("NVM_CLI_META_MODE=1")
cmd += ["nvm_vblk write", self.envs["DEV_PATH"], "0x%x" % address]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status | def vblk_write(self, address, meta=False):
"""nvm_vblk write"""
cmd = list()
if meta:
cmd.append("NVM_CLI_META_MODE=1")
cmd += ["nvm_vblk write", self.envs["DEV_PATH"], "0x%x" % address]
status, _, _ = cij.ssh.command(cmd, shell=True)
return status | [
"nvm_vblk",
"write"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L135-L142 | [
"def",
"vblk_write",
"(",
"self",
",",
"address",
",",
"meta",
"=",
"False",
")",
":",
"cmd",
"=",
"list",
"(",
")",
"if",
"meta",
":",
"cmd",
".",
"append",
"(",
"\"NVM_CLI_META_MODE=1\"",
")",
"cmd",
"+=",
"[",
"\"nvm_vblk write\"",
",",
"self",
".",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Nvm.vector_read | nvm_cmd read | deprecated/modules/cij/liblight.py | def vector_read(self, address_list, file_name=None):
"""nvm_cmd read"""
address = ["0x{:x}".format(i) for i in address_list]
cmd = ["nvm_cmd read", self.envs["DEV_PATH"], " ".join(address)]
if file_name:
cmd += ["-o {}".format(file_name)]
status, _, _ = cij.ssh.comman... | def vector_read(self, address_list, file_name=None):
"""nvm_cmd read"""
address = ["0x{:x}".format(i) for i in address_list]
cmd = ["nvm_cmd read", self.envs["DEV_PATH"], " ".join(address)]
if file_name:
cmd += ["-o {}".format(file_name)]
status, _, _ = cij.ssh.comman... | [
"nvm_cmd",
"read"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L168-L175 | [
"def",
"vector_read",
"(",
"self",
",",
"address_list",
",",
"file_name",
"=",
"None",
")",
":",
"address",
"=",
"[",
"\"0x{:x}\"",
".",
"format",
"(",
"i",
")",
"for",
"i",
"in",
"address_list",
"]",
"cmd",
"=",
"[",
"\"nvm_cmd read\"",
",",
"self",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Nvm.scalar_write | nvme write | deprecated/modules/cij/liblight.py | def scalar_write(self, address, block_count, data_file, meta_file):
"""nvme write"""
cmd = ["nvme", "write", self.envs["DEV_PATH"], "-s 0x{:x}".format(address),
"-c {}".format(block_count-1), "-d {}".format(data_file), "-M {}".format(meta_file),
"-z 0x{:x}".format(block_cou... | def scalar_write(self, address, block_count, data_file, meta_file):
"""nvme write"""
cmd = ["nvme", "write", self.envs["DEV_PATH"], "-s 0x{:x}".format(address),
"-c {}".format(block_count-1), "-d {}".format(data_file), "-M {}".format(meta_file),
"-z 0x{:x}".format(block_cou... | [
"nvme",
"write"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/liblight.py#L177-L184 | [
"def",
"scalar_write",
"(",
"self",
",",
"address",
",",
"block_count",
",",
"data_file",
",",
"meta_file",
")",
":",
"cmd",
"=",
"[",
"\"nvme\"",
",",
"\"write\"",
",",
"self",
".",
"envs",
"[",
"\"DEV_PATH\"",
"]",
",",
"\"-s 0x{:x}\"",
".",
"format",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Job.__run | Run DMESG job | modules/cij/dmesg.py | def __run(self, shell=True, echo=True):
"""Run DMESG job"""
if env():
return 1
cij.emph("cij.dmesg.start: shell: %r, cmd: %r" % (shell, self.__prefix + self.__suffix))
return cij.ssh.command(self.__prefix, shell, echo, self.__suffix) | def __run(self, shell=True, echo=True):
"""Run DMESG job"""
if env():
return 1
cij.emph("cij.dmesg.start: shell: %r, cmd: %r" % (shell, self.__prefix + self.__suffix))
return cij.ssh.command(self.__prefix, shell, echo, self.__suffix) | [
"Run",
"DMESG",
"job"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/dmesg.py#L28-L36 | [
"def",
"__run",
"(",
"self",
",",
"shell",
"=",
"True",
",",
"echo",
"=",
"True",
")",
":",
"if",
"env",
"(",
")",
":",
"return",
"1",
"cij",
".",
"emph",
"(",
"\"cij.dmesg.start: shell: %r, cmd: %r\"",
"%",
"(",
"shell",
",",
"self",
".",
"__prefix",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Job.start | Start DMESG job in thread | modules/cij/dmesg.py | def start(self):
"""Start DMESG job in thread"""
self.__thread = Thread(target=self.__run, args=(True, False))
self.__thread.setDaemon(True)
self.__thread.start() | def start(self):
"""Start DMESG job in thread"""
self.__thread = Thread(target=self.__run, args=(True, False))
self.__thread.setDaemon(True)
self.__thread.start() | [
"Start",
"DMESG",
"job",
"in",
"thread"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/dmesg.py#L38-L43 | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"__thread",
"=",
"Thread",
"(",
"target",
"=",
"self",
".",
"__run",
",",
"args",
"=",
"(",
"True",
",",
"False",
")",
")",
"self",
".",
"__thread",
".",
"setDaemon",
"(",
"True",
")",
"self",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Job.terminate | Terminate DMESG job | modules/cij/dmesg.py | def terminate(self):
"""Terminate DMESG job"""
if self.__thread:
cmd = ["who am i"]
status, output, _ = cij.util.execute(cmd, shell=True, echo=True)
if status:
cij.warn("cij.dmesg.terminate: who am i failed")
return 1
tty ... | def terminate(self):
"""Terminate DMESG job"""
if self.__thread:
cmd = ["who am i"]
status, output, _ = cij.util.execute(cmd, shell=True, echo=True)
if status:
cij.warn("cij.dmesg.terminate: who am i failed")
return 1
tty ... | [
"Terminate",
"DMESG",
"job"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/dmesg.py#L45-L66 | [
"def",
"terminate",
"(",
"self",
")",
":",
"if",
"self",
".",
"__thread",
":",
"cmd",
"=",
"[",
"\"who am i\"",
"]",
"status",
",",
"output",
",",
"_",
"=",
"cij",
".",
"util",
".",
"execute",
"(",
"cmd",
",",
"shell",
"=",
"True",
",",
"echo",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | generate_rt_pic | generate rater pic | modules/cij/xlsx.py | def generate_rt_pic(process_data, para_meter, scale):
""" generate rater pic"""
pic_path = para_meter['filename'] + '.png'
plt.figure(figsize=(5.6 * scale, 3.2 * scale))
for key in process_data.keys():
plt.plot(process_data[key][:, 0], process_data[key][:, 1], label=str(key))
plt.title... | def generate_rt_pic(process_data, para_meter, scale):
""" generate rater pic"""
pic_path = para_meter['filename'] + '.png'
plt.figure(figsize=(5.6 * scale, 3.2 * scale))
for key in process_data.keys():
plt.plot(process_data[key][:, 0], process_data[key][:, 1], label=str(key))
plt.title... | [
"generate",
"rater",
"pic"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L288-L299 | [
"def",
"generate_rt_pic",
"(",
"process_data",
",",
"para_meter",
",",
"scale",
")",
":",
"pic_path",
"=",
"para_meter",
"[",
"'filename'",
"]",
"+",
"'.png'",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"5.6",
"*",
"scale",
",",
"3.2",
"*",
"scale",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | generate_steady_rt_pic | generate rate steady | modules/cij/xlsx.py | def generate_steady_rt_pic(process_data, para_meter, scale, steady_time):
""" generate rate steady"""
pic_path_steady = para_meter['filename'] + '_steady.png'
plt.figure(figsize=(4 * scale, 2.5 * scale))
for key in process_data.keys():
if len(process_data[key]) < steady_time:
s... | def generate_steady_rt_pic(process_data, para_meter, scale, steady_time):
""" generate rate steady"""
pic_path_steady = para_meter['filename'] + '_steady.png'
plt.figure(figsize=(4 * scale, 2.5 * scale))
for key in process_data.keys():
if len(process_data[key]) < steady_time:
s... | [
"generate",
"rate",
"steady"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L302-L328 | [
"def",
"generate_steady_rt_pic",
"(",
"process_data",
",",
"para_meter",
",",
"scale",
",",
"steady_time",
")",
":",
"pic_path_steady",
"=",
"para_meter",
"[",
"'filename'",
"]",
"+",
"'_steady.png'",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"4",
"*",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | process_rt_data | process data | modules/cij/xlsx.py | def process_rt_data(source_data, is_bw=False):
""" process data"""
print("source_data length:", len(source_data))
filter_data = {}
for index in range(2):
filter_mask = source_data[:, 2] == index
if np.any(filter_mask):
filter_data[index] = sum_data(round_data(sourc... | def process_rt_data(source_data, is_bw=False):
""" process data"""
print("source_data length:", len(source_data))
filter_data = {}
for index in range(2):
filter_mask = source_data[:, 2] == index
if np.any(filter_mask):
filter_data[index] = sum_data(round_data(sourc... | [
"process",
"data"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L331-L341 | [
"def",
"process_rt_data",
"(",
"source_data",
",",
"is_bw",
"=",
"False",
")",
":",
"print",
"(",
"\"source_data length:\"",
",",
"len",
"(",
"source_data",
")",
")",
"filter_data",
"=",
"{",
"}",
"for",
"index",
"in",
"range",
"(",
"2",
")",
":",
"filte... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | sum_data | caculate sum | modules/cij/xlsx.py | def sum_data(filter_data, is_bw):
""" caculate sum"""
for index in range(len(filter_data) - 1):
if filter_data[index][0] > filter_data[index + 1][0]:
max_index = index + 1
break
else:
max_index = len(filter_data)
print("max_index: ", max_index + 1)
nu... | def sum_data(filter_data, is_bw):
""" caculate sum"""
for index in range(len(filter_data) - 1):
if filter_data[index][0] > filter_data[index + 1][0]:
max_index = index + 1
break
else:
max_index = len(filter_data)
print("max_index: ", max_index + 1)
nu... | [
"caculate",
"sum"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L344-L371 | [
"def",
"sum_data",
"(",
"filter_data",
",",
"is_bw",
")",
":",
"for",
"index",
"in",
"range",
"(",
"len",
"(",
"filter_data",
")",
"-",
"1",
")",
":",
"if",
"filter_data",
"[",
"index",
"]",
"[",
"0",
"]",
">",
"filter_data",
"[",
"index",
"+",
"1"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | round_data | round the data | modules/cij/xlsx.py | def round_data(filter_data):
""" round the data"""
for index, _ in enumerate(filter_data):
filter_data[index][0] = round(filter_data[index][0] / 100.0) * 100.0
return filter_data | def round_data(filter_data):
""" round the data"""
for index, _ in enumerate(filter_data):
filter_data[index][0] = round(filter_data[index][0] / 100.0) * 100.0
return filter_data | [
"round",
"the",
"data"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L374-L378 | [
"def",
"round_data",
"(",
"filter_data",
")",
":",
"for",
"index",
",",
"_",
"in",
"enumerate",
"(",
"filter_data",
")",
":",
"filter_data",
"[",
"index",
"]",
"[",
"0",
"]",
"=",
"round",
"(",
"filter_data",
"[",
"index",
"]",
"[",
"0",
"]",
"/",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Basic.import_source | Function:
Save original data into specific sheet, and try to translate data to float type
Input:
sheet: Must be a non exists sheet
source: File path of source | modules/cij/xlsx.py | def import_source(self, sheet, source, delimiter=","):
"""
Function:
Save original data into specific sheet, and try to translate data to float type
Input:
sheet: Must be a non exists sheet
source: File path of source
"""
# check input ... | def import_source(self, sheet, source, delimiter=","):
"""
Function:
Save original data into specific sheet, and try to translate data to float type
Input:
sheet: Must be a non exists sheet
source: File path of source
"""
# check input ... | [
"Function",
":",
"Save",
"original",
"data",
"into",
"specific",
"sheet",
"and",
"try",
"to",
"translate",
"data",
"to",
"float",
"type",
"Input",
":",
"sheet",
":",
"Must",
"be",
"a",
"non",
"exists",
"sheet",
"source",
":",
"File",
"path",
"of",
"sourc... | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L41-L80 | [
"def",
"import_source",
"(",
"self",
",",
"sheet",
",",
"source",
",",
"delimiter",
"=",
"\",\"",
")",
":",
"# check input parameters\r",
"if",
"' '",
"in",
"sheet",
":",
"raise",
"RuntimeError",
"(",
"\"Error sheet name: %s\"",
"%",
"sheet",
")",
"if",
"not",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Basic.generate_chart | Function:
Generate and save chart to specific sheet.
Input:
sheet: If already exists, new chart will be added below.
Otherwise, it would create a new sheet;
x_axis: Specify x axis;
y_axis: Specify y axis;
series: Specify serie... | modules/cij/xlsx.py | def generate_chart(self, properties):
"""
Function:
Generate and save chart to specific sheet.
Input:
sheet: If already exists, new chart will be added below.
Otherwise, it would create a new sheet;
x_axis: Specify x axis;
... | def generate_chart(self, properties):
"""
Function:
Generate and save chart to specific sheet.
Input:
sheet: If already exists, new chart will be added below.
Otherwise, it would create a new sheet;
x_axis: Specify x axis;
... | [
"Function",
":",
"Generate",
"and",
"save",
"chart",
"to",
"specific",
"sheet",
".",
"Input",
":",
"sheet",
":",
"If",
"already",
"exists",
"new",
"chart",
"will",
"be",
"added",
"below",
".",
"Otherwise",
"it",
"would",
"create",
"a",
"new",
"sheet",
";... | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L82-L113 | [
"def",
"generate_chart",
"(",
"self",
",",
"properties",
")",
":",
"# check input parameters\r",
"if",
"not",
"{",
"'x_axis'",
",",
"'y_axis'",
",",
"'series'",
",",
"'filters'",
"}",
".",
"issubset",
"(",
"set",
"(",
"properties",
".",
"keys",
"(",
")",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Gc.gen_config_sheet | generate configuration | modules/cij/xlsx.py | def gen_config_sheet(self, sheetname, plist):
""" generate configuration"""
worksheet_cfg = self.workbook.add_worksheet(sheetname)
cell_format = self.workbook.add_format({'bold': False, 'font_name': u'等线'})
cell_format_title = self.workbook.add_format({'border': 0, 'align': 'center',... | def gen_config_sheet(self, sheetname, plist):
""" generate configuration"""
worksheet_cfg = self.workbook.add_worksheet(sheetname)
cell_format = self.workbook.add_format({'bold': False, 'font_name': u'等线'})
cell_format_title = self.workbook.add_format({'border': 0, 'align': 'center',... | [
"generate",
"configuration"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L205-L215 | [
"def",
"gen_config_sheet",
"(",
"self",
",",
"sheetname",
",",
"plist",
")",
":",
"worksheet_cfg",
"=",
"self",
".",
"workbook",
".",
"add_worksheet",
"(",
"sheetname",
")",
"cell_format",
"=",
"self",
".",
"workbook",
".",
"add_format",
"(",
"{",
"'bold'",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Gc.gen_data_sheet | datafile, sheetname, x_axis_name, y_axis_name, title,
Function:
Turn realtime bw data into picture, and save into specific sheet
Input:
sheetname: If already exists, new chart will be added continuely.
Otherwise, it would create new sheet;
... | modules/cij/xlsx.py | def gen_data_sheet(self, datafile, para_meter, scale=1.75, steady_time=300):
"""
datafile, sheetname, x_axis_name, y_axis_name, title,
Function:
Turn realtime bw data into picture, and save into specific sheet
Input:
sheetname: If already exists, new chart w... | def gen_data_sheet(self, datafile, para_meter, scale=1.75, steady_time=300):
"""
datafile, sheetname, x_axis_name, y_axis_name, title,
Function:
Turn realtime bw data into picture, and save into specific sheet
Input:
sheetname: If already exists, new chart w... | [
"datafile",
"sheetname",
"x_axis_name",
"y_axis_name",
"title",
"Function",
":",
"Turn",
"realtime",
"bw",
"data",
"into",
"picture",
"and",
"save",
"into",
"specific",
"sheet",
"Input",
":",
"sheetname",
":",
"If",
"already",
"exists",
"new",
"chart",
"will",
... | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/xlsx.py#L217-L254 | [
"def",
"gen_data_sheet",
"(",
"self",
",",
"datafile",
",",
"para_meter",
",",
"scale",
"=",
"1.75",
",",
"steady_time",
"=",
"300",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"split",
"(",
"datafile",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env | Verify PCI variables and construct exported variables | modules/cij/pci.py | def env():
"""Verify PCI variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.pci.env: invalid SSH environment")
return 1
pci = cij.env_to_dict(PREFIX, REQUIRED)
pci["BUS_PATH"] = "/sys/bus/pci"
pci["DEV_PATH"] = os.sep.join([pci["BUS_PATH"], "devices", pci... | def env():
"""Verify PCI variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.pci.env: invalid SSH environment")
return 1
pci = cij.env_to_dict(PREFIX, REQUIRED)
pci["BUS_PATH"] = "/sys/bus/pci"
pci["DEV_PATH"] = os.sep.join([pci["BUS_PATH"], "devices", pci... | [
"Verify",
"PCI",
"variables",
"and",
"construct",
"exported",
"variables"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/pci.py#L14-L28 | [
"def",
"env",
"(",
")",
":",
"if",
"cij",
".",
"ssh",
".",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.pci.env: invalid SSH environment\"",
")",
"return",
"1",
"pci",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"REQUIRED",
")",
"pci",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | info | Print, emphasized 'neutral', the given 'txt' message | modules/cij/__init__.py | def info(txt):
"""Print, emphasized 'neutral', the given 'txt' message"""
print("%s# %s%s%s" % (PR_EMPH_CC, get_time_stamp(), txt, PR_NC))
sys.stdout.flush() | def info(txt):
"""Print, emphasized 'neutral', the given 'txt' message"""
print("%s# %s%s%s" % (PR_EMPH_CC, get_time_stamp(), txt, PR_NC))
sys.stdout.flush() | [
"Print",
"emphasized",
"neutral",
"the",
"given",
"txt",
"message"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L55-L59 | [
"def",
"info",
"(",
"txt",
")",
":",
"print",
"(",
"\"%s# %s%s%s\"",
"%",
"(",
"PR_EMPH_CC",
",",
"get_time_stamp",
"(",
")",
",",
"txt",
",",
"PR_NC",
")",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | good | Print, emphasized 'good', the given 'txt' message | modules/cij/__init__.py | def good(txt):
"""Print, emphasized 'good', the given 'txt' message"""
print("%s# %s%s%s" % (PR_GOOD_CC, get_time_stamp(), txt, PR_NC))
sys.stdout.flush() | def good(txt):
"""Print, emphasized 'good', the given 'txt' message"""
print("%s# %s%s%s" % (PR_GOOD_CC, get_time_stamp(), txt, PR_NC))
sys.stdout.flush() | [
"Print",
"emphasized",
"good",
"the",
"given",
"txt",
"message"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L62-L66 | [
"def",
"good",
"(",
"txt",
")",
":",
"print",
"(",
"\"%s# %s%s%s\"",
"%",
"(",
"PR_GOOD_CC",
",",
"get_time_stamp",
"(",
")",
",",
"txt",
",",
"PR_NC",
")",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | warn | Print, emphasized 'warning', the given 'txt' message | modules/cij/__init__.py | def warn(txt):
"""Print, emphasized 'warning', the given 'txt' message"""
print("%s# %s%s%s" % (PR_WARN_CC, get_time_stamp(), txt, PR_NC))
sys.stdout.flush() | def warn(txt):
"""Print, emphasized 'warning', the given 'txt' message"""
print("%s# %s%s%s" % (PR_WARN_CC, get_time_stamp(), txt, PR_NC))
sys.stdout.flush() | [
"Print",
"emphasized",
"warning",
"the",
"given",
"txt",
"message"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L69-L73 | [
"def",
"warn",
"(",
"txt",
")",
":",
"print",
"(",
"\"%s# %s%s%s\"",
"%",
"(",
"PR_WARN_CC",
",",
"get_time_stamp",
"(",
")",
",",
"txt",
",",
"PR_NC",
")",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | err | Print, emphasized 'error', the given 'txt' message | modules/cij/__init__.py | def err(txt):
"""Print, emphasized 'error', the given 'txt' message"""
print("%s# %s%s%s" % (PR_ERR_CC, get_time_stamp(), txt, PR_NC))
sys.stdout.flush() | def err(txt):
"""Print, emphasized 'error', the given 'txt' message"""
print("%s# %s%s%s" % (PR_ERR_CC, get_time_stamp(), txt, PR_NC))
sys.stdout.flush() | [
"Print",
"emphasized",
"error",
"the",
"given",
"txt",
"message"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L76-L80 | [
"def",
"err",
"(",
"txt",
")",
":",
"print",
"(",
"\"%s# %s%s%s\"",
"%",
"(",
"PR_ERR_CC",
",",
"get_time_stamp",
"(",
")",
",",
"txt",
",",
"PR_NC",
")",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | emph | Print, emphasized based on rval | modules/cij/__init__.py | def emph(txt, rval=None):
"""Print, emphasized based on rval"""
if rval is None: # rval is not specified, use 'neutral'
info(txt)
elif rval == 0: # rval is 0, by convention, this is 'good'
good(txt)
else: # any other value, considered 'bad'
err(txt) | def emph(txt, rval=None):
"""Print, emphasized based on rval"""
if rval is None: # rval is not specified, use 'neutral'
info(txt)
elif rval == 0: # rval is 0, by convention, this is 'good'
good(txt)
else: # any other value, considered 'bad'
err(txt) | [
"Print",
"emphasized",
"based",
"on",
"rval"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L83-L91 | [
"def",
"emph",
"(",
"txt",
",",
"rval",
"=",
"None",
")",
":",
"if",
"rval",
"is",
"None",
":",
"# rval is not specified, use 'neutral'",
"info",
"(",
"txt",
")",
"elif",
"rval",
"==",
"0",
":",
"# rval is 0, by convention, this is 'good'",
"good",
"(",
"txt",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | paths_from_env | Construct dict of paths from environment variables | modules/cij/__init__.py | def paths_from_env(prefix=None, names=None):
"""Construct dict of paths from environment variables'"""
def expand_path(path):
"""Expands variables in 'path' and turns it into absolute path"""
return os.path.abspath(os.path.expanduser(os.path.expandvars(path)))
if prefix is None:
... | def paths_from_env(prefix=None, names=None):
"""Construct dict of paths from environment variables'"""
def expand_path(path):
"""Expands variables in 'path' and turns it into absolute path"""
return os.path.abspath(os.path.expanduser(os.path.expandvars(path)))
if prefix is None:
... | [
"Construct",
"dict",
"of",
"paths",
"from",
"environment",
"variables"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L93-L118 | [
"def",
"paths_from_env",
"(",
"prefix",
"=",
"None",
",",
"names",
"=",
"None",
")",
":",
"def",
"expand_path",
"(",
"path",
")",
":",
"\"\"\"Expands variables in 'path' and turns it into absolute path\"\"\"",
"return",
"os",
".",
"path",
".",
"abspath",
"(",
"os"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env_to_dict | Construct dict from environment variables named: PREFIX_NAME
@returns dict of names | modules/cij/__init__.py | def env_to_dict(prefix, names):
"""
Construct dict from environment variables named: PREFIX_NAME
@returns dict of names
"""
env = {}
for name in names:
env[name] = ENV.get("_".join([prefix, name]))
if env[name] is None:
return None
return env | def env_to_dict(prefix, names):
"""
Construct dict from environment variables named: PREFIX_NAME
@returns dict of names
"""
env = {}
for name in names:
env[name] = ENV.get("_".join([prefix, name]))
if env[name] is None:
return None
return env | [
"Construct",
"dict",
"from",
"environment",
"variables",
"named",
":",
"PREFIX_NAME"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L120-L133 | [
"def",
"env_to_dict",
"(",
"prefix",
",",
"names",
")",
":",
"env",
"=",
"{",
"}",
"for",
"name",
"in",
"names",
":",
"env",
"[",
"name",
"]",
"=",
"ENV",
".",
"get",
"(",
"\"_\"",
".",
"join",
"(",
"[",
"prefix",
",",
"name",
"]",
")",
")",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env_export | Define the list of 'exported' variables with 'prefix' with values from 'env' | modules/cij/__init__.py | def env_export(prefix, exported, env):
"""
Define the list of 'exported' variables with 'prefix' with values from 'env'
"""
for exp in exported:
ENV["_".join([prefix, exp])] = env[exp] | def env_export(prefix, exported, env):
"""
Define the list of 'exported' variables with 'prefix' with values from 'env'
"""
for exp in exported:
ENV["_".join([prefix, exp])] = env[exp] | [
"Define",
"the",
"list",
"of",
"exported",
"variables",
"with",
"prefix",
"with",
"values",
"from",
"env"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/__init__.py#L136-L142 | [
"def",
"env_export",
"(",
"prefix",
",",
"exported",
",",
"env",
")",
":",
"for",
"exp",
"in",
"exported",
":",
"ENV",
"[",
"\"_\"",
".",
"join",
"(",
"[",
"prefix",
",",
"exp",
"]",
")",
"]",
"=",
"env",
"[",
"exp",
"]"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env | Verify NVME variables and construct exported variables | deprecated/modules/cij/nvm.py | def env():
"""Verify NVME variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.nvm.env: invalid SSH environment")
return 1
nvm = cij.env_to_dict(PREFIX, REQUIRED)
if "nvme" in nvm["DEV_NAME"]:
nvm["DEV_PATH"] = "/dev/%s" % nvm["DEV_NAME"]
else:
... | def env():
"""Verify NVME variables and construct exported variables"""
if cij.ssh.env():
cij.err("cij.nvm.env: invalid SSH environment")
return 1
nvm = cij.env_to_dict(PREFIX, REQUIRED)
if "nvme" in nvm["DEV_NAME"]:
nvm["DEV_PATH"] = "/dev/%s" % nvm["DEV_NAME"]
else:
... | [
"Verify",
"NVME",
"variables",
"and",
"construct",
"exported",
"variables"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvm.py#L23-L39 | [
"def",
"env",
"(",
")",
":",
"if",
"cij",
".",
"ssh",
".",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.nvm.env: invalid SSH environment\"",
")",
"return",
"1",
"nvm",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"REQUIRED",
")",
"if",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | exists | Verify that the ENV defined NVMe device exists | deprecated/modules/cij/nvm.py | def exists():
"""Verify that the ENV defined NVMe device exists"""
if env():
cij.err("cij.nvm.exists: Invalid NVMe ENV.")
return 1
nvm = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
cmd = ['[[ -b "%s" ]]' % nvm["DEV_PATH"]]
rcode, _, _ = cij.ssh.command(cmd, shell=True, echo=False... | def exists():
"""Verify that the ENV defined NVMe device exists"""
if env():
cij.err("cij.nvm.exists: Invalid NVMe ENV.")
return 1
nvm = cij.env_to_dict(PREFIX, EXPORTED + REQUIRED)
cmd = ['[[ -b "%s" ]]' % nvm["DEV_PATH"]]
rcode, _, _ = cij.ssh.command(cmd, shell=True, echo=False... | [
"Verify",
"that",
"the",
"ENV",
"defined",
"NVMe",
"device",
"exists"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvm.py#L42-L54 | [
"def",
"exists",
"(",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.nvm.exists: Invalid NVMe ENV.\"",
")",
"return",
"1",
"nvm",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"EXPORTED",
"+",
"REQUIRED",
")",
"cmd",
"=",
"[... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | dev_get_rprt | Get-log-page chunk information
If the pugrp and punit is set, then provide report only for that pugrp/punit
@returns the first chunk in the given state if one exists, None otherwise | deprecated/modules/cij/nvm.py | def dev_get_rprt(dev_name, pugrp=None, punit=None):
"""
Get-log-page chunk information
If the pugrp and punit is set, then provide report only for that pugrp/punit
@returns the first chunk in the given state if one exists, None otherwise
"""
cmd = ["nvm_cmd", "rprt_all", dev_name]
if not ... | def dev_get_rprt(dev_name, pugrp=None, punit=None):
"""
Get-log-page chunk information
If the pugrp and punit is set, then provide report only for that pugrp/punit
@returns the first chunk in the given state if one exists, None otherwise
"""
cmd = ["nvm_cmd", "rprt_all", dev_name]
if not ... | [
"Get",
"-",
"log",
"-",
"page",
"chunk",
"information"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvm.py#L57-L74 | [
"def",
"dev_get_rprt",
"(",
"dev_name",
",",
"pugrp",
"=",
"None",
",",
"punit",
"=",
"None",
")",
":",
"cmd",
"=",
"[",
"\"nvm_cmd\"",
",",
"\"rprt_all\"",
",",
"dev_name",
"]",
"if",
"not",
"(",
"pugrp",
"is",
"None",
"and",
"punit",
"is",
"None",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | dev_get_chunk | Get a chunk-descriptor for the first chunk in the given state.
If the pugrp and punit is set, then search only that pugrp/punit
@returns the first chunk in the given state if one exists, None otherwise | deprecated/modules/cij/nvm.py | def dev_get_chunk(dev_name, state, pugrp=None, punit=None):
"""
Get a chunk-descriptor for the first chunk in the given state.
If the pugrp and punit is set, then search only that pugrp/punit
@returns the first chunk in the given state if one exists, None otherwise
"""
rprt = dev_get_rprt(dev... | def dev_get_chunk(dev_name, state, pugrp=None, punit=None):
"""
Get a chunk-descriptor for the first chunk in the given state.
If the pugrp and punit is set, then search only that pugrp/punit
@returns the first chunk in the given state if one exists, None otherwise
"""
rprt = dev_get_rprt(dev... | [
"Get",
"a",
"chunk",
"-",
"descriptor",
"for",
"the",
"first",
"chunk",
"in",
"the",
"given",
"state",
"."
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/deprecated/modules/cij/nvm.py#L77-L90 | [
"def",
"dev_get_chunk",
"(",
"dev_name",
",",
"state",
",",
"pugrp",
"=",
"None",
",",
"punit",
"=",
"None",
")",
":",
"rprt",
"=",
"dev_get_rprt",
"(",
"dev_name",
",",
"pugrp",
",",
"punit",
")",
"if",
"not",
"rprt",
":",
"return",
"None",
"return",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | pkill | Kill all of FIO processes | modules/cij/fio.py | def pkill():
"""Kill all of FIO processes"""
if env():
return 1
cmd = ["ps -aux | grep fio | grep -v grep"]
status, _, _ = cij.ssh.command(cmd, shell=True, echo=False)
if not status:
status, _, _ = cij.ssh.command(["pkill -f fio"], shell=True)
if status:
return ... | def pkill():
"""Kill all of FIO processes"""
if env():
return 1
cmd = ["ps -aux | grep fio | grep -v grep"]
status, _, _ = cij.ssh.command(cmd, shell=True, echo=False)
if not status:
status, _, _ = cij.ssh.command(["pkill -f fio"], shell=True)
if status:
return ... | [
"Kill",
"all",
"of",
"FIO",
"processes"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L32-L44 | [
"def",
"pkill",
"(",
")",
":",
"if",
"env",
"(",
")",
":",
"return",
"1",
"cmd",
"=",
"[",
"\"ps -aux | grep fio | grep -v grep\"",
"]",
"status",
",",
"_",
",",
"_",
"=",
"cij",
".",
"ssh",
".",
"command",
"(",
"cmd",
",",
"shell",
"=",
"True",
",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Job.__parse_parms | Translate dict parameters to string | modules/cij/fio.py | def __parse_parms(self):
"""Translate dict parameters to string"""
args = list()
for key, val in self.__parm.items():
key = key.replace("FIO_", "").lower()
if key == "runtime":
args.append("--time_based")
if val is None:
args... | def __parse_parms(self):
"""Translate dict parameters to string"""
args = list()
for key, val in self.__parm.items():
key = key.replace("FIO_", "").lower()
if key == "runtime":
args.append("--time_based")
if val is None:
args... | [
"Translate",
"dict",
"parameters",
"to",
"string"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L74-L88 | [
"def",
"__parse_parms",
"(",
"self",
")",
":",
"args",
"=",
"list",
"(",
")",
"for",
"key",
",",
"val",
"in",
"self",
".",
"__parm",
".",
"items",
"(",
")",
":",
"key",
"=",
"key",
".",
"replace",
"(",
"\"FIO_\"",
",",
"\"\"",
")",
".",
"lower",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Job.import_parms | Import external dict to internal dict | modules/cij/fio.py | def import_parms(self, args):
"""Import external dict to internal dict"""
for key, val in args.items():
self.set_parm(key, val) | def import_parms(self, args):
"""Import external dict to internal dict"""
for key, val in args.items():
self.set_parm(key, val) | [
"Import",
"external",
"dict",
"to",
"internal",
"dict"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L90-L94 | [
"def",
"import_parms",
"(",
"self",
",",
"args",
")",
":",
"for",
"key",
",",
"val",
"in",
"args",
".",
"items",
"(",
")",
":",
"self",
".",
"set_parm",
"(",
"key",
",",
"val",
")"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Job.get_parm | Get parameter of FIO | modules/cij/fio.py | def get_parm(self, key):
"""Get parameter of FIO"""
if key in self.__parm.keys():
return self.__parm[key]
return None | def get_parm(self, key):
"""Get parameter of FIO"""
if key in self.__parm.keys():
return self.__parm[key]
return None | [
"Get",
"parameter",
"of",
"FIO"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L105-L111 | [
"def",
"get_parm",
"(",
"self",
",",
"key",
")",
":",
"if",
"key",
"in",
"self",
".",
"__parm",
".",
"keys",
"(",
")",
":",
"return",
"self",
".",
"__parm",
"[",
"key",
"]",
"return",
"None"
] | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Job.start | Run FIO job in thread | modules/cij/fio.py | def start(self):
"""Run FIO job in thread"""
self.__thread = Threads(target=self.run, args=(True, True, False))
self.__thread.setDaemon(True)
self.__thread.start() | def start(self):
"""Run FIO job in thread"""
self.__thread = Threads(target=self.run, args=(True, True, False))
self.__thread.setDaemon(True)
self.__thread.start() | [
"Run",
"FIO",
"job",
"in",
"thread"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L113-L118 | [
"def",
"start",
"(",
"self",
")",
":",
"self",
".",
"__thread",
"=",
"Threads",
"(",
"target",
"=",
"self",
".",
"run",
",",
"args",
"=",
"(",
"True",
",",
"True",
",",
"False",
")",
")",
"self",
".",
"__thread",
".",
"setDaemon",
"(",
"True",
")... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | Job.run | Run FIO job | modules/cij/fio.py | def run(self, shell=True, cmdline=False, echo=True):
"""Run FIO job"""
if env():
return 1
cmd = ["fio"] + self.__parse_parms()
if cmdline:
cij.emph("cij.fio.run: shell: %r, cmd: %r" % (shell, cmd))
return cij.ssh.command(cmd, shell, echo) | def run(self, shell=True, cmdline=False, echo=True):
"""Run FIO job"""
if env():
return 1
cmd = ["fio"] + self.__parse_parms()
if cmdline:
cij.emph("cij.fio.run: shell: %r, cmd: %r" % (shell, cmd))
return cij.ssh.command(cmd, shell, echo) | [
"Run",
"FIO",
"job"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/fio.py#L134-L144 | [
"def",
"run",
"(",
"self",
",",
"shell",
"=",
"True",
",",
"cmdline",
"=",
"False",
",",
"echo",
"=",
"True",
")",
":",
"if",
"env",
"(",
")",
":",
"return",
"1",
"cmd",
"=",
"[",
"\"fio\"",
"]",
"+",
"self",
".",
"__parse_parms",
"(",
")",
"if... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | extract_hook_names | Extract hook names from the given entity | modules/cij/reporter.py | def extract_hook_names(ent):
"""Extract hook names from the given entity"""
hnames = []
for hook in ent["hooks"]["enter"] + ent["hooks"]["exit"]:
hname = os.path.basename(hook["fpath_orig"])
hname = os.path.splitext(hname)[0]
hname = hname.strip()
hname = hname.replace("_ent... | def extract_hook_names(ent):
"""Extract hook names from the given entity"""
hnames = []
for hook in ent["hooks"]["enter"] + ent["hooks"]["exit"]:
hname = os.path.basename(hook["fpath_orig"])
hname = os.path.splitext(hname)[0]
hname = hname.strip()
hname = hname.replace("_ent... | [
"Extract",
"hook",
"names",
"from",
"the",
"given",
"entity"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L14-L31 | [
"def",
"extract_hook_names",
"(",
"ent",
")",
":",
"hnames",
"=",
"[",
"]",
"for",
"hook",
"in",
"ent",
"[",
"\"hooks\"",
"]",
"[",
"\"enter\"",
"]",
"+",
"ent",
"[",
"\"hooks\"",
"]",
"[",
"\"exit\"",
"]",
":",
"hname",
"=",
"os",
".",
"path",
"."... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | tcase_comment | Extract testcase comment section / testcase description
@returns the testcase-comment from the tcase["fpath"] as a list of strings | modules/cij/reporter.py | def tcase_comment(tcase):
"""
Extract testcase comment section / testcase description
@returns the testcase-comment from the tcase["fpath"] as a list of strings
"""
src = open(tcase["fpath"]).read()
if len(src) < 3:
cij.err("rprtr::tcase_comment: invalid src, tcase: %r" % tcase["name"]... | def tcase_comment(tcase):
"""
Extract testcase comment section / testcase description
@returns the testcase-comment from the tcase["fpath"] as a list of strings
"""
src = open(tcase["fpath"]).read()
if len(src) < 3:
cij.err("rprtr::tcase_comment: invalid src, tcase: %r" % tcase["name"]... | [
"Extract",
"testcase",
"comment",
"section",
"/",
"testcase",
"description"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L34-L62 | [
"def",
"tcase_comment",
"(",
"tcase",
")",
":",
"src",
"=",
"open",
"(",
"tcase",
"[",
"\"fpath\"",
"]",
")",
".",
"read",
"(",
")",
"if",
"len",
"(",
"src",
")",
"<",
"3",
":",
"cij",
".",
"err",
"(",
"\"rprtr::tcase_comment: invalid src, tcase: %r\"",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | tcase_parse_descr | Parse descriptions from the the given tcase | modules/cij/reporter.py | def tcase_parse_descr(tcase):
"""Parse descriptions from the the given tcase"""
descr_short = "SHORT"
descr_long = "LONG"
try:
comment = tcase_comment(tcase)
except (IOError, OSError, ValueError) as exc:
comment = []
cij.err("tcase_parse_descr: failed: %r, tcase: %r" % (exc... | def tcase_parse_descr(tcase):
"""Parse descriptions from the the given tcase"""
descr_short = "SHORT"
descr_long = "LONG"
try:
comment = tcase_comment(tcase)
except (IOError, OSError, ValueError) as exc:
comment = []
cij.err("tcase_parse_descr: failed: %r, tcase: %r" % (exc... | [
"Parse",
"descriptions",
"from",
"the",
"the",
"given",
"tcase"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L65-L89 | [
"def",
"tcase_parse_descr",
"(",
"tcase",
")",
":",
"descr_short",
"=",
"\"SHORT\"",
"descr_long",
"=",
"\"LONG\"",
"try",
":",
"comment",
"=",
"tcase_comment",
"(",
"tcase",
")",
"except",
"(",
"IOError",
",",
"OSError",
",",
"ValueError",
")",
"as",
"exc",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | runlogs_to_html | Returns content of the given 'fpath' with HTML annotations, currently simply
a conversion of ANSI color codes to HTML elements | modules/cij/reporter.py | def runlogs_to_html(run_root):
"""
Returns content of the given 'fpath' with HTML annotations, currently simply
a conversion of ANSI color codes to HTML elements
"""
if not os.path.isdir(run_root):
return "CANNOT_LOCATE_LOGFILES"
hook_enter = []
hook_exit = []
tcase = []
fo... | def runlogs_to_html(run_root):
"""
Returns content of the given 'fpath' with HTML annotations, currently simply
a conversion of ANSI color codes to HTML elements
"""
if not os.path.isdir(run_root):
return "CANNOT_LOCATE_LOGFILES"
hook_enter = []
hook_exit = []
tcase = []
fo... | [
"Returns",
"content",
"of",
"the",
"given",
"fpath",
"with",
"HTML",
"annotations",
"currently",
"simply",
"a",
"conversion",
"of",
"ANSI",
"color",
"codes",
"to",
"HTML",
"elements"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L92-L121 | [
"def",
"runlogs_to_html",
"(",
"run_root",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"run_root",
")",
":",
"return",
"\"CANNOT_LOCATE_LOGFILES\"",
"hook_enter",
"=",
"[",
"]",
"hook_exit",
"=",
"[",
"]",
"tcase",
"=",
"[",
"]",
"for",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | src_to_html | Returns content of the given 'fpath' with HTML annotations for syntax
highlighting | modules/cij/reporter.py | def src_to_html(fpath):
"""
Returns content of the given 'fpath' with HTML annotations for syntax
highlighting
"""
if not os.path.exists(fpath):
return "COULD-NOT-FIND-TESTCASE-SRC-AT-FPATH:%r" % fpath
# NOTE: Do SYNTAX highlight?
return open(fpath, "r").read() | def src_to_html(fpath):
"""
Returns content of the given 'fpath' with HTML annotations for syntax
highlighting
"""
if not os.path.exists(fpath):
return "COULD-NOT-FIND-TESTCASE-SRC-AT-FPATH:%r" % fpath
# NOTE: Do SYNTAX highlight?
return open(fpath, "r").read() | [
"Returns",
"content",
"of",
"the",
"given",
"fpath",
"with",
"HTML",
"annotations",
"for",
"syntax",
"highlighting"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L124-L135 | [
"def",
"src_to_html",
"(",
"fpath",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"fpath",
")",
":",
"return",
"\"COULD-NOT-FIND-TESTCASE-SRC-AT-FPATH:%r\"",
"%",
"fpath",
"# NOTE: Do SYNTAX highlight?",
"return",
"open",
"(",
"fpath",
",",
"\"r\... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | aux_listing | Listing | modules/cij/reporter.py | def aux_listing(aux_root):
"""Listing"""
listing = []
for root, _, fnames in os.walk(aux_root):
count = len(aux_root.split(os.sep))
prefix = root.split(os.sep)[count:]
for fname in fnames:
listing.append(os.sep.join(prefix + [fname]))
return listing | def aux_listing(aux_root):
"""Listing"""
listing = []
for root, _, fnames in os.walk(aux_root):
count = len(aux_root.split(os.sep))
prefix = root.split(os.sep)[count:]
for fname in fnames:
listing.append(os.sep.join(prefix + [fname]))
return listing | [
"Listing"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L138-L150 | [
"def",
"aux_listing",
"(",
"aux_root",
")",
":",
"listing",
"=",
"[",
"]",
"for",
"root",
",",
"_",
",",
"fnames",
"in",
"os",
".",
"walk",
"(",
"aux_root",
")",
":",
"count",
"=",
"len",
"(",
"aux_root",
".",
"split",
"(",
"os",
".",
"sep",
")",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | process_tsuite | Goes through the tsuite and processes "*.log" | modules/cij/reporter.py | def process_tsuite(tsuite):
"""Goes through the tsuite and processes "*.log" """
# scoop of output from all run-logs
tsuite["log_content"] = runlogs_to_html(tsuite["res_root"])
tsuite["aux_list"] = aux_listing(tsuite["aux_root"])
tsuite["hnames"] = extract_hook_names(tsuite)
return True | def process_tsuite(tsuite):
"""Goes through the tsuite and processes "*.log" """
# scoop of output from all run-logs
tsuite["log_content"] = runlogs_to_html(tsuite["res_root"])
tsuite["aux_list"] = aux_listing(tsuite["aux_root"])
tsuite["hnames"] = extract_hook_names(tsuite)
return True | [
"Goes",
"through",
"the",
"tsuite",
"and",
"processes",
"*",
".",
"log"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L153-L162 | [
"def",
"process_tsuite",
"(",
"tsuite",
")",
":",
"# scoop of output from all run-logs",
"tsuite",
"[",
"\"log_content\"",
"]",
"=",
"runlogs_to_html",
"(",
"tsuite",
"[",
"\"res_root\"",
"]",
")",
"tsuite",
"[",
"\"aux_list\"",
"]",
"=",
"aux_listing",
"(",
"tsui... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | process_tcase | Goes through the trun and processes "run.log" | modules/cij/reporter.py | def process_tcase(tcase):
"""Goes through the trun and processes "run.log" """
tcase["src_content"] = src_to_html(tcase["fpath"])
tcase["log_content"] = runlogs_to_html(tcase["res_root"])
tcase["aux_list"] = aux_listing(tcase["aux_root"])
tcase["descr_short"], tcase["descr_long"] = tcase_parse_desc... | def process_tcase(tcase):
"""Goes through the trun and processes "run.log" """
tcase["src_content"] = src_to_html(tcase["fpath"])
tcase["log_content"] = runlogs_to_html(tcase["res_root"])
tcase["aux_list"] = aux_listing(tcase["aux_root"])
tcase["descr_short"], tcase["descr_long"] = tcase_parse_desc... | [
"Goes",
"through",
"the",
"trun",
"and",
"processes",
"run",
".",
"log"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L165-L174 | [
"def",
"process_tcase",
"(",
"tcase",
")",
":",
"tcase",
"[",
"\"src_content\"",
"]",
"=",
"src_to_html",
"(",
"tcase",
"[",
"\"fpath\"",
"]",
")",
"tcase",
"[",
"\"log_content\"",
"]",
"=",
"runlogs_to_html",
"(",
"tcase",
"[",
"\"res_root\"",
"]",
")",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | process_trun | Goes through the trun and processes "run.log" | modules/cij/reporter.py | def process_trun(trun):
"""Goes through the trun and processes "run.log" """
trun["log_content"] = runlogs_to_html(trun["res_root"])
trun["aux_list"] = aux_listing(trun["aux_root"])
trun["hnames"] = extract_hook_names(trun)
return True | def process_trun(trun):
"""Goes through the trun and processes "run.log" """
trun["log_content"] = runlogs_to_html(trun["res_root"])
trun["aux_list"] = aux_listing(trun["aux_root"])
trun["hnames"] = extract_hook_names(trun)
return True | [
"Goes",
"through",
"the",
"trun",
"and",
"processes",
"run",
".",
"log"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L177-L184 | [
"def",
"process_trun",
"(",
"trun",
")",
":",
"trun",
"[",
"\"log_content\"",
"]",
"=",
"runlogs_to_html",
"(",
"trun",
"[",
"\"res_root\"",
"]",
")",
"trun",
"[",
"\"aux_list\"",
"]",
"=",
"aux_listing",
"(",
"trun",
"[",
"\"aux_root\"",
"]",
")",
"trun",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | postprocess | Perform postprocessing of the given test run | modules/cij/reporter.py | def postprocess(trun):
"""Perform postprocessing of the given test run"""
plog = []
plog.append(("trun", process_trun(trun)))
for tsuite in trun["testsuites"]:
plog.append(("tsuite", process_tsuite(tsuite)))
for tcase in tsuite["testcases"]:
plog.append(("tcase", process_t... | def postprocess(trun):
"""Perform postprocessing of the given test run"""
plog = []
plog.append(("trun", process_trun(trun)))
for tsuite in trun["testsuites"]:
plog.append(("tsuite", process_tsuite(tsuite)))
for tcase in tsuite["testcases"]:
plog.append(("tcase", process_t... | [
"Perform",
"postprocessing",
"of",
"the",
"given",
"test",
"run"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L187-L203 | [
"def",
"postprocess",
"(",
"trun",
")",
":",
"plog",
"=",
"[",
"]",
"plog",
".",
"append",
"(",
"(",
"\"trun\"",
",",
"process_trun",
"(",
"trun",
")",
")",
")",
"for",
"tsuite",
"in",
"trun",
"[",
"\"testsuites\"",
"]",
":",
"plog",
".",
"append",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | rehome | Replace all absolute paths to "re-home" it | modules/cij/reporter.py | def rehome(old, new, struct):
"""
Replace all absolute paths to "re-home" it
"""
if old == new:
return
if isinstance(struct, list):
for item in struct:
rehome(old, new, item)
elif isinstance(struct, dict):
for key, val in struct.iteritems():
if i... | def rehome(old, new, struct):
"""
Replace all absolute paths to "re-home" it
"""
if old == new:
return
if isinstance(struct, list):
for item in struct:
rehome(old, new, item)
elif isinstance(struct, dict):
for key, val in struct.iteritems():
if i... | [
"Replace",
"all",
"absolute",
"paths",
"to",
"re",
"-",
"home",
"it"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L252-L272 | [
"def",
"rehome",
"(",
"old",
",",
"new",
",",
"struct",
")",
":",
"if",
"old",
"==",
"new",
":",
"return",
"if",
"isinstance",
"(",
"struct",
",",
"list",
")",
":",
"for",
"item",
"in",
"struct",
":",
"rehome",
"(",
"old",
",",
"new",
",",
"item"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | main | Main entry point | modules/cij/reporter.py | def main(args):
"""Main entry point"""
trun = cij.runner.trun_from_file(args.trun_fpath)
rehome(trun["conf"]["OUTPUT"], args.output, trun)
postprocess(trun)
cij.emph("main: reports are uses tmpl_fpath: %r" % args.tmpl_fpath)
cij.emph("main: reports are here args.output: %r" % args.output)
... | def main(args):
"""Main entry point"""
trun = cij.runner.trun_from_file(args.trun_fpath)
rehome(trun["conf"]["OUTPUT"], args.output, trun)
postprocess(trun)
cij.emph("main: reports are uses tmpl_fpath: %r" % args.tmpl_fpath)
cij.emph("main: reports are here args.output: %r" % args.output)
... | [
"Main",
"entry",
"point"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/reporter.py#L275-L298 | [
"def",
"main",
"(",
"args",
")",
":",
"trun",
"=",
"cij",
".",
"runner",
".",
"trun_from_file",
"(",
"args",
".",
"trun_fpath",
")",
"rehome",
"(",
"trun",
"[",
"\"conf\"",
"]",
"[",
"\"OUTPUT\"",
"]",
",",
"args",
".",
"output",
",",
"trun",
")",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | env | Verify SSH variables and construct exported variables | modules/cij/ssh.py | def env():
"""Verify SSH variables and construct exported variables"""
ssh = cij.env_to_dict(PREFIX, REQUIRED)
if "KEY" in ssh:
ssh["KEY"] = cij.util.expand_path(ssh["KEY"])
if cij.ENV.get("SSH_PORT") is None:
cij.ENV["SSH_PORT"] = "22"
cij.warn("cij.ssh.env: SSH_PORT was not s... | def env():
"""Verify SSH variables and construct exported variables"""
ssh = cij.env_to_dict(PREFIX, REQUIRED)
if "KEY" in ssh:
ssh["KEY"] = cij.util.expand_path(ssh["KEY"])
if cij.ENV.get("SSH_PORT") is None:
cij.ENV["SSH_PORT"] = "22"
cij.warn("cij.ssh.env: SSH_PORT was not s... | [
"Verify",
"SSH",
"variables",
"and",
"construct",
"exported",
"variables"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ssh.py#L32-L51 | [
"def",
"env",
"(",
")",
":",
"ssh",
"=",
"cij",
".",
"env_to_dict",
"(",
"PREFIX",
",",
"REQUIRED",
")",
"if",
"\"KEY\"",
"in",
"ssh",
":",
"ssh",
"[",
"\"KEY\"",
"]",
"=",
"cij",
".",
"util",
".",
"expand_path",
"(",
"ssh",
"[",
"\"KEY\"",
"]",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | command | SSH: Run the given command over SSH as defined in environment | modules/cij/ssh.py | def command(cmd, shell=True, echo=True, suffix=None):
"""SSH: Run the given command over SSH as defined in environment"""
if env():
cij.err("cij.ssh.command: Invalid SSH environment")
return 1
prefix = []
if cij.ENV.get("SSH_CMD_TIME") == "1":
prefix.append("/usr/bin/time")
... | def command(cmd, shell=True, echo=True, suffix=None):
"""SSH: Run the given command over SSH as defined in environment"""
if env():
cij.err("cij.ssh.command: Invalid SSH environment")
return 1
prefix = []
if cij.ENV.get("SSH_CMD_TIME") == "1":
prefix.append("/usr/bin/time")
... | [
"SSH",
":",
"Run",
"the",
"given",
"command",
"over",
"SSH",
"as",
"defined",
"in",
"environment"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ssh.py#L54-L88 | [
"def",
"command",
"(",
"cmd",
",",
"shell",
"=",
"True",
",",
"echo",
"=",
"True",
",",
"suffix",
"=",
"None",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.ssh.command: Invalid SSH environment\"",
")",
"return",
"1",
"prefix",
"... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | pull | SSH: pull data from remote linux | modules/cij/ssh.py | def pull(src, dst, folder=False):
"""SSH: pull data from remote linux"""
if env():
cij.err("cij.ssh.pull: Invalid SSH environment")
return 1
args = []
if cij.ENV.get("SSH_KEY"):
args.append("-i")
args.append(cij.ENV.get("SSH_KEY"))
if cij.ENV.get("SSH_PORT"):
... | def pull(src, dst, folder=False):
"""SSH: pull data from remote linux"""
if env():
cij.err("cij.ssh.pull: Invalid SSH environment")
return 1
args = []
if cij.ENV.get("SSH_KEY"):
args.append("-i")
args.append(cij.ENV.get("SSH_KEY"))
if cij.ENV.get("SSH_PORT"):
... | [
"SSH",
":",
"pull",
"data",
"from",
"remote",
"linux"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ssh.py#L117-L140 | [
"def",
"pull",
"(",
"src",
",",
"dst",
",",
"folder",
"=",
"False",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.ssh.pull: Invalid SSH environment\"",
")",
"return",
"1",
"args",
"=",
"[",
"]",
"if",
"cij",
".",
"ENV",
".",
... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | wait | Wait util target connected | modules/cij/ssh.py | def wait(timeout=300):
"""Wait util target connected"""
if env():
cij.err("cij.ssh.wait: Invalid SSH environment")
return 1
timeout_backup = cij.ENV.get("SSH_CMD_TIMEOUT")
try:
time_start = time.time()
cij.ENV["SSH_CMD_TIMEOUT"] = "3"
while True:
... | def wait(timeout=300):
"""Wait util target connected"""
if env():
cij.err("cij.ssh.wait: Invalid SSH environment")
return 1
timeout_backup = cij.ENV.get("SSH_CMD_TIMEOUT")
try:
time_start = time.time()
cij.ENV["SSH_CMD_TIMEOUT"] = "3"
while True:
... | [
"Wait",
"util",
"target",
"connected"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ssh.py#L143-L175 | [
"def",
"wait",
"(",
"timeout",
"=",
"300",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.ssh.wait: Invalid SSH environment\"",
")",
"return",
"1",
"timeout_backup",
"=",
"cij",
".",
"ENV",
".",
"get",
"(",
"\"SSH_CMD_TIMEOUT\"",
")",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | reboot | Reboot target | modules/cij/ssh.py | def reboot(timeout=300, extra=""):
"""Reboot target"""
if env():
cij.err("cij.ssh.reboot: Invalid SSH environment")
return 1
timeout_backup = cij.ENV.get("SSH_CMD_TIMEOUT")
try:
time_start = time.time()
status, last_uptime, _ = command(["/usr/bin/uptime -s"], shell=Tru... | def reboot(timeout=300, extra=""):
"""Reboot target"""
if env():
cij.err("cij.ssh.reboot: Invalid SSH environment")
return 1
timeout_backup = cij.ENV.get("SSH_CMD_TIMEOUT")
try:
time_start = time.time()
status, last_uptime, _ = command(["/usr/bin/uptime -s"], shell=Tru... | [
"Reboot",
"target"
] | refenv/cijoe | python | https://github.com/refenv/cijoe/blob/21d7b2ed4ff68e0a1457e7df2db27f6334f1a379/modules/cij/ssh.py#L178-L215 | [
"def",
"reboot",
"(",
"timeout",
"=",
"300",
",",
"extra",
"=",
"\"\"",
")",
":",
"if",
"env",
"(",
")",
":",
"cij",
".",
"err",
"(",
"\"cij.ssh.reboot: Invalid SSH environment\"",
")",
"return",
"1",
"timeout_backup",
"=",
"cij",
".",
"ENV",
".",
"get",... | 21d7b2ed4ff68e0a1457e7df2db27f6334f1a379 |
valid | assert_that | Factory method for the assertion builder with value to be tested and optional description. | assertpy/assertpy.py | def assert_that(val, description=''):
"""Factory method for the assertion builder with value to be tested and optional description."""
global _soft_ctx
if _soft_ctx:
return AssertionBuilder(val, description, 'soft')
return AssertionBuilder(val, description) | def assert_that(val, description=''):
"""Factory method for the assertion builder with value to be tested and optional description."""
global _soft_ctx
if _soft_ctx:
return AssertionBuilder(val, description, 'soft')
return AssertionBuilder(val, description) | [
"Factory",
"method",
"for",
"the",
"assertion",
"builder",
"with",
"value",
"to",
"be",
"tested",
"and",
"optional",
"description",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L89-L94 | [
"def",
"assert_that",
"(",
"val",
",",
"description",
"=",
"''",
")",
":",
"global",
"_soft_ctx",
"if",
"_soft_ctx",
":",
"return",
"AssertionBuilder",
"(",
"val",
",",
"description",
",",
"'soft'",
")",
"return",
"AssertionBuilder",
"(",
"val",
",",
"descri... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | contents_of | Helper to read the contents of the given file or path into a string with the given encoding.
Encoding defaults to 'utf-8', other useful encodings are 'ascii' and 'latin-1'. | assertpy/assertpy.py | def contents_of(f, encoding='utf-8'):
"""Helper to read the contents of the given file or path into a string with the given encoding.
Encoding defaults to 'utf-8', other useful encodings are 'ascii' and 'latin-1'."""
try:
contents = f.read()
except AttributeError:
try:
with ... | def contents_of(f, encoding='utf-8'):
"""Helper to read the contents of the given file or path into a string with the given encoding.
Encoding defaults to 'utf-8', other useful encodings are 'ascii' and 'latin-1'."""
try:
contents = f.read()
except AttributeError:
try:
with ... | [
"Helper",
"to",
"read",
"the",
"contents",
"of",
"the",
"given",
"file",
"or",
"path",
"into",
"a",
"string",
"with",
"the",
"given",
"encoding",
".",
"Encoding",
"defaults",
"to",
"utf",
"-",
"8",
"other",
"useful",
"encodings",
"are",
"ascii",
"and",
"... | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L101-L131 | [
"def",
"contents_of",
"(",
"f",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"try",
":",
"contents",
"=",
"f",
".",
"read",
"(",
")",
"except",
"AttributeError",
":",
"try",
":",
"with",
"open",
"(",
"f",
",",
"'r'",
")",
"as",
"fp",
":",
"contents",... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | soft_fail | Adds error message to soft errors list if within soft assertions context.
Either just force test failure with the given message. | assertpy/assertpy.py | def soft_fail(msg=''):
"""Adds error message to soft errors list if within soft assertions context.
Either just force test failure with the given message."""
global _soft_ctx
if _soft_ctx:
global _soft_err
_soft_err.append('Fail: %s!' % msg if msg else 'Fail!')
return
fail... | def soft_fail(msg=''):
"""Adds error message to soft errors list if within soft assertions context.
Either just force test failure with the given message."""
global _soft_ctx
if _soft_ctx:
global _soft_err
_soft_err.append('Fail: %s!' % msg if msg else 'Fail!')
return
fail... | [
"Adds",
"error",
"message",
"to",
"soft",
"errors",
"list",
"if",
"within",
"soft",
"assertions",
"context",
".",
"Either",
"just",
"force",
"test",
"failure",
"with",
"the",
"given",
"message",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L137-L145 | [
"def",
"soft_fail",
"(",
"msg",
"=",
"''",
")",
":",
"global",
"_soft_ctx",
"if",
"_soft_ctx",
":",
"global",
"_soft_err",
"_soft_err",
".",
"append",
"(",
"'Fail: %s!'",
"%",
"msg",
"if",
"msg",
"else",
"'Fail!'",
")",
"return",
"fail",
"(",
"msg",
")"
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_equal_to | Asserts that val is equal to other. | assertpy/assertpy.py | def is_equal_to(self, other, **kwargs):
"""Asserts that val is equal to other."""
if self._check_dict_like(self.val, check_values=False, return_as_bool=True) and \
self._check_dict_like(other, check_values=False, return_as_bool=True):
if self._dict_not_equal(self.val, other, ... | def is_equal_to(self, other, **kwargs):
"""Asserts that val is equal to other."""
if self._check_dict_like(self.val, check_values=False, return_as_bool=True) and \
self._check_dict_like(other, check_values=False, return_as_bool=True):
if self._dict_not_equal(self.val, other, ... | [
"Asserts",
"that",
"val",
"is",
"equal",
"to",
"other",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L163-L172 | [
"def",
"is_equal_to",
"(",
"self",
",",
"other",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_check_dict_like",
"(",
"self",
".",
"val",
",",
"check_values",
"=",
"False",
",",
"return_as_bool",
"=",
"True",
")",
"and",
"self",
".",
"_check_... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_not_equal_to | Asserts that val is not equal to other. | assertpy/assertpy.py | def is_not_equal_to(self, other):
"""Asserts that val is not equal to other."""
if self.val == other:
self._err('Expected <%s> to be not equal to <%s>, but was.' % (self.val, other))
return self | def is_not_equal_to(self, other):
"""Asserts that val is not equal to other."""
if self.val == other:
self._err('Expected <%s> to be not equal to <%s>, but was.' % (self.val, other))
return self | [
"Asserts",
"that",
"val",
"is",
"not",
"equal",
"to",
"other",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L174-L178 | [
"def",
"is_not_equal_to",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"val",
"==",
"other",
":",
"self",
".",
"_err",
"(",
"'Expected <%s> to be not equal to <%s>, but was.'",
"%",
"(",
"self",
".",
"val",
",",
"other",
")",
")",
"return",
"sel... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_same_as | Asserts that the val is identical to other, via 'is' compare. | assertpy/assertpy.py | def is_same_as(self, other):
"""Asserts that the val is identical to other, via 'is' compare."""
if self.val is not other:
self._err('Expected <%s> to be identical to <%s>, but was not.' % (self.val, other))
return self | def is_same_as(self, other):
"""Asserts that the val is identical to other, via 'is' compare."""
if self.val is not other:
self._err('Expected <%s> to be identical to <%s>, but was not.' % (self.val, other))
return self | [
"Asserts",
"that",
"the",
"val",
"is",
"identical",
"to",
"other",
"via",
"is",
"compare",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L180-L184 | [
"def",
"is_same_as",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"val",
"is",
"not",
"other",
":",
"self",
".",
"_err",
"(",
"'Expected <%s> to be identical to <%s>, but was not.'",
"%",
"(",
"self",
".",
"val",
",",
"other",
")",
")",
"return"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_not_same_as | Asserts that the val is not identical to other, via 'is' compare. | assertpy/assertpy.py | def is_not_same_as(self, other):
"""Asserts that the val is not identical to other, via 'is' compare."""
if self.val is other:
self._err('Expected <%s> to be not identical to <%s>, but was.' % (self.val, other))
return self | def is_not_same_as(self, other):
"""Asserts that the val is not identical to other, via 'is' compare."""
if self.val is other:
self._err('Expected <%s> to be not identical to <%s>, but was.' % (self.val, other))
return self | [
"Asserts",
"that",
"the",
"val",
"is",
"not",
"identical",
"to",
"other",
"via",
"is",
"compare",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L186-L190 | [
"def",
"is_not_same_as",
"(",
"self",
",",
"other",
")",
":",
"if",
"self",
".",
"val",
"is",
"other",
":",
"self",
".",
"_err",
"(",
"'Expected <%s> to be not identical to <%s>, but was.'",
"%",
"(",
"self",
".",
"val",
",",
"other",
")",
")",
"return",
"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_type_of | Asserts that val is of the given type. | assertpy/assertpy.py | def is_type_of(self, some_type):
"""Asserts that val is of the given type."""
if type(some_type) is not type and\
not issubclass(type(some_type), type):
raise TypeError('given arg must be a type')
if type(self.val) is not some_type:
if hasattr(self.val, '_... | def is_type_of(self, some_type):
"""Asserts that val is of the given type."""
if type(some_type) is not type and\
not issubclass(type(some_type), type):
raise TypeError('given arg must be a type')
if type(self.val) is not some_type:
if hasattr(self.val, '_... | [
"Asserts",
"that",
"val",
"is",
"of",
"the",
"given",
"type",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L216-L229 | [
"def",
"is_type_of",
"(",
"self",
",",
"some_type",
")",
":",
"if",
"type",
"(",
"some_type",
")",
"is",
"not",
"type",
"and",
"not",
"issubclass",
"(",
"type",
"(",
"some_type",
")",
",",
"type",
")",
":",
"raise",
"TypeError",
"(",
"'given arg must be ... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_instance_of | Asserts that val is an instance of the given class. | assertpy/assertpy.py | def is_instance_of(self, some_class):
"""Asserts that val is an instance of the given class."""
try:
if not isinstance(self.val, some_class):
if hasattr(self.val, '__name__'):
t = self.val.__name__
elif hasattr(self.val, '__class__'):
... | def is_instance_of(self, some_class):
"""Asserts that val is an instance of the given class."""
try:
if not isinstance(self.val, some_class):
if hasattr(self.val, '__name__'):
t = self.val.__name__
elif hasattr(self.val, '__class__'):
... | [
"Asserts",
"that",
"val",
"is",
"an",
"instance",
"of",
"the",
"given",
"class",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L231-L244 | [
"def",
"is_instance_of",
"(",
"self",
",",
"some_class",
")",
":",
"try",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"val",
",",
"some_class",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"val",
",",
"'__name__'",
")",
":",
"t",
"=",
"self",
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_length | Asserts that val is the given length. | assertpy/assertpy.py | def is_length(self, length):
"""Asserts that val is the given length."""
if type(length) is not int:
raise TypeError('given arg must be an int')
if length < 0:
raise ValueError('given arg must be a positive int')
if len(self.val) != length:
self._err('... | def is_length(self, length):
"""Asserts that val is the given length."""
if type(length) is not int:
raise TypeError('given arg must be an int')
if length < 0:
raise ValueError('given arg must be a positive int')
if len(self.val) != length:
self._err('... | [
"Asserts",
"that",
"val",
"is",
"the",
"given",
"length",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L246-L254 | [
"def",
"is_length",
"(",
"self",
",",
"length",
")",
":",
"if",
"type",
"(",
"length",
")",
"is",
"not",
"int",
":",
"raise",
"TypeError",
"(",
"'given arg must be an int'",
")",
"if",
"length",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"'given arg must b... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.contains | Asserts that val contains the given item or items. | assertpy/assertpy.py | def contains(self, *items):
"""Asserts that val contains the given item or items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
elif len(items) == 1:
if items[0] not in self.val:
if self._check_dict_like(self.val, return_as_bool... | def contains(self, *items):
"""Asserts that val contains the given item or items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
elif len(items) == 1:
if items[0] not in self.val:
if self._check_dict_like(self.val, return_as_bool... | [
"Asserts",
"that",
"val",
"contains",
"the",
"given",
"item",
"or",
"items",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L256-L276 | [
"def",
"contains",
"(",
"self",
",",
"*",
"items",
")",
":",
"if",
"len",
"(",
"items",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'one or more args must be given'",
")",
"elif",
"len",
"(",
"items",
")",
"==",
"1",
":",
"if",
"items",
"[",
"0... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.does_not_contain | Asserts that val does not contain the given item or items. | assertpy/assertpy.py | def does_not_contain(self, *items):
"""Asserts that val does not contain the given item or items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
elif len(items) == 1:
if items[0] in self.val:
self._err('Expected <%s> to not conta... | def does_not_contain(self, *items):
"""Asserts that val does not contain the given item or items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
elif len(items) == 1:
if items[0] in self.val:
self._err('Expected <%s> to not conta... | [
"Asserts",
"that",
"val",
"does",
"not",
"contain",
"the",
"given",
"item",
"or",
"items",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L278-L292 | [
"def",
"does_not_contain",
"(",
"self",
",",
"*",
"items",
")",
":",
"if",
"len",
"(",
"items",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'one or more args must be given'",
")",
"elif",
"len",
"(",
"items",
")",
"==",
"1",
":",
"if",
"items",
"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.contains_only | Asserts that val contains only the given item or items. | assertpy/assertpy.py | def contains_only(self, *items):
"""Asserts that val contains only the given item or items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
else:
extra = []
for i in self.val:
if i not in items:
ext... | def contains_only(self, *items):
"""Asserts that val contains only the given item or items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
else:
extra = []
for i in self.val:
if i not in items:
ext... | [
"Asserts",
"that",
"val",
"contains",
"only",
"the",
"given",
"item",
"or",
"items",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L294-L312 | [
"def",
"contains_only",
"(",
"self",
",",
"*",
"items",
")",
":",
"if",
"len",
"(",
"items",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'one or more args must be given'",
")",
"else",
":",
"extra",
"=",
"[",
"]",
"for",
"i",
"in",
"self",
".",
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.contains_sequence | Asserts that val contains the given sequence of items in order. | assertpy/assertpy.py | def contains_sequence(self, *items):
"""Asserts that val contains the given sequence of items in order."""
if len(items) == 0:
raise ValueError('one or more args must be given')
else:
try:
for i in xrange(len(self.val) - len(items) + 1):
... | def contains_sequence(self, *items):
"""Asserts that val contains the given sequence of items in order."""
if len(items) == 0:
raise ValueError('one or more args must be given')
else:
try:
for i in xrange(len(self.val) - len(items) + 1):
... | [
"Asserts",
"that",
"val",
"contains",
"the",
"given",
"sequence",
"of",
"items",
"in",
"order",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L314-L328 | [
"def",
"contains_sequence",
"(",
"self",
",",
"*",
"items",
")",
":",
"if",
"len",
"(",
"items",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'one or more args must be given'",
")",
"else",
":",
"try",
":",
"for",
"i",
"in",
"xrange",
"(",
"len",
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.contains_duplicates | Asserts that val is iterable and contains duplicate items. | assertpy/assertpy.py | def contains_duplicates(self):
"""Asserts that val is iterable and contains duplicate items."""
try:
if len(self.val) != len(set(self.val)):
return self
except TypeError:
raise TypeError('val is not iterable')
self._err('Expected <%s> to contain du... | def contains_duplicates(self):
"""Asserts that val is iterable and contains duplicate items."""
try:
if len(self.val) != len(set(self.val)):
return self
except TypeError:
raise TypeError('val is not iterable')
self._err('Expected <%s> to contain du... | [
"Asserts",
"that",
"val",
"is",
"iterable",
"and",
"contains",
"duplicate",
"items",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L330-L337 | [
"def",
"contains_duplicates",
"(",
"self",
")",
":",
"try",
":",
"if",
"len",
"(",
"self",
".",
"val",
")",
"!=",
"len",
"(",
"set",
"(",
"self",
".",
"val",
")",
")",
":",
"return",
"self",
"except",
"TypeError",
":",
"raise",
"TypeError",
"(",
"'... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.does_not_contain_duplicates | Asserts that val is iterable and does not contain any duplicate items. | assertpy/assertpy.py | def does_not_contain_duplicates(self):
"""Asserts that val is iterable and does not contain any duplicate items."""
try:
if len(self.val) == len(set(self.val)):
return self
except TypeError:
raise TypeError('val is not iterable')
self._err('Expecte... | def does_not_contain_duplicates(self):
"""Asserts that val is iterable and does not contain any duplicate items."""
try:
if len(self.val) == len(set(self.val)):
return self
except TypeError:
raise TypeError('val is not iterable')
self._err('Expecte... | [
"Asserts",
"that",
"val",
"is",
"iterable",
"and",
"does",
"not",
"contain",
"any",
"duplicate",
"items",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L339-L346 | [
"def",
"does_not_contain_duplicates",
"(",
"self",
")",
":",
"try",
":",
"if",
"len",
"(",
"self",
".",
"val",
")",
"==",
"len",
"(",
"set",
"(",
"self",
".",
"val",
")",
")",
":",
"return",
"self",
"except",
"TypeError",
":",
"raise",
"TypeError",
"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_empty | Asserts that val is empty. | assertpy/assertpy.py | def is_empty(self):
"""Asserts that val is empty."""
if len(self.val) != 0:
if isinstance(self.val, str_types):
self._err('Expected <%s> to be empty string, but was not.' % self.val)
else:
self._err('Expected <%s> to be empty, but was not.' % self.... | def is_empty(self):
"""Asserts that val is empty."""
if len(self.val) != 0:
if isinstance(self.val, str_types):
self._err('Expected <%s> to be empty string, but was not.' % self.val)
else:
self._err('Expected <%s> to be empty, but was not.' % self.... | [
"Asserts",
"that",
"val",
"is",
"empty",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L348-L355 | [
"def",
"is_empty",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"val",
")",
"!=",
"0",
":",
"if",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"self",
".",
"_err",
"(",
"'Expected <%s> to be empty string, but was not.'",
"%... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_not_empty | Asserts that val is not empty. | assertpy/assertpy.py | def is_not_empty(self):
"""Asserts that val is not empty."""
if len(self.val) == 0:
if isinstance(self.val, str_types):
self._err('Expected not empty string, but was empty.')
else:
self._err('Expected not empty, but was empty.')
return self | def is_not_empty(self):
"""Asserts that val is not empty."""
if len(self.val) == 0:
if isinstance(self.val, str_types):
self._err('Expected not empty string, but was empty.')
else:
self._err('Expected not empty, but was empty.')
return self | [
"Asserts",
"that",
"val",
"is",
"not",
"empty",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L357-L364 | [
"def",
"is_not_empty",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"val",
")",
"==",
"0",
":",
"if",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"self",
".",
"_err",
"(",
"'Expected not empty string, but was empty.'",
")"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_in | Asserts that val is equal to one of the given items. | assertpy/assertpy.py | def is_in(self, *items):
"""Asserts that val is equal to one of the given items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
else:
for i in items:
if self.val == i:
return self
self._err('Expected <... | def is_in(self, *items):
"""Asserts that val is equal to one of the given items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
else:
for i in items:
if self.val == i:
return self
self._err('Expected <... | [
"Asserts",
"that",
"val",
"is",
"equal",
"to",
"one",
"of",
"the",
"given",
"items",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L366-L374 | [
"def",
"is_in",
"(",
"self",
",",
"*",
"items",
")",
":",
"if",
"len",
"(",
"items",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'one or more args must be given'",
")",
"else",
":",
"for",
"i",
"in",
"items",
":",
"if",
"self",
".",
"val",
"=="... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_nan | Asserts that val is real number and NaN (not a number). | assertpy/assertpy.py | def is_nan(self):
"""Asserts that val is real number and NaN (not a number)."""
self._validate_number()
self._validate_real()
if not math.isnan(self.val):
self._err('Expected <%s> to be <NaN>, but was not.' % self.val)
return self | def is_nan(self):
"""Asserts that val is real number and NaN (not a number)."""
self._validate_number()
self._validate_real()
if not math.isnan(self.val):
self._err('Expected <%s> to be <NaN>, but was not.' % self.val)
return self | [
"Asserts",
"that",
"val",
"is",
"real",
"number",
"and",
"NaN",
"(",
"not",
"a",
"number",
")",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L427-L433 | [
"def",
"is_nan",
"(",
"self",
")",
":",
"self",
".",
"_validate_number",
"(",
")",
"self",
".",
"_validate_real",
"(",
")",
"if",
"not",
"math",
".",
"isnan",
"(",
"self",
".",
"val",
")",
":",
"self",
".",
"_err",
"(",
"'Expected <%s> to be <NaN>, but w... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_not_nan | Asserts that val is real number and not NaN (not a number). | assertpy/assertpy.py | def is_not_nan(self):
"""Asserts that val is real number and not NaN (not a number)."""
self._validate_number()
self._validate_real()
if math.isnan(self.val):
self._err('Expected not <NaN>, but was.')
return self | def is_not_nan(self):
"""Asserts that val is real number and not NaN (not a number)."""
self._validate_number()
self._validate_real()
if math.isnan(self.val):
self._err('Expected not <NaN>, but was.')
return self | [
"Asserts",
"that",
"val",
"is",
"real",
"number",
"and",
"not",
"NaN",
"(",
"not",
"a",
"number",
")",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L435-L441 | [
"def",
"is_not_nan",
"(",
"self",
")",
":",
"self",
".",
"_validate_number",
"(",
")",
"self",
".",
"_validate_real",
"(",
")",
"if",
"math",
".",
"isnan",
"(",
"self",
".",
"val",
")",
":",
"self",
".",
"_err",
"(",
"'Expected not <NaN>, but was.'",
")"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_inf | Asserts that val is real number and Inf (infinity). | assertpy/assertpy.py | def is_inf(self):
"""Asserts that val is real number and Inf (infinity)."""
self._validate_number()
self._validate_real()
if not math.isinf(self.val):
self._err('Expected <%s> to be <Inf>, but was not.' % self.val)
return self | def is_inf(self):
"""Asserts that val is real number and Inf (infinity)."""
self._validate_number()
self._validate_real()
if not math.isinf(self.val):
self._err('Expected <%s> to be <Inf>, but was not.' % self.val)
return self | [
"Asserts",
"that",
"val",
"is",
"real",
"number",
"and",
"Inf",
"(",
"infinity",
")",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L443-L449 | [
"def",
"is_inf",
"(",
"self",
")",
":",
"self",
".",
"_validate_number",
"(",
")",
"self",
".",
"_validate_real",
"(",
")",
"if",
"not",
"math",
".",
"isinf",
"(",
"self",
".",
"val",
")",
":",
"self",
".",
"_err",
"(",
"'Expected <%s> to be <Inf>, but w... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_not_inf | Asserts that val is real number and not Inf (infinity). | assertpy/assertpy.py | def is_not_inf(self):
"""Asserts that val is real number and not Inf (infinity)."""
self._validate_number()
self._validate_real()
if math.isinf(self.val):
self._err('Expected not <Inf>, but was.')
return self | def is_not_inf(self):
"""Asserts that val is real number and not Inf (infinity)."""
self._validate_number()
self._validate_real()
if math.isinf(self.val):
self._err('Expected not <Inf>, but was.')
return self | [
"Asserts",
"that",
"val",
"is",
"real",
"number",
"and",
"not",
"Inf",
"(",
"infinity",
")",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L451-L457 | [
"def",
"is_not_inf",
"(",
"self",
")",
":",
"self",
".",
"_validate_number",
"(",
")",
"self",
".",
"_validate_real",
"(",
")",
"if",
"math",
".",
"isinf",
"(",
"self",
".",
"val",
")",
":",
"self",
".",
"_err",
"(",
"'Expected not <Inf>, but was.'",
")"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_less_than | Asserts that val is numeric and is less than other. | assertpy/assertpy.py | def is_less_than(self, other):
"""Asserts that val is numeric and is less than other."""
self._validate_compareable(other)
if self.val >= other:
if type(self.val) is datetime.datetime:
self._err('Expected <%s> to be less than <%s>, but was not.' % (self.val.strftime('... | def is_less_than(self, other):
"""Asserts that val is numeric and is less than other."""
self._validate_compareable(other)
if self.val >= other:
if type(self.val) is datetime.datetime:
self._err('Expected <%s> to be less than <%s>, but was not.' % (self.val.strftime('... | [
"Asserts",
"that",
"val",
"is",
"numeric",
"and",
"is",
"less",
"than",
"other",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L479-L487 | [
"def",
"is_less_than",
"(",
"self",
",",
"other",
")",
":",
"self",
".",
"_validate_compareable",
"(",
"other",
")",
"if",
"self",
".",
"val",
">=",
"other",
":",
"if",
"type",
"(",
"self",
".",
"val",
")",
"is",
"datetime",
".",
"datetime",
":",
"se... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_between | Asserts that val is numeric and is between low and high. | assertpy/assertpy.py | def is_between(self, low, high):
"""Asserts that val is numeric and is between low and high."""
val_type = type(self.val)
self._validate_between_args(val_type, low, high)
if self.val < low or self.val > high:
if val_type is datetime.datetime:
self._err('Expec... | def is_between(self, low, high):
"""Asserts that val is numeric and is between low and high."""
val_type = type(self.val)
self._validate_between_args(val_type, low, high)
if self.val < low or self.val > high:
if val_type is datetime.datetime:
self._err('Expec... | [
"Asserts",
"that",
"val",
"is",
"numeric",
"and",
"is",
"between",
"low",
"and",
"high",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L507-L517 | [
"def",
"is_between",
"(",
"self",
",",
"low",
",",
"high",
")",
":",
"val_type",
"=",
"type",
"(",
"self",
".",
"val",
")",
"self",
".",
"_validate_between_args",
"(",
"val_type",
",",
"low",
",",
"high",
")",
"if",
"self",
".",
"val",
"<",
"low",
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_close_to | Asserts that val is numeric and is close to other within tolerance. | assertpy/assertpy.py | def is_close_to(self, other, tolerance):
"""Asserts that val is numeric and is close to other within tolerance."""
self._validate_close_to_args(self.val, other, tolerance)
if self.val < (other-tolerance) or self.val > (other+tolerance):
if type(self.val) is datetime.datetime:
... | def is_close_to(self, other, tolerance):
"""Asserts that val is numeric and is close to other within tolerance."""
self._validate_close_to_args(self.val, other, tolerance)
if self.val < (other-tolerance) or self.val > (other+tolerance):
if type(self.val) is datetime.datetime:
... | [
"Asserts",
"that",
"val",
"is",
"numeric",
"and",
"is",
"close",
"to",
"other",
"within",
"tolerance",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L531-L543 | [
"def",
"is_close_to",
"(",
"self",
",",
"other",
",",
"tolerance",
")",
":",
"self",
".",
"_validate_close_to_args",
"(",
"self",
".",
"val",
",",
"other",
",",
"tolerance",
")",
"if",
"self",
".",
"val",
"<",
"(",
"other",
"-",
"tolerance",
")",
"or",... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_equal_to_ignoring_case | Asserts that val is case-insensitive equal to other. | assertpy/assertpy.py | def is_equal_to_ignoring_case(self, other):
"""Asserts that val is case-insensitive equal to other."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if not isinstance(other, str_types):
raise TypeError('given arg must be a string')
... | def is_equal_to_ignoring_case(self, other):
"""Asserts that val is case-insensitive equal to other."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if not isinstance(other, str_types):
raise TypeError('given arg must be a string')
... | [
"Asserts",
"that",
"val",
"is",
"case",
"-",
"insensitive",
"equal",
"to",
"other",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L560-L568 | [
"def",
"is_equal_to_ignoring_case",
"(",
"self",
",",
"other",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"raise",
"TypeError",
"(",
"'val is not a string'",
")",
"if",
"not",
"isinstance",
"(",
"other",
",",
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.contains_ignoring_case | Asserts that val is string and contains the given item or items. | assertpy/assertpy.py | def contains_ignoring_case(self, *items):
"""Asserts that val is string and contains the given item or items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
if isinstance(self.val, str_types):
if len(items) == 1:
if not isinstanc... | def contains_ignoring_case(self, *items):
"""Asserts that val is string and contains the given item or items."""
if len(items) == 0:
raise ValueError('one or more args must be given')
if isinstance(self.val, str_types):
if len(items) == 1:
if not isinstanc... | [
"Asserts",
"that",
"val",
"is",
"string",
"and",
"contains",
"the",
"given",
"item",
"or",
"items",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L570-L607 | [
"def",
"contains_ignoring_case",
"(",
"self",
",",
"*",
"items",
")",
":",
"if",
"len",
"(",
"items",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'one or more args must be given'",
")",
"if",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.starts_with | Asserts that val is string or iterable and starts with prefix. | assertpy/assertpy.py | def starts_with(self, prefix):
"""Asserts that val is string or iterable and starts with prefix."""
if prefix is None:
raise TypeError('given prefix arg must not be none')
if isinstance(self.val, str_types):
if not isinstance(prefix, str_types):
raise Type... | def starts_with(self, prefix):
"""Asserts that val is string or iterable and starts with prefix."""
if prefix is None:
raise TypeError('given prefix arg must not be none')
if isinstance(self.val, str_types):
if not isinstance(prefix, str_types):
raise Type... | [
"Asserts",
"that",
"val",
"is",
"string",
"or",
"iterable",
"and",
"starts",
"with",
"prefix",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L609-L628 | [
"def",
"starts_with",
"(",
"self",
",",
"prefix",
")",
":",
"if",
"prefix",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'given prefix arg must not be none'",
")",
"if",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"if",
"not",
"isi... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.ends_with | Asserts that val is string or iterable and ends with suffix. | assertpy/assertpy.py | def ends_with(self, suffix):
"""Asserts that val is string or iterable and ends with suffix."""
if suffix is None:
raise TypeError('given suffix arg must not be none')
if isinstance(self.val, str_types):
if not isinstance(suffix, str_types):
raise TypeErro... | def ends_with(self, suffix):
"""Asserts that val is string or iterable and ends with suffix."""
if suffix is None:
raise TypeError('given suffix arg must not be none')
if isinstance(self.val, str_types):
if not isinstance(suffix, str_types):
raise TypeErro... | [
"Asserts",
"that",
"val",
"is",
"string",
"or",
"iterable",
"and",
"ends",
"with",
"suffix",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L630-L651 | [
"def",
"ends_with",
"(",
"self",
",",
"suffix",
")",
":",
"if",
"suffix",
"is",
"None",
":",
"raise",
"TypeError",
"(",
"'given suffix arg must not be none'",
")",
"if",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"if",
"not",
"isins... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.matches | Asserts that val is string and matches regex pattern. | assertpy/assertpy.py | def matches(self, pattern):
"""Asserts that val is string and matches regex pattern."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if not isinstance(pattern, str_types):
raise TypeError('given pattern arg must be a string')
if l... | def matches(self, pattern):
"""Asserts that val is string and matches regex pattern."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if not isinstance(pattern, str_types):
raise TypeError('given pattern arg must be a string')
if l... | [
"Asserts",
"that",
"val",
"is",
"string",
"and",
"matches",
"regex",
"pattern",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L653-L663 | [
"def",
"matches",
"(",
"self",
",",
"pattern",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"raise",
"TypeError",
"(",
"'val is not a string'",
")",
"if",
"not",
"isinstance",
"(",
"pattern",
",",
"str_types",
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_alpha | Asserts that val is non-empty string and all characters are alphabetic. | assertpy/assertpy.py | def is_alpha(self):
"""Asserts that val is non-empty string and all characters are alphabetic."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if len(self.val) == 0:
raise ValueError('val is empty')
if not self.val.isalpha():
... | def is_alpha(self):
"""Asserts that val is non-empty string and all characters are alphabetic."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if len(self.val) == 0:
raise ValueError('val is empty')
if not self.val.isalpha():
... | [
"Asserts",
"that",
"val",
"is",
"non",
"-",
"empty",
"string",
"and",
"all",
"characters",
"are",
"alphabetic",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L677-L685 | [
"def",
"is_alpha",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"raise",
"TypeError",
"(",
"'val is not a string'",
")",
"if",
"len",
"(",
"self",
".",
"val",
")",
"==",
"0",
":",
"raise",
"Va... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_digit | Asserts that val is non-empty string and all characters are digits. | assertpy/assertpy.py | def is_digit(self):
"""Asserts that val is non-empty string and all characters are digits."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if len(self.val) == 0:
raise ValueError('val is empty')
if not self.val.isdigit():
... | def is_digit(self):
"""Asserts that val is non-empty string and all characters are digits."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if len(self.val) == 0:
raise ValueError('val is empty')
if not self.val.isdigit():
... | [
"Asserts",
"that",
"val",
"is",
"non",
"-",
"empty",
"string",
"and",
"all",
"characters",
"are",
"digits",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L687-L695 | [
"def",
"is_digit",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"raise",
"TypeError",
"(",
"'val is not a string'",
")",
"if",
"len",
"(",
"self",
".",
"val",
")",
"==",
"0",
":",
"raise",
"Va... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_lower | Asserts that val is non-empty string and all characters are lowercase. | assertpy/assertpy.py | def is_lower(self):
"""Asserts that val is non-empty string and all characters are lowercase."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if len(self.val) == 0:
raise ValueError('val is empty')
if self.val != self.val.lower():... | def is_lower(self):
"""Asserts that val is non-empty string and all characters are lowercase."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if len(self.val) == 0:
raise ValueError('val is empty')
if self.val != self.val.lower():... | [
"Asserts",
"that",
"val",
"is",
"non",
"-",
"empty",
"string",
"and",
"all",
"characters",
"are",
"lowercase",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L697-L705 | [
"def",
"is_lower",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"raise",
"TypeError",
"(",
"'val is not a string'",
")",
"if",
"len",
"(",
"self",
".",
"val",
")",
"==",
"0",
":",
"raise",
"Va... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_upper | Asserts that val is non-empty string and all characters are uppercase. | assertpy/assertpy.py | def is_upper(self):
"""Asserts that val is non-empty string and all characters are uppercase."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if len(self.val) == 0:
raise ValueError('val is empty')
if self.val != self.val.upper():... | def is_upper(self):
"""Asserts that val is non-empty string and all characters are uppercase."""
if not isinstance(self.val, str_types):
raise TypeError('val is not a string')
if len(self.val) == 0:
raise ValueError('val is empty')
if self.val != self.val.upper():... | [
"Asserts",
"that",
"val",
"is",
"non",
"-",
"empty",
"string",
"and",
"all",
"characters",
"are",
"uppercase",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L707-L715 | [
"def",
"is_upper",
"(",
"self",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"val",
",",
"str_types",
")",
":",
"raise",
"TypeError",
"(",
"'val is not a string'",
")",
"if",
"len",
"(",
"self",
".",
"val",
")",
"==",
"0",
":",
"raise",
"Va... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_unicode | Asserts that val is a unicode string. | assertpy/assertpy.py | def is_unicode(self):
"""Asserts that val is a unicode string."""
if type(self.val) is not unicode:
self._err('Expected <%s> to be unicode, but was <%s>.' % (self.val, type(self.val).__name__))
return self | def is_unicode(self):
"""Asserts that val is a unicode string."""
if type(self.val) is not unicode:
self._err('Expected <%s> to be unicode, but was <%s>.' % (self.val, type(self.val).__name__))
return self | [
"Asserts",
"that",
"val",
"is",
"a",
"unicode",
"string",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L717-L721 | [
"def",
"is_unicode",
"(",
"self",
")",
":",
"if",
"type",
"(",
"self",
".",
"val",
")",
"is",
"not",
"unicode",
":",
"self",
".",
"_err",
"(",
"'Expected <%s> to be unicode, but was <%s>.'",
"%",
"(",
"self",
".",
"val",
",",
"type",
"(",
"self",
".",
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.is_subset_of | Asserts that val is iterable and a subset of the given superset or flattened superset if multiple supersets are given. | assertpy/assertpy.py | def is_subset_of(self, *supersets):
"""Asserts that val is iterable and a subset of the given superset or flattened superset if multiple supersets are given."""
if not isinstance(self.val, Iterable):
raise TypeError('val is not iterable')
if len(supersets) == 0:
raise Val... | def is_subset_of(self, *supersets):
"""Asserts that val is iterable and a subset of the given superset or flattened superset if multiple supersets are given."""
if not isinstance(self.val, Iterable):
raise TypeError('val is not iterable')
if len(supersets) == 0:
raise Val... | [
"Asserts",
"that",
"val",
"is",
"iterable",
"and",
"a",
"subset",
"of",
"the",
"given",
"superset",
"or",
"flattened",
"superset",
"if",
"multiple",
"supersets",
"are",
"given",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L736-L775 | [
"def",
"is_subset_of",
"(",
"self",
",",
"*",
"supersets",
")",
":",
"if",
"not",
"isinstance",
"(",
"self",
".",
"val",
",",
"Iterable",
")",
":",
"raise",
"TypeError",
"(",
"'val is not iterable'",
")",
"if",
"len",
"(",
"supersets",
")",
"==",
"0",
... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.contains_key | Asserts the val is a dict and contains the given key or keys. Alias for contains(). | assertpy/assertpy.py | def contains_key(self, *keys):
"""Asserts the val is a dict and contains the given key or keys. Alias for contains()."""
self._check_dict_like(self.val, check_values=False, check_getitem=False)
return self.contains(*keys) | def contains_key(self, *keys):
"""Asserts the val is a dict and contains the given key or keys. Alias for contains()."""
self._check_dict_like(self.val, check_values=False, check_getitem=False)
return self.contains(*keys) | [
"Asserts",
"the",
"val",
"is",
"a",
"dict",
"and",
"contains",
"the",
"given",
"key",
"or",
"keys",
".",
"Alias",
"for",
"contains",
"()",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L778-L781 | [
"def",
"contains_key",
"(",
"self",
",",
"*",
"keys",
")",
":",
"self",
".",
"_check_dict_like",
"(",
"self",
".",
"val",
",",
"check_values",
"=",
"False",
",",
"check_getitem",
"=",
"False",
")",
"return",
"self",
".",
"contains",
"(",
"*",
"keys",
"... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.does_not_contain_key | Asserts the val is a dict and does not contain the given key or keys. Alias for does_not_contain(). | assertpy/assertpy.py | def does_not_contain_key(self, *keys):
"""Asserts the val is a dict and does not contain the given key or keys. Alias for does_not_contain()."""
self._check_dict_like(self.val, check_values=False, check_getitem=False)
return self.does_not_contain(*keys) | def does_not_contain_key(self, *keys):
"""Asserts the val is a dict and does not contain the given key or keys. Alias for does_not_contain()."""
self._check_dict_like(self.val, check_values=False, check_getitem=False)
return self.does_not_contain(*keys) | [
"Asserts",
"the",
"val",
"is",
"a",
"dict",
"and",
"does",
"not",
"contain",
"the",
"given",
"key",
"or",
"keys",
".",
"Alias",
"for",
"does_not_contain",
"()",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L783-L786 | [
"def",
"does_not_contain_key",
"(",
"self",
",",
"*",
"keys",
")",
":",
"self",
".",
"_check_dict_like",
"(",
"self",
".",
"val",
",",
"check_values",
"=",
"False",
",",
"check_getitem",
"=",
"False",
")",
"return",
"self",
".",
"does_not_contain",
"(",
"*... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
valid | AssertionBuilder.contains_value | Asserts that val is a dict and contains the given value or values. | assertpy/assertpy.py | def contains_value(self, *values):
"""Asserts that val is a dict and contains the given value or values."""
self._check_dict_like(self.val, check_getitem=False)
if len(values) == 0:
raise ValueError('one or more value args must be given')
missing = []
for v in values:... | def contains_value(self, *values):
"""Asserts that val is a dict and contains the given value or values."""
self._check_dict_like(self.val, check_getitem=False)
if len(values) == 0:
raise ValueError('one or more value args must be given')
missing = []
for v in values:... | [
"Asserts",
"that",
"val",
"is",
"a",
"dict",
"and",
"contains",
"the",
"given",
"value",
"or",
"values",
"."
] | ActivisionGameScience/assertpy | python | https://github.com/ActivisionGameScience/assertpy/blob/08d799cdb01f9a25d3e20672efac991c7bc26d79/assertpy/assertpy.py#L788-L799 | [
"def",
"contains_value",
"(",
"self",
",",
"*",
"values",
")",
":",
"self",
".",
"_check_dict_like",
"(",
"self",
".",
"val",
",",
"check_getitem",
"=",
"False",
")",
"if",
"len",
"(",
"values",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"'one or... | 08d799cdb01f9a25d3e20672efac991c7bc26d79 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.