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 | DatabaseConnection.delete | Send a delete request to the given path of the CRUD API. This deletes the object. Or at least tries to. | connectordb/_connection.py | def delete(self, path):
"""Send a delete request to the given path of the CRUD API. This deletes the object. Or at least tries to."""
return self.handleresult(self.r.delete(urljoin(self.url + CRUD_PATH,
path))) | def delete(self, path):
"""Send a delete request to the given path of the CRUD API. This deletes the object. Or at least tries to."""
return self.handleresult(self.r.delete(urljoin(self.url + CRUD_PATH,
path))) | [
"Send",
"a",
"delete",
"request",
"to",
"the",
"given",
"path",
"of",
"the",
"CRUD",
"API",
".",
"This",
"deletes",
"the",
"object",
".",
"Or",
"at",
"least",
"tries",
"to",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L150-L153 | [
"def",
"delete",
"(",
"self",
",",
"path",
")",
":",
"return",
"self",
".",
"handleresult",
"(",
"self",
".",
"r",
".",
"delete",
"(",
"urljoin",
"(",
"self",
".",
"url",
"+",
"CRUD_PATH",
",",
"path",
")",
")",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | DatabaseConnection.subscribe | Subscribe to the given stream with the callback | connectordb/_connection.py | def subscribe(self, stream, callback, transform=""):
"""Subscribe to the given stream with the callback"""
return self.ws.subscribe(stream, callback, transform) | def subscribe(self, stream, callback, transform=""):
"""Subscribe to the given stream with the callback"""
return self.ws.subscribe(stream, callback, transform) | [
"Subscribe",
"to",
"the",
"given",
"stream",
"with",
"the",
"callback"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_connection.py#L160-L162 | [
"def",
"subscribe",
"(",
"self",
",",
"stream",
",",
"callback",
",",
"transform",
"=",
"\"\"",
")",
":",
"return",
"self",
".",
"ws",
".",
"subscribe",
"(",
"stream",
",",
"callback",
",",
"transform",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | User.create | Creates the given user - using the passed in email and password.
You can also set other default properties by passing in the relevant information::
usr.create("my@email","mypass",description="I like trains.")
Furthermore, ConnectorDB permits immediate initialization of an entire user tree... | connectordb/_user.py | def create(self, email, password, role="user", public=True, **kwargs):
"""Creates the given user - using the passed in email and password.
You can also set other default properties by passing in the relevant information::
usr.create("my@email","mypass",description="I like trains.")
... | def create(self, email, password, role="user", public=True, **kwargs):
"""Creates the given user - using the passed in email and password.
You can also set other default properties by passing in the relevant information::
usr.create("my@email","mypass",description="I like trains.")
... | [
"Creates",
"the",
"given",
"user",
"-",
"using",
"the",
"passed",
"in",
"email",
"and",
"password",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_user.py#L10-L40 | [
"def",
"create",
"(",
"self",
",",
"email",
",",
"password",
",",
"role",
"=",
"\"user\"",
",",
"public",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"[",
"\"email\"",
"]",
"=",
"email",
"kwargs",
"[",
"\"password\"",
"]",
"=",
"passwor... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | User.devices | Returns the list of devices that belong to the user | connectordb/_user.py | def devices(self):
"""Returns the list of devices that belong to the user"""
result = self.db.read(self.path, {"q": "ls"})
if result is None or result.json() is None:
return []
devices = []
for d in result.json():
dev = self[d["name"]]
dev.met... | def devices(self):
"""Returns the list of devices that belong to the user"""
result = self.db.read(self.path, {"q": "ls"})
if result is None or result.json() is None:
return []
devices = []
for d in result.json():
dev = self[d["name"]]
dev.met... | [
"Returns",
"the",
"list",
"of",
"devices",
"that",
"belong",
"to",
"the",
"user"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_user.py#L46-L57 | [
"def",
"devices",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"db",
".",
"read",
"(",
"self",
".",
"path",
",",
"{",
"\"q\"",
":",
"\"ls\"",
"}",
")",
"if",
"result",
"is",
"None",
"or",
"result",
".",
"json",
"(",
")",
"is",
"None",
":"... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | User.streams | Returns the list of streams that belong to the user.
The list can optionally be filtered in 3 ways:
- public: when True, returns only streams belonging to public devices
- downlink: If True, returns only downlink streams
- visible: If True (default), returns only streams of v... | connectordb/_user.py | def streams(self, public=False, downlink=False, visible=True):
"""Returns the list of streams that belong to the user.
The list can optionally be filtered in 3 ways:
- public: when True, returns only streams belonging to public devices
- downlink: If True, returns only downlink s... | def streams(self, public=False, downlink=False, visible=True):
"""Returns the list of streams that belong to the user.
The list can optionally be filtered in 3 ways:
- public: when True, returns only streams belonging to public devices
- downlink: If True, returns only downlink s... | [
"Returns",
"the",
"list",
"of",
"streams",
"that",
"belong",
"to",
"the",
"user",
".",
"The",
"list",
"can",
"optionally",
"be",
"filtered",
"in",
"3",
"ways",
":",
"-",
"public",
":",
"when",
"True",
"returns",
"only",
"streams",
"belonging",
"to",
"pub... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_user.py#L59-L78 | [
"def",
"streams",
"(",
"self",
",",
"public",
"=",
"False",
",",
"downlink",
"=",
"False",
",",
"visible",
"=",
"True",
")",
":",
"result",
"=",
"self",
".",
"db",
".",
"read",
"(",
"self",
".",
"path",
",",
"{",
"\"q\"",
":",
"\"streams\"",
",",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | User.export | Exports the ConnectorDB user into the given directory.
The resulting export can be imported by using the import command(cdb.import(directory)),
Note that Python cannot export passwords, since the REST API does
not expose password hashes. Therefore, the imported user will have
password s... | connectordb/_user.py | def export(self, directory):
"""Exports the ConnectorDB user into the given directory.
The resulting export can be imported by using the import command(cdb.import(directory)),
Note that Python cannot export passwords, since the REST API does
not expose password hashes. Therefore, the im... | def export(self, directory):
"""Exports the ConnectorDB user into the given directory.
The resulting export can be imported by using the import command(cdb.import(directory)),
Note that Python cannot export passwords, since the REST API does
not expose password hashes. Therefore, the im... | [
"Exports",
"the",
"ConnectorDB",
"user",
"into",
"the",
"given",
"directory",
".",
"The",
"resulting",
"export",
"can",
"be",
"imported",
"by",
"using",
"the",
"import",
"command",
"(",
"cdb",
".",
"import",
"(",
"directory",
"))"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_user.py#L88-L133 | [
"def",
"export",
"(",
"self",
",",
"directory",
")",
":",
"exportInfoFile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"\"connectordb.json\"",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"directory",
")",
":",
"# Ensure that there is... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | User.import_device | Imports a device from the given directory. You export the device
by using device.export()
There are two special cases: user and meta devices.
If the device name is meta, import_device will not do anything.
If the device name is "user", import_device will overwrite the user device
... | connectordb/_user.py | def import_device(self, directory):
"""Imports a device from the given directory. You export the device
by using device.export()
There are two special cases: user and meta devices.
If the device name is meta, import_device will not do anything.
If the device name is "user", impo... | def import_device(self, directory):
"""Imports a device from the given directory. You export the device
by using device.export()
There are two special cases: user and meta devices.
If the device name is meta, import_device will not do anything.
If the device name is "user", impo... | [
"Imports",
"a",
"device",
"from",
"the",
"given",
"directory",
".",
"You",
"export",
"the",
"device",
"by",
"using",
"device",
".",
"export",
"()"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_user.py#L135-L167 | [
"def",
"import_device",
"(",
"self",
",",
"directory",
")",
":",
"# read the device's info",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"directory",
",",
"\"device.json\"",
")",
",",
"\"r\"",
")",
"as",
"f",
":",
"ddata",
"=",
"json",
".",... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | run_cutadapt | Adapter trimming for RNA-seq data
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq read 1
:param str r2_id: FileStoreID of fastq read 2 (if paired data)
:param str fwd_3pr_adapter: Adapter sequence for the forward 3' adapter
:param str rev_3pr_a... | src/toil_lib/tools/preprocessing.py | def run_cutadapt(job, r1_id, r2_id, fwd_3pr_adapter, rev_3pr_adapter):
"""
Adapter trimming for RNA-seq data
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq read 1
:param str r2_id: FileStoreID of fastq read 2 (if paired data)
:param str fw... | def run_cutadapt(job, r1_id, r2_id, fwd_3pr_adapter, rev_3pr_adapter):
"""
Adapter trimming for RNA-seq data
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq read 1
:param str r2_id: FileStoreID of fastq read 2 (if paired data)
:param str fw... | [
"Adapter",
"trimming",
"for",
"RNA",
"-",
"seq",
"data"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L10-L48 | [
"def",
"run_cutadapt",
"(",
"job",
",",
"r1_id",
",",
"r2_id",
",",
"fwd_3pr_adapter",
",",
"rev_3pr_adapter",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"if",
"r2_id",
":",
"require",
"(",
"rev_3pr_adapter",
",",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_samtools_faidx | Use SAMtools to create reference index file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str ref_id: FileStoreID for the reference genome
:return: FileStoreID for reference index
:rtype: str | src/toil_lib/tools/preprocessing.py | def run_samtools_faidx(job, ref_id):
"""
Use SAMtools to create reference index file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str ref_id: FileStoreID for the reference genome
:return: FileStoreID for reference index
:rtype: str
"""
job.fileStore.logToMaster... | def run_samtools_faidx(job, ref_id):
"""
Use SAMtools to create reference index file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str ref_id: FileStoreID for the reference genome
:return: FileStoreID for reference index
:rtype: str
"""
job.fileStore.logToMaster... | [
"Use",
"SAMtools",
"to",
"create",
"reference",
"index",
"file"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L51-L66 | [
"def",
"run_samtools_faidx",
"(",
"job",
",",
"ref_id",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Created reference index'",
")",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"job",
".",
"fileStore",
".",
"r... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_samtools_index | Runs SAMtools index to create a BAM index file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID of the BAM file
:return: FileStoreID for BAM index file
:rtype: str | src/toil_lib/tools/preprocessing.py | def run_samtools_index(job, bam):
"""
Runs SAMtools index to create a BAM index file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID of the BAM file
:return: FileStoreID for BAM index file
:rtype: str
"""
work_dir = job.fileStore.getLocalTempD... | def run_samtools_index(job, bam):
"""
Runs SAMtools index to create a BAM index file
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID of the BAM file
:return: FileStoreID for BAM index file
:rtype: str
"""
work_dir = job.fileStore.getLocalTempD... | [
"Runs",
"SAMtools",
"index",
"to",
"create",
"a",
"BAM",
"index",
"file"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L69-L85 | [
"def",
"run_samtools_index",
"(",
"job",
",",
"bam",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"job",
".",
"fileStore",
".",
"readGlobalFile",
"(",
"bam",
",",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_sambamba_markdup | Marks reads as PCR duplicates using Sambamba
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:return: FileStoreID for sorted BAM file
:rtype: str | src/toil_lib/tools/preprocessing.py | def run_sambamba_markdup(job, bam):
"""
Marks reads as PCR duplicates using Sambamba
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:return: FileStoreID for sorted BAM file
:rtype: str
"""
work_dir = job.fileStore.getLocalTempDir... | def run_sambamba_markdup(job, bam):
"""
Marks reads as PCR duplicates using Sambamba
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:return: FileStoreID for sorted BAM file
:rtype: str
"""
work_dir = job.fileStore.getLocalTempDir... | [
"Marks",
"reads",
"as",
"PCR",
"duplicates",
"using",
"Sambamba"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L227-L250 | [
"def",
"run_sambamba_markdup",
"(",
"job",
",",
"bam",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"job",
".",
"fileStore",
".",
"readGlobalFile",
"(",
"bam",
",",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_samblaster | Marks reads as PCR duplicates using SAMBLASTER
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str sam: FileStoreID for SAM file
:return: FileStoreID for deduped SAM file
:rtype: str | src/toil_lib/tools/preprocessing.py | def run_samblaster(job, sam):
"""
Marks reads as PCR duplicates using SAMBLASTER
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str sam: FileStoreID for SAM file
:return: FileStoreID for deduped SAM file
:rtype: str
"""
work_dir = job.fileStore.getLocalTempDir()
... | def run_samblaster(job, sam):
"""
Marks reads as PCR duplicates using SAMBLASTER
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str sam: FileStoreID for SAM file
:return: FileStoreID for deduped SAM file
:rtype: str
"""
work_dir = job.fileStore.getLocalTempDir()
... | [
"Marks",
"reads",
"as",
"PCR",
"duplicates",
"using",
"SAMBLASTER"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L253-L275 | [
"def",
"run_samblaster",
"(",
"job",
",",
"sam",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"job",
".",
"fileStore",
".",
"readGlobalFile",
"(",
"sam",
",",
"os",
".",
"path",
".",
"join",
"(",
"work_dir",
","... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | picard_mark_duplicates | Runs Picard MarkDuplicates on a BAM file. Requires that the BAM file be coordinate sorted.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileStoreID for BAM index file
:param str validation_stringency: BAM file validation string... | src/toil_lib/tools/preprocessing.py | def picard_mark_duplicates(job, bam, bai, validation_stringency='LENIENT'):
"""
Runs Picard MarkDuplicates on a BAM file. Requires that the BAM file be coordinate sorted.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileSto... | def picard_mark_duplicates(job, bam, bai, validation_stringency='LENIENT'):
"""
Runs Picard MarkDuplicates on a BAM file. Requires that the BAM file be coordinate sorted.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileSto... | [
"Runs",
"Picard",
"MarkDuplicates",
"on",
"a",
"BAM",
"file",
".",
"Requires",
"that",
"the",
"BAM",
"file",
"be",
"coordinate",
"sorted",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L297-L340 | [
"def",
"picard_mark_duplicates",
"(",
"job",
",",
"bam",
",",
"bai",
",",
"validation_stringency",
"=",
"'LENIENT'",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"# Retrieve file path",
"job",
".",
"fileStore",
".",
"re... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_picard_sort | Sorts BAM file using Picard SortSam
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param boolean sort_by_name: If true, sorts by read name instead of coordinate.
:return: FileStoreID for sorted BAM file
:rtype: str | src/toil_lib/tools/preprocessing.py | def run_picard_sort(job, bam, sort_by_name=False):
"""
Sorts BAM file using Picard SortSam
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param boolean sort_by_name: If true, sorts by read name instead of coordinate.
:return: FileStoreI... | def run_picard_sort(job, bam, sort_by_name=False):
"""
Sorts BAM file using Picard SortSam
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param boolean sort_by_name: If true, sorts by read name instead of coordinate.
:return: FileStoreI... | [
"Sorts",
"BAM",
"file",
"using",
"Picard",
"SortSam"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L343-L378 | [
"def",
"run_picard_sort",
"(",
"job",
",",
"bam",
",",
"sort_by_name",
"=",
"False",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"job",
".",
"fileStore",
".",
"readGlobalFile",
"(",
"bam",
",",
"os",
".",
"path",... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_gatk_preprocessing | GATK Preprocessing Pipeline
0: Mark duplicates
1: Create INDEL realignment intervals
2: Realign INDELs
3: Recalibrate base quality scores
4: Apply base score recalibration
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str... | src/toil_lib/tools/preprocessing.py | def run_gatk_preprocessing(job, bam, bai, ref, ref_dict, fai, g1k, mills, dbsnp, realign=False, unsafe=False):
"""
GATK Preprocessing Pipeline
0: Mark duplicates
1: Create INDEL realignment intervals
2: Realign INDELs
3: Recalibrate base quality scores
4: Apply base score recalibration
... | def run_gatk_preprocessing(job, bam, bai, ref, ref_dict, fai, g1k, mills, dbsnp, realign=False, unsafe=False):
"""
GATK Preprocessing Pipeline
0: Mark duplicates
1: Create INDEL realignment intervals
2: Realign INDELs
3: Recalibrate base quality scores
4: Apply base score recalibration
... | [
"GATK",
"Preprocessing",
"Pipeline",
"0",
":",
"Mark",
"duplicates",
"1",
":",
"Create",
"INDEL",
"realignment",
"intervals",
"2",
":",
"Realign",
"INDELs",
"3",
":",
"Recalibrate",
"base",
"quality",
"scores",
"4",
":",
"Apply",
"base",
"score",
"recalibratio... | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L381-L518 | [
"def",
"run_gatk_preprocessing",
"(",
"job",
",",
"bam",
",",
"bai",
",",
"ref",
",",
"ref_dict",
",",
"fai",
",",
"g1k",
",",
"mills",
",",
"dbsnp",
",",
"realign",
"=",
"False",
",",
"unsafe",
"=",
"False",
")",
":",
"# The MarkDuplicates disk requiremen... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_base_recalibration | Creates recalibration table for Base Quality Score Recalibration
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileStoreID for BAM index file
:param str ref: FileStoreID for reference genome fasta file
:param str ref_dict: F... | src/toil_lib/tools/preprocessing.py | def run_base_recalibration(job, bam, bai, ref, ref_dict, fai, dbsnp, mills, unsafe=False):
"""
Creates recalibration table for Base Quality Score Recalibration
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileStoreID for BA... | def run_base_recalibration(job, bam, bai, ref, ref_dict, fai, dbsnp, mills, unsafe=False):
"""
Creates recalibration table for Base Quality Score Recalibration
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str bam: FileStoreID for BAM file
:param str bai: FileStoreID for BA... | [
"Creates",
"recalibration",
"table",
"for",
"Base",
"Quality",
"Score",
"Recalibration"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/preprocessing.py#L649-L704 | [
"def",
"run_base_recalibration",
"(",
"job",
",",
"bam",
",",
"bai",
",",
"ref",
",",
"ref_dict",
",",
"fai",
",",
"dbsnp",
",",
"mills",
",",
"unsafe",
"=",
"False",
")",
":",
"inputs",
"=",
"{",
"'ref.fasta'",
":",
"ref",
",",
"'ref.fasta.fai'",
":",... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_kallisto | RNA quantification via Kallisto
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq (pair 1)
:param str r2_id: FileStoreID of fastq (pair 2 if applicable, otherwise pass None for single-end)
:param str kallisto_index_url: FileStoreID for Kallisto index... | src/toil_lib/tools/quantifiers.py | def run_kallisto(job, r1_id, r2_id, kallisto_index_url):
"""
RNA quantification via Kallisto
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq (pair 1)
:param str r2_id: FileStoreID of fastq (pair 2 if applicable, otherwise pass None for single-e... | def run_kallisto(job, r1_id, r2_id, kallisto_index_url):
"""
RNA quantification via Kallisto
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq (pair 1)
:param str r2_id: FileStoreID of fastq (pair 2 if applicable, otherwise pass None for single-e... | [
"RNA",
"quantification",
"via",
"Kallisto"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/quantifiers.py#L10-L45 | [
"def",
"run_kallisto",
"(",
"job",
",",
"r1_id",
",",
"r2_id",
",",
"kallisto_index_url",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"download_url",
"(",
"job",
",",
"url",
"=",
"kallisto_index_url",
",",
"name",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_rsem | RNA quantification with RSEM
:param JobFunctionWrappingJob job: Passed automatically by Toil
:param str bam_id: FileStoreID of transcriptome bam for quantification
:param str rsem_ref_url: URL of RSEM reference (tarball)
:param bool paired: If True, uses parameters for paired end data
:return: File... | src/toil_lib/tools/quantifiers.py | def run_rsem(job, bam_id, rsem_ref_url, paired=True):
"""
RNA quantification with RSEM
:param JobFunctionWrappingJob job: Passed automatically by Toil
:param str bam_id: FileStoreID of transcriptome bam for quantification
:param str rsem_ref_url: URL of RSEM reference (tarball)
:param bool pair... | def run_rsem(job, bam_id, rsem_ref_url, paired=True):
"""
RNA quantification with RSEM
:param JobFunctionWrappingJob job: Passed automatically by Toil
:param str bam_id: FileStoreID of transcriptome bam for quantification
:param str rsem_ref_url: URL of RSEM reference (tarball)
:param bool pair... | [
"RNA",
"quantification",
"with",
"RSEM"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/quantifiers.py#L48-L90 | [
"def",
"run_rsem",
"(",
"job",
",",
"bam_id",
",",
"rsem_ref_url",
",",
"paired",
"=",
"True",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"download_url",
"(",
"job",
",",
"url",
"=",
"rsem_ref_url",
",",
"name",... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | run_rsem_postprocess | Parses RSEMs output to produce the separate .tab files (TPM, FPKM, counts) for both gene and isoform.
These are two-column files: Genes and Quantifications.
HUGO files are also provided that have been mapped from Gencode/ENSEMBLE names.
:param JobFunctionWrappingJob job: passed automatically by Toil
:p... | src/toil_lib/tools/quantifiers.py | def run_rsem_postprocess(job, rsem_gene_id, rsem_isoform_id):
"""
Parses RSEMs output to produce the separate .tab files (TPM, FPKM, counts) for both gene and isoform.
These are two-column files: Genes and Quantifications.
HUGO files are also provided that have been mapped from Gencode/ENSEMBLE names.
... | def run_rsem_postprocess(job, rsem_gene_id, rsem_isoform_id):
"""
Parses RSEMs output to produce the separate .tab files (TPM, FPKM, counts) for both gene and isoform.
These are two-column files: Genes and Quantifications.
HUGO files are also provided that have been mapped from Gencode/ENSEMBLE names.
... | [
"Parses",
"RSEMs",
"output",
"to",
"produce",
"the",
"separate",
".",
"tab",
"files",
"(",
"TPM",
"FPKM",
"counts",
")",
"for",
"both",
"gene",
"and",
"isoform",
".",
"These",
"are",
"two",
"-",
"column",
"files",
":",
"Genes",
"and",
"Quantifications",
... | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/quantifiers.py#L93-L119 | [
"def",
"run_rsem_postprocess",
"(",
"job",
",",
"rsem_gene_id",
",",
"rsem_isoform_id",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"# I/O",
"genes",
"=",
"job",
".",
"fileStore",
".",
"readGlobalFile",
"(",
"rsem_gene... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | switch | Set/clear boolean field value for model object | boolean_switch/views.py | def switch(request, url):
"""
Set/clear boolean field value for model object
"""
app_label, model_name, object_id, field = url.split('/')
try:
# django >= 1.7
from django.apps import apps
model = apps.get_model(app_label, model_name)
except ImportError:
# django <... | def switch(request, url):
"""
Set/clear boolean field value for model object
"""
app_label, model_name, object_id, field = url.split('/')
try:
# django >= 1.7
from django.apps import apps
model = apps.get_model(app_label, model_name)
except ImportError:
# django <... | [
"Set",
"/",
"clear",
"boolean",
"field",
"value",
"for",
"model",
"object"
] | makeev/django-boolean-switch | python | https://github.com/makeev/django-boolean-switch/blob/ed740dbb56d0bb1ad20d4b1e124055283b0e932f/boolean_switch/views.py#L9-L37 | [
"def",
"switch",
"(",
"request",
",",
"url",
")",
":",
"app_label",
",",
"model_name",
",",
"object_id",
",",
"field",
"=",
"url",
".",
"split",
"(",
"'/'",
")",
"try",
":",
"# django >= 1.7",
"from",
"django",
".",
"apps",
"import",
"apps",
"model",
"... | ed740dbb56d0bb1ad20d4b1e124055283b0e932f |
test | SARPlus.fit | Main fit method for SAR. Expects the dataframes to have row_id, col_id columns which are indexes,
i.e. contain the sequential integer index of the original alphanumeric user and item IDs.
Dataframe also contains rating and timestamp as floats; timestamp is in seconds since Epoch by default.
Arg... | python/pysarplus/SARPlus.py | def fit(
self,
df,
similarity_type="jaccard",
time_decay_coefficient=30,
time_now=None,
timedecay_formula=False,
threshold=1,
):
"""Main fit method for SAR. Expects the dataframes to have row_id, col_id columns which are indexes,
i.e. contain t... | def fit(
self,
df,
similarity_type="jaccard",
time_decay_coefficient=30,
time_now=None,
timedecay_formula=False,
threshold=1,
):
"""Main fit method for SAR. Expects the dataframes to have row_id, col_id columns which are indexes,
i.e. contain t... | [
"Main",
"fit",
"method",
"for",
"SAR",
".",
"Expects",
"the",
"dataframes",
"to",
"have",
"row_id",
"col_id",
"columns",
"which",
"are",
"indexes",
"i",
".",
"e",
".",
"contain",
"the",
"sequential",
"integer",
"index",
"of",
"the",
"original",
"alphanumeric... | eisber/sarplus | python | https://github.com/eisber/sarplus/blob/945a1182e00a8bf70414fc3600086316701777f9/python/pysarplus/SARPlus.py#L48-L207 | [
"def",
"fit",
"(",
"self",
",",
"df",
",",
"similarity_type",
"=",
"\"jaccard\"",
",",
"time_decay_coefficient",
"=",
"30",
",",
"time_now",
"=",
"None",
",",
"timedecay_formula",
"=",
"False",
",",
"threshold",
"=",
"1",
",",
")",
":",
"# threshold - items ... | 945a1182e00a8bf70414fc3600086316701777f9 |
test | SARPlus.get_user_affinity | Prepare test set for C++ SAR prediction code.
Find all items the test users have seen in the past.
Arguments:
test (pySpark.DataFrame): input dataframe which contains test users. | python/pysarplus/SARPlus.py | def get_user_affinity(self, test):
"""Prepare test set for C++ SAR prediction code.
Find all items the test users have seen in the past.
Arguments:
test (pySpark.DataFrame): input dataframe which contains test users.
"""
test.createOrReplaceTempView(self.f("{prefix}d... | def get_user_affinity(self, test):
"""Prepare test set for C++ SAR prediction code.
Find all items the test users have seen in the past.
Arguments:
test (pySpark.DataFrame): input dataframe which contains test users.
"""
test.createOrReplaceTempView(self.f("{prefix}d... | [
"Prepare",
"test",
"set",
"for",
"C",
"++",
"SAR",
"prediction",
"code",
".",
"Find",
"all",
"items",
"the",
"test",
"users",
"have",
"seen",
"in",
"the",
"past",
"."
] | eisber/sarplus | python | https://github.com/eisber/sarplus/blob/945a1182e00a8bf70414fc3600086316701777f9/python/pysarplus/SARPlus.py#L209-L236 | [
"def",
"get_user_affinity",
"(",
"self",
",",
"test",
")",
":",
"test",
".",
"createOrReplaceTempView",
"(",
"self",
".",
"f",
"(",
"\"{prefix}df_test\"",
")",
")",
"query",
"=",
"self",
".",
"f",
"(",
"\"SELECT DISTINCT {col_user} FROM {prefix}df_test CLUSTER BY {c... | 945a1182e00a8bf70414fc3600086316701777f9 |
test | SARPlus.recommend_k_items_slow | Recommend top K items for all users which are in the test set.
Args:
test: test Spark dataframe
top_k: top n items to return
remove_seen: remove items test users have already seen in the past from the recommended set. | python/pysarplus/SARPlus.py | def recommend_k_items_slow(self, test, top_k=10, remove_seen=True):
"""Recommend top K items for all users which are in the test set.
Args:
test: test Spark dataframe
top_k: top n items to return
remove_seen: remove items test users have already seen in the past from... | def recommend_k_items_slow(self, test, top_k=10, remove_seen=True):
"""Recommend top K items for all users which are in the test set.
Args:
test: test Spark dataframe
top_k: top n items to return
remove_seen: remove items test users have already seen in the past from... | [
"Recommend",
"top",
"K",
"items",
"for",
"all",
"users",
"which",
"are",
"in",
"the",
"test",
"set",
"."
] | eisber/sarplus | python | https://github.com/eisber/sarplus/blob/945a1182e00a8bf70414fc3600086316701777f9/python/pysarplus/SARPlus.py#L323-L362 | [
"def",
"recommend_k_items_slow",
"(",
"self",
",",
"test",
",",
"top_k",
"=",
"10",
",",
"remove_seen",
"=",
"True",
")",
":",
"# TODO: remove seen",
"if",
"remove_seen",
":",
"raise",
"ValueError",
"(",
"\"Not implemented\"",
")",
"self",
".",
"get_user_affinit... | 945a1182e00a8bf70414fc3600086316701777f9 |
test | WebsocketHandler.setauth | setauth can be used during runtime to make sure that authentication is reset.
it can be used when changing passwords/apikeys to make sure reconnects succeed | connectordb/_websocket.py | def setauth(self,basic_auth):
""" setauth can be used during runtime to make sure that authentication is reset.
it can be used when changing passwords/apikeys to make sure reconnects succeed """
self.headers = []
# If we have auth
if basic_auth is not None:
# we use a... | def setauth(self,basic_auth):
""" setauth can be used during runtime to make sure that authentication is reset.
it can be used when changing passwords/apikeys to make sure reconnects succeed """
self.headers = []
# If we have auth
if basic_auth is not None:
# we use a... | [
"setauth",
"can",
"be",
"used",
"during",
"runtime",
"to",
"make",
"sure",
"that",
"authentication",
"is",
"reset",
".",
"it",
"can",
"be",
"used",
"when",
"changing",
"passwords",
"/",
"apikeys",
"to",
"make",
"sure",
"reconnects",
"succeed"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L69-L86 | [
"def",
"setauth",
"(",
"self",
",",
"basic_auth",
")",
":",
"self",
".",
"headers",
"=",
"[",
"]",
"# If we have auth",
"if",
"basic_auth",
"is",
"not",
"None",
":",
"# we use a cheap hack to get the basic auth header out of the auth object.",
"# This snippet ends up with... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.send | Send the given command thru the websocket | connectordb/_websocket.py | def send(self, cmd):
"""Send the given command thru the websocket"""
with self.ws_sendlock:
self.ws.send(json.dumps(cmd)) | def send(self, cmd):
"""Send the given command thru the websocket"""
with self.ws_sendlock:
self.ws.send(json.dumps(cmd)) | [
"Send",
"the",
"given",
"command",
"thru",
"the",
"websocket"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L101-L104 | [
"def",
"send",
"(",
"self",
",",
"cmd",
")",
":",
"with",
"self",
".",
"ws_sendlock",
":",
"self",
".",
"ws",
".",
"send",
"(",
"json",
".",
"dumps",
"(",
"cmd",
")",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.subscribe | Given a stream, a callback and an optional transform, sets up the subscription | connectordb/_websocket.py | def subscribe(self, stream, callback, transform=""):
"""Given a stream, a callback and an optional transform, sets up the subscription"""
if self.status == "disconnected" or self.status == "disconnecting" or self.status == "connecting":
self.connect()
if self.status is not "connected... | def subscribe(self, stream, callback, transform=""):
"""Given a stream, a callback and an optional transform, sets up the subscription"""
if self.status == "disconnected" or self.status == "disconnecting" or self.status == "connecting":
self.connect()
if self.status is not "connected... | [
"Given",
"a",
"stream",
"a",
"callback",
"and",
"an",
"optional",
"transform",
"sets",
"up",
"the",
"subscription"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L110-L121 | [
"def",
"subscribe",
"(",
"self",
",",
"stream",
",",
"callback",
",",
"transform",
"=",
"\"\"",
")",
":",
"if",
"self",
".",
"status",
"==",
"\"disconnected\"",
"or",
"self",
".",
"status",
"==",
"\"disconnecting\"",
"or",
"self",
".",
"status",
"==",
"\... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.unsubscribe | Unsubscribe from the given stream (with the optional transform) | connectordb/_websocket.py | def unsubscribe(self, stream, transform=""):
"""Unsubscribe from the given stream (with the optional transform)"""
if self.status is not "connected":
return False
logging.debug("Unsubscribing from %s", stream)
self.send(
{"cmd": "unsubscribe",
"arg": ... | def unsubscribe(self, stream, transform=""):
"""Unsubscribe from the given stream (with the optional transform)"""
if self.status is not "connected":
return False
logging.debug("Unsubscribing from %s", stream)
self.send(
{"cmd": "unsubscribe",
"arg": ... | [
"Unsubscribe",
"from",
"the",
"given",
"stream",
"(",
"with",
"the",
"optional",
"transform",
")"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L123-L139 | [
"def",
"unsubscribe",
"(",
"self",
",",
"stream",
",",
"transform",
"=",
"\"\"",
")",
":",
"if",
"self",
".",
"status",
"is",
"not",
"\"connected\"",
":",
"return",
"False",
"logging",
".",
"debug",
"(",
"\"Unsubscribing from %s\"",
",",
"stream",
")",
"se... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.connect | Attempt to connect to the websocket - and returns either True or False depending on if
the connection was successful or not | connectordb/_websocket.py | def connect(self):
"""Attempt to connect to the websocket - and returns either True or False depending on if
the connection was successful or not"""
# Wait for the lock to be available (ie, the websocket is not being used (yet))
self.ws_openlock.acquire()
self.ws_openlock.releas... | def connect(self):
"""Attempt to connect to the websocket - and returns either True or False depending on if
the connection was successful or not"""
# Wait for the lock to be available (ie, the websocket is not being used (yet))
self.ws_openlock.acquire()
self.ws_openlock.releas... | [
"Attempt",
"to",
"connect",
"to",
"the",
"websocket",
"-",
"and",
"returns",
"either",
"True",
"or",
"False",
"depending",
"on",
"if",
"the",
"connection",
"was",
"successful",
"or",
"not"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L141-L173 | [
"def",
"connect",
"(",
"self",
")",
":",
"# Wait for the lock to be available (ie, the websocket is not being used (yet))",
"self",
".",
"ws_openlock",
".",
"acquire",
"(",
")",
"self",
".",
"ws_openlock",
".",
"release",
"(",
")",
"if",
"self",
".",
"status",
"==",... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.__reconnect | This is called when a connection is lost - it attempts to reconnect to the server | connectordb/_websocket.py | def __reconnect(self):
"""This is called when a connection is lost - it attempts to reconnect to the server"""
self.status = "reconnecting"
# Reset the disconnect time after 15 minutes
if self.disconnected_time - self.connected_time > 15 * 60:
self.reconnect_time = self.reco... | def __reconnect(self):
"""This is called when a connection is lost - it attempts to reconnect to the server"""
self.status = "reconnecting"
# Reset the disconnect time after 15 minutes
if self.disconnected_time - self.connected_time > 15 * 60:
self.reconnect_time = self.reco... | [
"This",
"is",
"called",
"when",
"a",
"connection",
"is",
"lost",
"-",
"it",
"attempts",
"to",
"reconnect",
"to",
"the",
"server"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L184-L210 | [
"def",
"__reconnect",
"(",
"self",
")",
":",
"self",
".",
"status",
"=",
"\"reconnecting\"",
"# Reset the disconnect time after 15 minutes",
"if",
"self",
".",
"disconnected_time",
"-",
"self",
".",
"connected_time",
">",
"15",
"*",
"60",
":",
"self",
".",
"reco... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.__resubscribe | Send subscribe command for all existing subscriptions. This allows to resume a connection
that was closed | connectordb/_websocket.py | def __resubscribe(self):
"""Send subscribe command for all existing subscriptions. This allows to resume a connection
that was closed"""
with self.subscription_lock:
for sub in self.subscriptions:
logging.debug("Resubscribing to %s", sub)
stream_transf... | def __resubscribe(self):
"""Send subscribe command for all existing subscriptions. This allows to resume a connection
that was closed"""
with self.subscription_lock:
for sub in self.subscriptions:
logging.debug("Resubscribing to %s", sub)
stream_transf... | [
"Send",
"subscribe",
"command",
"for",
"all",
"existing",
"subscriptions",
".",
"This",
"allows",
"to",
"resume",
"a",
"connection",
"that",
"was",
"closed"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L219-L230 | [
"def",
"__resubscribe",
"(",
"self",
")",
":",
"with",
"self",
".",
"subscription_lock",
":",
"for",
"sub",
"in",
"self",
".",
"subscriptions",
":",
"logging",
".",
"debug",
"(",
"\"Resubscribing to %s\"",
",",
"sub",
")",
"stream_transform",
"=",
"sub",
"."... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.__on_open | Called when the websocket is opened | connectordb/_websocket.py | def __on_open(self, ws):
"""Called when the websocket is opened"""
logging.debug("ConnectorDB: Websocket opened")
# Connection success - decrease the wait time for next connection
self.reconnect_time /= self.reconnect_time_backoff_multiplier
self.status = "connected"
s... | def __on_open(self, ws):
"""Called when the websocket is opened"""
logging.debug("ConnectorDB: Websocket opened")
# Connection success - decrease the wait time for next connection
self.reconnect_time /= self.reconnect_time_backoff_multiplier
self.status = "connected"
s... | [
"Called",
"when",
"the",
"websocket",
"is",
"opened"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L232-L247 | [
"def",
"__on_open",
"(",
"self",
",",
"ws",
")",
":",
"logging",
".",
"debug",
"(",
"\"ConnectorDB: Websocket opened\"",
")",
"# Connection success - decrease the wait time for next connection",
"self",
".",
"reconnect_time",
"/=",
"self",
".",
"reconnect_time_backoff_multi... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.__on_close | Called when the websocket is closed | connectordb/_websocket.py | def __on_close(self, ws):
"""Called when the websocket is closed"""
if self.status == "disconnected":
return # This can be double-called on disconnect
logging.debug("ConnectorDB:WS: Websocket closed")
# Turn off the ping timer
if self.pingtimer is not None:
... | def __on_close(self, ws):
"""Called when the websocket is closed"""
if self.status == "disconnected":
return # This can be double-called on disconnect
logging.debug("ConnectorDB:WS: Websocket closed")
# Turn off the ping timer
if self.pingtimer is not None:
... | [
"Called",
"when",
"the",
"websocket",
"is",
"closed"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L249-L263 | [
"def",
"__on_close",
"(",
"self",
",",
"ws",
")",
":",
"if",
"self",
".",
"status",
"==",
"\"disconnected\"",
":",
"return",
"# This can be double-called on disconnect",
"logging",
".",
"debug",
"(",
"\"ConnectorDB:WS: Websocket closed\"",
")",
"# Turn off the ping time... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.__on_error | Called when there is an error in the websocket | connectordb/_websocket.py | def __on_error(self, ws, err):
"""Called when there is an error in the websocket"""
logging.debug("ConnectorDB:WS: Connection Error")
if self.status == "connecting":
self.status = "errored"
self.ws_openlock.release() | def __on_error(self, ws, err):
"""Called when there is an error in the websocket"""
logging.debug("ConnectorDB:WS: Connection Error")
if self.status == "connecting":
self.status = "errored"
self.ws_openlock.release() | [
"Called",
"when",
"there",
"is",
"an",
"error",
"in",
"the",
"websocket"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L265-L271 | [
"def",
"__on_error",
"(",
"self",
",",
"ws",
",",
"err",
")",
":",
"logging",
".",
"debug",
"(",
"\"ConnectorDB:WS: Connection Error\"",
")",
"if",
"self",
".",
"status",
"==",
"\"connecting\"",
":",
"self",
".",
"status",
"=",
"\"errored\"",
"self",
".",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.__on_message | This function is called whenever there is a message received from the server | connectordb/_websocket.py | def __on_message(self, ws, msg):
"""This function is called whenever there is a message received from the server"""
msg = json.loads(msg)
logging.debug("ConnectorDB:WS: Msg '%s'", msg["stream"])
# Build the subcription key
stream_key = msg["stream"] + ":"
if "transform" ... | def __on_message(self, ws, msg):
"""This function is called whenever there is a message received from the server"""
msg = json.loads(msg)
logging.debug("ConnectorDB:WS: Msg '%s'", msg["stream"])
# Build the subcription key
stream_key = msg["stream"] + ":"
if "transform" ... | [
"This",
"function",
"is",
"called",
"whenever",
"there",
"is",
"a",
"message",
"received",
"from",
"the",
"server"
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L273-L304 | [
"def",
"__on_message",
"(",
"self",
",",
"ws",
",",
"msg",
")",
":",
"msg",
"=",
"json",
".",
"loads",
"(",
"msg",
")",
"logging",
".",
"debug",
"(",
"\"ConnectorDB:WS: Msg '%s'\"",
",",
"msg",
"[",
"\"stream\"",
"]",
")",
"# Build the subcription key",
"s... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.__on_ping | The server periodically sends us websocket ping messages to keep the connection alive. To
ensure that the connection to the server is still active, we memorize the most recent ping's time
and we periodically ensure that a ping was received in __ensure_ping | connectordb/_websocket.py | def __on_ping(self, ws, data):
"""The server periodically sends us websocket ping messages to keep the connection alive. To
ensure that the connection to the server is still active, we memorize the most recent ping's time
and we periodically ensure that a ping was received in __ensure_ping"""
... | def __on_ping(self, ws, data):
"""The server periodically sends us websocket ping messages to keep the connection alive. To
ensure that the connection to the server is still active, we memorize the most recent ping's time
and we periodically ensure that a ping was received in __ensure_ping"""
... | [
"The",
"server",
"periodically",
"sends",
"us",
"websocket",
"ping",
"messages",
"to",
"keep",
"the",
"connection",
"alive",
".",
"To",
"ensure",
"that",
"the",
"connection",
"to",
"the",
"server",
"is",
"still",
"active",
"we",
"memorize",
"the",
"most",
"r... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L306-L311 | [
"def",
"__on_ping",
"(",
"self",
",",
"ws",
",",
"data",
")",
":",
"logging",
".",
"debug",
"(",
"\"ConnectorDB:WS: ping\"",
")",
"self",
".",
"lastpingtime",
"=",
"time",
".",
"time",
"(",
")"
] | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | WebsocketHandler.__ensure_ping | Each time the server sends a ping message, we record the timestamp. If we haven't received a ping
within the given interval, then we assume that the connection was lost, close the websocket and
attempt to reconnect | connectordb/_websocket.py | def __ensure_ping(self):
"""Each time the server sends a ping message, we record the timestamp. If we haven't received a ping
within the given interval, then we assume that the connection was lost, close the websocket and
attempt to reconnect"""
logging.debug("ConnectorDB:WS: pingcheck"... | def __ensure_ping(self):
"""Each time the server sends a ping message, we record the timestamp. If we haven't received a ping
within the given interval, then we assume that the connection was lost, close the websocket and
attempt to reconnect"""
logging.debug("ConnectorDB:WS: pingcheck"... | [
"Each",
"time",
"the",
"server",
"sends",
"a",
"ping",
"message",
"we",
"record",
"the",
"timestamp",
".",
"If",
"we",
"haven",
"t",
"received",
"a",
"ping",
"within",
"the",
"given",
"interval",
"then",
"we",
"assume",
"that",
"the",
"connection",
"was",
... | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/_websocket.py#L313-L329 | [
"def",
"__ensure_ping",
"(",
"self",
")",
":",
"logging",
".",
"debug",
"(",
"\"ConnectorDB:WS: pingcheck\"",
")",
"if",
"(",
"time",
".",
"time",
"(",
")",
"-",
"self",
".",
"lastpingtime",
">",
"self",
".",
"connection_ping_timeout",
")",
":",
"logging",
... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | gatk_select_variants | Isolates a particular variant type from a VCF file using GATK SelectVariants
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str mode: variant type (i.e. SNP or INDEL)
:param str vcf_id: FileStoreID for input VCF file
:param str ref_fasta: FileStoreID for reference genome fasta
... | src/toil_lib/tools/variant_manipulation.py | def gatk_select_variants(job, mode, vcf_id, ref_fasta, ref_fai, ref_dict):
"""
Isolates a particular variant type from a VCF file using GATK SelectVariants
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str mode: variant type (i.e. SNP or INDEL)
:param str vcf_id: FileStoreI... | def gatk_select_variants(job, mode, vcf_id, ref_fasta, ref_fai, ref_dict):
"""
Isolates a particular variant type from a VCF file using GATK SelectVariants
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str mode: variant type (i.e. SNP or INDEL)
:param str vcf_id: FileStoreI... | [
"Isolates",
"a",
"particular",
"variant",
"type",
"from",
"a",
"VCF",
"file",
"using",
"GATK",
"SelectVariants"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_manipulation.py#L7-L44 | [
"def",
"gatk_select_variants",
"(",
"job",
",",
"mode",
",",
"vcf_id",
",",
"ref_fasta",
",",
"ref_fai",
",",
"ref_dict",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running GATK SelectVariants to select %ss'",
"%",
"mode",
")",
"inputs",
"=",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | gatk_variant_filtration | Filters VCF file using GATK VariantFiltration. Fixes extra pair of quotation marks in VCF header that
may interfere with other VCF tools.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str vcf_id: FileStoreID for input VCF file
:param str filter_name: Name of filter for VCF head... | src/toil_lib/tools/variant_manipulation.py | def gatk_variant_filtration(job, vcf_id, filter_name, filter_expression, ref_fasta, ref_fai, ref_dict):
"""
Filters VCF file using GATK VariantFiltration. Fixes extra pair of quotation marks in VCF header that
may interfere with other VCF tools.
:param JobFunctionWrappingJob job: passed automatically b... | def gatk_variant_filtration(job, vcf_id, filter_name, filter_expression, ref_fasta, ref_fai, ref_dict):
"""
Filters VCF file using GATK VariantFiltration. Fixes extra pair of quotation marks in VCF header that
may interfere with other VCF tools.
:param JobFunctionWrappingJob job: passed automatically b... | [
"Filters",
"VCF",
"file",
"using",
"GATK",
"VariantFiltration",
".",
"Fixes",
"extra",
"pair",
"of",
"quotation",
"marks",
"in",
"VCF",
"header",
"that",
"may",
"interfere",
"with",
"other",
"VCF",
"tools",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_manipulation.py#L47-L96 | [
"def",
"gatk_variant_filtration",
"(",
"job",
",",
"vcf_id",
",",
"filter_name",
",",
"filter_expression",
",",
"ref_fasta",
",",
"ref_fai",
",",
"ref_dict",
")",
":",
"inputs",
"=",
"{",
"'genome.fa'",
":",
"ref_fasta",
",",
"'genome.fa.fai'",
":",
"ref_fai",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | gatk_variant_recalibrator | Runs either SNP or INDEL variant quality score recalibration using GATK VariantRecalibrator. Because the VQSR method
models SNPs and INDELs differently, VQSR must be run separately for these variant types.
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str mode: Determines variant r... | src/toil_lib/tools/variant_manipulation.py | def gatk_variant_recalibrator(job,
mode,
vcf,
ref_fasta, ref_fai, ref_dict,
annotations,
hapmap=None, omni=None, phase=None, dbsnp=None, mills=None,
... | def gatk_variant_recalibrator(job,
mode,
vcf,
ref_fasta, ref_fai, ref_dict,
annotations,
hapmap=None, omni=None, phase=None, dbsnp=None, mills=None,
... | [
"Runs",
"either",
"SNP",
"or",
"INDEL",
"variant",
"quality",
"score",
"recalibration",
"using",
"GATK",
"VariantRecalibrator",
".",
"Because",
"the",
"VQSR",
"method",
"models",
"SNPs",
"and",
"INDELs",
"differently",
"VQSR",
"must",
"be",
"run",
"separately",
... | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_manipulation.py#L99-L203 | [
"def",
"gatk_variant_recalibrator",
"(",
"job",
",",
"mode",
",",
"vcf",
",",
"ref_fasta",
",",
"ref_fai",
",",
"ref_dict",
",",
"annotations",
",",
"hapmap",
"=",
"None",
",",
"omni",
"=",
"None",
",",
"phase",
"=",
"None",
",",
"dbsnp",
"=",
"None",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | gatk_apply_variant_recalibration | Applies variant quality score recalibration to VCF file using GATK ApplyRecalibration
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str mode: Determines variant recalibration mode (SNP or INDEL)
:param str vcf: FileStoreID for input VCF file
:param str recal_table: FileStoreID ... | src/toil_lib/tools/variant_manipulation.py | def gatk_apply_variant_recalibration(job,
mode,
vcf,
recal_table, tranches,
ref_fasta, ref_fai, ref_dict,
ts_filter_level=99.0,
... | def gatk_apply_variant_recalibration(job,
mode,
vcf,
recal_table, tranches,
ref_fasta, ref_fai, ref_dict,
ts_filter_level=99.0,
... | [
"Applies",
"variant",
"quality",
"score",
"recalibration",
"to",
"VCF",
"file",
"using",
"GATK",
"ApplyRecalibration"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_manipulation.py#L206-L266 | [
"def",
"gatk_apply_variant_recalibration",
"(",
"job",
",",
"mode",
",",
"vcf",
",",
"recal_table",
",",
"tranches",
",",
"ref_fasta",
",",
"ref_fai",
",",
"ref_dict",
",",
"ts_filter_level",
"=",
"99.0",
",",
"unsafe_mode",
"=",
"False",
")",
":",
"inputs",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | gatk_combine_variants | Merges VCF files using GATK CombineVariants
:param JobFunctionWrappingJob job: Toil Job instance
:param dict vcfs: Dictionary of VCF FileStoreIDs {sample identifier: FileStoreID}
:param str ref_fasta: FileStoreID for reference genome fasta
:param str ref_fai: FileStoreID for reference genome index file... | src/toil_lib/tools/variant_manipulation.py | def gatk_combine_variants(job, vcfs, ref_fasta, ref_fai, ref_dict, merge_option='UNIQUIFY'):
"""
Merges VCF files using GATK CombineVariants
:param JobFunctionWrappingJob job: Toil Job instance
:param dict vcfs: Dictionary of VCF FileStoreIDs {sample identifier: FileStoreID}
:param str ref_fasta: F... | def gatk_combine_variants(job, vcfs, ref_fasta, ref_fai, ref_dict, merge_option='UNIQUIFY'):
"""
Merges VCF files using GATK CombineVariants
:param JobFunctionWrappingJob job: Toil Job instance
:param dict vcfs: Dictionary of VCF FileStoreIDs {sample identifier: FileStoreID}
:param str ref_fasta: F... | [
"Merges",
"VCF",
"files",
"using",
"GATK",
"CombineVariants"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/variant_manipulation.py#L269-L311 | [
"def",
"gatk_combine_variants",
"(",
"job",
",",
"vcfs",
",",
"ref_fasta",
",",
"ref_fai",
",",
"ref_dict",
",",
"merge_option",
"=",
"'UNIQUIFY'",
")",
":",
"job",
".",
"fileStore",
".",
"logToMaster",
"(",
"'Running GATK CombineVariants'",
")",
"inputs",
"=",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | bam_quickcheck | Perform a quick check on a BAM via `samtools quickcheck`.
This will detect obvious BAM errors such as truncation.
:param str bam_path: path to BAM file to checked
:rtype: boolean
:return: True if the BAM is valid, False is BAM is invalid or something related to the call went wrong | src/toil_lib/validators.py | def bam_quickcheck(bam_path):
"""
Perform a quick check on a BAM via `samtools quickcheck`.
This will detect obvious BAM errors such as truncation.
:param str bam_path: path to BAM file to checked
:rtype: boolean
:return: True if the BAM is valid, False is BAM is invalid or something related t... | def bam_quickcheck(bam_path):
"""
Perform a quick check on a BAM via `samtools quickcheck`.
This will detect obvious BAM errors such as truncation.
:param str bam_path: path to BAM file to checked
:rtype: boolean
:return: True if the BAM is valid, False is BAM is invalid or something related t... | [
"Perform",
"a",
"quick",
"check",
"on",
"a",
"BAM",
"via",
"samtools",
"quickcheck",
".",
"This",
"will",
"detect",
"obvious",
"BAM",
"errors",
"such",
"as",
"truncation",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/validators.py#L8-L24 | [
"def",
"bam_quickcheck",
"(",
"bam_path",
")",
":",
"directory",
",",
"bam_name",
"=",
"os",
".",
"path",
".",
"split",
"(",
"bam_path",
")",
"exit_code",
"=",
"subprocess",
".",
"call",
"(",
"[",
"'docker'",
",",
"'run'",
",",
"'-v'",
",",
"directory",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | load_handlers | Given a dictionary mapping which looks like the following, import the
objects based on the dotted path and yield the packet type and handler as
pairs.
If the special string '*' is passed, don't process that, pass it on as it
is a wildcard.
If an non-string object is given for either packet or hand... | home/collect/handlers.py | def load_handlers(handler_mapping):
"""
Given a dictionary mapping which looks like the following, import the
objects based on the dotted path and yield the packet type and handler as
pairs.
If the special string '*' is passed, don't process that, pass it on as it
is a wildcard.
If an non-... | def load_handlers(handler_mapping):
"""
Given a dictionary mapping which looks like the following, import the
objects based on the dotted path and yield the packet type and handler as
pairs.
If the special string '*' is passed, don't process that, pass it on as it
is a wildcard.
If an non-... | [
"Given",
"a",
"dictionary",
"mapping",
"which",
"looks",
"like",
"the",
"following",
"import",
"the",
"objects",
"based",
"on",
"the",
"dotted",
"path",
"and",
"yield",
"the",
"packet",
"type",
"and",
"handler",
"as",
"pairs",
"."
] | d0ugal/home | python | https://github.com/d0ugal/home/blob/e984716ae6c74dc8e40346584668ac5cfeaaf520/home/collect/handlers.py#L26-L69 | [
"def",
"load_handlers",
"(",
"handler_mapping",
")",
":",
"handlers",
"=",
"{",
"}",
"for",
"packet_type",
",",
"handler",
"in",
"handler_mapping",
".",
"items",
"(",
")",
":",
"if",
"packet_type",
"==",
"'*'",
":",
"Packet",
"=",
"packet_type",
"elif",
"i... | e984716ae6c74dc8e40346584668ac5cfeaaf520 |
test | write_config | Helper to write the JSON configuration to a file | src/ols_client/constants.py | def write_config(configuration):
"""Helper to write the JSON configuration to a file"""
with open(CONFIG_PATH, 'w') as f:
json.dump(configuration, f, indent=2, sort_keys=True) | def write_config(configuration):
"""Helper to write the JSON configuration to a file"""
with open(CONFIG_PATH, 'w') as f:
json.dump(configuration, f, indent=2, sort_keys=True) | [
"Helper",
"to",
"write",
"the",
"JSON",
"configuration",
"to",
"a",
"file"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/constants.py#L21-L24 | [
"def",
"write_config",
"(",
"configuration",
")",
":",
"with",
"open",
"(",
"CONFIG_PATH",
",",
"'w'",
")",
"as",
"f",
":",
"json",
".",
"dump",
"(",
"configuration",
",",
"f",
",",
"indent",
"=",
"2",
",",
"sort_keys",
"=",
"True",
")"
] | 8c6bb54888675652d25324184967392d00d128fc |
test | get_config | Gets the configuration for this project from the default JSON file, or writes one if it doesn't exist
:rtype: dict | src/ols_client/constants.py | def get_config():
"""Gets the configuration for this project from the default JSON file, or writes one if it doesn't exist
:rtype: dict
"""
if not os.path.exists(CONFIG_PATH):
write_config({})
with open(CONFIG_PATH) as f:
return json.load(f) | def get_config():
"""Gets the configuration for this project from the default JSON file, or writes one if it doesn't exist
:rtype: dict
"""
if not os.path.exists(CONFIG_PATH):
write_config({})
with open(CONFIG_PATH) as f:
return json.load(f) | [
"Gets",
"the",
"configuration",
"for",
"this",
"project",
"from",
"the",
"default",
"JSON",
"file",
"or",
"writes",
"one",
"if",
"it",
"doesn",
"t",
"exist"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/constants.py#L27-L36 | [
"def",
"get_config",
"(",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"CONFIG_PATH",
")",
":",
"write_config",
"(",
"{",
"}",
")",
"with",
"open",
"(",
"CONFIG_PATH",
")",
"as",
"f",
":",
"return",
"json",
".",
"load",
"(",
"f",
... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.get_ontology | Gets the metadata for a given ontology
:param str ontology: The name of the ontology
:return: The dictionary representing the JSON from the OLS
:rtype: dict | src/ols_client/client.py | def get_ontology(self, ontology):
"""Gets the metadata for a given ontology
:param str ontology: The name of the ontology
:return: The dictionary representing the JSON from the OLS
:rtype: dict
"""
url = self.ontology_metadata_fmt.format(ontology=ontology)
respon... | def get_ontology(self, ontology):
"""Gets the metadata for a given ontology
:param str ontology: The name of the ontology
:return: The dictionary representing the JSON from the OLS
:rtype: dict
"""
url = self.ontology_metadata_fmt.format(ontology=ontology)
respon... | [
"Gets",
"the",
"metadata",
"for",
"a",
"given",
"ontology"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L56-L65 | [
"def",
"get_ontology",
"(",
"self",
",",
"ontology",
")",
":",
"url",
"=",
"self",
".",
"ontology_metadata_fmt",
".",
"format",
"(",
"ontology",
"=",
"ontology",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"return",
"response",
".",
"j... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.get_term | Gets the data for a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:rtype: dict | src/ols_client/client.py | def get_term(self, ontology, iri):
"""Gets the data for a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:rtype: dict
"""
url = self.ontology_term_fmt.format(ontology, iri)
response = requests.get(url)
return r... | def get_term(self, ontology, iri):
"""Gets the data for a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:rtype: dict
"""
url = self.ontology_term_fmt.format(ontology, iri)
response = requests.get(url)
return r... | [
"Gets",
"the",
"data",
"for",
"a",
"given",
"term"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L67-L77 | [
"def",
"get_term",
"(",
"self",
",",
"ontology",
",",
"iri",
")",
":",
"url",
"=",
"self",
".",
"ontology_term_fmt",
".",
"format",
"(",
"ontology",
",",
"iri",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
")",
"return",
"response",
".",
... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.search | Searches the OLS with the given term
:param str name:
:param list[str] query_fields: Fields to query
:return: dict | src/ols_client/client.py | def search(self, name, query_fields=None):
"""Searches the OLS with the given term
:param str name:
:param list[str] query_fields: Fields to query
:return: dict
"""
params = {'q': name}
if query_fields is not None:
params['queryFields'] = '{{{}}}'.for... | def search(self, name, query_fields=None):
"""Searches the OLS with the given term
:param str name:
:param list[str] query_fields: Fields to query
:return: dict
"""
params = {'q': name}
if query_fields is not None:
params['queryFields'] = '{{{}}}'.for... | [
"Searches",
"the",
"OLS",
"with",
"the",
"given",
"term"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L79-L91 | [
"def",
"search",
"(",
"self",
",",
"name",
",",
"query_fields",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'q'",
":",
"name",
"}",
"if",
"query_fields",
"is",
"not",
"None",
":",
"params",
"[",
"'queryFields'",
"]",
"=",
"'{{{}}}'",
".",
"format",
"... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.suggest | Suggest terms from an optional list of ontologies
:param str name:
:param list[str] ontology:
:rtype: dict
.. seealso:: https://www.ebi.ac.uk/ols/docs/api#_suggest_term | src/ols_client/client.py | def suggest(self, name, ontology=None):
"""Suggest terms from an optional list of ontologies
:param str name:
:param list[str] ontology:
:rtype: dict
.. seealso:: https://www.ebi.ac.uk/ols/docs/api#_suggest_term
"""
params = {'q': name}
if ontology:
... | def suggest(self, name, ontology=None):
"""Suggest terms from an optional list of ontologies
:param str name:
:param list[str] ontology:
:rtype: dict
.. seealso:: https://www.ebi.ac.uk/ols/docs/api#_suggest_term
"""
params = {'q': name}
if ontology:
... | [
"Suggest",
"terms",
"from",
"an",
"optional",
"list",
"of",
"ontologies"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L93-L107 | [
"def",
"suggest",
"(",
"self",
",",
"name",
",",
"ontology",
"=",
"None",
")",
":",
"params",
"=",
"{",
"'q'",
":",
"name",
"}",
"if",
"ontology",
":",
"params",
"[",
"'ontology'",
"]",
"=",
"','",
".",
"join",
"(",
"ontology",
")",
"response",
"="... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient._iter_terms_helper | Iterates over all terms, lazily with paging
:param str url: The url to query
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to sleep between pages. Defaults to none.
:rtype: iter[dict] | src/ols_client/client.py | def _iter_terms_helper(url, size=None, sleep=None):
"""Iterates over all terms, lazily with paging
:param str url: The url to query
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to sleep between pag... | def _iter_terms_helper(url, size=None, sleep=None):
"""Iterates over all terms, lazily with paging
:param str url: The url to query
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to sleep between pag... | [
"Iterates",
"over",
"all",
"terms",
"lazily",
"with",
"paging"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L110-L157 | [
"def",
"_iter_terms_helper",
"(",
"url",
",",
"size",
"=",
"None",
",",
"sleep",
"=",
"None",
")",
":",
"if",
"size",
"is",
"None",
":",
"size",
"=",
"500",
"elif",
"size",
">",
"500",
":",
"raise",
"ValueError",
"(",
"'Maximum size is 500. Given: {}'",
... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.iter_terms | Iterates over all terms, lazily with paging
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to sleep between pages. Defaults to 0 seconds.
:rtype: iter[di... | src/ols_client/client.py | def iter_terms(self, ontology, size=None, sleep=None):
"""Iterates over all terms, lazily with paging
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to s... | def iter_terms(self, ontology, size=None, sleep=None):
"""Iterates over all terms, lazily with paging
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to s... | [
"Iterates",
"over",
"all",
"terms",
"lazily",
"with",
"paging"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L159-L169 | [
"def",
"iter_terms",
"(",
"self",
",",
"ontology",
",",
"size",
"=",
"None",
",",
"sleep",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"ontology_terms_fmt",
".",
"format",
"(",
"ontology",
"=",
"ontology",
")",
"for",
"term",
"in",
"self",
".",
"... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.iter_descendants | Iterates over the descendants of a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to sleep between pages. De... | src/ols_client/client.py | def iter_descendants(self, ontology, iri, size=None, sleep=None):
"""Iterates over the descendants of a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the... | def iter_descendants(self, ontology, iri, size=None, sleep=None):
"""Iterates over the descendants of a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the... | [
"Iterates",
"over",
"the",
"descendants",
"of",
"a",
"given",
"term"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L171-L183 | [
"def",
"iter_descendants",
"(",
"self",
",",
"ontology",
",",
"iri",
",",
"size",
"=",
"None",
",",
"sleep",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"ontology_term_descendants_fmt",
".",
"format",
"(",
"ontology",
"=",
"ontology",
",",
"iri",
"="... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.iter_descendants_labels | Iterates over the labels for the descendants of a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to sleep be... | src/ols_client/client.py | def iter_descendants_labels(self, ontology, iri, size=None, sleep=None):
"""Iterates over the labels for the descendants of a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:param int size: The size of each page. Defaults to 500, which is the ... | def iter_descendants_labels(self, ontology, iri, size=None, sleep=None):
"""Iterates over the labels for the descendants of a given term
:param str ontology: The name of the ontology
:param str iri: The IRI of a term
:param int size: The size of each page. Defaults to 500, which is the ... | [
"Iterates",
"over",
"the",
"labels",
"for",
"the",
"descendants",
"of",
"a",
"given",
"term"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L185-L195 | [
"def",
"iter_descendants_labels",
"(",
"self",
",",
"ontology",
",",
"iri",
",",
"size",
"=",
"None",
",",
"sleep",
"=",
"None",
")",
":",
"for",
"label",
"in",
"_help_iterate_labels",
"(",
"self",
".",
"iter_descendants",
"(",
"ontology",
",",
"iri",
",",... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.iter_labels | Iterates over the labels of terms in the ontology. Automatically wraps the pager returned by the OLS.
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to sleep bet... | src/ols_client/client.py | def iter_labels(self, ontology, size=None, sleep=None):
"""Iterates over the labels of terms in the ontology. Automatically wraps the pager returned by the OLS.
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by... | def iter_labels(self, ontology, size=None, sleep=None):
"""Iterates over the labels of terms in the ontology. Automatically wraps the pager returned by the OLS.
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by... | [
"Iterates",
"over",
"the",
"labels",
"of",
"terms",
"in",
"the",
"ontology",
".",
"Automatically",
"wraps",
"the",
"pager",
"returned",
"by",
"the",
"OLS",
"."
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L197-L206 | [
"def",
"iter_labels",
"(",
"self",
",",
"ontology",
",",
"size",
"=",
"None",
",",
"sleep",
"=",
"None",
")",
":",
"for",
"label",
"in",
"_help_iterate_labels",
"(",
"self",
".",
"iter_terms",
"(",
"ontology",
"=",
"ontology",
",",
"size",
"=",
"size",
... | 8c6bb54888675652d25324184967392d00d128fc |
test | OlsClient.iter_hierarchy | Iterates over parent-child relations
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to sleep between pages. Defaults to 0 seconds.
:rtype: iter[tuple[str... | src/ols_client/client.py | def iter_hierarchy(self, ontology, size=None, sleep=None):
"""Iterates over parent-child relations
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to slee... | def iter_hierarchy(self, ontology, size=None, sleep=None):
"""Iterates over parent-child relations
:param str ontology: The name of the ontology
:param int size: The size of each page. Defaults to 500, which is the maximum allowed by the EBI.
:param int sleep: The amount of time to slee... | [
"Iterates",
"over",
"parent",
"-",
"child",
"relations"
] | cthoyt/ols-client | python | https://github.com/cthoyt/ols-client/blob/8c6bb54888675652d25324184967392d00d128fc/src/ols_client/client.py#L208-L225 | [
"def",
"iter_hierarchy",
"(",
"self",
",",
"ontology",
",",
"size",
"=",
"None",
",",
"sleep",
"=",
"None",
")",
":",
"for",
"term",
"in",
"self",
".",
"iter_terms",
"(",
"ontology",
"=",
"ontology",
",",
"size",
"=",
"size",
",",
"sleep",
"=",
"slee... | 8c6bb54888675652d25324184967392d00d128fc |
test | run_fastqc | Run Fastqc on the input reads
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq read 1
:param str r2_id: FileStoreID of fastq read 2
:return: FileStoreID of fastQC output (tarball)
:rtype: str | src/toil_lib/tools/QC.py | def run_fastqc(job, r1_id, r2_id):
"""
Run Fastqc on the input reads
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq read 1
:param str r2_id: FileStoreID of fastq read 2
:return: FileStoreID of fastQC output (tarball)
:rtype: str
""... | def run_fastqc(job, r1_id, r2_id):
"""
Run Fastqc on the input reads
:param JobFunctionWrappingJob job: passed automatically by Toil
:param str r1_id: FileStoreID of fastq read 1
:param str r2_id: FileStoreID of fastq read 2
:return: FileStoreID of fastQC output (tarball)
:rtype: str
""... | [
"Run",
"Fastqc",
"on",
"the",
"input",
"reads"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/tools/QC.py#L8-L30 | [
"def",
"run_fastqc",
"(",
"job",
",",
"r1_id",
",",
"r2_id",
")",
":",
"work_dir",
"=",
"job",
".",
"fileStore",
".",
"getLocalTempDir",
"(",
")",
"job",
".",
"fileStore",
".",
"readGlobalFile",
"(",
"r1_id",
",",
"os",
".",
"path",
".",
"join",
"(",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | Merge.addStream | Adds the given stream to the query construction. The function supports both stream
names and Stream objects. | connectordb/query/merge.py | def addStream(self, stream, t1=None, t2=None, limit=None, i1=None, i2=None, transform=None):
"""Adds the given stream to the query construction. The function supports both stream
names and Stream objects."""
params = query_maker(t1, t2, limit, i1, i2, transform)
params["stream"] = ... | def addStream(self, stream, t1=None, t2=None, limit=None, i1=None, i2=None, transform=None):
"""Adds the given stream to the query construction. The function supports both stream
names and Stream objects."""
params = query_maker(t1, t2, limit, i1, i2, transform)
params["stream"] = ... | [
"Adds",
"the",
"given",
"stream",
"to",
"the",
"query",
"construction",
".",
"The",
"function",
"supports",
"both",
"stream",
"names",
"and",
"Stream",
"objects",
"."
] | connectordb/connectordb-python | python | https://github.com/connectordb/connectordb-python/blob/2092b0cb30898139a247176bcf433d5a4abde7cb/connectordb/query/merge.py#L32-L40 | [
"def",
"addStream",
"(",
"self",
",",
"stream",
",",
"t1",
"=",
"None",
",",
"t2",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"i1",
"=",
"None",
",",
"i2",
"=",
"None",
",",
"transform",
"=",
"None",
")",
":",
"params",
"=",
"query_maker",
"(",... | 2092b0cb30898139a247176bcf433d5a4abde7cb |
test | create_app | This needs some tidying up. To avoid circular imports we import
everything here but it makes this method a bit more gross. | home/__init__.py | def create_app(config=None):
""" This needs some tidying up. To avoid circular imports we import
everything here but it makes this method a bit more gross.
"""
# Initialise the app
from home.config import TEMPLATE_FOLDER, STATIC_FOLDER
app = Flask(__name__, static_folder=STATIC_FOLDER,
... | def create_app(config=None):
""" This needs some tidying up. To avoid circular imports we import
everything here but it makes this method a bit more gross.
"""
# Initialise the app
from home.config import TEMPLATE_FOLDER, STATIC_FOLDER
app = Flask(__name__, static_folder=STATIC_FOLDER,
... | [
"This",
"needs",
"some",
"tidying",
"up",
".",
"To",
"avoid",
"circular",
"imports",
"we",
"import",
"everything",
"here",
"but",
"it",
"makes",
"this",
"method",
"a",
"bit",
"more",
"gross",
"."
] | d0ugal/home | python | https://github.com/d0ugal/home/blob/e984716ae6c74dc8e40346584668ac5cfeaaf520/home/__init__.py#L26-L74 | [
"def",
"create_app",
"(",
"config",
"=",
"None",
")",
":",
"# Initialise the app",
"from",
"home",
".",
"config",
"import",
"TEMPLATE_FOLDER",
",",
"STATIC_FOLDER",
"app",
"=",
"Flask",
"(",
"__name__",
",",
"static_folder",
"=",
"STATIC_FOLDER",
",",
"template_... | e984716ae6c74dc8e40346584668ac5cfeaaf520 |
test | spawn_spark_cluster | :param numWorkers: The number of worker nodes to have in the cluster. \
Must be greater than or equal to 1.
:param cores: Optional parameter to set the number of cores per node. \
If not provided, we use the number of cores on the node that launches \
the service.
:param memory: Optional parameter t... | src/toil_lib/spark.py | def spawn_spark_cluster(job,
numWorkers,
cores=None,
memory=None,
disk=None,
overrideLeaderIP=None):
'''
:param numWorkers: The number of worker nodes to have in the cluster. \
Must be gre... | def spawn_spark_cluster(job,
numWorkers,
cores=None,
memory=None,
disk=None,
overrideLeaderIP=None):
'''
:param numWorkers: The number of worker nodes to have in the cluster. \
Must be gre... | [
":",
"param",
"numWorkers",
":",
"The",
"number",
"of",
"worker",
"nodes",
"to",
"have",
"in",
"the",
"cluster",
".",
"\\",
"Must",
"be",
"greater",
"than",
"or",
"equal",
"to",
"1",
".",
":",
"param",
"cores",
":",
"Optional",
"parameter",
"to",
"set"... | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L28-L64 | [
"def",
"spawn_spark_cluster",
"(",
"job",
",",
"numWorkers",
",",
"cores",
"=",
"None",
",",
"memory",
"=",
"None",
",",
"disk",
"=",
"None",
",",
"overrideLeaderIP",
"=",
"None",
")",
":",
"if",
"numWorkers",
"<",
"1",
":",
"raise",
"ValueError",
"(",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | SparkService.start | Start spark and hdfs master containers
:param job: The underlying job. | src/toil_lib/spark.py | def start(self, job):
"""
Start spark and hdfs master containers
:param job: The underlying job.
"""
if self.hostname is None:
self.hostname = subprocess.check_output(["hostname", "-f",])[:-1]
_log.info("Started Spark master container.")
self.sparkC... | def start(self, job):
"""
Start spark and hdfs master containers
:param job: The underlying job.
"""
if self.hostname is None:
self.hostname = subprocess.check_output(["hostname", "-f",])[:-1]
_log.info("Started Spark master container.")
self.sparkC... | [
"Start",
"spark",
"and",
"hdfs",
"master",
"containers"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L124-L155 | [
"def",
"start",
"(",
"self",
",",
"job",
")",
":",
"if",
"self",
".",
"hostname",
"is",
"None",
":",
"self",
".",
"hostname",
"=",
"subprocess",
".",
"check_output",
"(",
"[",
"\"hostname\"",
",",
"\"-f\"",
",",
"]",
")",
"[",
":",
"-",
"1",
"]",
... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | WorkerService.start | Start spark and hdfs worker containers
:param job: The underlying job. | src/toil_lib/spark.py | def start(self, job):
"""
Start spark and hdfs worker containers
:param job: The underlying job.
"""
# start spark and our datanode
self.sparkContainerID = dockerCheckOutput(job=job,
defer=STOP,
... | def start(self, job):
"""
Start spark and hdfs worker containers
:param job: The underlying job.
"""
# start spark and our datanode
self.sparkContainerID = dockerCheckOutput(job=job,
defer=STOP,
... | [
"Start",
"spark",
"and",
"hdfs",
"worker",
"containers"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L211-L283 | [
"def",
"start",
"(",
"self",
",",
"job",
")",
":",
"# start spark and our datanode",
"self",
".",
"sparkContainerID",
"=",
"dockerCheckOutput",
"(",
"job",
"=",
"job",
",",
"defer",
"=",
"STOP",
",",
"workDir",
"=",
"os",
".",
"getcwd",
"(",
")",
",",
"t... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | WorkerService.__start_datanode | Launches the Hadoop datanode.
:param job: The underlying job. | src/toil_lib/spark.py | def __start_datanode(self, job):
"""
Launches the Hadoop datanode.
:param job: The underlying job.
"""
self.hdfsContainerID = dockerCheckOutput(job=job,
defer=STOP,
workDir=os.getcw... | def __start_datanode(self, job):
"""
Launches the Hadoop datanode.
:param job: The underlying job.
"""
self.hdfsContainerID = dockerCheckOutput(job=job,
defer=STOP,
workDir=os.getcw... | [
"Launches",
"the",
"Hadoop",
"datanode",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L285-L298 | [
"def",
"__start_datanode",
"(",
"self",
",",
"job",
")",
":",
"self",
".",
"hdfsContainerID",
"=",
"dockerCheckOutput",
"(",
"job",
"=",
"job",
",",
"defer",
"=",
"STOP",
",",
"workDir",
"=",
"os",
".",
"getcwd",
"(",
")",
",",
"tool",
"=",
"\"quay.io/... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | WorkerService.stop | Stop spark and hdfs worker containers
:param job: The underlying job. | src/toil_lib/spark.py | def stop(self, fileStore):
"""
Stop spark and hdfs worker containers
:param job: The underlying job.
"""
subprocess.call(["docker", "exec", self.sparkContainerID, "rm", "-r", "/ephemeral/spark"])
subprocess.call(["docker", "stop", self.sparkContainerID])
subproc... | def stop(self, fileStore):
"""
Stop spark and hdfs worker containers
:param job: The underlying job.
"""
subprocess.call(["docker", "exec", self.sparkContainerID, "rm", "-r", "/ephemeral/spark"])
subprocess.call(["docker", "stop", self.sparkContainerID])
subproc... | [
"Stop",
"spark",
"and",
"hdfs",
"worker",
"containers"
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L300-L317 | [
"def",
"stop",
"(",
"self",
",",
"fileStore",
")",
":",
"subprocess",
".",
"call",
"(",
"[",
"\"docker\"",
",",
"\"exec\"",
",",
"self",
".",
"sparkContainerID",
",",
"\"rm\"",
",",
"\"-r\"",
",",
"\"/ephemeral/spark\"",
"]",
")",
"subprocess",
".",
"call"... | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | WorkerService.check | Checks to see if Spark worker and HDFS datanode are still running. | src/toil_lib/spark.py | def check(self):
"""
Checks to see if Spark worker and HDFS datanode are still running.
"""
status = _checkContainerStatus(self.sparkContainerID,
self.hdfsContainerID,
sparkNoun='worker',
... | def check(self):
"""
Checks to see if Spark worker and HDFS datanode are still running.
"""
status = _checkContainerStatus(self.sparkContainerID,
self.hdfsContainerID,
sparkNoun='worker',
... | [
"Checks",
"to",
"see",
"if",
"Spark",
"worker",
"and",
"HDFS",
"datanode",
"are",
"still",
"running",
"."
] | BD2KGenomics/toil-lib | python | https://github.com/BD2KGenomics/toil-lib/blob/022a615fc3dc98fc1aaa7bfd232409962ca44fbd/src/toil_lib/spark.py#L320-L330 | [
"def",
"check",
"(",
"self",
")",
":",
"status",
"=",
"_checkContainerStatus",
"(",
"self",
".",
"sparkContainerID",
",",
"self",
".",
"hdfsContainerID",
",",
"sparkNoun",
"=",
"'worker'",
",",
"hdfsNoun",
"=",
"'datanode'",
")",
"return",
"status"
] | 022a615fc3dc98fc1aaa7bfd232409962ca44fbd |
test | base_tokenizer | Tokenizer. Generates tokens stream from text | mint.py | def base_tokenizer(fp):
'Tokenizer. Generates tokens stream from text'
if isinstance(fp, StringIO):
template_file = fp
size = template_file.len
else:
#empty file check
if os.fstat(fp.fileno()).st_size == 0:
yield TOKEN_EOF, 'EOF', 0, 0
return
t... | def base_tokenizer(fp):
'Tokenizer. Generates tokens stream from text'
if isinstance(fp, StringIO):
template_file = fp
size = template_file.len
else:
#empty file check
if os.fstat(fp.fileno()).st_size == 0:
yield TOKEN_EOF, 'EOF', 0, 0
return
t... | [
"Tokenizer",
".",
"Generates",
"tokens",
"stream",
"from",
"text"
] | riffm/mint | python | https://github.com/riffm/mint/blob/db00855bbe9156d5ab281e00835af85a7958dd16/mint.py#L138-L196 | [
"def",
"base_tokenizer",
"(",
"fp",
")",
":",
"if",
"isinstance",
"(",
"fp",
",",
"StringIO",
")",
":",
"template_file",
"=",
"fp",
"size",
"=",
"template_file",
".",
"len",
"else",
":",
"#empty file check",
"if",
"os",
".",
"fstat",
"(",
"fp",
".",
"f... | db00855bbe9156d5ab281e00835af85a7958dd16 |
test | get_mint_tree | This function is wrapper to normal parsers (tag_parser, block_parser, etc.).
Returns mint tree. | mint.py | def get_mint_tree(tokens_stream):
'''
This function is wrapper to normal parsers (tag_parser, block_parser, etc.).
Returns mint tree.
'''
smart_stack = RecursiveStack()
block_parser.parse(tokens_stream, smart_stack)
return MintTemplate(body=smart_stack.stack) | def get_mint_tree(tokens_stream):
'''
This function is wrapper to normal parsers (tag_parser, block_parser, etc.).
Returns mint tree.
'''
smart_stack = RecursiveStack()
block_parser.parse(tokens_stream, smart_stack)
return MintTemplate(body=smart_stack.stack) | [
"This",
"function",
"is",
"wrapper",
"to",
"normal",
"parsers",
"(",
"tag_parser",
"block_parser",
"etc",
".",
")",
".",
"Returns",
"mint",
"tree",
"."
] | riffm/mint | python | https://github.com/riffm/mint/blob/db00855bbe9156d5ab281e00835af85a7958dd16/mint.py#L1233-L1240 | [
"def",
"get_mint_tree",
"(",
"tokens_stream",
")",
":",
"smart_stack",
"=",
"RecursiveStack",
"(",
")",
"block_parser",
".",
"parse",
"(",
"tokens_stream",
",",
"smart_stack",
")",
"return",
"MintTemplate",
"(",
"body",
"=",
"smart_stack",
".",
"stack",
")"
] | db00855bbe9156d5ab281e00835af85a7958dd16 |
test | lookup_zone | Look up a zone ID for a zone string.
Args: conn: boto.route53.Route53Connection
zone: string eg. foursquare.com
Returns: zone ID eg. ZE2DYFZDWGSL4.
Raises: ZoneNotFoundError if zone not found. | src/r53/r53.py | def lookup_zone(conn, zone):
"""Look up a zone ID for a zone string.
Args: conn: boto.route53.Route53Connection
zone: string eg. foursquare.com
Returns: zone ID eg. ZE2DYFZDWGSL4.
Raises: ZoneNotFoundError if zone not found."""
all_zones = conn.get_all_hosted_zones()
for resp in all_zones['ListHost... | def lookup_zone(conn, zone):
"""Look up a zone ID for a zone string.
Args: conn: boto.route53.Route53Connection
zone: string eg. foursquare.com
Returns: zone ID eg. ZE2DYFZDWGSL4.
Raises: ZoneNotFoundError if zone not found."""
all_zones = conn.get_all_hosted_zones()
for resp in all_zones['ListHost... | [
"Look",
"up",
"a",
"zone",
"ID",
"for",
"a",
"zone",
"string",
"."
] | coops/r53 | python | https://github.com/coops/r53/blob/3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a/src/r53/r53.py#L26-L37 | [
"def",
"lookup_zone",
"(",
"conn",
",",
"zone",
")",
":",
"all_zones",
"=",
"conn",
".",
"get_all_hosted_zones",
"(",
")",
"for",
"resp",
"in",
"all_zones",
"[",
"'ListHostedZonesResponse'",
"]",
"[",
"'HostedZones'",
"]",
":",
"if",
"resp",
"[",
"'Name'",
... | 3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a |
test | fetch_config | Fetch all pieces of a Route 53 config from Amazon.
Args: zone: string, hosted zone id.
conn: boto.route53.Route53Connection
Returns: list of ElementTrees, one for each piece of config. | src/r53/r53.py | def fetch_config(zone, conn):
"""Fetch all pieces of a Route 53 config from Amazon.
Args: zone: string, hosted zone id.
conn: boto.route53.Route53Connection
Returns: list of ElementTrees, one for each piece of config."""
more_to_fetch = True
cfg_chunks = []
next_name = None
next_type = None
nex... | def fetch_config(zone, conn):
"""Fetch all pieces of a Route 53 config from Amazon.
Args: zone: string, hosted zone id.
conn: boto.route53.Route53Connection
Returns: list of ElementTrees, one for each piece of config."""
more_to_fetch = True
cfg_chunks = []
next_name = None
next_type = None
nex... | [
"Fetch",
"all",
"pieces",
"of",
"a",
"Route",
"53",
"config",
"from",
"Amazon",
"."
] | coops/r53 | python | https://github.com/coops/r53/blob/3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a/src/r53/r53.py#L39-L71 | [
"def",
"fetch_config",
"(",
"zone",
",",
"conn",
")",
":",
"more_to_fetch",
"=",
"True",
"cfg_chunks",
"=",
"[",
"]",
"next_name",
"=",
"None",
"next_type",
"=",
"None",
"next_identifier",
"=",
"None",
"while",
"more_to_fetch",
"==",
"True",
":",
"more_to_fe... | 3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a |
test | merge_config | Merge a set of fetched Route 53 config Etrees into a canonical form.
Args: cfg_chunks: [ lxml.etree.ETree ]
Returns: lxml.etree.Element | src/r53/r53.py | def merge_config(cfg_chunks):
"""Merge a set of fetched Route 53 config Etrees into a canonical form.
Args: cfg_chunks: [ lxml.etree.ETree ]
Returns: lxml.etree.Element"""
root = lxml.etree.XML('<ResourceRecordSets xmlns="%s"></ResourceRecordSets>' % R53_XMLNS, parser=XML_PARSER)
for chunk in cfg_chunks:
... | def merge_config(cfg_chunks):
"""Merge a set of fetched Route 53 config Etrees into a canonical form.
Args: cfg_chunks: [ lxml.etree.ETree ]
Returns: lxml.etree.Element"""
root = lxml.etree.XML('<ResourceRecordSets xmlns="%s"></ResourceRecordSets>' % R53_XMLNS, parser=XML_PARSER)
for chunk in cfg_chunks:
... | [
"Merge",
"a",
"set",
"of",
"fetched",
"Route",
"53",
"config",
"Etrees",
"into",
"a",
"canonical",
"form",
"."
] | coops/r53 | python | https://github.com/coops/r53/blob/3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a/src/r53/r53.py#L73-L82 | [
"def",
"merge_config",
"(",
"cfg_chunks",
")",
":",
"root",
"=",
"lxml",
".",
"etree",
".",
"XML",
"(",
"'<ResourceRecordSets xmlns=\"%s\"></ResourceRecordSets>'",
"%",
"R53_XMLNS",
",",
"parser",
"=",
"XML_PARSER",
")",
"for",
"chunk",
"in",
"cfg_chunks",
":",
... | 3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a |
test | normalize_rrs | Lexically sort the order of every ResourceRecord in a ResourceRecords
element so we don't generate spurious changes: ordering of e.g. NS records
is irrelevant to the DNS line protocol, but XML sees it differently.
Also rewrite any wildcard records to use the ascii hex code: somewhere deep
inside route53 is som... | src/r53/r53.py | def normalize_rrs(rrsets):
"""Lexically sort the order of every ResourceRecord in a ResourceRecords
element so we don't generate spurious changes: ordering of e.g. NS records
is irrelevant to the DNS line protocol, but XML sees it differently.
Also rewrite any wildcard records to use the ascii hex code: somewh... | def normalize_rrs(rrsets):
"""Lexically sort the order of every ResourceRecord in a ResourceRecords
element so we don't generate spurious changes: ordering of e.g. NS records
is irrelevant to the DNS line protocol, but XML sees it differently.
Also rewrite any wildcard records to use the ascii hex code: somewh... | [
"Lexically",
"sort",
"the",
"order",
"of",
"every",
"ResourceRecord",
"in",
"a",
"ResourceRecords",
"element",
"so",
"we",
"don",
"t",
"generate",
"spurious",
"changes",
":",
"ordering",
"of",
"e",
".",
"g",
".",
"NS",
"records",
"is",
"irrelevant",
"to",
... | coops/r53 | python | https://github.com/coops/r53/blob/3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a/src/r53/r53.py#L87-L112 | [
"def",
"normalize_rrs",
"(",
"rrsets",
")",
":",
"for",
"rrset",
"in",
"rrsets",
":",
"if",
"rrset",
".",
"tag",
"==",
"'{%s}ResourceRecordSet'",
"%",
"R53_XMLNS",
":",
"for",
"rrs",
"in",
"rrset",
":",
"# preformat wildcard records",
"if",
"rrs",
".",
"tag"... | 3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a |
test | generate_changeset | Diff two XML configs and return an object with changes to be written.
Args: old, new: lxml.etree.Element (<ResourceRecordSets>).
Returns: lxml.etree.ETree (<ChangeResourceRecordSetsRequest>) or None | src/r53/r53.py | def generate_changeset(old, new, comment=None):
"""Diff two XML configs and return an object with changes to be written.
Args: old, new: lxml.etree.Element (<ResourceRecordSets>).
Returns: lxml.etree.ETree (<ChangeResourceRecordSetsRequest>) or None"""
rrsets_tag = '{%s}ResourceRecordSets' % R53_XMLNS
if rrs... | def generate_changeset(old, new, comment=None):
"""Diff two XML configs and return an object with changes to be written.
Args: old, new: lxml.etree.Element (<ResourceRecordSets>).
Returns: lxml.etree.ETree (<ChangeResourceRecordSetsRequest>) or None"""
rrsets_tag = '{%s}ResourceRecordSets' % R53_XMLNS
if rrs... | [
"Diff",
"two",
"XML",
"configs",
"and",
"return",
"an",
"object",
"with",
"changes",
"to",
"be",
"written",
"."
] | coops/r53 | python | https://github.com/coops/r53/blob/3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a/src/r53/r53.py#L114-L161 | [
"def",
"generate_changeset",
"(",
"old",
",",
"new",
",",
"comment",
"=",
"None",
")",
":",
"rrsets_tag",
"=",
"'{%s}ResourceRecordSets'",
"%",
"R53_XMLNS",
"if",
"rrsets_tag",
"not",
"in",
"(",
"old",
".",
"tag",
",",
"new",
".",
"tag",
")",
":",
"log",... | 3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a |
test | validate_changeset | Validate a changeset is compatible with Amazon's API spec.
Args: changeset: lxml.etree.Element (<ChangeResourceRecordSetsRequest>)
Returns: [ errors ] list of error strings or []. | src/r53/r53.py | def validate_changeset(changeset):
"""Validate a changeset is compatible with Amazon's API spec.
Args: changeset: lxml.etree.Element (<ChangeResourceRecordSetsRequest>)
Returns: [ errors ] list of error strings or []."""
errors = []
changes = changeset.findall('.//{%s}Change' % R53_XMLNS)
num_changes = len... | def validate_changeset(changeset):
"""Validate a changeset is compatible with Amazon's API spec.
Args: changeset: lxml.etree.Element (<ChangeResourceRecordSetsRequest>)
Returns: [ errors ] list of error strings or []."""
errors = []
changes = changeset.findall('.//{%s}Change' % R53_XMLNS)
num_changes = len... | [
"Validate",
"a",
"changeset",
"is",
"compatible",
"with",
"Amazon",
"s",
"API",
"spec",
"."
] | coops/r53 | python | https://github.com/coops/r53/blob/3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a/src/r53/r53.py#L163-L185 | [
"def",
"validate_changeset",
"(",
"changeset",
")",
":",
"errors",
"=",
"[",
"]",
"changes",
"=",
"changeset",
".",
"findall",
"(",
"'.//{%s}Change'",
"%",
"R53_XMLNS",
")",
"num_changes",
"=",
"len",
"(",
"changes",
")",
"if",
"num_changes",
"==",
"0",
":... | 3c4e7242ad65b0e1ad4ba6b4ac893c7d501ceb0a |
test | minimize_best_n | Orders population members from lowest fitness to highest fitness
Args:
Members (list): list of PyGenetics Member objects
Returns:
lsit: ordered lsit of Members, from highest fitness to lowest fitness | pygenetics/selection_functions.py | def minimize_best_n(Members):
'''
Orders population members from lowest fitness to highest fitness
Args:
Members (list): list of PyGenetics Member objects
Returns:
lsit: ordered lsit of Members, from highest fitness to lowest fitness
'''
return(list(reversed(sorted(
Me... | def minimize_best_n(Members):
'''
Orders population members from lowest fitness to highest fitness
Args:
Members (list): list of PyGenetics Member objects
Returns:
lsit: ordered lsit of Members, from highest fitness to lowest fitness
'''
return(list(reversed(sorted(
Me... | [
"Orders",
"population",
"members",
"from",
"lowest",
"fitness",
"to",
"highest",
"fitness"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/selection_functions.py#L10-L23 | [
"def",
"minimize_best_n",
"(",
"Members",
")",
":",
"return",
"(",
"list",
"(",
"reversed",
"(",
"sorted",
"(",
"Members",
",",
"key",
"=",
"lambda",
"Member",
":",
"Member",
".",
"fitness_score",
")",
")",
")",
")"
] | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.fitness | Population fitness == average member fitness score | pygenetics/ga_core.py | def fitness(self):
'''Population fitness == average member fitness score'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
return sum(m.fitness_score... | def fitness(self):
'''Population fitness == average member fitness score'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
return sum(m.fitness_score... | [
"Population",
"fitness",
"==",
"average",
"member",
"fitness",
"score"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L126-L136 | [
"def",
"fitness",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"__members",
")",
"!=",
"0",
":",
"if",
"self",
".",
"__num_processes",
">",
"1",
":",
"members",
"=",
"[",
"m",
".",
"get",
"(",
")",
"for",
"m",
"in",
"self",
".",
"__mem... | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.ave_cost_fn_val | Returns average cost function return value for all members | pygenetics/ga_core.py | def ave_cost_fn_val(self):
'''Returns average cost function return value for all members'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
return sum... | def ave_cost_fn_val(self):
'''Returns average cost function return value for all members'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
return sum... | [
"Returns",
"average",
"cost",
"function",
"return",
"value",
"for",
"all",
"members"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L145-L155 | [
"def",
"ave_cost_fn_val",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"__members",
")",
"!=",
"0",
":",
"if",
"self",
".",
"__num_processes",
">",
"1",
":",
"members",
"=",
"[",
"m",
".",
"get",
"(",
")",
"for",
"m",
"in",
"self",
".",
... | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.med_cost_fn_val | Returns median cost function return value for all members | pygenetics/ga_core.py | def med_cost_fn_val(self):
'''Returns median cost function return value for all members'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
return medi... | def med_cost_fn_val(self):
'''Returns median cost function return value for all members'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
return medi... | [
"Returns",
"median",
"cost",
"function",
"return",
"value",
"for",
"all",
"members"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L158-L168 | [
"def",
"med_cost_fn_val",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"__members",
")",
"!=",
"0",
":",
"if",
"self",
".",
"__num_processes",
">",
"1",
":",
"members",
"=",
"[",
"m",
".",
"get",
"(",
")",
"for",
"m",
"in",
"self",
".",
... | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.parameters | Population parameter vals == average member parameter vals | pygenetics/ga_core.py | def parameters(self):
'''Population parameter vals == average member parameter vals'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
params = {}
... | def parameters(self):
'''Population parameter vals == average member parameter vals'''
if len(self.__members) != 0:
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__members
params = {}
... | [
"Population",
"parameter",
"vals",
"==",
"average",
"member",
"parameter",
"vals"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L176-L191 | [
"def",
"parameters",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"__members",
")",
"!=",
"0",
":",
"if",
"self",
".",
"__num_processes",
">",
"1",
":",
"members",
"=",
"[",
"m",
".",
"get",
"(",
")",
"for",
"m",
"in",
"self",
".",
"__... | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.members | Returns Member objects of population | pygenetics/ga_core.py | def members(self):
'''Returns Member objects of population'''
if self.__num_processes > 1:
return [m.get() for m in self.__members]
else:
return self.__members | def members(self):
'''Returns Member objects of population'''
if self.__num_processes > 1:
return [m.get() for m in self.__members]
else:
return self.__members | [
"Returns",
"Member",
"objects",
"of",
"population"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L200-L206 | [
"def",
"members",
"(",
"self",
")",
":",
"if",
"self",
".",
"__num_processes",
">",
"1",
":",
"return",
"[",
"m",
".",
"get",
"(",
")",
"for",
"m",
"in",
"self",
".",
"__members",
"]",
"else",
":",
"return",
"self",
".",
"__members"
] | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.add_parameter | Adds a paramber to the Population
Args:
name (str): name of the parameter
min_val (int or float): minimum value for the parameter
max_val (int or float): maximum value for the parameter | pygenetics/ga_core.py | def add_parameter(self, name, min_val, max_val):
'''Adds a paramber to the Population
Args:
name (str): name of the parameter
min_val (int or float): minimum value for the parameter
max_val (int or float): maximum value for the parameter
'''
self.__p... | def add_parameter(self, name, min_val, max_val):
'''Adds a paramber to the Population
Args:
name (str): name of the parameter
min_val (int or float): minimum value for the parameter
max_val (int or float): maximum value for the parameter
'''
self.__p... | [
"Adds",
"a",
"paramber",
"to",
"the",
"Population"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L208-L217 | [
"def",
"add_parameter",
"(",
"self",
",",
"name",
",",
"min_val",
",",
"max_val",
")",
":",
"self",
".",
"__parameters",
".",
"append",
"(",
"Parameter",
"(",
"name",
",",
"min_val",
",",
"max_val",
")",
")"
] | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.generate_population | Generates self.__pop_size Members with randomly initialized values
for each parameter added with add_parameter(), evaluates their fitness | pygenetics/ga_core.py | def generate_population(self):
'''Generates self.__pop_size Members with randomly initialized values
for each parameter added with add_parameter(), evaluates their fitness
'''
if self.__num_processes > 1:
process_pool = Pool(processes=self.__num_processes)
self.__mem... | def generate_population(self):
'''Generates self.__pop_size Members with randomly initialized values
for each parameter added with add_parameter(), evaluates their fitness
'''
if self.__num_processes > 1:
process_pool = Pool(processes=self.__num_processes)
self.__mem... | [
"Generates",
"self",
".",
"__pop_size",
"Members",
"with",
"randomly",
"initialized",
"values",
"for",
"each",
"parameter",
"added",
"with",
"add_parameter",
"()",
"evaluates",
"their",
"fitness"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L219-L253 | [
"def",
"generate_population",
"(",
"self",
")",
":",
"if",
"self",
".",
"__num_processes",
">",
"1",
":",
"process_pool",
"=",
"Pool",
"(",
"processes",
"=",
"self",
".",
"__num_processes",
")",
"self",
".",
"__members",
"=",
"[",
"]",
"for",
"_",
"in",
... | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.next_generation | Generates the next population from a previously evaluated generation
Args:
mut_rate (float): mutation rate for new members (0.0 - 1.0)
max_mut_amt (float): how much the member is allowed to mutate
(0.0 - 1.0, proportion change of mutated parameter)
log_base (... | pygenetics/ga_core.py | def next_generation(self, mut_rate=0, max_mut_amt=0, log_base=10):
'''Generates the next population from a previously evaluated generation
Args:
mut_rate (float): mutation rate for new members (0.0 - 1.0)
max_mut_amt (float): how much the member is allowed to mutate
... | def next_generation(self, mut_rate=0, max_mut_amt=0, log_base=10):
'''Generates the next population from a previously evaluated generation
Args:
mut_rate (float): mutation rate for new members (0.0 - 1.0)
max_mut_amt (float): how much the member is allowed to mutate
... | [
"Generates",
"the",
"next",
"population",
"from",
"a",
"previously",
"evaluated",
"generation"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L255-L317 | [
"def",
"next_generation",
"(",
"self",
",",
"mut_rate",
"=",
"0",
",",
"max_mut_amt",
"=",
"0",
",",
"log_base",
"=",
"10",
")",
":",
"if",
"self",
".",
"__num_processes",
">",
"1",
":",
"process_pool",
"=",
"Pool",
"(",
"processes",
"=",
"self",
".",
... | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.__mutate_parameter | Private, static method: mutates parameter
Args:
value (int or float): current value for Member's parameter
param (Parameter): parameter object
mut_rate (float): mutation rate of the value
max_mut_amt (float): maximum mutation amount of the value
Returns:... | pygenetics/ga_core.py | def __mutate_parameter(value, param, mut_rate, max_mut_amt):
'''Private, static method: mutates parameter
Args:
value (int or float): current value for Member's parameter
param (Parameter): parameter object
mut_rate (float): mutation rate of the value
max... | def __mutate_parameter(value, param, mut_rate, max_mut_amt):
'''Private, static method: mutates parameter
Args:
value (int or float): current value for Member's parameter
param (Parameter): parameter object
mut_rate (float): mutation rate of the value
max... | [
"Private",
"static",
"method",
":",
"mutates",
"parameter"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L351-L377 | [
"def",
"__mutate_parameter",
"(",
"value",
",",
"param",
",",
"mut_rate",
",",
"max_mut_amt",
")",
":",
"if",
"uniform",
"(",
"0",
",",
"1",
")",
"<",
"mut_rate",
":",
"mut_amt",
"=",
"uniform",
"(",
"0",
",",
"max_mut_amt",
")",
"op",
"=",
"choice",
... | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | Population.__determine_best_member | Private method: determines if any current population members have a
fitness score better than the current best | pygenetics/ga_core.py | def __determine_best_member(self):
'''Private method: determines if any current population members have a
fitness score better than the current best
'''
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__member... | def __determine_best_member(self):
'''Private method: determines if any current population members have a
fitness score better than the current best
'''
if self.__num_processes > 1:
members = [m.get() for m in self.__members]
else:
members = self.__member... | [
"Private",
"method",
":",
"determines",
"if",
"any",
"current",
"population",
"members",
"have",
"a",
"fitness",
"score",
"better",
"than",
"the",
"current",
"best"
] | tjkessler/PyGenetics | python | https://github.com/tjkessler/PyGenetics/blob/b78ee6393605d6e85d2279fb05f3983f5833df40/pygenetics/ga_core.py#L379-L402 | [
"def",
"__determine_best_member",
"(",
"self",
")",
":",
"if",
"self",
".",
"__num_processes",
">",
"1",
":",
"members",
"=",
"[",
"m",
".",
"get",
"(",
")",
"for",
"m",
"in",
"self",
".",
"__members",
"]",
"else",
":",
"members",
"=",
"self",
".",
... | b78ee6393605d6e85d2279fb05f3983f5833df40 |
test | ConfigOptionParser.update_defaults | Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists). | capybara/virtualenv/lib/python2.7/site-packages/pip/baseparser.py | def update_defaults(self, defaults):
"""Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists)."""
# Then go and look for the other sources of configuration:
config = {}
# 1. config... | def update_defaults(self, defaults):
"""Updates the given defaults with values from the config files and
the environ. Does a little special handling for certain types of
options (lists)."""
# Then go and look for the other sources of configuration:
config = {}
# 1. config... | [
"Updates",
"the",
"given",
"defaults",
"with",
"values",
"from",
"the",
"config",
"files",
"and",
"the",
"environ",
".",
"Does",
"a",
"little",
"special",
"handling",
"for",
"certain",
"types",
"of",
"options",
"(",
"lists",
")",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/baseparser.py#L196-L226 | [
"def",
"update_defaults",
"(",
"self",
",",
"defaults",
")",
":",
"# Then go and look for the other sources of configuration:",
"config",
"=",
"{",
"}",
"# 1. config files",
"for",
"section",
"in",
"(",
"'global'",
",",
"self",
".",
"name",
")",
":",
"config",
"."... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | ConfigOptionParser.normalize_keys | Return a config dictionary with normalized keys regardless of
whether the keys were specified in environment variables or in config
files | capybara/virtualenv/lib/python2.7/site-packages/pip/baseparser.py | def normalize_keys(self, items):
"""Return a config dictionary with normalized keys regardless of
whether the keys were specified in environment variables or in config
files"""
normalized = {}
for key, val in items:
key = key.replace('_', '-')
if not key.s... | def normalize_keys(self, items):
"""Return a config dictionary with normalized keys regardless of
whether the keys were specified in environment variables or in config
files"""
normalized = {}
for key, val in items:
key = key.replace('_', '-')
if not key.s... | [
"Return",
"a",
"config",
"dictionary",
"with",
"normalized",
"keys",
"regardless",
"of",
"whether",
"the",
"keys",
"were",
"specified",
"in",
"environment",
"variables",
"or",
"in",
"config",
"files"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/baseparser.py#L228-L238 | [
"def",
"normalize_keys",
"(",
"self",
",",
"items",
")",
":",
"normalized",
"=",
"{",
"}",
"for",
"key",
",",
"val",
"in",
"items",
":",
"key",
"=",
"key",
".",
"replace",
"(",
"'_'",
",",
"'-'",
")",
"if",
"not",
"key",
".",
"startswith",
"(",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | ConfigOptionParser.get_environ_vars | Returns a generator with all environmental vars with prefix PIP_ | capybara/virtualenv/lib/python2.7/site-packages/pip/baseparser.py | def get_environ_vars(self):
"""Returns a generator with all environmental vars with prefix PIP_"""
for key, val in os.environ.items():
if _environ_prefix_re.search(key):
yield (_environ_prefix_re.sub("", key).lower(), val) | def get_environ_vars(self):
"""Returns a generator with all environmental vars with prefix PIP_"""
for key, val in os.environ.items():
if _environ_prefix_re.search(key):
yield (_environ_prefix_re.sub("", key).lower(), val) | [
"Returns",
"a",
"generator",
"with",
"all",
"environmental",
"vars",
"with",
"prefix",
"PIP_"
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/baseparser.py#L246-L250 | [
"def",
"get_environ_vars",
"(",
"self",
")",
":",
"for",
"key",
",",
"val",
"in",
"os",
".",
"environ",
".",
"items",
"(",
")",
":",
"if",
"_environ_prefix_re",
".",
"search",
"(",
"key",
")",
":",
"yield",
"(",
"_environ_prefix_re",
".",
"sub",
"(",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | throws_exception | Return True if the callable throws the specified exception
>>> throws_exception(lambda: int('3'))
False
>>> throws_exception(lambda: int('a'))
True
>>> throws_exception(lambda: int('a'), KeyError)
False | jaraco/util/exceptions.py | def throws_exception(callable, *exceptions):
"""
Return True if the callable throws the specified exception
>>> throws_exception(lambda: int('3'))
False
>>> throws_exception(lambda: int('a'))
True
>>> throws_exception(lambda: int('a'), KeyError)
False
"""
with context.ExceptionTrap():
with context.Exceptio... | def throws_exception(callable, *exceptions):
"""
Return True if the callable throws the specified exception
>>> throws_exception(lambda: int('3'))
False
>>> throws_exception(lambda: int('a'))
True
>>> throws_exception(lambda: int('a'), KeyError)
False
"""
with context.ExceptionTrap():
with context.Exceptio... | [
"Return",
"True",
"if",
"the",
"callable",
"throws",
"the",
"specified",
"exception"
] | jaraco/jaraco.util | python | https://github.com/jaraco/jaraco.util/blob/f21071c64f165a5cf844db15e39356e1a47f4b02/jaraco/util/exceptions.py#L6-L20 | [
"def",
"throws_exception",
"(",
"callable",
",",
"*",
"exceptions",
")",
":",
"with",
"context",
".",
"ExceptionTrap",
"(",
")",
":",
"with",
"context",
".",
"ExceptionTrap",
"(",
"*",
"exceptions",
")",
"as",
"exc",
":",
"callable",
"(",
")",
"return",
... | f21071c64f165a5cf844db15e39356e1a47f4b02 |
test | transform_hits | The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use. | capybara/virtualenv/lib/python2.7/site-packages/pip/commands/search.py | def transform_hits(hits):
"""
The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use.
"""
packages = {}
for hit in hits:
name = hit['name']
summary = hit['summar... | def transform_hits(hits):
"""
The list from pypi is really a list of versions. We want a list of
packages with the list of versions stored inline. This converts the
list from pypi into one we can use.
"""
packages = {}
for hit in hits:
name = hit['name']
summary = hit['summar... | [
"The",
"list",
"from",
"pypi",
"is",
"really",
"a",
"list",
"of",
"versions",
".",
"We",
"want",
"a",
"list",
"of",
"packages",
"with",
"the",
"list",
"of",
"versions",
"stored",
"inline",
".",
"This",
"converts",
"the",
"list",
"from",
"pypi",
"into",
... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/pip/commands/search.py#L64-L101 | [
"def",
"transform_hits",
"(",
"hits",
")",
":",
"packages",
"=",
"{",
"}",
"for",
"hit",
"in",
"hits",
":",
"name",
"=",
"hit",
"[",
"'name'",
"]",
"summary",
"=",
"hit",
"[",
"'summary'",
"]",
"version",
"=",
"hit",
"[",
"'version'",
"]",
"score",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | _transform_result | Convert the result back into the input type. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def _transform_result(typ, result):
"""Convert the result back into the input type.
"""
if issubclass(typ, bytes):
return tostring(result, encoding='utf-8')
elif issubclass(typ, unicode):
return tostring(result, encoding='unicode')
else:
return result | def _transform_result(typ, result):
"""Convert the result back into the input type.
"""
if issubclass(typ, bytes):
return tostring(result, encoding='utf-8')
elif issubclass(typ, unicode):
return tostring(result, encoding='unicode')
else:
return result | [
"Convert",
"the",
"result",
"back",
"into",
"the",
"input",
"type",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L114-L122 | [
"def",
"_transform_result",
"(",
"typ",
",",
"result",
")",
":",
"if",
"issubclass",
"(",
"typ",
",",
"bytes",
")",
":",
"return",
"tostring",
"(",
"result",
",",
"encoding",
"=",
"'utf-8'",
")",
"elif",
"issubclass",
"(",
"typ",
",",
"unicode",
")",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | fragments_fromstring | Parses several HTML elements, returning a list of elements.
The first item in the list may be a string (though leading
whitespace is removed). If no_leading_text is true, then it will
be an error if there is leading text, and it will always be a list
of only elements.
base_url will set the docume... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def fragments_fromstring(html, no_leading_text=False, base_url=None,
parser=None, **kw):
"""
Parses several HTML elements, returning a list of elements.
The first item in the list may be a string (though leading
whitespace is removed). If no_leading_text is true, then it will
... | def fragments_fromstring(html, no_leading_text=False, base_url=None,
parser=None, **kw):
"""
Parses several HTML elements, returning a list of elements.
The first item in the list may be a string (though leading
whitespace is removed). If no_leading_text is true, then it will
... | [
"Parses",
"several",
"HTML",
"elements",
"returning",
"a",
"list",
"of",
"elements",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L624-L661 | [
"def",
"fragments_fromstring",
"(",
"html",
",",
"no_leading_text",
"=",
"False",
",",
"base_url",
"=",
"None",
",",
"parser",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"parser",
"is",
"None",
":",
"parser",
"=",
"html_parser",
"# FIXME: check what... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | fragment_fromstring | Parses a single HTML element; it is an error if there is more than
one element, or if anything but whitespace precedes or follows the
element.
If ``create_parent`` is true (or is a tag name) then a parent node
will be created to encapsulate the HTML in a single element. In this
case, leading or tr... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def fragment_fromstring(html, create_parent=False, base_url=None,
parser=None, **kw):
"""
Parses a single HTML element; it is an error if there is more than
one element, or if anything but whitespace precedes or follows the
element.
If ``create_parent`` is true (or is a tag ... | def fragment_fromstring(html, create_parent=False, base_url=None,
parser=None, **kw):
"""
Parses a single HTML element; it is an error if there is more than
one element, or if anything but whitespace precedes or follows the
element.
If ``create_parent`` is true (or is a tag ... | [
"Parses",
"a",
"single",
"HTML",
"element",
";",
"it",
"is",
"an",
"error",
"if",
"there",
"is",
"more",
"than",
"one",
"element",
"or",
"if",
"anything",
"but",
"whitespace",
"precedes",
"or",
"follows",
"the",
"element",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L663-L709 | [
"def",
"fragment_fromstring",
"(",
"html",
",",
"create_parent",
"=",
"False",
",",
"base_url",
"=",
"None",
",",
"parser",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"parser",
"is",
"None",
":",
"parser",
"=",
"html_parser",
"accept_leading_text",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | fromstring | Parse the html, returning a single element/document.
This tries to minimally parse the chunk of text, without knowing if it
is a fragment or a document.
base_url will set the document's base_url attribute (and the tree's docinfo.URL) | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def fromstring(html, base_url=None, parser=None, **kw):
"""
Parse the html, returning a single element/document.
This tries to minimally parse the chunk of text, without knowing if it
is a fragment or a document.
base_url will set the document's base_url attribute (and the tree's docinfo.URL)
... | def fromstring(html, base_url=None, parser=None, **kw):
"""
Parse the html, returning a single element/document.
This tries to minimally parse the chunk of text, without knowing if it
is a fragment or a document.
base_url will set the document's base_url attribute (and the tree's docinfo.URL)
... | [
"Parse",
"the",
"html",
"returning",
"a",
"single",
"element",
"/",
"document",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L711-L776 | [
"def",
"fromstring",
"(",
"html",
",",
"base_url",
"=",
"None",
",",
"parser",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"parser",
"is",
"None",
":",
"parser",
"=",
"html_parser",
"if",
"isinstance",
"(",
"html",
",",
"bytes",
")",
":",
"is... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | parse | Parse a filename, URL, or file-like object into an HTML document
tree. Note: this returns a tree, not an element. Use
``parse(...).getroot()`` to get the document root.
You can override the base URL with the ``base_url`` keyword. This
is most useful when parsing from a file-like object. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def parse(filename_or_url, parser=None, base_url=None, **kw):
"""
Parse a filename, URL, or file-like object into an HTML document
tree. Note: this returns a tree, not an element. Use
``parse(...).getroot()`` to get the document root.
You can override the base URL with the ``base_url`` keyword. ... | def parse(filename_or_url, parser=None, base_url=None, **kw):
"""
Parse a filename, URL, or file-like object into an HTML document
tree. Note: this returns a tree, not an element. Use
``parse(...).getroot()`` to get the document root.
You can override the base URL with the ``base_url`` keyword. ... | [
"Parse",
"a",
"filename",
"URL",
"or",
"file",
"-",
"like",
"object",
"into",
"an",
"HTML",
"document",
"tree",
".",
"Note",
":",
"this",
"returns",
"a",
"tree",
"not",
"an",
"element",
".",
"Use",
"parse",
"(",
"...",
")",
".",
"getroot",
"()",
"to"... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L778-L789 | [
"def",
"parse",
"(",
"filename_or_url",
",",
"parser",
"=",
"None",
",",
"base_url",
"=",
"None",
",",
"*",
"*",
"kw",
")",
":",
"if",
"parser",
"is",
"None",
":",
"parser",
"=",
"html_parser",
"return",
"etree",
".",
"parse",
"(",
"filename_or_url",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | submit_form | Helper function to submit a form. Returns a file-like object, as from
``urllib.urlopen()``. This object also has a ``.geturl()`` function,
which shows the URL if there were any redirects.
You can use this like::
form = doc.forms[0]
form.inputs['foo'].value = 'bar' # etc
response ... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def submit_form(form, extra_values=None, open_http=None):
"""
Helper function to submit a form. Returns a file-like object, as from
``urllib.urlopen()``. This object also has a ``.geturl()`` function,
which shows the URL if there were any redirects.
You can use this like::
form = doc.for... | def submit_form(form, extra_values=None, open_http=None):
"""
Helper function to submit a form. Returns a file-like object, as from
``urllib.urlopen()``. This object also has a ``.geturl()`` function,
which shows the URL if there were any redirects.
You can use this like::
form = doc.for... | [
"Helper",
"function",
"to",
"submit",
"a",
"form",
".",
"Returns",
"a",
"file",
"-",
"like",
"object",
"as",
"from",
"urllib",
".",
"urlopen",
"()",
".",
"This",
"object",
"also",
"has",
"a",
".",
"geturl",
"()",
"function",
"which",
"shows",
"the",
"U... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L918-L953 | [
"def",
"submit_form",
"(",
"form",
",",
"extra_values",
"=",
"None",
",",
"open_http",
"=",
"None",
")",
":",
"values",
"=",
"form",
".",
"form_values",
"(",
")",
"if",
"extra_values",
":",
"if",
"hasattr",
"(",
"extra_values",
",",
"'items'",
")",
":",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | html_to_xhtml | Convert all tags in an HTML tree to XHTML by moving them to the
XHTML namespace. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def html_to_xhtml(html):
"""Convert all tags in an HTML tree to XHTML by moving them to the
XHTML namespace.
"""
try:
html = html.getroot()
except AttributeError:
pass
prefix = "{%s}" % XHTML_NAMESPACE
for el in html.iter(etree.Element):
tag = el.tag
if tag[0]... | def html_to_xhtml(html):
"""Convert all tags in an HTML tree to XHTML by moving them to the
XHTML namespace.
"""
try:
html = html.getroot()
except AttributeError:
pass
prefix = "{%s}" % XHTML_NAMESPACE
for el in html.iter(etree.Element):
tag = el.tag
if tag[0]... | [
"Convert",
"all",
"tags",
"in",
"an",
"HTML",
"tree",
"to",
"XHTML",
"by",
"moving",
"them",
"to",
"the",
"XHTML",
"namespace",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1544-L1556 | [
"def",
"html_to_xhtml",
"(",
"html",
")",
":",
"try",
":",
"html",
"=",
"html",
".",
"getroot",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"prefix",
"=",
"\"{%s}\"",
"%",
"XHTML_NAMESPACE",
"for",
"el",
"in",
"html",
".",
"iter",
"(",
"etree",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | xhtml_to_html | Convert all tags in an XHTML tree to HTML by removing their
XHTML namespace. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def xhtml_to_html(xhtml):
"""Convert all tags in an XHTML tree to HTML by removing their
XHTML namespace.
"""
try:
xhtml = xhtml.getroot()
except AttributeError:
pass
prefix = "{%s}" % XHTML_NAMESPACE
prefix_len = len(prefix)
for el in xhtml.iter(prefix + "*"):
el... | def xhtml_to_html(xhtml):
"""Convert all tags in an XHTML tree to HTML by removing their
XHTML namespace.
"""
try:
xhtml = xhtml.getroot()
except AttributeError:
pass
prefix = "{%s}" % XHTML_NAMESPACE
prefix_len = len(prefix)
for el in xhtml.iter(prefix + "*"):
el... | [
"Convert",
"all",
"tags",
"in",
"an",
"XHTML",
"tree",
"to",
"HTML",
"by",
"removing",
"their",
"XHTML",
"namespace",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1558-L1569 | [
"def",
"xhtml_to_html",
"(",
"xhtml",
")",
":",
"try",
":",
"xhtml",
"=",
"xhtml",
".",
"getroot",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"prefix",
"=",
"\"{%s}\"",
"%",
"XHTML_NAMESPACE",
"prefix_len",
"=",
"len",
"(",
"prefix",
")",
"for",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | tostring | Return an HTML string representation of the document.
Note: if include_meta_content_type is true this will create a
``<meta http-equiv="Content-Type" ...>`` tag in the head;
regardless of the value of include_meta_content_type any existing
``<meta http-equiv="Content-Type" ...>`` tag will be removed
... | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def tostring(doc, pretty_print=False, include_meta_content_type=False,
encoding=None, method="html", with_tail=True, doctype=None):
"""Return an HTML string representation of the document.
Note: if include_meta_content_type is true this will create a
``<meta http-equiv="Content-Type" ...>`` ta... | def tostring(doc, pretty_print=False, include_meta_content_type=False,
encoding=None, method="html", with_tail=True, doctype=None):
"""Return an HTML string representation of the document.
Note: if include_meta_content_type is true this will create a
``<meta http-equiv="Content-Type" ...>`` ta... | [
"Return",
"an",
"HTML",
"string",
"representation",
"of",
"the",
"document",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1578-L1649 | [
"def",
"tostring",
"(",
"doc",
",",
"pretty_print",
"=",
"False",
",",
"include_meta_content_type",
"=",
"False",
",",
"encoding",
"=",
"None",
",",
"method",
"=",
"\"html\"",
",",
"with_tail",
"=",
"True",
",",
"doctype",
"=",
"None",
")",
":",
"html",
... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | open_in_browser | Open the HTML document in a web browser, saving it to a temporary
file to open it. Note that this does not delete the file after
use. This is mainly meant for debugging. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def open_in_browser(doc, encoding=None):
"""
Open the HTML document in a web browser, saving it to a temporary
file to open it. Note that this does not delete the file after
use. This is mainly meant for debugging.
"""
import os
import webbrowser
import tempfile
if not isinstance(d... | def open_in_browser(doc, encoding=None):
"""
Open the HTML document in a web browser, saving it to a temporary
file to open it. Note that this does not delete the file after
use. This is mainly meant for debugging.
"""
import os
import webbrowser
import tempfile
if not isinstance(d... | [
"Open",
"the",
"HTML",
"document",
"in",
"a",
"web",
"browser",
"saving",
"it",
"to",
"a",
"temporary",
"file",
"to",
"open",
"it",
".",
"Note",
"that",
"this",
"does",
"not",
"delete",
"the",
"file",
"after",
"use",
".",
"This",
"is",
"mainly",
"meant... | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L1653-L1673 | [
"def",
"open_in_browser",
"(",
"doc",
",",
"encoding",
"=",
"None",
")",
":",
"import",
"os",
"import",
"webbrowser",
"import",
"tempfile",
"if",
"not",
"isinstance",
"(",
"doc",
",",
"etree",
".",
"_ElementTree",
")",
":",
"doc",
"=",
"etree",
".",
"Ele... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin._label__get | Get or set any <label> element associated with this element. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def _label__get(self):
"""
Get or set any <label> element associated with this element.
"""
id = self.get('id')
if not id:
return None
result = _label_xpath(self, id=id)
if not result:
return None
else:
return result[0] | def _label__get(self):
"""
Get or set any <label> element associated with this element.
"""
id = self.get('id')
if not id:
return None
result = _label_xpath(self, id=id)
if not result:
return None
else:
return result[0] | [
"Get",
"or",
"set",
"any",
"<label",
">",
"element",
"associated",
"with",
"this",
"element",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L165-L176 | [
"def",
"_label__get",
"(",
"self",
")",
":",
"id",
"=",
"self",
".",
"get",
"(",
"'id'",
")",
"if",
"not",
"id",
":",
"return",
"None",
"result",
"=",
"_label_xpath",
"(",
"self",
",",
"id",
"=",
"id",
")",
"if",
"not",
"result",
":",
"return",
"... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
test | HtmlMixin.drop_tree | Removes this element from the tree, including its children and
text. The tail text is joined to the previous element or
parent. | capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py | def drop_tree(self):
"""
Removes this element from the tree, including its children and
text. The tail text is joined to the previous element or
parent.
"""
parent = self.getparent()
assert parent is not None
if self.tail:
previous = self.getp... | def drop_tree(self):
"""
Removes this element from the tree, including its children and
text. The tail text is joined to the previous element or
parent.
"""
parent = self.getparent()
assert parent is not None
if self.tail:
previous = self.getp... | [
"Removes",
"this",
"element",
"from",
"the",
"tree",
"including",
"its",
"children",
"and",
"text",
".",
"The",
"tail",
"text",
"is",
"joined",
"to",
"the",
"previous",
"element",
"or",
"parent",
"."
] | AkihikoITOH/capybara | python | https://github.com/AkihikoITOH/capybara/blob/e86c2173ea386654f4ae061148e8fbe3f25e715c/capybara/virtualenv/lib/python2.7/site-packages/lxml/html/__init__.py#L194-L208 | [
"def",
"drop_tree",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"getparent",
"(",
")",
"assert",
"parent",
"is",
"not",
"None",
"if",
"self",
".",
"tail",
":",
"previous",
"=",
"self",
".",
"getprevious",
"(",
")",
"if",
"previous",
"is",
"Non... | e86c2173ea386654f4ae061148e8fbe3f25e715c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.