nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, identifier:cmp; 13, None; 14, identifier:key; 15, None; 16, identifier:reverse... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 19, 22; 19, 23; 20, 24; 21, 25; 21, 26; 22, 27; 23, 28; 23, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 26, 35; 30, 36; 30, 37; 31, 38; 31, 39; 33, 40; 33, 41; 34, 42; 34, 43; 35,... | def sort(self, cmp=None, key=None, reverse=False):
"""Overrides sort func to use the KeyValue for the key."""
if not key and self._keys:
key = self.KeyValue
super(CliTable, self).sort(cmp=cmp, key=key, reverse=reverse) |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, function_definition; 11, expression_statement; 12, comment:# Exclude header by copying table.; 13, expression_statement; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 10, 28; 10, 29; 10, 30; 11, 31; 13, 32; 14, 33; 14, 34; 15, 35; 17, 36; 18, 37; 20, 38; 20, 39; 20, 40; 29, 41; 30, 42; 30, 43; 30, 44; 30, ... | def sort(self, cmp=None, key=None, reverse=False):
"""Sorts rows in the texttable.
Args:
cmp: func, non default sort algorithm to use.
key: func, applied to each element before sorting.
reverse: bool, reverse order of sort.
"""
def _DefaultKey(value):
"""Default k... |
0, module; 1, function_definition; 2, function_name:find_order; 3, parameters; 4, block; 5, identifier:graph; 6, expression_statement; 7, while_statement; 8, string; 9, identifier:graph; 10, comment:# Find all items without a parent; 11, block; 12, string_content:Do a topological sort on the dependency graph dict.; 13,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 8, 12; 11, 13; 11, 14; 11, 15; 11, 16; 11, 17; 13, 18; 14, 19; 14, 20; 16, 21; 17, 22; 17, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 20, 29; 21, 30; 21, 31; 25, 32; 25, 33; 25, 34; 27, 35; 27, 36; 27, 37; 29, 38; 30, 39; 30, 40; 32, 41; 33, 42; 34, 4... | def find_order(graph):
'''
Do a topological sort on the dependency graph dict.
'''
while graph:
# Find all items without a parent
leftmost = [l for l, s in graph.items() if not s]
if not leftmost:
raise ValueError('Dependency cycle detected! %s' % graph)
# If ... |
0, module; 1, function_definition; 2, function_name:do_sort; 3, parameters; 4, block; 5, identifier:value; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:case_sensitive; 11, False; 12, comment:"""Sort an iterable. If the iterable is made of strings the second
pa... | 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; 8, 14; 8, 15; 9, 16; 13, 17; 14, 18; 15, 19; 16, 20; 16, 21; 18, 22; 18, 23; 18, 24; 19, 25; 21, 26; 21, 27; 23, 28; 24, 29; 24, 30; 25, 31; 27, 32; 27, 33; 29, 34; 29, 35; 30, 36; 31, 37; 31, 38; 34, 39; 34, 40; 35, 41; 40, 42; 40, 43; 4... | def do_sort(value, case_sensitive=False):
"""Sort an iterable. If the iterable is made of strings the second
parameter can be used to control the case sensitiveness of the
comparison which is disabled by default.
.. sourcecode:: jinja
{% for item in iterable|sort %}
...
{%... |
0, module; 1, function_definition; 2, function_name:dedupe; 3, parameters; 4, block; 5, identifier:contains_dupes; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, comment:# iterate over items in *contains_dupes*; 11, for_statement; 12, comment:# uniquify *extractor* lis... | 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; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 9, 24; 11, 25; 11, 26; 11, 27; 11, 28; 13, 29; 14, 30; 14, 31; 14, 32; 15, 33; 18, 34; 18, 35; 18, 36; 22, 37; 22, 38; 24, 39; 24, 40; 28, 41; 28, 42; 28, 43; 28, 44; 2... | def dedupe(contains_dupes, threshold=70, scorer=fuzz.token_set_ratio):
"""This convenience function takes a list of strings containing duplicates and uses fuzzy matching to identify
and remove duplicates. Specifically, it uses the process.extract to identify duplicates that
score greater than a user defined... |
0, module; 1, function_definition; 2, function_name:_process_and_sort; 3, parameters; 4, block; 5, identifier:s; 6, identifier:force_ascii; 7, default_parameter; 8, expression_statement; 9, comment:# pull tokens; 10, expression_statement; 11, expression_statement; 12, comment:# sort tokens and join; 13, expression_stat... | 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; 7, 15; 7, 16; 8, 17; 10, 18; 11, 19; 13, 20; 14, 21; 18, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 21, 29; 23, 30; 23, 31; 23, 32; 25, 33; 25, 34; 27, 35; 27, 36; 28, 37; 28, 38; 30, 39; 30, 40; 33, 41; 33, 42; 35, 43; 35... | def _process_and_sort(s, force_ascii, full_process=True):
"""Return a cleaned string with token sorted."""
# pull tokens
ts = utils.full_process(s, force_ascii=force_ascii) if full_process else s
tokens = ts.split()
# sort tokens and join
sorted_string = u" ".join(sorted(tokens))
return sor... |
0, module; 1, function_definition; 2, function_name:token_sort_ratio; 3, parameters; 4, block; 5, identifier:s1; 6, identifier:s2; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:force_ascii; 12, True; 13, identifier:full_process; 14, True; 15, comment:"""Return... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 16, 17; 16, 18; 18, 19; 18, 20; 18, 21; 18, 22; 18, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29 | def token_sort_ratio(s1, s2, force_ascii=True, full_process=True):
"""Return a measure of the sequences' similarity between 0 and 100
but sorting the token before comparing.
"""
return _token_sort(s1, s2, partial=False, force_ascii=force_ascii, full_process=full_process) |
0, module; 1, function_definition; 2, function_name:partial_token_sort_ratio; 3, parameters; 4, block; 5, identifier:s1; 6, identifier:s2; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:force_ascii; 12, True; 13, identifier:full_process; 14, True; 15, comment:"... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 16, 17; 16, 18; 18, 19; 18, 20; 18, 21; 18, 22; 18, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29 | def partial_token_sort_ratio(s1, s2, force_ascii=True, full_process=True):
"""Return the ratio of the most similar substring as a number between
0 and 100 but sorting the token before comparing.
"""
return _token_sort(s1, s2, partial=True, force_ascii=force_ascii, full_process=full_process) |
0, module; 1, function_definition; 2, function_name:WRatio; 3, parameters; 4, block; 5, identifier:s1; 6, identifier:s2; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, if_statement; 13, comment:# should we look at partials?; 14, expression_statement; 15, exp... | 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; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 10, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 12, 35; 14, 36; 15, 37; 16, 38; 17, 39; 18, 40; 20, 41; 20, 42; 22, 43; 22, 44; 23, 4... | def WRatio(s1, s2, force_ascii=True, full_process=True):
"""
Return a measure of the sequences' similarity between 0 and 100, using different algorithms.
**Steps in the order they occur**
#. Run full_process from utils on both strings
#. Short circuit if this makes either string empty
#. Take ... |
0, module; 1, function_definition; 2, function_name:sort_depth; 3, parameters; 4, block; 5, identifier:vals; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:reverse; 12, False; 13, comment:"""Sort bids or asks by price
"""; 14... | 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; 21, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 24, 31; 25, 32; 25, 33; 27, 34; 27, 35; 28, 36; 28, 37; 30, 38; 30, 39; 31, 40; 31, 41; 33, 42; 36, 43; ... | def sort_depth(vals, reverse=False):
"""Sort bids or asks by price
"""
lst = [[float(price), quantity] for price, quantity in vals.items()]
lst = sorted(lst, key=itemgetter(0), reverse=reverse)
return lst |
0, module; 1, function_definition; 2, function_name:_get_fields; 3, parameters; 4, block; 5, identifier:attrs; 6, identifier:field_class; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, if_statement; 13, return_statement; 14, identifier:pop; 15, False... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 21; 12, 22; 12, 23; 13, 24; 19, 25; 19, 26; 21, 27; 23, 28; 26, 29; 26, 30; 26, 31; 27, 32; 27, 33; 27, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 31, 40; 32, 41; 32, 42; 34, 43; 35,... | def _get_fields(attrs, field_class, pop=False, ordered=False):
"""Get fields from a class. If ordered=True, fields will sorted by creation index.
:param attrs: Mapping of class attributes
:param type field_class: Base field class
:param bool pop: Remove matching fields
"""
fields = [
(f... |
0, module; 1, function_definition; 2, function_name:extract_features; 3, parameters; 4, block; 5, identifier:timeseries_container; 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, defau... | 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; 3, 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; 6, 33; 6, 34; 7, 35; 7, 36; 8, 37; 8, 38; 9, 39; 9, 40; 10, 41; 10, 42; 11, 43; 11, 44; 12, 45; 12, 46; 1... | def extract_features(timeseries_container, default_fc_parameters=None,
kind_to_fc_parameters=None,
column_id=None, column_sort=None, column_kind=None, column_value=None,
chunksize=defaults.CHUNKSIZE,
n_jobs=defaults.N_PROCESSES, show_wa... |
0, module; 1, function_definition; 2, function_name:convert_to_output_format; 3, parameters; 4, block; 5, identifier:param; 6, expression_statement; 7, function_definition; 8, return_statement; 9, comment:"""
Helper function to convert parameters to a valid string, that can be used in a column name.
Does the op... | 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; 11, 14; 12, 15; 13, 16; 13, 17; 15, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 20, 28; 23, 29; 23, 30; 24, 31; 24, 32; 26, 33; 26, 34; 27, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 32, 41; 32, 42; 35, 43... | def convert_to_output_format(param):
"""
Helper function to convert parameters to a valid string, that can be used in a column name.
Does the opposite which is used in the from_columns function.
The parameters are sorted by their name and written out in the form
<param name>_<param value>__<par... |
0, module; 1, function_definition; 2, function_name:end_profiling; 3, parameters; 4, block; 5, identifier:profiler; 6, identifier:filename; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, with_statement; 14, identi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 13, 21; 13, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 26, 36; 26, 37; 28, 38; 28, 39; 29, 40; 29, 41; 31, 42; 32, 43; 33... | def end_profiling(profiler, filename, sorting=None):
"""
Helper function to stop the profiling process and write out the profiled
data into the given filename. Before this, sort the stats by the passed sorting.
:param profiler: An already started profiler (probably by start_profiling).
:type profil... |
0, module; 1, function_definition; 2, function_name:extract_relevant_features; 3, parameters; 4, block; 5, identifier:timeseries_container; 6, identifier:y; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, d... | 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; 3, 20; 3, 21; 3, 22; 3, 23; 3, 24; 3, 25; 3, 26; 3, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 4, 37; 4, 38; 7, 39; 7, 40; 8, 41; 8, 42; 9, 43; 9, 44; 10, 45; 10, 46; 11, 4... | def extract_relevant_features(timeseries_container, y, X=None,
default_fc_parameters=None,
kind_to_fc_parameters=None,
column_id=None, column_sort=None, column_kind=None, column_value=None,
show_warni... |
0, module; 1, function_definition; 2, function_name:user_agents; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""
Retrieve user-agents, sorted by most common to least common.
"""; 9, parenthesized_expression; 10, call; 11, attribute; 12, argument_... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 10, 11; 10, 12; 11, 13; 11, 14; 13, 15; 13, 16; 15, 17; 15, 18; 16, 19; 17, 20; 17, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 26, 31; 26, 32; 27, 33; 27, 34; 29, 35; 29, 36; 30, 37; 30, 38; 31, 39; 31, 40; 32, 41; 33, 42; 33,... | def user_agents(self):
"""
Retrieve user-agents, sorted by most common to least common.
"""
return (self.get_query()
.select(
PageView.headers['User-Agent'],
fn.Count(PageView.id))
.group_by(PageView.headers['User-Ag... |
0, module; 1, function_definition; 2, function_name:languages; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""
Retrieve languages, sorted by most common to least common. The
Accept-Languages head... | 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; 15, 19; 15, 20; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 21, 28; 21, 29; 22, 30; 22, 31; 22, 32; 22, 33; 22, 34; 23, 35; 23, 36; 34, 37; 34, 38; 35, 39; 35, 40; 37, 41; 37, 42; 38, 43... | def languages(self):
"""
Retrieve languages, sorted by most common to least common. The
Accept-Languages header sometimes looks weird, i.e.
"en-US,en;q=0.8,is;q=0.6,da;q=0.4" We will split on the first semi-
colon.
"""
language = PageView.headers['Accept-Language'... |
0, module; 1, function_definition; 2, function_name:error_router; 3, parameters; 4, block; 5, identifier:self; 6, identifier:original_handler; 7, identifier:e; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""This function decides whether the error occured in a flask-restful
endpoi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 9, 13; 10, 14; 12, 15; 12, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 17, 22; 17, 23; 19, 24; 22, 25; 23, 26; 23, 27; 25, 28; 27, 29; 27, 30; 28, 31; 28, 32; 31, 33; 31, 34; 32, 35 | def error_router(self, original_handler, e):
"""This function decides whether the error occured in a flask-restful
endpoint or not. If it happened in a flask-restful endpoint, our
handler will be dispatched. If it happened in an unrelated view, the
app's original error handler will be di... |
0, module; 1, function_definition; 2, function_name:smooth_knn_dist; 3, parameters; 4, block; 5, identifier:distances; 6, identifier:k; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, for_statem... | 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; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 12, 24; 13, 25; 14, 26; 14, 27; 14, 28; 15, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 25, 35; 27, 36; 27, 37; 28, 38; 28, 39; 28, 40; 28, 41; 28, 42; 28, 43; 28, 44... | def smooth_knn_dist(distances, k, n_iter=64, local_connectivity=1.0, bandwidth=1.0):
"""Compute a continuous version of the distance to the kth nearest
neighbor. That is, this is similar to knn-distance but allows continuous
k values rather than requiring an integral k. In esscence we are simply
computi... |
0, module; 1, function_definition; 2, function_name:_visible_units; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# Sort the units by elevation, then owned (eg refinery) above world (ie 16); 8, comment:# (eg geiser), small above big, and otherwise arbitrary but stable.; 9, for_stateme... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 9, 11; 9, 12; 9, 13; 12, 14; 12, 15; 13, 16; 15, 17; 15, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 20, 25; 20, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 27, 33; 28, 34; 28, 35; 28, 36; 28, 37; 30, 38; 30, 39; 31, 40; 31, 41; 34, 42; 34, 43... | def _visible_units(self):
"""A generator of visible units and their positions as `Point`s, sorted."""
# Sort the units by elevation, then owned (eg refinery) above world (ie 16)
# (eg geiser), small above big, and otherwise arbitrary but stable.
for u in sorted(self._obs.observation.raw_data.units,
... |
0, module; 1, function_definition; 2, function_name:interp; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, return_statement; 15, i... | 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; 11, 24; 12, 25; 12, 26; 13, 27; 14, 28; 18, 29; 25, 30; 25, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 30, 37; 30, 38; 31, 39; 32, 40; 34, 41; 34, 42; 35, 43; 35, 44;... | def interp(self, coords=None, method='linear', assume_sorted=False,
kwargs={}, **coords_kwargs):
""" Multidimensional interpolation of variables.
coords : dict, optional
Mapping from dimension names to the new coordinates.
new coordinate can be an scalar, array-li... |
0, module; 1, function_definition; 2, function_name:interp_like; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, return_statement; 14, identifier:method; 15, stri... | 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; 11, 22; 12, 23; 13, 24; 15, 25; 21, 26; 21, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 26, 33; 26, 34; 27, 35; 28, 36; 30, 37; 30, 38; 31, 39; 31, 40; 32, 41; 33, 42; 33, 43; 36, ... | def interp_like(self, other, method='linear', assume_sorted=False,
kwargs={}):
"""Interpolate this object onto the coordinates of another object,
filling out of range values with NaN.
Parameters
----------
other : Dataset or DataArray
Object with ... |
0, module; 1, function_definition; 2, function_name:is_uniform_spaced; 3, parameters; 4, type; 5, block; 6, identifier:arr; 7, dictionary_splat_pattern; 8, identifier:bool; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:kwargs; 14, comment:"""Return Tru... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 7, 13; 9, 14; 10, 15; 11, 16; 12, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 21, 26; 21, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 32, 38; 32, 39; 36, 40; 36, 41; 37, 42; 37, 43;... | def is_uniform_spaced(arr, **kwargs) -> bool:
"""Return True if values of an array are uniformly spaced and sorted.
>>> is_uniform_spaced(range(5))
True
>>> is_uniform_spaced([-4, 0, 100])
False
kwargs are additional arguments to ``np.isclose``
"""
arr = np.array(arr, dtype=float)
... |
0, module; 1, function_definition; 2, function_name:broadcast_variables; 3, parameters; 4, block; 5, list_splat_pattern; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, identifier:variables; 11, comment:"""Given any number of variables, return variables with matching ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 6, 11; 7, 12; 8, 13; 9, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 16, 21; 16, 22; 18, 23; 18, 24; 20, 25; 20, 26; 22, 27; 24, 28; 25, 29; 25, 30; 25, 31; 26, 32; 26, 33; 29, 34; 29, 35; 30, 36; 30, 37; 34, 38; 34, 39; 35, 40; 36, 41; 36, 42 | def broadcast_variables(*variables):
"""Given any number of variables, return variables with matching dimensions
and broadcast data.
The data on the returned variables will be a view of the data on the
corresponding original arrays, but dimensions will be reordered and
inserted so that both broadca... |
0, module; 1, function_definition; 2, function_name:interp; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, import_from_statement; 13, expression_statement; 14, expression_sta... | 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; 6, 32; 6, 33; 7, 34; 7, 35; 8, 36; 8, 37; 9, 38; 9, 39; 10, 40; 11, 41; 12, 42; 12, 43; 13, 44; 14, 45; 15, 46; ... | def interp(self, coords=None, method='linear', assume_sorted=False,
kwargs={}, **coords_kwargs):
""" Multidimensional interpolation of Dataset.
Parameters
----------
coords : dict, optional
Mapping from dimension names to the new coordinates.
New c... |
0, module; 1, function_definition; 2, function_name:interp_like; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, for_statement; ... | 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; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 14, 29; 14, 30; 15, 31; 16, 32; 16, 33; 16, 34; 16, 35; 17, 36; 19, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44; ... | def interp_like(self, other, method='linear', assume_sorted=False,
kwargs={}):
"""Interpolate this object onto the coordinates of another object,
filling the out of range values with NaN.
Parameters
----------
other : Dataset or DataArray
Object w... |
0, module; 1, function_definition; 2, function_name:transpose; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:dims; 13, comment:"""Return a new Dataset object with all array di... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 21, 30; 21, 31; 23, 32; 23, 33; 26, 34; 26, 35; 28, 36; 29, 37; 30, 38; 30, 39; 31, 40; 32, 41; 32, 42; 34, 43; 3... | def transpose(self, *dims):
"""Return a new Dataset object with all array dimensions transposed.
Although the order of dimensions on each array will change, the dataset
dimensions themselves will remain in fixed (sorted) order.
Parameters
----------
*dims : str, optiona... |
0, module; 1, function_definition; 2, function_name:to_dask_dataframe; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, import_statement; 10, import_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, expression_stateme... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 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; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 9, 26; 10, 27; 11, 28; 11, 29; 11, 30; 12, 31; 13, 32; 14, 33; 15, 34; 16, 35; 17, 36; 17, 37; 17, 38; 18, 39; 19, 40; 19, 41; 20, 42; 26, 43; 26, 44; 27,... | def to_dask_dataframe(self, dim_order=None, set_index=False):
"""
Convert this dataset into a dask.dataframe.DataFrame.
The dimensions, coordinates and data variables in this dataset form
the columns of the DataFrame.
Parameters
----------
dim_order : list, opti... |
0, module; 1, function_definition; 2, function_name:interp; 3, parameters; 4, block; 5, identifier:var; 6, identifier:indexes_coords; 7, identifier:method; 8, dictionary_splat_pattern; 9, expression_statement; 10, if_statement; 11, comment:# simple speed up for the local interpolation; 12, if_statement; 13, comment:# d... | 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; 8, 29; 9, 30; 10, 31; 10, 32; 12, 33; 12, 34; 14, 35; 16, 36; 17, 37; 18, 38; 20, 39; 21, 40; 22, 41; 23, 42; 24, 43; 26, 44; 27, 45;... | def interp(var, indexes_coords, method, **kwargs):
""" Make an interpolation of Variable
Parameters
----------
var: Variable
index_coords:
Mapping from dimension name to a pair of original and new coordinates.
Original coordinates should be sorted in strictly ascending order.
... |
0, module; 1, function_definition; 2, function_name:coerce_pandas_values; 3, parameters; 4, block; 5, identifier:objects; 6, expression_statement; 7, import_from_statement; 8, import_from_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""Convert pandas values found in a list of... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 13, 22; 13, 23; 14, 24; 15, 25; 15, 26; 16, 27; 17, 28; 17, 29; 20, 30; 20, 31; 23, 32; 26, 33; 30, 34; 30, 35; 30, 36; 31, 37; 34, 38; 34, 39; 35, 40; 36, 41; 37, 42; 37, 43; 39... | def coerce_pandas_values(objects):
"""Convert pandas values found in a list of labeled objects.
Parameters
----------
objects : list of Dataset or mappings
The mappings may contain any sort of objects coercible to
xarray.Variables as keys, including pandas objects.
Returns
----... |
0, module; 1, function_definition; 2, function_name:unique_value_groups; 3, parameters; 4, block; 5, identifier:ar; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:sort; 13, True; 14, comment:"""Group an array by it... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 24, 36; 24, 37; 28, 38; 29, 39; 29, 40; 29, 41; 34, 42; 34, 43; 3... | def unique_value_groups(ar, sort=True):
"""Group an array by its unique values.
Parameters
----------
ar : array-like
Input array. This will be flattened if it is not already 1-D.
sort : boolean, optional
Whether or not to sort unique values.
Returns
-------
values : np... |
0, module; 1, function_definition; 2, function_name:order; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# non-GA releases should appear before GA releases; 8, comment:# Order: tp -> beta -> rc -> GA; 9, if_statement; 10, return_statement; 11, comment:"""Return a representation that a... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 9, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 14, 19; 15, 20; 15, 21; 18, 22; 18, 23; 18, 24; 19, 25; 20, 26; 20, 27; 20, 28; 24, 29; 25, 30; 26, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 32, 41; 34, 42; 36, 43;... | def order(self):
"""Return a representation that allows this object to be sorted
correctly with the default comparator.
"""
# non-GA releases should appear before GA releases
# Order: tp -> beta -> rc -> GA
if self.stage:
for st in STAGES:
if s... |
0, module; 1, function_definition; 2, function_name:zadd; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:mapping; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, if_statement; 15, if_statement; 16, ... | 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; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 11, 31; 12, 32; 13, 33; 13, 34; 14, 35; 14, 36; 15, 37; 15, 38; 16, 39; 17, 40; 18, 41; 18, 42; 19, 43; 19, 44; 20, ... | def zadd(self, name, mapping, nx=False, xx=False, ch=False, incr=False):
"""
Set any number of element-name, score pairs to the key ``name``. Pairs
are specified as a dict of element-names keys to score values.
``nx`` forces ZADD to only create new elements and not to update
sco... |
0, module; 1, function_definition; 2, function_name:zincrby; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:amount; 8, identifier:value; 9, expression_statement; 10, return_statement; 11, string:"Increment the score of ``value`` in sorted set ``name`` by ``amount``"; 12, call; 13, attrib... | 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; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 14, 19; 14, 20; 17, 21 | def zincrby(self, name, amount, value):
"Increment the score of ``value`` in sorted set ``name`` by ``amount``"
return self.execute_command('ZINCRBY', name, amount, value) |
0, module; 1, function_definition; 2, function_name:zinterstore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:dest; 7, identifier:keys; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:aggregate; 12, None; 13, comment:"""
Intersect multiple sorted sets specified ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 8, 11; 8, 12; 9, 13; 10, 14; 14, 15; 14, 16; 15, 17; 15, 18; 16, 19; 16, 20; 16, 21; 16, 22; 19, 23 | def zinterstore(self, dest, keys, aggregate=None):
"""
Intersect multiple sorted sets specified by ``keys`` into
a new sorted set, ``dest``. Scores in the destination will be
aggregated based on the ``aggregate``, or SUM if none is provided.
"""
return self._zaggregate('Z... |
0, module; 1, function_definition; 2, function_name:zlexcount; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:min; 8, identifier:max; 9, expression_statement; 10, return_statement; 11, comment:"""
Return the number of items in the sorted set ``name`` between the
lexicogra... | 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; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 14, 19; 14, 20; 17, 21 | def zlexcount(self, name, min, max):
"""
Return the number of items in the sorted set ``name`` between the
lexicographical range ``min`` and ``max``.
"""
return self.execute_command('ZLEXCOUNT', name, min, max) |
0, module; 1, function_definition; 2, function_name:zpopmax; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:count; 13, None; 14, comment:"""
Remove and return ... | 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; 11, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 23, 31; 23, 32; 24, 33; 24, 34; 26, 35; 26, 36; 29, 37; 31, 38; 32, 39; 33, 40; 34, 41; 35, 42; 40, 43; ... | def zpopmax(self, name, count=None):
"""
Remove and return up to ``count`` members with the highest scores
from the sorted set ``name``.
"""
args = (count is not None) and [count] or []
options = {
'withscores': True
}
return self.execute_comma... |
0, module; 1, function_definition; 2, function_name:zpopmin; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:count; 13, None; 14, comment:"""
Remove and return ... | 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; 11, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 23, 31; 23, 32; 24, 33; 24, 34; 26, 35; 26, 36; 29, 37; 31, 38; 32, 39; 33, 40; 34, 41; 35, 42; 40, 43; ... | def zpopmin(self, name, count=None):
"""
Remove and return up to ``count`` members with the lowest scores
from the sorted set ``name``.
"""
args = (count is not None) and [count] or []
options = {
'withscores': True
}
return self.execute_comman... |
0, module; 1, function_definition; 2, function_name:bzpopmax; 3, parameters; 4, block; 5, identifier:self; 6, identifier:keys; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:timeout; 14, integer:0; 15, 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; 7, 13; 7, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 12, 20; 16, 21; 16, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 23, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 30, 41; 32, 42; 32, 43; 38... | def bzpopmax(self, keys, timeout=0):
"""
ZPOPMAX a value off of the first non-empty sorted set
named in the ``keys`` list.
If none of the sorted sets in ``keys`` has a value to ZPOPMAX,
then block for ``timeout`` seconds, or until a member gets added
to one of the sorted... |
0, module; 1, function_definition; 2, function_name:bzpopmin; 3, parameters; 4, block; 5, identifier:self; 6, identifier:keys; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:timeout; 14, integer:0; 15, 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; 7, 13; 7, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 12, 20; 16, 21; 16, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 23, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 30, 41; 32, 42; 32, 43; 38... | def bzpopmin(self, keys, timeout=0):
"""
ZPOPMIN a value off of the first non-empty sorted set
named in the ``keys`` list.
If none of the sorted sets in ``keys`` has a value to ZPOPMIN,
then block for ``timeout`` seconds, or until a member gets added
to one of the sorted... |
0, module; 1, function_definition; 2, function_name:zremrangebylex; 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`` between the
lexicograph... | 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; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 14, 19; 14, 20; 17, 21 | def zremrangebylex(self, name, min, max):
"""
Remove all elements in the sorted set ``name`` between the
lexicographical range specified by ``min`` and ``max``.
Returns the number of elements removed.
"""
return self.execute_command('ZREMRANGEBYLEX', name, min, max) |
0, module; 1, function_definition; 2, function_name:zremrangebyrank; 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 ranks between
``m... | 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; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 14, 19; 14, 20; 17, 21 | def zremrangebyrank(self, name, min, max):
"""
Remove all elements in the sorted set ``name`` with ranks between
``min`` and ``max``. Values are 0-based, ordered from smallest score
to largest. Values can be negative indicating the highest scores.
Returns the number of elements r... |
0, module; 1, function_definition; 2, function_name:argsort_k_smallest; 3, parameters; 4, block; 5, identifier:x; 6, identifier:k; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:""" Return no more than ``k`` indices of sma... | 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; 12, 20; 14, 21; 14, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 28, 39; 28, 40; 30, 41; 30, 42; 32, 43; 32... | def argsort_k_smallest(x, k):
""" Return no more than ``k`` indices of smallest values. """
if k == 0:
return np.array([], dtype=np.intp)
if k is None or k >= len(x):
return np.argsort(x)
indices = np.argpartition(x, k)[:k]
values = x[indices]
return indices[np.argsort(values)] |
0, module; 1, function_definition; 2, function_name:lookup; 3, parameters; 4, block; 5, typed_parameter; 6, typed_parameter; 7, expression_statement; 8, try_statement; 9, identifier:source_id; 10, type; 11, identifier:schema_id; 12, type; 13, comment:"""
Create a new schema object from an existing ledger schema... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 5, 9; 5, 10; 6, 11; 6, 12; 7, 13; 8, 14; 8, 15; 10, 16; 12, 17; 14, 18; 14, 19; 14, 20; 14, 21; 14, 22; 14, 23; 14, 24; 14, 25; 14, 26; 14, 27; 14, 28; 14, 29; 15, 30; 15, 31; 18, 32; 19, 33; 19, 34; 20, 35; 21, 36; 22, 37; 23, 38; 24, 39; 25, 40; 26, 41; 27, 42; 28, 43; ... | async def lookup(source_id: str, schema_id: str):
"""
Create a new schema object from an existing ledger schema
:param source_id: Institution's personal identification for the schema
:param schema_id: Ledger schema ID for lookup
Example:
source_id = 'foobar123'
n... |
0, module; 1, function_definition; 2, function_name:interleave_keys; 3, parameters; 4, block; 5, identifier:a; 6, identifier:b; 7, expression_statement; 8, function_definition; 9, return_statement; 10, comment:"""Interleave bits from two sort keys to form a joint sort key.
Examples that are similar in both of the ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 8, 13; 9, 14; 12, 15; 13, 16; 14, 17; 14, 18; 16, 19; 18, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 24, 31; 24, 32; 25, 33; 30, 34; 30, 35; 30, 36; 33, 37; 33, 38; 35, 39; 35, 40; 36, 41; 36, 42; 38, 43;... | def interleave_keys(a, b):
"""Interleave bits from two sort keys to form a joint sort key.
Examples that are similar in both of the provided keys will have similar
values for the key defined by this function. Useful for tasks with two
text fields like machine translation or natural language inference.
... |
0, module; 1, function_definition; 2, function_name:pool; 3, parameters; 4, block; 5, identifier:data; 6, identifier:batch_size; 7, identifier:key; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, for_statement; 15, identifier:batc... | 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; 8, 15; 8, 16; 9, 17; 9, 18; 10, 19; 10, 20; 11, 21; 11, 22; 12, 23; 13, 24; 13, 25; 14, 26; 14, 27; 14, 28; 16, 29; 16, 30; 24, 31; 24, 32; 25, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 29, 40; 33, 41; 35, 42; 35, 43; 35,... | def pool(data, batch_size, key, batch_size_fn=lambda new, count, sofar: count,
random_shuffler=None, shuffle=False, sort_within_batch=False):
"""Sort within buckets, then batch, then shuffle batches.
Partitions data into chunks of size 100*batch_size, sorts examples within
each chunk using sort_ke... |
0, module; 1, function_definition; 2, function_name:data; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:"""Return the examples in the dataset in order, sorted, or shuffled."""; 10, attribute; 11, block; 12, elif_clause; 13, else_clause; 14, identi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 7, 12; 7, 13; 8, 14; 10, 15; 10, 16; 11, 17; 12, 18; 12, 19; 13, 20; 17, 21; 18, 22; 18, 23; 19, 24; 20, 25; 21, 26; 21, 27; 24, 28; 25, 29; 27, 30; 27, 31; 28, 32; 28, 33; 29, 34; 29, 35; 31, 36; 31, 37; 33, 38; 33, 39; 35, 40; 35, 41; 36, 42; 36, 43;... | def data(self):
"""Return the examples in the dataset in order, sorted, or shuffled."""
if self.sort:
xs = sorted(self.dataset, key=self.sort_key)
elif self.shuffle:
xs = [self.dataset[i] for i in self.random_shuffler(range(len(self.dataset)))]
else:
x... |
0, module; 1, function_definition; 2, function_name:color_table; 3, parameters; 4, block; 5, identifier:color; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, function_definition; 14, expression_statement; 15,... | 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; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 9, 26; 10, 27; 10, 28; 11, 29; 12, 30; 12, 31; 12, 32; 12, 33; 13, 34; 13, 35; 13, 36; 14, 37; 15, 38; 15, 39; 15, 40; 16, 41; 17, 42; 17, 43; 18, 44; 30,... | def color_table(color, N=1, sort=False, sort_values=False, inline=False, as_html=False):
"""
Generates a colour table
Parameters:
-----------
color : string | list | dict
Color representation in rgba|rgb|hex
If a list of colors is passed then these
... |
0, module; 1, function_definition; 2, function_name:get_nearest_edge; 3, parameters; 4, block; 5, identifier:G; 6, identifier:point; 7, expression_statement; 8, expression_statement; 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; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 7, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 14, 24; 15, 25; 16, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, ... | def get_nearest_edge(G, point):
"""
Return the nearest edge to a pair of coordinates. Pass in a graph and a tuple
with the coordinates. We first get all the edges in the graph. Secondly we compute
the euclidean distance from the coordinates to the segments determined by each edge.
The last step is t... |
0, module; 1, function_definition; 2, function_name:get_http_headers; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, return_statement; 15, ide... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 5, 15; 5, 16; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 11, 27; 12, 28; 13, 29; 14, 30; 22, 31; 22, 32; 23, 33; 24, 34; 24, 35; 25, 36; 26, 37; 26, 38; 27, 39; 28, 40; 28, 41; 29, 42; 29, 43; 33, 44; ... | def get_http_headers(user_agent=None, referer=None, accept_language=None):
"""
Update the default requests HTTP headers with OSMnx info.
Parameters
----------
user_agent : str
the user agent string, if None will set with OSMnx default
referer : str
the referer string, if None wi... |
0, module; 1, function_definition; 2, function_name:_has_sorted_sa_indices; 3, parameters; 4, block; 5, identifier:s_indices; 6, identifier:a_indices; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""
Check whether `s_indices` and `a_indices` are sorted in
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 14, 19; 14, 20; 15, 21; 15, 22; 18, 23; 18, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 29, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; ... | def _has_sorted_sa_indices(s_indices, a_indices):
"""
Check whether `s_indices` and `a_indices` are sorted in
lexicographic order.
Parameters
----------
s_indices, a_indices : ndarray(ndim=1)
Returns
-------
bool
Whether `s_indices` and `a_indices` are sorted.
"""
... |
0, module; 1, function_definition; 2, function_name:_generate_a_indptr; 3, parameters; 4, block; 5, identifier:num_states; 6, identifier:s_indices; 7, identifier:out; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, comment:"""
Generate `a_... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 11, 16; 11, 17; 11, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 22, 30; 22, 31; 25, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 32, 40; 32, 41; 33, 42; 34, 43;... | def _generate_a_indptr(num_states, s_indices, out):
"""
Generate `a_indptr`; stored in `out`. `s_indices` is assumed to be
in sorted order.
Parameters
----------
num_states : scalar(int)
s_indices : ndarray(int, ndim=1)
out : ndarray(int, ndim=1)
Length must be num_states+1.
... |
0, module; 1, function_definition; 2, function_name:sort_topologically; 3, parameters; 4, block; 5, identifier:dag; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, while_statement; 11, if_statement; 12, return_statement; 13, comment:"""Sort the dag breath first to... | 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; 10, 17; 10, 18; 11, 19; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 18, 28; 18, 29; 18, 30; 18, 31; 18, 32; 19, 33; 19, 34; 20, 35; 23, 36; 23, 37; 27, 38; 27, 39; 28, 40; 29, 41; 31, 42; 32, 43; 3... | def sort_topologically(dag):
"""Sort the dag breath first topologically.
Only the nodes inside the dag are returned, i.e. the nodes that are also keys.
Returns:
a topological ordering of the DAG.
Raises:
an error if this is not possible (graph is not valid).
"""
dag = copy.de... |
0, module; 1, function_definition; 2, function_name:set_topological_dag_upstreams; 3, parameters; 4, block; 5, identifier:dag; 6, identifier:ops; 7, identifier:op_runs; 8, identifier:runs_by_ops; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:"""Set the upstream runs for the operation... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 9, 12; 10, 13; 11, 14; 11, 15; 11, 16; 13, 17; 13, 18; 16, 19; 16, 20; 16, 21; 18, 22; 18, 23; 19, 24; 20, 25; 21, 26; 22, 27; 22, 28; 23, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 29, 36; 29, 37; 31, 38; 31, 39; 33, 40; 33, 41; 35, 42; 35, 4... | def set_topological_dag_upstreams(dag, ops, op_runs, runs_by_ops):
"""Set the upstream runs for the operation runs in the dag following the topological sort."""
sorted_ops = dags.sort_topologically(dag=dag)
for op_id in sorted_ops:
op_run_id = runs_by_ops[op_id]
op_run = op_runs[op_run_id]
... |
0, module; 1, function_definition; 2, function_name:generate_from_text; 3, parameters; 4, block; 5, identifier:self; 6, identifier:text; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Generate wordcloud from text.
The input "text" is expected to ... | 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; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 19, 24; 19, 25; 20, 26 | def generate_from_text(self, text):
"""Generate wordcloud from text.
The input "text" is expected to be a natural text. If you pass a sorted
list of words, words will appear in your output twice. To remove this
duplication, set ``collocations=False``.
Calls process_text and gen... |
0, module; 1, function_definition; 2, function_name:_update_pods_metrics; 3, parameters; 4, block; 5, identifier:self; 6, identifier:instance; 7, identifier:pods; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, for_statement; 13, comment:"""
Reports the number ... | 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; 10, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 14, 22; 14, 23; 16, 24; 16, 25; 17, 26; 17, 27; 17, 28; 17, 29; 17, 30; 17, 31; 18, 32; 18, 33; 19, 34; 19, 35; 20, 36; 20, 37; 21, 38; 21, 39; 21, 40; 23, 41; 23, 42; 25, 43;... | def _update_pods_metrics(self, instance, pods):
"""
Reports the number of running pods on this node, tagged by service and creator
We go though all the pods, extract tags then count them by tag list, sorted and
serialized in a pipe-separated string (it is an illegar character for tags)
... |
0, module; 1, function_definition; 2, function_name:get_agent_tags; 3, parameters; 4, block; 5, identifier:since; 6, identifier:to; 7, expression_statement; 8, expression_statement; 9, comment:# default value for `to` is the latest tag; 10, if_statement; 11, expression_statement; 12, comment:# filter out versions accor... | 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; 10, 18; 10, 19; 10, 20; 11, 21; 13, 22; 15, 23; 17, 24; 17, 25; 19, 26; 20, 27; 21, 28; 21, 29; 22, 30; 22, 31; 23, 32; 23, 33; 25, 34; 25, 35; 26, 36; 27, 37; 29, 38; 29, 39; 31, 40; 31, 41; 31, 42; 32, 43; 32... | def get_agent_tags(since, to):
"""
Return a list of tags from integrations-core representing an Agent release,
sorted by more recent first.
"""
agent_tags = sorted(parse_version_info(t) for t in git_tag_list(r'^\d+\.\d+\.\d+$'))
# default value for `to` is the latest tag
if to:
to =... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key_or_list; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:direction; 14, None; 15, comm... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 20, 26; 20, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 25, 33; 28, 34; 28, 35; 29, 36; 29, 37; 32, 38; 32, 39; 33, 40 | def sort(self, key_or_list, direction=None):
"""Sorts this cursor's results.
Pass a field name and a direction, either
:data:`~pymongo.ASCENDING` or :data:`~pymongo.DESCENDING`::
for doc in collection.find().sort('field', pymongo.ASCENDING):
print(doc)
To s... |
0, module; 1, function_definition; 2, function_name:find_one_and_replace; 3, parameters; 4, block; 5, identifier:self; 6, identifier:filter; 7, identifier:replacement; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, dictionary_splat_pattern; 13, expression_statement; 14, ex... | 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; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 24, 30; 24, 31; 27, 32; 27, 33; 28, 34; 28, 35; 29, 36; 29, 37; 32, 38; 32, 39; 33, 40; 34, 41; 34, 42; 36, 43; 36, 4... | def find_one_and_replace(self, filter, replacement,
projection=None, sort=None, upsert=False,
return_document=ReturnDocument.BEFORE, **kwargs):
"""Finds a single document and replaces it, returning either the
original or the replaced document.
... |
0, module; 1, function_definition; 2, function_name:find_one_and_update; 3, parameters; 4, block; 5, identifier:self; 6, identifier:filter; 7, identifier:update; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, dictionary_splat_pattern; 13, expression_statement; 14, 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; 4, 13; 4, 14; 4, 15; 4, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 24, 30; 24, 31; 27, 32; 27, 33; 28, 34; 28, 35; 29, 36; 29, 37; 32, 38; 32, 39; 33, 40; 34, 41; 34, 42; 36, 43; 36, 4... | def find_one_and_update(self, filter, update,
projection=None, sort=None, upsert=False,
return_document=ReturnDocument.BEFORE, **kwargs):
"""Finds a single document and updates it, returning either the
original or the updated document.
>... |
0, module; 1, function_definition; 2, function_name:feature_correlation; 3, parameters; 4, block; 5, identifier:X; 6, identifier:y; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, dictionary_splat_pattern; 14, expression_statemen... | 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; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 11, 31; 12, 32; 12, 33; 13, 34; 14, 35; 16, 36; 18, 37; 19, 38; 21, 39; 25, 40; 36, 41; 36, 42; 37, 43; 37, 44; 38, ... | def feature_correlation(X, y, ax=None, method='pearson',
labels=None, sort=False, feature_index=None,
feature_names=None, **kwargs):
"""
Displays the correlation between features and dependent variables.
This visualizer can be used side-by-side with
yello... |
0, module; 1, function_definition; 2, function_name:dispersion; 3, parameters; 4, block; 5, identifier:words; 6, identifier:corpus; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, dictionary_splat_pattern; ... | 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; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 11, 31; 12, 32; 12, 33; 13, 34; 13, 35; 14, 36; 15, 37; 17, 38; 19, 39; 21, 40; 38, 41; 38, 42; 39, 43; 39, 44; 40, ... | def dispersion(words, corpus, y=None, ax=None, colors=None, colormap=None,
labels=None, annotate_docs=False, ignore_case=False, **kwargs):
""" Displays lexical dispersion plot for words in a corpus
This helper function is a quick wrapper to utilize the DisperstionPlot
Visualizer for one-off ... |
0, module; 1, function_definition; 2, function_name:sorted_product_set; 3, parameters; 4, block; 5, identifier:array_a; 6, identifier:array_b; 7, expression_statement; 8, return_statement; 9, comment:"""Compute the product set of array_a and array_b and sort it."""; 10, subscript; 11, call; 12, slice; 13, attribute; 14... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 11, 13; 11, 14; 12, 15; 13, 16; 13, 17; 14, 18; 15, 19; 18, 20; 18, 21; 20, 22; 20, 23; 21, 24; 21, 25; 24, 26; 24, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33; 30, 34; 30, 35; 33, 36; 33, 37; 37, 38; 38, 39; 38, 40; 40, 41 | def sorted_product_set(array_a, array_b):
"""Compute the product set of array_a and array_b and sort it."""
return np.sort(
np.concatenate(
[array_a[i] * array_b for i in xrange(len(array_a))], axis=0)
)[::-1] |
0, module; 1, function_definition; 2, function_name:_get_sorted_inputs; 3, parameters; 4, block; 5, identifier:filename; 6, expression_statement; 7, with_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; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 13, 24; 15, 25; 16, 26; 16, 27; 16, 28; 17, 29; 17, 30; 18, 31; 18, 32; 19, 33; 19, 34; 20, 35; 20, 36; 21, 37; 21, 38; 22, 39; 22, 40; 23, 41; 23, 42; 24, 43; 24,... | def _get_sorted_inputs(filename):
"""Read and sort lines from the file sorted by decreasing length.
Args:
filename: String name of file to read inputs from.
Returns:
Sorted list of inputs, and dictionary mapping original index->sorted index
of each element.
"""
with tf.gfile.Open(filename) as f:
... |
0, module; 1, function_definition; 2, function_name:games_by_time; 3, parameters; 4, block; 5, identifier:self; 6, identifier:start_game; 7, identifier:end_game; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, function_definition; 12, return_statement; 13, comment:"""Given a range of gam... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 11, 16; 11, 17; 11, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 18, 25; 18, 26; 18, 27; 19, 28; 19, 29; 21, 30; 23, 31; 23, 32; 25, 33; 26, 34; 27, 35; 29, 36; 29, 37; 31, 38; 31, 39; 32, 40; 32, 41; 32, 42; 33, 43;... | def games_by_time(self, start_game, end_game):
"""Given a range of games, return the games sorted by time.
Returns [(time, game_number), ...]
The time will be a `datetime.datetime` and the game
number is the integer used as the basis of the row ID.
Note that when a cluster of ... |
0, module; 1, function_definition; 2, function_name:bleakest_moves; 3, parameters; 4, block; 5, identifier:self; 6, identifier:start_game; 7, identifier:end_game; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, function_definition; 12, return_statement; 13, comment:"""Given a range of ga... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 11, 16; 11, 17; 11, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 18, 25; 18, 26; 18, 27; 18, 28; 19, 29; 19, 30; 21, 31; 23, 32; 23, 33; 25, 34; 26, 35; 27, 36; 28, 37; 30, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43;... | def bleakest_moves(self, start_game, end_game):
"""Given a range of games, return the bleakest moves.
Returns a list of (game, move, q) sorted by q.
"""
bleak = b'bleakest_q'
rows = self.bt_table.read_rows(
ROW_PREFIX.format(start_game),
ROW_PREFIX.format... |
0, module; 1, function_definition; 2, function_name:_generate_subtokens; 3, parameters; 4, block; 5, identifier:token_counts; 6, identifier:alphabet; 7, identifier:min_count; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, comment:# Use alphabet set to create initial list of ... | 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; 8, 21; 9, 22; 9, 23; 10, 24; 11, 25; 11, 26; 13, 27; 14, 28; 18, 29; 18, 30; 18, 31; 19, 32; 25, 33; 25, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 30, 40; 30, 41; 31, 42; 31, 43; 31, 44; ... | def _generate_subtokens(
token_counts, alphabet, min_count, num_iterations=4,
reserved_tokens=None):
"""Create a list of subtokens in decreasing order of frequency.
Args:
token_counts: dict mapping str tokens -> int count
alphabet: set of characters
min_count: int minimum number of times a subt... |
0, module; 1, function_definition; 2, function_name:sparse_svd; 3, parameters; 4, block; 5, identifier:sparse_matrix; 6, identifier:num_values; 7, identifier:max_iter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, return_statement; 14, comment:"""Wrapper aro... | 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; 8, 14; 9, 15; 9, 16; 10, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 13, 23; 15, 24; 15, 25; 16, 26; 17, 27; 17, 28; 18, 29; 19, 30; 19, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 23, 39; 26, 40; 27, 41; 27, 42; 28, 43; 2... | def sparse_svd(sparse_matrix, num_values, max_iter):
"""Wrapper around SciPy's Singular Value Decomposition for sparse matrices.
Args:
sparse_matrix: a SciPy sparse matrix (typically large).
num_values: the number of largest singular values to compute.
max_iter: maximum number of iterations (>= 0) in t... |
0, module; 1, function_definition; 2, function_name:build_collate_fn; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, function_definition; 11, function_definition; 12, if_statement; 13, identifier:batch_first; 14, False; 15,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 5, 13; 5, 14; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 9, 20; 9, 21; 9, 22; 10, 23; 10, 24; 10, 25; 11, 26; 11, 27; 11, 28; 12, 29; 12, 30; 12, 31; 21, 32; 22, 33; 22, 34; 22, 35; 22, 36; 22, 37; 22, 38; 22, 39; 22, 40; 24, 41; 25, 42; 25, 43; 25, 44;... | def build_collate_fn(batch_first=False, parallel=True, sort=False):
"""
Factory for collate_fn functions.
:param batch_first: if True returns batches in (batch, seq) format, if
False returns in (seq, batch) format
:param parallel: if True builds batches from parallel corpus (src, tgt)
:para... |
0, module; 1, function_definition; 2, function_name:get_golden_chunk_records; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, return_statement; 8, comment:"""Return up to num_records of golden chunks to train on.
Returns:
A list of golden chunks up to num_records in length, sorted b... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 5, 8; 6, 9; 7, 10; 9, 11; 9, 12; 10, 13; 10, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 22, 30; 22, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 30, 37; 30, 38; 33, 39; 33, 40; 34, 41; 39, 42; 39, 4... | def get_golden_chunk_records():
"""Return up to num_records of golden chunks to train on.
Returns:
A list of golden chunks up to num_records in length, sorted by path.
"""
pattern = os.path.join(fsdb.golden_chunk_dir(), '*.zz')
return sorted(tf.gfile.Glob(pattern), reverse=True)[:FLAGS.window_size] |
0, module; 1, function_definition; 2, function_name:_sorted_results; 3, parameters; 4, block; 5, identifier:self; 6, identifier:results_dicts; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, comment:"""Sorts dict of result... | 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; 9, 15; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 16, 26; 19, 27; 22, 28; 22, 29; 24, 30; 24, 31; 27, 32; 28, 33; 31, 34; 31, 35; 32, 36; 32, 37; 35, 38; 35, 39; 36, 40; 36, 41; 37, 42; 39, 43; ... | def _sorted_results(self, results_dicts):
"""Sorts dict of results based on log start_time.
Sorts the results and returns an array with only the values but sorted
by oldest value first.value
Args:
results_dicts: List of result dicts
Returns:
List of only the time but sorted oldest fir... |
0, module; 1, function_definition; 2, function_name:get_models; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Finds all models, returning a list of model number and names
sorted increasing.
Return... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 6, 11; 7, 12; 8, 13; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 13, 20; 16, 21; 16, 22; 18, 23; 18, 24; 20, 25; 20, 26; 21, 27; 21, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 26, 34; 29, 35; 29, 36; 30, 37; 30, 38; 31, 39; 34, 40; 34, 41; 35, 42; 35, 43;... | def get_models():
"""Finds all models, returning a list of model number and names
sorted increasing.
Returns: [(13, 000013-modelname), (17, 000017-modelname), ...etc]
"""
all_models = gfile.Glob(os.path.join(models_dir(), '*.meta'))
model_filenames = [os.path.basename(m) for m in all_models]
... |
0, module; 1, function_definition; 2, function_name:sorted_by; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, string; 8, expression_statement; 9, return_statement; 10, identifier:key; 11, type; 12, string_content:QubitOrder; 13, comment:"""A basis that orders qubits ascending based on a key function.
... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 6, 10; 6, 11; 7, 12; 8, 13; 9, 14; 11, 15; 14, 16; 14, 17; 15, 18; 15, 19; 17, 20; 19, 21; 19, 22; 20, 23; 20, 24; 21, 25; 22, 26; 23, 27; 24, 28; 24, 29; 25, 30; 29, 31; 30, 32; 30, 33; 31, 34; 31, 35; 35, 36; 35, 37; 37, 38; 37, 39 | def sorted_by(key: Callable[[raw_types.Qid], Any]) -> 'QubitOrder':
"""A basis that orders qubits ascending based on a key function.
Args:
key: A function that takes a qubit and returns a key value. The
basis will be ordered ascending according to these key values.
... |
0, module; 1, function_definition; 2, function_name:diagonalize_real_symmetric_and_sorted_diagonal_matrices; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, keyword_separator; 9, typed_default_parameter; 10, typed_default_parameter; 11, typed_default_parameter; 12, attribute; 13, expression... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 5, 18; 5, 19; 5, 20; 5, 21; 5, 22; 5, 23; 5, 24; 5, 25; 6, 26; 6, 27; 7, 28; 7, 29; 9, 30; 9, 31; 9, 32; 10, 33; 10, 34; 10, 35; 11, 36; 11, 37; 11, 38; 12, 39; 12, 40; 13, 41; 15, 42; 15, 43; 16, 44; 16, 45; 1... | def diagonalize_real_symmetric_and_sorted_diagonal_matrices(
symmetric_matrix: np.ndarray,
diagonal_matrix: np.ndarray,
*,
rtol: float = 1e-5,
atol: float = 1e-8,
check_preconditions: bool = True) -> np.ndarray:
"""Returns an orthogonal matrix that diagonalizes both g... |
0, module; 1, function_definition; 2, function_name:findall_operations_between; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, typed_parameter; 9, typed_default_parameter; 10, generic_type; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, comment:# Note: on... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 13, 28; 15, 29; 15, 30; 15, 31; 16, 32; 18, 33; 20, 34; 22, 35; 25, 36; 27, 37; 27, 38; 28, 39; 28, 40; 30, 41; 30, 42; 31, 43; 32, 44; ... | def findall_operations_between(self,
start_frontier: Dict[ops.Qid, int],
end_frontier: Dict[ops.Qid, int],
omit_crossing_operations: bool = False
) -> List[Tuple[int, ops.Operation... |
0, module; 1, function_definition; 2, function_name:_GetUnsortedNotifications; 3, parameters; 4, block; 5, identifier:self; 6, identifier:queue_shard; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:notifications_by_sessio... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 9, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 20, 28; 20, 29; 21, 30; 21, 31; 25, 32; 27, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 31, 40; 31, 41; 31, 42; 31, 43; 31... | def _GetUnsortedNotifications(self,
queue_shard,
notifications_by_session_id=None):
"""Returns all the available notifications for a queue_shard.
Args:
queue_shard: urn of queue shard
notifications_by_session_id: store notifications in... |
0, module; 1, function_definition; 2, function_name:Dump; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, comment:# Python 2 json.dumps expects separators as a tuple of bytes, while; 10, comment:# Python 3 expects them to be a tuple of unicode strings.... | 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; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 13, 26; 19, 27; 19, 28; 20, 29; 26, 30; 26, 31; 27, 32; 27, 33; 28, 34; 28, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41; 34, 42; 36, 43; 36, 44; 37... | def Dump(obj,
sort_keys = False,
encoder = None):
"""Stringifies a Python object into its JSON representation.
Args:
obj: A Python object to convert to JSON.
sort_keys: If True, output dictionaries keys in sorted (ascending) order.
encoder: An (optional) encoder class to use.
Retur... |
0, module; 1, function_definition; 2, function_name:NamedPlaceholders; 3, parameters; 4, block; 5, identifier:iterable; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""Returns named placeholders from all elements of the given iterable.
Use this function for VALUES of MySQL INSERT... | 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; 11, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 23, 25; 23, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 28, 32; 28, 33; 33, 34 | def NamedPlaceholders(iterable):
"""Returns named placeholders from all elements of the given iterable.
Use this function for VALUES of MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6),
this function sorts column names.
Examples:
>>> NamedPlaceholders({"password": ... |
0, module; 1, function_definition; 2, function_name:Columns; 3, parameters; 4, block; 5, identifier:iterable; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""Returns a string of column names for MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6... | 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; 11, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 17, 21; 20, 22; 20, 23; 22, 24; 22, 25; 23, 26; 23, 27; 26, 28; 26, 29; 27, 30; 27, 31; 28, 32; 28, 33; 29, 34 | def Columns(iterable):
"""Returns a string of column names for MySQL INSERTs.
To account for Iterables with undefined order (dicts before Python 3.6),
this function sorts column names.
Examples:
>>> Columns({"password": "foo", "name": "bar"})
u'(`name`, `password`)'
Args:
iterable: The iterable... |
0, module; 1, function_definition; 2, function_name:GetArtifactsForCollection; 3, parameters; 4, block; 5, identifier:os_name; 6, identifier:artifact_list; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Wrapper for the ArtifactArranger.
Extend the arti... | 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; 16, 19; 16, 20; 18, 21; 18, 22; 20, 23; 20, 24; 21, 25; 21, 26 | def GetArtifactsForCollection(os_name, artifact_list):
"""Wrapper for the ArtifactArranger.
Extend the artifact list by dependencies and sort the artifacts to resolve the
dependencies.
Args:
os_name: String specifying the OS name.
artifact_list: List of requested artifact names.
Returns:
A list... |
0, module; 1, function_definition; 2, function_name:_FilterOutPathInfoDuplicates; 3, parameters; 4, block; 5, identifier:path_infos; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, function_definition; 10, for_statement; 11, return_statement; 12, comment:"""Filters out duplicates from passed Path... | 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; 8, 15; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 10, 21; 10, 22; 11, 23; 13, 24; 13, 25; 16, 26; 16, 27; 18, 28; 19, 29; 21, 30; 21, 31; 22, 32; 23, 33; 23, 34; 26, 35; 27, 36; 29, 37; 30, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43; 34, ... | def _FilterOutPathInfoDuplicates(path_infos):
"""Filters out duplicates from passed PathInfo objects.
Args:
path_infos: An iterable with PathInfo objects.
Returns:
A list of PathInfo objects with duplicates removed. Duplicates are
removed following this logic: they're sorted by (ctime, mtime, atime,... |
0, module; 1, function_definition; 2, function_name:DrainTaskSchedulerQueueForClient; 3, parameters; 4, block; 5, identifier:self; 6, identifier:client; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, comment:# Drain the queue 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; 7, 18; 7, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 14, 27; 14, 28; 14, 29; 15, 30; 16, 31; 16, 32; 17, 33; 21, 34; 21, 35; 22, 36; 23, 37; 23, 38; 24, 39; 25, 40; 25, 41; 26, 42; 26, 43; 27, 44;... | def DrainTaskSchedulerQueueForClient(self, client, max_count=None):
"""Drains the client's Task Scheduler queue.
1) Get all messages in the client queue.
2) Sort these into a set of session_ids.
3) Use data_store.DB.ResolvePrefix() to query all requests.
4) Delete all responses for retransmitted me... |
0, module; 1, function_definition; 2, function_name:federated_query; 3, parameters; 4, block; 5, identifier:self; 6, identifier:environment_id; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parame... | 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; 3, 20; 3, 21; 3, 22; 3, 23; 3, 24; 3, 25; 3, 26; 3, 27; 3, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 4, 37; 4, 38; 4, 39; 7, 40; 7, 41; 8, 42; 8, 43; 9, 44; 9, 45; 10, 46; 10, 47... | def federated_query(self,
environment_id,
filter=None,
query=None,
natural_language_query=None,
passages=None,
aggregation=None,
count=None,
... |
0, module; 1, function_definition; 2, function_name:query_relations; 3, parameters; 4, block; 5, identifier:self; 6, identifier:environment_id; 7, identifier:collection_id; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, diction... | 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; 8, 30; 8, 31; 9, 32; 9, 33; 10, 34; 10, 35; 11, 36; 11, 37; 12, 38; 12, 39; 13, 40; 13, 41; 14, 42; 15, 43; 16, 44; 16, 45; 17... | def query_relations(self,
environment_id,
collection_id,
entities=None,
context=None,
sort=None,
filter=None,
count=None,
eviden... |
0, module; 1, function_definition; 2, function_name:query_log; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, dictionary_splat_pattern; 12, expression_statement; 13, expression_statement; 14, if_statement; 1... | 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; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 12, 32; 13, 33; 14, 34; 14, 35; 15, 36; 16, 37; 17, 38; 18, 39; 19, 40; 20, 41; 33, 42; 33, 43; 34, 44; 34, 4... | def query_log(self,
filter=None,
query=None,
count=None,
offset=None,
sort=None,
**kwargs):
"""
Search the query and event log.
Searches the query and event log to find query sessions tha... |
0, module; 1, function_definition; 2, function_name:list_workspaces; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, dictionary_splat_pattern; 12, expression_statement; 13, expression_statement; 14, if_statem... | 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; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 12, 32; 13, 33; 14, 34; 14, 35; 15, 36; 16, 37; 17, 38; 18, 39; 19, 40; 20, 41; 33, 42; 33, 43; 34, 44; 34, 4... | def list_workspaces(self,
page_limit=None,
include_count=None,
sort=None,
cursor=None,
include_audit=None,
**kwargs):
"""
List workspaces.
List the wor... |
0, module; 1, function_definition; 2, function_name:list_feedback; 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, d... | 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; 3, 20; 3, 21; 3, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 6, 32; 6, 33; 7, 34; 7, 35; 8, 36; 8, 37; 9, 38; 9, 39; 10, 40; 10, 41; 11, 42; 11, 43; 12, 44; 12, 45; 13, 46; ... | def list_feedback(self,
feedback_type=None,
before=None,
after=None,
document_title=None,
model_id=None,
model_version=None,
category_removed=None,
... |
0, module; 1, function_definition; 2, function_name:multi_index_insert_row; 3, parameters; 4, block; 5, identifier:df; 6, identifier:index_row; 7, identifier:values_row; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# The df wasn't so... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 14, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 21, 31; 22, 32; 22, 33; 24, 34; 24, 35; 26, 36; 26, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 3... | def multi_index_insert_row(df, index_row, values_row):
""" Return a new dataframe with a row inserted for a multi-index dataframe.
This will sort the rows according to the ordered multi-index levels.
"""
row_index = pd.MultiIndex(levels=[[i] for i in index_row],
labels=... |
0, module; 1, function_definition; 2, function_name:substring_search; 3, parameters; 4, block; 5, identifier:word; 6, identifier:collection; 7, expression_statement; 8, return_statement; 9, comment:"""Find all matches in the `collection` for the specified `word`.
If `word` is empty, returns all items in `collectio... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 10, 13; 12, 14; 12, 15; 13, 16; 15, 17; 15, 18; 16, 19; 16, 20; 18, 21; 19, 22; 19, 23; 20, 24 | def substring_search(word, collection):
"""Find all matches in the `collection` for the specified `word`.
If `word` is empty, returns all items in `collection`.
:type word: str
:param word: The substring to search for.
:type collection: collection, usually a list
:param collection: A collecti... |
0, module; 1, function_definition; 2, function_name:_nodes; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""
Returns the list of nodes present in the network
Examples
--------
>>> from pgmpy.models import DynamicBayesianNetwork as... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 12, 13; 12, 14; 14, 15; 15, 16; 15, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 22, 24; 22, 25; 24, 26; 24, 27; 27, 28; 27, 29 | def _nodes(self):
"""
Returns the list of nodes present in the network
Examples
--------
>>> from pgmpy.models import DynamicBayesianNetwork as DBN
>>> dbn = DBN()
>>> dbn.add_nodes_from(['A', 'B', 'C'])
>>> sorted(dbn._nodes())
['B', 'A', 'C']
... |
0, module; 1, function_definition; 2, function_name:add_edge; 3, parameters; 4, block; 5, identifier:self; 6, identifier:start; 7, identifier:end; 8, dictionary_splat_pattern; 9, expression_statement; 10, try_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, identifier:kwargs; 15, 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; 8, 14; 9, 15; 10, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 13, 22; 13, 23; 13, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 24, 38; 25, 39; 25, 40; 25, 41; 25, 42; 25, 43; ... | def add_edge(self, start, end, **kwargs):
"""
Add an edge between two nodes.
The nodes will be automatically added if they are not present in the network.
Parameters
----------
start: tuple
Both the start and end nodes should specify the time slice as
... |
0, module; 1, function_definition; 2, function_name:estimate; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; ... | 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; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 10, 24; 11, 25; 12, 26; 12, 27; 12, 28; 13, 29; 14, 30; 15, 31; 15, 32; 16, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29, 44; ... | def estimate(self, start=None, tabu_length=0, max_indegree=None):
"""
Performs local hill climb search to estimates the `DAG` structure
that has optimal score, according to the scoring method supplied in the constructor.
Starts at model `start` and proceeds by step-by-step network modifi... |
0, module; 1, function_definition; 2, function_name:add_node; 3, parameters; 4, block; 5, identifier:self; 6, identifier:node; 7, default_parameter; 8, expression_statement; 9, comment:# Check for networkx 2.0 syntax; 10, if_statement; 11, expression_statement; 12, identifier:weight; 13, None; 14, comment:"""
A... | 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; 10, 15; 10, 16; 10, 17; 11, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 22, 31; 22, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 29, 42; 29, 43;... | def add_node(self, node, weight=None):
"""
Adds a single node to the Graph.
Parameters
----------
node: str, int, or any hashable python object.
The node to add to the graph.
weight: int, float
The weight of the node.
Examples
--... |
0, module; 1, function_definition; 2, function_name:add_nodes_from; 3, parameters; 4, block; 5, identifier:self; 6, identifier:nodes; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, identifier:weights; 12, None; 13, comment:"""
Add multiple nodes to the Graph.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 14, 18; 14, 19; 16, 20; 16, 21; 17, 22; 19, 23; 19, 24; 20, 25; 20, 26; 21, 27; 21, 28; 21, 29; 22, 30; 24, 31; 25, 32; 25, 33; 26, 34; 28, 35; 28, 36; 29, 37; 30, 38; 30, 39; 30, 40; 32, 41; 32, 42; 33, 43;... | def add_nodes_from(self, nodes, weights=None):
"""
Add multiple nodes to the Graph.
**The behviour of adding weights is different than in networkx.
Parameters
----------
nodes: iterable container
A container of nodes (list, dict, set, or any hashable python
... |
0, module; 1, function_definition; 2, function_name:rank_items; 3, parameters; 4, block; 5, identifier:self; 6, identifier:userid; 7, identifier:user_items; 8, identifier:selected_items; 9, default_parameter; 10, expression_statement; 11, comment:# check if selected_items contains itemids that are not in the model(user... | 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; 9, 22; 9, 23; 10, 24; 12, 25; 12, 26; 14, 27; 15, 28; 17, 29; 18, 30; 20, 31; 20, 32; 20, 33; 21, 34; 25, 35; 25, 36; 26, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 29, 43; 30, 44; ... | def rank_items(self, userid, user_items, selected_items, recalculate_user=False):
""" Rank given items for a user and returns sorted item list """
# check if selected_items contains itemids that are not in the model(user_items)
if max(selected_items) >= user_items.shape[1] or min(selected_items)... |
0, module; 1, function_definition; 2, function_name:get_sorted_structure; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:key; 12, None; 13, identifier:reverse; 14, False; 15, comment:"""
... | 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; 7, 14; 8, 15; 9, 16; 10, 17; 16, 18; 16, 19; 17, 20; 17, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 23, 28; 23, 29; 23, 30; 24, 31; 24, 32; 27, 33; 27, 34; 29, 35; 29, 36; 30, 37; 30, 38; 34, 39; 34, 40 | def get_sorted_structure(self, key=None, reverse=False):
"""
Get a sorted copy of the structure. The parameters have the same
meaning as in list.sort. By default, sites are sorted by the
electronegativity of the species.
Args:
key: Specifies a function of one argumen... |
0, module; 1, function_definition; 2, function_name:from_str; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:input_string; 7, identifier:fmt; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, import_from_statement; 13, import_from_statement; 14, import_from_stat... | 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; 8, 22; 8, 23; 9, 24; 9, 25; 10, 26; 10, 27; 11, 28; 12, 29; 12, 30; 13, 31; 13, 32; 14, 33; 14, 34; 15, 35; 15, 36; 16, 37; 16, 38; 17, 39; 18, 40; 18, 41; 18, 42; 18, 43; 18, 44; 18... | def from_str(cls, input_string, fmt, primitive=False, sort=False,
merge_tol=0.0):
"""
Reads a structure from a string.
Args:
input_string (str): String to parse.
fmt (str): A format specification.
primitive (bool): Whether to find a primitive... |
0, module; 1, function_definition; 2, function_name:get_transition_chempots; 3, parameters; 4, block; 5, identifier:self; 6, identifier:element; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, return_stateme... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 10, 20; 10, 21; 11, 22; 12, 23; 12, 24; 12, 25; 13, 26; 14, 27; 16, 28; 16, 29; 17, 30; 18, 31; 18, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 24, 39; 24, 40; 25, 41; 26, 42; 26, 43; 27,... | def get_transition_chempots(self, element):
"""
Get the critical chemical potentials for an element in the Phase
Diagram.
Args:
element: An element. Has to be in the PD in the first place.
Returns:
A sorted sequence of critical chemical potentials, from ... |
0, module; 1, function_definition; 2, function_name:from_dir; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:top; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:exts; 14, None; 15, identifier:exclude_dirs; ... | 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; 11, 21; 12, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 20, 28; 20, 29; 21, 30; 22, 31; 22, 32; 27, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 34, 43; 34... | def from_dir(cls, top, exts=None, exclude_dirs="_*"):
"""
Find all pseudos in the directory tree starting from top.
Args:
top: Top of the directory tree
exts: List of files extensions. if exts == "all_files"
we try to open all files in top
... |
0, module; 1, function_definition; 2, function_name:sorted; 3, parameters; 4, block; 5, identifier:self; 6, identifier:attrname; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, comment:# Sort attrs, and build new table with sorted pseudos.; 12, return_statement; 13, identi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 12, 20; 16, 21; 16, 22; 17, 23; 17, 24; 19, 25; 19, 26; 20, 27; 20, 28; 25, 29; 25, 30; 26, 31; 27, 32; 27, 33; 28, 34; 29, 35; 30, 36; 30, 37; 31, 38; 31, 39; 34, 40; 34, 41; 35, 42; 37, 43; 3... | def sorted(self, attrname, reverse=False):
"""
Sort the table according to the value of attribute attrname.
Return:
New class:`PseudoTable` object
"""
attrs = []
for i, pseudo in self:
try:
a = getattr(pseudo, attrname)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.