text
stringlengths
0
828
slot | <callable>
:return <bool> | is connected
""""""
sig_calls = self._callbacks.get(signal, [])
for callback in sig_calls:
if callback == slot:
return True
return False"
3739,"def emit(self, signal, *args):
""""""
Emits the given signal with the inputted args. This will go through
its list of connected callback slots and call them.
:param signal | <variant>
*args | variables
""""""
callbacks = self._callbacks.get(signal, [])
new_callbacks = []
for callback in callbacks:
# clear out deleted pointers
if not callback.isValid():
continue
new_callbacks.append(callback)
try:
callback(*args)
except StandardError:
logger.exception('Error occurred during callback.')
self._callbacks[signal] = new_callbacks"
3740,"def generate_example(config, ext='json'):
""""""Generate an example file based on the given Configuration object.
Args:
config (confpy.core.configuration.Configuration): The configuration
object on which to base the example.
ext (str): The file extension to render. Choices: JSON and INI.
Returns:
str: The text of the example file.
""""""
template_name = 'example.{0}'.format(ext.lower())
template = ENV.get_template(template_name)
return template.render(config=config)"
3741,"def run(self):
"""""" Run at parse time.
When the documents are initially being scanned, this method runs
and does two things: (a) creates an instance that is added to
the site's widgets, and (b) leaves behind a placeholder docutils
node that can later be processed after the docs are resolved.
The latter needs enough information to retrieve the former.
""""""
rtype = self.name
resource_content = '\n'.join(self.content)
resource_class = ResourceDirective.get_resource_class(rtype)
this_resource = resource_class(self.docname, rtype, resource_content)
# Add this resource to the site
self.resources[this_resource.docname] = this_resource
# Don't need to return a resource ""node"", the document is the node
return []"
3742,"def importProteinDatabase(filePath, proteindb=None, headerParser=None,
forceId=False, decoyTag='[decoy]', contaminationTag='[cont]',
ignoreIsoleucine=False, cleavageRule='[KR]', minLength=5, maxLength=40,
missedCleavage=0, removeNtermM=False):
""""""Generates a :class:`ProteinDatabase` by in silico digestion of proteins
from a fasta file.
:param filePath: File path
:param proteindb: optional an existing :class:`ProteinDatabase` can be
specified, otherwise a new instance is generated and returned
:param decoyTag: If a fasta file contains decoy protein entries, they should
be specified with a sequence tag
:param contaminationTag: If a fasta file contains contamination protein
entries, they should be specified with a sequence tag
:param headerParser: optional, allows specifying an individual headerParser
:param forceId: bool, if True and no id can be extracted from the fasta
header the whole header sequence is used as a protein id instead of
raising an exception.
:param cleavageRule: cleavage rule expressed in a regular expression, see
:attr:`maspy.constants.expasy_rules`
:param missedCleavage: number of allowed missed cleavage sites
:param removeNtermM: bool, True to consider also peptides with the
N-terminal Methionine of the protein removed
:param minLength: int, only yield peptides with length >= minLength
:param maxLength: int, only yield peptides with length <= maxLength
:param ignoreIsoleucine: bool, if True treat Isoleucine and Leucine in
peptide sequences as indistinguishable
See also :func:`maspy.peptidemethods.digestInSilico`
""""""
if proteindb is None:
proteindb = ProteinDatabase(ignoreIsoleucine=ignoreIsoleucine)