nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:register; 3, parameters; 4, block; 5, identifier:self; 6, identifier:func; 7, identifier:order; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""
Add a function to the fi... | 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; 12, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 24, 32; 24, 33; 26, 34; 26, 35; 28, 36; 28, 37; 28, 38; 29, 39; 29, 40; 31, 41; 31, 42; 42, 43;... | def register(self, func, order):
"""
Add a function to the filter chain.
:param func: A callable which is to be added to the filter chain.
:param order: An object indicating the ordering of the function
relative to the others.
:return: Token representing th... |
0, module; 1, function_definition; 2, function_name:get_features; 3, parameters; 4, block; 5, identifier:self; 6, identifier:jid; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""
Return the features supported by a service.
... | 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; 10, 15; 10, 16; 10, 17; 11, 18; 13, 19; 13, 20; 14, 21; 14, 22; 16, 23; 16, 24; 17, 25; 20, 26; 22, 27; 22, 28; 25, 29; 25, 30; 26, 31; 26, 32; 29, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 33, 39; 35, 40; 36, 41; 36, 42; 39, 43;... | def get_features(self, jid):
"""
Return the features supported by a service.
:param jid: Address of the PubSub service to query.
:type jid: :class:`aioxmpp.JID`
:return: Set of supported features
:rtype: set containing :class:`~.pubsub.xso.Feature` enumeration
... |
0, module; 1, function_definition; 2, function_name:intersect; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Intersect with `other` sorted index.
Parameters
----------
other : array_like, i... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 22, 27; 22, 28; 26, 29; 26, 30 | def intersect(self, other):
"""Intersect with `other` sorted index.
Parameters
----------
other : array_like, int
Array of values to intersect with.
Returns
-------
out : SortedIndex
Values in common.
Examples
--------
... |
0, module; 1, function_definition; 2, function_name:locate_intersection_ranges; 3, parameters; 4, block; 5, identifier:self; 6, identifier:starts; 7, identifier:stops; 8, expression_statement; 9, comment:# check inputs; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:# find ind... | 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; 8, 22; 10, 23; 11, 24; 12, 25; 14, 26; 15, 27; 17, 28; 19, 29; 20, 30; 20, 31; 20, 32; 21, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44;... | def locate_intersection_ranges(self, starts, stops):
"""Locate the intersection with a set of ranges.
Parameters
----------
starts : array_like, int
Range start values.
stops : array_like, int
Range stop values.
Returns
-------
lo... |
0, module; 1, function_definition; 2, function_name:locate_ranges; 3, parameters; 4, block; 5, identifier:self; 6, identifier:starts; 7, identifier:stops; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:strict; 14, True; 15, comment:"""Loca... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 12, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 20, 25; 20, 26; 21, 27; 21, 28; 23, 29; 23, 30; 24, 31; 27, 32; 27, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 31, 39; 31, 40; 38, 41; 40, 42; 40, 43; ... | def locate_ranges(self, starts, stops, strict=True):
"""Locate items within the given ranges.
Parameters
----------
starts : array_like, int
Range start values.
stops : array_like, int
Range stop values.
strict : bool, optional
If True... |
0, module; 1, function_definition; 2, function_name:intersect_ranges; 3, parameters; 4, block; 5, identifier:self; 6, identifier:starts; 7, identifier:stops; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Intersect with a set of ranges.
Parameters
----------
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 10, 13; 12, 14; 12, 15; 13, 16; 13, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 19, 28; 23, 29; 23, 30; 28, 31; 28, 32 | def intersect_ranges(self, starts, stops):
"""Intersect with a set of ranges.
Parameters
----------
starts : array_like, int
Range start values.
stops : array_like, int
Range stop values.
Returns
-------
idx : SortedIndex
... |
0, module; 1, function_definition; 2, function_name:from_gff3; 3, parameters; 4, block; 5, identifier:path; 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, iden... | 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; 6, 15; 6, 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; 14, 30; 14, 31; 20, 32; 22, 33; 24, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 31, 40; 36, 41; 36, 42; 39, 43; 40, 44;... | def from_gff3(path, attributes=None, region=None, score_fill=-1, phase_fill=-1,
attributes_fill='.', dtype=None):
"""Read a feature table from a GFF3 format file.
Parameters
----------
path : string
File path.
attributes : list of strings, optional
... |
0, module; 1, function_definition; 2, function_name:iter_gff3; 3, parameters; 4, block; 5, identifier:path; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, comment:# prepare fill values for attributes; 14... | 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; 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; 14, 31; 14, 32; 16, 33; 16, 34; 16, 35; 16, 36; 17, 37; 17, 38; 23, 39; 25, 40; 27, 41; 29, 42; 31, 43; 31, 44; 32... | def iter_gff3(path, attributes=None, region=None, score_fill=-1,
phase_fill=-1, attributes_fill='.', tabix='tabix'):
"""Iterate over records in a GFF3 file.
Parameters
----------
path : string
Path to input file.
attributes : list of strings, optional
List of columns t... |
0, module; 1, function_definition; 2, function_name:gff3_to_recarray; 3, parameters; 4, block; 5, identifier:path; 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, comment:# read rec... | 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; 4, 18; 4, 19; 4, 20; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 11, 32; 12, 33; 12, 34; 13, 35; 15, 36; 16, 37; 16, 38; 18, 39; 18, 40; 19, 41; 20, 42; 26, 43; 28, 44; 30, 4... | def gff3_to_recarray(path, attributes=None, region=None, score_fill=-1,
phase_fill=-1, attributes_fill='.', tabix='tabix', dtype=None):
"""Load data from a GFF3 into a NumPy recarray.
Parameters
----------
path : string
Path to input file.
attributes : list of strings, ... |
0, module; 1, function_definition; 2, function_name:gff3_to_dataframe; 3, parameters; 4, block; 5, identifier:path; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, dictionary_splat_pattern; 13, expression_statement; 14, import_sta... | 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; 4, 18; 4, 19; 4, 20; 4, 21; 6, 22; 6, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 13, 35; 14, 36; 16, 37; 18, 38; 19, 39; 19, 40; 20, 41; 21, 42; 27, 43; 29, 44; 31, 45... | def gff3_to_dataframe(path, attributes=None, region=None, score_fill=-1,
phase_fill=-1, attributes_fill='.', tabix='tabix', **kwargs):
"""Load data from a GFF3 into a pandas DataFrame.
Parameters
----------
path : string
Path to input file.
attributes : list of strings... |
0, module; 1, function_definition; 2, function_name:voight_painting; 3, parameters; 4, block; 5, identifier:h; 6, expression_statement; 7, comment:# check inputs; 8, comment:# N.B., ensure int8 so we can use cython optimisation; 9, expression_statement; 10, if_statement; 11, if_statement; 12, comment:# sort by prefix; ... | 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; 4, 15; 4, 16; 4, 17; 6, 18; 9, 19; 10, 20; 10, 21; 11, 22; 11, 23; 13, 24; 14, 25; 16, 26; 17, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 22, 33; 22, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 29, ... | def voight_painting(h):
"""Paint haplotypes, assigning a unique integer to each shared haplotype
prefix.
Parameters
----------
h : array_like, int, shape (n_variants, n_haplotypes)
Haplotype array.
Returns
-------
painting : ndarray, int, shape (n_variants, n_haplotypes)
... |
0, module; 1, function_definition; 2, function_name:get_model_perms; 3, parameters; 4, block; 5, identifier:model; 6, expression_statement; 7, import_from_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""
Get permis... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 14, 21; 14, 22; 14, 23; 14, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 20, 35; 27, 36; 27, 37; 29, 38; 29, 39; 31, 40; 31, 41; 33, 42; 33, 43; 35... | def get_model_perms(model):
"""
Get permission-string list of a specified django model.
Parameters
----------
model : model class
A model class to specify the particular django model.
Returns
-------
set
A set of perms of the specified django model.
Examples
--... |
0, module; 1, function_definition; 2, function_name:sort_trigger_set; 3, parameters; 4, block; 5, identifier:triggers; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, comment:# KEEP IN MIND: the `triggers` array is composed of array elements of the form; 11, comment:# ["trigger... | 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; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 9, 25; 9, 26; 14, 27; 15, 28; 15, 29; 15, 30; 18, 31; 19, 32; 25, 33; 25, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 30, 44; 30,... | def sort_trigger_set(triggers, exclude_previous=True, say=None):
"""Sort a group of triggers in optimal sorting order.
The optimal sorting order is, briefly:
* Atomic triggers (containing nothing but plain words and alternation
groups) are on top, with triggers containing the most words coming
... |
0, module; 1, function_definition; 2, function_name:sort_list; 3, parameters; 4, block; 5, identifier:items; 6, expression_statement; 7, comment:# Track by number of words.; 8, expression_statement; 9, function_definition; 10, comment:# Loop through each item.; 11, for_statement; 12, comment:# Sort them.; 13, expressio... | 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; 4, 15; 6, 16; 8, 17; 9, 18; 9, 19; 9, 20; 11, 21; 11, 22; 11, 23; 11, 24; 13, 25; 14, 26; 14, 27; 14, 28; 15, 29; 17, 30; 17, 31; 19, 32; 19, 33; 20, 34; 24, 35; 24, 36; 24, 37; 25, 38; 25, 39; 27, 40; 27, 41; 28, 42; 28, 43; 34, 4... | def sort_list(items):
"""Sort a simple list by number of words and length."""
# Track by number of words.
track = {}
def by_length(word1, word2):
return len(word2) - len(word1)
# Loop through each item.
for item in items:
# Count the words.
cword = utils.word_count(ite... |
0, module; 1, function_definition; 2, function_name:sort_replies; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, comment:# (Re)initialize the sort cache.; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# Loop through all the topic... | 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; 6, 18; 6, 19; 7, 20; 9, 21; 10, 22; 11, 23; 13, 24; 13, 25; 13, 26; 15, 27; 15, 28; 16, 29; 17, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 25, 37; 25, 38; 26, 39; 26, 40; 26, 41; 26, 42; 26, 43; 26, 44... | def sort_replies(self, thats=False):
"""Sort the loaded triggers in memory.
After you have finished loading your RiveScript code, call this method
to populate the various internal sort buffers. This is absolutely
necessary for reply matching to work efficiently!
"""
# (R... |
0, module; 1, function_definition; 2, function_name:all; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:page; 12, integer:1; 13, identifier:per_page; 14, integer:10; 15, identifier:order_by; 16,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 10, 18; 18, 19; 18, 20; 19, 21; 19, 22; 20, 23; 20, 24; 20, 25; 20, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 26, 32 | def all(self, page=1, per_page=10, order_by="latest"):
"""
Get a single page from the list of all photos.
:param page [integer]: Page number to retrieve. (Optional; default: 1)
:param per_page [integer]: Number of items per page. (Optional; default: 10)
:param order_by [string]:... |
0, module; 1, function_definition; 2, function_name:photos; 3, parameters; 4, block; 5, identifier:self; 6, identifier:username; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:page; 15, ... | 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; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29; 25, 30; 25, 31; 27, 32; 27, 33; 28, 34; 28, 35; 29, 36; 30, 37; 30, 38; 31, 39; 32, 40; 32, 41; 33, 42; 33, 43; 33, ... | def photos(self, username, page=1, per_page=10, order_by="latest"):
"""
Get a list of photos uploaded by a user.
:param username [string]: The user’s username. Required.
:param page [integer]: Page number to retrieve. (Optional; default: 1)
:param per_page [integer]: Number of i... |
0, module; 1, function_definition; 2, function_name:callable; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, return_statement; 11, identifier:nans; 12, False; 13, comment:"""Compile a jitted function and loop it over the s... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 14, 19; 14, 20; 16, 21; 16, 22; 16, 23; 16, 24; 17, 25; 17, 26; 17, 27; 17, 28; 17, 29; 18, 30; 18, 31; 20, 32; 20, 33; 25, 34; 26, 35; 27, 36; 28, 37; 29, 38; 29, 39; 29, 40; 30, 41; 30, 42; 31, 43; 31... | def callable(self, nans=False):
"""Compile a jitted function and loop it over the sorted data."""
jitfunc = nb.njit(self.func, nogil=True)
def _loop(sortidx, group_idx, a, ret):
size = len(ret)
group_idx_srt = group_idx[sortidx]
a_srt = a[sortidx]
... |
0, module; 1, function_definition; 2, function_name:scores2recos; 3, parameters; 4, block; 5, identifier:self; 6, identifier:scores; 7, identifier:candidates; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:rev; 14, False; 15, comment:"""Ge... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 12, 19; 16, 20; 16, 21; 18, 22; 19, 23; 19, 24; 21, 25; 21, 26; 22, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 27, 35; 27, 36; 36, 37; 36, 38; 38, 39; 39, 40 | def scores2recos(self, scores, candidates, rev=False):
"""Get recommendation list for a user u_index based on scores.
Args:
scores (numpy array; (n_target_items,)):
Scores for the target items. Smaller score indicates a promising item.
candidates (numpy array; (#... |
0, module; 1, function_definition; 2, function_name:commutative_sequence_variable_partition_iter; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, generic_type; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, comment:# typ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 12, 27; 12, 28; 13, 29; 15, 30; 15, 31; 15, 32; 17, 33; 19, 34; 21, 35; 23, 36; 23, 37; 24, 38; 24, 39; 25, 40; 25, 41; 26, 42; 26, 43; 27, 44;... | def commutative_sequence_variable_partition_iter(values: Multiset, variables: List[VariableWithCount]
) -> Iterator[Dict[str, Multiset]]:
"""Yield all possible variable substitutions for given values and variables.
.. note::
The results are not yielded i... |
0, module; 1, function_definition; 2, function_name:iter_cookie_browse_sorting; 3, parameters; 4, block; 5, identifier:cookies; 6, expression_statement; 7, try_statement; 8, string; 9, block; 10, except_clause; 11, string_content:Get sorting-cookie from cookies dictionary.
:yields: tuple of path and sorting proper... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 8, 11; 9, 12; 9, 13; 10, 14; 10, 15; 12, 16; 13, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 20, 30; 20, 31; 20, 32; 21, 33; 22, 34; 24, 35; 24, 36; 27, 37; 27, 38; 28, 39; 29, 40; 34, 41; 34, 42; 35, 43... | def iter_cookie_browse_sorting(cookies):
'''
Get sorting-cookie from cookies dictionary.
:yields: tuple of path and sorting property
:ytype: 2-tuple of strings
'''
try:
data = cookies.get('browse-sorting', 'e30=').encode('ascii')
for path, prop in json.loads(base64.b64decode(dat... |
0, module; 1, function_definition; 2, function_name:get_cookie_browse_sorting; 3, parameters; 4, block; 5, identifier:path; 6, identifier:default; 7, expression_statement; 8, if_statement; 9, return_statement; 10, string; 11, identifier:request; 12, block; 13, identifier:default; 14, string_content:Get sorting-cookie d... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 10, 14; 12, 15; 15, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 22, 24; 23, 25; 23, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 31, 32 | def get_cookie_browse_sorting(path, default):
'''
Get sorting-cookie data for path of current request.
:returns: sorting property
:rtype: string
'''
if request:
for cpath, cprop in iter_cookie_browse_sorting(request.cookies):
if path == cpath:
return cprop
... |
0, module; 1, function_definition; 2, function_name:integral; 3, parameters; 4, block; 5, identifier:requestContext; 6, identifier:seriesList; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""
This will show the sum over time, sort of like a continuous additio... | 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; 15, 19; 15, 20; 15, 21; 15, 22; 15, 23; 15, 24; 15, 25; 19, 26; 20, 27; 21, 28; 21, 29; 21, 30; 22, 31; 23, 32; 24, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43; ... | def integral(requestContext, seriesList):
"""
This will show the sum over time, sort of like a continuous addition
function. Useful for finding totals or trends in metrics that are
collected per minute.
Example::
&target=integral(company.sales.perMinute)
This would start at zero on th... |
0, module; 1, function_definition; 2, function_name:map_metabolite2kegg; 3, parameters; 4, block; 5, identifier:metabolite; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, return_statement; 13, comment:"""
Return a KEGG comp... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 9, 19; 9, 20; 9, 21; 9, 22; 9, 23; 9, 24; 9, 25; 9, 26; 9, 27; 9, 28; 9, 29; 9, 30; 9, 31; 9, 32; 9, 33; 10, 34; 10, 35; 10, 36; 11, 37; 14, 38; 14, 39; 15, 40; 15, 41; 16, 42; 16, 43; 33, 44; 33, 45; 34... | def map_metabolite2kegg(metabolite):
"""
Return a KEGG compound identifier for the metabolite if it exists.
First see if there is an unambiguous mapping to a single KEGG compound ID
provided with the model. If not, check if there is any KEGG compound ID in
a list of mappings. KEGG IDs may map to co... |
0, module; 1, function_definition; 2, function_name:preProcessForComparison; 3, parameters; 4, block; 5, identifier:results; 6, identifier:target_size; 7, identifier:size_tolerance_prct; 8, expression_statement; 9, comment:# find reference (=image most likely to match target cover ignoring factors like size and format)... | 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; 8, 21; 10, 22; 11, 23; 11, 24; 11, 25; 13, 26; 15, 27; 16, 28; 16, 29; 16, 30; 17, 31; 18, 32; 18, 33; 19, 34; 19, 35; 19, 36; 20, 37; 22, 38; 22, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 44... | async def preProcessForComparison(results, target_size, size_tolerance_prct):
""" Process results to prepare them for future comparison and sorting. """
# find reference (=image most likely to match target cover ignoring factors like size and format)
reference = None
for result in results:
if resu... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, identifier:order; 12, string:"asc"; 13, comment:"""Getting the sorted result of the given list
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 18, 23; 18, 24; 21, 25; 21, 26; 22, 27; 22, 28; 22, 29; 25, 30; 25, 31; 27, 32; 27, 33; 28, 34; 29, 35; 34, 36; 35, 37; 36, 38; 36, 39; 37, 40; 38, 41; 38, 42; 39, 43; 3... | def sort(self, order="asc"):
"""Getting the sorted result of the given list
:@param order: "asc"
:@type order: string
:@return self
"""
self.__prepare()
if isinstance(self._json_data, list):
if order == "asc":
self._json_data = sorted... |
0, module; 1, function_definition; 2, function_name:sort_by; 3, parameters; 4, block; 5, identifier:self; 6, identifier:property; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:order; 13, string:"asc"; 14, comment:"""Getting the sorted resu... | 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; 11, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 19, 24; 19, 25; 22, 26; 22, 27; 23, 28; 23, 29; 23, 30; 26, 31; 26, 32; 28, 33; 28, 34; 29, 35; 30, 36; 35, 37; 36, 38; 37, 39; 37, 40; 38, 41; 39, 42; 39, 43; ... | def sort_by(self, property, order="asc"):
"""Getting the sorted result by the given property
:@param property, order: "asc"
:@type property, order: string
:@return self
"""
self.__prepare()
if isinstance(self._json_data, list):
if order == "asc":
... |
0, module; 1, function_definition; 2, function_name:get; 3, parameters; 4, block; 5, identifier:dic; 6, identifier:path; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, try_statement; 13, identifier:seps; 14, identifier:PATH_SEPS; 15, identifier:idx_r... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 10, 18; 11, 19; 11, 20; 12, 21; 12, 22; 18, 23; 18, 24; 19, 25; 20, 26; 21, 27; 21, 28; 21, 29; 21, 30; 22, 31; 22, 32; 24, 33; 24, 34; 26, 35; 27, 36; 27, 37; 28, 38; 29, 39; 30, 40; 31, 41; 31, 42; 32, 43; 33... | def get(dic, path, seps=PATH_SEPS, idx_reg=_JSNP_GET_ARRAY_IDX_REG):
"""getter for nested dicts.
:param dic: a dict[-like] object
:param path: Path expression to point object wanted
:param seps: Separator char candidates
:return: A tuple of (result_object, error_message)
>>> d = {'a': {'b': {'... |
0, module; 1, function_definition; 2, function_name:groupby; 3, parameters; 4, block; 5, identifier:itr; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:key_fn; 10, None; 11, comment:"""
An wrapper function around itertools.groupby to sort each results.
:param itr: Iterable ob... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 12, 13; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 17, 19; 17, 20; 18, 21; 18, 22; 20, 23; 20, 24; 24, 25; 24, 26 | def groupby(itr, key_fn=None):
"""
An wrapper function around itertools.groupby to sort each results.
:param itr: Iterable object, a list/tuple/genrator, etc.
:param key_fn: Key function to sort 'itr'.
>>> import operator
>>> itr = [("a", 1), ("b", -1), ("c", 1)]
>>> res = groupby(itr, ope... |
0, module; 1, function_definition; 2, function_name:open; 3, parameters; 4, block; 5, identifier:path; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:mode; 14, None; 15, identifier:ac_pars... | 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; 9, 18; 10, 19; 11, 20; 11, 21; 12, 22; 19, 23; 19, 24; 20, 25; 20, 26; 21, 27; 22, 28; 22, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 28, 37; 28, 38; 29, 39; 29, 40; 31, 41; 31, 42; 34, 43; 34,... | def open(path, mode=None, ac_parser=None, **options):
"""
Open given configuration file with appropriate open flag.
:param path: Configuration file path
:param mode:
Can be 'r' and 'rb' for reading (default) or 'w', 'wb' for writing.
Please note that even if you specify 'r' or 'w', it w... |
0, module; 1, function_definition; 2, function_name:single_load; 3, parameters; 4, block; 5, identifier:input_; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, retur... | 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; 10, 22; 11, 23; 12, 24; 13, 25; 14, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 28, 35; 28, 36; 30, 37; 30, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43; 34, 44... | def single_load(input_, ac_parser=None, ac_template=False,
ac_context=None, **options):
r"""
Load single configuration file.
.. note::
:func:`load` is a preferable alternative and this API should be used
only if there is a need to emphasize given input 'input\_' is single
... |
0, module; 1, function_definition; 2, function_name:multi_load; 3, parameters; 4, block; 5, identifier:inputs; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, commen... | 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; 6, 22; 6, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 10, 29; 11, 30; 12, 31; 13, 32; 15, 33; 16, 34; 16, 35; 17, 36; 18, 37; 18, 38; 18, 39; 19, 40; 19, 41; 20, 42; 21, 43; 30, 44; 30, 4... | def multi_load(inputs, ac_parser=None, ac_template=False, ac_context=None,
**options):
r"""
Load multiple config files.
.. note::
:func:`load` is a preferable alternative and this API should be used
only if there is a need to emphasize given inputs are multiple ones.
The ... |
0, module; 1, function_definition; 2, function_name:load; 3, parameters; 4, block; 5, identifier:path_specs; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, if_statement; 15, r... | 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; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 13, 28; 14, 29; 14, 30; 15, 31; 26, 32; 26, 33; 27, 34; 27, 35; 28, 36; 29, 37; 30, 38; 31, 39; 31, 40; 33, 41; 33, 42; 34, 43; 34, 44; ... | def load(path_specs, ac_parser=None, ac_dict=None, ac_template=False,
ac_context=None, **options):
r"""
Load single or multiple config files or multiple config files specified in
given paths pattern or pathlib.Path object represents config files or a
namedtuple 'anyconfig.globals.IOInfo' object... |
0, module; 1, function_definition; 2, function_name:dump; 3, parameters; 4, block; 5, identifier:data; 6, identifier:out; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, identifier:ac_... | 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; 9, 17; 10, 18; 11, 19; 12, 20; 13, 21; 18, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 21, 29; 23, 30; 23, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 29, 42; 30, 43; 30... | def dump(data, out, ac_parser=None, **options):
"""
Save 'data' to 'out'.
:param data: A mapping object may have configurations data to dump
:param out:
An output file path, a file, a file-like object, :class:`pathlib.Path`
object represents the file or a namedtuple 'anyconfig.globals.I... |
0, module; 1, function_definition; 2, function_name:dumps; 3, parameters; 4, block; 5, identifier:data; 6, default_parameter; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:ac_parser; 12, None; 13, identifier:options; 14, comment:"""
Return string... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 15, 17; 15, 18; 16, 19; 16, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 20, 26; 22, 27; 22, 28; 26, 29; 28, 30; 28, 31 | def dumps(data, ac_parser=None, **options):
"""
Return string representation of 'data' in forced type format.
:param data: Config data object to dump
:param ac_parser: Forced parser type or ID or parser object
:param options: see :func:`dump`
:return: Backend-specific string representation for... |
0, module; 1, function_definition; 2, function_name:sort_response; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, identifier:OrderedDict; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:response; 15, t... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 6, 14; 6, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 12, 21; 13, 22; 15, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 23, 33; 23, 34; 25, 35; 25, 36; 25, 37; 25, 38; 27, 39; 27, 40; 27, 41; 29, 42; 29, 43; 32... | def sort_response(response: Dict[str, Any]) -> OrderedDict:
"""
Sort the keys in a JSON-RPC response object.
This has no effect other than making it nicer to read. Useful in Python 3.5 only,
dictionaries are already sorted in newer Python versions.
Example::
>>> json.dumps(sort_response({... |
0, module; 1, function_definition; 2, function_name:sort_request; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, identifier:OrderedDict; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:request; 12, type; 13, comment:"""
Sort a JSON-RPC request dict.
This has no ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 6, 11; 6, 12; 8, 13; 9, 14; 10, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 18, 23; 18, 24; 18, 25; 18, 26; 20, 27; 22, 28; 22, 29; 27, 30; 27, 31; 28, 32; 29, 33; 31, 34; 31, 35; 34, 36; 34, 37; 35, 38; 35, 39; 36, 40; 36, 41; 39, 42; 39, 43;... | def sort_request(request: Dict[str, Any]) -> OrderedDict:
"""
Sort a JSON-RPC request dict.
This has no effect other than making the request nicer to read.
>>> json.dumps(sort_request(
... {'id': 2, 'params': [2, 3], 'method': 'add', 'jsonrpc': '2.0'}))
'{"jsonrpc": "2.0", "met... |
0, module; 1, function_definition; 2, function_name:dump; 3, parameters; 4, block; 5, identifier:obj; 6, identifier:fp; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, identifier:... | 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; 14, 27; 24, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33; 28, 34; 28, 35; 29, 36; 31, 37; 31, 38; 33, 39; 33, 40; 33, 41; 33, 42; 33, 43; 33, 4... | def dump(obj, fp, container_count=False, sort_keys=False, no_float32=True, default=None):
"""Writes the given object as UBJSON to the provided file-like object
Args:
obj: The object to encode
fp: write([size])-able object
container_count (bool): Specify length for container types (inclu... |
0, module; 1, function_definition; 2, function_name:torrents; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:filters; 12, comment:"""
Returns a list of torrents matching the suppli... | 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; 9, 17; 10, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 15, 24; 17, 25; 17, 26; 18, 27; 18, 28; 23, 29; 23, 30; 25, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 31, 37; 31, 38; 32, 39; 32, 40; 35, 41; 36, 42; 36, 43; 38... | def torrents(self, **filters):
"""
Returns a list of torrents matching the supplied filters.
:param filter: Current status of the torrents.
:param category: Fetch all torrents with the supplied label.
:param sort: Sort torrents by.
:param reverse: Enable reverse sorting.... |
0, module; 1, function_definition; 2, function_name:_get_global_color_table; 3, parameters; 4, block; 5, identifier:colors; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Return a color table sorted in de... | 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; 8, 14; 9, 15; 10, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 19, 28; 19, 29; 21, 30; 21, 31; 23, 32; 23, 33; 25, 34; 25, 35; 28, 36; 28, 37; 29, 38; 29, 39; 31, 40; 33, 41; 34, 42; 34, 43; ... | def _get_global_color_table(colors):
"""Return a color table sorted in descending order of count.
"""
global_color_table = b''.join(c[0] for c in colors.most_common())
full_table_size = 2**(1+int(get_color_table_size(len(colors)), 2))
repeats = 3 * (full_table_size - len(colors))
zeros = struct.... |
0, module; 1, function_definition; 2, function_name:good_sequences_to_track; 3, parameters; 4, block; 5, identifier:flow; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, function_definition; 12, function_definition; 13, function_definition; 14, exp... | 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; 10, 24; 10, 25; 10, 26; 11, 27; 11, 28; 11, 29; 12, 30; 12, 31; 12, 32; 13, 33; 13, 34; 13, 35; 14, 36; 16, 37; 17, 38; 17, 39; 17, 40; 18, 41; 22, 42; 22, 43; 23, 44; ... | def good_sequences_to_track(flow, motion_threshold=1.0):
"""Get list of good frames to do tracking in.
Looking at the optical flow, this function chooses a span of frames
that fulfill certain criteria.
These include
* not being too short or too long
* not too low or too high mean flow m... |
0, module; 1, function_definition; 2, function_name:_generate_comparator; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:field_names; 7, expression_statement; 8, comment:# Ensure that field names is a list and not a tuple.; 9, expression_statement; 10, comment:# For fields that start with a '-', reverse the ... | 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; 7, 17; 9, 18; 12, 19; 13, 20; 13, 21; 13, 22; 14, 23; 15, 24; 15, 25; 15, 26; 15, 27; 16, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 23, 38; 23, 39; 25, 40; 25, 41; 27, 42; 27, 43; 27,... | def _generate_comparator(cls, field_names):
"""
Construct a comparator function based on the field names. The comparator
returns the first non-zero comparison value.
Inputs:
field_names (iterable of strings): The field names to sort on.
Returns:
A compar... |
0, module; 1, function_definition; 2, function_name:sort_segment_points; 3, parameters; 4, block; 5, identifier:Aps; 6, identifier:Bps; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, for_statement; 13, return_statement; 14, comment:"""Takes tw... | 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; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 12, 22; 12, 23; 13, 24; 15, 25; 15, 26; 16, 27; 16, 28; 17, 29; 17, 30; 19, 31; 19, 32; 20, 33; 20, 34; 20, 35; 22, 36; 22, 37; 23, 38; 29, 39; 29, 40; 30, 41; 32, 42; 33, 43; 3... | def sort_segment_points(Aps, Bps):
"""Takes two line segments and sorts all their points,
so that they form a continuous path
Args:
Aps: Array of tracktotrip.Point
Bps: Array of tracktotrip.Point
Returns:
Array with points ordered
"""
mid = []
j = 0
mid.append(Ap... |
0, module; 1, function_definition; 2, function_name:works; 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, default_parameter; 14, default_parameter; 15, default_p... | 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; 3, 16; 3, 17; 3, 18; 4, 19; 4, 20; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 11, 32; 12, 33; 12, 34; 13, 35; 13, 36; 14, 37; 14, 38; 15, 39; 15, 40; 16, 41; 16, 42; 17, 43; 17, 44; 18, 4... | def works(self, ids = None, query = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, select = None, cursor = None,
cursor_max = 5000, **kwargs):
'''
Search Crossref works
:param ids: [Array] DOIs ... |
0, module; 1, function_definition; 2, function_name:prefixes; 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, default_parameter; 14, default_parameter; 15, defaul... | 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; 3, 16; 3, 17; 3, 18; 4, 19; 4, 20; 4, 21; 6, 22; 6, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 12, 35; 13, 36; 13, 37; 14, 38; 14, 39; 15, 40; 15, 41; 16, 42; 16, 43; 17, 44; 17, 45... | def prefixes(self, ids = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, works = False, select = None,
cursor = None, cursor_max = 5000, **kwargs):
'''
Search Crossref prefixes
:param ids: [Array... |
0, module; 1, function_definition; 2, function_name:types; 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, default_parameter; 14, default_parameter; 15, default_p... | 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; 3, 16; 3, 17; 3, 18; 3, 19; 4, 20; 4, 21; 6, 22; 6, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 12, 35; 13, 36; 13, 37; 14, 38; 14, 39; 15, 40; 15, 41; 16, 42; 16, 43; 17, 44; 17, 45... | def types(self, ids = None, query = None, filter = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, works = False, select = None,
cursor = None, cursor_max = 5000, **kwargs):
'''
Search Crossref types
:param ids... |
0, module; 1, function_definition; 2, function_name:licenses; 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, dictionary_splat_pattern; 14, expression_statement; ... | 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; 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; 15, 34; 16, 35; 17, 36; 34, 37; 34, 38; 35, 39; 35, 40; 38, 41; 38, 42; 40, 43; 40, 44; 41... | def licenses(self, query = None, offset = None,
limit = None, sample = None, sort = None,
order = None, facet = None, **kwargs):
'''
Search Crossref licenses
:param query: [String] A query string
:param offset: [Fixnum] Number of record to start at, from 1 to... |
0, module; 1, function_definition; 2, function_name:get_graph_component; 3, parameters; 4, block; 5, identifier:graph; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:""" Identify strongly connected component... | 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; 8, 14; 9, 15; 10, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 19, 26; 19, 27; 21, 28; 21, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 27, 35; 27, 36; 29, 37; 30, 38; 30, 39; 31, 40; 31, 41; 34, 42; 34, 43; ... | def get_graph_component(graph):
""" Identify strongly connected components in a graph using
Tarjan's algorithm.
graph should be a dictionary mapping node names to
lists of successor nodes.
"""
components = map(partial(_visit, graph=graph), graph)
node_component = dict(_gen_node_... |
0, module; 1, function_definition; 2, function_name:pipe_fetchdata; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, comment:# todo: iCal and KML; 11, expression_statement; 12, expression_statement; 13, expression_statem... | 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; 5, 17; 5, 18; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 9, 24; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 16, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 29, 40; 32, 41; 32, 42; 34, 43; 34, 44; 3... | def pipe_fetchdata(context=None, _INPUT=None, conf=None, **kwargs):
"""A source that fetches and parses an XML or JSON file. Loopable.
Parameters
----------
context : pipe2py.Context object
_INPUT : pipeforever pipe or an iterable of items or fields
conf : {
'URL': {'value': <url>},
... |
0, module; 1, function_definition; 2, function_name:pipe_sort; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expr... | 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; 5, 21; 5, 22; 6, 23; 6, 24; 7, 25; 7, 26; 8, 27; 9, 28; 10, 29; 11, 30; 12, 31; 13, 32; 14, 33; 15, 34; 16, 35; 17, 36; 18, 37; 19, 38; 20, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31, 44; 31, 4... | def pipe_sort(context=None, _INPUT=None, conf=None, **kwargs):
"""An operator that sorts the input source according to the specified key.
Not loopable. Not lazy.
Parameters
----------
context : pipe2py.Context object
_INPUT : pipe2py.modules pipe like object (iterable of items)
kwargs -- ot... |
0, module; 1, function_definition; 2, function_name:asyncPipeStringtokenizer; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 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; 5, 16; 5, 17; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31, 44; ... | def asyncPipeStringtokenizer(context=None, _INPUT=None, conf=None, **kwargs):
"""A string module that asynchronously splits a string into tokens
delimited by separators. Loopable.
Parameters
----------
context : pipe2py.Context object
_INPUT : twisted Deferred iterable of items or strings
c... |
0, module; 1, function_definition; 2, function_name:alphabeta; 3, parameters; 4, block; 5, identifier:game; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, comment:# base case - game is over; 10, if_statement; 11, if_statement; 12, comment:# recursive case - game is not over; 13, for_statement; ... | 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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 10, 20; 10, 21; 11, 22; 11, 23; 11, 24; 11, 25; 13, 26; 13, 27; 13, 28; 14, 29; 16, 30; 16, 31; 18, 32; 18, 33; 19, 34; 20, 35; 20, 36; 21, 37; 22, 38; 22, 39; 24, 40; 24, 41; 24, 42; 25, 43; 25, ... | def alphabeta(game, alpha_beta=(-float('inf'), float('inf')),
player=dominoes.players.identity):
'''
Runs minimax search with alpha-beta pruning on the provided game.
:param Game game: game to search
:param tuple alpha_beta: a tuple of two floats that indicate
... |
0, module; 1, function_definition; 2, function_name:csv; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:d; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, function_definition; 13, comment:# noinspection PyBroadException; 14, function_d... | 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; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 11, 31; 12, 32; 12, 33; 12, 34; 14, 35; 14, 36; 14, 37; 15, 38; 15, 39; 16, 40; 16, 41; 17, 42; 17, 43; 17, 44; 18, 45... | def csv(cls,
d,
order=None,
header=None,
sort_keys=True):
"""
prints a table in csv format
:param d: A a dict with dicts of the same type.
:type d: dict
:param order:The order in which the columns are printed.
T... |
0, module; 1, function_definition; 2, function_name:deauthorize_application; 3, parameters; 4, block; 5, identifier:request; 6, expression_statement; 7, if_statement; 8, comment:"""
When a user deauthorizes an application, Facebook sends a HTTP POST request to the application's
"deauthorization callback" URL. T... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 9, 12; 9, 13; 10, 14; 10, 15; 10, 16; 10, 17; 11, 18; 14, 19; 15, 20; 16, 21; 17, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 21, 29; 22, 30; 22, 31; 23, 32; 25, 33; 25, 34; 26, 35; 26, 36; 28, 37; 28, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43... | def deauthorize_application(request):
"""
When a user deauthorizes an application, Facebook sends a HTTP POST request to the application's
"deauthorization callback" URL. This view picks up on requests of this sort and marks the corresponding
users as unauthorized.
"""
if request.facebook:
... |
0, module; 1, function_definition; 2, function_name:_handle_send_response; 3, parameters; 4, block; 5, identifier:self; 6, identifier:result; 7, identifier:payloadsByTopicPart; 8, identifier:deferredsByTopicPart; 9, expression_statement; 10, function_definition; 11, function_definition; 12, function_definition; 13, fun... | 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; 4, 27; 4, 28; 4, 29; 4, 30; 9, 31; 10, 32; 10, 33; 10, 34; 11, 35; 11, 36; 11, 37; 11, 38; 11, 39; 11, 40; 11, 41; 12, 42; 12, 43; 12, 44; 12, 45; ... | def _handle_send_response(self, result, payloadsByTopicPart,
deferredsByTopicPart):
"""Handle the response from our client to our send_produce_request
This is a bit complex. Failures can happen in a few ways:
1. The client sent an empty list, False, None or some... |
0, module; 1, function_definition; 2, function_name:ordering_url; 3, parameters; 4, block; 5, identifier:self; 6, identifier:field_name; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expressi... | 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; 4, 20; 7, 21; 8, 22; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 13, 28; 14, 29; 16, 30; 16, 31; 16, 32; 17, 33; 18, 34; 18, 35; 18, 36; 19, 37; 20, 38; 22, 39; 22, 40; 23, 41; 23, 42; 24, 43; 24, 44; ... | def ordering_url(self, field_name):
"""
Creates a url link for sorting the given field.
The direction of sorting will be either ascending, if the field is not
yet sorted, or the opposite of the current sorting if sorted.
"""
path = self.request.path
direction = "... |
0, module; 1, function_definition; 2, function_name:load_maf; 3, parameters; 4, block; 5, identifier:path; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, comment:# pylint: disable=no-member; 13, comment:# pylint gets confused ... | 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; 4, 20; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 14, 32; 15, 33; 15, 34; 16, 35; 17, 36; 18, 37; 19, 38; 19, 39; 19, 40; 20, 41; 32, 42; 32, 43; 33, 44; 33, 4... | def load_maf(
path,
optional_cols=[],
sort_key=variant_ascending_position_sort_key,
distinct=True,
raise_on_error=True,
encoding=None):
"""
Load reference name and Variant objects from MAF filename.
Parameters
----------
path : str
Path to MA... |
0, module; 1, function_definition; 2, function_name:load_vcf; 3, parameters; 4, block; 5, identifier:path; 6, default_parameter; 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, expres... | 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; 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; 6, 30; 6, 31; 7, 32; 7, 33; 8, 34; 8, 35; 9, 36; 9, 37; 10, 38; 10, 39; 11, 40; 11, 41; 12, 42; 12, 43; 13, 44; 13, 45; 14, 46... | def load_vcf(
path,
genome=None,
reference_vcf_key="reference",
only_passing=True,
allow_extended_nucleotides=False,
include_info=True,
chunk_size=10 ** 5,
max_variants=None,
sort_key=variant_ascending_position_sort_key,
distinct=True):
... |
0, module; 1, function_definition; 2, function_name:top_expression_effect; 3, parameters; 4, block; 5, identifier:self; 6, identifier:expression_levels; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, function_definition; 11, return_statement; 12, comment:"""
Return effect whose transcrip... | 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; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 17, 25; 18, 26; 18, 27; 18, 28; 19, 29; 19, 30; 21, 31; 21, 32; 22, 33; 22, 34; 24, 35; 26, 36; 27, 37; 28, 38; 29, 39; 29, 40; 31, 41; 31, 42; 32, 43; ... | def top_expression_effect(self, expression_levels):
"""
Return effect whose transcript has the highest expression level.
If none of the effects are expressed or have associated transcripts,
then return None. In case of ties, add lexicographical sorting by
effect priority and tran... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, identifier:callback; 11, None; 12, comment:"""
Sort through each item with a callback.
:param callback: The... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 13, 17; 13, 18; 15, 19; 16, 20; 18, 21; 18, 22; 19, 23; 20, 24; 23, 25; 23, 26; 24, 27; 25, 28; 25, 29; 26, 30; 27, 31; 27, 32; 30, 33; 30, 34; 31, 35; 31, 36; 32, 37; 34, 38; 34, 39; 37, 40; 37, 41; 39, 42; 39, 43; 4... | def sort(self, callback=None):
"""
Sort through each item with a callback.
:param callback: The callback
:type callback: callable or None
:rtype: Collection
"""
items = self.items
if callback:
return self.__class__(sorted(items, key=callback... |
0, module; 1, function_definition; 2, function_name:scan_for_spec; 3, parameters; 4, block; 5, identifier:keyword; 6, expression_statement; 7, comment:# Both 'spec' formats are wrapped in parens, discard; 8, expression_statement; 9, comment:# First, test for intermediate '1.2+' style; 10, expression_statement; 11, if_s... | 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; 6, 14; 8, 15; 10, 16; 11, 17; 11, 18; 13, 19; 13, 20; 13, 21; 15, 22; 15, 23; 16, 24; 16, 25; 18, 26; 19, 27; 21, 28; 21, 29; 23, 30; 23, 31; 25, 32; 25, 33; 26, 34; 27, 35; 29, 36; 30, 37; 30, 38; 31, 39; 32, 40; 32, 41; 33, 42; 34, 43; ... | def scan_for_spec(keyword):
"""
Attempt to return some sort of Spec from given keyword value.
Returns None if one could not be derived.
"""
# Both 'spec' formats are wrapped in parens, discard
keyword = keyword.lstrip('(').rstrip(')')
# First, test for intermediate '1.2+' style
matches ... |
0, module; 1, function_definition; 2, function_name:get_students; 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, comment:# These are 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; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 6, 24; 6, 25; 7, 26; 7, 27; 8, 28; 8, 29; 9, 30; 9, 31; 10, 32; 10, 33; 11, 34; 11, 35; 12, 36; 12, 37; 13, 38; 18, 39; 19, 40; 20, 41; 20, 42; 21, 43; 22, 44; 22, 45; ... | def get_students(
self,
gradebook_id='',
simple=False,
section_name='',
include_photo=False,
include_grade_info=False,
include_grade_history=False,
include_makeup_grades=False
):
"""Get students for a gradebook.
... |
0, module; 1, function_definition; 2, function_name:get_staff; 3, parameters; 4, block; 5, identifier:self; 6, identifier:gradebook_id; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:simple; 13, False; 14, comment:"""Get staff list for grad... | 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; 11, 18; 15, 19; 15, 20; 17, 21; 17, 22; 17, 23; 17, 24; 18, 25; 18, 26; 20, 27; 20, 28; 21, 29; 22, 30; 23, 31; 23, 32; 23, 33; 24, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; ... | def get_staff(self, gradebook_id, simple=False):
"""Get staff list for gradebook.
Get staff list for the gradebook specified. Optionally, return
a less detailed list by specifying ``simple = True``.
If simple=True, return a list of dictionaries, one dictionary
for each member. ... |
0, module; 1, function_definition; 2, function_name:get_course_guide_staff; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, identifier:course_id; 11, string; 12, comment:"""Get the staff roster for a course.
Get a lis... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 8, 13; 9, 14; 13, 15; 13, 16; 14, 17; 14, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 22, 28; 26, 29; 26, 30; 27, 31; 27, 32; 29, 33; 29, 34; 30, 35; 33, 36; 35, 37; 35, 38; 38, 39; 38, 40; 40, 41; 40, 42 | def get_course_guide_staff(self, course_id=''):
"""Get the staff roster for a course.
Get a list of staff members for a given course,
specified by a course id.
Args:
course_id (int): unique identifier for course, i.e. ``2314``
Raises:
requests.RequestEx... |
0, module; 1, function_definition; 2, function_name:optimize; 3, parameters; 4, block; 5, identifier:self; 6, identifier:problem; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15, if... | 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; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 7, 26; 7, 27; 8, 28; 8, 29; 9, 30; 9, 31; 10, 32; 10, 33; 11, 34; 11, 35; 12, 36; 12, 37; 13, 38; 13, 39; 14, 40; 15, 41; 15, 42; 17, 43; 17, 44; 17, 45; ... | def optimize(self, problem, max_iterations=100, max_seconds=float('inf'),
cache_encoded=True, cache_solution=False, clear_cache=True,
logging_func=_print_fitnesses,
n_processes=0):
"""Find the optimal inputs for a given fitness function.
Args:
... |
0, module; 1, function_definition; 2, function_name:inspect; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""
Inspect a pattern. This gives information regarding the sorts of
operations, content,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 18, 25; 18, 26; 20, 27; 20, 28; 27, 29; 27, 30 | def inspect(self):
"""
Inspect a pattern. This gives information regarding the sorts of
operations, content, etc in use in the pattern.
:return: Pattern information
"""
inspector = stix2patterns.inspector.InspectionListener()
self.walk(inspector)
retur... |
0, module; 1, function_definition; 2, function_name:best_kmers; 3, parameters; 4, block; 5, identifier:dt; 6, identifier:response; 7, identifier:sequence; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement; 14, expression_statement; ... | 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; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 8, 30; 8, 31; 9, 32; 9, 33; 10, 34; 10, 35; 11, 36; 11, 37; 12, 38; 12, 39; 13, 40; 14, 41; 15, 42; 16, 43; 16, 44; 17, 45; 18... | def best_kmers(dt, response, sequence, k=6, consider_shift=True, n_cores=1,
seq_align="start", trim_seq_len=None):
"""
Find best k-mers for CONCISE initialization.
Args:
dt (pd.DataFrame): Table containing response variable and sequence.
response (str): Name of the column use... |
0, module; 1, function_definition; 2, function_name:_custom_rdd_reduce; 3, parameters; 4, block; 5, identifier:self; 6, identifier:reduce_func; 7, expression_statement; 8, function_definition; 9, expression_statement; 10, return_statement; 11, comment:"""Provides a custom RDD reduce which preserves ordering if the RDD ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 10, 16; 13, 17; 14, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 18, 25; 19, 26; 19, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 24, 33; 24, 34; 25, 35; 25, 36; 28, 37; 29, 38; 29, 39; 30, 40; 31, 41; 31, 42; 37, 43; ... | def _custom_rdd_reduce(self, reduce_func):
"""Provides a custom RDD reduce which preserves ordering if the RDD has
been sorted. This is useful for us because we need this functionality
as many pandas operations support sorting the results. The standard
reduce in PySpark does not have thi... |
0, module; 1, function_definition; 2, function_name:__sort_analyses; 3, parameters; 4, block; 5, identifier:sentence; 6, expression_statement; 7, for_statement; 8, return_statement; 9, string; 10, identifier:word; 11, identifier:sentence; 12, block; 13, identifier:sentence; 14, string_content:Sorts analysis of all the ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 7, 12; 8, 13; 9, 14; 12, 15; 15, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 18, 22; 21, 23; 22, 24; 23, 25; 23, 26; 24, 27; 26, 28; 27, 29; 27, 30; 28, 31; 28, 32; 29, 33; 29, 34; 30, 35; 30, 36; 31, 37; 32, 38; 32, 39; 36, 40; 36, 41; 36, 42; 39, 43;... | def __sort_analyses(sentence):
''' Sorts analysis of all the words in the sentence.
This is required for consistency, because by default, analyses are
listed in arbitrary order; '''
for word in sentence:
if ANALYSIS not in word:
raise Exception( '(!) Error: no analysis foun... |
0, module; 1, function_definition; 2, function_name:tag; 3, parameters; 4, block; 5, identifier:self; 6, identifier:text; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, comment:"""Retrieves list of keywords in text.
Parameters
----------
... | 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; 8, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 11, 20; 11, 21; 13, 22; 13, 23; 14, 24; 15, 25; 15, 26; 16, 27; 16, 28; 17, 29; 17, 30; 18, 31; 19, 32; 19, 33; 20, 34; 21, 35; 22, 36; 22, 37; 23, 38; 24, 39; 25, 40; 25, 41; 26, 42; 28, 43; 2... | def tag(self, text):
"""Retrieves list of keywords in text.
Parameters
----------
text: Text
The text to search for events.
Returns
-------
list of vents sorted by start, end
"""
if self.search_method == 'ahocorasick':
eve... |
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:term; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, comment:# If fields are provided, override the ones in the class; 11, if_statement; 12, expression_statement; 13, comment:# Cach... | 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; 7, 33; 7, 34; 8, 35; 9, 36; 9, 37; 11, 38; 11, 39; 12, 40; 14, 41; 15, 42; 22, 43; 26, 44; 27, 45; 27, 46... | def search(cls, term, fields=()):
"""Generic SQL search function that uses SQL ``LIKE`` to search the
database for matching records. The records are sorted by their
relavancey to the search term.
The query searches and sorts on the folling criteria, in order, where
the target st... |
0, module; 1, function_definition; 2, function_name:dependency_sort; 3, parameters; 4, block; 5, identifier:dependency_tree; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""
Sorts items 'dependencies first' in a given dependency tree.... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 21, 27; 21, 28; 24, 29; 24, 30; 26, 31; 31, 32; 31, 33; 33, 34; 33, 35; 33, 36; 33, 37; 33, 38 | def dependency_sort(dependency_tree):
"""
Sorts items 'dependencies first' in a given dependency tree.
A dependency tree is a dictionary mapping an object to a collection its
dependency objects.
Result is a properly sorted list of items, where each item is a 2-tuple
containing an object and it... |
0, module; 1, function_definition; 2, function_name:_sort_r; 3, parameters; 4, block; 5, identifier:sorted; 6, identifier:processed; 7, identifier:key; 8, identifier:deps; 9, identifier:dependency_tree; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, for_statement; 14, expression_statement; 15... | 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; 10, 15; 11, 16; 11, 17; 12, 18; 13, 19; 13, 20; 13, 21; 14, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 21, 28; 21, 29; 21, 30; 22, 31; 22, 32; 26, 33; 26, 34; 27, 35; 28, 36; 29, 37; 29, 38; 30, 39; 31, 40; 31, 41; 32, 42; 36, 43;... | def _sort_r(sorted, processed, key, deps, dependency_tree):
"""Recursive topological sort implementation."""
if key in processed:
return
processed.add(key)
for dep_key in deps:
dep_deps = dependency_tree.get(dep_key)
if dep_deps is None:
log.debug('"%s" not found, ski... |
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, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, commen... | 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; 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; 4, 36; 6, 37; 6, 38; 7, 39; 7, 40; 8, 41; 8, 42; 9, 43; 9, 44; 10, 45; 10, 46; 11, 4... | def list(self, count=30, order='user_ptime', asc=False, show_dir=True,
natsort=True):
"""
List directory contents
:param int count: number of entries to be listed
:param str order: order of entries, originally named `o`. This value
may be one of `user_ptime` (de... |
0, module; 1, function_definition; 2, function_name:list_items; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:sort_key; 13, None; 14, identifier:reverse; 15, False; 16, com... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 11, 20; 17, 21; 17, 22; 19, 23; 22, 24; 22, 25; 23, 26; 25, 27; 26, 28; 26, 29; 27, 30; 27, 31; 28, 32; 28, 33; 29, 34; 29, 35; 30, 36; 30, 37; 34, 38; 34, 39; 35, 40; 35, 41; 36, 42; 36, 43 | def list_items(self, sort_key=None, reverse=False):
"""Return a list of cart items.
Parameters
----------
sort_key : func
A function to customize the list order, same as the 'key'
argument to the built-in :func:`sorted`.
reverse: bool
If set t... |
0, module; 1, function_definition; 2, function_name:_prepare_axes; 3, parameters; 4, block; 5, identifier:node; 6, identifier:sort_key; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, 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; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 13, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 20, 31; 20, 32; 21, 33; 21, 34; 21, 35; 21, 36; 24, 37; 24, 38; 26, 39; 26, 40; 28, 41; 28, 42; 28, 43; 3... | def _prepare_axes(node, sort_key):
"""
Sort axes and combine those that point to the same target and go
in the same direction.
"""
links = node.links
o_links = node._overlapping_links
overlap = {ax2 for ax in links for ax2 in o_links.get(ax, [])}
axes = []
for axis in sorted(links.ke... |
0, module; 1, function_definition; 2, function_name:sort_vid_split; 3, parameters; 4, block; 5, identifier:vs; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, comment:"""
Split a valid variable string into its variable sort and id.
Examples:
>>> sort_vid_split('h3')
('h', ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 8, 13; 10, 14; 10, 15; 11, 16; 11, 17; 12, 18; 13, 19; 15, 20; 15, 21; 18, 22; 19, 23; 20, 24; 20, 25; 21, 26; 22, 27; 22, 28; 23, 29; 28, 30; 29, 31; 29, 32; 30, 33; 30, 34; 31, 35; 31, 36; 33, 37; 33, 38; 34, 39; 37, 40; 39, 41; 39, 42; 42, 43 | def sort_vid_split(vs):
"""
Split a valid variable string into its variable sort and id.
Examples:
>>> sort_vid_split('h3')
('h', '3')
>>> sort_vid_split('ref-ind12')
('ref-ind', '12')
"""
match = var_re.match(vs)
if match is None:
raise ValueError('Inval... |
0, module; 1, function_definition; 2, function_name:properties; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:"""
Morphosemantic property mapping.
Unlike :attr:`sortinfo`, this does not include `cvarsort`... | 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; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 16, 20; 16, 21; 19, 22; 21, 23; 22, 24; 22, 25; 23, 26; 23, 27 | def properties(self):
"""
Morphosemantic property mapping.
Unlike :attr:`sortinfo`, this does not include `cvarsort`.
"""
d = dict(self.sortinfo)
if CVARSORT in d:
del d[CVARSORT]
return d |
0, module; 1, function_definition; 2, function_name:build_messages_modules; 3, parameters; 4, block; 5, identifier:messages; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, for_statement; 10, comment:"""Build and yield sorted list of messages per module.
:param list messages: List of dict of... | 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; 9, 16; 9, 17; 11, 18; 11, 19; 14, 20; 14, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 19, 29; 19, 30; 20, 31; 21, 32; 22, 33; 23, 34; 26, 35; 26, 36; 28, 37; 29, 38; 29, 39; 30, 40; 31, 41; 31, 42; 32, 43; 32... | def build_messages_modules(messages):
"""Build and yield sorted list of messages per module.
:param list messages: List of dict of messages
:return: Tuple of 2 values: first is the module info, second is the list
of messages sorted by line number
"""
data = collections.defaultdict(list... |
0, module; 1, function_definition; 2, function_name:write; 3, parameters; 4, block; 5, identifier:nml; 6, identifier:nml_path; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# Promote dicts to Namelists; 11, if_statement; 12, expression_statement; 13, identifier:force; 14, False; 15, i... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 11, 18; 11, 19; 11, 20; 12, 21; 18, 22; 18, 23; 19, 24; 20, 25; 21, 26; 21, 27; 22, 28; 23, 29; 23, 30; 24, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 27, 37; 28, 38; 28, 39; 30, 40; 30, 41; 31, 42; 31, 43; 32... | def write(nml, nml_path, force=False, sort=False):
"""Save a namelist to disk using either a file object or its file path.
File object usage:
>>> with open(nml_path, 'w') as nml_file:
>>> f90nml.write(nml, nml_file)
File path usage:
>>> f90nml.write(nml, 'data.nml')
This function is... |
0, module; 1, function_definition; 2, function_name:date_key; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:month_string; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""
Return a key suitable for sorting by month.
>>> k1 = ChannelPage.dat... | 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; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 18, 25; 18, 26; 23, 27; 23, 28; 24, 29; 25, 30; 25, 31; 29, 32 | def date_key(cls, month_string):
"""
Return a key suitable for sorting by month.
>>> k1 = ChannelPage.date_key('September, 2012')
>>> k2 = ChannelPage.date_key('August, 2013')
>>> k2 > k1
True
"""
month, year = month_string.split(',')
month_ord = cls.month_ordinal[month]
return year, month_ord |
0, module; 1, function_definition; 2, function_name:SynchronizedClassMethod; 3, parameters; 4, comment:# pylint: disable=C1801; 5, block; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, comment:# Filter the names (remove empty ones); 10, expression_statement; 11, if_statement; 12, if_sta... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 6, 16; 7, 17; 8, 18; 10, 19; 11, 20; 11, 21; 12, 22; 12, 23; 12, 24; 12, 25; 13, 26; 13, 27; 13, 28; 15, 29; 19, 30; 19, 31; 20, 32; 21, 33; 22, 34; 22, 35; 25, 36; 25, 37; 27, 38; 28, 39; 28, 40; 28, 41; 31, 42; 31, 43; 31,... | def SynchronizedClassMethod(*locks_attr_names, **kwargs):
# pylint: disable=C1801
"""
A synchronizer decorator for class methods. An AttributeError can be raised
at runtime if the given lock attribute doesn't exist or if it is None.
If a parameter ``sorted`` is found in ``kwargs`` and its value is ... |
0, module; 1, function_definition; 2, function_name:__sort_registry; 3, parameters; 4, comment:# type: (ServiceReference) -> None; 5, block; 6, identifier:self; 7, identifier:svc_ref; 8, expression_statement; 9, with_statement; 10, comment:"""
Sorts the registry, after the update of the sort key of given servic... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 5, 8; 5, 9; 8, 10; 9, 11; 9, 12; 11, 13; 12, 14; 12, 15; 12, 16; 12, 17; 12, 18; 12, 19; 13, 20; 14, 21; 14, 22; 16, 23; 16, 24; 16, 25; 16, 26; 18, 27; 19, 28; 19, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 24, 37; 24, 38; 26, 39; 26, 40; 26, 41; 27, 42; 27, 4... | def __sort_registry(self, svc_ref):
# type: (ServiceReference) -> None
"""
Sorts the registry, after the update of the sort key of given service
reference
:param svc_ref: A service reference with a modified sort key
"""
with self.__svc_lock:
if svc_re... |
0, module; 1, function_definition; 2, function_name:sorted_timezones; 3, parameters; 4, block; 5, expression_statement; 6, function_definition; 7, expression_statement; 8, comment:# Make a list of country code mappings; 9, expression_statement; 10, for_statement; 11, comment:# Make a list of timezones, discarding the U... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 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; 5, 19; 6, 20; 6, 21; 6, 22; 7, 23; 9, 24; 10, 25; 10, 26; 10, 27; 13, 28; 15, 29; 16, 30; 18, 31; 21, 32; 22, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 26, 40; 26, 41; 27, 42; 28, 43; 28, 44; 2... | def sorted_timezones():
"""
Return a list of timezones sorted by offset from UTC.
"""
def hourmin(delta):
if delta.days < 0:
hours, remaining = divmod(86400 - delta.seconds, 3600)
else:
hours, remaining = divmod(delta.seconds, 3600)
minutes, remaining = di... |
0, module; 1, function_definition; 2, function_name:alphanum_order; 3, parameters; 4, block; 5, identifier:triples; 6, expression_statement; 7, return_statement; 8, comment:"""
Sort a list of triples by relation name.
Embedded integers are sorted numerically, but otherwise the sorting
is alphabetic.
""... | 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; 13, 14; 13, 15; 15, 16; 15, 17; 16, 18; 17, 19; 17, 20; 19, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 25, 30; 25, 31; 27, 32; 28, 33; 28, 34; 30, 35; 30, 36; 31, 37; 31, 38; 37, 39; 38, 40; 38, 41; 40, 42; 40, ... | def alphanum_order(triples):
"""
Sort a list of triples by relation name.
Embedded integers are sorted numerically, but otherwise the sorting
is alphabetic.
"""
return sorted(
triples,
key=lambda t: [
int(t) if t.isdigit() else t
for t in re.split(r'([0-9... |
0, module; 1, function_definition; 2, function_name:_encode_penman; 3, parameters; 4, block; 5, identifier:self; 6, identifier:g; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:# (preferred, dispreferred); 14, for... | 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; 7, 22; 7, 23; 8, 24; 9, 25; 9, 26; 10, 27; 11, 28; 12, 29; 14, 30; 14, 31; 14, 32; 15, 33; 16, 34; 17, 35; 17, 36; 17, 37; 18, 38; 18, 39; 18, 40; 19, 41; 20, 42; 20, 43; 21, 44; 25,... | def _encode_penman(self, g, top=None):
"""
Walk graph g and find a spanning dag, then serialize the result.
First, depth-first traversal of preferred orientations (whether
true or inverted) to create graph p.
If any triples remain, select the first remaining triple whose
... |
0, module; 1, function_definition; 2, function_name:copy; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""Return a shallow copy of the sorted list."""; 9, call; 10, attribute; 11, argument_list; 12, identifier:self; 13, identifier:__class__; 14, identifier:self; ... | 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; 11, 16; 15, 17; 15, 18; 16, 19; 16, 20; 18, 21; 18, 22; 20, 23; 20, 24 | def copy(self):
"""Return a shallow copy of the sorted list."""
return self.__class__(self, key=self._key, load=self._load) |
0, module; 1, function_definition; 2, function_name:copy; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""Return a shallow copy of the sorted dictionary."""; 9, call; 10, attribute; 11, argument_list; 12, identifier:self; 13, identifier:__class__; 14, attribute; ... | 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; 11, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 21, 23; 21, 24 | def copy(self):
"""Return a shallow copy of the sorted dictionary."""
return self.__class__(self._key, self._load, self._iteritems()) |
0, module; 1, function_definition; 2, function_name:sort_group; 3, parameters; 4, block; 5, identifier:d; 6, default_parameter; 7, expression_statement; 8, comment:# First, sort the paths in order (this must be a couple: (parent_dir, filename), so that there's no ambiguity because else a file at root will be considered... | 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; 6, 15; 6, 16; 7, 17; 9, 18; 11, 19; 12, 20; 12, 21; 14, 22; 14, 23; 14, 24; 14, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 21, 32; 22, 33; 22, 34; 23, 35; 25, 36; 25, 37; 28, 38; 28, 39; 30, 40; 30, 41; 31, 42; 31, 43; 32,... | def sort_group(d, return_only_first=False):
''' Sort a dictionary of relative paths and cluster equal paths together at the same time '''
# First, sort the paths in order (this must be a couple: (parent_dir, filename), so that there's no ambiguity because else a file at root will be considered as being after a ... |
0, module; 1, function_definition; 2, function_name:group_files_by_size_fast; 3, parameters; 4, comment:# pragma: no cover; 5, block; 6, identifier:fileslist; 7, identifier:nbgroups; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 8, 18; 8, 19; 9, 20; 10, 21; 11, 22; 12, 23; 14, 24; 15, 25; 16, 26; 16, 27; 17, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 27, 40; 27, 41; 27, 42; 27, 43; 27, 4... | def group_files_by_size_fast(fileslist, nbgroups, mode=1): # pragma: no cover
'''Given a files list with sizes, output a list where the files are grouped in nbgroups per cluster.
Pseudo-code for algorithm in O(n log(g)) (thank's to insertion sort or binary search trees)
See for more infos: http://cs.stack... |
0, module; 1, function_definition; 2, function_name:print_; 3, parameters; 4, block; 5, identifier:rows; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:# input validation; 13, expression_statement; 14, if_statement; 15,... | 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; 6, 25; 6, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 10, 32; 11, 33; 11, 34; 11, 35; 13, 36; 14, 37; 14, 38; 15, 39; 16, 40; 16, 41; 18, 42; 18, 43; 18, 44; 20, 45; ... | def print_(rows, limit=15, sort='size', order='descending'):
"""Print the rows as a summary.
Keyword arguments:
limit -- the maximum number of elements to be listed
sort -- sort elements by 'size', 'type', or '#'
order -- sort 'ascending' or 'descending'
"""
localrows = []
for row in r... |
0, module; 1, function_definition; 2, function_name:split_and_sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""
Split the graphs into sub graphs and return a list of all graphs sor... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 25, 32; 26, 33; 28, 34; 31, 35; 31, 36; 33, 37; 33, 38; 34, 39; 34, 40; 36, 41; 36, 42; 37, 43; 3... | def split_and_sort(self):
"""
Split the graphs into sub graphs and return a list of all graphs sorted
by the number of nodes. The graph with most nodes is returned first.
"""
graphs = list(self.split())
graphs.sort(key=lambda x: -len(x.metadata))
for index, graph ... |
0, module; 1, function_definition; 2, function_name:profile; 3, parameters; 4, block; 5, default_parameter; 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, comment... | 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; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 5, 29; 5, 30; 6, 31; 6, 32; 7, 33; 7, 34; 8, 35; 8, 36; 9, 37; 9, 38; 10, 39; 10, 40; 11, 41; 11, 42; 12, 43; 12, 44; 13, 45; 14, 46;... | def profile(fn=None, skip=0, filename=None, immediate=False, dirs=False,
sort=None, entries=40,
profiler=('cProfile', 'profile', 'hotshot')):
"""Mark `fn` for profiling.
If `skip` is > 0, first `skip` calls to `fn` will not be profiled.
If `immediate` is False, profiling results wi... |
0, module; 1, function_definition; 2, function_name:_get_kernel_arguments; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""Get the list of kernel arguments for loading the kernel data elements into the kernel.
... | 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; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 20, 23; 20, 24; 22, 25; 23, 26; 23, 27; 25, 28; 25, 29; 28, 30; 28, 31; 29, 32; 32, 33; 32, 34; 33, 35; 33, 36; 34, 37; 37, 38; 37, 39; 38, 40 | def _get_kernel_arguments(self):
"""Get the list of kernel arguments for loading the kernel data elements into the kernel.
This will use the sorted keys for looping through the kernel input items.
Returns:
list of str: the list of parameter definitions
"""
declarati... |
0, module; 1, function_definition; 2, function_name:topological_sort; 3, parameters; 4, block; 5, identifier:data; 6, expression_statement; 7, function_definition; 8, function_definition; 9, function_definition; 10, function_definition; 11, function_definition; 12, expression_statement; 13, if_statement; 14, expression... | 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; 4, 15; 4, 16; 4, 17; 4, 18; 6, 19; 7, 20; 7, 21; 7, 22; 8, 23; 8, 24; 8, 25; 9, 26; 9, 27; 9, 28; 10, 29; 10, 30; 10, 31; 11, 32; 11, 33; 11, 34; 12, 35; 13, 36; 13, 37; 14, 38; 15, 39; 16, 40; 17, 41; 17, 42; 17, 43; 18, 44; 21, 4... | def topological_sort(data):
"""Topological sort the given dictionary structure.
Args:
data (dict); dictionary structure where the value is a list of dependencies for that given key.
For example: ``{'a': (), 'b': ('a',)}``, where ``a`` depends on nothing and ``b`` depends on ``a``.
Retu... |
0, module; 1, function_definition; 2, function_name:get_posts; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:incl... | 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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 9, 19; 9, 20; 9, 21; 10, 22; 11, 23; 12, 24; 13, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 27, 37; 28, 38; 28, 39; 30, 40; 30, 41; 32, 42; 32, 43; 34, 44... | def get_posts(self, include_draft=False, filter_functions=None):
"""
Get all posts from filesystem.
:param include_draft: return draft posts or not
:param filter_functions: filter to apply BEFORE result being sorted
:return: an iterable of Post objects (the first is the latest p... |
0, module; 1, function_definition; 2, function_name:arbitrary_object_to_string; 3, parameters; 4, block; 5, identifier:a_thing; 6, expression_statement; 7, comment:# is it None?; 8, if_statement; 9, comment:# is it already a string?; 10, if_statement; 11, if_statement; 12, comment:# does it have a to_str function?; 13,... | 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; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 6, 24; 8, 25; 8, 26; 10, 27; 10, 28; 11, 29; 11, 30; 13, 31; 13, 32; 15, 33; 15, 34; 17, 35; 17, 36; 19, 37; 19, 38; 21, 39; 21, 40; 23, 41; 25, 42; 25, 43; 26, 44; 27,... | def arbitrary_object_to_string(a_thing):
"""take a python object of some sort, and convert it into a human readable
string. this function is used extensively to convert things like "subject"
into "subject_key, function -> function_key, etc."""
# is it None?
if a_thing is None:
return ''
... |
0, module; 1, function_definition; 2, function_name:add_parser; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 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; 6, 17; 7, 18; 8, 19; 9, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 15, 26; 16, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 29, 42; 29, 43; 31, 4... | def add_parser(self, *args, **kwargs):
"""each time a subparser action is used to create a new parser object
we must save the original args & kwargs. In a later phase of
configman, we'll need to reproduce the subparsers exactly without
resorting to copying. We save the args & kwargs in... |
0, module; 1, function_definition; 2, function_name:_parse_and_sort_accept_header; 3, parameters; 4, block; 5, identifier:accept_header; 6, expression_statement; 7, return_statement; 8, comment:"""Parse and sort the accept header items.
>>> _parse_and_sort_accept_header('application/json;q=0.5, text/*')
[('tex... | 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; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 18, 25; 18, 26; 22, 27; 24, 28; 24, 29; 25, 30; 26, 31; 26, 32; 28, 33; 28, 34; 29, 35; 35, 36 | def _parse_and_sort_accept_header(accept_header):
"""Parse and sort the accept header items.
>>> _parse_and_sort_accept_header('application/json;q=0.5, text/*')
[('text/*', 1.0), ('application/json', 0.5)]
"""
return sorted([_split_into_mimetype_and_priority(x) for x in accept_header.split(',')],
... |
0, module; 1, function_definition; 2, function_name:sort_name; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:""" Get the sorting name of this category """; 10, boolean_operator; 11, block; 12, attribute; 13, attribute; 14, attribute; 15, return_st... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 8, 12; 10, 13; 10, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 20, 23; 20, 24; 22, 25; 22, 26; 25, 27; 25, 28 | def sort_name(self):
""" Get the sorting name of this category """
if self._record and self._record.sort_name:
return self._record.sort_name
return self.name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.