nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:previous; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, if_statement; 9, return_statement; 10, comment:""" Gets the previous page, respecting sort order """; 11, comparison_operator:self._order_by == 'oldest'; 12, block; 13,... | 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; 9, 15; 11, 16; 11, 17; 12, 18; 13, 19; 13, 20; 14, 21; 16, 22; 16, 23; 17, 24; 18, 25; 19, 26; 19, 27; 20, 28; 21, 29; 25, 30; 25, 31; 29, 32; 29, 33 | def previous(self):
""" Gets the previous page, respecting sort order """
if self._order_by == 'oldest':
return self.older
if self._order_by == 'newest':
return self.newer
return None |
0, module; 1, function_definition; 2, function_name:next; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, if_statement; 9, return_statement; 10, comment:""" Gets the next page, respecting sort order """; 11, comparison_operator:self._order_by == 'oldest'; 12, block; 13, compari... | 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; 9, 15; 11, 16; 11, 17; 12, 18; 13, 19; 13, 20; 14, 21; 16, 22; 16, 23; 17, 24; 18, 25; 19, 26; 19, 27; 20, 28; 21, 29; 25, 30; 25, 31; 29, 32; 29, 33 | def next(self):
""" Gets the next page, respecting sort order """
if self._order_by == 'oldest':
return self.newer
if self._order_by == 'newest':
return self.older
return None |
0, module; 1, function_definition; 2, function_name:newest; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, if_statement; 9, return_statement; 10, comment:""" Gets the newest entry in the view, regardless of sort order """; 11, comparison_operator:self._order_by == 'newest'; 12... | 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; 9, 15; 11, 16; 11, 17; 12, 18; 13, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 21, 31; 23, 32; 23, 33; 27, 34; 27, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41; 41, 42; 41, 43; ... | def newest(self):
""" Gets the newest entry in the view, regardless of sort order """
if self._order_by == 'newest':
return self.first
if self._order_by == 'oldest':
return self.last
return max(self.entries, key=lambda x: (x.date, x.id)) |
0, module; 1, function_definition; 2, function_name:oldest; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, if_statement; 9, return_statement; 10, comment:""" Gets the oldest entry in the view, regardless of sort order """; 11, comparison_operator:self._order_by == 'newest'; 12... | 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; 9, 15; 11, 16; 11, 17; 12, 18; 13, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 21, 31; 23, 32; 23, 33; 27, 34; 27, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41; 41, 42; 41, 43; ... | def oldest(self):
""" Gets the oldest entry in the view, regardless of sort order """
if self._order_by == 'newest':
return self.last
if self._order_by == 'oldest':
return self.first
return min(self.entries, key=lambda x: (x.date, -x.id)) |
0, module; 1, function_definition; 2, function_name:sort_dataframe_cols; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# get the group for each column; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# put names first; ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 6, 27; 8, 28; 9, 29; 10, 30; 11, 31; 13, 32; 13, 33; 14, 34; 15, 35; 17, 36; 17, 37; 19, 38; 19, 39; 19, 40; 21, 41; 23, 42; 23, 43; 25, 44; 26, 45... | def sort_dataframe_cols(self):
"""
Sort self.df so that self.name is the first column,
and the rest of the columns are sorted by group.
"""
# get the group for each column
cols = self.df.columns
groups = list(map(lambda x: self.data_model.get_group_for_col(self.dt... |
0, module; 1, function_definition; 2, function_name:sort_diclist; 3, parameters; 4, block; 5, identifier:undecorated; 6, identifier:sort_on; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""
Sort a list of dictionaries by the value in each
dictionar... | 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; 17, 23; 17, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 22, 32; 27, 33; 27, 34; 29, 35; 29, 36; 29, 37; 31, 38; 31, 39; 32, 40; 32, 41; 35, 42; 35, 43... | def sort_diclist(undecorated, sort_on):
"""
Sort a list of dictionaries by the value in each
dictionary for the sorting key
Parameters
----------
undecorated : list of dicts
sort_on : str, numeric
key that is present in all dicts to sort on
Returns
---------
ordered lis... |
0, module; 1, function_definition; 2, function_name:process_data_for_mean; 3, parameters; 4, block; 5, identifier:data; 6, identifier:direction_type_key; 7, expression_statement; 8, expression_statement; 9, comment:# data model 2.5; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_st... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 7, 17; 8, 18; 10, 19; 10, 20; 10, 21; 11, 22; 12, 23; 13, 24; 15, 25; 15, 26; 15, 27; 16, 28; 18, 29; 18, 30; 19, 31; 19, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 27, 40; 27, 41; 28, 42; 28, 43; 28,... | def process_data_for_mean(data, direction_type_key):
"""
takes list of dicts with dec and inc as well as direction_type if possible or method_codes and sorts the data into lines and planes and process it for fisher means
@param: data - list of dicts with dec inc and some manner of PCA type info
@param:... |
0, module; 1, function_definition; 2, function_name:main; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, comment:#; 15, comment:# rea... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 5, 24; 6, 25; 7, 26; 8, 27; 8, 28; 9, 29; 9, 30; 10, 31; 10, 32; 11, 33; 12, 34; 13, 35; 17, 36; 18, 37; 18, 38; 20, 39; 21, 40; 21, 41; 21, 42; 23, 43; 23, 44; 23, 45;... | def main():
"""
NAME
sort_specimens.py
DESCRIPTION
Reads in a pmag_specimen formatted file and separates it into different components (A,B...etc.)
SYNTAX
sort_specimens.py [-h] [command line options]
INPUT
takes pmag_specimens.txt formatted input file
OPTIONS... |
0, module; 1, function_definition; 2, function_name:read_magic_file; 3, parameters; 4, block; 5, identifier:self; 6, identifier:path; 7, identifier:sort_by_this_name; 8, expression_statement; 9, expression_statement; 10, try_statement; 11, comment:# fin=open(path,'r'); 12, comment:# fin.readline(); 13, 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; 4, 18; 4, 19; 8, 20; 9, 21; 10, 22; 10, 23; 13, 24; 14, 25; 15, 26; 16, 27; 16, 28; 16, 29; 18, 30; 19, 31; 21, 32; 21, 33; 22, 34; 23, 35; 23, 36; 24, 37; 24, 38; 25, 39; 25, 40; 26, 41; 26, 42; 28, 43; 28, 44... | def read_magic_file(self, path, sort_by_this_name):
"""
reads a magic formated data file from path and sorts the keys
according to sort_by_this_name
Parameters
----------
path : path to file to read
sort_by_this_name : variable to sort data by
"""
... |
0, module; 1, function_definition; 2, function_name:plot_teq; 3, parameters; 4, block; 5, identifier:fignum; 6, identifier:araiblock; 7, identifier:s; 8, identifier:pars; 9, expression_statement; 10, expression_statement; 11, comment:# make the stereonet; 12, expression_statement; 13, expression_statement; 14, expressi... | 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; 9, 32; 10, 33; 12, 34; 13, 35; 14, 36; 15, 37; 15, 38; 15, 39; 15, 40; 16, 41; 17, 42; 17, 43; 17, 44; 18, 45; 1... | def plot_teq(fignum, araiblock, s, pars):
"""
plots directions of pTRM steps and zero field steps
Parameters
__________
fignum : figure number for matplotlib object
araiblock : nested list of data from pmag.sortarai()
s : specimen name
pars : default is "",
otherwise is diction... |
0, module; 1, function_definition; 2, function_name:_sort_records_map; 3, parameters; 4, block; 5, identifier:records; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, expression_statement; 14, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 6, 26; 7, 27; 8, 28; 9, 29; 10, 30; 11, 31; 11, 32; 11, 33; 12, 34; 13, 35; 14, 36; 15, 37; 16, 38; 17, 39; 18, 40; 19, 41; 20, 42; 21, 43; 21, 44; 22, 45... | def _sort_records_map(records):
"""Map function sorting records.
Converts records to KeyValue protos, sorts them by key and writes them
into new GCS file. Creates _OutputFile entity to record resulting
file name.
Args:
records: list of records which are serialized KeyValue protos.
"""
ctx = context.... |
0, module; 1, function_definition; 2, function_name:find_all_by_mapreduce_state; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:mapreduce_state; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, while_statement; 11, comment:"""Find all shard states for given mapreduce.
Args:... | 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; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 15, 24; 15, 25; 15, 26; 17, 27; 17, 28; 21, 29; 21, 30; 22, 31; 22, 32; 25, 33; 26, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 30, 40; 31, 41; 32, 42; 32, 43... | def find_all_by_mapreduce_state(cls, mapreduce_state):
"""Find all shard states for given mapreduce.
Args:
mapreduce_state: MapreduceState instance
Yields:
shard states sorted by shard id.
"""
keys = cls.calculate_keys_by_mapreduce_state(mapreduce_state)
i = 0
while i < len(key... |
0, module; 1, function_definition; 2, function_name:calculate_keys_by_mapreduce_state; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:mapreduce_state; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""Calculate all shard states keys for... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 15, 23; 15, 24; 17, 25; 17, 26; 18, 27; 18, 28; 22, 29; 26, 30; 27, 31; 28, 32; 30, 33; 30, 34; 31, 35; 31, 36; 32, 37; 32, 38; 33, 39; 33, 40; 36, 41; 36, 42; 37, 43; ... | def calculate_keys_by_mapreduce_state(cls, mapreduce_state):
"""Calculate all shard states keys for given mapreduce.
Args:
mapreduce_state: MapreduceState instance
Returns:
A list of keys for shard states, sorted by shard id.
The corresponding shard states may not exist.
"""
if m... |
0, module; 1, function_definition; 2, function_name:split; 3, parameters; 4, comment:# pylint: disable=g-doc-args; 5, block; 6, identifier:cls; 7, identifier:n; 8, identifier:contiguous; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, if_statement; ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 5, 18; 9, 19; 9, 20; 10, 21; 10, 22; 11, 23; 12, 24; 12, 25; 13, 26; 14, 27; 14, 28; 14, 29; 15, 30; 16, 31; 16, 32; 17, 33; 18, 34; 18, 35; 18, 36; 20, 37; 20, 38; 24, 39; 24, 40; 25, 41; 26, 42; 26, 43; 27, 4... | def split(cls,
n,
contiguous,
can_query=itertools.chain(itertools.repeat(True, 50),
itertools.repeat(False)).next,
_app=None):
# pylint: disable=g-doc-args
"""Splits the complete NamespaceRange into n equally-sized NamespaceRa... |
0, module; 1, function_definition; 2, function_name:_parse_raw_members; 3, parameters; 4, block; 5, identifier:self; 6, identifier:leaderboard_name; 7, identifier:members; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, if_statement; 12, if_statement; 13, identifier:members_only; 14, Fa... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 8, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 12, 19; 12, 20; 12, 21; 16, 22; 18, 23; 20, 24; 21, 25; 23, 26; 24, 27; 25, 28; 26, 29; 26, 30; 27, 31; 27, 32; 28, 33; 29, 34; 30, 35; 30, 36; 31, 37; 31, 38; 32, 39; 32, 40; 32, 41; 34, 42; 34, 43; ... | def _parse_raw_members(
self, leaderboard_name, members, members_only=False, **options):
'''
Parse the raw leaders data as returned from a given leader board query. Do associative
lookups with the member to rank, score and potentially sort the results.
@param leaderboard_nam... |
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, defaul... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 3, 18; 3, 19; 3, 20; 3, 21; 3, 22; 3, 23; 3, 24; 3, 25; 3, 26; 3, 27; 3, 28; 3, 29; 3, 30; 3, 31; 3, 32; 3, 33; 3, 34; 3, 35; 3, 36; 3, 37; 3, 38; 3, 39; 3, 40; 3, 41; 3, 42; 3, 43; 3, 44; 3, 45; 3, 46; 3, 47; ... | def search(title=None, artist=None, artist_id=None, combined=None, description=None, style=None, mood=None,
results=None, start=None, max_tempo=None, min_tempo=None,
max_duration=None, min_duration=None, max_loudness=None, min_loudness=None,
artist_max_familiarity=None, artist_min_famil... |
0, module; 1, function_definition; 2, function_name:list_campaigns; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:kwargs; 13, comment:"""List all update c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 19, 26; 19, 27; 21, 28; 21, 29; 23, 30; 23, 31; 25, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 29, 42; 30, 43; ... | def list_campaigns(self, **kwargs):
"""List all update campaigns.
:param int limit: number of campaigns to retrieve
:param str order: sort direction of campaigns when ordered by creation time (desc|asc)
:param str after: get campaigns after given campaign ID
:param dict filters:... |
0, module; 1, function_definition; 2, function_name:list_campaign_device_states; 3, parameters; 4, block; 5, identifier:self; 6, identifier:campaign_id; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, return... | 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; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 13, 20; 16, 21; 16, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 24, 33; 24, 34; 25, 35; 25, 36; 28, 37; 28, 38; 30, 39; 30, 40; 30, 41; 31, 42; 31, 43; 3... | def list_campaign_device_states(self, campaign_id, **kwargs):
"""List campaign devices status.
:param str campaign_id: Id of the update campaign (Required)
:param int limit: number of devices state to retrieve
:param str order: sort direction of device state when ordered by creation tim... |
0, module; 1, function_definition; 2, function_name:list_firmware_manifests; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:kwargs; 13, comment:"""List all... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 19, 26; 19, 27; 21, 28; 21, 29; 23, 30; 23, 31; 25, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 29, 42; 30, 43; ... | def list_firmware_manifests(self, **kwargs):
"""List all manifests.
:param int limit: number of manifests to retrieve
:param str order: sort direction of manifests when ordered by time. 'desc' or 'asc'
:param str after: get manifests after given `image_id`
:param dict filters: D... |
0, module; 1, function_definition; 2, function_name:merge_bams; 3, parameters; 4, block; 5, identifier:self; 6, identifier:input_bams; 7, identifier:merged_bam; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, comment:# Handle more i... | 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; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 11, 31; 11, 32; 12, 33; 13, 34; 13, 35; 15, 36; 15, 37; 16, 38; 17, 39; 18, 40; 19, 41; 20, 42; 21, 43; 22, 44; 23, 45... | def merge_bams(self, input_bams, merged_bam, in_sorted="TRUE", tmp_dir=None):
"""
Combine multiple files into one.
The tmp_dir parameter is important because on poorly configured
systems, the default can sometimes fill up.
:param Iterable[str] input_bams: Paths to files to comb... |
0, module; 1, function_definition; 2, function_name:samtools_view; 3, parameters; 4, block; 5, identifier:self; 6, identifier:file_name; 7, identifier:param; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:postpend; 13, string:""; 14, comment:"""
Run... | 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; 11, 16; 15, 17; 15, 18; 16, 19; 16, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30; 22, 31; 22, 32; 26, 33; 26, 34; 29, 35; 29, 36; 35, 37; 35, 38 | def samtools_view(self, file_name, param, postpend=""):
"""
Run samtools view, with flexible parameters and post-processing.
This is used internally to implement the various count_reads functions.
:param str file_name: file_name
:param str param: String of parameters to pass to... |
0, module; 1, function_definition; 2, function_name:sam_conversions; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sam_file; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:dep... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 12, 21; 13, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 21, 29; 24, 30; 24, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 34, 41; 34, 42; 36, 43; 36... | def sam_conversions(self, sam_file, depth=True):
"""
Convert sam files to bam files, then sort and index them for later use.
:param bool depth: also calculate coverage over each position
"""
cmd = self.tools.samtools + " view -bS " + sam_file + " > " + sam_file.replace(".sam", "... |
0, module; 1, function_definition; 2, function_name:bam_conversions; 3, parameters; 4, block; 5, identifier:self; 6, identifier:bam_file; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:dep... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 12, 21; 13, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 21, 29; 24, 30; 24, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 34, 41; 34, 42; 36, 43; 36... | def bam_conversions(self, bam_file, depth=True):
"""
Sort and index bam files for later use.
:param bool depth: also calculate coverage over each position
"""
cmd = self.tools.samtools + " view -h " + bam_file + " > " + bam_file.replace(".bam", ".sam") + "\n"
cmd += self... |
0, module; 1, function_definition; 2, function_name:_checkpoint; 3, parameters; 4, block; 5, identifier:self; 6, identifier:stage; 7, expression_statement; 8, comment:# For null stage, short-circuit and indicate no file write.; 9, comment:# This handles case in which we're timestamping prospectively and; 10, comment:# ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 11, 17; 11, 18; 12, 19; 12, 20; 12, 21; 13, 22; 14, 23; 14, 24; 14, 25; 15, 26; 17, 27; 17, 28; 18, 29; 19, 30; 20, 31; 20, 32; 20, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 25, 40; 26, 41; 26, 42; 29, 43; 3... | def _checkpoint(self, stage):
"""
Decide whether to stop processing of a pipeline. This is the hook
A pipeline can report various "checkpoints" as sort of status markers
that designate the logical processing phase that's just been completed.
The initiation of a pipeline can preo... |
0, module; 1, function_definition; 2, function_name:geolocation_sort; 3, parameters; 4, block; 5, identifier:field_name; 6, identifier:argument; 7, identifier:unit; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, function_definition; 12, return_statement; 13, identifier:mode; 14, None; 15, ide... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 8, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 19, 22; 20, 23; 20, 24; 20, 25; 20, 26; 20, 27; 23, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 31, 39; 33, 40; 36, 41; 36, 42; 38, 43; 3... | def geolocation_sort(field_name, argument, unit, mode=None,
distance_type=None):
"""Sort field factory for geo-location based sorting.
:param argument: Name of URL query string field to parse pin location from.
Multiple locations can be provided. Each location can be either a
... |
0, module; 1, function_definition; 2, function_name:eval_field; 3, parameters; 4, block; 5, identifier:field; 6, identifier:asc; 7, expression_statement; 8, if_statement; 9, comment:"""Evaluate a field for sorting purpose.
:param field: Field definition (string, dict or callable).
:param asc: ``True`` if order... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 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; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 19, 30; 23, 31; 24, 32; 24, 33; 26, 34; 27, 35; 28, 36; 29, 37; 29, 38; 30, 39; 31, 40; 33, 41; 33, 42; 33, 43... | def eval_field(field, asc):
"""Evaluate a field for sorting purpose.
:param field: Field definition (string, dict or callable).
:param asc: ``True`` if order is ascending, ``False`` if descending.
:returns: Dictionary with the sort field query.
"""
if isinstance(field, dict):
if asc:
... |
0, module; 1, function_definition; 2, function_name:default_sorter_factory; 3, parameters; 4, block; 5, identifier:search; 6, identifier:index; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# Get default sorting if sort is not specified.; 11, if_statement; 12, comment:# Parse 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; 4, 17; 4, 18; 4, 19; 7, 20; 8, 21; 9, 22; 11, 23; 11, 24; 11, 25; 13, 26; 15, 27; 16, 28; 16, 29; 18, 30; 19, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 44;... | def default_sorter_factory(search, index):
"""Default sort query factory.
:param query: Search query.
:param index: Index to search in.
:returns: Tuple of (query, URL arguments).
"""
sort_arg_name = 'sort'
urlfield = request.values.get(sort_arg_name, '', type=str)
# Get default sorting... |
0, module; 1, function_definition; 2, function_name:MakeHistFromList; 3, parameters; 4, block; 5, identifier:t; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:name; 12, string; 13, comment:"""Makes a histogram from an unsorted sequen... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 14, 17; 14, 18; 15, 19; 15, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 20, 26; 22, 27; 23, 28; 23, 29; 24, 30; 27, 31; 27, 32 | def MakeHistFromList(t, name=''):
"""Makes a histogram from an unsorted sequence of values.
Args:
t: sequence of numbers
name: string name for this histogram
Returns:
Hist object
"""
hist = Hist(name=name)
[hist.Incr(x) for x in t]
return hist |
0, module; 1, function_definition; 2, function_name:MakePmfFromList; 3, parameters; 4, block; 5, identifier:t; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:name; 14, string; 15, 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; 6, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 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; 26, 33; 26, 34; 27, 35; 27, 36; 30, 37; 31, 38; 31, 39; 34, 40; 34, 41 | def MakePmfFromList(t, name=''):
"""Makes a PMF from an unsorted sequence of values.
Args:
t: sequence of numbers
name: string name for this PMF
Returns:
Pmf object
"""
hist = MakeHistFromList(t)
d = hist.GetDict()
pmf = Pmf(d, name)
pmf.Normalize()
return p... |
0, module; 1, function_definition; 2, function_name:MakeSuiteFromList; 3, parameters; 4, block; 5, identifier:t; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:name; 12, string; 13, comment:"""Makes a suite from an unsorted sequence ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 18, 23; 18, 24; 20, 25; 20, 26; 22, 27; 24, 28; 25, 29; 25, 30 | def MakeSuiteFromList(t, name=''):
"""Makes a suite from an unsorted sequence of values.
Args:
t: sequence of numbers
name: string name for this suite
Returns:
Suite object
"""
hist = MakeHistFromList(t)
d = hist.GetDict()
return MakeSuiteFromDict(d) |
0, module; 1, function_definition; 2, function_name:sort_precursor; 3, parameters; 4, block; 5, identifier:c; 6, identifier:loci; 7, expression_statement; 8, comment:# Original Py 2.7 code; 9, comment:#data_loci = map(lambda (x): [x, loci[x].chr, int(loci[x].start), int(loci[x].end), loci[x].strand, len(c.loci2seq[x])]... | 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; 11, 15; 12, 16; 13, 17; 15, 18; 15, 19; 16, 20; 16, 21; 19, 22; 19, 23; 21, 24; 21, 25; 22, 26; 22, 27; 22, 28; 22, 29; 22, 30; 22, 31; 23, 32; 23, 33; 25, 34; 25, 35; 25, 36; 27, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 30, 43;... | def sort_precursor(c, loci):
"""
Sort loci according to number of sequences mapped there.
"""
# Original Py 2.7 code
#data_loci = map(lambda (x): [x, loci[x].chr, int(loci[x].start), int(loci[x].end), loci[x].strand, len(c.loci2seq[x])], c.loci2seq.keys())
# 2to3 suggested Py 3 rewrite
data_... |
0, module; 1, function_definition; 2, function_name:_merge_similar; 3, parameters; 4, block; 5, identifier:loci; 6, identifier:loci_similarity; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_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; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 12, 22; 12, 23; 13, 24; 14, 25; 15, 26; 17, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 23, 37; 23, 38; 23, 39; 23, 40; 23, 41; 23, 42; 23, 43; 24,... | def _merge_similar(loci, loci_similarity):
"""
Internal function to reduce loci complexity
:param loci: class cluster
:param locilen_sorted: list of loci sorted by size
:return
c: updated class cluster
"""
n_cluster = 0
internal_cluster = {}
clus_seen = {}
loci_sorted = so... |
0, module; 1, function_definition; 2, function_name:_solve_loci_deprecated; 3, parameters; 4, block; 5, identifier:c; 6, identifier:locilen_sorted; 7, identifier:seen_seqs; 8, identifier:filtered; 9, identifier:maxseq; 10, identifier:n_cluster; 11, expression_statement; 12, expression_statement; 13, expression_statemen... | 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; 11, 20; 12, 21; 13, 22; 14, 23; 15, 24; 16, 25; 17, 26; 17, 27; 17, 28; 18, 29; 19, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 24, 37; 24, 38; 25, 39; 25, 40; 26, 41; 26, 42; 28, 43; 28, ... | def _solve_loci_deprecated(c, locilen_sorted, seen_seqs, filtered, maxseq, n_cluster):
"""internal function to reduce loci complexity
The function will read the all loci in a cluster of
sequences and will determine if all loci are part
of the same transcriptional unit(TU) by most-vote locus
or by e... |
0, module; 1, function_definition; 2, function_name:hash_prefix_list_checksum; 3, parameters; 4, block; 5, identifier:self; 6, identifier:threat_list; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, with_statement; 11, return_statement; 12, comment:"""Returns SHA256 checksum for alphabeti... | 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; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 16, 24; 16, 25; 19, 26; 21, 27; 21, 28; 21, 29; 22, 30; 23, 31; 24, 32; 25, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 30, 41; 31, 42; 31, 43;... | def hash_prefix_list_checksum(self, threat_list):
"""Returns SHA256 checksum for alphabetically-sorted concatenated list of hash prefixes"""
q = '''SELECT value FROM hash_prefix
WHERE threat_type=? AND platform_type=? AND threat_entry_type=?
ORDER BY value
'''
... |
0, module; 1, function_definition; 2, function_name:remove_hash_prefix_indices; 3, parameters; 4, block; 5, identifier:self; 6, identifier:threat_list; 7, identifier:indices; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, with_statement; 13, comment:"""Remove r... | 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; 12, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 18, 26; 22, 27; 24, 28; 24, 29; 25, 30; 26, 31; 26, 32; 26, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43;... | def remove_hash_prefix_indices(self, threat_list, indices):
"""Remove records matching idices from a lexicographically-sorted local threat list."""
batch_size = 40
q = '''DELETE FROM hash_prefix
WHERE threat_type=? AND platform_type=? AND threat_entry_type=? AND value IN ({})
... |
0, module; 1, function_definition; 2, function_name:has_equal_value; 3, parameters; 4, block; 5, identifier:state; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, comment:# First of all, check if number of rows correspond; 13, expression... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 10, 24; 10, 25; 11, 26; 11, 27; 13, 28; 14, 29; 14, 30; 14, 31; 15, 32; 15, 33; 15, 34; 16, 35; 24, 36; 25, 37; 26, 38; 26, 39; 27, 40; 28, 41; 28, 42; 29, 43; 30, 44; ... | def has_equal_value(state, ordered=False, ndigits=None, incorrect_msg=None):
"""Verify if a student and solution query result match up.
This function must always be used after 'zooming' in on certain columns or records (check_column, check_row or check_result).
``has_equal_value`` then goes over all column... |
0, module; 1, function_definition; 2, function_name:sorted_releases; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""
Releases sorted by version.
"""; 11, assignment; 12, call; 13, list_comprehens... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 24, 33; 24, 34; 29, 35; 29, 36; 32, 37; 32, 38; 36, 39; 39, 40; 39, 41 | def sorted_releases(self):
"""
Releases sorted by version.
"""
releases = [(parse_version(release.version), release)
for release in self.releases]
releases.sort(reverse=True)
return [release[1] for release in releases] |
0, module; 1, function_definition; 2, function_name:image_position_stochastic; 3, parameters; 4, block; 5, identifier:self; 6, identifier:source_x; 7, identifier:source_y; 8, identifier:kwargs_lens; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, 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; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 11, 27; 12, 28; 12, 29; 13, 30; 13, 31; 14, 32; 14, 33; 15, 34; 15, 35; 16, 36; 17, 37; 18, 38; 18, 39; 18, 40; 19, 41; 20, 42; 20, 43; 21, 44; ... | def image_position_stochastic(self, source_x, source_y, kwargs_lens, search_window=10,
precision_limit=10**(-10), arrival_time_sort=True, x_center=0,
y_center=0, num_random=1000, verbose=False):
"""
Solves the lens equation stochastical... |
0, module; 1, function_definition; 2, function_name:image_position_from_source; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sourcePos_x; 7, identifier:sourcePos_y; 8, identifier:kwargs_lens; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; ... | 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; 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; 9, 47; ... | def image_position_from_source(self, sourcePos_x, sourcePos_y, kwargs_lens, min_distance=0.1, search_window=10,
precision_limit=10**(-10), num_iter_max=100, arrival_time_sort=True,
initial_guess_cut=True, verbose=False, x_center=0, y_center=0, num_ra... |
0, module; 1, function_definition; 2, function_name:count; 3, parameters; 4, block; 5, identifier:event_collection; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 9, 24; 10, 25; 10, 26; 11, 27; 11, 28; 12, 29; 12, 30; 13, 31; 13, 32; 14, 33; 15, 34; 16, 35; 34, 36; 34, 37; 35, 38; 35, 39; 38, 40; 38, 41; 39, 42; 39, 43; 39, 44; 3... | def count(event_collection, timeframe=None, timezone=None, interval=None, filters=None, group_by=None, order_by=None,
max_age=None, limit=None):
""" Performs a count query
Counts the number of events that meet the given criteria.
:param event_collection: string, the name of the collection to que... |
0, module; 1, function_definition; 2, function_name:sum; 3, parameters; 4, block; 5, identifier:event_collection; 6, identifier:target_property; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_param... | 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; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 11, 27; 12, 28; 12, 29; 13, 30; 13, 31; 14, 32; 14, 33; 15, 34; 16, 35; 17, 36; 35, 37; 35, 38; 36, 39; 36, 40; 39, 41; 39, 42; 40, 43; 40, 44; ... | def sum(event_collection, target_property, timeframe=None, timezone=None, interval=None, filters=None,
group_by=None, order_by=None, max_age=None, limit=None):
""" Performs a sum query
Adds the values of a target property for events that meet the given criteria.
:param event_collection: string, th... |
0, module; 1, function_definition; 2, function_name:multi_analysis; 3, parameters; 4, block; 5, identifier:event_collection; 6, identifier:analyses; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_p... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, 15; 4, 16; 4, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 11, 27; 12, 28; 12, 29; 13, 30; 13, 31; 14, 32; 14, 33; 15, 34; 16, 35; 17, 36; 35, 37; 35, 38; 36, 39; 36, 40; 39, 41; 39, 42; 40, 43; 40, 44; ... | def multi_analysis(event_collection, analyses, timeframe=None, interval=None, timezone=None,
filters=None, group_by=None, order_by=None, max_age=None, limit=None):
""" Performs a multi-analysis query
Returns a dictionary of analysis results.
:param event_collection: string, the name of ... |
0, module; 1, function_definition; 2, function_name:select_unique; 3, parameters; 4, block; 5, identifier:self; 6, identifier:event_collection; 7, identifier:target_property; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, defau... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 4, 16; 4, 17; 4, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 14, 31; 14, 32; 15, 33; 15, 34; 16, 35; 17, 36; 18, 37; 36, 38; 36, 39; 37, 40; 37, 41; 39, 42; 39, 43; 40, 44;... | def select_unique(self, event_collection, target_property, timeframe=None, timezone=None, interval=None,
filters=None, group_by=None, order_by=None, max_age=None, limit=None):
""" Performs a select unique query
Returns an array of the unique values of a target property for events ... |
0, module; 1, function_definition; 2, function_name:check_voltage; 3, parameters; 4, block; 5, identifier:grid; 6, identifier:mode; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, comment:""" Checks for voltage stability issues at all nodes for MV or LV gri... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 9, 17; 10, 18; 10, 19; 11, 20; 13, 21; 13, 22; 14, 23; 14, 24; 16, 25; 16, 26; 16, 27; 16, 28; 16, 29; 17, 30; 17, 31; 19, 32; 20, 33; 20, 34; 24, 35; 25, 36; 26, 37; 28, 38; 29, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31... | def check_voltage(grid, mode):
""" Checks for voltage stability issues at all nodes for MV or LV grid
Parameters
----------
grid : GridDing0
Grid identifier.
mode : str
Kind of grid ('MV' or 'LV').
Returns
-------
:any:`list` of :any:`GridDing0`
List of critical... |
0, module; 1, function_definition; 2, function_name:compute_savings_list; 3, parameters; 4, block; 5, identifier:self; 6, identifier:graph; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Compute Clarke and Wright savings list
A... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 9, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 17, 26; 17, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 24, 33; 24, 34; 26, 35; 26, 36; 26, 37; 27, 38; 27, 39; 28, 40; 30, 41; 30, 42; 32, 43; 32... | def compute_savings_list(self, graph):
"""Compute Clarke and Wright savings list
A saving list is a matrix containing the saving amount S between i and j
S is calculated by S = d(0,i) + d(0,j) - d(i,j) (CLARKE; WRIGHT, 1964)
Args
----
graph: :networkx:`NetworkX... |
0, module; 1, function_definition; 2, function_name:ask_choice; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, typed_default_parameter; 9, identifier:Any; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement; 15, for_state... | 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; 5, 17; 5, 18; 5, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 8, 26; 10, 27; 11, 28; 11, 29; 12, 30; 13, 31; 14, 32; 15, 33; 15, 34; 15, 35; 16, 36; 17, 37; 18, 38; 18, 39; 19, 40; 20, 41; 21, 42; 23, 43; 25, 44; 28,... | def ask_choice(
*prompt: Token, choices: List[Any], func_desc: Optional[FuncDesc] = None
) -> Any:
"""Ask the user to choose from a list of choices.
:return: the selected choice
``func_desc`` will be called on every list item for displaying
and sorting the list. If not given, will default to
t... |
0, module; 1, function_definition; 2, function_name:list; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, return_statement; 11, comment:"""
List all backups as WorkspaceBackup objects, sorted descending by lastmod.
... | 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; 10, 17; 12, 18; 12, 19; 14, 20; 14, 21; 15, 22; 16, 23; 16, 24; 21, 25; 22, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 29, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43; 3... | def list(self):
"""
List all backups as WorkspaceBackup objects, sorted descending by lastmod.
"""
backups = []
for d in glob(join(self.backup_directory, '*')):
backups.append(WorkspaceBackup.from_path(d))
backups.sort(key=lambda b: b.lastmod, reverse=True)
... |
0, module; 1, function_definition; 2, function_name:retrieve; 3, parameters; 4, block; 5, identifier:self; 6, identifier:operation; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:field; 13, None; 14, comment:"""Retrieve a position in this c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 15, 20; 15, 21; 16, 22; 16, 23; 18, 24; 19, 25; 19, 26; 21, 27; 21, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 32, 40; 32, 41; 39, 42; 39, 43; ... | def retrieve(self, operation, field=None):
"""Retrieve a position in this collection.
:param operation: Name of an operation
:type operation: :class:`Operation`
:param field: Name of field for sort order
:type field: str
:return: The position for this operation
:... |
0, module; 1, function_definition; 2, function_name:query; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, if_... | 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; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 10, 23; 11, 24; 11, 25; 11, 26; 12, 27; 13, 28; 13, 29; 14, 30; 15, 31; 15, 32; 15, 33; 24, 34; 24, 35; 25, 36; 26, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 30, 43; 30, 44;... | def query(self, properties=None, criteria=None, distinct_key=None,
**kwargs):
"""
Convenience method for database access. All properties and criteria
can be specified using simplified names defined in Aliases. You can
use the supported_properties property to get the list ... |
0, module; 1, function_definition; 2, function_name:sort_rows; 3, parameters; 4, block; 5, identifier:self; 6, identifier:rows; 7, identifier:section; 8, expression_statement; 9, comment:#print("@@ SORT ROWS:\n{}".format(rows)); 10, comment:# Section-specific determination of sort key; 11, if_statement; 12, if_statemen... | 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; 11, 14; 11, 15; 11, 16; 12, 17; 12, 18; 14, 19; 14, 20; 15, 21; 16, 22; 17, 23; 17, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 22, 31; 25, 32; 26, 33; 26, 34; 28, 35; 28, 36; 30, 37; 30, 38; 31, 39; 32, 40; 32, 41; 35, 42; 35, 43... | def sort_rows(self, rows, section):
"""Sort the rows, as appropriate for the section.
:param rows: List of tuples (all same length, same values in each position)
:param section: Name of section, should match const in Differ class
:return: None; rows are sorted in-place
"""
... |
0, module; 1, function_definition; 2, function_name:get_free_crypto_domains; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, if_statement; 10, comment:# We determine the maximum number of crypto domains independently; 11, comment:# of the partitions, becau... | 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; 6, 25; 6, 26; 7, 27; 8, 28; 8, 29; 9, 30; 9, 31; 9, 32; 15, 33; 17, 34; 17, 35; 17, 36; 18, 37; 20, 38; 21, 39; 21, 40; 21, 41; 22, 42; 23, 43; 24, 44; 28, 45; 2... | def get_free_crypto_domains(self, crypto_adapters=None):
"""
Return a list of crypto domains that are free for usage on a list of
crypto adapters in this CPC.
A crypto domain is considered free for usage if it is not assigned to
any defined partition of this CPC in access mode '... |
0, module; 1, function_definition; 2, function_name:topological; 3, parameters; 4, block; 5, identifier:nodes; 6, expression_statement; 7, expression_statement; 8, function_definition; 9, while_statement; 10, return_statement; 11, comment:"""Return nodes in a topological order."""; 12, assignment; 13, function_name:dfs... | 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; 17, 27; 19, 28; 19, 29; 19, 30; 20, 31; 20, 32; 20, 33; 22, 34; 23, 35; 24, 36; 24, 37; 24, 38; 25, 39; 26, 40; 27, 41; 31, 42; 31, 43; 32... | def topological(nodes):
"""Return nodes in a topological order."""
order, enter, state = deque(), set(nodes), {}
def dfs(node):
"""Visit nodes in depth-first order."""
state[node] = GRAY
for parent in nodes.get(node, ()):
color = state.get(parent, None)
if co... |
0, module; 1, function_definition; 2, function_name:get_teachers_sorted; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, for_statement; 11, expression_statement; 12, comment:# Hack to return QuerySet in given order; 13, expres... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 6, 18; 7, 19; 8, 20; 9, 21; 9, 22; 9, 23; 10, 24; 10, 25; 10, 26; 11, 27; 13, 28; 14, 29; 15, 30; 16, 31; 17, 32; 19, 33; 19, 34; 20, 35; 20, 36; 23, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 29, 44; ... | def get_teachers_sorted(self):
"""Get teachers sorted by last name.
This is used for the announcement request page.
"""
teachers = self.get_teachers()
teachers = [(u.last_name, u.first_name, u.id) for u in teachers]
for t in teachers:
if t is None or t[0] is... |
0, module; 1, function_definition; 2, function_name:sorted_bits; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, generic_type; 8, expression_statement; 9, return_statement; 10, identifier:List; 11, type_parameter; 12, comment:"""Return list of bit items sorted by position."""; 13, call; 14, type; 15, identifie... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 7, 10; 7, 11; 8, 12; 9, 13; 11, 14; 13, 15; 13, 16; 14, 17; 16, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 25, 30; 25, 31; 26, 32; 27, 33; 28, 34; 28, 35; 30, 36; 31, 37; 31, 38 | def sorted_bits(self) -> List[Tuple[str, int]]:
"""Return list of bit items sorted by position."""
return sorted(self.bit.items(), key=lambda x: x[1]) |
0, module; 1, function_definition; 2, function_name:sorted_enums; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, generic_type; 8, expression_statement; 9, return_statement; 10, identifier:List; 11, type_parameter; 12, comment:"""Return list of enum items sorted by value."""; 13, call; 14, type; 15, identifier... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 7, 10; 7, 11; 8, 12; 9, 13; 11, 14; 13, 15; 13, 16; 14, 17; 16, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 25, 30; 25, 31; 26, 32; 27, 33; 28, 34; 28, 35; 30, 36; 31, 37; 31, 38 | def sorted_enums(self) -> List[Tuple[str, int]]:
"""Return list of enum items sorted by value."""
return sorted(self.enum.items(), key=lambda x: x[1]) |
0, module; 1, function_definition; 2, function_name:collate; 3, parameters; 4, block; 5, list_splat_pattern; 6, dictionary_splat_pattern; 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; 5, 17; 6, 18; 7, 19; 8, 20; 9, 21; 10, 22; 11, 23; 12, 24; 13, 25; 14, 26; 14, 27; 14, 28; 15, 29; 15, 30; 15, 31; 16, 32; 16, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 24, 42; 24, 43; 25, 44... | def collate(*iterables, **kwargs):
"""Return an iterable ordered collation of the already-sorted items
from each of ``iterables``, compared by kwarg ``key``.
If ``reverse=True`` is passed, iterables must return their results in
descending order rather than ascending.
"""
key = kwargs.pop('key'... |
0, module; 1, function_definition; 2, function_name:order_key_defs; 3, parameters; 4, block; 5, identifier:key_def; 6, expression_statement; 7, expression_statement; 8, comment:# First make sure all defs only reference one usage; 9, for_statement; 10, expression_statement; 11, return_statement; 12, comment:"""
Sort... | 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; 9, 14; 9, 15; 9, 16; 10, 17; 11, 18; 13, 19; 13, 20; 16, 21; 17, 22; 17, 23; 21, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 24, 30; 24, 31; 25, 32; 26, 33; 29, 34; 29, 35; 30, 36; 30, 37; 32, 38; 32, 39; 32, 40; 33, 41; 35, 42; 35, 43; 3... | def order_key_defs(key_def):
"""
Sort a set of key definitions. A key definition that defines more then
one usage type are splitted into as many definitions as the number of
usage types specified. One key definition per usage type.
:param key_def: A set of key definitions
:return: The set of de... |
0, module; 1, function_definition; 2, function_name:wait; 3, parameters; 4, block; 5, identifier:self; 6, identifier:condition_or_value; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, function_definition... | 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; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 13, 28; 14, 29; 14, 30; 14, 31; 14, 32; 15, 33; 17, 34; 18, 35; 18, 36; 18, 37; 22, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, 44; ... | def wait(self, condition_or_value, timeout=None):
"""Wait for the sensor to satisfy a condition.
Parameters
----------
condition_or_value : obj or callable, or seq of objs or callables
If obj, sensor.value is compared with obj. If callable,
condition_or_value(rea... |
0, module; 1, function_definition; 2, function_name:_find_nearest_conn_objects; 3, parameters; 4, block; 5, identifier:network; 6, identifier:node; 7, identifier:branches; 8, expression_statement; 9, comment:# threshold which is used to determine if 2 objects are on the same position (see below for details on usage); 1... | 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; 10, 18; 11, 19; 12, 20; 13, 21; 13, 22; 13, 23; 15, 24; 16, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 23, 32; 23, 33; 23, 34; 23, 35; 23, 36; 23, 37; 23, 38; 23, 39; 23, 40; 23, 41; 23, 42; 23, 43; 23... | def _find_nearest_conn_objects(network, node, branches):
"""Searches all branches for the nearest possible connection object per branch
It picks out 1 object out of 3 possible objects: 2 branch-adjacent stations
and 1 potentially created branch tee on the line (using perpendicular projection).
The resu... |
0, module; 1, function_definition; 2, function_name:mv_voltage_deviation; 3, parameters; 4, block; 5, identifier:network; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statemen... | 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; 10, 27; 11, 28; 12, 29; 13, 30; 14, 31; 14, 32; 14, 33; 14, 34; 16, 35; 17, 36; 18, 37; 19, 38; 20, 39; 20, 40; 20, 41; 21, 42; 23, 43; 25, 44; 25,... | def mv_voltage_deviation(network, voltage_levels='mv_lv'):
"""
Checks for voltage stability issues in MV grid.
Parameters
----------
network : :class:`~.grid.network.Network`
voltage_levels : :obj:`str`
Specifies which allowed voltage deviations to use. Possible options
are:
... |
0, module; 1, function_definition; 2, function_name:calc_geo_lines_in_buffer; 3, parameters; 4, block; 5, identifier:network; 6, identifier:node; 7, identifier:grid; 8, identifier:radius; 9, identifier:radius_inc; 10, expression_statement; 11, expression_statement; 12, while_statement; 13, return_statement; 14, comment... | 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; 10, 14; 11, 15; 12, 16; 12, 17; 13, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 17, 24; 17, 25; 18, 26; 18, 27; 22, 28; 23, 29; 24, 30; 24, 31; 24, 32; 25, 33; 27, 34; 27, 35; 28, 36; 28, 37; 29, 38; 29, 39; 31, 40; 31, 41; 32, 42; 32, 43... | def calc_geo_lines_in_buffer(network, node, grid, radius, radius_inc):
"""Determines lines in nodes' associated graph that are at least partly
within buffer of radius from node. If there are no lines, the buffer is
successively extended by radius_inc until lines are found.
Parameters
----------
... |
0, module; 1, function_definition; 2, function_name:_group_by_size_greedy; 3, parameters; 4, block; 5, identifier:obj_list; 6, identifier:tot_groups; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""Partition a list of objects in even buc... | 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; 17, 28; 20, 29; 20, 30; 22, 31; 22, 32; 26, 33; 27, 34; 28, 35; 30, 36; 30, 37; 30, 38; 32, 39; 32, 40; 34, 41; 34, 42; 35, 43;... | def _group_by_size_greedy(obj_list, tot_groups):
"""Partition a list of objects in even buckets
The idea is to choose the bucket for an object in a round-robin fashion.
The list of objects is sorted to also try to keep the total size in bytes
as balanced as possible.
:param obj_list: a list of dict... |
0, module; 1, function_definition; 2, function_name:dimensions_from_subgroups; 3, parameters; 4, block; 5, identifier:s; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
Given a sorted list of subgroups, return a string appropriate to provide as
a composite track's `dimensio... | 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; 14, 17; 14, 18; 15, 19; 17, 20; 19, 21; 19, 22; 21, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 30, 36; 30, 37; 34, 38; 34, 39 | def dimensions_from_subgroups(s):
"""
Given a sorted list of subgroups, return a string appropriate to provide as
a composite track's `dimensions` arg.
Parameters
----------
s : list of SubGroup objects (or anything with a `name` attribute)
"""
letters = 'XYABCDEFGHIJKLMNOPQRSTUVWZ'
... |
0, module; 1, function_definition; 2, function_name:filter_composite_from_subgroups; 3, parameters; 4, block; 5, identifier:s; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, if_statement; 10, comment:"""
Given a sorted list of subgroups, return a string appropriate to provide as
the a co... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 9, 16; 11, 17; 11, 18; 12, 19; 12, 20; 13, 21; 13, 22; 14, 23; 16, 24; 22, 25; 22, 26; 23, 27; 24, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33; 28, 34; 28, 35; 31, 36; 32, 37; 32, 38; 33, 39; 34, 40; 34, 41; 35, 42; 39, 43; 3... | def filter_composite_from_subgroups(s):
"""
Given a sorted list of subgroups, return a string appropriate to provide as
the a composite track's `filterComposite` argument
>>> import trackhub
>>> trackhub.helpers.filter_composite_from_subgroups(['cell', 'ab', 'lab', 'knockdown'])
'dimA dimB'
... |
0, module; 1, function_definition; 2, function_name:_get_videos_for_filter; 3, parameters; 4, block; 5, identifier:video_filter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, return_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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 10, 22; 11, 23; 12, 24; 12, 25; 12, 26; 13, 27; 13, 28; 14, 29; 18, 30; 18, 31; 22, 32; 22, 33; 23, 34; 23, 35; 26, 36; 26, 37; 28, 38; 28, 39; 28, 40; 28, 41; 29, 42; 29, 43; 33, 44... | def _get_videos_for_filter(video_filter, sort_field=None, sort_dir=SortDirection.asc, pagination_conf=None):
"""
Returns a generator expression that contains the videos found, sorted by
the given field and direction, with ties broken by edx_video_id to ensure a
total order.
"""
videos = Video.ob... |
0, module; 1, function_definition; 2, function_name:get_videos_for_course; 3, parameters; 4, block; 5, identifier:course_id; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:sort_field; 12, None; 13, identifier:sort_dir; 14, attribute; 15, i... | 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; 14, 19; 14, 20; 18, 21; 18, 22; 22, 23; 22, 24; 22, 25; 22, 26; 23, 27; 23, 28; 27, 29; 27, 30; 28, 31; 28, 32; 29, 33; 30, 34; 30, 35; 31, 36; 34, 37; 34, 38; 35, 39 | def get_videos_for_course(course_id, sort_field=None, sort_dir=SortDirection.asc, pagination_conf=None):
"""
Returns an iterator of videos for the given course id.
Args:
course_id (String)
sort_field (VideoSortField)
sort_dir (SortDirection)
Returns:
A generator express... |
0, module; 1, function_definition; 2, function_name:get_videos_for_ids; 3, parameters; 4, block; 5, identifier:edx_video_ids; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:sort_field; 12, None; 13, identifier:sort_dir; 14, attribute; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 14, 18; 14, 19; 16, 20; 16, 21; 20, 22; 20, 23; 21, 24; 21, 25; 25, 26; 25, 27; 25, 28; 26, 29; 29, 30; 29, 31 | def get_videos_for_ids(
edx_video_ids,
sort_field=None,
sort_dir=SortDirection.asc
):
"""
Returns an iterator of videos that match the given list of ids.
Args:
edx_video_ids (list)
sort_field (VideoSortField)
sort_dir (SortDirection)
Returns:
A g... |
0, module; 1, function_definition; 2, function_name:put; 3, parameters; 4, block; 5, identifier:self; 6, identifier:block_id; 7, identifier:priority; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, with_statement; 12, identifier:pb_type; 13, string; 14, comment:"""Add a Processing Block to the queu... | 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; 11, 18; 13, 19; 15, 20; 15, 21; 16, 22; 17, 23; 18, 24; 18, 25; 18, 26; 18, 27; 18, 28; 18, 29; 18, 30; 18, 31; 18, 32; 18, 33; 21, 34; 21, 35; 22, 36; 23, 37; 24, 38; 25, 39; 26, 40; 27, 41; 27, 42; 28, 43;... | def put(self, block_id, priority, pb_type='offline'):
"""Add a Processing Block to the queue.
When a new entry it added, the queue is (re-)sorted by priority
followed by insertion order (older blocks with equal priority are
first).
Args:
block_id (str): Processing B... |
0, module; 1, function_definition; 2, function_name:sort_device; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# idx: the indices of order-sensitive models; 9, comment:# names: an ordered list of order-sensitive models; 10, expression_statement; 11, expression... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 7, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 12, 22; 12, 23; 13, 24; 14, 25; 14, 26; 14, 27; 16, 28; 16, 29; 17, 30; 17, 31; 18, 32; 18, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 28, 42; 28, 43; 3... | def sort_device(self):
"""
Sort device to follow the order of initialization
:return: None
"""
self.devices.sort()
# idx: the indices of order-sensitive models
# names: an ordered list of order-sensitive models
idx = []
names = []
for dev... |
0, module; 1, function_definition; 2, function_name:export_csv; 3, parameters; 4, block; 5, identifier:self; 6, identifier:path; 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, assert_statem... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 11, 27; 12, 28; 13, 29; 13, 30; 14, 31; 14, 32; 15, 33; 15, 34; 16, 35; 17, 36; 17, 37; 27, 38; 29, 39; 30, 40; 31, 41; 32, 42; 33, 43; 33, 44; ... | def export_csv(self, path, idx=None, header=None, formatted=False,
sort_idx=True, fmt='%.18e'):
"""
Export to a csv file
Parameters
----------
path : str
path of the csv file to save
idx : None or array-like, optional
the indice... |
0, module; 1, function_definition; 2, function_name:get_event_times; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, if_statement; 11, return_statement; 12, comment:"""
Return event times of Fault, Breaker and other ti... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 10, 19; 11, 20; 13, 21; 13, 22; 14, 23; 14, 24; 16, 25; 16, 26; 17, 27; 19, 28; 23, 29; 23, 30; 24, 31; 25, 32; 25, 33; 27, 34; 28, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 34, 41; 34, 42; 35, 43; 35... | def get_event_times(self):
"""
Return event times of Fault, Breaker and other timed events
Returns
-------
list
A sorted list of event times
"""
times = []
times.extend(self.Breaker.get_times())
for model in self.__dict__['Event'].al... |
0, module; 1, function_definition; 2, function_name:get_sort_field; 3, parameters; 4, block; 5, identifier:request; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""
Retrieve field used for sorting a qu... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 19, 26; 19, 27; 21, 28; 21, 29; 21, 30; 23, 31; 23, 32; 23, 33; 25, 34; 25, 35; 26, 36; 26, 37; 27, 38; 28, 39; 32, 40; 32, 41; 34, 42; 34, 43; ... | def get_sort_field(request):
"""
Retrieve field used for sorting a queryset
:param request: HTTP request
:return: the sorted field name, prefixed with "-" if ordering is descending
"""
sort_direction = request.GET.get("dir")
field_name = (request.GET.get("sort") or "") if sort_direction els... |
0, module; 1, function_definition; 2, function_name:linkage_group_ordering; 3, parameters; 4, block; 5, identifier:linkage_records; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""Convert degenerate linkage records into ordered info_frags-like records
for comp... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 14, 23; 17, 24; 17, 25; 20, 26; 20, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 23, 33; 29, 34; 29, 35; 30, 36; 30, 37; 33, 38; 33, 39; 33, 40; 33, 41; 33, 42; 34, 43; ... | def linkage_group_ordering(linkage_records):
"""Convert degenerate linkage records into ordered info_frags-like records
for comparison purposes.
Simple example:
>>> linkage_records = [
... ['linkage_group_1', 31842, 94039, 'sctg_207'],
... ['linkage_group_1', 95303, 95303, 'sctg_20... |
0, module; 1, function_definition; 2, function_name:get_issues; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, de... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 4, 18; 4, 19; 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; 5, 39; 5, 40; 6, 41; 6, 42; 7, 43; 7, 44; 8, 45; 8, 46; 9, 47; ... | def get_issues(repo_name=None,
profile='github',
milestone=None,
state='open',
assignee=None,
creator=None,
mentioned=None,
labels=None,
sort='created',
direction='desc',
... |
0, module; 1, function_definition; 2, function_name:get_milestones; 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, expression_statement; 14, if_statement; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 5, 26; 5, 27; 6, 28; 6, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 9, 35; 10, 36; 10, 37; 11, 38; 11, 39; 12, 40; 13, 41; 14, 42; 14, 43; 15, 44; 16, 45; 17, ... | def get_milestones(repo_name=None,
profile='github',
state='open',
sort='due_on',
direction='asc',
output='min',
per_page=None):
'''
Return information about milestones for a given repository.
... |
0, module; 1, function_definition; 2, function_name:get_prs; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15, 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; 3, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 5, 31; 5, 32; 6, 33; 6, 34; 7, 35; 7, 36; 8, 37; 8, 38; 9, 39; 9, 40; 10, 41; 10, 42; 11, 43; 11, 44; 12, 45; 12, 46; 1... | def get_prs(repo_name=None,
profile='github',
state='open',
head=None,
base=None,
sort='created',
direction='desc',
output='min',
per_page=None):
'''
Returns information for all pull requests in a given repository, b... |
0, module; 1, function_definition; 2, function_name:_diff_lists; 3, parameters; 4, block; 5, identifier:old; 6, identifier:new; 7, identifier:comparator; 8, expression_statement; 9, function_definition; 10, expression_statement; 11, comment:# We don't want to alter old since it may be used later by caller; 12, expressi... | 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; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 12, 21; 13, 22; 13, 23; 13, 24; 14, 25; 15, 26; 16, 27; 18, 28; 19, 29; 19, 30; 19, 31; 19, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 24, 38; 24, 39; 25, 40; 25, 41; 29, 42; 30, 43; 31, ... | def _diff_lists(old, new, comparator):
'''
Compare lists to extract the changes
:param old: old list
:param new: new list
:return: a dictionary with ``unchanged``, ``new``, ``deleted`` and ``sorted`` keys
The sorted list is the union of unchanged and new lists, but keeping the original
ord... |
0, module; 1, function_definition; 2, function_name:_job_sorting_key; 3, parameters; 4, block; 5, identifier:self; 6, identifier:job; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:"""
Get the sorting key of a CFGJob instance.
:par... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 22, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 38, 41; 38, 42; 40, 43; 4... | def _job_sorting_key(self, job):
"""
Get the sorting key of a CFGJob instance.
:param CFGJob job: the CFGJob object.
:return: An integer that determines the order of this job in the queue.
:rtype: int
"""
if self._base_graph is None:
# we don't do so... |
0, module; 1, function_definition; 2, function_name:instruction_addresses; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""
Get all instruction addresses in the binary.
:return: A list of sorted instruc... | 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; 8, 15; 9, 16; 11, 17; 11, 18; 13, 19; 13, 20; 15, 21; 16, 22; 16, 23; 20, 24; 20, 25; 21, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43; 3... | def instruction_addresses(self):
"""
Get all instruction addresses in the binary.
:return: A list of sorted instruction addresses.
:rtype: list
"""
addrs = [ ]
for b in sorted(self.blocks, key=lambda x: x.addr): # type: BasicBlock
addrs.extend(b.ins... |
0, module; 1, function_definition; 2, function_name:desymbolize; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:"""
We believe this was a pointer and symbolized it before. Now we want to desymbolize it.... | 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; 14, 20; 14, 21; 15, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 23, 28; 23, 29; 24, 30; 24, 31; 24, 32; 28, 33; 28, 34; 30, 35; 30, 36; 31, 37; 31, 38 | def desymbolize(self):
"""
We believe this was a pointer and symbolized it before. Now we want to desymbolize it.
The following actions are performed:
- Reload content from memory
- Mark the sort as 'unknown'
:return: None
"""
self.sort = 'unknown'
... |
0, module; 1, function_definition; 2, function_name:append_data; 3, parameters; 4, comment:# pylint:disable=unused-argument; 5, block; 6, identifier:self; 7, identifier:name; 8, identifier:initial_content; 9, identifier:size; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 10, 18; 10, 19; 11, 20; 11, 21; 12, 22; 13, 23; 13, 24; 13, 25; 14, 26; 14, 27; 15, 28; 16, 29; 17, 30; 17, 31; 17, 32; 24, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31... | def append_data(self, name, initial_content, size, readonly=False, sort="unknown"): # pylint:disable=unused-argument
"""
Append a new data entry into the binary with specific name, content, and size.
:param str name: Name of the data entry. Will be used as the label.
:param bytes initi... |
0, module; 1, function_definition; 2, function_name:pop_job; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, if_statement; 10, comment:# Prioritize returning functions; 11, for_statement; 12, return_statement; 13, identifier:returning; 14, True; 15, commen... | 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; 11, 20; 11, 21; 11, 22; 12, 23; 16, 24; 17, 25; 18, 26; 19, 27; 21, 28; 21, 29; 22, 30; 22, 31; 25, 32; 27, 33; 29, 34; 30, 35; 30, 36; 31, 37; 33, 38; 33, 39; 34, 40; 34, 41; 35, 42; 35, 43; 36, ... | def pop_job(self, returning=True):
"""
Pop a job from the pending jobs list.
When returning == True, we prioritize the jobs whose functions are known to be returning (function.returning is
True). As an optimization, we are sorting the pending jobs list according to job.function.returnin... |
0, module; 1, function_definition; 2, function_name:_get_min_addr; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:"""
Get the minimum address out of all regions. We assume self._regions is sorted.
:return: The minimum address.
... | 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; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 17, 23; 20, 24; 20, 25; 21, 26; 23, 27; 23, 28; 24, 29; 24, 30; 26, 31; 27, 32; 27, 33; 29, 34; 29, 35; 31, 36; 31, 37; 32, 38; 32, 39; 34, 40; 34, 41; 36, 42; 36, 4... | def _get_min_addr(self):
"""
Get the minimum address out of all regions. We assume self._regions is sorted.
:return: The minimum address.
:rtype: int
"""
if not self._regions:
if self.project.arch.name != "Soot":
l.error("self._regions is em... |
0, module; 1, function_definition; 2, function_name:_job_sorting_key; 3, parameters; 4, block; 5, identifier:self; 6, identifier:job; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, try_statement; 11, try_statement; 12, return_statement; 13, comment:"""
Get the sorting key of a VF... | 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; 10, 17; 11, 18; 11, 19; 12, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 17, 26; 17, 27; 17, 28; 17, 29; 17, 30; 18, 31; 19, 32; 19, 33; 19, 34; 20, 35; 20, 36; 24, 37; 24, 38; 25, 39; 30, 40; 30, 41; 31, 42; 34, 43; ... | def _job_sorting_key(self, job):
"""
Get the sorting key of a VFGJob instance.
:param VFGJob job: the VFGJob object.
:return: An integer that determines the order of this job in the queue.
:rtype: int
"""
MAX_BLOCKS_PER_FUNCTION = 1000000
task_functions... |
0, module; 1, function_definition; 2, function_name:_merge_points; 3, parameters; 4, block; 5, identifier:self; 6, identifier:function_address; 7, expression_statement; 8, comment:# we are entering a new function. now it's time to figure out how to optimally traverse the control flow; 9, comment:# graph by generating t... | 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; 10, 14; 10, 15; 11, 16; 11, 17; 12, 18; 14, 19; 15, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 22, 30; 24, 31; 24, 32; 25, 33; 26, 34; 27, 35; 27, 36; 29, 37; 29, 38; 30, 39; 33, 40; 33, 41; 34, 42; 34, 43... | def _merge_points(self, function_address):
"""
Return the ordered merge points for a specific function.
:param int function_address: Address of the querying function.
:return: A list of sorted merge points (addresses).
:rtype: list
"""
# we are entering a new fu... |
0, module; 1, function_definition; 2, function_name:_widening_points; 3, parameters; 4, block; 5, identifier:self; 6, identifier:function_address; 7, expression_statement; 8, comment:# we are entering a new function. now it's time to figure out how to optimally traverse the control flow; 9, comment:# graph by generatin... | 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; 10, 14; 10, 15; 11, 16; 11, 17; 12, 18; 14, 19; 15, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 22, 31; 24, 32; 24, 33; 25, 34; 25, 35; 26, 36; 27, 37; 28, 38; 28, 39; 30, 40; 30, 41; 31, 42; 34, 43... | def _widening_points(self, function_address):
"""
Return the ordered widening points for a specific function.
:param int function_address: Address of the querying function.
:return: A list of sorted merge points (addresses).
:rtype: list
"""
# we are entering a ... |
0, module; 1, function_definition; 2, function_name:get_variables; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, for_statement; 12, return_statement; 13, identifier:sort; 14, None; 15, identifier:collapse_... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 18, 25; 18, 26; 20, 27; 22, 28; 22, 29; 23, 30; 23, 31; 23, 32; 27, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; 36,... | def get_variables(self, sort=None, collapse_same_ident=False):
"""
Get a list of variables.
:param str or None sort: Sort of the variable to get.
:param collapse_same_ident: Whether variables of the same identifier should be collapsed or not.
:return: A lis... |
0, module; 1, function_definition; 2, function_name:find_merge_points; 3, parameters; 4, comment:# pylint:disable=unused-argument; 5, block; 6, identifier:function_addr; 7, identifier:function_endpoints; 8, identifier:graph; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement;... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 9, 15; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 13, 21; 14, 22; 16, 23; 16, 24; 18, 25; 18, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 24, 32; 24, 33; 25, 34; 25, 35; 27, 36; 27, 37; 29, 38; 29, 39; 31, 40; 31, 41; 36, 42; 36, 43; ... | def find_merge_points(function_addr, function_endpoints, graph): # pylint:disable=unused-argument
"""
Given a local transition graph of a function, find all merge points inside, and then perform a
quasi-topological sort of those merge points.
A merge point might be one of the following... |
0, module; 1, function_definition; 2, function_name:reverse_post_order_sort_nodes; 3, parameters; 4, block; 5, identifier:graph; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:nodes; 14, None; 15,... | 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; 9, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 12, 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; 23, 37; 25, 38; 25, 39; 28, 40; 34, 41; 35, 42; 37, 43; 37,... | def reverse_post_order_sort_nodes(graph, nodes=None):
"""
Sort a given set of nodes in reverse post ordering.
:param networkx.DiGraph graph: A local transition graph of a function.
:param iterable nodes: A collection of nodes to sort.
:return: A list of sorted nodes.
:rt... |
0, module; 1, function_definition; 2, function_name:split; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, if_statement; 15, expressi... | 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; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 11, 31; 12, 32; 13, 33; 14, 34; 14, 35; 14, 36; 14, 37; 14, 38; 15, 39; 16, 40; 17, 41; 18, 42; 19, 43; 29, 44; 31, ... | def split(self, stash_splitter=None, stash_ranker=None, state_ranker=None,
limit=8, from_stash='active', to_stash='stashed'):
"""
Split a stash of states into two stashes depending on the specified options.
The stash from_stash will be split into two stashes depending on the other... |
0, module; 1, function_definition; 2, function_name:_executable_memory_regions; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, for_statement; 12, if_statement; 13, expression_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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 9, 20; 9, 21; 9, 22; 10, 23; 11, 24; 11, 25; 11, 26; 12, 27; 12, 28; 13, 29; 14, 30; 20, 31; 20, 32; 21, 33; 22, 34; 23, 35; 23, 36; 26, 37; 27, 38; 28, 39; 29, 40; 29, 41; 33, 42; 34, 43; 37, 44;... | def _executable_memory_regions(self, objects=None, force_segment=False):
"""
Get all executable memory regions from the binaries
:param objects: A collection of binary objects to collect regions from. If None, regions from all project
binary objects are used.
:pa... |
0, module; 1, function_definition; 2, function_name:_debug_check; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# old_start = 0; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, comment:"""
Iterates over list checking segments with same sort do not over... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 8, 12; 9, 13; 10, 14; 10, 15; 10, 16; 12, 17; 12, 18; 13, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 16, 25; 16, 26; 23, 27; 23, 28; 25, 29; 26, 30; 27, 31; 27, 32; 28, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 31, 39; 32, 40; 32, 41; 33, 42; 35, 43... | def _debug_check(self):
"""
Iterates over list checking segments with same sort do not overlap
:raise: Exception: if segments overlap space with same sort
"""
# old_start = 0
old_end = 0
old_sort = ""
for segment in self._list:
if segment.star... |
0, module; 1, function_definition; 2, function_name:next_pos_with_sort_not_in; 3, parameters; 4, block; 5, identifier:self; 6, identifier:address; 7, identifier:sorts; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifie... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 8, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 13, 22; 17, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 21, 29; 21, 30; 21, 31; 21, 32; 21, 33; 24, 34; 24, 35; 26, 36; 26, 37; 29, 38; 30, 39; 30, 40; 31, 41; 31, 42; 31, 43; 3... | def next_pos_with_sort_not_in(self, address, sorts, max_distance=None):
"""
Returns the address of the next occupied block whose sort is not one of the specified ones.
:param int address: The address to begin the search with (including itself).
:param sorts: A collection of sort s... |
0, module; 1, function_definition; 2, function_name:occupied_by_sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:address; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, comment:"""
Check if an address belongs to an... | 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; 10, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 14, 23; 14, 24; 15, 25; 15, 26; 16, 27; 17, 28; 17, 29; 17, 30; 18, 31; 19, 32; 19, 33; 21, 34; 24, 35; 24, 36; 25, 37; 25, 38; 27, 39; 28, 40; 28, 41; 30, 42; 30, 43; 3... | def occupied_by_sort(self, address):
"""
Check if an address belongs to any segment, and if yes, returns the sort of the segment
:param int address: The address to check
:return: Sort of the segment that occupies this address
:rtype: str
"""
idx = self._search(a... |
0, module; 1, function_definition; 2, function_name:_binary_insert; 3, parameters; 4, block; 5, identifier:lst; 6, identifier:elem; 7, identifier:key; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, if_statement; 13, while_statement; 14, expression_statement; 15, identifier:l... | 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; 8, 15; 8, 16; 9, 17; 9, 18; 10, 19; 11, 20; 11, 21; 12, 22; 12, 23; 13, 24; 13, 25; 14, 26; 20, 27; 20, 28; 21, 29; 22, 30; 22, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 29, 39; 32, 40; 35, 41; 36, 42; 36, 43; 36,... | def _binary_insert(lst, elem, key, lo=0, hi=None):
"""
Insert an element into a sorted list, and keep the list sorted.
The major difference from bisect.bisect_left is that this function supports a key method, so user doesn't have
to create the key array for each insertion.
:par... |
0, module; 1, function_definition; 2, function_name:_sort_io_counters; 3, parameters; 4, block; 5, identifier:process; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:sortedby; 11, string; 12, identifier:sortedby_secondary; 13, string; 14, comment:"""Specific cas... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 11, 16; 13, 17; 15, 18; 15, 19; 18, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 24, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 30, 36; 30, 37; 32, 38; 32, 39 | def _sort_io_counters(process,
sortedby='io_counters',
sortedby_secondary='memory_percent'):
"""Specific case for io_counters
Sum of io_r + io_w"""
return process[sortedby][0] - process[sortedby][2] + process[sortedby][1] - process[sortedby][3] |
0, module; 1, function_definition; 2, function_name:_sort_lambda; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, identifier:sortedby; 12, string; 13, identifier:sortedby_secondary; 14, string; 15, comment:... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 5, 11; 5, 12; 6, 13; 6, 14; 7, 15; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 12, 21; 14, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 26, 30; 27, 31; 28, 32; 28, 33; 29, 34; 31, 35; 31, 36; 33, 37; 34, 38; 38, 39; 38, 40 | def _sort_lambda(sortedby='cpu_percent',
sortedby_secondary='memory_percent'):
"""Return a sort lambda function for the sortedbykey"""
ret = None
if sortedby == 'io_counters':
ret = _sort_io_counters
elif sortedby == 'cpu_times':
ret = _sort_cpu_times
return ret |
0, module; 1, function_definition; 2, function_name:loop_position; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, for_statement; 8, return_statement; 9, comment:"""Return the current sort in the loop"""; 10, pattern_list; 11, call; 12, block; 13, integer:0; 14, identifier:i; 15, identifier:v; ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 7, 12; 8, 13; 10, 14; 10, 15; 11, 16; 11, 17; 12, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 25, 27; 25, 28; 26, 29 | def loop_position(self):
"""Return the current sort in the loop"""
for i, v in enumerate(self._sort_loop):
if v == glances_processes.sort_key:
return i
return 0 |
0, module; 1, function_definition; 2, function_name:get_event_sort_key; 3, parameters; 4, block; 5, identifier:self; 6, identifier:event_type; 7, expression_statement; 8, comment:# Process sort depending on alert type; 9, if_statement; 10, return_statement; 11, comment:"""Return the process sort key"""; 12, call; 13, c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 9, 12; 9, 13; 9, 14; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 14, 20; 15, 21; 15, 22; 15, 23; 16, 24; 16, 25; 18, 26; 18, 27; 19, 28; 20, 29; 21, 30; 21, 31; 23, 32; 25, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 32, 39; 33, 40; 35, 41; 39, 42; 39, 43; 4... | def get_event_sort_key(self, event_type):
"""Return the process sort key"""
# Process sort depending on alert type
if event_type.startswith("MEM"):
# Sort TOP process by memory_percent
ret = 'memory_percent'
elif event_type.startswith("CPU_IOWAIT"):
# ... |
0, module; 1, function_definition; 2, function_name:set_process_sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:event_type; 7, expression_statement; 8, if_statement; 9, comment:"""Define the process auto sort key from the alert type."""; 10, attribute; 11, block; 12, identifier:glances_processes; 13, i... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 10, 12; 10, 13; 11, 14; 14, 15; 15, 16; 15, 17; 16, 18; 16, 19; 17, 20; 17, 21; 20, 22; 20, 23; 21, 24 | def set_process_sort(self, event_type):
"""Define the process auto sort key from the alert type."""
if glances_processes.auto_sort:
glances_processes.sort_key = self.get_event_sort_key(event_type) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.