nodes
stringlengths
501
22.4k
edges
stringlengths
138
5.07k
code
stringlengths
108
19.3k
0, module; 1, function_definition; 2, function_name:select_segment; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, identifier:segs; 8, identifier:segs_tips; 9, identifier:segs_undecided; 10, generic_type; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, for_statement; 15, expr...
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; 10, 19; 10, 20; 11, 21; 12, 22; 13, 23; 14, 24; 14, 25; 14, 26; 14, 27; 15, 28; 16, 29; 16, 30; 17, 31; 18, 32; 20, 33; 20, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 27, 43; 27,...
def select_segment(self, segs, segs_tips, segs_undecided) -> Tuple[int, int]: """Out of a list of line segments, choose segment that has the most distant second data point. Assume the distance matrix Ddiff is sorted according to seg_idcs. Compute all the distances. Returns ...
0, module; 1, function_definition; 2, function_name:unique_categories; 3, parameters; 4, block; 5, identifier:categories; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Pass array-like categories, return sorted cleaned unique cate...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 17, 22; 17, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 24, 31; 24, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 34, 38; 34, 39; 37, 40; 37, 41; 38, 42; 38, 43;...
def unique_categories(categories): """Pass array-like categories, return sorted cleaned unique categories.""" categories = np.unique(categories) categories = np.setdiff1d(categories, np.array(settings.categories_to_ignore)) categories = np.array(natsorted(categories, key=lambda v: v.upper())) return...
0, module; 1, function_definition; 2, function_name:find_one_and_delete; 3, parameters; 4, block; 5, identifier:self; 6, identifier:filter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identi...
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; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 22, 24; 22, 25; 23, 26; 23, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 27, 33; 27, 34; 27, 35; 27, 36; 29, 37; 35, 38; 35, 39; 36, 40
def find_one_and_delete(self, filter, projection=None, sort=None, session=None, **kwargs): """Finds a single document and deletes it, returning the document. >>> db.test.count_documents({'x': 1}) 2 >>> db.test.find_one_and_delete({'x': 1}) {u'...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, comment:# type: (List[str]) -> List[str]; 5, block; 6, identifier:lines; 7, expression_statement; 8, comment:# make a copy of lines since we will clobber it; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_state...
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; 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; 21, 28; 21, 29; 23, 30; 23, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 29, 37; 31, 38; 31, 39; 32, 40; 32, 41; 33, 42; 33, 43;...
def sort(lines): # type: (List[str]) -> List[str] """Sort a YAML file in alphabetical order, keeping blocks together. :param lines: array of strings (without newlines) :return: sorted array of strings """ # make a copy of lines since we will clobber it lines = list(lines) new_lines = parse...
0, module; 1, function_definition; 2, function_name:first_key; 3, parameters; 4, comment:# type: (List[str]) -> str; 5, block; 6, identifier:lines; 7, expression_statement; 8, for_statement; 9, comment:"""Returns a string representing the sort key of a block. The sort key is the first YAML key we encounter, ignori...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 5, 7; 5, 8; 7, 9; 8, 10; 8, 11; 8, 12; 8, 13; 12, 14; 12, 15; 12, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 17, 23; 18, 24; 18, 25; 19, 26; 20, 27; 20, 28; 21, 29; 23, 30; 24, 31; 24, 32; 25, 33; 28, 34; 28, 35; 29, 36; 33, 37; 34, 38; 34, 39; 35, 40; 35, 41; 36, 42; 36, 43...
def first_key(lines): # type: (List[str]) -> str """Returns a string representing the sort key of a block. The sort key is the first YAML key we encounter, ignoring comments, and stripping leading quotes. >>> print(test) # some comment 'foo': true >>> first_key(test) 'foo' """ ...
0, module; 1, function_definition; 2, function_name:geoadd; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:longitude; 8, identifier:latitude; 9, identifier:member; 10, list_splat_pattern; 11, dictionary_splat_pattern; 12, expression_statement; 13, return_statement; 14, identifier:args; 15...
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; 10, 14; 11, 15; 12, 16; 13, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 19, 24; 19, 25; 19, 26; 19, 27; 19, 28; 22, 29; 27, 30; 28, 31
def geoadd(self, key, longitude, latitude, member, *args, **kwargs): """Add one or more geospatial items in the geospatial index represented using a sorted set. :rtype: int """ return self.execute( b'GEOADD', key, longitude, latitude, member, *args, **kwargs ...
0, module; 1, function_definition; 2, function_name:georadius; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:longitude; 8, identifier:latitude; 9, identifier:radius; 10, default_parameter; 11, keyword_separator; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, def...
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; 10, 23; 10, 24; 12, 25; 12, 26; 13, 27; 13, 28; 14, 29; 14, 30; 15, 31; 15, 32; 16, 33; 16, 34; 17, 35; 17, 36; 18, 37; 19, 38; 20, 39; 21, 40; 21, 41; 22, 42; 24, 43; 38, 44;...
def georadius(self, key, longitude, latitude, radius, unit='m', *, with_dist=False, with_hash=False, with_coord=False, count=None, sort=None, encoding=_NOTSET): """Query a sorted set representing a geospatial index to fetch members matching a given maximum distance fr...
0, module; 1, function_definition; 2, function_name:georadiusbymember; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:member; 8, identifier:radius; 9, default_parameter; 10, keyword_separator; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 9, 22; 9, 23; 11, 24; 11, 25; 12, 26; 12, 27; 13, 28; 13, 29; 14, 30; 14, 31; 15, 32; 15, 33; 16, 34; 16, 35; 17, 36; 18, 37; 19, 38; 20, 39; 20, 40; 21, 41; 23, 42; 37, 43; 37, 44; ...
def georadiusbymember(self, key, member, radius, unit='m', *, with_dist=False, with_hash=False, with_coord=False, count=None, sort=None, encoding=_NOTSET): """Query a sorted set representing a geospatial index to fetch members matching a given maximum ...
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, list_splat_pattern; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15, expressio...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 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; 16, 38; 16, 39; 17, 40; 17, 41; 18, 42; 18, 43; 19, 44; 19, ...
def sort(self, key, *get_patterns, by=None, offset=None, count=None, asc=None, alpha=False, store=None): """Sort the elements in a list, set or sorted set.""" args = [] if by is not None: args += [b'BY', by] if offset is not None and count is not Non...
0, module; 1, function_definition; 2, function_name:zadd; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:score; 8, identifier:member; 9, list_splat_pattern; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, if_statement; 14, expression_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; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 12, 26; 13, 27; 13, 28; 14, 29; 15, 30; 15, 31; 16, 32; 17, 33; 17, 34; 17, 35; 18, 36; 19, 37; 19, 38; 20, 39; 25, 40; 26, 41; 27, 42; 27, 43; 28, 44...
def zadd(self, key, score, member, *pairs, exist=None): """Add one or more members to a sorted set or update its score. :raises TypeError: score not int or float :raises TypeError: length of pairs is not even number """ if not isinstance(score, (int, float)): raise T...
0, module; 1, function_definition; 2, function_name:zcount; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, keyword_separator; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, return_statement; 16, 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; 4, 15; 7, 16; 7, 17; 8, 18; 8, 19; 10, 20; 10, 21; 11, 22; 12, 23; 12, 24; 13, 25; 13, 26; 14, 27; 14, 28; 15, 29; 17, 30; 17, 31; 19, 32; 19, 33; 23, 34; 24, 35; 25, 36; 26, 37; 27, 38; 27, 39; 28, 40; 29, 41; 29, 42; 31, 43; 33, ...
def zcount(self, key, min=float('-inf'), max=float('inf'), *, exclude=None): """Count the members in a sorted set with scores within the given values. :raises TypeError: min or max is not float or int :raises ValueError: if min greater than max """ if not ...
0, module; 1, function_definition; 2, function_name:zincrby; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:increment; 8, identifier:member; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, return_statement; 13, comment:"""Increment the score of a member in a sorte...
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; 11, 16; 12, 17; 14, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 21, 27; 21, 28; 23, 29; 23, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 28, 39; 28, 40; 32, 41; 32, 42; 34, 43...
def zincrby(self, key, increment, member): """Increment the score of a member in a sorted set. :raises TypeError: increment is not float or int """ if not isinstance(increment, (int, float)): raise TypeError("increment argument must be int or float") fut = self.execu...
0, module; 1, function_definition; 2, function_name:zrem; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:member; 8, list_splat_pattern; 9, expression_statement; 10, return_statement; 11, identifier:members; 12, comment:"""Remove one or more members from a sorted set."""; 13, call; 14, att...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 8, 11; 9, 12; 10, 13; 13, 14; 13, 15; 14, 16; 14, 17; 15, 18; 15, 19; 15, 20; 15, 21; 18, 22; 21, 23
def zrem(self, key, member, *members): """Remove one or more members from a sorted set.""" return self.execute(b'ZREM', key, member, *members)
0, module; 1, function_definition; 2, function_name:zremrangebylex; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, if_statement; 1...
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; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 12, 27; 12, 28; 13, 29; 13, 30; 13, 31; 14, 32; 14, 33; 15, 34; 15, 35; 16, 36; 18, 37; 20, 38; 26, 39; 28, 40; 29, 41; 31, 42; 32, 43; 33, 44;...
def zremrangebylex(self, key, min=b'-', max=b'+', include_min=True, include_max=True): """Remove all members in a sorted set between the given lexicographical range. :raises TypeError: if min is not bytes :raises TypeError: if max is not bytes """ ...
0, module; 1, function_definition; 2, function_name:zremrangebyrank; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:start; 8, identifier:stop; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, comment:"""Remove all members in a sorted set within the gi...
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; 11, 16; 11, 17; 12, 18; 14, 19; 15, 20; 16, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 24, 35; 24, 36; 26, 37; 26, 38; 27, 39; 27, 40; 29, 41; 29, 42; 30, 43...
def zremrangebyrank(self, key, start, stop): """Remove all members in a sorted set within the given indexes. :raises TypeError: if start is not int :raises TypeError: if stop is not int """ if not isinstance(start, int): raise TypeError("start argument must be int") ...
0, module; 1, function_definition; 2, function_name:zremrangebyscore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, keyword_separator; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, if_statement; 14, expression_statement; 15, retur...
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; 7, 16; 7, 17; 8, 18; 8, 19; 10, 20; 10, 21; 11, 22; 12, 23; 12, 24; 13, 25; 13, 26; 14, 27; 15, 28; 17, 29; 17, 30; 19, 31; 19, 32; 23, 33; 24, 34; 25, 35; 26, 36; 27, 37; 27, 38; 28, 39; 28, 40; 30, 41; 32, 42; 33, 43; 33, ...
def zremrangebyscore(self, key, min=float('-inf'), max=float('inf'), *, exclude=None): """Remove all members in a sorted set within the given scores. :raises TypeError: if min or max is not int or float """ if not isinstance(min, (int, float)): raise...
0, module; 1, function_definition; 2, function_name:zrevrange; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:start; 8, identifier:stop; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, expression_statement; 1...
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; 9, 18; 9, 19; 10, 20; 10, 21; 11, 22; 12, 23; 12, 24; 13, 25; 13, 26; 14, 27; 14, 28; 14, 29; 15, 30; 16, 31; 16, 32; 17, 33; 23, 34; 24, 35; 25, 36; 26, 37; 28, 38; 29, 39; 30, 40; 30, 41; 32, 42; 34, 43; 34, ...
def zrevrange(self, key, start, stop, withscores=False, encoding=_NOTSET): """Return a range of members in a sorted set, by index, with scores ordered from high to low. :raises TypeError: if start or stop is not int """ if not isinstance(start, int): raise TypeError(...
0, module; 1, function_definition; 2, function_name:zrevrangebyscore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, keyword_separator; 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; 4, 24; 4, 25; 4, 26; 4, 27; 7, 28; 7, 29; 8, 30; 8, 31; 10, 32; 10, 33; 11, 34; 11, 35; 12, 36; 12, 37; 13, 38; 13, 39; 14, 40; 14, 41; 15, 42; 16, 43; 16, 44; 17, 45; ...
def zrevrangebyscore(self, key, max=float('inf'), min=float('-inf'), *, exclude=None, withscores=False, offset=None, count=None, encoding=_NOTSET): """Return a range of members in a sorted set, by score, with scores ordered from high to low. :ra...
0, module; 1, function_definition; 2, function_name:zscore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:member; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Get the score associated with the given member in a sorted set."""; 12, assignment; 13,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 10, 13; 12, 14; 12, 15; 13, 16; 13, 17; 15, 18; 15, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 19, 26; 24, 27
def zscore(self, key, member): """Get the score associated with the given member in a sorted set.""" fut = self.execute(b'ZSCORE', key, member) return wait_convert(fut, optional_int_or_float)
0, module; 1, function_definition; 2, function_name:zunionstore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:destkey; 7, identifier:key; 8, list_splat_pattern; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_stateme...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 8, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 13, 26; 14, 27; 15, 28; 15, 29; 15, 30; 16, 31; 16, 32; 16, 33; 16, 34; 17, 35; 18, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 29, 43; 29, 44...
def zunionstore(self, destkey, key, *keys, with_weights=False, aggregate=None): """Add multiple sorted sets and store result in a new key.""" keys = (key,) + keys numkeys = len(keys) args = [] if with_weights: assert all(isinstance(val, (list, tupl...
0, module; 1, function_definition; 2, function_name:zscan; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, expression_statement; 15, function_defi...
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; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 12, 25; 12, 26; 13, 27; 13, 28; 14, 29; 15, 30; 15, 31; 15, 32; 16, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 27, 39; 27, 40; 28, 41; 29, 42; 29, 43; 31, 44;...
def zscan(self, key, cursor=0, match=None, count=None): """Incrementally iterate sorted sets elements and associated scores.""" args = [] if match is not None: args += [b'MATCH', match] if count is not None: args += [b'COUNT', count] fut = self.execute(b'Z...
0, module; 1, function_definition; 2, function_name:zpopmin; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, keyword_separator; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, return_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; 7, 16; 7, 17; 9, 18; 9, 19; 10, 20; 11, 21; 11, 22; 12, 23; 13, 24; 13, 25; 14, 26; 15, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 26, 37; 28, 38; 28, 39; 29, 40; 30, 41; 35, 42; 37, 43; 37, ...
def zpopmin(self, key, count=None, *, encoding=_NOTSET): """Removes and returns up to count members with the lowest scores in the sorted set stored at key. :raises TypeError: if count is not int """ if count is not None and not isinstance(count, int): raise TypeError...
0, module; 1, function_definition; 2, function_name:zpopmax; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, keyword_separator; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, return_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; 7, 16; 7, 17; 9, 18; 9, 19; 10, 20; 11, 21; 11, 22; 12, 23; 13, 24; 13, 25; 14, 26; 15, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 26, 37; 28, 38; 28, 39; 29, 40; 30, 41; 35, 42; 37, 43; 37, ...
def zpopmax(self, key, count=None, *, encoding=_NOTSET): """Removes and returns up to count members with the highest scores in the sorted set stored at key. :raises TypeError: if count is not int """ if count is not None and not isinstance(count, int): raise TypeErro...
0, module; 1, function_definition; 2, function_name:uniq; 3, parameters; 4, block; 5, identifier:container; 6, expression_statement; 7, try_statement; 8, return_statement; 9, comment:""" Check if all of a container's elements are unique. Successively tries first to rely that the elements are hashable, then ...
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; 11, 14; 11, 15; 13, 16; 15, 17; 16, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 20, 28; 21, 29; 21, 30; 23, 31; 25, 32; 26, 33; 27, 34; 28, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 30, 41; 31, 42; 31, 4...
def uniq(container): """ Check if all of a container's elements are unique. Successively tries first to rely that the elements are hashable, then falls back on them being sortable, and finally falls back on brute force. """ try: return len(set(unbool(i) for i in container)) == len...
0, module; 1, function_definition; 2, function_name:split_traversal; 3, parameters; 4, block; 5, identifier:traversal; 6, identifier:edges; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, comment:# hash edge rows for contains checks; 11, if_statement; 12, comment:# turn the (n,) traversal in...
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; 7, 24; 7, 25; 8, 26; 9, 27; 11, 28; 11, 29; 13, 30; 15, 31; 17, 32; 19, 33; 19, 34; 19, 35; 19, 36; 21, 37; 21, 38; 21, 39; 21, 40; 22, 41; 23, 42; 27, 43; 27, 44; 28, ...
def split_traversal(traversal, edges, edges_hash=None): """ Given a traversal as a list of nodes, split the traversal if a sequential index pair is not in the given edges. Parameters -------------- edges : (n, 2) int Graph edge indexes traversa...
0, module; 1, function_definition; 2, function_name:fill_traversals; 3, parameters; 4, block; 5, identifier:traversals; 6, identifier:edges; 7, default_parameter; 8, expression_statement; 9, comment:# make sure edges are correct type; 10, expression_statement; 11, comment:# make sure edges are sorted; 12, expression_st...
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; 7, 23; 7, 24; 8, 25; 10, 26; 12, 27; 14, 28; 14, 29; 16, 30; 16, 31; 17, 32; 18, 33; 18, 34; 18, 35; 18, 36; 18, 37; 20, 38; 21, 39; 21, 40; 21, 41; 21, 42; 22, 43; 26, 44; 26...
def fill_traversals(traversals, edges, edges_hash=None): """ Convert a traversal of a list of edges into a sequence of traversals where every pair of consecutive node indexes is an edge in a passed edge list Parameters ------------- traversals : sequence of (m,) int Node indexes of t...
0, module; 1, function_definition; 2, function_name:hashable_rows; 3, parameters; 4, block; 5, identifier:data; 6, default_parameter; 7, expression_statement; 8, comment:# if there is no data return immediately; 9, if_statement; 10, comment:# get array as integer to precision we care about; 11, expression_statement; 12...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 6, 22; 6, 23; 7, 24; 9, 25; 9, 26; 11, 27; 13, 28; 13, 29; 16, 30; 16, 31; 16, 32; 16, 33; 18, 34; 20, 35; 21, 36; 25, 37; 25, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29, 44; 30,...
def hashable_rows(data, digits=None): """ We turn our array into integers based on the precision given by digits and then put them in a hashable format. Parameters --------- data : (n, m) array Input data digits : int or None How many digits to add to hash if data is floating po...
0, module; 1, function_definition; 2, function_name:interpolate_nans_1d; 3, parameters; 4, block; 5, identifier:x; 6, identifier:y; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_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; 7, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 13, 22; 13, 23; 13, 24; 13, 25; 14, 26; 16, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 23, 38; 24, 39; 24, 40; 25, 41; 26, 42; 26, 43; 29,...
def interpolate_nans_1d(x, y, kind='linear'): """Interpolate NaN values in y. Interpolate NaN values in the y dimension. Works with unsorted x values. Parameters ---------- x : array-like 1-dimensional array of numeric x-values y : array-like 1-dimensional array of numeric y-va...
0, module; 1, function_definition; 2, function_name:interpolate_1d; 3, parameters; 4, block; 5, identifier:x; 6, identifier:xp; 7, list_splat_pattern; 8, dictionary_splat_pattern; 9, expression_statement; 10, comment:# Pull out keyword args; 11, expression_statement; 12, expression_statement; 13, comment:# Make x an ar...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 4, 37; 4, 38; 4, 39; 4, 40; 4, 41; 4, 42; 4, 43; 4, 44; 4, 45; 4, 46; 4, 47; ...
def interpolate_1d(x, xp, *args, **kwargs): r"""Interpolates data with any shape over a specified axis. Interpolation over a specified axis for arrays of any shape. Parameters ---------- x : array-like 1-D array of desired interpolated values. xp : array-like The x-coordinates...
0, module; 1, function_definition; 2, function_name:log_interpolate_1d; 3, parameters; 4, block; 5, identifier:x; 6, identifier:xp; 7, list_splat_pattern; 8, dictionary_splat_pattern; 9, expression_statement; 10, comment:# Pull out kwargs; 11, expression_statement; 12, expression_statement; 13, comment:# Log x and xp; ...
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; 7, 17; 8, 18; 9, 19; 11, 20; 12, 21; 14, 22; 15, 23; 16, 24; 20, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 26, 35; 26, 36; 28, 37; 28, 38; 30, 39; 30, 40; 32, 41; 32, 42; 34, 43; 34, ...
def log_interpolate_1d(x, xp, *args, **kwargs): r"""Interpolates data with logarithmic x-scale over a specified axis. Interpolation on a logarithmic x-scale for interpolation values in pressure coordintates. Parameters ---------- x : array-like 1-D array of desired interpolated values. ...
0, module; 1, function_definition; 2, function_name:_find_append_zero_crossings; 3, parameters; 4, block; 5, identifier:x; 6, identifier:y; 7, expression_statement; 8, comment:# Find and append crossings to the data; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# Resort so th...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 7, 21; 9, 22; 10, 23; 11, 24; 13, 25; 14, 26; 15, 27; 17, 28; 18, 29; 19, 30; 20, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44;...
def _find_append_zero_crossings(x, y): r""" Find and interpolate zero crossings. Estimate the zero crossings of an x,y series and add estimated crossings to series, returning a sorted array with no duplicate values. Parameters ---------- x : `pint.Quantity` x values of data y :...
0, module; 1, function_definition; 2, function_name:sort_ordered_objects; 3, parameters; 4, block; 5, identifier:items; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:getter; 10, lambda; 11, comment:"""Sort an iterable of OrderedBase instances. Args: items (iterable): the...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 10, 13; 10, 14; 12, 15; 12, 16; 13, 17; 16, 18; 16, 19; 19, 20; 19, 21; 21, 22; 21, 23; 22, 24; 23, 25; 23, 26; 26, 27; 26, 28; 26, 29; 27, 30; 27, 31; 28, 32; 28, 33; 29, 34; 31, 35
def sort_ordered_objects(items, getter=lambda x: x): """Sort an iterable of OrderedBase instances. Args: items (iterable): the objects to sort getter (callable or None): a function to extract the OrderedBase instance from an object. Examples: >>> sort_ordered_objects([x, y, z]) ...
0, module; 1, function_definition; 2, function_name:remove_fewwords_paragraphs; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, comment:"""\ remove paragraphs that have less than x number of words, would indica...
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; 9, 14; 9, 15; 11, 16; 11, 17; 12, 18; 12, 19; 15, 20; 15, 21; 15, 22; 15, 23; 17, 24; 17, 25; 18, 26; 18, 27; 20, 28; 21, 29; 22, 30; 23, 31; 23, 32; 23, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 28, 40; 28, 41; 29, 42; 29, 43; ...
def remove_fewwords_paragraphs(self): """\ remove paragraphs that have less than x number of words, would indicate that it's some sort of link """ all_nodes = self.parser.getElementsByTags(self.get_top_node(), ['*']) all_nodes.reverse() for el in all_nodes: ...
0, module; 1, function_definition; 2, function_name:compare_baselines; 3, parameters; 4, block; 5, identifier:old_baseline_filename; 6, identifier:new_baseline_filename; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, c...
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; 7, 19; 8, 20; 8, 21; 9, 22; 10, 23; 11, 24; 12, 25; 14, 26; 15, 27; 16, 28; 17, 29; 18, 30; 18, 31; 18, 32; 20, 33; 20, 34; 21, 35; 22, 36; 22, 37; 23, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, 44;...
def compare_baselines(old_baseline_filename, new_baseline_filename): """ This function enables developers to more easily configure plugin settings, by comparing two generated baselines and highlighting their differences. For effective use, a few assumptions are made: 1. Baselines are sorted...
0, module; 1, function_definition; 2, function_name:_GetEventIdentifiers; 3, parameters; 4, block; 5, identifier:self; 6, identifier:event; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:# The 'atime', 'ctime', 'crtime', 'mtime' are in...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 7, 18; 8, 19; 9, 20; 10, 21; 11, 22; 11, 23; 11, 24; 14, 25; 14, 26; 14, 27; 15, 28; 16, 29; 17, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 24, 43; 24, 4...
def _GetEventIdentifiers(self, event): """Retrieves different identifiers of the event. Every event contains event data, which consists of attributes and values. These attributes and values can be represented as a string and used for sorting and uniquely identifying events. This function determines mul...
0, module; 1, function_definition; 2, function_name:PopEvents; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, while_statement; 9, comment:"""Pops events from the heap. Yields: EventObject: event. """; 10, assignment; 11, identifier:event; 12, block; 13, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 10, 13; 10, 14; 12, 15; 12, 16; 14, 17; 14, 18; 15, 19; 16, 20; 17, 21; 17, 22; 19, 23; 20, 24; 20, 25; 25, 26; 25, 27; 26, 28; 26, 29
def PopEvents(self): """Pops events from the heap. Yields: EventObject: event. """ event = self.PopEvent() while event: yield event event = self.PopEvent()
0, module; 1, function_definition; 2, function_name:_CheckStatusAnalysisProcess; 3, parameters; 4, block; 5, identifier:self; 6, identifier:pid; 7, expression_statement; 8, comment:# TODO: Refactor this method, simplify and separate concerns (monitoring; 9, comment:# vs management).; 10, expression_statement; 11, if_st...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 10, 15; 11, 16; 11, 17; 11, 18; 12, 19; 13, 20; 13, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 17, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 23, 38; 25, 39; 25, 40; 26, 41; 27, 42; 28, 43;...
def _CheckStatusAnalysisProcess(self, pid): """Checks the status of an analysis process. Args: pid (int): process ID (PID) of a registered analysis process. Raises: KeyError: if the process is not registered with the engine. """ # TODO: Refactor this method, simplify and separate conce...
0, module; 1, function_definition; 2, function_name:_ExportEvent; 3, parameters; 4, block; 5, identifier:self; 6, identifier:output_module; 7, identifier:event; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, identifier:deduplicate_events; 13, True; 14, comment:"""Exports ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 8, 12; 8, 13; 9, 14; 10, 15; 10, 16; 11, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 21, 29; 22, 30; 22, 31; 23, 32; 28, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43;...
def _ExportEvent(self, output_module, event, deduplicate_events=True): """Exports an event using an output module. Args: output_module (OutputModule): output module. event (EventObject): event. deduplicate_events (Optional[bool]): True if events should be deduplicated. """ i...
0, module; 1, function_definition; 2, function_name:_FlushExportBuffer; 3, parameters; 4, block; 5, identifier:self; 6, identifier:output_module; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, i...
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; 9, 18; 10, 19; 11, 20; 12, 21; 13, 22; 13, 23; 13, 24; 14, 25; 14, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 22, 37; 24, 38; 24, 39; 24, 40; 24, 41; 26, 42; 34, 43; 34,...
def _FlushExportBuffer(self, output_module, deduplicate_events=True): """Flushes buffered events and writes them to the output module. Args: output_module (OutputModule): output module. deduplicate_events (Optional[bool]): True if events should be deduplicated. """ last_macb_group...
0, module; 1, function_definition; 2, function_name:_MergeEventTag; 3, parameters; 4, block; 5, identifier:self; 6, identifier:storage_writer; 7, identifier:attribute_container; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, comment:# Check if the event has already been tagged...
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; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 11, 22; 14, 23; 15, 24; 15, 25; 16, 26; 18, 27; 18, 28; 19, 29; 20, 30; 20, 31; 21, 32; 22, 33; 23, 34; 23, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 31, 43; 31, ...
def _MergeEventTag(self, storage_writer, attribute_container): """Merges an event tag with the last stored event tag. If there is an existing event the provided event tag is updated with the contents of the existing one. After which the event tag index is updated. Args: storage_writer (Stora...
0, module; 1, function_definition; 2, function_name:_StartAnalysisProcesses; 3, parameters; 4, block; 5, identifier:self; 6, identifier:storage_writer; 7, identifier:analysis_plugins; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, comment:"""Starts the analysis proces...
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; 10, 15; 10, 16; 11, 17; 13, 18; 13, 19; 15, 20; 15, 21; 16, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 20, 30; 20, 31; 22, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 29, 39; 32, 40; 32, 41; 33, 42; 33, 43...
def _StartAnalysisProcesses(self, storage_writer, analysis_plugins): """Starts the analysis processes. Args: storage_writer (StorageWriter): storage writer. analysis_plugins (dict[str, AnalysisPlugin]): analysis plugins that should be run and their names. """ logger.info('Starting...
0, module; 1, function_definition; 2, function_name:_StopAnalysisProcesses; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# Note that multiprocessing.Queue is very sensitive regarding; 11, comment:# blocking on e...
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; 6, 22; 6, 23; 7, 24; 8, 25; 9, 26; 13, 27; 13, 28; 13, 29; 14, 30; 14, 31; 17, 32; 17, 33; 17, 34; 19, 35; 20, 36; 20, 37; 20, 38; 21, 39; 21, 40; 21, 41; 21, 42; 25, 43; 25, 44; 26,...
def _StopAnalysisProcesses(self, abort=False): """Stops the analysis processes. Args: abort (bool): True to indicated the stop is issued on abort. """ logger.debug('Stopping analysis processes.') self._StopMonitoringProcesses() # Note that multiprocessing.Queue is very sensitive regardin...
0, module; 1, function_definition; 2, function_name:_UpdateForemanProcessStatus; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:"""Update the foreman process status."""; 12, assignment...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 17, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 21, 32; 21, 33; 21, 34; 21, 35; 21, 36; 21, 37; 21, 38; 21, 39; 21, 40; 21, 41; 21, 42; 21, 43;...
def _UpdateForemanProcessStatus(self): """Update the foreman process status.""" used_memory = self._process_information.GetUsedMemory() or 0 display_name = getattr(self._merge_task, 'identifier', '') self._processing_status.UpdateForemanStatus( self._name, self._status, self._pid, used_memory,...
0, module; 1, function_definition; 2, function_name:workers_status; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""The worker status objects sorted by identifier."""; 9, list_comprehension; 10, subscript; 11, for_in_clause; 12, attribute; 13, identifier:identifi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 11, 15; 12, 16; 12, 17; 15, 18; 15, 19; 19, 20; 20, 21; 20, 22; 21, 23; 21, 24; 23, 25; 23, 26
def workers_status(self): """The worker status objects sorted by identifier.""" return [self._workers_status[identifier] for identifier in sorted(self._workers_status.keys())]
0, module; 1, function_definition; 2, function_name:ProcessStorage; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, express...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 6, 29; 7, 30; 8, 31; 9, 32; 10, 33; 11, 34; 12, 35; 13, 36; 13, 37; 14, 38; 15, 39; 16, 40; 17, 41; 18, 42; 19, 43; 20, 44; 21, 45; 2...
def ProcessStorage(self): """Processes a plaso storage file. Raises: BadConfigOption: when a configuration parameter fails validation. RuntimeError: if a non-recoverable situation is encountered. """ self._CheckStorageFile(self._storage_file_path) self._status_view.SetMode(self._status...
0, module; 1, function_definition; 2, function_name:sort_state; 3, parameters; 4, block; 5, identifier:self; 6, typed_parameter; 7, expression_statement; 8, expression_statement; 9, identifier:best_hyp_indices; 10, type; 11, comment:""" Sorts states according to k-best order from last step in beam search. ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 10, 13; 12, 14; 12, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 20, 24; 20, 25; 21, 26; 21, 27; 24, 28; 24, 29; 25, 30; 25, 31; 27, 32; 27, 33; 28, 34; 28, 35
def sort_state(self, best_hyp_indices: mx.nd.NDArray): """ Sorts states according to k-best order from last step in beam search. """ self.states = [mx.nd.take(ds, best_hyp_indices) for ds in self.states]
0, module; 1, function_definition; 2, function_name:rerank; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, typed_parameter; 9, generic_type; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:# descending; 14, expression_statement; 15, if_statement; 1...
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; 5, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 11, 24; 12, 25; 14, 26; 15, 27; 15, 28; 16, 29; 18, 30; 20, 31; 22, 32; 22, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 30, 43; 30, 44;...
def rerank(self, hypotheses: Dict[str, Any], reference: str) -> Dict[str, Any]: """ Reranks a set of hypotheses that belong to one single reference translation. Uses stable sorting. :param hypotheses: Nbest translations. :param reference: A single string with the actual referenc...
0, module; 1, function_definition; 2, function_name:load; 3, parameters; 4, block; 5, identifier:self; 6, typed_parameter; 7, typed_default_parameter; 8, expression_statement; 9, expression_statement; 10, with_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, for_statement; 15, expres...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 7, 20; 7, 21; 8, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 12, 28; 12, 29; 13, 30; 14, 31; 14, 32; 14, 33; 15, 34; 16, 35; 18, 36; 20, 37; 23, 38; 23, 39; 24, 40; 25, 41; 26, 42; 26, 43; 27, 44; ...
def load(self, path: str, k: Optional[int] = None): """ Load lexicon from Numpy array file. The top-k target ids will be sorted by increasing target id. :param path: Path to Numpy array file. :param k: Optionally load less items than stored in path. """ load_time_start =...
0, module; 1, function_definition; 2, function_name:get_trg_ids; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_parameter; 8, attribute; 9, expression_statement; 10, comment:# TODO: When MXNet adds support for set operations, we can migrate to avoid conversions to/from NumPy.; 11, expression_statement; ...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 11, 19; 12, 20; 13, 21; 15, 22; 19, 23; 19, 24; 20, 25; 20, 26; 22, 27; 22, 28; 24, 29; 24, 30; 26, 31; 26, 32; 29, 33; 29, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41; 36, 42; 36, 43; 38,...
def get_trg_ids(self, src_ids: np.ndarray) -> np.ndarray: """ Lookup possible target ids for input sequence of source ids. :param src_ids: Sequence(s) of source ids (any shape). :return: Possible target ids for source (unique sorted, always includes special symbols). """ ...
0, module; 1, function_definition; 2, function_name:choice; 3, parameters; 4, block; 5, identifier:self; 6, identifier:obj; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:""" Overloads the choice method to add the position of the object in th...
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; 16, 21; 16, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 22, 28; 22, 29; 22, 30; 24, 31; 24, 32; 24, 33; 25, 34; 25, 35; 26, 36; 27, 37; 27, 38; 29, 39; 29, 40; 32, 41; 32, 42; 34, 43...
def choice(self, obj): """ Overloads the choice method to add the position of the object in the tree for future sorting. """ tree_id = getattr(obj, self.queryset.model._mptt_meta.tree_id_attr, 0) left = getattr(obj, self.queryset.model._mptt_meta.left_attr, 0) ret...
0, module; 1, function_definition; 2, function_name:get_best_dataset_key; 3, parameters; 4, block; 5, identifier:key; 6, identifier:choices; 7, expression_statement; 8, comment:# Choose the wavelength closest to the choice; 9, if_statement; 10, if_statement; 11, if_statement; 12, if_statement; 13, if_statement; 14, ret...
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; 9, 16; 9, 17; 9, 18; 9, 19; 10, 20; 10, 21; 11, 22; 11, 23; 12, 24; 12, 25; 13, 26; 13, 27; 14, 28; 16, 29; 16, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, ...
def get_best_dataset_key(key, choices): """Choose the "best" `DatasetID` from `choices` based on `key`. The best key is chosen based on the follow criteria: 1. Central wavelength is nearest to the `key` wavelength if specified. 2. Least modified dataset if `modifiers` is `None` in `...
0, module; 1, function_definition; 2, function_name:get_key; 3, parameters; 4, block; 5, identifier:key; 6, identifier:key_container; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 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; 15, 40; 15, 41; 15, 42; 15, 43; 15, 44; 15, 45;...
def get_key(key, key_container, num_results=1, best=True, resolution=None, calibration=None, polarization=None, level=None, modifiers=None): """Get the fully-specified key best matching the provided key. Only the best match is returned if `best` is `True` (default). See `get_best_da...
0, module; 1, function_definition; 2, function_name:group_files; 3, parameters; 4, block; 5, identifier:files_to_sort; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, comment:# FUTURE: Find the best reader for each filename usi...
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; 6, 29; 6, 30; 7, 31; 7, 32; 8, 33; 8, 34; 9, 35; 9, 36; 10, 37; 10, 38; 11, 39; 13, 40; 13, 41; 13, 42; 15, 43; 16, 44; 17, 45; 18, 4...
def group_files(files_to_sort, reader=None, time_threshold=10, group_keys=None, ppp_config_dir=None, reader_kwargs=None): """Group series of files by file pattern information. By default this will group files by their filename ``start_time`` assuming it exists in the pattern. By passing the...
0, module; 1, function_definition; 2, function_name:sorted_filetype_items; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, while_statement; 10, comment:"""Sort the instance's filetypes in using order."""; 11, assignment; 12, assignment; 13, call...
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; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 14, 23; 14, 24; 14, 25; 18, 26; 18, 27; 20, 28; 21, 29; 22, 30; 23, 31; 23, 32; 23, 33; 24, 34; 25, 35; 27, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 33, 43;...
def sorted_filetype_items(self): """Sort the instance's filetypes in using order.""" processed_types = [] file_type_items = deque(self.config['file_types'].items()) while len(file_type_items): filetype, filetype_info = file_type_items.popleft() requirements = fil...
0, module; 1, function_definition; 2, function_name:combine_hashes; 3, parameters; 4, block; 5, identifier:hashes; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""A simple helper function to combine other hashes. Sorts the hashes before rolling them in."""; 11, 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; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 15, 24; 17, 25; 17, 26; 19, 27; 20, 28; 21, 29; 22, 30; 22, 31; 24, 32; 24, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 32, 40; 32, 41; 33, 42; 35, 43; ...
def combine_hashes(hashes): """A simple helper function to combine other hashes. Sorts the hashes before rolling them in.""" hasher = sha1() for h in sorted(hashes): h = ensure_binary(h) hasher.update(h) return hasher.hexdigest() if PY3 else hasher.hexdigest().decode('utf-8')
0, module; 1, function_definition; 2, function_name:register_jvm_tool; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:register; 7, identifier:key; 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; 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; 14, 43; 15, 44; 15, 45; 16...
def register_jvm_tool(cls, register, key, classpath_spec=None, main=None, custom_rules=None, fingerprint=True, classpath=None, h...
0, module; 1, function_definition; 2, function_name:get_available_urls; 3, parameters; 4, block; 5, identifier:self; 6, identifier:urls; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# List of pairs (host, time in ms).; 11, expression_statement; 12, expression_statement; 13, exp...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 8, 17; 9, 18; 11, 19; 12, 20; 13, 21; 14, 22; 15, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 25, 36; 25, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 31, 43; 31,...
def get_available_urls(self, urls): """Return reachable urls sorted by their ping times.""" baseurl_to_urls = {self._baseurl(url): url for url in urls} pingtimes = self._pinger.pings(list(baseurl_to_urls.keys())) # List of pairs (host, time in ms). self._log.debug('Artifact cache server ping times: {}'...
0, module; 1, function_definition; 2, function_name:iterate; 3, parameters; 4, block; 5, identifier:self; 6, identifier:scopes; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, comment:"""Yields ScopeInfo instances for the specified scopes, plus relevant related scopes. Relevant scopes are: ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 9, 13; 11, 14; 11, 15; 13, 16; 15, 17; 15, 18; 16, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 28, 36; 31, 37; 31, 38; 32, 39; 36, 40
def iterate(self, scopes): """Yields ScopeInfo instances for the specified scopes, plus relevant related scopes. Relevant scopes are: - All tasks in a requested goal. - All subsystems tied to a request scope. Yields in a sensible order: Sorted by scope, but with subsystems tied to a request sc...
0, module; 1, function_definition; 2, function_name:_expand_tasks; 3, parameters; 4, block; 5, identifier:self; 6, identifier:scopes; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Add all tasks in any requested goals. Returns the requested scopes, plus the...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 15, 23; 16, 24; 16, 25; 18, 26; 18, 27; 21, 28; 21, 29; 23, 30; 23, 31; 25, 32; 27, 33; 28, 34; 28, 35; 30, 36; 30, 37; 31, 38; 31, 39; 36, 40; 36, 41; 37, 42; 37, 43; ...
def _expand_tasks(self, scopes): """Add all tasks in any requested goals. Returns the requested scopes, plus the added tasks, sorted by scope name. """ expanded_scopes = set(scopes) for scope, info in self._scope_to_info.items(): if info.category == ScopeInfo.TASK: outer = enclosing_s...
0, module; 1, function_definition; 2, function_name:get_all; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""Returns all the timings, sorted in decreasing order. Each value is a dict: { path: <path>, timing: <timing in seconds> } """; 9, list_comprehensi...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 10, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 19, 28; 20, 29; 20, 30; 21, 31; 22, 32; 22, 33; 24, 34; 24, 35; 24, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, ...
def get_all(self): """Returns all the timings, sorted in decreasing order. Each value is a dict: { path: <path>, timing: <timing in seconds> } """ return [{'label': x[0], 'timing': x[1], 'is_tool': x[0] in self._tool_labels} for x in sorted(self._timings_by_path.items(), key=lambda x: x[1],...
0, module; 1, function_definition; 2, function_name:all; 3, parameters; 4, block; 5, expression_statement; 6, return_statement; 7, comment:"""Returns all active registered goals, sorted alphabetically by name. :API: public """; 8, list_comprehension; 9, identifier:goal; 10, for_in_clause; 11, if_clause; 12, pa...
0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 5, 7; 6, 8; 8, 9; 8, 10; 8, 11; 10, 12; 10, 13; 11, 14; 12, 15; 12, 16; 13, 17; 13, 18; 14, 19; 14, 20; 18, 21; 21, 22; 21, 23; 22, 24; 22, 25; 24, 26; 24, 27
def all(): """Returns all active registered goals, sorted alphabetically by name. :API: public """ return [goal for _, goal in sorted(Goal._goal_by_name.items()) if goal.active]
0, module; 1, function_definition; 2, function_name:select_best_url; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, try_statement; 9, comment:"""Select `best` url. Since urls are pre-sorted w.r.t. their ping times, we simply return the first element from the l...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 8, 13; 10, 14; 10, 15; 11, 16; 12, 17; 12, 18; 13, 19; 15, 20; 15, 21; 16, 22; 18, 23; 18, 24; 18, 25; 18, 26; 19, 27; 20, 28; 20, 29; 22, 30; 23, 31; 25, 32; 25, 33; 27, 34; 31, 35; 31, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43...
def select_best_url(self): """Select `best` url. Since urls are pre-sorted w.r.t. their ping times, we simply return the first element from the list. And we always return the same url unless we observe greater than max allowed number of consecutive failures. In this case, we would return the next `best...
0, module; 1, function_definition; 2, function_name:_topological_sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:targets; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Topologically order a list of targets"""; 11, assignment; 12, list_comprehension; 13, identifie...
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; 12, 17; 14, 18; 14, 19; 16, 20; 16, 21; 17, 22; 19, 23; 21, 24; 21, 25; 22, 26; 22, 27; 25, 28; 28, 29; 28, 30; 30, 31
def _topological_sort(self, targets): """Topologically order a list of targets""" target_set = set(targets) return [t for t in reversed(sort_targets(targets)) if t in target_set]
0, module; 1, function_definition; 2, function_name:sortmerna_detailed_barplot; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# Specify the order of the different possible categories; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, for_statement; 12, 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; 4, 14; 6, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 11, 22; 11, 23; 13, 24; 14, 25; 16, 26; 16, 27; 17, 28; 17, 29; 19, 30; 19, 31; 20, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 27, 38; 27, 39; 29, 40; 29, 41; 32, 42; 32, 43; 32...
def sortmerna_detailed_barplot (self): """ Make the HighCharts HTML to plot the sortmerna rates """ # Specify the order of the different possible categories keys = OrderedDict() metrics = set() for sample in self.sortmerna: for key in self.sortmerna[sample]: ...
0, module; 1, function_definition; 2, function_name:_short_chrom; 3, parameters; 4, block; 5, identifier:self; 6, identifier:chrom; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, try_statement; 12, if_statement; 13, comment:"""Plot standard chromosomes + X, sort...
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; 12, 19; 12, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 20, 31; 21, 32; 21, 33; 23, 34; 23, 35; 25, 36; 25, 37; 27, 38; 27, 39; 28, 40; 30, 41; 31, 42; 31, 43; ...
def _short_chrom(self, chrom): """Plot standard chromosomes + X, sorted numerically. Allows specification from a list of chromosomes via config for non-standard genomes. """ default_allowed = set(["X"]) allowed_chroms = set(getattr(config, "goleft_indexcov_config", {}).g...
0, module; 1, function_definition; 2, function_name:deepvalues; 3, parameters; 4, block; 5, identifier:mapping; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, comment:"""Iterates over nested mapping, depth-first, in sorted order by key."""; 10, assignment; 11, identifier:obj; 12, identifier:valu...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 8, 13; 10, 14; 10, 15; 13, 16; 13, 17; 13, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 17, 24; 18, 25; 18, 26; 20, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 25, 34; 26, 35; 30, 36; 32, 37; 33, 38; 33, 39; 35, 40; 36, 41; 36, 42; 38, 43...
def deepvalues(mapping): """Iterates over nested mapping, depth-first, in sorted order by key.""" values = vals_sorted_by_key(mapping) for obj in values: mapping = False try: obj.items except AttributeError: pass else: mapping = True ...
0, module; 1, function_definition; 2, function_name:values; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""Return a list of all the message's header values. These will be sorted in the order they appeared in the original message, or were added t...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25
def values(self): """Return a list of all the message's header values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. ...
0, module; 1, function_definition; 2, function_name:items; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""Get all the message's header fields and values. These will be sorted in the order they appeared in the original message, or were added to t...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 22, 26; 22, 27
def items(self): """Get all the message's header fields and values. These will be sorted in the order they appeared in the original message, or were added to the message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. ...
0, module; 1, function_definition; 2, function_name:get_all; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, if_statement; 13, return_statement; 14, identifier:failobj; 15, None; 16,...
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; 11, 20; 11, 21; 12, 22; 12, 23; 13, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 22, 34; 23, 35; 28, 36; 28, 37; 33, 38; 33, 39; 35, 40; 36, 41; 36, 42; 38, 43; 38...
def get_all(self, name, failobj=None): """Return a list of all the values for the named field. These will be sorted in the order they appeared in the original message, and may contain duplicates. Any fields deleted and re-inserted are always appended to the header list. If no ...
0, module; 1, function_definition; 2, function_name:setup; 3, parameters; 4, block; 5, identifier:job; 6, identifier:input_file_id; 7, identifier:n; 8, identifier:down_checkpoints; 9, expression_statement; 10, comment:# Write the input file to the file store; 11, expression_statement; 12, return_statement; 13, 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; 9, 13; 11, 14; 12, 15; 14, 16; 14, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 18, 23; 18, 24; 20, 25; 20, 26; 23, 27; 23, 28; 27, 29; 27, 30; 28, 31; 28, 32; 28, 33; 28, 34; 28, 35; 34, 36; 34, 37; 35, 38; 35, 39; 39, 40
def setup(job, input_file_id, n, down_checkpoints): """Sets up the sort. Returns the FileID of the sorted file """ # Write the input file to the file store job.fileStore.logToMaster("Starting the merge sort") return job.addChildJobFn(down, input_file_id, n, ...
0, module; 1, function_definition; 2, function_name:down; 3, parameters; 4, block; 5, identifier:job; 6, identifier:input_file_id; 7, identifier:n; 8, identifier:down_checkpoints; 9, expression_statement; 10, comment:# Read the file; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, comment:"""I...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 9, 14; 11, 15; 12, 16; 13, 17; 13, 18; 13, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 19, 27; 19, 28; 19, 29; 19, 30; 19, 31; 19, 32; 19, 33; 19, 34; 19, 35; 20, 36; 20, 37; 22, 38; 22, 39; 24, 40; 24, 41; 27, 42; 29, 43;...
def down(job, input_file_id, n, down_checkpoints): """Input is a file and a range into that file to sort and an output location in which to write the sorted file. If the range is larger than a threshold N the range is divided recursively and a follow on job is then created which merges back the results....
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:in_file; 6, identifier:out_file; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, expression_sta...
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; 9, 17; 10, 18; 11, 19; 12, 20; 13, 21; 13, 22; 13, 23; 14, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 23, 35; 24, 36; 24, 37; 26, 38; 26, 39; 28, 40; 28, 41; 29, 42; 29, 43; 31...
def sort(in_file, out_file): """Sorts the given file. """ filehandle = open(in_file, 'r') lines = filehandle.readlines() filehandle.close() lines.sort() filehandle = open(out_file, 'w') for line in lines: filehandle.write(line) filehandle.close()
0, module; 1, function_definition; 2, function_name:merge; 3, parameters; 4, block; 5, identifier:filehandle_1; 6, identifier:filehandle_2; 7, identifier:output_filehandle; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, while_statement; 12, comment:"""Merges together two files maintaining sort...
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; 10, 15; 10, 16; 11, 17; 11, 18; 13, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 20, 29; 20, 30; 21, 31; 21, 32; 23, 33; 23, 34; 24, 35; 27, 36; 28, 37; 29, 38; 29, 39; 33, 40; 33, 41; 34, 42; 34, 43...
def merge(filehandle_1, filehandle_2, output_filehandle): """Merges together two files maintaining sorted order. """ line2 = filehandle_2.readline() for line1 in filehandle_1.readlines(): while line2 != '' and line2 <= line1: output_filehandle.write(line2) line2 = filehan...
0, module; 1, function_definition; 2, function_name:decorateSubHeader; 3, parameters; 4, block; 5, identifier:title; 6, identifier:columnWidths; 7, identifier:options; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, comment:""" Add a marker to the correct field if the TITLE is sorted on. """...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 10, 13; 10, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 17, 23; 17, 24; 19, 25; 19, 26; 20, 27; 21, 28; 22, 29; 22, 30; 22, 31; 22, 32; 23, 33; 23, 34; 27, 35; 27, 36; 29, 37; 30, 38; 30, 39; 30, 40; 31, 41; 32, 42; 36, 4...
def decorateSubHeader(title, columnWidths, options): """ Add a marker to the correct field if the TITLE is sorted on. """ title = title.lower() if title != options.sortCategory: s = "| %*s%*s%*s%*s%*s " % ( columnWidths.getWidth(title, "min"), "min", columnWidths.getWidth...
0, module; 1, function_definition; 2, function_name:sortJobs; 3, parameters; 4, block; 5, identifier:jobTypes; 6, identifier:options; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, comment:""" Return a jobTypes all sorted. """; 12, assignment; 13, assignment; 14, pa...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 10, 14; 10, 15; 10, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 19, 28; 19, 29; 19, 30; 19, 31; 19, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 24, 38; 24, 39; 25, 40; 26, 41; 26, 42; 27, 43...
def sortJobs(jobTypes, options): """ Return a jobTypes all sorted. """ longforms = {"med": "median", "ave": "average", "min": "min", "total": "total", "max": "max",} sortField = longforms[options.sortField] if (options.sortCategory ...
0, module; 1, function_definition; 2, function_name:_sort_tau_by_y; 3, parameters; 4, block; 5, identifier:self; 6, identifier:y; 7, expression_statement; 8, comment:# first column is the variable of interest; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, exp...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 7, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 14, 24; 15, 25; 16, 26; 17, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 25, 40; 25, 41; 26, 42; 26, 43; 29, ...
def _sort_tau_by_y(self, y): """Sort tau matrix by dependece with variable y. Args: :param y: index of variable of intrest :type y: int """ # first column is the variable of interest tau_y = self.tau_matrix[:, y] tau_y[y] = np.NaN temp = ...
0, module; 1, function_definition; 2, function_name:sort_edge; 3, parameters; 4, block; 5, identifier:edges; 6, expression_statement; 7, return_statement; 8, comment:"""Sort iterable of edges first by left node indices then right. Args: edges(list[Edge]): List of edges to be sorted. Return...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 11, 13; 13, 14; 13, 15; 15, 16; 15, 17; 16, 18; 17, 19; 17, 20; 19, 21; 19, 22; 20, 23; 20, 24
def sort_edge(edges): """Sort iterable of edges first by left node indices then right. Args: edges(list[Edge]): List of edges to be sorted. Returns: list[Edge]: Sorted list by left and right node indices. """ return sorted(edges, key=lambda x: (x.L, x.R)...
0, module; 1, function_definition; 2, function_name:stanc; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, if_statement; 15, if_statement; ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 5, 34; 5, 35; 6, 36; 6, 37; 7, 38; 7, 39; 8, 40; 8, 41; 9, 42; 9, 43; 10, 44; 10, 45; 11, 46; 11, ...
def stanc(file=None, charset='utf-8', model_code=None, model_name="anon_model", include_paths=None, verbose=False, obfuscate_model_name=True): """Translate Stan model specification into C++ code. Parameters ---------- file : {string, file}, optional If filename, the string passed as a...
0, module; 1, function_definition; 2, function_name:suggestion_list; 3, parameters; 4, block; 5, typed_parameter; 6, typed_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:input_; 13, type; 14, identifier:options; 15, type; 16,...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 5, 12; 5, 13; 6, 14; 6, 15; 7, 16; 8, 17; 9, 18; 10, 19; 10, 20; 10, 21; 11, 22; 13, 23; 15, 24; 17, 25; 17, 26; 18, 27; 18, 28; 21, 29; 21, 30; 21, 31; 22, 32; 22, 33; 24, 34; 24, 35; 28, 36; 28, 37; 29, 38; 30, 39; 31, 40; 31, 41; 33, 42; 33, 43; 35,...
def suggestion_list(input_: str, options: Collection[str]): """Get list with suggestions for a given input. Given an invalid input string and list of valid options, returns a filtered list of valid options sorted based on their similarity with the input. """ options_by_distance = {} input_thres...
0, module; 1, function_definition; 2, function_name:lexical_distance; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, identifier:int; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, comment:# Any case change counts as a single edit; 14, if_...
0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 5, 18; 6, 19; 6, 20; 7, 21; 7, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 14, 28; 14, 29; 15, 30; 16, 31; 16, 32; 16, 33; 17, 34; 17, 35; 17, 36; 18, 37; 20, 38; 22, 39; 24, 40; 24, 41; 25, 42; 26, 43; 26, 44; ...
def lexical_distance(a_str: str, b_str: str) -> int: """Computes the lexical distance between strings A and B. The "distance" between two strings is given by counting the minimum number of edits needed to transform string A into string B. An edit can be an insertion, deletion, or substitution of a sing...
0, module; 1, function_definition; 2, function_name:get_suggested_type_names; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, typed_parameter; 9, generic_type; 10, expression_statement; 11, if_statement; 12, comment:# Otherwise, must be an Object type, which does not have possible fields.; ...
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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 11, 24; 13, 25; 15, 26; 17, 27; 19, 28; 21, 29; 23, 30; 23, 31; 24, 32; 24, 33; 24, 34; 24, 35; 24, 36; 24, 37; 24, 38; 24, 39; 29, 40; 31, 41; 32, 42; 33, 43; 34, 44...
def get_suggested_type_names( schema: GraphQLSchema, type_: GraphQLOutputType, field_name: str ) -> List[str]: """ Get a list of suggested type names. Go through all of the implementations of type, as well as the interfaces that they implement. If any of those types include the provided field, ...
0, module; 1, function_definition; 2, function_name:instances_get; 3, parameters; 4, block; 5, identifier:opts; 6, identifier:plugins; 7, identifier:url_file_input; 8, identifier:out; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, for_statement; 14, return_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; 9, 15; 10, 16; 11, 17; 12, 18; 12, 19; 12, 20; 13, 21; 13, 22; 13, 23; 14, 24; 16, 25; 16, 26; 17, 27; 17, 28; 20, 29; 23, 30; 23, 31; 26, 32; 26, 33; 28, 34; 28, 35; 28, 36; 29, 37; 29, 38; 29, 39; 30, 40; 31, 41; 31, 42; 34, 43; ...
def instances_get(opts, plugins, url_file_input, out): """ Creates and returns an ordered dictionary containing instances for all available scanning plugins, sort of ordered by popularity. @param opts: options as returned by self._options. @param plugins: plugins as returned by plugins_util.plugins_...
0, module; 1, function_definition; 2, function_name:get_signed_headers; 3, parameters; 4, block; 5, identifier:headers; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:""" Get signed headers. :param headers: input dictionary to be sorted. """; 11, assign...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 14, 18; 15, 19; 15, 20; 18, 21; 20, 22; 21, 23; 21, 24; 23, 25; 23, 26; 24, 27; 27, 28; 27, 29; 28, 30; 28, 31; 30, 32; 30, 33; 32, 34; 32, 35
def get_signed_headers(headers): """ Get signed headers. :param headers: input dictionary to be sorted. """ signed_headers = [] for header in headers: signed_headers.append(header.lower().strip()) return sorted(signed_headers)
0, module; 1, function_definition; 2, function_name:add_from_names_to_locals; 3, parameters; 4, block; 5, identifier:self; 6, identifier:node; 7, expression_statement; 8, expression_statement; 9, function_definition; 10, for_statement; 11, comment:"""Store imported names to the locals Resort the locals if comi...
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; 10, 17; 10, 18; 12, 19; 12, 20; 14, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 20, 28; 20, 29; 22, 30; 27, 31; 27, 32; 27, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43; ...
def add_from_names_to_locals(self, node): """Store imported names to the locals Resort the locals if coming from a delayed node """ _key_func = lambda node: node.fromlineno def sort_locals(my_list): my_list.sort(key=_key_func) for (name, asname) in node.nam...
0, module; 1, function_definition; 2, function_name:nearest; 3, parameters; 4, block; 5, identifier:self; 6, identifier:nodes; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, comment:# FIXME: raise an exception if nearest is None ?; 13, return_...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 13, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 20, 28; 20, 29; 20, 30; 20, 31; 21, 32; 21, 33; 23, 34; 23, 35; 25, 36; 25, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 30, 43; 3...
def nearest(self, nodes): """Get the node closest to this one from the given list of nodes. :param nodes: The list of nodes to search. All of these nodes must belong to the same module as this one. The list should be sorted by the line number of the nodes, smallest first. ...
0, module; 1, function_definition; 2, function_name:object_type; 3, parameters; 4, block; 5, identifier:node; 6, default_parameter; 7, expression_statement; 8, try_statement; 9, if_statement; 10, return_statement; 11, identifier:context; 12, None; 13, comment:"""Obtain the type of the given node This is used to im...
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; 9, 16; 9, 17; 10, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 18, 25; 18, 26; 19, 27; 20, 28; 20, 29; 21, 30; 22, 31; 22, 32; 23, 33; 24, 34; 25, 35; 25, 36; 27, 37; 27, 38; 30, 39; 31, 40; 31, 41; 34, 42; 34, 43; 36...
def object_type(node, context=None): """Obtain the type of the given node This is used to implement the ``type`` builtin, which means that it's used for inferring type calls, as well as used in a couple of other places in the inference. The node will be inferred first, so this function can support ...
0, module; 1, function_definition; 2, function_name:get_deffacts; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""Return the existing deffacts sorted by the internal order"""; 9, call; 10, identifier:sorted; 11, argument_list; 12, call; 13, keyword_argument; 14, ...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 11, 13; 12, 14; 12, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 17, 21; 17, 22; 21, 23; 22, 24; 22, 25
def get_deffacts(self): """Return the existing deffacts sorted by the internal order""" return sorted(self._get_by_type(DefFacts), key=lambda d: d.order)
0, module; 1, function_definition; 2, function_name:json_dumps; 3, parameters; 4, block; 5, identifier:self; 6, identifier:data; 7, expression_statement; 8, return_statement; 9, comment:""" Standardized json.dumps function with separators and sorted keys set Args: data (dict or list): data ...
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; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 17, 23; 17, 24; 17, 25; 22, 26; 22, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 25, 33; 27, 34; 27, 35; 31, 36; 31, 37; 34, 38; 35, 39
def json_dumps(self, data): """ Standardized json.dumps function with separators and sorted keys set Args: data (dict or list): data to be dumped Returns: string: json """ return json.dumps( data, separators=(',', ':'), ...
0, module; 1, function_definition; 2, function_name:create_waveform_generator; 3, parameters; 4, block; 5, identifier:variable_params; 6, identifier:data; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, comment:# figure out what generator to use based on the approx...
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; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 10, 25; 12, 26; 12, 27; 13, 28; 16, 29; 17, 30; 17, 31; 17, 32; 18, 33; 19, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 31, 42; 31, 43; 32, 44; 3...
def create_waveform_generator(variable_params, data, recalibration=None, gates=None, **static_params): """Creates a waveform generator for use with a model. Parameters ---------- variable_params : list of str The names of the parameter...
0, module; 1, function_definition; 2, function_name:rst_dict_table; 3, parameters; 4, block; 5, identifier:dict_; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, comment:# apply formatting; 13, expression_statement; 14, expr...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 6, 30; 6, 31; 7, 32; 7, 33; 8, 34; 8, 35; 9, 36; 9, 37; 10, 38; 11, 39; 13, 40; 14, 41; 16, 42; 17, 43; 18, 44; 18, 45; 20, 46...
def rst_dict_table(dict_, key_format=str, val_format=str, header=None, sort=True): """Returns an RST-formatted table of keys and values from a `dict` Parameters ---------- dict_ : dict data to display in table key_format : callable callable function with which to ...
0, module; 1, function_definition; 2, function_name:read_transforms_from_config; 3, parameters; 4, block; 5, identifier:cp; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:section; 12, string:"transforms"; 13, comment:"""Returns a list of Py...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 14, 19; 14, 20; 16, 21; 16, 22; 17, 23; 17, 24; 17, 25; 18, 26; 18, 27; 21, 28; 21, 29; 22, 30; 23, 31; 24, 32; 25, 33; 27, 34; 31, 35; 31, 36; 32, 37; 32, 38; 33, 39; 33, 40; 36, 41; 36, 42; 38, 43; 38...
def read_transforms_from_config(cp, section="transforms"): """Returns a list of PyCBC transform instances for a section in the given configuration file. If the transforms are nested (i.e., the output of one transform is the input of another), the returned list will be sorted by the order of the nes...
0, module; 1, function_definition; 2, function_name:samples_from_cli; 3, parameters; 4, block; 5, identifier:self; 6, identifier:opts; 7, default_parameter; 8, dictionary_splat_pattern; 9, expression_statement; 10, if_statement; 11, comment:# parse optional arguments; 12, expression_statement; 13, 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; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 10, 21; 10, 22; 12, 23; 13, 24; 14, 25; 15, 26; 20, 27; 20, 28; 21, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 29, ...
def samples_from_cli(self, opts, parameters=None, **kwargs): """Reads samples from the given command-line options. Parameters ---------- opts : argparse Namespace The options with the settings to use for loading samples (the sort of thing returned by ``ArgumentPa...
0, module; 1, function_definition; 2, function_name:data_from_cli; 3, parameters; 4, block; 5, identifier:opts; 6, expression_statement; 7, comment:# get gates to apply; 8, expression_statement; 9, expression_statement; 10, comment:# get strain time series; 11, expression_statement; 12, expression_statement; 13, commen...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 6, 30; 8, 31; 9, 32; 11, 33; 12, 34; 14, 35; 14, 36; 17, 37; 17, 38; 17, 39; 17, 40; 20, 41; 21, 42; 22, 43; 23, 44; 24, 45; 2...
def data_from_cli(opts): """Loads the data needed for a model from the given command-line options. Gates specifed on the command line are also applied. Parameters ---------- opts : ArgumentParser parsed args Argument options parsed from a command line string (the sort of thing retur...
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, try_statement; 11, identifier:axis; 12, unary_operator; 13, identifier:kind; 14, string; 15, identifier:order; 16, None; 1...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 10, 18; 10, 19; 12, 20; 14, 21; 18, 22; 19, 23; 19, 24; 22, 25; 24, 26; 24, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 28, 33; 28, 34; 29, 35; 29, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 32, 42; 32, 43; 33...
def sort(self, axis=-1, kind='quicksort', order=None): """Sort an array, in-place. This function extends the standard numpy record array in-place sort to allow the basic use of Field array virtual fields. Only a single field is currently supported when referencing a virtual field. ...
0, module; 1, function_definition; 2, function_name:emit_containers; 3, parameters; 4, block; 5, identifier:self; 6, identifier:containers; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, identifier:verbose; 13, True; 14, comment:""" Emits ...
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; 11, 18; 11, 19; 15, 20; 15, 21; 16, 22; 16, 23; 18, 24; 19, 25; 21, 26; 21, 27; 23, 28; 23, 29; 23, 30; 24, 31; 25, 32; 27, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 32, 43; ...
def emit_containers(self, containers, verbose=True): """ Emits the task definition and sorts containers by name :param containers: List of the container definitions :type containers: list of dict :param verbose: Print out newlines and indented JSON :type verbose: bool ...
0, module; 1, function_definition; 2, function_name:sort_completions; 3, parameters; 4, block; 5, identifier:completions_gen; 6, expression_statement; 7, import_from_statement; 8, function_definition; 9, return_statement; 10, comment:""" sorts the completions """; 11, dotted_name; 12, dotted_name; 13, function_name:_ge...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 11, 17; 11, 18; 12, 19; 14, 20; 15, 21; 15, 22; 15, 23; 15, 24; 16, 25; 16, 26; 21, 27; 22, 28; 23, 29; 23, 30; 24, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 31, 40; 31, 41; 33, 42; 33, 43; 3...
def sort_completions(completions_gen): """ sorts the completions """ from knack.help import REQUIRED_TAG def _get_weight(val): """ weights the completions with required things first the lexicographically""" priority = '' if val.display_meta and val.display_meta.startswith(REQUIRED_T...
0, module; 1, function_definition; 2, function_name:attr_list; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:label; 13, None; 14, identifier:kwargs; 15, None; 16, identif...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 5, 12; 5, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 10, 21; 11, 22; 19, 23; 19, 24; 20, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 26, 31; 27, 32; 30, 33; 30, 34; 30, 35
def attr_list(label=None, kwargs=None, attributes=None): """Return assembled DOT attribute list string. Sorts ``kwargs`` and ``attributes`` if they are plain dicts (to avoid unpredictable order from hash randomization in Python 3 versions). >>> attr_list() '' >>> attr_list('spam spam', kwargs...
0, module; 1, function_definition; 2, function_name:mapping_items; 3, parameters; 4, block; 5, identifier:mapping; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:_iteritems; 11, attribute; 12, comment:"""Return an iterator over the ``mapping`` items, sort if it's a p...
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; 9, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 15, 21; 15, 22; 18, 23; 18, 24; 20, 25; 22, 26; 24, 27; 25, 28; 25, 29; 29, 30; 30, 31; 30, 32; 32, 33; 33, 34; 33, 35; 35, 36
def mapping_items(mapping, _iteritems=_compat.iteritems): """Return an iterator over the ``mapping`` items, sort if it's a plain dict. >>> list(mapping_items({'spam': 0, 'ham': 1, 'eggs': 2})) [('eggs', 2), ('ham', 1), ('spam', 0)] >>> from collections import OrderedDict >>> list(mapping_items(Ord...
0, module; 1, function_definition; 2, function_name:convert_tensor_to_probability_map; 3, parameters; 4, block; 5, identifier:scope; 6, identifier:operator; 7, identifier:container; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, if_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; 11, 19; 11, 20; 11, 21; 12, 22; 13, 23; 13, 24; 13, 25; 13, 26; 14, 27; 15, 28; 16, 29; 16, 30; 17, 31; 17, 32; 18, 33; 18, 34; 19, 35; 19, 36; 20, 37; 20, 38; 21, 39; 22, 40; 22, 41; 23, 42; 23, 43; 2...
def convert_tensor_to_probability_map(scope, operator, container): ''' This converter tries to convert a special operator 'TensorToProbabilityMap' into a sequence of some ONNX operators. Those operators are used to create a dictionary in which keys are class labels and values are the associated probabil...
0, module; 1, function_definition; 2, function_name:group_and_sort_nodes; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, comment:""" Groups and then sorts the nodes according to the criteria passed into the Plot constructor. """; 9, boolean_operator; 10...
0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 7, 12; 9, 13; 9, 14; 10, 15; 11, 16; 11, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 15, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 28, 42; 29, 43;...
def group_and_sort_nodes(self): """ Groups and then sorts the nodes according to the criteria passed into the Plot constructor. """ if self.node_grouping and not self.node_order: if self.group_order == "alphabetically": self.nodes = [ ...