id int32 0 252k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
55,600 | mikebryant/django-autoconfig | django_autoconfig/autoconfig.py | configure_urls | def configure_urls(apps, index_view=None, prefixes=None):
'''
Configure urls from a list of apps.
'''
prefixes = prefixes or {}
urlpatterns = patterns('')
if index_view:
from django.views.generic.base import RedirectView
urlpatterns += patterns('',
url(r'^$', Redirec... | python | def configure_urls(apps, index_view=None, prefixes=None):
'''
Configure urls from a list of apps.
'''
prefixes = prefixes or {}
urlpatterns = patterns('')
if index_view:
from django.views.generic.base import RedirectView
urlpatterns += patterns('',
url(r'^$', Redirec... | [
"def",
"configure_urls",
"(",
"apps",
",",
"index_view",
"=",
"None",
",",
"prefixes",
"=",
"None",
")",
":",
"prefixes",
"=",
"prefixes",
"or",
"{",
"}",
"urlpatterns",
"=",
"patterns",
"(",
"''",
")",
"if",
"index_view",
":",
"from",
"django",
".",
"... | Configure urls from a list of apps. | [
"Configure",
"urls",
"from",
"a",
"list",
"of",
"apps",
"."
] | 1ce793e95b024dccb189de1dc111dc4ae6c2f3a6 | https://github.com/mikebryant/django-autoconfig/blob/1ce793e95b024dccb189de1dc111dc4ae6c2f3a6/django_autoconfig/autoconfig.py#L200-L230 |
55,601 | thunder-project/thunder-registration | registration/utils.py | check_images | def check_images(data):
"""
Check and reformat input images if needed
"""
if isinstance(data, ndarray):
data = fromarray(data)
if not isinstance(data, Images):
data = fromarray(asarray(data))
if len(data.shape) not in set([3, 4]):
raise Exception('Number of image di... | python | def check_images(data):
"""
Check and reformat input images if needed
"""
if isinstance(data, ndarray):
data = fromarray(data)
if not isinstance(data, Images):
data = fromarray(asarray(data))
if len(data.shape) not in set([3, 4]):
raise Exception('Number of image di... | [
"def",
"check_images",
"(",
"data",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"ndarray",
")",
":",
"data",
"=",
"fromarray",
"(",
"data",
")",
"if",
"not",
"isinstance",
"(",
"data",
",",
"Images",
")",
":",
"data",
"=",
"fromarray",
"(",
"asar... | Check and reformat input images if needed | [
"Check",
"and",
"reformat",
"input",
"images",
"if",
"needed"
] | 286f091e6c402d592e9686d4821e0fd80dbf86ec | https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/utils.py#L4-L17 |
55,602 | thunder-project/thunder-registration | registration/utils.py | check_reference | def check_reference(images, reference):
"""
Ensure the reference matches image dimensions
"""
if not images.shape[1:] == reference.shape:
raise Exception('Image shape %s and reference shape %s must match'
% (images.shape[1:], reference.shape))
return reference | python | def check_reference(images, reference):
"""
Ensure the reference matches image dimensions
"""
if not images.shape[1:] == reference.shape:
raise Exception('Image shape %s and reference shape %s must match'
% (images.shape[1:], reference.shape))
return reference | [
"def",
"check_reference",
"(",
"images",
",",
"reference",
")",
":",
"if",
"not",
"images",
".",
"shape",
"[",
"1",
":",
"]",
"==",
"reference",
".",
"shape",
":",
"raise",
"Exception",
"(",
"'Image shape %s and reference shape %s must match'",
"%",
"(",
"imag... | Ensure the reference matches image dimensions | [
"Ensure",
"the",
"reference",
"matches",
"image",
"dimensions"
] | 286f091e6c402d592e9686d4821e0fd80dbf86ec | https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/utils.py#L19-L26 |
55,603 | flo-compbio/genometools | genometools/expression/gene.py | ExpGene.from_dict | def from_dict(cls, data: Dict[str, Union[str, int]]):
"""Generate an `ExpGene` object from a dictionary.
Parameters
----------
data : dict
A dictionary with keys corresponding to attribute names.
Attributes with missing keys will be assigned `None`.
Retu... | python | def from_dict(cls, data: Dict[str, Union[str, int]]):
"""Generate an `ExpGene` object from a dictionary.
Parameters
----------
data : dict
A dictionary with keys corresponding to attribute names.
Attributes with missing keys will be assigned `None`.
Retu... | [
"def",
"from_dict",
"(",
"cls",
",",
"data",
":",
"Dict",
"[",
"str",
",",
"Union",
"[",
"str",
",",
"int",
"]",
"]",
")",
":",
"assert",
"isinstance",
"(",
"data",
",",
"dict",
")",
"if",
"'ensembl_id'",
"not",
"in",
"data",
":",
"raise",
"ValueEr... | Generate an `ExpGene` object from a dictionary.
Parameters
----------
data : dict
A dictionary with keys corresponding to attribute names.
Attributes with missing keys will be assigned `None`.
Returns
-------
`ExpGene`
The gene. | [
"Generate",
"an",
"ExpGene",
"object",
"from",
"a",
"dictionary",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/gene.py#L156-L186 |
55,604 | acorg/dark-matter | dark/intervals.py | ReadIntervals.add | def add(self, start, end):
"""
Add the start and end offsets of a matching read.
@param start: The C{int} start offset of the read match in the subject.
@param end: The C{int} end offset of the read match in the subject.
This is Python-style: the end offset is not included i... | python | def add(self, start, end):
"""
Add the start and end offsets of a matching read.
@param start: The C{int} start offset of the read match in the subject.
@param end: The C{int} end offset of the read match in the subject.
This is Python-style: the end offset is not included i... | [
"def",
"add",
"(",
"self",
",",
"start",
",",
"end",
")",
":",
"assert",
"start",
"<=",
"end",
"self",
".",
"_intervals",
".",
"append",
"(",
"(",
"start",
",",
"end",
")",
")"
] | Add the start and end offsets of a matching read.
@param start: The C{int} start offset of the read match in the subject.
@param end: The C{int} end offset of the read match in the subject.
This is Python-style: the end offset is not included in the match. | [
"Add",
"the",
"start",
"and",
"end",
"offsets",
"of",
"a",
"matching",
"read",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L20-L29 |
55,605 | acorg/dark-matter | dark/intervals.py | ReadIntervals.walk | def walk(self):
"""
Get the non-overlapping read intervals that match the subject.
@return: A generator that produces (TYPE, (START, END)) tuples, where
where TYPE is either self.EMPTY or self.FULL and (START, STOP) is
the interval. The endpoint (STOP) of the interval is... | python | def walk(self):
"""
Get the non-overlapping read intervals that match the subject.
@return: A generator that produces (TYPE, (START, END)) tuples, where
where TYPE is either self.EMPTY or self.FULL and (START, STOP) is
the interval. The endpoint (STOP) of the interval is... | [
"def",
"walk",
"(",
"self",
")",
":",
"intervals",
"=",
"sorted",
"(",
"self",
".",
"_intervals",
")",
"def",
"nextFull",
"(",
")",
":",
"start",
",",
"stop",
"=",
"intervals",
".",
"pop",
"(",
"0",
")",
"while",
"intervals",
":",
"if",
"intervals",
... | Get the non-overlapping read intervals that match the subject.
@return: A generator that produces (TYPE, (START, END)) tuples, where
where TYPE is either self.EMPTY or self.FULL and (START, STOP) is
the interval. The endpoint (STOP) of the interval is not considered
to be in... | [
"Get",
"the",
"non",
"-",
"overlapping",
"read",
"intervals",
"that",
"match",
"the",
"subject",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L31-L72 |
55,606 | acorg/dark-matter | dark/intervals.py | ReadIntervals.coverage | def coverage(self):
"""
Get the fraction of a subject is matched by its set of reads.
@return: The C{float} fraction of a subject matched by its reads.
"""
if self._targetLength == 0:
return 0.0
coverage = 0
for (intervalType, (start, end)) in self.w... | python | def coverage(self):
"""
Get the fraction of a subject is matched by its set of reads.
@return: The C{float} fraction of a subject matched by its reads.
"""
if self._targetLength == 0:
return 0.0
coverage = 0
for (intervalType, (start, end)) in self.w... | [
"def",
"coverage",
"(",
"self",
")",
":",
"if",
"self",
".",
"_targetLength",
"==",
"0",
":",
"return",
"0.0",
"coverage",
"=",
"0",
"for",
"(",
"intervalType",
",",
"(",
"start",
",",
"end",
")",
")",
"in",
"self",
".",
"walk",
"(",
")",
":",
"i... | Get the fraction of a subject is matched by its set of reads.
@return: The C{float} fraction of a subject matched by its reads. | [
"Get",
"the",
"fraction",
"of",
"a",
"subject",
"is",
"matched",
"by",
"its",
"set",
"of",
"reads",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L74-L89 |
55,607 | acorg/dark-matter | dark/intervals.py | ReadIntervals.coverageCounts | def coverageCounts(self):
"""
For each location in the subject, return a count of how many times that
location is covered by a read.
@return: a C{Counter} where the keys are the C{int} locations on the
subject and the value is the number of times the location is
... | python | def coverageCounts(self):
"""
For each location in the subject, return a count of how many times that
location is covered by a read.
@return: a C{Counter} where the keys are the C{int} locations on the
subject and the value is the number of times the location is
... | [
"def",
"coverageCounts",
"(",
"self",
")",
":",
"coverageCounts",
"=",
"Counter",
"(",
")",
"for",
"start",
",",
"end",
"in",
"self",
".",
"_intervals",
":",
"coverageCounts",
".",
"update",
"(",
"range",
"(",
"max",
"(",
"0",
",",
"start",
")",
",",
... | For each location in the subject, return a count of how many times that
location is covered by a read.
@return: a C{Counter} where the keys are the C{int} locations on the
subject and the value is the number of times the location is
covered by a read. | [
"For",
"each",
"location",
"in",
"the",
"subject",
"return",
"a",
"count",
"of",
"how",
"many",
"times",
"that",
"location",
"is",
"covered",
"by",
"a",
"read",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L91-L104 |
55,608 | acorg/dark-matter | dark/intervals.py | OffsetAdjuster._reductionForOffset | def _reductionForOffset(self, offset):
"""
Calculate the total reduction for a given X axis offset.
@param offset: The C{int} offset.
@return: The total C{float} reduction that should be made for this
offset.
"""
reduction = 0
for (thisOffset, thisRed... | python | def _reductionForOffset(self, offset):
"""
Calculate the total reduction for a given X axis offset.
@param offset: The C{int} offset.
@return: The total C{float} reduction that should be made for this
offset.
"""
reduction = 0
for (thisOffset, thisRed... | [
"def",
"_reductionForOffset",
"(",
"self",
",",
"offset",
")",
":",
"reduction",
"=",
"0",
"for",
"(",
"thisOffset",
",",
"thisReduction",
")",
"in",
"self",
".",
"_adjustments",
":",
"if",
"offset",
">=",
"thisOffset",
":",
"reduction",
"+=",
"thisReduction... | Calculate the total reduction for a given X axis offset.
@param offset: The C{int} offset.
@return: The total C{float} reduction that should be made for this
offset. | [
"Calculate",
"the",
"total",
"reduction",
"for",
"a",
"given",
"X",
"axis",
"offset",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L136-L150 |
55,609 | acorg/dark-matter | dark/intervals.py | OffsetAdjuster.adjustHSP | def adjustHSP(self, hsp):
"""
Adjust the read and subject start and end offsets in an HSP.
@param hsp: a L{dark.hsp.HSP} or L{dark.hsp.LSP} instance.
"""
reduction = self._reductionForOffset(
min(hsp.readStartInSubject, hsp.subjectStart))
hsp.readEndInSubjec... | python | def adjustHSP(self, hsp):
"""
Adjust the read and subject start and end offsets in an HSP.
@param hsp: a L{dark.hsp.HSP} or L{dark.hsp.LSP} instance.
"""
reduction = self._reductionForOffset(
min(hsp.readStartInSubject, hsp.subjectStart))
hsp.readEndInSubjec... | [
"def",
"adjustHSP",
"(",
"self",
",",
"hsp",
")",
":",
"reduction",
"=",
"self",
".",
"_reductionForOffset",
"(",
"min",
"(",
"hsp",
".",
"readStartInSubject",
",",
"hsp",
".",
"subjectStart",
")",
")",
"hsp",
".",
"readEndInSubject",
"=",
"hsp",
".",
"r... | Adjust the read and subject start and end offsets in an HSP.
@param hsp: a L{dark.hsp.HSP} or L{dark.hsp.LSP} instance. | [
"Adjust",
"the",
"read",
"and",
"subject",
"start",
"and",
"end",
"offsets",
"in",
"an",
"HSP",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/intervals.py#L161-L173 |
55,610 | flo-compbio/genometools | genometools/basic/gene_set_collection.py | GeneSetCollection.get_by_index | def get_by_index(self, i):
"""Look up a gene set by its index.
Parameters
----------
i: int
The index of the gene set.
Returns
-------
GeneSet
The gene set.
Raises
------
ValueError
If the given index ... | python | def get_by_index(self, i):
"""Look up a gene set by its index.
Parameters
----------
i: int
The index of the gene set.
Returns
-------
GeneSet
The gene set.
Raises
------
ValueError
If the given index ... | [
"def",
"get_by_index",
"(",
"self",
",",
"i",
")",
":",
"if",
"i",
">=",
"self",
".",
"n",
":",
"raise",
"ValueError",
"(",
"'Index %d out of bounds '",
"%",
"i",
"+",
"'for database with %d gene sets.'",
"%",
"self",
".",
"n",
")",
"return",
"self",
".",
... | Look up a gene set by its index.
Parameters
----------
i: int
The index of the gene set.
Returns
-------
GeneSet
The gene set.
Raises
------
ValueError
If the given index is out of bounds. | [
"Look",
"up",
"a",
"gene",
"set",
"by",
"its",
"index",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set_collection.py#L159-L180 |
55,611 | flo-compbio/genometools | genometools/basic/gene_set_collection.py | GeneSetCollection.read_tsv | def read_tsv(cls, path, encoding='utf-8'):
"""Read a gene set database from a tab-delimited text file.
Parameters
----------
path: str
The path name of the the file.
encoding: str
The encoding of the text file.
Returns
-------
Non... | python | def read_tsv(cls, path, encoding='utf-8'):
"""Read a gene set database from a tab-delimited text file.
Parameters
----------
path: str
The path name of the the file.
encoding: str
The encoding of the text file.
Returns
-------
Non... | [
"def",
"read_tsv",
"(",
"cls",
",",
"path",
",",
"encoding",
"=",
"'utf-8'",
")",
":",
"gene_sets",
"=",
"[",
"]",
"n",
"=",
"0",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"fh",
":",
"reader",
"=",
"csv",
".",
"reader",
"(",
"fh",
",... | Read a gene set database from a tab-delimited text file.
Parameters
----------
path: str
The path name of the the file.
encoding: str
The encoding of the text file.
Returns
-------
None | [
"Read",
"a",
"gene",
"set",
"database",
"from",
"a",
"tab",
"-",
"delimited",
"text",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set_collection.py#L206-L230 |
55,612 | flo-compbio/genometools | genometools/basic/gene_set_collection.py | GeneSetCollection.write_tsv | def write_tsv(self, path):
"""Write the database to a tab-delimited text file.
Parameters
----------
path: str
The path name of the file.
Returns
-------
None
"""
with open(path, 'wb') as ofh:
writer = csv.writer(
... | python | def write_tsv(self, path):
"""Write the database to a tab-delimited text file.
Parameters
----------
path: str
The path name of the file.
Returns
-------
None
"""
with open(path, 'wb') as ofh:
writer = csv.writer(
... | [
"def",
"write_tsv",
"(",
"self",
",",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'wb'",
")",
"as",
"ofh",
":",
"writer",
"=",
"csv",
".",
"writer",
"(",
"ofh",
",",
"dialect",
"=",
"'excel-tab'",
",",
"quoting",
"=",
"csv",
".",
"QUOTE_NO... | Write the database to a tab-delimited text file.
Parameters
----------
path: str
The path name of the file.
Returns
-------
None | [
"Write",
"the",
"database",
"to",
"a",
"tab",
"-",
"delimited",
"text",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set_collection.py#L232-L250 |
55,613 | flo-compbio/genometools | genometools/basic/gene_set_collection.py | GeneSetCollection.read_msigdb_xml | def read_msigdb_xml(cls, path, entrez2gene, species=None): # pragma: no cover
"""Read the complete MSigDB database from an XML file.
The XML file can be downloaded from here:
http://software.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/5.0/msigdb_v5.0.xml
... | python | def read_msigdb_xml(cls, path, entrez2gene, species=None): # pragma: no cover
"""Read the complete MSigDB database from an XML file.
The XML file can be downloaded from here:
http://software.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/5.0/msigdb_v5.0.xml
... | [
"def",
"read_msigdb_xml",
"(",
"cls",
",",
"path",
",",
"entrez2gene",
",",
"species",
"=",
"None",
")",
":",
"# pragma: no cover",
"# note: is XML file really encoded in UTF-8?",
"assert",
"isinstance",
"(",
"path",
",",
"(",
"str",
",",
"_oldstr",
")",
")",
"a... | Read the complete MSigDB database from an XML file.
The XML file can be downloaded from here:
http://software.broadinstitute.org/gsea/msigdb/download_file.jsp?filePath=/resources/msigdb/5.0/msigdb_v5.0.xml
Parameters
----------
path: str
The path name of the XML fil... | [
"Read",
"the",
"complete",
"MSigDB",
"database",
"from",
"an",
"XML",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set_collection.py#L253-L354 |
55,614 | acorg/dark-matter | dark/features.py | Feature.legendLabel | def legendLabel(self):
"""
Provide a textual description of the feature and its qualifiers to be
used as a label in a plot legend.
@return: A C{str} description of the feature.
"""
excludedQualifiers = set((
'codon_start', 'db_xref', 'protein_id', 'region_nam... | python | def legendLabel(self):
"""
Provide a textual description of the feature and its qualifiers to be
used as a label in a plot legend.
@return: A C{str} description of the feature.
"""
excludedQualifiers = set((
'codon_start', 'db_xref', 'protein_id', 'region_nam... | [
"def",
"legendLabel",
"(",
"self",
")",
":",
"excludedQualifiers",
"=",
"set",
"(",
"(",
"'codon_start'",
",",
"'db_xref'",
",",
"'protein_id'",
",",
"'region_name'",
",",
"'ribosomal_slippage'",
",",
"'rpt_type'",
",",
"'translation'",
",",
"'transl_except'",
","... | Provide a textual description of the feature and its qualifiers to be
used as a label in a plot legend.
@return: A C{str} description of the feature. | [
"Provide",
"a",
"textual",
"description",
"of",
"the",
"feature",
"and",
"its",
"qualifiers",
"to",
"be",
"used",
"as",
"a",
"label",
"in",
"a",
"plot",
"legend",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/features.py#L52-L80 |
55,615 | zniper/simple-article | article/templatetags/article_tags.py | recent_articles | def recent_articles(limit=10, exclude=None):
"""Returns list of latest article"""
queryset = Article.objects.filter(published=True).order_by('-modified')
if exclude:
if hasattr(exclude, '__iter__'):
queryset = queryset.exclude(pk__in=exclude)
else:
queryset = queryset... | python | def recent_articles(limit=10, exclude=None):
"""Returns list of latest article"""
queryset = Article.objects.filter(published=True).order_by('-modified')
if exclude:
if hasattr(exclude, '__iter__'):
queryset = queryset.exclude(pk__in=exclude)
else:
queryset = queryset... | [
"def",
"recent_articles",
"(",
"limit",
"=",
"10",
",",
"exclude",
"=",
"None",
")",
":",
"queryset",
"=",
"Article",
".",
"objects",
".",
"filter",
"(",
"published",
"=",
"True",
")",
".",
"order_by",
"(",
"'-modified'",
")",
"if",
"exclude",
":",
"if... | Returns list of latest article | [
"Returns",
"list",
"of",
"latest",
"article"
] | db605bdd966e7023f27870d040804798db606522 | https://github.com/zniper/simple-article/blob/db605bdd966e7023f27870d040804798db606522/article/templatetags/article_tags.py#L9-L17 |
55,616 | digidotcom/python-streamexpect | streamexpect.py | _flatten | def _flatten(n):
"""Recursively flatten a mixed sequence of sub-sequences and items"""
if isinstance(n, collections.Sequence):
for x in n:
for y in _flatten(x):
yield y
else:
yield n | python | def _flatten(n):
"""Recursively flatten a mixed sequence of sub-sequences and items"""
if isinstance(n, collections.Sequence):
for x in n:
for y in _flatten(x):
yield y
else:
yield n | [
"def",
"_flatten",
"(",
"n",
")",
":",
"if",
"isinstance",
"(",
"n",
",",
"collections",
".",
"Sequence",
")",
":",
"for",
"x",
"in",
"n",
":",
"for",
"y",
"in",
"_flatten",
"(",
"x",
")",
":",
"yield",
"y",
"else",
":",
"yield",
"n"
] | Recursively flatten a mixed sequence of sub-sequences and items | [
"Recursively",
"flatten",
"a",
"mixed",
"sequence",
"of",
"sub",
"-",
"sequences",
"and",
"items"
] | 9ab894506ffd679b37230e935158ff3b0aa170ab | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L259-L266 |
55,617 | digidotcom/python-streamexpect | streamexpect.py | wrap | def wrap(stream, unicode=False, window=1024, echo=False, close_stream=True):
"""Wrap a stream to implement expect functionality.
This function provides a convenient way to wrap any Python stream (a
file-like object) or socket with an appropriate :class:`Expecter` class for
the stream type. The returned... | python | def wrap(stream, unicode=False, window=1024, echo=False, close_stream=True):
"""Wrap a stream to implement expect functionality.
This function provides a convenient way to wrap any Python stream (a
file-like object) or socket with an appropriate :class:`Expecter` class for
the stream type. The returned... | [
"def",
"wrap",
"(",
"stream",
",",
"unicode",
"=",
"False",
",",
"window",
"=",
"1024",
",",
"echo",
"=",
"False",
",",
"close_stream",
"=",
"True",
")",
":",
"if",
"hasattr",
"(",
"stream",
",",
"'read'",
")",
":",
"proxy",
"=",
"PollingStreamAdapter"... | Wrap a stream to implement expect functionality.
This function provides a convenient way to wrap any Python stream (a
file-like object) or socket with an appropriate :class:`Expecter` class for
the stream type. The returned object adds an :func:`Expect.expect` method
to the stream, while passing normal... | [
"Wrap",
"a",
"stream",
"to",
"implement",
"expect",
"functionality",
"."
] | 9ab894506ffd679b37230e935158ff3b0aa170ab | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L740-L790 |
55,618 | digidotcom/python-streamexpect | streamexpect.py | BytesSearcher.search | def search(self, buf):
"""Search the provided buffer for matching bytes.
Search the provided buffer for matching bytes. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Seque... | python | def search(self, buf):
"""Search the provided buffer for matching bytes.
Search the provided buffer for matching bytes. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Seque... | [
"def",
"search",
"(",
"self",
",",
"buf",
")",
":",
"idx",
"=",
"self",
".",
"_check_type",
"(",
"buf",
")",
".",
"find",
"(",
"self",
".",
"_bytes",
")",
"if",
"idx",
"<",
"0",
":",
"return",
"None",
"else",
":",
"start",
"=",
"idx",
"end",
"=... | Search the provided buffer for matching bytes.
Search the provided buffer for matching bytes. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`SequenceMatch` if matched, None if no m... | [
"Search",
"the",
"provided",
"buffer",
"for",
"matching",
"bytes",
"."
] | 9ab894506ffd679b37230e935158ff3b0aa170ab | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L143-L158 |
55,619 | digidotcom/python-streamexpect | streamexpect.py | TextSearcher.search | def search(self, buf):
"""Search the provided buffer for matching text.
Search the provided buffer for matching text. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Sequenc... | python | def search(self, buf):
"""Search the provided buffer for matching text.
Search the provided buffer for matching text. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Sequenc... | [
"def",
"search",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"_check_type",
"(",
"buf",
")",
"normalized",
"=",
"unicodedata",
".",
"normalize",
"(",
"self",
".",
"FORM",
",",
"buf",
")",
"idx",
"=",
"normalized",
".",
"find",
"(",
"self",
".",
... | Search the provided buffer for matching text.
Search the provided buffer for matching text. If the *match* is found,
returns a :class:`SequenceMatch` object, otherwise returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`SequenceMatch` if matched, None if no mat... | [
"Search",
"the",
"provided",
"buffer",
"for",
"matching",
"text",
"."
] | 9ab894506ffd679b37230e935158ff3b0aa170ab | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L193-L209 |
55,620 | digidotcom/python-streamexpect | streamexpect.py | RegexSearcher.search | def search(self, buf):
"""Search the provided buffer for a match to the object's regex.
Search the provided buffer for a match to the object's regex. If the
*match* is found, returns a :class:`RegexMatch` object, otherwise
returns ``None``.
:param buf: Buffer to search for a ma... | python | def search(self, buf):
"""Search the provided buffer for a match to the object's regex.
Search the provided buffer for a match to the object's regex. If the
*match* is found, returns a :class:`RegexMatch` object, otherwise
returns ``None``.
:param buf: Buffer to search for a ma... | [
"def",
"search",
"(",
"self",
",",
"buf",
")",
":",
"match",
"=",
"self",
".",
"_regex",
".",
"search",
"(",
"self",
".",
"_check_type",
"(",
"buf",
")",
")",
"if",
"match",
"is",
"not",
"None",
":",
"start",
"=",
"match",
".",
"start",
"(",
")",... | Search the provided buffer for a match to the object's regex.
Search the provided buffer for a match to the object's regex. If the
*match* is found, returns a :class:`RegexMatch` object, otherwise
returns ``None``.
:param buf: Buffer to search for a match.
:return: :class:`Rege... | [
"Search",
"the",
"provided",
"buffer",
"for",
"a",
"match",
"to",
"the",
"object",
"s",
"regex",
"."
] | 9ab894506ffd679b37230e935158ff3b0aa170ab | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L242-L256 |
55,621 | digidotcom/python-streamexpect | streamexpect.py | SearcherCollection.search | def search(self, buf):
"""Search the provided buffer for a match to any sub-searchers.
Search the provided buffer for a match to any of this collection's
sub-searchers. If a single matching sub-searcher is found, returns that
sub-searcher's *match* object. If multiple matches are found,... | python | def search(self, buf):
"""Search the provided buffer for a match to any sub-searchers.
Search the provided buffer for a match to any of this collection's
sub-searchers. If a single matching sub-searcher is found, returns that
sub-searcher's *match* object. If multiple matches are found,... | [
"def",
"search",
"(",
"self",
",",
"buf",
")",
":",
"self",
".",
"_check_type",
"(",
"buf",
")",
"best_match",
"=",
"None",
"best_index",
"=",
"sys",
".",
"maxsize",
"for",
"searcher",
"in",
"self",
":",
"match",
"=",
"searcher",
".",
"search",
"(",
... | Search the provided buffer for a match to any sub-searchers.
Search the provided buffer for a match to any of this collection's
sub-searchers. If a single matching sub-searcher is found, returns that
sub-searcher's *match* object. If multiple matches are found, the match
with the smalle... | [
"Search",
"the",
"provided",
"buffer",
"for",
"a",
"match",
"to",
"any",
"sub",
"-",
"searchers",
"."
] | 9ab894506ffd679b37230e935158ff3b0aa170ab | https://github.com/digidotcom/python-streamexpect/blob/9ab894506ffd679b37230e935158ff3b0aa170ab/streamexpect.py#L316-L336 |
55,622 | Peter-Slump/django-dynamic-fixtures | src/dynamic_fixtures/fixtures/runner.py | LoadFixtureRunner.init_graph | def init_graph(self):
"""
Initialize graph
Load all nodes and set dependencies.
To avoid errors about missing nodes all nodes get loaded first before
setting the dependencies.
"""
self._graph = Graph()
# First add all nodes
for key in self.loader... | python | def init_graph(self):
"""
Initialize graph
Load all nodes and set dependencies.
To avoid errors about missing nodes all nodes get loaded first before
setting the dependencies.
"""
self._graph = Graph()
# First add all nodes
for key in self.loader... | [
"def",
"init_graph",
"(",
"self",
")",
":",
"self",
".",
"_graph",
"=",
"Graph",
"(",
")",
"# First add all nodes",
"for",
"key",
"in",
"self",
".",
"loader",
".",
"disk_fixtures",
".",
"keys",
"(",
")",
":",
"self",
".",
"graph",
".",
"add_node",
"(",... | Initialize graph
Load all nodes and set dependencies.
To avoid errors about missing nodes all nodes get loaded first before
setting the dependencies. | [
"Initialize",
"graph",
"Load",
"all",
"nodes",
"and",
"set",
"dependencies",
"."
] | da99b4b12b11be28ea4b36b6cf2896ca449c73c1 | https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/fixtures/runner.py#L26-L43 |
55,623 | Peter-Slump/django-dynamic-fixtures | src/dynamic_fixtures/fixtures/runner.py | LoadFixtureRunner.load_fixtures | def load_fixtures(self, nodes=None, progress_callback=None, dry_run=False):
"""Load all fixtures for given nodes.
If no nodes are given all fixtures will be loaded.
:param list nodes: list of nodes to be loaded.
:param callable progress_callback: Callback which will be called while
... | python | def load_fixtures(self, nodes=None, progress_callback=None, dry_run=False):
"""Load all fixtures for given nodes.
If no nodes are given all fixtures will be loaded.
:param list nodes: list of nodes to be loaded.
:param callable progress_callback: Callback which will be called while
... | [
"def",
"load_fixtures",
"(",
"self",
",",
"nodes",
"=",
"None",
",",
"progress_callback",
"=",
"None",
",",
"dry_run",
"=",
"False",
")",
":",
"if",
"progress_callback",
"and",
"not",
"callable",
"(",
"progress_callback",
")",
":",
"raise",
"Exception",
"(",... | Load all fixtures for given nodes.
If no nodes are given all fixtures will be loaded.
:param list nodes: list of nodes to be loaded.
:param callable progress_callback: Callback which will be called while
handling the nodes. | [
"Load",
"all",
"fixtures",
"for",
"given",
"nodes",
"."
] | da99b4b12b11be28ea4b36b6cf2896ca449c73c1 | https://github.com/Peter-Slump/django-dynamic-fixtures/blob/da99b4b12b11be28ea4b36b6cf2896ca449c73c1/src/dynamic_fixtures/fixtures/runner.py#L79-L102 |
55,624 | acorg/dark-matter | dark/mutations.py | getAPOBECFrequencies | def getAPOBECFrequencies(dotAlignment, orig, new, pattern):
"""
Gets mutation frequencies if they are in a certain pattern.
@param dotAlignment: result from calling basePlotter
@param orig: A C{str}, naming the original base
@param new: A C{str}, what orig was mutated to
@param pattern: A C{str... | python | def getAPOBECFrequencies(dotAlignment, orig, new, pattern):
"""
Gets mutation frequencies if they are in a certain pattern.
@param dotAlignment: result from calling basePlotter
@param orig: A C{str}, naming the original base
@param new: A C{str}, what orig was mutated to
@param pattern: A C{str... | [
"def",
"getAPOBECFrequencies",
"(",
"dotAlignment",
",",
"orig",
",",
"new",
",",
"pattern",
")",
":",
"cPattern",
"=",
"[",
"'ACA'",
",",
"'ACC'",
",",
"'ACG'",
",",
"'ACT'",
",",
"'CCA'",
",",
"'CCC'",
",",
"'CCG'",
",",
"'CCT'",
",",
"'GCA'",
",",
... | Gets mutation frequencies if they are in a certain pattern.
@param dotAlignment: result from calling basePlotter
@param orig: A C{str}, naming the original base
@param new: A C{str}, what orig was mutated to
@param pattern: A C{str}m which pattern we're looking for
(must be one of 'cPattern', '... | [
"Gets",
"mutation",
"frequencies",
"if",
"they",
"are",
"in",
"a",
"certain",
"pattern",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/mutations.py#L181-L228 |
55,625 | acorg/dark-matter | dark/mutations.py | getCompleteFreqs | def getCompleteFreqs(blastHits):
"""
Make a dictionary which collects all mutation frequencies from
all reads.
Calls basePlotter to get dotAlignment, which is passed to
getAPOBECFrequencies with the respective parameter, to collect
the frequencies.
@param blastHits: A L{dark.blast.BlastHits... | python | def getCompleteFreqs(blastHits):
"""
Make a dictionary which collects all mutation frequencies from
all reads.
Calls basePlotter to get dotAlignment, which is passed to
getAPOBECFrequencies with the respective parameter, to collect
the frequencies.
@param blastHits: A L{dark.blast.BlastHits... | [
"def",
"getCompleteFreqs",
"(",
"blastHits",
")",
":",
"allFreqs",
"=",
"{",
"}",
"for",
"title",
"in",
"blastHits",
".",
"titles",
":",
"allFreqs",
"[",
"title",
"]",
"=",
"{",
"'C>A'",
":",
"{",
"}",
",",
"'C>G'",
":",
"{",
"}",
",",
"'C>T'",
":"... | Make a dictionary which collects all mutation frequencies from
all reads.
Calls basePlotter to get dotAlignment, which is passed to
getAPOBECFrequencies with the respective parameter, to collect
the frequencies.
@param blastHits: A L{dark.blast.BlastHits} instance. | [
"Make",
"a",
"dictionary",
"which",
"collects",
"all",
"mutation",
"frequencies",
"from",
"all",
"reads",
".",
"Calls",
"basePlotter",
"to",
"get",
"dotAlignment",
"which",
"is",
"passed",
"to",
"getAPOBECFrequencies",
"with",
"the",
"respective",
"parameter",
"to... | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/mutations.py#L231-L265 |
55,626 | acorg/dark-matter | bin/filter-fasta-by-taxonomy.py | writeDetails | def writeDetails(accept, readId, taxonomy, fp):
"""
Write read and taxonomy details.
@param accept: A C{bool} indicating whether the read was accepted,
according to its taxonomy.
@param readId: The C{str} id of the read.
@taxonomy: A C{list} of taxonomy C{str} levels.
@fp: An open file ... | python | def writeDetails(accept, readId, taxonomy, fp):
"""
Write read and taxonomy details.
@param accept: A C{bool} indicating whether the read was accepted,
according to its taxonomy.
@param readId: The C{str} id of the read.
@taxonomy: A C{list} of taxonomy C{str} levels.
@fp: An open file ... | [
"def",
"writeDetails",
"(",
"accept",
",",
"readId",
",",
"taxonomy",
",",
"fp",
")",
":",
"fp",
".",
"write",
"(",
"'%s %s\\n %s\\n\\n'",
"%",
"(",
"'MATCH:'",
"if",
"accept",
"else",
"'MISS: '",
",",
"readId",
",",
"' | '",
".",
"join",
"(",
"tax... | Write read and taxonomy details.
@param accept: A C{bool} indicating whether the read was accepted,
according to its taxonomy.
@param readId: The C{str} id of the read.
@taxonomy: A C{list} of taxonomy C{str} levels.
@fp: An open file pointer to write to. | [
"Write",
"read",
"and",
"taxonomy",
"details",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/filter-fasta-by-taxonomy.py#L32-L44 |
55,627 | invenia/Arbiter | arbiter/graph.py | Graph.add | def add(self, name, parents=None):
"""
add a node to the graph.
Raises an exception if the node cannot be added (i.e., if a node
that name already exists, or if it would create a cycle.
NOTE: A node can be added before its parents are added.
name: The name of the node ... | python | def add(self, name, parents=None):
"""
add a node to the graph.
Raises an exception if the node cannot be added (i.e., if a node
that name already exists, or if it would create a cycle.
NOTE: A node can be added before its parents are added.
name: The name of the node ... | [
"def",
"add",
"(",
"self",
",",
"name",
",",
"parents",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"name",
",",
"Hashable",
")",
":",
"raise",
"TypeError",
"(",
"name",
")",
"parents",
"=",
"set",
"(",
"parents",
"or",
"(",
")",
")",
... | add a node to the graph.
Raises an exception if the node cannot be added (i.e., if a node
that name already exists, or if it would create a cycle.
NOTE: A node can be added before its parents are added.
name: The name of the node to add to the graph. Name can be any
unique... | [
"add",
"a",
"node",
"to",
"the",
"graph",
"."
] | 51008393ae8797da85bcd67807259a157f941dfd | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/graph.py#L27-L84 |
55,628 | invenia/Arbiter | arbiter/graph.py | Graph.remove | def remove(self, name, strategy=Strategy.promote):
"""
Remove a node from the graph. Returns the set of nodes that were
removed.
If the node doesn't exist, an exception will be raised.
name: The name of the node to remove.
strategy: (Optional, Strategy.promote) What to ... | python | def remove(self, name, strategy=Strategy.promote):
"""
Remove a node from the graph. Returns the set of nodes that were
removed.
If the node doesn't exist, an exception will be raised.
name: The name of the node to remove.
strategy: (Optional, Strategy.promote) What to ... | [
"def",
"remove",
"(",
"self",
",",
"name",
",",
"strategy",
"=",
"Strategy",
".",
"promote",
")",
":",
"removed",
"=",
"set",
"(",
")",
"stack",
"=",
"[",
"name",
"]",
"while",
"stack",
":",
"current",
"=",
"stack",
".",
"pop",
"(",
")",
"node",
... | Remove a node from the graph. Returns the set of nodes that were
removed.
If the node doesn't exist, an exception will be raised.
name: The name of the node to remove.
strategy: (Optional, Strategy.promote) What to do with children
or removed nodes. The options are:
... | [
"Remove",
"a",
"node",
"from",
"the",
"graph",
".",
"Returns",
"the",
"set",
"of",
"nodes",
"that",
"were",
"removed",
"."
] | 51008393ae8797da85bcd67807259a157f941dfd | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/graph.py#L86-L148 |
55,629 | invenia/Arbiter | arbiter/graph.py | Graph.ancestor_of | def ancestor_of(self, name, ancestor, visited=None):
"""
Check whether a node has another node as an ancestor.
name: The name of the node being checked.
ancestor: The name of the (possible) ancestor node.
visited: (optional, None) If given, a set of nodes that have
a... | python | def ancestor_of(self, name, ancestor, visited=None):
"""
Check whether a node has another node as an ancestor.
name: The name of the node being checked.
ancestor: The name of the (possible) ancestor node.
visited: (optional, None) If given, a set of nodes that have
a... | [
"def",
"ancestor_of",
"(",
"self",
",",
"name",
",",
"ancestor",
",",
"visited",
"=",
"None",
")",
":",
"if",
"visited",
"is",
"None",
":",
"visited",
"=",
"set",
"(",
")",
"node",
"=",
"self",
".",
"_nodes",
".",
"get",
"(",
"name",
")",
"if",
"... | Check whether a node has another node as an ancestor.
name: The name of the node being checked.
ancestor: The name of the (possible) ancestor node.
visited: (optional, None) If given, a set of nodes that have
already been traversed. NOTE: The set will be updated with
any... | [
"Check",
"whether",
"a",
"node",
"has",
"another",
"node",
"as",
"an",
"ancestor",
"."
] | 51008393ae8797da85bcd67807259a157f941dfd | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/graph.py#L184-L219 |
55,630 | disqus/overseer | overseer/views.py | respond | def respond(template, context={}, request=None, **kwargs):
"Calls render_to_response with a RequestConext"
from django.http import HttpResponse
from django.template import RequestContext
from django.template.loader import render_to_string
if request:
default = context_processors.default... | python | def respond(template, context={}, request=None, **kwargs):
"Calls render_to_response with a RequestConext"
from django.http import HttpResponse
from django.template import RequestContext
from django.template.loader import render_to_string
if request:
default = context_processors.default... | [
"def",
"respond",
"(",
"template",
",",
"context",
"=",
"{",
"}",
",",
"request",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
"django",
".",
"http",
"import",
"HttpResponse",
"from",
"django",
".",
"template",
"import",
"RequestContext",
"fro... | Calls render_to_response with a RequestConext | [
"Calls",
"render_to_response",
"with",
"a",
"RequestConext"
] | b37573aba33b20aa86f89eb0c7e6f4d9905bedef | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L38-L51 |
55,631 | disqus/overseer | overseer/views.py | update_subscription | def update_subscription(request, ident):
"Shows subscriptions options for a verified subscriber."
try:
subscription = Subscription.objects.get(ident=ident)
except Subscription.DoesNotExist:
return respond('overseer/invalid_subscription_token.html', {}, request)
if request.POST:
... | python | def update_subscription(request, ident):
"Shows subscriptions options for a verified subscriber."
try:
subscription = Subscription.objects.get(ident=ident)
except Subscription.DoesNotExist:
return respond('overseer/invalid_subscription_token.html', {}, request)
if request.POST:
... | [
"def",
"update_subscription",
"(",
"request",
",",
"ident",
")",
":",
"try",
":",
"subscription",
"=",
"Subscription",
".",
"objects",
".",
"get",
"(",
"ident",
"=",
"ident",
")",
"except",
"Subscription",
".",
"DoesNotExist",
":",
"return",
"respond",
"(",
... | Shows subscriptions options for a verified subscriber. | [
"Shows",
"subscriptions",
"options",
"for",
"a",
"verified",
"subscriber",
"."
] | b37573aba33b20aa86f89eb0c7e6f4d9905bedef | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L120-L151 |
55,632 | disqus/overseer | overseer/views.py | verify_subscription | def verify_subscription(request, ident):
"""
Verifies an unverified subscription and create or appends
to an existing subscription.
"""
try:
unverified = UnverifiedSubscription.objects.get(ident=ident)
except UnverifiedSubscription.DoesNotExist:
return respond('overseer/inva... | python | def verify_subscription(request, ident):
"""
Verifies an unverified subscription and create or appends
to an existing subscription.
"""
try:
unverified = UnverifiedSubscription.objects.get(ident=ident)
except UnverifiedSubscription.DoesNotExist:
return respond('overseer/inva... | [
"def",
"verify_subscription",
"(",
"request",
",",
"ident",
")",
":",
"try",
":",
"unverified",
"=",
"UnverifiedSubscription",
".",
"objects",
".",
"get",
"(",
"ident",
"=",
"ident",
")",
"except",
"UnverifiedSubscription",
".",
"DoesNotExist",
":",
"return",
... | Verifies an unverified subscription and create or appends
to an existing subscription. | [
"Verifies",
"an",
"unverified",
"subscription",
"and",
"create",
"or",
"appends",
"to",
"an",
"existing",
"subscription",
"."
] | b37573aba33b20aa86f89eb0c7e6f4d9905bedef | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/views.py#L192-L213 |
55,633 | acorg/dark-matter | dark/alignments.py | ReadsAlignments.hsps | def hsps(self):
"""
Provide access to all HSPs for all alignments of all reads.
@return: A generator that yields HSPs (or LSPs).
"""
for readAlignments in self:
for alignment in readAlignments:
for hsp in alignment.hsps:
yield hsp | python | def hsps(self):
"""
Provide access to all HSPs for all alignments of all reads.
@return: A generator that yields HSPs (or LSPs).
"""
for readAlignments in self:
for alignment in readAlignments:
for hsp in alignment.hsps:
yield hsp | [
"def",
"hsps",
"(",
"self",
")",
":",
"for",
"readAlignments",
"in",
"self",
":",
"for",
"alignment",
"in",
"readAlignments",
":",
"for",
"hsp",
"in",
"alignment",
".",
"hsps",
":",
"yield",
"hsp"
] | Provide access to all HSPs for all alignments of all reads.
@return: A generator that yields HSPs (or LSPs). | [
"Provide",
"access",
"to",
"all",
"HSPs",
"for",
"all",
"alignments",
"of",
"all",
"reads",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/alignments.py#L375-L384 |
55,634 | acorg/dark-matter | dark/entrez.py | getSequence | def getSequence(title, db='nucleotide'):
"""
Get information about a sequence from Genbank.
@param title: A C{str} sequence title from a BLAST hit. Of the form
'gi|63148399|gb|DQ011818.1| Description...'.
@param db: The C{str} name of the Entrez database to consult.
NOTE: this uses the net... | python | def getSequence(title, db='nucleotide'):
"""
Get information about a sequence from Genbank.
@param title: A C{str} sequence title from a BLAST hit. Of the form
'gi|63148399|gb|DQ011818.1| Description...'.
@param db: The C{str} name of the Entrez database to consult.
NOTE: this uses the net... | [
"def",
"getSequence",
"(",
"title",
",",
"db",
"=",
"'nucleotide'",
")",
":",
"titleId",
"=",
"title",
".",
"split",
"(",
"' '",
",",
"1",
")",
"[",
"0",
"]",
"try",
":",
"gi",
"=",
"titleId",
".",
"split",
"(",
"'|'",
")",
"[",
"1",
"]",
"exce... | Get information about a sequence from Genbank.
@param title: A C{str} sequence title from a BLAST hit. Of the form
'gi|63148399|gb|DQ011818.1| Description...'.
@param db: The C{str} name of the Entrez database to consult.
NOTE: this uses the network! Also, there is a 3 requests/second limit
i... | [
"Get",
"information",
"about",
"a",
"sequence",
"from",
"Genbank",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/entrez.py#L7-L32 |
55,635 | cloudrave/avwx | avwx/models.py | WeatherReport.parse_xml_data | def parse_xml_data(self):
"""
Parses `xml_data` and loads it into object properties.
"""
self.raw_text = self.xml_data.find('raw_text').text
self.station = WeatherStation(self.xml_data.find('station_id').text)
self.station.latitude = float(self.xml_data.find('latitude').t... | python | def parse_xml_data(self):
"""
Parses `xml_data` and loads it into object properties.
"""
self.raw_text = self.xml_data.find('raw_text').text
self.station = WeatherStation(self.xml_data.find('station_id').text)
self.station.latitude = float(self.xml_data.find('latitude').t... | [
"def",
"parse_xml_data",
"(",
"self",
")",
":",
"self",
".",
"raw_text",
"=",
"self",
".",
"xml_data",
".",
"find",
"(",
"'raw_text'",
")",
".",
"text",
"self",
".",
"station",
"=",
"WeatherStation",
"(",
"self",
".",
"xml_data",
".",
"find",
"(",
"'st... | Parses `xml_data` and loads it into object properties. | [
"Parses",
"xml_data",
"and",
"loads",
"it",
"into",
"object",
"properties",
"."
] | d5a9a1179e0634e94f40d446b89ceecbd1e61e13 | https://github.com/cloudrave/avwx/blob/d5a9a1179e0634e94f40d446b89ceecbd1e61e13/avwx/models.py#L149-L157 |
55,636 | cloudrave/avwx | avwx/models.py | WeatherReportSet.download_data | def download_data(self, mock_response=None):
"""
Loads XML data into the `xml_data` attribute.
"""
if mock_response is not None:
body = mock_response
else:
api_url = self.get_api_url()
body = urlopen(api_url).read()
xml_root = ElementTr... | python | def download_data(self, mock_response=None):
"""
Loads XML data into the `xml_data` attribute.
"""
if mock_response is not None:
body = mock_response
else:
api_url = self.get_api_url()
body = urlopen(api_url).read()
xml_root = ElementTr... | [
"def",
"download_data",
"(",
"self",
",",
"mock_response",
"=",
"None",
")",
":",
"if",
"mock_response",
"is",
"not",
"None",
":",
"body",
"=",
"mock_response",
"else",
":",
"api_url",
"=",
"self",
".",
"get_api_url",
"(",
")",
"body",
"=",
"urlopen",
"(... | Loads XML data into the `xml_data` attribute. | [
"Loads",
"XML",
"data",
"into",
"the",
"xml_data",
"attribute",
"."
] | d5a9a1179e0634e94f40d446b89ceecbd1e61e13 | https://github.com/cloudrave/avwx/blob/d5a9a1179e0634e94f40d446b89ceecbd1e61e13/avwx/models.py#L215-L231 |
55,637 | acorg/dark-matter | dark/summarize.py | sequenceCategoryLengths | def sequenceCategoryLengths(read, categories, defaultCategory=None,
suppressedCategory='...', minLength=1):
"""
Summarize the nucleotides or AAs found in a read by assigning each to a
category and reporting the lengths of the contiguous category classes
found along the sequen... | python | def sequenceCategoryLengths(read, categories, defaultCategory=None,
suppressedCategory='...', minLength=1):
"""
Summarize the nucleotides or AAs found in a read by assigning each to a
category and reporting the lengths of the contiguous category classes
found along the sequen... | [
"def",
"sequenceCategoryLengths",
"(",
"read",
",",
"categories",
",",
"defaultCategory",
"=",
"None",
",",
"suppressedCategory",
"=",
"'...'",
",",
"minLength",
"=",
"1",
")",
":",
"result",
"=",
"[",
"]",
"append",
"=",
"result",
".",
"append",
"get",
"=... | Summarize the nucleotides or AAs found in a read by assigning each to a
category and reporting the lengths of the contiguous category classes
found along the sequence.
@param read: A C{Read} instance or one of its subclasses.
@param categories: A C{dict} mapping nucleotides or AAs to category.
@par... | [
"Summarize",
"the",
"nucleotides",
"or",
"AAs",
"found",
"in",
"a",
"read",
"by",
"assigning",
"each",
"to",
"a",
"category",
"and",
"reporting",
"the",
"lengths",
"of",
"the",
"contiguous",
"category",
"classes",
"found",
"along",
"the",
"sequence",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/summarize.py#L41-L113 |
55,638 | acorg/dark-matter | dark/simplify.py | simplifyTitle | def simplifyTitle(title, target):
"""
Simplify a given sequence title. Given a title, look for the first
occurrence of target anywhere in any of its words. Return a space-separated
string of the words of the title up to and including the occurrence of the
target. Ignore case.
E.g.,
# S... | python | def simplifyTitle(title, target):
"""
Simplify a given sequence title. Given a title, look for the first
occurrence of target anywhere in any of its words. Return a space-separated
string of the words of the title up to and including the occurrence of the
target. Ignore case.
E.g.,
# S... | [
"def",
"simplifyTitle",
"(",
"title",
",",
"target",
")",
":",
"targetLen",
"=",
"len",
"(",
"target",
")",
"result",
"=",
"[",
"]",
"for",
"word",
"in",
"title",
".",
"split",
"(",
")",
":",
"if",
"len",
"(",
"word",
")",
">=",
"targetLen",
":",
... | Simplify a given sequence title. Given a title, look for the first
occurrence of target anywhere in any of its words. Return a space-separated
string of the words of the title up to and including the occurrence of the
target. Ignore case.
E.g.,
# Suffix
simplifyTitle('Bovine polyomavirus... | [
"Simplify",
"a",
"given",
"sequence",
"title",
".",
"Given",
"a",
"title",
"look",
"for",
"the",
"first",
"occurrence",
"of",
"target",
"anywhere",
"in",
"any",
"of",
"its",
"words",
".",
"Return",
"a",
"space",
"-",
"separated",
"string",
"of",
"the",
"... | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/simplify.py#L1-L36 |
55,639 | nkavaldj/myhdl_lib | myhdl_lib/simulation/_DUTer.py | DUTer._enableTracesVerilog | def _enableTracesVerilog(self, verilogFile):
''' Enables traces in a Verilog file'''
fname, _ = os.path.splitext(verilogFile)
inserted = False
for _, line in enumerate(fileinput.input(verilogFile, inplace = 1)):
sys.stdout.write(line)
if line.startswith("end") and... | python | def _enableTracesVerilog(self, verilogFile):
''' Enables traces in a Verilog file'''
fname, _ = os.path.splitext(verilogFile)
inserted = False
for _, line in enumerate(fileinput.input(verilogFile, inplace = 1)):
sys.stdout.write(line)
if line.startswith("end") and... | [
"def",
"_enableTracesVerilog",
"(",
"self",
",",
"verilogFile",
")",
":",
"fname",
",",
"_",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"verilogFile",
")",
"inserted",
"=",
"False",
"for",
"_",
",",
"line",
"in",
"enumerate",
"(",
"fileinput",
".",
... | Enables traces in a Verilog file | [
"Enables",
"traces",
"in",
"a",
"Verilog",
"file"
] | 9902afd2031e7847373f692821b2135fd0810aa8 | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/simulation/_DUTer.py#L101-L113 |
55,640 | invenia/Arbiter | arbiter/scheduler.py | Scheduler.add_task | def add_task(self, task):
"""
Add a task to the scheduler.
task: The task to add.
"""
if not self._valid_name(task.name):
raise ValueError(task.name)
self._tasks[task.name] = task
incomplete_dependencies = set()
for dependency in task.depen... | python | def add_task(self, task):
"""
Add a task to the scheduler.
task: The task to add.
"""
if not self._valid_name(task.name):
raise ValueError(task.name)
self._tasks[task.name] = task
incomplete_dependencies = set()
for dependency in task.depen... | [
"def",
"add_task",
"(",
"self",
",",
"task",
")",
":",
"if",
"not",
"self",
".",
"_valid_name",
"(",
"task",
".",
"name",
")",
":",
"raise",
"ValueError",
"(",
"task",
".",
"name",
")",
"self",
".",
"_tasks",
"[",
"task",
".",
"name",
"]",
"=",
"... | Add a task to the scheduler.
task: The task to add. | [
"Add",
"a",
"task",
"to",
"the",
"scheduler",
"."
] | 51008393ae8797da85bcd67807259a157f941dfd | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/scheduler.py#L68-L94 |
55,641 | invenia/Arbiter | arbiter/scheduler.py | Scheduler.end_task | def end_task(self, name, success=True):
"""
End a running task. Raises an exception if the task isn't
running.
name: The name of the task to complete.
success: (optional, True) Whether the task was successful.
"""
self._running.remove(name)
if success:
... | python | def end_task(self, name, success=True):
"""
End a running task. Raises an exception if the task isn't
running.
name: The name of the task to complete.
success: (optional, True) Whether the task was successful.
"""
self._running.remove(name)
if success:
... | [
"def",
"end_task",
"(",
"self",
",",
"name",
",",
"success",
"=",
"True",
")",
":",
"self",
".",
"_running",
".",
"remove",
"(",
"name",
")",
"if",
"success",
":",
"self",
".",
"_completed",
".",
"add",
"(",
"name",
")",
"self",
".",
"_graph",
".",... | End a running task. Raises an exception if the task isn't
running.
name: The name of the task to complete.
success: (optional, True) Whether the task was successful. | [
"End",
"a",
"running",
"task",
".",
"Raises",
"an",
"exception",
"if",
"the",
"task",
"isn",
"t",
"running",
"."
] | 51008393ae8797da85bcd67807259a157f941dfd | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/scheduler.py#L123-L137 |
55,642 | acorg/dark-matter | bin/get-features.py | main | def main(gi, ranges):
"""
Print the features of the genbank entry given by gi. If ranges is
non-emtpy, only print features that include the ranges.
gi: either a hit from a BLAST record, in the form
'gi|63148399|gb|DQ011818.1|' or a gi number (63148399 in this example).
ranges: a possibly em... | python | def main(gi, ranges):
"""
Print the features of the genbank entry given by gi. If ranges is
non-emtpy, only print features that include the ranges.
gi: either a hit from a BLAST record, in the form
'gi|63148399|gb|DQ011818.1|' or a gi number (63148399 in this example).
ranges: a possibly em... | [
"def",
"main",
"(",
"gi",
",",
"ranges",
")",
":",
"# TODO: Make it so we can pass a 'db' argument to getSequence.",
"record",
"=",
"getSequence",
"(",
"gi",
")",
"if",
"record",
"is",
"None",
":",
"print",
"(",
"\"Looks like you're offline.\"",
")",
"sys",
".",
"... | Print the features of the genbank entry given by gi. If ranges is
non-emtpy, only print features that include the ranges.
gi: either a hit from a BLAST record, in the form
'gi|63148399|gb|DQ011818.1|' or a gi number (63148399 in this example).
ranges: a possibly empty list of ranges to print inform... | [
"Print",
"the",
"features",
"of",
"the",
"genbank",
"entry",
"given",
"by",
"gi",
".",
"If",
"ranges",
"is",
"non",
"-",
"emtpy",
"only",
"print",
"features",
"that",
"include",
"the",
"ranges",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/get-features.py#L10-L39 |
55,643 | flo-compbio/genometools | genometools/gcloud/compute/instance.py | create_instance | def create_instance(credentials, project, zone, name,
startup_script=None, startup_script_url=None,
metadata=None,
machine_type='f1-micro', tags=None,
disk_size_gb=10, wait_until_done=False):
"""Create instance with startup script.
... | python | def create_instance(credentials, project, zone, name,
startup_script=None, startup_script_url=None,
metadata=None,
machine_type='f1-micro', tags=None,
disk_size_gb=10, wait_until_done=False):
"""Create instance with startup script.
... | [
"def",
"create_instance",
"(",
"credentials",
",",
"project",
",",
"zone",
",",
"name",
",",
"startup_script",
"=",
"None",
",",
"startup_script_url",
"=",
"None",
",",
"metadata",
"=",
"None",
",",
"machine_type",
"=",
"'f1-micro'",
",",
"tags",
"=",
"None"... | Create instance with startup script.
TODO: docstring | [
"Create",
"instance",
"with",
"startup",
"script",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/compute/instance.py#L13-L129 |
55,644 | acorg/dark-matter | dark/sam.py | SAMFilter.referenceLengths | def referenceLengths(self):
"""
Get the lengths of wanted references.
@raise UnknownReference: If a reference id is not present in the
SAM/BAM file.
@return: A C{dict} of C{str} reference id to C{int} length with a key
for each reference id in C{self.referenceIds... | python | def referenceLengths(self):
"""
Get the lengths of wanted references.
@raise UnknownReference: If a reference id is not present in the
SAM/BAM file.
@return: A C{dict} of C{str} reference id to C{int} length with a key
for each reference id in C{self.referenceIds... | [
"def",
"referenceLengths",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"with",
"samfile",
"(",
"self",
".",
"filename",
")",
"as",
"sam",
":",
"if",
"self",
".",
"referenceIds",
":",
"for",
"referenceId",
"in",
"self",
".",
"referenceIds",
":",
"ti... | Get the lengths of wanted references.
@raise UnknownReference: If a reference id is not present in the
SAM/BAM file.
@return: A C{dict} of C{str} reference id to C{int} length with a key
for each reference id in C{self.referenceIds} or for all references
if C{self.re... | [
"Get",
"the",
"lengths",
"of",
"wanted",
"references",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sam.py#L390-L414 |
55,645 | flo-compbio/genometools | genometools/ncbi/sra/find_experiment_runs.py | main | def main(args=None):
"""Download all .sra from NCBI SRA for a given experiment ID.
Parameters
----------
args: argparse.Namespace object, optional
The argument values. If not specified, the values will be obtained by
parsing the command line arguments using the `argparse` module.
R... | python | def main(args=None):
"""Download all .sra from NCBI SRA for a given experiment ID.
Parameters
----------
args: argparse.Namespace object, optional
The argument values. If not specified, the values will be obtained by
parsing the command line arguments using the `argparse` module.
R... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"if",
"args",
"is",
"None",
":",
"# parse command-line arguments",
"parser",
"=",
"get_argument_parser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
")",
"experiment_file",
"=",
"args",
".",
"... | Download all .sra from NCBI SRA for a given experiment ID.
Parameters
----------
args: argparse.Namespace object, optional
The argument values. If not specified, the values will be obtained by
parsing the command line arguments using the `argparse` module.
Returns
-------
int
... | [
"Download",
"all",
".",
"sra",
"from",
"NCBI",
"SRA",
"for",
"a",
"given",
"experiment",
"ID",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/sra/find_experiment_runs.py#L79-L140 |
55,646 | cebel/pyuniprot | src/pyuniprot/manager/query.py | QueryManager.version | def version(self):
"""Version of UniPort knowledgebase
:returns: dictionary with version info
:rtype: dict
"""
return [x for x in self.session.query(models.Version).all()] | python | def version(self):
"""Version of UniPort knowledgebase
:returns: dictionary with version info
:rtype: dict
"""
return [x for x in self.session.query(models.Version).all()] | [
"def",
"version",
"(",
"self",
")",
":",
"return",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"session",
".",
"query",
"(",
"models",
".",
"Version",
")",
".",
"all",
"(",
")",
"]"
] | Version of UniPort knowledgebase
:returns: dictionary with version info
:rtype: dict | [
"Version",
"of",
"UniPort",
"knowledgebase"
] | 9462a6042c7c9295415a5eb589b77b27cb7c142b | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/manager/query.py#L1009-L1015 |
55,647 | shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.write | def write(self):
""" Write configuration to chassis.
Raise StreamWarningsError if configuration warnings found.
"""
self.ix_command('write')
stream_warnings = self.streamRegion.generateWarningList()
warnings_list = (self.api.call('join ' + ' {' + stream_warnings + '} ' ... | python | def write(self):
""" Write configuration to chassis.
Raise StreamWarningsError if configuration warnings found.
"""
self.ix_command('write')
stream_warnings = self.streamRegion.generateWarningList()
warnings_list = (self.api.call('join ' + ' {' + stream_warnings + '} ' ... | [
"def",
"write",
"(",
"self",
")",
":",
"self",
".",
"ix_command",
"(",
"'write'",
")",
"stream_warnings",
"=",
"self",
".",
"streamRegion",
".",
"generateWarningList",
"(",
")",
"warnings_list",
"=",
"(",
"self",
".",
"api",
".",
"call",
"(",
"'join '",
... | Write configuration to chassis.
Raise StreamWarningsError if configuration warnings found. | [
"Write",
"configuration",
"to",
"chassis",
"."
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L187-L199 |
55,648 | shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.load_config | def load_config(self, config_file_name):
""" Load configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
... | python | def load_config(self, config_file_name):
""" Load configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
... | [
"def",
"load_config",
"(",
"self",
",",
"config_file_name",
")",
":",
"config_file_name",
"=",
"config_file_name",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"ext",
"=",
"path",
".",
"splitext",
"(",
"config_file_name",
")",
"[",
"-",
"1",
"]",
".",
... | Load configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
The config file is on shared folder.
... | [
"Load",
"configuration",
"file",
"from",
"prt",
"or",
"str",
"."
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L211-L231 |
55,649 | shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.save_config | def save_config(self, config_file_name):
""" Save configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
... | python | def save_config(self, config_file_name):
""" Save configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
... | [
"def",
"save_config",
"(",
"self",
",",
"config_file_name",
")",
":",
"config_file_name",
"=",
"config_file_name",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"ext",
"=",
"path",
".",
"splitext",
"(",
"config_file_name",
")",
"[",
"-",
"1",
"]",
".",
... | Save configuration file from prt or str.
Configuration file type is extracted from the file suffix - prt or str.
:param config_file_name: full path to the configuration file.
IxTclServer must have access to the file location. either:
The config file is on shared folder.
... | [
"Save",
"configuration",
"file",
"from",
"prt",
"or",
"str",
"."
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L233-L251 |
55,650 | shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.start_transmit | def start_transmit(self, blocking=False):
""" Start transmit on port.
:param blocking: True - wait for traffic end, False - return after traffic start.
"""
self.session.start_transmit(blocking, False, self) | python | def start_transmit(self, blocking=False):
""" Start transmit on port.
:param blocking: True - wait for traffic end, False - return after traffic start.
"""
self.session.start_transmit(blocking, False, self) | [
"def",
"start_transmit",
"(",
"self",
",",
"blocking",
"=",
"False",
")",
":",
"self",
".",
"session",
".",
"start_transmit",
"(",
"blocking",
",",
"False",
",",
"self",
")"
] | Start transmit on port.
:param blocking: True - wait for traffic end, False - return after traffic start. | [
"Start",
"transmit",
"on",
"port",
"."
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L268-L274 |
55,651 | shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.stop_capture | def stop_capture(self, cap_file_name=None, cap_file_format=IxeCapFileFormat.mem):
""" Stop capture on port.
:param cap_file_name: prefix for the capture file name.
Capture file will be saved as pcap file named 'prefix' + 'URI'.pcap.
:param cap_file_format: exported file format
... | python | def stop_capture(self, cap_file_name=None, cap_file_format=IxeCapFileFormat.mem):
""" Stop capture on port.
:param cap_file_name: prefix for the capture file name.
Capture file will be saved as pcap file named 'prefix' + 'URI'.pcap.
:param cap_file_format: exported file format
... | [
"def",
"stop_capture",
"(",
"self",
",",
"cap_file_name",
"=",
"None",
",",
"cap_file_format",
"=",
"IxeCapFileFormat",
".",
"mem",
")",
":",
"return",
"self",
".",
"session",
".",
"stop_capture",
"(",
"cap_file_name",
",",
"cap_file_format",
",",
"self",
")",... | Stop capture on port.
:param cap_file_name: prefix for the capture file name.
Capture file will be saved as pcap file named 'prefix' + 'URI'.pcap.
:param cap_file_format: exported file format
:return: number of captured frames | [
"Stop",
"capture",
"on",
"port",
"."
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L286-L295 |
55,652 | shmir/PyIxExplorer | ixexplorer/ixe_port.py | IxePort.set_transmit_mode | def set_transmit_mode(self, mode):
""" set port transmit mode
:param mode: request transmit mode
:type mode: ixexplorer.ixe_port.IxeTransmitMode
"""
self.api.call_rc('port setTransmitMode {} {}'.format(mode, self.uri)) | python | def set_transmit_mode(self, mode):
""" set port transmit mode
:param mode: request transmit mode
:type mode: ixexplorer.ixe_port.IxeTransmitMode
"""
self.api.call_rc('port setTransmitMode {} {}'.format(mode, self.uri)) | [
"def",
"set_transmit_mode",
"(",
"self",
",",
"mode",
")",
":",
"self",
".",
"api",
".",
"call_rc",
"(",
"'port setTransmitMode {} {}'",
".",
"format",
"(",
"mode",
",",
"self",
".",
"uri",
")",
")"
] | set port transmit mode
:param mode: request transmit mode
:type mode: ixexplorer.ixe_port.IxeTransmitMode | [
"set",
"port",
"transmit",
"mode"
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_port.py#L372-L379 |
55,653 | lewiscollard/django-flexible-images | flexible_images/util.py | get_template_context | def get_template_context(src, container="div", classes="", inner_classes="", alt="", background_image=False, no_css=False, aria_hidden=False):
"""Returns a template context for a flexible image template
tag implementation."""
context = {
"container": container,
"classes": classes,
"a... | python | def get_template_context(src, container="div", classes="", inner_classes="", alt="", background_image=False, no_css=False, aria_hidden=False):
"""Returns a template context for a flexible image template
tag implementation."""
context = {
"container": container,
"classes": classes,
"a... | [
"def",
"get_template_context",
"(",
"src",
",",
"container",
"=",
"\"div\"",
",",
"classes",
"=",
"\"\"",
",",
"inner_classes",
"=",
"\"\"",
",",
"alt",
"=",
"\"\"",
",",
"background_image",
"=",
"False",
",",
"no_css",
"=",
"False",
",",
"aria_hidden",
"=... | Returns a template context for a flexible image template
tag implementation. | [
"Returns",
"a",
"template",
"context",
"for",
"a",
"flexible",
"image",
"template",
"tag",
"implementation",
"."
] | d9e369586b70067f137b785c0e727d7244c0b17f | https://github.com/lewiscollard/django-flexible-images/blob/d9e369586b70067f137b785c0e727d7244c0b17f/flexible_images/util.py#L101-L132 |
55,654 | thunder-project/thunder-registration | registration/algorithms/crosscorr.py | CrossCorr.fit | def fit(self, images, reference=None):
"""
Estimate registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference. Displacements will be
2D for images and 3D for volumes.
Parameters
---------... | python | def fit(self, images, reference=None):
"""
Estimate registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference. Displacements will be
2D for images and 3D for volumes.
Parameters
---------... | [
"def",
"fit",
"(",
"self",
",",
"images",
",",
"reference",
"=",
"None",
")",
":",
"images",
"=",
"check_images",
"(",
"images",
")",
"reference",
"=",
"check_reference",
"(",
"images",
",",
"reference",
")",
"def",
"func",
"(",
"item",
")",
":",
"key"... | Estimate registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference. Displacements will be
2D for images and 3D for volumes.
Parameters
----------
images : array-like or thunder images
... | [
"Estimate",
"registration",
"model",
"using",
"cross",
"-",
"correlation",
"."
] | 286f091e6c402d592e9686d4821e0fd80dbf86ec | https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/algorithms/crosscorr.py#L27-L55 |
55,655 | thunder-project/thunder-registration | registration/algorithms/crosscorr.py | CrossCorr.fit_and_transform | def fit_and_transform(self, images, reference=None):
"""
Estimate and apply registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference, and apply the
estimated model to the data. Displacements will be
... | python | def fit_and_transform(self, images, reference=None):
"""
Estimate and apply registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference, and apply the
estimated model to the data. Displacements will be
... | [
"def",
"fit_and_transform",
"(",
"self",
",",
"images",
",",
"reference",
"=",
"None",
")",
":",
"images",
"=",
"check_images",
"(",
"images",
")",
"check_reference",
"(",
"images",
",",
"reference",
")",
"def",
"func",
"(",
"image",
")",
":",
"t",
"=",
... | Estimate and apply registration model using cross-correlation.
Use cross correlation to compute displacements between
images or volumes and reference, and apply the
estimated model to the data. Displacements will be
2D for images and 3D for volumes.
Parameters
-------... | [
"Estimate",
"and",
"apply",
"registration",
"model",
"using",
"cross",
"-",
"correlation",
"."
] | 286f091e6c402d592e9686d4821e0fd80dbf86ec | https://github.com/thunder-project/thunder-registration/blob/286f091e6c402d592e9686d4821e0fd80dbf86ec/registration/algorithms/crosscorr.py#L57-L81 |
55,656 | mikebryant/django-autoconfig | django_autoconfig/environment_settings/autoconfig.py | get_settings_from_environment | def get_settings_from_environment(environ):
'''Deduce settings from environment variables'''
settings = {}
for name, value in environ.items():
if not name.startswith('DJANGO_'):
continue
name = name.replace('DJANGO_', '', 1)
if _ignore_setting(name):
continue
... | python | def get_settings_from_environment(environ):
'''Deduce settings from environment variables'''
settings = {}
for name, value in environ.items():
if not name.startswith('DJANGO_'):
continue
name = name.replace('DJANGO_', '', 1)
if _ignore_setting(name):
continue
... | [
"def",
"get_settings_from_environment",
"(",
"environ",
")",
":",
"settings",
"=",
"{",
"}",
"for",
"name",
",",
"value",
"in",
"environ",
".",
"items",
"(",
")",
":",
"if",
"not",
"name",
".",
"startswith",
"(",
"'DJANGO_'",
")",
":",
"continue",
"name"... | Deduce settings from environment variables | [
"Deduce",
"settings",
"from",
"environment",
"variables"
] | 1ce793e95b024dccb189de1dc111dc4ae6c2f3a6 | https://github.com/mikebryant/django-autoconfig/blob/1ce793e95b024dccb189de1dc111dc4ae6c2f3a6/django_autoconfig/environment_settings/autoconfig.py#L12-L25 |
55,657 | flo-compbio/genometools | genometools/expression/filter.py | filter_variance | def filter_variance(matrix, top):
"""Filter genes in an expression matrix by variance.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix.
"""
as... | python | def filter_variance(matrix, top):
"""Filter genes in an expression matrix by variance.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix.
"""
as... | [
"def",
"filter_variance",
"(",
"matrix",
",",
"top",
")",
":",
"assert",
"isinstance",
"(",
"matrix",
",",
"ExpMatrix",
")",
"assert",
"isinstance",
"(",
"top",
",",
"(",
"int",
",",
"np",
".",
"integer",
")",
")",
"if",
"top",
">=",
"matrix",
".",
"... | Filter genes in an expression matrix by variance.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix. | [
"Filter",
"genes",
"in",
"an",
"expression",
"matrix",
"by",
"variance",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/filter.py#L32-L71 |
55,658 | flo-compbio/genometools | genometools/expression/filter.py | filter_mean | def filter_mean(matrix, top):
"""Filter genes in an expression matrix by mean expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix.
"""
... | python | def filter_mean(matrix, top):
"""Filter genes in an expression matrix by mean expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix.
"""
... | [
"def",
"filter_mean",
"(",
"matrix",
",",
"top",
")",
":",
"assert",
"isinstance",
"(",
"matrix",
",",
"ExpMatrix",
")",
"assert",
"isinstance",
"(",
"top",
",",
"int",
")",
"if",
"top",
">=",
"matrix",
".",
"p",
":",
"logger",
".",
"warning",
"(",
"... | Filter genes in an expression matrix by mean expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
Returns
-------
ExpMatrix
The filtered expression matrix. | [
"Filter",
"genes",
"in",
"an",
"expression",
"matrix",
"by",
"mean",
"expression",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/filter.py#L74-L104 |
55,659 | flo-compbio/genometools | genometools/expression/filter.py | filter_percentile | def filter_percentile(matrix, top, percentile=50):
"""Filter genes in an expression matrix by percentile expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
percentile: int or float, optinonal
The percentile ... | python | def filter_percentile(matrix, top, percentile=50):
"""Filter genes in an expression matrix by percentile expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
percentile: int or float, optinonal
The percentile ... | [
"def",
"filter_percentile",
"(",
"matrix",
",",
"top",
",",
"percentile",
"=",
"50",
")",
":",
"assert",
"isinstance",
"(",
"matrix",
",",
"ExpMatrix",
")",
"assert",
"isinstance",
"(",
"top",
",",
"int",
")",
"assert",
"isinstance",
"(",
"percentile",
","... | Filter genes in an expression matrix by percentile expression.
Parameters
----------
matrix: ExpMatrix
The expression matrix.
top: int
The number of genes to retain.
percentile: int or float, optinonal
The percentile to use Defaults to the median (50th percentile).
Ret... | [
"Filter",
"genes",
"in",
"an",
"expression",
"matrix",
"by",
"percentile",
"expression",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/filter.py#L107-L140 |
55,660 | flo-compbio/genometools | genometools/ensembl/dna.py | _transform_chrom | def _transform_chrom(chrom):
"""Helper function to obtain specific sort order."""
try:
c = int(chrom)
except:
if chrom in ['X', 'Y']:
return chrom
elif chrom == 'MT':
return '_MT' # sort to the end
else:
return '__' + chrom # sort to the v... | python | def _transform_chrom(chrom):
"""Helper function to obtain specific sort order."""
try:
c = int(chrom)
except:
if chrom in ['X', 'Y']:
return chrom
elif chrom == 'MT':
return '_MT' # sort to the end
else:
return '__' + chrom # sort to the v... | [
"def",
"_transform_chrom",
"(",
"chrom",
")",
":",
"try",
":",
"c",
"=",
"int",
"(",
"chrom",
")",
"except",
":",
"if",
"chrom",
"in",
"[",
"'X'",
",",
"'Y'",
"]",
":",
"return",
"chrom",
"elif",
"chrom",
"==",
"'MT'",
":",
"return",
"'_MT'",
"# so... | Helper function to obtain specific sort order. | [
"Helper",
"function",
"to",
"obtain",
"specific",
"sort",
"order",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/dna.py#L35-L48 |
55,661 | flo-compbio/genometools | genometools/ensembl/dna.py | get_chromosome_lengths | def get_chromosome_lengths(fasta_file, fancy_sort=True):
"""Extract chromosome lengths from genome FASTA file."""
chromlen = []
with gzip.open(fasta_file, 'rt', encoding='ascii') as fh:
fasta = SeqIO.parse(fh, 'fasta')
for i, f in enumerate(fasta):
chromlen.append((f.id, len(f.se... | python | def get_chromosome_lengths(fasta_file, fancy_sort=True):
"""Extract chromosome lengths from genome FASTA file."""
chromlen = []
with gzip.open(fasta_file, 'rt', encoding='ascii') as fh:
fasta = SeqIO.parse(fh, 'fasta')
for i, f in enumerate(fasta):
chromlen.append((f.id, len(f.se... | [
"def",
"get_chromosome_lengths",
"(",
"fasta_file",
",",
"fancy_sort",
"=",
"True",
")",
":",
"chromlen",
"=",
"[",
"]",
"with",
"gzip",
".",
"open",
"(",
"fasta_file",
",",
"'rt'",
",",
"encoding",
"=",
"'ascii'",
")",
"as",
"fh",
":",
"fasta",
"=",
"... | Extract chromosome lengths from genome FASTA file. | [
"Extract",
"chromosome",
"lengths",
"from",
"genome",
"FASTA",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/dna.py#L51-L73 |
55,662 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/utils.py | resolve_schema | def resolve_schema(schema):
"""Transform JSON schemas "allOf".
This is the default schema resolver.
This function was created because some javascript JSON Schema libraries
don't support "allOf". We recommend to use this function only in this
specific case.
This function is transforming the JS... | python | def resolve_schema(schema):
"""Transform JSON schemas "allOf".
This is the default schema resolver.
This function was created because some javascript JSON Schema libraries
don't support "allOf". We recommend to use this function only in this
specific case.
This function is transforming the JS... | [
"def",
"resolve_schema",
"(",
"schema",
")",
":",
"def",
"traverse",
"(",
"schema",
")",
":",
"if",
"isinstance",
"(",
"schema",
",",
"dict",
")",
":",
"if",
"'allOf'",
"in",
"schema",
":",
"for",
"x",
"in",
"schema",
"[",
"'allOf'",
"]",
":",
"sub_s... | Transform JSON schemas "allOf".
This is the default schema resolver.
This function was created because some javascript JSON Schema libraries
don't support "allOf". We recommend to use this function only in this
specific case.
This function is transforming the JSON Schema by removing "allOf" keywo... | [
"Transform",
"JSON",
"schemas",
"allOf",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/utils.py#L16-L55 |
55,663 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/utils.py | _merge_dicts | def _merge_dicts(first, second):
"""Merge the 'second' multiple-dictionary into the 'first' one."""
new = deepcopy(first)
for k, v in second.items():
if isinstance(v, dict) and v:
ret = _merge_dicts(new.get(k, dict()), v)
new[k] = ret
else:
new[k] = second... | python | def _merge_dicts(first, second):
"""Merge the 'second' multiple-dictionary into the 'first' one."""
new = deepcopy(first)
for k, v in second.items():
if isinstance(v, dict) and v:
ret = _merge_dicts(new.get(k, dict()), v)
new[k] = ret
else:
new[k] = second... | [
"def",
"_merge_dicts",
"(",
"first",
",",
"second",
")",
":",
"new",
"=",
"deepcopy",
"(",
"first",
")",
"for",
"k",
",",
"v",
"in",
"second",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
"and",
"v",
":",
"ret",
... | Merge the 'second' multiple-dictionary into the 'first' one. | [
"Merge",
"the",
"second",
"multiple",
"-",
"dictionary",
"into",
"the",
"first",
"one",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/utils.py#L58-L67 |
55,664 | flo-compbio/genometools | genometools/expression/visualize/util.py | read_colorscale | def read_colorscale(cmap_file):
"""Return a colorscale in the format expected by plotly.
Parameters
----------
cmap_file : str
Path of a plain-text file containing the colorscale.
Returns
-------
list
The colorscale.
Notes
-----
A plotly colorscale is ... | python | def read_colorscale(cmap_file):
"""Return a colorscale in the format expected by plotly.
Parameters
----------
cmap_file : str
Path of a plain-text file containing the colorscale.
Returns
-------
list
The colorscale.
Notes
-----
A plotly colorscale is ... | [
"def",
"read_colorscale",
"(",
"cmap_file",
")",
":",
"assert",
"isinstance",
"(",
"cmap_file",
",",
"str",
")",
"cm",
"=",
"np",
".",
"loadtxt",
"(",
"cmap_file",
",",
"delimiter",
"=",
"'\\t'",
",",
"dtype",
"=",
"np",
".",
"float64",
")",
"# x = cm[:,... | Return a colorscale in the format expected by plotly.
Parameters
----------
cmap_file : str
Path of a plain-text file containing the colorscale.
Returns
-------
list
The colorscale.
Notes
-----
A plotly colorscale is a list where each item is a pair
(i... | [
"Return",
"a",
"colorscale",
"in",
"the",
"format",
"expected",
"by",
"plotly",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/visualize/util.py#L26-L62 |
55,665 | openfisca/openfisca-web-api | openfisca_web_api/controllers/__init__.py | make_router | def make_router():
"""Return a WSGI application that searches requests to controllers """
global router
routings = [
('GET', '^/$', index),
('GET', '^/api/?$', index),
('POST', '^/api/1/calculate/?$', calculate.api1_calculate),
('GET', '^/api/2/entities/?$', entities.api2_ent... | python | def make_router():
"""Return a WSGI application that searches requests to controllers """
global router
routings = [
('GET', '^/$', index),
('GET', '^/api/?$', index),
('POST', '^/api/1/calculate/?$', calculate.api1_calculate),
('GET', '^/api/2/entities/?$', entities.api2_ent... | [
"def",
"make_router",
"(",
")",
":",
"global",
"router",
"routings",
"=",
"[",
"(",
"'GET'",
",",
"'^/$'",
",",
"index",
")",
",",
"(",
"'GET'",
",",
"'^/api/?$'",
",",
"index",
")",
",",
"(",
"'POST'",
",",
"'^/api/1/calculate/?$'",
",",
"calculate",
... | Return a WSGI application that searches requests to controllers | [
"Return",
"a",
"WSGI",
"application",
"that",
"searches",
"requests",
"to",
"controllers"
] | d1cd3bfacac338e80bb0df7e0465b65649dd893b | https://github.com/openfisca/openfisca-web-api/blob/d1cd3bfacac338e80bb0df7e0465b65649dd893b/openfisca_web_api/controllers/__init__.py#L31-L49 |
55,666 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/ext.py | InvenioJSONSchemasState.register_schemas_dir | def register_schemas_dir(self, directory):
"""Recursively register all json-schemas in a directory.
:param directory: directory path.
"""
for root, dirs, files in os.walk(directory):
dir_path = os.path.relpath(root, directory)
if dir_path == '.':
... | python | def register_schemas_dir(self, directory):
"""Recursively register all json-schemas in a directory.
:param directory: directory path.
"""
for root, dirs, files in os.walk(directory):
dir_path = os.path.relpath(root, directory)
if dir_path == '.':
... | [
"def",
"register_schemas_dir",
"(",
"self",
",",
"directory",
")",
":",
"for",
"root",
",",
"dirs",
",",
"files",
"in",
"os",
".",
"walk",
"(",
"directory",
")",
":",
"dir_path",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"root",
",",
"directory",
... | Recursively register all json-schemas in a directory.
:param directory: directory path. | [
"Recursively",
"register",
"all",
"json",
"-",
"schemas",
"in",
"a",
"directory",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/ext.py#L51-L69 |
55,667 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/ext.py | InvenioJSONSchemasState.register_schema | def register_schema(self, directory, path):
"""Register a json-schema.
:param directory: root directory path.
:param path: schema path, relative to the root directory.
"""
self.schemas[path] = os.path.abspath(directory) | python | def register_schema(self, directory, path):
"""Register a json-schema.
:param directory: root directory path.
:param path: schema path, relative to the root directory.
"""
self.schemas[path] = os.path.abspath(directory) | [
"def",
"register_schema",
"(",
"self",
",",
"directory",
",",
"path",
")",
":",
"self",
".",
"schemas",
"[",
"path",
"]",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"directory",
")"
] | Register a json-schema.
:param directory: root directory path.
:param path: schema path, relative to the root directory. | [
"Register",
"a",
"json",
"-",
"schema",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/ext.py#L71-L77 |
55,668 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/ext.py | InvenioJSONSchemasState.get_schema_dir | def get_schema_dir(self, path):
"""Retrieve the directory containing the given schema.
:param path: Schema path, relative to the directory where it was
registered.
:raises invenio_jsonschemas.errors.JSONSchemaNotFound: If no schema
was found in the specified path.
... | python | def get_schema_dir(self, path):
"""Retrieve the directory containing the given schema.
:param path: Schema path, relative to the directory where it was
registered.
:raises invenio_jsonschemas.errors.JSONSchemaNotFound: If no schema
was found in the specified path.
... | [
"def",
"get_schema_dir",
"(",
"self",
",",
"path",
")",
":",
"if",
"path",
"not",
"in",
"self",
".",
"schemas",
":",
"raise",
"JSONSchemaNotFound",
"(",
"path",
")",
"return",
"self",
".",
"schemas",
"[",
"path",
"]"
] | Retrieve the directory containing the given schema.
:param path: Schema path, relative to the directory where it was
registered.
:raises invenio_jsonschemas.errors.JSONSchemaNotFound: If no schema
was found in the specified path.
:returns: The schema directory. | [
"Retrieve",
"the",
"directory",
"containing",
"the",
"given",
"schema",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/ext.py#L79-L90 |
55,669 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/ext.py | InvenioJSONSchemasState.get_schema_path | def get_schema_path(self, path):
"""Compute the schema's absolute path from a schema relative path.
:param path: relative path of the schema.
:raises invenio_jsonschemas.errors.JSONSchemaNotFound: If no schema
was found in the specified path.
:returns: The absolute path.
... | python | def get_schema_path(self, path):
"""Compute the schema's absolute path from a schema relative path.
:param path: relative path of the schema.
:raises invenio_jsonschemas.errors.JSONSchemaNotFound: If no schema
was found in the specified path.
:returns: The absolute path.
... | [
"def",
"get_schema_path",
"(",
"self",
",",
"path",
")",
":",
"if",
"path",
"not",
"in",
"self",
".",
"schemas",
":",
"raise",
"JSONSchemaNotFound",
"(",
"path",
")",
"return",
"os",
".",
"path",
".",
"join",
"(",
"self",
".",
"schemas",
"[",
"path",
... | Compute the schema's absolute path from a schema relative path.
:param path: relative path of the schema.
:raises invenio_jsonschemas.errors.JSONSchemaNotFound: If no schema
was found in the specified path.
:returns: The absolute path. | [
"Compute",
"the",
"schema",
"s",
"absolute",
"path",
"from",
"a",
"schema",
"relative",
"path",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/ext.py#L92-L102 |
55,670 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/ext.py | InvenioJSONSchemasState.get_schema | def get_schema(self, path, with_refs=False, resolved=False):
"""Retrieve a schema.
:param path: schema's relative path.
:param with_refs: replace $refs in the schema.
:param resolved: resolve schema using the resolver
:py:const:`invenio_jsonschemas.config.JSONSCHEMAS_RESOLVE... | python | def get_schema(self, path, with_refs=False, resolved=False):
"""Retrieve a schema.
:param path: schema's relative path.
:param with_refs: replace $refs in the schema.
:param resolved: resolve schema using the resolver
:py:const:`invenio_jsonschemas.config.JSONSCHEMAS_RESOLVE... | [
"def",
"get_schema",
"(",
"self",
",",
"path",
",",
"with_refs",
"=",
"False",
",",
"resolved",
"=",
"False",
")",
":",
"if",
"path",
"not",
"in",
"self",
".",
"schemas",
":",
"raise",
"JSONSchemaNotFound",
"(",
"path",
")",
"with",
"open",
"(",
"os",
... | Retrieve a schema.
:param path: schema's relative path.
:param with_refs: replace $refs in the schema.
:param resolved: resolve schema using the resolver
:py:const:`invenio_jsonschemas.config.JSONSCHEMAS_RESOLVER_CLS`
:raises invenio_jsonschemas.errors.JSONSchemaNotFound: If... | [
"Retrieve",
"a",
"schema",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/ext.py#L105-L128 |
55,671 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/ext.py | InvenioJSONSchemasState.url_to_path | def url_to_path(self, url):
"""Convert schema URL to path.
:param url: The schema URL.
:returns: The schema path or ``None`` if the schema can't be resolved.
"""
parts = urlsplit(url)
try:
loader, args = self.url_map.bind(parts.netloc).match(parts.path)
... | python | def url_to_path(self, url):
"""Convert schema URL to path.
:param url: The schema URL.
:returns: The schema path or ``None`` if the schema can't be resolved.
"""
parts = urlsplit(url)
try:
loader, args = self.url_map.bind(parts.netloc).match(parts.path)
... | [
"def",
"url_to_path",
"(",
"self",
",",
"url",
")",
":",
"parts",
"=",
"urlsplit",
"(",
"url",
")",
"try",
":",
"loader",
",",
"args",
"=",
"self",
".",
"url_map",
".",
"bind",
"(",
"parts",
".",
"netloc",
")",
".",
"match",
"(",
"parts",
".",
"p... | Convert schema URL to path.
:param url: The schema URL.
:returns: The schema path or ``None`` if the schema can't be resolved. | [
"Convert",
"schema",
"URL",
"to",
"path",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/ext.py#L138-L151 |
55,672 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/ext.py | InvenioJSONSchemasState.path_to_url | def path_to_url(self, path):
"""Build URL from a path.
:param path: relative path of the schema.
:returns: The schema complete URL or ``None`` if not found.
"""
if path not in self.schemas:
return None
return self.url_map.bind(
self.app.config['JS... | python | def path_to_url(self, path):
"""Build URL from a path.
:param path: relative path of the schema.
:returns: The schema complete URL or ``None`` if not found.
"""
if path not in self.schemas:
return None
return self.url_map.bind(
self.app.config['JS... | [
"def",
"path_to_url",
"(",
"self",
",",
"path",
")",
":",
"if",
"path",
"not",
"in",
"self",
".",
"schemas",
":",
"return",
"None",
"return",
"self",
".",
"url_map",
".",
"bind",
"(",
"self",
".",
"app",
".",
"config",
"[",
"'JSONSCHEMAS_HOST'",
"]",
... | Build URL from a path.
:param path: relative path of the schema.
:returns: The schema complete URL or ``None`` if not found. | [
"Build",
"URL",
"from",
"a",
"path",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/ext.py#L153-L165 |
55,673 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/ext.py | InvenioJSONSchemasState.loader_cls | def loader_cls(self):
"""Loader class used in `JsonRef.replace_refs`."""
cls = self.app.config['JSONSCHEMAS_LOADER_CLS']
if isinstance(cls, six.string_types):
return import_string(cls)
return cls | python | def loader_cls(self):
"""Loader class used in `JsonRef.replace_refs`."""
cls = self.app.config['JSONSCHEMAS_LOADER_CLS']
if isinstance(cls, six.string_types):
return import_string(cls)
return cls | [
"def",
"loader_cls",
"(",
"self",
")",
":",
"cls",
"=",
"self",
".",
"app",
".",
"config",
"[",
"'JSONSCHEMAS_LOADER_CLS'",
"]",
"if",
"isinstance",
"(",
"cls",
",",
"six",
".",
"string_types",
")",
":",
"return",
"import_string",
"(",
"cls",
")",
"retur... | Loader class used in `JsonRef.replace_refs`. | [
"Loader",
"class",
"used",
"in",
"JsonRef",
".",
"replace_refs",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/ext.py#L168-L173 |
55,674 | acorg/dark-matter | dark/graphics.py | scatterAlign | def scatterAlign(seq1, seq2, window=7):
"""
Visually align two sequences.
"""
d1 = defaultdict(list)
d2 = defaultdict(list)
for (seq, section_dict) in [(seq1, d1), (seq2, d2)]:
for i in range(len(seq) - window):
section = seq[i:i + window]
section_dict[section].ap... | python | def scatterAlign(seq1, seq2, window=7):
"""
Visually align two sequences.
"""
d1 = defaultdict(list)
d2 = defaultdict(list)
for (seq, section_dict) in [(seq1, d1), (seq2, d2)]:
for i in range(len(seq) - window):
section = seq[i:i + window]
section_dict[section].ap... | [
"def",
"scatterAlign",
"(",
"seq1",
",",
"seq2",
",",
"window",
"=",
"7",
")",
":",
"d1",
"=",
"defaultdict",
"(",
"list",
")",
"d2",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"(",
"seq",
",",
"section_dict",
")",
"in",
"[",
"(",
"seq1",
",",
... | Visually align two sequences. | [
"Visually",
"align",
"two",
"sequences",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/graphics.py#L774-L802 |
55,675 | acorg/dark-matter | dark/graphics.py | plotAAProperties | def plotAAProperties(sequence, propertyNames, showLines=True, showFigure=True):
"""
Plot amino acid property values for a sequence.
@param sequence: An C{AARead} (or a subclass) instance.
@param propertyNames: An iterable of C{str} property names (each of which
must be a key of a key in the C{d... | python | def plotAAProperties(sequence, propertyNames, showLines=True, showFigure=True):
"""
Plot amino acid property values for a sequence.
@param sequence: An C{AARead} (or a subclass) instance.
@param propertyNames: An iterable of C{str} property names (each of which
must be a key of a key in the C{d... | [
"def",
"plotAAProperties",
"(",
"sequence",
",",
"propertyNames",
",",
"showLines",
"=",
"True",
",",
"showFigure",
"=",
"True",
")",
":",
"MISSING_AA_VALUE",
"=",
"-",
"1.1",
"propertyValues",
"=",
"propertiesForSequence",
"(",
"sequence",
",",
"propertyNames",
... | Plot amino acid property values for a sequence.
@param sequence: An C{AARead} (or a subclass) instance.
@param propertyNames: An iterable of C{str} property names (each of which
must be a key of a key in the C{dark.aa.PROPERTY_DETAILS} C{dict}).
@param showLines: If C{True}, lines will be drawn bet... | [
"Plot",
"amino",
"acid",
"property",
"values",
"for",
"a",
"sequence",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/graphics.py#L805-L845 |
55,676 | acorg/dark-matter | dark/graphics.py | plotAAClusters | def plotAAClusters(sequence, propertyNames, showLines=True, showFigure=True):
"""
Plot amino acid property cluster numbers for a sequence.
@param sequence: An C{AARead} (or a subclass) instance.
@param propertyNames: An iterable of C{str} property names (each of which
must be a key of a key in ... | python | def plotAAClusters(sequence, propertyNames, showLines=True, showFigure=True):
"""
Plot amino acid property cluster numbers for a sequence.
@param sequence: An C{AARead} (or a subclass) instance.
@param propertyNames: An iterable of C{str} property names (each of which
must be a key of a key in ... | [
"def",
"plotAAClusters",
"(",
"sequence",
",",
"propertyNames",
",",
"showLines",
"=",
"True",
",",
"showFigure",
"=",
"True",
")",
":",
"MISSING_AA_VALUE",
"=",
"0",
"propertyClusters",
"=",
"clustersForSequence",
"(",
"sequence",
",",
"propertyNames",
",",
"mi... | Plot amino acid property cluster numbers for a sequence.
@param sequence: An C{AARead} (or a subclass) instance.
@param propertyNames: An iterable of C{str} property names (each of which
must be a key of a key in the C{dark.aa.PROPERTY_CLUSTERS} C{dict}).
@param showLines: If C{True}, lines will be... | [
"Plot",
"amino",
"acid",
"property",
"cluster",
"numbers",
"for",
"a",
"sequence",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/graphics.py#L848-L900 |
55,677 | invenia/Arbiter | arbiter/base.py | task_loop | def task_loop(tasks, execute, wait=None, store=TaskStore()):
"""
The inner task loop for a task runner.
execute: A function that runs a task. It should take a task as its
sole argument, and may optionally return a TaskResult.
wait: (optional, None) A function to run whenever there aren't any
... | python | def task_loop(tasks, execute, wait=None, store=TaskStore()):
"""
The inner task loop for a task runner.
execute: A function that runs a task. It should take a task as its
sole argument, and may optionally return a TaskResult.
wait: (optional, None) A function to run whenever there aren't any
... | [
"def",
"task_loop",
"(",
"tasks",
",",
"execute",
",",
"wait",
"=",
"None",
",",
"store",
"=",
"TaskStore",
"(",
")",
")",
":",
"completed",
"=",
"set",
"(",
")",
"failed",
"=",
"set",
"(",
")",
"exceptions",
"=",
"[",
"]",
"def",
"collect",
"(",
... | The inner task loop for a task runner.
execute: A function that runs a task. It should take a task as its
sole argument, and may optionally return a TaskResult.
wait: (optional, None) A function to run whenever there aren't any
runnable tasks (but there are still tasks listed as running).
... | [
"The",
"inner",
"task",
"loop",
"for",
"a",
"task",
"runner",
"."
] | 51008393ae8797da85bcd67807259a157f941dfd | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/base.py#L17-L80 |
55,678 | acorg/dark-matter | bin/aa-info.py | findOrDie | def findOrDie(s):
"""
Look up an amino acid.
@param s: A C{str} amino acid specifier. This may be a full name,
a 3-letter abbreviation or a 1-letter abbreviation. Case is ignored.
@return: An C{AminoAcid} instance, if one can be found. Else exit.
"""
aa = find(s)
if aa:
retu... | python | def findOrDie(s):
"""
Look up an amino acid.
@param s: A C{str} amino acid specifier. This may be a full name,
a 3-letter abbreviation or a 1-letter abbreviation. Case is ignored.
@return: An C{AminoAcid} instance, if one can be found. Else exit.
"""
aa = find(s)
if aa:
retu... | [
"def",
"findOrDie",
"(",
"s",
")",
":",
"aa",
"=",
"find",
"(",
"s",
")",
"if",
"aa",
":",
"return",
"aa",
"else",
":",
"print",
"(",
"'Unknown amino acid or codon: %s'",
"%",
"s",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"print",
"(",
"'Valid ar... | Look up an amino acid.
@param s: A C{str} amino acid specifier. This may be a full name,
a 3-letter abbreviation or a 1-letter abbreviation. Case is ignored.
@return: An C{AminoAcid} instance, if one can be found. Else exit. | [
"Look",
"up",
"an",
"amino",
"acid",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/aa-info.py#L13-L28 |
55,679 | flo-compbio/genometools | genometools/misc/download.py | ftp_download | def ftp_download(url, download_file, if_exists='error',
user_name='anonymous', password='', blocksize=4194304):
"""Downloads a file from an FTP server.
Parameters
----------
url : str
The URL of the file to download.
download_file : str
The path of the local file to... | python | def ftp_download(url, download_file, if_exists='error',
user_name='anonymous', password='', blocksize=4194304):
"""Downloads a file from an FTP server.
Parameters
----------
url : str
The URL of the file to download.
download_file : str
The path of the local file to... | [
"def",
"ftp_download",
"(",
"url",
",",
"download_file",
",",
"if_exists",
"=",
"'error'",
",",
"user_name",
"=",
"'anonymous'",
",",
"password",
"=",
"''",
",",
"blocksize",
"=",
"4194304",
")",
":",
"assert",
"isinstance",
"(",
"url",
",",
"(",
"str",
... | Downloads a file from an FTP server.
Parameters
----------
url : str
The URL of the file to download.
download_file : str
The path of the local file to download to.
if_exists : str, optional
Desired behavior when the download file already exists. One of:
'error' ... | [
"Downloads",
"a",
"file",
"from",
"an",
"FTP",
"server",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/download.py#L89-L156 |
55,680 | flo-compbio/genometools | genometools/ensembl/cdna.py | get_cdna_url | def get_cdna_url(species, release=None, ftp=None):
"""Returns the URL for a cDNA file hosted on the Ensembl FTP server.
Parameters
----------
species: str
The scientific name of the species. It should be all lower-case,
and the genus and species parts should be separated by an underscor... | python | def get_cdna_url(species, release=None, ftp=None):
"""Returns the URL for a cDNA file hosted on the Ensembl FTP server.
Parameters
----------
species: str
The scientific name of the species. It should be all lower-case,
and the genus and species parts should be separated by an underscor... | [
"def",
"get_cdna_url",
"(",
"species",
",",
"release",
"=",
"None",
",",
"ftp",
"=",
"None",
")",
":",
"#species_list, release=None, ftp=None",
"# type checks",
"assert",
"isinstance",
"(",
"species",
",",
"(",
"str",
",",
"_oldstr",
")",
")",
"if",
"release",... | Returns the URL for a cDNA file hosted on the Ensembl FTP server.
Parameters
----------
species: str
The scientific name of the species. It should be all lower-case,
and the genus and species parts should be separated by an underscore
(e.g., "homo_sapiens").
release: int or ``No... | [
"Returns",
"the",
"URL",
"for",
"a",
"cDNA",
"file",
"hosted",
"on",
"the",
"Ensembl",
"FTP",
"server",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/cdna.py#L33-L92 |
55,681 | flo-compbio/genometools | genometools/ontology/ontology.py | GeneOntology.write_pickle | def write_pickle(self, path, compress=False):
"""Serialize the current `GOParser` object and store it in a pickle file.
Parameters
----------
path: str
Path of the output file.
compress: bool, optional
Whether to compress the file using gzip.
Ret... | python | def write_pickle(self, path, compress=False):
"""Serialize the current `GOParser` object and store it in a pickle file.
Parameters
----------
path: str
Path of the output file.
compress: bool, optional
Whether to compress the file using gzip.
Ret... | [
"def",
"write_pickle",
"(",
"self",
",",
"path",
",",
"compress",
"=",
"False",
")",
":",
"logger",
".",
"info",
"(",
"'Writing pickle to \"%s\"...'",
",",
"path",
")",
"if",
"compress",
":",
"with",
"gzip",
".",
"open",
"(",
"path",
",",
"'wb'",
")",
... | Serialize the current `GOParser` object and store it in a pickle file.
Parameters
----------
path: str
Path of the output file.
compress: bool, optional
Whether to compress the file using gzip.
Returns
-------
None
Notes
... | [
"Serialize",
"the",
"current",
"GOParser",
"object",
"and",
"store",
"it",
"in",
"a",
"pickle",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ontology/ontology.py#L159-L184 |
55,682 | flo-compbio/genometools | genometools/ontology/ontology.py | GeneOntology.read_pickle | def read_pickle(fn):
"""Load a GOParser object from a pickle file.
The function automatically detects whether the file is compressed
with gzip.
Parameters
----------
fn: str
Path of the pickle file.
Returns
-------
`GOParser`
... | python | def read_pickle(fn):
"""Load a GOParser object from a pickle file.
The function automatically detects whether the file is compressed
with gzip.
Parameters
----------
fn: str
Path of the pickle file.
Returns
-------
`GOParser`
... | [
"def",
"read_pickle",
"(",
"fn",
")",
":",
"with",
"misc",
".",
"open_plain_or_gzip",
"(",
"fn",
",",
"'rb'",
")",
"as",
"fh",
":",
"parser",
"=",
"pickle",
".",
"load",
"(",
"fh",
")",
"return",
"parser"
] | Load a GOParser object from a pickle file.
The function automatically detects whether the file is compressed
with gzip.
Parameters
----------
fn: str
Path of the pickle file.
Returns
-------
`GOParser`
The GOParser object stored ... | [
"Load",
"a",
"GOParser",
"object",
"from",
"a",
"pickle",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ontology/ontology.py#L187-L205 |
55,683 | flo-compbio/genometools | genometools/ontology/ontology.py | GeneOntology._flatten_descendants | def _flatten_descendants(self, include_parts=True):
"""Determines and stores all descendants of each GO term.
Parameters
----------
include_parts: bool, optional
Whether to include ``part_of`` relations in determining
descendants.
Returns
-------... | python | def _flatten_descendants(self, include_parts=True):
"""Determines and stores all descendants of each GO term.
Parameters
----------
include_parts: bool, optional
Whether to include ``part_of`` relations in determining
descendants.
Returns
-------... | [
"def",
"_flatten_descendants",
"(",
"self",
",",
"include_parts",
"=",
"True",
")",
":",
"def",
"get_all_descendants",
"(",
"term",
")",
":",
"descendants",
"=",
"set",
"(",
")",
"for",
"id_",
"in",
"term",
".",
"children",
":",
"descendants",
".",
"add",
... | Determines and stores all descendants of each GO term.
Parameters
----------
include_parts: bool, optional
Whether to include ``part_of`` relations in determining
descendants.
Returns
-------
None | [
"Determines",
"and",
"stores",
"all",
"descendants",
"of",
"each",
"GO",
"term",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ontology/ontology.py#L391-L416 |
55,684 | flo-compbio/genometools | genometools/gcloud/compute/instance_config.py | InstanceConfig.wait_for_instance_deletion | def wait_for_instance_deletion(self, credentials, name, **kwargs):
"""Wait for deletion of instance based on the configuration data.
TODO: docstring"""
op_name = wait_for_instance_deletion(
credentials, self.project, self.zone, name, **kwargs)
return op_name | python | def wait_for_instance_deletion(self, credentials, name, **kwargs):
"""Wait for deletion of instance based on the configuration data.
TODO: docstring"""
op_name = wait_for_instance_deletion(
credentials, self.project, self.zone, name, **kwargs)
return op_name | [
"def",
"wait_for_instance_deletion",
"(",
"self",
",",
"credentials",
",",
"name",
",",
"*",
"*",
"kwargs",
")",
":",
"op_name",
"=",
"wait_for_instance_deletion",
"(",
"credentials",
",",
"self",
".",
"project",
",",
"self",
".",
"zone",
",",
"name",
",",
... | Wait for deletion of instance based on the configuration data.
TODO: docstring | [
"Wait",
"for",
"deletion",
"of",
"instance",
"based",
"on",
"the",
"configuration",
"data",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/compute/instance_config.py#L39-L46 |
55,685 | biocommons/bioutils | src/bioutils/cytobands.py | get_cytoband_names | def get_cytoband_names():
"""Returns the names of available cytoband data files
>> get_cytoband_names()
['ucsc-hg38', 'ucsc-hg19']
"""
return [
n.replace(".json.gz", "")
for n in pkg_resources.resource_listdir(__name__, _data_dir)
if n.endswith(".json.gz")
] | python | def get_cytoband_names():
"""Returns the names of available cytoband data files
>> get_cytoband_names()
['ucsc-hg38', 'ucsc-hg19']
"""
return [
n.replace(".json.gz", "")
for n in pkg_resources.resource_listdir(__name__, _data_dir)
if n.endswith(".json.gz")
] | [
"def",
"get_cytoband_names",
"(",
")",
":",
"return",
"[",
"n",
".",
"replace",
"(",
"\".json.gz\"",
",",
"\"\"",
")",
"for",
"n",
"in",
"pkg_resources",
".",
"resource_listdir",
"(",
"__name__",
",",
"_data_dir",
")",
"if",
"n",
".",
"endswith",
"(",
"\... | Returns the names of available cytoband data files
>> get_cytoband_names()
['ucsc-hg38', 'ucsc-hg19'] | [
"Returns",
"the",
"names",
"of",
"available",
"cytoband",
"data",
"files"
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/cytobands.py#L13-L23 |
55,686 | biocommons/bioutils | src/bioutils/cytobands.py | get_cytoband_map | def get_cytoband_map(name):
"""Fetch one cytoband map by name
>>> map = get_cytoband_map("ucsc-hg38")
>>> map["1"]["p32.2"]
[55600000, 58500000, 'gpos50']
"""
fn = pkg_resources.resource_filename(
__name__, _data_path_fmt.format(name=name))
return json.load(gzip.open(fn, mode="rt",... | python | def get_cytoband_map(name):
"""Fetch one cytoband map by name
>>> map = get_cytoband_map("ucsc-hg38")
>>> map["1"]["p32.2"]
[55600000, 58500000, 'gpos50']
"""
fn = pkg_resources.resource_filename(
__name__, _data_path_fmt.format(name=name))
return json.load(gzip.open(fn, mode="rt",... | [
"def",
"get_cytoband_map",
"(",
"name",
")",
":",
"fn",
"=",
"pkg_resources",
".",
"resource_filename",
"(",
"__name__",
",",
"_data_path_fmt",
".",
"format",
"(",
"name",
"=",
"name",
")",
")",
"return",
"json",
".",
"load",
"(",
"gzip",
".",
"open",
"(... | Fetch one cytoband map by name
>>> map = get_cytoband_map("ucsc-hg38")
>>> map["1"]["p32.2"]
[55600000, 58500000, 'gpos50'] | [
"Fetch",
"one",
"cytoband",
"map",
"by",
"name"
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/cytobands.py#L26-L36 |
55,687 | biocommons/bioutils | src/bioutils/cytobands.py | get_cytoband_maps | def get_cytoband_maps(names=[]):
"""Load all cytoband maps
>>> maps = get_cytoband_maps()
>>> maps["ucsc-hg38"]["1"]["p32.2"]
[55600000, 58500000, 'gpos50']
>>> maps["ucsc-hg19"]["1"]["p32.2"]
[56100000, 59000000, 'gpos50']
"""
if names == []:
names = get_cytoband_names()
re... | python | def get_cytoband_maps(names=[]):
"""Load all cytoband maps
>>> maps = get_cytoband_maps()
>>> maps["ucsc-hg38"]["1"]["p32.2"]
[55600000, 58500000, 'gpos50']
>>> maps["ucsc-hg19"]["1"]["p32.2"]
[56100000, 59000000, 'gpos50']
"""
if names == []:
names = get_cytoband_names()
re... | [
"def",
"get_cytoband_maps",
"(",
"names",
"=",
"[",
"]",
")",
":",
"if",
"names",
"==",
"[",
"]",
":",
"names",
"=",
"get_cytoband_names",
"(",
")",
"return",
"{",
"name",
":",
"get_cytoband_map",
"(",
"name",
")",
"for",
"name",
"in",
"names",
"}"
] | Load all cytoband maps
>>> maps = get_cytoband_maps()
>>> maps["ucsc-hg38"]["1"]["p32.2"]
[55600000, 58500000, 'gpos50']
>>> maps["ucsc-hg19"]["1"]["p32.2"]
[56100000, 59000000, 'gpos50'] | [
"Load",
"all",
"cytoband",
"maps"
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/cytobands.py#L39-L50 |
55,688 | flo-compbio/genometools | genometools/expression/profile.py | ExpProfile.filter_genes | def filter_genes(self, gene_names : Iterable[str]):
"""Filter the expression matrix against a set of genes.
Parameters
----------
gene_names: list of str
The genome to filter the genes against.
Returns
-------
ExpMatrix
The filtered expre... | python | def filter_genes(self, gene_names : Iterable[str]):
"""Filter the expression matrix against a set of genes.
Parameters
----------
gene_names: list of str
The genome to filter the genes against.
Returns
-------
ExpMatrix
The filtered expre... | [
"def",
"filter_genes",
"(",
"self",
",",
"gene_names",
":",
"Iterable",
"[",
"str",
"]",
")",
":",
"filt",
"=",
"self",
".",
"loc",
"[",
"self",
".",
"index",
"&",
"gene_names",
"]",
"return",
"filt"
] | Filter the expression matrix against a set of genes.
Parameters
----------
gene_names: list of str
The genome to filter the genes against.
Returns
-------
ExpMatrix
The filtered expression matrix. | [
"Filter",
"the",
"expression",
"matrix",
"against",
"a",
"set",
"of",
"genes",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/profile.py#L205-L220 |
55,689 | flo-compbio/genometools | genometools/expression/profile.py | ExpProfile.read_tsv | def read_tsv(cls, filepath_or_buffer: str, gene_table: ExpGeneTable = None,
encoding='UTF-8'):
"""Read expression profile from a tab-delimited text file.
Parameters
----------
path: str
The path of the text file.
gene_table: `ExpGeneTable` object, op... | python | def read_tsv(cls, filepath_or_buffer: str, gene_table: ExpGeneTable = None,
encoding='UTF-8'):
"""Read expression profile from a tab-delimited text file.
Parameters
----------
path: str
The path of the text file.
gene_table: `ExpGeneTable` object, op... | [
"def",
"read_tsv",
"(",
"cls",
",",
"filepath_or_buffer",
":",
"str",
",",
"gene_table",
":",
"ExpGeneTable",
"=",
"None",
",",
"encoding",
"=",
"'UTF-8'",
")",
":",
"# \"squeeze = True\" ensures that a pd.read_tsv returns a series",
"# as long as there is only one column",... | Read expression profile from a tab-delimited text file.
Parameters
----------
path: str
The path of the text file.
gene_table: `ExpGeneTable` object, optional
The set of valid genes. If given, the genes in the text file will
be filtered against this s... | [
"Read",
"expression",
"profile",
"from",
"a",
"tab",
"-",
"delimited",
"text",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/expression/profile.py#L224-L253 |
55,690 | flo-compbio/genometools | genometools/gcloud/tasks/fastq.py | run_fastqc | def run_fastqc(credentials, instance_config, instance_name,
script_dir, input_file, output_dir, self_destruct=True,
**kwargs):
"""Run FASTQC.
TODO: docstring"""
template = _TEMPLATE_ENV.get_template('fastqc.sh')
startup_script = template.render(
script_dir=script_d... | python | def run_fastqc(credentials, instance_config, instance_name,
script_dir, input_file, output_dir, self_destruct=True,
**kwargs):
"""Run FASTQC.
TODO: docstring"""
template = _TEMPLATE_ENV.get_template('fastqc.sh')
startup_script = template.render(
script_dir=script_d... | [
"def",
"run_fastqc",
"(",
"credentials",
",",
"instance_config",
",",
"instance_name",
",",
"script_dir",
",",
"input_file",
",",
"output_dir",
",",
"self_destruct",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"template",
"=",
"_TEMPLATE_ENV",
".",
"get_te... | Run FASTQC.
TODO: docstring | [
"Run",
"FASTQC",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/tasks/fastq.py#L15-L36 |
55,691 | flo-compbio/genometools | genometools/gcloud/tasks/fastq.py | sra_download_paired_end | def sra_download_paired_end(credentials, instance_config, instance_name,
script_dir, sra_run_acc, output_dir, **kwargs):
"""Download paired-end reads from SRA and convert to gzip'ed FASTQ files.
TODO: docstring"""
template = _TEMPLATE_ENV.get_template('sra_download_paired-e... | python | def sra_download_paired_end(credentials, instance_config, instance_name,
script_dir, sra_run_acc, output_dir, **kwargs):
"""Download paired-end reads from SRA and convert to gzip'ed FASTQ files.
TODO: docstring"""
template = _TEMPLATE_ENV.get_template('sra_download_paired-e... | [
"def",
"sra_download_paired_end",
"(",
"credentials",
",",
"instance_config",
",",
"instance_name",
",",
"script_dir",
",",
"sra_run_acc",
",",
"output_dir",
",",
"*",
"*",
"kwargs",
")",
":",
"template",
"=",
"_TEMPLATE_ENV",
".",
"get_template",
"(",
"'sra_downl... | Download paired-end reads from SRA and convert to gzip'ed FASTQ files.
TODO: docstring | [
"Download",
"paired",
"-",
"end",
"reads",
"from",
"SRA",
"and",
"convert",
"to",
"gzip",
"ed",
"FASTQ",
"files",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/tasks/fastq.py#L39-L57 |
55,692 | udragon/pybrctl | pybrctl/pybrctl.py | _runshell | def _runshell(cmd, exception):
""" Run a shell command. if fails, raise a proper exception. """
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if p.wait() != 0:
raise BridgeException(exception)
return p | python | def _runshell(cmd, exception):
""" Run a shell command. if fails, raise a proper exception. """
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if p.wait() != 0:
raise BridgeException(exception)
return p | [
"def",
"_runshell",
"(",
"cmd",
",",
"exception",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"PIPE",
")",
"if",
"p",
".",
"wait",
"(",
")",
"!=",... | Run a shell command. if fails, raise a proper exception. | [
"Run",
"a",
"shell",
"command",
".",
"if",
"fails",
"raise",
"a",
"proper",
"exception",
"."
] | 9e834a605b57bd969a81c56a886dee81f7d715c1 | https://github.com/udragon/pybrctl/blob/9e834a605b57bd969a81c56a886dee81f7d715c1/pybrctl/pybrctl.py#L145-L150 |
55,693 | udragon/pybrctl | pybrctl/pybrctl.py | Bridge.addif | def addif(self, iname):
""" Add an interface to the bridge """
_runshell([brctlexe, 'addif', self.name, iname],
"Could not add interface %s to %s." % (iname, self.name)) | python | def addif(self, iname):
""" Add an interface to the bridge """
_runshell([brctlexe, 'addif', self.name, iname],
"Could not add interface %s to %s." % (iname, self.name)) | [
"def",
"addif",
"(",
"self",
",",
"iname",
")",
":",
"_runshell",
"(",
"[",
"brctlexe",
",",
"'addif'",
",",
"self",
".",
"name",
",",
"iname",
"]",
",",
"\"Could not add interface %s to %s.\"",
"%",
"(",
"iname",
",",
"self",
".",
"name",
")",
")"
] | Add an interface to the bridge | [
"Add",
"an",
"interface",
"to",
"the",
"bridge"
] | 9e834a605b57bd969a81c56a886dee81f7d715c1 | https://github.com/udragon/pybrctl/blob/9e834a605b57bd969a81c56a886dee81f7d715c1/pybrctl/pybrctl.py#L24-L27 |
55,694 | udragon/pybrctl | pybrctl/pybrctl.py | Bridge.delif | def delif(self, iname):
""" Delete an interface from the bridge. """
_runshell([brctlexe, 'delif', self.name, iname],
"Could not delete interface %s from %s." % (iname, self.name)) | python | def delif(self, iname):
""" Delete an interface from the bridge. """
_runshell([brctlexe, 'delif', self.name, iname],
"Could not delete interface %s from %s." % (iname, self.name)) | [
"def",
"delif",
"(",
"self",
",",
"iname",
")",
":",
"_runshell",
"(",
"[",
"brctlexe",
",",
"'delif'",
",",
"self",
".",
"name",
",",
"iname",
"]",
",",
"\"Could not delete interface %s from %s.\"",
"%",
"(",
"iname",
",",
"self",
".",
"name",
")",
")"
... | Delete an interface from the bridge. | [
"Delete",
"an",
"interface",
"from",
"the",
"bridge",
"."
] | 9e834a605b57bd969a81c56a886dee81f7d715c1 | https://github.com/udragon/pybrctl/blob/9e834a605b57bd969a81c56a886dee81f7d715c1/pybrctl/pybrctl.py#L29-L32 |
55,695 | udragon/pybrctl | pybrctl/pybrctl.py | Bridge.setageing | def setageing(self, time):
""" Set bridge ageing time. """
_runshell([brctlexe, 'setageing', self.name, str(time)],
"Could not set ageing time in %s." % self.name) | python | def setageing(self, time):
""" Set bridge ageing time. """
_runshell([brctlexe, 'setageing', self.name, str(time)],
"Could not set ageing time in %s." % self.name) | [
"def",
"setageing",
"(",
"self",
",",
"time",
")",
":",
"_runshell",
"(",
"[",
"brctlexe",
",",
"'setageing'",
",",
"self",
".",
"name",
",",
"str",
"(",
"time",
")",
"]",
",",
"\"Could not set ageing time in %s.\"",
"%",
"self",
".",
"name",
")"
] | Set bridge ageing time. | [
"Set",
"bridge",
"ageing",
"time",
"."
] | 9e834a605b57bd969a81c56a886dee81f7d715c1 | https://github.com/udragon/pybrctl/blob/9e834a605b57bd969a81c56a886dee81f7d715c1/pybrctl/pybrctl.py#L48-L51 |
55,696 | udragon/pybrctl | pybrctl/pybrctl.py | Bridge.setbridgeprio | def setbridgeprio(self, prio):
""" Set bridge priority value. """
_runshell([brctlexe, 'setbridgeprio', self.name, str(prio)],
"Could not set bridge priority in %s." % self.name) | python | def setbridgeprio(self, prio):
""" Set bridge priority value. """
_runshell([brctlexe, 'setbridgeprio', self.name, str(prio)],
"Could not set bridge priority in %s." % self.name) | [
"def",
"setbridgeprio",
"(",
"self",
",",
"prio",
")",
":",
"_runshell",
"(",
"[",
"brctlexe",
",",
"'setbridgeprio'",
",",
"self",
".",
"name",
",",
"str",
"(",
"prio",
")",
"]",
",",
"\"Could not set bridge priority in %s.\"",
"%",
"self",
".",
"name",
"... | Set bridge priority value. | [
"Set",
"bridge",
"priority",
"value",
"."
] | 9e834a605b57bd969a81c56a886dee81f7d715c1 | https://github.com/udragon/pybrctl/blob/9e834a605b57bd969a81c56a886dee81f7d715c1/pybrctl/pybrctl.py#L53-L56 |
55,697 | udragon/pybrctl | pybrctl/pybrctl.py | Bridge.setfd | def setfd(self, time):
""" Set bridge forward delay time value. """
_runshell([brctlexe, 'setfd', self.name, str(time)],
"Could not set forward delay in %s." % self.name) | python | def setfd(self, time):
""" Set bridge forward delay time value. """
_runshell([brctlexe, 'setfd', self.name, str(time)],
"Could not set forward delay in %s." % self.name) | [
"def",
"setfd",
"(",
"self",
",",
"time",
")",
":",
"_runshell",
"(",
"[",
"brctlexe",
",",
"'setfd'",
",",
"self",
".",
"name",
",",
"str",
"(",
"time",
")",
"]",
",",
"\"Could not set forward delay in %s.\"",
"%",
"self",
".",
"name",
")"
] | Set bridge forward delay time value. | [
"Set",
"bridge",
"forward",
"delay",
"time",
"value",
"."
] | 9e834a605b57bd969a81c56a886dee81f7d715c1 | https://github.com/udragon/pybrctl/blob/9e834a605b57bd969a81c56a886dee81f7d715c1/pybrctl/pybrctl.py#L58-L61 |
55,698 | udragon/pybrctl | pybrctl/pybrctl.py | Bridge.sethello | def sethello(self, time):
""" Set bridge hello time value. """
_runshell([brctlexe, 'sethello', self.name, str(time)],
"Could not set hello time in %s." % self.name) | python | def sethello(self, time):
""" Set bridge hello time value. """
_runshell([brctlexe, 'sethello', self.name, str(time)],
"Could not set hello time in %s." % self.name) | [
"def",
"sethello",
"(",
"self",
",",
"time",
")",
":",
"_runshell",
"(",
"[",
"brctlexe",
",",
"'sethello'",
",",
"self",
".",
"name",
",",
"str",
"(",
"time",
")",
"]",
",",
"\"Could not set hello time in %s.\"",
"%",
"self",
".",
"name",
")"
] | Set bridge hello time value. | [
"Set",
"bridge",
"hello",
"time",
"value",
"."
] | 9e834a605b57bd969a81c56a886dee81f7d715c1 | https://github.com/udragon/pybrctl/blob/9e834a605b57bd969a81c56a886dee81f7d715c1/pybrctl/pybrctl.py#L63-L66 |
55,699 | udragon/pybrctl | pybrctl/pybrctl.py | Bridge.setmaxage | def setmaxage(self, time):
""" Set bridge max message age time. """
_runshell([brctlexe, 'setmaxage', self.name, str(time)],
"Could not set max message age in %s." % self.name) | python | def setmaxage(self, time):
""" Set bridge max message age time. """
_runshell([brctlexe, 'setmaxage', self.name, str(time)],
"Could not set max message age in %s." % self.name) | [
"def",
"setmaxage",
"(",
"self",
",",
"time",
")",
":",
"_runshell",
"(",
"[",
"brctlexe",
",",
"'setmaxage'",
",",
"self",
".",
"name",
",",
"str",
"(",
"time",
")",
"]",
",",
"\"Could not set max message age in %s.\"",
"%",
"self",
".",
"name",
")"
] | Set bridge max message age time. | [
"Set",
"bridge",
"max",
"message",
"age",
"time",
"."
] | 9e834a605b57bd969a81c56a886dee81f7d715c1 | https://github.com/udragon/pybrctl/blob/9e834a605b57bd969a81c56a886dee81f7d715c1/pybrctl/pybrctl.py#L68-L71 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.