nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:get_keys; 3, parameters; 4, block; 5, identifier:data_list; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:leading_columns; 13, identifier:LEADING_COLUMNS; 14, co... | 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; 19, 25; 19, 26; 19, 27; 20, 28; 20, 29; 22, 30; 22, 31; 25, 32; 25, 33; 26, 34; 27, 35; 29, 36; 29, 37; 30, 38; 30, 39; 31, 40; 32, 41; 32, 42; 33, 43; 3... | def get_keys(data_list, leading_columns=LEADING_COLUMNS):
"""Gets all possible keys from a list of dicts, sorting by leading_columns first
Args:
data_list: list of dicts to pull keys from
leading_columns: list of keys to put first in the result
Returns:
list of keys to be included ... |
0, module; 1, function_definition; 2, function_name:to_file; 3, parameters; 4, block; 5, identifier:self; 6, identifier:f; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, if_statement; 13, if_statement; 14, try_statement; 15, identifier:sorted; 16, True;... | 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; 13, 29; 13, 30; 13, 31; 14, 32; 14, 33; 22, 34; 22, 35; 24, 36; 25, 37; 26, 38; 26, 39; 27, 40; 28, 41; 29, 42; 29, 43; 30, 4... | def to_file(self, f, sorted=True, relativize=True, nl=None):
"""Write a zone to a file.
@param f: file or string. If I{f} is a string, it is treated
as the name of a file to open.
@param sorted: if True, the file will be written with the
names sorted in DNSSEC order from least ... |
0, module; 1, function_definition; 2, function_name:_sorted_keys; 3, parameters; 4, block; 5, identifier:self; 6, identifier:keys; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, for_statement; 11, for_statement; 12, if_statement; 13, return_statement; 14, comment:"""Sort keys, dropping the ones ... | 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; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 12, 25; 13, 26; 15, 27; 15, 28; 16, 29; 16, 30; 17, 31; 19, 32; 19, 33; 20, 34; 22, 35; 22, 36; 23, 37; 24, 38; 24, 39; 25, 40; 29, 41; 30, 42; 31, 43; 33... | def _sorted_keys(self, keys):
"""Sort keys, dropping the ones that should be ignored.
The keys that are in ``self.ignored_keys`` or that end on
'_best' are dropped. Among the remaining keys:
* 'epoch' is put first;
* 'dur' is put last;
* keys that start with 'event... |
0, module; 1, function_definition; 2, function_name:sort_values; 3, parameters; 4, block; 5, identifier:expr; 6, identifier:by; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, return_statement; 12, identifier:ascending; 13, True; 14, comment:"""
Sort the collection by v... | 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; 16, 20; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 22, 28; 22, 29; 24, 30; 24, 31; 24, 32; 24, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 28, 40; 29, 41; 29, 42; 31, 43; 3... | def sort_values(expr, by, ascending=True):
"""
Sort the collection by values. `sort` is an alias name for `sort_values`
:param expr: collection
:param by: the sequence or sequences to sort
:param ascending: Sort ascending vs. descending. Sepecify list for multiple sort orders.
... |
0, module; 1, function_definition; 2, function_name:reshuffle; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:by; 15, None; ... | 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; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 10, 21; 11, 22; 12, 23; 12, 24; 13, 25; 21, 26; 21, 27; 22, 28; 22, 29; 24, 30; 25, 31; 25, 32; 27, 33; 27, 34; 29, 35; 29, 36; 30, 37; 32, 38; 32, 39; 34, 40; 34, 41; 35, 42; 35, 43; 36, 4... | def reshuffle(expr, by=None, sort=None, ascending=True):
"""
Reshuffle data.
:param expr:
:param by: the sequence or scalar to shuffle by. RandomScalar as default
:param sort: the sequence or scalar to sort.
:param ascending: True if ascending else False
:return: collection
"""
by ... |
0, module; 1, function_definition; 2, function_name:cumsum; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:sort; 15, None; 16, ide... | 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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 12, 26; 12, 27; 13, 28; 25, 29; 25, 30; 26, 31; 27, 32; 28, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 31, 39; 32, 40; 34, 41; 34, 42; 34, 43; 34, 44... | def cumsum(expr, sort=None, ascending=True, unique=False,
preceding=None, following=None):
"""
Calculate cumulative summation of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:p... |
0, module; 1, function_definition; 2, function_name:cummax; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, return_statement; 13, identifier:sort; 14, None; 15, identifier:ascending;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 12, 24; 24, 25; 24, 26; 26, 27; 26, 28; 26, 29; 26, 30; 26, 31; 26, 32; 26, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 31, 39; 32, 40; 32, 41; 33, 42; 33, 43 | def cummax(expr, sort=None, ascending=True, unique=False,
preceding=None, following=None):
"""
Calculate cumulative maximum of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:par... |
0, module; 1, function_definition; 2, function_name:cummin; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, return_statement; 13, identifier:sort; 14, None; 15, identifier:ascending;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 12, 24; 24, 25; 24, 26; 26, 27; 26, 28; 26, 29; 26, 30; 26, 31; 26, 32; 26, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 31, 39; 32, 40; 32, 41; 33, 42; 33, 43 | def cummin(expr, sort=None, ascending=True, unique=False,
preceding=None, following=None):
"""
Calculate cumulative minimum of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:par... |
0, module; 1, function_definition; 2, function_name:cummean; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:sort; 15, None... | 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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 25, 27; 25, 28; 26, 29; 26, 30; 28, 31; 28, 32; 30, 33; 30, 34; 30, 35; 30, 36; 30, 37; 30, 38; 30, 39; 30, 40; 32, 41; 35, 42; 35, 43; 36, 44... | def cummean(expr, sort=None, ascending=True, unique=False,
preceding=None, following=None):
"""
Calculate cumulative mean of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:para... |
0, module; 1, function_definition; 2, function_name:cummedian; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:sort; 15, No... | 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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 25, 27; 25, 28; 26, 29; 26, 30; 28, 31; 28, 32; 30, 33; 30, 34; 30, 35; 30, 36; 30, 37; 30, 38; 30, 39; 30, 40; 32, 41; 35, 42; 35, 43; 36, 44... | def cummedian(expr, sort=None, ascending=True, unique=False,
preceding=None, following=None):
"""
Calculate cumulative median of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
... |
0, module; 1, function_definition; 2, function_name:cumcount; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:sort; 15, Non... | 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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 25, 27; 25, 28; 26, 29; 26, 30; 28, 31; 28, 32; 30, 33; 30, 34; 30, 35; 30, 36; 30, 37; 30, 38; 30, 39; 30, 40; 35, 41; 35, 42; 36, 43; 36, 44... | def cumcount(expr, sort=None, ascending=True, unique=False,
preceding=None, following=None):
"""
Calculate cumulative count of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:p... |
0, module; 1, function_definition; 2, function_name:cumstd; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:sort; 15, None;... | 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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 25, 27; 25, 28; 26, 29; 26, 30; 28, 31; 28, 32; 30, 33; 30, 34; 30, 35; 30, 36; 30, 37; 30, 38; 30, 39; 30, 40; 32, 41; 35, 42; 35, 43; 36, 44... | def cumstd(expr, sort=None, ascending=True, unique=False,
preceding=None, following=None):
"""
Calculate cumulative standard deviation of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending ord... |
0, module; 1, function_definition; 2, function_name:nth_value; 3, parameters; 4, block; 5, identifier:expr; 6, identifier:nth; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, return_statement; 12, identifier:skip_nulls; 13, False; 14, identifier:sort; 15, None; 16, identi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 19, 20; 19, 21; 21, 22; 21, 23; 21, 24; 21, 25; 21, 26; 21, 27; 21, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 30, 39; 30, 40 | def nth_value(expr, nth, skip_nulls=False, sort=None, ascending=True):
"""
Get nth value of a grouped and sorted expression.
:param expr: expression for calculation
:param nth: integer position
:param skip_nulls: whether to skip null values, False by default
:param sort: name of the sort column... |
0, module; 1, function_definition; 2, function_name:rank; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:sort; 11, None; 12, identifier:ascending; 13, True; 14, comment:"""
Calculate rank of a sequence expression.... | 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; 17, 18; 17, 19; 17, 20; 17, 21; 17, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28 | def rank(expr, sort=None, ascending=True):
"""
Calculate rank of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:return: calculated column
"""
return _rank_op(expr, Rank, types.int6... |
0, module; 1, function_definition; 2, function_name:dense_rank; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:sort; 11, None; 12, identifier:ascending; 13, True; 14, comment:"""
Calculate dense rank of a sequence... | 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; 17, 18; 17, 19; 17, 20; 17, 21; 17, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28 | def dense_rank(expr, sort=None, ascending=True):
"""
Calculate dense rank of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:return: calculated column
"""
return _rank_op(expr, Dens... |
0, module; 1, function_definition; 2, function_name:percent_rank; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:sort; 11, None; 12, identifier:ascending; 13, True; 14, comment:"""
Calculate percentage rank of a s... | 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; 17, 18; 17, 19; 17, 20; 17, 21; 17, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28 | def percent_rank(expr, sort=None, ascending=True):
"""
Calculate percentage rank of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:return: calculated column
"""
return _rank_op(exp... |
0, module; 1, function_definition; 2, function_name:row_number; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:sort; 11, None; 12, identifier:ascending; 13, True; 14, comment:"""
Calculate row number of a sequence... | 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; 17, 18; 17, 19; 17, 20; 17, 21; 17, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28 | def row_number(expr, sort=None, ascending=True):
"""
Calculate row number of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:return: calculated column
"""
return _rank_op(expr, RowN... |
0, module; 1, function_definition; 2, function_name:qcut; 3, parameters; 4, block; 5, identifier:expr; 6, identifier:bins; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:labels; 14, False; 15, identifier:sort; 16, None; ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 9, 18; 10, 19; 11, 20; 11, 21; 12, 22; 20, 23; 20, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29; 25, 30; 27, 31; 27, 32; 27, 33; 27, 34; 27, 35; 27, 36; 30, 37; 30, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; 35,... | def qcut(expr, bins, labels=False, sort=None, ascending=True):
"""
Get quantile-based bin indices of every element of a grouped and sorted expression.
The indices of bins start from 0. If cuts are not of equal sizes, extra items will
be appended into the first group.
:param expr: expression for cal... |
0, module; 1, function_definition; 2, function_name:cume_dist; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:sort; 11, None; 12, identifier:ascending; 13, True; 14, comment:"""
Calculate cumulative ratio of a seq... | 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; 17, 18; 17, 19; 17, 20; 17, 21; 17, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28 | def cume_dist(expr, sort=None, ascending=True):
"""
Calculate cumulative ratio of a sequence expression.
:param expr: expression for calculation
:param sort: name of the sort column
:param ascending: whether to sort in ascending order
:return: calculated column
"""
return _rank_op(expr,... |
0, module; 1, function_definition; 2, function_name:lag; 3, parameters; 4, block; 5, identifier:expr; 6, identifier:offset; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, return_statement; 12, identifier:default; 13, None; 14, identifier:sort; 15, None; 16, identifier:as... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 19, 20; 19, 21; 21, 22; 21, 23; 21, 24; 21, 25; 21, 26; 21, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33 | def lag(expr, offset, default=None, sort=None, ascending=True):
"""
Get value in the row ``offset`` rows prior to the current row.
:param offset: the offset value
:param default: default value for the function, when there are no rows satisfying the offset
:param expr: expression for calculation
... |
0, module; 1, function_definition; 2, function_name:lead; 3, parameters; 4, block; 5, identifier:expr; 6, identifier:offset; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, return_statement; 12, identifier:default; 13, None; 14, identifier:sort; 15, None; 16, identifier:a... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 19, 20; 19, 21; 21, 22; 21, 23; 21, 24; 21, 25; 21, 26; 21, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33 | def lead(expr, offset, default=None, sort=None, ascending=True):
"""
Get value in the row ``offset`` rows after to the current row.
:param offset: the offset value
:param default: default value for the function, when there are no rows satisfying the offset
:param expr: expression for calculation
... |
0, module; 1, function_definition; 2, function_name:value_counts; 3, parameters; 4, block; 5, identifier:expr; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:sort; 14, True; 15, 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; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 26, 31; 26, 32; 28, 33; 28, 34; 28, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 31, 41; 31, 42; 32, 43; 32, ... | def value_counts(expr, sort=True, ascending=False, dropna=False):
"""
Return object containing counts of unique values.
The resulting object will be in descending order so that the first element is the most frequently-occuring
element. Exclude NA values by default
:param expr: sequence
:param ... |
0, module; 1, function_definition; 2, function_name:last; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, dictionary_splat_pattern; 8, expression_statement; 9, return_statement; 10, identifier:limit; 11, integer:1; 12, identifier:kwargs; 13, comment:"""
Returns the last `limit` records ins... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 8, 13; 9, 14; 14, 15; 14, 16; 15, 17; 15, 18; 16, 19; 19, 20; 19, 21; 20, 22; 20, 23; 21, 24; 21, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 30, 39; 32, 40; 37, 41; 37, 42; 38, 43;... | def last(self, limit=1, **kwargs):
"""
Returns the last `limit` records inserted in the model's table in the replica database. Rows are sorted by ``created_at``.
"""
return self.collection_instance(
self.db_adapter(
db_name=kwargs.get('db'),
ro... |
0, module; 1, function_definition; 2, function_name:_compile_itemsort; 3, parameters; 4, block; 5, expression_statement; 6, function_definition; 7, function_definition; 8, function_definition; 9, function_definition; 10, function_definition; 11, comment:# priority list for map sorting (in order of checking); 12, commen... | 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; 4, 19; 5, 20; 6, 21; 6, 22; 6, 23; 7, 24; 7, 25; 7, 26; 8, 27; 8, 28; 8, 29; 9, 30; 9, 31; 9, 32; 10, 33; 10, 34; 10, 35; 16, 36; 18, 37; 18, 38; 18, 39; 19, 40; 20, 41; 22, 42; 23, 43; 25, 44; 26, 45; 2... | def _compile_itemsort():
'''return sort function of mappings'''
def is_extra(key_):
return key_ is Extra
def is_remove(key_):
return isinstance(key_, Remove)
def is_marker(key_):
return isinstance(key_, Marker)
def is_type(key_):
return inspect.isclass(key_)
... |
0, module; 1, function_definition; 2, function_name:_compile_dict; 3, parameters; 4, block; 5, identifier:self; 6, identifier:schema; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, function_definition; 13, return_statement; 14, comment:"""Vali... | 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; 20, 31; 22, 32; 22, 33; 23, 34; 23, 35; 23, 36; 23, 37; 23, 38; 23, 39; 23, 40; 23, 41; 26, 42; 26, 43; 3... | def _compile_dict(self, schema):
"""Validate a dictionary.
A dictionary schema can contain a set of values, or at most one
validator function/type.
A dictionary schema will only validate a dictionary:
>>> validate = Schema({})
>>> with raises(er.MultipleInvalid... |
0, module; 1, function_definition; 2, function_name:to_list; 3, parameters; 4, block; 5, identifier:self; 6, identifier:length; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comment:"""Get a list of documents.
.. testsetup:: to_... | 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; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 14, 23; 14, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 20, 32; 21, 33; 25, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 30, 42; 30, 43; 31... | def to_list(self, length):
"""Get a list of documents.
.. testsetup:: to_list
MongoClient().test.test_collection.delete_many({})
MongoClient().test.test_collection.insert_many([{'_id': i} for i in range(4)])
from tornado import ioloop
.. doctest:: to_list
... |
0, module; 1, function_definition; 2, function_name:find; 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, return_statement; 12, identifier:args; 13, identifier:kwargs; 14, comment:"""Find and... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 21, 26; 21, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 25, 33; 27, 34; 27, 35; 27, 36; 29, 37; 29, 38; 30, 39; 30, 40; 32, 41; 33, 42; 35, 43; ... | def find(self, *args, **kwargs):
"""Find and return the files collection documents that match ``filter``.
Returns a cursor that iterates across files matching
arbitrary queries on the files collection. Can be combined
with other modifiers for additional control.
For example::
... |
0, module; 1, function_definition; 2, function_name:_serial_poller; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, while_statement; 8, expression_statement; 9, comment:""" Priority-sorted list of checks
Highest priority is the 'halt' channel, which is used to kill the
thread a... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 8, 12; 11, 13; 11, 14; 12, 15; 12, 16; 13, 17; 14, 18; 14, 19; 14, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 19, 32; 19, 33; 19, 34; 20, 35; 20, 36; 20, 37; 21, 38; 21, 39; 22, 40; 22, 41; 25, 42; 25, 4... | def _serial_poller(self):
""" Priority-sorted list of checks
Highest priority is the 'halt' channel, which is used to kill the
thread and the serial communication channel and allow everything to be
cleaned up.
Second is the lid-open interrupt, which should trigger a callback
... |
0, module; 1, function_definition; 2, function_name:enqueue_at; 3, parameters; 4, block; 5, identifier:self; 6, identifier:scheduled_time; 7, identifier:func; 8, list_splat_pattern; 9, dictionary_splat_pattern; 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; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 8, 20; 9, 21; 10, 22; 11, 23; 12, 24; 13, 25; 14, 26; 15, 27; 16, 28; 17, 29; 18, 30; 19, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29, 44... | def enqueue_at(self, scheduled_time, func, *args, **kwargs):
"""
Pushes a job to the scheduler queue. The scheduled queue is a Redis sorted
set ordered by timestamp - which in this case is job's scheduled execution time.
All args and kwargs are passed onto the job, except for the follow... |
0, module; 1, function_definition; 2, function_name:_getMostActiveCells; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# include a tie-breaker before sorting; 10, expression_statement; 11, expression_statement; 12, expression_statement... | 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; 10, 18; 11, 19; 12, 20; 13, 21; 13, 22; 13, 23; 14, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 23, 38; 24, 39; 24, 40; 26, 41; 26, 42; 28, 43; 28... | def _getMostActiveCells(self):
"""
Gets the most active cells in the Union SDR having at least non-zero
activation in sorted order.
@return: a list of cell indices
"""
poolingActivation = self._poolingActivation
nonZeroCells = numpy.argwhere(poolingActivation > 0)[:,0]
# include a tie-b... |
0, module; 1, function_definition; 2, function_name:printNetwork; 3, parameters; 4, block; 5, identifier:network; 6, expression_statement; 7, print_statement; 8, for_statement; 9, comment:"""
Given a network, print out regions sorted by phase
"""; 10, string:"The network has"; 11, call; 12, string:"regions"; 13, id... | 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; 8, 14; 8, 15; 11, 16; 11, 17; 14, 18; 14, 19; 15, 20; 15, 21; 17, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 27, 33; 27, 34; 28, 35; 29, 36; 29, 37; 31, 38; 31, 39; 33, 40; 33, 41; 35, 42; 35, 43; ... | def printNetwork(network):
"""
Given a network, print out regions sorted by phase
"""
print "The network has",len(network.regions.values()),"regions"
for p in range(network.getMaxPhase()):
print "=== Phase",p
for region in network.regions.values():
if network.getPhases(region.name)[0] == p:
... |
0, module; 1, function_definition; 2, function_name:argmaxMulti; 3, parameters; 4, block; 5, identifier:a; 6, identifier:groupKeys; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:# Break ties by finding the insert... | 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; 7, 18; 7, 19; 8, 20; 9, 21; 9, 22; 9, 23; 10, 24; 11, 25; 12, 26; 16, 27; 17, 28; 17, 29; 17, 30; 21, 31; 23, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 29, 43; 30, 44; ... | def argmaxMulti(a, groupKeys, assumeSorted=False):
"""
This is like numpy's argmax, but it returns multiple maximums.
It gets the indices of the max values of each group in 'a', grouping the
elements by their corresponding value in 'groupKeys'.
@param a (numpy array)
An array of values that will be compar... |
0, module; 1, function_definition; 2, function_name:getAllCellsInColumns; 3, parameters; 4, block; 5, identifier:columns; 6, identifier:cellsPerColumn; 7, expression_statement; 8, comment:# Add; 9, comment:# [[beginningOfColumn0],; 10, comment:# [beginningOfColumn1],; 11, comment:# ...]; 12, comment:# to; 13, ... | 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; 7, 20; 19, 21; 21, 22; 21, 23; 22, 24; 22, 25; 24, 26; 26, 27; 26, 28; 27, 29; 27, 30; 28, 31; 28, 32; 29, 33; 29, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 35, 41; 35, 42; 39, 43; 39, 4... | def getAllCellsInColumns(columns, cellsPerColumn):
"""
Calculate all cell indices in the specified columns.
@param columns (numpy array)
@param cellsPerColumn (int)
@return (numpy array)
All cells within the specified columns. The cells are in the same order as the
provided columns, so they're sorted if... |
0, module; 1, function_definition; 2, function_name:shuffle_sparse_matrix_and_labels; 3, parameters; 4, block; 5, identifier:matrix; 6, identifier:labels; 7, expression_statement; 8, print_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, 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; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 13, 22; 14, 23; 15, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 24, 35; 24, 36; 26, 37; 26, 38; 28, 39; 28, 40; 29, 41; 29, 42; 30, 43; 31,... | def shuffle_sparse_matrix_and_labels(matrix, labels):
"""
Shuffles a sparse matrix and set of labels together.
Resorts to densifying and then re-sparsifying the matrix, for
convenience. Still very fast.
"""
print "Shuffling data"
new_matrix = matrix.toDense()
rng_state = numpy.random.get_state()
nump... |
0, module; 1, function_definition; 2, function_name:compute; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sensorToBodyByColumn; 7, identifier:sensorToSpecificObjectByColumn; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, comment... | 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; 8, 20; 9, 21; 10, 22; 11, 23; 11, 24; 11, 25; 12, 26; 17, 27; 18, 28; 18, 29; 18, 30; 18, 31; 19, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 25, 44... | def compute(self, sensorToBodyByColumn, sensorToSpecificObjectByColumn):
"""
Compute the
"body's location relative to a specific object"
from an array of
"sensor's location relative to a specific object"
and an array of
"sensor's location relative to body"
These arrays consist of ... |
0, module; 1, function_definition; 2, function_name:metricCompute; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sensorToBody; 7, identifier:bodyToSpecificObject; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""
Compute the
"sen... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 10, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 26, 35; 26, 36; 30, 37; 30, 38; 31, 39; 32, 40; 32, 41; 34, 42; 34, 43... | def metricCompute(self, sensorToBody, bodyToSpecificObject):
"""
Compute the
"sensor's location relative to a specific object"
from the
"body's location relative to a specific object"
and the
"sensor's location relative to body"
@param sensorToBody (numpy array)
Active cells o... |
0, module; 1, function_definition; 2, function_name:compute; 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, comment:# inference step; 14, if_statement; 15, identif... | 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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 12, 27; 14, 28; 14, 29; 14, 30; 14, 31; 14, 32; 14, 33; 26, 34; 26, 35; 27, 36; 28, 37; 29, 38; 31, 39; 31, 40; 33, 41; 36, 42; 38, 43; 39, 44;... | def compute(self, feedforwardInput=(), lateralInputs=(),
feedforwardGrowthCandidates=None, learn=True,
predictedInput = None,):
"""
Runs one time step of the column pooler algorithm.
@param feedforwardInput (sequence)
Sorted indices of active feedforward input bits
... |
0, module; 1, function_definition; 2, function_name:_learn; 3, parameters; 4, block; 5, comment:# mutated args; 6, identifier:permanences; 7, identifier:rng; 8, comment:# activity; 9, identifier:activeCells; 10, identifier:activeInput; 11, identifier:growthCandidateInput; 12, comment:# configuration; 13, identifier:sam... | 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; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 18, 23; 19, 24; 20, 25; 21, 26; 22, 27; 22, 28; 22, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 29, 39; 30, 40; 30, 41; 31, 42; 31, 43; 31, 44;... | def _learn(# mutated args
permanences, rng,
# activity
activeCells, activeInput, growthCandidateInput,
# configuration
sampleSize, initialPermanence, permanenceIncrement,
permanenceDecrement, connectedPermanence):
"""
For each activ... |
0, module; 1, function_definition; 2, function_name:compute; 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, expression_statement; 13, expression_statement; 14, comment:# When we're ... | 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; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 10, 26; 11, 27; 12, 28; 13, 29; 15, 30; 15, 31; 15, 32; 16, 33; 16, 34; 16, 35; 16, 36; 16, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31, 44; 3... | def compute(self, deltaLocation=(), newLocation=(),
featureLocationInput=(), featureLocationGrowthCandidates=(),
learn=True):
"""
Run one time step of the Location Memory algorithm.
@param deltaLocation (sorted numpy array)
@param newLocation (sorted numpy array)
@param ... |
0, module; 1, function_definition; 2, function_name:getmerge; 3, parameters; 4, block; 5, identifier:self; 6, identifier:path; 7, identifier:dst; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, expression_s... | 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; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 11, 23; 12, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 16, 30; 21, 31; 22, 32; 23, 33; 24, 34; 25, 35; 26, 36; 26, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 29, 43; 30, 4... | def getmerge(self, path, dst, newline=False, check_crc=False):
''' Get all the files in the directories that
match the source file pattern and merge and sort them to only
one file on local fs.
:param paths: Directory containing files that will be merged
:type paths: string
... |
0, module; 1, function_definition; 2, function_name:countByValue; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""Apply countByValue to every RDD.abs
:rtype: DStream
.. warning::
Implemented as a local operation.
Example:
... | 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; 15, 17; 16, 18; 16, 19; 18, 20; 18, 21; 19, 22; 20, 23; 20, 24; 22, 25; 22, 26; 23, 27; 23, 28; 25, 29; 25, 30; 29, 31; 29, 32; 31, 33; 31, 34 | def countByValue(self):
"""Apply countByValue to every RDD.abs
:rtype: DStream
.. warning::
Implemented as a local operation.
Example:
>>> import pysparkling
>>> sc = pysparkling.Context()
>>> ssc = pysparkling.streaming.StreamingContext(sc, 0.1)
... |
0, module; 1, function_definition; 2, function_name:_contiguous_offsets; 3, parameters; 4, block; 5, identifier:self; 6, identifier:offsets; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""
Sorts the input list of integer offsets,
ensures that val... | 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; 17, 22; 17, 23; 20, 24; 21, 25; 21, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 27, 34; 29, 35; 29, 36; 30, 37; 30, 38; 32, 39; 34, 40; 35, 41; 35, 42; 38, 43; ... | def _contiguous_offsets(self, offsets):
"""
Sorts the input list of integer offsets,
ensures that values are contiguous.
"""
offsets.sort()
for i in range(len(offsets) - 1):
assert offsets[i] + 1 == offsets[i + 1], \
"Offsets not contiguous: %s... |
0, module; 1, function_definition; 2, function_name:_collapse; 3, parameters; 4, block; 5, identifier:intervals; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, if_statement; 10, comment:"""
Collapse an iterable of intervals sorted by start coord.
"""; 11, assignment; 12, pattern_lis... | 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; 11, 17; 11, 18; 12, 19; 12, 20; 14, 21; 15, 22; 15, 23; 16, 24; 21, 25; 21, 26; 21, 27; 21, 28; 24, 29; 25, 30; 25, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 29, 37; 32, 38; 33, 39; 33, 40; 33, 41; 34, 42; 35, 43; 3... | def _collapse(intervals):
"""
Collapse an iterable of intervals sorted by start coord.
"""
span = None
for start, stop in intervals:
if span is None:
span = _Interval(start, stop)
elif start <= span.stop < stop:
span = _Interval(span.start, stop)
... |
0, module; 1, function_definition; 2, function_name:remove; 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, if_statement; 13, expression_statement; 14, identifier:index; 15, None; 16, identifi... | 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; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 12, 26; 13, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 27, 40; 27, 41; 30, 42; 33, 43; 34, 4... | def remove(self, index=None, hash=None, keepSorted=True):
"""
Removes a particle from the simulation.
Parameters
----------
index : int, optional
Specify particle to remove by index.
hash : c_uint32 or string, optional
Specifiy particle to remove... |
0, module; 1, function_definition; 2, function_name:particles; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""
Access the variational... | 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; 10, 19; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 23, 34; 23, 35; 26, 36; 26, 37; 28, 38; 29, 39; 31, 40; 31, 41; 33, 42; 33, 43; 34,... | def particles(self):
"""
Access the variational particles corresponding to this set of variational equations.
The function returns a list of particles which are sorted in the same way as those in
sim.particles
The particles are pointers and thus can be modified.
If t... |
0, module; 1, function_definition; 2, function_name:filter_queryset; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, identifier:queryset; 8, identifier:view; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, comment:""""Filter... | 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; 9, 14; 10, 15; 11, 16; 12, 17; 12, 18; 13, 19; 15, 20; 15, 21; 16, 22; 16, 23; 18, 24; 20, 25; 20, 26; 21, 27; 21, 28; 23, 29; 23, 30; 24, 31; 29, 32; 29, 33; 30, 34; 30, 35; 30, 36; 31, 37; 31, 38; 37, 39; 37, 40; 38, 41; 41, 42 | def filter_queryset(self, request, queryset, view):
""""Filter the queryset, applying the ordering.
The `ordering_param` can be overwritten here.
In DRF, the ordering_param is 'ordering', but we support changing it
to allow the viewset to control the parameter.
"""
self.... |
0, module; 1, function_definition; 2, function_name:get_ordering; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, identifier:queryset; 8, identifier:view; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, comment:# No sorting was included; 13, return_statement; 14, comment:... | 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; 9, 14; 10, 15; 11, 16; 11, 17; 13, 18; 15, 19; 15, 20; 17, 21; 17, 22; 17, 23; 17, 24; 17, 25; 18, 26; 18, 27; 20, 28; 20, 29; 21, 30; 22, 31; 25, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 30, 41; 30, 42; 31, 43;... | def get_ordering(self, request, queryset, view):
"""Return an ordering for a given request.
DRF expects a comma separated list, while DREST expects an array.
This method overwrites the DRF default so it can parse the array.
"""
params = view.get_request_feature(view.SORT)
... |
0, module; 1, function_definition; 2, function_name:remove_invalid_fields; 3, parameters; 4, block; 5, identifier:self; 6, identifier:queryset; 7, identifier:fields; 8, identifier:view; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# for each field sent down from the query par... | 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; 14, 19; 14, 20; 14, 21; 15, 22; 17, 23; 17, 24; 18, 25; 18, 26; 21, 27; 21, 28; 21, 29; 21, 30; 21, 31; 22, 32; 22, 33; 27, 34; 29, 35; 30, 36; 31, 37; 31, 38; 31, 39; 34, 40; 34, 41; 35, 42; 35, 43; 3... | def remove_invalid_fields(self, queryset, fields, view):
"""Remove invalid fields from an ordering.
Overwrites the DRF default remove_invalid_fields method to return
both the valid orderings and any invalid orderings.
"""
valid_orderings = []
invalid_orderings = []
... |
0, module; 1, function_definition; 2, function_name:_format_dataframe; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, default_parameter; 8, attribute; 9, expression_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, return_statement; 15, identifier:df; 16, type; 17,... | 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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 10, 22; 10, 23; 11, 24; 11, 25; 12, 26; 13, 27; 13, 28; 14, 29; 16, 30; 22, 31; 22, 32; 23, 33; 25, 34; 25, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 29, 43; 29, 44... | def _format_dataframe(
df: pd.DataFrame, nautical_units=True
) -> pd.DataFrame:
"""
This function converts types, strips spaces after callsigns and sorts
the DataFrame by timestamp.
For some reason, all data arriving from OpenSky are converted to
units in metric syst... |
0, module; 1, function_definition; 2, function_name:find_package_indexes_in_dir; 3, parameters; 4, block; 5, identifier:self; 6, identifier:simple_dir; 7, expression_statement; 8, expression_statement; 9, comment:# Package indexes must be in directories, so ignore anything else.; 10, expression_statement; 11, return_st... | 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; 10, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 17, 20; 17, 21; 19, 22; 19, 23; 19, 24; 21, 25; 23, 26; 23, 27; 24, 28; 25, 29; 25, 30; 25, 31; 28, 32; 28, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 35, 41; 37, 42; 37, 43... | def find_package_indexes_in_dir(self, simple_dir):
"""Given a directory that contains simple packages indexes, return
a sorted list of normalized package names. This presumes every
directory within is a simple package index directory."""
packages = sorted(
{
... |
0, module; 1, function_definition; 2, function_name:factorize; 3, parameters; 4, block; 5, identifier:train; 6, identifier:test; 7, identifier:features; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, for_statement; 13, return_statement; 14, identifier:na_value; 15, unar... | 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; 8, 14; 8, 15; 9, 16; 9, 17; 10, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 13, 24; 15, 25; 23, 26; 23, 27; 23, 28; 23, 29; 24, 30; 24, 31; 26, 32; 26, 33; 26, 34; 27, 35; 28, 36; 29, 37; 29, 38; 33, 39; 33, 40; 34, 41; 35, 42; 35, 43; 36... | def factorize(train, test, features, na_value=-9999, full=False, sort=True):
"""Factorize categorical features.
Parameters
----------
train : pd.DataFrame
test : pd.DataFrame
features : list
Column names in the DataFrame to be encoded.
na_value : int, default -9999
full : boo... |
0, module; 1, function_definition; 2, function_name:preferred_ordinal; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:attr_name; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Returns an ordering value for a particular attribute key.
... | 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; 15, 22; 16, 23; 16, 24; 18, 25; 18, 26; 20, 27; 20, 28; 21, 29; 22, 30; 25, 31; 25, 32; 26, 33; 29, 34; 29, 35; 30, 36; 35, 37; 35, 38; 36, 39; 36, 40; 37, 41; 37, 42; 38, 43; ... | def preferred_ordinal(cls, attr_name):
"""
Returns an ordering value for a particular attribute key.
Unrecognized attributes and OIDs will be sorted lexically at the end.
:return:
An orderable value.
"""
attr_name = cls.map(attr_name)
if attr_name ... |
0, module; 1, function_definition; 2, function_name:patience_sort; 3, parameters; 4, block; 5, identifier:xs; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, string:'''Patience sort an iterable, xs.
This function generates a series of pairs (x, pile), where "pile"
is the 0-based index of... | 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; 13, 16; 13, 17; 13, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 17, 24; 18, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 24, 31; 25, 32; 27, 33; 27, 34; 29, 35; 29, 36; 30, 37; 31, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43... | def patience_sort(xs):
'''Patience sort an iterable, xs.
This function generates a series of pairs (x, pile), where "pile"
is the 0-based index of the pile "x" should be placed on top of.
Elements of "xs" must be less-than comparable.
'''
pile_tops = list()
for x in xs:
pile = bisec... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statem... | 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; 6, 20; 7, 21; 8, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 13, 28; 14, 29; 15, 30; 15, 31; 15, 32; 15, 33; 16, 34; 16, 35; 16, 36; 17, 37; 18, 38; 19, 39; 21, 40; 21, 41; 22, 42; 22, 43; 23, 44; ... | def sort(args):
"""
%prog sort fastafile
Sort a list of sequences and output with sorted IDs, etc.
"""
p = OptionParser(sort.__doc__)
p.add_option("--sizes", default=False, action="store_true",
help="Sort by decreasing size [default: %default]")
opts, args = p.parse_args(a... |
0, module; 1, function_definition; 2, function_name:posmap; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, comment:# fasta; 12, expression_statement; 13, expression_statement; 14, if_statement; 15, co... | 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; 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; 7, 37; 8, 38; 9, 39; 9, 40; 10, 41; 12, 42; 13, 43; 14, 44; 14, 45; 16, 46; 1... | def posmap(args):
"""
%prog posmap frgscf.sorted scf.fasta scfID
Perform QC on the selected scfID, generate multiple BED files for plotting.
"""
p = OptionParser(posmap.__doc__)
opts, args = p.parse_args(args)
if len(args) != 3:
sys.exit(p.print_help())
frgscffile, fastafile,... |
0, module; 1, function_definition; 2, function_name:shred; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, comment:"""
... | 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; 7, 15; 8, 16; 9, 17; 9, 18; 10, 19; 11, 20; 12, 21; 13, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 24, 38; 24, 39; 25, 40; 25, 41; 26, 42; 26, 43; 27,... | def shred(args):
"""
%prog shred unitigfile
Shred the unitig into one fragment per unitig to fix. This is the last
resort as a desperate fix.
"""
p = OptionParser(shred.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(not p.print_help())
s, = args
u... |
0, module; 1, function_definition; 2, function_name:index; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15... | 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; 7, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 12, 25; 13, 26; 13, 27; 14, 28; 16, 29; 17, 30; 17, 31; 19, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, 44;... | def index(args):
"""
%prog index frgscf.sorted
Compress frgscffile.sorted and index it using `tabix`.
"""
p = OptionParser(index.__doc__)
opts, args = p.parse_args(args)
if len(args) != 1:
sys.exit(p.print_help())
frgscffile, = args
gzfile = frgscffile + ".gz"
cmd = "... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, 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; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 7, 21; 8, 22; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 15, 30; 16, 31; 17, 32; 18, 33; 18, 34; 19, 35; 19, 36; 19, 37; 21, 38; 21, 39; 22, 40; 22, 41; 23, 42; 23, 43; 24, 44; ... | def sort(args):
"""
%prog sort gffile
Sort gff file using plain old unix sort based on [chromosome, start coordinate].
or topologically based on hierarchy of features using the gt (genometools) toolkit
"""
valid_sort_methods = ("unix", "topo")
p = OptionParser(sort.__doc__)
p.add_optio... |
0, module; 1, function_definition; 2, function_name:sort_layout; 3, parameters; 4, block; 5, identifier:thread; 6, identifier:listfile; 7, default_parameter; 8, expression_statement; 9, import_from_statement; 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; 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; 7, 25; 7, 26; 8, 27; 9, 28; 9, 29; 10, 30; 11, 31; 12, 32; 13, 33; 14, 34; 15, 35; 16, 36; 16, 37; 16, 38; 17, 39; 18, 40; 19, 41; 20, 42; 21, 43; 21, 44; 21, 45... | def sort_layout(thread, listfile, column=0):
"""
Sort the syntelog table according to chromomomal positions. First orient the
contents against threadbed, then for contents not in threadbed, insert to
the nearest neighbor.
"""
from jcvi.formats.base import DictFile
outfile = listfile.rsplit(... |
0, module; 1, function_definition; 2, function_name:fromgroups; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, import_from_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_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; 6, 17; 7, 18; 7, 19; 8, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 16, 30; 16, 31; 18, 32; 18, 33; 18, 34; 19, 35; 20, 36; 20, 37; 21, 38; 21, 39; 22, 40; 22, 41; 23, 42; 24, 43; 24, 44... | def fromgroups(args):
"""
%prog fromgroups groupsfile a.bed b.bed ...
Flatten the gene familes into pairs, the groupsfile is a file with each line
containing the members, separated by comma. The commands also require
several bed files in order to sort the pairs into different piles (e.g.
pairs ... |
0, module; 1, function_definition; 2, function_name:merge_paths; 3, parameters; 4, block; 5, identifier:paths; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:weights; 12, None; 13, comment:"""
Zip together sorted lists.
>>> ... | 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; 10, 16; 14, 17; 14, 18; 15, 19; 15, 20; 18, 21; 18, 22; 20, 23; 20, 24; 22, 25; 22, 26; 24, 27; 26, 28; 26, 29 | def merge_paths(paths, weights=None):
"""
Zip together sorted lists.
>>> paths = [[1, 2, 3], [1, 3, 4], [2, 4, 5]]
>>> G = merge_paths(paths)
>>> nx.topological_sort(G)
[1, 2, 3, 4, 5]
>>> paths = [[1, 2, 3, 4], [1, 2, 3, 2, 4]]
>>> G = merge_paths(paths, weights=(1, 2))
>>> nx.topo... |
0, module; 1, function_definition; 2, function_name:build; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, import_from_statement; 8, import_from_statement; 9, import_from_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_st... | 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; 4, 24; 4, 25; 6, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 11, 34; 12, 35; 13, 36; 13, 37; 14, 38; 15, 39; 16, 40; 17, 41; 18, 42; 19, 43; 20, 44; 21, 45; 2... | def build(args):
"""
%prog build current.fasta Bacteria_Virus.fasta prefix
Build assembly files after a set of clean-ups:
1. Use cdhit (100%) to remove duplicate scaffolds
2. Screen against the bacteria and virus database (remove scaffolds 95% id, 50% cov)
3. Mask matches to UniVec_Core
4. ... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, import_statement; 8, return_statement; 9, comment:"""
%prog sort coordsfile
Sort coordsfile based on query or ref.
"""; 10, dotted_name; 11, call; 12, identifier:jcvi; 13, iden... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 10, 14; 11, 15; 11, 16; 15, 17; 15, 18; 16, 19; 17, 20; 17, 21; 19, 22; 19, 23; 20, 24; 20, 25; 23, 26 | def sort(args):
"""
%prog sort coordsfile
Sort coordsfile based on query or ref.
"""
import jcvi.formats.blast
return jcvi.formats.blast.sort(args + ["--coords"]) |
0, module; 1, function_definition; 2, function_name:coverage; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_st... | 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; 4, 24; 4, 25; 6, 26; 7, 27; 8, 28; 9, 29; 10, 30; 11, 31; 12, 32; 12, 33; 13, 34; 14, 35; 15, 36; 15, 37; 15, 38; 16, 39; 17, 40; 18, 41; 19, 42; 19, 43; 20, 44; 21, 45... | def coverage(args):
"""
%prog coverage fastafile bamfile
Calculate coverage for BAM file. BAM file will be sorted unless with
--nosort.
"""
p = OptionParser(coverage.__doc__)
p.add_option("--format", default="bigwig",
choices=("bedgraph", "bigwig", "coverage"),
... |
0, module; 1, function_definition; 2, function_name:_number_finder; 3, parameters; 4, block; 5, identifier:s; 6, identifier:regex; 7, identifier:numconv; 8, expression_statement; 9, comment:# Split. If there are no splits, return now; 10, expression_statement; 11, if_statement; 12, comment:# Now convert the numbers to... | 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; 8, 18; 10, 19; 11, 20; 11, 21; 13, 22; 14, 23; 14, 24; 14, 25; 17, 26; 17, 27; 17, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 22, 34; 22, 35; 24, 36; 24, 37; 25, 38; 26, 39; 27, 40; 28, 41; 30, 42; 30, 43; 31,... | def _number_finder(s, regex, numconv):
"""Helper to split numbers"""
# Split. If there are no splits, return now
s = regex.split(s)
if len(s) == 1:
return tuple(s)
# Now convert the numbers to numbers, and leave strings as strings
s = remove_empty(s)
for i in range(len(s)):
... |
0, module; 1, function_definition; 2, function_name:index_natsorted; 3, parameters; 4, block; 5, identifier:seq; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, import_from_statement; 12, expression_statement; 13, comment:# Pair the index and sequenc... | 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; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 11, 26; 11, 27; 12, 28; 14, 29; 15, 30; 16, 31; 18, 32; 18, 33; 26, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 30, 41; 31, 42; 31, 43; 32, 44; 3... | def index_natsorted(seq, key=lambda x: x, number_type=float, signed=True, exp=True):
"""\
Sorts a sequence naturally, but returns a list of sorted the
indeces and not the sorted list.
>>> a = ['num3', 'num5', 'num2']
>>> b = ['foo', 'bar', 'baz']
>>> index = index_natsorted(a)
... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:args; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, if_statem... | 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; 4, 24; 4, 25; 4, 26; 6, 27; 7, 28; 8, 29; 9, 30; 10, 31; 11, 32; 12, 33; 13, 34; 14, 35; 14, 36; 15, 37; 16, 38; 17, 39; 17, 40; 18, 41; 19, 42; 19, 43; 19, 44; 20, 45;... | def sort(args):
"""
%prog sort bedfile
Sort bed file to have ascending order of seqid, then start. It uses the
`sort` command.
"""
p = OptionParser(sort.__doc__)
p.add_option("-i", "--inplace", dest="inplace",
default=False, action="store_true",
help="Sort bed file i... |
0, module; 1, function_definition; 2, function_name:by_image_seq; 3, parameters; 4, block; 5, identifier:blocks; 6, identifier:image_seq; 7, expression_statement; 8, return_statement; 9, comment:"""Filter blocks to return only those associated with the provided image_seq number.
Argument:
List:blocks -- ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 12, 13; 13, 14; 13, 15; 15, 16; 15, 17; 16, 18; 16, 19; 18, 20; 19, 21; 19, 22; 21, 23; 21, 24; 23, 25; 23, 26; 25, 27; 25, 28 | def by_image_seq(blocks, image_seq):
"""Filter blocks to return only those associated with the provided image_seq number.
Argument:
List:blocks -- List of block objects to sort.
Int:image_seq -- image_seq number found in ec_hdr.
Returns:
List -- List of block indexes matchi... |
0, module; 1, function_definition; 2, function_name:by_vol_id; 3, parameters; 4, block; 5, identifier:blocks; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, comment:# sort block by volume; 10, comment:# not reliable with multiple partitions (fifo); 11, for_statement; 12, return_statement; 13... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 8, 16; 11, 17; 11, 18; 11, 19; 12, 20; 16, 21; 16, 22; 19, 23; 19, 24; 19, 25; 23, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 26, 32; 26, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 31, 40; 31, 41; 33, 42; 33, 43; 3... | def by_vol_id(blocks, slist=None):
"""Sort blocks by volume id
Arguments:
Obj:blocks -- List of block objects.
List:slist -- (optional) List of block indexes.
Return:
Dict -- blocks grouped in lists with dict key as volume id.
"""
vol_blocks = {}
# sort block by volume
# ... |
0, module; 1, function_definition; 2, function_name:by_type; 3, parameters; 4, block; 5, identifier:blocks; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, identifier:slist; ... | 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; 6, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 13, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 23, 33; 23, 34; 24, 35; 24, 36; 24, 37; 24, 38; 33, 39; 33, 40; 34, 41; 34, 42; 34, 43; 34,... | def by_type(blocks, slist=None):
"""Sort blocks into layout, internal volume, data or unknown
Arguments:
Obj:blocks -- List of block objects.
List:slist -- (optional) List of block indexes.
Returns:
List:layout -- List of block indexes of blocks containing the
volume t... |
0, module; 1, function_definition; 2, function_name:group_pairs; 3, parameters; 4, block; 5, identifier:blocks; 6, identifier:layout_blocks_list; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Sort a list of layout blocks into pairs
... | 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; 9, 16; 10, 17; 11, 18; 13, 19; 13, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 21, 27; 22, 28; 22, 29; 22, 30; 24, 31; 24, 32; 26, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43; 3... | def group_pairs(blocks, layout_blocks_list):
"""Sort a list of layout blocks into pairs
Arguments:
List:blocks -- List of block objects
List:layout_blocks -- List of layout block indexes
Returns:
List -- Layout block pair indexes grouped in a list
"""
image_dict={}
for bloc... |
0, module; 1, function_definition; 2, function_name:read_cBpack; 3, parameters; 4, block; 5, identifier:filename; 6, expression_statement; 7, with_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Read a file from an idiosyncratic format that we use for storing
approxima... | 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; 9, 16; 10, 17; 12, 18; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 17, 24; 17, 25; 18, 26; 19, 27; 21, 28; 21, 29; 22, 30; 22, 31; 23, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43; 3... | def read_cBpack(filename):
"""
Read a file from an idiosyncratic format that we use for storing
approximate word frequencies, called "cBpack".
The cBpack format is as follows:
- The file on disk is a gzipped file in msgpack format, which decodes to a
list whose first element is a header, and... |
0, module; 1, function_definition; 2, function_name:addDiscreteOutcomeConstantMean; 3, parameters; 4, block; 5, identifier:distribution; 6, identifier:x; 7, identifier:p; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identi... | 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; 8, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 13, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 20, 27; 20, 28; 20, 29; 21, 30; 24, 31; 24, 32; 26, 33; 26, 34; 27, 35; 28, 36; 29, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43; 3... | def addDiscreteOutcomeConstantMean(distribution, x, p, sort = False):
'''
Adds a discrete outcome of x with probability p to an existing distribution,
holding constant the relative probabilities of other outcomes and overall mean.
Parameters
----------
distribution : [np.array]
Two elem... |
0, module; 1, function_definition; 2, function_name:runStickyEregressionsInStata; 3, parameters; 4, block; 5, identifier:infile_name; 6, identifier:interval_size; 7, identifier:meas_err; 8, identifier:sticky; 9, identifier:all_specs; 10, identifier:stata_exe; 11, expression_statement; 12, expression_statement; 13, expr... | 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; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 15, 30; 15, 31; 17, 32; 19, 33; 20, 34; 20, 35; 21, 36; 23, 37; 24, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 44; 3... | def runStickyEregressionsInStata(infile_name,interval_size,meas_err,sticky,all_specs,stata_exe):
'''
Runs regressions for the main tables of the StickyC paper in Stata and produces a
LaTeX table with results for one "panel". Running in Stata allows production of
the KP-statistic, for which there is curr... |
0, module; 1, function_definition; 2, function_name:capability_functions; 3, parameters; 4, block; 5, identifier:self; 6, identifier:fn; 7, expression_statement; 8, if_statement; 9, comment:# build a list of functions to call; 10, expression_statement; 11, for_statement; 12, comment:# sort them by z-index; 13, 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; 7, 17; 8, 18; 8, 19; 10, 20; 11, 21; 11, 22; 11, 23; 13, 24; 14, 25; 14, 26; 16, 27; 16, 28; 16, 29; 19, 30; 20, 31; 20, 32; 22, 33; 22, 34; 23, 35; 23, 36; 23, 37; 24, 38; 24, 39; 26, 40; 27, 41; 27, 42; 29, 43; 29, ... | def capability_functions(self, fn):
"""This generator yields functions that match the
requested capability sorted by z-index."""
if _debug: Collector._debug("capability_functions %r", fn)
# build a list of functions to call
fns = []
for cls in self.capabilities:
... |
0, module; 1, function_definition; 2, function_name:add; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, for_statement; 9, return_statement; 10, identifier:items; 11, comment:"""
Add items to be sorted.
@param items: One or more items to be added.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 14, 16; 14, 17; 14, 18; 16, 19; 17, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 25, 31; 25, 32; 26, 33; 26, 34; 28, 35; 28, 36; 33, 37; 33, 38 | def add(self, *items):
"""
Add items to be sorted.
@param items: One or more items to be added.
@type items: I{item}
@return: self
@rtype: L{DepList}
"""
for item in items:
self.unsorted.append(item)
key = item[0]
self.i... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, return_statement; 12, comment:"""
Sort the list based on dependancies.
@return... | 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; 9, 16; 9, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 16, 24; 16, 25; 17, 26; 17, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 26, 42; 27, 43; 28... | def sort(self):
"""
Sort the list based on dependancies.
@return: The sorted items.
@rtype: list
"""
self.sorted = list()
self.pushed = set()
for item in self.unsorted:
popped = []
self.push(item)
while len(self.stack):
... |
0, module; 1, function_definition; 2, function_name:push; 3, parameters; 4, block; 5, identifier:self; 6, identifier:item; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""
Push and item onto the sorting stack.
@param i... | 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; 9, 15; 10, 16; 11, 17; 13, 18; 13, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 19, 27; 19, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 25, 34; 25, 35; 26, 36; 30, 37; 30, 38; 31, 39; 31, 40; 34, 41; 34, 42; 38, 43; ... | def push(self, item):
"""
Push and item onto the sorting stack.
@param item: An item to push.
@type item: I{item}
@return: The number of items pushed.
@rtype: int
"""
if item in self.pushed:
return
frame = (item, iter(item[1]))
... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:content; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Sort suds object attributes based on ordering defined
in the XSD type inf... | 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; 17, 22; 17, 23; 19, 24; 19, 25; 20, 26; 21, 27; 26, 28; 26, 29; 27, 30; 27, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 31, 37; 36, 38; 36, 39; 37, 40; 40, 41; 40, 42 | def sort(self, content):
"""
Sort suds object attributes based on ordering defined
in the XSD type information.
@param content: The content to sort.
@type content: L{Object}
@return: self
@rtype: L{Typed}
"""
v = content.value
if isinstance... |
0, module; 1, function_definition; 2, function_name:alerts; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:alert_level; 13, string; 14, comment:"""Get a filtered ... | 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; 13, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 21, 26; 21, 27; 23, 28; 23, 29; 25, 30; 25, 31; 26, 32; 26, 33; 28, 34; 28, 35; 31, 36; 31, 37; 31, 38; 32, 39; 32, 40; 36, 41; 36, 42; 36, 43; 3... | def alerts(self, alert_level='High'):
"""Get a filtered list of alerts at the given alert level, and sorted by alert level."""
alerts = self.zap.core.alerts()
alert_level_value = self.alert_levels[alert_level]
alerts = sorted((a for a in alerts if self.alert_levels[a['risk']] >= alert_l... |
0, module; 1, function_definition; 2, function_name:assortativity_bin; 3, parameters; 4, block; 5, identifier:CIJ; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, comment:# compute assortativity; 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; 6, 15; 6, 16; 7, 17; 8, 18; 8, 19; 8, 20; 8, 21; 10, 22; 11, 23; 12, 24; 13, 25; 14, 26; 17, 27; 18, 28; 18, 29; 20, 30; 20, 31; 20, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, 44... | def assortativity_bin(CIJ, flag=0):
'''
The assortativity coefficient is a correlation coefficient between the
degrees of all nodes on two opposite ends of a link. A positive
assortativity coefficient indicates that nodes tend to link to other
nodes with the same or similar degree.
Parameters
... |
0, module; 1, function_definition; 2, function_name:sort_coords; 3, parameters; 4, block; 5, identifier:coord; 6, expression_statement; 7, import_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""
Sorts a list of DimCoords trying to ensure that
dates and pressure ... | 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; 10, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 18, 23; 18, 24; 18, 25; 18, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43;... | def sort_coords(coord):
"""
Sorts a list of DimCoords trying to ensure that
dates and pressure levels appear first and the
longitude and latitude appear last in the correct
order.
"""
import iris
order = {'T': -2, 'Z': -1, 'X': 1, 'Y': 2}
axis = iris.util.guess_coord_axis(coord)
... |
0, module; 1, function_definition; 2, function_name:separate_groups; 3, parameters; 4, block; 5, identifier:groups; 6, identifier:key; 7, identifier:total; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# If every group is optimal return; 12, if_statement; 13, comment:# Some gro... | 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; 8, 20; 9, 21; 10, 22; 12, 23; 12, 24; 15, 25; 16, 26; 17, 27; 18, 28; 19, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29, 44... | def separate_groups(groups, key, total):
"""Separate the group into overloaded and under-loaded groups.
The revised over-loaded groups increases the choice space for future
selection of most suitable group based on search criteria.
For example:
Given the groups (a:4, b:4, c:3, d:2) where the numbe... |
0, module; 1, function_definition; 2, function_name:zrange; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:start; 8, identifier:end; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, if_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; 9, 18; 9, 19; 10, 20; 10, 21; 11, 22; 11, 23; 12, 24; 13, 25; 13, 26; 14, 27; 15, 28; 15, 29; 16, 30; 17, 31; 26, 32; 27, 33; 27, 34; 29, 35; 30, 36; 30, 37; 31, 38; 32, 39; 34, 40; 34, 41; 34, 42; 34, 43; 35, ... | async def zrange(self, name, start, end, desc=False, withscores=False,
score_cast_func=float):
"""
Return a range of values from sorted set ``name`` between
``start`` and ``end`` sorted in ascending order.
``start`` and ``end`` can be negative, indicating the end of... |
0, module; 1, function_definition; 2, function_name:zremrangebyscore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:min; 8, identifier:max; 9, expression_statement; 10, return_statement; 11, comment:"""
Remove all elements in the sorted set ``name`` with scores
between `... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 9, 11; 10, 12; 12, 13; 13, 14; 13, 15; 14, 16; 14, 17; 15, 18; 15, 19; 15, 20; 15, 21; 18, 22 | async def zremrangebyscore(self, name, min, max):
"""
Remove all elements in the sorted set ``name`` with scores
between ``min`` and ``max``. Returns the number of elements removed.
"""
return await self.execute_command('ZREMRANGEBYSCORE', name, min, max) |
0, module; 1, function_definition; 2, function_name:georadius; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:longitude; 8, identifier:latitude; 9, identifier:radius; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, de... | 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; 4, 18; 4, 19; 10, 20; 10, 21; 11, 22; 11, 23; 12, 24; 12, 25; 13, 26; 13, 27; 14, 28; 14, 29; 15, 30; 15, 31; 16, 32; 16, 33; 17, 34; 17, 35; 18, 36; 19, 37; 37, 38; 38, 39; 38, 40; 39, 41; 39, 42; 40, 43; 40, ... | async def georadius(self, name, longitude, latitude, radius, unit=None,
withdist=False, withcoord=False, withhash=False, count=None,
sort=None, store=None, store_dist=None):
"""
Return the members of the specified key identified by the
``name`` arg... |
0, module; 1, function_definition; 2, function_name:georadiusbymember; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:member; 8, identifier:radius; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15,... | 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; 4, 17; 4, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 12, 26; 13, 27; 13, 28; 14, 29; 14, 30; 15, 31; 15, 32; 16, 33; 16, 34; 17, 35; 18, 36; 36, 37; 37, 38; 37, 39; 38, 40; 38, 41; 39, 42; 39, 43; 39, 4... | async def georadiusbymember(self, name, member, radius, unit=None,
withdist=False, withcoord=False, withhash=False,
count=None, sort=None, store=None, store_dist=None):
"""
This command is exactly like ``georadius`` with the sole difference... |
0, module; 1, function_definition; 2, function_name:search; 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, expressi... | 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; 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; 13, 33; 14, 34; 14, 35; 15, 36; 16, 37; 17, 38; 37, 39; 37, 40; 38, 41; 38, 42; 40, 43; 40, 44; 40... | def search(self, page=0, per_page=50, sort=None, q=None,
include_totals=True, fields=None, from_param=None, take=None,
include_fields=True):
"""Search log events.
Args:
page (int, optional): The result's page number (zero based).
per_page (int, opt... |
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, default_parameter; 13, default_parameter; 14, default_parameter; 15, expression... | 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; 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; 13, 33; 14, 34; 14, 35; 15, 36; 16, 37; 17, 38; 37, 39; 37, 40; 38, 41; 38, 42; 40, 43; 40, 44; 40... | def list(self, page=0, per_page=25, sort=None, connection=None, q=None,
search_engine=None, include_totals=True, fields=None,
include_fields=True):
"""List or search users.
Args:
page (int, optional): The result's page number (zero based).
per_page (in... |
0, module; 1, function_definition; 2, function_name:get_log_events; 3, parameters; 4, block; 5, identifier:self; 6, identifier:user_id; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_statem... | 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; 13, 25; 14, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 26, 32; 28, 33; 28, 34; 28, 35; 28, 36; 30, 37; 30, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43; 33, 4... | def get_log_events(self, user_id, page=0, per_page=50, sort=None,
include_totals=False):
"""Retrieve every log event for a specific user id
Args:
user_id (str): The user_id of the logs to retrieve
page (int, optional): The result's page number (zero base... |
0, module; 1, function_definition; 2, function_name:get_activities; 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, expression_statement; 14, return_statement; 15, id... | 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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 10, 22; 10, 23; 11, 24; 11, 25; 12, 26; 13, 27; 14, 28; 23, 29; 25, 30; 26, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 29, 37; 30, 38; 32, 39; 32, 40; 34, 41; 34, 42; 36, 43; 36, 44... | def get_activities(self, before=None, after=None, limit=None):
"""
Get activities for authenticated user sorted by newest first.
http://strava.github.io/api/v3/activities/
:param before: Result will start with activities whose start date is
before specified date... |
0, module; 1, function_definition; 2, function_name:get_segment_leaderboard; 3, parameters; 4, block; 5, identifier:self; 6, identifier:segment_id; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, 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; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 9, 35; 10, 36; 10, 37; 11, 38; 11, 39; 12, 40; 12, 41; 13, 42; 13, 43; 14, 44; 14, 45; 15, ... | def get_segment_leaderboard(self, segment_id, gender=None, age_group=None, weight_class=None,
following=None, club_id=None, timeframe=None, top_results_limit=None,
page=None, context_entries = None):
"""
Gets the leaderboard for a segment.
... |
0, module; 1, function_definition; 2, function_name:get_segment_efforts; 3, parameters; 4, block; 5, identifier:self; 6, identifier:segment_id; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, if_statement;... | 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; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 10, 26; 11, 27; 12, 28; 13, 29; 13, 30; 14, 31; 14, 32; 15, 33; 15, 34; 16, 35; 16, 36; 17, 37; 18, 38; 28, 39; 28, 40; 29, 41; 29, 42; 30, 43; 32, 44; 3... | def get_segment_efforts(self, segment_id, athlete_id=None,
start_date_local=None, end_date_local=None,
limit=None):
"""
Gets all efforts on a particular segment sorted by start_date_local
Returns an array of segment effort summary represen... |
0, module; 1, function_definition; 2, function_name:range; 3, parameters; 4, block; 5, identifier:self; 6, identifier:low; 7, identifier:high; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, identifier:with_scores; 14, False; 15, identifier:desc; 16, Fa... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 8, 13; 8, 14; 9, 15; 9, 16; 10, 17; 10, 18; 11, 19; 12, 20; 12, 21; 12, 22; 21, 23; 22, 24; 23, 25; 24, 26; 25, 27; 25, 28; 26, 29; 27, 30; 27, 31; 28, 32; 28, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 32, 40; 32, 41; 36, 42; 36, 43; 3... | def range(self, low, high, with_scores=False, desc=False, reverse=False):
"""
Return a range of items between ``low`` and ``high``. By
default scores will not be included, but this can be controlled
via the ``with_scores`` parameter.
:param low: Lower bound.
:param high:... |
0, module; 1, function_definition; 2, function_name:sfiles_to_event; 3, parameters; 4, block; 5, identifier:sfile_list; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, comment:# Hand off to sis... | 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; 7, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 12, 23; 12, 24; 14, 25; 15, 26; 17, 27; 17, 28; 18, 29; 18, 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, ... | def sfiles_to_event(sfile_list):
"""
Write an event.dat file from a list of Seisan events
:type sfile_list: list
:param sfile_list: List of s-files to sort and put into the database
:returns: List of tuples of event ID (int) and Sfile name
"""
event_list = []
sort_list = [(readheader(s... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
Sort the families by template name.
.. rubric:: Example
>>> party = Party(families=[Family(template=Temp... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 12, 14; 12, 15; 13, 16; 14, 17; 14, 18; 16, 19; 16, 20; 20, 21; 20, 22; 21, 23; 22, 24; 22, 25; 24, 26; 24, 27 | def sort(self):
"""
Sort the families by template name.
.. rubric:: Example
>>> party = Party(families=[Family(template=Template(name='b')),
... Family(template=Template(name='a'))])
>>> party[0]
Family of 0 detections from template b
... |
0, module; 1, function_definition; 2, function_name:decluster; 3, parameters; 4, block; 5, identifier:self; 6, identifier:trig_int; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, if_statement; 13, expression_statement; 14, expression_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; 4, 25; 4, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 10, 32; 11, 33; 11, 34; 11, 35; 12, 36; 12, 37; 12, 38; 12, 39; 13, 40; 14, 41; 15, 42; 17, 43; 19, 44; 20, 45; ... | def decluster(self, trig_int, timing='detect', metric='avg_cor'):
"""
De-cluster a Party of detections by enforcing a detection separation.
De-clustering occurs between events detected by different (or the same)
templates. If multiple detections occur within trig_int then the
pr... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""Sort by detection time.
.. rubric:: Example
>>> family = Family(
... template=Template(name='a'), dete... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 12, 14; 12, 15; 13, 16; 13, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 23, 24; 23, 25; 24, 26; 25, 27; 25, 28 | def sort(self):
"""Sort by detection time.
.. rubric:: Example
>>> family = Family(
... template=Template(name='a'), detections=[
... Detection(template_name='a', detect_time=UTCDateTime(0) + 200,
... no_chans=8, detect_val=4.2, threshold=1.2,
... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
Sort the tribe, sorts by template name.
.. rubric:: Example
>>> tribe = Tribe(templates=[Template(name='c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 12, 14; 12, 15; 13, 16; 13, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 23, 24; 23, 25; 24, 26; 25, 27; 25, 28 | def sort(self):
"""
Sort the tribe, sorts by template name.
.. rubric:: Example
>>> tribe = Tribe(templates=[Template(name='c'), Template(name='b'),
... Template(name='a')])
>>> tribe.sort()
Tribe of 3 templates
>>> tribe[0] # do... |
0, module; 1, function_definition; 2, function_name:filter_picks; 3, parameters; 4, block; 5, identifier:catalog; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, comment:# Don't work in place on the catal... | 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; 4, 21; 4, 22; 4, 23; 4, 24; 6, 25; 6, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 10, 34; 11, 35; 11, 36; 12, 37; 14, 38; 15, 39; 15, 40; 16, 41; 16, 42; 17, 43; 17, 44; 18, 45; 1... | def filter_picks(catalog, stations=None, channels=None, networks=None,
locations=None, top_n_picks=None, evaluation_mode='all'):
"""
Filter events in the catalog based on a number of parameters.
:param catalog: Catalog to filter.
:type catalog: obspy.core.event.Catalog
:param stati... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.