nodes
stringlengths
501
22.4k
edges
stringlengths
138
5.07k
code
stringlengths
108
19.3k
0, module; 1, function_definition; 2, function_name:get_loc; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, function_definition; 11, if_statement; 12, expression_statement; 13, if_statement; 14, if_statement; 15, comment:# -- partial s...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 7, 28; 7, 29; 8, 30; 9, 31; 9, 32; 10, 33; 10, 34; 10, 35; 11, 36; 11, 37; 12, 38; 13, 39; 13, 40; 14, 41; 14, 42; 19, 43; 20, 44; 21, 45; 2...
def get_loc(self, key, method=None): """ Get location for a label or a tuple of labels as an integer, slice or boolean mask. Parameters ---------- key : label or tuple of labels (one for each level) method : None Returns ------- loc : int...
0, module; 1, function_definition; 2, function_name:union; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# TODO: Index.union returns other when `l...
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; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 12, 23; 14, 24; 15, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 28, 42; 28, 43; 29, ...
def union(self, other, sort=None): """ Form the union of two MultiIndex objects Parameters ---------- other : MultiIndex or array / Index of tuples sort : False or None, default None Whether to sort the resulting Index. * None : Sort the result, ...
0, module; 1, function_definition; 2, function_name:intersection; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_state...
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; 10, 22; 11, 23; 12, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 16, 30; 17, 31; 17, 32; 17, 33; 21, 34; 21, 35; 22, 36; 22, 37; 23, 38; 23, 39; 24, 40; 24, 41; 25, 42; 26, 43; 26, 44...
def intersection(self, other, sort=False): """ Form the intersection of two MultiIndex objects. Parameters ---------- other : MultiIndex or array / Index of tuples sort : False or None, default False Sort the resulting MultiIndex if possible .. v...
0, module; 1, function_definition; 2, function_name:difference; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, expression_statement; 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; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 7, 21; 7, 22; 8, 23; 9, 24; 10, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 14, 31; 15, 32; 16, 33; 17, 34; 18, 35; 19, 36; 19, 37; 20, 38; 20, 39; 20, 40; 24, 41; 24, 42; 25, 43; 25, 44; 2...
def difference(self, other, sort=None): """ Compute set difference of two MultiIndex objects Parameters ---------- other : MultiIndex sort : False or None, default None Sort the resulting MultiIndex if possible .. versionadded:: 0.24.0 ...
0, module; 1, function_definition; 2, function_name:unique; 3, parameters; 4, block; 5, identifier:values; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_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; 6, 15; 7, 16; 8, 17; 8, 18; 8, 19; 9, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 16, 26; 16, 27; 17, 28; 17, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 27, 41; 27, 42; 29, 43; 30, 4...
def unique(values): """ Hash table-based unique. Uniques are returned in order of appearance. This does NOT sort. Significantly faster than numpy.unique. Includes NA values. Parameters ---------- values : 1d array-like Returns ------- numpy.ndarray or ExtensionArray T...
0, module; 1, function_definition; 2, function_name:value_counts; 3, parameters; 4, block; 5, identifier:values; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, import_from_statement; 13, expression_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; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 9, 25; 10, 26; 10, 27; 11, 28; 12, 29; 12, 30; 12, 31; 13, 32; 14, 33; 14, 34; 14, 35; 15, 36; 15, 37; 16, 38; 16, 39; 17, 40; 29, 41; 29, 42; 29, 43; 30, 44; 31...
def value_counts(values, sort=True, ascending=False, normalize=False, bins=None, dropna=True): """ Compute a histogram of the counts of non-null values. Parameters ---------- values : ndarray (1-d) sort : boolean, default True Sort by values ascending : boolean, def...
0, module; 1, function_definition; 2, function_name:validate_argsort_with_ascending; 3, parameters; 4, block; 5, identifier:ascending; 6, identifier:args; 7, identifier:kwargs; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, return_statement; 12, comment:""" If 'Categorical.argsort' is calle...
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; 9, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 20, 28; 22, 29; 22, 30; 22, 31; 24, 32; 27, 33; 27, 34; 28, 35; 28, 36; 31, 37; 31, 38; 34, 39; 34, 40; 39, 41
def validate_argsort_with_ascending(ascending, args, kwargs): """ If 'Categorical.argsort' is called via the 'numpy' library, the first parameter in its signature is 'axis', which takes either an integer or 'None', so check if the 'ascending' parameter has either integer type or is None, since 'asce...
0, module; 1, function_definition; 2, function_name:merge_asof; 3, parameters; 4, block; 5, identifier:left; 6, identifier:right; 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, 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; 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; 14, 37; 15, 38; 15, 39; 16, 40; 16, 41; 17, 42; 17, 43; 18, 44; 18, ...
def merge_asof(left, right, on=None, left_on=None, right_on=None, left_index=False, right_index=False, by=None, left_by=None, right_by=None, suffixes=('_x', '_y'), tolerance=None, allow_exact_matches=True, direction...
0, module; 1, function_definition; 2, function_name:generate_classes; 3, parameters; 4, block; 5, identifier:self; 6, identifier:items; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, string:"Generate classes from `items` ...
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; 9, 16; 9, 17; 10, 18; 11, 19; 12, 20; 14, 21; 14, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 22, 28; 22, 29; 23, 30; 25, 31; 25, 32; 26, 33; 26, 34; 30, 35; 30, 36; 32, 37; 36, 38; 36, 39; 38, 40; 38, 41; 39, 42; 42, 43; 42...
def generate_classes(self, items): "Generate classes from `items` by taking the sorted unique values." classes = set() for c in items: classes = classes.union(set(c)) classes = list(classes) classes.sort() return classes
0, module; 1, function_definition; 2, function_name:most_confused; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_default_parameter; 8, typed_default_parameter; 9, generic_type; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_statement; ...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 4, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 7, 15; 7, 16; 7, 17; 8, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 12, 25; 13, 26; 14, 27; 16, 28; 19, 29; 22, 30; 24, 31; 24, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43; 34, 44;...
def most_confused(self, min_val:int=1, slice_size:int=1)->Collection[Tuple[str,str,int]]: "Sorted descending list of largest non-diagonal entries of confusion matrix, presented as actual, predicted, number of occurrences." cm = self.confusion_matrix(slice_size=slice_size) np.fill_diagonal(cm, 0)...
0, module; 1, function_definition; 2, function_name:get_toplosses_idxs; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:learn; 7, identifier:n_imgs; 8, dictionary_splat_pattern; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, return_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 12, 20; 13, 21; 14, 22; 17, 23; 17, 24; 18, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 24, 33; 24, 34; 26, 35; 27, 36; 27, 37; 27, 38; 28, 39; 28, 40; 30, 41; 30, 42; 31, 43; 3...
def get_toplosses_idxs(cls, learn, n_imgs, **kwargs): "Sorts `ds_type` dataset by top losses and returns dataset and sorted indices." dl = learn.data.fix_dl if not n_imgs: n_imgs = len(dl.dataset) _,_,top_losses = learn.get_preds(ds_type=DatasetType.Fix, with_loss=True) idxs = to...
0, module; 1, function_definition; 2, function_name:sort_idxs; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:similarities; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, string:"Sorts `similarities` and return the indexes in pairs ordered by highest simi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 10, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 14, 21; 16, 22; 16, 23; 18, 24; 18, 25; 20, 26; 20, 27; 21, 28; 21, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 33, 38; 33, 39; 34, 40; 34, 41; 35, 42; 35, 43...
def sort_idxs(cls, similarities): "Sorts `similarities` and return the indexes in pairs ordered by highest similarity." idxs = cls.largest_indices(similarities, len(similarities)) idxs = [(idxs[0][i], idxs[1][i]) for i in range(len(idxs[0]))] return [e for l in idxs for e in l]
0, module; 1, function_definition; 2, function_name:uniqueify; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_default_parameter; 8, identifier:List; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:x; 14, type; 15, identifier:sort; 16, type; 17, F...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 6, 13; 6, 14; 7, 15; 7, 16; 7, 17; 9, 18; 10, 19; 11, 20; 11, 21; 12, 22; 14, 23; 16, 24; 19, 25; 19, 26; 21, 27; 26, 28; 26, 29; 27, 30; 29, 31; 30, 32; 30, 33; 31, 34; 31, 35; 32, 36; 32, 37; 34, 38; 34, 39; 38, 40; 38, 41; 40, 42; 40, 43; 41,...
def uniqueify(x:Series, sort:bool=False)->List: "Return sorted unique values of `x`." res = list(OrderedDict.fromkeys(x).keys()) if sort: res.sort() return res
0, module; 1, function_definition; 2, function_name:get_imported_modules; 3, parameters; 4, block; 5, identifier:cells; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# Imports parent modules - a.b.c = [a, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 8, 19; 9, 20; 10, 21; 11, 22; 13, 23; 14, 24; 15, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 25, 40; 27, 41; 27, 42; 29, 43; 29, 4...
def get_imported_modules(cells, nb_module_name=''): "Finds all submodules of notebook - sorted by submodules > top level modules > manual imports. This gives notebook imports priority" module_names = get_top_level_modules() nb_imports = [match.group(1) for cell in cells for match in IMPORT_RE.finditer(cell[...
0, module; 1, function_definition; 2, function_name:numericalize_tok; 3, parameters; 4, block; 5, identifier:tokens; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, if_statement; 15, exp...
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; 6, 24; 6, 25; 7, 26; 7, 27; 8, 28; 8, 29; 9, 30; 9, 31; 10, 32; 10, 33; 11, 34; 11, 35; 12, 36; 13, 37; 13, 38; 14, 39; 14, 40; 15, 41; 16, 42; 17, 43; 18, 44; 19, 45; ...
def numericalize_tok(tokens, max_vocab=50000, min_freq=0, unk_tok="_unk_", pad_tok="_pad_", bos_tok="_bos_", eos_tok="_eos_"): """Takes in text tokens and returns int2tok and tok2int converters Arguments: tokens(list): List of tokens. Can be a list of strings, or a list of lists of strings. ...
0, module; 1, function_definition; 2, function_name:get_freq_tuples; 3, parameters; 4, block; 5, identifier:my_list; 6, identifier:print_total_threshold; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:""" Turn a list of errors into frequency-sorted tuples threshold...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 15, 19; 15, 20; 16, 21; 16, 22; 19, 23; 20, 24; 21, 25; 21, 26; 22, 27; 23, 28; 23, 29; 24, 30; 24, 31; 26, 32; 26, 33; 26, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 32, 41; 32, 42; 33, 43; ...
def get_freq_tuples(my_list, print_total_threshold): """ Turn a list of errors into frequency-sorted tuples thresholded by a certain total number """ d = {} for token in my_list: d.setdefault(token, 0) d[token] += 1 return sorted(d.items(), key=operator.itemgetter(1), reverse=True)[:prin...
0, module; 1, function_definition; 2, function_name:get_levels; 3, parameters; 4, block; 5, identifier:self; 6, identifier:arcs; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Calculate available arc height "levels". Used to calculate arrow heights dynamically and without ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 16, 19; 18, 20; 19, 21; 19, 22; 20, 23; 20, 24; 22, 25; 24, 26; 24, 27; 26, 28; 26, 29; 28, 30; 29, 31; 29, 32; 31, 33; 31, 34; 32, 35; 32, 36
def get_levels(self, arcs): """Calculate available arc height "levels". Used to calculate arrow heights dynamically and without wasting space. args (list): Individual arcs and their start, end, direction and label. RETURNS (list): Arc levels sorted from lowest to highest. """ ...
0, module; 1, function_definition; 2, function_name:organize_commands; 3, parameters; 4, block; 5, identifier:corrected_commands; 6, expression_statement; 7, try_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:"""Yields sorted commands without duplic...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 13, 21; 13, 22; 14, 23; 14, 24; 15, 25; 15, 26; 16, 27; 16, 28; 17, 29; 17, 30; 20, 31; 21, 32; 22, 33; 24, 34; 26, 35; 26, 36; 26, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 31, 43; 3...
def organize_commands(corrected_commands): """Yields sorted commands without duplicates. :type corrected_commands: Iterable[thefuck.types.CorrectedCommand] :rtype: Iterable[thefuck.types.CorrectedCommand] """ try: first_command = next(corrected_commands) yield first_command exc...
0, module; 1, function_definition; 2, function_name:get_corrected_commands; 3, parameters; 4, block; 5, identifier:command; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""Returns generator with sorted and unique corrected commands. :type command: thefuck.types.Command :rty...
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; 13, 18; 13, 19; 15, 20; 17, 21; 17, 22; 18, 23; 19, 24; 19, 25; 22, 26; 22, 27; 23, 28; 23, 29; 25, 30; 25, 31; 28, 32; 28, 33; 29, 34; 30, 35; 30, 36; 31, 37
def get_corrected_commands(command): """Returns generator with sorted and unique corrected commands. :type command: thefuck.types.Command :rtype: Iterable[thefuck.types.CorrectedCommand] """ corrected_commands = ( corrected for rule in get_rules() if rule.is_match(command) ...
0, module; 1, function_definition; 2, function_name:_partition_query; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:table_name; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_sta...
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; 13, 28; 14, 29; 15, 30; 15, 31; 16, 32; 17, 33; 25, 34; 25, 35; 26, 36; 26, 37; 28, 38; 28, 39; 28, 40; 28, 41; 29, 42; 29, 43; 31, 44; ...
def _partition_query( cls, table_name, limit=0, order_by=None, filters=None): """Returns a partition query :param table_name: the name of the table to get partitions from :type table_name: str :param limit: the number of partitions to be returned :type limit: int ...
0, module; 1, function_definition; 2, function_name:cocktail_shaker_sort; 3, parameters; 4, block; 5, identifier:arr; 6, expression_statement; 7, function_definition; 8, expression_statement; 9, expression_statement; 10, while_statement; 11, return_statement; 12, comment:""" Cocktail_shaker_sort Sorting a given...
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; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 11, 20; 14, 21; 14, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 19, 28; 19, 29; 19, 30; 19, 31; 19, 32; 23, 33; 25, 34; 25, 35; 28, 36; 29, 37; 29, 38; 29, 39; 30, 40; 30, 41; 31, 42; 32, 43; 32...
def cocktail_shaker_sort(arr): """ Cocktail_shaker_sort Sorting a given array mutation of bubble sort reference: https://en.wikipedia.org/wiki/Cocktail_shaker_sort Worst-case performance: O(N^2) """ def swap(i, j): arr[i], arr[j] = arr[j], arr[i] n = len(arr) swap...
0, module; 1, function_definition; 2, function_name:max_heapify; 3, parameters; 4, block; 5, identifier:arr; 6, identifier:end; 7, identifier:simulation; 8, identifier:iteration; 9, expression_statement; 10, expression_statement; 11, comment:# Iterate from last parent to first; 12, for_statement; 13, expression_stateme...
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; 9, 15; 10, 16; 12, 17; 12, 18; 12, 19; 13, 20; 14, 21; 16, 22; 16, 23; 18, 24; 18, 25; 19, 26; 19, 27; 19, 28; 20, 29; 20, 30; 23, 31; 23, 32; 25, 33; 25, 34; 25, 35; 26, 36; 28, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; ...
def max_heapify(arr, end, simulation, iteration): """ Max heapify helper for max_heap_sort """ last_parent = (end - 1) // 2 # Iterate from last parent to first for parent in range(last_parent, -1, -1): current_parent = parent # Iterate from current_parent to last_parent whi...
0, module; 1, function_definition; 2, function_name:min_heapify; 3, parameters; 4, block; 5, identifier:arr; 6, identifier:start; 7, identifier:simulation; 8, identifier:iteration; 9, expression_statement; 10, comment:# Offset last_parent by the start (last_parent calculated as if start index was 0); 11, comment:# All ...
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; 9, 17; 12, 18; 13, 19; 15, 20; 15, 21; 15, 22; 16, 23; 18, 24; 18, 25; 19, 26; 19, 27; 21, 28; 21, 29; 22, 30; 22, 31; 22, 32; 25, 33; 25, 34; 27, 35; 27, 36; 29, 37; 29, 38; 29, 39; 30, 40; 32, 41; 32, 42; 32, 43; 33...
def min_heapify(arr, start, simulation, iteration): """ Min heapify helper for min_heap_sort """ # Offset last_parent by the start (last_parent calculated as if start index was 0) # All array accesses need to be offset by start end = len(arr) - 1 last_parent = (end - start - 1) // 2 # Itera...
0, module; 1, function_definition; 2, function_name:pancake_sort; 3, parameters; 4, block; 5, identifier:arr; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, for_statement; 10, return_statement; 11, comment:""" Pancake_sort Sorting a given array mutation of selection sort referenc...
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; 8, 14; 9, 15; 9, 16; 9, 17; 9, 18; 10, 19; 12, 20; 12, 21; 13, 22; 13, 23; 14, 24; 16, 25; 16, 26; 18, 27; 18, 28; 21, 29; 21, 30; 24, 31; 26, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 28, 38; 30, 39; 32, 40; 32, 41; 34, 42; 35, 43; 35,...
def pancake_sort(arr): """ Pancake_sort Sorting a given array mutation of selection sort reference: https://www.geeksforgeeks.org/pancake-sorting/ Overall time complexity : O(N^2) """ len_arr = len(arr) if len_arr <= 1: return arr for cur in range(len(arr), 1, -1):...
0, module; 1, function_definition; 2, function_name:natural_sort; 3, parameters; 4, block; 5, identifier:list; 6, default_parameter; 7, expression_statement; 8, function_definition; 9, expression_statement; 10, expression_statement; 11, identifier:key; 12, lambda; 13, comment:""" Sort the list into natural alphanum...
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; 8, 15; 8, 16; 9, 17; 10, 18; 12, 19; 12, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 22, 29; 23, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 29, 36; 29, 37; 30, 38; 30, 39; 32, 40; 35, 41; 35, 42; 37, 43; 37...
def natural_sort(list, key=lambda s:s): """ Sort the list into natural alphanumeric order. """ def get_alphanum_key_func(key): convert = lambda text: int(text) if text.isdigit() else text return lambda s: [convert(c) for c in re.split('([0-9]+)', key(s))] sort_key = get_alphanum_key_...
0, module; 1, function_definition; 2, function_name:_build_vocab; 3, parameters; 4, block; 5, identifier:filename; 6, identifier:vocab_path; 7, identifier:vocab_size; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement;...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 13, 20; 14, 21; 14, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 22, 34; 24, 35; 24, 36; 26, 37; 26, 38; 28, 39; 28, 40; 29, 41; 29, 42; 30, 43; 3...
def _build_vocab(filename, vocab_path, vocab_size): """Reads a file to build a vocabulary of `vocab_size` most common words. The vocabulary is sorted by occurrence count and has one word per line. Originally from: https://github.com/tensorflow/models/blob/master/tutorials/rnn/ptb/reader.py Args: file...
0, module; 1, function_definition; 2, function_name:_read_stepfiles_list; 3, parameters; 4, block; 5, identifier:path_prefix; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:path_suffix; 13, string:".index"; 14, identi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 17, 22; 17, 23; 19, 24; 19, 25; 20, 26; 20, 27; 20, 28; 20, 29; 20, 30; 21, 31; 21, 32; 25, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 29, 40; 30, 41; 32, 42; 32, 43; 33...
def _read_stepfiles_list(path_prefix, path_suffix=".index", min_steps=0): """Return list of StepFiles sorted by step from files at path_prefix.""" stepfiles = [] for filename in _try_twice_tf_glob(path_prefix + "*-[0-9]*" + path_suffix): basename = filename[:-len(path_suffix)] if path_suffix else filename ...
0, module; 1, function_definition; 2, function_name:to_json; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, function_definition; 11, return_statement; 12, identifier:indent; 13, None; 14, identifier:separators; 15, None; 16, id...
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; 10, 21; 11, 22; 20, 23; 21, 24; 21, 25; 21, 26; 22, 27; 22, 28; 24, 29; 25, 30; 25, 31; 25, 32; 26, 33; 27, 34; 27, 35; 28, 36; 28, 37; 28, 38; 28, 39; 30, 40; 30, 41; 31, 42; 32, 43; 32,...
def to_json(self, indent=None, separators=None, sort_keys=False): """Serializes the hyperparameters into JSON. Args: indent: If a non-negative integer, JSON array elements and object members will be pretty-printed with that indent level. An indent level of 0, or negative, will only insert...
0, module; 1, function_definition; 2, function_name:_create_topk_unique; 3, parameters; 4, block; 5, identifier:inputs; 6, identifier:k; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 7, 28; 8, 29; 9, 30; 10, 31; 11, 32; 12, 33; 13, 34; 17, 35; 18, 36; 19, 37; 19, 38; 19, 39; 20, 40; 21, 41; 22, 42; 23, 43; 24, 44; 25, 45;...
def _create_topk_unique(inputs, k): """Creates the top k values in sorted order with indices. Args: inputs: A tensor with rank of 2. [batch_size, original_size]. k: An integer, number of top elements to select. Returns: topk_r2: A tensor, the k largest elements. [batch_size, k]. topk_indices_r2:...
0, module; 1, function_definition; 2, function_name:top_k_with_unique; 3, parameters; 4, block; 5, identifier:inputs; 6, identifier:k; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Finds the values and indices of the k largests ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 26, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41; 39, 42; 39, 43;...
def top_k_with_unique(inputs, k): """Finds the values and indices of the k largests entries. Instead of doing sort like tf.nn.top_k, this function finds the max value k times. The running time is proportional to k, which is be faster when k is small. The current implementation supports only inputs of rank 2. ...
0, module; 1, function_definition; 2, function_name:_rowwise_unsorted_segment_sum; 3, parameters; 4, block; 5, identifier:values; 6, identifier:indices; 7, identifier:n; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, comment:"""UnsortedSeg...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 11, 16; 12, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 21, 30; 21, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43;...
def _rowwise_unsorted_segment_sum(values, indices, n): """UnsortedSegmentSum on each row. Args: values: a `Tensor` with shape `[batch_size, k]`. indices: an integer `Tensor` with shape `[batch_size, k]`. n: an integer. Returns: A `Tensor` with the same type as `values` and shape `[batch_size, n]`...
0, module; 1, function_definition; 2, function_name:_get_sorted_inputs; 3, parameters; 4, block; 5, identifier:filename; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, with_statement; 10, expression_statement; 11, expression_statement; 12, comment:# We'll need the keys to rearrange the input...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 13, 25; 14, 26; 15, 27; 15, 28; 15, 29; 16, 30; 20, 31; 20, 32; 21, 33; 22, 34; 22, 35; 22, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, 44;...
def _get_sorted_inputs(filename, delimiter="\n"): """Returning inputs sorted according to decreasing length. This causes inputs of similar lengths to be processed in the same batch, facilitating early stopping for short sequences. Longer sequences are sorted first so that if you're going to get OOMs, you'll...
0, module; 1, function_definition; 2, function_name:sort_batch_by_length; 3, parameters; 4, block; 5, typed_parameter; 6, typed_parameter; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# This is the equivalent of zipping with index, so...
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; 5, 17; 5, 18; 6, 19; 6, 20; 7, 21; 8, 22; 8, 23; 9, 24; 10, 25; 11, 26; 14, 27; 15, 28; 16, 29; 18, 30; 20, 31; 22, 32; 22, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 44; 2...
def sort_batch_by_length(tensor: torch.Tensor, sequence_lengths: torch.Tensor): """ Sort a batch first tensor by some specified lengths. Parameters ---------- tensor : torch.FloatTensor, required. A batch first Pytorch tensor. sequence_lengths : torch.LongTensor, required. A ten...
0, module; 1, function_definition; 2, function_name:render_config; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_default_parameter; 8, identifier:str; 9, expression_statement; 10, comment:# Add four spaces to the indent.; 11, expression_statement; 12, return_statement; 13, identifier:config; 14, type; ...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 6, 13; 6, 14; 7, 15; 7, 16; 7, 17; 9, 18; 11, 19; 12, 20; 14, 21; 16, 22; 19, 23; 19, 24; 20, 25; 20, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 31, 32; 31, 33; 31, 34; 31, 35; 31, 36; 31, 37; 31, 38; 31, 39; 31, 40; 35, 41; 35, 42; 35, 43; 37,...
def render_config(config: Config, indent: str = "") -> str: """ Pretty-print a config in sort-of-JSON+comments. """ # Add four spaces to the indent. new_indent = indent + " " return "".join([ # opening brace + newline "{\n", # "type": "...", (if present) ...
0, module; 1, function_definition; 2, function_name:sort_and_run_forward; 3, parameters; 4, block; 5, identifier:self; 6, typed_parameter; 7, typed_parameter; 8, typed_parameter; 9, typed_default_parameter; 10, expression_statement; 11, comment:# In some circumstances you may have sequences of zero length. ``pack_padde...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 6, 26; 6, 27; 7, 28; 7, 29; 8, 30; 8, 31; 9, 32; 9, 33; 9, 34; 10, 35; 15, 36; 16, 37; 17, 38; 18, 39; 20, 40; 22, 41; 22, 42; 22, 43; 24, 44; 25, 45; 27,...
def sort_and_run_forward(self, module: Callable[[PackedSequence, Optional[RnnState]], Tuple[Union[PackedSequence, torch.Tensor], RnnState]], inputs: torch.Tensor, mask: torch.Tensor, ...
0, module; 1, function_definition; 2, function_name:_get_initial_states; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, typed_parameter; 9, typed_parameter; 10, generic_type; 11, expression_statement; 12, comment:# We don't know the state sizes the first time calling forward,; 13, comment:...
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; 5, 17; 5, 18; 5, 19; 5, 20; 5, 21; 5, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 14, 32; 14, 33; 16, 34; 16, 35; 16, 36; 16, 37; 16, 38; 16, 39; 22, 40; 22, 41; 22, 42; 22, 43; 22, 44; 24, 4...
def _get_initial_states(self, batch_size: int, num_valid: int, sorting_indices: torch.LongTensor) -> Optional[RnnState]: """ Returns an initial state for use in an RNN. Additionally, this method handles the batch...
0, module; 1, function_definition; 2, function_name:_update_states; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, typed_parameter; 9, None; 10, expression_statement; 11, comment:# TODO(Mark): seems weird to sort here, but append zeros in the subclasses.; 12, comment:# which way around is ...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 4, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 7, 15; 7, 16; 8, 17; 8, 18; 10, 19; 13, 20; 14, 21; 14, 22; 14, 23; 14, 24; 14, 25; 16, 26; 18, 27; 20, 28; 20, 29; 21, 30; 21, 31; 24, 32; 25, 33; 25, 34; 25, 35; 25, 36; 25, 37; 25, 38; 25, 39; 27, 40; 27, 41; 29, 42; 29, 43; 30,...
def _update_states(self, final_states: RnnStateStorage, restoration_indices: torch.LongTensor) -> None: """ After the RNN has run forward, the states need to be updated. This method just sets the state to the updated new state, performing sev...
0, module; 1, function_definition; 2, function_name:_prune_beam; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, typed_default_parameter; 9, generic_type; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, for_statement; 15, return_statement...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 4, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 11, 26; 12, 27; 12, 28; 12, 29; 13, 30; 14, 31; 14, 32; 14, 33; 15, 34; 17, 35; 19, 36; 21, 37; 24, 38; 26, 39; 26, 40; 26, 41; 29, 42; 29, 43; 29, 44; 3...
def _prune_beam(states: List[State], beam_size: int, sort_states: bool = False) -> List[State]: """ This method can be used to prune the set of unfinished states on a beam or finished states at the end of search. In the former case, the states need not be ...
0, module; 1, function_definition; 2, function_name:take_step; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, typed_default_parameter; 9, typed_default_parameter; 10, generic_type; 11, expression_statement; 12, raise_statement; 13, identifier:state; 14, type; 15, identifier:max_actions; 16...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 5, 11; 5, 12; 7, 13; 7, 14; 8, 15; 8, 16; 8, 17; 9, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 12, 24; 14, 25; 16, 26; 19, 27; 22, 28; 27, 29; 27, 30; 28, 31; 30, 32; 32, 33
def take_step(self, state: StateType, max_actions: int = None, allowed_actions: List[Set] = None) -> List[StateType]: """ The main method in the ``TransitionFunction`` API. This function defines the computation done at each step of decoding ...
0, module; 1, function_definition; 2, function_name:row_sparse_pull; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, assert_statement; 12, assert_statement; 13, if_statement; 14, assert_statement; 15, express...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 7, 26; 7, 27; 8, 28; 8, 29; 9, 30; 9, 31; 10, 32; 11, 33; 12, 34; 13, 35; 13, 36; 14, 37; 14, 38; 15, 39; 17, 40; 18, 41; 18, 42; 19, 43; 20, 44; 21, 45; ...
def row_sparse_pull(self, key, out=None, priority=0, row_ids=None): """ Pulls a single RowSparseNDArray value or a sequence of RowSparseNDArray values \ from the store with specified row_ids. When there is only one row_id, KVStoreRowSparsePull \ is invoked just once and the result is broadcast t...
0, module; 1, function_definition; 2, function_name:row_sparse_array; 3, parameters; 4, block; 5, identifier:arg1; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# construct a row sparse array from (D0, D1 ..) or (data, indices); 11, if_statement; 12, identifier:s...
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; 11, 19; 11, 20; 11, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 23, 28; 23, 29; 24, 30; 25, 31; 25, 32; 25, 33; 25, 34; 27, 35; 30, 36; 30, 37; 31, 38; 31, 39; 32, 40; 33, 41; 33, 42; 33, 43; 34,...
def row_sparse_array(arg1, shape=None, ctx=None, dtype=None): """Creates a `RowSparseNDArray`, a multidimensional row sparse array with a set of \ tensor slices at given indices. The RowSparseNDArray can be instantiated in several ways: - row_sparse_array(D): to construct a RowSparseNDArray wi...
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, return_statement; 10, comment:""" return beam-labelings, sorted by probability """; 11, assignment; 12, assignment; 13, 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; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 15, 20; 15, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 21, 28; 21, 29; 23, 30; 23, 31; 23, 32; 28, 33; 28, 34; 29, 35; 29, 36; 31, 37; 31, 38; 32, 39; 32, 40; 35, 41; 35, 42; 40, 43...
def sort(self): """ return beam-labelings, sorted by probability """ beams = [v for (_, v) in self.entries.items()] sortedBeams = sorted(beams, reverse=True, key=lambda x: x.prTotal*x.prText) return [x.labeling for x in sortedBeams]
0, module; 1, function_definition; 2, function_name:runtime; 3, parameters; 4, block; 5, identifier:X; 6, identifier:y; 7, identifier:model_generator; 8, identifier:method_name; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# average the method scores over several train/test s...
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; 9, 17; 10, 18; 11, 19; 13, 20; 14, 21; 14, 22; 14, 23; 15, 24; 16, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 22, 32; 22, 33; 23, 34; 23, 35; 23, 36; 23, 37; 23, 38; 23, 39; 23, 40; 23, 41; 23, 42; 23, 43; 23...
def runtime(X, y, model_generator, method_name): """ Runtime transform = "negate" sort_order = 1 """ old_seed = np.random.seed() np.random.seed(3293) # average the method scores over several train/test splits method_reps = [] for i in range(1): X_train, X_test, y_train, _ =...
0, module; 1, function_definition; 2, function_name:local_accuracy; 3, parameters; 4, block; 5, identifier:X; 6, identifier:y; 7, identifier:model_generator; 8, identifier:method_name; 9, expression_statement; 10, function_definition; 11, function_definition; 12, return_statement; 13, comment:""" Local Accuracy tra...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 9, 13; 10, 14; 10, 15; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 15, 21; 15, 22; 16, 23; 16, 24; 16, 25; 18, 26; 18, 27; 18, 28; 18, 29; 18, 30; 18, 31; 18, 32; 19, 33; 20, 34; 20, 35; 23, 36; 24, 37; 25, 38; 25, 39; 25, 40; 25, 41; 25, 42; 25, 43...
def local_accuracy(X, y, model_generator, method_name): """ Local Accuracy transform = "identity" sort_order = 2 """ def score_map(true, pred): """ Converts local accuracy from % of standard deviation to numerical scores for coloring. """ v = min(1.0, np.std(pred - true) / ...
0, module; 1, function_definition; 2, function_name:get_checkpoints_for_actor; 3, parameters; 4, block; 5, identifier:actor_id; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Get the available checkpoints for the given actor ID, return a ...
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; 8, 14; 9, 15; 10, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 18, 26; 18, 27; 21, 28; 23, 29; 23, 30; 25, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 29, 37; 29, 38; 30, 39; 30, 40; 32, 41; 32, 42; 33, 43; ...
def get_checkpoints_for_actor(actor_id): """Get the available checkpoints for the given actor ID, return a list sorted by checkpoint timestamp in descending order. """ checkpoint_info = ray.worker.global_state.actor_checkpoint_info(actor_id) if checkpoint_info is None: return [] checkpoi...
0, module; 1, function_definition; 2, function_name:_naturalize; 3, parameters; 4, block; 5, identifier:string; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""Provides a natural representation for string for nice sorting."""; 10, assignment; 11, list_comprehension; 12, identifier:s...
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; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 28, 33; 29, 34; 29, 35; 31, 36; 31, 37
def _naturalize(string): """Provides a natural representation for string for nice sorting.""" splits = re.split("([0-9]+)", string) return [int(text) if text.isdigit() else text.lower() for text in splits]
0, module; 1, function_definition; 2, function_name:mount; 3, parameters; 4, block; 5, identifier:self; 6, identifier:prefix; 7, identifier:adapter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:"""Registers a connection adapter to a prefix. Adapters...
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; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 17, 22; 18, 23; 18, 24; 21, 25; 21, 26; 21, 27; 22, 28; 23, 29; 23, 30; 26, 31; 26, 32; 27, 33; 28, 34; 28, 35; 32, 36; 32, 37; 33, 38; 33, 39; 34, 40; 34, 41; 35, 42; 35, 43...
def mount(self, prefix, adapter): """Registers a connection adapter to a prefix. Adapters are sorted in descending order by prefix length. """ self.adapters[prefix] = adapter keys_to_move = [k for k in self.adapters if len(k) < len(prefix)] for key in keys_to_move: ...
0, module; 1, function_definition; 2, function_name:sorted_outrows; 3, parameters; 4, comment:# type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow]; 5, block; 6, identifier:outrows; 7, expression_statement; 8, comment:# Normally, there should only be one row per path, in which case the; 9, comment:# second and t...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 5, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 7, 17; 16, 18; 18, 19; 18, 20; 20, 21; 20, 22; 22, 23; 22, 24; 24, 25; 24, 26; 25, 27; 26, 28; 26, 29; 29, 30; 29, 31; 30, 32; 30, 33; 31, 34; 31, 35; 33, 36
def sorted_outrows(outrows): # type: (Iterable[InstalledCSVRow]) -> List[InstalledCSVRow] """ Return the given rows of a RECORD file in sorted order. Each row is a 3-tuple (path, hash, size) and corresponds to a record of a RECORD file (see PEP 376 and PEP 427 for details). For the rows passed...
0, module; 1, function_definition; 2, function_name:traceParseAction; 3, parameters; 4, block; 5, identifier:f; 6, expression_statement; 7, expression_statement; 8, function_definition; 9, try_statement; 10, return_statement; 11, comment:"""Decorator for debugging parse actions. When the parse action is called, th...
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; 8, 14; 8, 15; 9, 16; 9, 17; 10, 18; 12, 19; 12, 20; 14, 21; 15, 22; 15, 23; 15, 24; 15, 25; 15, 26; 15, 27; 15, 28; 16, 29; 17, 30; 17, 31; 20, 32; 20, 33; 21, 34; 22, 35; 23, 36; 24, 37; 24, 38; 25, 39; 26, 40; 26, 41; 27, 42; 28, 43; 29...
def traceParseAction(f): """Decorator for debugging parse actions. When the parse action is called, this decorator will print ``">> entering method-name(line:<current_source_line>, <parse_location>, <matched_tokens>)"``. When the parse action completes, the decorator will print ``"<<"`` followed by...
0, module; 1, function_definition; 2, function_name:sorted_tree; 3, parameters; 4, block; 5, identifier:tree; 6, expression_statement; 7, return_statement; 8, comment:"""Sorts the dict representation of the tree The root packages as well as the intermediate packages are sorted in the alphabetical order of the ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 12, 13; 12, 14; 14, 15; 14, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 18, 24; 20, 25; 20, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 26, 34; 26, 35; 28, 36; 28, 37; 31, 38; 31, 39; 34, 40; 34, 41; 37, 42; 37, ...
def sorted_tree(tree): """Sorts the dict representation of the tree The root packages as well as the intermediate packages are sorted in the alphabetical order of the package names. :param dict tree: the pkg dependency tree obtained by calling `construct_tree` function :return...
0, module; 1, function_definition; 2, function_name:do_sort; 3, parameters; 4, block; 5, identifier:environment; 6, identifier:value; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:reverse; 14, False; 15, identif...
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; 12, 21; 20, 22; 20, 23; 21, 24; 21, 25; 23, 26; 23, 27; 25, 28; 25, 29; 25, 30; 27, 31; 27, 32; 27, 33; 29, 34; 29, 35; 30, 36; 30, 37; 33, 38; 33, 39; 39, 40; 39, 41; 39, 42; 41, 43
def do_sort( environment, value, reverse=False, case_sensitive=False, attribute=None ): """Sort an iterable. Per default it sorts ascending, if you pass it true as first argument it will reverse the sorting. If the iterable is made of strings the third parameter can be used to control the case sen...
0, module; 1, function_definition; 2, function_name:sorted; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, function_definition; 9, expression_statement; 10, comment:# make a copy!; 11, if_statement; 12, return_statement; 13, identifier:wantdirs; 14, False; 15, comment:"""...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 8, 16; 8, 17; 8, 18; 9, 19; 11, 20; 11, 21; 12, 22; 17, 23; 17, 24; 18, 25; 18, 26; 18, 27; 19, 28; 19, 29; 21, 30; 21, 31; 21, 32; 22, 33; 22, 34; 25, 35; 26, 36; 27, 37; 27, 38; 29, 39; 29, 40; 30, 41; 31, 42; 31, 43; 31, ...
def sorted(self, wantdirs=False): """ Return sorted files in directory order """ def add_dir(dirs, d): dirs.add(d) logger.debug('add_dir added %s', d) if d != self.base: parent, _ = os.path.split(d) assert parent not in...
0, module; 1, function_definition; 2, function_name:next_event_indexer; 3, parameters; 4, block; 5, identifier:all_dates; 6, identifier:data_query_cutoff; 7, identifier:all_sids; 8, identifier:event_dates; 9, identifier:event_timestamps; 10, identifier:event_sids; 11, expression_statement; 12, expression_statement; 13,...
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; 11, 26; 12, 27; 13, 28; 14, 29; 17, 30; 18, 31; 24, 32; 24, 33; 24, 34; 25, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31, 44; 31...
def next_event_indexer(all_dates, data_query_cutoff, all_sids, event_dates, event_timestamps, event_sids): """ Construct an index array that, when applied to an array of values, produces a 2D a...
0, module; 1, function_definition; 2, function_name:previous_event_indexer; 3, parameters; 4, block; 5, identifier:data_query_cutoff_times; 6, identifier:all_sids; 7, identifier:event_dates; 8, identifier:event_timestamps; 9, identifier:event_sids; 10, expression_statement; 11, expression_statement; 12, expression_stat...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 21, 30; 22, 31; 22, 32; 22, 33; 23, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 29, 44; ...
def previous_event_indexer(data_query_cutoff_times, all_sids, event_dates, event_timestamps, event_sids): """ Construct an index array that, when applied to an array of values, produces a 2D array con...
0, module; 1, function_definition; 2, function_name:last_in_date_group; 3, parameters; 4, block; 5, identifier:df; 6, identifier:data_query_cutoff_times; 7, identifier:assets; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, if_...
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; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 12, 31; 13, 32; 13, 33; 14, 34; 14, 35; 15, 36; 16, 37; 21, 38; 21, 39; 21, 40; 22, 41; 22, 42; 23, 43; 31, 44; 31, ...
def last_in_date_group(df, data_query_cutoff_times, assets, reindex=True, have_sids=True, extra_groupers=None): """ Determine the last piece of information known on each date in the date index...
0, module; 1, function_definition; 2, function_name:risk_metric_period; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:start_session; 7, identifier:end_session; 8, identifier:algorithm_returns; 9, identifier:benchmark_returns; 10, identifier:algorithm_leverages; 11, expression_statement; 12, expression_state...
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; 11, 32; 12, 33; 14, 34; 15, 35; 16, 36; 17, 37; 18, 38; 26, 39; 26, 40; 27, 41; 28, 42; 31, 43; 33, 44; 33, 45; ...
def risk_metric_period(cls, start_session, end_session, algorithm_returns, benchmark_returns, algorithm_leverages): """ Creates a dictionary representing the state of th...
0, module; 1, function_definition; 2, function_name:get_last_data_per_qtr; 3, parameters; 4, block; 5, identifier:self; 6, identifier:assets_with_data; 7, identifier:columns; 8, identifier:dates; 9, identifier:data_query_cutoff_times; 10, expression_statement; 11, comment:# Get a DataFrame indexed by date with a MultiI...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 10, 25; 14, 26; 15, 27; 17, 28; 19, 29; 21, 30; 22, 31; 23, 32; 24, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31, 44; 3...
def get_last_data_per_qtr(self, assets_with_data, columns, dates, data_query_cutoff_times): """ Determine the last piece of information we know for each column on each date in ...
0, module; 1, function_definition; 2, function_name:get_zeroth_quarter_idx; 3, parameters; 4, block; 5, identifier:self; 6, identifier:stacked_last_per_qtr; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:""" Filters for releases that are on or after each simulation date and ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 17, 19; 17, 20; 18, 21; 19, 22; 19, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 23, 29; 23, 30; 25, 31; 25, 32; 27, 33; 27, 34; 28, 35; 28, 36; 31, 37; 31, 38; 32, 39; 32, 40; 34, 41; 34, 42; 39, 4...
def get_zeroth_quarter_idx(self, stacked_last_per_qtr): """ Filters for releases that are on or after each simulation date and determines the previous quarter by picking out the most recent release relative to each date in the index. Parameters ---------- stacked...
0, module; 1, function_definition; 2, function_name:rank; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:method; 14, string; 15, identifier:ascending; 16...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 11, 23; 12, 24; 14, 25; 22, 26; 22, 27; 23, 28; 24, 29; 24, 30; 28, 31; 30, 32; 30, 33; 30, 34; 30, 35; 30, 36; 30, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43; 33, 4...
def rank(self, method='ordinal', ascending=True, mask=NotSpecified, groupby=NotSpecified): """ Construct a new Factor representing the sorted rank of each column within each row. Parameters ---------- method : str, {'or...
0, module; 1, function_definition; 2, function_name:find_in_sorted_index; 3, parameters; 4, block; 5, identifier:dts; 6, identifier:dt; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:""" Find the index of ``dt`` in ``dts``. This function should be used inst...
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; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 21, 28; 21, 29; 22, 30; 24, 31; 24, 32; 25, 33; 25, 34; 27, 35; 27, 36; 32, 37; 36, 38; 38, 39; 38, 40; 39, 41; 39, 42; 40, 43;...
def find_in_sorted_index(dts, dt): """ Find the index of ``dt`` in ``dts``. This function should be used instead of `dts.get_loc(dt)` if the index is large enough that we don't want to initialize a hash table in ``dts``. In particular, this should always be used on minutely trading calendars. ...
0, module; 1, function_definition; 2, function_name:nearest_unequal_elements; 3, parameters; 4, block; 5, identifier:dts; 6, identifier:dt; 7, expression_statement; 8, if_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, try_statement; 13, if_statement; 14, expression_statement; 15, expression...
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; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 12, 26; 13, 27; 13, 28; 13, 29; 13, 30; 14, 31; 15, 32; 16, 33; 18, 34; 19, 35; 20, 36; 21, 37; 22, 38; 23, 39; 24, 40; 24, 41; 25, 42; 26, 43; 26, 44...
def nearest_unequal_elements(dts, dt): """ Find values in ``dts`` closest but not equal to ``dt``. Returns a pair of (last_before, first_after). When ``dt`` is less than any element in ``dts``, ``last_before`` is None. When ``dt`` is greater any element in ``dts``, ``first_after`` is None. ``...
0, module; 1, function_definition; 2, function_name:date_sorted_sources; 3, parameters; 4, block; 5, list_splat_pattern; 6, expression_statement; 7, expression_statement; 8, comment:# Strip out key decoration; 9, for_statement; 10, identifier:sources; 11, comment:""" Takes an iterable of sources, generating namestr...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 6, 11; 7, 12; 9, 13; 9, 14; 9, 15; 12, 16; 12, 17; 13, 18; 13, 19; 15, 20; 17, 21; 17, 22; 20, 23; 21, 24; 21, 25; 22, 26; 23, 27; 26, 28; 28, 29; 28, 30; 29, 31; 29, 32; 30, 33; 30, 34; 32, 35
def date_sorted_sources(*sources): """ Takes an iterable of sources, generating namestrings and piping their output into date_sort. """ sorted_stream = heapq.merge(*(_decorate_source(s) for s in sources)) # Strip out key decoration for _, message in sorted_stream: yield message
0, module; 1, function_definition; 2, function_name:execution_order; 3, parameters; 4, block; 5, identifier:self; 6, identifier:refcounts; 7, expression_statement; 8, return_statement; 9, comment:""" Return a topologically-sorted iterator over the terms in ``self`` which need to be computed. """...
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; 14, 16; 14, 17; 15, 18; 18, 19; 18, 20; 19, 21; 19, 22; 20, 23; 21, 24; 21, 25; 23, 26; 23, 27; 23, 28; 27, 29; 27, 30; 28, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 31, 37; 34, 38; 34, 39
def execution_order(self, refcounts): """ Return a topologically-sorted iterator over the terms in ``self`` which need to be computed. """ return iter(nx.topological_sort( self.graph.subgraph( {term for term, refcount in refcounts.items() if refcount >...
0, module; 1, function_definition; 2, function_name:parse; 3, parameters; 4, type; 5, block; 6, identifier:cls; 7, typed_parameter; 8, string:"HTTPHeaders"; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:headers; 14, type; 15, comment:"""Returns a dictionary f...
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; 7, 14; 9, 15; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 14, 21; 16, 22; 16, 23; 18, 24; 18, 25; 19, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 26, 32; 26, 33; 33, 34; 34, 35; 35, 36; 35, 37; 36, 38; 36, 39; 37, 40
def parse(cls, headers: str) -> "HTTPHeaders": """Returns a dictionary from HTTP header text. >>> h = HTTPHeaders.parse("Content-Type: text/html\\r\\nContent-Length: 42\\r\\n") >>> sorted(h.items()) [('Content-Length', '42'), ('Content-Type', 'text/html')] .. versionchanged:: 5...
0, module; 1, function_definition; 2, function_name:lovasz_grad; 3, parameters; 4, block; 5, identifier:gt_sorted; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_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; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 12, 21; 12, 22; 13, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 20, 35; 22, 36; 25, 37; 25, 38; 27, 39; 27, 40; 29, 41; 29, 42; 31, 43; 31...
def lovasz_grad(gt_sorted): """ Computes gradient of the Lovasz extension w.r.t sorted errors See Alg. 1 in paper """ p = len(gt_sorted) gts = gt_sorted.sum() intersection = gts - gt_sorted.float().cumsum(0) union = gts + (1 - gt_sorted).float().cumsum(0) jaccard = 1. - intersection ...
0, module; 1, function_definition; 2, function_name:merge; 3, parameters; 4, block; 5, identifier:left; 6, identifier:right; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_pa...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 4, 18; 4, 19; 4, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 9, 26; 10, 27; 10, 28; 11, 29; 11, 30; 12, 31; 12, 32; 13, 33; 13, 34; 14, 35; 14, 36; 15, 37; 15, 38; 16, 39; 16, 40; 17, 41; 17, 42; 18, 43; 19, 44; 19,...
def merge( left, right, how="inner", on=None, left_on=None, right_on=None, left_index=False, right_index=False, sort=False, suffixes=("_x", "_y"), copy=True, indicator=False, validate=None, ): """Database style join, where common columns in "on" are merged. A...
0, module; 1, function_definition; 2, function_name:copartition; 3, parameters; 4, block; 5, identifier:self; 6, identifier:axis; 7, identifier:other; 8, identifier:how_to_join; 9, identifier:sort; 10, default_parameter; 11, expression_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; 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; 10, 25; 10, 26; 11, 27; 12, 28; 12, 29; 13, 30; 14, 31; 17, 32; 18, 33; 20, 34; 21, 35; 22, 36; 22, 37; 22, 38; 23, 39; 23, 40; 23, 41; 23, 42; 23, 43; 24, 44; 2...
def copartition(self, axis, other, how_to_join, sort, force_repartition=False): """Copartition two QueryCompiler objects. Args: axis: The axis to copartition along. other: The other Query Compiler(s) to copartition against. how_to_join: How to manage joining the inde...
0, module; 1, function_definition; 2, function_name:sort_index; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# sort_index can have ascending be None and behaves as if it is False.; 11, comment:# sort_valu...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 6, 21; 7, 22; 8, 23; 9, 24; 13, 25; 14, 26; 14, 27; 15, 28; 16, 29; 16, 30; 16, 31; 17, 32; 18, 33; 19, 34; 19, 35; 19, 36; 20, 37; 23, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, 44; 2...
def sort_index(self, **kwargs): """Sorts the data with respect to either the columns or the indices. Returns: DataManager containing the data sorted by columns or indices. """ axis = kwargs.pop("axis", 0) index = self.columns if axis else self.index # sort_i...
0, module; 1, function_definition; 2, function_name:sample_row_keys; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Read a sample of row keys in the table. For example: .. literalinclude:: snip...
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; 15, 18; 15, 19; 17, 20; 17, 21; 18, 22; 18, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 26, 30; 26, 31; 27, 32; 27, 33; 33, 34; 33, 35
def sample_row_keys(self): """Read a sample of row keys in the table. For example: .. literalinclude:: snippets_table.py :start-after: [START bigtable_sample_row_keys] :end-before: [END bigtable_sample_row_keys] The returned row keys will delimit contiguous sec...
0, module; 1, function_definition; 2, function_name:search_profiles; 3, parameters; 4, block; 5, identifier:self; 6, identifier:parent; 7, identifier:request_metadata; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_para...
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; 4, 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; 14, 37; 15, 38; 15, 39; 16, 40; 16, 41; 17, 42; 17, 43; 18, 44; 20, ...
def search_profiles( self, parent, request_metadata, profile_query=None, page_size=None, offset=None, disable_spell_check=None, order_by=None, case_sensitive_sort=None, histogram_queries=None, retry=google.api_core.gapic_v1.method.D...
0, module; 1, function_definition; 2, function_name:search_jobs; 3, parameters; 4, block; 5, identifier:self; 6, identifier:parent; 7, identifier:request_metadata; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_paramete...
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; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 10, 34; 11, 35; 11, 36; 12, 37; 12, 38; 13, 39; 13, 40; 14, 41; 14, 42; 15, 43; 15, 44; 16, 45; 1...
def search_jobs( self, parent, request_metadata, search_mode=None, job_query=None, enable_broadening=None, require_precise_result_size=None, histogram_queries=None, job_view=None, offset=None, page_size=None, order_by=None, ...
0, module; 1, function_definition; 2, function_name:list_findings; 3, parameters; 4, block; 5, identifier:self; 6, identifier:parent; 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, e...
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; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 12, 35; 13, 36; 13, 37; 14, 38; 14, 39; 15, 40; 17, 41; 17, 42; 18, 43; 19, 44; 19, 45...
def list_findings( self, parent, filter_=None, order_by=None, read_time=None, field_mask=None, page_size=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ): """...
0, module; 1, function_definition; 2, function_name:list_traces; 3, parameters; 4, block; 5, identifier:self; 6, identifier:project_id; 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,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 7, 25; 7, 26; 8, 27; 8, 28; 9, 29; 9, 30; 10, 31; 10, 32; 11, 33; 11, 34; 12, 35; 12, 36; 13, 37; 13, 38; 14, 39; 14, 40; 15, 41; 15, 42; 16, 43; 18, 44; 18, 45;...
def list_traces( self, project_id, view=None, page_size=None, start_time=None, end_time=None, filter_=None, order_by=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None...
0, module; 1, function_definition; 2, function_name:order; 3, parameters; 4, block; 5, identifier:self; 6, identifier:value; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, comment:"""Set the fields used to sort query results. Sort fields will be applied in the order specified. ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 13, 17; 13, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 21, 24; 21, 25; 22, 26; 22, 27; 25, 28
def order(self, value): """Set the fields used to sort query results. Sort fields will be applied in the order specified. :type value: str or sequence of strings :param value: Each value is a string giving the name of the property on which to sort, optionally prec...
0, module; 1, function_definition; 2, function_name:get_canonical_headers; 3, parameters; 4, block; 5, identifier:headers; 6, expression_statement; 7, if_statement; 8, if_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, comment:"""Canon...
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; 7, 17; 8, 18; 8, 19; 9, 20; 10, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 15, 27; 15, 28; 16, 29; 17, 30; 17, 31; 18, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 23, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, 4...
def get_canonical_headers(headers): """Canonicalize headers for signing. See: https://cloud.google.com/storage/docs/access-control/signed-urls#about-canonical-extension-headers :type headers: Union[dict|List(Tuple(str,str))] :param headers: (Optional) Additional HTTP headers to be included...
0, module; 1, function_definition; 2, function_name:_sorted_resource_labels; 3, parameters; 4, block; 5, identifier:labels; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Sort label names, putting well-known resource labels first."""; 11, assignment; 12, a...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 15, 20; 15, 21; 15, 22; 17, 23; 17, 24; 21, 25; 21, 26; 22, 27; 24, 28; 24, 29; 24, 30; 27, 31; 27, 32; 29, 33; 29, 34; 30, 35; 35, 36; 35, 37
def _sorted_resource_labels(labels): """Sort label names, putting well-known resource labels first.""" head = [label for label in TOP_RESOURCE_LABELS if label in labels] tail = sorted(label for label in labels if label not in TOP_RESOURCE_LABELS) return head + tail
0, module; 1, function_definition; 2, function_name:partition_read; 3, parameters; 4, block; 5, identifier:self; 6, identifier:session; 7, identifier:table; 8, identifier:key_set; 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; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 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; 15, 37; 16, 38; 18, 39; 18, 40; 19, 41; 20, 42; 20, 43; 21, 44; 22...
def partition_read( self, session, table, key_set, transaction=None, index=None, columns=None, partition_options=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.DEFAULT, metadata=None, ...
0, module; 1, function_definition; 2, function_name:list_documents; 3, parameters; 4, block; 5, identifier:self; 6, identifier:parent; 7, identifier:collection_id; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_paramete...
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; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 12, 35; 13, 36; 13, 37; 14, 38; 14, 39; 15, 40; 15, 41; 16, 42; 16, 43; 17, 44; 19, 45...
def list_documents( self, parent, collection_id, page_size=None, order_by=None, mask=None, transaction=None, read_time=None, show_missing=None, retry=google.api_core.gapic_v1.method.DEFAULT, timeout=google.api_core.gapic_v1.method.D...
0, module; 1, function_definition; 2, function_name:predict; 3, parameters; 4, block; 5, identifier:self; 6, identifier:dataset; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:output_type; 13, string; 14, identifier:missing_value_actio...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 8, 15; 9, 16; 10, 17; 11, 18; 13, 19; 15, 20; 17, 21; 17, 22; 18, 23; 18, 24; 22, 25; 22, 26; 22, 27; 23, 28; 23, 29; 24, 30; 24, 31; 24, 32; 25, 33; 27, 34; 27, 35; 27, 36; 27, 37; 28, 38; 28, 39; 31, 40; 31, 41; 32, 42; 32, 43; 3...
def predict(self, dataset, output_type='class', missing_value_action='auto'): """ A flexible and advanced prediction API. The target column is provided during :func:`~turicreate.decision_tree.create`. If the target column is in the `dataset` it will be ignored. Paramete...
0, module; 1, function_definition; 2, function_name:_sort_topk_votes; 3, parameters; 4, block; 5, identifier:x; 6, identifier:k; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:""" Sort a dictionary of classes and corresponding vote totals according to the votes, then truncate...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 24, 30; 24, 31; 24, 32; 26, 33; 27, 34; 27, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 32, 4...
def _sort_topk_votes(x, k): """ Sort a dictionary of classes and corresponding vote totals according to the votes, then truncate to the highest 'k' classes. """ y = sorted(x.items(), key=lambda x: x[1], reverse=True)[:k] return [{'class': i[0], 'votes': i[1]} for i in y]
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key_column_names; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# validate key_column_names; 12, if_statement; 13, comment:# use the second...
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; 7, 19; 7, 20; 8, 21; 9, 22; 10, 23; 12, 24; 12, 25; 12, 26; 12, 27; 14, 28; 14, 29; 16, 30; 17, 31; 17, 32; 17, 33; 18, 34; 18, 35; 22, 36; 22, 37; 23, 38; 23, 39; 24, 40; 25, 41; 26, 42; 26, 43; 27, 44;...
def sort(self, key_column_names, ascending=True): """ Sort current SFrame by the given columns, using the given sort order. Only columns that are type of str, int and float can be sorted. Parameters ---------- key_column_names : str | list of str | list of (str, bool) pa...
0, module; 1, function_definition; 2, function_name:MakeSimpleProtoClass; 3, parameters; 4, block; 5, identifier:fields; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, comment:# Get a list of (name, field_type) tuples from the fields dict. If fields w...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 6, 26; 6, 27; 7, 28; 7, 29; 8, 30; 9, 31; 10, 32; 10, 33; 14, 34; 15, 35; 15, 36; 18, 37; 19, 38; 19, 39; 19, 40; 20, 41; 22, 42; 22, 43; 24, 44; 25, 45; ...
def MakeSimpleProtoClass(fields, full_name=None, pool=None): """Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherw...
0, module; 1, function_definition; 2, function_name:value_counts; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, import_from_statement; 8, return_statement; 9, comment:""" Return an SFrame containing counts of unique values. The resulting SFrame will be sorted in descending fre...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 8, 12; 10, 13; 10, 14; 11, 15; 11, 16; 12, 17; 12, 18; 14, 19; 15, 20; 17, 21; 17, 22; 18, 23; 18, 24; 21, 25; 21, 26; 23, 27; 24, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 30, 34; 30, 35; 32, 36; 33, 37; 35, 38; 37, 39; 37, 40; 38, 41; 39, 42; 40, 4...
def value_counts(self): """ Return an SFrame containing counts of unique values. The resulting SFrame will be sorted in descending frequency. Returns ------- out : SFrame An SFrame containing 2 columns : 'value', and 'count'. The SFrame will be so...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, import_from_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:ascending; 14, True; 15, comment:""" ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 12, 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; 25, 37; 27, 38; 27, 39; 28, 40; 28, 41; 28, 42; 28, 43; 29, ...
def sort(self, ascending=True): """ Sort all values in this SArray. Sort only works for sarray of type str, int and float, otherwise TypeError will be raised. Creates a new, sorted SArray. Parameters ---------- ascending: boolean, optional If true, th...
0, module; 1, function_definition; 2, function_name:predict; 3, parameters; 4, block; 5, identifier:self; 6, identifier:dataset; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:output_type; 14, string; 15, c...
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; 14, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 22, 29; 22, 30; 24, 31; 24, 32; 27, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 31, 40; 31, 41; 32, 42; 35, 43; 3...
def predict(self, dataset, output_type='class'): """ Return predictions for ``dataset``, using the trained model. Parameters ---------- dataset : SFrame dataset of new observations. Must include columns with the same names as the features used for model t...
0, module; 1, function_definition; 2, function_name:format_json; 3, parameters; 4, block; 5, identifier:event; 6, identifier:colored; 7, expression_statement; 8, try_statement; 9, return_statement; 10, comment:""" If the event message is a JSON string, then pretty print the JSON with 2 indents and sort the keys...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 11, 14; 12, 15; 12, 16; 12, 17; 14, 18; 14, 19; 17, 20; 18, 21; 18, 22; 19, 23; 19, 24; 21, 25; 21, 26; 22, 27; 23, 28; 24, 29; 25, 30; 25, 31; 28, 32; 28, 33; 29, 34; 29, 35; 33, 36; 33, 37; 34, 38; 34, 39; 35, 40; 35, 41; 36, 42; 36, 43...
def format_json(event, colored): """ If the event message is a JSON string, then pretty print the JSON with 2 indents and sort the keys. This makes it very easy to visually parse and search JSON data """ try: if event.message.startswith("{"): msg_dict...
0, module; 1, function_definition; 2, function_name:explain_instance_with_data; 3, parameters; 4, block; 5, identifier:self; 6, identifier:neighborhood_data; 7, identifier:neighborhood_labels; 8, identifier:distances; 9, identifier:label; 10, identifier:num_features; 11, default_parameter; 12, default_parameter; 13, 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; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 11, 24; 11, 25; 12, 26; 12, 27; 13, 28; 14, 29; 15, 30; 16, 31; 17, 32; 17, 33; 18, 34; 19, 35; 20, 36; 21, 37; 22, 38; 22, 39; 23, 40; 25, 41; 29, 42; 29, 43; 30, 44; ...
def explain_instance_with_data(self, neighborhood_data, neighborhood_labels, distances, label, num_features, f...
0, module; 1, function_definition; 2, function_name:serialize_json; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, comment:# these args to json.dumps are computed internally and should not be passed along; 11, for_stateme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 9, 21; 11, 22; 11, 23; 11, 24; 12, 25; 12, 26; 13, 27; 13, 28; 13, 29; 14, 30; 14, 31; 15, 32; 23, 33; 23, 34; 23, 35; 24, 36; 25, 37; 25, 38; 26, 39; 28, 40; 29, 41; 30, 42; 30, 43; 31, 44...
def serialize_json(obj, pretty=None, indent=None, **kwargs): ''' Return a serialized JSON representation of objects, suitable to send to BokehJS. This function is typically used to serialize single python objects in the manner expected by BokehJS. In particular, many datetime values are automatical...
0, module; 1, function_definition; 2, function_name:get_item_children; 3, parameters; 4, block; 5, identifier:item; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""Return a sorted list of all the children items of 'item'."""; 11, assignment; 12, identifier:child; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 17, 25; 20, 26; 21, 27; 21, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 30, 40; 30, 41; 31, 42; 31, 43; ...
def get_item_children(item): """Return a sorted list of all the children items of 'item'.""" children = [item.child(index) for index in range(item.childCount())] for child in children[:]: others = get_item_children(child) if others is not None: children += others retur...
0, module; 1, function_definition; 2, function_name:__sort_toplevel_items; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, comment:""" Sort the root file items in alphabetical order if 'sort_files_al...
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; 9, 17; 10, 18; 10, 19; 12, 20; 12, 21; 13, 22; 14, 23; 14, 24; 15, 25; 15, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 19, 33; 19, 34; 19, 35; 19, 36; 19, 37; 20, 38; 20, 39; 24, 40; 24, 41; 27, 42; 28, 43; 31...
def __sort_toplevel_items(self): """ Sort the root file items in alphabetical order if 'sort_files_alphabetically' is True, else order the items as specified in the 'self.ordered_editor_ids' list. """ if self.show_all_files is False: return c...
0, module; 1, function_definition; 2, function_name:sortByColumn; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, comment:"""Implement a column sort."""; 14, com...
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; 10, 17; 11, 18; 11, 19; 12, 20; 14, 21; 14, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 23, 36; 25, 37; 25, 38; 26, 39; 26, 40; 28, 41; 28, 42; 29, 43; 2...
def sortByColumn(self, index): """Implement a column sort.""" if self.sort_old == [None]: self.header_class.setSortIndicatorShown(True) sort_order = self.header_class.sortIndicatorOrder() self.sig_sort_by_column.emit() if not self.model().sort(index, sort_order)...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:column; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:order; 13, attribute; 14, comment:"""Overriding sort method....
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; 13, 18; 13, 19; 15, 20; 15, 21; 16, 22; 16, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29; 25, 30; 25, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 29, 37
def sort(self, column, order=Qt.AscendingOrder): """Overriding sort method.""" ascending = order == Qt.AscendingOrder self.model.sort(self.COLUMN_INDEX, order=ascending) return True
0, module; 1, function_definition; 2, function_name:sortByIndex; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""Implement a Index sort."""; 13, call; 14, assig...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 25, 36; 25, 37; 28, 38; 28, 39; 30, 40; 30, 41; 36, 42; 36, 43;...
def sortByIndex(self, index): """Implement a Index sort.""" self.table_level.horizontalHeader().setSortIndicatorShown(True) sort_order = self.table_level.horizontalHeader().sortIndicatorOrder() self.table_index.model().sort(index, sort_order) self._sort_update()
0, module; 1, function_definition; 2, function_name:sort_file_tabs_alphabetically; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, while_statement; 8, comment:"""Sort open tabs alphabetically."""; 9, comparison_operator:self.sorted() is False; 10, block; 11, call; 12, False; 13, for_statement; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 9, 11; 9, 12; 10, 13; 11, 14; 11, 15; 13, 16; 13, 17; 13, 18; 14, 19; 14, 20; 17, 21; 17, 22; 18, 23; 22, 24; 22, 25; 23, 26; 23, 27; 25, 28; 25, 29; 26, 30; 27, 31; 28, 32; 28, 33; 30, 34; 30, 35; 31, 36; 32, 37; 32, 38; 34, 39; 34, 40; 35, 41; 35, 42; 36, 4...
def sort_file_tabs_alphabetically(self): """Sort open tabs alphabetically.""" while self.sorted() is False: for i in range(0, self.tabs.tabBar().count()): if(self.tabs.tabBar().tabText(i) > self.tabs.tabBar().tabText(i + 1)): ...
0, module; 1, function_definition; 2, function_name:sort_top_level_items; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, comment:"""Sorting tree wrt top level items"""; 13, call; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 11, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 22, 32; 22, 33; 26, 34; 27, 35; 28, 36; 28, 37; 33, 38; 33, 39; 35, 40; 35, 41; 38, 42; 38, 43;...
def sort_top_level_items(self, key): """Sorting tree wrt top level items""" self.save_expanded_state() items = sorted([self.takeTopLevelItem(0) for index in range(self.topLevelItemCount())], key=key) for index, item in enumerate(items): self.inse...
0, module; 1, function_definition; 2, function_name:set_sorting; 3, parameters; 4, block; 5, identifier:self; 6, identifier:flag; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:"""Enable result sorting after search is complete."""; 11, assignment; 12, call; 13, subscript; 14, ide...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 13, 17; 13, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 19, 25; 19, 26; 21, 27; 21, 28; 25, 29; 25, 30
def set_sorting(self, flag): """Enable result sorting after search is complete.""" self.sorting['status'] = flag self.header().setSectionsClickable(flag == ON)
0, module; 1, function_definition; 2, function_name:set_filter; 3, parameters; 4, block; 5, identifier:self; 6, identifier:text; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, comment:"""Set regular expression for filter."""; 12, assignment; 13, attribute; 14, block; 15...
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; 17, 25; 17, 26; 18, 27; 18, 28; 21, 29; 22, 30; 23, 31; 23, 32; 28, 33; 29, 34; 29, 35; 30, 36; 34, 37; 34, 38; 35, 39; 36, 40; 36, 41; 37, 42; 37, 43; ...
def set_filter(self, text): """Set regular expression for filter.""" self.pattern = get_search_regex(text) if self.pattern: self._parent.setSortingEnabled(False) else: self._parent.setSortingEnabled(True) self.invalidateFilter()
0, module; 1, function_definition; 2, function_name:_get_content_hash; 3, parameters; 4, comment:# type: () -> str; 5, block; 6, identifier:self; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, return_statement; 13, comment:""" Returns ...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 5, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 12, 20; 14, 21; 14, 22; 15, 23; 15, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 22, 30; 22, 31; 27, 32; 29, 33; 29, 34; 32, 35; 32, 36; 33, 37; 33, 38; 35, 39; 35, 40; 36, 41; 36, 42; 37, 43; ...
def _get_content_hash(self): # type: () -> str """ Returns the sha256 hash of the sorted content of the pyproject file. """ content = self._local_config relevant_content = {} for key in self._relevant_keys: relevant_content[key] = content.get(key) c...
0, module; 1, function_definition; 2, function_name:missing_datetimes; 3, parameters; 4, block; 5, identifier:self; 6, identifier:finite_datetimes; 7, expression_statement; 8, return_statement; 9, comment:""" Override in subclasses to do bulk checks. Returns a sorted list. This is a conservati...
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; 16, 17; 17, 18; 17, 19; 18, 20; 18, 21; 20, 22; 20, 23; 22, 24; 22, 25; 23, 26; 26, 27; 26, 28; 27, 29; 27, 30; 28, 31
def missing_datetimes(self, finite_datetimes): """ Override in subclasses to do bulk checks. Returns a sorted list. This is a conservative base implementation that brutally checks completeness, instance by instance. Inadvisable as it may be slow. """ return [d ...
0, module; 1, function_definition; 2, function_name:_partition_tasks; 3, parameters; 4, block; 5, identifier:worker; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, 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; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 6, 24; 7, 25; 8, 26; 9, 27; 10, 28; 11, 29; 12, 30; 13, 31; 14, 32; 15, 33; 16, 34; 17, 35; 18, 36; 19, 37; 20, 38; 21, 39; 22, 40; 23, 41; 25, 42; 25, 43; 26, 44; 26, ...
def _partition_tasks(worker): """ Takes a worker and sorts out tasks based on their status. Still_pending_not_ext is only used to get upstream_failure, upstream_missing_dependency and run_by_other_worker """ task_history = worker._add_task_history pending_tasks = {task for(task, status, ext) in ...