repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
NoviceLive/intellicoder | intellicoder/utils.py | AttrsGetter.get_attrs | def get_attrs(self, *names):
"""Get multiple attributes from multiple objects."""
attrs = [getattr(self, name) for name in names]
return attrs | python | def get_attrs(self, *names):
"""Get multiple attributes from multiple objects."""
attrs = [getattr(self, name) for name in names]
return attrs | [
"def",
"get_attrs",
"(",
"self",
",",
"*",
"names",
")",
":",
"attrs",
"=",
"[",
"getattr",
"(",
"self",
",",
"name",
")",
"for",
"name",
"in",
"names",
"]",
"return",
"attrs"
] | Get multiple attributes from multiple objects. | [
"Get",
"multiple",
"attributes",
"from",
"multiple",
"objects",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/utils.py#L155-L158 | train |
dpa-newslab/livebridge | livebridge/base/posts.py | BasePost.target_id | def target_id(self):
"""Returns the id the target, to which this post has to be syndicated.
:returns: string"""
# already set?
if self._target_id:
return self._target_id
# post already exists?
if self._existing:
self._target_id = self._existing.ge... | python | def target_id(self):
"""Returns the id the target, to which this post has to be syndicated.
:returns: string"""
# already set?
if self._target_id:
return self._target_id
# post already exists?
if self._existing:
self._target_id = self._existing.ge... | [
"def",
"target_id",
"(",
"self",
")",
":",
"if",
"self",
".",
"_target_id",
":",
"return",
"self",
".",
"_target_id",
"if",
"self",
".",
"_existing",
":",
"self",
".",
"_target_id",
"=",
"self",
".",
"_existing",
".",
"get",
"(",
"\"target_id\"",
")",
... | Returns the id the target, to which this post has to be syndicated.
:returns: string | [
"Returns",
"the",
"id",
"the",
"target",
"to",
"which",
"this",
"post",
"has",
"to",
"be",
"syndicated",
"."
] | d930e887faa2f882d15b574f0f1fe4a580d7c5fa | https://github.com/dpa-newslab/livebridge/blob/d930e887faa2f882d15b574f0f1fe4a580d7c5fa/livebridge/base/posts.py#L115-L125 | train |
NoviceLive/intellicoder | intellicoder/intellisense/formatters.py | with_formatter | def with_formatter(formatter):
"""Apply a formatter function the return value
of the decorated function.
"""
def _decorator_after_args(unwrapped):
def _wrapped(self, *args, **kwargs):
logging.debug('unwrapped: %s', unwrapped)
logging.debug('self: %s', self)
lo... | python | def with_formatter(formatter):
"""Apply a formatter function the return value
of the decorated function.
"""
def _decorator_after_args(unwrapped):
def _wrapped(self, *args, **kwargs):
logging.debug('unwrapped: %s', unwrapped)
logging.debug('self: %s', self)
lo... | [
"def",
"with_formatter",
"(",
"formatter",
")",
":",
"def",
"_decorator_after_args",
"(",
"unwrapped",
")",
":",
"def",
"_wrapped",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"logging",
".",
"debug",
"(",
"'unwrapped: %s'",
",",
"unwrapp... | Apply a formatter function the return value
of the decorated function. | [
"Apply",
"a",
"formatter",
"function",
"the",
"return",
"value",
"of",
"the",
"decorated",
"function",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/formatters.py#L31-L47 | train |
NoviceLive/intellicoder | intellicoder/intellisense/formatters.py | format_info | def format_info(raw):
"""Format a string representing the information
concerning the name.
"""
logging.debug(_('raw[0]: %s'), raw[0])
results, sense = raw
# A scenario where ORM really stands out.
new = '\n'.join(
'{} {} {} {}'.format(
i[0], sense.kind_id_to_name(i[1]),
... | python | def format_info(raw):
"""Format a string representing the information
concerning the name.
"""
logging.debug(_('raw[0]: %s'), raw[0])
results, sense = raw
# A scenario where ORM really stands out.
new = '\n'.join(
'{} {} {} {}'.format(
i[0], sense.kind_id_to_name(i[1]),
... | [
"def",
"format_info",
"(",
"raw",
")",
":",
"logging",
".",
"debug",
"(",
"_",
"(",
"'raw[0]: %s'",
")",
",",
"raw",
"[",
"0",
"]",
")",
"results",
",",
"sense",
"=",
"raw",
"new",
"=",
"'\\n'",
".",
"join",
"(",
"'{} {} {} {}'",
".",
"format",
"("... | Format a string representing the information
concerning the name. | [
"Format",
"a",
"string",
"representing",
"the",
"information",
"concerning",
"the",
"name",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/formatters.py#L59-L72 | train |
NoviceLive/intellicoder | intellicoder/intellisense/formatters.py | format_names | def format_names(raw):
"""Format a string representing the names contained in the files.
"""
if raw:
raw = [
'{}:\n{}'.format(
header.lower(), ' '.join(func[0] for func in funcs)
)
for header, funcs in raw
]
return '\n'.join(raw)
... | python | def format_names(raw):
"""Format a string representing the names contained in the files.
"""
if raw:
raw = [
'{}:\n{}'.format(
header.lower(), ' '.join(func[0] for func in funcs)
)
for header, funcs in raw
]
return '\n'.join(raw)
... | [
"def",
"format_names",
"(",
"raw",
")",
":",
"if",
"raw",
":",
"raw",
"=",
"[",
"'{}:\\n{}'",
".",
"format",
"(",
"header",
".",
"lower",
"(",
")",
",",
"' '",
".",
"join",
"(",
"func",
"[",
"0",
"]",
"for",
"func",
"in",
"funcs",
")",
")",
"fo... | Format a string representing the names contained in the files. | [
"Format",
"a",
"string",
"representing",
"the",
"names",
"contained",
"in",
"the",
"files",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/formatters.py#L75-L86 | train |
NoviceLive/intellicoder | intellicoder/intellisense/formatters.py | format_kinds | def format_kinds(raw):
"""Format a string representing the kinds."""
output = ' '.join('{} {}'.format(*kind) for kind in raw if kind)
return output | python | def format_kinds(raw):
"""Format a string representing the kinds."""
output = ' '.join('{} {}'.format(*kind) for kind in raw if kind)
return output | [
"def",
"format_kinds",
"(",
"raw",
")",
":",
"output",
"=",
"' '",
".",
"join",
"(",
"'{} {}'",
".",
"format",
"(",
"*",
"kind",
")",
"for",
"kind",
"in",
"raw",
"if",
"kind",
")",
"return",
"output"
] | Format a string representing the kinds. | [
"Format",
"a",
"string",
"representing",
"the",
"kinds",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/intellisense/formatters.py#L89-L92 | train |
etal/biocma | biocma/utils.py | find_seq_rec | def find_seq_rec(block, name, case_sensitive=True):
"""Given part of a sequence ID, find the first matching record."""
if case_sensitive:
def test(name, rec):
return name in rec['id']
else:
def test(name, rec):
return name.upper() in rec['id'].upper()
for rec in ... | python | def find_seq_rec(block, name, case_sensitive=True):
"""Given part of a sequence ID, find the first matching record."""
if case_sensitive:
def test(name, rec):
return name in rec['id']
else:
def test(name, rec):
return name.upper() in rec['id'].upper()
for rec in ... | [
"def",
"find_seq_rec",
"(",
"block",
",",
"name",
",",
"case_sensitive",
"=",
"True",
")",
":",
"if",
"case_sensitive",
":",
"def",
"test",
"(",
"name",
",",
"rec",
")",
":",
"return",
"name",
"in",
"rec",
"[",
"'id'",
"]",
"else",
":",
"def",
"test"... | Given part of a sequence ID, find the first matching record. | [
"Given",
"part",
"of",
"a",
"sequence",
"ID",
"find",
"the",
"first",
"matching",
"record",
"."
] | eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7 | https://github.com/etal/biocma/blob/eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7/biocma/utils.py#L6-L18 | train |
etal/biocma | biocma/utils.py | find_seq_id | def find_seq_id(block, name, case_sensitive=True):
"""Given part of a sequence ID, find the first actual ID that contains it.
Example::
>>> find_seq_id(block, '2QG5')
'gi|158430190|pdb|2QG5|A'
Raise a ValueError if no matching key is found.
"""
# logging.warn("DEPRECATED: Try to u... | python | def find_seq_id(block, name, case_sensitive=True):
"""Given part of a sequence ID, find the first actual ID that contains it.
Example::
>>> find_seq_id(block, '2QG5')
'gi|158430190|pdb|2QG5|A'
Raise a ValueError if no matching key is found.
"""
# logging.warn("DEPRECATED: Try to u... | [
"def",
"find_seq_id",
"(",
"block",
",",
"name",
",",
"case_sensitive",
"=",
"True",
")",
":",
"rec",
"=",
"find_seq_rec",
"(",
"block",
",",
"name",
",",
"case_sensitive",
")",
"return",
"rec",
"[",
"'id'",
"]"
] | Given part of a sequence ID, find the first actual ID that contains it.
Example::
>>> find_seq_id(block, '2QG5')
'gi|158430190|pdb|2QG5|A'
Raise a ValueError if no matching key is found. | [
"Given",
"part",
"of",
"a",
"sequence",
"ID",
"find",
"the",
"first",
"actual",
"ID",
"that",
"contains",
"it",
"."
] | eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7 | https://github.com/etal/biocma/blob/eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7/biocma/utils.py#L21-L33 | train |
etal/biocma | biocma/utils.py | get_consensus | def get_consensus(block):
"""Calculate a simple consensus sequence for the block."""
from collections import Counter
# Take aligned (non-insert) chars from all rows; transpose
columns = zip(*[[c for c in row['seq'] if not c.islower()]
for row in block['sequences']])
cons_chars =... | python | def get_consensus(block):
"""Calculate a simple consensus sequence for the block."""
from collections import Counter
# Take aligned (non-insert) chars from all rows; transpose
columns = zip(*[[c for c in row['seq'] if not c.islower()]
for row in block['sequences']])
cons_chars =... | [
"def",
"get_consensus",
"(",
"block",
")",
":",
"from",
"collections",
"import",
"Counter",
"columns",
"=",
"zip",
"(",
"*",
"[",
"[",
"c",
"for",
"c",
"in",
"row",
"[",
"'seq'",
"]",
"if",
"not",
"c",
".",
"islower",
"(",
")",
"]",
"for",
"row",
... | Calculate a simple consensus sequence for the block. | [
"Calculate",
"a",
"simple",
"consensus",
"sequence",
"for",
"the",
"block",
"."
] | eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7 | https://github.com/etal/biocma/blob/eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7/biocma/utils.py#L36-L60 | train |
etal/biocma | biocma/utils.py | get_conservation | def get_conservation(block):
"""Calculate conservation levels at each consensus position.
Return a dict of {position: float conservation}
"""
consensus = block['sequences'][0]['seq']
assert all(c.isupper() for c in consensus), \
"So-called consensus contains indels!"
# remove all no... | python | def get_conservation(block):
"""Calculate conservation levels at each consensus position.
Return a dict of {position: float conservation}
"""
consensus = block['sequences'][0]['seq']
assert all(c.isupper() for c in consensus), \
"So-called consensus contains indels!"
# remove all no... | [
"def",
"get_conservation",
"(",
"block",
")",
":",
"consensus",
"=",
"block",
"[",
"'sequences'",
"]",
"[",
"0",
"]",
"[",
"'seq'",
"]",
"assert",
"all",
"(",
"c",
".",
"isupper",
"(",
")",
"for",
"c",
"in",
"consensus",
")",
",",
"\"So-called consensu... | Calculate conservation levels at each consensus position.
Return a dict of {position: float conservation} | [
"Calculate",
"conservation",
"levels",
"at",
"each",
"consensus",
"position",
"."
] | eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7 | https://github.com/etal/biocma/blob/eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7/biocma/utils.py#L63-L84 | train |
etal/biocma | biocma/utils.py | get_equivalent_positions | def get_equivalent_positions(block):
"""Create a mapping of equivalent residue positions to consensus.
Build a dict-of-dicts::
{consensus-posn: {id: equiv-posn, id: equiv-posn, ...}, ...}
The first sequence in the alignment is assumed to be the (gapless) consensus
sequence.
"""
consen... | python | def get_equivalent_positions(block):
"""Create a mapping of equivalent residue positions to consensus.
Build a dict-of-dicts::
{consensus-posn: {id: equiv-posn, id: equiv-posn, ...}, ...}
The first sequence in the alignment is assumed to be the (gapless) consensus
sequence.
"""
consen... | [
"def",
"get_equivalent_positions",
"(",
"block",
")",
":",
"consensus",
"=",
"block",
"[",
"'sequences'",
"]",
"[",
"0",
"]",
"[",
"'seq'",
"]",
"rest",
"=",
"block",
"[",
"'sequences'",
"]",
"[",
"1",
":",
"]",
"if",
"'-'",
"in",
"consensus",
"or",
... | Create a mapping of equivalent residue positions to consensus.
Build a dict-of-dicts::
{consensus-posn: {id: equiv-posn, id: equiv-posn, ...}, ...}
The first sequence in the alignment is assumed to be the (gapless) consensus
sequence. | [
"Create",
"a",
"mapping",
"of",
"equivalent",
"residue",
"positions",
"to",
"consensus",
"."
] | eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7 | https://github.com/etal/biocma/blob/eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7/biocma/utils.py#L87-L156 | train |
etal/biocma | biocma/utils.py | get_inserts | def get_inserts(block):
"""Identify the inserts in sequence in a block.
Inserts are relative to the consensus (theoretically), and identified by
lowercase letters in the sequence. The returned integer pairs represent the
insert start and end positions in the full-length sequence, using one-based
nu... | python | def get_inserts(block):
"""Identify the inserts in sequence in a block.
Inserts are relative to the consensus (theoretically), and identified by
lowercase letters in the sequence. The returned integer pairs represent the
insert start and end positions in the full-length sequence, using one-based
nu... | [
"def",
"get_inserts",
"(",
"block",
")",
":",
"def",
"find_inserts",
"(",
"seq",
",",
"head_len",
")",
":",
"in_insert",
"=",
"False",
"curr_start",
"=",
"None",
"deletions",
"=",
"0",
"for",
"idx",
",",
"is_lower",
"in",
"enumerate",
"(",
"map",
"(",
... | Identify the inserts in sequence in a block.
Inserts are relative to the consensus (theoretically), and identified by
lowercase letters in the sequence. The returned integer pairs represent the
insert start and end positions in the full-length sequence, using one-based
numbering.
The first sequenc... | [
"Identify",
"the",
"inserts",
"in",
"sequence",
"in",
"a",
"block",
"."
] | eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7 | https://github.com/etal/biocma/blob/eac0c57eb83a9498e53ccdeb9cbc3fe21a5826a7/biocma/utils.py#L159-L200 | train |
computational-metabolomics/msp2db | msp2db/re.py | get_meta_regex | def get_meta_regex(schema='mona'):
""" Create a dictionary of regex for extracting the meta data for the spectra
"""
# NOTE: will just ignore cases, to avoid repetition here
meta_parse = collections.OrderedDict()
if schema == 'mona':
meta_parse['collision_energy'] = ['^collision energy(?:=|... | python | def get_meta_regex(schema='mona'):
""" Create a dictionary of regex for extracting the meta data for the spectra
"""
# NOTE: will just ignore cases, to avoid repetition here
meta_parse = collections.OrderedDict()
if schema == 'mona':
meta_parse['collision_energy'] = ['^collision energy(?:=|... | [
"def",
"get_meta_regex",
"(",
"schema",
"=",
"'mona'",
")",
":",
"meta_parse",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"if",
"schema",
"==",
"'mona'",
":",
"meta_parse",
"[",
"'collision_energy'",
"]",
"=",
"[",
"'^collision energy(?:=|:)(.*)$'",
"]",
... | Create a dictionary of regex for extracting the meta data for the spectra | [
"Create",
"a",
"dictionary",
"of",
"regex",
"for",
"extracting",
"the",
"meta",
"data",
"for",
"the",
"spectra"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/re.py#L5-L57 | train |
computational-metabolomics/msp2db | msp2db/re.py | get_compound_regex | def get_compound_regex(schema='mona'):
""" Create a dictionary of regex for extracting the compound information for the spectra
"""
# NOTE: will just ignore cases in the regex, to avoid repetition here
meta_parse = collections.OrderedDict()
if schema == 'mona':
meta_parse['name'] = ['^Name... | python | def get_compound_regex(schema='mona'):
""" Create a dictionary of regex for extracting the compound information for the spectra
"""
# NOTE: will just ignore cases in the regex, to avoid repetition here
meta_parse = collections.OrderedDict()
if schema == 'mona':
meta_parse['name'] = ['^Name... | [
"def",
"get_compound_regex",
"(",
"schema",
"=",
"'mona'",
")",
":",
"meta_parse",
"=",
"collections",
".",
"OrderedDict",
"(",
")",
"if",
"schema",
"==",
"'mona'",
":",
"meta_parse",
"[",
"'name'",
"]",
"=",
"[",
"'^Name(?:=|:)(.*)$'",
"]",
"meta_parse",
"[... | Create a dictionary of regex for extracting the compound information for the spectra | [
"Create",
"a",
"dictionary",
"of",
"regex",
"for",
"extracting",
"the",
"compound",
"information",
"for",
"the",
"spectra"
] | f86f01efca26fd2745547c9993f97337c6bef123 | https://github.com/computational-metabolomics/msp2db/blob/f86f01efca26fd2745547c9993f97337c6bef123/msp2db/re.py#L60-L91 | train |
lowandrew/OLCTools | coreGenome/coretyper.py | CoreTyper.handler | def handler(self):
"""Run the required analyses"""
printtime('Creating and populating objects', self.start)
self.populate()
printtime('Populating {} sequence profiles'.format(self.analysistype), self.start)
self.profiler()
# Annotate sequences with prokka
self.ann... | python | def handler(self):
"""Run the required analyses"""
printtime('Creating and populating objects', self.start)
self.populate()
printtime('Populating {} sequence profiles'.format(self.analysistype), self.start)
self.profiler()
# Annotate sequences with prokka
self.ann... | [
"def",
"handler",
"(",
"self",
")",
":",
"printtime",
"(",
"'Creating and populating objects'",
",",
"self",
".",
"start",
")",
"self",
".",
"populate",
"(",
")",
"printtime",
"(",
"'Populating {} sequence profiles'",
".",
"format",
"(",
"self",
".",
"analysisty... | Run the required analyses | [
"Run",
"the",
"required",
"analyses"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/coretyper.py#L19-L38 | train |
lowandrew/OLCTools | coreGenome/coretyper.py | CoreTyper.annotatethreads | def annotatethreads(self):
"""
Use prokka to annotate each strain
"""
# Move the files to subfolders and create objects
self.runmetadata = createobject.ObjectCreation(self)
# Fix headers
self.headers()
printtime('Performing prokka analyses', self.start)
... | python | def annotatethreads(self):
"""
Use prokka to annotate each strain
"""
# Move the files to subfolders and create objects
self.runmetadata = createobject.ObjectCreation(self)
# Fix headers
self.headers()
printtime('Performing prokka analyses', self.start)
... | [
"def",
"annotatethreads",
"(",
"self",
")",
":",
"self",
".",
"runmetadata",
"=",
"createobject",
".",
"ObjectCreation",
"(",
"self",
")",
"self",
".",
"headers",
"(",
")",
"printtime",
"(",
"'Performing prokka analyses'",
",",
"self",
".",
"start",
")",
"fo... | Use prokka to annotate each strain | [
"Use",
"prokka",
"to",
"annotate",
"each",
"strain"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/coretyper.py#L100-L139 | train |
lowandrew/OLCTools | coreGenome/coretyper.py | CoreTyper.cdsthreads | def cdsthreads(self):
"""
Determines which core genes from a pre-calculated database are present in each strain
"""
# Create and start threads
for i in range(self.cpus):
# Send the threads to the appropriate destination function
threads = Thread(target=sel... | python | def cdsthreads(self):
"""
Determines which core genes from a pre-calculated database are present in each strain
"""
# Create and start threads
for i in range(self.cpus):
# Send the threads to the appropriate destination function
threads = Thread(target=sel... | [
"def",
"cdsthreads",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"cpus",
")",
":",
"threads",
"=",
"Thread",
"(",
"target",
"=",
"self",
".",
"cds",
",",
"args",
"=",
"(",
")",
")",
"threads",
".",
"setDaemon",
"(",
"True"... | Determines which core genes from a pre-calculated database are present in each strain | [
"Determines",
"which",
"core",
"genes",
"from",
"a",
"pre",
"-",
"calculated",
"database",
"are",
"present",
"in",
"each",
"strain"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/coretyper.py#L207-L223 | train |
lowandrew/OLCTools | coreGenome/coretyper.py | CoreTyper.cdssequencethreads | def cdssequencethreads(self):
"""
Extracts the sequence of each gene for each strain
"""
# Create and start threads
for i in range(self.cpus):
# Send the threads to the appropriate destination function
threads = Thread(target=self.cdssequence, args=())
... | python | def cdssequencethreads(self):
"""
Extracts the sequence of each gene for each strain
"""
# Create and start threads
for i in range(self.cpus):
# Send the threads to the appropriate destination function
threads = Thread(target=self.cdssequence, args=())
... | [
"def",
"cdssequencethreads",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"cpus",
")",
":",
"threads",
"=",
"Thread",
"(",
"target",
"=",
"self",
".",
"cdssequence",
",",
"args",
"=",
"(",
")",
")",
"threads",
".",
"setDaemon",... | Extracts the sequence of each gene for each strain | [
"Extracts",
"the",
"sequence",
"of",
"each",
"gene",
"for",
"each",
"strain"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/coretyper.py#L247-L263 | train |
lowandrew/OLCTools | coreGenome/coretyper.py | CoreTyper.allelematchthreads | def allelematchthreads(self):
"""
Determine allele of each gene
"""
# Create and start threads
for i in range(self.cpus):
# Send the threads to the appropriate destination function
threads = Thread(target=self.allelematch, args=())
# Set the da... | python | def allelematchthreads(self):
"""
Determine allele of each gene
"""
# Create and start threads
for i in range(self.cpus):
# Send the threads to the appropriate destination function
threads = Thread(target=self.allelematch, args=())
# Set the da... | [
"def",
"allelematchthreads",
"(",
"self",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"cpus",
")",
":",
"threads",
"=",
"Thread",
"(",
"target",
"=",
"self",
".",
"allelematch",
",",
"args",
"=",
"(",
")",
")",
"threads",
".",
"setDaemon",... | Determine allele of each gene | [
"Determine",
"allele",
"of",
"each",
"gene"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/coreGenome/coretyper.py#L274-L289 | train |
by46/simplekit | simplekit/url/path.py | remove_path_segments | def remove_path_segments(segments, removes):
"""Removes the removes from the tail of segments.
Examples::
>>> # '/a/b/c' - 'b/c' == '/a/'
>>> assert remove_path_segments(['', 'a', 'b', 'c'], ['b', 'c']) == ['', 'a', '']
>>> # '/a/b/c' - '/b/c' == '/a
>>> assert remove_path_segme... | python | def remove_path_segments(segments, removes):
"""Removes the removes from the tail of segments.
Examples::
>>> # '/a/b/c' - 'b/c' == '/a/'
>>> assert remove_path_segments(['', 'a', 'b', 'c'], ['b', 'c']) == ['', 'a', '']
>>> # '/a/b/c' - '/b/c' == '/a
>>> assert remove_path_segme... | [
"def",
"remove_path_segments",
"(",
"segments",
",",
"removes",
")",
":",
"if",
"segments",
"==",
"[",
"''",
"]",
":",
"segments",
".",
"append",
"(",
"''",
")",
"if",
"removes",
"==",
"[",
"''",
"]",
":",
"removes",
".",
"append",
"(",
"''",
")",
... | Removes the removes from the tail of segments.
Examples::
>>> # '/a/b/c' - 'b/c' == '/a/'
>>> assert remove_path_segments(['', 'a', 'b', 'c'], ['b', 'c']) == ['', 'a', '']
>>> # '/a/b/c' - '/b/c' == '/a
>>> assert remove_path_segments(['', 'a', 'b', 'c'], ['', 'b', 'c']) == ['', 'a'... | [
"Removes",
"the",
"removes",
"from",
"the",
"tail",
"of",
"segments",
"."
] | 33f3ce6de33accc185e1057f096af41859db5976 | https://github.com/by46/simplekit/blob/33f3ce6de33accc185e1057f096af41859db5976/simplekit/url/path.py#L9-L48 | train |
by46/simplekit | simplekit/url/path.py | join_path_segments | def join_path_segments(*args):
"""Join multiple list of path segments
This function is not encoding aware, it does not test for, or changed the
encoding of the path segments it's passed.
Example::
>>> assert join_path_segments(['a'], ['b']) == ['a','b']
>>> assert join_path_segments(['... | python | def join_path_segments(*args):
"""Join multiple list of path segments
This function is not encoding aware, it does not test for, or changed the
encoding of the path segments it's passed.
Example::
>>> assert join_path_segments(['a'], ['b']) == ['a','b']
>>> assert join_path_segments(['... | [
"def",
"join_path_segments",
"(",
"*",
"args",
")",
":",
"finals",
"=",
"[",
"]",
"for",
"segments",
"in",
"args",
":",
"if",
"not",
"segments",
"or",
"segments",
"[",
"0",
"]",
"==",
"[",
"''",
"]",
":",
"continue",
"elif",
"not",
"finals",
":",
"... | Join multiple list of path segments
This function is not encoding aware, it does not test for, or changed the
encoding of the path segments it's passed.
Example::
>>> assert join_path_segments(['a'], ['b']) == ['a','b']
>>> assert join_path_segments(['a',''], ['b']) == ['a','b']
>>... | [
"Join",
"multiple",
"list",
"of",
"path",
"segments"
] | 33f3ce6de33accc185e1057f096af41859db5976 | https://github.com/by46/simplekit/blob/33f3ce6de33accc185e1057f096af41859db5976/simplekit/url/path.py#L52-L83 | train |
portfors-lab/sparkle | sparkle/data/acqdata.py | increment | def increment(index, dims, data_shape):
"""Increments a given index according to the shape of the data added
:param index: Current index to be incremented
:type index: list
:param dims: Shape of the data that the index is being incremented by
:type dims: tuple
:param data_shape: Shape of the da... | python | def increment(index, dims, data_shape):
"""Increments a given index according to the shape of the data added
:param index: Current index to be incremented
:type index: list
:param dims: Shape of the data that the index is being incremented by
:type dims: tuple
:param data_shape: Shape of the da... | [
"def",
"increment",
"(",
"index",
",",
"dims",
",",
"data_shape",
")",
":",
"inc_to_match",
"=",
"data_shape",
"[",
"1",
":",
"]",
"for",
"dim_a",
",",
"dim_b",
"in",
"zip",
"(",
"inc_to_match",
",",
"dims",
"[",
"-",
"1",
"*",
"(",
"len",
"(",
"in... | Increments a given index according to the shape of the data added
:param index: Current index to be incremented
:type index: list
:param dims: Shape of the data that the index is being incremented by
:type dims: tuple
:param data_shape: Shape of the data structure being incremented, this is check t... | [
"Increments",
"a",
"given",
"index",
"according",
"to",
"the",
"shape",
"of",
"the",
"data",
"added"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/data/acqdata.py#L231-L262 | train |
klahnakoski/mo-logs | mo_logs/__init__.py | Log.error | def error(
cls,
template, # human readable template
default_params={}, # parameters for template
cause=None, # pausible cause
stack_depth=0,
**more_params
):
"""
raise an exception with a trace for the cause too
:param template: *string* hu... | python | def error(
cls,
template, # human readable template
default_params={}, # parameters for template
cause=None, # pausible cause
stack_depth=0,
**more_params
):
"""
raise an exception with a trace for the cause too
:param template: *string* hu... | [
"def",
"error",
"(",
"cls",
",",
"template",
",",
"default_params",
"=",
"{",
"}",
",",
"cause",
"=",
"None",
",",
"stack_depth",
"=",
"0",
",",
"**",
"more_params",
")",
":",
"if",
"not",
"is_text",
"(",
"template",
")",
":",
"sys",
".",
"stderr",
... | raise an exception with a trace for the cause too
:param template: *string* human readable string with placeholders for parameters
:param default_params: *dict* parameters to fill in template
:param cause: *Exception* for chaining
:param stack_depth: *int* how many calls you want poppe... | [
"raise",
"an",
"exception",
"with",
"a",
"trace",
"for",
"the",
"cause",
"too"
] | 0971277ac9caf28a755b766b70621916957d4fea | https://github.com/klahnakoski/mo-logs/blob/0971277ac9caf28a755b766b70621916957d4fea/mo_logs/__init__.py#L305-L354 | train |
TorkamaniLab/metapipe | metapipe/models/command_template.py | _get_parts_list | def _get_parts_list(to_go, so_far=[[]], ticker=None):
""" Iterates over to_go, building the list of parts. To provide
items for the beginning, use so_far.
"""
try:
part = to_go.pop(0)
except IndexError:
return so_far, ticker
# Lists of input groups
if isinstance(part, list) ... | python | def _get_parts_list(to_go, so_far=[[]], ticker=None):
""" Iterates over to_go, building the list of parts. To provide
items for the beginning, use so_far.
"""
try:
part = to_go.pop(0)
except IndexError:
return so_far, ticker
# Lists of input groups
if isinstance(part, list) ... | [
"def",
"_get_parts_list",
"(",
"to_go",
",",
"so_far",
"=",
"[",
"[",
"]",
"]",
",",
"ticker",
"=",
"None",
")",
":",
"try",
":",
"part",
"=",
"to_go",
".",
"pop",
"(",
"0",
")",
"except",
"IndexError",
":",
"return",
"so_far",
",",
"ticker",
"if",... | Iterates over to_go, building the list of parts. To provide
items for the beginning, use so_far. | [
"Iterates",
"over",
"to_go",
"building",
"the",
"list",
"of",
"parts",
".",
"To",
"provide",
"items",
"for",
"the",
"beginning",
"use",
"so_far",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/command_template.py#L74-L105 | train |
TorkamaniLab/metapipe | metapipe/models/command_template.py | _get_max_size | def _get_max_size(parts, size=1):
""" Given a list of parts, find the maximum number of commands
contained in it.
"""
max_group_size = 0
for part in parts:
if isinstance(part, list):
group_size = 0
for input_group in part:
group_size += 1
... | python | def _get_max_size(parts, size=1):
""" Given a list of parts, find the maximum number of commands
contained in it.
"""
max_group_size = 0
for part in parts:
if isinstance(part, list):
group_size = 0
for input_group in part:
group_size += 1
... | [
"def",
"_get_max_size",
"(",
"parts",
",",
"size",
"=",
"1",
")",
":",
"max_group_size",
"=",
"0",
"for",
"part",
"in",
"parts",
":",
"if",
"isinstance",
"(",
"part",
",",
"list",
")",
":",
"group_size",
"=",
"0",
"for",
"input_group",
"in",
"part",
... | Given a list of parts, find the maximum number of commands
contained in it. | [
"Given",
"a",
"list",
"of",
"parts",
"find",
"the",
"maximum",
"number",
"of",
"commands",
"contained",
"in",
"it",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/command_template.py#L108-L123 | train |
TorkamaniLab/metapipe | metapipe/models/command_template.py | _grow | def _grow(list_of_lists, num_new):
""" Given a list of lists, and a number of new lists to add, copy the
content of the first list into the new ones, and add them to the list
of lists.
"""
first = list_of_lists[0]
for i in range(num_new):
list_of_lists.append(copy.deepcopy(first))
re... | python | def _grow(list_of_lists, num_new):
""" Given a list of lists, and a number of new lists to add, copy the
content of the first list into the new ones, and add them to the list
of lists.
"""
first = list_of_lists[0]
for i in range(num_new):
list_of_lists.append(copy.deepcopy(first))
re... | [
"def",
"_grow",
"(",
"list_of_lists",
",",
"num_new",
")",
":",
"first",
"=",
"list_of_lists",
"[",
"0",
"]",
"for",
"i",
"in",
"range",
"(",
"num_new",
")",
":",
"list_of_lists",
".",
"append",
"(",
"copy",
".",
"deepcopy",
"(",
"first",
")",
")",
"... | Given a list of lists, and a number of new lists to add, copy the
content of the first list into the new ones, and add them to the list
of lists. | [
"Given",
"a",
"list",
"of",
"lists",
"and",
"a",
"number",
"of",
"new",
"lists",
"to",
"add",
"copy",
"the",
"content",
"of",
"the",
"first",
"list",
"into",
"the",
"new",
"ones",
"and",
"add",
"them",
"to",
"the",
"list",
"of",
"lists",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/command_template.py#L144-L152 | train |
TorkamaniLab/metapipe | metapipe/models/command_template.py | _search_for_files | def _search_for_files(parts):
""" Given a list of parts, return all of the nested file parts. """
file_parts = []
for part in parts:
if isinstance(part, list):
file_parts.extend(_search_for_files(part))
elif isinstance(part, FileToken):
file_parts.append(part)
ret... | python | def _search_for_files(parts):
""" Given a list of parts, return all of the nested file parts. """
file_parts = []
for part in parts:
if isinstance(part, list):
file_parts.extend(_search_for_files(part))
elif isinstance(part, FileToken):
file_parts.append(part)
ret... | [
"def",
"_search_for_files",
"(",
"parts",
")",
":",
"file_parts",
"=",
"[",
"]",
"for",
"part",
"in",
"parts",
":",
"if",
"isinstance",
"(",
"part",
",",
"list",
")",
":",
"file_parts",
".",
"extend",
"(",
"_search_for_files",
"(",
"part",
")",
")",
"e... | Given a list of parts, return all of the nested file parts. | [
"Given",
"a",
"list",
"of",
"parts",
"return",
"all",
"of",
"the",
"nested",
"file",
"parts",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/command_template.py#L155-L163 | train |
TorkamaniLab/metapipe | metapipe/models/command_template.py | CommandTemplate.eval | def eval(self):
""" Returns a list of Command objects that can be evaluated as their
string values. Each command will track it's preliminary dependencies,
but these values should not be depended on for running commands.
"""
max_size = _get_max_size(self.parts)
parts_list ... | python | def eval(self):
""" Returns a list of Command objects that can be evaluated as their
string values. Each command will track it's preliminary dependencies,
but these values should not be depended on for running commands.
"""
max_size = _get_max_size(self.parts)
parts_list ... | [
"def",
"eval",
"(",
"self",
")",
":",
"max_size",
"=",
"_get_max_size",
"(",
"self",
".",
"parts",
")",
"parts_list",
"=",
"_grow",
"(",
"[",
"[",
"]",
"]",
",",
"max_size",
"-",
"1",
")",
"counter",
"=",
"Ticker",
"(",
"max_size",
")",
"parts",
"=... | Returns a list of Command objects that can be evaluated as their
string values. Each command will track it's preliminary dependencies,
but these values should not be depended on for running commands. | [
"Returns",
"a",
"list",
"of",
"Command",
"objects",
"that",
"can",
"be",
"evaluated",
"as",
"their",
"string",
"values",
".",
"Each",
"command",
"will",
"track",
"it",
"s",
"preliminary",
"dependencies",
"but",
"these",
"values",
"should",
"not",
"be",
"depe... | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/command_template.py#L48-L67 | train |
hkupty/asterix | asterix/core.py | start_system | def start_system(components, bind_to, hooks={}):
"""Start all components on component map."""
deps = build_deps_graph(components)
started_components = start_components(components, deps, None)
run_hooks(hooks, started_components)
if type(bind_to) is str:
master = started_components[bind_to]... | python | def start_system(components, bind_to, hooks={}):
"""Start all components on component map."""
deps = build_deps_graph(components)
started_components = start_components(components, deps, None)
run_hooks(hooks, started_components)
if type(bind_to) is str:
master = started_components[bind_to]... | [
"def",
"start_system",
"(",
"components",
",",
"bind_to",
",",
"hooks",
"=",
"{",
"}",
")",
":",
"deps",
"=",
"build_deps_graph",
"(",
"components",
")",
"started_components",
"=",
"start_components",
"(",
"components",
",",
"deps",
",",
"None",
")",
"run_ho... | Start all components on component map. | [
"Start",
"all",
"components",
"on",
"component",
"map",
"."
] | 809ee5b02a29e38889c5bd4eb5f0859da0703d0c | https://github.com/hkupty/asterix/blob/809ee5b02a29e38889c5bd4eb5f0859da0703d0c/asterix/core.py#L48-L61 | train |
portfors-lab/sparkle | sparkle/stim/auto_parameter_model.py | AutoParameterModel.ranges | def ranges(self):
"""The expanded lists of values generated from the parameter fields
:returns: list<list>, outer list is for each parameter, inner loops are that
parameter's values to loop through
"""
steps = []
for p in self._parameters:
# inclusive range
... | python | def ranges(self):
"""The expanded lists of values generated from the parameter fields
:returns: list<list>, outer list is for each parameter, inner loops are that
parameter's values to loop through
"""
steps = []
for p in self._parameters:
# inclusive range
... | [
"def",
"ranges",
"(",
"self",
")",
":",
"steps",
"=",
"[",
"]",
"for",
"p",
"in",
"self",
".",
"_parameters",
":",
"if",
"p",
"[",
"'parameter'",
"]",
"==",
"'filename'",
":",
"steps",
".",
"append",
"(",
"p",
"[",
"'names'",
"]",
")",
"else",
":... | The expanded lists of values generated from the parameter fields
:returns: list<list>, outer list is for each parameter, inner loops are that
parameter's values to loop through | [
"The",
"expanded",
"lists",
"of",
"values",
"generated",
"from",
"the",
"parameter",
"fields"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/auto_parameter_model.py#L301-L335 | train |
portfors-lab/sparkle | sparkle/stim/auto_parameter_model.py | AutoParameterModel._selectionParameters | def _selectionParameters(self, param):
"""see docstring for selectedParameterTypes"""
components = param['selection']
if len(components) == 0:
return []
# extract the selected component names
editable_sets = []
for comp in components:
# all the key... | python | def _selectionParameters(self, param):
"""see docstring for selectedParameterTypes"""
components = param['selection']
if len(components) == 0:
return []
# extract the selected component names
editable_sets = []
for comp in components:
# all the key... | [
"def",
"_selectionParameters",
"(",
"self",
",",
"param",
")",
":",
"components",
"=",
"param",
"[",
"'selection'",
"]",
"if",
"len",
"(",
"components",
")",
"==",
"0",
":",
"return",
"[",
"]",
"editable_sets",
"=",
"[",
"]",
"for",
"comp",
"in",
"comp... | see docstring for selectedParameterTypes | [
"see",
"docstring",
"for",
"selectedParameterTypes"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/auto_parameter_model.py#L337-L350 | train |
portfors-lab/sparkle | sparkle/stim/auto_parameter_model.py | AutoParameterModel.updateComponentStartVals | def updateComponentStartVals(self):
"""Go through selected components for each auto parameter and set the start value"""
for param in self._parameters:
for component in param['selection']:
if param['parameter'] == 'filename':
component.set(param['parameter... | python | def updateComponentStartVals(self):
"""Go through selected components for each auto parameter and set the start value"""
for param in self._parameters:
for component in param['selection']:
if param['parameter'] == 'filename':
component.set(param['parameter... | [
"def",
"updateComponentStartVals",
"(",
"self",
")",
":",
"for",
"param",
"in",
"self",
".",
"_parameters",
":",
"for",
"component",
"in",
"param",
"[",
"'selection'",
"]",
":",
"if",
"param",
"[",
"'parameter'",
"]",
"==",
"'filename'",
":",
"component",
... | Go through selected components for each auto parameter and set the start value | [
"Go",
"through",
"selected",
"components",
"for",
"each",
"auto",
"parameter",
"and",
"set",
"the",
"start",
"value"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/auto_parameter_model.py#L352-L359 | train |
portfors-lab/sparkle | sparkle/stim/auto_parameter_model.py | AutoParameterModel.verify | def verify(self):
"""Checks all parameters for invalidating conditions
:returns: str -- message if error, 0 otherwise
"""
for row in range(self.nrows()):
result = self.verify_row(row)
if result != 0:
return result
return 0 | python | def verify(self):
"""Checks all parameters for invalidating conditions
:returns: str -- message if error, 0 otherwise
"""
for row in range(self.nrows()):
result = self.verify_row(row)
if result != 0:
return result
return 0 | [
"def",
"verify",
"(",
"self",
")",
":",
"for",
"row",
"in",
"range",
"(",
"self",
".",
"nrows",
"(",
")",
")",
":",
"result",
"=",
"self",
".",
"verify_row",
"(",
"row",
")",
"if",
"result",
"!=",
"0",
":",
"return",
"result",
"return",
"0"
] | Checks all parameters for invalidating conditions
:returns: str -- message if error, 0 otherwise | [
"Checks",
"all",
"parameters",
"for",
"invalidating",
"conditions"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/auto_parameter_model.py#L381-L390 | train |
yamcs/yamcs-python | yamcs-client/examples/query_mdb.py | find_parameter | def find_parameter():
"""Find one parameter."""
p1 = mdb.get_parameter('/YSS/SIMULATOR/BatteryVoltage2')
print('Via qualified name:', p1)
p2 = mdb.get_parameter('MDB:OPS Name/SIMULATOR_BatteryVoltage2')
print('Via domain-specific alias:', p2) | python | def find_parameter():
"""Find one parameter."""
p1 = mdb.get_parameter('/YSS/SIMULATOR/BatteryVoltage2')
print('Via qualified name:', p1)
p2 = mdb.get_parameter('MDB:OPS Name/SIMULATOR_BatteryVoltage2')
print('Via domain-specific alias:', p2) | [
"def",
"find_parameter",
"(",
")",
":",
"p1",
"=",
"mdb",
".",
"get_parameter",
"(",
"'/YSS/SIMULATOR/BatteryVoltage2'",
")",
"print",
"(",
"'Via qualified name:'",
",",
"p1",
")",
"p2",
"=",
"mdb",
".",
"get_parameter",
"(",
"'MDB:OPS Name/SIMULATOR_BatteryVoltage2... | Find one parameter. | [
"Find",
"one",
"parameter",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/examples/query_mdb.py#L24-L30 | train |
lowandrew/OLCTools | spadespipeline/mobrecon.py | MobRecon.summary_reporter | def summary_reporter(self):
"""
Parse individual MOB Recon reports into a summary report
"""
logging.info('Creating MOB-recon summary report')
with open(os.path.join(self.reportpath, 'mob_recon_summary.csv'), 'w') as summary:
data = 'Strain,Location,Contig,Incompatibi... | python | def summary_reporter(self):
"""
Parse individual MOB Recon reports into a summary report
"""
logging.info('Creating MOB-recon summary report')
with open(os.path.join(self.reportpath, 'mob_recon_summary.csv'), 'w') as summary:
data = 'Strain,Location,Contig,Incompatibi... | [
"def",
"summary_reporter",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Creating MOB-recon summary report'",
")",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"reportpath",
",",
"'mob_recon_summary.csv'",
")",
",",
"'w'",
"... | Parse individual MOB Recon reports into a summary report | [
"Parse",
"individual",
"MOB",
"Recon",
"reports",
"into",
"a",
"summary",
"report"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/mobrecon.py#L107-L139 | train |
lowandrew/OLCTools | spadespipeline/mobrecon.py | MobRecon.amrsummary | def amrsummary(self):
"""
Create a report combining results from resfinder_assembled and mob_recon_summary reports
"""
logging.info('Creating AMR summary table from ResFinder and MOB-recon outputs')
with open(os.path.join(self.reportpath, 'amr_summary.csv'), 'w') as amr:
... | python | def amrsummary(self):
"""
Create a report combining results from resfinder_assembled and mob_recon_summary reports
"""
logging.info('Creating AMR summary table from ResFinder and MOB-recon outputs')
with open(os.path.join(self.reportpath, 'amr_summary.csv'), 'w') as amr:
... | [
"def",
"amrsummary",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Creating AMR summary table from ResFinder and MOB-recon outputs'",
")",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"reportpath",
",",
"'amr_summary.csv'",
")",
... | Create a report combining results from resfinder_assembled and mob_recon_summary reports | [
"Create",
"a",
"report",
"combining",
"results",
"from",
"resfinder_assembled",
"and",
"mob_recon_summary",
"reports"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/mobrecon.py#L141-L196 | train |
lowandrew/OLCTools | spadespipeline/mobrecon.py | MobRecon.geneseekrsummary | def geneseekrsummary(self):
"""
Create a report combining GeneSeekr and MOB Recon outputs
"""
logging.info('Creating predicted plasmid-borne gene summary table')
with open(os.path.join(self.reportpath, 'plasmid_borne_summary.csv'), 'w') as pbs:
data = 'Strain,Gene,Per... | python | def geneseekrsummary(self):
"""
Create a report combining GeneSeekr and MOB Recon outputs
"""
logging.info('Creating predicted plasmid-borne gene summary table')
with open(os.path.join(self.reportpath, 'plasmid_borne_summary.csv'), 'w') as pbs:
data = 'Strain,Gene,Per... | [
"def",
"geneseekrsummary",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Creating predicted plasmid-borne gene summary table'",
")",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"reportpath",
",",
"'plasmid_borne_summary.csv'",
")... | Create a report combining GeneSeekr and MOB Recon outputs | [
"Create",
"a",
"report",
"combining",
"GeneSeekr",
"and",
"MOB",
"Recon",
"outputs"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/mobrecon.py#L198-L257 | train |
kevinconway/venvctrl | venvctrl/venv/command.py | CommandMixin._execute | def _execute(cmd):
"""Run a command in a subshell."""
cmd_parts = shlex.split(cmd)
if sys.version_info[0] < 3:
cmd_parts = shlex.split(cmd.encode('ascii'))
proc = subprocess.Popen(
cmd_parts,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE... | python | def _execute(cmd):
"""Run a command in a subshell."""
cmd_parts = shlex.split(cmd)
if sys.version_info[0] < 3:
cmd_parts = shlex.split(cmd.encode('ascii'))
proc = subprocess.Popen(
cmd_parts,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE... | [
"def",
"_execute",
"(",
"cmd",
")",
":",
"cmd_parts",
"=",
"shlex",
".",
"split",
"(",
"cmd",
")",
"if",
"sys",
".",
"version_info",
"[",
"0",
"]",
"<",
"3",
":",
"cmd_parts",
"=",
"shlex",
".",
"split",
"(",
"cmd",
".",
"encode",
"(",
"'ascii'",
... | Run a command in a subshell. | [
"Run",
"a",
"command",
"in",
"a",
"subshell",
"."
] | 36d4e0e4d5ebced6385a6ade1198f4769ff2df41 | https://github.com/kevinconway/venvctrl/blob/36d4e0e4d5ebced6385a6ade1198f4769ff2df41/venvctrl/venv/command.py#L22-L47 | train |
kevinconway/venvctrl | venvctrl/venv/command.py | CommandMixin.cmd_path | def cmd_path(self, cmd):
"""Get the path of a command in the virtual if it exists.
Args:
cmd (str): The command to look for.
Returns:
str: The full path to the command.
Raises:
ValueError: If the command is not present.
"""
for binsc... | python | def cmd_path(self, cmd):
"""Get the path of a command in the virtual if it exists.
Args:
cmd (str): The command to look for.
Returns:
str: The full path to the command.
Raises:
ValueError: If the command is not present.
"""
for binsc... | [
"def",
"cmd_path",
"(",
"self",
",",
"cmd",
")",
":",
"for",
"binscript",
"in",
"self",
".",
"bin",
".",
"files",
":",
"if",
"binscript",
".",
"path",
".",
"endswith",
"(",
"'/{0}'",
".",
"format",
"(",
"cmd",
")",
")",
":",
"return",
"binscript",
... | Get the path of a command in the virtual if it exists.
Args:
cmd (str): The command to look for.
Returns:
str: The full path to the command.
Raises:
ValueError: If the command is not present. | [
"Get",
"the",
"path",
"of",
"a",
"command",
"in",
"the",
"virtual",
"if",
"it",
"exists",
"."
] | 36d4e0e4d5ebced6385a6ade1198f4769ff2df41 | https://github.com/kevinconway/venvctrl/blob/36d4e0e4d5ebced6385a6ade1198f4769ff2df41/venvctrl/venv/command.py#L49-L67 | train |
kevinconway/venvctrl | venvctrl/venv/command.py | CommandMixin.python | def python(self, cmd):
"""Execute a python script using the virtual environment python."""
python_bin = self.cmd_path('python')
cmd = '{0} {1}'.format(python_bin, cmd)
return self._execute(cmd) | python | def python(self, cmd):
"""Execute a python script using the virtual environment python."""
python_bin = self.cmd_path('python')
cmd = '{0} {1}'.format(python_bin, cmd)
return self._execute(cmd) | [
"def",
"python",
"(",
"self",
",",
"cmd",
")",
":",
"python_bin",
"=",
"self",
".",
"cmd_path",
"(",
"'python'",
")",
"cmd",
"=",
"'{0} {1}'",
".",
"format",
"(",
"python_bin",
",",
"cmd",
")",
"return",
"self",
".",
"_execute",
"(",
"cmd",
")"
] | Execute a python script using the virtual environment python. | [
"Execute",
"a",
"python",
"script",
"using",
"the",
"virtual",
"environment",
"python",
"."
] | 36d4e0e4d5ebced6385a6ade1198f4769ff2df41 | https://github.com/kevinconway/venvctrl/blob/36d4e0e4d5ebced6385a6ade1198f4769ff2df41/venvctrl/venv/command.py#L73-L77 | train |
kevinconway/venvctrl | venvctrl/venv/command.py | CommandMixin.pip | def pip(self, cmd):
"""Execute some pip function using the virtual environment pip."""
pip_bin = self.cmd_path('pip')
cmd = '{0} {1}'.format(pip_bin, cmd)
return self._execute(cmd) | python | def pip(self, cmd):
"""Execute some pip function using the virtual environment pip."""
pip_bin = self.cmd_path('pip')
cmd = '{0} {1}'.format(pip_bin, cmd)
return self._execute(cmd) | [
"def",
"pip",
"(",
"self",
",",
"cmd",
")",
":",
"pip_bin",
"=",
"self",
".",
"cmd_path",
"(",
"'pip'",
")",
"cmd",
"=",
"'{0} {1}'",
".",
"format",
"(",
"pip_bin",
",",
"cmd",
")",
"return",
"self",
".",
"_execute",
"(",
"cmd",
")"
] | Execute some pip function using the virtual environment pip. | [
"Execute",
"some",
"pip",
"function",
"using",
"the",
"virtual",
"environment",
"pip",
"."
] | 36d4e0e4d5ebced6385a6ade1198f4769ff2df41 | https://github.com/kevinconway/venvctrl/blob/36d4e0e4d5ebced6385a6ade1198f4769ff2df41/venvctrl/venv/command.py#L79-L83 | train |
lowandrew/OLCTools | spadespipeline/GeneSeekr.py | GeneSeekr.filterunique | def filterunique(self):
"""
Filters multiple BLAST hits in a common region of the genome. Leaves only the best hit
"""
for sample in self.metadata:
# Initialise variables
sample[self.analysistype].blastresults = list()
resultdict = dict()
r... | python | def filterunique(self):
"""
Filters multiple BLAST hits in a common region of the genome. Leaves only the best hit
"""
for sample in self.metadata:
# Initialise variables
sample[self.analysistype].blastresults = list()
resultdict = dict()
r... | [
"def",
"filterunique",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"blastresults",
"=",
"list",
"(",
")",
"resultdict",
"=",
"dict",
"(",
")",
"rowdict",
"=",
"dict",... | Filters multiple BLAST hits in a common region of the genome. Leaves only the best hit | [
"Filters",
"multiple",
"BLAST",
"hits",
"in",
"a",
"common",
"region",
"of",
"the",
"genome",
".",
"Leaves",
"only",
"the",
"best",
"hit"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/GeneSeekr.py#L51-L118 | train |
lowandrew/OLCTools | spadespipeline/GeneSeekr.py | GeneSeekr.makedbthreads | def makedbthreads(self):
"""
Setup and create threads for class
"""
# Find all the target folders in the analysis and add them to the targetfolders set
for sample in self.metadata:
if sample[self.analysistype].combinedtargets != 'NA':
self.targetfolder... | python | def makedbthreads(self):
"""
Setup and create threads for class
"""
# Find all the target folders in the analysis and add them to the targetfolders set
for sample in self.metadata:
if sample[self.analysistype].combinedtargets != 'NA':
self.targetfolder... | [
"def",
"makedbthreads",
"(",
"self",
")",
":",
"for",
"sample",
"in",
"self",
".",
"metadata",
":",
"if",
"sample",
"[",
"self",
".",
"analysistype",
"]",
".",
"combinedtargets",
"!=",
"'NA'",
":",
"self",
".",
"targetfolders",
".",
"add",
"(",
"sample",... | Setup and create threads for class | [
"Setup",
"and",
"create",
"threads",
"for",
"class"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/spadespipeline/GeneSeekr.py#L120-L149 | train |
grahame/dividebatur | dividebatur/senatecount.py | check_config | def check_config(config):
"basic checks that the configuration file is valid"
shortnames = [count['shortname'] for count in config['count']]
if len(shortnames) != len(set(shortnames)):
logger.error("error: duplicate `shortname' in count configuration.")
return False
return True | python | def check_config(config):
"basic checks that the configuration file is valid"
shortnames = [count['shortname'] for count in config['count']]
if len(shortnames) != len(set(shortnames)):
logger.error("error: duplicate `shortname' in count configuration.")
return False
return True | [
"def",
"check_config",
"(",
"config",
")",
":",
"\"basic checks that the configuration file is valid\"",
"shortnames",
"=",
"[",
"count",
"[",
"'shortname'",
"]",
"for",
"count",
"in",
"config",
"[",
"'count'",
"]",
"]",
"if",
"len",
"(",
"shortnames",
")",
"!="... | basic checks that the configuration file is valid | [
"basic",
"checks",
"that",
"the",
"configuration",
"file",
"is",
"valid"
] | adc1f6e8013943471f1679e3c94f9448a1e4a472 | https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/senatecount.py#L464-L470 | train |
grahame/dividebatur | dividebatur/senatecount.py | Automation._qstr | def _qstr(self, question):
"we need to cope with a list, or a list of lists"
parts = []
for entry in question:
if type(entry) is list:
parts.append(self._qstr(entry))
else:
parts.append('"%s"<%d>' % (self._count_data.get_candidate_title(ent... | python | def _qstr(self, question):
"we need to cope with a list, or a list of lists"
parts = []
for entry in question:
if type(entry) is list:
parts.append(self._qstr(entry))
else:
parts.append('"%s"<%d>' % (self._count_data.get_candidate_title(ent... | [
"def",
"_qstr",
"(",
"self",
",",
"question",
")",
":",
"\"we need to cope with a list, or a list of lists\"",
"parts",
"=",
"[",
"]",
"for",
"entry",
"in",
"question",
":",
"if",
"type",
"(",
"entry",
")",
"is",
"list",
":",
"parts",
".",
"append",
"(",
"... | we need to cope with a list, or a list of lists | [
"we",
"need",
"to",
"cope",
"with",
"a",
"list",
"or",
"a",
"list",
"of",
"lists"
] | adc1f6e8013943471f1679e3c94f9448a1e4a472 | https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/senatecount.py#L333-L341 | train |
grahame/dividebatur | dividebatur/senatecount.py | Automation.create_callback | def create_callback(self):
"""
create a callback, suitable to be passed to SenateCounter
"""
def __callback(question_posed):
logger.debug("%s: asked to choose between: %s" % (self._name, self._qstr(question_posed)))
if self._upto == len(self._data):
... | python | def create_callback(self):
"""
create a callback, suitable to be passed to SenateCounter
"""
def __callback(question_posed):
logger.debug("%s: asked to choose between: %s" % (self._name, self._qstr(question_posed)))
if self._upto == len(self._data):
... | [
"def",
"create_callback",
"(",
"self",
")",
":",
"def",
"__callback",
"(",
"question_posed",
")",
":",
"logger",
".",
"debug",
"(",
"\"%s: asked to choose between: %s\"",
"%",
"(",
"self",
".",
"_name",
",",
"self",
".",
"_qstr",
"(",
"question_posed",
")",
... | create a callback, suitable to be passed to SenateCounter | [
"create",
"a",
"callback",
"suitable",
"to",
"be",
"passed",
"to",
"SenateCounter"
] | adc1f6e8013943471f1679e3c94f9448a1e4a472 | https://github.com/grahame/dividebatur/blob/adc1f6e8013943471f1679e3c94f9448a1e4a472/dividebatur/senatecount.py#L343-L358 | train |
jmbhughes/suvi-trainer | scripts/fetch_hek_labeled.py | main | def main():
"""
fetches hek data and makes thematic maps as requested
"""
args = get_args()
config = Config(args.config)
# Load dates
if os.path.isfile(args.dates):
with open(args.dates) as f:
dates = [dateparser.parse(line.split(" ")[0]) for line in f.readlines()]
e... | python | def main():
"""
fetches hek data and makes thematic maps as requested
"""
args = get_args()
config = Config(args.config)
# Load dates
if os.path.isfile(args.dates):
with open(args.dates) as f:
dates = [dateparser.parse(line.split(" ")[0]) for line in f.readlines()]
e... | [
"def",
"main",
"(",
")",
":",
"args",
"=",
"get_args",
"(",
")",
"config",
"=",
"Config",
"(",
"args",
".",
"config",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"args",
".",
"dates",
")",
":",
"with",
"open",
"(",
"args",
".",
"dates",
"... | fetches hek data and makes thematic maps as requested | [
"fetches",
"hek",
"data",
"and",
"makes",
"thematic",
"maps",
"as",
"requested"
] | 3d89894a4a037286221974c7eb5634d229b4f5d4 | https://github.com/jmbhughes/suvi-trainer/blob/3d89894a4a037286221974c7eb5634d229b4f5d4/scripts/fetch_hek_labeled.py#L85-L114 | train |
TorkamaniLab/metapipe | metapipe/models/job_template.py | JobTemplate._get_jobs_from_template | def _get_jobs_from_template(self, template, job_class):
""" Given a template, a job class, construct jobs from
the given template.
"""
jobs = []
for command in template.eval():
alias = command.alias
depends_on = [job.alias
for job in self.q... | python | def _get_jobs_from_template(self, template, job_class):
""" Given a template, a job class, construct jobs from
the given template.
"""
jobs = []
for command in template.eval():
alias = command.alias
depends_on = [job.alias
for job in self.q... | [
"def",
"_get_jobs_from_template",
"(",
"self",
",",
"template",
",",
"job_class",
")",
":",
"jobs",
"=",
"[",
"]",
"for",
"command",
"in",
"template",
".",
"eval",
"(",
")",
":",
"alias",
"=",
"command",
".",
"alias",
"depends_on",
"=",
"[",
"job",
"."... | Given a template, a job class, construct jobs from
the given template. | [
"Given",
"a",
"template",
"a",
"job",
"class",
"construct",
"jobs",
"from",
"the",
"given",
"template",
"."
] | 15592e5b0c217afb00ac03503f8d0d7453d4baf4 | https://github.com/TorkamaniLab/metapipe/blob/15592e5b0c217afb00ac03503f8d0d7453d4baf4/metapipe/models/job_template.py#L47-L64 | train |
NoviceLive/intellicoder | intellicoder/executables/pe.py | PE.get_export_table | def get_export_table(self):
"""Get the export table."""
symbols = self.binary.DIRECTORY_ENTRY_EXPORT.symbols
names = AttrsGetter(symbols, join=False).name
return names | python | def get_export_table(self):
"""Get the export table."""
symbols = self.binary.DIRECTORY_ENTRY_EXPORT.symbols
names = AttrsGetter(symbols, join=False).name
return names | [
"def",
"get_export_table",
"(",
"self",
")",
":",
"symbols",
"=",
"self",
".",
"binary",
".",
"DIRECTORY_ENTRY_EXPORT",
".",
"symbols",
"names",
"=",
"AttrsGetter",
"(",
"symbols",
",",
"join",
"=",
"False",
")",
".",
"name",
"return",
"names"
] | Get the export table. | [
"Get",
"the",
"export",
"table",
"."
] | 6cac5ebfce65c370dbebe47756a1789b120ef982 | https://github.com/NoviceLive/intellicoder/blob/6cac5ebfce65c370dbebe47756a1789b120ef982/intellicoder/executables/pe.py#L54-L58 | train |
sholsapp/py509 | py509/x509.py | resolve_pkix_certificate | def resolve_pkix_certificate(url):
"""Resolve a certificate from a remote host.
Extensions like the authority information access extension point to
certificates hosted on remote servers. This functionc an be used to
download and load the certificate.
:param str url: The URL to resolve a certificate from.
... | python | def resolve_pkix_certificate(url):
"""Resolve a certificate from a remote host.
Extensions like the authority information access extension point to
certificates hosted on remote servers. This functionc an be used to
download and load the certificate.
:param str url: The URL to resolve a certificate from.
... | [
"def",
"resolve_pkix_certificate",
"(",
"url",
")",
":",
"http",
"=",
"urllib3",
".",
"PoolManager",
"(",
")",
"rsp",
"=",
"http",
".",
"request",
"(",
"'GET'",
",",
"url",
",",
"headers",
"=",
"{",
"'Content-Type'",
":",
"'application/pkix-cert'",
"}",
")... | Resolve a certificate from a remote host.
Extensions like the authority information access extension point to
certificates hosted on remote servers. This functionc an be used to
download and load the certificate.
:param str url: The URL to resolve a certificate from.
:returns: The certificate.
:rtype: Ope... | [
"Resolve",
"a",
"certificate",
"from",
"a",
"remote",
"host",
"."
] | 83bd6786a8ec1543b66c42ea5523e611c3e8dc5a | https://github.com/sholsapp/py509/blob/83bd6786a8ec1543b66c42ea5523e611c3e8dc5a/py509/x509.py#L14-L43 | train |
sholsapp/py509 | py509/x509.py | make_certificate_signing_request | def make_certificate_signing_request(pkey, digest='sha512', **name):
"""Make a certificate signing request.
:param OpenSSL.crypto.PKey pkey: A private key.
:param str digest: A valid digest to use. For example, `sha512`.
:param name: Key word arguments containing subject name parts: C, ST, L, O,
OU, CN.
... | python | def make_certificate_signing_request(pkey, digest='sha512', **name):
"""Make a certificate signing request.
:param OpenSSL.crypto.PKey pkey: A private key.
:param str digest: A valid digest to use. For example, `sha512`.
:param name: Key word arguments containing subject name parts: C, ST, L, O,
OU, CN.
... | [
"def",
"make_certificate_signing_request",
"(",
"pkey",
",",
"digest",
"=",
"'sha512'",
",",
"**",
"name",
")",
":",
"csr",
"=",
"crypto",
".",
"X509Req",
"(",
")",
"subj",
"=",
"csr",
".",
"get_subject",
"(",
")",
"subj",
".",
"C",
"=",
"name",
".",
... | Make a certificate signing request.
:param OpenSSL.crypto.PKey pkey: A private key.
:param str digest: A valid digest to use. For example, `sha512`.
:param name: Key word arguments containing subject name parts: C, ST, L, O,
OU, CN.
:return: A certificate signing request.
:rtype: :class:`OpenSSL.crypto.X... | [
"Make",
"a",
"certificate",
"signing",
"request",
"."
] | 83bd6786a8ec1543b66c42ea5523e611c3e8dc5a | https://github.com/sholsapp/py509/blob/83bd6786a8ec1543b66c42ea5523e611c3e8dc5a/py509/x509.py#L71-L93 | train |
sholsapp/py509 | py509/x509.py | make_certificate | def make_certificate(csr, ca_key, ca_cert, serial, not_before, not_after, digest='sha512', version=2, exts=()):
"""Make a certificate.
The following extensions are added to all certificates in the following order
*before* additional extensions specified by `exts` kwarg:
- subjectKeyIdentifier
- authorit... | python | def make_certificate(csr, ca_key, ca_cert, serial, not_before, not_after, digest='sha512', version=2, exts=()):
"""Make a certificate.
The following extensions are added to all certificates in the following order
*before* additional extensions specified by `exts` kwarg:
- subjectKeyIdentifier
- authorit... | [
"def",
"make_certificate",
"(",
"csr",
",",
"ca_key",
",",
"ca_cert",
",",
"serial",
",",
"not_before",
",",
"not_after",
",",
"digest",
"=",
"'sha512'",
",",
"version",
"=",
"2",
",",
"exts",
"=",
"(",
")",
")",
":",
"crt",
"=",
"crypto",
".",
"X509... | Make a certificate.
The following extensions are added to all certificates in the following order
*before* additional extensions specified by `exts` kwarg:
- subjectKeyIdentifier
- authorityKeyIdentifier
:param OpenSSL.crypto.X509Request csr: A certificate signing request.
:param OpenSSL.crypto.PKey ... | [
"Make",
"a",
"certificate",
"."
] | 83bd6786a8ec1543b66c42ea5523e611c3e8dc5a | https://github.com/sholsapp/py509/blob/83bd6786a8ec1543b66c42ea5523e611c3e8dc5a/py509/x509.py#L96-L139 | train |
sholsapp/py509 | py509/x509.py | make_certificate_authority | def make_certificate_authority(**name):
"""Make a certificate authority.
A certificate authority can sign certificates. For clients to be able to
validate certificates signed by your certificate authorithy, they must trust
the certificate returned by this function.
:param name: Key word arguments containing... | python | def make_certificate_authority(**name):
"""Make a certificate authority.
A certificate authority can sign certificates. For clients to be able to
validate certificates signed by your certificate authorithy, they must trust
the certificate returned by this function.
:param name: Key word arguments containing... | [
"def",
"make_certificate_authority",
"(",
"**",
"name",
")",
":",
"key",
"=",
"make_pkey",
"(",
")",
"csr",
"=",
"make_certificate_signing_request",
"(",
"key",
",",
"**",
"name",
")",
"crt",
"=",
"make_certificate",
"(",
"csr",
",",
"key",
",",
"csr",
","... | Make a certificate authority.
A certificate authority can sign certificates. For clients to be able to
validate certificates signed by your certificate authorithy, they must trust
the certificate returned by this function.
:param name: Key word arguments containing subject name parts: C, ST, L, O,
OU, CN.... | [
"Make",
"a",
"certificate",
"authority",
"."
] | 83bd6786a8ec1543b66c42ea5523e611c3e8dc5a | https://github.com/sholsapp/py509/blob/83bd6786a8ec1543b66c42ea5523e611c3e8dc5a/py509/x509.py#L142-L158 | train |
sholsapp/py509 | py509/x509.py | load_certificate | def load_certificate(filetype, buf):
"""Load a certificate and patch in incubating functionality.
Load a certificate using the same API as
:func:`OpenSSL.crypto.load_certificate` so clients can use this function as a
drop in replacement. Doing so patches in *incubating* functionality:
functionality that is n... | python | def load_certificate(filetype, buf):
"""Load a certificate and patch in incubating functionality.
Load a certificate using the same API as
:func:`OpenSSL.crypto.load_certificate` so clients can use this function as a
drop in replacement. Doing so patches in *incubating* functionality:
functionality that is n... | [
"def",
"load_certificate",
"(",
"filetype",
",",
"buf",
")",
":",
"x509cert",
"=",
"crypto",
".",
"load_certificate",
"(",
"filetype",
",",
"buf",
")",
"patch_certificate",
"(",
"x509cert",
")",
"return",
"x509cert"
] | Load a certificate and patch in incubating functionality.
Load a certificate using the same API as
:func:`OpenSSL.crypto.load_certificate` so clients can use this function as a
drop in replacement. Doing so patches in *incubating* functionality:
functionality that is not yet (or possibly will never be) present... | [
"Load",
"a",
"certificate",
"and",
"patch",
"in",
"incubating",
"functionality",
"."
] | 83bd6786a8ec1543b66c42ea5523e611c3e8dc5a | https://github.com/sholsapp/py509/blob/83bd6786a8ec1543b66c42ea5523e611c3e8dc5a/py509/x509.py#L221-L237 | train |
sholsapp/py509 | py509/x509.py | load_x509_certificates | def load_x509_certificates(buf):
"""Load one or multiple X.509 certificates from a buffer.
:param str buf: A buffer is an instance of `basestring` and can contain multiple
certificates.
:return: An iterator that iterates over certificates in a buffer.
:rtype: list[:class:`OpenSSL.crypto.X509`]
"""
if ... | python | def load_x509_certificates(buf):
"""Load one or multiple X.509 certificates from a buffer.
:param str buf: A buffer is an instance of `basestring` and can contain multiple
certificates.
:return: An iterator that iterates over certificates in a buffer.
:rtype: list[:class:`OpenSSL.crypto.X509`]
"""
if ... | [
"def",
"load_x509_certificates",
"(",
"buf",
")",
":",
"if",
"not",
"isinstance",
"(",
"buf",
",",
"basestring",
")",
":",
"raise",
"ValueError",
"(",
"'`buf` should be an instance of `basestring` not `%s`'",
"%",
"type",
"(",
"buf",
")",
")",
"for",
"pem",
"in"... | Load one or multiple X.509 certificates from a buffer.
:param str buf: A buffer is an instance of `basestring` and can contain multiple
certificates.
:return: An iterator that iterates over certificates in a buffer.
:rtype: list[:class:`OpenSSL.crypto.X509`] | [
"Load",
"one",
"or",
"multiple",
"X",
".",
"509",
"certificates",
"from",
"a",
"buffer",
"."
] | 83bd6786a8ec1543b66c42ea5523e611c3e8dc5a | https://github.com/sholsapp/py509/blob/83bd6786a8ec1543b66c42ea5523e611c3e8dc5a/py509/x509.py#L240-L253 | train |
lowandrew/OLCTools | databasesetup/database_setup.py | DatabaseSetup.cowbat | def cowbat(self):
"""
Run all the methods
"""
logging.info('Beginning COWBAT database downloads')
if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'genesippr')):
self.sipprverse_targets(databasepath=self.databasepath)
if self.overwrite or... | python | def cowbat(self):
"""
Run all the methods
"""
logging.info('Beginning COWBAT database downloads')
if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'genesippr')):
self.sipprverse_targets(databasepath=self.databasepath)
if self.overwrite or... | [
"def",
"cowbat",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Beginning COWBAT database downloads'",
")",
"if",
"self",
".",
"overwrite",
"or",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"dat... | Run all the methods | [
"Run",
"all",
"the",
"methods"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/databasesetup/database_setup.py#L21-L60 | train |
lowandrew/OLCTools | databasesetup/database_setup.py | DatabaseSetup.sipprverse_full | def sipprverse_full(self):
"""
Run a subset of the methods - only the targets used in the sipprverse are required here
"""
logging.info('Beginning sipprverse full database downloads')
if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'genesippr')):
... | python | def sipprverse_full(self):
"""
Run a subset of the methods - only the targets used in the sipprverse are required here
"""
logging.info('Beginning sipprverse full database downloads')
if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'genesippr')):
... | [
"def",
"sipprverse_full",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Beginning sipprverse full database downloads'",
")",
"if",
"self",
".",
"overwrite",
"or",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
"se... | Run a subset of the methods - only the targets used in the sipprverse are required here | [
"Run",
"a",
"subset",
"of",
"the",
"methods",
"-",
"only",
"the",
"targets",
"used",
"in",
"the",
"sipprverse",
"are",
"required",
"here"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/databasesetup/database_setup.py#L62-L89 | train |
lowandrew/OLCTools | databasesetup/database_setup.py | DatabaseSetup.sipprverse_method | def sipprverse_method(self):
"""
Reduced subset again. Only sipprverse, MASH, and confindr targets are required
"""
logging.info('Beginning sipprverse method database downloads')
if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'genesippr')):
sel... | python | def sipprverse_method(self):
"""
Reduced subset again. Only sipprverse, MASH, and confindr targets are required
"""
logging.info('Beginning sipprverse method database downloads')
if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'genesippr')):
sel... | [
"def",
"sipprverse_method",
"(",
"self",
")",
":",
"logging",
".",
"info",
"(",
"'Beginning sipprverse method database downloads'",
")",
"if",
"self",
".",
"overwrite",
"or",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"os",
".",
"path",
".",
"join",
"(",
... | Reduced subset again. Only sipprverse, MASH, and confindr targets are required | [
"Reduced",
"subset",
"again",
".",
"Only",
"sipprverse",
"MASH",
"and",
"confindr",
"targets",
"are",
"required"
] | 88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a | https://github.com/lowandrew/OLCTools/blob/88aa90ac85f84d0bbeb03e43c29b0a9d36e4ce2a/databasesetup/database_setup.py#L91-L101 | train |
yamcs/yamcs-python | yamcs-client/yamcs/model.py | Event.severity | def severity(self):
"""
Severity level of the event. One of ``INFO``, ``WATCH``,
``WARNING``, ``DISTRESS``, ``CRITICAL`` or ``SEVERE``.
"""
if self._proto.HasField('severity'):
return yamcs_pb2.Event.EventSeverity.Name(self._proto.severity)
return None | python | def severity(self):
"""
Severity level of the event. One of ``INFO``, ``WATCH``,
``WARNING``, ``DISTRESS``, ``CRITICAL`` or ``SEVERE``.
"""
if self._proto.HasField('severity'):
return yamcs_pb2.Event.EventSeverity.Name(self._proto.severity)
return None | [
"def",
"severity",
"(",
"self",
")",
":",
"if",
"self",
".",
"_proto",
".",
"HasField",
"(",
"'severity'",
")",
":",
"return",
"yamcs_pb2",
".",
"Event",
".",
"EventSeverity",
".",
"Name",
"(",
"self",
".",
"_proto",
".",
"severity",
")",
"return",
"No... | Severity level of the event. One of ``INFO``, ``WATCH``,
``WARNING``, ``DISTRESS``, ``CRITICAL`` or ``SEVERE``. | [
"Severity",
"level",
"of",
"the",
"event",
".",
"One",
"of",
"INFO",
"WATCH",
"WARNING",
"DISTRESS",
"CRITICAL",
"or",
"SEVERE",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/model.py#L129-L136 | train |
yamcs/yamcs-python | yamcs-client/yamcs/model.py | Instance.state | def state(self):
"""
State of this instance. One of ``OFFLINE``, ``INITIALIZING``,
``INITIALIZED``, ``STARTING``, ``RUNNING``, ``STOPPING`` or
``FAILED``.
"""
if self._proto.HasField('state'):
return yamcsManagement_pb2.YamcsInstance.InstanceState.Name(self._p... | python | def state(self):
"""
State of this instance. One of ``OFFLINE``, ``INITIALIZING``,
``INITIALIZED``, ``STARTING``, ``RUNNING``, ``STOPPING`` or
``FAILED``.
"""
if self._proto.HasField('state'):
return yamcsManagement_pb2.YamcsInstance.InstanceState.Name(self._p... | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"self",
".",
"_proto",
".",
"HasField",
"(",
"'state'",
")",
":",
"return",
"yamcsManagement_pb2",
".",
"YamcsInstance",
".",
"InstanceState",
".",
"Name",
"(",
"self",
".",
"_proto",
".",
"state",
")",
"retur... | State of this instance. One of ``OFFLINE``, ``INITIALIZING``,
``INITIALIZED``, ``STARTING``, ``RUNNING``, ``STOPPING`` or
``FAILED``. | [
"State",
"of",
"this",
"instance",
".",
"One",
"of",
"OFFLINE",
"INITIALIZING",
"INITIALIZED",
"STARTING",
"RUNNING",
"STOPPING",
"or",
"FAILED",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/model.py#L267-L275 | train |
yamcs/yamcs-python | yamcs-client/yamcs/model.py | Service.state | def state(self):
"""State of this service."""
if self._proto.HasField('state'):
return yamcsManagement_pb2.ServiceState.Name(self._proto.state)
return None | python | def state(self):
"""State of this service."""
if self._proto.HasField('state'):
return yamcsManagement_pb2.ServiceState.Name(self._proto.state)
return None | [
"def",
"state",
"(",
"self",
")",
":",
"if",
"self",
".",
"_proto",
".",
"HasField",
"(",
"'state'",
")",
":",
"return",
"yamcsManagement_pb2",
".",
"ServiceState",
".",
"Name",
"(",
"self",
".",
"_proto",
".",
"state",
")",
"return",
"None"
] | State of this service. | [
"State",
"of",
"this",
"service",
"."
] | 1082fee8a299010cc44416bbb7518fac0ef08b48 | https://github.com/yamcs/yamcs-python/blob/1082fee8a299010cc44416bbb7518fac0ef08b48/yamcs-client/yamcs/model.py#L345-L349 | train |
dalloriam/engel | engel/widgets/base.py | BaseContainer.add_child | def add_child(self, child):
"""
Add a new child element to this widget.
:param child: Object inheriting :class:`BaseElement`.
"""
self.children.append(child)
child.parent = self
if self.view and self.view.is_loaded:
self.view.dispatch({
... | python | def add_child(self, child):
"""
Add a new child element to this widget.
:param child: Object inheriting :class:`BaseElement`.
"""
self.children.append(child)
child.parent = self
if self.view and self.view.is_loaded:
self.view.dispatch({
... | [
"def",
"add_child",
"(",
"self",
",",
"child",
")",
":",
"self",
".",
"children",
".",
"append",
"(",
"child",
")",
"child",
".",
"parent",
"=",
"self",
"if",
"self",
".",
"view",
"and",
"self",
".",
"view",
".",
"is_loaded",
":",
"self",
".",
"vie... | Add a new child element to this widget.
:param child: Object inheriting :class:`BaseElement`. | [
"Add",
"a",
"new",
"child",
"element",
"to",
"this",
"widget",
"."
] | f3477cd546e885bc53e755b3eb1452ce43ef5697 | https://github.com/dalloriam/engel/blob/f3477cd546e885bc53e755b3eb1452ce43ef5697/engel/widgets/base.py#L166-L180 | train |
dalloriam/engel | engel/widgets/base.py | BaseContainer.remove_child | def remove_child(self, child):
"""
Remove a child widget from this widget.
:param child: Object inheriting :class:`BaseElement`
"""
self.children.remove(child)
child.parent = None
if self.view and self.view.is_loaded:
self.view.dispatch({
... | python | def remove_child(self, child):
"""
Remove a child widget from this widget.
:param child: Object inheriting :class:`BaseElement`
"""
self.children.remove(child)
child.parent = None
if self.view and self.view.is_loaded:
self.view.dispatch({
... | [
"def",
"remove_child",
"(",
"self",
",",
"child",
")",
":",
"self",
".",
"children",
".",
"remove",
"(",
"child",
")",
"child",
".",
"parent",
"=",
"None",
"if",
"self",
".",
"view",
"and",
"self",
".",
"view",
".",
"is_loaded",
":",
"self",
".",
"... | Remove a child widget from this widget.
:param child: Object inheriting :class:`BaseElement` | [
"Remove",
"a",
"child",
"widget",
"from",
"this",
"widget",
"."
] | f3477cd546e885bc53e755b3eb1452ce43ef5697 | https://github.com/dalloriam/engel/blob/f3477cd546e885bc53e755b3eb1452ce43ef5697/engel/widgets/base.py#L182-L195 | train |
dalloriam/engel | engel/widgets/base.py | BaseContainer.compile | def compile(self):
"""
Recursively compile this widget as well as all of its children to HTML.
:returns: HTML string representation of this widget.
"""
self.content = "".join(map(lambda x: x.compile(), self.children))
return self._generate_html() | python | def compile(self):
"""
Recursively compile this widget as well as all of its children to HTML.
:returns: HTML string representation of this widget.
"""
self.content = "".join(map(lambda x: x.compile(), self.children))
return self._generate_html() | [
"def",
"compile",
"(",
"self",
")",
":",
"self",
".",
"content",
"=",
"\"\"",
".",
"join",
"(",
"map",
"(",
"lambda",
"x",
":",
"x",
".",
"compile",
"(",
")",
",",
"self",
".",
"children",
")",
")",
"return",
"self",
".",
"_generate_html",
"(",
"... | Recursively compile this widget as well as all of its children to HTML.
:returns: HTML string representation of this widget. | [
"Recursively",
"compile",
"this",
"widget",
"as",
"well",
"as",
"all",
"of",
"its",
"children",
"to",
"HTML",
"."
] | f3477cd546e885bc53e755b3eb1452ce43ef5697 | https://github.com/dalloriam/engel/blob/f3477cd546e885bc53e755b3eb1452ce43ef5697/engel/widgets/base.py#L220-L227 | train |
loganasherjones/yapconf | yapconf/handlers.py | ConfigChangeHandler.handle_config_change | def handle_config_change(self, new_config):
"""Handle the new configuration.
Args:
new_config (dict): The new configuration
"""
if self.user_handler:
self.user_handler(self.current_config, new_config)
self._call_spec_handlers(new_config)
self.cur... | python | def handle_config_change(self, new_config):
"""Handle the new configuration.
Args:
new_config (dict): The new configuration
"""
if self.user_handler:
self.user_handler(self.current_config, new_config)
self._call_spec_handlers(new_config)
self.cur... | [
"def",
"handle_config_change",
"(",
"self",
",",
"new_config",
")",
":",
"if",
"self",
".",
"user_handler",
":",
"self",
".",
"user_handler",
"(",
"self",
".",
"current_config",
",",
"new_config",
")",
"self",
".",
"_call_spec_handlers",
"(",
"new_config",
")"... | Handle the new configuration.
Args:
new_config (dict): The new configuration | [
"Handle",
"the",
"new",
"configuration",
"."
] | d2970e6e7e3334615d4d978d8b0ca33006d79d16 | https://github.com/loganasherjones/yapconf/blob/d2970e6e7e3334615d4d978d8b0ca33006d79d16/yapconf/handlers.py#L23-L33 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.setReferenceVoltage | def setReferenceVoltage(self, caldb, calv):
"""Sets the reference point to determine what outgoing voltage will produce what intensity,
used to calculate the proper output amplitude of components
:param caldb: calibration intensity in dbSPL
:type caldb: float
:param calv: calib... | python | def setReferenceVoltage(self, caldb, calv):
"""Sets the reference point to determine what outgoing voltage will produce what intensity,
used to calculate the proper output amplitude of components
:param caldb: calibration intensity in dbSPL
:type caldb: float
:param calv: calib... | [
"def",
"setReferenceVoltage",
"(",
"self",
",",
"caldb",
",",
"calv",
")",
":",
"self",
".",
"caldb",
"=",
"caldb",
"self",
".",
"calv",
"=",
"calv"
] | Sets the reference point to determine what outgoing voltage will produce what intensity,
used to calculate the proper output amplitude of components
:param caldb: calibration intensity in dbSPL
:type caldb: float
:param calv: calibration voltage that was used to record the intensity pr... | [
"Sets",
"the",
"reference",
"point",
"to",
"determine",
"what",
"outgoing",
"voltage",
"will",
"produce",
"what",
"intensity",
"used",
"to",
"calculate",
"the",
"proper",
"output",
"amplitude",
"of",
"components"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L73-L83 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.setCalibration | def setCalibration(self, dbBoostArray, frequencies, frange):
"""Sets the calibration to use with this stimulus,
creates a filter that will be applied to output signal generated by this model.
Set arguments to `None` to clear calibration.
:param dbBoostArray: frequency response of the s... | python | def setCalibration(self, dbBoostArray, frequencies, frange):
"""Sets the calibration to use with this stimulus,
creates a filter that will be applied to output signal generated by this model.
Set arguments to `None` to clear calibration.
:param dbBoostArray: frequency response of the s... | [
"def",
"setCalibration",
"(",
"self",
",",
"dbBoostArray",
",",
"frequencies",
",",
"frange",
")",
":",
"if",
"dbBoostArray",
"is",
"not",
"None",
"and",
"frequencies",
"is",
"not",
"None",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"'main'",
")... | Sets the calibration to use with this stimulus,
creates a filter that will be applied to output signal generated by this model.
Set arguments to `None` to clear calibration.
:param dbBoostArray: frequency response of the system (in dB)
:type dbBoostArray: numpy.ndarray
:param f... | [
"Sets",
"the",
"calibration",
"to",
"use",
"with",
"this",
"stimulus",
"creates",
"a",
"filter",
"that",
"will",
"be",
"applied",
"to",
"output",
"signal",
"generated",
"by",
"this",
"model",
".",
"Set",
"arguments",
"to",
"None",
"to",
"clear",
"calibration... | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L85-L134 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.updateCalibration | def updateCalibration(self):
"""Updates the current calibration according to intenal values. For example, if the stimulus samplerate changes
the calibration needs to be recalculated."""
if self.samplerate() != self._calibration_fs:
self.setCalibration(self._attenuationVector, self._c... | python | def updateCalibration(self):
"""Updates the current calibration according to intenal values. For example, if the stimulus samplerate changes
the calibration needs to be recalculated."""
if self.samplerate() != self._calibration_fs:
self.setCalibration(self._attenuationVector, self._c... | [
"def",
"updateCalibration",
"(",
"self",
")",
":",
"if",
"self",
".",
"samplerate",
"(",
")",
"!=",
"self",
".",
"_calibration_fs",
":",
"self",
".",
"setCalibration",
"(",
"self",
".",
"_attenuationVector",
",",
"self",
".",
"_calFrequencies",
",",
"self",
... | Updates the current calibration according to intenal values. For example, if the stimulus samplerate changes
the calibration needs to be recalculated. | [
"Updates",
"the",
"current",
"calibration",
"according",
"to",
"intenal",
"values",
".",
"For",
"example",
"if",
"the",
"stimulus",
"samplerate",
"changes",
"the",
"calibration",
"needs",
"to",
"be",
"recalculated",
"."
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L136-L140 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.samplerate | def samplerate(self):
"""Returns the generation rate for this stimulus
:returns: int -- the output samplerate (Hz)
"""
rates = []
for track in self._segments:
for component in track:
# special case, where component is a wav file:
# it ... | python | def samplerate(self):
"""Returns the generation rate for this stimulus
:returns: int -- the output samplerate (Hz)
"""
rates = []
for track in self._segments:
for component in track:
# special case, where component is a wav file:
# it ... | [
"def",
"samplerate",
"(",
"self",
")",
":",
"rates",
"=",
"[",
"]",
"for",
"track",
"in",
"self",
".",
"_segments",
":",
"for",
"component",
"in",
"track",
":",
"if",
"component",
".",
"__class__",
".",
"__name__",
"==",
"'Vocalization'",
":",
"if",
"c... | Returns the generation rate for this stimulus
:returns: int -- the output samplerate (Hz) | [
"Returns",
"the",
"generation",
"rate",
"for",
"this",
"stimulus"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L147-L170 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.columnCount | def columnCount(self, row=None):
"""Returns the number of components in a track,
or the max number of components in any row, if none given
:param row: track to get count for
:type row: int
:returns: int -- number of components for *row*
"""
if row is not None:
... | python | def columnCount(self, row=None):
"""Returns the number of components in a track,
or the max number of components in any row, if none given
:param row: track to get count for
:type row: int
:returns: int -- number of components for *row*
"""
if row is not None:
... | [
"def",
"columnCount",
"(",
"self",
",",
"row",
"=",
"None",
")",
":",
"if",
"row",
"is",
"not",
"None",
":",
"wholerow",
"=",
"self",
".",
"_segments",
"[",
"row",
"]",
"return",
"len",
"(",
"wholerow",
")",
"else",
":",
"column_lengths",
"=",
"[",
... | Returns the number of components in a track,
or the max number of components in any row, if none given
:param row: track to get count for
:type row: int
:returns: int -- number of components for *row* | [
"Returns",
"the",
"number",
"of",
"components",
"in",
"a",
"track",
"or",
"the",
"max",
"number",
"of",
"components",
"in",
"any",
"row",
"if",
"none",
"given"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L194-L207 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.componentCount | def componentCount(self):
"""Returns the total number of components in stimulus
:returns: number of components (not including expanded auto-params)
"""
return sum([self.columnCountForRow(x) for x in range(self.rowCount())]) | python | def componentCount(self):
"""Returns the total number of components in stimulus
:returns: number of components (not including expanded auto-params)
"""
return sum([self.columnCountForRow(x) for x in range(self.rowCount())]) | [
"def",
"componentCount",
"(",
"self",
")",
":",
"return",
"sum",
"(",
"[",
"self",
".",
"columnCountForRow",
"(",
"x",
")",
"for",
"x",
"in",
"range",
"(",
"self",
".",
"rowCount",
"(",
")",
")",
"]",
")"
] | Returns the total number of components in stimulus
:returns: number of components (not including expanded auto-params) | [
"Returns",
"the",
"total",
"number",
"of",
"components",
"in",
"stimulus"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L215-L220 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.component | def component(self, row, col):
"""Gets the components for the location
:param row: track the component is in
:type row: int
:param col: the ith member of the track
:type col: int
:returns: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulus... | python | def component(self, row, col):
"""Gets the components for the location
:param row: track the component is in
:type row: int
:param col: the ith member of the track
:type col: int
:returns: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulus... | [
"def",
"component",
"(",
"self",
",",
"row",
",",
"col",
")",
":",
"try",
":",
"comp",
"=",
"self",
".",
"_segments",
"[",
"row",
"]",
"[",
"col",
"]",
"except",
":",
"print",
"'Invalid index'",
"return",
"None",
"return",
"comp"
] | Gets the components for the location
:param row: track the component is in
:type row: int
:param col: the ith member of the track
:type col: int
:returns: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>` | [
"Gets",
"the",
"components",
"for",
"the",
"location"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L222-L237 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.insertComponent | def insertComponent(self, comp, row=0, col=0):
"""Inserts component into model
:param comp: Component to insert into the stimulus
:type comp: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:param row: Track number to place comp in
:... | python | def insertComponent(self, comp, row=0, col=0):
"""Inserts component into model
:param comp: Component to insert into the stimulus
:type comp: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:param row: Track number to place comp in
:... | [
"def",
"insertComponent",
"(",
"self",
",",
"comp",
",",
"row",
"=",
"0",
",",
"col",
"=",
"0",
")",
":",
"if",
"row",
">",
"len",
"(",
"self",
".",
"_segments",
")",
"-",
"1",
":",
"self",
".",
"insertEmptyRow",
"(",
")",
"self",
".",
"_segments... | Inserts component into model
:param comp: Component to insert into the stimulus
:type comp: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:param row: Track number to place comp in
:type row: int
:param col: location in track to ins... | [
"Inserts",
"component",
"into",
"model"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L239-L254 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.overwriteComponent | def overwriteComponent(self, comp, row, col):
"""Overwrites the component at the specficied location with a provided one.
:param comp: New component to insert
:type comp: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:param row: track loca... | python | def overwriteComponent(self, comp, row, col):
"""Overwrites the component at the specficied location with a provided one.
:param comp: New component to insert
:type comp: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:param row: track loca... | [
"def",
"overwriteComponent",
"(",
"self",
",",
"comp",
",",
"row",
",",
"col",
")",
":",
"self",
".",
"_segments",
"[",
"row",
"]",
"[",
"col",
"]",
"=",
"comp",
"self",
".",
"updateCalibration",
"(",
")"
] | Overwrites the component at the specficied location with a provided one.
:param comp: New component to insert
:type comp: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:param row: track location of existing component to overwrite
:type row... | [
"Overwrites",
"the",
"component",
"at",
"the",
"specficied",
"location",
"with",
"a",
"provided",
"one",
"."
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L256-L269 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.removeLastRow | def removeLastRow(self):
"""Removes the last track"""
lastrow = self._segments.pop(len(self._segments)-1)
if len(lastrow) > 0:
raise Exception("Attempt to remove non-empty stimulus track") | python | def removeLastRow(self):
"""Removes the last track"""
lastrow = self._segments.pop(len(self._segments)-1)
if len(lastrow) > 0:
raise Exception("Attempt to remove non-empty stimulus track") | [
"def",
"removeLastRow",
"(",
"self",
")",
":",
"lastrow",
"=",
"self",
".",
"_segments",
".",
"pop",
"(",
"len",
"(",
"self",
".",
"_segments",
")",
"-",
"1",
")",
"if",
"len",
"(",
"lastrow",
")",
">",
"0",
":",
"raise",
"Exception",
"(",
"\"Attem... | Removes the last track | [
"Removes",
"the",
"last",
"track"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L275-L279 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.removeComponent | def removeComponent(self, row,col):
"""Removes the component at the given location
:param row: track location of existing component to remove
:type row: int
:param col: location in track of existing component to remove
:type col: int
"""
self._segments[row].pop(c... | python | def removeComponent(self, row,col):
"""Removes the component at the given location
:param row: track location of existing component to remove
:type row: int
:param col: location in track of existing component to remove
:type col: int
"""
self._segments[row].pop(c... | [
"def",
"removeComponent",
"(",
"self",
",",
"row",
",",
"col",
")",
":",
"self",
".",
"_segments",
"[",
"row",
"]",
".",
"pop",
"(",
"col",
")",
"if",
"self",
".",
"columnCountForRow",
"(",
"-",
"1",
")",
"==",
"0",
":",
"self",
".",
"removeRow",
... | Removes the component at the given location
:param row: track location of existing component to remove
:type row: int
:param col: location in track of existing component to remove
:type col: int | [
"Removes",
"the",
"component",
"at",
"the",
"given",
"location"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L285-L300 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.indexByComponent | def indexByComponent(self, component):
"""Returns a location for the given component, or None if
it is not in the model
:param component: Component to get index for
:type component: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:re... | python | def indexByComponent(self, component):
"""Returns a location for the given component, or None if
it is not in the model
:param component: Component to get index for
:type component: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:re... | [
"def",
"indexByComponent",
"(",
"self",
",",
"component",
")",
":",
"for",
"row",
",",
"rowcontents",
"in",
"enumerate",
"(",
"self",
".",
"_segments",
")",
":",
"if",
"component",
"in",
"rowcontents",
":",
"column",
"=",
"rowcontents",
".",
"index",
"(",
... | Returns a location for the given component, or None if
it is not in the model
:param component: Component to get index for
:type component: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>`
:returns: (int, int) -- (row, column) of component | [
"Returns",
"a",
"location",
"for",
"the",
"given",
"component",
"or",
"None",
"if",
"it",
"is",
"not",
"in",
"the",
"model"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L309-L320 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.traceCount | def traceCount(self):
"""The number of unique stimului for this stimulus object
:returns: int -- The expanded trace count
"""
nsegs = sum([len(track) for track in self._segments])
if nsegs == 0:
return 0
ntraces = 1
for irow in range(self._autoParams.... | python | def traceCount(self):
"""The number of unique stimului for this stimulus object
:returns: int -- The expanded trace count
"""
nsegs = sum([len(track) for track in self._segments])
if nsegs == 0:
return 0
ntraces = 1
for irow in range(self._autoParams.... | [
"def",
"traceCount",
"(",
"self",
")",
":",
"nsegs",
"=",
"sum",
"(",
"[",
"len",
"(",
"track",
")",
"for",
"track",
"in",
"self",
".",
"_segments",
"]",
")",
"if",
"nsegs",
"==",
"0",
":",
"return",
"0",
"ntraces",
"=",
"1",
"for",
"irow",
"in",... | The number of unique stimului for this stimulus object
:returns: int -- The expanded trace count | [
"The",
"number",
"of",
"unique",
"stimului",
"for",
"this",
"stimulus",
"object"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L322-L333 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.contains | def contains(self, stimtype):
"""Returns whether the specified stimlus type is a component in this stimulus
:param stimtype: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>` subclass class name to test for membership in the components of this stimulus
... | python | def contains(self, stimtype):
"""Returns whether the specified stimlus type is a component in this stimulus
:param stimtype: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>` subclass class name to test for membership in the components of this stimulus
... | [
"def",
"contains",
"(",
"self",
",",
"stimtype",
")",
":",
"for",
"track",
"in",
"self",
".",
"_segments",
":",
"for",
"component",
"in",
"track",
":",
"if",
"component",
".",
"__class__",
".",
"__name__",
"==",
"stimtype",
":",
"return",
"True",
"return... | Returns whether the specified stimlus type is a component in this stimulus
:param stimtype: :class:`AbstractStimulusComponent<sparkle.stim.abstract_component.AbstractStimulusComponent>` subclass class name to test for membership in the components of this stimulus
:type stimtype: str
:returns: b... | [
"Returns",
"whether",
"the",
"specified",
"stimlus",
"type",
"is",
"a",
"component",
"in",
"this",
"stimulus"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L355-L366 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.purgeAutoSelected | def purgeAutoSelected(self):
"""Clears out orphaned auto parameters"""
params = self._autoParams.allData()
for p in params:
comps_to_remove = []
for comp in p['selection']:
if self.indexByComponent(comp) is None:
comps_to_remove.append(... | python | def purgeAutoSelected(self):
"""Clears out orphaned auto parameters"""
params = self._autoParams.allData()
for p in params:
comps_to_remove = []
for comp in p['selection']:
if self.indexByComponent(comp) is None:
comps_to_remove.append(... | [
"def",
"purgeAutoSelected",
"(",
"self",
")",
":",
"params",
"=",
"self",
".",
"_autoParams",
".",
"allData",
"(",
")",
"for",
"p",
"in",
"params",
":",
"comps_to_remove",
"=",
"[",
"]",
"for",
"comp",
"in",
"p",
"[",
"'selection'",
"]",
":",
"if",
"... | Clears out orphaned auto parameters | [
"Clears",
"out",
"orphaned",
"auto",
"parameters"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L368-L377 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.expandFunction | def expandFunction(self, func, args=[]):
"""applies the given function to each of this stimulus's memerships when autoparamters are applied
:param func: callable to execute for each version of the stimulus
:type instancemethod:
:param args: arguments to feed to func
:type args: ... | python | def expandFunction(self, func, args=[]):
"""applies the given function to each of this stimulus's memerships when autoparamters are applied
:param func: callable to execute for each version of the stimulus
:type instancemethod:
:param args: arguments to feed to func
:type args: ... | [
"def",
"expandFunction",
"(",
"self",
",",
"func",
",",
"args",
"=",
"[",
"]",
")",
":",
"params",
"=",
"self",
".",
"_autoParams",
".",
"allData",
"(",
")",
"steps",
"=",
"self",
".",
"autoParamRanges",
"(",
")",
"ntraces",
"=",
"1",
"for",
"p",
"... | applies the given function to each of this stimulus's memerships when autoparamters are applied
:param func: callable to execute for each version of the stimulus
:type instancemethod:
:param args: arguments to feed to func
:type args: list
:returns: list<results of *func*>, one ... | [
"applies",
"the",
"given",
"function",
"to",
"each",
"of",
"this",
"stimulus",
"s",
"memerships",
"when",
"autoparamters",
"are",
"applied"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L392-L441 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.setReorderFunc | def setReorderFunc(self, func, name=None):
"""Sets the function that reorders the expanded signals of this stimulus
:param func: a function which takes the template doc as an argument
:type func: callable
:param name: a name to assign the function (for documentation purposes)
:t... | python | def setReorderFunc(self, func, name=None):
"""Sets the function that reorders the expanded signals of this stimulus
:param func: a function which takes the template doc as an argument
:type func: callable
:param name: a name to assign the function (for documentation purposes)
:t... | [
"def",
"setReorderFunc",
"(",
"self",
",",
"func",
",",
"name",
"=",
"None",
")",
":",
"self",
".",
"reorder",
"=",
"func",
"self",
".",
"reorderName",
"=",
"name"
] | Sets the function that reorders the expanded signals of this stimulus
:param func: a function which takes the template doc as an argument
:type func: callable
:param name: a name to assign the function (for documentation purposes)
:type name: str | [
"Sets",
"the",
"function",
"that",
"reorders",
"the",
"expanded",
"signals",
"of",
"this",
"stimulus"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L443-L452 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.expandedStim | def expandedStim(self):
"""
Apply the autoparameters to this stimulus and return a list of
the resulting stimuli, a complimentary list of doc dictionaries, and
a complimentary list of undesired attenuations.
:returns: list<numpy.ndarray>, list<dict>, list<float> -- the signals, ... | python | def expandedStim(self):
"""
Apply the autoparameters to this stimulus and return a list of
the resulting stimuli, a complimentary list of doc dictionaries, and
a complimentary list of undesired attenuations.
:returns: list<numpy.ndarray>, list<dict>, list<float> -- the signals, ... | [
"def",
"expandedStim",
"(",
"self",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"'main'",
")",
"logger",
".",
"debug",
"(",
"\"Generating Expanded Stimulus\"",
")",
"signals",
"=",
"self",
".",
"expandFunction",
"(",
"self",
".",
"signal",
")"... | Apply the autoparameters to this stimulus and return a list of
the resulting stimuli, a complimentary list of doc dictionaries, and
a complimentary list of undesired attenuations.
:returns: list<numpy.ndarray>, list<dict>, list<float> -- the signals, their doc, undesired attenuations (dB) | [
"Apply",
"the",
"autoparameters",
"to",
"this",
"stimulus",
"and",
"return",
"a",
"list",
"of",
"the",
"resulting",
"stimuli",
"a",
"complimentary",
"list",
"of",
"doc",
"dictionaries",
"and",
"a",
"complimentary",
"list",
"of",
"undesired",
"attenuations",
"."
... | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L454-L481 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.loadFromTemplate | def loadFromTemplate(template, stim=None):
"""Loads the stimlus to the state provided by a template
:param template: dict that includes all info nesessary to recreate stim
:type template: dict
:param stim: Stimulus to apply to, creates a new model if None
:type stim: StimulusMod... | python | def loadFromTemplate(template, stim=None):
"""Loads the stimlus to the state provided by a template
:param template: dict that includes all info nesessary to recreate stim
:type template: dict
:param stim: Stimulus to apply to, creates a new model if None
:type stim: StimulusMod... | [
"def",
"loadFromTemplate",
"(",
"template",
",",
"stim",
"=",
"None",
")",
":",
"if",
"stim",
"is",
"None",
":",
"stim",
"=",
"StimulusModel",
"(",
")",
"stim",
".",
"setRepCount",
"(",
"template",
"[",
"'reps'",
"]",
")",
"stim",
".",
"setUserTag",
"(... | Loads the stimlus to the state provided by a template
:param template: dict that includes all info nesessary to recreate stim
:type template: dict
:param stim: Stimulus to apply to, creates a new model if None
:type stim: StimulusModel | [
"Loads",
"the",
"stimlus",
"to",
"the",
"state",
"provided",
"by",
"a",
"template"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L506-L538 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.duration | def duration(self):
"""The duration of this stimulus
:returns: float -- duration in seconds
"""
durs = []
for track in self._segments:
durs.append(sum([comp.duration() for comp in track]))
return max(durs) | python | def duration(self):
"""The duration of this stimulus
:returns: float -- duration in seconds
"""
durs = []
for track in self._segments:
durs.append(sum([comp.duration() for comp in track]))
return max(durs) | [
"def",
"duration",
"(",
"self",
")",
":",
"durs",
"=",
"[",
"]",
"for",
"track",
"in",
"self",
".",
"_segments",
":",
"durs",
".",
"append",
"(",
"sum",
"(",
"[",
"comp",
".",
"duration",
"(",
")",
"for",
"comp",
"in",
"track",
"]",
")",
")",
"... | The duration of this stimulus
:returns: float -- duration in seconds | [
"The",
"duration",
"of",
"this",
"stimulus"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L557-L566 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.signal | def signal(self, force_fs=False):
"""The current stimulus in signal representation, this is the sum
of its components
:param force_fs: Allow to use a different samplerate than the default, should be used to recreate historical signals only
:type force_fs: int
:returns: numpy.nda... | python | def signal(self, force_fs=False):
"""The current stimulus in signal representation, this is the sum
of its components
:param force_fs: Allow to use a different samplerate than the default, should be used to recreate historical signals only
:type force_fs: int
:returns: numpy.nda... | [
"def",
"signal",
"(",
"self",
",",
"force_fs",
"=",
"False",
")",
":",
"assert",
"None",
"not",
"in",
"self",
".",
"voltage_limits",
",",
"'Max voltage level not set'",
"if",
"force_fs",
":",
"samplerate",
"=",
"force_fs",
"else",
":",
"samplerate",
"=",
"se... | The current stimulus in signal representation, this is the sum
of its components
:param force_fs: Allow to use a different samplerate than the default, should be used to recreate historical signals only
:type force_fs: int
:returns: numpy.ndarray -- voltage signal for this stimulus | [
"The",
"current",
"stimulus",
"in",
"signal",
"representation",
"this",
"is",
"the",
"sum",
"of",
"its",
"components"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L568-L654 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.componentDoc | def componentDoc(self, starttime=True):
"""The documentation for the components, as a dict
:returns dict -- values are the generation samplerate, and a list of
the individual component docs
"""
samplerate = self.samplerate()
doc_list = []
for ro... | python | def componentDoc(self, starttime=True):
"""The documentation for the components, as a dict
:returns dict -- values are the generation samplerate, and a list of
the individual component docs
"""
samplerate = self.samplerate()
doc_list = []
for ro... | [
"def",
"componentDoc",
"(",
"self",
",",
"starttime",
"=",
"True",
")",
":",
"samplerate",
"=",
"self",
".",
"samplerate",
"(",
")",
"doc_list",
"=",
"[",
"]",
"for",
"row",
",",
"track",
"in",
"enumerate",
"(",
"self",
".",
"_segments",
")",
":",
"s... | The documentation for the components, as a dict
:returns dict -- values are the generation samplerate, and a list of
the individual component docs | [
"The",
"documentation",
"for",
"the",
"components",
"as",
"a",
"dict"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L656-L675 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.warning | def warning(self):
"""Checks Stimulus for any warning conditions
:returns: str -- warning message, if any, 0 otherwise
"""
signals, docs, overs = self.expandedStim()
if np.any(np.array(overs) > 0):
msg = 'Stimuli in this test are over the maximum allowable \
... | python | def warning(self):
"""Checks Stimulus for any warning conditions
:returns: str -- warning message, if any, 0 otherwise
"""
signals, docs, overs = self.expandedStim()
if np.any(np.array(overs) > 0):
msg = 'Stimuli in this test are over the maximum allowable \
... | [
"def",
"warning",
"(",
"self",
")",
":",
"signals",
",",
"docs",
",",
"overs",
"=",
"self",
".",
"expandedStim",
"(",
")",
"if",
"np",
".",
"any",
"(",
"np",
".",
"array",
"(",
"overs",
")",
">",
"0",
")",
":",
"msg",
"=",
"'Stimuli in this test ar... | Checks Stimulus for any warning conditions
:returns: str -- warning message, if any, 0 otherwise | [
"Checks",
"Stimulus",
"for",
"any",
"warning",
"conditions"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L715-L726 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.verifyExpanded | def verifyExpanded(self, samplerate):
"""Checks the expanded parameters for invalidating conditions
:param samplerate: generation samplerate (Hz), passed on to component verification
:type samplerate: int
:returns: str -- error message, if any, 0 otherwise"""
results = self.expa... | python | def verifyExpanded(self, samplerate):
"""Checks the expanded parameters for invalidating conditions
:param samplerate: generation samplerate (Hz), passed on to component verification
:type samplerate: int
:returns: str -- error message, if any, 0 otherwise"""
results = self.expa... | [
"def",
"verifyExpanded",
"(",
"self",
",",
"samplerate",
")",
":",
"results",
"=",
"self",
".",
"expandFunction",
"(",
"self",
".",
"verifyComponents",
",",
"args",
"=",
"(",
"samplerate",
",",
")",
")",
"msg",
"=",
"[",
"x",
"for",
"x",
"in",
"results... | Checks the expanded parameters for invalidating conditions
:param samplerate: generation samplerate (Hz), passed on to component verification
:type samplerate: int
:returns: str -- error message, if any, 0 otherwise | [
"Checks",
"the",
"expanded",
"parameters",
"for",
"invalidating",
"conditions"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L728-L739 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.verifyComponents | def verifyComponents(self, samplerate):
"""Checks the current components for invalidating conditions
:param samplerate: generation samplerate (Hz), passed on to component verification
:type samplerate: int
:returns: str -- error message, if any, 0 otherwise
"""
# flatten... | python | def verifyComponents(self, samplerate):
"""Checks the current components for invalidating conditions
:param samplerate: generation samplerate (Hz), passed on to component verification
:type samplerate: int
:returns: str -- error message, if any, 0 otherwise
"""
# flatten... | [
"def",
"verifyComponents",
"(",
"self",
",",
"samplerate",
")",
":",
"components",
"=",
"[",
"comp",
"for",
"track",
"in",
"self",
".",
"_segments",
"for",
"comp",
"in",
"track",
"]",
"for",
"comp",
"in",
"components",
":",
"msg",
"=",
"comp",
".",
"ve... | Checks the current components for invalidating conditions
:param samplerate: generation samplerate (Hz), passed on to component verification
:type samplerate: int
:returns: str -- error message, if any, 0 otherwise | [
"Checks",
"the",
"current",
"components",
"for",
"invalidating",
"conditions"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L741-L754 | train |
portfors-lab/sparkle | sparkle/stim/stimulus_model.py | StimulusModel.verify | def verify(self, windowSize=None):
"""Checks the stimulus, including expanded parameters for invalidating conditions
:param windowSize: acquistion (recording) window size (seconds)
:type windowSize: float
:returns: str -- error message, if any, 0 otherwise"""
if self.samplerate(... | python | def verify(self, windowSize=None):
"""Checks the stimulus, including expanded parameters for invalidating conditions
:param windowSize: acquistion (recording) window size (seconds)
:type windowSize: float
:returns: str -- error message, if any, 0 otherwise"""
if self.samplerate(... | [
"def",
"verify",
"(",
"self",
",",
"windowSize",
"=",
"None",
")",
":",
"if",
"self",
".",
"samplerate",
"(",
")",
"is",
"None",
":",
"return",
"\"Multiple recording files with conflicting samplerates\"",
"msg",
"=",
"self",
".",
"_autoParams",
".",
"verify",
... | Checks the stimulus, including expanded parameters for invalidating conditions
:param windowSize: acquistion (recording) window size (seconds)
:type windowSize: float
:returns: str -- error message, if any, 0 otherwise | [
"Checks",
"the",
"stimulus",
"including",
"expanded",
"parameters",
"for",
"invalidating",
"conditions"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/stim/stimulus_model.py#L756-L782 | train |
portfors-lab/sparkle | sparkle/acq/daq_tasks.py | get_ao_chans | def get_ao_chans(dev):
"""Discover and return a list of the names of all analog output channels for the given device
:param dev: the device name
:type dev: str
"""
buf = create_string_buffer(256)
buflen = c_uint32(sizeof(buf))
DAQmxGetDevAOPhysicalChans(dev.encode(), buf, buflen)
pybuf ... | python | def get_ao_chans(dev):
"""Discover and return a list of the names of all analog output channels for the given device
:param dev: the device name
:type dev: str
"""
buf = create_string_buffer(256)
buflen = c_uint32(sizeof(buf))
DAQmxGetDevAOPhysicalChans(dev.encode(), buf, buflen)
pybuf ... | [
"def",
"get_ao_chans",
"(",
"dev",
")",
":",
"buf",
"=",
"create_string_buffer",
"(",
"256",
")",
"buflen",
"=",
"c_uint32",
"(",
"sizeof",
"(",
"buf",
")",
")",
"DAQmxGetDevAOPhysicalChans",
"(",
"dev",
".",
"encode",
"(",
")",
",",
"buf",
",",
"buflen"... | Discover and return a list of the names of all analog output channels for the given device
:param dev: the device name
:type dev: str | [
"Discover",
"and",
"return",
"a",
"list",
"of",
"the",
"names",
"of",
"all",
"analog",
"output",
"channels",
"for",
"the",
"given",
"device"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/acq/daq_tasks.py#L313-L324 | train |
portfors-lab/sparkle | sparkle/acq/daq_tasks.py | get_devices | def get_devices():
"""Discover and return a list of the names of all NI devices on this system"""
buf = create_string_buffer(512)
buflen = c_uint32(sizeof(buf))
DAQmxGetSysDevNames(buf, buflen)
pybuf = buf.value
devices = pybuf.decode(u'utf-8').split(u",")
return devices | python | def get_devices():
"""Discover and return a list of the names of all NI devices on this system"""
buf = create_string_buffer(512)
buflen = c_uint32(sizeof(buf))
DAQmxGetSysDevNames(buf, buflen)
pybuf = buf.value
devices = pybuf.decode(u'utf-8').split(u",")
return devices | [
"def",
"get_devices",
"(",
")",
":",
"buf",
"=",
"create_string_buffer",
"(",
"512",
")",
"buflen",
"=",
"c_uint32",
"(",
"sizeof",
"(",
"buf",
")",
")",
"DAQmxGetSysDevNames",
"(",
"buf",
",",
"buflen",
")",
"pybuf",
"=",
"buf",
".",
"value",
"devices",... | Discover and return a list of the names of all NI devices on this system | [
"Discover",
"and",
"return",
"a",
"list",
"of",
"the",
"names",
"of",
"all",
"NI",
"devices",
"on",
"this",
"system"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/acq/daq_tasks.py#L339-L346 | train |
portfors-lab/sparkle | sparkle/acq/daq_tasks.py | AOTask.write | def write(self, output):
"""Writes the data to be output to the device buffer, output will be looped when the data runs out
:param output: data to output
:type output: numpy.ndarray
"""
w = c_int32()
# print "output max", max(abs(output))
self.WriteAnalogF64(self... | python | def write(self, output):
"""Writes the data to be output to the device buffer, output will be looped when the data runs out
:param output: data to output
:type output: numpy.ndarray
"""
w = c_int32()
# print "output max", max(abs(output))
self.WriteAnalogF64(self... | [
"def",
"write",
"(",
"self",
",",
"output",
")",
":",
"w",
"=",
"c_int32",
"(",
")",
"self",
".",
"WriteAnalogF64",
"(",
"self",
".",
"bufsize",
",",
"0",
",",
"10.0",
",",
"DAQmx_Val_GroupByChannel",
",",
"output",
",",
"w",
",",
"None",
")"
] | Writes the data to be output to the device buffer, output will be looped when the data runs out
:param output: data to output
:type output: numpy.ndarray | [
"Writes",
"the",
"data",
"to",
"be",
"output",
"to",
"the",
"device",
"buffer",
"output",
"will",
"be",
"looped",
"when",
"the",
"data",
"runs",
"out"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/acq/daq_tasks.py#L109-L118 | train |
portfors-lab/sparkle | sparkle/gui/plotting/calibration_explore_display.py | ExtendedCalibrationDisplay.setXlimits | def setXlimits(self, lims):
"""Sets the X axis limits of the signal plots
:param lims: (min, max) of x axis, in same units as data
:type lims: (float, float)
"""
self.responseSignalPlot.setXlim(lims)
self.stimSignalPlot.setXlim(lims) | python | def setXlimits(self, lims):
"""Sets the X axis limits of the signal plots
:param lims: (min, max) of x axis, in same units as data
:type lims: (float, float)
"""
self.responseSignalPlot.setXlim(lims)
self.stimSignalPlot.setXlim(lims) | [
"def",
"setXlimits",
"(",
"self",
",",
"lims",
")",
":",
"self",
".",
"responseSignalPlot",
".",
"setXlim",
"(",
"lims",
")",
"self",
".",
"stimSignalPlot",
".",
"setXlim",
"(",
"lims",
")"
] | Sets the X axis limits of the signal plots
:param lims: (min, max) of x axis, in same units as data
:type lims: (float, float) | [
"Sets",
"the",
"X",
"axis",
"limits",
"of",
"the",
"signal",
"plots"
] | 5fad1cf2bec58ec6b15d91da20f6236a74826110 | https://github.com/portfors-lab/sparkle/blob/5fad1cf2bec58ec6b15d91da20f6236a74826110/sparkle/gui/plotting/calibration_explore_display.py#L136-L143 | train |
NoviceLive/pat | pat/pat.py | Pat.from_chars | def from_chars(cls, chars='', optimal=3):
"""Construct a Pat object from the specified string
and optimal position count."""
if not chars:
chars = ''.join(ALNUM)
sets = most_even_chunk(chars, optimal)
return cls(sets) | python | def from_chars(cls, chars='', optimal=3):
"""Construct a Pat object from the specified string
and optimal position count."""
if not chars:
chars = ''.join(ALNUM)
sets = most_even_chunk(chars, optimal)
return cls(sets) | [
"def",
"from_chars",
"(",
"cls",
",",
"chars",
"=",
"''",
",",
"optimal",
"=",
"3",
")",
":",
"if",
"not",
"chars",
":",
"chars",
"=",
"''",
".",
"join",
"(",
"ALNUM",
")",
"sets",
"=",
"most_even_chunk",
"(",
"chars",
",",
"optimal",
")",
"return"... | Construct a Pat object from the specified string
and optimal position count. | [
"Construct",
"a",
"Pat",
"object",
"from",
"the",
"specified",
"string",
"and",
"optimal",
"position",
"count",
"."
] | bd223fc5e758213662befbebdf9538f3fbf58ad6 | https://github.com/NoviceLive/pat/blob/bd223fc5e758213662befbebdf9538f3fbf58ad6/pat/pat.py#L47-L53 | train |
NoviceLive/pat | pat/pat.py | Pat.create | def create(self, count):
"""Create a pattern of the specified length."""
space, self.space = tee(self.space)
limit = reduce(mul, map(len, self.sets)) * self.position
logging.debug('limit: %s', limit)
if limit >= count:
return ''.join(islice(space, count))
else... | python | def create(self, count):
"""Create a pattern of the specified length."""
space, self.space = tee(self.space)
limit = reduce(mul, map(len, self.sets)) * self.position
logging.debug('limit: %s', limit)
if limit >= count:
return ''.join(islice(space, count))
else... | [
"def",
"create",
"(",
"self",
",",
"count",
")",
":",
"space",
",",
"self",
".",
"space",
"=",
"tee",
"(",
"self",
".",
"space",
")",
"limit",
"=",
"reduce",
"(",
"mul",
",",
"map",
"(",
"len",
",",
"self",
".",
"sets",
")",
")",
"*",
"self",
... | Create a pattern of the specified length. | [
"Create",
"a",
"pattern",
"of",
"the",
"specified",
"length",
"."
] | bd223fc5e758213662befbebdf9538f3fbf58ad6 | https://github.com/NoviceLive/pat/blob/bd223fc5e758213662befbebdf9538f3fbf58ad6/pat/pat.py#L63-L72 | train |
NoviceLive/pat | pat/pat.py | Pat.locate | def locate(self, pattern, big_endian=False):
"""Locate the pattern."""
space, self.space = tee(self.space)
if pattern.startswith('0x'):
target = unhexlify(
pattern[2:].encode('utf-8')).decode('utf-8')
if not big_endian:
target = target[::-1... | python | def locate(self, pattern, big_endian=False):
"""Locate the pattern."""
space, self.space = tee(self.space)
if pattern.startswith('0x'):
target = unhexlify(
pattern[2:].encode('utf-8')).decode('utf-8')
if not big_endian:
target = target[::-1... | [
"def",
"locate",
"(",
"self",
",",
"pattern",
",",
"big_endian",
"=",
"False",
")",
":",
"space",
",",
"self",
".",
"space",
"=",
"tee",
"(",
"self",
".",
"space",
")",
"if",
"pattern",
".",
"startswith",
"(",
"'0x'",
")",
":",
"target",
"=",
"unhe... | Locate the pattern. | [
"Locate",
"the",
"pattern",
"."
] | bd223fc5e758213662befbebdf9538f3fbf58ad6 | https://github.com/NoviceLive/pat/blob/bd223fc5e758213662befbebdf9538f3fbf58ad6/pat/pat.py#L74-L88 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/common.py | preserve_namespace | def preserve_namespace(newns=None):
"""Contextmanager that will restore the current namespace
:param newns: a name of namespace that should be set in the beginning. the original namespace will be restored afterwards.
If None, does not set a namespace.
:type newns: str | None
:returns:... | python | def preserve_namespace(newns=None):
"""Contextmanager that will restore the current namespace
:param newns: a name of namespace that should be set in the beginning. the original namespace will be restored afterwards.
If None, does not set a namespace.
:type newns: str | None
:returns:... | [
"def",
"preserve_namespace",
"(",
"newns",
"=",
"None",
")",
":",
"ns",
"=",
"cmds",
".",
"namespaceInfo",
"(",
"an",
"=",
"True",
")",
"try",
":",
"cmds",
".",
"namespace",
"(",
"set",
"=",
"newns",
")",
"yield",
"finally",
":",
"cmds",
".",
"namesp... | Contextmanager that will restore the current namespace
:param newns: a name of namespace that should be set in the beginning. the original namespace will be restored afterwards.
If None, does not set a namespace.
:type newns: str | None
:returns: None
:rtype: None
:raises: None | [
"Contextmanager",
"that",
"will",
"restore",
"the",
"current",
"namespace"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/common.py#L8-L23 | train |
JukeboxPipeline/jukeboxmaya | src/jukeboxmaya/common.py | preserve_selection | def preserve_selection():
"""Contextmanager that will restore the current selection
:returns: None
:rtype: None
:raises: None
"""
sl = cmds.ls(sl=True)
try:
yield
finally:
cmds.select(sl, replace=True) | python | def preserve_selection():
"""Contextmanager that will restore the current selection
:returns: None
:rtype: None
:raises: None
"""
sl = cmds.ls(sl=True)
try:
yield
finally:
cmds.select(sl, replace=True) | [
"def",
"preserve_selection",
"(",
")",
":",
"sl",
"=",
"cmds",
".",
"ls",
"(",
"sl",
"=",
"True",
")",
"try",
":",
"yield",
"finally",
":",
"cmds",
".",
"select",
"(",
"sl",
",",
"replace",
"=",
"True",
")"
] | Contextmanager that will restore the current selection
:returns: None
:rtype: None
:raises: None | [
"Contextmanager",
"that",
"will",
"restore",
"the",
"current",
"selection"
] | c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c | https://github.com/JukeboxPipeline/jukeboxmaya/blob/c8d6318d53cdb5493453c4a6b65ef75bdb2d5f2c/src/jukeboxmaya/common.py#L27-L38 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.