nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:usearch_chimera_filter_de_novo; 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; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 6, 27; 6, 28; 7, 29; 7, 30; 8, 31; 8, 32; 9, 33; 9, 34; 10, 35; 10, 36; 11, 37; 11, 38; 12, 39; 12, 40; 13, 41; 13, 42; 14, 43; 14, 44; 15, 45; 16,... | def usearch_chimera_filter_de_novo(
fasta_filepath,
output_chimera_filepath=None,
output_non_chimera_filepath=None,
abundance_skew=2.0,
log_name="uchime_de_novo_chimera_filtering.log",
usersort=False,
HALT_EXEC=False,
save_intermediate_files=False,
... |
0, module; 1, function_definition; 2, function_name:usearch_cluster_seqs_ref; 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, def... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 3, 18; 3, 19; 3, 20; 3, 21; 3, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 4, 37; 4, 38; 4, 39; 4, 40; 6, 41; 6, 42; 7, 43; 7, 44; 8, 45; 8, 46; 9, 47; ... | def usearch_cluster_seqs_ref(
fasta_filepath,
output_filepath=None,
percent_id=0.97,
sizein=True,
sizeout=True,
w=64,
slots=16769023,
maxrejects=64,
log_name="usearch_cluster_seqs.log",
usersort=True,
HALT_EXEC=False,
save_i... |
0, module; 1, function_definition; 2, function_name:assign_reads_to_otus; 3, parameters; 4, block; 5, identifier:original_fasta; 6, identifier:filtered_fasta; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 7, 26; 7, 27; 8, 28; 8, 29; 9, 30; 9, 31; 10, 32; 10, 33; 11, 34; 11, 35; 12, 36; 12, 37; 13, 38; 13, 39; 14, 40; 14, 41; 15, 42; 18, 43; 18, 44; 19, 45; ... | def assign_reads_to_otus(original_fasta,
filtered_fasta,
output_filepath=None,
log_name="assign_reads_to_otus.log",
perc_id_blast=0.97,
global_alignment=True,
HALT_EXEC=F... |
0, module; 1, function_definition; 2, function_name:sort_by_abundance_usearch61; 3, parameters; 4, block; 5, identifier:seq_path; 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, 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; 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; 7, 28; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 10, 34; 11, 35; 11, 36; 12, 37; 12, 38; 13, 39; 13, 40; 14, 41; 14, 42; 15, 43; 16, 44; 16, 45; 1... | def sort_by_abundance_usearch61(seq_path,
output_dir='.',
rev=False,
minlen=64,
remove_usearch_logs=False,
HALT_EXEC=False,
outp... |
0, module; 1, function_definition; 2, function_name:sort_by_length_usearch61; 3, parameters; 4, block; 5, identifier:seq_path; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, expression_... | 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; 13, 34; 14, 35; 15, 36; 16, 37; 16, 38; 17, 39; 18, 40; 19, 41; 33, 42; 34, 43; 35, 44; 35, ... | def sort_by_length_usearch61(seq_path,
output_dir=".",
minlen=64,
remove_usearch_logs=False,
HALT_EXEC=False,
output_fna_filepath=None,
log_name="... |
0, module; 1, function_definition; 2, function_name:usearch61_fast_cluster; 3, parameters; 4, block; 5, identifier:intermediate_fasta; 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, d... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 6, 25; 6, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 10, 34; 11, 35; 11, 36; 12, 37; 12, 38; 13, 39; 13, 40; 14, 41; 14, 42; 15, 43; 15, 44; 16, 45; 1... | def usearch61_fast_cluster(intermediate_fasta,
percent_id=0.97,
minlen=64,
output_dir=".",
remove_usearch_logs=False,
wordlength=8,
usearch61_maxrejects=8,
... |
0, module; 1, function_definition; 2, function_name:usearch61_smallmem_cluster; 3, parameters; 4, block; 5, identifier:intermediate_fasta; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 1... | 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; 4, 31; 6, 32; 6, 33; 7, 34; 7, 35; 8, 36; 8, 37; 9, 38; 9, 39; 10, 40; 10, 41; 11, 42; 11, 43; 12, 44; 12, 45; 13, 46; ... | def usearch61_smallmem_cluster(intermediate_fasta,
percent_id=0.97,
minlen=64,
rev=False,
output_dir=".",
remove_usearch_logs=False,
w... |
0, module; 1, function_definition; 2, function_name:normalize; 3, parameters; 4, block; 5, identifier:self; 6, dictionary_splat_pattern; 7, expression_statement; 8, comment:# FIXME: should it be performed in place? if it should; 9, comment:# be, the should there be no return value?; 10, for_statement; 11, return_stat... | 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; 10, 14; 10, 15; 10, 16; 11, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 21, 23; 22, 24; 22, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30; 25, 31; 25, 32; 26, 33; 26, 34; 30, 35; 31, 36; 31, 37; 31, 38; 35, 39; 35, 40; 37, 41; 37, 42; 38, 43... | def normalize(self, **kwargs):
"""
Adjust the offsetvector so that a particular instrument has
the desired offset. All other instruments have their
offsets adjusted so that the relative offsets are
preserved. The instrument to noramlize, and the offset one
wishes it to have, are provided as a key-word arg... |
0, module; 1, function_definition; 2, function_name:_modifyInternal; 3, parameters; 4, block; 5, identifier:self; 6, keyword_separator; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, function_definition; 14, function_de... | 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; 13, 27; 14, 28; 14, 29; 14, 30; 15, 31; 23, 32; 23, 33; 24, 34; 24, 35; 26, 36; 26, 37; 27, 38; 27, 39; 27, 40; 27, 41; 27, 42; 27, 43; 29, 44... | def _modifyInternal(self, *, sort=None, purge=False, done=None):
"""Creates a whole new database from existing one, based on given
modifiers.
:sort: pattern should look like this:
([(<index>, True|False)], {<level_index>: [(<index>, True|False)]}),
where True|False indicate whet... |
0, module; 1, function_definition; 2, function_name:_getPattern; 3, parameters; 4, block; 5, identifier:self; 6, identifier:ipattern; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, function_definition; 12, function_definition; 13, function_definition; 14, expression_statement; 15,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 7, 18; 7, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 11, 27; 12, 28; 12, 29; 12, 30; 13, 31; 13, 32; 13, 33; 14, 34; 15, 35; 16, 36; 16, 37; 16, 38; 17, 39; 21, 40; 21, 41; 22, 42; 23, 43; 23, 44;... | def _getPattern(self, ipattern, done=None):
"""Parses sort pattern.
:ipattern: A pattern to parse.
:done: If :ipattern: refers to done|undone,
use this to indicate proper state.
:returns: A pattern suitable for Model.modify.
"""
if ipattern is None:
... |
0, module; 1, function_definition; 2, function_name:view; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, dictionary_splat_pattern; 11, expression_statement; 12, expression_statement; 13, identifier:sort; 14, None; 15, identifier:p... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 12, 23; 23, 24; 23, 25; 25, 26; 25, 27; 26, 28; 26, 29; 27, 30; 28, 31; 28, 32; 29, 33; 29, 34; 29, 35; 31, 36; 31, 37; 33, 38; 33, 39; 34, 40; 34, 41; 35, 42; 35, 43; 39, 4... | def view(self, sort=None, purge=False, done=None, undone=None, **kwargs):
"""Handles the 'v' command.
:sort: Sort pattern.
:purge: Whether to purge items marked as 'done'.
:done: Done pattern.
:undone: Not done pattern.
:kwargs: Additional arguments to pass to the View o... |
0, module; 1, function_definition; 2, function_name:modify; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, identifier:sort; 13, None; 14, identifier:purge; 15, False; 16, identif... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 21, 22; 21, 23; 22, 24; 22, 25; 23, 26; 23, 27; 23, 28; 24, 29; 24, 30; 26, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 32, 37; 32, 38; 36, 39; 36, 40; 37, 41; 37, 42; 38, 43; 39, ... | def modify(self, sort=None, purge=False, done=None, undone=None):
"""Handles the 'm' command.
:sort: Sort pattern.
:purge: Whether to purge items marked as 'done'.
:done: Done pattern.
:undone: Not done pattern.
"""
self.model.modifyInPlace(
sort=sel... |
0, module; 1, function_definition; 2, function_name:inorder; 3, parameters; 4, block; 5, list_splat_pattern; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# default = identity; 11, if_statement; 12, expression_statement; 13, for_statement; 14, if_sta... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 5, 22; 6, 23; 7, 24; 8, 25; 9, 26; 11, 27; 11, 28; 12, 29; 13, 30; 13, 31; 13, 32; 14, 33; 14, 34; 14, 35; 15, 36; 15, 37; 15, 38; 16, 39; 17, 40; 17, 41; 19, 42; 20, 43; 21, 44; 21,... | def inorder(*iterables, **kwargs):
"""
A generator that yields the values from several ordered iterables
in order.
Example:
>>> x = [0, 1, 2, 3]
>>> y = [1.5, 2.5, 3.5, 4.5]
>>> z = [1.75, 2.25, 3.75, 4.25]
>>> list(inorder(x, y, z))
[0, 1, 1.5, 1.75, 2, 2.25, 2.5, 3, 3.5, 3.75, 4.25, 4.5]
>>> list(inorder(... |
0, module; 1, function_definition; 2, function_name:add_tag; 3, parameters; 4, block; 5, identifier:self; 6, identifier:tag; 7, identifier:value; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, if_statement; 13, comment:""" as tags are kept in a sorted order, a bisectio... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 8, 13; 9, 14; 10, 15; 11, 16; 11, 17; 12, 18; 12, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 19, 28; 21, 29; 21, 30; 25, 31; 25, 32; 26, 33; 28, 34; 30, 35; 30, 36; 32, 37; 33, 38; 33, 39; 34, 40; 34, 41; 35, 42; 35, 43;... | def add_tag(self, tag, value):
""" as tags are kept in a sorted order, a bisection is a fastest way to identify a correct position
of or a new tag to be added. An additional check is required to make sure w don't add duplicates
"""
index = bisect_left(self.tags, (tag, value))
con... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 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, if_stateme... | 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; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 10, 31; 11, 32; 11, 33; 12, 34; 12, 35; 13, 36; 13, 37; 14, 38; 15, 39; 15, 40; 16, 41; 17, 42; 17, 43; 18, 44; 18, 45... | def sort(self,
key,
by=None,
external=None,
offset=0,
limit=None,
order=None,
alpha=False,
store_as=None):
"""Returns or stores the elements contained in the list, set or sorted
set at key. By default... |
0, module; 1, function_definition; 2, function_name:zrange; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:start; 15, integer:0; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 12, 22; 12, 23; 13, 24; 17, 25; 21, 26; 21, 27; 23, 28; 24, 29; 24, 30; 27, 31; 27, 32; 27, 33; 27, 34; 28, 35; 29, 36; 29, 37; 30, 38; 31, 39; 35, 40; 35, 41; 41, 42; 42, 43 | def zrange(self, key, start=0, stop=-1, with_scores=False):
"""Returns the specified range of elements in the sorted set stored at
key. The elements are considered to be ordered from the lowest to the
highest score. Lexicographical order is used for elements with equal
score.
Se... |
0, module; 1, function_definition; 2, function_name:zrem; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, list_splat_pattern; 8, expression_statement; 9, return_statement; 10, identifier:members; 11, comment:"""Removes the specified members from the sorted set stored at key.
Non existing mem... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 12, 13; 12, 14; 13, 15; 13, 16; 14, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 20, 24; 23, 25 | def zrem(self, key, *members):
"""Removes the specified members from the sorted set stored at key.
Non existing members are ignored.
An error is returned when key exists and does not hold a sorted set.
.. note::
**Time complexity**: ``O(M*log(N))`` with ``N`` being the num... |
0, module; 1, function_definition; 2, function_name:zremrangebyscore; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:min_score; 8, identifier:max_score; 9, expression_statement; 10, return_statement; 11, comment:"""Removes all elements in the sorted set stored at key with a score
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 9, 11; 10, 12; 12, 13; 12, 14; 13, 15; 13, 16; 14, 17; 17, 18; 17, 19; 17, 20; 17, 21; 18, 22 | def zremrangebyscore(self, key, min_score, max_score):
"""Removes all elements in the sorted set stored at key with a score
between min and max.
Intervals are described in :meth:`~tredis.RedisClient.zrangebyscore`.
Returns the number of elements removed.
.. note::
... |
0, module; 1, function_definition; 2, function_name:zrevrange; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:start; 15, integer:0... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 11, 21; 12, 22; 12, 23; 13, 24; 17, 25; 21, 26; 21, 27; 23, 28; 24, 29; 24, 30; 27, 31; 27, 32; 27, 33; 27, 34; 28, 35; 29, 36; 29, 37; 30, 38; 31, 39; 35, 40; 35, 41; 41, 42; 42, 43 | def zrevrange(self, key, start=0, stop=-1, with_scores=False):
"""Returns the specified range of elements in the sorted set stored at
key. The elements are considered to be ordered from the highest to the
lowest score. Descending lexicographical order is used for elements
with equal scor... |
0, module; 1, function_definition; 2, function_name:_sortObjects; 3, parameters; 4, block; 5, default_parameter; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, return_statement; 14, identifier:ord... | 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; 5, 14; 5, 15; 6, 16; 7, 17; 8, 18; 9, 19; 9, 20; 9, 21; 10, 22; 11, 23; 12, 24; 12, 25; 12, 26; 13, 27; 15, 28; 18, 29; 18, 30; 20, 31; 20, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 25, 40; 26, 41; 31, 42; 31, 43; 33, 44... | def _sortObjects(orderby='created', **kwargs):
"""Sorts lists of objects and combines them into a single list"""
o = []
for m in kwargs.values():
for l in iter(m):
o.append(l)
o = list(set(o))
sortfunc = _sortByCreated if orderby == 'created' else _sortByModified
if six.... |
0, module; 1, function_definition; 2, function_name:_sortByCreated; 3, parameters; 4, block; 5, identifier:a; 6, identifier:b; 7, expression_statement; 8, if_statement; 9, comment:"""Sort function for object by created date"""; 10, comparison_operator:a.created < b.created; 11, block; 12, elif_clause; 13, else_clause; ... | 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; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 28, 34; 33, 35 | def _sortByCreated(a, b):
"""Sort function for object by created date"""
if a.created < b.created:
return 1
elif a.created > b.created:
return -1
else:
return 0 |
0, module; 1, function_definition; 2, function_name:_sortByModified; 3, parameters; 4, block; 5, identifier:a; 6, identifier:b; 7, expression_statement; 8, if_statement; 9, comment:"""Sort function for object by modified date"""; 10, comparison_operator:a.modified < b.modified; 11, block; 12, elif_clause; 13, else_clau... | 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; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 17, 25; 17, 26; 18, 27; 19, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 28, 34; 33, 35 | def _sortByModified(a, b):
"""Sort function for object by modified date"""
if a.modified < b.modified:
return 1
elif a.modified > b.modified:
return -1
else:
return 0 |
0, module; 1, function_definition; 2, function_name:wngram2idngram; 3, parameters; 4, block; 5, identifier:input_file; 6, identifier:vocab_file; 7, identifier:output_file; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_... | 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; 8, 34; 8, 35; 9, 36; 9, 37; 10, 38; 10, 39; 11, 40; 11, 41; 12, 42; 12, 43; 13, 44; 13, 45; 14, 46... | def wngram2idngram(input_file, vocab_file, output_file, buffersize=100, hashtablesize=2000000, files=20, compress=False, verbosity=2, n=3, write_ascii=False, fof_size=10):
"""
Takes a word N-gram file and a vocabulary file and lists every id n-gram which occurred in the text, along with its number of occurr... |
0, module; 1, function_definition; 2, function_name:get_top; 3, parameters; 4, block; 5, identifier:self; 6, identifier:stat; 7, identifier:n; 8, expression_statement; 9, return_statement; 10, comment:"""Return the top n values when sorting by 'stat'"""; 11, subscript; 12, call; 13, slice; 14, identifier:sorted; 15, ar... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 11, 12; 11, 13; 12, 14; 12, 15; 13, 16; 15, 17; 15, 18; 15, 19; 17, 20; 17, 21; 18, 22; 18, 23; 19, 24; 19, 25; 23, 26; 23, 27; 26, 28; 27, 29; 27, 30; 30, 31; 30, 32 | def get_top(self, stat, n):
"""Return the top n values when sorting by 'stat'"""
return sorted(self.stats, key=lambda x: getattr(x, stat), reverse=True)[:n] |
0, module; 1, function_definition; 2, function_name:toposort; 3, parameters; 4, block; 5, identifier:initialAtoms; 6, identifier:initialBonds; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# for the atom and bond hashes; 13, co... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 7, 29; 8, 30; 9, 31; 10, 32; 11, 33; 15, 34; 16, 35; 17, 36; 17, 37; 17, 38; 18, 39; 18, 40; 18, 41; 19, 42; 20, 43; 22, 44; 22, 45; ... | def toposort(initialAtoms, initialBonds):
"""initialAtoms, initialBonds -> atoms, bonds
Given the list of atoms and bonds in a ring
return the topologically sorted atoms and bonds.
That is each atom is connected to the following atom
and each bond is connected to the following bond in
the follow... |
0, module; 1, function_definition; 2, function_name:flip_uuid_parts; 3, parameters; 4, block; 5, identifier:uuid; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""
Flips high and low segments of the timestamp portion of a UUID str... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 21, 28; 21, 29; 22, 30; 22, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43;... | def flip_uuid_parts(uuid):
"""
Flips high and low segments of the timestamp portion of a UUID string.
This enables correct lexicographic sorting. Because it is a simple flip,
this function works in both directions.
"""
flipped_uuid = uuid.split('-')
flipped_uuid[0], flipped_uuid[2] = flipped_uuid[2], flip... |
0, module; 1, function_definition; 2, function_name:SortedSet; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:initial; 11, None; 12, comment:"""The sorted set datatype.
:param name: The name of the sorted set.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 7, 10; 7, 11; 8, 12; 9, 13; 13, 14; 13, 15; 14, 16; 14, 17; 15, 18; 15, 19; 15, 20; 19, 21; 19, 22 | def SortedSet(self, name, initial=None):
"""The sorted set datatype.
:param name: The name of the sorted set.
:param initial: Initial members of the set as an iterable
of ``(element, score)`` tuples.
See :class:`redish.types.SortedSet`.
"""
return types.Sort... |
0, module; 1, function_definition; 2, function_name:add; 3, parameters; 4, block; 5, identifier:self; 6, identifier:member; 7, identifier:score; 8, expression_statement; 9, return_statement; 10, comment:"""Add the specified member to the sorted set, or update the score
if it already exist."""; 11, call; 12, att... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 11, 12; 11, 13; 12, 14; 12, 15; 13, 16; 13, 17; 13, 18; 14, 19; 14, 20; 16, 21; 16, 22 | def add(self, member, score):
"""Add the specified member to the sorted set, or update the score
if it already exist."""
return self.client.zadd(self.name, member, score) |
0, module; 1, function_definition; 2, function_name:deserialize; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:value; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, comment:"""
Generates a Peer instance via a JSON stri... | 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; 19, 30; 19, 31; 20, 32; 21, 33; 21, 34; 23, 35; 23, 36; 26, 37; 29, 38; 32, 39; 34, 40; 34, 41; 34, 42; 35, 43; 3... | def deserialize(cls, value):
"""
Generates a Peer instance via a JSON string of the sort generated
by `Peer.deserialize`.
The `name` and `ip` keys are required to be present in the JSON map,
if the `port` key is not present the default is used.
"""
parsed = json.... |
0, module; 1, function_definition; 2, function_name:apply_config; 3, parameters; 4, block; 5, identifier:self; 6, identifier:config; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expr... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 13, 21; 14, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26... | def apply_config(self, config):
"""
Takes a given validated config dictionary and sets an instance
attribute for each one.
For check definitions, a Check instance is is created and a `checks`
attribute set to a dictionary keyed off of the checks' names. If
the Check ins... |
0, module; 1, function_definition; 2, function_name:get_key; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:key; 11, None; 12, identifier:keyfile; 13, None; 14, comment:""" returns a key given either its value, a path to... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 5, 10; 5, 11; 6, 12; 6, 13; 7, 14; 8, 15; 8, 16; 9, 17; 15, 18; 15, 19; 16, 20; 20, 21; 20, 22; 20, 23; 21, 24; 21, 25; 22, 26; 22, 27; 23, 28; 26, 29; 27, 30; 27, 31; 27, 32; 28, 33; 29, 34; 29, 35; 30, 36; 30, 37; 31, 38; 32, 39; 33, 40; 35, 41; 35, 42; 38, 43; 39... | def get_key(key=None, keyfile=None):
""" returns a key given either its value, a path to it on the filesystem
or as last resort it checks the environment variable CRYPTOYAML_SECRET
"""
if key is None:
if keyfile is None:
key = environ.get('CRYPTOYAML_SECRET')
if key is No... |
0, module; 1, function_definition; 2, function_name:getList; 3, parameters; 4, block; 5, identifier:self; 6, identifier:full_path; 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, i... | 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; 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; 15, 35; 16, 36; 17, 37; 18, 38; 18, 39; 18, 40; 24, 41; 26, 42; 34, 43; 34, 44; 3... | def getList(self, full_path, type = 1, dept = 0, sort = 'name', order = 'asc', startnum = 0, pagingrow = 1000, dummy = 56184):
"""Get a list of files
>>> nd_list = nd.getList('/', type=3)
>>> print nd_list
There are 5 kinds of ``type``:
- 1 => only directories with ... |
0, module; 1, function_definition; 2, function_name:list_assignment_groups; 3, parameters; 4, block; 5, identifier:self; 6, identifier:course_id; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, expres... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 7, 36; 7, 37; 8, 38; 8, 39; 9, 40; 9, 41; 10, 42; 10, 43; 11, 44; 11, 45; 12, 46; 13... | def list_assignment_groups(self, course_id, exclude_assignment_submission_types=None, grading_period_id=None, include=None, override_assignment_dates=None, scope_assignments_to_student=None):
"""
List assignment groups.
Returns the list of assignment groups for the current context. The retu... |
0, module; 1, function_definition; 2, function_name:_sorted_keys; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, try_statement; 8, return_statement; 9, comment:"""
Return list of keys sorted by version
Sorting is done based on :py:func:`pkg_resources.parse_version`
"""... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 8, 12; 10, 13; 11, 14; 11, 15; 13, 16; 15, 17; 16, 18; 16, 19; 17, 20; 19, 21; 19, 22; 20, 23; 20, 24; 21, 25; 21, 26; 22, 27; 24, 28; 24, 29; 28, 30; 28, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 33, 37; 33, 38; 37, 39; 37, 40; 38, 41; 38, 42; 39, 4... | def _sorted_keys(self):
"""
Return list of keys sorted by version
Sorting is done based on :py:func:`pkg_resources.parse_version`
"""
try:
keys = self._cache['sorted_keys']
except KeyError:
keys = self._cache['sorted_keys'] = sorted(self.keys(), ... |
0, module; 1, function_definition; 2, function_name:query; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, if_statement; 14, expression_statement; 15, comment:#... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 7, 32; 7, 33; 8, 34; 8, 35; 9, 36; 9, 37; 10, 38; 10, 39; 11, 40; 11, 41; 12, 42; 13, 43; 13, 44; 14, 45; 16, 46... | def query(self, query, filters=None, columns=None, sort=None, start=0, rows=30):
"""
Queries Solr and returns results
query - Text query to search for
filters - dictionary of filters to apply when searching in form of { "field":"filter_value" }
columns - columns to return, list ... |
0, module; 1, function_definition; 2, function_name:search_videohub; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:query; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, comment:# construct url; 14, expression_stat... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 9, 35; 10, 36; 10, 37; 11, 38; 11, 39; 12, 40; 14, 41; 16, 42; 18, 43; 19, 44; 19, 45; 20, ... | def search_videohub(cls, query, filters=None, status=None, sort=None, size=None, page=None):
"""searches the videohub given a query and applies given filters and other bits
:see: https://github.com/theonion/videohub/blob/master/docs/search/post.md
:see: https://github.com/theonion/videohub/blob... |
0, module; 1, function_definition; 2, function_name:insert; 3, parameters; 4, block; 5, identifier:self; 6, identifier:key; 7, identifier:value; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""Insert a key-value pair in the list.
The pair is ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 10, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 25, 30; 25, 31; 26, 32; 26, 33 | def insert(self, key, value):
"""Insert a key-value pair in the list.
The pair is inserted at the correct location so that the list remains
sorted on *key*. If a pair with the same key is already in the list,
then the pair is appended after all other pairs with that key.
"""
... |
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, if_statement; 12, return_statement; 13, identifier:sorting; 14, identifier:kwargs; 15, comme... | 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; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 11, 21; 12, 22; 16, 23; 16, 24; 17, 25; 17, 26; 19, 27; 19, 28; 19, 29; 19, 30; 21, 31; 22, 32; 22, 33; 27, 34; 28, 35; 28, 36; 29, 37; 29, 38; 30, 39; 31, 40; 34, 41; 34, 42; 35, 43; 3... | def sort(self, *sorting, **kwargs):
"""Sort resources."""
sorting_ = []
for name, desc in sorting:
field = self.meta.model._meta.fields.get(name)
if field is None:
continue
if desc:
field = field.desc()
sorting_.appe... |
0, module; 1, function_definition; 2, function_name:split; 3, parameters; 4, block; 5, identifier:self; 6, identifier:indices; 7, expression_statement; 8, return_statement; 9, comment:"""
Splits logical networks according to given indices
Parameters
----------
indices : list
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 10, 11; 10, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 16, 19; 16, 20; 17, 21; 17, 22; 19, 23; 19, 24; 20, 25; 20, 26; 25, 27; 25, 28 | def split(self, indices):
"""
Splits logical networks according to given indices
Parameters
----------
indices : list
1-D array of sorted integers, the entries indicate where the array is split
Returns
-------
list
List of :class:... |
0, module; 1, function_definition; 2, function_name:movies_box_office; 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:"""Gets the top b... | 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; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 24, 31; 24, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 33, 38 | def movies_box_office(self, **kwargs):
"""Gets the top box office earning movies from the API.
Sorted by most recent weekend gross ticket sales.
Args:
limit (optional): limits the number of movies returned, default=10
country (optional): localized data for selected countr... |
0, module; 1, function_definition; 2, function_name:get_parents; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Return sorted list of names of packages without dependants."""; 11, assignment; 12, assignment... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 6, 11; 7, 12; 8, 13; 9, 14; 11, 15; 11, 16; 12, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 16, 23; 16, 24; 18, 25; 18, 26; 20, 27; 20, 28; 20, 29; 22, 30; 24, 31; 25, 32; 25, 33; 26, 34; 26, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43;... | def get_parents():
"""Return sorted list of names of packages without dependants."""
distributions = get_installed_distributions(user_only=ENABLE_USER_SITE)
remaining = {d.project_name.lower() for d in distributions}
requirements = {r.project_name.lower() for d in distributions for
r... |
0, module; 1, function_definition; 2, function_name:get_realnames; 3, parameters; 4, block; 5, identifier:packages; 6, expression_statement; 7, return_statement; 8, comment:"""
Return list of unique case-correct package names.
Packages are listed in a case-insensitive sorted order.
"""; 9, call; 10, identi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 11, 13; 12, 14; 12, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 17, 22; 17, 23; 18, 24; 18, 25; 22, 26; 23, 27; 23, 28; 25, 29; 27, 30; 27, 31 | def get_realnames(packages):
"""
Return list of unique case-correct package names.
Packages are listed in a case-insensitive sorted order.
"""
return sorted({get_distribution(p).project_name for p in packages},
key=lambda n: n.lower()) |
0, module; 1, function_definition; 2, function_name:build_sort; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, string; 11, assignment; 12, assignment; 13, assignment; 14, list_comprehension; 15, string_content:Build s... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 6, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 11, 17; 12, 18; 12, 19; 13, 20; 13, 21; 14, 22; 14, 23; 14, 24; 17, 25; 17, 26; 19, 27; 19, 28; 19, 29; 21, 30; 21, 31; 22, 32; 23, 33; 23, 34; 24, 35; 25, 36; 25, 37; 26, 38; 27, 39; 28, 40; 28, 41; 30, 42; 30, 43;... | def build_sort():
'''Build sort query paramter from kwargs'''
sorts = request.args.getlist('sort')
sorts = [sorts] if isinstance(sorts, basestring) else sorts
sorts = [s.split(' ') for s in sorts]
return [{SORTS[s]: d} for s, d in sorts if s in SORTS] |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:transactions; 6, expression_statement; 7, return_statement; 8, comment:""" Return a list of sorted transactions by date. """; 9, subscript; 10, call; 11, slice; 12, attribute; 13, argument_list; 14, identifier:transactions;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 12, 14; 12, 15; 13, 16; 16, 17; 16, 18; 18, 19; 18, 20; 19, 21; 20, 22; 20, 23; 22, 24; 22, 25; 23, 26; 23, 27; 24, 28; 24, 29; 26, 30; 26, 31; 27, 32; 30, 33; 30, 34; 33, 35; 33, 36; 34, 37; 37, 38 | def sort(transactions):
""" Return a list of sorted transactions by date. """
return transactions.sort(key=lambda x: datetime.datetime.strptime(x.split(':')[0], '%Y-%m-%d'))[:] |
0, module; 1, function_definition; 2, function_name:duplicates; 3, parameters; 4, block; 5, identifier:base; 6, identifier:items; 7, expression_statement; 8, for_statement; 9, comment:"""Get an iterator of items similar but not equal to the base.
@param base: base item to perform comparison against
@param item... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 8, 12; 12, 13; 13, 14; 13, 15; 14, 16; 14, 17; 15, 18; 16, 19; 16, 20; 17, 21; 18, 22; 19, 23; 19, 24; 20, 25; 21, 26; 21, 27; 22, 28; 26, 29; 26, 30; 27, 31 | def duplicates(base, items):
"""Get an iterator of items similar but not equal to the base.
@param base: base item to perform comparison against
@param items: list of items to compare to the base
@return: generator of items sorted by similarity to the base
"""
for item in items:
if ite... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:base; 6, identifier:items; 7, expression_statement; 8, return_statement; 9, comment:"""Get a sorted list of items ranked in descending similarity.
@param base: base item to perform comparison against
@param items: ... | 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; 12, 15; 14, 16; 14, 17; 15, 18; 15, 19; 17, 20; 17, 21 | def sort(base, items):
"""Get a sorted list of items ranked in descending similarity.
@param base: base item to perform comparison against
@param items: list of items to compare to the base
@return: list of items sorted by similarity to the base
"""
return sorted(items, key=base.similarity, re... |
0, module; 1, function_definition; 2, function_name:Subclasses; 3, parameters; 4, block; 5, identifier:cls; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, if_statement; 12, expression_statement; 13, return_statement; 14, identifier:sort_by; 15, None;... | 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; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 13, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 23, 34; 23, 35; 24, 36; 25, 37; 25, 38; 28, 39; 28, 40; 32, 41; 33, 42; 33, 43; 36, ... | def Subclasses(cls, sort_by=None, reverse=False):
"""Get all nested Constant class and it's name pair.
:param sort_by: the attribute name used for sorting.
:param reverse: if True, return in descend order.
:returns: [(attr, value),...] pairs.
::
>>> class MyClass(Const... |
0, module; 1, function_definition; 2, function_name:subclasses; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:sort_by; 13, None; 14, identifier:reverse; 15, False; 16, com... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 23, 30; 23, 31; 26, 32; 26, 33; 27, 34; 27, 35; 28, 36; 29, 37; 36, 38; 36, 39; 37, 40; 37, 41; 39, 42; 39, 43; 40... | def subclasses(self, sort_by=None, reverse=False):
"""Get all nested Constant class instance and it's name pair.
:param sort_by: the attribute name used for sorting.
:param reverse: if True, return in descend order.
:returns: [(attr, value),...] pairs.
::
>>> class... |
0, module; 1, function_definition; 2, function_name:organize_dir; 3, parameters; 4, block; 5, identifier:orig_dir; 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, for_... | 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; 9, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 13, 25; 14, 26; 14, 27; 14, 28; 15, 29; 15, 30; 15, 31; 16, 32; 17, 33; 17, 34; 18, 35; 18, 36; 19, 37; 19, 38; 20, 39; 20, 40; 23, 41; 23, 42; 24, 43; 24, ... | def organize_dir(orig_dir):
'''scans through the given directory and organizes DICOMs that look similar into subdirectories
output directory is the ``orig_dir`` with ``-sorted`` appended to the end'''
tags = [
(0x10,0x20), # Subj ID
(0x8,0x21), # Date
(0x8,0x31), # Time
... |
0, module; 1, function_definition; 2, function_name:reconstruct_files; 3, parameters; 4, block; 5, identifier:input_dir; 6, expression_statement; 7, expression_statement; 8, with_statement; 9, string; 10, assignment; 11, with_clause; 12, comment:# Some datasets start with a ".", which confuses many programs; 13, block;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 8, 12; 8, 13; 9, 14; 10, 15; 10, 16; 11, 17; 13, 18; 13, 19; 13, 20; 13, 21; 16, 22; 16, 23; 17, 24; 18, 25; 18, 26; 18, 27; 19, 28; 20, 29; 21, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43;... | def reconstruct_files(input_dir):
'''sorts ``input_dir`` and tries to reconstruct the subdirectories found'''
input_dir = input_dir.rstrip('/')
with nl.notify('Attempting to organize/reconstruct directory'):
# Some datasets start with a ".", which confuses many programs
for r,ds,fs in os.wal... |
0, module; 1, function_definition; 2, function_name:lint; 3, parameters; 4, block; 5, identifier:self; 6, identifier:targets; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, with_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, comment:"""Run linter... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 12, 20; 13, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 25, 36; 25, 37; 26, 38; 27, 39; 29, 40; 29, 41; 29, 42; 30, 43; 3... | def lint(self, targets):
"""Run linters in parallel and sort all results.
Args:
targets (list): List of files and folders to lint.
"""
LinterRunner.targets = targets
linters = self._config.get_linter_classes()
with Pool() as pool:
out_err_none = p... |
0, module; 1, function_definition; 2, function_name:_linear_interp; 3, parameters; 4, block; 5, identifier:curve; 6, identifier:test_x; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, identifier:round_result; 12, False; 13, comment:"""
Take a series of points and inter... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 10, 17; 10, 18; 10, 19; 14, 20; 14, 21; 16, 22; 16, 23; 18, 24; 18, 25; 19, 26; 23, 27; 24, 28; 24, 29; 25, 30; 25, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 29, 37; 30, 38; 30, 39; 30, 40; 31, 41; 31, 42; 31, 43;... | def _linear_interp(curve, test_x, round_result=False):
"""
Take a series of points and interpolate between them at ``test_x``.
Args:
curve (list[tuple]): A list of ``(x, y)`` points sorted in
nondecreasing ``x`` value. If multiple points have the same
``x`` value, all but th... |
0, module; 1, function_definition; 2, function_name:bound_weights; 3, parameters; 4, block; 5, identifier:weights; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, comment:# Copy weights to avoid side-effects; 10, expression_statement; 11, comment:# Remove weights outside of minimum and maximum; ... | 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; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 10, 23; 12, 24; 12, 25; 12, 26; 12, 27; 12, 28; 15, 29; 15, 30; 16, 31; 16, 32; 17, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44;... | def bound_weights(weights, minimum=None, maximum=None):
"""
Bound a weight list so that all outcomes fit within specified bounds.
The probability distribution within the ``minimum`` and ``maximum``
values remains the same. Weights in the list with outcomes outside of
``minimum`` and ``maximum`` are... |
0, module; 1, function_definition; 2, function_name:weighted_rand; 3, parameters; 4, block; 5, identifier:weights; 6, default_parameter; 7, expression_statement; 8, comment:# If just one weight is passed, simply return the weight's name; 9, if_statement; 10, comment:# Is there a way to do this more efficiently? Maybe e... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 9, 23; 9, 24; 12, 25; 13, 26; 14, 27; 15, 28; 16, 29; 18, 30; 19, 31; 19, 32; 19, 33; 19, 34; 23, 35; 23, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44; 2... | def weighted_rand(weights, round_result=False):
"""
Generate a non-uniform random value based on a list of weight tuples.
Treats weights as coordinates for a probability distribution curve and
rolls accordingly. Constructs a piece-wise linear curve according to
coordinates given in ``weights`` and ... |
0, module; 1, function_definition; 2, function_name:_cmp_key; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:obj; 13, None; 14, comment:"""Comparison key for sorting resu... | 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; 8, 16; 9, 17; 10, 18; 11, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 19, 28; 19, 29; 21, 30; 23, 31; 23, 32; 23, 33; 25, 34; 25, 35; 25, 36; 26, 37; 26, 38; 29, 39; 29, 40; 30, 41; 30, 42; 31, 43; 31... | def _cmp_key(self, obj=None):
"""Comparison key for sorting results from all linters.
The sort should group files and lines from different linters to make it
easier for refactoring.
"""
if not obj:
obj = self
line_nr = int(obj.line_nr) if obj.line_nr else 0
... |
0, module; 1, function_definition; 2, function_name:_create_output_from_match; 3, parameters; 4, block; 5, identifier:self; 6, identifier:match_result; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""As isort outputs full path, we change it to relative pat... | 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; 20, 25; 20, 26; 20, 27; 22, 28; 23, 29; 23, 30; 24, 31; 25, 32; 25, 33; 27, 34; 27, 35; 35, 36 | def _create_output_from_match(self, match_result):
"""As isort outputs full path, we change it to relative path."""
full_path = match_result['full_path']
path = self._get_relative_path(full_path)
return LinterOutput(self.name, path, match_result['msg']) |
0, module; 1, function_definition; 2, function_name:get_cached_filename; 3, parameters; 4, block; 5, identifier:self; 6, identifier:filename; 7, identifier:extention; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:settings_list; 13, None; 14, comment:"""Cre... | 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; 21, 26; 21, 27; 22, 28; 25, 29; 25, 30; 28, 31; 28, 32; 32, 33; 32, 34; 33, 35; 33, 36 | def get_cached_filename(self, filename, extention, settings_list=None):
"""Creates a filename with md5 cache string based on settings list
Args:
filename (str): the filename without extention
extention (str): the file extention without dot. (i.e. 'pkl')
settings_list... |
0, module; 1, function_definition; 2, function_name:sort_func; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:variant; 10, identifier:VARIANT1; 11, identifier:case_sensitive; 12, False; 13, comment:"""A function generator that can be used... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 5, 9; 5, 10; 6, 11; 6, 12; 7, 13; 8, 14; 14, 15; 14, 16; 15, 17; 16, 18; 16, 19; 19, 20; 19, 21; 19, 22; 21, 23; 21, 24; 22, 25; 22, 26 | def sort_func(variant=VARIANT1, case_sensitive=False):
"""A function generator that can be used for sorting.
All keywords are passed to `normalize()` and generate keywords that
can be passed to `sorted()`::
>>> key = sort_func()
>>> print(sorted(["fur", "far"], key=key))
[u'far', u'fur']... |
0, module; 1, function_definition; 2, function_name:_notify_reader_writes; 3, parameters; 4, block; 5, identifier:writeto; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""Notify reader closures about these writes and return a sorted
list of thus-satisfied c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 14, 18; 15, 19; 15, 20; 18, 21; 18, 22; 19, 23; 19, 24; 20, 25; 21, 26; 21, 27; 22, 28; 28, 29; 28, 30; 28, 31; 30, 32; 30, 33; 31, 34; 31, 35; 34, 36; 35, 37; 35, 38; 36, 39; 36, 40; 37, 41; 37, 42; 38, 43; ... | def _notify_reader_writes(writeto):
"""Notify reader closures about these writes and return a sorted
list of thus-satisfied closures.
"""
satisfied = []
for var in writeto:
if var.readable:
for reader in var.readers:
reader.notify_read_ready()
i... |
0, module; 1, function_definition; 2, function_name:getFilePathsWithExtensionsInDirectory; 3, parameters; 4, block; 5, identifier:dirTree; 6, identifier:patterns; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, if_statement; 12, return_statement; 13, identifier:sort; 14, T... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 11, 21; 12, 22; 16, 23; 16, 24; 17, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 21, 31; 28, 32; 28, 33; 29, 34; 30, 35; 30, 36; 30, 37; 31, 38; 37, 39; 38, 40; 38, 41; 39, 42; 39, 43; 3... | def getFilePathsWithExtensionsInDirectory(dirTree, patterns, sort=True):
"""
Returns all file paths that match any one of patterns in a
file tree with its root at dirTree. Sorts the paths by default.
"""
filePaths = []
for root, dirs, files in os.walk(dirTree):
for filePath in files:
... |
0, module; 1, function_definition; 2, function_name:shellsort; 3, parameters; 4, block; 5, identifier:inlist; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# integer division needed; 12, while_statement; 13, comment:# svec is no... | 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; 9, 18; 10, 19; 12, 20; 12, 21; 14, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 21, 33; 21, 34; 21, 35; 22, 36; 22, 37; 24, 38; 24, 39; 26, 40; 26, 41; 28, 42; 28, 43; 30,... | def shellsort(inlist):
"""
Shellsort algorithm. Sorts a 1D-list.
Usage: lshellsort(inlist)
Returns: sorted-inlist, sorting-index-vector (for original list)
"""
n = len(inlist)
svec = copy.deepcopy(inlist)
ivec = range(n)
gap = n / 2 # integer division needed
while gap > 0:
for i in... |
0, module; 1, function_definition; 2, function_name:rankdata; 3, parameters; 4, block; 5, identifier:inlist; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, comment:"""
Ra... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 11, 19; 12, 20; 12, 21; 12, 22; 13, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 21, 34; 21, 35; 22, 36; 22, 37; 22, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27... | def rankdata(inlist):
"""
Ranks the data in inlist, dealing with ties appropritely. Assumes
a 1D inlist. Adapted from Gary Perlman's |Stat ranksort.
Usage: rankdata(inlist)
Returns: a list of length equal to inlist, containing rank scores
"""
n = len(inlist)
svec, ivec = shellsort(inlist)
sumranks ... |
0, module; 1, function_definition; 2, function_name:to_json; 3, parameters; 4, block; 5, identifier:self; 6, keyword_separator; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, return_statement; 11, identifier:indent; 12, None; 13, identifier:sort_keys; 14, False; 15, comment:"""Gets the object'... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 8, 14; 9, 15; 10, 16; 16, 17; 16, 18; 17, 19; 17, 20; 18, 21; 18, 22; 18, 23; 18, 24; 21, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 25, 35; 26, 36; 26, 37; 27, 38; 33, 39; 33, 40; 36, 41; 36, 42; 37, 43; ... | def to_json(self, *, indent=None, sort_keys = False):
"""Gets the object's JSON representation.
Parameters
----------
indent: :class:`int`, optional
Number of spaces used as indentation, ``None`` will return the shortest possible string.
sort_keys: :class:`bool`, opt... |
0, module; 1, function_definition; 2, function_name:get_sort_field; 3, parameters; 4, block; 5, identifier:attr; 6, identifier:model; 7, expression_statement; 8, try_statement; 9, comment:"""
Get's the field to sort on for the given
attr.
Currently returns attr if it is a field on
the given model.
... | 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; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 17, 22; 17, 23; 18, 24; 19, 25; 19, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 25, 33; 25, 34; 30, 35; 30, 36; 31, 37; 32, 38; 32, 39; 37, 40; 37, 41; 38, 42; 38, ... | def get_sort_field(attr, model):
"""
Get's the field to sort on for the given
attr.
Currently returns attr if it is a field on
the given model.
If the models has an attribute matching that name
and that value has an attribute 'sort_field' than
that value is used.
TODO: Provide a w... |
0, module; 1, function_definition; 2, function_name:sorted_query_paths; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, return_statement; 8, comment:"""
RETURN A LIST OF ALL SCHEMA'S IN DEPTH-FIRST TOPOLOGICAL ORDER
"""; 9, call; 10, identifier:list; 11, argument_list; 12, call;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 12, 13; 12, 14; 14, 15; 15, 16; 15, 17; 17, 18; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 23, 24; 23, 25; 24, 26; 24, 27; 25, 28; 26, 29; 26, 30; 28, 31; 28, 32; 29, 33; 29, 34 | def sorted_query_paths(self):
"""
RETURN A LIST OF ALL SCHEMA'S IN DEPTH-FIRST TOPOLOGICAL ORDER
"""
return list(reversed(sorted(p[0] for p in self.namespace.alias_to_query_paths.get(self.name)))) |
0, module; 1, function_definition; 2, function_name:add_arguments; 3, parameters; 4, block; 5, identifier:self; 6, identifier:actions; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:"""
Sort the flags alphabetically
"""; 11, assignment; 12, call; 13, identifier:ac... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 11, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 18, 22; 18, 23; 19, 24; 19, 25; 23, 26; 23, 27; 25, 28; 25, 29; 27, 30; 27, 31; 30, 32; 30, 33; 31, 34; 34, 35 | def add_arguments(self, actions):
"""
Sort the flags alphabetically
"""
actions = sorted(
actions, key=operator.attrgetter('option_strings'))
super(SortedHelpFormatter, self).add_arguments(actions) |
0, module; 1, function_definition; 2, function_name:_iter_indented_subactions; 3, parameters; 4, block; 5, identifier:self; 6, identifier:action; 7, expression_statement; 8, try_statement; 9, comment:"""
Sort the subcommands alphabetically
"""; 10, block; 11, except_clause; 12, else_clause; 13, expressi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 8, 12; 10, 13; 11, 14; 11, 15; 12, 16; 13, 17; 15, 18; 16, 19; 16, 20; 16, 21; 17, 22; 17, 23; 19, 24; 20, 25; 20, 26; 20, 27; 21, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 25, 34; 26, 35; 27, 36; 28, 37; 28, 38; 31, 39; 31, 40; 34, 41; 34, 42; 35, 4... | def _iter_indented_subactions(self, action):
"""
Sort the subcommands alphabetically
"""
try:
get_subactions = action._get_subactions
except AttributeError:
pass
else:
self._indent()
if isinstance(action, argparse._SubParser... |
0, module; 1, function_definition; 2, function_name:_sort2sql; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sort; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:"""
RETURN ORDER BY CLAUSE
"""; 11, not_operator; 12, block; 13, binary_operator:SQL_ORDERBY + sql_li... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 11, 14; 12, 15; 13, 16; 13, 17; 15, 18; 17, 19; 17, 20; 20, 21; 21, 22; 21, 23; 22, 24; 22, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30; 29, 31; 30, 32; 30, 33; 30, 34; 31, 35; 31, 36; 33, 37; 33, 38; 37, 39; 37, 40; 38, 41 | def _sort2sql(self, sort):
"""
RETURN ORDER BY CLAUSE
"""
if not sort:
return ""
return SQL_ORDERBY + sql_list([quote_column(o.field) + (" DESC" if o.sort == -1 else "") for o in sort]) |
0, module; 1, function_definition; 2, function_name:optimize_batch; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, return_statement; 15, id... | 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; 10, 23; 11, 24; 12, 25; 12, 26; 12, 27; 13, 28; 14, 29; 18, 30; 22, 31; 22, 32; 23, 33; 24, 34; 24, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 29, 42; 32, 43; 32, 44... | def optimize_batch(self, batchsize=10, returns='best', paralell=True):
"""
Run multiple optimizations using different starting coordinates.
Args:
batchsize (`int`): Number of optimizations to run.
returns (`str`): If ``'all'``, return results of all optimizations,
... |
0, module; 1, function_definition; 2, function_name:list_gewesten; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, function_definition; 9, if_statement; 10, for_statement; 11, return_statement; 12, identifier:sort; 13, integer:1; 14, string; 15, function_name:creator; 16, ... | 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; 8, 16; 8, 17; 9, 18; 9, 19; 9, 20; 10, 21; 10, 22; 10, 23; 11, 24; 14, 25; 17, 26; 17, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 20, 34; 23, 35; 26, 36; 27, 37; 28, 38; 28, 39; 28, 40; 29, 41; 30, 42; 30, 43; 32, 4... | def list_gewesten(self, sort=1):
'''
List all `gewesten` in Belgium.
:param integer sort: What field to sort on.
:rtype: A :class`list` of class: `Gewest`.
'''
def creator():
res = crab_gateway_request(self.client, 'ListGewesten', sort)
tmp = {}
... |
0, module; 1, function_definition; 2, function_name:list_provincies; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, try_statement; 9, function_definition; 10, if_statement; 11, for_statement; 12, return_statement; 13, identifier:gewest; 14, integer:2; 15, string; 16, bloc... | 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; 9, 20; 10, 21; 10, 22; 10, 23; 11, 24; 11, 25; 11, 26; 12, 27; 15, 28; 16, 29; 17, 30; 17, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 26, 38; 28, 39; 29, 40; 31, 41; 32, 42; 33, 43; 33, 4... | def list_provincies(self, gewest=2):
'''
List all `provincies` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`provincies` are wanted.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Provincie`.
'''
tr... |
0, module; 1, function_definition; 2, function_name:list_gemeenten; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, try_statement; 10, expression_statement; 11, function_definition; 12, if_statement; 13, for_statement; 14, return_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; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 11, 24; 11, 25; 12, 26; 12, 27; 12, 28; 13, 29; 13, 30; 13, 31; 14, 32; 19, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 44... | def list_gemeenten(self, gewest=2, sort=1):
'''
List all `gemeenten` in a `gewest`.
:param gewest: The :class:`Gewest` for which the \
`gemeenten` are wanted.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Gemeente`.
'''
... |
0, module; 1, function_definition; 2, function_name:list_gemeenten; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, function_definition; 9, if_statement; 10, for_statement; 11, return_statement; 12, identifier:sort; 13, integer:1; 14, string; 15, function_name:creator; 16,... | 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; 8, 16; 8, 17; 9, 18; 9, 19; 9, 20; 10, 21; 10, 22; 10, 23; 11, 24; 14, 25; 17, 26; 17, 27; 17, 28; 17, 29; 17, 30; 18, 31; 18, 32; 19, 33; 19, 34; 20, 35; 23, 36; 26, 37; 27, 38; 28, 39; 29, 40; 30, 41; 31, 42; 31, 43; 33, 4... | def list_gemeenten(self, sort=1):
'''
List all `gemeenten` in Vlaanderen.
:param integer sort: What field to sort on.
:rtype: A :class:`list` of :class:`Gemeente`.
'''
def creator():
url = self.base_url + '/municipality'
h = self.base_headers
... |
0, module; 1, function_definition; 2, function_name:list_kadastrale_afdelingen; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, function_definition; 8, if_statement; 9, return_statement; 10, string; 11, function_name:creator; 12, parameters; 13, block; 14, attribute; 15, block; 16, else_clause;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 7, 12; 7, 13; 8, 14; 8, 15; 8, 16; 9, 17; 10, 18; 13, 19; 13, 20; 13, 21; 13, 22; 14, 23; 14, 24; 15, 25; 15, 26; 16, 27; 19, 28; 20, 29; 21, 30; 21, 31; 21, 32; 22, 33; 23, 34; 23, 35; 25, 36; 26, 37; 27, 38; 28, 39; 28, 40; 29, 41; 29, 42; 32, 43; 34... | def list_kadastrale_afdelingen(self):
'''
List all `kadastrale afdelingen` in Flanders.
:param integer sort: Field to sort on.
:rtype: A :class:`list` of :class:`Afdeling`.
'''
def creator():
gemeentes = self.list_gemeenten()
res = []
... |
0, module; 1, function_definition; 2, function_name:list_kadastrale_afdelingen_by_gemeente; 3, parameters; 4, block; 5, identifier:self; 6, identifier:gemeente; 7, default_parameter; 8, expression_statement; 9, try_statement; 10, expression_statement; 11, function_definition; 12, if_statement; 13, for_statement; 14, re... | 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; 11, 23; 12, 24; 12, 25; 12, 26; 13, 27; 13, 28; 13, 29; 14, 30; 17, 31; 18, 32; 19, 33; 19, 34; 20, 35; 20, 36; 23, 37; 23, 38; 23, 39; 23, 40; 23, 41; 24, 42; 24, 43; 25, ... | def list_kadastrale_afdelingen_by_gemeente(self, gemeente, sort=1):
'''
List all `kadastrale afdelingen` in a `gemeente`.
:param gemeente: The :class:`Gemeente` for which the \
`afdelingen` are wanted.
:param integer sort: Field to sort on.
:rtype: A :class:`list` of... |
0, module; 1, function_definition; 2, function_name:list_percelen_by_sectie; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sectie; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, function_definition; 13, if_statement; 14, fo... | 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; 13, 25; 13, 26; 14, 27; 14, 28; 14, 29; 15, 30; 16, 31; 17, 32; 17, 33; 18, 34; 18, 35; 19, 36; 19, 37; 20, 38; 20, 39; 23, 40; 23, 41; 23, 42; 23, 43; 23,... | def list_percelen_by_sectie(self, sectie):
'''
List all percelen in a `sectie`.
:param sectie: The :class:`Sectie` for which the percelen are wanted.
:param integer sort: Field to sort on.
:rtype: A :class:`list` of :class:`Perceel`.
'''
sid = sectie.id
a... |
0, module; 1, function_definition; 2, function_name:get_urls; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:order; 13, string:"total_clicks desc"; 14, identifier:offse... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 6, 12; 6, 13; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 19, 21; 19, 22; 20, 23; 20, 24; 22, 25; 22, 26; 22, 27; 23, 28; 23, 29; 24, 30; 24, 31; 27, 32; 27, 33; 33, 34; 33, 35 | def get_urls(self, order="total_clicks desc", offset=None, count=None):
"""Returns a list of URLs you've included in messages.
List is sorted by ``total_clicks``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items.
"""
req_data = [ None, orde... |
0, module; 1, function_definition; 2, function_name:get_message_urls; 3, parameters; 4, block; 5, identifier:self; 6, identifier:message_id; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:order; 12, string:"total_clicks desc"; 13, comment:"""Returns a list o... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 7, 11; 7, 12; 8, 13; 9, 14; 10, 15; 14, 16; 14, 17; 15, 18; 15, 19; 17, 20; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 27, 28; 27, 29; 29, 30; 29, 31; 31, 32 | def get_message_urls(self, message_id, order="total_clicks desc"):
"""Returns a list of URLs you've included in a specific message.
List is sorted by ``total_clicks``, starting at an optional integer ``offset``, and optionally limited to the first ``count`` items.
"""
req_data = [ { "me... |
0, module; 1, function_definition; 2, function_name:trade_history; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, expression_statement; 15... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 4, 14; 4, 15; 6, 16; 6, 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; 15, 33; 33, 34; 33, 35; 34, 36; 34, 37; 35, 38; 35, 39; 35, 40; 35, 41; 35, 42; 35, 43; 35, 44; ... | def trade_history(
self, from_=None, count=None, from_id=None, end_id=None,
order=None, since=None, end=None, pair=None
):
"""
Returns trade history.
To use this method you need a privilege of the info key.
:param int or None from_: trade ID, from which the display s... |
0, module; 1, function_definition; 2, function_name:trans_history; 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, return_statement; 15,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, 13; 4, 14; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 11, 26; 12, 27; 12, 28; 13, 29; 14, 30; 30, 31; 30, 32; 31, 33; 31, 34; 32, 35; 32, 36; 32, 37; 32, 38; 32, 39; 32, 40; 32, 41; 32, 42; 35, 43; 36, 44;... | def trans_history(
self, from_=None, count=None, from_id=None, end_id=None,
order=None, since=None, end=None
):
"""
Returns the history of transactions.
To use this method you need a privilege of the info key.
:param int or None from_: transaction ID, from which the ... |
0, module; 1, function_definition; 2, function_name:get_atom_type_symbol; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:calc; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:kwargs; 14, 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; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 12, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 19, 27; 19, 28; 21, 29; 21, 30; 23, 31; 23, 32; 24, 33; 25, 34; 25, 35; 26, 36; 28, 37; 29, 38; 29, 39; 31, 40; 31, 41; 34, 42; 34, 43; ... | def get_atom_type_symbol(cls,calc,**kwargs):
"""
Returns a list of atom types. Each atom site MUST occur only
once in this list. List MUST be sorted.
"""
parameters = calc.out.output
dictionary = parameters.get_dict()
if 'basis_set' not in dictionary.keys():
... |
0, module; 1, function_definition; 2, function_name:sort_url; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
Return the URL to sort the linked table by this column. If the
table is already sorted by this column, the orde... | 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; 18, 23; 18, 24; 20, 25; 20, 26; 21, 27; 26, 28; 26, 29; 27, 30; 27, 31; 29, 32; 29, 33; 30, 34; 30, 35 | def sort_url(self):
"""
Return the URL to sort the linked table by this column. If the
table is already sorted by this column, the order is reversed.
Since there is no canonical URL for a table the current URL (via
the HttpRequest linked to the Table instance) is reused, and any... |
0, module; 1, function_definition; 2, function_name:append; 3, parameters; 4, block; 5, identifier:self; 6, identifier:newconfig; 7, expression_statement; 8, comment:# Check for commands where we accept multiple statements (no test_url); 9, for_statement; 10, comment:# Check for single statement commands;; 11, 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; 4, 16; 7, 17; 9, 18; 9, 19; 9, 20; 9, 21; 12, 22; 12, 23; 12, 24; 14, 25; 14, 26; 15, 27; 15, 28; 15, 29; 15, 30; 16, 31; 16, 32; 16, 33; 16, 34; 19, 35; 19, 36; 19, 37; 19, 38; 19, 39; 19, 40; 19, 41; 19, 42; 19, 43; 19, 44... | def append(self, newconfig):
""" Append another site config to current instance.
All ``newconfig`` attributes are appended one by one to ours.
Order matters, eg. current instance values will come first when
merging.
Thus, if you plan to use some sort of global site config with
... |
0, module; 1, function_definition; 2, function_name:__exportUsers; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sort; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, for_statement; 14, return_statement; 15, i... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 21; 12, 22; 13, 23; 13, 24; 13, 25; 14, 26; 18, 27; 18, 28; 19, 29; 19, 30; 21, 31; 22, 32; 22, 33; 25, 34; 25, 35; 25, 36; 25, 37; 25, 38; 30, 39; 30, 40; 31, 41; 34, 42; 35, 43; 36,... | def __exportUsers(self, sort, limit=0):
"""Export the users to a dictionary.
:param sort: field to sort the users
:type sort: str.
:return: exported users.
:rtype: dict.
"""
position = 1
dataUsers = self.getSortedUsers(sort)
if limit:
... |
0, module; 1, function_definition; 2, function_name:zset_example; 3, parameters; 4, block; 5, expression_statement; 6, import_from_statement; 7, import_from_statement; 8, import_from_statement; 9, expression_statement; 10, expression_statement; 11, comment:# 97-114 is 'a' to 'r' in ASCII; 12, for_statement; 13, express... | 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; 4, 24; 4, 25; 5, 26; 6, 27; 6, 28; 7, 29; 7, 30; 8, 31; 8, 32; 9, 33; 10, 34; 12, 35; 12, 36; 12, 37; 13, 38; 14, 39; 16, 40; 18, 41; 20, 42; 21, 43; 23, 44; 25, 45; 27... | def zset_example():
""" Example sorted set pagination.
"""
from uuid import uuid4
from redis import StrictRedis
from zato.redis_paginator import ZSetPaginator
conn = StrictRedis()
key = 'paginator:{}'.format(uuid4().hex)
# 97-114 is 'a' to 'r' in ASCII
for x in range(1, 18)... |
0, module; 1, function_definition; 2, function_name:paths_by_depth; 3, parameters; 4, block; 5, identifier:paths; 6, expression_statement; 7, return_statement; 8, comment:"""Sort list of paths by number of directories in it
.. todo::
check if a final '/' is consistently given or ommitted.
:param iter... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 11, 13; 11, 14; 13, 15; 13, 16; 14, 17; 14, 18; 16, 19; 16, 20; 19, 21; 20, 22; 20, 23; 22, 24; 22, 25; 23, 26; 26, 27; 26, 28; 27, 29; 27, 30 | def paths_by_depth(paths):
"""Sort list of paths by number of directories in it
.. todo::
check if a final '/' is consistently given or ommitted.
:param iterable paths: iterable containing paths (str)
:rtype: list
"""
return sorted(
paths,
key=lambda path: path... |
0, module; 1, function_definition; 2, function_name:normalize_date; 3, parameters; 4, block; 5, identifier:date; 6, expression_statement; 7, if_statement; 8, return_statement; 9, string:'''normalize the specified date to milliseconds since the epoch
If it is a string, it is assumed to be some sort of datetime ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 7, 12; 7, 13; 7, 14; 8, 15; 10, 16; 10, 17; 11, 18; 12, 19; 12, 20; 13, 21; 13, 22; 14, 23; 15, 24; 15, 25; 17, 26; 17, 27; 19, 28; 19, 29; 20, 30; 21, 31; 21, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 30, 39; 32, 40; 32, 41; 33, 42; 33, 43; ... | def normalize_date(date):
'''normalize the specified date to milliseconds since the epoch
If it is a string, it is assumed to be some sort of datetime such as
"2015-12-27" or "2015-12-27T11:01:20.954". If date is a naive datetime,
it is assumed to be UTC.
If numeric arguments a... |
0, module; 1, function_definition; 2, function_name:format_float; 3, parameters; 4, block; 5, identifier:x; 6, identifier:max_width; 7, expression_statement; 8, comment:# width of (whole part + 1 (to avoid zero)) + 1 because int floors, not ceils; 9, expression_statement; 10, comment:# for +/- sign; 11, expression_stat... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 9, 16; 11, 17; 13, 18; 14, 19; 15, 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; 24, 33; 26, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 29, 40; 29, 41; 32, 42; 32, 43; 3... | def format_float(x, max_width):
'''format_float will ensure that a number's decimal part is truncated to
fit within some bounds, unless the whole part is wider than max_width,
which is a problem you need to sort out yourself.
'''
# width of (whole part + 1 (to avoid zero)) + 1 because int floors, no... |
0, module; 1, function_definition; 2, function_name:__cleanup; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# set run to False and wait some time -> see what happens; 8, expression_statement; 9, if_statement; 10, try_statement; 11, expression_statement; 12, expression_statement; 13, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 8, 16; 9, 17; 9, 18; 9, 19; 10, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 23, 38; 23, 39; 24, 40; 24, 41; 25, 42; 25, 43; 26, ... | def __cleanup(self):
"""
Wait at most twice as long as the given repetition interval
for the _wrapper_function to terminate.
If after that time the _wrapper_function has not terminated,
send SIGTERM to and the process.
Wait at most five times as long as ... |
0, module; 1, function_definition; 2, function_name:regroup; 3, parameters; 4, block; 5, identifier:target; 6, identifier:expression; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:"""
Regroups a list of alike objects by a common attribute.
This complex tag is best illustrated by us... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 11, 14; 12, 15; 13, 16; 13, 17; 13, 18; 13, 19; 15, 20; 18, 21; 18, 22; 19, 23; 19, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 27, 34; 28, 35; 28, 36; 32, 37; 32, 38; 36, 39; 38, 40; 38, 41; 40, 42; 40, 43... | def regroup(target, expression):
"""
Regroups a list of alike objects by a common attribute.
This complex tag is best illustrated by use of an example: say that
``people`` is a list of ``Person`` objects that have ``first_name``,
``last_name``, and ``gender`` attributes, and you'd like to display ... |
0, module; 1, function_definition; 2, function_name:entityTriples; 3, parameters; 4, block; 5, identifier:rdfGraph; 6, identifier:anEntity; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# extract predicate/object; 14, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 9, 25; 10, 26; 11, 27; 12, 28; 12, 29; 14, 30; 14, 31; 14, 32; 16, 33; 16, 34; 16, 35; 19, 36; 25, 37; 25, 38; 25, 39; 25, 40; 27, 41; 27, 42; 28, 43; 29, 44; 30... | def entityTriples(rdfGraph, anEntity, excludeProps=False, excludeBNodes=False,
orderProps=[RDF, RDFS, OWL.OWLNS, DC.DCNS]):
"""
Returns the pred-obj for any given resource, excluding selected ones..
Sorting: by default results are sorted alphabetically and according to namespaces: [RDF, R... |
0, module; 1, function_definition; 2, function_name:msvd; 3, parameters; 4, block; 5, identifier:m; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, comment:# reverse the n first columns of u; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, 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; 6, 14; 7, 15; 8, 16; 10, 17; 11, 18; 12, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 20, 33; 21, 34; 21, 35; 21, 36; 22, 37; 22, 38; 24, 39; 24, 40; 26, 41; 26, 42; 28, 43; 2... | def msvd(m):
"""Modified singular value decomposition.
Returns U, S, V where Udagger M V = diag(S) and the singular values
are sorted in ascending order (small to large).
"""
u, s, vdgr = np.linalg.svd(m)
order = s.argsort()
# reverse the n first columns of u
s = s[order]
u= u[:,order]
vdgr = vdgr[... |
0, module; 1, function_definition; 2, function_name:_rows_sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:rows; 7, expression_statement; 8, return_statement; 9, comment:"""
Returns a list of rows sorted by start and end date.
:param list[dict[str,T]] rows: The list of rows.
:r... | 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; 14, 15; 14, 16; 16, 17; 16, 18; 17, 19; 18, 20; 18, 21; 20, 22; 20, 23; 21, 24; 21, 25; 23, 26; 23, 27; 25, 28; 25, 29 | def _rows_sort(self, rows):
"""
Returns a list of rows sorted by start and end date.
:param list[dict[str,T]] rows: The list of rows.
:rtype: list[dict[str,T]]
"""
return sorted(rows, key=lambda row: (row[self._key_start_date], row[self._key_end_date])) |
0, module; 1, function_definition; 2, function_name:get_rows; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, identifier:sort; 12, False; 13, comment:"""
Returns the rows of this Type2Helper.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 9, 17; 10, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 16, 25; 17, 26; 17, 27; 23, 28; 23, 29; 25, 30; 25, 31; 26, 32; 27, 33; 29, 34; 30, 35; 30, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 35, 43; 35... | def get_rows(self, sort=False):
"""
Returns the rows of this Type2Helper.
:param bool sort: If True the rows are sorted by the pseudo key.
"""
ret = []
for _, rows in sorted(self._rows.items()) if sort else self._rows.items():
self._rows_int2date(rows)
... |
0, module; 1, function_definition; 2, function_name:get_entries; 3, parameters; 4, block; 5, identifier:path; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Return sorted lists of directories and files in the gi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 8, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 13, 21; 13, 22; 15, 23; 15, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 25, 39; 25, 40; 25, 41; 26, 42; 26, 43; 28,... | def get_entries(path):
"""Return sorted lists of directories and files in the given path."""
dirs, files = [], []
for entry in os.listdir(path):
# Categorize entry as directory or file.
if os.path.isdir(os.path.join(path, entry)):
dirs.append(entry)
else:
... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:ctx; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, comment:"""Sort the variants of a vcf file"... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 7, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 20, 32; 20, 33; 21, 34; 23, 35; 23, 36; 25, 37; 25, 38; 27, 39; 27, 40; 29, 41; 29, 42; 31, 43; 3... | def sort(ctx):
"""Sort the variants of a vcf file"""
head = ctx.parent.head
vcf_handle = ctx.parent.handle
outfile = ctx.parent.outfile
silent = ctx.parent.silent
print_headers(head, outfile=outfile, silent=silent)
for line in sort_variants(vcf_handle):
print_variant(variant_line=l... |
0, module; 1, function_definition; 2, function_name:_sort_to_str; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""
Before exec query, this method transform... | 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; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 26, 33; 26, 34; 28, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 31, 41; 31, 42; 32, 43; 32... | def _sort_to_str(self):
"""
Before exec query, this method transforms sort dict string
from
{"name": "asc", "timestamp":"desc"}
to
"name asc, timestamp desc"
"""
params_list = []
timestamp = ""
for k, v in self._solr_params['s... |
0, module; 1, function_definition; 2, function_name:_get_video_ts_file_paths; 3, parameters; 4, block; 5, identifier:dvd_path; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""Returns a sorted list of paths for files contained in th VIDEO_... | 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; 9, 15; 9, 16; 10, 17; 12, 18; 12, 19; 13, 20; 13, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 17, 27; 19, 28; 19, 29; 23, 30; 24, 31; 25, 32; 25, 33; 27, 34; 29, 35; 29, 36; 31, 37; 31, 38; 32, 39; 32, 40; 33, 41; 38, 42; 38, 43; 4... | def _get_video_ts_file_paths(dvd_path):
"""Returns a sorted list of paths for files contained in th VIDEO_TS folder of the specified
DVD path.
"""
video_ts_folder_path = join(dvd_path, "VIDEO_TS")
video_ts_file_paths = []
for video_ts_folder_content_name in listdir(video_ts_folder_path):
... |
0, module; 1, function_definition; 2, function_name:sort_ranges; 3, parameters; 4, block; 5, identifier:inranges; 6, expression_statement; 7, return_statement; 8, comment:"""from an array of ranges, make a sorted array of ranges
:param inranges: List of GenomicRange data
:type inranges: GenomicRange[]
:returns: ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 11, 12; 11, 13; 13, 14; 13, 15; 15, 16; 15, 17; 16, 18; 17, 19; 17, 20; 17, 21; 17, 22; 19, 23; 19, 24; 20, 25; 20, 26; 21, 27; 21, 28; 22, 29; 22, 30 | def sort_ranges(inranges):
"""from an array of ranges, make a sorted array of ranges
:param inranges: List of GenomicRange data
:type inranges: GenomicRange[]
:returns: a new sorted GenomicRange list
:rtype: GenomicRange[]
"""
return sorted(inranges,key=lambda x: (x.chr,x.start,x.end,x.direction)) |
0, module; 1, function_definition; 2, function_name:subtract_ranges; 3, parameters; 4, block; 5, identifier:r1s; 6, identifier:r2s; 7, default_parameter; 8, expression_statement; 9, import_from_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_stat... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 7, 19; 7, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 13, 28; 14, 29; 15, 30; 15, 31; 15, 32; 15, 33; 18, 34; 22, 35; 22, 36; 23, 37; 24, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; 27, 44; ... | def subtract_ranges(r1s,r2s,already_sorted=False):
"""Subtract multiple ranges from a list of ranges
:param r1s: range list 1
:param r2s: range list 2
:param already_sorted: default (False)
:type r1s: GenomicRange[]
:type r2s: GenomicRange[]
:return: new range r1s minus r2s
:rtype: GenomicRange[]
""... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.