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,500 | acorg/dark-matter | dark/dna.py | matchToString | def matchToString(dnaMatch, read1, read2, matchAmbiguous=True, indent='',
offsets=None):
"""
Format a DNA match as a string.
@param dnaMatch: A C{dict} returned by C{compareDNAReads}.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read}... | python | def matchToString(dnaMatch, read1, read2, matchAmbiguous=True, indent='',
offsets=None):
"""
Format a DNA match as a string.
@param dnaMatch: A C{dict} returned by C{compareDNAReads}.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read}... | [
"def",
"matchToString",
"(",
"dnaMatch",
",",
"read1",
",",
"read2",
",",
"matchAmbiguous",
"=",
"True",
",",
"indent",
"=",
"''",
",",
"offsets",
"=",
"None",
")",
":",
"match",
"=",
"dnaMatch",
"[",
"'match'",
"]",
"identicalMatchCount",
"=",
"match",
... | Format a DNA match as a string.
@param dnaMatch: A C{dict} returned by C{compareDNAReads}.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of one of its subclasses.
@param matchAmbiguous: If C{True}, ambiguous nucleotides that ar... | [
"Format",
"a",
"DNA",
"match",
"as",
"a",
"string",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/dna.py#L39-L110 |
55,501 | acorg/dark-matter | dark/dna.py | compareDNAReads | def compareDNAReads(read1, read2, matchAmbiguous=True, gapChars='-',
offsets=None):
"""
Compare two DNA sequences.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of one of its subclasses.
@param matchAmbi... | python | def compareDNAReads(read1, read2, matchAmbiguous=True, gapChars='-',
offsets=None):
"""
Compare two DNA sequences.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of one of its subclasses.
@param matchAmbi... | [
"def",
"compareDNAReads",
"(",
"read1",
",",
"read2",
",",
"matchAmbiguous",
"=",
"True",
",",
"gapChars",
"=",
"'-'",
",",
"offsets",
"=",
"None",
")",
":",
"identicalMatchCount",
"=",
"ambiguousMatchCount",
"=",
"0",
"gapMismatchCount",
"=",
"nonGapMismatchCou... | Compare two DNA sequences.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of one of its subclasses.
@param matchAmbiguous: If C{True}, count ambiguous nucleotides that are
possibly correct as actually being correct, and scor... | [
"Compare",
"two",
"DNA",
"sequences",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/dna.py#L113-L220 |
55,502 | acorg/dark-matter | bin/check-fasta-json-blast-consistency.py | check | def check(fastaFile, jsonFiles):
"""
Check for simple consistency between the FASTA file and the JSON files.
Note that some checking is already performed by the BlastReadsAlignments
class. That includes checking the number of reads matches the number of
BLAST records and that read ids and BLAST rec... | python | def check(fastaFile, jsonFiles):
"""
Check for simple consistency between the FASTA file and the JSON files.
Note that some checking is already performed by the BlastReadsAlignments
class. That includes checking the number of reads matches the number of
BLAST records and that read ids and BLAST rec... | [
"def",
"check",
"(",
"fastaFile",
",",
"jsonFiles",
")",
":",
"reads",
"=",
"FastaReads",
"(",
"fastaFile",
")",
"readsAlignments",
"=",
"BlastReadsAlignments",
"(",
"reads",
",",
"jsonFiles",
")",
"for",
"index",
",",
"readAlignments",
"in",
"enumerate",
"(",... | Check for simple consistency between the FASTA file and the JSON files.
Note that some checking is already performed by the BlastReadsAlignments
class. That includes checking the number of reads matches the number of
BLAST records and that read ids and BLAST record read ids match.
@param jsonFiles: A ... | [
"Check",
"for",
"simple",
"consistency",
"between",
"the",
"FASTA",
"file",
"and",
"the",
"JSON",
"files",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/check-fasta-json-blast-consistency.py#L19-L62 |
55,503 | acorg/dark-matter | bin/fasta-identity-table.py | thresholdForIdentity | def thresholdForIdentity(identity, colors):
"""
Get the best identity threshold for a specific identity value.
@param identity: A C{float} nucleotide identity.
@param colors: A C{list} of (threshold, color) tuples, where threshold is a
C{float} and color is a C{str} to be used as a cell backgro... | python | def thresholdForIdentity(identity, colors):
"""
Get the best identity threshold for a specific identity value.
@param identity: A C{float} nucleotide identity.
@param colors: A C{list} of (threshold, color) tuples, where threshold is a
C{float} and color is a C{str} to be used as a cell backgro... | [
"def",
"thresholdForIdentity",
"(",
"identity",
",",
"colors",
")",
":",
"for",
"threshold",
",",
"_",
"in",
"colors",
":",
"if",
"identity",
">=",
"threshold",
":",
"return",
"threshold",
"raise",
"ValueError",
"(",
"'This should never happen! Last threshold is not... | Get the best identity threshold for a specific identity value.
@param identity: A C{float} nucleotide identity.
@param colors: A C{list} of (threshold, color) tuples, where threshold is a
C{float} and color is a C{str} to be used as a cell background. This
is as returned by C{parseColors}.
... | [
"Get",
"the",
"best",
"identity",
"threshold",
"for",
"a",
"specific",
"identity",
"value",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L29-L43 |
55,504 | acorg/dark-matter | bin/fasta-identity-table.py | parseColors | def parseColors(colors, defaultColor):
"""
Parse command line color information.
@param colors: A C{list} of space separated "value color" strings, such as
["0.9 red", "0.75 rgb(23, 190, 207)", "0.1 #CF3CF3"].
@param defaultColor: The C{str} color to use for cells that do not reach
the ... | python | def parseColors(colors, defaultColor):
"""
Parse command line color information.
@param colors: A C{list} of space separated "value color" strings, such as
["0.9 red", "0.75 rgb(23, 190, 207)", "0.1 #CF3CF3"].
@param defaultColor: The C{str} color to use for cells that do not reach
the ... | [
"def",
"parseColors",
"(",
"colors",
",",
"defaultColor",
")",
":",
"result",
"=",
"[",
"]",
"if",
"colors",
":",
"for",
"colorInfo",
"in",
"colors",
":",
"fields",
"=",
"colorInfo",
".",
"split",
"(",
"maxsplit",
"=",
"1",
")",
"if",
"len",
"(",
"fi... | Parse command line color information.
@param colors: A C{list} of space separated "value color" strings, such as
["0.9 red", "0.75 rgb(23, 190, 207)", "0.1 #CF3CF3"].
@param defaultColor: The C{str} color to use for cells that do not reach
the identity fraction threshold of any color in C{color... | [
"Parse",
"command",
"line",
"color",
"information",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L46-L92 |
55,505 | acorg/dark-matter | bin/fasta-identity-table.py | getReadLengths | def getReadLengths(reads, gapChars):
"""
Get all read lengths, excluding gap characters.
@param reads: A C{Reads} instance.
@param gapChars: A C{str} of sequence characters considered to be gaps.
@return: A C{dict} keyed by read id, with C{int} length values.
"""
gapChars = set(gapChars)
... | python | def getReadLengths(reads, gapChars):
"""
Get all read lengths, excluding gap characters.
@param reads: A C{Reads} instance.
@param gapChars: A C{str} of sequence characters considered to be gaps.
@return: A C{dict} keyed by read id, with C{int} length values.
"""
gapChars = set(gapChars)
... | [
"def",
"getReadLengths",
"(",
"reads",
",",
"gapChars",
")",
":",
"gapChars",
"=",
"set",
"(",
"gapChars",
")",
"result",
"=",
"{",
"}",
"for",
"read",
"in",
"reads",
":",
"result",
"[",
"read",
".",
"id",
"]",
"=",
"len",
"(",
"read",
")",
"-",
... | Get all read lengths, excluding gap characters.
@param reads: A C{Reads} instance.
@param gapChars: A C{str} of sequence characters considered to be gaps.
@return: A C{dict} keyed by read id, with C{int} length values. | [
"Get",
"all",
"read",
"lengths",
"excluding",
"gap",
"characters",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L95-L108 |
55,506 | acorg/dark-matter | bin/fasta-identity-table.py | explanation | def explanation(matchAmbiguous, concise, showLengths, showGaps, showNs):
"""
Make an explanation of the output HTML table.
@param matchAmbiguous: If C{True}, count ambiguous nucleotides that are
possibly correct as actually being correct. Otherwise, we are strict
and insist that only non-am... | python | def explanation(matchAmbiguous, concise, showLengths, showGaps, showNs):
"""
Make an explanation of the output HTML table.
@param matchAmbiguous: If C{True}, count ambiguous nucleotides that are
possibly correct as actually being correct. Otherwise, we are strict
and insist that only non-am... | [
"def",
"explanation",
"(",
"matchAmbiguous",
",",
"concise",
",",
"showLengths",
",",
"showGaps",
",",
"showNs",
")",
":",
"result",
"=",
"[",
"\"\"\"\n<h1>Sequence versus sequence identity table</h1>\n\n<p>\n\nThe table cells below show the nucleotide identity fraction for the seq... | Make an explanation of the output HTML table.
@param matchAmbiguous: If C{True}, count ambiguous nucleotides that are
possibly correct as actually being correct. Otherwise, we are strict
and insist that only non-ambiguous nucleotides can contribute to the
matching nucleotide count.
@par... | [
"Make",
"an",
"explanation",
"of",
"the",
"output",
"HTML",
"table",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L111-L179 |
55,507 | acorg/dark-matter | bin/fasta-identity-table.py | collectData | def collectData(reads1, reads2, square, matchAmbiguous):
"""
Get pairwise matching statistics for two sets of reads.
@param reads1: An C{OrderedDict} of C{str} read ids whose values are
C{Read} instances. These will be the rows of the table.
@param reads2: An C{OrderedDict} of C{str} read ids w... | python | def collectData(reads1, reads2, square, matchAmbiguous):
"""
Get pairwise matching statistics for two sets of reads.
@param reads1: An C{OrderedDict} of C{str} read ids whose values are
C{Read} instances. These will be the rows of the table.
@param reads2: An C{OrderedDict} of C{str} read ids w... | [
"def",
"collectData",
"(",
"reads1",
",",
"reads2",
",",
"square",
",",
"matchAmbiguous",
")",
":",
"result",
"=",
"defaultdict",
"(",
"dict",
")",
"for",
"id1",
",",
"read1",
"in",
"reads1",
".",
"items",
"(",
")",
":",
"for",
"id2",
",",
"read2",
"... | Get pairwise matching statistics for two sets of reads.
@param reads1: An C{OrderedDict} of C{str} read ids whose values are
C{Read} instances. These will be the rows of the table.
@param reads2: An C{OrderedDict} of C{str} read ids whose values are
C{Read} instances. These will be the columns ... | [
"Get",
"pairwise",
"matching",
"statistics",
"for",
"two",
"sets",
"of",
"reads",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L182-L208 |
55,508 | acorg/dark-matter | bin/fasta-identity-table.py | simpleTable | def simpleTable(tableData, reads1, reads2, square, matchAmbiguous, gapChars):
"""
Make a text table showing inter-sequence distances.
@param tableData: A C{defaultdict(dict)} keyed by read ids, whose values
are the dictionaries returned by compareDNAReads.
@param reads1: An C{OrderedDict} of C{... | python | def simpleTable(tableData, reads1, reads2, square, matchAmbiguous, gapChars):
"""
Make a text table showing inter-sequence distances.
@param tableData: A C{defaultdict(dict)} keyed by read ids, whose values
are the dictionaries returned by compareDNAReads.
@param reads1: An C{OrderedDict} of C{... | [
"def",
"simpleTable",
"(",
"tableData",
",",
"reads1",
",",
"reads2",
",",
"square",
",",
"matchAmbiguous",
",",
"gapChars",
")",
":",
"readLengths1",
"=",
"getReadLengths",
"(",
"reads1",
".",
"values",
"(",
")",
",",
"gapChars",
")",
"print",
"(",
"'ID\\... | Make a text table showing inter-sequence distances.
@param tableData: A C{defaultdict(dict)} keyed by read ids, whose values
are the dictionaries returned by compareDNAReads.
@param reads1: An C{OrderedDict} of C{str} read ids whose values are
C{Read} instances. These will be the rows of the ta... | [
"Make",
"a",
"text",
"table",
"showing",
"inter",
"-",
"sequence",
"distances",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/fasta-identity-table.py#L211-L246 |
55,509 | flo-compbio/genometools | genometools/misc/functions.py | get_file_md5sum | def get_file_md5sum(path):
"""Calculate the MD5 hash for a file."""
with open(path, 'rb') as fh:
h = str(hashlib.md5(fh.read()).hexdigest())
return h | python | def get_file_md5sum(path):
"""Calculate the MD5 hash for a file."""
with open(path, 'rb') as fh:
h = str(hashlib.md5(fh.read()).hexdigest())
return h | [
"def",
"get_file_md5sum",
"(",
"path",
")",
":",
"with",
"open",
"(",
"path",
",",
"'rb'",
")",
"as",
"fh",
":",
"h",
"=",
"str",
"(",
"hashlib",
".",
"md5",
"(",
"fh",
".",
"read",
"(",
")",
")",
".",
"hexdigest",
"(",
")",
")",
"return",
"h"
... | Calculate the MD5 hash for a file. | [
"Calculate",
"the",
"MD5",
"hash",
"for",
"a",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L65-L69 |
55,510 | flo-compbio/genometools | genometools/misc/functions.py | smart_open_read | def smart_open_read(path=None, mode='rb', encoding=None, try_gzip=False):
"""Open a file for reading or return ``stdin``.
Adapted from StackOverflow user "Wolph"
(http://stackoverflow.com/a/17603000).
"""
assert mode in ('r', 'rb')
assert path is None or isinstance(path, (str, _oldstr))
ass... | python | def smart_open_read(path=None, mode='rb', encoding=None, try_gzip=False):
"""Open a file for reading or return ``stdin``.
Adapted from StackOverflow user "Wolph"
(http://stackoverflow.com/a/17603000).
"""
assert mode in ('r', 'rb')
assert path is None or isinstance(path, (str, _oldstr))
ass... | [
"def",
"smart_open_read",
"(",
"path",
"=",
"None",
",",
"mode",
"=",
"'rb'",
",",
"encoding",
"=",
"None",
",",
"try_gzip",
"=",
"False",
")",
":",
"assert",
"mode",
"in",
"(",
"'r'",
",",
"'rb'",
")",
"assert",
"path",
"is",
"None",
"or",
"isinstan... | Open a file for reading or return ``stdin``.
Adapted from StackOverflow user "Wolph"
(http://stackoverflow.com/a/17603000). | [
"Open",
"a",
"file",
"for",
"reading",
"or",
"return",
"stdin",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L73-L129 |
55,511 | flo-compbio/genometools | genometools/misc/functions.py | smart_open_write | def smart_open_write(path=None, mode='wb', encoding=None):
"""Open a file for writing or return ``stdout``.
Adapted from StackOverflow user "Wolph"
(http://stackoverflow.com/a/17603000).
"""
if path is not None:
# open a file
fh = io.open(path, mode=mode, encoding=encoding)
else... | python | def smart_open_write(path=None, mode='wb', encoding=None):
"""Open a file for writing or return ``stdout``.
Adapted from StackOverflow user "Wolph"
(http://stackoverflow.com/a/17603000).
"""
if path is not None:
# open a file
fh = io.open(path, mode=mode, encoding=encoding)
else... | [
"def",
"smart_open_write",
"(",
"path",
"=",
"None",
",",
"mode",
"=",
"'wb'",
",",
"encoding",
"=",
"None",
")",
":",
"if",
"path",
"is",
"not",
"None",
":",
"# open a file",
"fh",
"=",
"io",
".",
"open",
"(",
"path",
",",
"mode",
"=",
"mode",
","... | Open a file for writing or return ``stdout``.
Adapted from StackOverflow user "Wolph"
(http://stackoverflow.com/a/17603000). | [
"Open",
"a",
"file",
"for",
"writing",
"or",
"return",
"stdout",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L133-L153 |
55,512 | flo-compbio/genometools | genometools/misc/functions.py | get_url_size | def get_url_size(url):
"""Get the size of a URL.
Note: Uses requests, so it does not work for FTP URLs.
Source: StackOverflow user "Burhan Khalid".
(http://stackoverflow.com/a/24585314/5651021)
Parameters
----------
url : str
The URL.
Returns
-------
int
The s... | python | def get_url_size(url):
"""Get the size of a URL.
Note: Uses requests, so it does not work for FTP URLs.
Source: StackOverflow user "Burhan Khalid".
(http://stackoverflow.com/a/24585314/5651021)
Parameters
----------
url : str
The URL.
Returns
-------
int
The s... | [
"def",
"get_url_size",
"(",
"url",
")",
":",
"r",
"=",
"requests",
".",
"head",
"(",
"url",
",",
"headers",
"=",
"{",
"'Accept-Encoding'",
":",
"'identity'",
"}",
")",
"size",
"=",
"int",
"(",
"r",
".",
"headers",
"[",
"'content-length'",
"]",
")",
"... | Get the size of a URL.
Note: Uses requests, so it does not work for FTP URLs.
Source: StackOverflow user "Burhan Khalid".
(http://stackoverflow.com/a/24585314/5651021)
Parameters
----------
url : str
The URL.
Returns
-------
int
The size of the URL in bytes. | [
"Get",
"the",
"size",
"of",
"a",
"URL",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L214-L234 |
55,513 | flo-compbio/genometools | genometools/misc/functions.py | make_sure_dir_exists | def make_sure_dir_exists(dir_, create_subfolders=False):
"""Ensures that a directory exists.
Adapted from StackOverflow users "Bengt" and "Heikki Toivonen"
(http://stackoverflow.com/a/5032238).
Parameters
----------
dir_: str
The directory path.
create_subfolders: bool, optional
... | python | def make_sure_dir_exists(dir_, create_subfolders=False):
"""Ensures that a directory exists.
Adapted from StackOverflow users "Bengt" and "Heikki Toivonen"
(http://stackoverflow.com/a/5032238).
Parameters
----------
dir_: str
The directory path.
create_subfolders: bool, optional
... | [
"def",
"make_sure_dir_exists",
"(",
"dir_",
",",
"create_subfolders",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"dir_",
",",
"(",
"str",
",",
"_oldstr",
")",
")",
"assert",
"isinstance",
"(",
"create_subfolders",
",",
"bool",
")",
"try",
":",
"i... | Ensures that a directory exists.
Adapted from StackOverflow users "Bengt" and "Heikki Toivonen"
(http://stackoverflow.com/a/5032238).
Parameters
----------
dir_: str
The directory path.
create_subfolders: bool, optional
Whether to create any inexistent subfolders. [False]
... | [
"Ensures",
"that",
"a",
"directory",
"exists",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L253-L285 |
55,514 | flo-compbio/genometools | genometools/misc/functions.py | get_file_size | def get_file_size(path):
"""The the size of a file in bytes.
Parameters
----------
path: str
The path of the file.
Returns
-------
int
The size of the file in bytes.
Raises
------
IOError
If the file does not exist.
OSError
If a file system ... | python | def get_file_size(path):
"""The the size of a file in bytes.
Parameters
----------
path: str
The path of the file.
Returns
-------
int
The size of the file in bytes.
Raises
------
IOError
If the file does not exist.
OSError
If a file system ... | [
"def",
"get_file_size",
"(",
"path",
")",
":",
"assert",
"isinstance",
"(",
"path",
",",
"(",
"str",
",",
"_oldstr",
")",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
":",
"raise",
"IOError",
"(",
"'File \"%s\" does not exist.'",... | The the size of a file in bytes.
Parameters
----------
path: str
The path of the file.
Returns
-------
int
The size of the file in bytes.
Raises
------
IOError
If the file does not exist.
OSError
If a file system error occurs. | [
"The",
"the",
"size",
"of",
"a",
"file",
"in",
"bytes",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L287-L312 |
55,515 | flo-compbio/genometools | genometools/misc/functions.py | gzip_open_text | def gzip_open_text(path, encoding=None):
"""Opens a plain-text file that may be gzip'ed.
Parameters
----------
path : str
The file.
encoding : str, optional
The encoding to use.
Returns
-------
file-like
A file-like object.
Notes
-----
Generally, re... | python | def gzip_open_text(path, encoding=None):
"""Opens a plain-text file that may be gzip'ed.
Parameters
----------
path : str
The file.
encoding : str, optional
The encoding to use.
Returns
-------
file-like
A file-like object.
Notes
-----
Generally, re... | [
"def",
"gzip_open_text",
"(",
"path",
",",
"encoding",
"=",
"None",
")",
":",
"if",
"encoding",
"is",
"None",
":",
"encoding",
"=",
"sys",
".",
"getdefaultencoding",
"(",
")",
"assert",
"os",
".",
"path",
".",
"isfile",
"(",
"path",
")",
"is_compressed",... | Opens a plain-text file that may be gzip'ed.
Parameters
----------
path : str
The file.
encoding : str, optional
The encoding to use.
Returns
-------
file-like
A file-like object.
Notes
-----
Generally, reading gzip'ed files with gzip.open is very slow,... | [
"Opens",
"a",
"plain",
"-",
"text",
"file",
"that",
"may",
"be",
"gzip",
"ed",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L390-L438 |
55,516 | flo-compbio/genometools | genometools/misc/functions.py | bisect_index | def bisect_index(a, x):
""" Find the leftmost index of an element in a list using binary search.
Parameters
----------
a: list
A sorted list.
x: arbitrary
The element.
Returns
-------
int
The index.
"""
i = bisect.bisect_left(a, x)
if i != len(a) an... | python | def bisect_index(a, x):
""" Find the leftmost index of an element in a list using binary search.
Parameters
----------
a: list
A sorted list.
x: arbitrary
The element.
Returns
-------
int
The index.
"""
i = bisect.bisect_left(a, x)
if i != len(a) an... | [
"def",
"bisect_index",
"(",
"a",
",",
"x",
")",
":",
"i",
"=",
"bisect",
".",
"bisect_left",
"(",
"a",
",",
"x",
")",
"if",
"i",
"!=",
"len",
"(",
"a",
")",
"and",
"a",
"[",
"i",
"]",
"==",
"x",
":",
"return",
"i",
"raise",
"ValueError"
] | Find the leftmost index of an element in a list using binary search.
Parameters
----------
a: list
A sorted list.
x: arbitrary
The element.
Returns
-------
int
The index. | [
"Find",
"the",
"leftmost",
"index",
"of",
"an",
"element",
"in",
"a",
"list",
"using",
"binary",
"search",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L470-L489 |
55,517 | flo-compbio/genometools | genometools/misc/functions.py | read_single | def read_single(path, encoding = 'UTF-8'):
""" Reads the first column of a tab-delimited text file.
The file can either be uncompressed or gzip'ed.
Parameters
----------
path: str
The path of the file.
enc: str
The file encoding.
Returns
-------
List of str
... | python | def read_single(path, encoding = 'UTF-8'):
""" Reads the first column of a tab-delimited text file.
The file can either be uncompressed or gzip'ed.
Parameters
----------
path: str
The path of the file.
enc: str
The file encoding.
Returns
-------
List of str
... | [
"def",
"read_single",
"(",
"path",
",",
"encoding",
"=",
"'UTF-8'",
")",
":",
"assert",
"isinstance",
"(",
"path",
",",
"(",
"str",
",",
"_oldstr",
")",
")",
"data",
"=",
"[",
"]",
"with",
"smart_open_read",
"(",
"path",
",",
"mode",
"=",
"'rb'",
","... | Reads the first column of a tab-delimited text file.
The file can either be uncompressed or gzip'ed.
Parameters
----------
path: str
The path of the file.
enc: str
The file encoding.
Returns
-------
List of str
A list containing the elements in the first column... | [
"Reads",
"the",
"first",
"column",
"of",
"a",
"tab",
"-",
"delimited",
"text",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/functions.py#L548-L572 |
55,518 | flo-compbio/genometools | genometools/gcloud/compute/network.py | add_tcp_firewall_rule | def add_tcp_firewall_rule(project, access_token, name, tag, port):
"""Adds a TCP firewall rule.
TODO: docstring"""
headers = {
'Authorization': 'Bearer %s' % access_token.access_token
}
payload = {
"name": name,
"kind": "compute#firewall",
"sourceRanges": [... | python | def add_tcp_firewall_rule(project, access_token, name, tag, port):
"""Adds a TCP firewall rule.
TODO: docstring"""
headers = {
'Authorization': 'Bearer %s' % access_token.access_token
}
payload = {
"name": name,
"kind": "compute#firewall",
"sourceRanges": [... | [
"def",
"add_tcp_firewall_rule",
"(",
"project",
",",
"access_token",
",",
"name",
",",
"tag",
",",
"port",
")",
":",
"headers",
"=",
"{",
"'Authorization'",
":",
"'Bearer %s'",
"%",
"access_token",
".",
"access_token",
"}",
"payload",
"=",
"{",
"\"name\"",
"... | Adds a TCP firewall rule.
TODO: docstring | [
"Adds",
"a",
"TCP",
"firewall",
"rule",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/compute/network.py#L8-L35 |
55,519 | cebel/pyuniprot | src/pyuniprot/cli.py | update | def update(taxids, conn, force_download, silent):
"""Update local UniProt database"""
if not silent:
click.secho("WARNING: Update is very time consuming and can take several "
"hours depending which organisms you are importing!", fg="yellow")
if not taxids:
click... | python | def update(taxids, conn, force_download, silent):
"""Update local UniProt database"""
if not silent:
click.secho("WARNING: Update is very time consuming and can take several "
"hours depending which organisms you are importing!", fg="yellow")
if not taxids:
click... | [
"def",
"update",
"(",
"taxids",
",",
"conn",
",",
"force_download",
",",
"silent",
")",
":",
"if",
"not",
"silent",
":",
"click",
".",
"secho",
"(",
"\"WARNING: Update is very time consuming and can take several \"",
"\"hours depending which organisms you are importing!\"",... | Update local UniProt database | [
"Update",
"local",
"UniProt",
"database"
] | 9462a6042c7c9295415a5eb589b77b27cb7c142b | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/cli.py#L57-L72 |
55,520 | cebel/pyuniprot | src/pyuniprot/cli.py | web | def web(host, port):
"""Start web application"""
from .webserver.web import get_app
get_app().run(host=host, port=port) | python | def web(host, port):
"""Start web application"""
from .webserver.web import get_app
get_app().run(host=host, port=port) | [
"def",
"web",
"(",
"host",
",",
"port",
")",
":",
"from",
".",
"webserver",
".",
"web",
"import",
"get_app",
"get_app",
"(",
")",
".",
"run",
"(",
"host",
"=",
"host",
",",
"port",
"=",
"port",
")"
] | Start web application | [
"Start",
"web",
"application"
] | 9462a6042c7c9295415a5eb589b77b27cb7c142b | https://github.com/cebel/pyuniprot/blob/9462a6042c7c9295415a5eb589b77b27cb7c142b/src/pyuniprot/cli.py#L99-L102 |
55,521 | acorg/dark-matter | dark/blast/params.py | checkCompatibleParams | def checkCompatibleParams(initialParams, laterParams):
"""
Check a later set of BLAST parameters against those originally found.
@param initialParams: A C{dict} with the originally encountered BLAST
parameter settings.
@param laterParams: A C{dict} with BLAST parameter settings encountered
... | python | def checkCompatibleParams(initialParams, laterParams):
"""
Check a later set of BLAST parameters against those originally found.
@param initialParams: A C{dict} with the originally encountered BLAST
parameter settings.
@param laterParams: A C{dict} with BLAST parameter settings encountered
... | [
"def",
"checkCompatibleParams",
"(",
"initialParams",
",",
"laterParams",
")",
":",
"# Note that although the params contains a 'date', its value is empty",
"# (as far as I've seen). This could become an issue one day if it",
"# becomes non-empty and differs between JSON files that we cat",
"#... | Check a later set of BLAST parameters against those originally found.
@param initialParams: A C{dict} with the originally encountered BLAST
parameter settings.
@param laterParams: A C{dict} with BLAST parameter settings encountered
later.
@return: A C{str} summary of the parameter differenc... | [
"Check",
"a",
"later",
"set",
"of",
"BLAST",
"parameters",
"against",
"those",
"originally",
"found",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/blast/params.py#L12-L46 |
55,522 | flo-compbio/genometools | genometools/basic/gene_set.py | GeneSet.to_list | def to_list(self):
"""Converts the GeneSet object to a flat list of strings.
Note: see also :meth:`from_list`.
Parameters
----------
Returns
-------
list of str
The data from the GeneSet object as a flat list.
"""
src = self._source ... | python | def to_list(self):
"""Converts the GeneSet object to a flat list of strings.
Note: see also :meth:`from_list`.
Parameters
----------
Returns
-------
list of str
The data from the GeneSet object as a flat list.
"""
src = self._source ... | [
"def",
"to_list",
"(",
"self",
")",
":",
"src",
"=",
"self",
".",
"_source",
"or",
"''",
"coll",
"=",
"self",
".",
"_collection",
"or",
"''",
"desc",
"=",
"self",
".",
"_description",
"or",
"''",
"l",
"=",
"[",
"self",
".",
"_id",
",",
"src",
","... | Converts the GeneSet object to a flat list of strings.
Note: see also :meth:`from_list`.
Parameters
----------
Returns
-------
list of str
The data from the GeneSet object as a flat list. | [
"Converts",
"the",
"GeneSet",
"object",
"to",
"a",
"flat",
"list",
"of",
"strings",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set.py#L165-L184 |
55,523 | flo-compbio/genometools | genometools/basic/gene_set.py | GeneSet.from_list | def from_list(cls, l):
"""Generate an GeneSet object from a list of strings.
Note: See also :meth:`to_list`.
Parameters
----------
l: list or tuple of str
A list of strings representing gene set ID, name, genes,
source, collection, and description. The g... | python | def from_list(cls, l):
"""Generate an GeneSet object from a list of strings.
Note: See also :meth:`to_list`.
Parameters
----------
l: list or tuple of str
A list of strings representing gene set ID, name, genes,
source, collection, and description. The g... | [
"def",
"from_list",
"(",
"cls",
",",
"l",
")",
":",
"id_",
"=",
"l",
"[",
"0",
"]",
"name",
"=",
"l",
"[",
"3",
"]",
"genes",
"=",
"l",
"[",
"4",
"]",
".",
"split",
"(",
"','",
")",
"src",
"=",
"l",
"[",
"1",
"]",
"or",
"None",
"coll",
... | Generate an GeneSet object from a list of strings.
Note: See also :meth:`to_list`.
Parameters
----------
l: list or tuple of str
A list of strings representing gene set ID, name, genes,
source, collection, and description. The genes must be
comma-sep... | [
"Generate",
"an",
"GeneSet",
"object",
"from",
"a",
"list",
"of",
"strings",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/basic/gene_set.py#L187-L212 |
55,524 | acorg/dark-matter | dark/sequence.py | findPrimer | def findPrimer(primer, seq):
"""
Look for a primer sequence.
@param primer: A C{str} primer sequence.
@param seq: A BioPython C{Bio.Seq} sequence.
@return: A C{list} of zero-based offsets into the sequence at which the
primer can be found. If no instances are found, return an empty
... | python | def findPrimer(primer, seq):
"""
Look for a primer sequence.
@param primer: A C{str} primer sequence.
@param seq: A BioPython C{Bio.Seq} sequence.
@return: A C{list} of zero-based offsets into the sequence at which the
primer can be found. If no instances are found, return an empty
... | [
"def",
"findPrimer",
"(",
"primer",
",",
"seq",
")",
":",
"offsets",
"=",
"[",
"]",
"seq",
"=",
"seq",
".",
"upper",
"(",
")",
"primer",
"=",
"primer",
".",
"upper",
"(",
")",
"primerLen",
"=",
"len",
"(",
"primer",
")",
"discarded",
"=",
"0",
"o... | Look for a primer sequence.
@param primer: A C{str} primer sequence.
@param seq: A BioPython C{Bio.Seq} sequence.
@return: A C{list} of zero-based offsets into the sequence at which the
primer can be found. If no instances are found, return an empty
C{list}. | [
"Look",
"for",
"a",
"primer",
"sequence",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sequence.py#L4-L28 |
55,525 | acorg/dark-matter | dark/sequence.py | findPrimerBidi | def findPrimerBidi(primer, seq):
"""
Look for a primer in a sequence and its reverse complement.
@param primer: A C{str} primer sequence.
@param seq: A BioPython C{Bio.Seq} sequence.
@return: A C{tuple} of two lists. The first contains (zero-based)
ascending offsets into the sequence at wh... | python | def findPrimerBidi(primer, seq):
"""
Look for a primer in a sequence and its reverse complement.
@param primer: A C{str} primer sequence.
@param seq: A BioPython C{Bio.Seq} sequence.
@return: A C{tuple} of two lists. The first contains (zero-based)
ascending offsets into the sequence at wh... | [
"def",
"findPrimerBidi",
"(",
"primer",
",",
"seq",
")",
":",
"# Note that we reverse complement the primer to find the reverse",
"# matches. This is much simpler than reverse complementing the sequence",
"# because it allows us to use findPrimer and to deal with overlapping",
"# matches corre... | Look for a primer in a sequence and its reverse complement.
@param primer: A C{str} primer sequence.
@param seq: A BioPython C{Bio.Seq} sequence.
@return: A C{tuple} of two lists. The first contains (zero-based)
ascending offsets into the sequence at which the primer can be found.
The seco... | [
"Look",
"for",
"a",
"primer",
"in",
"a",
"sequence",
"and",
"its",
"reverse",
"complement",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/sequence.py#L31-L51 |
55,526 | acorg/dark-matter | dark/utils.py | parseRangeString | def parseRangeString(s, convertToZeroBased=False):
"""
Parse a range string of the form 1-5,12,100-200.
@param s: A C{str} specifiying a set of numbers, given in the form of
comma separated numeric ranges or individual indices.
@param convertToZeroBased: If C{True} all indices will have one
... | python | def parseRangeString(s, convertToZeroBased=False):
"""
Parse a range string of the form 1-5,12,100-200.
@param s: A C{str} specifiying a set of numbers, given in the form of
comma separated numeric ranges or individual indices.
@param convertToZeroBased: If C{True} all indices will have one
... | [
"def",
"parseRangeString",
"(",
"s",
",",
"convertToZeroBased",
"=",
"False",
")",
":",
"result",
"=",
"set",
"(",
")",
"for",
"_range",
"in",
"s",
".",
"split",
"(",
"','",
")",
":",
"match",
"=",
"_rangeRegex",
".",
"match",
"(",
"_range",
")",
"if... | Parse a range string of the form 1-5,12,100-200.
@param s: A C{str} specifiying a set of numbers, given in the form of
comma separated numeric ranges or individual indices.
@param convertToZeroBased: If C{True} all indices will have one
subtracted from them.
@return: A C{set} of all C{int}s... | [
"Parse",
"a",
"range",
"string",
"of",
"the",
"form",
"1",
"-",
"5",
"12",
"100",
"-",
"200",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/utils.py#L136-L168 |
55,527 | acorg/dark-matter | dark/utils.py | nucleotidesToStr | def nucleotidesToStr(nucleotides, prefix=''):
"""
Convert offsets and base counts to a string.
@param nucleotides: A C{defaultdict(Counter)} instance, keyed
by C{int} offset, with nucleotides keying the Counters.
@param prefix: A C{str} to put at the start of each line.
@return: A C{str} re... | python | def nucleotidesToStr(nucleotides, prefix=''):
"""
Convert offsets and base counts to a string.
@param nucleotides: A C{defaultdict(Counter)} instance, keyed
by C{int} offset, with nucleotides keying the Counters.
@param prefix: A C{str} to put at the start of each line.
@return: A C{str} re... | [
"def",
"nucleotidesToStr",
"(",
"nucleotides",
",",
"prefix",
"=",
"''",
")",
":",
"result",
"=",
"[",
"]",
"for",
"offset",
"in",
"sorted",
"(",
"nucleotides",
")",
":",
"result",
".",
"append",
"(",
"'%s%d: %s'",
"%",
"(",
"prefix",
",",
"offset",
",... | Convert offsets and base counts to a string.
@param nucleotides: A C{defaultdict(Counter)} instance, keyed
by C{int} offset, with nucleotides keying the Counters.
@param prefix: A C{str} to put at the start of each line.
@return: A C{str} representation of the offsets and nucleotide
counts ... | [
"Convert",
"offsets",
"and",
"base",
"counts",
"to",
"a",
"string",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/utils.py#L201-L216 |
55,528 | acorg/dark-matter | dark/diamond/alignments.py | DiamondReadsAlignments._getReader | def _getReader(self, filename, scoreClass):
"""
Obtain a JSON record reader for DIAMOND records.
@param filename: The C{str} file name holding the JSON.
@param scoreClass: A class to hold and compare scores (see scores.py).
"""
if filename.endswith('.json') or filename.e... | python | def _getReader(self, filename, scoreClass):
"""
Obtain a JSON record reader for DIAMOND records.
@param filename: The C{str} file name holding the JSON.
@param scoreClass: A class to hold and compare scores (see scores.py).
"""
if filename.endswith('.json') or filename.e... | [
"def",
"_getReader",
"(",
"self",
",",
"filename",
",",
"scoreClass",
")",
":",
"if",
"filename",
".",
"endswith",
"(",
"'.json'",
")",
"or",
"filename",
".",
"endswith",
"(",
"'.json.bz2'",
")",
":",
"return",
"JSONRecordsReader",
"(",
"filename",
",",
"s... | Obtain a JSON record reader for DIAMOND records.
@param filename: The C{str} file name holding the JSON.
@param scoreClass: A class to hold and compare scores (see scores.py). | [
"Obtain",
"a",
"JSON",
"record",
"reader",
"for",
"DIAMOND",
"records",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/diamond/alignments.py#L84-L95 |
55,529 | flo-compbio/genometools | genometools/ncbi/extract_entrez2gene.py | get_argument_parser | def get_argument_parser():
"""Creates the argument parser for the extract_entrez2gene.py script.
Returns
-------
A fully configured `argparse.ArgumentParser` object.
Notes
-----
This function is used by the `sphinx-argparse` extension for sphinx.
"""
desc = 'Generate a mapping of... | python | def get_argument_parser():
"""Creates the argument parser for the extract_entrez2gene.py script.
Returns
-------
A fully configured `argparse.ArgumentParser` object.
Notes
-----
This function is used by the `sphinx-argparse` extension for sphinx.
"""
desc = 'Generate a mapping of... | [
"def",
"get_argument_parser",
"(",
")",
":",
"desc",
"=",
"'Generate a mapping of Entrez IDs to gene symbols.'",
"parser",
"=",
"cli",
".",
"get_argument_parser",
"(",
"desc",
"=",
"desc",
")",
"parser",
".",
"add_argument",
"(",
"'-f'",
",",
"'--gene2acc-file'",
",... | Creates the argument parser for the extract_entrez2gene.py script.
Returns
-------
A fully configured `argparse.ArgumentParser` object.
Notes
-----
This function is used by the `sphinx-argparse` extension for sphinx. | [
"Creates",
"the",
"argument",
"parser",
"for",
"the",
"extract_entrez2gene",
".",
"py",
"script",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/extract_entrez2gene.py#L69-L116 |
55,530 | flo-compbio/genometools | genometools/ncbi/extract_entrez2gene.py | read_gene2acc | def read_gene2acc(file_path, logger):
"""Extracts Entrez ID -> gene symbol mapping from gene2accession.gz file.
Parameters
----------
file_path: str
The path of the gene2accession.gz file (or a filtered version thereof).
The file may be gzip'ed.
Returns
-------
dict
... | python | def read_gene2acc(file_path, logger):
"""Extracts Entrez ID -> gene symbol mapping from gene2accession.gz file.
Parameters
----------
file_path: str
The path of the gene2accession.gz file (or a filtered version thereof).
The file may be gzip'ed.
Returns
-------
dict
... | [
"def",
"read_gene2acc",
"(",
"file_path",
",",
"logger",
")",
":",
"gene2acc",
"=",
"{",
"}",
"with",
"misc",
".",
"smart_open_read",
"(",
"file_path",
",",
"mode",
"=",
"'rb'",
",",
"try_gzip",
"=",
"True",
")",
"as",
"fh",
":",
"reader",
"=",
"csv",
... | Extracts Entrez ID -> gene symbol mapping from gene2accession.gz file.
Parameters
----------
file_path: str
The path of the gene2accession.gz file (or a filtered version thereof).
The file may be gzip'ed.
Returns
-------
dict
A mapping of Entrez IDs to gene symbols. | [
"Extracts",
"Entrez",
"ID",
"-",
">",
"gene",
"symbol",
"mapping",
"from",
"gene2accession",
".",
"gz",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/extract_entrez2gene.py#L119-L160 |
55,531 | flo-compbio/genometools | genometools/ncbi/extract_entrez2gene.py | write_entrez2gene | def write_entrez2gene(file_path, entrez2gene, logger):
"""Writes Entrez ID -> gene symbol mapping to a tab-delimited text file.
Parameters
----------
file_path: str
The path of the output file.
entrez2gene: dict
The mapping of Entrez IDs to gene symbols.
Returns
-------
... | python | def write_entrez2gene(file_path, entrez2gene, logger):
"""Writes Entrez ID -> gene symbol mapping to a tab-delimited text file.
Parameters
----------
file_path: str
The path of the output file.
entrez2gene: dict
The mapping of Entrez IDs to gene symbols.
Returns
-------
... | [
"def",
"write_entrez2gene",
"(",
"file_path",
",",
"entrez2gene",
",",
"logger",
")",
":",
"with",
"misc",
".",
"smart_open_write",
"(",
"file_path",
",",
"mode",
"=",
"'wb'",
")",
"as",
"ofh",
":",
"writer",
"=",
"csv",
".",
"writer",
"(",
"ofh",
",",
... | Writes Entrez ID -> gene symbol mapping to a tab-delimited text file.
Parameters
----------
file_path: str
The path of the output file.
entrez2gene: dict
The mapping of Entrez IDs to gene symbols.
Returns
-------
None | [
"Writes",
"Entrez",
"ID",
"-",
">",
"gene",
"symbol",
"mapping",
"to",
"a",
"tab",
"-",
"delimited",
"text",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/extract_entrez2gene.py#L163-L183 |
55,532 | flo-compbio/genometools | genometools/ncbi/extract_entrez2gene.py | main | def main(args=None):
"""Extracts Entrez ID -> gene symbol mapping and writes it to a text file.
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` m... | python | def main(args=None):
"""Extracts Entrez ID -> gene symbol mapping and writes it to a text file.
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` m... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"vinfo",
"=",
"sys",
".",
"version_info",
"if",
"not",
"(",
"vinfo",
">=",
"(",
"2",
",",
"7",
")",
")",
":",
"raise",
"SystemError",
"(",
"'Python interpreter version >= 2.7 required, '",
"'found %d.%d inst... | Extracts Entrez ID -> gene symbol mapping and writes it to a text file.
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
----... | [
"Extracts",
"Entrez",
"ID",
"-",
">",
"gene",
"symbol",
"mapping",
"and",
"writes",
"it",
"to",
"a",
"text",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/extract_entrez2gene.py#L186-L231 |
55,533 | acorg/dark-matter | dark/aa.py | find | def find(s):
"""
Find an amino acid whose name or abbreviation is s.
@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 L{AminoAcid} instance or C{None} if no matching amino acid can
be locate... | python | def find(s):
"""
Find an amino acid whose name or abbreviation is s.
@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 L{AminoAcid} instance or C{None} if no matching amino acid can
be locate... | [
"def",
"find",
"(",
"s",
")",
":",
"abbrev1",
"=",
"None",
"origS",
"=",
"s",
"if",
"' '",
"in",
"s",
":",
"# Convert first word to title case, others to lower.",
"first",
",",
"rest",
"=",
"s",
".",
"split",
"(",
"' '",
",",
"1",
")",
"s",
"=",
"first... | Find an amino acid whose name or abbreviation is s.
@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 L{AminoAcid} instance or C{None} if no matching amino acid can
be located. | [
"Find",
"an",
"amino",
"acid",
"whose",
"name",
"or",
"abbreviation",
"is",
"s",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/aa.py#L982-L1022 |
55,534 | acorg/dark-matter | dark/aa.py | _propertiesOrClustersForSequence | def _propertiesOrClustersForSequence(sequence, propertyNames, propertyValues,
missingAAValue):
"""
Extract amino acid property values or cluster numbers for a sequence.
@param sequence: An C{AARead} (or a subclass) instance.
@param propertyNames: An iterable of C{st... | python | def _propertiesOrClustersForSequence(sequence, propertyNames, propertyValues,
missingAAValue):
"""
Extract amino acid property values or cluster numbers for a sequence.
@param sequence: An C{AARead} (or a subclass) instance.
@param propertyNames: An iterable of C{st... | [
"def",
"_propertiesOrClustersForSequence",
"(",
"sequence",
",",
"propertyNames",
",",
"propertyValues",
",",
"missingAAValue",
")",
":",
"propertyNames",
"=",
"sorted",
"(",
"map",
"(",
"str",
".",
"lower",
",",
"set",
"(",
"propertyNames",
")",
")",
")",
"# ... | Extract amino acid property values or 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{propertyValues} C{dict}).
@param propertyValues: A C{dict} in the f... | [
"Extract",
"amino",
"acid",
"property",
"values",
"or",
"cluster",
"numbers",
"for",
"a",
"sequence",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/aa.py#L1025-L1069 |
55,535 | acorg/dark-matter | dark/aa.py | matchToString | def matchToString(aaMatch, read1, read2, indent='', offsets=None):
"""
Format amino acid sequence match as a string.
@param aaMatch: A C{dict} returned by C{compareAaReads}.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of ... | python | def matchToString(aaMatch, read1, read2, indent='', offsets=None):
"""
Format amino acid sequence match as a string.
@param aaMatch: A C{dict} returned by C{compareAaReads}.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of ... | [
"def",
"matchToString",
"(",
"aaMatch",
",",
"read1",
",",
"read2",
",",
"indent",
"=",
"''",
",",
"offsets",
"=",
"None",
")",
":",
"match",
"=",
"aaMatch",
"[",
"'match'",
"]",
"matchCount",
"=",
"match",
"[",
"'matchCount'",
"]",
"gapMismatchCount",
"... | Format amino acid sequence match as a string.
@param aaMatch: A C{dict} returned by C{compareAaReads}.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of one of its subclasses.
@param indent: A C{str} to indent all returned lines... | [
"Format",
"amino",
"acid",
"sequence",
"match",
"as",
"a",
"string",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/aa.py#L1108-L1162 |
55,536 | acorg/dark-matter | dark/aa.py | compareAaReads | def compareAaReads(read1, read2, gapChars='-', offsets=None):
"""
Compare two amino acid sequences.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of one of its subclasses.
@param gapChars: An object supporting __contains__ ... | python | def compareAaReads(read1, read2, gapChars='-', offsets=None):
"""
Compare two amino acid sequences.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of one of its subclasses.
@param gapChars: An object supporting __contains__ ... | [
"def",
"compareAaReads",
"(",
"read1",
",",
"read2",
",",
"gapChars",
"=",
"'-'",
",",
"offsets",
"=",
"None",
")",
":",
"matchCount",
"=",
"0",
"gapMismatchCount",
"=",
"nonGapMismatchCount",
"=",
"gapGapMismatchCount",
"=",
"0",
"read1ExtraCount",
"=",
"read... | Compare two amino acid sequences.
@param read1: A C{Read} instance or an instance of one of its subclasses.
@param read2: A C{Read} instance or an instance of one of its subclasses.
@param gapChars: An object supporting __contains__ with characters that
should be considered to be gaps.
@param o... | [
"Compare",
"two",
"amino",
"acid",
"sequences",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/aa.py#L1165-L1241 |
55,537 | acorg/dark-matter | bin/noninteractive-alignment-panel.py | parseColors | def parseColors(colors, args):
"""
Parse read id color specification.
@param colors: A C{list} of C{str}s. Each item is of the form, e.g.,
'green X Y Z...', where each of X, Y, Z, ... etc. is either a read
id or the name of a FASTA or FASTQ file containing reads whose ids
should be ... | python | def parseColors(colors, args):
"""
Parse read id color specification.
@param colors: A C{list} of C{str}s. Each item is of the form, e.g.,
'green X Y Z...', where each of X, Y, Z, ... etc. is either a read
id or the name of a FASTA or FASTQ file containing reads whose ids
should be ... | [
"def",
"parseColors",
"(",
"colors",
",",
"args",
")",
":",
"result",
"=",
"defaultdict",
"(",
"set",
")",
"for",
"colorInfo",
"in",
"colors",
":",
"readIds",
"=",
"colorInfo",
".",
"split",
"(",
")",
"color",
"=",
"readIds",
".",
"pop",
"(",
"0",
")... | Parse read id color specification.
@param colors: A C{list} of C{str}s. Each item is of the form, e.g.,
'green X Y Z...', where each of X, Y, Z, ... etc. is either a read
id or the name of a FASTA or FASTQ file containing reads whose ids
should be displayed with the corresponding color. Not... | [
"Parse",
"read",
"id",
"color",
"specification",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/bin/noninteractive-alignment-panel.py#L35-L65 |
55,538 | flo-compbio/genometools | genometools/ontology/util.py | download_release | def download_release(download_file, release=None):
"""Downloads the "go-basic.obo" file for the specified release."""
if release is None:
release = get_latest_release()
url = 'http://viewvc.geneontology.org/viewvc/GO-SVN/ontology-releases/%s/go-basic.obo' % release
#download_file = 'go-basic_%s.... | python | def download_release(download_file, release=None):
"""Downloads the "go-basic.obo" file for the specified release."""
if release is None:
release = get_latest_release()
url = 'http://viewvc.geneontology.org/viewvc/GO-SVN/ontology-releases/%s/go-basic.obo' % release
#download_file = 'go-basic_%s.... | [
"def",
"download_release",
"(",
"download_file",
",",
"release",
"=",
"None",
")",
":",
"if",
"release",
"is",
"None",
":",
"release",
"=",
"get_latest_release",
"(",
")",
"url",
"=",
"'http://viewvc.geneontology.org/viewvc/GO-SVN/ontology-releases/%s/go-basic.obo'",
"%... | Downloads the "go-basic.obo" file for the specified release. | [
"Downloads",
"the",
"go",
"-",
"basic",
".",
"obo",
"file",
"for",
"the",
"specified",
"release",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ontology/util.py#L53-L59 |
55,539 | flo-compbio/genometools | genometools/ontology/util.py | get_current_ontology_date | def get_current_ontology_date():
"""Get the release date of the current Gene Ontolgo release."""
with closing(requests.get(
'http://geneontology.org/ontology/go-basic.obo',
stream=True)) as r:
for i, l in enumerate(r.iter_lines(decode_unicode=True)):
if i == 1:
... | python | def get_current_ontology_date():
"""Get the release date of the current Gene Ontolgo release."""
with closing(requests.get(
'http://geneontology.org/ontology/go-basic.obo',
stream=True)) as r:
for i, l in enumerate(r.iter_lines(decode_unicode=True)):
if i == 1:
... | [
"def",
"get_current_ontology_date",
"(",
")",
":",
"with",
"closing",
"(",
"requests",
".",
"get",
"(",
"'http://geneontology.org/ontology/go-basic.obo'",
",",
"stream",
"=",
"True",
")",
")",
"as",
"r",
":",
"for",
"i",
",",
"l",
"in",
"enumerate",
"(",
"r"... | Get the release date of the current Gene Ontolgo release. | [
"Get",
"the",
"release",
"date",
"of",
"the",
"current",
"Gene",
"Ontolgo",
"release",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ontology/util.py#L62-L73 |
55,540 | invenia/Arbiter | arbiter/sync.py | execute | def execute(function, name):
"""
Execute a task, returning a TaskResult
"""
try:
return TaskResult(name, True, None, function())
except Exception as exc:
return TaskResult(name, False, exc, None) | python | def execute(function, name):
"""
Execute a task, returning a TaskResult
"""
try:
return TaskResult(name, True, None, function())
except Exception as exc:
return TaskResult(name, False, exc, None) | [
"def",
"execute",
"(",
"function",
",",
"name",
")",
":",
"try",
":",
"return",
"TaskResult",
"(",
"name",
",",
"True",
",",
"None",
",",
"function",
"(",
")",
")",
"except",
"Exception",
"as",
"exc",
":",
"return",
"TaskResult",
"(",
"name",
",",
"F... | Execute a task, returning a TaskResult | [
"Execute",
"a",
"task",
"returning",
"a",
"TaskResult"
] | 51008393ae8797da85bcd67807259a157f941dfd | https://github.com/invenia/Arbiter/blob/51008393ae8797da85bcd67807259a157f941dfd/arbiter/sync.py#L19-L26 |
55,541 | disqus/overseer | overseer/templatetags/overseer_helpers.py | truncatechars | def truncatechars(value, arg):
"""
Truncates a string after a certain number of chars.
Argument: Number of chars to truncate after.
"""
try:
length = int(arg)
except ValueError: # Invalid literal for int().
return value # Fail silently.
if len(value) > length:
return... | python | def truncatechars(value, arg):
"""
Truncates a string after a certain number of chars.
Argument: Number of chars to truncate after.
"""
try:
length = int(arg)
except ValueError: # Invalid literal for int().
return value # Fail silently.
if len(value) > length:
return... | [
"def",
"truncatechars",
"(",
"value",
",",
"arg",
")",
":",
"try",
":",
"length",
"=",
"int",
"(",
"arg",
")",
"except",
"ValueError",
":",
"# Invalid literal for int().",
"return",
"value",
"# Fail silently.",
"if",
"len",
"(",
"value",
")",
">",
"length",
... | Truncates a string after a certain number of chars.
Argument: Number of chars to truncate after. | [
"Truncates",
"a",
"string",
"after",
"a",
"certain",
"number",
"of",
"chars",
"."
] | b37573aba33b20aa86f89eb0c7e6f4d9905bedef | https://github.com/disqus/overseer/blob/b37573aba33b20aa86f89eb0c7e6f4d9905bedef/overseer/templatetags/overseer_helpers.py#L32-L44 |
55,542 | flo-compbio/genometools | genometools/ensembl/cli/util.py | get_gtf_argument_parser | def get_gtf_argument_parser(desc, default_field_name='gene'):
"""Return an argument parser with basic options for reading GTF files.
Parameters
----------
desc: str
Description of the ArgumentParser
default_field_name: str, optional
Name of field in GTF file to look for.
Return... | python | def get_gtf_argument_parser(desc, default_field_name='gene'):
"""Return an argument parser with basic options for reading GTF files.
Parameters
----------
desc: str
Description of the ArgumentParser
default_field_name: str, optional
Name of field in GTF file to look for.
Return... | [
"def",
"get_gtf_argument_parser",
"(",
"desc",
",",
"default_field_name",
"=",
"'gene'",
")",
":",
"parser",
"=",
"cli",
".",
"get_argument_parser",
"(",
"desc",
"=",
"desc",
")",
"parser",
".",
"add_argument",
"(",
"'-a'",
",",
"'--annotation-file'",
",",
"de... | Return an argument parser with basic options for reading GTF files.
Parameters
----------
desc: str
Description of the ArgumentParser
default_field_name: str, optional
Name of field in GTF file to look for.
Returns
-------
`argparse.ArgumentParser` object
The argume... | [
"Return",
"an",
"argument",
"parser",
"with",
"basic",
"options",
"for",
"reading",
"GTF",
"files",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/cli/util.py#L30-L85 |
55,543 | inveniosoftware/invenio-jsonschemas | invenio_jsonschemas/jsonresolver.py | jsonresolver_loader | def jsonresolver_loader(url_map):
"""JSON resolver plugin that loads the schema endpoint.
Injected into Invenio-Records JSON resolver.
"""
from flask import current_app
from . import current_jsonschemas
url_map.add(Rule(
"{0}/<path:path>".format(current_app.config['JSONSCHEMAS_ENDPOINT'... | python | def jsonresolver_loader(url_map):
"""JSON resolver plugin that loads the schema endpoint.
Injected into Invenio-Records JSON resolver.
"""
from flask import current_app
from . import current_jsonschemas
url_map.add(Rule(
"{0}/<path:path>".format(current_app.config['JSONSCHEMAS_ENDPOINT'... | [
"def",
"jsonresolver_loader",
"(",
"url_map",
")",
":",
"from",
"flask",
"import",
"current_app",
"from",
".",
"import",
"current_jsonschemas",
"url_map",
".",
"add",
"(",
"Rule",
"(",
"\"{0}/<path:path>\"",
".",
"format",
"(",
"current_app",
".",
"config",
"[",... | JSON resolver plugin that loads the schema endpoint.
Injected into Invenio-Records JSON resolver. | [
"JSON",
"resolver",
"plugin",
"that",
"loads",
"the",
"schema",
"endpoint",
"."
] | 93019b8fe3bf549335e94c84198c9c0b76d8fde2 | https://github.com/inveniosoftware/invenio-jsonschemas/blob/93019b8fe3bf549335e94c84198c9c0b76d8fde2/invenio_jsonschemas/jsonresolver.py#L18-L28 |
55,544 | grabbles/grabbit | grabbit/core.py | merge_layouts | def merge_layouts(layouts):
''' Utility function for merging multiple layouts.
Args:
layouts (list): A list of BIDSLayout instances to merge.
Returns:
A BIDSLayout containing merged files and entities.
Notes:
Layouts will be merged in the order of the elements in the list. I.e.,... | python | def merge_layouts(layouts):
''' Utility function for merging multiple layouts.
Args:
layouts (list): A list of BIDSLayout instances to merge.
Returns:
A BIDSLayout containing merged files and entities.
Notes:
Layouts will be merged in the order of the elements in the list. I.e.,... | [
"def",
"merge_layouts",
"(",
"layouts",
")",
":",
"layout",
"=",
"layouts",
"[",
"0",
"]",
".",
"clone",
"(",
")",
"for",
"l",
"in",
"layouts",
"[",
"1",
":",
"]",
":",
"layout",
".",
"files",
".",
"update",
"(",
"l",
".",
"files",
")",
"layout",... | Utility function for merging multiple layouts.
Args:
layouts (list): A list of BIDSLayout instances to merge.
Returns:
A BIDSLayout containing merged files and entities.
Notes:
Layouts will be merged in the order of the elements in the list. I.e.,
the first Layout will be up... | [
"Utility",
"function",
"for",
"merging",
"multiple",
"layouts",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L1079-L1105 |
55,545 | grabbles/grabbit | grabbit/core.py | File.copy | def copy(self, path_patterns, symbolic_link=False, root=None,
conflicts='fail'):
''' Copy the contents of a file to a new location, with target
filename defined by the current File's entities and the specified
path_patterns. '''
new_filename = build_path(self.entities, path_... | python | def copy(self, path_patterns, symbolic_link=False, root=None,
conflicts='fail'):
''' Copy the contents of a file to a new location, with target
filename defined by the current File's entities and the specified
path_patterns. '''
new_filename = build_path(self.entities, path_... | [
"def",
"copy",
"(",
"self",
",",
"path_patterns",
",",
"symbolic_link",
"=",
"False",
",",
"root",
"=",
"None",
",",
"conflicts",
"=",
"'fail'",
")",
":",
"new_filename",
"=",
"build_path",
"(",
"self",
".",
"entities",
",",
"path_patterns",
")",
"if",
"... | Copy the contents of a file to a new location, with target
filename defined by the current File's entities and the specified
path_patterns. | [
"Copy",
"the",
"contents",
"of",
"a",
"file",
"to",
"a",
"new",
"location",
"with",
"target",
"filename",
"defined",
"by",
"the",
"current",
"File",
"s",
"entities",
"and",
"the",
"specified",
"path_patterns",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L110-L141 |
55,546 | grabbles/grabbit | grabbit/core.py | Entity.match_file | def match_file(self, f, update_file=False):
"""
Determine whether the passed file matches the Entity.
Args:
f (File): The File instance to match against.
Returns: the matched value if a match was found, otherwise None.
"""
if self.map_func is not None:
... | python | def match_file(self, f, update_file=False):
"""
Determine whether the passed file matches the Entity.
Args:
f (File): The File instance to match against.
Returns: the matched value if a match was found, otherwise None.
"""
if self.map_func is not None:
... | [
"def",
"match_file",
"(",
"self",
",",
"f",
",",
"update_file",
"=",
"False",
")",
":",
"if",
"self",
".",
"map_func",
"is",
"not",
"None",
":",
"val",
"=",
"self",
".",
"map_func",
"(",
"f",
")",
"else",
":",
"m",
"=",
"self",
".",
"regex",
".",... | Determine whether the passed file matches the Entity.
Args:
f (File): The File instance to match against.
Returns: the matched value if a match was found, otherwise None. | [
"Determine",
"whether",
"the",
"passed",
"file",
"matches",
"the",
"Entity",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L261-L276 |
55,547 | grabbles/grabbit | grabbit/core.py | Layout._get_or_load_domain | def _get_or_load_domain(self, domain):
''' Return a domain if one already exists, or create a new one if not.
Args:
domain (str, dict): Can be one of:
- The name of the Domain to return (fails if none exists)
- A path to the Domain configuration file
... | python | def _get_or_load_domain(self, domain):
''' Return a domain if one already exists, or create a new one if not.
Args:
domain (str, dict): Can be one of:
- The name of the Domain to return (fails if none exists)
- A path to the Domain configuration file
... | [
"def",
"_get_or_load_domain",
"(",
"self",
",",
"domain",
")",
":",
"if",
"isinstance",
"(",
"domain",
",",
"six",
".",
"string_types",
")",
":",
"if",
"domain",
"in",
"self",
".",
"domains",
":",
"return",
"self",
".",
"domains",
"[",
"domain",
"]",
"... | Return a domain if one already exists, or create a new one if not.
Args:
domain (str, dict): Can be one of:
- The name of the Domain to return (fails if none exists)
- A path to the Domain configuration file
- A dictionary containing configuration inf... | [
"Return",
"a",
"domain",
"if",
"one",
"already",
"exists",
"or",
"create",
"a",
"new",
"one",
"if",
"not",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L423-L457 |
55,548 | grabbles/grabbit | grabbit/core.py | Layout._check_inclusions | def _check_inclusions(self, f, domains=None):
''' Check file or directory against regexes in config to determine if
it should be included in the index '''
filename = f if isinstance(f, six.string_types) else f.path
if domains is None:
domains = list(self.domains.values(... | python | def _check_inclusions(self, f, domains=None):
''' Check file or directory against regexes in config to determine if
it should be included in the index '''
filename = f if isinstance(f, six.string_types) else f.path
if domains is None:
domains = list(self.domains.values(... | [
"def",
"_check_inclusions",
"(",
"self",
",",
"f",
",",
"domains",
"=",
"None",
")",
":",
"filename",
"=",
"f",
"if",
"isinstance",
"(",
"f",
",",
"six",
".",
"string_types",
")",
"else",
"f",
".",
"path",
"if",
"domains",
"is",
"None",
":",
"domains... | Check file or directory against regexes in config to determine if
it should be included in the index | [
"Check",
"file",
"or",
"directory",
"against",
"regexes",
"in",
"config",
"to",
"determine",
"if",
"it",
"should",
"be",
"included",
"in",
"the",
"index"
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L470-L495 |
55,549 | grabbles/grabbit | grabbit/core.py | Layout._find_entity | def _find_entity(self, entity):
''' Find an Entity instance by name. Checks both name and id fields.'''
if entity in self.entities:
return self.entities[entity]
_ent = [e for e in self.entities.values() if e.name == entity]
if len(_ent) > 1:
raise ValueError("Enti... | python | def _find_entity(self, entity):
''' Find an Entity instance by name. Checks both name and id fields.'''
if entity in self.entities:
return self.entities[entity]
_ent = [e for e in self.entities.values() if e.name == entity]
if len(_ent) > 1:
raise ValueError("Enti... | [
"def",
"_find_entity",
"(",
"self",
",",
"entity",
")",
":",
"if",
"entity",
"in",
"self",
".",
"entities",
":",
"return",
"self",
".",
"entities",
"[",
"entity",
"]",
"_ent",
"=",
"[",
"e",
"for",
"e",
"in",
"self",
".",
"entities",
".",
"values",
... | Find an Entity instance by name. Checks both name and id fields. | [
"Find",
"an",
"Entity",
"instance",
"by",
"name",
".",
"Checks",
"both",
"name",
"and",
"id",
"fields",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L557-L570 |
55,550 | grabbles/grabbit | grabbit/core.py | Layout.save_index | def save_index(self, filename):
''' Save the current Layout's index to a .json file.
Args:
filename (str): Filename to write to.
Note: At the moment, this won't serialize directory-specific config
files. This means reconstructed indexes will only work properly in
ca... | python | def save_index(self, filename):
''' Save the current Layout's index to a .json file.
Args:
filename (str): Filename to write to.
Note: At the moment, this won't serialize directory-specific config
files. This means reconstructed indexes will only work properly in
ca... | [
"def",
"save_index",
"(",
"self",
",",
"filename",
")",
":",
"data",
"=",
"{",
"}",
"for",
"f",
"in",
"self",
".",
"files",
".",
"values",
"(",
")",
":",
"entities",
"=",
"{",
"v",
".",
"entity",
".",
"id",
":",
"v",
".",
"value",
"for",
"k",
... | Save the current Layout's index to a .json file.
Args:
filename (str): Filename to write to.
Note: At the moment, this won't serialize directory-specific config
files. This means reconstructed indexes will only work properly in
cases where there aren't multiple layout specs... | [
"Save",
"the",
"current",
"Layout",
"s",
"index",
"to",
"a",
".",
"json",
"file",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L613-L628 |
55,551 | grabbles/grabbit | grabbit/core.py | Layout.load_index | def load_index(self, filename, reindex=False):
''' Load the Layout's index from a plaintext file.
Args:
filename (str): Path to the plaintext index file.
reindex (bool): If True, discards entity values provided in the
loaded index and instead re-indexes every fil... | python | def load_index(self, filename, reindex=False):
''' Load the Layout's index from a plaintext file.
Args:
filename (str): Path to the plaintext index file.
reindex (bool): If True, discards entity values provided in the
loaded index and instead re-indexes every fil... | [
"def",
"load_index",
"(",
"self",
",",
"filename",
",",
"reindex",
"=",
"False",
")",
":",
"self",
".",
"_reset_index",
"(",
")",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"fobj",
":",
"data",
"=",
"json",
".",
"load",
"(",
"fobj",
")... | Load the Layout's index from a plaintext file.
Args:
filename (str): Path to the plaintext index file.
reindex (bool): If True, discards entity values provided in the
loaded index and instead re-indexes every file in the loaded
index against the entities ... | [
"Load",
"the",
"Layout",
"s",
"index",
"from",
"a",
"plaintext",
"file",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L630-L664 |
55,552 | grabbles/grabbit | grabbit/core.py | Layout.add_entity | def add_entity(self, domain, **kwargs):
''' Add a new Entity to tracking. '''
# Set the entity's mapping func if one was specified
map_func = kwargs.get('map_func', None)
if map_func is not None and not callable(kwargs['map_func']):
if self.entity_mapper is None:
... | python | def add_entity(self, domain, **kwargs):
''' Add a new Entity to tracking. '''
# Set the entity's mapping func if one was specified
map_func = kwargs.get('map_func', None)
if map_func is not None and not callable(kwargs['map_func']):
if self.entity_mapper is None:
... | [
"def",
"add_entity",
"(",
"self",
",",
"domain",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the entity's mapping func if one was specified",
"map_func",
"=",
"kwargs",
".",
"get",
"(",
"'map_func'",
",",
"None",
")",
"if",
"map_func",
"is",
"not",
"None",
"and"... | Add a new Entity to tracking. | [
"Add",
"a",
"new",
"Entity",
"to",
"tracking",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L666-L697 |
55,553 | grabbles/grabbit | grabbit/core.py | Layout.count | def count(self, entity, files=False):
"""
Return the count of unique values or files for the named entity.
Args:
entity (str): The name of the entity.
files (bool): If True, counts the number of filenames that contain
at least one value of the entity, rat... | python | def count(self, entity, files=False):
"""
Return the count of unique values or files for the named entity.
Args:
entity (str): The name of the entity.
files (bool): If True, counts the number of filenames that contain
at least one value of the entity, rat... | [
"def",
"count",
"(",
"self",
",",
"entity",
",",
"files",
"=",
"False",
")",
":",
"return",
"self",
".",
"_find_entity",
"(",
"entity",
")",
".",
"count",
"(",
"files",
")"
] | Return the count of unique values or files for the named entity.
Args:
entity (str): The name of the entity.
files (bool): If True, counts the number of filenames that contain
at least one value of the entity, rather than the number of
unique values of th... | [
"Return",
"the",
"count",
"of",
"unique",
"values",
"or",
"files",
"for",
"the",
"named",
"entity",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L802-L812 |
55,554 | grabbles/grabbit | grabbit/core.py | Layout.as_data_frame | def as_data_frame(self, **kwargs):
"""
Return information for all Files tracked in the Layout as a pandas
DataFrame.
Args:
kwargs: Optional keyword arguments passed on to get(). This allows
one to easily select only a subset of files for export.
Retur... | python | def as_data_frame(self, **kwargs):
"""
Return information for all Files tracked in the Layout as a pandas
DataFrame.
Args:
kwargs: Optional keyword arguments passed on to get(). This allows
one to easily select only a subset of files for export.
Retur... | [
"def",
"as_data_frame",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"import",
"pandas",
"as",
"pd",
"except",
"ImportError",
":",
"raise",
"ImportError",
"(",
"\"What are you doing trying to export a Layout \"",
"\"as a pandas DataFrame when you don't ha... | Return information for all Files tracked in the Layout as a pandas
DataFrame.
Args:
kwargs: Optional keyword arguments passed on to get(). This allows
one to easily select only a subset of files for export.
Returns:
A pandas DataFrame, where each row is a... | [
"Return",
"information",
"for",
"all",
"Files",
"tracked",
"in",
"the",
"Layout",
"as",
"a",
"pandas",
"DataFrame",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/core.py#L814-L839 |
55,555 | flo-compbio/genometools | genometools/misc/log.py | configure_logger | def configure_logger(name, log_stream=sys.stdout, log_file=None,
log_level=logging.INFO, keep_old_handlers=False,
propagate=False):
"""Configures and returns a logger.
This function serves to simplify the configuration of a logger that
writes to a file and/or to a ... | python | def configure_logger(name, log_stream=sys.stdout, log_file=None,
log_level=logging.INFO, keep_old_handlers=False,
propagate=False):
"""Configures and returns a logger.
This function serves to simplify the configuration of a logger that
writes to a file and/or to a ... | [
"def",
"configure_logger",
"(",
"name",
",",
"log_stream",
"=",
"sys",
".",
"stdout",
",",
"log_file",
"=",
"None",
",",
"log_level",
"=",
"logging",
".",
"INFO",
",",
"keep_old_handlers",
"=",
"False",
",",
"propagate",
"=",
"False",
")",
":",
"# create a... | Configures and returns a logger.
This function serves to simplify the configuration of a logger that
writes to a file and/or to a stream (e.g., stdout).
Parameters
----------
name: str
The name of the logger. Typically set to ``__name__``.
log_stream: a stream object, optional
... | [
"Configures",
"and",
"returns",
"a",
"logger",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/log.py#L27-L106 |
55,556 | flo-compbio/genometools | genometools/misc/log.py | get_logger | def get_logger(name='', log_stream=None, log_file=None,
quiet=False, verbose=False):
"""Convenience function for getting a logger."""
# configure root logger
log_level = logging.INFO
if quiet:
log_level = logging.WARNING
elif verbose:
log_level = logging.DEBUG
if... | python | def get_logger(name='', log_stream=None, log_file=None,
quiet=False, verbose=False):
"""Convenience function for getting a logger."""
# configure root logger
log_level = logging.INFO
if quiet:
log_level = logging.WARNING
elif verbose:
log_level = logging.DEBUG
if... | [
"def",
"get_logger",
"(",
"name",
"=",
"''",
",",
"log_stream",
"=",
"None",
",",
"log_file",
"=",
"None",
",",
"quiet",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"# configure root logger",
"log_level",
"=",
"logging",
".",
"INFO",
"if",
"qui... | Convenience function for getting a logger. | [
"Convenience",
"function",
"for",
"getting",
"a",
"logger",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/misc/log.py#L109-L126 |
55,557 | srevenant/timeinterval | timeinterval/__init__.py | start | def start(milliseconds, func, *args, **kwargs):
"""
Call function every interval. Starts the timer at call time.
Although this could also be a decorator, that would not initiate the time at
the same time, so would require additional work.
Arguments following function will be sent to function. Not... | python | def start(milliseconds, func, *args, **kwargs):
"""
Call function every interval. Starts the timer at call time.
Although this could also be a decorator, that would not initiate the time at
the same time, so would require additional work.
Arguments following function will be sent to function. Not... | [
"def",
"start",
"(",
"milliseconds",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"stopper",
"=",
"threading",
".",
"Event",
"(",
")",
"def",
"interval",
"(",
"seconds",
",",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
... | Call function every interval. Starts the timer at call time.
Although this could also be a decorator, that would not initiate the time at
the same time, so would require additional work.
Arguments following function will be sent to function. Note that these args
are part of the defining state, and un... | [
"Call",
"function",
"every",
"interval",
".",
"Starts",
"the",
"timer",
"at",
"call",
"time",
".",
"Although",
"this",
"could",
"also",
"be",
"a",
"decorator",
"that",
"would",
"not",
"initiate",
"the",
"time",
"at",
"the",
"same",
"time",
"so",
"would",
... | 61ba4cb23530dc131ff9e2209fb84019663ee7f9 | https://github.com/srevenant/timeinterval/blob/61ba4cb23530dc131ff9e2209fb84019663ee7f9/timeinterval/__init__.py#L40-L88 |
55,558 | vovanec/httputil | examples/http_client.py | example_async_client | def example_async_client(api_client):
"""Example async client.
"""
try:
pprint((yield from api_client.echo()))
except errors.RequestError as exc:
log.exception('Exception occurred: %s', exc)
yield gen.Task(lambda *args, **kwargs: ioloop.IOLoop.current().stop()) | python | def example_async_client(api_client):
"""Example async client.
"""
try:
pprint((yield from api_client.echo()))
except errors.RequestError as exc:
log.exception('Exception occurred: %s', exc)
yield gen.Task(lambda *args, **kwargs: ioloop.IOLoop.current().stop()) | [
"def",
"example_async_client",
"(",
"api_client",
")",
":",
"try",
":",
"pprint",
"(",
"(",
"yield",
"from",
"api_client",
".",
"echo",
"(",
")",
")",
")",
"except",
"errors",
".",
"RequestError",
"as",
"exc",
":",
"log",
".",
"exception",
"(",
"'Excepti... | Example async client. | [
"Example",
"async",
"client",
"."
] | 0b8dab5a23166cceb7dbc2a1dbc802ab5b311347 | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/examples/http_client.py#L65-L74 |
55,559 | vovanec/httputil | examples/http_client.py | example_sync_client | def example_sync_client(api_client):
"""Example sync client use with.
"""
try:
pprint(api_client.echo())
except errors.RequestError as exc:
log.exception('Exception occurred: %s', exc) | python | def example_sync_client(api_client):
"""Example sync client use with.
"""
try:
pprint(api_client.echo())
except errors.RequestError as exc:
log.exception('Exception occurred: %s', exc) | [
"def",
"example_sync_client",
"(",
"api_client",
")",
":",
"try",
":",
"pprint",
"(",
"api_client",
".",
"echo",
"(",
")",
")",
"except",
"errors",
".",
"RequestError",
"as",
"exc",
":",
"log",
".",
"exception",
"(",
"'Exception occurred: %s'",
",",
"exc",
... | Example sync client use with. | [
"Example",
"sync",
"client",
"use",
"with",
"."
] | 0b8dab5a23166cceb7dbc2a1dbc802ab5b311347 | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/examples/http_client.py#L77-L84 |
55,560 | vovanec/httputil | examples/http_client.py | main | def main():
"""Run the examples.
"""
logging.basicConfig(level=logging.INFO)
example_sync_client(SyncAPIClient())
example_async_client(AsyncAPIClient())
io_loop = ioloop.IOLoop.current()
io_loop.start() | python | def main():
"""Run the examples.
"""
logging.basicConfig(level=logging.INFO)
example_sync_client(SyncAPIClient())
example_async_client(AsyncAPIClient())
io_loop = ioloop.IOLoop.current()
io_loop.start() | [
"def",
"main",
"(",
")",
":",
"logging",
".",
"basicConfig",
"(",
"level",
"=",
"logging",
".",
"INFO",
")",
"example_sync_client",
"(",
"SyncAPIClient",
"(",
")",
")",
"example_async_client",
"(",
"AsyncAPIClient",
"(",
")",
")",
"io_loop",
"=",
"ioloop",
... | Run the examples. | [
"Run",
"the",
"examples",
"."
] | 0b8dab5a23166cceb7dbc2a1dbc802ab5b311347 | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/examples/http_client.py#L87-L97 |
55,561 | flo-compbio/genometools | genometools/ensembl/cli/extract_protein_coding_genes.py | main | def main(args=None):
"""Extract protein-coding genes and store in tab-delimited text file.
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... | python | def main(args=None):
"""Extract protein-coding genes and store in tab-delimited text file.
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... | [
"def",
"main",
"(",
"args",
"=",
"None",
")",
":",
"vinfo",
"=",
"sys",
".",
"version_info",
"if",
"not",
"vinfo",
">=",
"(",
"2",
",",
"7",
")",
":",
"raise",
"SystemError",
"(",
"'Python interpreter version >= 2.7 required, '",
"'found %d.%d instead.'",
"%",... | Extract protein-coding genes and store in tab-delimited text file.
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
-------
... | [
"Extract",
"protein",
"-",
"coding",
"genes",
"and",
"store",
"in",
"tab",
"-",
"delimited",
"text",
"file",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/cli/extract_protein_coding_genes.py#L75-L140 |
55,562 | shmir/PyIxExplorer | ixexplorer/ixe_statistics_view.py | IxePortsStats.read_stats | def read_stats(self, *stats):
""" Read port statistics from chassis.
:param stats: list of requested statistics to read, if empty - read all statistics.
"""
self.statistics = OrderedDict()
for port in self.ports:
port_stats = IxeStatTotal(port).get_attributes(FLAG_R... | python | def read_stats(self, *stats):
""" Read port statistics from chassis.
:param stats: list of requested statistics to read, if empty - read all statistics.
"""
self.statistics = OrderedDict()
for port in self.ports:
port_stats = IxeStatTotal(port).get_attributes(FLAG_R... | [
"def",
"read_stats",
"(",
"self",
",",
"*",
"stats",
")",
":",
"self",
".",
"statistics",
"=",
"OrderedDict",
"(",
")",
"for",
"port",
"in",
"self",
".",
"ports",
":",
"port_stats",
"=",
"IxeStatTotal",
"(",
"port",
")",
".",
"get_attributes",
"(",
"FL... | Read port statistics from chassis.
:param stats: list of requested statistics to read, if empty - read all statistics. | [
"Read",
"port",
"statistics",
"from",
"chassis",
"."
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_statistics_view.py#L195-L207 |
55,563 | shmir/PyIxExplorer | ixexplorer/ixe_statistics_view.py | IxeStreamsStats.read_stats | def read_stats(self, *stats):
""" Read stream statistics from chassis.
:param stats: list of requested statistics to read, if empty - read all statistics.
"""
from ixexplorer.ixe_stream import IxePacketGroupStream
sleep_time = 0.1 # in cases we only want few counters but very f... | python | def read_stats(self, *stats):
""" Read stream statistics from chassis.
:param stats: list of requested statistics to read, if empty - read all statistics.
"""
from ixexplorer.ixe_stream import IxePacketGroupStream
sleep_time = 0.1 # in cases we only want few counters but very f... | [
"def",
"read_stats",
"(",
"self",
",",
"*",
"stats",
")",
":",
"from",
"ixexplorer",
".",
"ixe_stream",
"import",
"IxePacketGroupStream",
"sleep_time",
"=",
"0.1",
"# in cases we only want few counters but very fast we need a smaller sleep time",
"if",
"not",
"stats",
":"... | Read stream statistics from chassis.
:param stats: list of requested statistics to read, if empty - read all statistics. | [
"Read",
"stream",
"statistics",
"from",
"chassis",
"."
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_statistics_view.py#L242-L279 |
55,564 | nkavaldj/myhdl_lib | myhdl_lib/arbiter.py | arbiter | def arbiter(rst, clk, req_vec, gnt_vec=None, gnt_idx=None, gnt_vld=None, gnt_rdy=None, ARBITER_TYPE="priority"):
''' Wrapper that provides common interface to all arbiters '''
if ARBITER_TYPE == "priority":
_arb = arbiter_priority(req_vec, gnt_vec, gnt_idx, gnt_vld)
elif (ARBITER_TYPE == "roundrobin... | python | def arbiter(rst, clk, req_vec, gnt_vec=None, gnt_idx=None, gnt_vld=None, gnt_rdy=None, ARBITER_TYPE="priority"):
''' Wrapper that provides common interface to all arbiters '''
if ARBITER_TYPE == "priority":
_arb = arbiter_priority(req_vec, gnt_vec, gnt_idx, gnt_vld)
elif (ARBITER_TYPE == "roundrobin... | [
"def",
"arbiter",
"(",
"rst",
",",
"clk",
",",
"req_vec",
",",
"gnt_vec",
"=",
"None",
",",
"gnt_idx",
"=",
"None",
",",
"gnt_vld",
"=",
"None",
",",
"gnt_rdy",
"=",
"None",
",",
"ARBITER_TYPE",
"=",
"\"priority\"",
")",
":",
"if",
"ARBITER_TYPE",
"=="... | Wrapper that provides common interface to all arbiters | [
"Wrapper",
"that",
"provides",
"common",
"interface",
"to",
"all",
"arbiters"
] | 9902afd2031e7847373f692821b2135fd0810aa8 | https://github.com/nkavaldj/myhdl_lib/blob/9902afd2031e7847373f692821b2135fd0810aa8/myhdl_lib/arbiter.py#L5-L14 |
55,565 | biocommons/bioutils | src/bioutils/digests.py | seq_seqhash | def seq_seqhash(seq, normalize=True):
"""returns 24-byte Truncated Digest sequence `seq`
>>> seq_seqhash("")
'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc'
>>> seq_seqhash("ACGT")
'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'
>>> seq_seqhash("acgt")
'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'
>>> seq_seqhash("acgt"... | python | def seq_seqhash(seq, normalize=True):
"""returns 24-byte Truncated Digest sequence `seq`
>>> seq_seqhash("")
'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc'
>>> seq_seqhash("ACGT")
'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'
>>> seq_seqhash("acgt")
'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'
>>> seq_seqhash("acgt"... | [
"def",
"seq_seqhash",
"(",
"seq",
",",
"normalize",
"=",
"True",
")",
":",
"seq",
"=",
"normalize_sequence",
"(",
"seq",
")",
"if",
"normalize",
"else",
"seq",
"return",
"str",
"(",
"vmc_digest",
"(",
"seq",
",",
"digest_size",
"=",
"24",
")",
")"
] | returns 24-byte Truncated Digest sequence `seq`
>>> seq_seqhash("")
'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc'
>>> seq_seqhash("ACGT")
'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'
>>> seq_seqhash("acgt")
'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'
>>> seq_seqhash("acgt", normalize=False)
'eFwawHHdibaZBDcs9kW3g... | [
"returns",
"24",
"-",
"byte",
"Truncated",
"Digest",
"sequence",
"seq"
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L10-L28 |
55,566 | biocommons/bioutils | src/bioutils/digests.py | seq_seguid | def seq_seguid(seq, normalize=True):
"""returns seguid for sequence `seq`
This seguid is compatible with BioPython's seguid.
>>> seq_seguid('')
'2jmj7l5rSw0yVb/vlWAYkK/YBwk'
>>> seq_seguid('ACGT')
'IQiZThf2zKn/I1KtqStlEdsHYDQ'
>>> seq_seguid('acgt')
'IQiZThf2zKn/I1KtqStlEdsHYDQ'
... | python | def seq_seguid(seq, normalize=True):
"""returns seguid for sequence `seq`
This seguid is compatible with BioPython's seguid.
>>> seq_seguid('')
'2jmj7l5rSw0yVb/vlWAYkK/YBwk'
>>> seq_seguid('ACGT')
'IQiZThf2zKn/I1KtqStlEdsHYDQ'
>>> seq_seguid('acgt')
'IQiZThf2zKn/I1KtqStlEdsHYDQ'
... | [
"def",
"seq_seguid",
"(",
"seq",
",",
"normalize",
"=",
"True",
")",
":",
"seq",
"=",
"normalize_sequence",
"(",
"seq",
")",
"if",
"normalize",
"else",
"seq",
"bseq",
"=",
"seq",
".",
"encode",
"(",
"\"ascii\"",
")",
"return",
"base64",
".",
"b64encode",... | returns seguid for sequence `seq`
This seguid is compatible with BioPython's seguid.
>>> seq_seguid('')
'2jmj7l5rSw0yVb/vlWAYkK/YBwk'
>>> seq_seguid('ACGT')
'IQiZThf2zKn/I1KtqStlEdsHYDQ'
>>> seq_seguid('acgt')
'IQiZThf2zKn/I1KtqStlEdsHYDQ'
>>> seq_seguid('acgt', normalize=False)
... | [
"returns",
"seguid",
"for",
"sequence",
"seq"
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L31-L52 |
55,567 | biocommons/bioutils | src/bioutils/digests.py | seq_md5 | def seq_md5(seq, normalize=True):
"""returns unicode md5 as hex digest for sequence `seq`.
>>> seq_md5('')
'd41d8cd98f00b204e9800998ecf8427e'
>>> seq_md5('ACGT')
'f1f8f4bf413b16ad135722aa4591043e'
>>> seq_md5('ACGT*')
'f1f8f4bf413b16ad135722aa4591043e'
>>> seq_md5(' A C G T ')
'f... | python | def seq_md5(seq, normalize=True):
"""returns unicode md5 as hex digest for sequence `seq`.
>>> seq_md5('')
'd41d8cd98f00b204e9800998ecf8427e'
>>> seq_md5('ACGT')
'f1f8f4bf413b16ad135722aa4591043e'
>>> seq_md5('ACGT*')
'f1f8f4bf413b16ad135722aa4591043e'
>>> seq_md5(' A C G T ')
'f... | [
"def",
"seq_md5",
"(",
"seq",
",",
"normalize",
"=",
"True",
")",
":",
"seq",
"=",
"normalize_sequence",
"(",
"seq",
")",
"if",
"normalize",
"else",
"seq",
"bseq",
"=",
"seq",
".",
"encode",
"(",
"\"ascii\"",
")",
"return",
"hashlib",
".",
"md5",
"(",
... | returns unicode md5 as hex digest for sequence `seq`.
>>> seq_md5('')
'd41d8cd98f00b204e9800998ecf8427e'
>>> seq_md5('ACGT')
'f1f8f4bf413b16ad135722aa4591043e'
>>> seq_md5('ACGT*')
'f1f8f4bf413b16ad135722aa4591043e'
>>> seq_md5(' A C G T ')
'f1f8f4bf413b16ad135722aa4591043e'
>>>... | [
"returns",
"unicode",
"md5",
"as",
"hex",
"digest",
"for",
"sequence",
"seq",
"."
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L55-L79 |
55,568 | biocommons/bioutils | src/bioutils/digests.py | seq_sha1 | def seq_sha1(seq, normalize=True):
"""returns unicode sha1 hexdigest for sequence `seq`.
>>> seq_sha1('')
'da39a3ee5e6b4b0d3255bfef95601890afd80709'
>>> seq_sha1('ACGT')
'2108994e17f6cca9ff2352ada92b6511db076034'
>>> seq_sha1('acgt')
'2108994e17f6cca9ff2352ada92b6511db076034'
>>> seq... | python | def seq_sha1(seq, normalize=True):
"""returns unicode sha1 hexdigest for sequence `seq`.
>>> seq_sha1('')
'da39a3ee5e6b4b0d3255bfef95601890afd80709'
>>> seq_sha1('ACGT')
'2108994e17f6cca9ff2352ada92b6511db076034'
>>> seq_sha1('acgt')
'2108994e17f6cca9ff2352ada92b6511db076034'
>>> seq... | [
"def",
"seq_sha1",
"(",
"seq",
",",
"normalize",
"=",
"True",
")",
":",
"seq",
"=",
"normalize_sequence",
"(",
"seq",
")",
"if",
"normalize",
"else",
"seq",
"bseq",
"=",
"seq",
".",
"encode",
"(",
"\"ascii\"",
")",
"return",
"hashlib",
".",
"sha1",
"("... | returns unicode sha1 hexdigest for sequence `seq`.
>>> seq_sha1('')
'da39a3ee5e6b4b0d3255bfef95601890afd80709'
>>> seq_sha1('ACGT')
'2108994e17f6cca9ff2352ada92b6511db076034'
>>> seq_sha1('acgt')
'2108994e17f6cca9ff2352ada92b6511db076034'
>>> seq_sha1('acgt', normalize=False)
'948234... | [
"returns",
"unicode",
"sha1",
"hexdigest",
"for",
"sequence",
"seq",
"."
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L82-L101 |
55,569 | biocommons/bioutils | src/bioutils/digests.py | seq_sha512 | def seq_sha512(seq, normalize=True):
"""returns unicode sequence sha512 hexdigest for sequence `seq`.
>>> seq_sha512('')
'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'
>>> seq_sha512('ACGT')
'68a178f7c740c5c240aa67... | python | def seq_sha512(seq, normalize=True):
"""returns unicode sequence sha512 hexdigest for sequence `seq`.
>>> seq_sha512('')
'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'
>>> seq_sha512('ACGT')
'68a178f7c740c5c240aa67... | [
"def",
"seq_sha512",
"(",
"seq",
",",
"normalize",
"=",
"True",
")",
":",
"seq",
"=",
"normalize_sequence",
"(",
"seq",
")",
"if",
"normalize",
"else",
"seq",
"bseq",
"=",
"seq",
".",
"encode",
"(",
"\"ascii\"",
")",
"return",
"hashlib",
".",
"sha512",
... | returns unicode sequence sha512 hexdigest for sequence `seq`.
>>> seq_sha512('')
'cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e'
>>> seq_sha512('ACGT')
'68a178f7c740c5c240aa67ba41843b119d3bf9f8b0f0ac36cf701d26672964efbd... | [
"returns",
"unicode",
"sequence",
"sha512",
"hexdigest",
"for",
"sequence",
"seq",
"."
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/digests.py#L104-L123 |
55,570 | flo-compbio/genometools | genometools/gcloud/tasks/star.py | map_single_end | def map_single_end(credentials, instance_config, instance_name,
script_dir, index_dir, fastq_file, output_dir,
num_threads=None, seed_start_lmax=None,
mismatch_nmax=None, multimap_nmax=None,
splice_min_overhang=None,
out_mult... | python | def map_single_end(credentials, instance_config, instance_name,
script_dir, index_dir, fastq_file, output_dir,
num_threads=None, seed_start_lmax=None,
mismatch_nmax=None, multimap_nmax=None,
splice_min_overhang=None,
out_mult... | [
"def",
"map_single_end",
"(",
"credentials",
",",
"instance_config",
",",
"instance_name",
",",
"script_dir",
",",
"index_dir",
",",
"fastq_file",
",",
"output_dir",
",",
"num_threads",
"=",
"None",
",",
"seed_start_lmax",
"=",
"None",
",",
"mismatch_nmax",
"=",
... | Maps single-end reads using STAR.
Reads are expected in FASTQ format. By default, they are also expected to
be compressed with gzip.
- recommended machine type: "n1-standard-16" (60 GB of RAM, 16 vCPUs).
- recommended disk size: depends on size of FASTQ files, at least 128 GB.
TODO: docstring | [
"Maps",
"single",
"-",
"end",
"reads",
"using",
"STAR",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/tasks/star.py#L39-L93 |
55,571 | flo-compbio/genometools | genometools/gcloud/tasks/star.py | generate_index | def generate_index(credentials, instance_config, instance_name,
script_dir, genome_file, output_dir, annotation_file=None,
splice_overhang=100,
num_threads=8, chromosome_bin_bits=18,
genome_memory_limit=31000000000,
self_dest... | python | def generate_index(credentials, instance_config, instance_name,
script_dir, genome_file, output_dir, annotation_file=None,
splice_overhang=100,
num_threads=8, chromosome_bin_bits=18,
genome_memory_limit=31000000000,
self_dest... | [
"def",
"generate_index",
"(",
"credentials",
",",
"instance_config",
",",
"instance_name",
",",
"script_dir",
",",
"genome_file",
",",
"output_dir",
",",
"annotation_file",
"=",
"None",
",",
"splice_overhang",
"=",
"100",
",",
"num_threads",
"=",
"8",
",",
"chro... | Generates a STAR index.
Recommended machine type: "n1-highmem-8" (52 GB of RAM, 8 vCPUs)
TODO: docstring | [
"Generates",
"a",
"STAR",
"index",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/gcloud/tasks/star.py#L162-L191 |
55,572 | flo-compbio/genometools | genometools/ensembl/util.py | get_file_checksums | def get_file_checksums(url, ftp=None):
"""Download and parse an Ensembl CHECKSUMS file and obtain checksums.
Parameters
----------
url : str
The URL of the CHECKSUM file.
ftp : `ftplib.FTP` or `None`, optional
An FTP connection.
Returns
-------
`collections.OrderedD... | python | def get_file_checksums(url, ftp=None):
"""Download and parse an Ensembl CHECKSUMS file and obtain checksums.
Parameters
----------
url : str
The URL of the CHECKSUM file.
ftp : `ftplib.FTP` or `None`, optional
An FTP connection.
Returns
-------
`collections.OrderedD... | [
"def",
"get_file_checksums",
"(",
"url",
",",
"ftp",
"=",
"None",
")",
":",
"assert",
"isinstance",
"(",
"url",
",",
"(",
"str",
",",
"_oldstr",
")",
")",
"if",
"ftp",
"is",
"not",
"None",
":",
"assert",
"isinstance",
"(",
"ftp",
",",
"ftplib",
".",
... | Download and parse an Ensembl CHECKSUMS file and obtain checksums.
Parameters
----------
url : str
The URL of the CHECKSUM file.
ftp : `ftplib.FTP` or `None`, optional
An FTP connection.
Returns
-------
`collections.OrderedDict`
An ordered dictionary containing ... | [
"Download",
"and",
"parse",
"an",
"Ensembl",
"CHECKSUMS",
"file",
"and",
"obtain",
"checksums",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ensembl/util.py#L77-L127 |
55,573 | grabbles/grabbit | grabbit/utils.py | listify | def listify(obj, ignore=(list, tuple, type(None))):
''' Wraps all non-list or tuple objects in a list; provides a simple way
to accept flexible arguments. '''
return obj if isinstance(obj, ignore) else [obj] | python | def listify(obj, ignore=(list, tuple, type(None))):
''' Wraps all non-list or tuple objects in a list; provides a simple way
to accept flexible arguments. '''
return obj if isinstance(obj, ignore) else [obj] | [
"def",
"listify",
"(",
"obj",
",",
"ignore",
"=",
"(",
"list",
",",
"tuple",
",",
"type",
"(",
"None",
")",
")",
")",
":",
"return",
"obj",
"if",
"isinstance",
"(",
"obj",
",",
"ignore",
")",
"else",
"[",
"obj",
"]"
] | Wraps all non-list or tuple objects in a list; provides a simple way
to accept flexible arguments. | [
"Wraps",
"all",
"non",
"-",
"list",
"or",
"tuple",
"objects",
"in",
"a",
"list",
";",
"provides",
"a",
"simple",
"way",
"to",
"accept",
"flexible",
"arguments",
"."
] | 83ff93df36019eaaee9d4e31f816a518e46cae07 | https://github.com/grabbles/grabbit/blob/83ff93df36019eaaee9d4e31f816a518e46cae07/grabbit/utils.py#L34-L37 |
55,574 | flo-compbio/genometools | genometools/ncbi/taxonomy.py | _get_divisions | def _get_divisions(taxdump_file):
"""Returns a dictionary mapping division names to division IDs."""
with tarfile.open(taxdump_file) as tf:
with tf.extractfile('division.dmp') as fh:
df = pd.read_csv(fh, header=None, sep='|', encoding='ascii')
# only keep division ids and names... | python | def _get_divisions(taxdump_file):
"""Returns a dictionary mapping division names to division IDs."""
with tarfile.open(taxdump_file) as tf:
with tf.extractfile('division.dmp') as fh:
df = pd.read_csv(fh, header=None, sep='|', encoding='ascii')
# only keep division ids and names... | [
"def",
"_get_divisions",
"(",
"taxdump_file",
")",
":",
"with",
"tarfile",
".",
"open",
"(",
"taxdump_file",
")",
"as",
"tf",
":",
"with",
"tf",
".",
"extractfile",
"(",
"'division.dmp'",
")",
"as",
"fh",
":",
"df",
"=",
"pd",
".",
"read_csv",
"(",
"fh... | Returns a dictionary mapping division names to division IDs. | [
"Returns",
"a",
"dictionary",
"mapping",
"division",
"names",
"to",
"division",
"IDs",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/taxonomy.py#L25-L43 |
55,575 | flo-compbio/genometools | genometools/ncbi/taxonomy.py | get_species | def get_species(taxdump_file, select_divisions=None,
exclude_divisions=None, nrows=None):
"""Get a dataframe with species information."""
if select_divisions and exclude_divisions:
raise ValueError('Cannot specify "select_divisions" and '
'"exclude_divisions... | python | def get_species(taxdump_file, select_divisions=None,
exclude_divisions=None, nrows=None):
"""Get a dataframe with species information."""
if select_divisions and exclude_divisions:
raise ValueError('Cannot specify "select_divisions" and '
'"exclude_divisions... | [
"def",
"get_species",
"(",
"taxdump_file",
",",
"select_divisions",
"=",
"None",
",",
"exclude_divisions",
"=",
"None",
",",
"nrows",
"=",
"None",
")",
":",
"if",
"select_divisions",
"and",
"exclude_divisions",
":",
"raise",
"ValueError",
"(",
"'Cannot specify \"s... | Get a dataframe with species information. | [
"Get",
"a",
"dataframe",
"with",
"species",
"information",
"."
] | dd962bb26d60a0f14ca14d8c9a4dd75768962c7d | https://github.com/flo-compbio/genometools/blob/dd962bb26d60a0f14ca14d8c9a4dd75768962c7d/genometools/ncbi/taxonomy.py#L94-L143 |
55,576 | shmir/PyIxExplorer | ixexplorer/ixe_object.py | IxeObject.set_attributes | def set_attributes(self, **attributes):
""" Set group of attributes without calling set between attributes regardless of global auto_set.
Set will be called only after all attributes are set based on global auto_set.
:param attributes: dictionary of <attribute, value> to set.
"""
... | python | def set_attributes(self, **attributes):
""" Set group of attributes without calling set between attributes regardless of global auto_set.
Set will be called only after all attributes are set based on global auto_set.
:param attributes: dictionary of <attribute, value> to set.
"""
... | [
"def",
"set_attributes",
"(",
"self",
",",
"*",
"*",
"attributes",
")",
":",
"auto_set",
"=",
"IxeObject",
".",
"get_auto_set",
"(",
")",
"IxeObject",
".",
"set_auto_set",
"(",
"False",
")",
"for",
"name",
",",
"value",
"in",
"attributes",
".",
"items",
... | Set group of attributes without calling set between attributes regardless of global auto_set.
Set will be called only after all attributes are set based on global auto_set.
:param attributes: dictionary of <attribute, value> to set. | [
"Set",
"group",
"of",
"attributes",
"without",
"calling",
"set",
"between",
"attributes",
"regardless",
"of",
"global",
"auto_set",
"."
] | d6946b9ce0e8961507cc912062e10c365d4beee2 | https://github.com/shmir/PyIxExplorer/blob/d6946b9ce0e8961507cc912062e10c365d4beee2/ixexplorer/ixe_object.py#L64-L78 |
55,577 | jbochi/cep | cep/__init__.py | Correios.consulta_faixa | def consulta_faixa(self, localidade, uf):
"""Consulta site e retorna faixa para localidade"""
url = 'consultaFaixaCepAction.do'
data = {
'UF': uf,
'Localidade': localidade.encode('cp1252'),
'cfm': '1',
'Metodo': 'listaFaixaCEP',
'TipoCo... | python | def consulta_faixa(self, localidade, uf):
"""Consulta site e retorna faixa para localidade"""
url = 'consultaFaixaCepAction.do'
data = {
'UF': uf,
'Localidade': localidade.encode('cp1252'),
'cfm': '1',
'Metodo': 'listaFaixaCEP',
'TipoCo... | [
"def",
"consulta_faixa",
"(",
"self",
",",
"localidade",
",",
"uf",
")",
":",
"url",
"=",
"'consultaFaixaCepAction.do'",
"data",
"=",
"{",
"'UF'",
":",
"uf",
",",
"'Localidade'",
":",
"localidade",
".",
"encode",
"(",
"'cp1252'",
")",
",",
"'cfm'",
":",
... | Consulta site e retorna faixa para localidade | [
"Consulta",
"site",
"e",
"retorna",
"faixa",
"para",
"localidade"
] | 8c9c334b63fe1685706065a72c69a66ddaa13392 | https://github.com/jbochi/cep/blob/8c9c334b63fe1685706065a72c69a66ddaa13392/cep/__init__.py#L81-L94 |
55,578 | jbochi/cep | cep/__init__.py | Correios.consulta | def consulta(self, endereco, primeiro=False,
uf=None, localidade=None, tipo=None, numero=None):
"""Consulta site e retorna lista de resultados"""
if uf is None:
url = 'consultaEnderecoAction.do'
data = {
'relaxation': endereco.encode('ISO-8859-1'... | python | def consulta(self, endereco, primeiro=False,
uf=None, localidade=None, tipo=None, numero=None):
"""Consulta site e retorna lista de resultados"""
if uf is None:
url = 'consultaEnderecoAction.do'
data = {
'relaxation': endereco.encode('ISO-8859-1'... | [
"def",
"consulta",
"(",
"self",
",",
"endereco",
",",
"primeiro",
"=",
"False",
",",
"uf",
"=",
"None",
",",
"localidade",
"=",
"None",
",",
"tipo",
"=",
"None",
",",
"numero",
"=",
"None",
")",
":",
"if",
"uf",
"is",
"None",
":",
"url",
"=",
"'c... | Consulta site e retorna lista de resultados | [
"Consulta",
"site",
"e",
"retorna",
"lista",
"de",
"resultados"
] | 8c9c334b63fe1685706065a72c69a66ddaa13392 | https://github.com/jbochi/cep/blob/8c9c334b63fe1685706065a72c69a66ddaa13392/cep/__init__.py#L96-L133 |
55,579 | vovanec/httputil | httputil/request_engines/sync.py | SyncRequestEngine._request | def _request(self, url, *,
method='GET', headers=None, data=None, result_callback=None):
"""Perform synchronous request.
:param str url: request URL.
:param str method: request method.
:param object data: JSON-encodable object.
:param object -> object result_cal... | python | def _request(self, url, *,
method='GET', headers=None, data=None, result_callback=None):
"""Perform synchronous request.
:param str url: request URL.
:param str method: request method.
:param object data: JSON-encodable object.
:param object -> object result_cal... | [
"def",
"_request",
"(",
"self",
",",
"url",
",",
"*",
",",
"method",
"=",
"'GET'",
",",
"headers",
"=",
"None",
",",
"data",
"=",
"None",
",",
"result_callback",
"=",
"None",
")",
":",
"retries_left",
"=",
"self",
".",
"_conn_retries",
"while",
"True",... | Perform synchronous request.
:param str url: request URL.
:param str method: request method.
:param object data: JSON-encodable object.
:param object -> object result_callback: result callback.
:rtype: dict
:raise: APIError | [
"Perform",
"synchronous",
"request",
"."
] | 0b8dab5a23166cceb7dbc2a1dbc802ab5b311347 | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/httputil/request_engines/sync.py#L51-L121 |
55,580 | vovanec/httputil | httputil/request_engines/sync.py | SyncRequestEngine._make_session | def _make_session():
"""Create session object.
:rtype: requests.Session
"""
sess = requests.Session()
sess.mount('http://', requests.adapters.HTTPAdapter(max_retries=False))
sess.mount('https://', requests.adapters.HTTPAdapter(max_retries=False))
return sess | python | def _make_session():
"""Create session object.
:rtype: requests.Session
"""
sess = requests.Session()
sess.mount('http://', requests.adapters.HTTPAdapter(max_retries=False))
sess.mount('https://', requests.adapters.HTTPAdapter(max_retries=False))
return sess | [
"def",
"_make_session",
"(",
")",
":",
"sess",
"=",
"requests",
".",
"Session",
"(",
")",
"sess",
".",
"mount",
"(",
"'http://'",
",",
"requests",
".",
"adapters",
".",
"HTTPAdapter",
"(",
"max_retries",
"=",
"False",
")",
")",
"sess",
".",
"mount",
"(... | Create session object.
:rtype: requests.Session | [
"Create",
"session",
"object",
"."
] | 0b8dab5a23166cceb7dbc2a1dbc802ab5b311347 | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/httputil/request_engines/sync.py#L124-L134 |
55,581 | acorg/dark-matter | dark/fasta.py | fastaSubtract | def fastaSubtract(fastaFiles):
"""
Given a list of open file descriptors, each with FASTA content,
remove the reads found in the 2nd, 3rd, etc files from the first file
in the list.
@param fastaFiles: a C{list} of FASTA filenames.
@raises IndexError: if passed an empty list.
@return: An ite... | python | def fastaSubtract(fastaFiles):
"""
Given a list of open file descriptors, each with FASTA content,
remove the reads found in the 2nd, 3rd, etc files from the first file
in the list.
@param fastaFiles: a C{list} of FASTA filenames.
@raises IndexError: if passed an empty list.
@return: An ite... | [
"def",
"fastaSubtract",
"(",
"fastaFiles",
")",
":",
"reads",
"=",
"{",
"}",
"firstFile",
"=",
"fastaFiles",
".",
"pop",
"(",
"0",
")",
"for",
"seq",
"in",
"SeqIO",
".",
"parse",
"(",
"firstFile",
",",
"'fasta'",
")",
":",
"reads",
"[",
"seq",
".",
... | Given a list of open file descriptors, each with FASTA content,
remove the reads found in the 2nd, 3rd, etc files from the first file
in the list.
@param fastaFiles: a C{list} of FASTA filenames.
@raises IndexError: if passed an empty list.
@return: An iterator producing C{Bio.SeqRecord} instances ... | [
"Given",
"a",
"list",
"of",
"open",
"file",
"descriptors",
"each",
"with",
"FASTA",
"content",
"remove",
"the",
"reads",
"found",
"in",
"the",
"2nd",
"3rd",
"etc",
"files",
"from",
"the",
"first",
"file",
"in",
"the",
"list",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L57-L81 |
55,582 | acorg/dark-matter | dark/fasta.py | SqliteIndex._addFilename | def _addFilename(self, filename):
"""
Add a new file name.
@param filename: A C{str} file name.
@raise ValueError: If a file with this name has already been added.
@return: The C{int} id of the newly added file.
"""
cur = self._connection.cursor()
try:
... | python | def _addFilename(self, filename):
"""
Add a new file name.
@param filename: A C{str} file name.
@raise ValueError: If a file with this name has already been added.
@return: The C{int} id of the newly added file.
"""
cur = self._connection.cursor()
try:
... | [
"def",
"_addFilename",
"(",
"self",
",",
"filename",
")",
":",
"cur",
"=",
"self",
".",
"_connection",
".",
"cursor",
"(",
")",
"try",
":",
"cur",
".",
"execute",
"(",
"'INSERT INTO files(name) VALUES (?)'",
",",
"(",
"filename",
",",
")",
")",
"except",
... | Add a new file name.
@param filename: A C{str} file name.
@raise ValueError: If a file with this name has already been added.
@return: The C{int} id of the newly added file. | [
"Add",
"a",
"new",
"file",
"name",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L297-L316 |
55,583 | acorg/dark-matter | dark/fasta.py | SqliteIndex.addFile | def addFile(self, filename):
"""
Add a new FASTA file of sequences.
@param filename: A C{str} file name, with the file in FASTA format.
This file must (obviously) exist at indexing time. When __getitem__
is used to access sequences, it is possible to provide a
... | python | def addFile(self, filename):
"""
Add a new FASTA file of sequences.
@param filename: A C{str} file name, with the file in FASTA format.
This file must (obviously) exist at indexing time. When __getitem__
is used to access sequences, it is possible to provide a
... | [
"def",
"addFile",
"(",
"self",
",",
"filename",
")",
":",
"endswith",
"=",
"filename",
".",
"lower",
"(",
")",
".",
"endswith",
"if",
"endswith",
"(",
"'.bgz'",
")",
"or",
"endswith",
"(",
"'.gz'",
")",
":",
"useBgzf",
"=",
"True",
"elif",
"endswith",
... | Add a new FASTA file of sequences.
@param filename: A C{str} file name, with the file in FASTA format.
This file must (obviously) exist at indexing time. When __getitem__
is used to access sequences, it is possible to provide a
C{fastaDirectory} argument to our C{__init__} t... | [
"Add",
"a",
"new",
"FASTA",
"file",
"of",
"sequences",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L318-L404 |
55,584 | acorg/dark-matter | dark/fasta.py | SqliteIndex._find | def _find(self, id_):
"""
Find the filename and offset of a sequence, given its id.
@param id_: A C{str} sequence id.
@return: A 2-tuple, containing the C{str} file name and C{int} offset
within that file of the sequence.
"""
cur = self._connection.cursor()
... | python | def _find(self, id_):
"""
Find the filename and offset of a sequence, given its id.
@param id_: A C{str} sequence id.
@return: A 2-tuple, containing the C{str} file name and C{int} offset
within that file of the sequence.
"""
cur = self._connection.cursor()
... | [
"def",
"_find",
"(",
"self",
",",
"id_",
")",
":",
"cur",
"=",
"self",
".",
"_connection",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"'SELECT fileNumber, offset FROM sequences WHERE id = ?'",
",",
"(",
"id_",
",",
")",
")",
"row",
"=",
"cur",
... | Find the filename and offset of a sequence, given its id.
@param id_: A C{str} sequence id.
@return: A 2-tuple, containing the C{str} file name and C{int} offset
within that file of the sequence. | [
"Find",
"the",
"filename",
"and",
"offset",
"of",
"a",
"sequence",
"given",
"its",
"id",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta.py#L406-L421 |
55,585 | acorg/dark-matter | dark/proteins.py | PathogenSampleFiles.writeSampleIndex | def writeSampleIndex(self, fp):
"""
Write a file of sample indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) in s... | python | def writeSampleIndex(self, fp):
"""
Write a file of sample indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) in s... | [
"def",
"writeSampleIndex",
"(",
"self",
",",
"fp",
")",
":",
"print",
"(",
"'\\n'",
".",
"join",
"(",
"'%d %s'",
"%",
"(",
"index",
",",
"name",
")",
"for",
"(",
"index",
",",
"name",
")",
"in",
"sorted",
"(",
"(",
"index",
",",
"name",
")",
"for... | Write a file of sample indices and names, sorted by index.
@param fp: A file-like object, opened for writing. | [
"Write",
"a",
"file",
"of",
"sample",
"indices",
"and",
"names",
"sorted",
"by",
"index",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L166-L175 |
55,586 | acorg/dark-matter | dark/proteins.py | PathogenSampleFiles.writePathogenIndex | def writePathogenIndex(self, fp):
"""
Write a file of pathogen indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) ... | python | def writePathogenIndex(self, fp):
"""
Write a file of pathogen indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) ... | [
"def",
"writePathogenIndex",
"(",
"self",
",",
"fp",
")",
":",
"print",
"(",
"'\\n'",
".",
"join",
"(",
"'%d %s'",
"%",
"(",
"index",
",",
"name",
")",
"for",
"(",
"index",
",",
"name",
")",
"in",
"sorted",
"(",
"(",
"index",
",",
"name",
")",
"f... | Write a file of pathogen indices and names, sorted by index.
@param fp: A file-like object, opened for writing. | [
"Write",
"a",
"file",
"of",
"pathogen",
"indices",
"and",
"names",
"sorted",
"by",
"index",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L177-L186 |
55,587 | acorg/dark-matter | dark/proteins.py | ProteinGrouper._title | def _title(self):
"""
Create a title summarizing the pathogens and samples.
@return: A C{str} title.
"""
return (
'Overall, proteins from %d pathogen%s were found in %d sample%s.' %
(len(self.pathogenNames),
'' if len(self.pathogenNames) == 1... | python | def _title(self):
"""
Create a title summarizing the pathogens and samples.
@return: A C{str} title.
"""
return (
'Overall, proteins from %d pathogen%s were found in %d sample%s.' %
(len(self.pathogenNames),
'' if len(self.pathogenNames) == 1... | [
"def",
"_title",
"(",
"self",
")",
":",
"return",
"(",
"'Overall, proteins from %d pathogen%s were found in %d sample%s.'",
"%",
"(",
"len",
"(",
"self",
".",
"pathogenNames",
")",
",",
"''",
"if",
"len",
"(",
"self",
".",
"pathogenNames",
")",
"==",
"1",
"els... | Create a title summarizing the pathogens and samples.
@return: A C{str} title. | [
"Create",
"a",
"title",
"summarizing",
"the",
"pathogens",
"and",
"samples",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L244-L255 |
55,588 | acorg/dark-matter | dark/proteins.py | ProteinGrouper.addFile | def addFile(self, filename, fp):
"""
Read and record protein information for a sample.
@param filename: A C{str} file name.
@param fp: An open file pointer to read the file's data from.
@raise ValueError: If information for a pathogen/protein/sample
combination is gi... | python | def addFile(self, filename, fp):
"""
Read and record protein information for a sample.
@param filename: A C{str} file name.
@param fp: An open file pointer to read the file's data from.
@raise ValueError: If information for a pathogen/protein/sample
combination is gi... | [
"def",
"addFile",
"(",
"self",
",",
"filename",
",",
"fp",
")",
":",
"if",
"self",
".",
"_sampleName",
":",
"sampleName",
"=",
"self",
".",
"_sampleName",
"elif",
"self",
".",
"_sampleNameRegex",
":",
"match",
"=",
"self",
".",
"_sampleNameRegex",
".",
"... | Read and record protein information for a sample.
@param filename: A C{str} file name.
@param fp: An open file pointer to read the file's data from.
@raise ValueError: If information for a pathogen/protein/sample
combination is given more than once. | [
"Read",
"and",
"record",
"protein",
"information",
"for",
"a",
"sample",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L257-L327 |
55,589 | acorg/dark-matter | dark/proteins.py | ProteinGrouper.toStr | def toStr(self):
"""
Produce a string representation of the pathogen summary.
@return: A C{str} suitable for printing.
"""
# Note that the string representation contains much less
# information than the HTML summary. E.g., it does not contain the
# unique (de-dup... | python | def toStr(self):
"""
Produce a string representation of the pathogen summary.
@return: A C{str} suitable for printing.
"""
# Note that the string representation contains much less
# information than the HTML summary. E.g., it does not contain the
# unique (de-dup... | [
"def",
"toStr",
"(",
"self",
")",
":",
"# Note that the string representation contains much less",
"# information than the HTML summary. E.g., it does not contain the",
"# unique (de-duplicated, by id) read count, since that is only computed",
"# when we are making combined FASTA files of reads ma... | Produce a string representation of the pathogen summary.
@return: A C{str} suitable for printing. | [
"Produce",
"a",
"string",
"representation",
"of",
"the",
"pathogen",
"summary",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/proteins.py#L340-L380 |
55,590 | acorg/dark-matter | dark/fasta_ss.py | SSFastaReads.iter | def iter(self):
"""
Iterate over the sequences in self.file_, yielding each as an
instance of the desired read class.
@raise ValueError: If the input file has an odd number of records or
if any sequence has a different length than its predicted
secondary structur... | python | def iter(self):
"""
Iterate over the sequences in self.file_, yielding each as an
instance of the desired read class.
@raise ValueError: If the input file has an odd number of records or
if any sequence has a different length than its predicted
secondary structur... | [
"def",
"iter",
"(",
"self",
")",
":",
"upperCase",
"=",
"self",
".",
"_upperCase",
"for",
"_file",
"in",
"self",
".",
"_files",
":",
"with",
"asHandle",
"(",
"_file",
")",
"as",
"fp",
":",
"records",
"=",
"SeqIO",
".",
"parse",
"(",
"fp",
",",
"'fa... | Iterate over the sequences in self.file_, yielding each as an
instance of the desired read class.
@raise ValueError: If the input file has an odd number of records or
if any sequence has a different length than its predicted
secondary structure. | [
"Iterate",
"over",
"the",
"sequences",
"in",
"self",
".",
"file_",
"yielding",
"each",
"as",
"an",
"instance",
"of",
"the",
"desired",
"read",
"class",
"."
] | c78a1bf262667fa5db3548fa7066c4ec14d0551d | https://github.com/acorg/dark-matter/blob/c78a1bf262667fa5db3548fa7066c4ec14d0551d/dark/fasta_ss.py#L43-L85 |
55,591 | Snaipe/python-rst2ansi | rst2ansi/functional.py | npartial | def npartial(func, *args, **kwargs):
"""
Returns a partial node visitor function
"""
def wrapped(self, node):
func(self, *args, **kwargs)
return wrapped | python | def npartial(func, *args, **kwargs):
"""
Returns a partial node visitor function
"""
def wrapped(self, node):
func(self, *args, **kwargs)
return wrapped | [
"def",
"npartial",
"(",
"func",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"wrapped",
"(",
"self",
",",
"node",
")",
":",
"func",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"wrapped"
] | Returns a partial node visitor function | [
"Returns",
"a",
"partial",
"node",
"visitor",
"function"
] | 1b1b963804bcc87a7187d07c3943585d9385ea92 | https://github.com/Snaipe/python-rst2ansi/blob/1b1b963804bcc87a7187d07c3943585d9385ea92/rst2ansi/functional.py#L26-L32 |
55,592 | biocommons/bioutils | src/bioutils/sequences.py | aa3_to_aa1 | def aa3_to_aa1(seq):
"""convert string of 3-letter amino acids to 1-letter amino acids
>>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu")
'CATSARELAME'
>>> aa3_to_aa1(None)
"""
if seq is None:
return None
return "".join(aa3_to_aa1_lut[aa3]
for aa3 in [seq[i:i +... | python | def aa3_to_aa1(seq):
"""convert string of 3-letter amino acids to 1-letter amino acids
>>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu")
'CATSARELAME'
>>> aa3_to_aa1(None)
"""
if seq is None:
return None
return "".join(aa3_to_aa1_lut[aa3]
for aa3 in [seq[i:i +... | [
"def",
"aa3_to_aa1",
"(",
"seq",
")",
":",
"if",
"seq",
"is",
"None",
":",
"return",
"None",
"return",
"\"\"",
".",
"join",
"(",
"aa3_to_aa1_lut",
"[",
"aa3",
"]",
"for",
"aa3",
"in",
"[",
"seq",
"[",
"i",
":",
"i",
"+",
"3",
"]",
"for",
"i",
"... | convert string of 3-letter amino acids to 1-letter amino acids
>>> aa3_to_aa1("CysAlaThrSerAlaArgGluLeuAlaMetGlu")
'CATSARELAME'
>>> aa3_to_aa1(None) | [
"convert",
"string",
"of",
"3",
"-",
"letter",
"amino",
"acids",
"to",
"1",
"-",
"letter",
"amino",
"acids"
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L158-L170 |
55,593 | biocommons/bioutils | src/bioutils/sequences.py | elide_sequence | def elide_sequence(s, flank=5, elision="..."):
"""trim a sequence to include the left and right flanking sequences of
size `flank`, with the intervening sequence elided by `elision`.
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
'ABCDE...VWXYZ'
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ", f... | python | def elide_sequence(s, flank=5, elision="..."):
"""trim a sequence to include the left and right flanking sequences of
size `flank`, with the intervening sequence elided by `elision`.
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
'ABCDE...VWXYZ'
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ", f... | [
"def",
"elide_sequence",
"(",
"s",
",",
"flank",
"=",
"5",
",",
"elision",
"=",
"\"...\"",
")",
":",
"elided_sequence_len",
"=",
"flank",
"+",
"flank",
"+",
"len",
"(",
"elision",
")",
"if",
"len",
"(",
"s",
")",
"<=",
"elided_sequence_len",
":",
"retu... | trim a sequence to include the left and right flanking sequences of
size `flank`, with the intervening sequence elided by `elision`.
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
'ABCDE...VWXYZ'
>>> elide_sequence("ABCDEFGHIJKLMNOPQRSTUVWXYZ", flank=3)
'ABC...XYZ'
>>> elide_sequence("ABCDE... | [
"trim",
"a",
"sequence",
"to",
"include",
"the",
"left",
"and",
"right",
"flanking",
"sequences",
"of",
"size",
"flank",
"with",
"the",
"intervening",
"sequence",
"elided",
"by",
"elision",
"."
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L188-L212 |
55,594 | biocommons/bioutils | src/bioutils/sequences.py | normalize_sequence | def normalize_sequence(seq):
"""return normalized representation of sequence for hashing
This really means ensuring that the sequence is represented as a
binary blob and removing whitespace and asterisks and uppercasing.
>>> normalize_sequence("ACGT")
'ACGT'
>>> normalize_sequence(" A C G T ... | python | def normalize_sequence(seq):
"""return normalized representation of sequence for hashing
This really means ensuring that the sequence is represented as a
binary blob and removing whitespace and asterisks and uppercasing.
>>> normalize_sequence("ACGT")
'ACGT'
>>> normalize_sequence(" A C G T ... | [
"def",
"normalize_sequence",
"(",
"seq",
")",
":",
"nseq",
"=",
"re",
".",
"sub",
"(",
"r\"[\\s\\*]\"",
",",
"\"\"",
",",
"seq",
")",
".",
"upper",
"(",
")",
"m",
"=",
"re",
".",
"search",
"(",
"\"[^A-Z]\"",
",",
"nseq",
")",
"if",
"m",
":",
"_lo... | return normalized representation of sequence for hashing
This really means ensuring that the sequence is represented as a
binary blob and removing whitespace and asterisks and uppercasing.
>>> normalize_sequence("ACGT")
'ACGT'
>>> normalize_sequence(" A C G T * ")
'ACGT'
>>> normalize_s... | [
"return",
"normalized",
"representation",
"of",
"sequence",
"for",
"hashing"
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L221-L247 |
55,595 | biocommons/bioutils | src/bioutils/sequences.py | translate_cds | def translate_cds(seq, full_codons=True, ter_symbol="*"):
"""translate a DNA or RNA sequence into a single-letter amino acid sequence
using the standard translation table
If full_codons is True, a sequence whose length isn't a multiple of three
generates a ValueError; else an 'X' will be added as the l... | python | def translate_cds(seq, full_codons=True, ter_symbol="*"):
"""translate a DNA or RNA sequence into a single-letter amino acid sequence
using the standard translation table
If full_codons is True, a sequence whose length isn't a multiple of three
generates a ValueError; else an 'X' will be added as the l... | [
"def",
"translate_cds",
"(",
"seq",
",",
"full_codons",
"=",
"True",
",",
"ter_symbol",
"=",
"\"*\"",
")",
":",
"if",
"seq",
"is",
"None",
":",
"return",
"None",
"if",
"len",
"(",
"seq",
")",
"==",
"0",
":",
"return",
"\"\"",
"if",
"full_codons",
"an... | translate a DNA or RNA sequence into a single-letter amino acid sequence
using the standard translation table
If full_codons is True, a sequence whose length isn't a multiple of three
generates a ValueError; else an 'X' will be added as the last amino acid.
This matches biopython's behaviour when paddi... | [
"translate",
"a",
"DNA",
"or",
"RNA",
"sequence",
"into",
"a",
"single",
"-",
"letter",
"amino",
"acid",
"sequence",
"using",
"the",
"standard",
"translation",
"table"
] | 88bcbdfa707268fed1110800e91b6d4f8e9475a0 | https://github.com/biocommons/bioutils/blob/88bcbdfa707268fed1110800e91b6d4f8e9475a0/src/bioutils/sequences.py#L290-L349 |
55,596 | vovanec/httputil | httputil/request_engines/base.py | BaseRequestEngine.request | def request(self, url, *,
method='GET', headers=None, data=None, result_callback=None):
"""Perform request.
:param str url: request URL.
:param str method: request method.
:param dict headers: request headers.
:param object data: request data.
:param obje... | python | def request(self, url, *,
method='GET', headers=None, data=None, result_callback=None):
"""Perform request.
:param str url: request URL.
:param str method: request method.
:param dict headers: request headers.
:param object data: request data.
:param obje... | [
"def",
"request",
"(",
"self",
",",
"url",
",",
"*",
",",
"method",
"=",
"'GET'",
",",
"headers",
"=",
"None",
",",
"data",
"=",
"None",
",",
"result_callback",
"=",
"None",
")",
":",
"url",
"=",
"self",
".",
"_make_full_url",
"(",
"url",
")",
"sel... | Perform request.
:param str url: request URL.
:param str method: request method.
:param dict headers: request headers.
:param object data: request data.
:param object -> object result_callback: result callback.
:rtype: dict
:raise: APIError | [
"Perform",
"request",
"."
] | 0b8dab5a23166cceb7dbc2a1dbc802ab5b311347 | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/httputil/request_engines/base.py#L47-L65 |
55,597 | vovanec/httputil | httputil/request_engines/base.py | BaseRequestEngine._make_full_url | def _make_full_url(self, url):
"""Given base and relative URL, construct the full URL.
:param str url: relative URL.
:return: full URL.
:rtype: str
"""
return SLASH.join([self._api_base_url, url.lstrip(SLASH)]) | python | def _make_full_url(self, url):
"""Given base and relative URL, construct the full URL.
:param str url: relative URL.
:return: full URL.
:rtype: str
"""
return SLASH.join([self._api_base_url, url.lstrip(SLASH)]) | [
"def",
"_make_full_url",
"(",
"self",
",",
"url",
")",
":",
"return",
"SLASH",
".",
"join",
"(",
"[",
"self",
".",
"_api_base_url",
",",
"url",
".",
"lstrip",
"(",
"SLASH",
")",
"]",
")"
] | Given base and relative URL, construct the full URL.
:param str url: relative URL.
:return: full URL.
:rtype: str | [
"Given",
"base",
"and",
"relative",
"URL",
"construct",
"the",
"full",
"URL",
"."
] | 0b8dab5a23166cceb7dbc2a1dbc802ab5b311347 | https://github.com/vovanec/httputil/blob/0b8dab5a23166cceb7dbc2a1dbc802ab5b311347/httputil/request_engines/base.py#L84-L93 |
55,598 | mikebryant/django-autoconfig | django_autoconfig/autoconfig.py | merge_dictionaries | def merge_dictionaries(current, new, only_defaults=False, template_special_case=False):
'''
Merge two settings dictionaries, recording how many changes were needed.
'''
changes = 0
for key, value in new.items():
if key not in current:
if hasattr(global_settings, key):
... | python | def merge_dictionaries(current, new, only_defaults=False, template_special_case=False):
'''
Merge two settings dictionaries, recording how many changes were needed.
'''
changes = 0
for key, value in new.items():
if key not in current:
if hasattr(global_settings, key):
... | [
"def",
"merge_dictionaries",
"(",
"current",
",",
"new",
",",
"only_defaults",
"=",
"False",
",",
"template_special_case",
"=",
"False",
")",
":",
"changes",
"=",
"0",
"for",
"key",
",",
"value",
"in",
"new",
".",
"items",
"(",
")",
":",
"if",
"key",
"... | Merge two settings dictionaries, recording how many changes were needed. | [
"Merge",
"two",
"settings",
"dictionaries",
"recording",
"how",
"many",
"changes",
"were",
"needed",
"."
] | 1ce793e95b024dccb189de1dc111dc4ae6c2f3a6 | https://github.com/mikebryant/django-autoconfig/blob/1ce793e95b024dccb189de1dc111dc4ae6c2f3a6/django_autoconfig/autoconfig.py#L94-L144 |
55,599 | mikebryant/django-autoconfig | django_autoconfig/autoconfig.py | configure_settings | def configure_settings(settings, environment_settings=True):
'''
Given a settings object, run automatic configuration of all
the apps in INSTALLED_APPS.
'''
changes = 1
iterations = 0
while changes:
changes = 0
app_names = ['django_autoconfig'] + list(settings['INSTALLED_APP... | python | def configure_settings(settings, environment_settings=True):
'''
Given a settings object, run automatic configuration of all
the apps in INSTALLED_APPS.
'''
changes = 1
iterations = 0
while changes:
changes = 0
app_names = ['django_autoconfig'] + list(settings['INSTALLED_APP... | [
"def",
"configure_settings",
"(",
"settings",
",",
"environment_settings",
"=",
"True",
")",
":",
"changes",
"=",
"1",
"iterations",
"=",
"0",
"while",
"changes",
":",
"changes",
"=",
"0",
"app_names",
"=",
"[",
"'django_autoconfig'",
"]",
"+",
"list",
"(",
... | Given a settings object, run automatic configuration of all
the apps in INSTALLED_APPS. | [
"Given",
"a",
"settings",
"object",
"run",
"automatic",
"configuration",
"of",
"all",
"the",
"apps",
"in",
"INSTALLED_APPS",
"."
] | 1ce793e95b024dccb189de1dc111dc4ae6c2f3a6 | https://github.com/mikebryant/django-autoconfig/blob/1ce793e95b024dccb189de1dc111dc4ae6c2f3a6/django_autoconfig/autoconfig.py#L158-L197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.