nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:_get_paths_for_status; 3, parameters; 4, block; 5, identifier:self; 6, identifier:status; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""
Returns sorted list of paths for given ``status``.
:param status: one of: ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 13, 17; 13, 18; 13, 19; 14, 20; 14, 21; 16, 22; 22, 23; 22, 24; 23, 25; 23, 26; 23, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 27, 33; 28, 34; 29, 35; 29, 36; 30, 37; 31, 38; 31, 39; 32, 40; 33, 41; 33, 42; 36, 4... | def _get_paths_for_status(self, status):
"""
Returns sorted list of paths for given ``status``.
:param status: one of: *added*, *modified* or *deleted*
"""
added, modified, deleted = self._changes_cache
return sorted({
'added': list(added),
'modif... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, identifier:args; 12, identifier:kwargs; 13, comment:"""Sort this setlist in place."""; 14, c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 18, 25; 18, 26; 19, 27; 19, 28; 23, 29; 24, 30; 25, 31; 25, 32; 27, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 37, 39; 37, 40; 39, 41; 39, 42 | def sort(self, *args, **kwargs):
"""Sort this setlist in place."""
self._list.sort(*args, **kwargs)
for index, value in enumerate(self._list):
self._dict[value] = index |
0, module; 1, function_definition; 2, function_name:find; 3, parameters; 4, block; 5, identifier:self; 6, identifier:term; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, if_statement; 15, if_st... | 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; 13, 26; 14, 27; 14, 28; 14, 29; 15, 30; 15, 31; 16, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 28, 40; 29, 41; 31, 42; 34, 43; 34, 44;... | def find(self, term, limit=0, sort=False, ranks=None):
"""
Searches the stack for cards with a value, suit, name, or
abbreviation matching the given argument, 'term'.
:arg str term:
The search term. Can be a card full name, value, suit,
or abbreviation.
:... |
0, module; 1, function_definition; 2, function_name:get_list; 3, parameters; 4, block; 5, identifier:self; 6, identifier:terms; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, try_statement; 14, if_statement; 15, return_... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 12, 24; 13, 25; 13, 26; 14, 27; 14, 28; 15, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 25, 35; 25, 36; 26, 37; 28, 38; 31, 39; 31, 40; 34, 41; 35, 42; 36, 43; 37, 44... | def get_list(self, terms, limit=0, sort=False, ranks=None):
"""
Get the specified cards from the stack.
:arg term:
The search term. Can be a card full name, value, suit,
abbreviation, or stack indice.
:arg int limit:
The number of items to retrieve fo... |
0, module; 1, function_definition; 2, function_name:is_sorted; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, identifier:ranks; 11, None; 12, comment:"""
Checks whether the stack is sorted.
:arg dict ranks:
... | 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; 9, 14; 13, 15; 13, 16; 14, 17; 14, 18; 16, 19; 16, 20; 18, 21; 18, 22; 20, 23; 20, 24 | def is_sorted(self, ranks=None):
"""
Checks whether the stack is sorted.
:arg dict ranks:
The rank dict to reference for checking. If ``None``, it will
default to ``DEFAULT_RANKS``.
:returns:
Whether or not the cards are sorted.
"""
... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, identifier:ranks; 11, None; 12, comment:"""
Sorts the stack, either by poker ranks, or big two ranks.
... | 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; 9, 14; 13, 15; 13, 16; 14, 17; 14, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 18, 24; 20, 25; 20, 26; 24, 27; 24, 28; 27, 29; 27, 30 | def sort(self, ranks=None):
"""
Sorts the stack, either by poker ranks, or big two ranks.
:arg dict ranks:
The rank dict to reference for sorting. If ``None``, it will
default to ``DEFAULT_RANKS``.
:returns:
The sorted cards.
"""
ran... |
0, module; 1, function_definition; 2, function_name:canonical_headers; 3, parameters; 4, block; 5, identifier:self; 6, identifier:headers_to_sign; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""
Return the headers that need to be included in the S... | 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; 21, 28; 21, 29; 22, 30; 22, 31; 25, 32; 28, 33; 29, 34; 29, 35; 32, 36; 34, 37; 34, 38; 35, 39; 35, 40; 37, 41; 37, 42; 39, 43... | def canonical_headers(self, headers_to_sign):
"""
Return the headers that need to be included in the StringToSign
in their canonical form by converting all header keys to lower
case, sorting them in alphabetical order and then joining
them into a string, separated by newlines.
... |
0, module; 1, function_definition; 2, function_name:build_cards; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, return_statement; 12, identifier:jokers; 13, False; 14, identifier:num_jokers; 15, intege... | 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; 9, 19; 10, 20; 11, 21; 17, 22; 17, 23; 19, 24; 20, 25; 20, 26; 24, 27; 26, 28; 26, 29; 26, 30; 27, 31; 27, 32; 28, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 34, 41; 34, 42; 39, 43; 39, ... | def build_cards(jokers=False, num_jokers=0):
"""
Builds a list containing a full French deck of 52 Card instances. The
cards are sorted according to ``DEFAULT_RANKS``.
.. note:
Adding jokers may break some functions & methods at the moment.
:arg bool jokers:
Whether or not to inclu... |
0, module; 1, function_definition; 2, function_name:check_sorted; 3, parameters; 4, block; 5, identifier:cards; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, identifier:ranks; 12, None; 13, comment:"""
Checks whether the given cards are sorted... | 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; 10, 17; 10, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 18, 26; 20, 27; 20, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 30, 37; 30, 38; 33, 39; 33, 40; 36, 41; 40, 42; 42, 43 | def check_sorted(cards, ranks=None):
"""
Checks whether the given cards are sorted by the given ranks.
:arg cards:
The cards to check. Can be a ``Stack``, ``Deck``, or ``list`` of
``Card`` isntances.
:arg dict ranks:
The ranks to check against. Default is DEFAULT_RANKS.
:re... |
0, module; 1, function_definition; 2, function_name:sort_card_indices; 3, parameters; 4, block; 5, identifier:cards; 6, identifier:indices; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, identifier:ranks; 14, None; 15, comment:"""
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 11, 20; 12, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 19, 27; 19, 28; 20, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 26, 35; 27, 36; 27, 37; 28, 38; 29, 39; 35, 40; 35, 41; 39, 42; 39, 43; 4... | def sort_card_indices(cards, indices, ranks=None):
"""
Sorts the given Deck indices by the given ranks. Must also supply the
``Stack``, ``Deck``, or ``list`` that the indices are from.
:arg cards:
The cards the indices are from. Can be a ``Stack``, ``Deck``, or
``list``
:arg list in... |
0, module; 1, function_definition; 2, function_name:sort_cards; 3, parameters; 4, block; 5, identifier:cards; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, identifier:ranks; 13, None; 14, comment:"""
Sorts a given list of cards, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 8, 15; 9, 16; 9, 17; 10, 18; 10, 19; 11, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 19, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 34, 39; 34, 40; 38, 41; 38, 42; 40, 43; 40... | def sort_cards(cards, ranks=None):
"""
Sorts a given list of cards, either by poker ranks, or big two ranks.
:arg cards:
The cards to sort.
:arg dict ranks:
The rank dict to reference for sorting. If ``None``, it will
default to ``DEFAULT_RANKS``.
:returns:
The sort... |
0, module; 1, function_definition; 2, function_name:key; 3, parameters; 4, block; 5, identifier:self; 6, identifier:frame; 7, expression_statement; 8, function_definition; 9, comment:# Look up frame by exact match; 10, if_statement; 11, comment:# Look up parent frame for v2.2 frames; 12, if_statement; 13, comment:# Try... | 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; 8, 18; 8, 19; 10, 20; 10, 21; 12, 22; 12, 23; 14, 24; 14, 25; 14, 26; 15, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 22, 34; 22, 35; 23, 36; 24, 37; 24, 38; 25, 39; 25, 40; 26, 41; 27, 42; 27, 43; 29, ... | def key(self, frame):
"Return the sort key for the given frame."
def keytuple(primary):
if frame.frameno is None:
return (primary, 1)
return (primary, 0, frame.frameno)
# Look up frame by exact match
if type(frame) in self.frame_keys:
... |
0, module; 1, function_definition; 2, function_name:frames; 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; 15, identifier:key... | 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; 12, 29; 13, 30; 14, 31; 20, 32; 20, 33; 22, 34; 22, 35; 22, 36; 23, 37; 23, 38; 25, 39; 25, 40; 26, 41; 28, 42; 29, 43; 30, 44;... | def frames(self, key=None, orig_order=False):
"""Returns a list of frames in this tag.
If KEY is None, returns all frames in the tag; otherwise returns all frames
whose frameid matches KEY.
If ORIG_ORDER is True, then the frames are returned in their original order.
Othe... |
0, module; 1, function_definition; 2, function_name:detach; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:force; 14, False; 15, comment:"""
Det... | 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; 12, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 22, 33; 22, 34; 27, 35; 32, 36; 33, 37; 33, 38; 34, 39; 34, 40; 34, 41; 34, 42; 35, 43; 35,... | def detach(self, force=False):
"""
Detach this EBS volume from an EC2 instance.
:type force: bool
:param force: Forces detachment if the previous detachment attempt did
not occur cleanly. This option can lead to data loss or
a corrupted file ... |
0, module; 1, function_definition; 2, function_name:make_node_dict; 3, parameters; 4, block; 5, identifier:outer_list; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, for_stateme... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 8, 19; 9, 20; 10, 21; 10, 22; 10, 23; 11, 24; 11, 25; 11, 26; 11, 27; 12, 28; 13, 29; 14, 30; 14, 31; 14, 32; 15, 33; 19, 34; 19, 35; 20, 36; 20, 37; 23, 38; 24, 39; 24, 40; 26, 41; 27, 42; 27, 43; 28, 4... | def make_node_dict(outer_list, sort="zone"):
"""Convert node data from nested-list to sorted dict."""
raw_dict = {}
x = 1
for inner_list in outer_list:
for node in inner_list:
raw_dict[x] = node
x += 1
if sort == "name": # sort by provider - name
srt_dict = O... |
0, module; 1, function_definition; 2, function_name:crack; 3, parameters; 4, block; 5, identifier:ciphertext; 6, list_splat_pattern; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, comment:# Find a local maximum by swapping two letters and scoring the decryption; 12, function_... | 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; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 10, 23; 10, 24; 12, 25; 12, 26; 12, 27; 12, 28; 14, 29; 14, 30; 14, 31; 15, 32; 16, 33; 23, 34; 23, 35; 24, 36; 26, 37; 28, 38; 28, 39; 28, 40; 28, 41; 28, 42; 30, 43; 31, 44;... | def crack(ciphertext, *fitness_functions, ntrials=30, nswaps=3000):
"""Break ``ciphertext`` using hill climbing.
Note:
Currently ntrails and nswaps default to magic numbers.
Generally the trend is, the longer the text, the lower the number of trials
you need to run, because the hill cli... |
0, module; 1, function_definition; 2, function_name:key_periods; 3, parameters; 4, block; 5, identifier:ciphertext; 6, identifier:max_key_period; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comment:"""Rank all key periods for ``ciphertext`` up to and i... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 15, 23; 15, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 22, 31; 26, 32; 26, 33; 27, 34; 28, 35; 29, 36; 29, 37; 30, 38; 30, 39; 31, 40; 31, 41; 33, 42; 33, 43; ... | def key_periods(ciphertext, max_key_period):
"""Rank all key periods for ``ciphertext`` up to and including ``max_key_period``
Example:
>>> key_periods(ciphertext, 30)
[2, 4, 8, 3, ...]
Args:
ciphertext (str): The text to analyze
max_key_period (int): The maximum period the... |
0, module; 1, function_definition; 2, function_name:crack; 3, parameters; 4, block; 5, identifier:ciphertext; 6, list_splat_pattern; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, for_statement; 14, return_statement; 15, identi... | 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; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 11, 24; 12, 25; 13, 26; 13, 27; 13, 28; 14, 29; 23, 30; 23, 31; 24, 32; 25, 33; 25, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 29, 40; 32, 41; 36, 42; 36, 43; 37, 44... | def crack(ciphertext, *fitness_functions, min_key=0, max_key=26, shift_function=shift_case_english):
"""Break ``ciphertext`` by enumerating keys between ``min_key`` and ``max_key``.
Example:
>>> decryptions = crack("KHOOR", fitness.english.quadgrams)
>>> print(''.join(decryptions[0].plaintext))... |
0, module; 1, function_definition; 2, function_name:get_sort_limit; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, if_statement; 8, return_statement; 9, comment:""" returns the 'sort_limit' from the request
"""; 10, assignment; 11, parenthesized_expression; 12, block; 13, identifier:l... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 5, 9; 6, 10; 7, 11; 7, 12; 8, 13; 10, 14; 10, 15; 11, 16; 12, 17; 12, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 19, 24; 19, 25; 20, 26; 20, 27; 23, 28; 23, 29; 26, 30; 26, 31; 27, 32; 27, 33; 31, 34 | def get_sort_limit():
""" returns the 'sort_limit' from the request
"""
limit = _.convert(get("sort_limit"), _.to_int)
if (limit < 1):
limit = None # catalog raises IndexError if limit < 1
return limit |
0, module; 1, function_definition; 2, function_name:get_sort_on; 3, parameters; 4, block; 5, default_parameter; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:allowed_indexes; 11, None; 12, comment:""" returns the 'sort_on' from the request
"""; 13, assignment... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 5, 11; 6, 12; 7, 13; 8, 14; 8, 15; 9, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 18, 23; 18, 24; 20, 25; 20, 26; 21, 27; 22, 28; 24, 29; 27, 30; 27, 31; 30, 32; 30, 33; 31, 34; 34, 35; 34, 36; 35, 37; 35, 38; 36, 39 | def get_sort_on(allowed_indexes=None):
""" returns the 'sort_on' from the request
"""
sort_on = get("sort_on")
if allowed_indexes and sort_on not in allowed_indexes:
logger.warn("Index '{}' is not in allowed_indexes".format(sort_on))
return None
return sort_on |
0, module; 1, function_definition; 2, function_name:to_list; 3, parameters; 4, block; 5, identifier:thing; 6, expression_statement; 7, if_statement; 8, if_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, comment:""" converts an object to a list
>>> to_list(1)
[1]
>>> to_l... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 9, 18; 10, 19; 10, 20; 11, 21; 13, 22; 13, 23; 14, 24; 15, 25; 15, 26; 16, 27; 17, 28; 17, 29; 18, 30; 19, 31; 20, 32; 21, 33; 21, 34; 24, 35; 26, 36; 26, 37; 27, 38; 29, 39; 29, 40; 30, 41; 30, 42; 30, 43; 31,... | def to_list(thing):
""" converts an object to a list
>>> to_list(1)
[1]
>>> to_list([1,2,3])
[1, 2, 3]
>>> to_list(("a", "b", "c"))
['a', 'b', 'c']
>>> to_list(dict(a=1, b=2))
[{'a': 1, 'b': 2}]
>>> to_list(None)
[]
>>> to_list... |
0, module; 1, function_definition; 2, function_name:get_sort_spec; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Build sort specification
"""; 12, assignment; 13, assignment; 1... | 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; 21, 28; 21, 29; 24, 30; 24, 31; 26, 32; 26, 33; 27, 34; 28, 35; 28, 36; 30, 37; 30, 38; 34, 39; 34, 40 | def get_sort_spec(self):
"""Build sort specification
"""
all_indexes = self.catalog.get_indexes()
si = req.get_sort_on(allowed_indexes=all_indexes)
so = req.get_sort_order()
return si, so |
0, module; 1, function_definition; 2, function_name:sort_dict; 3, parameters; 4, block; 5, identifier:self; 6, identifier:data; 7, identifier:key; 8, expression_statement; 9, return_statement; 10, string; 11, conditional_expression:sorted(data, key=itemgetter(key)) if data else []; 12, string_content:Sort a list of dic... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 10, 12; 11, 13; 11, 14; 11, 15; 13, 16; 13, 17; 17, 18; 17, 19; 19, 20; 19, 21; 21, 22; 21, 23; 23, 24 | def sort_dict(self, data, key):
'''Sort a list of dictionaries by dictionary key'''
return sorted(data, key=itemgetter(key)) if data else [] |
0, module; 1, function_definition; 2, function_name:load_drops; 3, parameters; 4, block; 5, identifier:self; 6, identifier:dropin; 7, expression_statement; 8, expression_statement; 9, try_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, comment:"""Load `drops` from the given dropin.
Arg... | 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; 12, 21; 14, 22; 14, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 19, 30; 19, 31; 20, 32; 21, 33; 21, 34; 23, 35; 23, 36; 24, 37; 26, 38; 28, 39; 28, 40; 29, 41; 31, 42; 32, 43; 3... | def load_drops(self, dropin):
"""Load `drops` from the given dropin.
Args:
dropin (string): path of a dropin, e.g. dropin.auth
Returns:
An iterable contains the drops object in the given dropin
This method load drops object by some sort of convension. For examp... |
0, module; 1, function_definition; 2, function_name:sort_by; 3, parameters; 4, block; 5, identifier:self; 6, identifier:attr_or_key; 7, default_parameter; 8, expression_statement; 9, comment:# work out the direction; 10, if_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, identifier:... | 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; 10, 17; 10, 18; 10, 19; 10, 20; 11, 21; 11, 22; 11, 23; 11, 24; 12, 25; 13, 26; 15, 27; 17, 28; 17, 29; 18, 30; 19, 31; 19, 32; 20, 33; 21, 34; 21, 35; 23, 36; 24, 37; 24, 38; 25, 39; 25, 40; 26, 41; 26, 42; 29, 43; 2... | def sort_by(self, attr_or_key, direction='asc'):
"""Sort the view by an attribute or key
:param attr_or_key: The attribute or key to sort by
:param direction: Either `asc` or `desc` indicating the direction of
sorting
"""
# work out the direction
... |
0, module; 1, function_definition; 2, function_name:load_file; 3, parameters; 4, block; 5, identifier:self; 6, identifier:filepath; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, with_statement; 12, return_statement; 13, comment:"""
This function opens a... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 27, 40; 28, 41; 28, 42; 32, 43; ... | def load_file(self, filepath):
"""
This function opens any type of a readable file and decompose
the file object into a list, for each line, of lists containing
splitted line strings using space as a spacer.
Parameters
----------
filepath : :class:`str`
... |
0, module; 1, function_definition; 2, function_name:find; 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, dictionary_splat_pattern; 13, expression_statement; 14, if_statement; 15, if_st... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 6, 22; 6, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 13, 35; 14, 36; 14, 37; 15, 38; 15, 39; 16, 40; 17, 41; 17, 42; 18, 43; 19, 44; 19, 45... | def find(self, limit=None, reverse=False, sort=None,
exclude=None, duplicates=True, pretty=False, **filters):
""" Using filters and sorts, this finds all hyperlinks
on a web page
:param limit: Crop results down to limit specified
:param reverse: Reverse the list of links, u... |
0, module; 1, function_definition; 2, function_name:__draw_cmp; 3, parameters; 4, block; 5, identifier:self; 6, identifier:obj1; 7, identifier:obj2; 8, expression_statement; 9, if_statement; 10, comment:"""Defines how our drawable objects should be sorted"""; 11, comparison_operator:obj1.draw_order > obj2.draw_order; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 9, 12; 9, 13; 9, 14; 11, 15; 11, 16; 12, 17; 13, 18; 13, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 19, 28; 20, 29; 26, 30; 26, 31; 27, 32; 27, 33; 28, 34; 29, 35; 34, 36 | def __draw_cmp(self, obj1, obj2):
"""Defines how our drawable objects should be sorted"""
if obj1.draw_order > obj2.draw_order:
return 1
elif obj1.draw_order < obj2.draw_order:
return -1
else:
return 0 |
0, module; 1, function_definition; 2, function_name:__up_cmp; 3, parameters; 4, block; 5, identifier:self; 6, identifier:obj1; 7, identifier:obj2; 8, expression_statement; 9, if_statement; 10, comment:"""Defines how our updatable objects should be sorted"""; 11, comparison_operator:obj1.update_order > obj2.update_order... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 9, 12; 9, 13; 9, 14; 11, 15; 11, 16; 12, 17; 13, 18; 13, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 18, 26; 18, 27; 19, 28; 20, 29; 26, 30; 26, 31; 27, 32; 27, 33; 28, 34; 29, 35; 34, 36 | def __up_cmp(self, obj1, obj2):
"""Defines how our updatable objects should be sorted"""
if obj1.update_order > obj2.update_order:
return 1
elif obj1.update_order < obj2.update_order:
return -1
else:
return 0 |
0, module; 1, function_definition; 2, function_name:discover; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# 'ssdp:all'; 12, expression_statement; 13, expression_statement; 14, for_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; 4, 17; 5, 18; 5, 19; 6, 20; 6, 21; 7, 22; 8, 23; 9, 24; 10, 25; 12, 26; 13, 27; 14, 28; 14, 29; 14, 30; 15, 31; 17, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 29, 43; 29, 44; 3... | def discover(timeout=1, retries=1):
"""Discover Raumfeld devices in the network
:param timeout: The timeout in seconds
:param retries: How often the search should be retried
:returns: A list of raumfeld devices, sorted by name
"""
locations = []
group = ('239.255.255.250', 1900)
... |
0, module; 1, function_definition; 2, function_name:get_user_trades; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# TODO Workaround for the broken limit param in Qua... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 8, 19; 9, 20; 10, 21; 11, 22; 13, 23; 19, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 23, 31; 25, 32; 25, 33; 26, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 30, 41; 34, 42; 35, 43; 35, 4... | def get_user_trades(self, limit=0, offset=0, sort='desc'):
"""Return user's trade history.
:param limit: Maximum number of trades to return. If set to 0 or lower,
all trades are returned (default: 0).
:type limit: int
:param offset: Number of trades to skip.
:type of... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, typed_parameter; 7, expression_statement; 8, try_statement; 9, identifier:col; 10, type; 11, comment:"""
Sorts the main dataframe according to the given column
:param col: column name
:type... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 8, 13; 10, 14; 12, 15; 13, 16; 13, 17; 15, 18; 16, 19; 16, 20; 17, 21; 18, 22; 18, 23; 20, 24; 21, 25; 22, 26; 22, 27; 23, 28; 23, 29; 25, 30; 25, 31; 28, 32; 28, 33; 29, 34; 30, 35; 30, 36; 31, 37; 31, 38; 32, 39; 32, 40; 38, 41; 38, 42; 39, 43... | def sort(self, col: str):
"""
Sorts the main dataframe according to the given column
:param col: column name
:type col: str
:example: ``ds.sort("Col 1")``
"""
try:
self.df = self.df.copy().sort_values(col)
except Exception as e:
s... |
0, module; 1, function_definition; 2, function_name:iterate; 3, parameters; 4, block; 5, identifier:MachineClass; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, function_definition; 13, function_definition; 14, function_defini... | 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; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 12, 31; 12, 32; 12, 33; 13, 34; 13, 35; 13, 36; 14, 37; 14, 38; 14, 39; 15, 40; 16, 41; 17, 42; 17, 43; 17, 44; 18, ... | def iterate(MachineClass, stop_function=lambda iterations: iterations < 10000,
machines=1000, survival_rate=0.05, mutation_rate=0.075, silent=False):
"""Creates a bunch of machines, runs them for a number of steps and then
gives them a fitness score. The best produce offspring that are passed on
to... |
0, module; 1, function_definition; 2, function_name:count_account; 3, parameters; 4, block; 5, identifier:self; 6, identifier:domain; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, comment:""" Count the number of accounts... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 16, 26; 19, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 24, 33; 24, 34; 27, 35; 28, 36; 30, 37; 31, 38; 31, 39; 33, 40; 33, 41; 34, 42; 34, 43; ... | def count_account(self, domain):
""" Count the number of accounts for a given domain, sorted by cos
:returns: a list of pairs <ClassOfService object>,count
"""
selector = domain.to_selector()
cos_list = self.request_list('CountAccount', {'domain': selector})
ret = []
... |
0, module; 1, function_definition; 2, function_name:search_directory; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:kwargs; 14, comment... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 23, 33; 23, 34; 27, 35; 27, 36; 27, 37; 27, 38; 27, 39; 27, 40; 30, 41; 30, 42; 32, 43; 3... | def search_directory(self, **kwargs):
"""
SearchAccount is deprecated, using SearchDirectory
:param query: Query string - should be an LDAP-style filter
string (RFC 2254)
:param limit: The maximum number of accounts to return
(0 is default and means all)
:param o... |
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:kwargs; 13, comment:""" Search object in account
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 19, 23; 19, 24; 20, 25; 21, 26; 21, 27; 22, 28; 22, 29; 24, 30; 25, 31; 25, 32; 28, 33; 31, 34 | def search(self, query, **kwargs):
""" Search object in account
:returns: a dic where value c contains the list of results (if there
is any). Example : {
'more': '0',
'offset': '0',
'sortBy': 'dateDesc',
'c': [
{
... |
0, module; 1, function_definition; 2, function_name:_call_zincrby; 3, parameters; 4, block; 5, identifier:self; 6, identifier:command; 7, identifier:value; 8, list_splat_pattern; 9, dictionary_splat_pattern; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:args; 14, identifier:kwargs; 15... | 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; 9, 14; 10, 15; 11, 16; 11, 17; 12, 18; 16, 19; 16, 20; 17, 21; 18, 22; 18, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 23, 29; 23, 30; 24, 31; 24, 32; 29, 33; 30, 34; 31, 35; 31, 36; 32, 37; 37, 38 | def _call_zincrby(self, command, value, *args, **kwargs):
"""
This command update a score of a given value. But it can be a new value
of the sorted set, so we index it.
"""
if self.indexable:
self.index([value])
return self._traverse_command(command, value, *a... |
0, module; 1, function_definition; 2, function_name:_extract_value_from_storage; 3, parameters; 4, block; 5, identifier:self; 6, identifier:string; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Taking a string that was a member of the zset, extract the v... | 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; 21, 27; 21, 28; 22, 29; 23, 30; 23, 31; 25, 32; 25, 33; 26, 34; 29, 35; 29, 36; 32, 37; 32, 38 | def _extract_value_from_storage(self, string):
"""Taking a string that was a member of the zset, extract the value and pk
Parameters
----------
string: str
The member extracted from the sorted set
Returns
-------
tuple
Tuple with the valu... |
0, module; 1, function_definition; 2, function_name:get_boundaries; 3, parameters; 4, block; 5, identifier:self; 6, identifier:filter_type; 7, identifier:value; 8, expression_statement; 9, assert_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_statem... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 13, 20; 13, 21; 13, 22; 13, 23; 13, 24; 13, 25; 13, 26; 13, 27; 14, 28; 16, 29; 16, 30; 17, 31; 17, 32; 18, 33; 18, 34; 19, 35; 19, 36; 20, 37; 20, 38; 22, 39; 22, 40; 23, 41; 23, 42; 23, 43; 2... | def get_boundaries(self, filter_type, value):
"""Compute the boundaries to pass to zrangebylex depending of the filter type
The third return value, ``exclude`` is ``None`` except for the filters
`lt` and `gt` because we cannot explicitly exclude it when
querying the sorted-set
... |
0, module; 1, function_definition; 2, function_name:get_boundaries; 3, parameters; 4, block; 5, identifier:self; 6, identifier:filter_type; 7, identifier:value; 8, expression_statement; 9, assert_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, return_statem... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 13, 20; 13, 21; 13, 22; 13, 23; 13, 24; 13, 25; 13, 26; 14, 27; 16, 28; 16, 29; 17, 30; 17, 31; 18, 32; 18, 33; 19, 34; 19, 35; 20, 36; 20, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 2... | def get_boundaries(self, filter_type, value):
"""Compute the boundaries to pass to the sorted-set command depending of the filter type
The third return value, ``exclude`` is always ``None`` because we can easily restrict the
score to filter on in the sorted-set.
For the parameters, see... |
0, module; 1, function_definition; 2, function_name:_combine_sets; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sets; 7, identifier:final_set; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Given a list of set, combine them to create the final set that will be
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 14, 19; 18, 20; 19, 21; 20, 22; 20, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 24, 29; 24, 30; 25, 31; 25, 32; 28, 33; 28, 34; 30, 35; 30, 36; 31, 37; 31, 38; 34, 39; 35, 40; 35, 41; 36, 42; 36, 43;... | def _combine_sets(self, sets, final_set):
"""
Given a list of set, combine them to create the final set that will be
used to make the final redis call.
If we have a least a sorted set, use zinterstore insted of sunionstore
"""
if self._has_sortedsets:
self.cls... |
0, module; 1, function_definition; 2, function_name:_final_redis_call; 3, parameters; 4, block; 5, identifier:self; 6, identifier:final_set; 7, identifier:sort_options; 8, expression_statement; 9, expression_statement; 10, comment:# we have a sorted set without need to sort, use zrange; 11, if_statement; 12, comment:# ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 8, 17; 9, 18; 11, 19; 11, 20; 14, 21; 14, 22; 16, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 21, 29; 21, 30; 21, 31; 22, 32; 23, 33; 23, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 29, 42; 29, 43; 29,... | def _final_redis_call(self, final_set, sort_options):
"""
The final redis call to obtain the values to return from the "final_set"
with some sort options.
IIf we have at leaset a sorted set and if we don't have any sort
options, call zrange on the final set wich is the result of ... |
0, module; 1, function_definition; 2, function_name:_collection_length; 3, parameters; 4, block; 5, identifier:self; 6, identifier:final_set; 7, expression_statement; 8, expression_statement; 9, comment:# we have a sorted set without need to sort, use zcard; 10, if_statement; 11, comment:# normal call; 12, return_state... | 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; 10, 15; 10, 16; 10, 17; 10, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 18, 25; 18, 26; 19, 27; 19, 28; 21, 29; 21, 30; 24, 31; 25, 32; 25, 33; 25, 34; 26, 35; 27, 36; 27, 37; 28, 38; 29, 39; 29, 40; 31, 41; 31, 42; 32, 43;... | def _collection_length(self, final_set):
"""
Return the length of the final collection, directly asking redis for the
count without calling sort
"""
conn = self.cls.get_connection()
# we have a sorted set without need to sort, use zcard
if self._has_sortedsets:
... |
0, module; 1, function_definition; 2, function_name:_prepare_sort_by_score; 3, parameters; 4, block; 5, identifier:self; 6, identifier:values; 7, identifier:sort_options; 8, expression_statement; 9, comment:# create the keys; 10, expression_statement; 11, comment:# ask to sort on our new keys; 12, expression_statement;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 8, 18; 10, 19; 12, 20; 14, 21; 14, 22; 14, 23; 16, 24; 16, 25; 17, 26; 19, 27; 19, 28; 20, 29; 20, 30; 22, 31; 22, 32; 22, 33; 22, 34; 23, 35; 24, 36; 24, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28,... | def _prepare_sort_by_score(self, values, sort_options):
"""
Create the key to sort on the sorted set references in
self._sort_by_sortedset and adapte sort options
"""
# create the keys
base_tmp_key, tmp_keys = self._zset_to_keys(
key=se... |
0, module; 1, function_definition; 2, function_name:_prepare_sort_options; 3, parameters; 4, block; 5, identifier:self; 6, identifier:has_pk; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, return_statement; 12, comment:"""
Prepare sort options for _values attributes.
... | 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; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 19, 31; 22, 32; 22, 33; 25, 34; 25, 35; 26, 36; 29, 37; 29, 38; 29, 39; 30, 40; 30, 41; 31, 42; 31, 43; 32... | def _prepare_sort_options(self, has_pk):
"""
Prepare sort options for _values attributes.
If we manager sort by score after getting the result, we do not want to
get values from the first sort call, but only from the last one, after
converting results in zset into keys
""... |
0, module; 1, function_definition; 2, function_name:_get_final_set; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sets; 7, identifier:pk; 8, identifier:sort_options; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, comment:# if we have a slice and we want to sort by the score of a s... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 9, 18; 10, 19; 10, 20; 10, 21; 10, 22; 10, 23; 10, 24; 10, 25; 11, 26; 16, 27; 16, 28; 16, 29; 16, 30; 17, 31; 19, 32; 19, 33; 25, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 30, 41; 30, 42; 30, 43; 30,... | def _get_final_set(self, sets, pk, sort_options):
"""
Add intersects fo sets and call parent's _get_final_set.
If we have to sort by sorted score, and we have a slice, we have to
convert the whole sorted set to keys now.
"""
if self._lazy_collection['intersects']:
... |
0, module; 1, function_definition; 2, function_name:_prepare_sort_options; 3, parameters; 4, block; 5, identifier:self; 6, identifier:has_pk; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, comment:"""
Prepare "sort" options to use... | 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; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 24, 34; 24, 35; 25, 36; 26, 37; 27, 38; 27, 39; 29, 40; 29, 41; 29, 42; 30, 43; 3... | def _prepare_sort_options(self, has_pk):
"""
Prepare "sort" options to use when calling the collection, depending
on "_sort" and "_sort_limits" attributes
"""
sort_options = {}
if self._sort is not None and not has_pk:
sort_options.update(self._sort)
i... |
0, module; 1, function_definition; 2, function_name:_final_redis_call; 3, parameters; 4, block; 5, identifier:self; 6, identifier:final_set; 7, identifier:sort_options; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, comment:"""
The final redis call to obtain the values to return from th... | 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; 10, 16; 12, 17; 12, 18; 13, 19; 13, 20; 15, 21; 16, 22; 16, 23; 18, 24; 18, 25; 21, 26; 23, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 28, 33; 28, 34; 30, 35; 30, 36; 31, 37; 31, 38; 32, 39; 32, 40; 38, 41; 39, 42; 39, 4... | def _final_redis_call(self, final_set, sort_options):
"""
The final redis call to obtain the values to return from the "final_set"
with some sort options.
"""
conn = self.cls.get_connection()
if sort_options is not None:
# a sort, or values, call the SORT com... |
0, module; 1, function_definition; 2, function_name:query_mongo_sort_decend; 3, parameters; 4, block; 5, identifier:database_name; 6, identifier:collection_name; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_state... | 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; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 12, 27; 13, 28; 14, 29; 15, 30; 15, 31; 16, 32; 22, 33; 22, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 30, 40; 30, 41; 30, 42; 30, 43; 30, 44;... | def query_mongo_sort_decend(
database_name,
collection_name,
query={},
skip=0,
limit=getattr(
settings,
'MONGO_LIMIT',
200),
return_keys=(),
sortkey=None):
"""return a response_dict with a list of search results in decending
... |
0, module; 1, function_definition; 2, function_name:build_sort; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:kwargs; 13, string; 14, assignment; 15, assignment; ... | 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; 10, 17; 11, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 17, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30; 25, 31; 25, 32; 26, 33; 26, 34; 27, 35; 27, 36; 28, 37; 28, 38; 29, 39; 30, 40; 30, 41; 31, 42; 32, 43; ... | def build_sort(self, **kwargs):
''' Break url parameters and turn into sort arguments '''
sort = []
order = kwargs.get('order_by', None)
if order:
if type(order) is list:
order = order[0]
if order[:1] == '-':
sort.append((order[1:],... |
0, module; 1, function_definition; 2, function_name:load_remotes; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, import_from_statement; 9, try_statement; 10, if_statement; 11, identifier:extra_path; 12, None; 13, identifier:load_user; 14, True; 15, comment:"""Load the Y... | 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; 8, 17; 9, 18; 9, 19; 10, 20; 10, 21; 10, 22; 16, 23; 16, 24; 17, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 21, 33; 21, 34; 21, 35; 22, 36; 26, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 31, 43; 32, ... | def load_remotes(extra_path=None, load_user=True):
"""Load the YAML remotes file, which sort of combines the Accounts file with part of the
remotes sections from the main config
:return: An `AttrDict`
"""
from os.path import getmtime
try:
remotes_file = find_config_file(REMOTES_FILE, ... |
0, module; 1, function_definition; 2, function_name:find_previous; 3, parameters; 4, block; 5, identifier:element; 6, identifier:l; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, comment:"""
find previous element in a sorted list
>>> find_previous(0, [0])
0
>>> find_previous(2,... | 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; 9, 14; 9, 15; 11, 16; 11, 17; 12, 18; 12, 19; 13, 20; 13, 21; 15, 22; 15, 23; 15, 24; 15, 25; 17, 26; 17, 27; 21, 28; 22, 29; 22, 30; 24, 31; 24, 32; 25, 33; 25, 34; 27, 35; 29, 36; 29, 37; 30, 38; 31, 39; 31, 40; 32, 41; 33, 42; 33, 43; ... | def find_previous(element, l):
"""
find previous element in a sorted list
>>> find_previous(0, [0])
0
>>> find_previous(2, [1, 1, 3])
1
>>> find_previous(0, [1, 2])
>>> find_previous(1.5, [1, 2])
1
>>> find_previous(3, [1, 2])
2
"""
length = len(l)
for index, cur... |
0, module; 1, function_definition; 2, function_name:tsort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, comment:# parts = parts.copy(); 10, expression_statement; 11, expression_statement; 12, while_statement; 13, if_statement; 14, return_statement; ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 7, 16; 8, 17; 8, 18; 8, 19; 10, 20; 11, 21; 12, 22; 12, 23; 13, 24; 13, 25; 14, 26; 16, 27; 16, 28; 17, 29; 17, 30; 18, 31; 18, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 23, 38; 23, 39; 23, 40; 23, 41; 25, 42; 31, 43; 31, ... | def tsort(self):
"""Given a partial ordering, return a totally ordered list.
part is a dict of partial orderings. Each value is a set,
which the key depends on.
The return value is a list of sets, each of which has only
dependencies on items in previous entries in the list.
... |
0, module; 1, function_definition; 2, function_name:getBounds; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:tzinfo; 11, None; 12, comment:"""
Return a pair describing the bounds of self.
This returns 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; 8, 15; 9, 16; 13, 17; 13, 18; 13, 19; 14, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 19, 26; 19, 27; 20, 28; 21, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 28, 38; 28, 39; 29, 40; 31, 41; 31, 42; 33, 43; 3... | def getBounds(self, tzinfo=None):
"""
Return a pair describing the bounds of self.
This returns a pair (min, max) of Time instances. It is not quite the
same as (self, self + self.resolution). This is because timezones are
insignificant for instances with a resolution greater or... |
0, module; 1, function_definition; 2, function_name:_get_all_migrations; 3, parameters; 4, block; 5, expression_statement; 6, import_from_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, return_statement; 13, comment:""" Returns sorte... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 5, 13; 6, 14; 6, 15; 7, 16; 8, 17; 9, 18; 10, 19; 10, 20; 10, 21; 11, 22; 12, 23; 14, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 19, 34; 20, 35; 20, 36; 21, 37; 21, 38; 22, 39; 22, 40; 29, 41; 29, 42; 35, 43; 35,... | def _get_all_migrations():
""" Returns sorted list of all migrations.
Returns:
list of (int, str) tuples: first elem of the tuple is migration number, second if module name.
"""
from . import migrations
package = migrations
prefix = package.__name__ + '.'
all_migrations = []
f... |
0, module; 1, function_definition; 2, function_name:sort_genes; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:stable; 14, True; 15, identifier:inplac... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 11, 22; 12, 23; 20, 24; 20, 25; 22, 26; 23, 27; 23, 28; 25, 29; 26, 30; 27, 31; 27, 32; 28, 33; 28, 34; 28, 35; 30, 36; 30, 37; 33, 38; 33, 39; 34, 40; 34, 41; 35, 42; 35, 43; 37, ... | def sort_genes(self, stable=True, inplace=False, ascending=True):
"""Sort the rows of the matrix alphabetically by gene name.
Parameters
----------
stable: bool, optional
Whether to use a stable sorting algorithm. [True]
inplace: bool, optional
Whether to... |
0, module; 1, function_definition; 2, function_name:sort_samples; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:stable; 14, True; 15, identifier:inpl... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 11, 22; 12, 23; 20, 24; 20, 25; 22, 26; 23, 27; 23, 28; 25, 29; 26, 30; 27, 31; 27, 32; 28, 33; 28, 34; 28, 35; 28, 36; 30, 37; 30, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; 35, ... | def sort_samples(self, stable=True, inplace=False, ascending=True):
"""Sort the columns of the matrix alphabetically by sample name.
Parameters
----------
stable: bool, optional
Whether to use a stable sorting algorithm. [True]
inplace: bool, optional
Whe... |
0, module; 1, function_definition; 2, function_name:parseColors; 3, parameters; 4, block; 5, identifier:colors; 6, identifier:defaultColor; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comment:"""
Parse command line color 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; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 11, 19; 12, 20; 14, 21; 14, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 23, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 25, 35; 26, 36; 27, 37; 27, 38; 28, 39; 31, 40; 31, 41; 34, 42; 34, 43; 3... | def parseColors(colors, defaultColor):
"""
Parse command line color information.
@param colors: A C{list} of space separated "value color" strings, such as
["0.9 red", "0.75 rgb(23, 190, 207)", "0.1 #CF3CF3"].
@param defaultColor: The C{str} color to use for cells that do not reach
the ... |
0, module; 1, function_definition; 2, function_name:bisect_index; 3, parameters; 4, block; 5, identifier:a; 6, identifier:x; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, raise_statement; 11, comment:""" Find the leftmost index of an element in a list using binary search.
Parameters
--... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 21, 28; 21, 29; 22, 30; 22, 31; 24, 32; 24, 33; 25, 34; 25, 35; 33, 36 | def bisect_index(a, x):
""" Find the leftmost index of an element in a list using binary search.
Parameters
----------
a: list
A sorted list.
x: arbitrary
The element.
Returns
-------
int
The index.
"""
i = bisect.bisect_left(a, x)
if i != len(a) an... |
0, module; 1, function_definition; 2, function_name:writeSampleIndex; 3, parameters; 4, block; 5, identifier:self; 6, identifier:fp; 7, expression_statement; 8, expression_statement; 9, comment:"""
Write a file of sample indices and names, sorted by index.
@param fp: A file-like object, opened for writ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 12, 13; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 19, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 27, 35; 35, 36; 35, 37; 36, 38; 36, 39; 37, 40; 37, 41; 40, 42; 40,... | def writeSampleIndex(self, fp):
"""
Write a file of sample indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) in s... |
0, module; 1, function_definition; 2, function_name:writePathogenIndex; 3, parameters; 4, block; 5, identifier:self; 6, identifier:fp; 7, expression_statement; 8, expression_statement; 9, comment:"""
Write a file of pathogen indices and names, sorted by index.
@param fp: A file-like object, opened for ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 12, 13; 12, 14; 13, 15; 13, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 16, 22; 19, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 27, 34; 27, 35; 35, 36; 35, 37; 36, 38; 36, 39; 37, 40; 37, 41; 40, 42; 40,... | def writePathogenIndex(self, fp):
"""
Write a file of pathogen indices and names, sorted by index.
@param fp: A file-like object, opened for writing.
"""
print('\n'.join(
'%d %s' % (index, name) for (index, name) in
sorted((index, name) for (name, index) ... |
0, module; 1, function_definition; 2, function_name:_transform_chrom; 3, parameters; 4, block; 5, identifier:chrom; 6, expression_statement; 7, try_statement; 8, comment:"""Helper function to obtain specific sort order."""; 9, block; 10, except_clause; 11, else_clause; 12, expression_statement; 13, block; 14, comment:#... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 9, 12; 10, 13; 11, 14; 11, 15; 12, 16; 13, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 17, 23; 17, 24; 18, 25; 20, 26; 20, 27; 21, 28; 21, 29; 22, 30; 23, 31; 23, 32; 24, 33; 25, 34; 25, 35; 27, 36; 29, 37; 29, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 4... | def _transform_chrom(chrom):
"""Helper function to obtain specific sort order."""
try:
c = int(chrom)
except:
if chrom in ['X', 'Y']:
return chrom
elif chrom == 'MT':
return '_MT' # sort to the end
else:
return '__' + chrom # sort to the v... |
0, module; 1, function_definition; 2, function_name:_show; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:""" Return a list of unsorted bridge details. """; 10, assignment; 11, subscript; 12, identifier:p; 13, call; 14, call; 15, slice; 16,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 11, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 17, 21; 17, 22; 18, 23; 18, 24; 21, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31; 26, 32; 27, 33; 27, 34; 29, 35; 29, 36; 30, 37; 30, 38; 37, 39; 37, 40 | def _show(self):
""" Return a list of unsorted bridge details. """
p = _runshell([brctlexe, 'show', self.name],
"Could not show %s." % self.name)
return p.stdout.read().split()[7:] |
0, module; 1, function_definition; 2, function_name:get_assembly; 3, parameters; 4, block; 5, identifier:name; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""read a single assembly by name, returning a dictionary of assembly data
>>> assy = get_assembly('GRCh37.p13')
>>> ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 11, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 20, 25; 20, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 26, 32; 26, 33; 27, 34; 27, 35; 28, 36; 32, 37; 32, 38; 33, 39; 33, 40; 36, 41; 36, 42 | def get_assembly(name):
"""read a single assembly by name, returning a dictionary of assembly data
>>> assy = get_assembly('GRCh37.p13')
>>> assy['name']
'GRCh37.p13'
>>> assy['description']
'Genome Reference Consortium Human Build 37 patch release 13 (GRCh37.p13)'
>>> assy['refseq_ac']
... |
0, module; 1, function_definition; 2, function_name:coverageInfo; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""
Return information about the bases found at each location in our title
sequence.
... | 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; 17, 19; 17, 20; 18, 21; 18, 22; 18, 23; 20, 24; 22, 25; 22, 26; 23, 27; 23, 28; 27, 29; 28, 30; 28, 31; 28, 32; 29, 33; 29, 34; 30, 35; 30, 36; 30, 37; 31, 38; 31, 39; 32, 40; 34, 41; 34, 42; 38, 43; ... | def coverageInfo(self):
"""
Return information about the bases found at each location in our title
sequence.
@return: A C{dict} whose keys are C{int} subject offsets and whose
values are unsorted lists of (score, base) 2-tuples, giving all the
bases from reads th... |
0, module; 1, function_definition; 2, function_name:filter; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement; 14, comment:# Use a ReadSetFilte... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 6, 21; 6, 22; 7, 23; 7, 24; 8, 25; 8, 26; 9, 27; 9, 28; 10, 29; 10, 30; 11, 31; 11, 32; 12, 33; 12, 34; 13, 35; 16, 36; 16, 37; 16, 38; 17, 39; 18, 40; 18, 41; 18, 42; 19, 43; 19, 44; 19, 4... | def filter(self, minMatchingReads=None, minMedianScore=None,
withScoreBetterThan=None, minNewReads=None, minCoverage=None,
maxTitles=None, sortOn='maxScore'):
"""
Filter the titles in self to create another TitlesAlignments.
@param minMatchingReads: titles that are... |
0, module; 1, function_definition; 2, function_name:sortTitles; 3, parameters; 4, block; 5, identifier:self; 6, identifier:by; 7, expression_statement; 8, comment:# First sort titles by the secondary key, which is always the title.; 9, expression_statement; 10, comment:# Then sort on the primary key (if any).; 11, if_s... | 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; 9, 18; 11, 19; 11, 20; 12, 21; 12, 22; 13, 23; 13, 24; 14, 25; 14, 26; 15, 27; 15, 28; 16, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 21, 35; 21, 36; 22, 37; 23, 38; 23, 39; 24, 40; 25, 41; 25, 42; 26, 43; 27,... | def sortTitles(self, by):
"""
Sort titles by a given attribute and then by title.
@param by: A C{str}, one of 'length', 'maxScore', 'medianScore',
'readCount', or 'title'.
@raise ValueError: If an unknown C{by} value is given.
@return: A sorted C{list} of titles.
... |
0, module; 1, function_definition; 2, function_name:summary; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, identifier:sortOn; 11, None; 12, comment:"""
Summarize all the alignments for this title.
@param sortOn... | 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; 9, 14; 9, 15; 9, 16; 13, 17; 13, 18; 16, 19; 18, 20; 18, 21; 18, 22; 19, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 26, 29; 26, 30; 27, 31; 28, 32; 28, 33; 32, 34; 32, 35; 34, 36; 34, 37 | def summary(self, sortOn=None):
"""
Summarize all the alignments for this title.
@param sortOn: A C{str} attribute to sort titles on. One of 'length',
'maxScore', 'medianScore', 'readCount', or 'title'.
@raise ValueError: If an unknown C{sortOn} value is given.
@retu... |
0, module; 1, function_definition; 2, function_name:tabSeparatedSummary; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, comment:# The order of the fields returned here is somewhat arbitrary. The; 9, comment:# subject titles are last because they are so variable in length.... | 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; 19, 25; 20, 26; 20, 27; 20, 28; 21, 29; 25, 30; 25, 31; 27, 32; 27, 33; 28, 34; 29, 35; 29, 36; 32, 37; 32, 38; 33, 39; 34, 40; 35, 41; 35, 42; 36, 43; 40, 44; 4... | def tabSeparatedSummary(self, sortOn=None):
"""
Summarize all the alignments for this title as multi-line string with
TAB-separated values on each line.
@param sortOn: A C{str} attribute to sort titles on. One of 'length',
'maxScore', 'medianScore', 'readCount', or 'title'.
... |
0, module; 1, function_definition; 2, function_name:infer_namespaces; 3, parameters; 4, block; 5, identifier:ac; 6, expression_statement; 7, return_statement; 8, comment:"""infer possible namespaces of given accession based on syntax
Always returns a list, possibly empty
>>> infer_namespaces("ENST00000530893.6... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 9, 12; 11, 13; 11, 14; 12, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 18, 22; 18, 23; 20, 24; 20, 25; 21, 26 | def infer_namespaces(ac):
"""infer possible namespaces of given accession based on syntax
Always returns a list, possibly empty
>>> infer_namespaces("ENST00000530893.6")
['ensembl']
>>> infer_namespaces("ENST00000530893")
['ensembl']
>>> infer_namespaces("ENSQ00000530893")
[]
>>> in... |
0, module; 1, function_definition; 2, function_name:to_digraph; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, dictionary_splat_pattern; 8, expression_statement; 9, comment:# TODO: make test for this; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:args; 14, ide... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 16, 21; 16, 22; 18, 23; 18, 24; 19, 25; 19, 26; 19, 27; 19, 28; 19, 29; 19, 30; 19, 31; 19, 32; 22, 33; 22, 34; 25, 35; 26, 36; 26, 37; 27, 38; 28, 39; 28, 40; 29, 41; 30, 42; 30, 43; ... | def to_digraph(self, *args, **kwargs):
"""
Compute a directed graph for the chemical system.
Returns
-------
digraph : `networkx.DiGraph`
Graph nodes are reactants and/or products of chemical equations,
while edges represent the equations themselves. Doub... |
0, module; 1, function_definition; 2, function_name:get_streams; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, if_statement; 15, 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; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 9, 25; 10, 26; 11, 27; 11, 28; 12, 29; 13, 30; 14, 31; 14, 32; 15, 33; 16, 34; 17, 35; 27, 36; 27, 37; 28, 38; 29, 39; 29, 40; 30, 41; 30, 42; 32, 43; 32, 44; 33... | def get_streams(self, game=None, channels=None, limit=25, offset=0):
"""Return a list of streams queried by a number of parameters
sorted by number of viewers descending
:param game: the game or name of the game
:type game: :class:`str` | :class:`models.Game`
:param channels: li... |
0, module; 1, function_definition; 2, function_name:sort_queryset; 3, parameters; 4, block; 5, identifier:queryset; 6, identifier:request; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:context; 13, None; 14, comment:""" Returns a sorted qu... | 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; 11, 18; 15, 19; 15, 20; 17, 21; 20, 22; 20, 23; 21, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 24, 30; 24, 31; 25, 32; 26, 33; 27, 34; 27, 35; 29, 36; 31, 37; 31, 38; 32, 39; 33, 40; 37, 41; 37, 42; 38, 43; ... | def sort_queryset(queryset, request, context=None):
""" Returns a sorted queryset
The context argument is only used in the template tag
"""
sort_by = request.GET.get('sort_by')
if sort_by:
if sort_by in [el.name for el in queryset.model._meta.fields]:
queryset = queryset.order_by... |
0, module; 1, function_definition; 2, function_name:percentile; 3, parameters; 4, block; 5, identifier:data; 6, identifier:n; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, comment:"""Return the n-th percentile of the given data
Assume that th... | 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; 15, 23; 16, 24; 17, 25; 17, 26; 19, 27; 19, 28; 21, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 26, 36; 26, 37; 28, 38; 29, 39; 29, 40; 35, 41; 35, 42; 37, 43;... | def percentile(data, n):
"""Return the n-th percentile of the given data
Assume that the data are already sorted
"""
size = len(data)
idx = (n / 100.0) * size - 0.5
if idx < 0 or idx > size:
raise StatisticsError("Too few data points ({}) for {}th percentile".format(size, n))
re... |
0, module; 1, function_definition; 2, function_name:get_histogram; 3, parameters; 4, block; 5, identifier:data; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, for_stat... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 7, 17; 8, 18; 8, 19; 9, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 14, 26; 14, 27; 15, 28; 17, 29; 17, 30; 18, 31; 18, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 24, 42; 24, 43; 27, 4... | def get_histogram(data):
"""Return the histogram relative to the given data
Assume that the data are already sorted
"""
count = len(data)
if count < 2:
raise StatisticsError('Too few data points ({}) for get_histogram'.format(count))
min_ = data[0]
max_ = data[-1]
std = stde... |
0, module; 1, function_definition; 2, function_name:make_geohash_tables; 3, parameters; 4, block; 5, identifier:table; 6, identifier:listofprecisions; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# logic for accepting kwarg inputs; 12, for_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; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 7, 25; 8, 26; 9, 27; 10, 28; 12, 29; 12, 30; 12, 31; 14, 32; 16, 33; 18, 34; 19, 35; 19, 36; 20, 37; 22, 38; 22, 39; 22, 40; 23, 41; 23, 42; 23, 43; 24, 44; 24, ... | def make_geohash_tables(table,listofprecisions,**kwargs):
'''
sort_by - field to sort by for each group
return_squares - boolean arg if true returns a list of squares instead of writing out to table
'''
return_squares = False
sort_by = 'COUNT'
# logic for accepting kwarg inputs
for key,value in kwargs.iteritems... |
0, module; 1, function_definition; 2, function_name:coercer; 3, parameters; 4, block; 5, identifier:self; 6, identifier:dataSets; 7, expression_statement; 8, comment:# Xxx - This does a slightly complex (hey, it's like 20 lines, how; 9, comment:# complex could it really be?) thing to figure out which elements are; 10, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 7, 26; 19, 27; 19, 28; 19, 29; 20, 30; 21, 31; 22, 32; 23, 33; 23, 34; 23, 35; 24, 36; 25, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31, 44; 31,... | def coercer(self, dataSets):
"""
Coerce all of the repetitions and sort them into creations, edits and
deletions.
@rtype: L{ListChanges}
@return: An object describing all of the creations, modifications, and
deletions represented by C{dataSets}.
"""
#... |
0, module; 1, function_definition; 2, function_name:zcard; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, expression_statement; 8, with_statement; 9, comment:"""
Returns the cardinality of the SortedSet.
:param name: str the name of the redis key
:return: Future()
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 10, 12; 11, 13; 12, 14; 13, 15; 14, 16; 14, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 18, 23; 18, 24; 19, 25; 25, 26; 25, 27; 26, 28; 26, 29; 27, 30 | def zcard(self, name):
"""
Returns the cardinality of the SortedSet.
:param name: str the name of the redis key
:return: Future()
"""
with self.pipe as pipe:
return pipe.zcard(self.redis_key(name)) |
0, module; 1, function_definition; 2, function_name:zscore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:value; 8, expression_statement; 9, with_statement; 10, comment:"""
Return the score of an element
:param name: str the name of the redis key
:param valu... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 9, 12; 11, 13; 12, 14; 13, 15; 14, 16; 15, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 19, 24; 19, 25; 20, 26; 20, 27; 26, 28; 26, 29; 27, 30; 27, 31; 28, 32; 28, 33; 29, 34; 30, 35; 30, 36; 31, 37; 35, 38; 35, 39 | def zscore(self, name, value):
"""
Return the score of an element
:param name: str the name of the redis key
:param value: the element in the sorted set key
:return: Future()
"""
with self.pipe as pipe:
return pipe.zscore(self.redis_key(name),
... |
0, module; 1, function_definition; 2, function_name:zrank; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:value; 8, expression_statement; 9, with_statement; 10, comment:"""
Returns the rank of the element.
:param name: str the name of the redis key
:param val... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 9, 12; 11, 13; 12, 14; 12, 15; 13, 16; 14, 17; 15, 18; 16, 19; 16, 20; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 28, 34; 28, 35; 29, 36; 32, 37; 32, 38; 34, 39; 34, 40; 37, 41; 37, 42; 38, 4... | def zrank(self, name, value):
"""
Returns the rank of the element.
:param name: str the name of the redis key
:param value: the element in the sorted set
"""
with self.pipe as pipe:
value = self.valueparse.encode(value)
return pipe.zrank(self.... |
0, module; 1, function_definition; 2, function_name:zlexcount; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:min; 8, identifier:max; 9, expression_statement; 10, with_statement; 11, comment:"""
Return the number of items in the sorted set between the
lexicographical rang... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 9, 11; 10, 12; 10, 13; 12, 14; 13, 15; 14, 16; 15, 17; 16, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 20, 25; 20, 26; 21, 27; 21, 28; 21, 29; 27, 30; 27, 31; 30, 32; 30, 33; 31, 34 | def zlexcount(self, name, min, max):
"""
Return the number of items in the sorted set between the
lexicographical range ``min`` and ``max``.
:param name: str the name of the redis key
:param min: int or '-inf'
:param max: int or '+inf'
:return: Future()
... |
0, module; 1, function_definition; 2, function_name:zrevrangebylex; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:max; 8, identifier:min; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, with_statement; 13, identifier:start; 14, None; 15, identifier:num; 16, No... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 9, 13; 9, 14; 10, 15; 10, 16; 11, 17; 12, 18; 12, 19; 18, 20; 19, 21; 19, 22; 19, 23; 19, 24; 19, 25; 20, 26; 21, 27; 22, 28; 23, 29; 23, 30; 23, 31; 24, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 31, 40; 32, 41; 32, 42; 34, 43;... | def zrevrangebylex(self, name, max, min, start=None, num=None):
"""
Return the reversed lexicographical range of values from the sorted set
between ``max`` and ``min``.
If ``start`` and ``num`` are specified, then return a slice of the
range.
:param name: str the n... |
0, module; 1, function_definition; 2, function_name:zremrangebylex; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, identifier:min; 8, identifier:max; 9, expression_statement; 10, with_statement; 11, comment:"""
Remove all elements in the sorted set between the
lexicographical range ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 9, 11; 10, 12; 10, 13; 12, 14; 13, 15; 14, 16; 15, 17; 16, 18; 16, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 20, 25; 20, 26; 21, 27; 21, 28; 21, 29; 27, 30; 27, 31; 30, 32; 30, 33; 31, 34 | def zremrangebylex(self, name, min, max):
"""
Remove all elements in the sorted set between the
lexicographical range specified by ``min`` and ``max``.
Returns the number of elements removed.
:param name: str the name of the redis key
:param min: int or -inf
... |
0, module; 1, function_definition; 2, function_name:resort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:attributeID; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, identi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 11, 22; 12, 23; 12, 24; 12, 25; 12, 26; 12, 27; 12, 28; 13, 29; 14, 30; 18, 31; 18, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 23, 39; 23, 40; 27, 41; 28, 42; 29, 43; 29, ... | def resort(self, attributeID, isAscending=None):
"""Sort by one of my specified columns, identified by attributeID
"""
if isAscending is None:
isAscending = self.defaultSortAscending
newSortColumn = self.columns[attributeID]
if newSortColumn.sortAttribute() is None:
... |
0, module; 1, function_definition; 2, function_name:_sortAttributeValue; 3, parameters; 4, block; 5, identifier:self; 6, identifier:offset; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:"""
return the value of the sort attribute for the item at
'offset' in the results of the... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 8, 13; 9, 14; 11, 15; 11, 16; 12, 17; 13, 18; 17, 19; 18, 20; 19, 21; 19, 22; 20, 23; 22, 24; 22, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30; 25, 31; 28, 32; 28, 33; 29, 34; 29, 35; 30, 36; 30, 37; 32, 38; 32, 39; 34, 40; 34, 41; 36, 42; 36, 43;... | def _sortAttributeValue(self, offset):
"""
return the value of the sort attribute for the item at
'offset' in the results of the last query, otherwise None.
"""
if self._currentResults:
pageStart = (self._currentResults[offset][
self.currentSortColumn.... |
0, module; 1, function_definition; 2, function_name:resort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:columnName; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, comment:"""
Re-sort the table.
@par... | 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; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 20, 32; 21, 33; 21, 34; 23, 35; 23, 36; 25, 37; 25, 38; 28, 39; 31, 40; 32, 41; 32, 42; 37, 43; ... | def resort(self, columnName):
"""
Re-sort the table.
@param columnName: the name of the column to sort by. This is a string
because it is passed from the browser.
"""
csc = self.currentSortColumn
newSortColumn = self.columns[columnName]
if newSortColumn ... |
0, module; 1, function_definition; 2, function_name:rowsAfterValue; 3, parameters; 4, block; 5, identifier:self; 6, identifier:value; 7, identifier:count; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Retrieve some rows at or after a given sort-column value.
@param val... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 14, 19; 15, 20; 15, 21; 18, 22; 19, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 24, 32; 25, 33; 30, 34; 30, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 33, 41; 34, 42; 34, 43;... | def rowsAfterValue(self, value, count):
"""
Retrieve some rows at or after a given sort-column value.
@param value: Starting value in the index for the current sort column
at which to start returning results. Rows with a column value for the
current sort column which is greater... |
0, module; 1, function_definition; 2, function_name:rowsBeforeValue; 3, parameters; 4, block; 5, identifier:self; 6, identifier:value; 7, identifier:count; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Retrieve display data for rows with sort-column values less than the
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 9, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 14, 19; 15, 20; 15, 21; 18, 22; 19, 23; 19, 24; 19, 25; 20, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 24, 32; 25, 33; 26, 34; 26, 35; 27, 36; 28, 37; 30, 38; 30, 39; 31, 40; 31, 41; 32, 42; 32, 43;... | def rowsBeforeValue(self, value, count):
"""
Retrieve display data for rows with sort-column values less than the
given value.
@type value: Some type compatible with the current sort column.
@param value: Starting value in the index for the current sort column
at which t... |
0, module; 1, function_definition; 2, function_name:rowsBeforeItem; 3, parameters; 4, block; 5, identifier:self; 6, identifier:item; 7, identifier:count; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, if_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; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 13, 21; 14, 22; 14, 23; 15, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 23, 35; 23, 36; 24, 37; 24, 38; 26, 39; 26, 40; 28, 41; 28, 42; 30, 43; 30... | def rowsBeforeItem(self, item, count):
"""
The inverse of rowsAfterItem.
@param item: then L{Item} to request rows before.
@type item: this L{InequalityModel}'s L{itemType} attribute.
@param count: The maximum number of rows to return.
@type count: L{int}
@retu... |
0, module; 1, function_definition; 2, function_name:getTableMetadata; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, if_statement; 10, return_statement; 11, comment:"""
Retrieve a description of the various properties of this scrolltable.
... | 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; 9, 18; 10, 19; 12, 20; 12, 21; 13, 22; 13, 23; 14, 24; 14, 25; 15, 26; 15, 27; 15, 28; 15, 29; 16, 30; 16, 31; 17, 32; 18, 33; 19, 34; 19, 35; 19, 36; 19, 37; 19, 38; 24, 39; 24, 40; 26, 41; 27, 42; 28, 43; 28,... | def getTableMetadata(self):
"""
Retrieve a description of the various properties of this scrolltable.
@return: A sequence containing 5 elements. They are, in order, a
list of the names of the columns present, a mapping of column names
to two-tuples of their type and a boolean i... |
0, module; 1, function_definition; 2, function_name:getInitialArguments; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
Return the constructor arguments required for the JavaScript client class,
Mantissa.ScrollTable.Scro... | 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; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 18, 25; 19, 26; 19, 27; 20, 28; 21, 29; 21, 30; 25, 31; 25, 32; 26, 33; 26, 34; 28, 35 | def getInitialArguments(self):
"""
Return the constructor arguments required for the JavaScript client class,
Mantissa.ScrollTable.ScrollTable.
@return: a 3-tuple of::
- The unicode attribute ID of my current sort column
- A list of dictionaries with 'name' and 'typ... |
0, module; 1, function_definition; 2, function_name:build_database_sortmerna; 3, parameters; 4, block; 5, identifier:fasta_path; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, if_statement; 14, expression_... | 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; 4, 30; 4, 31; 4, 32; 6, 33; 6, 34; 7, 35; 7, 36; 8, 37; 8, 38; 9, 39; 9, 40; 10, 41; 11, 42; 11, 43; 12, 44; 13, 45; 13, 46; 1... | def build_database_sortmerna(fasta_path,
max_pos=None,
output_dir=None,
temp_dir=tempfile.gettempdir(),
HALT_EXEC=False):
""" Build sortmerna db from fasta_path; return db name
and list of fil... |
0, module; 1, function_definition; 2, function_name:sortmerna_ref_cluster; 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_parame... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 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 sortmerna_ref_cluster(seq_path=None,
sortmerna_db=None,
refseqs_fp=None,
result_path=None,
tabular=False,
max_e_value=1,
similarity=0.97,
... |
0, module; 1, function_definition; 2, function_name:sortmerna_map; 3, parameters; 4, block; 5, identifier:seq_path; 6, identifier:output_dir; 7, identifier:refseqs_fp; 8, identifier:sortmerna_db; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, 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; 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 sortmerna_map(seq_path,
output_dir,
refseqs_fp,
sortmerna_db,
e_value=1,
threads=1,
best=None,
num_alignments=None,
HALT_EXEC=False,
output_sam=False,
... |
0, module; 1, function_definition; 2, function_name:_dict_values_sorted_by_key; 3, parameters; 4, comment:# This should be a yield from instead.; 5, block; 6, identifier:dictionary; 7, expression_statement; 8, for_statement; 9, comment:"""Internal helper to return the values of a dictionary, sorted by key.
"""; 10,... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 5, 7; 5, 8; 7, 9; 8, 10; 8, 11; 8, 12; 10, 13; 10, 14; 11, 15; 11, 16; 12, 17; 16, 18; 16, 19; 17, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 21, 26; 21, 27; 24, 28; 24, 29; 28, 30; 28, 31; 29, 32 | def _dict_values_sorted_by_key(dictionary):
# This should be a yield from instead.
"""Internal helper to return the values of a dictionary, sorted by key.
"""
for _, value in sorted(dictionary.iteritems(), key=operator.itemgetter(0)):
yield value |
0, module; 1, function_definition; 2, function_name:uclust_cluster_from_sorted_fasta_filepath; 3, parameters; 4, block; 5, identifier:fasta_filepath; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, 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; 3, 15; 3, 16; 3, 17; 3, 18; 3, 19; 3, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 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 uclust_cluster_from_sorted_fasta_filepath(
fasta_filepath,
uc_save_filepath=None,
percent_ID=0.97,
max_accepts=1,
max_rejects=8,
stepwords=8,
word_length=8,
optimal=False,
exact=False,
suppress_sort=False,
enable_rev_strand_matc... |
0, module; 1, function_definition; 2, function_name:get_clusters_from_fasta_filepath; 3, parameters; 4, block; 5, identifier:fasta_filepath; 6, identifier:original_fasta_path; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, defau... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 3, 18; 3, 19; 3, 20; 3, 21; 3, 22; 3, 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; 7, 42; 7, 43; 8, 44; 8, 45; 9, 46; 9, 47; ... | def get_clusters_from_fasta_filepath(
fasta_filepath,
original_fasta_path,
percent_ID=0.97,
max_accepts=1,
max_rejects=8,
stepwords=8,
word_length=8,
optimal=False,
exact=False,
suppress_sort=False,
output_dir=None,
enable_r... |
0, module; 1, function_definition; 2, function_name:ls; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:startswith; 13, None; 14, string:'''
List all cubes... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 19, 25; 19, 26; 20, 27; 22, 28; 22, 29; 24, 30; 24, 31; 27, 32; 27, 33; 29, 34; 31, 35; 31, 36; 31, 37; 34, 38; 34, 39; 36, 40; 36, 41; 37, 42; 41, 43; 4... | def ls(self, startswith=None):
'''
List all cubes available to the calling client.
:param startswith: string to use in a simple "startswith" query filter
:returns list: sorted list of cube names
'''
logger.info('Listing cubes starting with "%s")' % startswith)
st... |
0, module; 1, function_definition; 2, function_name:usearch_sort_by_abundance; 3, parameters; 4, block; 5, identifier:fasta_filepath; 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, 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; 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; 6, 31; 6, 32; 7, 33; 7, 34; 8, 35; 8, 36; 9, 37; 9, 38; 10, 39; 10, 40; 11, 41; 11, 42; 12, 43; 12, 44; 13, 45; 13, 46;... | def usearch_sort_by_abundance(
fasta_filepath,
output_filepath=None,
sizein=True,
sizeout=True,
minsize=0,
log_name="abundance_sort.log",
usersort=False,
HALT_EXEC=False,
save_intermediate_files=False,
remove_usearch_logs=False,
wor... |
0, module; 1, function_definition; 2, function_name:usearch_cluster_error_correction; 3, parameters; 4, block; 5, identifier:fasta_filepath; 6, default_parameter; 7, default_parameter; 8, default_parameter; 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; 3, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 6, 31; 6, 32; 7, 33; 7, 34; 8, 35; 8, 36; 9, 37; 9, 38; 10, 39; 10, 40; 11, 41; 11, 42; 12, 43; 12, 44; 13, 45; 13, 46;... | def usearch_cluster_error_correction(
fasta_filepath,
output_filepath=None,
output_uc_filepath=None,
percent_id_err=0.97,
sizein=True,
sizeout=True,
w=64,
slots=16769023,
maxrejects=64,
log_name="usearch_cluster_err_corrected.log",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.