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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | RequestBuilder.with_headers | Adds headers to the request
Args:
headers (dict): The headers to add the request headers
Returns:
The request builder instance in order to chain calls | hbp_service_client/request/request_builder.py | def with_headers(self, headers):
'''Adds headers to the request
Args:
headers (dict): The headers to add the request headers
Returns:
The request builder instance in order to chain calls
'''
copy = headers.copy()
copy.update(self._headers)
... | def with_headers(self, headers):
'''Adds headers to the request
Args:
headers (dict): The headers to add the request headers
Returns:
The request builder instance in order to chain calls
'''
copy = headers.copy()
copy.update(self._headers)
... | [
"Adds",
"headers",
"to",
"the",
"request"
] | HumanBrainProject/hbp-service-client | python | https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/request/request_builder.py#L115-L126 | [
"def",
"with_headers",
"(",
"self",
",",
"headers",
")",
":",
"copy",
"=",
"headers",
".",
"copy",
"(",
")",
"copy",
".",
"update",
"(",
"self",
".",
"_headers",
")",
"return",
"self",
".",
"__copy_and_set",
"(",
"'headers'",
",",
"copy",
")"
] | b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d |
test | RequestBuilder.with_params | Adds parameters to the request params
Args:
params (dict): The parameters to add to the request params
Returns:
The request builder instance in order to chain calls | hbp_service_client/request/request_builder.py | def with_params(self, params):
'''Adds parameters to the request params
Args:
params (dict): The parameters to add to the request params
Returns:
The request builder instance in order to chain calls
'''
copy = params.copy()
copy.update(self._para... | def with_params(self, params):
'''Adds parameters to the request params
Args:
params (dict): The parameters to add to the request params
Returns:
The request builder instance in order to chain calls
'''
copy = params.copy()
copy.update(self._para... | [
"Adds",
"parameters",
"to",
"the",
"request",
"params"
] | HumanBrainProject/hbp-service-client | python | https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/request/request_builder.py#L139-L150 | [
"def",
"with_params",
"(",
"self",
",",
"params",
")",
":",
"copy",
"=",
"params",
".",
"copy",
"(",
")",
"copy",
".",
"update",
"(",
"self",
".",
"_params",
")",
"return",
"self",
".",
"__copy_and_set",
"(",
"'params'",
",",
"copy",
")"
] | b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d |
test | RequestBuilder.throw | Defines if the an exception should be thrown after the request is sent
Args:
exception_class (class): The class of the exception to instantiate
should_throw (function): The predicate that should indicate if the exception
should be thrown. This function will be called wit... | hbp_service_client/request/request_builder.py | def throw(self, exception_class, should_throw):
'''Defines if the an exception should be thrown after the request is sent
Args:
exception_class (class): The class of the exception to instantiate
should_throw (function): The predicate that should indicate if the exception
... | def throw(self, exception_class, should_throw):
'''Defines if the an exception should be thrown after the request is sent
Args:
exception_class (class): The class of the exception to instantiate
should_throw (function): The predicate that should indicate if the exception
... | [
"Defines",
"if",
"the",
"an",
"exception",
"should",
"be",
"thrown",
"after",
"the",
"request",
"is",
"sent"
] | HumanBrainProject/hbp-service-client | python | https://github.com/HumanBrainProject/hbp-service-client/blob/b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d/hbp_service_client/request/request_builder.py#L191-L202 | [
"def",
"throw",
"(",
"self",
",",
"exception_class",
",",
"should_throw",
")",
":",
"return",
"self",
".",
"__copy_and_set",
"(",
"'throws'",
",",
"self",
".",
"_throws",
"+",
"[",
"(",
"exception_class",
",",
"should_throw",
")",
"]",
")"
] | b338fb41a7f0e7b9d654ff28fcf13a56d03bff4d |
test | run_command | Run the command, piping stderr to stdout.
Sends output to stdout.
:param cmd: The list for args to pass to the process | docker_runner/application_runner.py | def run_command(cmd):
"""
Run the command, piping stderr to stdout.
Sends output to stdout.
:param cmd: The list for args to pass to the process
"""
try:
process = subprocess.Popen(
cmd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr... | def run_command(cmd):
"""
Run the command, piping stderr to stdout.
Sends output to stdout.
:param cmd: The list for args to pass to the process
"""
try:
process = subprocess.Popen(
cmd,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr... | [
"Run",
"the",
"command",
"piping",
"stderr",
"to",
"stdout",
".",
"Sends",
"output",
"to",
"stdout",
".",
":",
"param",
"cmd",
":",
"The",
"list",
"for",
"args",
"to",
"pass",
"to",
"the",
"process"
] | TDG-Platform/cloud-harness | python | https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/docker_runner/application_runner.py#L38-L54 | [
"def",
"run_command",
"(",
"cmd",
")",
":",
"try",
":",
"process",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"stdin",
"=",
"subprocess",
".",
"PIPE",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"STDOUT"... | 1d8f972f861816b90785a484e9bec5bd4bc2f569 |
test | extract_source | Extract the source bundle
:param bundle_path: path to the aource bundle *.tar.gz
:param source_path: path to location where to extractall | docker_runner/application_runner.py | def extract_source(bundle_path, source_path):
"""
Extract the source bundle
:param bundle_path: path to the aource bundle *.tar.gz
:param source_path: path to location where to extractall
"""
with tarfile.open(bundle_path, 'r:gz') as tf:
tf.extractall(path=source_path)
logger.debug("... | def extract_source(bundle_path, source_path):
"""
Extract the source bundle
:param bundle_path: path to the aource bundle *.tar.gz
:param source_path: path to location where to extractall
"""
with tarfile.open(bundle_path, 'r:gz') as tf:
tf.extractall(path=source_path)
logger.debug("... | [
"Extract",
"the",
"source",
"bundle",
":",
"param",
"bundle_path",
":",
"path",
"to",
"the",
"aource",
"bundle",
"*",
".",
"tar",
".",
"gz",
":",
"param",
"source_path",
":",
"path",
"to",
"location",
"where",
"to",
"extractall"
] | TDG-Platform/cloud-harness | python | https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/docker_runner/application_runner.py#L57-L65 | [
"def",
"extract_source",
"(",
"bundle_path",
",",
"source_path",
")",
":",
"with",
"tarfile",
".",
"open",
"(",
"bundle_path",
",",
"'r:gz'",
")",
"as",
"tf",
":",
"tf",
".",
"extractall",
"(",
"path",
"=",
"source_path",
")",
"logger",
".",
"debug",
"("... | 1d8f972f861816b90785a484e9bec5bd4bc2f569 |
test | printer | response is json or straight text.
:param data:
:return: | gbdx_cloud_harness/utils/printer.py | def printer(data):
"""
response is json or straight text.
:param data:
:return:
"""
data = str(data) # Get rid of unicode
if not isinstance(data, str):
output = json.dumps(
data,
sort_keys=True,
indent=4,
separators=(',', ': ')
... | def printer(data):
"""
response is json or straight text.
:param data:
:return:
"""
data = str(data) # Get rid of unicode
if not isinstance(data, str):
output = json.dumps(
data,
sort_keys=True,
indent=4,
separators=(',', ': ')
... | [
"response",
"is",
"json",
"or",
"straight",
"text",
".",
":",
"param",
"data",
":",
":",
"return",
":"
] | TDG-Platform/cloud-harness | python | https://github.com/TDG-Platform/cloud-harness/blob/1d8f972f861816b90785a484e9bec5bd4bc2f569/gbdx_cloud_harness/utils/printer.py#L5-L27 | [
"def",
"printer",
"(",
"data",
")",
":",
"data",
"=",
"str",
"(",
"data",
")",
"# Get rid of unicode",
"if",
"not",
"isinstance",
"(",
"data",
",",
"str",
")",
":",
"output",
"=",
"json",
".",
"dumps",
"(",
"data",
",",
"sort_keys",
"=",
"True",
",",... | 1d8f972f861816b90785a484e9bec5bd4bc2f569 |
test | AdminBooleanMixin.get_list_display | Return a sequence containing the fields to be displayed on the
changelist. | boolean_switch/admin.py | def get_list_display(self, request):
"""
Return a sequence containing the fields to be displayed on the
changelist.
"""
list_display = []
for field_name in self.list_display:
try:
db_field = self.model._meta.get_field(field_name)
... | def get_list_display(self, request):
"""
Return a sequence containing the fields to be displayed on the
changelist.
"""
list_display = []
for field_name in self.list_display:
try:
db_field = self.model._meta.get_field(field_name)
... | [
"Return",
"a",
"sequence",
"containing",
"the",
"fields",
"to",
"be",
"displayed",
"on",
"the",
"changelist",
"."
] | makeev/django-boolean-switch | python | https://github.com/makeev/django-boolean-switch/blob/ed740dbb56d0bb1ad20d4b1e124055283b0e932f/boolean_switch/admin.py#L44-L58 | [
"def",
"get_list_display",
"(",
"self",
",",
"request",
")",
":",
"list_display",
"=",
"[",
"]",
"for",
"field_name",
"in",
"self",
".",
"list_display",
":",
"try",
":",
"db_field",
"=",
"self",
".",
"model",
".",
"_meta",
".",
"get_field",
"(",
"field_n... | ed740dbb56d0bb1ad20d4b1e124055283b0e932f |
test | map_job | Spawns a tree of jobs to avoid overloading the number of jobs spawned by a single parent.
This function is appropriate to use when batching samples greater than 1,000.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param function func: Function to spawn dynamically, passes one sample as f... | src/toil_lib/jobs.py | def map_job(job, func, inputs, *args):
"""
Spawns a tree of jobs to avoid overloading the number of jobs spawned by a single parent.
This function is appropriate to use when batching samples greater than 1,000.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param function func: Fu... | def map_job(job, func, inputs, *args):
"""
Spawns a tree of jobs to avoid overloading the number of jobs spawned by a single parent.
This function is appropriate to use when batching samples greater than 1,000.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param function func: Fu... | [
"Spawns",
"a",
"tree",
"of",
"jobs",
"to",
"avoid",
"overloading",
"the",
"number",
"of",
"jobs",
"spawned",
"by",
"a",
"single",
"parent",
".",
"This",
"function",
"is",
"appropriate",
"to",
"use",
"when",
"batching",
"samples",
"greater",
"than",
"1",
"0... | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/jobs.py#L4-L23 | [
"def",
"map_job",
"(",
"job",
",",
"func",
",",
"inputs",
",",
"*",
"args",
")",
":",
"# num_partitions isn't exposed as an argument in order to be transparent to the user.",
"# The value for num_partitions is a tested value",
"num_partitions",
"=",
"100",
"partition_size",
"="... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | gatk_genotype_gvcfs | Runs GenotypeGVCFs on one or more gVCFs generated by HaplotypeCaller.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict gvcfs: Dictionary of GVCF FileStoreIDs {sample identifier: FileStoreID}
:param str ref: FileStoreID for the reference genome fasta file
:param str fai: FileS... | src/toil_lib/tools/variant_annotation.py | def gatk_genotype_gvcfs(job,
gvcfs,
ref, fai, ref_dict,
annotations=None,
emit_threshold=10.0, call_threshold=30.0,
unsafe_mode=False):
"""
Runs GenotypeGVCFs on one or more gVCFs generated by... | def gatk_genotype_gvcfs(job,
gvcfs,
ref, fai, ref_dict,
annotations=None,
emit_threshold=10.0, call_threshold=30.0,
unsafe_mode=False):
"""
Runs GenotypeGVCFs on one or more gVCFs generated by... | [
"Runs",
"GenotypeGVCFs",
"on",
"one",
"or",
"more",
"gVCFs",
"generated",
"by",
"HaplotypeCaller",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_annotation.py#L7-L72 | [
"def",
"gatk_genotype_gvcfs",
"(",
"job",
",",
"gvcfs",
",",
"ref",
",",
"fai",
",",
"ref_dict",
",",
"annotations",
"=",
"None",
",",
"emit_threshold",
"=",
"10.0",
",",
"call_threshold",
"=",
"30.0",
",",
"unsafe_mode",
"=",
"False",
")",
":",
"inputs",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_oncotator | Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept
other genome builds, but the output VCF is based on hg19.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str vcf_id: FileStoreID for VCF file
:param str oncotator_db: FileStoreID for On... | src/toil_lib/tools/variant_annotation.py | def run_oncotator(job, vcf_id, oncotator_db):
"""
Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept
other genome builds, but the output VCF is based on hg19.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str vcf_id: FileStoreID fo... | def run_oncotator(job, vcf_id, oncotator_db):
"""
Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept
other genome builds, but the output VCF is based on hg19.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str vcf_id: FileStoreID fo... | [
"Uses",
"Oncotator",
"to",
"add",
"cancer",
"relevant",
"variant",
"annotations",
"to",
"a",
"VCF",
"file",
".",
"Oncotator",
"can",
"accept",
"other",
"genome",
"builds",
"but",
"the",
"output",
"VCF",
"is",
"based",
"on",
"hg19",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_annotation.py#L75-L117 | [
"def",
"run_oncotator",
"(",
"job",
",",
"vcf_id",
",",
"oncotator_db",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running Oncotator'",
")",
"inputs",
"=",
"{",
"'input.vcf'",
":",
"vcf_id",
",",
"'oncotator_db'",
":",
"oncotator_db",
"}",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | DatapointArray.sort | Sort here works by sorting by timestamp by default | connectordb/_datapointarray.py | def sort(self, f=lambda d: d["t"]):
"""Sort here works by sorting by timestamp by default"""
list.sort(self, key=f)
return self | def sort(self, f=lambda d: d["t"]):
"""Sort here works by sorting by timestamp by default"""
list.sort(self, key=f)
return self | [
"Sort",
"here",
"works",
"by",
"sorting",
"by",
"timestamp",
"by",
"default"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L41-L44 | [
"def",
"sort",
"(",
"self",
",",
"f",
"=",
"lambda",
"d",
":",
"d",
"[",
"\"t\"",
"]",
")",
":",
"list",
".",
"sort",
"(",
"self",
",",
"key",
"=",
"f",
")",
"return",
"self"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatapointArray.t | Returns just the timestamp portion of the datapoints as a list.
The timestamps are in python datetime's date format. | connectordb/_datapointarray.py | def t(self):
"""Returns just the timestamp portion of the datapoints as a list.
The timestamps are in python datetime's date format."""
return list(map(lambda x: datetime.datetime.fromtimestamp(x["t"]), self.raw())) | def t(self):
"""Returns just the timestamp portion of the datapoints as a list.
The timestamps are in python datetime's date format."""
return list(map(lambda x: datetime.datetime.fromtimestamp(x["t"]), self.raw())) | [
"Returns",
"just",
"the",
"timestamp",
"portion",
"of",
"the",
"datapoints",
"as",
"a",
"list",
".",
"The",
"timestamps",
"are",
"in",
"python",
"datetime",
"s",
"date",
"format",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L50-L53 | [
"def",
"t",
"(",
"self",
")",
":",
"return",
"list",
"(",
"map",
"(",
"lambda",
"x",
":",
"datetime",
".",
"datetime",
".",
"fromtimestamp",
"(",
"x",
"[",
"\"t\"",
"]",
")",
",",
"self",
".",
"raw",
"(",
")",
")",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatapointArray.writeJSON | Writes the data to the given file::
DatapointArray([{"t": unix timestamp, "d": data}]).writeJSON("myfile.json")
The data can later be loaded using loadJSON. | connectordb/_datapointarray.py | def writeJSON(self, filename):
"""Writes the data to the given file::
DatapointArray([{"t": unix timestamp, "d": data}]).writeJSON("myfile.json")
The data can later be loaded using loadJSON.
"""
with open(filename, "w") as f:
json.dump(self, f) | def writeJSON(self, filename):
"""Writes the data to the given file::
DatapointArray([{"t": unix timestamp, "d": data}]).writeJSON("myfile.json")
The data can later be loaded using loadJSON.
"""
with open(filename, "w") as f:
json.dump(self, f) | [
"Writes",
"the",
"data",
"to",
"the",
"given",
"file",
"::"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L76-L84 | [
"def",
"writeJSON",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"w\"",
")",
"as",
"f",
":",
"json",
".",
"dump",
"(",
"self",
",",
"f",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatapointArray.loadJSON | Adds the data from a JSON file. The file is expected to be in datapoint format::
d = DatapointArray().loadJSON("myfile.json") | connectordb/_datapointarray.py | def loadJSON(self, filename):
"""Adds the data from a JSON file. The file is expected to be in datapoint format::
d = DatapointArray().loadJSON("myfile.json")
"""
with open(filename, "r") as f:
self.merge(json.load(f))
return self | def loadJSON(self, filename):
"""Adds the data from a JSON file. The file is expected to be in datapoint format::
d = DatapointArray().loadJSON("myfile.json")
"""
with open(filename, "r") as f:
self.merge(json.load(f))
return self | [
"Adds",
"the",
"data",
"from",
"a",
"JSON",
"file",
".",
"The",
"file",
"is",
"expected",
"to",
"be",
"in",
"datapoint",
"format",
"::"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L86-L93 | [
"def",
"loadJSON",
"(",
"self",
",",
"filename",
")",
":",
"with",
"open",
"(",
"filename",
",",
"\"r\"",
")",
"as",
"f",
":",
"self",
".",
"merge",
"(",
"json",
".",
"load",
"(",
"f",
")",
")",
"return",
"self"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatapointArray.loadExport | Adds the data from a ConnectorDB export. If it is a stream export, then the folder
is the location of the export. If it is a device export, then the folder is the export folder
with the stream name as a subdirectory
If it is a user export, you will use the path of the export folder, with the us... | connectordb/_datapointarray.py | def loadExport(self, folder):
"""Adds the data from a ConnectorDB export. If it is a stream export, then the folder
is the location of the export. If it is a device export, then the folder is the export folder
with the stream name as a subdirectory
If it is a user export, you will use t... | def loadExport(self, folder):
"""Adds the data from a ConnectorDB export. If it is a stream export, then the folder
is the location of the export. If it is a device export, then the folder is the export folder
with the stream name as a subdirectory
If it is a user export, you will use t... | [
"Adds",
"the",
"data",
"from",
"a",
"ConnectorDB",
"export",
".",
"If",
"it",
"is",
"a",
"stream",
"export",
"then",
"the",
"folder",
"is",
"the",
"location",
"of",
"the",
"export",
".",
"If",
"it",
"is",
"a",
"device",
"export",
"then",
"the",
"folder... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L95-L107 | [
"def",
"loadExport",
"(",
"self",
",",
"folder",
")",
":",
"self",
".",
"loadJSON",
"(",
"os",
".",
"path",
".",
"join",
"(",
"folder",
",",
"\"data.json\"",
")",
")",
"return",
"self"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatapointArray.tshift | Shifts all timestamps in the datapoint array by the given number of seconds.
It is the same as the 'tshift' pipescript transform.
Warning: The shift is performed in-place! This means that it modifies the underlying array::
d = DatapointArray([{"t":56,"d":1}])
d.tshift(20)
... | connectordb/_datapointarray.py | def tshift(self, t):
"""Shifts all timestamps in the datapoint array by the given number of seconds.
It is the same as the 'tshift' pipescript transform.
Warning: The shift is performed in-place! This means that it modifies the underlying array::
d = DatapointArray([{"t":56,"d":1}]... | def tshift(self, t):
"""Shifts all timestamps in the datapoint array by the given number of seconds.
It is the same as the 'tshift' pipescript transform.
Warning: The shift is performed in-place! This means that it modifies the underlying array::
d = DatapointArray([{"t":56,"d":1}]... | [
"Shifts",
"all",
"timestamps",
"in",
"the",
"datapoint",
"array",
"by",
"the",
"given",
"number",
"of",
"seconds",
".",
"It",
"is",
"the",
"same",
"as",
"the",
"tshift",
"pipescript",
"transform",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L109-L122 | [
"def",
"tshift",
"(",
"self",
",",
"t",
")",
":",
"raw",
"=",
"self",
".",
"raw",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"raw",
")",
")",
":",
"raw",
"[",
"i",
"]",
"[",
"\"t\"",
"]",
"+=",
"t",
"return",
"self"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatapointArray.sum | Gets the sum of the data portions of all datapoints within | connectordb/_datapointarray.py | def sum(self):
"""Gets the sum of the data portions of all datapoints within"""
raw = self.raw()
s = 0
for i in range(len(raw)):
s += raw[i]["d"]
return s | def sum(self):
"""Gets the sum of the data portions of all datapoints within"""
raw = self.raw()
s = 0
for i in range(len(raw)):
s += raw[i]["d"]
return s | [
"Gets",
"the",
"sum",
"of",
"the",
"data",
"portions",
"of",
"all",
"datapoints",
"within"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_datapointarray.py#L124-L130 | [
"def",
"sum",
"(",
"self",
")",
":",
"raw",
"=",
"self",
".",
"raw",
"(",
")",
"s",
"=",
"0",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"raw",
")",
")",
":",
"s",
"+=",
"raw",
"[",
"i",
"]",
"[",
"\"d\"",
"]",
"return",
"s"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | rfxcom | Start the event loop to collect data from the serial device. | home/__main__.py | def rfxcom(device):
"""Start the event loop to collect data from the serial device."""
# If the device isn't passed in, look for it in the config.
if device is None:
device = app.config.get('DEVICE')
# If the device is *still* none, error.
if device is None:
print("The serial devic... | def rfxcom(device):
"""Start the event loop to collect data from the serial device."""
# If the device isn't passed in, look for it in the config.
if device is None:
device = app.config.get('DEVICE')
# If the device is *still* none, error.
if device is None:
print("The serial devic... | [
"Start",
"the",
"event",
"loop",
"to",
"collect",
"data",
"from",
"the",
"serial",
"device",
"."
] | d0ugal/home | python | https://github.com/d0ugal/home/blob/e984716ae6c74dc8e40346584668ac5cfeaaf520/home/__main__.py#L31-L44 | [
"def",
"rfxcom",
"(",
"device",
")",
":",
"# If the device isn't passed in, look for it in the config.",
"if",
"device",
"is",
"None",
":",
"device",
"=",
"app",
".",
"config",
".",
"get",
"(",
"'DEVICE'",
")",
"# If the device is *still* none, error.",
"if",
"device"... | e984716ae6c74dc8e40346584668ac5cfeaaf520 |
test | create_user | Create a new user. | home/__main__.py | def create_user(username):
"Create a new user."
password = prompt_pass("Enter password")
user = User(username=username, password=password)
db.session.add(user)
db.session.commit() | def create_user(username):
"Create a new user."
password = prompt_pass("Enter password")
user = User(username=username, password=password)
db.session.add(user)
db.session.commit() | [
"Create",
"a",
"new",
"user",
"."
] | d0ugal/home | python | https://github.com/d0ugal/home/blob/e984716ae6c74dc8e40346584668ac5cfeaaf520/home/__main__.py#L55-L60 | [
"def",
"create_user",
"(",
"username",
")",
":",
"password",
"=",
"prompt_pass",
"(",
"\"Enter password\"",
")",
"user",
"=",
"User",
"(",
"username",
"=",
"username",
",",
"password",
"=",
"password",
")",
"db",
".",
"session",
".",
"add",
"(",
"user",
... | e984716ae6c74dc8e40346584668ac5cfeaaf520 |
test | to_iri | Safely quotes an IRI in a way that is resilient to unicode and incorrect
arguments (checks for RFC 3987 compliance and falls back to percent encoding) | iribaker/__init__.py | def to_iri(iri):
"""
Safely quotes an IRI in a way that is resilient to unicode and incorrect
arguments (checks for RFC 3987 compliance and falls back to percent encoding)
"""
# First decode the IRI if needed (python 2)
if sys.version_info[0] < 3:
if not isinstance(iri, unicode):
... | def to_iri(iri):
"""
Safely quotes an IRI in a way that is resilient to unicode and incorrect
arguments (checks for RFC 3987 compliance and falls back to percent encoding)
"""
# First decode the IRI if needed (python 2)
if sys.version_info[0] < 3:
if not isinstance(iri, unicode):
... | [
"Safely",
"quotes",
"an",
"IRI",
"in",
"a",
"way",
"that",
"is",
"resilient",
"to",
"unicode",
"and",
"incorrect",
"arguments",
"(",
"checks",
"for",
"RFC",
"3987",
"compliance",
"and",
"falls",
"back",
"to",
"percent",
"encoding",
")"
] | CLARIAH/iribaker | python | https://github.com/CLARIAH/iribaker/blob/47d2e8e95472353769962fde7626881f53429379/iribaker/__init__.py#L17-L81 | [
"def",
"to_iri",
"(",
"iri",
")",
":",
"# First decode the IRI if needed (python 2)",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
"<",
"3",
":",
"if",
"not",
"isinstance",
"(",
"iri",
",",
"unicode",
")",
":",
"logger",
".",
"debug",
"(",
"\"Convertin... | 47d2e8e95472353769962fde7626881f53429379 |
test | parse_vn_results | Parse Visual Novel search pages.
:param soup: The BS4 class object
:return: A list of dictionaries containing a name and id. | Shosetsu/Parsing.py | async def parse_vn_results(soup):
"""
Parse Visual Novel search pages.
:param soup: The BS4 class object
:return: A list of dictionaries containing a name and id.
"""
soup = soup.find_all('td', class_='tc1')
vns = []
for item in soup[1:]:
vns.append({'name': item.string, 'id': ... | async def parse_vn_results(soup):
"""
Parse Visual Novel search pages.
:param soup: The BS4 class object
:return: A list of dictionaries containing a name and id.
"""
soup = soup.find_all('td', class_='tc1')
vns = []
for item in soup[1:]:
vns.append({'name': item.string, 'id': ... | [
"Parse",
"Visual",
"Novel",
"search",
"pages",
"."
] | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L3-L14 | [
"async",
"def",
"parse_vn_results",
"(",
"soup",
")",
":",
"soup",
"=",
"soup",
".",
"find_all",
"(",
"'td'",
",",
"class_",
"=",
"'tc1'",
")",
"vns",
"=",
"[",
"]",
"for",
"item",
"in",
"soup",
"[",
"1",
":",
"]",
":",
"vns",
".",
"append",
"(",... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | parse_release_results | Parse Releases search pages.
:param soup: The BS4 class object
:return: A list of dictionaries containing a release dictionary. This is the same as the one returned in get_novel.
It contains a Date released, Platform, Ages group and Name. | Shosetsu/Parsing.py | async def parse_release_results(soup):
"""
Parse Releases search pages.
:param soup: The BS4 class object
:return: A list of dictionaries containing a release dictionary. This is the same as the one returned in get_novel.
It contains a Date released, Platform, Ages group and Name.
"""
... | async def parse_release_results(soup):
"""
Parse Releases search pages.
:param soup: The BS4 class object
:return: A list of dictionaries containing a release dictionary. This is the same as the one returned in get_novel.
It contains a Date released, Platform, Ages group and Name.
"""
... | [
"Parse",
"Releases",
"search",
"pages",
"."
] | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L16-L35 | [
"async",
"def",
"parse_release_results",
"(",
"soup",
")",
":",
"soup",
"=",
"list",
"(",
"soup",
".",
"find_all",
"(",
"'table'",
",",
"class_",
"=",
"'stripe'",
")",
"[",
"0",
"]",
".",
"children",
")",
"[",
"1",
":",
"]",
"releases",
"=",
"[",
"... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | parse_prod_staff_results | Parse a page of producer or staff results
:param soup: The BS4 class object
:return: A list of dictionaries containing a name and nationality. | Shosetsu/Parsing.py | async def parse_prod_staff_results(soup):
"""
Parse a page of producer or staff results
:param soup: The BS4 class object
:return: A list of dictionaries containing a name and nationality.
"""
soup = soup.find_all('li')
producers = []
for item in soup:
producers.append({'nationa... | async def parse_prod_staff_results(soup):
"""
Parse a page of producer or staff results
:param soup: The BS4 class object
:return: A list of dictionaries containing a name and nationality.
"""
soup = soup.find_all('li')
producers = []
for item in soup:
producers.append({'nationa... | [
"Parse",
"a",
"page",
"of",
"producer",
"or",
"staff",
"results"
] | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L37-L48 | [
"async",
"def",
"parse_prod_staff_results",
"(",
"soup",
")",
":",
"soup",
"=",
"soup",
".",
"find_all",
"(",
"'li'",
")",
"producers",
"=",
"[",
"]",
"for",
"item",
"in",
"soup",
":",
"producers",
".",
"append",
"(",
"{",
"'nationality'",
":",
"item",
... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | parse_character_results | Parse a page of character results.
:param soup: The BS4 class object
:return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair
for games they appeared in. | Shosetsu/Parsing.py | async def parse_character_results(soup):
"""
Parse a page of character results.
:param soup: The BS4 class object
:return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair
for games they appeared in.
"""
soup = list(so... | async def parse_character_results(soup):
"""
Parse a page of character results.
:param soup: The BS4 class object
:return: Returns a list of dictionaries containing a name, gender and list of dictionaries containing a game name/id pair
for games they appeared in.
"""
soup = list(so... | [
"Parse",
"a",
"page",
"of",
"character",
"results",
"."
] | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L50-L71 | [
"async",
"def",
"parse_character_results",
"(",
"soup",
")",
":",
"soup",
"=",
"list",
"(",
"soup",
".",
"find_all",
"(",
"'table'",
",",
"class_",
"=",
"'stripe'",
")",
"[",
"0",
"]",
".",
"children",
")",
"[",
"1",
":",
"]",
"characters",
"=",
"[",... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | parse_tag_results | Parse a page of tag or trait results. Same format.
:param soup: BS4 Class Object
:return: A list of tags, Nothing else really useful there | Shosetsu/Parsing.py | async def parse_tag_results(soup):
"""
Parse a page of tag or trait results. Same format.
:param soup: BS4 Class Object
:return: A list of tags, Nothing else really useful there
"""
soup = soup.find_all('td', class_='tc3')
tags = []
for item in soup:
tags.append(item.a.string)
... | async def parse_tag_results(soup):
"""
Parse a page of tag or trait results. Same format.
:param soup: BS4 Class Object
:return: A list of tags, Nothing else really useful there
"""
soup = soup.find_all('td', class_='tc3')
tags = []
for item in soup:
tags.append(item.a.string)
... | [
"Parse",
"a",
"page",
"of",
"tag",
"or",
"trait",
"results",
".",
"Same",
"format",
"."
] | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L73-L84 | [
"async",
"def",
"parse_tag_results",
"(",
"soup",
")",
":",
"soup",
"=",
"soup",
".",
"find_all",
"(",
"'td'",
",",
"class_",
"=",
"'tc3'",
")",
"tags",
"=",
"[",
"]",
"for",
"item",
"in",
"soup",
":",
"tags",
".",
"append",
"(",
"item",
".",
"a",
... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | parse_user_results | Parse a page of user results
:param soup: Bs4 Class object
:return: A list of dictionaries containing a name and join date | Shosetsu/Parsing.py | async def parse_user_results(soup):
"""
Parse a page of user results
:param soup: Bs4 Class object
:return: A list of dictionaries containing a name and join date
"""
soup = list(soup.find_all('table', class_='stripe')[0].children)[1:]
users = []
for item in soup:
t_u = {'name':... | async def parse_user_results(soup):
"""
Parse a page of user results
:param soup: Bs4 Class object
:return: A list of dictionaries containing a name and join date
"""
soup = list(soup.find_all('table', class_='stripe')[0].children)[1:]
users = []
for item in soup:
t_u = {'name':... | [
"Parse",
"a",
"page",
"of",
"user",
"results"
] | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/Parsing.py#L86-L101 | [
"async",
"def",
"parse_user_results",
"(",
"soup",
")",
":",
"soup",
"=",
"list",
"(",
"soup",
".",
"find_all",
"(",
"'table'",
",",
"class_",
"=",
"'stripe'",
")",
"[",
"0",
"]",
".",
"children",
")",
"[",
"1",
":",
"]",
"users",
"=",
"[",
"]",
... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | tarball_files | Creates a tarball from a group of files
:param str tar_name: Name of tarball
:param list[str] file_paths: Absolute file paths to include in the tarball
:param str output_dir: Output destination for tarball
:param str prefix: Optional prefix for files in tarball | src/toil_lib/files.py | def tarball_files(tar_name, file_paths, output_dir='.', prefix=''):
"""
Creates a tarball from a group of files
:param str tar_name: Name of tarball
:param list[str] file_paths: Absolute file paths to include in the tarball
:param str output_dir: Output destination for tarball
:param str prefix... | def tarball_files(tar_name, file_paths, output_dir='.', prefix=''):
"""
Creates a tarball from a group of files
:param str tar_name: Name of tarball
:param list[str] file_paths: Absolute file paths to include in the tarball
:param str output_dir: Output destination for tarball
:param str prefix... | [
"Creates",
"a",
"tarball",
"from",
"a",
"group",
"of",
"files"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/files.py#L9-L23 | [
"def",
"tarball_files",
"(",
"tar_name",
",",
"file_paths",
",",
"output_dir",
"=",
"'.'",
",",
"prefix",
"=",
"''",
")",
":",
"with",
"tarfile",
".",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"output_dir",
",",
"tar_name",
")",
",",
"'w:gz'",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | __forall_files | Applies a function to a set of files and an output directory.
:param str output_dir: Output directory
:param list[str] file_paths: Absolute file paths to move | src/toil_lib/files.py | def __forall_files(file_paths, output_dir, op):
"""
Applies a function to a set of files and an output directory.
:param str output_dir: Output directory
:param list[str] file_paths: Absolute file paths to move
"""
for file_path in file_paths:
if not file_path.startswith('/'):
... | def __forall_files(file_paths, output_dir, op):
"""
Applies a function to a set of files and an output directory.
:param str output_dir: Output directory
:param list[str] file_paths: Absolute file paths to move
"""
for file_path in file_paths:
if not file_path.startswith('/'):
... | [
"Applies",
"a",
"function",
"to",
"a",
"set",
"of",
"files",
"and",
"an",
"output",
"directory",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/files.py#L26-L37 | [
"def",
"__forall_files",
"(",
"file_paths",
",",
"output_dir",
",",
"op",
")",
":",
"for",
"file_path",
"in",
"file_paths",
":",
"if",
"not",
"file_path",
".",
"startswith",
"(",
"'/'",
")",
":",
"raise",
"ValueError",
"(",
"'Path provided (%s) is relative not a... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | copy_file_job | Job version of move_files for one file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str name: Name of output file (including extension)
:param str file_id: FileStoreID of file
:param str output_dir: Location to place output file | src/toil_lib/files.py | def copy_file_job(job, name, file_id, output_dir):
"""
Job version of move_files for one file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str name: Name of output file (including extension)
:param str file_id: FileStoreID of file
:param str output_dir: Location to pla... | def copy_file_job(job, name, file_id, output_dir):
"""
Job version of move_files for one file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str name: Name of output file (including extension)
:param str file_id: FileStoreID of file
:param str output_dir: Location to pla... | [
"Job",
"version",
"of",
"move_files",
"for",
"one",
"file"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/files.py#L40-L51 | [
"def",
"copy_file_job",
"(",
"job",
",",
"name",
",",
"file_id",
",",
"output_dir",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"fpath",
"=",
"job",
".",
"fileStore",
".",
"readGlobalFile",
"(",
"file_id",
",",
"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | consolidate_tarballs_job | Combine the contents of separate tarballs into one.
Subdirs within the tarball will be named the keys in **fname_to_id
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict[str,str] fname_to_id: Dictionary of the form: file-name-prefix=FileStoreID
:return: The file store ID of the... | src/toil_lib/files.py | def consolidate_tarballs_job(job, fname_to_id):
"""
Combine the contents of separate tarballs into one.
Subdirs within the tarball will be named the keys in **fname_to_id
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict[str,str] fname_to_id: Dictionary of the form: file-n... | def consolidate_tarballs_job(job, fname_to_id):
"""
Combine the contents of separate tarballs into one.
Subdirs within the tarball will be named the keys in **fname_to_id
:param JobFunctionWrappingJob job: passed automatically by Toil
:param dict[str,str] fname_to_id: Dictionary of the form: file-n... | [
"Combine",
"the",
"contents",
"of",
"separate",
"tarballs",
"into",
"one",
".",
"Subdirs",
"within",
"the",
"tarball",
"will",
"be",
"named",
"the",
"keys",
"in",
"**",
"fname_to_id"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/files.py#L81-L109 | [
"def",
"consolidate_tarballs_job",
"(",
"job",
",",
"fname_to_id",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"# Retrieve output file paths to consolidate",
"tar_paths",
"=",
"[",
"]",
"for",
"fname",
",",
"file_store_id",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | _make_parameters | Makes a Spark Submit style job submission line.
:param masterIP: The Spark leader IP address.
:param default_parameters: Application specific Spark configuration parameters.
:param memory: The memory to allocate to each Spark driver and executor.
:param arguments: Arguments to pass to the submitted job... | src/toil_lib/tools/spark_tools.py | def _make_parameters(master_ip, default_parameters, memory, arguments, override_parameters):
"""
Makes a Spark Submit style job submission line.
:param masterIP: The Spark leader IP address.
:param default_parameters: Application specific Spark configuration parameters.
:param memory: The memory to... | def _make_parameters(master_ip, default_parameters, memory, arguments, override_parameters):
"""
Makes a Spark Submit style job submission line.
:param masterIP: The Spark leader IP address.
:param default_parameters: Application specific Spark configuration parameters.
:param memory: The memory to... | [
"Makes",
"a",
"Spark",
"Submit",
"style",
"job",
"submission",
"line",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/spark_tools.py#L53-L95 | [
"def",
"_make_parameters",
"(",
"master_ip",
",",
"default_parameters",
",",
"memory",
",",
"arguments",
",",
"override_parameters",
")",
":",
"# python doesn't support logical xor?",
"# anywho, exactly one of memory or override_parameters must be defined",
"require",
"(",
"(",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | call_conductor | Invokes the Conductor container to copy files between S3 and HDFS and vice versa.
Find Conductor at https://github.com/BD2KGenomics/conductor.
:param toil.Job.job job: The Toil Job calling this function
:param masterIP: The Spark leader IP address.
:param src: URL of file to copy.
:param src: URL o... | src/toil_lib/tools/spark_tools.py | def call_conductor(job, master_ip, src, dst, memory=None, override_parameters=None):
"""
Invokes the Conductor container to copy files between S3 and HDFS and vice versa.
Find Conductor at https://github.com/BD2KGenomics/conductor.
:param toil.Job.job job: The Toil Job calling this function
:param ... | def call_conductor(job, master_ip, src, dst, memory=None, override_parameters=None):
"""
Invokes the Conductor container to copy files between S3 and HDFS and vice versa.
Find Conductor at https://github.com/BD2KGenomics/conductor.
:param toil.Job.job job: The Toil Job calling this function
:param ... | [
"Invokes",
"the",
"Conductor",
"container",
"to",
"copy",
"files",
"between",
"S3",
"and",
"HDFS",
"and",
"vice",
"versa",
".",
"Find",
"Conductor",
"at",
"https",
":",
"//",
"github",
".",
"com",
"/",
"BD2KGenomics",
"/",
"conductor",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/spark_tools.py#L98-L127 | [
"def",
"call_conductor",
"(",
"job",
",",
"master_ip",
",",
"src",
",",
"dst",
",",
"memory",
"=",
"None",
",",
"override_parameters",
"=",
"None",
")",
":",
"arguments",
"=",
"[",
"\"-C\"",
",",
"src",
",",
"dst",
"]",
"docker_parameters",
"=",
"[",
"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | call_adam | Invokes the ADAM container. Find ADAM at https://github.com/bigdatagenomics/adam.
:param toil.Job.job job: The Toil Job calling this function
:param masterIP: The Spark leader IP address.
:param arguments: Arguments to pass to ADAM.
:param memory: Gigabytes of memory to provision for Spark driver/worke... | src/toil_lib/tools/spark_tools.py | def call_adam(job, master_ip, arguments,
memory=None,
override_parameters=None,
run_local=False,
native_adam_path=None):
"""
Invokes the ADAM container. Find ADAM at https://github.com/bigdatagenomics/adam.
:param toil.Job.job job: The Toil Job callin... | def call_adam(job, master_ip, arguments,
memory=None,
override_parameters=None,
run_local=False,
native_adam_path=None):
"""
Invokes the ADAM container. Find ADAM at https://github.com/bigdatagenomics/adam.
:param toil.Job.job job: The Toil Job callin... | [
"Invokes",
"the",
"ADAM",
"container",
".",
"Find",
"ADAM",
"at",
"https",
":",
"//",
"github",
".",
"com",
"/",
"bigdatagenomics",
"/",
"adam",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/spark_tools.py#L130-L192 | [
"def",
"call_adam",
"(",
"job",
",",
"master_ip",
",",
"arguments",
",",
"memory",
"=",
"None",
",",
"override_parameters",
"=",
"None",
",",
"run_local",
"=",
"False",
",",
"native_adam_path",
"=",
"None",
")",
":",
"if",
"run_local",
":",
"master",
"=",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | MasterAddress.docker_parameters | Augment a list of "docker run" arguments with those needed to map the notional Spark master address to the
real one, if they are different. | src/toil_lib/tools/spark_tools.py | def docker_parameters(self, docker_parameters=None):
"""
Augment a list of "docker run" arguments with those needed to map the notional Spark master address to the
real one, if they are different.
"""
if self != self.actual:
add_host_option = '--add-host=spark-master... | def docker_parameters(self, docker_parameters=None):
"""
Augment a list of "docker run" arguments with those needed to map the notional Spark master address to the
real one, if they are different.
"""
if self != self.actual:
add_host_option = '--add-host=spark-master... | [
"Augment",
"a",
"list",
"of",
"docker",
"run",
"arguments",
"with",
"those",
"needed",
"to",
"map",
"the",
"notional",
"Spark",
"master",
"address",
"to",
"the",
"real",
"one",
"if",
"they",
"are",
"different",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/spark_tools.py#L40-L51 | [
"def",
"docker_parameters",
"(",
"self",
",",
"docker_parameters",
"=",
"None",
")",
":",
"if",
"self",
"!=",
"self",
".",
"actual",
":",
"add_host_option",
"=",
"'--add-host=spark-master:'",
"+",
"self",
".",
"actual",
"if",
"docker_parameters",
"is",
"None",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | ConnectorObject.refresh | Refresh reloads data from the server. It raises an error if it fails to get the object's metadata | connectordb/_connectorobject.py | def refresh(self):
"""Refresh reloads data from the server. It raises an error if it fails to get the object's metadata"""
self.metadata = self.db.read(self.path).json() | def refresh(self):
"""Refresh reloads data from the server. It raises an error if it fails to get the object's metadata"""
self.metadata = self.db.read(self.path).json() | [
"Refresh",
"reloads",
"data",
"from",
"the",
"server",
".",
"It",
"raises",
"an",
"error",
"if",
"it",
"fails",
"to",
"get",
"the",
"object",
"s",
"metadata"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connectorobject.py#L16-L18 | [
"def",
"refresh",
"(",
"self",
")",
":",
"self",
".",
"metadata",
"=",
"self",
".",
"db",
".",
"read",
"(",
"self",
".",
"path",
")",
".",
"json",
"(",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | ConnectorObject.set | Attempts to set the given properties of the object.
An example of this is setting the nickname of the object::
cdb.set({"nickname": "My new nickname"})
note that there is a convenience property `cdb.nickname` that allows you to get/set the nickname directly. | connectordb/_connectorobject.py | def set(self, property_dict):
"""Attempts to set the given properties of the object.
An example of this is setting the nickname of the object::
cdb.set({"nickname": "My new nickname"})
note that there is a convenience property `cdb.nickname` that allows you to get/set the nic... | def set(self, property_dict):
"""Attempts to set the given properties of the object.
An example of this is setting the nickname of the object::
cdb.set({"nickname": "My new nickname"})
note that there is a convenience property `cdb.nickname` that allows you to get/set the nic... | [
"Attempts",
"to",
"set",
"the",
"given",
"properties",
"of",
"the",
"object",
".",
"An",
"example",
"of",
"this",
"is",
"setting",
"the",
"nickname",
"of",
"the",
"object",
"::",
"cdb",
".",
"set",
"(",
"{",
"nickname",
":",
"My",
"new",
"nickname",
"}... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connectorobject.py#L49-L57 | [
"def",
"set",
"(",
"self",
",",
"property_dict",
")",
":",
"self",
".",
"metadata",
"=",
"self",
".",
"db",
".",
"update",
"(",
"self",
".",
"path",
",",
"property_dict",
")",
".",
"json",
"(",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | run_mutect | Calls MuTect to perform variant analysis
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str normal_bam: Normal BAM FileStoreID
:param str normal_bai: Normal BAM index FileStoreID
:param str tumor_bam: Tumor BAM FileStoreID
:param str tumor_bai: Tumor BAM Index FileStoreID
... | src/toil_lib/tools/mutation_callers.py | def run_mutect(job, normal_bam, normal_bai, tumor_bam, tumor_bai, ref, ref_dict, fai, cosmic, dbsnp):
"""
Calls MuTect to perform variant analysis
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str normal_bam: Normal BAM FileStoreID
:param str normal_bai: Normal BAM index Fi... | def run_mutect(job, normal_bam, normal_bai, tumor_bam, tumor_bai, ref, ref_dict, fai, cosmic, dbsnp):
"""
Calls MuTect to perform variant analysis
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str normal_bam: Normal BAM FileStoreID
:param str normal_bai: Normal BAM index Fi... | [
"Calls",
"MuTect",
"to",
"perform",
"variant",
"analysis"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/mutation_callers.py#L9-L50 | [
"def",
"run_mutect",
"(",
"job",
",",
"normal_bam",
",",
"normal_bai",
",",
"tumor_bam",
",",
"tumor_bai",
",",
"ref",
",",
"ref_dict",
",",
"fai",
",",
"cosmic",
",",
"dbsnp",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_pindel | Calls Pindel to compute indels / deletions
:param JobFunctionWrappingJob job: Passed automatically by Toil
:param str normal_bam: Normal BAM FileStoreID
:param str normal_bai: Normal BAM index FileStoreID
:param str tumor_bam: Tumor BAM FileStoreID
:param str tumor_bai: Tumor BAM Index FileStoreID
... | src/toil_lib/tools/mutation_callers.py | def run_pindel(job, normal_bam, normal_bai, tumor_bam, tumor_bai, ref, fai):
"""
Calls Pindel to compute indels / deletions
:param JobFunctionWrappingJob job: Passed automatically by Toil
:param str normal_bam: Normal BAM FileStoreID
:param str normal_bai: Normal BAM index FileStoreID
:param st... | def run_pindel(job, normal_bam, normal_bai, tumor_bam, tumor_bai, ref, fai):
"""
Calls Pindel to compute indels / deletions
:param JobFunctionWrappingJob job: Passed automatically by Toil
:param str normal_bam: Normal BAM FileStoreID
:param str normal_bai: Normal BAM index FileStoreID
:param st... | [
"Calls",
"Pindel",
"to",
"compute",
"indels",
"/",
"deletions"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/mutation_callers.py#L93-L129 | [
"def",
"run_pindel",
"(",
"job",
",",
"normal_bam",
",",
"normal_bai",
",",
"tumor_bam",
",",
"tumor_bai",
",",
"ref",
",",
"fai",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"file_ids",
"=",
"[",
"normal_bam",
"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | Device.create | Creates the device. Attempts to create private devices by default,
but if public is set to true, creates public devices.
You can also set other default properties by passing in the relevant information.
For example, setting a device with the given nickname and description::
dev.cre... | connectordb/_device.py | def create(self, public=False, **kwargs):
"""Creates the device. Attempts to create private devices by default,
but if public is set to true, creates public devices.
You can also set other default properties by passing in the relevant information.
For example, setting a device with the ... | def create(self, public=False, **kwargs):
"""Creates the device. Attempts to create private devices by default,
but if public is set to true, creates public devices.
You can also set other default properties by passing in the relevant information.
For example, setting a device with the ... | [
"Creates",
"the",
"device",
".",
"Attempts",
"to",
"create",
"private",
"devices",
"by",
"default",
"but",
"if",
"public",
"is",
"set",
"to",
"true",
"creates",
"public",
"devices",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_device.py#L12-L31 | [
"def",
"create",
"(",
"self",
",",
"public",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"\"public\"",
"]",
"=",
"public",
"self",
".",
"metadata",
"=",
"self",
".",
"db",
".",
"create",
"(",
"self",
".",
"path",
",",
"kwargs",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Device.streams | Returns the list of streams that belong to the device | connectordb/_device.py | def streams(self):
"""Returns the list of streams that belong to the device"""
result = self.db.read(self.path, {"q": "ls"})
if result is None or result.json() is None:
return []
streams = []
for s in result.json():
strm = self[s["name"]]
strm... | def streams(self):
"""Returns the list of streams that belong to the device"""
result = self.db.read(self.path, {"q": "ls"})
if result is None or result.json() is None:
return []
streams = []
for s in result.json():
strm = self[s["name"]]
strm... | [
"Returns",
"the",
"list",
"of",
"streams",
"that",
"belong",
"to",
"the",
"device"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_device.py#L33-L44 | [
"def",
"streams",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"db",
".",
"read",
"(",
"self",
".",
"path",
",",
"{",
"\"q\"",
":",
"\"ls\"",
"}",
")",
"if",
"result",
"is",
"None",
"or",
"result",
".",
"json",
"(",
")",
"is",
"None",
":"... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Device.export | Exports the device to the given directory. The directory can't exist.
You can later import this device by running import_device on a user. | connectordb/_device.py | def export(self, directory):
"""Exports the device to the given directory. The directory can't exist.
You can later import this device by running import_device on a user.
"""
if os.path.exists(directory):
raise FileExistsError(
"The device export directory al... | def export(self, directory):
"""Exports the device to the given directory. The directory can't exist.
You can later import this device by running import_device on a user.
"""
if os.path.exists(directory):
raise FileExistsError(
"The device export directory al... | [
"Exports",
"the",
"device",
"to",
"the",
"given",
"directory",
".",
"The",
"directory",
"can",
"t",
"exist",
".",
"You",
"can",
"later",
"import",
"this",
"device",
"by",
"running",
"import_device",
"on",
"a",
"user",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_device.py#L54-L70 | [
"def",
"export",
"(",
"self",
",",
"directory",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"directory",
")",
":",
"raise",
"FileExistsError",
"(",
"\"The device export directory already exists\"",
")",
"os",
".",
"mkdir",
"(",
"directory",
")",
"... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Device.import_stream | Imports a stream from the given directory. You export the Stream
by using stream.export() | connectordb/_device.py | def import_stream(self, directory):
"""Imports a stream from the given directory. You export the Stream
by using stream.export()"""
# read the stream's info
with open(os.path.join(directory, "stream.json"), "r") as f:
sdata = json.load(f)
s = self[sdata["name"]]
... | def import_stream(self, directory):
"""Imports a stream from the given directory. You export the Stream
by using stream.export()"""
# read the stream's info
with open(os.path.join(directory, "stream.json"), "r") as f:
sdata = json.load(f)
s = self[sdata["name"]]
... | [
"Imports",
"a",
"stream",
"from",
"the",
"given",
"directory",
".",
"You",
"export",
"the",
"Stream",
"by",
"using",
"stream",
".",
"export",
"()"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_device.py#L72-L110 | [
"def",
"import_stream",
"(",
"self",
",",
"directory",
")",
":",
"# read the stream's info",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"\"stream.json\"",
")",
",",
"\"r\"",
")",
"as",
"f",
":",
"sdata",
"=",
"json",
".",... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Shosetsu.search_vndb | Search vndb.org for a term and return matching results from type.
:param stype: type to search for.
Type should be one of:
v - Visual Novels
r - Releases
p - Producers
s - Staff
c - Characters
g - Tags
... | Shosetsu/VNDB.py | async def search_vndb(self, stype, term):
"""
Search vndb.org for a term and return matching results from type.
:param stype: type to search for.
Type should be one of:
v - Visual Novels
r - Releases
p - Producers
s - S... | async def search_vndb(self, stype, term):
"""
Search vndb.org for a term and return matching results from type.
:param stype: type to search for.
Type should be one of:
v - Visual Novels
r - Releases
p - Producers
s - S... | [
"Search",
"vndb",
".",
"org",
"for",
"a",
"term",
"and",
"return",
"matching",
"results",
"from",
"type",
"."
] | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/VNDB.py#L17-L62 | [
"async",
"def",
"search_vndb",
"(",
"self",
",",
"stype",
",",
"term",
")",
":",
"fstype",
"=",
"\"\"",
"if",
"stype",
"not",
"in",
"[",
"'v'",
",",
"'r'",
",",
"'p'",
",",
"'s'",
",",
"'c'",
",",
"'g'",
",",
"'i'",
",",
"'u'",
"]",
":",
"raise... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | Shosetsu.get_novel | If term is an ID will return that specific ID. If it's a string, it will return the details of the first search result for that term.
Returned Dictionary Has the following structure:
Please note, if it says list or dict, it means the python types.
Indentation indicates level. So English is ['Tit... | Shosetsu/VNDB.py | async def get_novel(self, term, hide_nsfw=False):
"""
If term is an ID will return that specific ID. If it's a string, it will return the details of the first search result for that term.
Returned Dictionary Has the following structure:
Please note, if it says list or dict, it means the ... | async def get_novel(self, term, hide_nsfw=False):
"""
If term is an ID will return that specific ID. If it's a string, it will return the details of the first search result for that term.
Returned Dictionary Has the following structure:
Please note, if it says list or dict, it means the ... | [
"If",
"term",
"is",
"an",
"ID",
"will",
"return",
"that",
"specific",
"ID",
".",
"If",
"it",
"s",
"a",
"string",
"it",
"will",
"return",
"the",
"details",
"of",
"the",
"first",
"search",
"result",
"for",
"that",
"term",
".",
"Returned",
"Dictionary",
"... | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/VNDB.py#L64-L209 | [
"async",
"def",
"get_novel",
"(",
"self",
",",
"term",
",",
"hide_nsfw",
"=",
"False",
")",
":",
"if",
"not",
"term",
".",
"isdigit",
"(",
")",
"and",
"not",
"term",
".",
"startswith",
"(",
"'v'",
")",
":",
"try",
":",
"vnid",
"=",
"await",
"self",... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | Shosetsu.parse_search | This is our parsing dispatcher
:param stype: Search type category
:param soup: The beautifulsoup object that contains the parsed html | Shosetsu/VNDB.py | async def parse_search(self, stype, soup):
"""
This is our parsing dispatcher
:param stype: Search type category
:param soup: The beautifulsoup object that contains the parsed html
"""
if stype == 'v':
return await parse_vn_results(soup)
elif stype ==... | async def parse_search(self, stype, soup):
"""
This is our parsing dispatcher
:param stype: Search type category
:param soup: The beautifulsoup object that contains the parsed html
"""
if stype == 'v':
return await parse_vn_results(soup)
elif stype ==... | [
"This",
"is",
"our",
"parsing",
"dispatcher"
] | ccubed/Shosetsu | python | https://github.com/ccubed/Shosetsu/blob/eba01c058100ec8806129b11a2859f3126a1b101/Shosetsu/VNDB.py#L211-L233 | [
"async",
"def",
"parse_search",
"(",
"self",
",",
"stype",
",",
"soup",
")",
":",
"if",
"stype",
"==",
"'v'",
":",
"return",
"await",
"parse_vn_results",
"(",
"soup",
")",
"elif",
"stype",
"==",
"'r'",
":",
"return",
"await",
"parse_release_results",
"(",
... | eba01c058100ec8806129b11a2859f3126a1b101 |
test | Dataset.addStream | Adds the given stream to the query construction. Additionally, you can choose the interpolator to use for this stream, as well as a special name
for the column in the returned dataset. If no column name is given, the full stream path will be used.
addStream also supports Merge queries. You can insert a... | connectordb/query/dataset.py | def addStream(self, stream, interpolator="closest", t1=None, t2=None, dt=None, limit=None, i1=None, i2=None, transform=None,colname=None):
"""Adds the given stream to the query construction. Additionally, you can choose the interpolator to use for this stream, as well as a special name
for the column in... | def addStream(self, stream, interpolator="closest", t1=None, t2=None, dt=None, limit=None, i1=None, i2=None, transform=None,colname=None):
"""Adds the given stream to the query construction. Additionally, you can choose the interpolator to use for this stream, as well as a special name
for the column in... | [
"Adds",
"the",
"given",
"stream",
"to",
"the",
"query",
"construction",
".",
"Additionally",
"you",
"can",
"choose",
"the",
"interpolator",
"to",
"use",
"for",
"this",
"stream",
"as",
"well",
"as",
"a",
"special",
"name",
"for",
"the",
"column",
"in",
"the... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/query/dataset.py#L165-L202 | [
"def",
"addStream",
"(",
"self",
",",
"stream",
",",
"interpolator",
"=",
"\"closest\"",
",",
"t1",
"=",
"None",
",",
"t2",
"=",
"None",
",",
"dt",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"i1",
"=",
"None",
",",
"i2",
"=",
"None",
",",
"tran... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | ConnectorDB.reset_apikey | invalidates the device's current api key, and generates a new one. Resets current auth to use the new apikey,
since the change would have future queries fail if they use the old api key. | connectordb/_connectordb.py | def reset_apikey(self):
"""invalidates the device's current api key, and generates a new one. Resets current auth to use the new apikey,
since the change would have future queries fail if they use the old api key."""
apikey = Device.reset_apikey(self)
self.db.setauth(apikey)
retu... | def reset_apikey(self):
"""invalidates the device's current api key, and generates a new one. Resets current auth to use the new apikey,
since the change would have future queries fail if they use the old api key."""
apikey = Device.reset_apikey(self)
self.db.setauth(apikey)
retu... | [
"invalidates",
"the",
"device",
"s",
"current",
"api",
"key",
"and",
"generates",
"a",
"new",
"one",
".",
"Resets",
"current",
"auth",
"to",
"use",
"the",
"new",
"apikey",
"since",
"the",
"change",
"would",
"have",
"future",
"queries",
"fail",
"if",
"they"... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connectordb.py#L70-L75 | [
"def",
"reset_apikey",
"(",
"self",
")",
":",
"apikey",
"=",
"Device",
".",
"reset_apikey",
"(",
"self",
")",
"self",
".",
"db",
".",
"setauth",
"(",
"apikey",
")",
"return",
"apikey"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | ConnectorDB.info | returns a dictionary of information about the database, including the database version, the transforms
and the interpolators supported::
>>>cdb = connectordb.ConnectorDB(apikey)
>>>cdb.info()
{
"version": "0.3.0",
"transforms": {
... | connectordb/_connectordb.py | def info(self):
"""returns a dictionary of information about the database, including the database version, the transforms
and the interpolators supported::
>>>cdb = connectordb.ConnectorDB(apikey)
>>>cdb.info()
{
"version": "0.3.0",
"t... | def info(self):
"""returns a dictionary of information about the database, including the database version, the transforms
and the interpolators supported::
>>>cdb = connectordb.ConnectorDB(apikey)
>>>cdb.info()
{
"version": "0.3.0",
"t... | [
"returns",
"a",
"dictionary",
"of",
"information",
"about",
"the",
"database",
"including",
"the",
"database",
"version",
"the",
"transforms",
"and",
"the",
"interpolators",
"supported",
"::"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connectordb.py#L89-L112 | [
"def",
"info",
"(",
"self",
")",
":",
"return",
"{",
"\"version\"",
":",
"self",
".",
"db",
".",
"get",
"(",
"\"meta/version\"",
")",
".",
"text",
",",
"\"transforms\"",
":",
"self",
".",
"db",
".",
"get",
"(",
"\"meta/transforms\"",
")",
".",
"json",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | ConnectorDB.users | Returns the list of users in the database | connectordb/_connectordb.py | def users(self):
"""Returns the list of users in the database"""
result = self.db.read("", {"q": "ls"})
if result is None or result.json() is None:
return []
users = []
for u in result.json():
usr = self(u["name"])
usr.metadata = u
... | def users(self):
"""Returns the list of users in the database"""
result = self.db.read("", {"q": "ls"})
if result is None or result.json() is None:
return []
users = []
for u in result.json():
usr = self(u["name"])
usr.metadata = u
... | [
"Returns",
"the",
"list",
"of",
"users",
"in",
"the",
"database"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connectordb.py#L117-L128 | [
"def",
"users",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"db",
".",
"read",
"(",
"\"\"",
",",
"{",
"\"q\"",
":",
"\"ls\"",
"}",
")",
"if",
"result",
"is",
"None",
"or",
"result",
".",
"json",
"(",
")",
"is",
"None",
":",
"return",
"["... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | ConnectorDB.import_users | Imports version 1 of ConnectorDB export. These exports can be generated
by running user.export(dir), possibly on multiple users. | connectordb/_connectordb.py | def import_users(self, directory):
"""Imports version 1 of ConnectorDB export. These exports can be generated
by running user.export(dir), possibly on multiple users.
"""
exportInfoFile = os.path.join(directory, "connectordb.json")
with open(exportInfoFile) as f:
expo... | def import_users(self, directory):
"""Imports version 1 of ConnectorDB export. These exports can be generated
by running user.export(dir), possibly on multiple users.
"""
exportInfoFile = os.path.join(directory, "connectordb.json")
with open(exportInfoFile) as f:
expo... | [
"Imports",
"version",
"1",
"of",
"ConnectorDB",
"export",
".",
"These",
"exports",
"can",
"be",
"generated",
"by",
"running",
"user",
".",
"export",
"(",
"dir",
")",
"possibly",
"on",
"multiple",
"users",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connectordb.py#L134-L163 | [
"def",
"import_users",
"(",
"self",
",",
"directory",
")",
":",
"exportInfoFile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"\"connectordb.json\"",
")",
"with",
"open",
"(",
"exportInfoFile",
")",
"as",
"f",
":",
"exportInfo",
"=",
"json"... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | run_bwa_index | Use BWA to create reference index files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str ref_id: FileStoreID for the reference genome
:return: FileStoreIDs for BWA index files
:rtype: tuple(str, str, str, str, str) | src/toil_lib/tools/indexing.py | def run_bwa_index(job, ref_id):
"""
Use BWA to create reference index files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str ref_id: FileStoreID for the reference genome
:return: FileStoreIDs for BWA index files
:rtype: tuple(str, str, str, str, str)
"""
job.fi... | def run_bwa_index(job, ref_id):
"""
Use BWA to create reference index files
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str ref_id: FileStoreID for the reference genome
:return: FileStoreIDs for BWA index files
:rtype: tuple(str, str, str, str, str)
"""
job.fi... | [
"Use",
"BWA",
"to",
"create",
"reference",
"index",
"files"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/indexing.py#L6-L24 | [
"def",
"run_bwa_index",
"(",
"job",
",",
"ref_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Created BWA index files'",
")",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"job",
".",
"fileStore",
".",
"readGl... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | Logger.connectordb | Returns the ConnectorDB object that the logger uses. Raises an error if Logger isn't able to connect | connectordb/logger.py | def connectordb(self):
"""Returns the ConnectorDB object that the logger uses. Raises an error if Logger isn't able to connect"""
if self.__cdb is None:
logging.debug("Logger: Connecting to " + self.serverurl)
self.__cdb = ConnectorDB(self.apikey, url=self.serverurl)
retu... | def connectordb(self):
"""Returns the ConnectorDB object that the logger uses. Raises an error if Logger isn't able to connect"""
if self.__cdb is None:
logging.debug("Logger: Connecting to " + self.serverurl)
self.__cdb = ConnectorDB(self.apikey, url=self.serverurl)
retu... | [
"Returns",
"the",
"ConnectorDB",
"object",
"that",
"the",
"logger",
"uses",
".",
"Raises",
"an",
"error",
"if",
"Logger",
"isn",
"t",
"able",
"to",
"connect"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L96-L101 | [
"def",
"connectordb",
"(",
"self",
")",
":",
"if",
"self",
".",
"__cdb",
"is",
"None",
":",
"logging",
".",
"debug",
"(",
"\"Logger: Connecting to \"",
"+",
"self",
".",
"serverurl",
")",
"self",
".",
"__cdb",
"=",
"ConnectorDB",
"(",
"self",
".",
"apike... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Logger.addStream | Adds the given stream to the logger. Requires an active connection to the ConnectorDB database.
If a schema is not specified, loads the stream from the database. If a schema is specified, and the stream
does not exist, creates the stream. You can also add stream properties such as description or nickna... | connectordb/logger.py | def addStream(self, streamname, schema=None, **kwargs):
"""Adds the given stream to the logger. Requires an active connection to the ConnectorDB database.
If a schema is not specified, loads the stream from the database. If a schema is specified, and the stream
does not exist, creates the strea... | def addStream(self, streamname, schema=None, **kwargs):
"""Adds the given stream to the logger. Requires an active connection to the ConnectorDB database.
If a schema is not specified, loads the stream from the database. If a schema is specified, and the stream
does not exist, creates the strea... | [
"Adds",
"the",
"given",
"stream",
"to",
"the",
"logger",
".",
"Requires",
"an",
"active",
"connection",
"to",
"the",
"ConnectorDB",
"database",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L118-L134 | [
"def",
"addStream",
"(",
"self",
",",
"streamname",
",",
"schema",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"stream",
"=",
"self",
".",
"connectordb",
"[",
"streamname",
"]",
"if",
"not",
"stream",
".",
"exists",
"(",
")",
":",
"if",
"schema",... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Logger.addStream_force | This function adds the given stream to the logger, but does not check with a ConnectorDB database
to make sure that the stream exists. Use at your own risk. | connectordb/logger.py | def addStream_force(self, streamname, schema=None):
"""This function adds the given stream to the logger, but does not check with a ConnectorDB database
to make sure that the stream exists. Use at your own risk."""
c = self.database.cursor()
c.execute("INSERT OR REPLACE INTO streams VAL... | def addStream_force(self, streamname, schema=None):
"""This function adds the given stream to the logger, but does not check with a ConnectorDB database
to make sure that the stream exists. Use at your own risk."""
c = self.database.cursor()
c.execute("INSERT OR REPLACE INTO streams VAL... | [
"This",
"function",
"adds",
"the",
"given",
"stream",
"to",
"the",
"logger",
"but",
"does",
"not",
"check",
"with",
"a",
"ConnectorDB",
"database",
"to",
"make",
"sure",
"that",
"the",
"stream",
"exists",
".",
"Use",
"at",
"your",
"own",
"risk",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L136-L144 | [
"def",
"addStream_force",
"(",
"self",
",",
"streamname",
",",
"schema",
"=",
"None",
")",
":",
"c",
"=",
"self",
".",
"database",
".",
"cursor",
"(",
")",
"c",
".",
"execute",
"(",
"\"INSERT OR REPLACE INTO streams VALUES (?,?);\"",
",",
"(",
"streamname",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Logger.insert | Insert the datapoint into the logger for the given stream name. The logger caches the datapoint
and eventually synchronizes it with ConnectorDB | connectordb/logger.py | def insert(self, streamname, value):
"""Insert the datapoint into the logger for the given stream name. The logger caches the datapoint
and eventually synchronizes it with ConnectorDB"""
if streamname not in self.streams:
raise Exception("The stream '%s' was not found" % (streamname,... | def insert(self, streamname, value):
"""Insert the datapoint into the logger for the given stream name. The logger caches the datapoint
and eventually synchronizes it with ConnectorDB"""
if streamname not in self.streams:
raise Exception("The stream '%s' was not found" % (streamname,... | [
"Insert",
"the",
"datapoint",
"into",
"the",
"logger",
"for",
"the",
"given",
"stream",
"name",
".",
"The",
"logger",
"caches",
"the",
"datapoint",
"and",
"eventually",
"synchronizes",
"it",
"with",
"ConnectorDB"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L146-L160 | [
"def",
"insert",
"(",
"self",
",",
"streamname",
",",
"value",
")",
":",
"if",
"streamname",
"not",
"in",
"self",
".",
"streams",
":",
"raise",
"Exception",
"(",
"\"The stream '%s' was not found\"",
"%",
"(",
"streamname",
",",
")",
")",
"# Validate the schema... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Logger.insert_many | Inserts data into the cache, if the data is a dict of the form {streamname: [{"t": timestamp,"d":data,...]} | connectordb/logger.py | def insert_many(self, data_dict):
""" Inserts data into the cache, if the data is a dict of the form {streamname: [{"t": timestamp,"d":data,...]}"""
c = self.database.cursor()
c.execute("BEGIN TRANSACTION;")
try:
for streamname in data_dict:
if streamname not ... | def insert_many(self, data_dict):
""" Inserts data into the cache, if the data is a dict of the form {streamname: [{"t": timestamp,"d":data,...]}"""
c = self.database.cursor()
c.execute("BEGIN TRANSACTION;")
try:
for streamname in data_dict:
if streamname not ... | [
"Inserts",
"data",
"into",
"the",
"cache",
"if",
"the",
"data",
"is",
"a",
"dict",
"of",
"the",
"form",
"{",
"streamname",
":",
"[",
"{",
"t",
":",
"timestamp",
"d",
":",
"data",
"...",
"]",
"}"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L162-L178 | [
"def",
"insert_many",
"(",
"self",
",",
"data_dict",
")",
":",
"c",
"=",
"self",
".",
"database",
".",
"cursor",
"(",
")",
"c",
".",
"execute",
"(",
"\"BEGIN TRANSACTION;\"",
")",
"try",
":",
"for",
"streamname",
"in",
"data_dict",
":",
"if",
"streamname... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Logger.sync | Attempt to sync with the ConnectorDB server | connectordb/logger.py | def sync(self):
"""Attempt to sync with the ConnectorDB server"""
logging.debug("Logger: Syncing...")
failed = False
try:
# Get the connectordb object
cdb = self.connectordb
# Ping the database - most connection errors will happen here
cdb... | def sync(self):
"""Attempt to sync with the ConnectorDB server"""
logging.debug("Logger: Syncing...")
failed = False
try:
# Get the connectordb object
cdb = self.connectordb
# Ping the database - most connection errors will happen here
cdb... | [
"Attempt",
"to",
"sync",
"with",
"the",
"ConnectorDB",
"server"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L180-L253 | [
"def",
"sync",
"(",
"self",
")",
":",
"logging",
".",
"debug",
"(",
"\"Logger: Syncing...\"",
")",
"failed",
"=",
"False",
"try",
":",
"# Get the connectordb object",
"cdb",
"=",
"self",
".",
"connectordb",
"# Ping the database - most connection errors will happen here"... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Logger.start | Start the logger background synchronization service. This allows you to not need to
worry about syncing with ConnectorDB - you just insert into the Logger, and the Logger
will by synced every syncperiod. | connectordb/logger.py | def start(self):
"""Start the logger background synchronization service. This allows you to not need to
worry about syncing with ConnectorDB - you just insert into the Logger, and the Logger
will by synced every syncperiod."""
with self.synclock:
if self.syncthread is not No... | def start(self):
"""Start the logger background synchronization service. This allows you to not need to
worry about syncing with ConnectorDB - you just insert into the Logger, and the Logger
will by synced every syncperiod."""
with self.synclock:
if self.syncthread is not No... | [
"Start",
"the",
"logger",
"background",
"synchronization",
"service",
".",
"This",
"allows",
"you",
"to",
"not",
"need",
"to",
"worry",
"about",
"syncing",
"with",
"ConnectorDB",
"-",
"you",
"just",
"insert",
"into",
"the",
"Logger",
"and",
"the",
"Logger",
... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L272-L284 | [
"def",
"start",
"(",
"self",
")",
":",
"with",
"self",
".",
"synclock",
":",
"if",
"self",
".",
"syncthread",
"is",
"not",
"None",
":",
"logging",
".",
"warn",
"(",
"\"Logger: Start called on a syncer that is already running\"",
")",
"return",
"self",
".",
"sy... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Logger.stop | Stops the background synchronization thread | connectordb/logger.py | def stop(self):
"""Stops the background synchronization thread"""
with self.synclock:
if self.syncthread is not None:
self.syncthread.cancel()
self.syncthread = None | def stop(self):
"""Stops the background synchronization thread"""
with self.synclock:
if self.syncthread is not None:
self.syncthread.cancel()
self.syncthread = None | [
"Stops",
"the",
"background",
"synchronization",
"thread"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L286-L291 | [
"def",
"stop",
"(",
"self",
")",
":",
"with",
"self",
".",
"synclock",
":",
"if",
"self",
".",
"syncthread",
"is",
"not",
"None",
":",
"self",
".",
"syncthread",
".",
"cancel",
"(",
")",
"self",
".",
"syncthread",
"=",
"None"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Logger.data | The data property allows the user to save settings/data in the database, so that
there does not need to be extra code messing around with settings.
Use this property to save things that can be converted to JSON inside the logger database,
so that you don't have to mess with configuration files ... | connectordb/logger.py | def data(self):
"""The data property allows the user to save settings/data in the database, so that
there does not need to be extra code messing around with settings.
Use this property to save things that can be converted to JSON inside the logger database,
so that you don't have to mes... | def data(self):
"""The data property allows the user to save settings/data in the database, so that
there does not need to be extra code messing around with settings.
Use this property to save things that can be converted to JSON inside the logger database,
so that you don't have to mes... | [
"The",
"data",
"property",
"allows",
"the",
"user",
"to",
"save",
"settings",
"/",
"data",
"in",
"the",
"database",
"so",
"that",
"there",
"does",
"not",
"need",
"to",
"be",
"extra",
"code",
"messing",
"around",
"with",
"settings",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/logger.py#L361-L379 | [
"def",
"data",
"(",
"self",
")",
":",
"c",
"=",
"self",
".",
"database",
".",
"cursor",
"(",
")",
"c",
".",
"execute",
"(",
"\"SELECT userdatajson FROM metadata;\"",
")",
"return",
"json",
".",
"loads",
"(",
"next",
"(",
"c",
")",
"[",
"0",
"]",
")"
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | read | Build a file path from *paths* and return the contents. | setup.py | def read(*paths):
"""Build a file path from *paths* and return the contents."""
filename = os.path.join(*paths)
with codecs.open(filename, mode='r', encoding='utf-8') as handle:
return handle.read() | def read(*paths):
"""Build a file path from *paths* and return the contents."""
filename = os.path.join(*paths)
with codecs.open(filename, mode='r', encoding='utf-8') as handle:
return handle.read() | [
"Build",
"a",
"file",
"path",
"from",
"*",
"paths",
"*",
"and",
"return",
"the",
"contents",
"."
] | omaciel/pytest-fauxfactory | python | https://github.com/omaciel/pytest-fauxfactory/blob/4365f521e7d8a6db00bdc9a02743467aa5bd1d72/setup.py#L9-L13 | [
"def",
"read",
"(",
"*",
"paths",
")",
":",
"filename",
"=",
"os",
".",
"path",
".",
"join",
"(",
"*",
"paths",
")",
"with",
"codecs",
".",
"open",
"(",
"filename",
",",
"mode",
"=",
"'r'",
",",
"encoding",
"=",
"'utf-8'",
")",
"as",
"handle",
":... | 4365f521e7d8a6db00bdc9a02743467aa5bd1d72 |
test | download_url | Downloads URL, can pass in file://, http://, s3://, or ftp://, gnos://cghub/analysisID, or gnos:///analysisID
If downloading S3 URLs, the S3AM binary must be on the PATH
:param toil.job.Job job: Toil job that is calling this function
:param str url: URL to download from
:param str work_dir: Directory t... | src/toil_lib/urls.py | def download_url(job, url, work_dir='.', name=None, s3_key_path=None, cghub_key_path=None):
"""
Downloads URL, can pass in file://, http://, s3://, or ftp://, gnos://cghub/analysisID, or gnos:///analysisID
If downloading S3 URLs, the S3AM binary must be on the PATH
:param toil.job.Job job: Toil job tha... | def download_url(job, url, work_dir='.', name=None, s3_key_path=None, cghub_key_path=None):
"""
Downloads URL, can pass in file://, http://, s3://, or ftp://, gnos://cghub/analysisID, or gnos:///analysisID
If downloading S3 URLs, the S3AM binary must be on the PATH
:param toil.job.Job job: Toil job tha... | [
"Downloads",
"URL",
"can",
"pass",
"in",
"file",
":",
"//",
"http",
":",
"//",
"s3",
":",
"//",
"or",
"ftp",
":",
"//",
"gnos",
":",
"//",
"cghub",
"/",
"analysisID",
"or",
"gnos",
":",
"///",
"analysisID",
"If",
"downloading",
"S3",
"URLs",
"the",
... | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/urls.py#L15-L39 | [
"def",
"download_url",
"(",
"job",
",",
"url",
",",
"work_dir",
"=",
"'.'",
",",
"name",
"=",
"None",
",",
"s3_key_path",
"=",
"None",
",",
"cghub_key_path",
"=",
"None",
")",
":",
"file_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
",... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | download_url_job | Job version of `download_url` | src/toil_lib/urls.py | def download_url_job(job, url, name=None, s3_key_path=None, cghub_key_path=None):
"""Job version of `download_url`"""
work_dir = job.fileStore.getLocalTempDir()
fpath = download_url(job=job, url=url, work_dir=work_dir, name=name,
s3_key_path=s3_key_path, cghub_key_path=cghub_key_pat... | def download_url_job(job, url, name=None, s3_key_path=None, cghub_key_path=None):
"""Job version of `download_url`"""
work_dir = job.fileStore.getLocalTempDir()
fpath = download_url(job=job, url=url, work_dir=work_dir, name=name,
s3_key_path=s3_key_path, cghub_key_path=cghub_key_pat... | [
"Job",
"version",
"of",
"download_url"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/urls.py#L42-L47 | [
"def",
"download_url_job",
"(",
"job",
",",
"url",
",",
"name",
"=",
"None",
",",
"s3_key_path",
"=",
"None",
",",
"cghub_key_path",
"=",
"None",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"fpath",
"=",
"downloa... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | s3am_upload | Uploads a file to s3 via S3AM
S3AM binary must be on the PATH to use this function
For SSE-C encryption: provide a path to a 32-byte file
:param toil.job.Job job: Toil job that is calling this function
:param str fpath: Path to file to upload
:param str s3_dir: Ouptut S3 path. Format: s3://bucket/[... | src/toil_lib/urls.py | def s3am_upload(job, fpath, s3_dir, num_cores=1, s3_key_path=None):
"""
Uploads a file to s3 via S3AM
S3AM binary must be on the PATH to use this function
For SSE-C encryption: provide a path to a 32-byte file
:param toil.job.Job job: Toil job that is calling this function
:param str fpath: Pat... | def s3am_upload(job, fpath, s3_dir, num_cores=1, s3_key_path=None):
"""
Uploads a file to s3 via S3AM
S3AM binary must be on the PATH to use this function
For SSE-C encryption: provide a path to a 32-byte file
:param toil.job.Job job: Toil job that is calling this function
:param str fpath: Pat... | [
"Uploads",
"a",
"file",
"to",
"s3",
"via",
"S3AM",
"S3AM",
"binary",
"must",
"be",
"on",
"the",
"PATH",
"to",
"use",
"this",
"function",
"For",
"SSE",
"-",
"C",
"encryption",
":",
"provide",
"a",
"path",
"to",
"a",
"32",
"-",
"byte",
"file"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/urls.py#L63-L78 | [
"def",
"s3am_upload",
"(",
"job",
",",
"fpath",
",",
"s3_dir",
",",
"num_cores",
"=",
"1",
",",
"s3_key_path",
"=",
"None",
")",
":",
"require",
"(",
"s3_dir",
".",
"startswith",
"(",
"'s3://'",
")",
",",
"'Format of s3_dir (s3://) is incorrect: %s'",
",",
"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | s3am_upload_job | Job version of s3am_upload | src/toil_lib/urls.py | def s3am_upload_job(job, file_id, file_name, s3_dir, s3_key_path=None):
"""Job version of s3am_upload"""
work_dir = job.fileStore.getLocalTempDir()
fpath = job.fileStore.readGlobalFile(file_id, os.path.join(work_dir, file_name))
s3am_upload(job=job, fpath=fpath, s3_dir=s3_dir, num_cores=job.cores, s3_ke... | def s3am_upload_job(job, file_id, file_name, s3_dir, s3_key_path=None):
"""Job version of s3am_upload"""
work_dir = job.fileStore.getLocalTempDir()
fpath = job.fileStore.readGlobalFile(file_id, os.path.join(work_dir, file_name))
s3am_upload(job=job, fpath=fpath, s3_dir=s3_dir, num_cores=job.cores, s3_ke... | [
"Job",
"version",
"of",
"s3am_upload"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/urls.py#L81-L85 | [
"def",
"s3am_upload_job",
"(",
"job",
",",
"file_id",
",",
"file_name",
",",
"s3_dir",
",",
"s3_key_path",
"=",
"None",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"fpath",
"=",
"job",
".",
"fileStore",
".",
"rea... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | _s3am_with_retry | Run s3am with 3 retries
:param toil.job.Job job: Toil job that is calling this function
:param int num_cores: Number of cores to pass to upload/download slots
:param str file_path: Full path to the file
:param str s3_url: S3 URL
:param str mode: Mode to run s3am in. Either "upload" or "download"
... | src/toil_lib/urls.py | def _s3am_with_retry(job, num_cores, file_path, s3_url, mode='upload', s3_key_path=None):
"""
Run s3am with 3 retries
:param toil.job.Job job: Toil job that is calling this function
:param int num_cores: Number of cores to pass to upload/download slots
:param str file_path: Full path to the file
... | def _s3am_with_retry(job, num_cores, file_path, s3_url, mode='upload', s3_key_path=None):
"""
Run s3am with 3 retries
:param toil.job.Job job: Toil job that is calling this function
:param int num_cores: Number of cores to pass to upload/download slots
:param str file_path: Full path to the file
... | [
"Run",
"s3am",
"with",
"3",
"retries"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/urls.py#L88-L163 | [
"def",
"_s3am_with_retry",
"(",
"job",
",",
"num_cores",
",",
"file_path",
",",
"s3_url",
",",
"mode",
"=",
"'upload'",
",",
"s3_key_path",
"=",
"None",
")",
":",
"container_key_file",
"=",
"None",
"# try to find suitable credentials",
"base_boto",
"=",
"'.boto'",... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | labels | Output the names to the given file | src/ols_client/cli.py | def labels(ontology, output, ols_base):
"""Output the names to the given file"""
for label in get_labels(ontology=ontology, ols_base=ols_base):
click.echo(label, file=output) | def labels(ontology, output, ols_base):
"""Output the names to the given file"""
for label in get_labels(ontology=ontology, ols_base=ols_base):
click.echo(label, file=output) | [
"Output",
"the",
"names",
"to",
"the",
"given",
"file"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/cli.py#L19-L22 | [
"def",
"labels",
"(",
"ontology",
",",
"output",
",",
"ols_base",
")",
":",
"for",
"label",
"in",
"get_labels",
"(",
"ontology",
"=",
"ontology",
",",
"ols_base",
"=",
"ols_base",
")",
":",
"click",
".",
"echo",
"(",
"label",
",",
"file",
"=",
"output"... | 8c6bb54888675652d25324184967392d00d128fc |
test | tree | Output the parent-child relations to the given file | src/ols_client/cli.py | def tree(ontology, output, ols_base):
"""Output the parent-child relations to the given file"""
for parent, child in get_hierarchy(ontology=ontology, ols_base=ols_base):
click.echo('{}\t{}'.format(parent, child), file=output) | def tree(ontology, output, ols_base):
"""Output the parent-child relations to the given file"""
for parent, child in get_hierarchy(ontology=ontology, ols_base=ols_base):
click.echo('{}\t{}'.format(parent, child), file=output) | [
"Output",
"the",
"parent",
"-",
"child",
"relations",
"to",
"the",
"given",
"file"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/cli.py#L29-L32 | [
"def",
"tree",
"(",
"ontology",
",",
"output",
",",
"ols_base",
")",
":",
"for",
"parent",
",",
"child",
"in",
"get_hierarchy",
"(",
"ontology",
"=",
"ontology",
",",
"ols_base",
"=",
"ols_base",
")",
":",
"click",
".",
"echo",
"(",
"'{}\\t{}'",
".",
"... | 8c6bb54888675652d25324184967392d00d128fc |
test | get_mean_insert_size | Function taken from MC3 Pipeline | src/toil_lib/tools/__init__.py | def get_mean_insert_size(work_dir, bam_name):
"""Function taken from MC3 Pipeline"""
cmd = "docker run --log-driver=none --rm -v {}:/data quay.io/ucsc_cgl/samtools " \
"view -f66 {}".format(work_dir, os.path.join(work_dir, bam_name))
process = subprocess.Popen(args=cmd, shell=True, stdout=subproce... | def get_mean_insert_size(work_dir, bam_name):
"""Function taken from MC3 Pipeline"""
cmd = "docker run --log-driver=none --rm -v {}:/data quay.io/ucsc_cgl/samtools " \
"view -f66 {}".format(work_dir, os.path.join(work_dir, bam_name))
process = subprocess.Popen(args=cmd, shell=True, stdout=subproce... | [
"Function",
"taken",
"from",
"MC3",
"Pipeline"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/__init__.py#L5-L26 | [
"def",
"get_mean_insert_size",
"(",
"work_dir",
",",
"bam_name",
")",
":",
"cmd",
"=",
"\"docker run --log-driver=none --rm -v {}:/data quay.io/ucsc_cgl/samtools \"",
"\"view -f66 {}\"",
".",
"format",
"(",
"work_dir",
",",
"os",
".",
"path",
".",
"join",
"(",
"work_dir... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | partitions | >>> list(partitions([], 10))
[]
>>> list(partitions([1,2,3,4,5], 1))
[[1], [2], [3], [4], [5]]
>>> list(partitions([1,2,3,4,5], 2))
[[1, 2], [3, 4], [5]]
>>> list(partitions([1,2,3,4,5], 5))
[[1, 2, 3, 4, 5]]
:param list l: List to be partitioned
:param int partition_size: Size of p... | src/toil_lib/__init__.py | def partitions(l, partition_size):
"""
>>> list(partitions([], 10))
[]
>>> list(partitions([1,2,3,4,5], 1))
[[1], [2], [3], [4], [5]]
>>> list(partitions([1,2,3,4,5], 2))
[[1, 2], [3, 4], [5]]
>>> list(partitions([1,2,3,4,5], 5))
[[1, 2, 3, 4, 5]]
:param list l: List to be parti... | def partitions(l, partition_size):
"""
>>> list(partitions([], 10))
[]
>>> list(partitions([1,2,3,4,5], 1))
[[1], [2], [3], [4], [5]]
>>> list(partitions([1,2,3,4,5], 2))
[[1, 2], [3, 4], [5]]
>>> list(partitions([1,2,3,4,5], 5))
[[1, 2, 3, 4, 5]]
:param list l: List to be parti... | [
">>>",
"list",
"(",
"partitions",
"(",
"[]",
"10",
"))",
"[]",
">>>",
"list",
"(",
"partitions",
"(",
"[",
"1",
"2",
"3",
"4",
"5",
"]",
"1",
"))",
"[[",
"1",
"]",
"[",
"2",
"]",
"[",
"3",
"]",
"[",
"4",
"]",
"[",
"5",
"]]",
">>>",
"list"... | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/__init__.py#L25-L40 | [
"def",
"partitions",
"(",
"l",
",",
"partition_size",
")",
":",
"for",
"i",
"in",
"xrange",
"(",
"0",
",",
"len",
"(",
"l",
")",
",",
"partition_size",
")",
":",
"yield",
"l",
"[",
"i",
":",
"i",
"+",
"partition_size",
"]"
] | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | required_length | For use with argparse's action argument. Allows setting a range for nargs.
Example: nargs='+', action=required_length(2, 3)
:param int nmin: Minimum number of arguments
:param int nmax: Maximum number of arguments
:return: RequiredLength object | src/toil_lib/__init__.py | def required_length(nmin, nmax):
"""
For use with argparse's action argument. Allows setting a range for nargs.
Example: nargs='+', action=required_length(2, 3)
:param int nmin: Minimum number of arguments
:param int nmax: Maximum number of arguments
:return: RequiredLength object
"""
c... | def required_length(nmin, nmax):
"""
For use with argparse's action argument. Allows setting a range for nargs.
Example: nargs='+', action=required_length(2, 3)
:param int nmin: Minimum number of arguments
:param int nmax: Maximum number of arguments
:return: RequiredLength object
"""
c... | [
"For",
"use",
"with",
"argparse",
"s",
"action",
"argument",
".",
"Allows",
"setting",
"a",
"range",
"for",
"nargs",
".",
"Example",
":",
"nargs",
"=",
"+",
"action",
"=",
"required_length",
"(",
"2",
"3",
")"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/__init__.py#L54-L70 | [
"def",
"required_length",
"(",
"nmin",
",",
"nmax",
")",
":",
"class",
"RequiredLength",
"(",
"argparse",
".",
"Action",
")",
":",
"def",
"__call__",
"(",
"self",
",",
"parser",
",",
"args",
",",
"values",
",",
"option_string",
"=",
"None",
")",
":",
"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | current_docker_container_id | Returns a string that represents the container ID of the current Docker container. If this
function is invoked outside of a container a NotInsideContainerError is raised.
>>> import subprocess
>>> import sys
>>> a = subprocess.check_output(['docker', 'run', '-v',
... sy... | src/toil_lib/__init__.py | def current_docker_container_id():
"""
Returns a string that represents the container ID of the current Docker container. If this
function is invoked outside of a container a NotInsideContainerError is raised.
>>> import subprocess
>>> import sys
>>> a = subprocess.check_output(['docker', 'run'... | def current_docker_container_id():
"""
Returns a string that represents the container ID of the current Docker container. If this
function is invoked outside of a container a NotInsideContainerError is raised.
>>> import subprocess
>>> import sys
>>> a = subprocess.check_output(['docker', 'run'... | [
"Returns",
"a",
"string",
"that",
"represents",
"the",
"container",
"ID",
"of",
"the",
"current",
"Docker",
"container",
".",
"If",
"this",
"function",
"is",
"invoked",
"outside",
"of",
"a",
"container",
"a",
"NotInsideContainerError",
"is",
"raised",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/__init__.py#L98-L122 | [
"def",
"current_docker_container_id",
"(",
")",
":",
"try",
":",
"with",
"open",
"(",
"'/proc/1/cgroup'",
",",
"'r'",
")",
"as",
"readable",
":",
"raw",
"=",
"readable",
".",
"read",
"(",
")",
"ids",
"=",
"set",
"(",
"re",
".",
"compile",
"(",
"'[0-9a-... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_star | Performs alignment of fastqs to bam via STAR
--limitBAMsortRAM step added to deal with memory explosion when sorting certain samples.
The value was chosen to complement the recommended amount of memory to have when running STAR (60G)
:param JobFunctionWrappingJob job: passed automatically by Toil
:par... | src/toil_lib/tools/aligners.py | def run_star(job, r1_id, r2_id, star_index_url, wiggle=False, sort=True):
"""
Performs alignment of fastqs to bam via STAR
--limitBAMsortRAM step added to deal with memory explosion when sorting certain samples.
The value was chosen to complement the recommended amount of memory to have when running ST... | def run_star(job, r1_id, r2_id, star_index_url, wiggle=False, sort=True):
"""
Performs alignment of fastqs to bam via STAR
--limitBAMsortRAM step added to deal with memory explosion when sorting certain samples.
The value was chosen to complement the recommended amount of memory to have when running ST... | [
"Performs",
"alignment",
"of",
"fastqs",
"to",
"bam",
"via",
"STAR"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/aligners.py#L9-L82 | [
"def",
"run_star",
"(",
"job",
",",
"r1_id",
",",
"r2_id",
",",
"star_index_url",
",",
"wiggle",
"=",
"False",
",",
"sort",
"=",
"True",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"download_url",
"(",
"job",
"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_bwakit | Runs BWA-Kit to align single or paired-end fastq files or realign SAM/BAM files.
:param JobFunctionWrappingJob job: Passed by Toil automatically
:param Namespace config: A configuration object that holds strings as attributes.
The attributes must be accessible via the dot operator.
The config m... | src/toil_lib/tools/aligners.py | def run_bwakit(job, config, sort=True, trim=False, mark_secondary=False):
"""
Runs BWA-Kit to align single or paired-end fastq files or realign SAM/BAM files.
:param JobFunctionWrappingJob job: Passed by Toil automatically
:param Namespace config: A configuration object that holds strings as attributes... | def run_bwakit(job, config, sort=True, trim=False, mark_secondary=False):
"""
Runs BWA-Kit to align single or paired-end fastq files or realign SAM/BAM files.
:param JobFunctionWrappingJob job: Passed by Toil automatically
:param Namespace config: A configuration object that holds strings as attributes... | [
"Runs",
"BWA",
"-",
"Kit",
"to",
"align",
"single",
"or",
"paired",
"-",
"end",
"fastq",
"files",
"or",
"realign",
"SAM",
"/",
"BAM",
"files",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/aligners.py#L85-L188 | [
"def",
"run_bwakit",
"(",
"job",
",",
"config",
",",
"sort",
"=",
"True",
",",
"trim",
"=",
"False",
",",
"mark_secondary",
"=",
"False",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"rg",
"=",
"None",
"inputs",... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | query_maker | query_maker takes the optional arguments and constructs a json query for a stream's
datapoints using it::
#{"t1": 5, "transform": "if $ > 5"}
print query_maker(t1=5,transform="if $ > 5") | connectordb/_stream.py | def query_maker(t1=None, t2=None, limit=None, i1=None, i2=None, transform=None, downlink=False):
"""query_maker takes the optional arguments and constructs a json query for a stream's
datapoints using it::
#{"t1": 5, "transform": "if $ > 5"}
print query_maker(t1=5,transform="if $ > 5")
"""
... | def query_maker(t1=None, t2=None, limit=None, i1=None, i2=None, transform=None, downlink=False):
"""query_maker takes the optional arguments and constructs a json query for a stream's
datapoints using it::
#{"t1": 5, "transform": "if $ > 5"}
print query_maker(t1=5,transform="if $ > 5")
"""
... | [
"query_maker",
"takes",
"the",
"optional",
"arguments",
"and",
"constructs",
"a",
"json",
"query",
"for",
"a",
"stream",
"s",
"datapoints",
"using",
"it",
"::",
"#",
"{",
"t1",
":",
"5",
"transform",
":",
"if",
"$",
">",
"5",
"}",
"print",
"query_maker",... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L21-L53 | [
"def",
"query_maker",
"(",
"t1",
"=",
"None",
",",
"t2",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"i1",
"=",
"None",
",",
"i2",
"=",
"None",
",",
"transform",
"=",
"None",
",",
"downlink",
"=",
"False",
")",
":",
"params",
"=",
"{",
"}",
"i... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Stream.create | Creates a stream given an optional JSON schema encoded as a python dict. You can also add other properties
of the stream, such as the icon, datatype or description. Create accepts both a string schema and
a dict-encoded schema. | connectordb/_stream.py | def create(self, schema="{}", **kwargs):
"""Creates a stream given an optional JSON schema encoded as a python dict. You can also add other properties
of the stream, such as the icon, datatype or description. Create accepts both a string schema and
a dict-encoded schema."""
if isinstance... | def create(self, schema="{}", **kwargs):
"""Creates a stream given an optional JSON schema encoded as a python dict. You can also add other properties
of the stream, such as the icon, datatype or description. Create accepts both a string schema and
a dict-encoded schema."""
if isinstance... | [
"Creates",
"a",
"stream",
"given",
"an",
"optional",
"JSON",
"schema",
"encoded",
"as",
"a",
"python",
"dict",
".",
"You",
"can",
"also",
"add",
"other",
"properties",
"of",
"the",
"stream",
"such",
"as",
"the",
"icon",
"datatype",
"or",
"description",
"."... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L58-L69 | [
"def",
"create",
"(",
"self",
",",
"schema",
"=",
"\"{}\"",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"schema",
",",
"basestring",
")",
":",
"strschema",
"=",
"schema",
"schema",
"=",
"json",
".",
"loads",
"(",
"schema",
")",
"else"... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Stream.insert_array | given an array of datapoints, inserts them to the stream. This is different from insert(),
because it requires an array of valid datapoints, whereas insert only requires the data portion
of the datapoint, and fills out the rest::
s = cdb["mystream"]
s.create({"type": "number"})
... | connectordb/_stream.py | def insert_array(self, datapoint_array, restamp=False):
"""given an array of datapoints, inserts them to the stream. This is different from insert(),
because it requires an array of valid datapoints, whereas insert only requires the data portion
of the datapoint, and fills out the rest::
... | def insert_array(self, datapoint_array, restamp=False):
"""given an array of datapoints, inserts them to the stream. This is different from insert(),
because it requires an array of valid datapoints, whereas insert only requires the data portion
of the datapoint, and fills out the rest::
... | [
"given",
"an",
"array",
"of",
"datapoints",
"inserts",
"them",
"to",
"the",
"stream",
".",
"This",
"is",
"different",
"from",
"insert",
"()",
"because",
"it",
"requires",
"an",
"array",
"of",
"valid",
"datapoints",
"whereas",
"insert",
"only",
"requires",
"t... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L71-L108 | [
"def",
"insert_array",
"(",
"self",
",",
"datapoint_array",
",",
"restamp",
"=",
"False",
")",
":",
"# To be safe, we split into chunks",
"while",
"(",
"len",
"(",
"datapoint_array",
")",
">",
"DATAPOINT_INSERT_LIMIT",
")",
":",
"# We insert datapoints in chunks of a co... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Stream.insert | insert inserts one datapoint with the given data, and appends it to
the end of the stream::
s = cdb["mystream"]
s.create({"type": "string"})
s.insert("Hello World!") | connectordb/_stream.py | def insert(self, data):
"""insert inserts one datapoint with the given data, and appends it to
the end of the stream::
s = cdb["mystream"]
s.create({"type": "string"})
s.insert("Hello World!")
"""
self.insert_array([{"d": data, "t": time.time()}], ... | def insert(self, data):
"""insert inserts one datapoint with the given data, and appends it to
the end of the stream::
s = cdb["mystream"]
s.create({"type": "string"})
s.insert("Hello World!")
"""
self.insert_array([{"d": data, "t": time.time()}], ... | [
"insert",
"inserts",
"one",
"datapoint",
"with",
"the",
"given",
"data",
"and",
"appends",
"it",
"to",
"the",
"end",
"of",
"the",
"stream",
"::"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L110-L121 | [
"def",
"insert",
"(",
"self",
",",
"data",
")",
":",
"self",
".",
"insert_array",
"(",
"[",
"{",
"\"d\"",
":",
"data",
",",
"\"t\"",
":",
"time",
".",
"time",
"(",
")",
"}",
"]",
",",
"restamp",
"=",
"True",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Stream.subscribe | Subscribes to the stream, running the callback function each time datapoints are inserted into
the given stream. There is an optional transform to the datapoints, and a downlink parameter.::
s = cdb["mystream"]
def subscription_callback(stream,data):
print stream, data
... | connectordb/_stream.py | def subscribe(self, callback, transform="", downlink=False):
"""Subscribes to the stream, running the callback function each time datapoints are inserted into
the given stream. There is an optional transform to the datapoints, and a downlink parameter.::
s = cdb["mystream"]
def... | def subscribe(self, callback, transform="", downlink=False):
"""Subscribes to the stream, running the callback function each time datapoints are inserted into
the given stream. There is an optional transform to the datapoints, and a downlink parameter.::
s = cdb["mystream"]
def... | [
"Subscribes",
"to",
"the",
"stream",
"running",
"the",
"callback",
"function",
"each",
"time",
"datapoints",
"are",
"inserted",
"into",
"the",
"given",
"stream",
".",
"There",
"is",
"an",
"optional",
"transform",
"to",
"the",
"datapoints",
"and",
"a",
"downlin... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L127-L160 | [
"def",
"subscribe",
"(",
"self",
",",
"callback",
",",
"transform",
"=",
"\"\"",
",",
"downlink",
"=",
"False",
")",
":",
"streampath",
"=",
"self",
".",
"path",
"if",
"downlink",
":",
"streampath",
"+=",
"\"/downlink\"",
"return",
"self",
".",
"db",
"."... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Stream.unsubscribe | Unsubscribes from a previously subscribed stream. Note that the same values of transform
and downlink must be passed in order to do the correct unsubscribe::
s.subscribe(callback,transform="if last")
s.unsubscribe(transform="if last") | connectordb/_stream.py | def unsubscribe(self, transform="", downlink=False):
"""Unsubscribes from a previously subscribed stream. Note that the same values of transform
and downlink must be passed in order to do the correct unsubscribe::
s.subscribe(callback,transform="if last")
s.unsubscribe(transform... | def unsubscribe(self, transform="", downlink=False):
"""Unsubscribes from a previously subscribed stream. Note that the same values of transform
and downlink must be passed in order to do the correct unsubscribe::
s.subscribe(callback,transform="if last")
s.unsubscribe(transform... | [
"Unsubscribes",
"from",
"a",
"previously",
"subscribed",
"stream",
".",
"Note",
"that",
"the",
"same",
"values",
"of",
"transform",
"and",
"downlink",
"must",
"be",
"passed",
"in",
"order",
"to",
"do",
"the",
"correct",
"unsubscribe",
"::"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L162-L173 | [
"def",
"unsubscribe",
"(",
"self",
",",
"transform",
"=",
"\"\"",
",",
"downlink",
"=",
"False",
")",
":",
"streampath",
"=",
"self",
".",
"path",
"if",
"downlink",
":",
"streampath",
"+=",
"\"/downlink\"",
"return",
"self",
".",
"db",
".",
"unsubscribe",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Stream.export | Exports the stream to the given directory. The directory can't exist.
You can later import this device by running import_stream on a device. | connectordb/_stream.py | def export(self, directory):
"""Exports the stream to the given directory. The directory can't exist.
You can later import this device by running import_stream on a device.
"""
if os.path.exists(directory):
raise FileExistsError(
"The stream export directory ... | def export(self, directory):
"""Exports the stream to the given directory. The directory can't exist.
You can later import this device by running import_stream on a device.
"""
if os.path.exists(directory):
raise FileExistsError(
"The stream export directory ... | [
"Exports",
"the",
"stream",
"to",
"the",
"given",
"directory",
".",
"The",
"directory",
"can",
"t",
"exist",
".",
"You",
"can",
"later",
"import",
"this",
"device",
"by",
"running",
"import_stream",
"on",
"a",
"device",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L228-L249 | [
"def",
"export",
"(",
"self",
",",
"directory",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"directory",
")",
":",
"raise",
"FileExistsError",
"(",
"\"The stream export directory already exists\"",
")",
"os",
".",
"mkdir",
"(",
"directory",
")",
"... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Stream.schema | sets the stream's schema. An empty schema is "{}". The schemas allow you to set a specific data type.
Both python dicts and strings are accepted. | connectordb/_stream.py | def schema(self, schema):
"""sets the stream's schema. An empty schema is "{}". The schemas allow you to set a specific data type.
Both python dicts and strings are accepted."""
if isinstance(schema, basestring):
strschema = schema
schema = json.loads(schema)
els... | def schema(self, schema):
"""sets the stream's schema. An empty schema is "{}". The schemas allow you to set a specific data type.
Both python dicts and strings are accepted."""
if isinstance(schema, basestring):
strschema = schema
schema = json.loads(schema)
els... | [
"sets",
"the",
"stream",
"s",
"schema",
".",
"An",
"empty",
"schema",
"is",
"{}",
".",
"The",
"schemas",
"allow",
"you",
"to",
"set",
"a",
"specific",
"data",
"type",
".",
"Both",
"python",
"dicts",
"and",
"strings",
"are",
"accepted",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L305-L314 | [
"def",
"schema",
"(",
"self",
",",
"schema",
")",
":",
"if",
"isinstance",
"(",
"schema",
",",
"basestring",
")",
":",
"strschema",
"=",
"schema",
"schema",
"=",
"json",
".",
"loads",
"(",
"schema",
")",
"else",
":",
"strschema",
"=",
"json",
".",
"d... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | Stream.device | returns the device which owns the given stream | connectordb/_stream.py | def device(self):
"""returns the device which owns the given stream"""
splitted_path = self.path.split("/")
return Device(self.db,
splitted_path[0] + "/" + splitted_path[1]) | def device(self):
"""returns the device which owns the given stream"""
splitted_path = self.path.split("/")
return Device(self.db,
splitted_path[0] + "/" + splitted_path[1]) | [
"returns",
"the",
"device",
"which",
"owns",
"the",
"given",
"stream"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_stream.py#L322-L327 | [
"def",
"device",
"(",
"self",
")",
":",
"splitted_path",
"=",
"self",
".",
"path",
".",
"split",
"(",
"\"/\"",
")",
"return",
"Device",
"(",
"self",
".",
"db",
",",
"splitted_path",
"[",
"0",
"]",
"+",
"\"/\"",
"+",
"splitted_path",
"[",
"1",
"]",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | get_labels | Iterates over the labels of terms in the ontology
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:rtype: iter[str] | src/ols_client/api.py | def get_labels(ontology, ols_base=None):
"""Iterates over the labels of terms in the ontology
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:rtype: iter[str]
"""
client = OlsClient(ols_base=ols_base)
return client.iter_labels(ontology) | def get_labels(ontology, ols_base=None):
"""Iterates over the labels of terms in the ontology
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:rtype: iter[str]
"""
client = OlsClient(ols_base=ols_base)
return client.iter_labels(ontology) | [
"Iterates",
"over",
"the",
"labels",
"of",
"terms",
"in",
"the",
"ontology"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/api.py#L16-L24 | [
"def",
"get_labels",
"(",
"ontology",
",",
"ols_base",
"=",
"None",
")",
":",
"client",
"=",
"OlsClient",
"(",
"ols_base",
"=",
"ols_base",
")",
"return",
"client",
".",
"iter_labels",
"(",
"ontology",
")"
] | 8c6bb54888675652d25324184967392d00d128fc |
test | get_metadata | Gets the metadata for a given ontology
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:return: The dictionary representing the JSON from the OLS
:rtype: dict | src/ols_client/api.py | def get_metadata(ontology, ols_base=None):
"""Gets the metadata for a given ontology
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:return: The dictionary representing the JSON from the OLS
:rtype: dict
"""
client = OlsClient(ols_base=ol... | def get_metadata(ontology, ols_base=None):
"""Gets the metadata for a given ontology
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:return: The dictionary representing the JSON from the OLS
:rtype: dict
"""
client = OlsClient(ols_base=ol... | [
"Gets",
"the",
"metadata",
"for",
"a",
"given",
"ontology"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/api.py#L27-L36 | [
"def",
"get_metadata",
"(",
"ontology",
",",
"ols_base",
"=",
"None",
")",
":",
"client",
"=",
"OlsClient",
"(",
"ols_base",
"=",
"ols_base",
")",
"return",
"client",
".",
"get_ontology",
"(",
"ontology",
")"
] | 8c6bb54888675652d25324184967392d00d128fc |
test | get_hierarchy | Iterates over the parent-child relationships in an ontolog
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:rtype: iter[tuple[str,str]] | src/ols_client/api.py | def get_hierarchy(ontology, ols_base=None):
"""Iterates over the parent-child relationships in an ontolog
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:rtype: iter[tuple[str,str]]
"""
client = OlsClient(ols_base=ols_base)
return client.... | def get_hierarchy(ontology, ols_base=None):
"""Iterates over the parent-child relationships in an ontolog
:param str ontology: The name of the ontology
:param str ols_base: An optional, custom OLS base url
:rtype: iter[tuple[str,str]]
"""
client = OlsClient(ols_base=ols_base)
return client.... | [
"Iterates",
"over",
"the",
"parent",
"-",
"child",
"relationships",
"in",
"an",
"ontolog"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/api.py#L39-L47 | [
"def",
"get_hierarchy",
"(",
"ontology",
",",
"ols_base",
"=",
"None",
")",
":",
"client",
"=",
"OlsClient",
"(",
"ols_base",
"=",
"ols_base",
")",
"return",
"client",
".",
"iter_hierarchy",
"(",
"ontology",
")"
] | 8c6bb54888675652d25324184967392d00d128fc |
test | AbstractPipelineWrapper.run | Prepares and runs the pipeline. Note this method must be invoked both from inside a
Docker container and while the docker daemon is reachable.
:param str name: The name of the command to start the workflow.
:param str desc: The description of the workflow. | src/toil_lib/abstractPipelineWrapper.py | def run(cls, name, desc):
"""
Prepares and runs the pipeline. Note this method must be invoked both from inside a
Docker container and while the docker daemon is reachable.
:param str name: The name of the command to start the workflow.
:param str desc: The description of the wo... | def run(cls, name, desc):
"""
Prepares and runs the pipeline. Note this method must be invoked both from inside a
Docker container and while the docker daemon is reachable.
:param str name: The name of the command to start the workflow.
:param str desc: The description of the wo... | [
"Prepares",
"and",
"runs",
"the",
"pipeline",
".",
"Note",
"this",
"method",
"must",
"be",
"invoked",
"both",
"from",
"inside",
"a",
"Docker",
"container",
"and",
"while",
"the",
"docker",
"daemon",
"is",
"reachable",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L32-L86 | [
"def",
"run",
"(",
"cls",
",",
"name",
",",
"desc",
")",
":",
"wrapper",
"=",
"cls",
"(",
"name",
",",
"desc",
")",
"mount_path",
"=",
"wrapper",
".",
"_get_mount_path",
"(",
")",
"# prepare parser",
"arg_parser",
"=",
"wrapper",
".",
"_create_argument_par... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | AbstractPipelineWrapper.__populate_parser_from_config | Populates an ArgumentParser object with arguments where each argument is a key from the
given config_data dictionary.
:param str prefix: Prepends the key with this prefix delimited by a single '.' character.
:param argparse.ArgumentParser arg_parser:
:param dict config_data: The parsed ... | src/toil_lib/abstractPipelineWrapper.py | def __populate_parser_from_config(self, arg_parser, config_data, prefix=''):
"""
Populates an ArgumentParser object with arguments where each argument is a key from the
given config_data dictionary.
:param str prefix: Prepends the key with this prefix delimited by a single '.' character... | def __populate_parser_from_config(self, arg_parser, config_data, prefix=''):
"""
Populates an ArgumentParser object with arguments where each argument is a key from the
given config_data dictionary.
:param str prefix: Prepends the key with this prefix delimited by a single '.' character... | [
"Populates",
"an",
"ArgumentParser",
"object",
"with",
"arguments",
"where",
"each",
"argument",
"is",
"a",
"key",
"from",
"the",
"given",
"config_data",
"dictionary",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L88-L121 | [
"def",
"__populate_parser_from_config",
"(",
"self",
",",
"arg_parser",
",",
"config_data",
",",
"prefix",
"=",
"''",
")",
":",
"for",
"k",
",",
"v",
"in",
"config_data",
".",
"items",
"(",
")",
":",
"k",
"=",
"prefix",
"+",
"'.'",
"+",
"k",
"if",
"p... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | AbstractPipelineWrapper.__get_empty_config | Returns the config file contents as a string. The config file is generated and then deleted. | src/toil_lib/abstractPipelineWrapper.py | def __get_empty_config(self):
"""
Returns the config file contents as a string. The config file is generated and then deleted.
"""
self._generate_config()
path = self._get_config_path()
with open(path, 'r') as readable:
contents = readable.read()
os.re... | def __get_empty_config(self):
"""
Returns the config file contents as a string. The config file is generated and then deleted.
"""
self._generate_config()
path = self._get_config_path()
with open(path, 'r') as readable:
contents = readable.read()
os.re... | [
"Returns",
"the",
"config",
"file",
"contents",
"as",
"a",
"string",
".",
"The",
"config",
"file",
"is",
"generated",
"and",
"then",
"deleted",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L123-L132 | [
"def",
"__get_empty_config",
"(",
"self",
")",
":",
"self",
".",
"_generate_config",
"(",
")",
"path",
"=",
"self",
".",
"_get_config_path",
"(",
")",
"with",
"open",
"(",
"path",
",",
"'r'",
")",
"as",
"readable",
":",
"contents",
"=",
"readable",
".",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | AbstractPipelineWrapper._get_mount_path | Returns the path of the mount point of the current container. If this method is invoked
outside of a Docker container a NotInsideContainerError is raised. Likewise if the docker
daemon is unreachable from inside the container a UserError is raised. This method is
idempotent. | src/toil_lib/abstractPipelineWrapper.py | def _get_mount_path(self):
"""
Returns the path of the mount point of the current container. If this method is invoked
outside of a Docker container a NotInsideContainerError is raised. Likewise if the docker
daemon is unreachable from inside the container a UserError is raised. This met... | def _get_mount_path(self):
"""
Returns the path of the mount point of the current container. If this method is invoked
outside of a Docker container a NotInsideContainerError is raised. Likewise if the docker
daemon is unreachable from inside the container a UserError is raised. This met... | [
"Returns",
"the",
"path",
"of",
"the",
"mount",
"point",
"of",
"the",
"current",
"container",
".",
"If",
"this",
"method",
"is",
"invoked",
"outside",
"of",
"a",
"Docker",
"container",
"a",
"NotInsideContainerError",
"is",
"raised",
".",
"Likewise",
"if",
"t... | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L134-L171 | [
"def",
"_get_mount_path",
"(",
"self",
")",
":",
"if",
"self",
".",
"_mount_path",
"is",
"None",
":",
"name",
"=",
"current_docker_container_id",
"(",
")",
"if",
"dockerd_is_reachable",
"(",
")",
":",
"# Get name of mounted volume",
"blob",
"=",
"json",
".",
"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | AbstractPipelineWrapper._add_option | Add an argument to the given arg_parser with the given name.
:param argparse.ArgumentParser arg_parser:
:param str name: The name of the option. | src/toil_lib/abstractPipelineWrapper.py | def _add_option(self, arg_parser, name, *args, **kwargs):
"""
Add an argument to the given arg_parser with the given name.
:param argparse.ArgumentParser arg_parser:
:param str name: The name of the option.
"""
arg_parser.add_argument('--' + name, *args, **kwargs) | def _add_option(self, arg_parser, name, *args, **kwargs):
"""
Add an argument to the given arg_parser with the given name.
:param argparse.ArgumentParser arg_parser:
:param str name: The name of the option.
"""
arg_parser.add_argument('--' + name, *args, **kwargs) | [
"Add",
"an",
"argument",
"to",
"the",
"given",
"arg_parser",
"with",
"the",
"given",
"name",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L185-L192 | [
"def",
"_add_option",
"(",
"self",
",",
"arg_parser",
",",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"arg_parser",
".",
"add_argument",
"(",
"'--'",
"+",
"name",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | AbstractPipelineWrapper._create_argument_parser | Creates and returns an ArgumentParser object prepopulated with 'no clean', 'cores' and
'restart' arguments. | src/toil_lib/abstractPipelineWrapper.py | def _create_argument_parser(self):
"""
Creates and returns an ArgumentParser object prepopulated with 'no clean', 'cores' and
'restart' arguments.
"""
parser = argparse.ArgumentParser(description=self._desc,
formatter_class=argparse.RawTex... | def _create_argument_parser(self):
"""
Creates and returns an ArgumentParser object prepopulated with 'no clean', 'cores' and
'restart' arguments.
"""
parser = argparse.ArgumentParser(description=self._desc,
formatter_class=argparse.RawTex... | [
"Creates",
"and",
"returns",
"an",
"ArgumentParser",
"object",
"prepopulated",
"with",
"no",
"clean",
"cores",
"and",
"restart",
"arguments",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L194-L209 | [
"def",
"_create_argument_parser",
"(",
"self",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"self",
".",
"_desc",
",",
"formatter_class",
"=",
"argparse",
".",
"RawTextHelpFormatter",
")",
"parser",
".",
"add_argument",
"(... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | AbstractPipelineWrapper._create_pipeline_command | Creates and returns a list that represents a command for running the pipeline. | src/toil_lib/abstractPipelineWrapper.py | def _create_pipeline_command(self, args, workdir_path, config_path):
"""
Creates and returns a list that represents a command for running the pipeline.
"""
return ([self._name, 'run', os.path.join(workdir_path, 'jobStore'),
'--config', config_path,
'--wo... | def _create_pipeline_command(self, args, workdir_path, config_path):
"""
Creates and returns a list that represents a command for running the pipeline.
"""
return ([self._name, 'run', os.path.join(workdir_path, 'jobStore'),
'--config', config_path,
'--wo... | [
"Creates",
"and",
"returns",
"a",
"list",
"that",
"represents",
"a",
"command",
"for",
"running",
"the",
"pipeline",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/abstractPipelineWrapper.py#L211-L218 | [
"def",
"_create_pipeline_command",
"(",
"self",
",",
"args",
",",
"workdir_path",
",",
"config_path",
")",
":",
"return",
"(",
"[",
"self",
".",
"_name",
",",
"'run'",
",",
"os",
".",
"path",
".",
"join",
"(",
"workdir_path",
",",
"'jobStore'",
")",
",",... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | DatabaseConnection.setauth | setauth sets the authentication header for use in the session.
It is for use when apikey is updated or something of the sort, such that
there is a seamless experience. | connectordb/_connection.py | def setauth(self, user_or_apikey=None, user_password=None):
""" setauth sets the authentication header for use in the session.
It is for use when apikey is updated or something of the sort, such that
there is a seamless experience. """
auth = None
if user_or_apikey is not None:
... | def setauth(self, user_or_apikey=None, user_password=None):
""" setauth sets the authentication header for use in the session.
It is for use when apikey is updated or something of the sort, such that
there is a seamless experience. """
auth = None
if user_or_apikey is not None:
... | [
"setauth",
"sets",
"the",
"authentication",
"header",
"for",
"use",
"in",
"the",
"session",
".",
"It",
"is",
"for",
"use",
"when",
"apikey",
"is",
"updated",
"or",
"something",
"of",
"the",
"sort",
"such",
"that",
"there",
"is",
"a",
"seamless",
"experienc... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L68-L85 | [
"def",
"setauth",
"(",
"self",
",",
"user_or_apikey",
"=",
"None",
",",
"user_password",
"=",
"None",
")",
":",
"auth",
"=",
"None",
"if",
"user_or_apikey",
"is",
"not",
"None",
":",
"# ConnectorDB allows login using both basic auth or an apikey url param.",
"# The py... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatabaseConnection.handleresult | Handles HTTP error codes for the given request
Raises:
AuthenticationError on the appropriate 4** errors
ServerError if the response is not an ok (2**)
Arguments:
r -- The request result | connectordb/_connection.py | def handleresult(self, r):
"""Handles HTTP error codes for the given request
Raises:
AuthenticationError on the appropriate 4** errors
ServerError if the response is not an ok (2**)
Arguments:
r -- The request result
"""
if r.status_code >= 4... | def handleresult(self, r):
"""Handles HTTP error codes for the given request
Raises:
AuthenticationError on the appropriate 4** errors
ServerError if the response is not an ok (2**)
Arguments:
r -- The request result
"""
if r.status_code >= 4... | [
"Handles",
"HTTP",
"error",
"codes",
"for",
"the",
"given",
"request"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L91-L115 | [
"def",
"handleresult",
"(",
"self",
",",
"r",
")",
":",
"if",
"r",
".",
"status_code",
">=",
"400",
"and",
"r",
".",
"status_code",
"<",
"500",
":",
"msg",
"=",
"r",
".",
"json",
"(",
")",
"raise",
"AuthenticationError",
"(",
"str",
"(",
"msg",
"["... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatabaseConnection.ping | Attempts to ping the server using current credentials, and responds with the path of the currently
authenticated device | connectordb/_connection.py | def ping(self):
"""Attempts to ping the server using current credentials, and responds with the path of the currently
authenticated device"""
return self.handleresult(self.r.get(self.url,
params={"q": "this"})).text | def ping(self):
"""Attempts to ping the server using current credentials, and responds with the path of the currently
authenticated device"""
return self.handleresult(self.r.get(self.url,
params={"q": "this"})).text | [
"Attempts",
"to",
"ping",
"the",
"server",
"using",
"current",
"credentials",
"and",
"responds",
"with",
"the",
"path",
"of",
"the",
"currently",
"authenticated",
"device"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L117-L121 | [
"def",
"ping",
"(",
"self",
")",
":",
"return",
"self",
".",
"handleresult",
"(",
"self",
".",
"r",
".",
"get",
"(",
"self",
".",
"url",
",",
"params",
"=",
"{",
"\"q\"",
":",
"\"this\"",
"}",
")",
")",
".",
"text"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatabaseConnection.query | Run the given query on the connection (POST request to /query) | connectordb/_connection.py | def query(self, query_type, query=None):
"""Run the given query on the connection (POST request to /query)"""
return self.handleresult(self.r.post(urljoin(self.url + "query/",
query_type),
data=json.dumps(q... | def query(self, query_type, query=None):
"""Run the given query on the connection (POST request to /query)"""
return self.handleresult(self.r.post(urljoin(self.url + "query/",
query_type),
data=json.dumps(q... | [
"Run",
"the",
"given",
"query",
"on",
"the",
"connection",
"(",
"POST",
"request",
"to",
"/",
"query",
")"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L123-L127 | [
"def",
"query",
"(",
"self",
",",
"query_type",
",",
"query",
"=",
"None",
")",
":",
"return",
"self",
".",
"handleresult",
"(",
"self",
".",
"r",
".",
"post",
"(",
"urljoin",
"(",
"self",
".",
"url",
"+",
"\"query/\"",
",",
"query_type",
")",
",",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatabaseConnection.create | Send a POST CRUD API request to the given path using the given data which will be converted
to json | connectordb/_connection.py | def create(self, path, data=None):
"""Send a POST CRUD API request to the given path using the given data which will be converted
to json"""
return self.handleresult(self.r.post(urljoin(self.url + CRUD_PATH,
path),
... | def create(self, path, data=None):
"""Send a POST CRUD API request to the given path using the given data which will be converted
to json"""
return self.handleresult(self.r.post(urljoin(self.url + CRUD_PATH,
path),
... | [
"Send",
"a",
"POST",
"CRUD",
"API",
"request",
"to",
"the",
"given",
"path",
"using",
"the",
"given",
"data",
"which",
"will",
"be",
"converted",
"to",
"json"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L129-L134 | [
"def",
"create",
"(",
"self",
",",
"path",
",",
"data",
"=",
"None",
")",
":",
"return",
"self",
".",
"handleresult",
"(",
"self",
".",
"r",
".",
"post",
"(",
"urljoin",
"(",
"self",
".",
"url",
"+",
"CRUD_PATH",
",",
"path",
")",
",",
"data",
"=... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatabaseConnection.read | Read the result at the given path (GET) from the CRUD API, using the optional params dictionary
as url parameters. | connectordb/_connection.py | def read(self, path, params=None):
"""Read the result at the given path (GET) from the CRUD API, using the optional params dictionary
as url parameters."""
return self.handleresult(self.r.get(urljoin(self.url + CRUD_PATH,
path),
... | def read(self, path, params=None):
"""Read the result at the given path (GET) from the CRUD API, using the optional params dictionary
as url parameters."""
return self.handleresult(self.r.get(urljoin(self.url + CRUD_PATH,
path),
... | [
"Read",
"the",
"result",
"at",
"the",
"given",
"path",
"(",
"GET",
")",
"from",
"the",
"CRUD",
"API",
"using",
"the",
"optional",
"params",
"dictionary",
"as",
"url",
"parameters",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L136-L141 | [
"def",
"read",
"(",
"self",
",",
"path",
",",
"params",
"=",
"None",
")",
":",
"return",
"self",
".",
"handleresult",
"(",
"self",
".",
"r",
".",
"get",
"(",
"urljoin",
"(",
"self",
".",
"url",
"+",
"CRUD_PATH",
",",
"path",
")",
",",
"params",
"... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatabaseConnection.update | Send an update request to the given path of the CRUD API, with the given data dict, which will be converted
into json | connectordb/_connection.py | def update(self, path, data=None):
"""Send an update request to the given path of the CRUD API, with the given data dict, which will be converted
into json"""
return self.handleresult(self.r.put(urljoin(self.url + CRUD_PATH,
path),
... | def update(self, path, data=None):
"""Send an update request to the given path of the CRUD API, with the given data dict, which will be converted
into json"""
return self.handleresult(self.r.put(urljoin(self.url + CRUD_PATH,
path),
... | [
"Send",
"an",
"update",
"request",
"to",
"the",
"given",
"path",
"of",
"the",
"CRUD",
"API",
"with",
"the",
"given",
"data",
"dict",
"which",
"will",
"be",
"converted",
"into",
"json"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L143-L148 | [
"def",
"update",
"(",
"self",
",",
"path",
",",
"data",
"=",
"None",
")",
":",
"return",
"self",
".",
"handleresult",
"(",
"self",
".",
"r",
".",
"put",
"(",
"urljoin",
"(",
"self",
".",
"url",
"+",
"CRUD_PATH",
",",
"path",
")",
",",
"data",
"="... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.