repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | XXmotif._parse_params | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background"]:
# Absolute path, just to be su... | python | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background"]:
# Absolute path, just to be su... | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"prm",
"=",
"self",
".",
"default_params",
".",
"copy",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"prm",
".",
"update",
"(",
"params",
")",
"if",
"prm",
"[",
"\"ba... | Parse parameters.
Combine default and user-defined parameters. | [
"Parse",
"parameters",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L203-L223 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | XXmotif._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run XXmotif and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict,... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run XXmotif and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict,... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"outfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"tmpdir",
",",
... | Run XXmotif and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required... | [
"Run",
"XXmotif",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L225-L284 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Homer._parse_params | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
# Background file is essential!
if not prm["background"]... | python | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
# Background file is essential!
if not prm["background"]... | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"prm",
"=",
"self",
".",
"default_params",
".",
"copy",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"prm",
".",
"update",
"(",
"params",
")",
"# Background file is essenti... | Parse parameters.
Combine default and user-defined parameters. | [
"Parse",
"parameters",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L305-L326 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Homer._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run Homer and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run Homer and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"outfile",
"=",
"NamedTemporaryFile",
"(",
"mode",
"=",
"\"w\"",
",",
"dir",
"=",
"... | Run Homer and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required p... | [
"Run",
"Homer",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L328-L387 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | BioProspector.parse | def parse(self, fo):
"""
Convert BioProspector output to motifs
Parameters
----------
fo : file-like
File object containing BioProspector output.
Returns
-------
motifs : list
List of Motif instances.
"""
m... | python | def parse(self, fo):
"""
Convert BioProspector output to motifs
Parameters
----------
fo : file-like
File object containing BioProspector output.
Returns
-------
motifs : list
List of Motif instances.
"""
m... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"p",
"=",
"re",
".",
"compile",
"(",
"r'^\\d+\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)\\s+(\\d+\\.\\d+)'",
")",
"pwm",
"=",
"[",
"]",
"motif_id",
"=",
"\"\"",
"for",
"line",
... | Convert BioProspector output to motifs
Parameters
----------
fo : file-like
File object containing BioProspector output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"BioProspector",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"BioProspector",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L488-L524 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Hms._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run HMS and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, opt... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run HMS and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, opt... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"default_params",
"=",
"{",
"\"width\"",
":",
"10",
"}",
"if",
"params",
"is",
"not... | Run HMS and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required par... | [
"Run",
"HMS",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L575-L631 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Hms.parse | def parse(self, fo):
"""
Convert HMS output to motifs
Parameters
----------
fo : file-like
File object containing HMS output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
m... | python | def parse(self, fo):
"""
Convert HMS output to motifs
Parameters
----------
fo : file-like
File object containing HMS output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
m... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"m",
"=",
"[",
"[",
"float",
"(",
"x",
")",
"for",
"x",
"in",
"fo",
".",
"readline",
"(",
")",
".",
"strip",
"(",
")",
".",
"split",
"(",
"\" \"",
")",
"]",
"for",
... | Convert HMS output to motifs
Parameters
----------
fo : file-like
File object containing HMS output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"HMS",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"HMS",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L633-L653 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Amd._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run AMD and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, opt... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run AMD and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, opt... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"fgfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"tmpdir",
",",
... | Run AMD and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required par... | [
"Run",
"AMD",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L688-L744 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Amd.parse | def parse(self, fo):
"""
Convert AMD output to motifs
Parameters
----------
fo : file-like
File object containing AMD output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | python | def parse(self, fo):
"""
Convert AMD output to motifs
Parameters
----------
fo : file-like
File object containing AMD output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"#160: 112 CACGTGC 7.25 chr14:32308489-32308689",
"p",
"=",
"re",
".",
"compile",
"(",
"r'\\d+\\s+([\\d.]+)\\s+([\\d.]+)\\s+([\\d.]+)\\s+([\\d.]+)'",
")",
"wm",
"=",
"[",
"]",
"name"... | Convert AMD output to motifs
Parameters
----------
fo : file-like
File object containing AMD output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"AMD",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"AMD",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L746-L781 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Improbizer.parse | def parse(self, fo):
"""
Convert Improbizer output to motifs
Parameters
----------
fo : file-like
File object containing Improbizer output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs ... | python | def parse(self, fo):
"""
Convert Improbizer output to motifs
Parameters
----------
fo : file-like
File object containing Improbizer output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs ... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"p",
"=",
"re",
".",
"compile",
"(",
"r'\\d+\\s+@\\s+\\d+\\.\\d+\\s+sd\\s+\\d+\\.\\d+\\s+(\\w+)$'",
")",
"line",
"=",
"fo",
".",
"readline",
"(",
")",
"while",
"line",
"and",
"line"... | Convert Improbizer output to motifs
Parameters
----------
fo : file-like
File object containing Improbizer output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"Improbizer",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"Improbizer",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L873-L905 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Trawler._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run Trawler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict,... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run Trawler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict,... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"tmp",
"=",
"NamedTemporaryFile",
"(",
"mode",
"=",
"\"w\"",
",",
"dir",
"=",
"self... | Run Trawler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required... | [
"Run",
"Trawler",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L945-L1023 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Weeder._run_program | def _run_program(self, bin,fastafile, params=None):
"""
Run Weeder and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | python | def _run_program(self, bin,fastafile, params=None):
"""
Run Weeder and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"organism",
"=",
"params",
"[",
"\"organism\"",
"]",
"weeder_organisms",
"=",
"{",
"\... | Run Weeder and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required ... | [
"Run",
"Weeder",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1055-L1137 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | MotifSampler._parse_params | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background_model"]:
# Absolute path, just to... | python | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
if prm["background_model"]:
# Absolute path, just to... | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"prm",
"=",
"self",
".",
"default_params",
".",
"copy",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"prm",
".",
"update",
"(",
"params",
")",
"if",
"prm",
"[",
"\"ba... | Parse parameters.
Combine default and user-defined parameters. | [
"Parse",
"parameters",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1173-L1206 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | MotifSampler._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run MotifSampler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : ... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run MotifSampler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : ... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"# TODO: test organism",
"#cmd = \"%s -f %s -b %s -m %s -w %s -n %s -o %s -s %s > /dev/null 2>&1\" % ... | Run MotifSampler and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools req... | [
"Run",
"MotifSampler",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1208-L1264 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | MotifSampler.parse | def parse(self, fo):
"""
Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances.
"""
mot... | python | def parse(self, fo):
"""
Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances.
"""
mot... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"pwm",
"=",
"[",
"]",
"info",
"=",
"{",
"}",
"for",
"line",
"in",
"fo",
".",
"readlines",
"(",
")",
":",
"if",
"line",
".",
"startswith",
"(",
"\"#\"",
")",
":",
"vals... | Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"MotifSampler",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"MotifSampler",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1266-L1299 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | MotifSampler.parse_out | def parse_out(self, fo):
"""
Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances.
"""
... | python | def parse_out(self, fo):
"""
Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances.
"""
... | [
"def",
"parse_out",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"pseudo",
"=",
"0.0",
"# Should be 1/sqrt(# of seqs)",
... | Convert MotifSampler output to motifs
Parameters
----------
fo : file-like
File object containing MotifSampler output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"MotifSampler",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"MotifSampler",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1301-L1348 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | MDmodule._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run MDmodule and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run MDmodule and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"default_params",
"=",
"{",
"\"width\"",
":",
"10",
",",
"\"number\"",
":",
"10",
"}",
"if",
"params",
"is",
"not",
"None",
":",
"default_params",
"... | Run MDmodule and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools require... | [
"Run",
"MDmodule",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1378-L1436 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | MDmodule.parse | def parse(self, fo):
"""
Convert MDmodule output to motifs
Parameters
----------
fo : file-like
File object containing MDmodule output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []... | python | def parse(self, fo):
"""
Convert MDmodule output to motifs
Parameters
----------
fo : file-like
File object containing MDmodule output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"p",
"=",
"re",
".",
"compile",
"(",
"r'(\\d+)\\s+(\\... | Convert MDmodule output to motifs
Parameters
----------
fo : file-like
File object containing MDmodule output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"MDmodule",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"MDmodule",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1438-L1493 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | ChIPMunk._parse_params | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
return prm | python | def _parse_params(self, params=None):
"""
Parse parameters.
Combine default and user-defined parameters.
"""
prm = self.default_params.copy()
if params is not None:
prm.update(params)
return prm | [
"def",
"_parse_params",
"(",
"self",
",",
"params",
"=",
"None",
")",
":",
"prm",
"=",
"self",
".",
"default_params",
".",
"copy",
"(",
")",
"if",
"params",
"is",
"not",
"None",
":",
"prm",
".",
"update",
"(",
"params",
")",
"return",
"prm"
] | Parse parameters.
Combine default and user-defined parameters. | [
"Parse",
"parameters",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1509-L1519 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | ChIPMunk._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run ChIPMunk and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run ChIPMunk and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"params",
"=",
"self",
".",
"_parse_params",
"(",
"params",
")",
"basename",
"=",
"\"munk_in.fa\"",
"new_file",
"=",
"os",
".",
"path",
".",
"join",
... | Run ChIPMunk and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools require... | [
"Run",
"ChIPMunk",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1521-L1596 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | ChIPMunk.parse | def parse(self, fo):
"""
Convert ChIPMunk output to motifs
Parameters
----------
fo : file-like
File object containing ChIPMunk output.
Returns
-------
motifs : list
List of Motif instances.
"""
#KDIC|6.124... | python | def parse(self, fo):
"""
Convert ChIPMunk output to motifs
Parameters
----------
fo : file-like
File object containing ChIPMunk output.
Returns
-------
motifs : list
List of Motif instances.
"""
#KDIC|6.124... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"#KDIC|6.124756232026243",
"#A|517.9999999999999 42.99999999999999 345.99999999999994 25.999999999999996 602.9999999999999 155.99999999999997 2.9999999999999996 91.99999999999999",
"#C|5.999999999999999 4.999999999999999 2.9999999999999996 956.99... | Convert ChIPMunk output to motifs
Parameters
----------
fo : file-like
File object containing ChIPMunk output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"ChIPMunk",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"ChIPMunk",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1598-L1633 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Posmo._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run Posmo and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run Posmo and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, o... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"default_params",
"=",
"{",
"}",
"if",
"params",
"is",
"not",
"None",
":",
"default_params",
".",
"update",
"(",
"params",
")",
"width",
"=",
"param... | Run Posmo and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required p... | [
"Run",
"Posmo",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1664-L1729 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Posmo.parse | def parse(self, fo, width, seed=None):
"""
Convert Posmo output to motifs
Parameters
----------
fo : file-like
File object containing Posmo output.
Returns
-------
motifs : list
List of Motif instances.
"""
... | python | def parse(self, fo, width, seed=None):
"""
Convert Posmo output to motifs
Parameters
----------
fo : file-like
File object containing Posmo output.
Returns
-------
motifs : list
List of Motif instances.
"""
... | [
"def",
"parse",
"(",
"self",
",",
"fo",
",",
"width",
",",
"seed",
"=",
"None",
")",
":",
"motifs",
"=",
"[",
"]",
"lines",
"=",
"[",
"fo",
".",
"readline",
"(",
")",
"for",
"x",
"in",
"range",
"(",
"6",
")",
"]",
"while",
"lines",
"[",
"0",
... | Convert Posmo output to motifs
Parameters
----------
fo : file-like
File object containing Posmo output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"Posmo",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"Posmo",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1731-L1764 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Gadem.parse | def parse(self, fo):
"""
Convert GADEM output to motifs
Parameters
----------
fo : file-like
File object containing GADEM output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | python | def parse(self, fo):
"""
Convert GADEM output to motifs
Parameters
----------
fo : file-like
File object containing GADEM output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"lines",
"=",
"fo",
".",
"readlines",
"(",
")",
"fo... | Convert GADEM output to motifs
Parameters
----------
fo : file-like
File object containing GADEM output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"GADEM",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"GADEM",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1847-L1896 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Jaspar._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Get enriched JASPAR motifs in a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optio... | python | def _run_program(self, bin, fastafile, params=None):
"""
Get enriched JASPAR motifs in a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optio... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"fname",
"=",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"config",
".",
"get_motif_dir",
"(",
")",
",",
"\"JASPAR2010_vertebrate.pwm\"",
")",
... | Get enriched JASPAR motifs in a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required param... | [
"Get",
"enriched",
"JASPAR",
"motifs",
"in",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1919-L1951 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Meme._run_program | def _run_program(self, bin, fastafile, params=None):
"""
Run MEME and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, op... | python | def _run_program(self, bin, fastafile, params=None):
"""
Run MEME and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, op... | [
"def",
"_run_program",
"(",
"self",
",",
"bin",
",",
"fastafile",
",",
"params",
"=",
"None",
")",
":",
"default_params",
"=",
"{",
"\"width\"",
":",
"10",
",",
"\"single\"",
":",
"False",
",",
"\"number\"",
":",
"10",
"}",
"if",
"params",
"is",
"not",... | Run MEME and predict motifs from a FASTA file.
Parameters
----------
bin : str
Command used to run the tool.
fastafile : str
Name of the FASTA input file.
params : dict, optional
Optional parameters. For some of the tools required pa... | [
"Run",
"MEME",
"and",
"predict",
"motifs",
"from",
"a",
"FASTA",
"file",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L1981-L2033 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/tools.py | Meme.parse | def parse(self, fo):
"""
Convert MEME output to motifs
Parameters
----------
fo : file-like
File object containing MEME output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | python | def parse(self, fo):
"""
Convert MEME output to motifs
Parameters
----------
fo : file-like
File object containing MEME output.
Returns
-------
motifs : list
List of Motif instances.
"""
motifs = []
... | [
"def",
"parse",
"(",
"self",
",",
"fo",
")",
":",
"motifs",
"=",
"[",
"]",
"nucs",
"=",
"{",
"\"A\"",
":",
"0",
",",
"\"C\"",
":",
"1",
",",
"\"G\"",
":",
"2",
",",
"\"T\"",
":",
"3",
"}",
"p",
"=",
"re",
".",
"compile",
"(",
"'MOTIF.+MEME-(\... | Convert MEME output to motifs
Parameters
----------
fo : file-like
File object containing MEME output.
Returns
-------
motifs : list
List of Motif instances. | [
"Convert",
"MEME",
"output",
"to",
"motifs",
"Parameters",
"----------",
"fo",
":",
"file",
"-",
"like",
"File",
"object",
"containing",
"MEME",
"output",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/tools.py#L2035-L2084 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/maelstrom.py | scan_to_table | def scan_to_table(input_table, genome, scoring, pwmfile=None, ncpus=None):
"""Scan regions in input table with motifs.
Parameters
----------
input_table : str
Filename of input table. Can be either a text-separated tab file or a
feather file.
genome : str
Genome name. C... | python | def scan_to_table(input_table, genome, scoring, pwmfile=None, ncpus=None):
"""Scan regions in input table with motifs.
Parameters
----------
input_table : str
Filename of input table. Can be either a text-separated tab file or a
feather file.
genome : str
Genome name. C... | [
"def",
"scan_to_table",
"(",
"input_table",
",",
"genome",
",",
"scoring",
",",
"pwmfile",
"=",
"None",
",",
"ncpus",
"=",
"None",
")",
":",
"config",
"=",
"MotifConfig",
"(",
")",
"if",
"pwmfile",
"is",
"None",
":",
"pwmfile",
"=",
"config",
".",
"get... | Scan regions in input table with motifs.
Parameters
----------
input_table : str
Filename of input table. Can be either a text-separated tab file or a
feather file.
genome : str
Genome name. Can be either the name of a FASTA-formatted file or a
genomepy genome name... | [
"Scan",
"regions",
"in",
"input",
"table",
"with",
"motifs",
"."
] | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/maelstrom.py#L52-L123 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/maelstrom.py | run_maelstrom | def run_maelstrom(infile, genome, outdir, pwmfile=None, plot=True, cluster=False,
score_table=None, count_table=None, methods=None, ncpus=None):
"""Run maelstrom on an input table.
Parameters
----------
infile : str
Filename of input table. Can be either a text-separated tab file o... | python | def run_maelstrom(infile, genome, outdir, pwmfile=None, plot=True, cluster=False,
score_table=None, count_table=None, methods=None, ncpus=None):
"""Run maelstrom on an input table.
Parameters
----------
infile : str
Filename of input table. Can be either a text-separated tab file o... | [
"def",
"run_maelstrom",
"(",
"infile",
",",
"genome",
",",
"outdir",
",",
"pwmfile",
"=",
"None",
",",
"plot",
"=",
"True",
",",
"cluster",
"=",
"False",
",",
"score_table",
"=",
"None",
",",
"count_table",
"=",
"None",
",",
"methods",
"=",
"None",
","... | Run maelstrom on an input table.
Parameters
----------
infile : str
Filename of input table. Can be either a text-separated tab file or a
feather file.
genome : str
Genome name. Can be either the name of a FASTA-formatted file or a
genomepy genome name.
... | [
"Run",
"maelstrom",
"on",
"an",
"input",
"table",
".",
"Parameters",
"----------",
"infile",
":",
"str",
"Filename",
"of",
"input",
"table",
".",
"Can",
"be",
"either",
"a",
"text",
"-",
"separated",
"tab",
"file",
"or",
"a",
"feather",
"file",
".",
"gen... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/maelstrom.py#L250-L428 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/maelstrom.py | MaelstromResult.plot_heatmap | def plot_heatmap(self, kind="final", min_freq=0.01, threshold=2, name=True, max_len=50, aspect=1, **kwargs):
"""Plot clustered heatmap of predicted motif activity.
Parameters
----------
kind : str, optional
Which data type to use for plotting. Default is 'final', whi... | python | def plot_heatmap(self, kind="final", min_freq=0.01, threshold=2, name=True, max_len=50, aspect=1, **kwargs):
"""Plot clustered heatmap of predicted motif activity.
Parameters
----------
kind : str, optional
Which data type to use for plotting. Default is 'final', whi... | [
"def",
"plot_heatmap",
"(",
"self",
",",
"kind",
"=",
"\"final\"",
",",
"min_freq",
"=",
"0.01",
",",
"threshold",
"=",
"2",
",",
"name",
"=",
"True",
",",
"max_len",
"=",
"50",
",",
"aspect",
"=",
"1",
",",
"*",
"*",
"kwargs",
")",
":",
"filt",
... | Plot clustered heatmap of predicted motif activity.
Parameters
----------
kind : str, optional
Which data type to use for plotting. Default is 'final', which will plot the
result of the rang aggregation. Other options are 'freq' for the motif frequencies,
... | [
"Plot",
"clustered",
"heatmap",
"of",
"predicted",
"motif",
"activity",
".",
"Parameters",
"----------",
"kind",
":",
"str",
"optional",
"Which",
"data",
"type",
"to",
"use",
"for",
"plotting",
".",
"Default",
"is",
"final",
"which",
"will",
"plot",
"the",
"... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/maelstrom.py#L495-L558 | train |
vanheeringen-lab/gimmemotifs | gimmemotifs/maelstrom.py | MaelstromResult.plot_scores | def plot_scores(self, motifs, name=True, max_len=50):
"""Create motif scores boxplot of different clusters.
Motifs can be specified as either motif or factor names.
The motif scores will be scaled and plotted as z-scores.
Parameters
----------
motifs : iterable o... | python | def plot_scores(self, motifs, name=True, max_len=50):
"""Create motif scores boxplot of different clusters.
Motifs can be specified as either motif or factor names.
The motif scores will be scaled and plotted as z-scores.
Parameters
----------
motifs : iterable o... | [
"def",
"plot_scores",
"(",
"self",
",",
"motifs",
",",
"name",
"=",
"True",
",",
"max_len",
"=",
"50",
")",
":",
"if",
"self",
".",
"input",
".",
"shape",
"[",
"1",
"]",
"!=",
"1",
":",
"raise",
"ValueError",
"(",
"\"Can't make a categorical plot with re... | Create motif scores boxplot of different clusters.
Motifs can be specified as either motif or factor names.
The motif scores will be scaled and plotted as z-scores.
Parameters
----------
motifs : iterable or str
List of motif or factor names.
... | [
"Create",
"motif",
"scores",
"boxplot",
"of",
"different",
"clusters",
".",
"Motifs",
"can",
"be",
"specified",
"as",
"either",
"motif",
"or",
"factor",
"names",
".",
"The",
"motif",
"scores",
"will",
"be",
"scaled",
"and",
"plotted",
"as",
"z",
"-",
"scor... | 1dc0572179e5d0c8f96958060133c1f8d92c6675 | https://github.com/vanheeringen-lab/gimmemotifs/blob/1dc0572179e5d0c8f96958060133c1f8d92c6675/gimmemotifs/maelstrom.py#L561-L608 | train |
biosustain/swiglpk | scripts/find_swiglpk_version.py | get_version | def get_version(package, url_pattern=URL_PATTERN):
"""Return version of package on pypi.python.org using json. Adapted from https://stackoverflow.com/a/34366589"""
req = requests.get(url_pattern.format(package=package))
version = parse('0')
if req.status_code == requests.codes.ok:
# j = json.loa... | python | def get_version(package, url_pattern=URL_PATTERN):
"""Return version of package on pypi.python.org using json. Adapted from https://stackoverflow.com/a/34366589"""
req = requests.get(url_pattern.format(package=package))
version = parse('0')
if req.status_code == requests.codes.ok:
# j = json.loa... | [
"def",
"get_version",
"(",
"package",
",",
"url_pattern",
"=",
"URL_PATTERN",
")",
":",
"req",
"=",
"requests",
".",
"get",
"(",
"url_pattern",
".",
"format",
"(",
"package",
"=",
"package",
")",
")",
"version",
"=",
"parse",
"(",
"'0'",
")",
"if",
"re... | Return version of package on pypi.python.org using json. Adapted from https://stackoverflow.com/a/34366589 | [
"Return",
"version",
"of",
"package",
"on",
"pypi",
".",
"python",
".",
"org",
"using",
"json",
".",
"Adapted",
"from",
"https",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"a",
"/",
"34366589"
] | a83bc5d0bb4bf7795756ba11a33fb5cb2c501bef | https://github.com/biosustain/swiglpk/blob/a83bc5d0bb4bf7795756ba11a33fb5cb2c501bef/scripts/find_swiglpk_version.py#L13-L25 | train |
osantana/prettyconf | prettyconf/loaders.py | get_args | def get_args(parser):
"""
Converts arguments extracted from a parser to a dict,
and will dismiss arguments which default to NOT_SET.
:param parser: an ``argparse.ArgumentParser`` instance.
:type parser: argparse.ArgumentParser
:return: Dictionary with the configs found in the parsed CLI argumen... | python | def get_args(parser):
"""
Converts arguments extracted from a parser to a dict,
and will dismiss arguments which default to NOT_SET.
:param parser: an ``argparse.ArgumentParser`` instance.
:type parser: argparse.ArgumentParser
:return: Dictionary with the configs found in the parsed CLI argumen... | [
"def",
"get_args",
"(",
"parser",
")",
":",
"args",
"=",
"vars",
"(",
"parser",
".",
"parse_args",
"(",
")",
")",
".",
"items",
"(",
")",
"return",
"{",
"key",
":",
"val",
"for",
"key",
",",
"val",
"in",
"args",
"if",
"not",
"isinstance",
"(",
"v... | Converts arguments extracted from a parser to a dict,
and will dismiss arguments which default to NOT_SET.
:param parser: an ``argparse.ArgumentParser`` instance.
:type parser: argparse.ArgumentParser
:return: Dictionary with the configs found in the parsed CLI arguments.
:rtype: dict | [
"Converts",
"arguments",
"extracted",
"from",
"a",
"parser",
"to",
"a",
"dict",
"and",
"will",
"dismiss",
"arguments",
"which",
"default",
"to",
"NOT_SET",
"."
] | ddbbc8a592ebd7d80d9c3f87c8671523e3692a0d | https://github.com/osantana/prettyconf/blob/ddbbc8a592ebd7d80d9c3f87c8671523e3692a0d/prettyconf/loaders.py#L22-L33 | train |
aouyar/PyMunin | pysysinfo/util.py | parse_value | def parse_value(val, parsebool=False):
"""Parse input string and return int, float or str depending on format.
@param val: Input string.
@param parsebool: If True parse yes / no, on / off as boolean.
@return: Value of type int, float or str.
"""
try:
return i... | python | def parse_value(val, parsebool=False):
"""Parse input string and return int, float or str depending on format.
@param val: Input string.
@param parsebool: If True parse yes / no, on / off as boolean.
@return: Value of type int, float or str.
"""
try:
return i... | [
"def",
"parse_value",
"(",
"val",
",",
"parsebool",
"=",
"False",
")",
":",
"try",
":",
"return",
"int",
"(",
"val",
")",
"except",
"ValueError",
":",
"pass",
"try",
":",
"return",
"float",
"(",
"val",
")",
"except",
":",
"pass",
"if",
"parsebool",
"... | Parse input string and return int, float or str depending on format.
@param val: Input string.
@param parsebool: If True parse yes / no, on / off as boolean.
@return: Value of type int, float or str. | [
"Parse",
"input",
"string",
"and",
"return",
"int",
"float",
"or",
"str",
"depending",
"on",
"format",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L27-L48 | train |
aouyar/PyMunin | pysysinfo/util.py | socket_read | def socket_read(fp):
"""Buffered read from socket. Reads all data available from socket.
@fp: File pointer for socket.
@return: String of characters read from buffer.
"""
response = ''
oldlen = 0
newlen = 0
while True:
response += fp.read(buffSize)
newlen = ... | python | def socket_read(fp):
"""Buffered read from socket. Reads all data available from socket.
@fp: File pointer for socket.
@return: String of characters read from buffer.
"""
response = ''
oldlen = 0
newlen = 0
while True:
response += fp.read(buffSize)
newlen = ... | [
"def",
"socket_read",
"(",
"fp",
")",
":",
"response",
"=",
"''",
"oldlen",
"=",
"0",
"newlen",
"=",
"0",
"while",
"True",
":",
"response",
"+=",
"fp",
".",
"read",
"(",
"buffSize",
")",
"newlen",
"=",
"len",
"(",
"response",
")",
"if",
"newlen",
"... | Buffered read from socket. Reads all data available from socket.
@fp: File pointer for socket.
@return: String of characters read from buffer. | [
"Buffered",
"read",
"from",
"socket",
".",
"Reads",
"all",
"data",
"available",
"from",
"socket",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L64-L81 | train |
aouyar/PyMunin | pysysinfo/util.py | exec_command | def exec_command(args, env=None):
"""Convenience function that executes command and returns result.
@param args: Tuple of command and arguments.
@param env: Dictionary of environment variables.
(Environment is not modified if None.)
@return: Command output.
"""
t... | python | def exec_command(args, env=None):
"""Convenience function that executes command and returns result.
@param args: Tuple of command and arguments.
@param env: Dictionary of environment variables.
(Environment is not modified if None.)
@return: Command output.
"""
t... | [
"def",
"exec_command",
"(",
"args",
",",
"env",
"=",
"None",
")",
":",
"try",
":",
"cmd",
"=",
"subprocess",
".",
"Popen",
"(",
"args",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"PIPE",
",",
"bufsize",
"=",... | Convenience function that executes command and returns result.
@param args: Tuple of command and arguments.
@param env: Dictionary of environment variables.
(Environment is not modified if None.)
@return: Command output. | [
"Convenience",
"function",
"that",
"executes",
"command",
"and",
"returns",
"result",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L84-L106 | train |
aouyar/PyMunin | pysysinfo/util.py | NestedDict.set_nested | def set_nested(self, klist, value):
"""D.set_nested((k1, k2,k3, ...), v) -> D[k1][k2][k3] ... = v"""
keys = list(klist)
if len(keys) > 0:
curr_dict = self
last_key = keys.pop()
for key in keys:
if not curr_dict.has_key(key) or not isinstance(cu... | python | def set_nested(self, klist, value):
"""D.set_nested((k1, k2,k3, ...), v) -> D[k1][k2][k3] ... = v"""
keys = list(klist)
if len(keys) > 0:
curr_dict = self
last_key = keys.pop()
for key in keys:
if not curr_dict.has_key(key) or not isinstance(cu... | [
"def",
"set_nested",
"(",
"self",
",",
"klist",
",",
"value",
")",
":",
"keys",
"=",
"list",
"(",
"klist",
")",
"if",
"len",
"(",
"keys",
")",
">",
"0",
":",
"curr_dict",
"=",
"self",
"last_key",
"=",
"keys",
".",
"pop",
"(",
")",
"for",
"key",
... | D.set_nested((k1, k2,k3, ...), v) -> D[k1][k2][k3] ... = v | [
"D",
".",
"set_nested",
"((",
"k1",
"k2",
"k3",
"...",
")",
"v",
")",
"-",
">",
"D",
"[",
"k1",
"]",
"[",
"k2",
"]",
"[",
"k3",
"]",
"...",
"=",
"v"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L156-L167 | train |
aouyar/PyMunin | pysysinfo/util.py | TableFilter.registerFilter | def registerFilter(self, column, patterns, is_regex=False,
ignore_case=False):
"""Register filter on a column of table.
@param column: The column name.
@param patterns: A single pattern or a list of patterns used for
matching ... | python | def registerFilter(self, column, patterns, is_regex=False,
ignore_case=False):
"""Register filter on a column of table.
@param column: The column name.
@param patterns: A single pattern or a list of patterns used for
matching ... | [
"def",
"registerFilter",
"(",
"self",
",",
"column",
",",
"patterns",
",",
"is_regex",
"=",
"False",
",",
"ignore_case",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"patterns",
",",
"basestring",
")",
":",
"patt_list",
"=",
"(",
"patterns",
",",
")"... | Register filter on a column of table.
@param column: The column name.
@param patterns: A single pattern or a list of patterns used for
matching column values.
@param is_regex: The patterns will be treated as regex if True, the
... | [
"Register",
"filter",
"on",
"a",
"column",
"of",
"table",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L233-L264 | train |
aouyar/PyMunin | pysysinfo/util.py | TableFilter.unregisterFilter | def unregisterFilter(self, column):
"""Unregister filter on a column of the table.
@param column: The column header.
"""
if self._filters.has_key(column):
del self._filters[column] | python | def unregisterFilter(self, column):
"""Unregister filter on a column of the table.
@param column: The column header.
"""
if self._filters.has_key(column):
del self._filters[column] | [
"def",
"unregisterFilter",
"(",
"self",
",",
"column",
")",
":",
"if",
"self",
".",
"_filters",
".",
"has_key",
"(",
"column",
")",
":",
"del",
"self",
".",
"_filters",
"[",
"column",
"]"
] | Unregister filter on a column of the table.
@param column: The column header. | [
"Unregister",
"filter",
"on",
"a",
"column",
"of",
"the",
"table",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L266-L273 | train |
aouyar/PyMunin | pysysinfo/util.py | TableFilter.registerFilters | def registerFilters(self, **kwargs):
"""Register multiple filters at once.
@param **kwargs: Multiple filters are registered using keyword
variables. Each keyword must correspond to a field name
with an optional suffix:
... | python | def registerFilters(self, **kwargs):
"""Register multiple filters at once.
@param **kwargs: Multiple filters are registered using keyword
variables. Each keyword must correspond to a field name
with an optional suffix:
... | [
"def",
"registerFilters",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"(",
"key",
",",
"patterns",
")",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"key",
".",
"endswith",
"(",
"'_regex'",
")",
":",
"col",
"=",
"key",
"[",
":",
... | Register multiple filters at once.
@param **kwargs: Multiple filters are registered using keyword
variables. Each keyword must correspond to a field name
with an optional suffix:
field: Field equal to value or in list... | [
"Register",
"multiple",
"filters",
"at",
"once",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L275-L304 | train |
aouyar/PyMunin | pysysinfo/util.py | TableFilter.applyFilters | def applyFilters(self, headers, table):
"""Apply filter on ps command result.
@param headers: List of column headers.
@param table: Nested list of rows and columns.
@return: Nested list of rows and columns filtered using
registered filters.
... | python | def applyFilters(self, headers, table):
"""Apply filter on ps command result.
@param headers: List of column headers.
@param table: Nested list of rows and columns.
@return: Nested list of rows and columns filtered using
registered filters.
... | [
"def",
"applyFilters",
"(",
"self",
",",
"headers",
",",
"table",
")",
":",
"result",
"=",
"[",
"]",
"column_idxs",
"=",
"{",
"}",
"for",
"column",
"in",
"self",
".",
"_filters",
".",
"keys",
"(",
")",
":",
"try",
":",
"column_idxs",
"[",
"column",
... | Apply filter on ps command result.
@param headers: List of column headers.
@param table: Nested list of rows and columns.
@return: Nested list of rows and columns filtered using
registered filters. | [
"Apply",
"filter",
"on",
"ps",
"command",
"result",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L306-L343 | train |
aouyar/PyMunin | pysysinfo/util.py | Telnet.open | def open(self, host=None, port=0, socket_file=None,
timeout=socket.getdefaulttimeout()):
"""Connect to a host.
With a host argument, it connects the instance using TCP; port number
and timeout are optional, socket_file must be None. The port number
defaults to the standar... | python | def open(self, host=None, port=0, socket_file=None,
timeout=socket.getdefaulttimeout()):
"""Connect to a host.
With a host argument, it connects the instance using TCP; port number
and timeout are optional, socket_file must be None. The port number
defaults to the standar... | [
"def",
"open",
"(",
"self",
",",
"host",
"=",
"None",
",",
"port",
"=",
"0",
",",
"socket_file",
"=",
"None",
",",
"timeout",
"=",
"socket",
".",
"getdefaulttimeout",
"(",
")",
")",
":",
"self",
".",
"socket_file",
"=",
"socket_file",
"if",
"host",
"... | Connect to a host.
With a host argument, it connects the instance using TCP; port number
and timeout are optional, socket_file must be None. The port number
defaults to the standard telnet port (23).
With a socket_file argument, it connects the instance using
named soc... | [
"Connect",
"to",
"a",
"host",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/util.py#L366-L395 | train |
ContextLab/quail | quail/analysis/analysis.py | analyze | def analyze(egg, subjgroup=None, listgroup=None, subjname='Subject',
listname='List', analysis=None, position=0, permute=False,
n_perms=1000, parallel=False, match='exact',
distance='euclidean', features=None, ts=None):
"""
General analysis function that groups data by subjec... | python | def analyze(egg, subjgroup=None, listgroup=None, subjname='Subject',
listname='List', analysis=None, position=0, permute=False,
n_perms=1000, parallel=False, match='exact',
distance='euclidean', features=None, ts=None):
"""
General analysis function that groups data by subjec... | [
"def",
"analyze",
"(",
"egg",
",",
"subjgroup",
"=",
"None",
",",
"listgroup",
"=",
"None",
",",
"subjname",
"=",
"'Subject'",
",",
"listname",
"=",
"'List'",
",",
"analysis",
"=",
"None",
",",
"position",
"=",
"0",
",",
"permute",
"=",
"False",
",",
... | General analysis function that groups data by subject/list number and performs analysis.
Parameters
----------
egg : Egg data object
The data to be analyzed
subjgroup : list of strings or ints
String/int variables indicating how to group over subjects. Must be
the length of th... | [
"General",
"analysis",
"function",
"that",
"groups",
"data",
"by",
"subject",
"/",
"list",
"number",
"and",
"performs",
"analysis",
"."
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/analysis.py#L31-L155 | train |
ContextLab/quail | quail/analysis/analysis.py | _analyze_chunk | def _analyze_chunk(data, subjgroup=None, subjname='Subject', listgroup=None,
listname='List', analysis=None, analysis_type=None,
pass_features=False, features=None, parallel=False,
**kwargs):
"""
Private function that groups data by subject/list number an... | python | def _analyze_chunk(data, subjgroup=None, subjname='Subject', listgroup=None,
listname='List', analysis=None, analysis_type=None,
pass_features=False, features=None, parallel=False,
**kwargs):
"""
Private function that groups data by subject/list number an... | [
"def",
"_analyze_chunk",
"(",
"data",
",",
"subjgroup",
"=",
"None",
",",
"subjname",
"=",
"'Subject'",
",",
"listgroup",
"=",
"None",
",",
"listname",
"=",
"'List'",
",",
"analysis",
"=",
"None",
",",
"analysis_type",
"=",
"None",
",",
"pass_features",
"=... | Private function that groups data by subject/list number and performs
analysis for a chunk of data.
Parameters
----------
data : Egg data object
The data to be analyzed
subjgroup : list of strings or ints
String/int variables indicating how to group over subjects. Must be
... | [
"Private",
"function",
"that",
"groups",
"data",
"by",
"subject",
"/",
"list",
"number",
"and",
"performs",
"analysis",
"for",
"a",
"chunk",
"of",
"data",
"."
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/analysis.py#L157-L236 | train |
aouyar/PyMunin | pymunin/plugins/tomcatstats.py | MuninTomcatPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
if self.hasGraph('tomcat_memory'):
stats = self._tomcatInfo.getMemoryStats()
self.setGraphVal('tomcat_memory', 'used',
stats['total'] - stats['free'])
self.setGraphVal('tomcat_memo... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
if self.hasGraph('tomcat_memory'):
stats = self._tomcatInfo.getMemoryStats()
self.setGraphVal('tomcat_memory', 'used',
stats['total'] - stats['free'])
self.setGraphVal('tomcat_memo... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"if",
"self",
".",
"hasGraph",
"(",
"'tomcat_memory'",
")",
":",
"stats",
"=",
"self",
".",
"_tomcatInfo",
".",
"getMemoryStats",
"(",
")",
"self",
".",
"setGraphVal",
"(",
"'tomcat_memory'",
",",
"'used'",
","... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/tomcatstats.py#L196-L225 | train |
dfm/acor | acor/acor.py | function | def function(data, maxt=None):
"""
Calculate the autocorrelation function for a 1D time series.
Parameters
----------
data : numpy.ndarray (N,)
The time series.
Returns
-------
rho : numpy.ndarray (N,)
An autocorrelation function.
"""
data = np.atleast_1d(data)... | python | def function(data, maxt=None):
"""
Calculate the autocorrelation function for a 1D time series.
Parameters
----------
data : numpy.ndarray (N,)
The time series.
Returns
-------
rho : numpy.ndarray (N,)
An autocorrelation function.
"""
data = np.atleast_1d(data)... | [
"def",
"function",
"(",
"data",
",",
"maxt",
"=",
"None",
")",
":",
"data",
"=",
"np",
".",
"atleast_1d",
"(",
"data",
")",
"assert",
"len",
"(",
"np",
".",
"shape",
"(",
"data",
")",
")",
"==",
"1",
",",
"\"The autocorrelation function can only by compu... | Calculate the autocorrelation function for a 1D time series.
Parameters
----------
data : numpy.ndarray (N,)
The time series.
Returns
-------
rho : numpy.ndarray (N,)
An autocorrelation function. | [
"Calculate",
"the",
"autocorrelation",
"function",
"for",
"a",
"1D",
"time",
"series",
"."
] | b55eb8efa7df6c73b6f3f0c9b64fa1c801e8f821 | https://github.com/dfm/acor/blob/b55eb8efa7df6c73b6f3f0c9b64fa1c801e8f821/acor/acor.py#L36-L59 | train |
aouyar/PyMunin | pymunin/plugins/nginxstats.py | MuninNginxPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
nginxInfo = NginxInfo(self._host, self._port,
self._user, self._password,
self._statuspath, self._ssl)
stats = nginxInfo.getServerStats()
if stats:
if... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
nginxInfo = NginxInfo(self._host, self._port,
self._user, self._password,
self._statuspath, self._ssl)
stats = nginxInfo.getServerStats()
if stats:
if... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"nginxInfo",
"=",
"NginxInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_statuspath",
",",
"self",
".",
"_ssl",
")... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/nginxstats.py#L151-L186 | train |
aouyar/PyMunin | pymunin/plugins/nginxstats.py | MuninNginxPlugin.autoconf | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
nginxInfo = NginxInfo(self._host, self._port,
self._user, self._password,
... | python | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
nginxInfo = NginxInfo(self._host, self._port,
self._user, self._password,
... | [
"def",
"autoconf",
"(",
"self",
")",
":",
"nginxInfo",
"=",
"NginxInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_statuspath",
",",
"self",
".",
"_ssl",
")",
... | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/nginxstats.py#L188-L197 | train |
aouyar/PyMunin | pysysinfo/phpfpm.py | PHPfpmInfo.getStats | def getStats(self):
"""Query and parse Web Server Status Page.
"""
url = "%s://%s:%d/%s" % (self._proto, self._host, self._port,
self._monpath)
response = util.get_url(url, self._user, self._password)
stats = {}
for line in respo... | python | def getStats(self):
"""Query and parse Web Server Status Page.
"""
url = "%s://%s:%d/%s" % (self._proto, self._host, self._port,
self._monpath)
response = util.get_url(url, self._user, self._password)
stats = {}
for line in respo... | [
"def",
"getStats",
"(",
"self",
")",
":",
"url",
"=",
"\"%s://%s:%d/%s\"",
"%",
"(",
"self",
".",
"_proto",
",",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_monpath",
")",
"response",
"=",
"util",
".",
"get_url",
"(",
"url",
... | Query and parse Web Server Status Page. | [
"Query",
"and",
"parse",
"Web",
"Server",
"Status",
"Page",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/phpfpm.py#L65-L77 | train |
aouyar/PyMunin | pymunin/plugins/phpapcstats.py | MuninPHPapcPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
apcinfo = APCinfo(self._host, self._port, self._user, self._password,
self._monpath, self._ssl, self._extras)
stats = apcinfo.getAllStats()
if self.hasGraph('php_apc_memory') and stats:
... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
apcinfo = APCinfo(self._host, self._port, self._user, self._password,
self._monpath, self._ssl, self._extras)
stats = apcinfo.getAllStats()
if self.hasGraph('php_apc_memory') and stats:
... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"apcinfo",
"=",
"APCinfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_monpath",
",",
"self",
".",
"_ssl",
",",
"s... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpapcstats.py#L196-L246 | train |
aouyar/PyMunin | pymunin/plugins/phpapcstats.py | MuninPHPapcPlugin.autoconf | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
apcinfo = APCinfo(self._host, self._port, self._user, self._password,
self._monpath, self.... | python | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
apcinfo = APCinfo(self._host, self._port, self._user, self._password,
self._monpath, self.... | [
"def",
"autoconf",
"(",
"self",
")",
":",
"apcinfo",
"=",
"APCinfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_monpath",
",",
"self",
".",
"_ssl",
")",
"retur... | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpapcstats.py#L248-L256 | train |
aouyar/PyMunin | pysysinfo/varnish.py | VarnishInfo.getStats | def getStats(self):
"""Runs varnishstats command to get stats from Varnish Cache.
@return: Dictionary of stats.
"""
info_dict = {}
args = [varnishstatCmd, '-1']
if self._instance is not None:
args.extend(['-n', self._instance])
output = util.... | python | def getStats(self):
"""Runs varnishstats command to get stats from Varnish Cache.
@return: Dictionary of stats.
"""
info_dict = {}
args = [varnishstatCmd, '-1']
if self._instance is not None:
args.extend(['-n', self._instance])
output = util.... | [
"def",
"getStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"args",
"=",
"[",
"varnishstatCmd",
",",
"'-1'",
"]",
"if",
"self",
".",
"_instance",
"is",
"not",
"None",
":",
"args",
".",
"extend",
"(",
"[",
"'-n'",
",",
"self",
".",
"_insta... | Runs varnishstats command to get stats from Varnish Cache.
@return: Dictionary of stats. | [
"Runs",
"varnishstats",
"command",
"to",
"get",
"stats",
"from",
"Varnish",
"Cache",
".",
"@return",
":",
"Dictionary",
"of",
"stats",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/varnish.py#L39-L59 | train |
aouyar/PyMunin | pysysinfo/varnish.py | VarnishInfo.getDesc | def getDesc(self, entry):
"""Returns description for stat entry.
@param entry: Entry name.
@return: Description for entry.
"""
if len(self._descDict) == 0:
self.getStats()
return self._descDict.get(entry) | python | def getDesc(self, entry):
"""Returns description for stat entry.
@param entry: Entry name.
@return: Description for entry.
"""
if len(self._descDict) == 0:
self.getStats()
return self._descDict.get(entry) | [
"def",
"getDesc",
"(",
"self",
",",
"entry",
")",
":",
"if",
"len",
"(",
"self",
".",
"_descDict",
")",
"==",
"0",
":",
"self",
".",
"getStats",
"(",
")",
"return",
"self",
".",
"_descDict",
".",
"get",
"(",
"entry",
")"
] | Returns description for stat entry.
@param entry: Entry name.
@return: Description for entry. | [
"Returns",
"description",
"for",
"stat",
"entry",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/varnish.py#L71-L80 | train |
aouyar/PyMunin | pymunin/plugins/phpopcstats.py | MuninPHPOPCPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
opcinfo = OPCinfo(self._host, self._port, self._user, self._password,
self._monpath, self._ssl)
stats = opcinfo.getAllStats()
if self.hasGraph('php_opc_memory') and stats:
mem = stat... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
opcinfo = OPCinfo(self._host, self._port, self._user, self._password,
self._monpath, self._ssl)
stats = opcinfo.getAllStats()
if self.hasGraph('php_opc_memory') and stats:
mem = stat... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"opcinfo",
"=",
"OPCinfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_monpath",
",",
"self",
".",
"_ssl",
")",
"s... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpopcstats.py#L148-L177 | train |
aouyar/PyMunin | pymunin/plugins/phpopcstats.py | MuninPHPOPCPlugin.autoconf | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
opcinfo = OPCinfo(self._host, self._port, self._user, self._password,
self._monpath, self.... | python | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
opcinfo = OPCinfo(self._host, self._port, self._user, self._password,
self._monpath, self.... | [
"def",
"autoconf",
"(",
"self",
")",
":",
"opcinfo",
"=",
"OPCinfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_monpath",
",",
"self",
".",
"_ssl",
")",
"retur... | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpopcstats.py#L179-L187 | train |
ContextLab/quail | quail/analysis/clustering.py | fingerprint_helper | def fingerprint_helper(egg, permute=False, n_perms=1000,
match='exact', distance='euclidean', features=None):
"""
Computes clustering along a set of feature dimensions
Parameters
----------
egg : quail.Egg
Data to analyze
dist_funcs : dict
Dictionary of d... | python | def fingerprint_helper(egg, permute=False, n_perms=1000,
match='exact', distance='euclidean', features=None):
"""
Computes clustering along a set of feature dimensions
Parameters
----------
egg : quail.Egg
Data to analyze
dist_funcs : dict
Dictionary of d... | [
"def",
"fingerprint_helper",
"(",
"egg",
",",
"permute",
"=",
"False",
",",
"n_perms",
"=",
"1000",
",",
"match",
"=",
"'exact'",
",",
"distance",
"=",
"'euclidean'",
",",
"features",
"=",
"None",
")",
":",
"if",
"features",
"is",
"None",
":",
"features"... | Computes clustering along a set of feature dimensions
Parameters
----------
egg : quail.Egg
Data to analyze
dist_funcs : dict
Dictionary of distance functions for feature clustering analyses
Returns
----------
probabilities : Numpy array
Each number represents cluste... | [
"Computes",
"clustering",
"along",
"a",
"set",
"of",
"feature",
"dimensions"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/clustering.py#L9-L37 | train |
ContextLab/quail | quail/analysis/clustering.py | compute_feature_weights | def compute_feature_weights(pres_list, rec_list, feature_list, distances):
"""
Compute clustering scores along a set of feature dimensions
Parameters
----------
pres_list : list
list of presented words
rec_list : list
list of recalled words
feature_list : list
list... | python | def compute_feature_weights(pres_list, rec_list, feature_list, distances):
"""
Compute clustering scores along a set of feature dimensions
Parameters
----------
pres_list : list
list of presented words
rec_list : list
list of recalled words
feature_list : list
list... | [
"def",
"compute_feature_weights",
"(",
"pres_list",
",",
"rec_list",
",",
"feature_list",
",",
"distances",
")",
":",
"# initialize the weights object for just this list",
"weights",
"=",
"{",
"}",
"for",
"feature",
"in",
"feature_list",
"[",
"0",
"]",
":",
"weights... | Compute clustering scores along a set of feature dimensions
Parameters
----------
pres_list : list
list of presented words
rec_list : list
list of recalled words
feature_list : list
list of feature dicts for presented words
distances : dict
dict of distance ma... | [
"Compute",
"clustering",
"scores",
"along",
"a",
"set",
"of",
"feature",
"dimensions"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/clustering.py#L137-L218 | train |
ContextLab/quail | quail/analysis/lagcrp.py | lagcrp_helper | def lagcrp_helper(egg, match='exact', distance='euclidean',
ts=None, features=None):
"""
Computes probabilities for each transition distance (probability that a word
recalled will be a given distance--in presentation order--from the previous
recalled word).
Parameters
--------... | python | def lagcrp_helper(egg, match='exact', distance='euclidean',
ts=None, features=None):
"""
Computes probabilities for each transition distance (probability that a word
recalled will be a given distance--in presentation order--from the previous
recalled word).
Parameters
--------... | [
"def",
"lagcrp_helper",
"(",
"egg",
",",
"match",
"=",
"'exact'",
",",
"distance",
"=",
"'euclidean'",
",",
"ts",
"=",
"None",
",",
"features",
"=",
"None",
")",
":",
"def",
"lagcrp",
"(",
"rec",
",",
"lstlen",
")",
":",
"\"\"\"Computes lag-crp for a given... | Computes probabilities for each transition distance (probability that a word
recalled will be a given distance--in presentation order--from the previous
recalled word).
Parameters
----------
egg : quail.Egg
Data to analyze
match : str (exact, best or smooth)
Matching approach t... | [
"Computes",
"probabilities",
"for",
"each",
"transition",
"distance",
"(",
"probability",
"that",
"a",
"word",
"recalled",
"will",
"be",
"a",
"given",
"distance",
"--",
"in",
"presentation",
"order",
"--",
"from",
"the",
"previous",
"recalled",
"word",
")",
".... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/lagcrp.py#L7-L129 | train |
aouyar/PyMunin | pymunin/plugins/diskiostats.py | MuninDiskIOplugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
if self._diskList:
self._fetchDevAll('disk', self._diskList,
self._info.getDiskStats)
if self._mdList:
self._fetchDevAll('md', self._mdList,
self._info.... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
if self._diskList:
self._fetchDevAll('disk', self._diskList,
self._info.getDiskStats)
if self._mdList:
self._fetchDevAll('md', self._mdList,
self._info.... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"if",
"self",
".",
"_diskList",
":",
"self",
".",
"_fetchDevAll",
"(",
"'disk'",
",",
"self",
".",
"_diskList",
",",
"self",
".",
"_info",
".",
"getDiskStats",
")",
"if",
"self",
".",
"_mdList",
":",
"self"... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskiostats.py#L125-L140 | train |
aouyar/PyMunin | pymunin/plugins/diskiostats.py | MuninDiskIOplugin._configDevRequests | def _configDevRequests(self, namestr, titlestr, devlist):
"""Generate configuration for I/O Request stats.
@param namestr: Field name component indicating device type.
@param titlestr: Title component indicating device type.
@param devlist: List of devices.
""... | python | def _configDevRequests(self, namestr, titlestr, devlist):
"""Generate configuration for I/O Request stats.
@param namestr: Field name component indicating device type.
@param titlestr: Title component indicating device type.
@param devlist: List of devices.
""... | [
"def",
"_configDevRequests",
"(",
"self",
",",
"namestr",
",",
"titlestr",
",",
"devlist",
")",
":",
"name",
"=",
"'diskio_%s_requests'",
"%",
"namestr",
"if",
"self",
".",
"graphEnabled",
"(",
"name",
")",
":",
"graph",
"=",
"MuninGraph",
"(",
"'Disk I/O - ... | Generate configuration for I/O Request stats.
@param namestr: Field name component indicating device type.
@param titlestr: Title component indicating device type.
@param devlist: List of devices. | [
"Generate",
"configuration",
"for",
"I",
"/",
"O",
"Request",
"stats",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskiostats.py#L142-L170 | train |
aouyar/PyMunin | pymunin/plugins/diskiostats.py | MuninDiskIOplugin._configDevActive | def _configDevActive(self, namestr, titlestr, devlist):
"""Generate configuration for I/O Queue Length.
@param namestr: Field name component indicating device type.
@param titlestr: Title component indicating device type.
@param devlist: List of devices.
"""
... | python | def _configDevActive(self, namestr, titlestr, devlist):
"""Generate configuration for I/O Queue Length.
@param namestr: Field name component indicating device type.
@param titlestr: Title component indicating device type.
@param devlist: List of devices.
"""
... | [
"def",
"_configDevActive",
"(",
"self",
",",
"namestr",
",",
"titlestr",
",",
"devlist",
")",
":",
"name",
"=",
"'diskio_%s_active'",
"%",
"namestr",
"if",
"self",
".",
"graphEnabled",
"(",
"name",
")",
":",
"graph",
"=",
"MuninGraph",
"(",
"'Disk I/O - %s -... | Generate configuration for I/O Queue Length.
@param namestr: Field name component indicating device type.
@param titlestr: Title component indicating device type.
@param devlist: List of devices. | [
"Generate",
"configuration",
"for",
"I",
"/",
"O",
"Queue",
"Length",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskiostats.py#L202-L224 | train |
aouyar/PyMunin | pymunin/plugins/diskiostats.py | MuninDiskIOplugin._fetchDevAll | def _fetchDevAll(self, namestr, devlist, statsfunc):
"""Initialize I/O stats for devices.
@param namestr: Field name component indicating device type.
@param devlist: List of devices.
@param statsfunc: Function for retrieving stats for device.
"""
fo... | python | def _fetchDevAll(self, namestr, devlist, statsfunc):
"""Initialize I/O stats for devices.
@param namestr: Field name component indicating device type.
@param devlist: List of devices.
@param statsfunc: Function for retrieving stats for device.
"""
fo... | [
"def",
"_fetchDevAll",
"(",
"self",
",",
"namestr",
",",
"devlist",
",",
"statsfunc",
")",
":",
"for",
"dev",
"in",
"devlist",
":",
"stats",
"=",
"statsfunc",
"(",
"dev",
")",
"name",
"=",
"'diskio_%s_requests'",
"%",
"namestr",
"if",
"self",
".",
"hasGr... | Initialize I/O stats for devices.
@param namestr: Field name component indicating device type.
@param devlist: List of devices.
@param statsfunc: Function for retrieving stats for device. | [
"Initialize",
"I",
"/",
"O",
"stats",
"for",
"devices",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskiostats.py#L226-L246 | train |
aouyar/PyMunin | pymunin/plugins/redisstats.py | RedisPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
for graph_name in self.getGraphList():
for field_name in self.getGraphFieldList(graph_name):
self.setGraphVal(graph_name, field_name, self._stats.get(field_name)) | python | def retrieveVals(self):
"""Retrieve values for graphs."""
for graph_name in self.getGraphList():
for field_name in self.getGraphFieldList(graph_name):
self.setGraphVal(graph_name, field_name, self._stats.get(field_name)) | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"for",
"graph_name",
"in",
"self",
".",
"getGraphList",
"(",
")",
":",
"for",
"field_name",
"in",
"self",
".",
"getGraphFieldList",
"(",
"graph_name",
")",
":",
"self",
".",
"setGraphVal",
"(",
"graph_name",
",... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/redisstats.py#L296-L300 | train |
aouyar/PyMunin | pymunin/plugins/sysstats.py | MuninSysStatsPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
if self.hasGraph('sys_loadavg'):
self._loadstats = self._sysinfo.getLoadAvg()
if self._loadstats:
self.setGraphVal('sys_loadavg', 'load15min', self._loadstats[2])
self.setGraphVal('sys_loada... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
if self.hasGraph('sys_loadavg'):
self._loadstats = self._sysinfo.getLoadAvg()
if self._loadstats:
self.setGraphVal('sys_loadavg', 'load15min', self._loadstats[2])
self.setGraphVal('sys_loada... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"if",
"self",
".",
"hasGraph",
"(",
"'sys_loadavg'",
")",
":",
"self",
".",
"_loadstats",
"=",
"self",
".",
"_sysinfo",
".",
"getLoadAvg",
"(",
")",
"if",
"self",
".",
"_loadstats",
":",
"self",
".",
"setGr... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/sysstats.py#L211-L274 | train |
mattseymour/python-env | dotenv/__init__.py | get | def get(key, default=None):
"""
Searches os.environ. If a key is found try evaluating its type else;
return the string.
returns: k->value (type as defined by ast.literal_eval)
"""
try:
# Attempt to evaluate into python literal
return ast.literal_eval(os.environ.get(k... | python | def get(key, default=None):
"""
Searches os.environ. If a key is found try evaluating its type else;
return the string.
returns: k->value (type as defined by ast.literal_eval)
"""
try:
# Attempt to evaluate into python literal
return ast.literal_eval(os.environ.get(k... | [
"def",
"get",
"(",
"key",
",",
"default",
"=",
"None",
")",
":",
"try",
":",
"# Attempt to evaluate into python literal",
"return",
"ast",
".",
"literal_eval",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"key",
".",
"upper",
"(",
")",
",",
"default",
")"... | Searches os.environ. If a key is found try evaluating its type else;
return the string.
returns: k->value (type as defined by ast.literal_eval) | [
"Searches",
"os",
".",
"environ",
".",
"If",
"a",
"key",
"is",
"found",
"try",
"evaluating",
"its",
"type",
"else",
";",
"return",
"the",
"string",
"."
] | 5ac09b1685fbba75c174c79cb40287aa49d0f208 | https://github.com/mattseymour/python-env/blob/5ac09b1685fbba75c174c79cb40287aa49d0f208/dotenv/__init__.py#L17-L28 | train |
mattseymour/python-env | dotenv/__init__.py | save | def save(filepath=None, **kwargs):
"""
Saves a list of keyword arguments as environment variables to a file.
If no filepath given will default to the default `.env` file.
"""
if filepath is None:
filepath = os.path.join('.env')
with open(filepath, 'wb') as file_handle:
f... | python | def save(filepath=None, **kwargs):
"""
Saves a list of keyword arguments as environment variables to a file.
If no filepath given will default to the default `.env` file.
"""
if filepath is None:
filepath = os.path.join('.env')
with open(filepath, 'wb') as file_handle:
f... | [
"def",
"save",
"(",
"filepath",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"filepath",
"is",
"None",
":",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'.env'",
")",
"with",
"open",
"(",
"filepath",
",",
"'wb'",
")",
"as",
"fi... | Saves a list of keyword arguments as environment variables to a file.
If no filepath given will default to the default `.env` file. | [
"Saves",
"a",
"list",
"of",
"keyword",
"arguments",
"as",
"environment",
"variables",
"to",
"a",
"file",
".",
"If",
"no",
"filepath",
"given",
"will",
"default",
"to",
"the",
"default",
".",
"env",
"file",
"."
] | 5ac09b1685fbba75c174c79cb40287aa49d0f208 | https://github.com/mattseymour/python-env/blob/5ac09b1685fbba75c174c79cb40287aa49d0f208/dotenv/__init__.py#L31-L43 | train |
mattseymour/python-env | dotenv/__init__.py | load | def load(filepath=None):
"""
Reads a .env file into os.environ.
For a set filepath, open the file and read contents into os.environ.
If filepath is not set then look in current dir for a .env file.
"""
if filepath and os.path.exists(filepath):
pass
else:
if not o... | python | def load(filepath=None):
"""
Reads a .env file into os.environ.
For a set filepath, open the file and read contents into os.environ.
If filepath is not set then look in current dir for a .env file.
"""
if filepath and os.path.exists(filepath):
pass
else:
if not o... | [
"def",
"load",
"(",
"filepath",
"=",
"None",
")",
":",
"if",
"filepath",
"and",
"os",
".",
"path",
".",
"exists",
"(",
"filepath",
")",
":",
"pass",
"else",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"'.env'",
")",
":",
"return",
"F... | Reads a .env file into os.environ.
For a set filepath, open the file and read contents into os.environ.
If filepath is not set then look in current dir for a .env file. | [
"Reads",
"a",
".",
"env",
"file",
"into",
"os",
".",
"environ",
"."
] | 5ac09b1685fbba75c174c79cb40287aa49d0f208 | https://github.com/mattseymour/python-env/blob/5ac09b1685fbba75c174c79cb40287aa49d0f208/dotenv/__init__.py#L46-L64 | train |
mattseymour/python-env | dotenv/__init__.py | _get_line_ | def _get_line_(filepath):
"""
Gets each line from the file and parse the data.
Attempt to translate the value into a python type is possible
(falls back to string).
"""
for line in open(filepath):
line = line.strip()
# allows for comments in the file
if line.startswith('#... | python | def _get_line_(filepath):
"""
Gets each line from the file and parse the data.
Attempt to translate the value into a python type is possible
(falls back to string).
"""
for line in open(filepath):
line = line.strip()
# allows for comments in the file
if line.startswith('#... | [
"def",
"_get_line_",
"(",
"filepath",
")",
":",
"for",
"line",
"in",
"open",
"(",
"filepath",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"# allows for comments in the file",
"if",
"line",
".",
"startswith",
"(",
"'#'",
")",
"or",
"'='",
"not"... | Gets each line from the file and parse the data.
Attempt to translate the value into a python type is possible
(falls back to string). | [
"Gets",
"each",
"line",
"from",
"the",
"file",
"and",
"parse",
"the",
"data",
".",
"Attempt",
"to",
"translate",
"the",
"value",
"into",
"a",
"python",
"type",
"is",
"possible",
"(",
"falls",
"back",
"to",
"string",
")",
"."
] | 5ac09b1685fbba75c174c79cb40287aa49d0f208 | https://github.com/mattseymour/python-env/blob/5ac09b1685fbba75c174c79cb40287aa49d0f208/dotenv/__init__.py#L67-L94 | train |
aouyar/PyMunin | pysysinfo/apache.py | ApacheInfo.initStats | def initStats(self):
"""Query and parse Apache Web Server Status Page."""
url = "%s://%s:%d/%s?auto" % (self._proto, self._host, self._port,
self._statuspath)
response = util.get_url(url, self._user, self._password)
self._statusDict = {}
f... | python | def initStats(self):
"""Query and parse Apache Web Server Status Page."""
url = "%s://%s:%d/%s?auto" % (self._proto, self._host, self._port,
self._statuspath)
response = util.get_url(url, self._user, self._password)
self._statusDict = {}
f... | [
"def",
"initStats",
"(",
"self",
")",
":",
"url",
"=",
"\"%s://%s:%d/%s?auto\"",
"%",
"(",
"self",
".",
"_proto",
",",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_statuspath",
")",
"response",
"=",
"util",
".",
"get_url",
"(",
... | Query and parse Apache Web Server Status Page. | [
"Query",
"and",
"parse",
"Apache",
"Web",
"Server",
"Status",
"Page",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/apache.py#L68-L79 | train |
ContextLab/quail | quail/egg.py | Egg.get_pres_features | def get_pres_features(self, features=None):
"""
Returns a df of features for presented items
"""
if features is None:
features = self.dist_funcs.keys()
elif not isinstance(features, list):
features = [features]
return self.pres.applymap(lambda x: {... | python | def get_pres_features(self, features=None):
"""
Returns a df of features for presented items
"""
if features is None:
features = self.dist_funcs.keys()
elif not isinstance(features, list):
features = [features]
return self.pres.applymap(lambda x: {... | [
"def",
"get_pres_features",
"(",
"self",
",",
"features",
"=",
"None",
")",
":",
"if",
"features",
"is",
"None",
":",
"features",
"=",
"self",
".",
"dist_funcs",
".",
"keys",
"(",
")",
"elif",
"not",
"isinstance",
"(",
"features",
",",
"list",
")",
":"... | Returns a df of features for presented items | [
"Returns",
"a",
"df",
"of",
"features",
"for",
"presented",
"items"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L220-L228 | train |
ContextLab/quail | quail/egg.py | Egg.get_rec_features | def get_rec_features(self, features=None):
"""
Returns a df of features for recalled items
"""
if features is None:
features = self.dist_funcs.keys()
elif not isinstance(features, list):
features = [features]
return self.rec.applymap(lambda x: {k:v... | python | def get_rec_features(self, features=None):
"""
Returns a df of features for recalled items
"""
if features is None:
features = self.dist_funcs.keys()
elif not isinstance(features, list):
features = [features]
return self.rec.applymap(lambda x: {k:v... | [
"def",
"get_rec_features",
"(",
"self",
",",
"features",
"=",
"None",
")",
":",
"if",
"features",
"is",
"None",
":",
"features",
"=",
"self",
".",
"dist_funcs",
".",
"keys",
"(",
")",
"elif",
"not",
"isinstance",
"(",
"features",
",",
"list",
")",
":",... | Returns a df of features for recalled items | [
"Returns",
"a",
"df",
"of",
"features",
"for",
"recalled",
"items"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L236-L244 | train |
ContextLab/quail | quail/egg.py | Egg.info | def info(self):
"""
Print info about the data egg
"""
print('Number of subjects: ' + str(self.n_subjects))
print('Number of lists per subject: ' + str(self.n_lists))
print('Number of words per list: ' + str(self.list_length))
print('Date created: ' + str(self.date... | python | def info(self):
"""
Print info about the data egg
"""
print('Number of subjects: ' + str(self.n_subjects))
print('Number of lists per subject: ' + str(self.n_lists))
print('Number of words per list: ' + str(self.list_length))
print('Date created: ' + str(self.date... | [
"def",
"info",
"(",
"self",
")",
":",
"print",
"(",
"'Number of subjects: '",
"+",
"str",
"(",
"self",
".",
"n_subjects",
")",
")",
"print",
"(",
"'Number of lists per subject: '",
"+",
"str",
"(",
"self",
".",
"n_lists",
")",
")",
"print",
"(",
"'Number o... | Print info about the data egg | [
"Print",
"info",
"about",
"the",
"data",
"egg"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L247-L255 | train |
ContextLab/quail | quail/egg.py | Egg.save | def save(self, fname, compression='blosc'):
"""
Save method for the Egg object
The data will be saved as a 'egg' file, which is a dictionary containing
the elements of a Egg saved in the hd5 format using
`deepdish`.
Parameters
----------
fname : str
... | python | def save(self, fname, compression='blosc'):
"""
Save method for the Egg object
The data will be saved as a 'egg' file, which is a dictionary containing
the elements of a Egg saved in the hd5 format using
`deepdish`.
Parameters
----------
fname : str
... | [
"def",
"save",
"(",
"self",
",",
"fname",
",",
"compression",
"=",
"'blosc'",
")",
":",
"# put egg vars into a dict",
"egg",
"=",
"{",
"'pres'",
":",
"df2list",
"(",
"self",
".",
"pres",
")",
",",
"'rec'",
":",
"df2list",
"(",
"self",
".",
"rec",
")",
... | Save method for the Egg object
The data will be saved as a 'egg' file, which is a dictionary containing
the elements of a Egg saved in the hd5 format using
`deepdish`.
Parameters
----------
fname : str
A name for the file. If the file extension (.egg) is n... | [
"Save",
"method",
"for",
"the",
"Egg",
"object"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L257-L298 | train |
ContextLab/quail | quail/egg.py | FriedEgg.save | def save(self, fname, compression='blosc'):
"""
Save method for the FriedEgg object
The data will be saved as a 'fegg' file, which is a dictionary containing
the elements of a FriedEgg saved in the hd5 format using
`deepdish`.
Parameters
----------
fnam... | python | def save(self, fname, compression='blosc'):
"""
Save method for the FriedEgg object
The data will be saved as a 'fegg' file, which is a dictionary containing
the elements of a FriedEgg saved in the hd5 format using
`deepdish`.
Parameters
----------
fnam... | [
"def",
"save",
"(",
"self",
",",
"fname",
",",
"compression",
"=",
"'blosc'",
")",
":",
"egg",
"=",
"{",
"'data'",
":",
"self",
".",
"data",
",",
"'analysis'",
":",
"self",
".",
"analysis",
",",
"'list_length'",
":",
"self",
".",
"list_length",
",",
... | Save method for the FriedEgg object
The data will be saved as a 'fegg' file, which is a dictionary containing
the elements of a FriedEgg saved in the hd5 format using
`deepdish`.
Parameters
----------
fname : str
A name for the file. If the file extension ... | [
"Save",
"method",
"for",
"the",
"FriedEgg",
"object"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/egg.py#L381-L418 | train |
ContextLab/quail | quail/analysis/pnr.py | pnr_helper | def pnr_helper(egg, position, match='exact',
distance='euclidean', features=None):
"""
Computes probability of a word being recalled nth (in the appropriate recall
list), given its presentation position. Note: zero indexed
Parameters
----------
egg : quail.Egg
Data to a... | python | def pnr_helper(egg, position, match='exact',
distance='euclidean', features=None):
"""
Computes probability of a word being recalled nth (in the appropriate recall
list), given its presentation position. Note: zero indexed
Parameters
----------
egg : quail.Egg
Data to a... | [
"def",
"pnr_helper",
"(",
"egg",
",",
"position",
",",
"match",
"=",
"'exact'",
",",
"distance",
"=",
"'euclidean'",
",",
"features",
"=",
"None",
")",
":",
"def",
"pnr",
"(",
"lst",
",",
"position",
")",
":",
"return",
"[",
"1",
"if",
"pos",
"==",
... | Computes probability of a word being recalled nth (in the appropriate recall
list), given its presentation position. Note: zero indexed
Parameters
----------
egg : quail.Egg
Data to analyze
position : int
Position of item to be analyzed
match : str (exact, best or smooth)
... | [
"Computes",
"probability",
"of",
"a",
"word",
"being",
"recalled",
"nth",
"(",
"in",
"the",
"appropriate",
"recall",
"list",
")",
"given",
"its",
"presentation",
"position",
".",
"Note",
":",
"zero",
"indexed"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/pnr.py#L4-L52 | train |
aouyar/PyMunin | pymunin/plugins/apachestats.py | MuninApachePlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
apacheInfo = ApacheInfo(self._host, self._port,
self._user, self._password,
self._statuspath, self._ssl)
stats = apacheInfo.getServerStats()
if self.hasGraph('apache... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
apacheInfo = ApacheInfo(self._host, self._port,
self._user, self._password,
self._statuspath, self._ssl)
stats = apacheInfo.getServerStats()
if self.hasGraph('apache... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"apacheInfo",
"=",
"ApacheInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_statuspath",
",",
"self",
".",
"_ssl",
... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/apachestats.py#L124-L138 | train |
aouyar/PyMunin | pymunin/plugins/apachestats.py | MuninApachePlugin.autoconf | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
apacheInfo = ApacheInfo(self._host, self._port,
self._user, self._password,
... | python | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
apacheInfo = ApacheInfo(self._host, self._port,
self._user, self._password,
... | [
"def",
"autoconf",
"(",
"self",
")",
":",
"apacheInfo",
"=",
"ApacheInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_statuspath",
",",
"self",
".",
"_ssl",
")",... | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/apachestats.py#L140-L149 | train |
aouyar/PyMunin | pymunin/plugins/ntphostoffsets.py | MuninNTPhostOffsetsPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
ntpinfo = NTPinfo()
ntpstats = ntpinfo.getHostOffsets(self._remoteHosts)
if ntpstats:
for host in self._remoteHosts:
hostkey = re.sub('\.', '_', host)
hoststats = ntpstats.get(host)
... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
ntpinfo = NTPinfo()
ntpstats = ntpinfo.getHostOffsets(self._remoteHosts)
if ntpstats:
for host in self._remoteHosts:
hostkey = re.sub('\.', '_', host)
hoststats = ntpstats.get(host)
... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"ntpinfo",
"=",
"NTPinfo",
"(",
")",
"ntpstats",
"=",
"ntpinfo",
".",
"getHostOffsets",
"(",
"self",
".",
"_remoteHosts",
")",
"if",
"ntpstats",
":",
"for",
"host",
"in",
"self",
".",
"_remoteHosts",
":",
"ho... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntphostoffsets.py#L119-L136 | train |
aouyar/PyMunin | pymunin/plugins/ntphostoffsets.py | MuninNTPhostOffsetsPlugin.autoconf | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
ntpinfo = NTPinfo()
ntpstats = ntpinfo.getHostOffsets(self._remoteHosts)
return len(ntpstats) > 0 | python | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
ntpinfo = NTPinfo()
ntpstats = ntpinfo.getHostOffsets(self._remoteHosts)
return len(ntpstats) > 0 | [
"def",
"autoconf",
"(",
"self",
")",
":",
"ntpinfo",
"=",
"NTPinfo",
"(",
")",
"ntpstats",
"=",
"ntpinfo",
".",
"getHostOffsets",
"(",
"self",
".",
"_remoteHosts",
")",
"return",
"len",
"(",
"ntpstats",
")",
">",
"0"
] | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntphostoffsets.py#L138-L146 | train |
aouyar/PyMunin | pymunin/plugins/lighttpdstats.py | MuninLighttpdPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
lighttpdInfo = LighttpdInfo(self._host, self._port,
self._user, self._password,
self._statuspath, self._ssl)
stats = lighttpdInfo.getServerStats()
if self.hasGraph('... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
lighttpdInfo = LighttpdInfo(self._host, self._port,
self._user, self._password,
self._statuspath, self._ssl)
stats = lighttpdInfo.getServerStats()
if self.hasGraph('... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"lighttpdInfo",
"=",
"LighttpdInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_statuspath",
",",
"self",
".",
"_ssl"... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/lighttpdstats.py#L124-L138 | train |
aouyar/PyMunin | pymunin/plugins/lighttpdstats.py | MuninLighttpdPlugin.autoconf | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
lighttpdInfo = LighttpdInfo(self._host, self._port,
self._user, self._password,
... | python | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
lighttpdInfo = LighttpdInfo(self._host, self._port,
self._user, self._password,
... | [
"def",
"autoconf",
"(",
"self",
")",
":",
"lighttpdInfo",
"=",
"LighttpdInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_statuspath",
",",
"self",
".",
"_ssl",
... | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/lighttpdstats.py#L140-L149 | train |
aouyar/PyMunin | pymunin/plugins/diskusagestats.py | MuninDiskUsagePlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
name = 'diskspace'
if self.hasGraph(name):
for fspath in self._fslist:
if self._statsSpace.has_key(fspath):
self.setGraphVal(name, fspath,
self._statsSp... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
name = 'diskspace'
if self.hasGraph(name):
for fspath in self._fslist:
if self._statsSpace.has_key(fspath):
self.setGraphVal(name, fspath,
self._statsSp... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"name",
"=",
"'diskspace'",
"if",
"self",
".",
"hasGraph",
"(",
"name",
")",
":",
"for",
"fspath",
"in",
"self",
".",
"_fslist",
":",
"if",
"self",
".",
"_statsSpace",
".",
"has_key",
"(",
"fspath",
")",
... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskusagestats.py#L121-L134 | train |
scikit-umfpack/scikit-umfpack | scikits/umfpack/umfpack.py | UmfpackContext.symbolic | def symbolic(self, mtx):
"""
Perform symbolic object (symbolic LU decomposition) computation for a given
sparsity pattern.
"""
self.free_symbolic()
indx = self._getIndx(mtx)
if not assumeSortedIndices:
# row/column indices cannot be assumed to be sor... | python | def symbolic(self, mtx):
"""
Perform symbolic object (symbolic LU decomposition) computation for a given
sparsity pattern.
"""
self.free_symbolic()
indx = self._getIndx(mtx)
if not assumeSortedIndices:
# row/column indices cannot be assumed to be sor... | [
"def",
"symbolic",
"(",
"self",
",",
"mtx",
")",
":",
"self",
".",
"free_symbolic",
"(",
")",
"indx",
"=",
"self",
".",
"_getIndx",
"(",
"mtx",
")",
"if",
"not",
"assumeSortedIndices",
":",
"# row/column indices cannot be assumed to be sorted",
"mtx",
".",
"so... | Perform symbolic object (symbolic LU decomposition) computation for a given
sparsity pattern. | [
"Perform",
"symbolic",
"object",
"(",
"symbolic",
"LU",
"decomposition",
")",
"computation",
"for",
"a",
"given",
"sparsity",
"pattern",
"."
] | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L492-L525 | train |
scikit-umfpack/scikit-umfpack | scikits/umfpack/umfpack.py | UmfpackContext.numeric | def numeric(self, mtx):
"""
Perform numeric object (LU decomposition) computation using the
symbolic decomposition. The symbolic decomposition is (re)computed
if necessary.
"""
self.free_numeric()
if self._symbolic is None:
self.symbolic(mtx)
... | python | def numeric(self, mtx):
"""
Perform numeric object (LU decomposition) computation using the
symbolic decomposition. The symbolic decomposition is (re)computed
if necessary.
"""
self.free_numeric()
if self._symbolic is None:
self.symbolic(mtx)
... | [
"def",
"numeric",
"(",
"self",
",",
"mtx",
")",
":",
"self",
".",
"free_numeric",
"(",
")",
"if",
"self",
".",
"_symbolic",
"is",
"None",
":",
"self",
".",
"symbolic",
"(",
"mtx",
")",
"indx",
"=",
"self",
".",
"_getIndx",
"(",
"mtx",
")",
"failCou... | Perform numeric object (LU decomposition) computation using the
symbolic decomposition. The symbolic decomposition is (re)computed
if necessary. | [
"Perform",
"numeric",
"object",
"(",
"LU",
"decomposition",
")",
"computation",
"using",
"the",
"symbolic",
"decomposition",
".",
"The",
"symbolic",
"decomposition",
"is",
"(",
"re",
")",
"computed",
"if",
"necessary",
"."
] | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L532-L577 | train |
scikit-umfpack/scikit-umfpack | scikits/umfpack/umfpack.py | UmfpackContext.free_symbolic | def free_symbolic(self):
"""Free symbolic data"""
if self._symbolic is not None:
self.funs.free_symbolic(self._symbolic)
self._symbolic = None
self.mtx = None | python | def free_symbolic(self):
"""Free symbolic data"""
if self._symbolic is not None:
self.funs.free_symbolic(self._symbolic)
self._symbolic = None
self.mtx = None | [
"def",
"free_symbolic",
"(",
"self",
")",
":",
"if",
"self",
".",
"_symbolic",
"is",
"not",
"None",
":",
"self",
".",
"funs",
".",
"free_symbolic",
"(",
"self",
".",
"_symbolic",
")",
"self",
".",
"_symbolic",
"=",
"None",
"self",
".",
"mtx",
"=",
"N... | Free symbolic data | [
"Free",
"symbolic",
"data"
] | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L615-L620 | train |
scikit-umfpack/scikit-umfpack | scikits/umfpack/umfpack.py | UmfpackContext.free_numeric | def free_numeric(self):
"""Free numeric data"""
if self._numeric is not None:
self.funs.free_numeric(self._numeric)
self._numeric = None
self.free_symbolic() | python | def free_numeric(self):
"""Free numeric data"""
if self._numeric is not None:
self.funs.free_numeric(self._numeric)
self._numeric = None
self.free_symbolic() | [
"def",
"free_numeric",
"(",
"self",
")",
":",
"if",
"self",
".",
"_numeric",
"is",
"not",
"None",
":",
"self",
".",
"funs",
".",
"free_numeric",
"(",
"self",
".",
"_numeric",
")",
"self",
".",
"_numeric",
"=",
"None",
"self",
".",
"free_symbolic",
"(",... | Free numeric data | [
"Free",
"numeric",
"data"
] | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L625-L630 | train |
scikit-umfpack/scikit-umfpack | scikits/umfpack/umfpack.py | UmfpackContext.solve | def solve(self, sys, mtx, rhs, autoTranspose=False):
"""
Solution of system of linear equation using the Numeric object.
Parameters
----------
sys : constant
one of UMFPACK system description constants, like
UMFPACK_A, UMFPACK_At, see umfSys list and UMFP... | python | def solve(self, sys, mtx, rhs, autoTranspose=False):
"""
Solution of system of linear equation using the Numeric object.
Parameters
----------
sys : constant
one of UMFPACK system description constants, like
UMFPACK_A, UMFPACK_At, see umfSys list and UMFP... | [
"def",
"solve",
"(",
"self",
",",
"sys",
",",
"mtx",
",",
"rhs",
",",
"autoTranspose",
"=",
"False",
")",
":",
"if",
"sys",
"not",
"in",
"umfSys",
":",
"raise",
"ValueError",
"(",
"'sys must be in'",
"%",
"umfSys",
")",
"if",
"autoTranspose",
"and",
"s... | Solution of system of linear equation using the Numeric object.
Parameters
----------
sys : constant
one of UMFPACK system description constants, like
UMFPACK_A, UMFPACK_At, see umfSys list and UMFPACK docs
mtx : scipy.sparse.csc_matrix or scipy.sparse.csr_matrix... | [
"Solution",
"of",
"system",
"of",
"linear",
"equation",
"using",
"the",
"Numeric",
"object",
"."
] | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L645-L723 | train |
scikit-umfpack/scikit-umfpack | scikits/umfpack/umfpack.py | UmfpackContext.linsolve | def linsolve(self, sys, mtx, rhs, autoTranspose=False):
"""
One-shot solution of system of linear equation. Reuses Numeric object
if possible.
Parameters
----------
sys : constant
one of UMFPACK system description constants, like
UMFPACK_A, UMFPAC... | python | def linsolve(self, sys, mtx, rhs, autoTranspose=False):
"""
One-shot solution of system of linear equation. Reuses Numeric object
if possible.
Parameters
----------
sys : constant
one of UMFPACK system description constants, like
UMFPACK_A, UMFPAC... | [
"def",
"linsolve",
"(",
"self",
",",
"sys",
",",
"mtx",
",",
"rhs",
",",
"autoTranspose",
"=",
"False",
")",
":",
"if",
"sys",
"not",
"in",
"umfSys",
":",
"raise",
"ValueError",
"(",
"'sys must be in'",
"%",
"umfSys",
")",
"if",
"self",
".",
"_numeric"... | One-shot solution of system of linear equation. Reuses Numeric object
if possible.
Parameters
----------
sys : constant
one of UMFPACK system description constants, like
UMFPACK_A, UMFPACK_At, see umfSys list and UMFPACK docs
mtx : scipy.sparse.csc_matrix... | [
"One",
"-",
"shot",
"solution",
"of",
"system",
"of",
"linear",
"equation",
".",
"Reuses",
"Numeric",
"object",
"if",
"possible",
"."
] | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L728-L764 | train |
scikit-umfpack/scikit-umfpack | scikits/umfpack/umfpack.py | UmfpackContext.lu | def lu(self, mtx):
"""
Perform LU decomposition.
For a given matrix A, the decomposition satisfies::
LU = PRAQ when do_recip is true
LU = P(R^-1)AQ when do_recip is false
Parameters
----------
mtx : scipy.sparse.csc_matrix or sc... | python | def lu(self, mtx):
"""
Perform LU decomposition.
For a given matrix A, the decomposition satisfies::
LU = PRAQ when do_recip is true
LU = P(R^-1)AQ when do_recip is false
Parameters
----------
mtx : scipy.sparse.csc_matrix or sc... | [
"def",
"lu",
"(",
"self",
",",
"mtx",
")",
":",
"# this should probably be changed",
"mtx",
"=",
"mtx",
".",
"tocsc",
"(",
")",
"self",
".",
"numeric",
"(",
"mtx",
")",
"# first find out how much space to reserve",
"(",
"status",
",",
"lnz",
",",
"unz",
",",... | Perform LU decomposition.
For a given matrix A, the decomposition satisfies::
LU = PRAQ when do_recip is true
LU = P(R^-1)AQ when do_recip is false
Parameters
----------
mtx : scipy.sparse.csc_matrix or scipy.sparse.csr_matrix
Input... | [
"Perform",
"LU",
"decomposition",
"."
] | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L801-L903 | train |
ContextLab/quail | quail/fingerprint.py | order_stick | def order_stick(presenter, egg, dist_dict, strategy, fingerprint):
"""
Reorders a list according to strategy
"""
def compute_feature_stick(features, weights, alpha):
'''create a 'stick' of feature weights'''
feature_stick = []
for f, w in zip(features, weights):
fea... | python | def order_stick(presenter, egg, dist_dict, strategy, fingerprint):
"""
Reorders a list according to strategy
"""
def compute_feature_stick(features, weights, alpha):
'''create a 'stick' of feature weights'''
feature_stick = []
for f, w in zip(features, weights):
fea... | [
"def",
"order_stick",
"(",
"presenter",
",",
"egg",
",",
"dist_dict",
",",
"strategy",
",",
"fingerprint",
")",
":",
"def",
"compute_feature_stick",
"(",
"features",
",",
"weights",
",",
"alpha",
")",
":",
"'''create a 'stick' of feature weights'''",
"feature_stick"... | Reorders a list according to strategy | [
"Reorders",
"a",
"list",
"according",
"to",
"strategy"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L346-L464 | train |
ContextLab/quail | quail/fingerprint.py | stick_perm | def stick_perm(presenter, egg, dist_dict, strategy):
"""Computes weights for one reordering using stick-breaking method"""
# seed RNG
np.random.seed()
# unpack egg
egg_pres, egg_rec, egg_features, egg_dist_funcs = parse_egg(egg)
# reorder
regg = order_stick(presenter, egg, dist_dict, stra... | python | def stick_perm(presenter, egg, dist_dict, strategy):
"""Computes weights for one reordering using stick-breaking method"""
# seed RNG
np.random.seed()
# unpack egg
egg_pres, egg_rec, egg_features, egg_dist_funcs = parse_egg(egg)
# reorder
regg = order_stick(presenter, egg, dist_dict, stra... | [
"def",
"stick_perm",
"(",
"presenter",
",",
"egg",
",",
"dist_dict",
",",
"strategy",
")",
":",
"# seed RNG",
"np",
".",
"random",
".",
"seed",
"(",
")",
"# unpack egg",
"egg_pres",
",",
"egg_rec",
",",
"egg_features",
",",
"egg_dist_funcs",
"=",
"parse_egg"... | Computes weights for one reordering using stick-breaking method | [
"Computes",
"weights",
"for",
"one",
"reordering",
"using",
"stick",
"-",
"breaking",
"method"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L577-L603 | train |
ContextLab/quail | quail/fingerprint.py | compute_distances_dict | def compute_distances_dict(egg):
""" Creates a nested dict of distances """
pres, rec, features, dist_funcs = parse_egg(egg)
pres_list = list(pres)
features_list = list(features)
# initialize dist dict
distances = {}
# for each word in the list
for idx1, item1 in enumerate(pres_list):
... | python | def compute_distances_dict(egg):
""" Creates a nested dict of distances """
pres, rec, features, dist_funcs = parse_egg(egg)
pres_list = list(pres)
features_list = list(features)
# initialize dist dict
distances = {}
# for each word in the list
for idx1, item1 in enumerate(pres_list):
... | [
"def",
"compute_distances_dict",
"(",
"egg",
")",
":",
"pres",
",",
"rec",
",",
"features",
",",
"dist_funcs",
"=",
"parse_egg",
"(",
"egg",
")",
"pres_list",
"=",
"list",
"(",
"pres",
")",
"features_list",
"=",
"list",
"(",
"features",
")",
"# initialize ... | Creates a nested dict of distances | [
"Creates",
"a",
"nested",
"dict",
"of",
"distances"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L637-L660 | train |
ContextLab/quail | quail/fingerprint.py | compute_feature_weights_dict | def compute_feature_weights_dict(pres_list, rec_list, feature_list, dist_dict):
"""
Compute clustering scores along a set of feature dimensions
Parameters
----------
pres_list : list
list of presented words
rec_list : list
list of recalled words
feature_list : list
l... | python | def compute_feature_weights_dict(pres_list, rec_list, feature_list, dist_dict):
"""
Compute clustering scores along a set of feature dimensions
Parameters
----------
pres_list : list
list of presented words
rec_list : list
list of recalled words
feature_list : list
l... | [
"def",
"compute_feature_weights_dict",
"(",
"pres_list",
",",
"rec_list",
",",
"feature_list",
",",
"dist_dict",
")",
":",
"# initialize the weights object for just this list",
"weights",
"=",
"{",
"}",
"for",
"feature",
"in",
"feature_list",
"[",
"0",
"]",
":",
"we... | Compute clustering scores along a set of feature dimensions
Parameters
----------
pres_list : list
list of presented words
rec_list : list
list of recalled words
feature_list : list
list of feature dicts for presented words
distances : dict
dict of distance matri... | [
"Compute",
"clustering",
"scores",
"along",
"a",
"set",
"of",
"feature",
"dimensions"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L662-L739 | train |
ContextLab/quail | quail/fingerprint.py | Fingerprint.update | def update(self, egg, permute=False, nperms=1000,
parallel=False):
"""
In-place method that updates fingerprint with new data
Parameters
----------
egg : quail.Egg
Data to update fingerprint
Returns
----------
None
"""... | python | def update(self, egg, permute=False, nperms=1000,
parallel=False):
"""
In-place method that updates fingerprint with new data
Parameters
----------
egg : quail.Egg
Data to update fingerprint
Returns
----------
None
"""... | [
"def",
"update",
"(",
"self",
",",
"egg",
",",
"permute",
"=",
"False",
",",
"nperms",
"=",
"1000",
",",
"parallel",
"=",
"False",
")",
":",
"# increment n",
"self",
".",
"n",
"+=",
"1",
"next_weights",
"=",
"np",
".",
"nanmean",
"(",
"_analyze_chunk",... | In-place method that updates fingerprint with new data
Parameters
----------
egg : quail.Egg
Data to update fingerprint
Returns
----------
None | [
"In",
"-",
"place",
"method",
"that",
"updates",
"fingerprint",
"with",
"new",
"data"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L83-L121 | train |
ContextLab/quail | quail/fingerprint.py | OptimalPresenter.order | def order(self, egg, method='permute', nperms=2500, strategy=None,
distfun='correlation', fingerprint=None):
"""
Reorders a list of stimuli to match a fingerprint
Parameters
----------
egg : quail.Egg
Data to compute fingerprint
method : str
... | python | def order(self, egg, method='permute', nperms=2500, strategy=None,
distfun='correlation', fingerprint=None):
"""
Reorders a list of stimuli to match a fingerprint
Parameters
----------
egg : quail.Egg
Data to compute fingerprint
method : str
... | [
"def",
"order",
"(",
"self",
",",
"egg",
",",
"method",
"=",
"'permute'",
",",
"nperms",
"=",
"2500",
",",
"strategy",
"=",
"None",
",",
"distfun",
"=",
"'correlation'",
",",
"fingerprint",
"=",
"None",
")",
":",
"def",
"order_perm",
"(",
"self",
",",
... | Reorders a list of stimuli to match a fingerprint
Parameters
----------
egg : quail.Egg
Data to compute fingerprint
method : str
Method to re-sort list. Can be 'stick' or 'permute' (default: permute)
nperms : int
Number of permutations to us... | [
"Reorders",
"a",
"list",
"of",
"stimuli",
"to",
"match",
"a",
"fingerprint"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L203-L344 | train |
aouyar/PyMunin | pysysinfo/phpopc.py | OPCinfo.initStats | def initStats(self, extras=None):
"""Query and parse Web Server Status Page.
@param extras: Include extra metrics, which can be computationally more
expensive.
"""
url = "%s://%s:%d/%s" % (self._proto, self._host, self._port, self._monpath)
... | python | def initStats(self, extras=None):
"""Query and parse Web Server Status Page.
@param extras: Include extra metrics, which can be computationally more
expensive.
"""
url = "%s://%s:%d/%s" % (self._proto, self._host, self._port, self._monpath)
... | [
"def",
"initStats",
"(",
"self",
",",
"extras",
"=",
"None",
")",
":",
"url",
"=",
"\"%s://%s:%d/%s\"",
"%",
"(",
"self",
".",
"_proto",
",",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_monpath",
")",
"response",
"=",
"util",... | Query and parse Web Server Status Page.
@param extras: Include extra metrics, which can be computationally more
expensive. | [
"Query",
"and",
"parse",
"Web",
"Server",
"Status",
"Page",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/phpopc.py#L72-L83 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo._getDevMajorMinor | def _getDevMajorMinor(self, devpath):
"""Return major and minor device number for block device path devpath.
@param devpath: Full path for block device.
@return: Tuple (major, minor).
"""
fstat = os.stat(devpath)
if stat.S_ISBLK(fstat.st_mode):
... | python | def _getDevMajorMinor(self, devpath):
"""Return major and minor device number for block device path devpath.
@param devpath: Full path for block device.
@return: Tuple (major, minor).
"""
fstat = os.stat(devpath)
if stat.S_ISBLK(fstat.st_mode):
... | [
"def",
"_getDevMajorMinor",
"(",
"self",
",",
"devpath",
")",
":",
"fstat",
"=",
"os",
".",
"stat",
"(",
"devpath",
")",
"if",
"stat",
".",
"S_ISBLK",
"(",
"fstat",
".",
"st_mode",
")",
":",
"return",
"(",
"os",
".",
"major",
"(",
"fstat",
".",
"st... | Return major and minor device number for block device path devpath.
@param devpath: Full path for block device.
@return: Tuple (major, minor). | [
"Return",
"major",
"and",
"minor",
"device",
"number",
"for",
"block",
"device",
"path",
"devpath",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L53-L63 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo._getUniqueDev | def _getUniqueDev(self, devpath):
"""Return unique device for any block device path.
@param devpath: Full path for block device.
@return: Unique device string without the /dev prefix.
"""
realpath = os.path.realpath(devpath)
mobj = re.match('\/dev... | python | def _getUniqueDev(self, devpath):
"""Return unique device for any block device path.
@param devpath: Full path for block device.
@return: Unique device string without the /dev prefix.
"""
realpath = os.path.realpath(devpath)
mobj = re.match('\/dev... | [
"def",
"_getUniqueDev",
"(",
"self",
",",
"devpath",
")",
":",
"realpath",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"devpath",
")",
"mobj",
"=",
"re",
".",
"match",
"(",
"'\\/dev\\/(.*)$'",
",",
"realpath",
")",
"if",
"mobj",
":",
"dev",
"=",
"m... | Return unique device for any block device path.
@param devpath: Full path for block device.
@return: Unique device string without the /dev prefix. | [
"Return",
"unique",
"device",
"for",
"any",
"block",
"device",
"path",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L65-L84 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo._initBlockMajorMap | def _initBlockMajorMap(self):
"""Parses /proc/devices to initialize device class - major number map
for block devices.
"""
self._mapMajorDevclass = {}
try:
fp = open(devicesFile, 'r')
data = fp.read()
fp.close()
except:
... | python | def _initBlockMajorMap(self):
"""Parses /proc/devices to initialize device class - major number map
for block devices.
"""
self._mapMajorDevclass = {}
try:
fp = open(devicesFile, 'r')
data = fp.read()
fp.close()
except:
... | [
"def",
"_initBlockMajorMap",
"(",
"self",
")",
":",
"self",
".",
"_mapMajorDevclass",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"devicesFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except... | Parses /proc/devices to initialize device class - major number map
for block devices. | [
"Parses",
"/",
"proc",
"/",
"devices",
"to",
"initialize",
"device",
"class",
"-",
"major",
"number",
"map",
"for",
"block",
"devices",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L86-L111 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo._initDMinfo | def _initDMinfo(self):
"""Check files in /dev/mapper to initialize data structures for
mappings between device-mapper devices, minor device numbers, VGs
and LVs.
"""
self._mapLVtuple2dm = {}
self._mapLVname2dm = {}
self._vgTree = {}
if self._dmM... | python | def _initDMinfo(self):
"""Check files in /dev/mapper to initialize data structures for
mappings between device-mapper devices, minor device numbers, VGs
and LVs.
"""
self._mapLVtuple2dm = {}
self._mapLVname2dm = {}
self._vgTree = {}
if self._dmM... | [
"def",
"_initDMinfo",
"(",
"self",
")",
":",
"self",
".",
"_mapLVtuple2dm",
"=",
"{",
"}",
"self",
".",
"_mapLVname2dm",
"=",
"{",
"}",
"self",
".",
"_vgTree",
"=",
"{",
"}",
"if",
"self",
".",
"_dmMajorNum",
"is",
"None",
":",
"self",
".",
"_initBlo... | Check files in /dev/mapper to initialize data structures for
mappings between device-mapper devices, minor device numbers, VGs
and LVs. | [
"Check",
"files",
"in",
"/",
"dev",
"/",
"mapper",
"to",
"initialize",
"data",
"structures",
"for",
"mappings",
"between",
"device",
"-",
"mapper",
"devices",
"minor",
"device",
"numbers",
"VGs",
"and",
"LVs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L113-L137 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.