nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:gather_categories; 3, parameters; 4, block; 5, identifier:imap; 6, identifier:header; 7, default_parameter; 8, expression_statement; 9, comment:# If no categories provided, return all SampleIDs; 10, if_statement; 11, expression_statement; 12, expression_statement; 13,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 7, 27; 7, 28; 8, 29; 10, 30; 10, 31; 11, 32; 12, 33; 13, 34; 14, 35; 14, 36; 14, 37; 16, 38; 16, 39; 18, 40; 18, 41; 20, 42; 21, 43; 21, 44; 21, 45... | def gather_categories(imap, header, categories=None):
"""
Find the user specified categories in the map and create a dictionary to contain the
relevant data for each type within the categories. Multiple categories will have their
types combined such that each possible combination will have its own entry... |
0, module; 1, function_definition; 2, function_name:sort_sam; 3, parameters; 4, block; 5, identifier:sam; 6, identifier:sort; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
sort sam file
"""; 12, assignment; 13, comparison_operator:sort is True; 14, bloc... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 14, 23; 15, 24; 18, 25; 18, 26; 21, 27; 22, 28; 22, 29; 22, 30; 23, 31; 24, 32; 25, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 30, 40; 31, 41; 31, 42; 32, 43; ... | def sort_sam(sam, sort):
"""
sort sam file
"""
tempdir = '%s/' % (os.path.abspath(sam).rsplit('/', 1)[0])
if sort is True:
mapping = '%s.sorted.sam' % (sam.rsplit('.', 1)[0])
if sam != '-':
if os.path.exists(mapping) is False:
os.system("\
... |
0, module; 1, function_definition; 2, function_name:top_hits; 3, parameters; 4, block; 5, identifier:hits; 6, identifier:num; 7, identifier:column; 8, identifier:reverse; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:"""
get top hits after sorting by column number
"""; 13, ca... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 9, 12; 10, 13; 11, 14; 11, 15; 11, 16; 13, 17; 13, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 20, 26; 20, 27; 21, 28; 24, 29; 24, 30; 25, 31; 25, 32; 28, 33; 30, 34; 30, 35; 35, 36 | def top_hits(hits, num, column, reverse):
"""
get top hits after sorting by column number
"""
hits.sort(key = itemgetter(column), reverse = reverse)
for hit in hits[0:num]:
yield hit |
0, module; 1, function_definition; 2, function_name:numBlast_sort; 3, parameters; 4, block; 5, identifier:blast; 6, identifier:numHits; 7, identifier:evalueT; 8, identifier:bitT; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, expression_stat... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 9, 16; 10, 17; 11, 18; 12, 19; 13, 20; 13, 21; 13, 22; 14, 23; 15, 24; 15, 25; 15, 26; 17, 27; 17, 28; 18, 29; 19, 30; 19, 31; 22, 32; 22, 33; 22, 34; 22, 35; 22, 36; 22, 37; 22, 38; 22, 39; 23, 40; 23, 41; 24, 42; 24, 43; 2... | def numBlast_sort(blast, numHits, evalueT, bitT):
"""
parse b6 output with sorting
"""
header = ['#query', 'target', 'pident', 'alen', 'mismatch', 'gapopen',
'qstart', 'qend', 'tstart', 'tend', 'evalue', 'bitscore']
yield header
hmm = {h:[] for h in header}
for line in blast:
... |
0, module; 1, function_definition; 2, function_name:numDomtblout; 3, parameters; 4, block; 5, identifier:domtblout; 6, identifier:numHits; 7, identifier:evalueT; 8, identifier:bitT; 9, identifier:sort; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, expression_stateme... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 10, 17; 11, 18; 11, 19; 12, 20; 13, 21; 14, 22; 15, 23; 15, 24; 15, 25; 16, 26; 16, 27; 16, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 22, 36; 22, 37; 25, 38; 25, 39; 25, 40; 25, 41; 25, 42; 25, 43; 2... | def numDomtblout(domtblout, numHits, evalueT, bitT, sort):
"""
parse hmm domain table output
this version is faster but does not work unless the table is sorted
"""
if sort is True:
for hit in numDomtblout_sort(domtblout, numHits, evalueT, bitT):
yield hit
return
head... |
0, module; 1, function_definition; 2, function_name:S; 3, parameters; 4, block; 5, identifier:Document; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:fields; 12, comment:"""Generate a MongoDB sort order list using the Django ORM style."""... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 13, 18; 13, 19; 16, 20; 16, 21; 16, 22; 16, 23; 16, 24; 16, 25; 16, 26; 20, 27; 20, 28; 20, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 26, 38; 27, 39; 27, 40; 29, 41; 29, 42; 29, 43; 3... | def S(Document, *fields):
"""Generate a MongoDB sort order list using the Django ORM style."""
result = []
for field in fields:
if isinstance(field, tuple): # Unpack existing tuple.
field, direction = field
result.append((field, direction))
continue
direction = ASCENDING
if not field.starts... |
0, module; 1, function_definition; 2, function_name:arrayuniqify; 3, parameters; 4, block; 5, identifier:X; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, identifier:retainorder; 13, False; 14, comment:"""
Very fast un... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 19, 27; 19, 28; 19, 29; 19, 30; 20, 31; 22, 32; 22, 33; 24, 34; 24, 35; 26, 36; 26, 37; 27, 38; 28, 39; 29, 40; 30, 41; 31, 42; 32, 43; 3... | def arrayuniqify(X, retainorder=False):
"""
Very fast uniqify routine for numpy arrays.
**Parameters**
**X** : numpy array
Determine the unique elements of this numpy array.
**retainorder** : Boolean, optional
Whether or not to return in... |
0, module; 1, function_definition; 2, function_name:equalspairs; 3, parameters; 4, block; 5, identifier:X; 6, identifier:Y; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_st... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 7, 18; 8, 19; 9, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 15, 26; 16, 27; 17, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, 4... | def equalspairs(X, Y):
"""
Indices of elements in a sorted numpy array equal to those in another.
Given numpy array `X` and sorted numpy array `Y`, determine the indices in
Y equal to indices in X.
Returns `[A,B]` where `A` and `B` are numpy arrays of indices in `X` such
that::
... |
0, module; 1, function_definition; 2, function_name:_inplace_sort_by_id; 3, parameters; 4, block; 5, identifier:unsorted_list; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, expression_statement; 10, delete_statement; 11, expression_statement; 12, comment:"""Takes a list of dicts each of which ha... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 13, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 22, 31; 22, 32; 23, 33; 23, 34; 27, 35; 27, 36; 28, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43; 3... | def _inplace_sort_by_id(unsorted_list):
"""Takes a list of dicts each of which has an '@id' key,
sorts the elements in the list by the value of the @id key.
Assumes that @id is unique or the dicts have a meaningul < operator
"""
if not isinstance(unsorted_list, list):
return
sorted_list ... |
0, module; 1, function_definition; 2, function_name:get_schemaloc_string; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, for_statement; 14, if_statement; 15, return_... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 12, 27; 13, 28; 13, 29; 13, 30; 14, 31; 14, 32; 15, 33; 23, 34; 24, 35; 26, 36; 27, 37; 27, 38; 30, 39; 30, 40; 31, 41; 32, 42; 33, 43; 33, 44;... | def get_schemaloc_string(self, ns_uris=None, sort=False, delim="\n"):
"""Constructs and returns a schemalocation attribute. If no
namespaces in this set have any schema locations defined, returns
an empty string.
Args:
ns_uris (iterable): The namespaces to include in the co... |
0, module; 1, function_definition; 2, function_name:aggregate; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement; 14, if_statement; 15, express... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 9, 25; 10, 26; 10, 27; 11, 28; 11, 29; 12, 30; 12, 31; 13, 32; 14, 33; 14, 34; 14, 35; 15, 36; 16, 37; 17, 38; 17, 39; 17, 40; 34, 41; 35, 42; 36, 43; 36, 44; 37... | def aggregate(self, On=None, AggFuncDict=None, AggFunc=None, AggList =
None, returnsort=False,KeepOthers=True, keyfuncdict=None):
"""
Aggregate a tabarray on columns for given functions.
Method wraps::
tabular.spreadsheet.aggregate(self, On, AggFuncDict, AggFu... |
0, module; 1, function_definition; 2, function_name:argsort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:axis; 14, unary_operator; 15, iden... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 14, 23; 16, 24; 20, 25; 20, 26; 21, 27; 21, 28; 26, 29; 26, 30; 28, 31; 28, 32; 29, 33; 29, 34; 30, 35; 30, 36; 30, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 33, 43; 33, ... | def argsort(self, axis=-1, kind='quicksort', order=None):
"""
Returns the indices that would sort an array.
.. note::
This method wraps `numpy.argsort`. This documentation is
modified from that of `numpy.argsort`.
Perform an indirect sort along the gi... |
0, module; 1, function_definition; 2, function_name:blt; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, generic_type; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:f; 14, type; 15, identifier:x; 16, type; 17, identifier:Di... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 14, 23; 16, 24; 18, 25; 18, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 22, 33; 22, 34; 22, 35; 22, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 26, ... | def blt(f: List[SYM], x: List[SYM]) -> Dict[str, Any]:
"""
Sort equations by dependence
"""
J = ca.jacobian(f, x)
nblock, rowperm, colperm, rowblock, colblock, coarserow, coarsecol = J.sparsity().btf()
return {
'J': J,
'nblock': nblock,
'rowperm': rowperm,
'colper... |
0, module; 1, function_definition; 2, function_name:sort_generators; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:""" Reorders the list of generators according to bus index.
"""; 9, call; 10, attribute; 11, argument_list; 12, attribute; 13, identifier... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 18, 19; 18, 20; 19, 21; 20, 22; 20, 23; 22, 24; 22, 25 | def sort_generators(self):
""" Reorders the list of generators according to bus index.
"""
self.generators.sort(key=lambda gn: gn.bus._i) |
0, module; 1, function_definition; 2, function_name:list; 3, parameters; 4, comment:# pylint: disable=redefined-builtin; 5, block; 6, identifier:self; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, e... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 12, 27; 13, 28; 14, 29; 15, 30; 16, 31; 28, 32; 28, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 31, 39; 33, 40; 33, 41; 35, 42; 35, 43; 36, 44;... | def list(self, filter=None, type=None, sort=None, limit=None, page=None): # pylint: disable=redefined-builtin
"""Get a list of configs.
:param filter: (optional) Filters to apply as a string list.
:param type: (optional) `union` or `inter` as string.
:param sort: (optional) Sort fields ... |
0, module; 1, function_definition; 2, function_name:list_csv; 3, parameters; 4, comment:# pylint: disable=redefined-builtin; 5, block; 6, identifier:self; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, return_statement; 14, i... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 5, 12; 5, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 10, 21; 11, 22; 11, 23; 12, 24; 13, 25; 25, 26; 25, 27; 26, 28; 26, 29; 28, 30; 28, 31; 29, 32; 29, 33; 29, 34; 29, 35; 29, 36; 29, 37; 29, 38; 30, 39; 30, 40; 32, 41; 32, 42; 38, 43; 38, ... | def list_csv(self, filter=None, type=None, sort=None, limit=None, page=None): # pylint: disable=redefined-builtin
"""Get a list of results as CSV.
:param filter: (optional) Filters to apply as a string list.
:param type: (optional) `union` or `inter` as string.
:param sort: (optional) S... |
0, module; 1, function_definition; 2, function_name:list_logdir; 3, parameters; 4, comment:# pylint: disable=invalid-name,redefined-builtin; 5, block; 6, identifier:self; 7, identifier:id; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, retur... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 5, 10; 5, 11; 5, 12; 5, 13; 8, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 12, 20; 13, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 23, 28; 23, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 27, 35; 27, 36; 30, 37; 30, 38; 31, 39; 31, 40; 31, 41; 32, 42; 32, 43; 36... | def list_logdir(self, id, filter=None, sort=None): # pylint: disable=invalid-name,redefined-builtin
"""Get a list of logdir files.
:param id: Result ID as an int.
:param filter: Filter to apply as string.
:param sort: Sort field to apply as string.
:return: :class:`results.LogDi... |
0, module; 1, function_definition; 2, function_name:list; 3, parameters; 4, comment:# pylint: disable=redefined-builtin; 5, block; 6, identifier:self; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, e... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 12, 27; 13, 28; 14, 29; 15, 30; 16, 31; 28, 32; 28, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 31, 39; 33, 40; 33, 41; 35, 42; 35, 43; 36, 44;... | def list(self, filter=None, type=None, sort=None, limit=None, page=None): # pylint: disable=redefined-builtin
"""Get a list of packages.
:param filter: (optional) Filters to apply as a string list.
:param type: (optional) `union` or `inter` as string.
:param sort: (optional) Sort fields... |
0, module; 1, function_definition; 2, function_name:list; 3, parameters; 4, comment:# pylint: disable=invalid-name,redefined-builtin; 5, block; 6, identifier:self; 7, identifier:id; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement;... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 11, 25; 12, 26; 12, 27; 13, 28; 14, 29; 15, 30; 16, 31; 17, 32; 29, 33; 29, 34; 30, 35; 30, 36; 31, 37; 31, 38; 32, 39; 32, 40; 34, 41; 34, 42; 36, 43; 36, 44... | def list(self, id, filter=None, type=None, sort=None, limit=None, page=None): # pylint: disable=invalid-name,redefined-builtin
"""Get a list of a device's attachments.
:param id: Device ID as an int.
:param filter: (optional) Filters to apply as a string list.
:param type: (optional) `u... |
0, module; 1, function_definition; 2, function_name:_process_value; 3, parameters; 4, block; 5, identifier:self; 6, identifier:value; 7, identifier:type; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Process a value that will be sent to backend
:param value: the value ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 9, 13; 10, 14; 12, 15; 13, 16; 15, 17; 15, 18; 16, 19; 18, 20; 18, 21; 19, 22; 19, 23; 21, 24; 21, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30; 26, 31; 26, 32; 27, 33 | def _process_value(self, value, type):
"""
Process a value that will be sent to backend
:param value: the value to return
:param type: hint for what sort of value this is
:type type: str
"""
if not isinstance(value, six.string_types + (list,)):
val... |
0, module; 1, function_definition; 2, function_name:representatives; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, for_statement; 15, r... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 9, 21; 10, 22; 10, 23; 11, 24; 11, 25; 12, 26; 13, 27; 14, 28; 14, 29; 14, 30; 15, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29, 44... | def representatives(self, count=None, sorting=False):
"""
Returns a list of pairs of representative and its voting weight
:param count: Max amount of representatives to return
:type count: int
:param sorting: If true, sorts by weight
:type sorting: bool
:raises... |
0, module; 1, function_definition; 2, function_name:iterative_overlap_assembly; 3, parameters; 4, block; 5, identifier:variant_sequences; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, comment:# reduce the number of inputs to the merge algorithm by first collapsing; 10, comment:# shorter sequences o... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 8, 20; 8, 21; 8, 22; 8, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 20, 30; 20, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 29, 44; ... | def iterative_overlap_assembly(
variant_sequences,
min_overlap_size=MIN_VARIANT_SEQUENCE_ASSEMBLY_OVERLAP_SIZE):
"""
Assembles longer sequences from reads centered on a variant by
between merging all pairs of overlapping sequences and collapsing
shorter sequences onto every longer sequen... |
0, module; 1, function_definition; 2, function_name:rot_consts; 3, parameters; 4, block; 5, identifier:geom; 6, identifier:masses; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# Imports; 11, import_statement; 12, import_from_statement; 13, comment:# Ensure units are valid; 14, if_sta... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 11, 32; 12, 33; 12, 34; 12, 35; 12, 36; 12, 37; 14, 38; 14, 39; 18, 40; 20, 41; 20, 42; 20, 43; 20, 44; 23, 45; ... | def rot_consts(geom, masses, units=_EURC.INV_INERTIA, on_tol=_DEF.ORTHONORM_TOL):
"""Rotational constants for a given molecular system.
Calculates the rotational constants for the provided system with numerical
value given in the units provided in `units`. The orthnormality tolerance
`on_tol` is requi... |
0, module; 1, function_definition; 2, function_name:reference_contexts_for_variants; 3, parameters; 4, block; 5, identifier:variants; 6, identifier:context_size; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:transcript_id_whitelist; 13, N... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 15, 20; 15, 21; 18, 22; 21, 23; 21, 24; 22, 25; 25, 26; 25, 27; 26, 28; 26, 29; 27, 30; 27, 31; 31, 32; 31, 33; 31, 34; 32, 35; 32, 36; 33, 37; 33, 38; 34, 39; 34, 40 | def reference_contexts_for_variants(
variants,
context_size,
transcript_id_whitelist=None):
"""
Extract a set of reference contexts for each variant in the collection.
Parameters
----------
variants : varcode.VariantCollection
context_size : int
Max of nucleotid... |
0, module; 1, function_definition; 2, function_name:ffd; 3, parameters; 4, block; 5, identifier:items; 6, identifier:targets; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:kwargs; 14, comment:"""Fir... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 12, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 20, 27; 20, 28; 22, 29; 22, 30; 24, 31; 24, 32; 26, 33; 26, 34; 28, 35; 28, 36; 30, 37; 30, 38; 30, 39; 32, 40; 32, 41; 36, 42; 36, 43; ... | def ffd(items, targets, **kwargs):
"""First-Fit Decreasing
This is perhaps the simplest packing heuristic;
it simply packs items in the next available bin.
This algorithm differs only from Next-Fit Decreasing
in having a 'sort'; that is, the items are pre-sorted
(largest to smallest).
Com... |
0, module; 1, function_definition; 2, function_name:sort_protein_sequences; 3, parameters; 4, block; 5, identifier:protein_sequences; 6, expression_statement; 7, return_statement; 8, comment:"""
Sort protein sequences in decreasing order of priority
"""; 9, call; 10, identifier:list; 11, argument_list; 12, call... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 12, 13; 12, 14; 14, 15; 14, 16; 14, 17; 16, 18; 16, 19; 17, 20; 17, 21; 19, 22; 19, 23 | def sort_protein_sequences(protein_sequences):
"""
Sort protein sequences in decreasing order of priority
"""
return list(
sorted(
protein_sequences,
key=ProteinSequence.ascending_sort_key,
reverse=True)) |
0, module; 1, function_definition; 2, function_name:dump; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, if_statement; 12, identifier:fp; 13, None; 14, identifier:indent; 15, None; 16, identifier:so... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 21, 23; 21, 24; 22, 25; 23, 26; 24, 27; 24, 28; 24, 29; 25, 30; 26, 31; 26, 32; 29, 33; 30, 34; 32, 35; 32, 36; 33, 37; 34, 38; 34, 39; 35, 40; 35, 41; 36, 42; 37, 43; 37,... | def dump(obj, fp=None, indent=None, sort_keys=False, **kw):
"""
Dump object to a file like object or string.
:param obj:
:param fp: Open file like object
:param int indent: Indent size, default 2
:param bool sort_keys: Optionally sort dictionary keys.
:return: Yaml serialized data.
"""
... |
0, module; 1, function_definition; 2, function_name:sorted_options; 3, parameters; 4, block; 5, identifier:sort_options; 6, expression_statement; 7, return_statement; 8, comment:"""Sort sort options for display.
:param sort_options: A dictionary containing the field name as key and
asc/desc as value.
:... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 23, 29; 23, 30; 26, 31; 28, 32; 28, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 33, 41; 33, 42; 35, ... | def sorted_options(sort_options):
"""Sort sort options for display.
:param sort_options: A dictionary containing the field name as key and
asc/desc as value.
:returns: A dictionary with sorting options for Invenio-Search-JS.
"""
return [
{
'title': v['title'],
... |
0, module; 1, function_definition; 2, function_name:info; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, string; 9, call; 10, string_content:Returns information on all the registered checkers.
Sorted by namespace and then name
:returns a list of CheckerInf... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 8, 10; 9, 11; 9, 12; 12, 13; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 15, 19; 15, 20; 18, 21; 18, 22; 19, 23; 19, 24; 21, 25; 22, 26; 22, 27; 26, 28; 26, 29; 27, 30; 27, 31 | def info(self):
''' Returns information on all the registered checkers.
Sorted by namespace and then name
:returns a list of CheckerInfo
'''
return sorted(self._checkers.values(), key=lambda x: (x.ns, x.name)) |
0, module; 1, function_definition; 2, function_name:extract_from_text; 3, parameters; 4, block; 5, identifier:text; 6, expression_statement; 7, return_statement; 8, comment:"""
Extract HAL ids from a text.
:param text: The text to extract HAL ids from.
:returns: A list of matching HAL ids.
>>> sorted(... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 14, 15; 14, 16; 14, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 21, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 24, 29 | def extract_from_text(text):
"""
Extract HAL ids from a text.
:param text: The text to extract HAL ids from.
:returns: A list of matching HAL ids.
>>> sorted(extract_from_text("hal-01258754 hal-01258754v2 foobar"))
['hal-01258754', 'hal-01258754v2']
"""
return tools.remove_duplicates([... |
0, module; 1, function_definition; 2, function_name:_show_documentation; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, while_sta... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 7, 16; 8, 17; 8, 18; 8, 19; 9, 20; 10, 21; 11, 22; 11, 23; 12, 24; 13, 25; 14, 26; 14, 27; 16, 28; 16, 29; 17, 30; 17, 31; 18, 32; 18, 33; 19, 34; 20, 35; 20, 36; 21, 37; 21, 38; 22, 39; 22, 40; 23, 41; 24, 42; 24, 43; 25, 4... | def _show_documentation(self):
"""
Shows all documents of the current groundwork app in the console.
Documents are sorted bei its names, except "main", which gets set to the beginning.
"""
documents = []
for key, document in self.app.documents.get().items():
... |
0, module; 1, function_definition; 2, function_name:dispersion_ranking_NN; 3, parameters; 4, block; 5, identifier:self; 6, identifier:nnm; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, e... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 7, 20; 7, 21; 8, 22; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 16, 30; 17, 31; 18, 32; 19, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44; ... | def dispersion_ranking_NN(self, nnm, num_norm_avg=50):
"""Computes the spatial dispersion factors for each gene.
Parameters
----------
nnm - scipy.sparse, float
Square cell-to-cell nearest-neighbor matrix.
num_norm_avg - int, optional, default 50
The top... |
0, module; 1, function_definition; 2, function_name:canonical_ops; 3, parameters; 4, block; 5, identifier:ops; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, string; 10, assignment; 11, identifier:new_ops; 12, string_content:Returns the given operations array sorted with duplicates removed.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 9, 12; 10, 13; 10, 14; 14, 15; 14, 16; 16, 17; 16, 18; 17, 19; 17, 20; 18, 21; 18, 22; 20, 23; 22, 24; 22, 25; 24, 26; 25, 27; 25, 28; 27, 29; 27, 30; 28, 31; 28, 32 | def canonical_ops(ops):
''' Returns the given operations array sorted with duplicates removed.
@param ops checker.Ops
@return: checker.Ops
'''
new_ops = sorted(set(ops), key=lambda x: (x.entity, x.action))
return new_ops |
0, module; 1, function_definition; 2, function_name:extract_from_text; 3, parameters; 4, block; 5, identifier:text; 6, expression_statement; 7, comment:# Remove the leading "arxiv:".; 8, return_statement; 9, comment:"""
Extract arXiv IDs from a text.
:param text: The text to extract arXiv IDs from.
:return... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 8, 10; 10, 11; 10, 12; 11, 13; 11, 14; 12, 15; 15, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 20, 28; 20, 29; 22, 30; 22, 31; 23, 32; 23, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 31, 40; 32, 41; 32, 42; 37,... | def extract_from_text(text):
"""
Extract arXiv IDs from a text.
:param text: The text to extract arXiv IDs from.
:returns: A list of matching arXiv IDs, in canonical form.
>>> sorted(extract_from_text('1506.06690 1506.06690v1 arXiv:1506.06690 arXiv:1506.06690v1 arxiv:1506.06690 arxiv:1506.06690v1 ... |
0, module; 1, function_definition; 2, function_name:serialize_text; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, string; 13, boolean_operator; 14, block; 15, assignment; 16, assignmen... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 12, 21; 13, 22; 13, 23; 14, 24; 15, 25; 15, 26; 16, 27; 16, 28; 19, 29; 20, 30; 20, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 26, 37; 26, 38; 29, 39; 30, 40; 30, 41; 31, 42; 32, 43; 3... | def serialize_text(self):
'''Returns a serialized form of the Namepace.
All the elements in the namespace are sorted by
URI, joined to the associated prefix with a colon and
separated with spaces.
:return: bytes
'''
if self._uri_to_prefix is None or len(self._uri... |
0, module; 1, function_definition; 2, function_name:process; 3, parameters; 4, block; 5, identifier:self; 6, identifier:versions; 7, expression_statement; 8, for_statement; 9, comment:"""Logging version sorted ascending by tool name."""; 10, identifier:tool_name; 11, call; 12, block; 13, identifier:sorted; 14, argument... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 8, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 15, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 32, 33; 32, 34; 34, 35; 34, 36 | def process(self, versions):
"""Logging version sorted ascending by tool name."""
for tool_name in sorted(versions.keys()):
version = versions[tool_name]
self._log("Using tool '%s', %s" % (tool_name, version)) |
0, module; 1, function_definition; 2, function_name:most_similar_catchments; 3, parameters; 4, block; 5, identifier:self; 6, identifier:subject_catchment; 7, identifier:similarity_dist_function; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, comment... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 11, 31; 11, 32; 12, 33; 14, 34; 16, 35; 16, 36; 16, 37; 18, 38; 18, 39; 18, 40; 20, 41; 22, 42; 23, 43; 24, 44; 24, 45... | def most_similar_catchments(self, subject_catchment, similarity_dist_function, records_limit=500,
include_subject_catchment='auto'):
"""
Return a list of catchments sorted by hydrological similarity defined by `similarity_distance_function`
:param subject_catchme... |
0, module; 1, function_definition; 2, function_name:sort_and_index_star; 3, parameters; 4, block; 5, identifier:job; 6, identifier:star_bams; 7, identifier:univ_options; 8, identifier:star_options; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_stat... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 9, 16; 10, 17; 11, 18; 12, 19; 13, 20; 14, 21; 15, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 26, 40; 26, 41; 28, 42; 28, 43; 2... | def sort_and_index_star(job, star_bams, univ_options, star_options):
"""
A wrapper for sorting and indexing the genomic star bam generated by run_star. It is required
since run_star returns a dict of 2 bams
:param dict star_bams: The bams from run_star
:param dict univ_options: Dict of universal op... |
0, module; 1, function_definition; 2, function_name:align_dna; 3, parameters; 4, block; 5, identifier:job; 6, identifier:fastqs; 7, identifier:sample_type; 8, identifier:univ_options; 9, identifier:bwa_options; 10, expression_statement; 11, comment:# The mkdup and regroup steps use picard that allots heap space using t... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 10, 28; 14, 29; 15, 30; 17, 31; 18, 32; 19, 33; 20, 34; 21, 35; 22, 36; 23, 37; 24, 38; 25, 39; 26, 40; 27, 41; 29, 42; 29, 43; 30, 44; 30, ... | def align_dna(job, fastqs, sample_type, univ_options, bwa_options):
"""
A wrapper for the entire dna alignment subgraph.
:param list fastqs: The input fastqs for alignment
:param str sample_type: Description of the sample to inject into the filename
:param dict univ_options: Dict of universal optio... |
0, module; 1, function_definition; 2, function_name:run_star; 3, parameters; 4, block; 5, identifier:job; 6, identifier:fastqs; 7, identifier:univ_options; 8, identifier:star_options; 9, expression_statement; 10, assert_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, express... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 9, 25; 10, 26; 11, 27; 12, 28; 13, 29; 14, 30; 15, 31; 16, 32; 16, 33; 16, 34; 17, 35; 18, 36; 18, 37; 18, 38; 19, 39; 20, 40; 21, 41; 22, 42; 23, 43; 24, 44; 26... | def run_star(job, fastqs, univ_options, star_options):
"""
This module uses STAR to align the RNA fastqs to the reference
ARGUMENTS
1. fastqs: REFER RETURN VALUE of run_cutadapt()
2. univ_options: Dict of universal arguments used by almost all tools
univ_options
+- 'dockerhub... |
0, module; 1, function_definition; 2, function_name:run_bwa; 3, parameters; 4, block; 5, identifier:job; 6, identifier:fastqs; 7, identifier:sample_type; 8, identifier:univ_options; 9, identifier:bwa_options; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, exp... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 10, 26; 11, 27; 12, 28; 13, 29; 14, 30; 15, 31; 16, 32; 17, 33; 17, 34; 19, 35; 20, 36; 21, 37; 25, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 29, 44; 30... | def run_bwa(job, fastqs, sample_type, univ_options, bwa_options):
"""
This module aligns the SAMPLE_TYPE dna fastqs to the reference
ARGUMENTS -- <ST> depicts the sample type. Substitute with 'tumor'/'normal'
1. fastqs: Dict of list of input WGS/WXS fastqs
fastqs
+- '<ST>_dna': [... |
0, module; 1, function_definition; 2, function_name:make_key_hippie; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, comment:## should we try to convert to frozen{set,dict} to get the C; 11, comment:## hashing function speed ? But ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 8, 19; 9, 20; 9, 21; 9, 22; 9, 23; 12, 24; 12, 25; 13, 26; 13, 27; 14, 28; 14, 29; 15, 30; 19, 31; 19, 32; 20, 33; 20, 34; 23, 35; 24, 36; 24, 37; 25, 38; 26, 39; 26, 40; 27, 41; 28, 42; 28, 43; 29, 44; ... | def make_key_hippie(obj, typed=True):
"""Return hashable structure from non-hashable structure using hippie means
dict and set are sorted and their content subjected to same hippie means.
Note that the key identifies the current content of the structure.
"""
ftype = type if typed else lambda o: N... |
0, module; 1, function_definition; 2, function_name:run_radia; 3, parameters; 4, block; 5, identifier:job; 6, identifier:rna_bam; 7, identifier:tumor_bam; 8, identifier:normal_bam; 9, identifier:univ_options; 10, identifier:radia_options; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, comment... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 11, 20; 12, 21; 12, 22; 12, 23; 12, 24; 13, 25; 15, 26; 15, 27; 15, 28; 16, 29; 17, 30; 17, 31; 17, 32; 18, 33; 19, 34; 21, 35; 21, 36; 22, 37; 23, 38; 23, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, ... | def run_radia(job, rna_bam, tumor_bam, normal_bam, univ_options, radia_options):
"""
Spawn a RADIA job for each chromosome on the input bam trios.
:param dict rna_bam: Dict of bam and bai for tumor DNA-Seq. It can be one of two formats
rna_bam: # Just the genomic bam and bai
|... |
0, module; 1, function_definition; 2, function_name:sort_bamfile; 3, parameters; 4, block; 5, identifier:job; 6, identifier:bamfile; 7, identifier:sample_type; 8, identifier:univ_options; 9, identifier:samtools_options; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_stateme... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 15, 26; 16, 27; 17, 28; 18, 29; 19, 30; 20, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 4... | def sort_bamfile(job, bamfile, sample_type, univ_options, samtools_options):
"""
Sort `bamfile` using samtools
:param toil.fileStore.FileID bamfile: fsID for the bam file
:param str sample_type: Description of the sample to inject into the filename
:param dict univ_options: Dict of universal option... |
0, module; 1, function_definition; 2, function_name:recursive_sort; 3, parameters; 4, block; 5, identifier:data_structure; 6, expression_statement; 7, comment:# We don't sory primitve types; 8, if_statement; 9, return_statement; 10, comment:"""Sort a recursive data_structure.
:param data_structure: The structure... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 8, 11; 8, 12; 9, 13; 11, 14; 12, 15; 12, 16; 12, 17; 12, 18; 12, 19; 12, 20; 12, 21; 14, 22; 14, 23; 15, 24; 16, 25; 17, 26; 17, 27; 18, 28; 20, 29; 20, 30; 21, 31; 21, 32; 21, 33; 21, 34; 23, 35; 23, 36; 24, 37; 24, 38; 25, 39; 25, 40; 26, 41; 27, 42; 27, 43... | def recursive_sort(data_structure):
"""Sort a recursive data_structure.
:param data_structure: The structure to convert.
data_structure must be already sortable or you must use freeze() or dump().
The function will work with many kinds of input. Dictionaries will be
converted to lists of tuples.... |
0, module; 1, function_definition; 2, function_name:tree_diff; 3, parameters; 4, block; 5, identifier:a; 6, identifier:b; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:n; 15, integer:5; 16, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 13, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 22, 30; 22, 31; 23, 32; 24, 33; 24, 34; 26, 35; 26, 36; 28, 37; 28, 38; 30, 39; 31, 40; 32, 41; 32, 42; 33, 43; 33,... | def tree_diff(a, b, n=5, sort=False):
"""Dump any data-structure or object, traverse
it depth-first in-order and apply a unified diff.
Depth-first in-order is just like structure would be printed.
:param a: data_structure a
:param b: data_structure b
:param ... |
0, module; 1, function_definition; 2, function_name:_add_new; 3, parameters; 4, block; 5, identifier:self; 6, identifier:host_object; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, comment:"""Add a new host to the collection.
Before a new hostname can be added... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 18, 25; 18, 26; 20, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 28, 38; 29, 39; 30, 40; 30, 41; 31, 42; 31, 43; ... | def _add_new(self, host_object):
"""Add a new host to the collection.
Before a new hostname can be added, all its subdomains already
present in the collection must be removed. Since the collection
is sorted, we can limit our search for them to a slice of
the collection starting ... |
0, module; 1, function_definition; 2, function_name:sort_by_type; 3, parameters; 4, block; 5, identifier:file_list; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""
Sorts a list of files into types.
:param file_list: List of file paths.
:return: {exte... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 14, 18; 14, 19; 17, 20; 17, 21; 18, 22; 19, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 27, 34; 28, 35; 31, 36; 31, 37; 32, 38; 33, 39; 33, 40; 36, 41; 36, 42; 40, 43; ... | def sort_by_type(file_list):
"""
Sorts a list of files into types.
:param file_list: List of file paths.
:return: {extension: [<list of file paths with that extension>]}
"""
ret_dict = defaultdict(list)
for filepath in file_list:
_, ext = os.path.splitext(filepath)
ret_dict[... |
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query_string; 7, expression_statement; 8, expression_statement; 9, comment:# TODO: should QueryParser be a method of query? should it return one?; 10, expression_statement; 11, expression_statement; 12... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 10, 15; 11, 16; 12, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 19, 26; 19, 27; 21, 28; 21, 29; 22, 30; 22, 31; 24, 32; 24, 33; 25, 34; 26, 35; 26, 36; 29, 37; 29, 38 | def search(self, query_string):
"""Performs a search against the index using lunr query syntax.
Results will be returned sorted by their score, the most relevant
results will be returned first.
For more programmatic querying use `lunr.Index.query`.
Args:
query_stri... |
0, module; 1, function_definition; 2, function_name:mode_half_sample; 3, parameters; 4, block; 5, identifier:a; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, identifier:is_sorted; 13, False; 14, string:'''
Estimate the mode u... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 11, 23; 11, 24; 15, 25; 15, 26; 16, 27; 17, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 26, 40; 26, 41; 28, 42; 29, 43; 31,... | def mode_half_sample(a, is_sorted=False):
'''
Estimate the mode using the Half Sample mode.
A method to estimate the mode, as described in
D. R. Bickel and R. Frühwirth (contributed equally),
"On a fast, robust estimator of the mode: Comparisons to other
robust estimators with applications,"
... |
0, module; 1, function_definition; 2, function_name:construct_reference_system; 3, parameters; 4, block; 5, identifier:symbols; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, commen... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 6, 28; 6, 29; 7, 30; 7, 31; 8, 32; 9, 33; 9, 34; 9, 35; 10, 36; 11, 37; 12, 38; 12, 39; 12, 40; 13, 41; 16, 42; 16, 43; 16, 44; 17, 45; 18, ... | def construct_reference_system(
symbols,
candidates=None,
options=None,
):
"""Take a list of symbols and construct gas phase
references system, when possible avoiding O2.
Candidates can be rearranged, where earlier candidates
get higher preference than later candidates
assume symbols so... |
0, module; 1, function_definition; 2, function_name:gen_triplets_master; 3, parameters; 4, block; 5, identifier:wv_master; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, comment:# Check that the wavelengths in the master table are sorted; 11, expression_statement; 12, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 6, 36; 6, 37; 7, 38; 7, 39; 8, 40; 9, 41; 11, 42; 12, 43; 12, 44; 12, 45; 18, 46; 19... | def gen_triplets_master(wv_master, geometry=None, debugplot=0):
"""Compute information associated to triplets in master table.
Determine all the possible triplets that can be generated from the
array `wv_master`. In addition, the relative position of the
central line of each triplet is also computed.
... |
0, module; 1, function_definition; 2, function_name:shortlex; 3, parameters; 4, block; 5, identifier:start; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, while_statement; 12, identifier:excludestart; 13, False; 14, comment:"""Yield all unions of start... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 11, 19; 15, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 21, 26; 23, 27; 23, 28; 24, 29; 25, 30; 25, 31; 26, 32; 27, 33; 27, 34; 28, 35; 29, 36; 29, 37; 31, 38; 31, 39; 31, 40; 31, 41; 35, 42; 36, 43; 3... | def shortlex(start, other, excludestart=False):
"""Yield all unions of start with other in shortlex order.
>>> ['{:03b}'.format(s) for s in shortlex(0, [0b100, 0b010, 0b001])]
['000', '100', '010', '001', '110', '101', '011', '111']
>>> ', '.join(''.join(sorted(s))
... for s in shortlex(set(), [{'... |
0, module; 1, function_definition; 2, function_name:reverse_shortlex; 3, parameters; 4, block; 5, identifier:end; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, while_statement; 12, identifier:excludeend; 13, False; 14, comment:"""Yield all intersectio... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 11, 19; 15, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 21, 26; 23, 27; 23, 28; 24, 29; 25, 30; 25, 31; 26, 32; 27, 33; 27, 34; 28, 35; 29, 36; 29, 37; 31, 38; 31, 39; 31, 40; 31, 41; 35, 42; 36, 43; 3... | def reverse_shortlex(end, other, excludeend=False):
"""Yield all intersections of end with other in reverse shortlex order.
>>> ['{:03b}'.format(s) for s in reverse_shortlex(0b111, [0b011, 0b101, 0b110])]
['111', '011', '101', '110', '001', '010', '100', '000']
>>> ', '.join(''.join(sorted(s))
...... |
0, module; 1, function_definition; 2, function_name:set_sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, expression_statement; 8, comment:# Look for 'sort' in get request. If not available use default.; 9, expression_statement; 10, if_statement; 11, comment:# Invalid sort requests fail silen... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 9, 15; 10, 16; 10, 17; 10, 18; 12, 19; 12, 20; 13, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 26, 39; 27, 40; 28, 41; 28, 42; 29, 43; ... | def set_sort(self, request):
"""
Take the sort parameter from the get parameters and split it into
the field and the prefix
"""
# Look for 'sort' in get request. If not available use default.
sort_request = request.GET.get(self.sort_parameter, self.default_sort)
i... |
0, module; 1, function_definition; 2, function_name:get_next_sort_string; 3, parameters; 4, block; 5, identifier:self; 6, identifier:field; 7, expression_statement; 8, comment:# self.sort_field is the currect sort field; 9, if_statement; 10, return_statement; 11, comment:"""
If we're already sorted by the field... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 9, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 14, 19; 15, 20; 15, 21; 17, 22; 17, 23; 18, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 24, 30; 24, 31; 25, 32; 26, 33; 31, 34; 31, 35; 32, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 38, 43;... | def get_next_sort_string(self, field):
"""
If we're already sorted by the field then the sort query
returned reverses the sort order.
"""
# self.sort_field is the currect sort field
if field == self.sort_field:
next_sort = self.toggle_sort_order() + field
... |
0, module; 1, function_definition; 2, function_name:get_sort_indicator; 3, parameters; 4, block; 5, identifier:self; 6, identifier:field; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Returns a sort class for the active sort only. That is, if field is n... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 19, 22; 19, 23; 20, 24; 21, 25; 21, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 28, 32; 29, 33; 29, 34; 30, 35; 31, 36; 36, 37; 36, 38; 38, 39 | def get_sort_indicator(self, field):
"""
Returns a sort class for the active sort only. That is, if field is not
sort_field, then nothing will be returned becaues the sort is not
active.
"""
indicator = ''
if field == self.sort_field:
indicator = 'sort... |
0, module; 1, function_definition; 2, function_name:get_basic_sort_link; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, identifier:field; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comment:"""
Thanks to del_quer... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 11, 16; 11, 17; 11, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 17, 25; 18, 26; 21, 27; 21, 28; 23, 29; 23, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 29, 38; 29, 39; 30, 40; 31, 41; 31, 42; 33, 43;... | def get_basic_sort_link(self, request, field):
"""
Thanks to del_query_parameters and get_querystring, we build the link
with preserving interesting get parameters and removing the others
"""
query_string = self.get_querystring()
sort_string = self.get_next_sort_string(fi... |
0, module; 1, function_definition; 2, function_name:options; 3, parameters; 4, block; 5, identifier:cls; 6, expression_statement; 7, return_statement; 8, comment:"""Provide a sorted list of options."""; 9, call; 10, identifier:sorted; 11, generator_expression; 12, tuple; 13, for_in_clause; 14, if_clause; 15, identifier... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 11, 13; 11, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 22, 25; 22, 26; 24, 27; 24, 28; 25, 29; 25, 30; 27, 31; 27, 32; 28, 33; 33, 34 | def options(cls):
"""Provide a sorted list of options."""
return sorted((value, name) for (name, value) in cls.__dict__.items() if not name.startswith('__')) |
0, module; 1, function_definition; 2, function_name:combine_dicts; 3, parameters; 4, block; 5, list_splat_pattern; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, comment:# Return combined dict.; 11, return_statement; 12, identifier:dicts; 13, identifier:copy; 14, False; 15, id... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 5, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 9, 18; 9, 19; 9, 20; 9, 21; 11, 22; 18, 23; 18, 24; 20, 25; 21, 26; 22, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 26, 35; 26, 36; 26, 37; 27, 38; 27, 39; 30, 40; 30, 41; 34, 42; 34, 43; 35, 44... | def combine_dicts(*dicts, copy=False, base=None):
"""
Combines multiple dicts in one.
:param dicts:
A sequence of dicts.
:type dicts: dict
:param copy:
If True, it returns a deepcopy of input values.
:type copy: bool, optional
:param base:
Base dict where combine m... |
0, module; 1, function_definition; 2, function_name:kk_dict; 3, parameters; 4, block; 5, list_splat_pattern; 6, dictionary_splat_pattern; 7, expression_statement; 8, for_statement; 9, return_statement; 10, identifier:kk; 11, identifier:adict; 12, comment:"""
Merges and defines dictionaries with values identical to ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 5, 10; 6, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 15, 17; 17, 18; 17, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 26, 34; 26, 35; 27, 36; 28, 37; 31, 38; 32, 39; 33, 40; 33, 41; 36, 42; 37, 43; 3... | def kk_dict(*kk, **adict):
"""
Merges and defines dictionaries with values identical to keys.
:param kk:
A sequence of keys and/or dictionaries.
:type kk: object | dict, optional
:param adict:
A dictionary.
:type adict: dict, optional
:return:
Merged dictionary.
... |
0, module; 1, function_definition; 2, function_name:map_dict; 3, parameters; 4, block; 5, identifier:key_map; 6, list_splat_pattern; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, comment:# Combine dicts.; 12, expression_statement; 13, comment:# Namespace shortcut.; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 10, 22; 12, 23; 15, 24; 22, 25; 22, 26; 23, 27; 23, 28; 24, 29; 24, 30; 26, 31; 26, 32; 28, 33; 28, 34; 30, 35; 30, 36; 30, 37; 31, 38; 31, 39; 35, 40; 35, 41; 36, 42; 36, 43; 37, 44... | def map_dict(key_map, *dicts, copy=False, base=None):
"""
Returns a dict with new key values.
:param key_map:
A dictionary that maps the dict keys ({old key: new key}
:type key_map: dict
:param dicts:
A sequence of dicts.
:type dicts: dict
:param copy:
If True, it ... |
0, module; 1, function_definition; 2, function_name:map_list; 3, parameters; 4, block; 5, identifier:key_map; 6, list_splat_pattern; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, comment:# Initialize empty dict.; 12, for_statement; 13, return_statement; 14, identifie... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 12, 21; 12, 22; 12, 23; 13, 24; 20, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30; 23, 31; 24, 32; 24, 33; 26, 34; 26, 35; 26, 36; 30, 37; 30, 38; 31, 39; 31, 40; 31, 41; 31, 42; 33, 43; 33, ... | def map_list(key_map, *inputs, copy=False, base=None):
"""
Returns a new dict.
:param key_map:
A list that maps the dict keys ({old key: new key}
:type key_map: list[str | dict | list]
:param inputs:
A sequence of data.
:type inputs: iterable | dict | int | float | list | tuple... |
0, module; 1, function_definition; 2, function_name:selector; 3, parameters; 4, block; 5, identifier:keys; 6, identifier:dictionary; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, if_statement; 13, comment:# Select as dict.; 14, return_statement; 15, id... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 11, 23; 11, 24; 11, 25; 12, 26; 12, 27; 12, 28; 12, 29; 14, 30; 18, 31; 22, 32; 24, 33; 25, 34; 26, 35; 26, 36; 28, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 33, 43; 33, 4... | def selector(keys, dictionary, copy=False, output_type='dict',
allow_miss=False):
"""
Selects the chosen dictionary keys from the given dictionary.
:param keys:
Keys to select.
:type keys: list, tuple, set
:param dictionary:
A dictionary.
:type dictionary: dict
... |
0, module; 1, function_definition; 2, function_name:difference; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, return_statement; 14, identifier:other... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 13, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 20, 30; 20, 31; 21, 32; 22, 33; 22, 34; 25, 35; 25, 36; 27, 37; 27, 38; 29, 39; 29, 40; 31, 41; 31, 42; 32, 43; 32... | def difference(self, *others):
r"""Return a new multiset with all elements from the others removed.
>>> ms = Multiset('aab')
>>> sorted(ms.difference('bc'))
['a', 'a']
You can also use the ``-`` operator for the same effect. However, the operator version
will only accep... |
0, module; 1, function_definition; 2, function_name:union; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, return_statement; 14, identifier:others; 15... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 13, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 20, 30; 20, 31; 21, 32; 22, 33; 22, 34; 25, 35; 25, 36; 27, 37; 27, 38; 29, 39; 29, 40; 31, 41; 31, 42; 32, 43; 32... | def union(self, *others):
r"""Return a new multiset with all elements from the multiset and the others with maximal multiplicities.
>>> ms = Multiset('aab')
>>> sorted(ms.union('bc'))
['a', 'a', 'b', 'c']
You can also use the ``|`` operator for the same effect. However, the ope... |
0, module; 1, function_definition; 2, function_name:intersection; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, return_statement; 14, identifier:oth... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 13, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 20, 30; 20, 31; 21, 32; 22, 33; 22, 34; 25, 35; 25, 36; 27, 37; 27, 38; 29, 39; 29, 40; 31, 41; 31, 42; 32, 43; 32... | def intersection(self, *others):
r"""Return a new multiset with elements common to the multiset and all others.
>>> ms = Multiset('aab')
>>> sorted(ms.intersection('abc'))
['a', 'b']
You can also use the ``&`` operator for the same effect. However, the operator version
... |
0, module; 1, function_definition; 2, function_name:symmetric_difference; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 7, 18; 8, 19; 9, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 15, 26; 15, 27; 15, 28; 16, 29; 17, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, 4... | def symmetric_difference(self, other):
r"""Return a new set with elements in either the set or other but not both.
>>> ms = Multiset('aab')
>>> sorted(ms.symmetric_difference('abc'))
['a', 'c']
You can also use the ``^`` operator for the same effect. However, the operator versi... |
0, module; 1, function_definition; 2, function_name:times; 3, parameters; 4, block; 5, identifier:self; 6, identifier:factor; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, return_statement; 15, comment:"""R... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 12, 22; 12, 23; 12, 24; 13, 25; 14, 26; 16, 27; 16, 28; 17, 29; 18, 30; 18, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 24, 37; 25, 38; 25, 39; 29, 40; 32, 41; 34, 42; 34, 43; 36, ... | def times(self, factor):
"""Return a new set with each element's multiplicity multiplied with the given scalar factor.
>>> ms = Multiset('aab')
>>> sorted(ms.times(2))
['a', 'a', 'a', 'a', 'b', 'b']
You can also use the ``*`` operator for the same effect:
>>> sorted(ms... |
0, module; 1, function_definition; 2, function_name:union_update; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, identifier:others; 13, comment:r"""Update the multiset, adding... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 17, 25; 18, 26; 19, 27; 19, 28; 21, 29; 21, 30; 23, 31; 23, 32; 25, 33; 25, 34; 26, 35; 26, 36; 26, 37; 27, 38; 27, 39; 33, 40; 33, 41; 35, 42; 35, 43; ... | def union_update(self, *others):
r"""Update the multiset, adding elements from all others using the maximum multiplicity.
>>> ms = Multiset('aab')
>>> ms.union_update('bc')
>>> sorted(ms)
['a', 'a', 'b', 'c']
You can also use the ``|=`` operator for the same effect. How... |
0, module; 1, function_definition; 2, function_name:intersection_update; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, for_statement; 9, identifier:others; 10, comment:r"""Update the multiset, keeping only elements found in it and all others.
>>> ms = Multiset(... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 8, 13; 12, 14; 12, 15; 13, 16; 15, 17; 15, 18; 16, 19; 16, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 21, 29; 27, 30; 28, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 34, 41; 34, 42; 37, 43... | def intersection_update(self, *others):
r"""Update the multiset, keeping only elements found in it and all others.
>>> ms = Multiset('aab')
>>> ms.intersection_update('bc')
>>> sorted(ms)
['b']
You can also use the ``&=`` operator for the same effect. However, the opera... |
0, module; 1, function_definition; 2, function_name:difference_update; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, for_statement; 9, identifier:others; 10, comment:r"""Remove all elements contained the others from this multiset.
>>> ms = Multiset('aab')
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 8, 13; 12, 14; 12, 15; 13, 16; 15, 17; 15, 18; 16, 19; 16, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 26, 29; 26, 30; 28, 31; 31, 32; 31, 33; 32, 34; 32, 35; 33, 36; 33, 37 | def difference_update(self, *others):
r"""Remove all elements contained the others from this multiset.
>>> ms = Multiset('aab')
>>> ms.difference_update('abc')
>>> sorted(ms)
['a']
You can also use the ``-=`` operator for the same effect. However, the operator version
... |
0, module; 1, function_definition; 2, function_name:symmetric_difference_update; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, comment:r"""Update the multiset to contain only elements in either this mul... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 10, 14; 10, 15; 10, 16; 12, 17; 12, 18; 13, 19; 13, 20; 16, 21; 16, 22; 16, 23; 18, 24; 18, 25; 20, 26; 20, 27; 21, 28; 22, 29; 23, 30; 24, 31; 24, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43... | def symmetric_difference_update(self, other):
r"""Update the multiset to contain only elements in either this multiset or the other but not both.
>>> ms = Multiset('aab')
>>> ms.symmetric_difference_update('abc')
>>> sorted(ms)
['a', 'c']
You can also use the ``^=`` ope... |
0, module; 1, function_definition; 2, function_name:times_update; 3, parameters; 4, block; 5, identifier:self; 6, identifier:factor; 7, expression_statement; 8, if_statement; 9, comment:"""Update each this multiset by multiplying each element's multiplicity with the given scalar factor.
>>> ms = Multiset('aab'... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 8, 12; 8, 13; 10, 14; 10, 15; 11, 16; 12, 17; 12, 18; 13, 19; 16, 20; 17, 21; 17, 22; 18, 23; 19, 24; 19, 25; 19, 26; 20, 27; 20, 28; 23, 29; 24, 30; 25, 31; 25, 32; 25, 33; 26, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 33, 40; 34, 41; 34, 42; 36, 43... | def times_update(self, factor):
"""Update each this multiset by multiplying each element's multiplicity with the given scalar factor.
>>> ms = Multiset('aab')
>>> ms.times_update(2)
>>> sorted(ms)
['a', 'a', 'a', 'a', 'b', 'b']
You can also use the ``*=`` operator for t... |
0, module; 1, function_definition; 2, function_name:add; 3, parameters; 4, block; 5, identifier:self; 6, identifier:element; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, identifier:multiplicity; 13, integer:1; 14, comment:"""Adds an element to t... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 26, 31; 26, 32; 27, 33; 27, 34; 32, 35 | def add(self, element, multiplicity=1):
"""Adds an element to the multiset.
>>> ms = Multiset()
>>> ms.add('a')
>>> sorted(ms)
['a']
An optional multiplicity can be specified to define how many of the element are added:
>>> ms.add('b', 2)
>>> sorted(ms)... |
0, module; 1, function_definition; 2, function_name:remove; 3, parameters; 4, block; 5, identifier:self; 6, identifier:element; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:multiplicity; 15, Non... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 12, 24; 13, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 27, 41; 27, 42; 30, 43; 32... | def remove(self, element, multiplicity=None):
"""Removes an element from the multiset.
If no multiplicity is specified, the element is completely removed from the multiset:
>>> ms = Multiset('aabbbc')
>>> ms.remove('a')
2
>>> sorted(ms)
['b', 'b', 'b', 'c']
... |
0, module; 1, function_definition; 2, function_name:discard; 3, parameters; 4, block; 5, identifier:self; 6, identifier:element; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, identifier:multiplicity; 12, None; 13, comment:"""Removes the `element` from the multiset.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 16, 24; 17, 25; 19, 26; 19, 27; 22, 28; 23, 29; 23, 30; 23, 31; 23, 32; 24, 33; 25, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 32, 43;... | def discard(self, element, multiplicity=None):
"""Removes the `element` from the multiset.
If multiplicity is ``None``, all occurrences of the element are removed:
>>> ms = Multiset('aab')
>>> ms.discard('a')
2
>>> sorted(ms)
['b']
Otherwise, the multip... |
0, module; 1, function_definition; 2, function_name:_see_node; 3, parameters; 4, block; 5, identifier:self; 6, identifier:node_id; 7, identifier:fringe; 8, identifier:dist; 9, default_parameter; 10, expression_statement; 11, comment:# Namespace shortcuts.; 12, expression_statement; 13, expression_statement; 14, comment... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 9, 20; 9, 21; 10, 22; 12, 23; 13, 24; 15, 25; 18, 26; 18, 27; 18, 28; 18, 29; 19, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 28, 43; 29, 44... | def _see_node(self, node_id, fringe, dist, w_wait_in=0):
"""
See a node, updating seen and fringe.
:param node_id:
Node id to see.
:type node_id: str
:param fringe:
Heapq of closest available nodes.
:type fringe: list[(float | int, bool, (str, Di... |
0, module; 1, function_definition; 2, function_name:_add_compounds; 3, parameters; 4, block; 5, identifier:self; 6, identifier:variant_obj; 7, identifier:info_dict; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, comment:#Sort the compounds based on rank score; 13, expr... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 13, 20; 14, 21; 14, 22; 14, 23; 16, 24; 16, 25; 17, 26; 17, 27; 19, 28; 20, 29; 20, 30; 23, 31; 27, 32; 27, 33; 28, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 32, 42; 32, 43; 3... | def _add_compounds(self, variant_obj, info_dict):
"""Check if there are any compounds and add them to the variant
The compounds that are added should be sorted on rank score
"""
compound_list = []
compound_entry = info_dict.get('Compounds')
if compound_entry:... |
0, module; 1, function_definition; 2, function_name:dump_xml; 3, parameters; 4, block; 5, identifier:props; 6, identifier:fp; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, identifier:comment; 15, Non... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 13, 24; 13, 25; 17, 26; 21, 27; 21, 28; 22, 29; 22, 30; 24, 31; 24, 32; 25, 33; 28, 34; 28, 35; 30, 36; 30, 37; 32, 38; 32, 39; 32, 40; 33, 41; 34, 42; 34, 43; 35, ... | def dump_xml(props, fp, comment=None, encoding='UTF-8', sort_keys=False):
"""
Write a series ``props`` of key-value pairs to a binary filehandle ``fp``
in the format of an XML properties file. The file will include both an XML
declaration and a doctype declaration.
:param props: A mapping or itera... |
0, module; 1, function_definition; 2, function_name:dumps_xml; 3, parameters; 4, block; 5, identifier:props; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:comment; 11, None; 12, identifier:sort_keys; 13, False; 14, comment:"""
Convert a series ``props`` of ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 15, 16; 15, 17; 16, 18; 16, 19; 17, 20; 17, 21; 20, 22; 20, 23; 21, 24; 21, 25; 23, 26; 25, 27; 25, 28; 26, 29; 28, 30; 28, 31; 28, 32 | def dumps_xml(props, comment=None, sort_keys=False):
"""
Convert a series ``props`` of key-value pairs to a text string containing
an XML properties document. The document will include a doctype
declaration but not an XML declaration.
:param props: A mapping or iterable of ``(key, value)`` pairs t... |
0, module; 1, function_definition; 2, function_name:toposort; 3, parameters; 4, block; 5, identifier:graph; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, while_statement; 14, comment:# Nodes may... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 8, 20; 9, 21; 9, 22; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 13, 28; 15, 29; 15, 30; 16, 31; 18, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, 44; ... | def toposort(graph, pick_first='head'):
"""Toplogically sorts a list match graph.
Tries to perform a topological sort using as tiebreaker the pick_first
argument. If the graph contains cycles, raise ValueError.
"""
in_deg = {}
for node, next_nodes in six.iteritems(graph):
for next_node ... |
0, module; 1, function_definition; 2, function_name:sort_cyclic_graph_best_effort; 3, parameters; 4, block; 5, identifier:graph; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# Go first on the pick_first chain then go back again on the others; 11, comment:#... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 6, 19; 6, 20; 7, 21; 8, 22; 9, 23; 13, 24; 13, 25; 13, 26; 14, 27; 15, 28; 15, 29; 16, 30; 17, 31; 17, 32; 18, 33; 20, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 26, 42; 27, 43; 27, 44; ... | def sort_cyclic_graph_best_effort(graph, pick_first='head'):
"""Fallback for cases in which the graph has cycles."""
ordered = []
visited = set()
# Go first on the pick_first chain then go back again on the others
# that were not visited. Given the way the graph is built both chains
# will alway... |
0, module; 1, function_definition; 2, function_name:dump; 3, parameters; 4, block; 5, identifier:props; 6, identifier:fp; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, if_statement; 14, for_statement; 15, identifier:separator; 16... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 12, 24; 12, 25; 13, 26; 13, 27; 14, 28; 14, 29; 14, 30; 16, 31; 24, 32; 24, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 34, 43; 35, 4... | def dump(props, fp, separator='=', comments=None, timestamp=True,
sort_keys=False):
"""
Write a series of key-value pairs to a file in simple line-oriented
``.properties`` format.
:param props: A mapping or iterable of ``(key, value)`` pairs to write to
``fp``. All keys and values in ... |
0, module; 1, function_definition; 2, function_name:dumps; 3, parameters; 4, block; 5, identifier:props; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:separator; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 12, 24; 13, 25; 15, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 28, 33; 28, 34; 30, 35; 30, 36; 30, 37; 30, 38; 30, 39; 30, 40; 31, 41; 31, 42; 37, 43; 37, 44... | def dumps(props, separator='=', comments=None, timestamp=True, sort_keys=False):
"""
Convert a series of key-value pairs to a text string in simple
line-oriented ``.properties`` format.
:param props: A mapping or iterable of ``(key, value)`` pairs to serialize.
All keys and values in ``props`` ... |
0, module; 1, function_definition; 2, function_name:_zadd; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:pk; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, return_statement; 12, identifier:ts; 13, None; 14, identifier:ttl; 15, None; 16, comment:"""Redis lua fun... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 8, 12; 8, 13; 9, 14; 9, 15; 10, 16; 11, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 19, 24; 19, 25; 19, 26; 20, 27; 20, 28; 22, 29; 22, 30; 25, 31; 25, 32; 32, 33; 32, 34; 33, 35; 33, 36 | def _zadd(self, key, pk, ts=None, ttl=None):
"""Redis lua func to add an event to the corresponding sorted set.
:param key: the key to be stored in redis server
:param pk: the primary key of event
:param ts: timestamp of the event, default to redis_server's
current timestamp
... |
0, module; 1, function_definition; 2, function_name:add; 3, parameters; 4, block; 5, identifier:self; 6, identifier:event; 7, identifier:pk; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, try_statement; 13, identifier:ts; 14, None; 15, identifier:ttl; 16, None; 17, c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 8, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 20, 26; 20, 27; 20, 28; 20, 29; 22, 30; 22, 31; 23, 32; 24, 33; 25, 34; 25, 35; 29, 36; 29, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43; 3... | def add(self, event, pk, ts=None, ttl=None):
"""Add an event to event store.
All events were stored in a sorted set in redis with timestamp as
rank score.
:param event: the event to be added, format should be ``table_action``
:param pk: the primary key of event
:param ... |
0, module; 1, function_definition; 2, function_name:group; 3, parameters; 4, block; 5, identifier:iterable; 6, identifier:key; 7, expression_statement; 8, for_statement; 9, comment:"""
groupby which sorts the input, discards the key and returns the output
as a sequence of lists.
"""; 10, pattern_list; 11, c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 8, 12; 10, 13; 10, 14; 11, 15; 11, 16; 12, 17; 16, 18; 16, 19; 17, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 22, 26; 22, 27; 25, 28; 25, 29; 27, 30; 27, 31; 29, 32 | def group(iterable, key):
"""
groupby which sorts the input, discards the key and returns the output
as a sequence of lists.
"""
for _, grouped in groupby(sorted(iterable, key=key), key=key):
yield list(grouped) |
0, module; 1, function_definition; 2, function_name:sort_strings; 3, parameters; 4, block; 5, identifier:strings; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, function_definition; 14, return_statement; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 11, 25; 12, 26; 13, 27; 13, 28; 13, 29; 14, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 28, 36; 28, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 32, 43; 33, 44;... | def sort_strings(strings, sort_order=None, reverse=False, case_sensitive=False, sort_order_first=True):
"""Sort a list of strings according to the provided sorted list of string prefixes
TODO:
- Provide an option to use `.startswith()` rather than a fixed prefix length (will be much slower)
Argume... |
0, module; 1, function_definition; 2, function_name:clean_field_dict; 3, parameters; 4, block; 5, identifier:field_dict; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, for_statement; 12, return_statement; 13, identifier:cleaner; 14, attribute; 15, ide... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 14, 25; 14, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 31, 38; 35, 39; 36, 40; 36, 41; 37, 42; 37, 43; 37,... | def clean_field_dict(field_dict, cleaner=str.strip, time_zone=None):
r"""Normalize field values by stripping whitespace from strings, localizing datetimes to a timezone, etc
>>> (sorted(clean_field_dict({'_state': object(), 'x': 1, 'y': "\t Wash Me! \n" }).items()) ==
... [('x', 1), ('y', 'Wash Me!')])
... |
0, module; 1, function_definition; 2, function_name:best_fit; 3, parameters; 4, block; 5, identifier:li; 6, identifier:value; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, comment:"""For a sorted list li, returns the closest item to value"""; 12, assignment; 13, comparison_ope... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 10, 15; 10, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 15, 23; 15, 24; 16, 25; 17, 26; 19, 27; 19, 28; 21, 29; 21, 30; 22, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 26, 37; 28, 38; 28, 39; 30, 40; 30, 41; 32, 42; 32, 43;... | def best_fit(li, value):
"""For a sorted list li, returns the closest item to value"""
index = min(bisect_left(li, value), len(li) - 1)
if index in (0, len(li)):
return index
if li[index] - value < value - li[index-1]:
return index
else:
return index-1 |
0, module; 1, function_definition; 2, function_name:index_pix_in_pixels; 3, parameters; 4, block; 5, identifier:pix; 6, identifier:pixels; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# ADW: Not really safe to set index = -1 (accesses last entry);; 11, comment:# -np.inf would be bett... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 13, 23; 13, 24; 15, 25; 16, 26; 16, 27; 16, 28; 17, 29; 21, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 28, 37; 28, 38; 31, 39; 33, 40; 33, 41; 34, 42; 34, 43; 35, 44;... | def index_pix_in_pixels(pix,pixels,sort=False,outside=-1):
"""
Find the indices of a set of pixels into another set of pixels.
!!! ASSUMES SORTED PIXELS !!!
Parameters:
-----------
pix : set of search pixels
pixels : set of reference pixels
Returns:
--------
index : index ... |
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:text; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_pa... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 7, 25; 7, 26; 8, 27; 8, 28; 9, 29; 9, 30; 10, 31; 10, 32; 11, 33; 11, 34; 12, 35; 12, 36; 13, 37; 13, 38; 14, 39; 14, 40; 15, 41; 15, 42; 16, 43; 17, 44; 18, 45;... | def search(self, text, includes=None, doc_type=None, limit=None,
autocomplete=False, promulgated_only=False, tags=None,
sort=None, owner=None, series=None):
'''
Search for entities in the charmstore.
@param text The text to search for.
@param includes What ... |
0, module; 1, function_definition; 2, function_name:list; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, if_statement; 15, expressio... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 10, 26; 11, 27; 11, 28; 12, 29; 13, 30; 14, 31; 14, 32; 14, 33; 15, 34; 16, 35; 29, 36; 30, 37; 30, 38; 31, 39; 31, 40; 32, 41; 33, 42; 34, 43; 34, 44; 3... | def list(self, includes=None, doc_type=None, promulgated_only=False,
sort=None, owner=None, series=None):
'''
List entities in the charmstore.
@param includes What metadata to return in results (e.g. charm-config).
@param doc_type Filter to this type: bundle or charm.
... |
0, module; 1, function_definition; 2, function_name:_common_query_parameters; 3, parameters; 4, block; 5, identifier:self; 6, identifier:doc_type; 7, identifier:includes; 8, identifier:owner; 9, identifier:promulgated_only; 10, identifier:series; 11, identifier:sort; 12, expression_statement; 13, expression_statement; ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 12, 21; 13, 22; 14, 23; 14, 24; 15, 25; 15, 26; 16, 27; 16, 28; 17, 29; 17, 30; 18, 31; 18, 32; 19, 33; 19, 34; 20, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 25, 42; 25, 43; 26, 4... | def _common_query_parameters(self, doc_type, includes, owner,
promulgated_only, series, sort):
'''
Extract common query parameters between search and list into slice.
@param includes What metadata to return in results (e.g. charm-config).
@param doc_type... |
0, module; 1, function_definition; 2, function_name:letter_scales; 3, parameters; 4, block; 5, identifier:counts; 6, expression_statement; 7, try_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Convert letter counts to frequencies, sorted increasing."""; 12, block; 13, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 10, 16; 12, 17; 13, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 15, 24; 17, 25; 20, 26; 22, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 25, 33; 25, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 32, 41; 32, 42; 34, 43; ... | def letter_scales(counts):
"""Convert letter counts to frequencies, sorted increasing."""
try:
scale = 1.0 / sum(counts.values())
except ZeroDivisionError:
# This logo is all gaps, nothing can be done
return []
freqs = [(aa, cnt*scale) for aa, cnt in counts.iteritems() if cnt]
... |
0, module; 1, function_definition; 2, function_name:_push_subtree; 3, parameters; 4, block; 5, identifier:self; 6, typed_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, comment:# in general we want the highest bit, but here it's also the lowest bit; 11, comment:# so just reuse that cod... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 8, 23; 9, 24; 9, 25; 12, 26; 13, 27; 13, 28; 14, 29; 15, 30; 16, 31; 16, 32; 17, 33; 18, 34; 19, 35; 19, 36; 21, 37; 23, 38; 23, 39; 24, 40; 24, 41; 25, 42; 26, 43; 26, 44; 27... | def _push_subtree(self, leaves: List[bytes]):
"""Extend with a full subtree <= the current minimum subtree.
The leaves must form a full subtree, i.e. of size 2^k for some k. If
there is a minimum subtree (i.e. __mintree_height > 0), then the input
subtree must be smaller or of equal siz... |
0, module; 1, function_definition; 2, function_name:_sort_cards; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, identifier:list; 9, expression_statement; 10, return_statement; 11, identifier:cards; 12, type; 13, string; 14, call; 15, identifier:Generator; 16, string_content:sort cards by b... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 7, 11; 7, 12; 9, 13; 10, 14; 12, 15; 13, 16; 14, 17; 14, 18; 18, 19; 18, 20; 19, 21; 19, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 30, 31; 30, 32; 30, 33; 31, 34; 32, 35; 33, 36 | def _sort_cards(self, cards: Generator) -> list:
'''sort cards by blocknum and blockseq'''
return sorted([card.__dict__ for card in cards],
key=itemgetter('blocknum', 'blockseq', 'cardseq')) |
0, module; 1, function_definition; 2, function_name:sort_aliases; 3, parameters; 4, block; 5, identifier:self; 6, identifier:aliases; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Sorts the given aliases list, returns a sorted list.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 9, 15; 10, 16; 11, 17; 13, 18; 13, 19; 14, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 17, 26; 18, 27; 18, 28; 21, 29; 23, 30; 23, 31; 25, 32; 25, 33; 26, 34; 30, 35; 30, 36; 34, 37; 34, 38; 35, 39; 35, 40; 39, 41; 39, 42; 40, 43; ... | def sort_aliases(self, aliases):
"""Sorts the given aliases list, returns a sorted list.
:param list aliases:
:return: sorted aliases list
"""
self._cache_init()
if not aliases:
return aliases
parent_aliases = self._cache_get_entry(self.CACHE_NAME_PAR... |
0, module; 1, function_definition; 2, function_name:contigs_to_positions; 3, parameters; 4, block; 5, identifier:contigs; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:binning; 13, integer:10000; 14, comment:"""Bu... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 19, 31; 22, 32; 22, 33; 27, 34; 27, 35; 28, 36; 29, 37; 30, 38; 31, 39; 32, 40; 32, 41; 33, 42; 37, 43; 3... | def contigs_to_positions(contigs, binning=10000):
"""Build positions from contig labels
From a list of contig labels and a binning parameter,
build a list of positions that's essentially a
concatenation of linspaces with step equal to the
binning.
Parameters
----------
contigs : list o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.