nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:_serve_runs; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:"""Serve a JSON array of run names, ordered by run started time.
Sort order is by started time (aka first e... | 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; 12, 18; 12, 19; 13, 20; 13, 21; 13, 22; 14, 23; 14, 24; 17, 25; 18, 26; 19, 27; 22, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 28, 42; 29, 43;... | def _serve_runs(self, request):
"""Serve a JSON array of run names, ordered by run started time.
Sort order is by started time (aka first event time) with empty times sorted
last, and then ties are broken by sorting on the run name.
"""
if self._db_connection_provider:
db = self._db_connectio... |
0, module; 1, function_definition; 2, function_name:_fetch_events_files_on_disk; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""Obtains the names of debugger-related events files within the directory.
Retur... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 15, 20; 15, 21; 17, 22; 17, 23; 17, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 23, 30; 23, 31; 24, 32; 26, 33; 26, 34; 27, 35; 27, 36; 29, 37; 29, 38; 32, 39; 32, 40; 34, 41; 34, 42; 35, 43... | def _fetch_events_files_on_disk(self):
"""Obtains the names of debugger-related events files within the directory.
Returns:
The names of the debugger-related events files written to disk. The names
are sorted in increasing events file index.
"""
all_files = tf.io.gfile.listdir(self._events_... |
0, module; 1, function_definition; 2, function_name:Cleanse; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, identifier:encoding; 10, string; 11, comment:"""Makes Python object appropriate for JSON serialization.
- Replaces instances of Infinity/-Infinit... | 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; 8, 14; 8, 15; 8, 16; 8, 17; 8, 18; 8, 19; 10, 20; 12, 21; 12, 22; 13, 23; 14, 24; 14, 25; 15, 26; 15, 27; 16, 28; 16, 29; 17, 30; 17, 31; 18, 32; 18, 33; 19, 34; 22, 35; 22, 36; 23, 37; 24, 38; 24, 39; 25, 40; 26, 41; 26, 42; 27, 43; 28, ... | def Cleanse(obj, encoding='utf-8'):
"""Makes Python object appropriate for JSON serialization.
- Replaces instances of Infinity/-Infinity/NaN with strings.
- Turns byte strings into unicode strings.
- Turns sets into sorted lists.
- Turns tuples into lists.
Args:
obj: Python data structure.
encodi... |
0, module; 1, function_definition; 2, function_name:_sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:session_groups; 7, expression_statement; 8, comment:# Sort by session_group name so we have a deterministic order.; 9, expression_statement; 10, comment:# Sort by lexicographical order of the _request.c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 9, 17; 15, 18; 15, 19; 15, 20; 17, 21; 17, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 26, 32; 27, 33; 27, 34; 28, 35; 28, 36; 28, 37; 28, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43; 33... | def _sort(self, session_groups):
"""Sorts 'session_groups' in place according to _request.col_params."""
# Sort by session_group name so we have a deterministic order.
session_groups.sort(key=operator.attrgetter('name'))
# Sort by lexicographical order of the _request.col_params whose order
# is no... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:search; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:"""
Add sorting information to the request.
"""; 11, attribute; 12, block; 13, identifier:search; 14, id... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 16, 17; 17, 18; 17, 19; 19, 20; 19, 21; 20, 22; 20, 23; 21, 24; 24, 25; 25, 26; 25, 27 | def sort(self, search):
"""
Add sorting information to the request.
"""
if self._sort:
search = search.sort(*self._sort)
return search |
0, module; 1, function_definition; 2, function_name:competitions_list; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, expression_statemen... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 9, 27; 10, 28; 10, 29; 11, 30; 12, 31; 13, 32; 13, 33; 14, 34; 15, 35; 15, 36; 16, 37; 17, 38; 17, 39; 18, 40; 19, 41; 31, 42; 31, 43; 32, 44; 32, ... | def competitions_list(self,
group=None,
category=None,
sort_by=None,
page=1,
search=None):
""" make call to list competitions, format the response, and return
a list of C... |
0, module; 1, function_definition; 2, function_name:competitions_list_cli; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, 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; 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; 13, 29; 14, 30; 15, 31; 15, 32; 15, 33; 29, 34; 29, 35; 30, 36; 30, 37; 32, 38; 33, 39; 35, 40; 35, 41; 37, 42; 37, 43; 37, 44; ... | def competitions_list_cli(self,
group=None,
category=None,
sort_by=None,
page=1,
search=None,
csv_display=False):
""" a wrapper for ... |
0, module; 1, function_definition; 2, function_name:dataset_list; 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, default_parameter; 15, ex... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 6, 30; 6, 31; 7, 32; 7, 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 dataset_list(self,
sort_by=None,
size=None,
file_type=None,
license_name=None,
tag_ids=None,
search=None,
user=None,
mine=False,
... |
0, module; 1, function_definition; 2, function_name:dataset_list_cli; 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, default_parameter; 15... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 4, 16; 4, 17; 4, 18; 4, 19; 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; 12, 33; 13, 34; 13, 35; 14, 36; 14, 37; 15, 38; 15, 39; 16, 40; 17, 41; 18, 42; 19, 43; 19, 44; 19, ... | def dataset_list_cli(self,
sort_by=None,
size=None,
file_type=None,
license_name=None,
tag_ids=None,
search=None,
user=None,
... |
0, module; 1, function_definition; 2, function_name:kernels_list; 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, default_parameter; 15, de... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 3, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 4, 30; 4, 31; 4, 32; 4, 33; 4, 34; 4, 35; 4, 36; 4, 37; 6, 38; 6, 39; 7, 40; 7, 41; 8, 42; 8, 43; 9, 44; 9, 45; 10, 46; 10, 47... | def kernels_list(self,
page=1,
page_size=20,
dataset=None,
competition=None,
parent_kernel=None,
search=None,
mine=False,
user=None,
... |
0, module; 1, function_definition; 2, function_name:_get_salt_params; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, try_statement; 10, return_statement; 11, string; 12, assignment; 13, assignment; 14, assignment; 15, block; 16, except_cla... | 0, 1; 1, 2; 1, 3; 1, 4; 4, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 5, 11; 6, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 13, 21; 13, 22; 14, 23; 14, 24; 15, 25; 15, 26; 15, 27; 15, 28; 15, 29; 15, 30; 15, 31; 15, 32; 15, 33; 16, 34; 16, 35; 20, 36; 20, 37; 22, 38; 22, 39; 25, 40; 26, 41; 27, 42; 27, 43; 2... | def _get_salt_params():
'''
Try to get all sort of parameters for Server Density server info.
NOTE: Missing publicDNS and publicIPs parameters. There might be way of
getting them with salt-cloud.
'''
all_stats = __salt__['status.all_status']()
all_grains = __salt__['grains.items']()
par... |
0, module; 1, function_definition; 2, function_name:zcard; 3, parameters; 4, block; 5, identifier:key; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, return_statement; 13, identifier:host; 14, None; 15, identifier:port; 16,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 12, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 26, 29; 26, 30; 27, 31; 27, 32; 28, 33; 30, 34; 30, 35; 30, 36; 30, 37 | def zcard(key, host=None, port=None, db=None, password=None):
'''
Get the length of a sorted set in Redis
CLI Example:
.. code-block:: bash
salt '*' redis.zcard foo_sorted
'''
server = _connect(host, port, db, password)
return server.zcard(key) |
0, module; 1, function_definition; 2, function_name:zrange; 3, parameters; 4, block; 5, identifier:key; 6, identifier:start; 7, identifier:stop; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, return_statement; 15, identif... | 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; 8, 15; 8, 16; 9, 17; 9, 18; 10, 19; 10, 20; 11, 21; 11, 22; 12, 23; 13, 24; 14, 25; 23, 26; 24, 27; 24, 28; 25, 29; 25, 30; 28, 31; 28, 32; 29, 33; 29, 34; 30, 35; 30, 36; 30, 37; 32, 38; 32, 39; 32, 40; 32, 41 | def zrange(key, start, stop, host=None, port=None, db=None, password=None):
'''
Get a range of values from a sorted set in Redis by index
CLI Example:
.. code-block:: bash
salt '*' redis.zrange foo_sorted 0 10
'''
server = _connect(host, port, db, password)
return server.zrange(ke... |
0, module; 1, function_definition; 2, function_name:get_list; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, if_statement;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 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; 5, 23; 5, 24; 6, 25; 6, 26; 7, 27; 7, 28; 8, 29; 8, 30; 9, 31; 9, 32; 10, 33; 11, 34; 12, 35; 12, 36; 13, 37; 13, 38; 14, 39; 14, 40; 15, 41; 15, 42; 16, 43; 16, 44; 17, 45; 1... | def get_list(list_type=None,
search_term=None,
page=None,
page_size=None,
sort_by=None):
'''
Returns a list of domains for the particular user as a list of objects
offset by ``page`` length of ``page_size``
list_type : ALL
One of ``ALL``, ``EX... |
0, module; 1, function_definition; 2, function_name:_sort_policy; 3, parameters; 4, block; 5, identifier:doc; 6, expression_statement; 7, if_statement; 8, return_statement; 9, string; 10, call; 11, block; 12, elif_clause; 13, identifier:doc; 14, string_content:List-type sub-items in policies don't happen to be order-se... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 7, 11; 7, 12; 8, 13; 9, 14; 10, 15; 10, 16; 11, 17; 12, 18; 12, 19; 16, 20; 16, 21; 17, 22; 18, 23; 18, 24; 19, 25; 22, 26; 22, 27; 24, 28; 24, 29; 25, 30; 27, 31; 29, 32; 29, 33; 30, 34; 30, 35; 31, 36; 31, 37; 35, 38; 36, 39; 36, 40; 37, 41; 37, 42; 38, 43;... | def _sort_policy(doc):
'''
List-type sub-items in policies don't happen to be order-sensitive, but
compare operations will render them unequal, leading to non-idempotent
state runs. We'll sort any list-type subitems before comparison to reduce
the likelihood of false negatives.
'''
if isins... |
0, module; 1, function_definition; 2, function_name:_resolve_datacenter; 3, parameters; 4, block; 5, identifier:dc; 6, identifier:pillarenv; 7, expression_statement; 8, expression_statement; 9, try_statement; 10, expression_statement; 11, expression_statement; 12, comment:# sort in reverse based on pattern length; 13, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 7, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 14, 23; 15, 24; 15, 25; 15, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 26, 43; 26, 4... | def _resolve_datacenter(dc, pillarenv):
'''
If ``dc`` is a string - return it as is.
If it's a dict then sort it in descending order by key length and try
to use keys as RegEx patterns to match against ``pillarenv``.
The value for matched pattern should be a string (that can use
``str.format`` ... |
0, module; 1, function_definition; 2, function_name:read_conf; 3, parameters; 4, block; 5, identifier:conf_file; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, with_statement; 11, if_statement; 12, return_statement; 13, identifier:out_format; 14, string; 15, string;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 11, 20; 11, 21; 12, 22; 14, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 19, 30; 20, 31; 20, 32; 21, 33; 29, 34; 30, 35; 30, 36; 30, 37; 32, 38; 33, 39; 34, 40; 34, 41; 36, 42; 36, 43; 37... | def read_conf(conf_file, out_format='simple'):
'''
Read in an LXC configuration file. By default returns a simple, unsorted
dict, but can also return a more detailed structure including blank lines
and comments.
out_format:
set to 'simple' if you need the old and unsupported behavior.
... |
0, module; 1, function_definition; 2, function_name:sort_top_targets; 3, parameters; 4, block; 5, identifier:self; 6, identifier:top; 7, identifier:orders; 8, expression_statement; 9, expression_statement; 10, comment:# pylint: disable=cell-var-from-loop; 11, for_statement; 12, comment:# pylint: enable=cell-var-from-lo... | 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; 8, 14; 9, 15; 11, 16; 11, 17; 11, 18; 13, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 22, 29; 22, 30; 25, 31; 25, 32; 26, 33; 27, 34; 28, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 34, 41; 34, 42; 37, 43; ... | def sort_top_targets(self, top, orders):
'''
Returns the sorted high data from the merged top files
'''
sorted_top = collections.defaultdict(OrderedDict)
# pylint: disable=cell-var-from-loop
for saltenv, targets in six.iteritems(top):
sorted_targets = sorted(t... |
0, module; 1, function_definition; 2, function_name:subvolume_list; 3, parameters; 4, block; 5, identifier: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, default_parameter; 15, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 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; 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; 6, 46; 6, 47; ... | def subvolume_list(path, parent_id=False, absolute=False,
ogeneration=False, generation=False,
subvolumes=False, uuid=False, parent_uuid=False,
sent_subvolume_uuid=False, snapshots=False,
readonly=False, deleted=False, generation_cmp=None,
... |
0, module; 1, function_definition; 2, function_name:diff; 3, parameters; 4, block; 5, list_splat_pattern; 6, dictionary_splat_pattern; 7, expression_statement; 8, comment:# TODO: The salt execution module "cp.get_file_str file:///..." is a; 9, comment:# non-obvious way to display the differences between files using; 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; 5, 16; 6, 17; 7, 18; 11, 19; 12, 20; 13, 21; 14, 22; 14, 23; 14, 24; 15, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 24, 31; 24, 32; 24, 33; 24, 34; 24, 35; 24, 36; 24, 37; 24, 38; 24, 39; 24, 40; 24, 41; 24, 42; 24, 43; 24,... | def diff(*args, **kwargs):
'''
Return the DIFFERENCE of the result sets returned by each matching minion
pool
.. versionadded:: 2014.7.0
These pools are determined from the aggregated and sorted results of
a salt command.
This command displays the "diffs" as a series of 2-way differences ... |
0, module; 1, function_definition; 2, function_name:_get_pool_results; 3, parameters; 4, block; 5, list_splat_pattern; 6, dictionary_splat_pattern; 7, expression_statement; 8, comment:# TODO: the option "survey.sort=" would be preferred for namespace; 9, comment:# separation but the kwargs parser for the salt-run comma... | 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; 5, 28; 6, 29; 7, 30; 12, 31; 13, 32; 14, 33; 15, 34; 16, 35; 17, 36; 18, 37; 19, 38; 19, 39; 20, 40; 21, 41; 22, 42; 22, 43; 24, 44; 24, 45;... | def _get_pool_results(*args, **kwargs):
'''
A helper function which returns a dictionary of minion pools along with
their matching result sets.
Useful for developing other "survey style" functions.
Optionally accepts a "survey_sort=up" or "survey_sort=down" kwargs for
specifying sort order.
... |
0, module; 1, function_definition; 2, function_name:list_; 3, parameters; 4, block; 5, default_parameter; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, comment:## update properties; 10, comment:# NOTE: properties should be a list; 11, expression_statement; 12, if_statement; 13, comme... | 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; 4, 29; 4, 30; 4, 31; 4, 32; 5, 33; 5, 34; 6, 35; 7, 36; 8, 37; 11, 38; 12, 39; 12, 40; 16, 41; 16, 42; 17, 43; 20, 44; 21, 45; 23, 46... | def list_(name=None, **kwargs):
'''
Return a list of all datasets or a specified dataset on the system and the
values of their used, available, referenced, and mountpoint properties.
name : string
name of dataset, volume, or snapshot
recursive : boolean
recursively list children
... |
0, module; 1, function_definition; 2, function_name:list_users; 3, parameters; 4, block; 5, default_parameter; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:order_by; 14, string; 15, s... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 5, 13; 5, 14; 6, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 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; 22, 34; 22, 35; 22, 36; 22, 37; 22, 38; 28, 39; 28, 40; 29, 41; 29, 42; 31, 43; 31,... | def list_users(order_by='id'):
'''
Show all users for this company.
CLI Example:
salt myminion bamboohr.list_users
By default, the return data will be keyed by ID. However, it can be ordered
by any other field. Keep in mind that if the field that is chosen contains
duplicate values (i... |
0, module; 1, function_definition; 2, function_name:key_value; 3, parameters; 4, block; 5, identifier:minion_id; 6, identifier:pillar; 7, comment:# pylint: disable=W0613; 8, default_parameter; 9, expression_statement; 10, comment:# Identify key type and process as needed based on that type; 11, expression_statement; 12... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 8, 15; 8, 16; 9, 17; 11, 18; 12, 19; 12, 20; 12, 21; 12, 22; 12, 23; 12, 24; 14, 25; 16, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 21, 33; 21, 34; 22, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 29, 41; 29, 42; 31, 43; 32... | def key_value(minion_id,
pillar, # pylint: disable=W0613
pillar_key='redis_pillar'):
'''
Looks for key in redis matching minion_id, returns a structure based on the
data type of the redis key. String for string type, dict for hash type and
lists for lists, sets and sorted se... |
0, module; 1, function_definition; 2, function_name:_cmp_version; 3, parameters; 4, block; 5, identifier:item1; 6, identifier:item2; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, if_statement; 12, return_statement; 13, string; 14, assignment; 15, assignment; 16, compar... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 11, 18; 11, 19; 12, 20; 13, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 23, 32; 23, 33; 25, 34; 25, 35; 28, 36; 31, 37; 33, 38; 35, 39; 36, 40 | def _cmp_version(item1, item2):
'''
Compare function for package version sorting
'''
vers1 = _LooseVersion(item1)
vers2 = _LooseVersion(item2)
if vers1 < vers2:
return -1
if vers1 > vers2:
return 1
return 0 |
0, module; 1, function_definition; 2, function_name:list_snapshots; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_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; 5, 15; 5, 16; 6, 17; 6, 18; 7, 19; 8, 20; 9, 21; 10, 22; 10, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 23, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 31, 42; 33, 43; 33, 44... | def list_snapshots(config_path=_DEFAULT_CONFIG_PATH, sort_by_time=False):
'''
Get a list of all the existing snapshots.
:param str config_path: The path to the configuration file for the aptly instance.
:param bool sort_by_time: Whether to sort by creation time instead of by name.
:return: A list ... |
0, module; 1, function_definition; 2, function_name:render_value; 3, parameters; 4, block; 5, identifier:value; 6, expression_statement; 7, if_statement; 8, comment:"""Render a value, ensuring that any nested dicts are sorted by key."""; 9, call; 10, block; 11, elif_clause; 12, else_clause; 13, identifier:isinstance; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 7, 12; 9, 13; 9, 14; 10, 15; 11, 16; 11, 17; 12, 18; 14, 19; 14, 20; 15, 21; 16, 22; 16, 23; 17, 24; 18, 25; 21, 26; 21, 27; 23, 28; 23, 29; 24, 30; 25, 31; 26, 32; 26, 33; 27, 34; 30, 35; 31, 36; 31, 37; 32, 38; 33, 39; 33, 40; 35, 41; 35, 42; 37, 43;... | def render_value(value):
"""Render a value, ensuring that any nested dicts are sorted by key."""
if isinstance(value, list):
return '[' + ', '.join(render_value(v) for v in value) + ']'
elif isinstance(value, dict):
return (
'{' +
', '.join('{k!r}: {v}'.format(
... |
0, module; 1, function_definition; 2, function_name:_sort_schema; 3, parameters; 4, block; 5, identifier:schema; 6, expression_statement; 7, if_statement; 8, comment:"""Recursively sorts a JSON schema by dict key."""; 9, call; 10, block; 11, elif_clause; 12, else_clause; 13, identifier:isinstance; 14, argument_list; 15... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 7, 12; 9, 13; 9, 14; 10, 15; 11, 16; 11, 17; 12, 18; 14, 19; 14, 20; 15, 21; 15, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 21, 28; 21, 29; 22, 30; 22, 31; 23, 32; 25, 33; 25, 34; 26, 35; 26, 36; 26, 37; 27, 38; 31, 39; 32, 40; 32, 41; 32, 42; 32, 43;... | def _sort_schema(schema):
"""Recursively sorts a JSON schema by dict key."""
if isinstance(schema, dict):
for k, v in sorted(schema.items()):
if isinstance(v, dict):
yield k, OrderedDict(_sort_schema(v))
elif isinstance(v, list):
yield k, list(_so... |
0, module; 1, function_definition; 2, function_name:_sort_handlers; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:signals; 7, identifier:handlers; 8, identifier:configs; 9, expression_statement; 10, function_definition; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, for_statement... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 9, 16; 10, 17; 10, 18; 10, 19; 11, 20; 12, 21; 13, 22; 13, 23; 13, 24; 14, 25; 14, 26; 14, 27; 15, 28; 18, 29; 18, 30; 19, 31; 19, 32; 19, 33; 19, 34; 19, 35; 20, 36; 20, 37; 21, 38; 21, 39; 22, 40; 22, 41; 23, 42; 23, 43; 2... | def _sort_handlers(cls, signals, handlers, configs):
"""Sort class defined handlers to give precedence to those declared at
lower level. ``config`` can contain two keys ``begin`` or ``end`` that
will further reposition the handler at the two extremes.
"""
def macro_precedence_sor... |
0, module; 1, function_definition; 2, function_name:_radixPass; 3, parameters; 4, block; 5, identifier:a; 6, identifier:b; 7, identifier:r; 8, identifier:n; 9, identifier:K; 10, expression_statement; 11, expression_statement; 12, comment:# counter array; 13, for_statement; 14, expression_statement; 15, for_statement; 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; 4, 14; 4, 15; 4, 16; 10, 17; 11, 18; 13, 19; 13, 20; 13, 21; 13, 22; 14, 23; 15, 24; 15, 25; 15, 26; 15, 27; 16, 28; 16, 29; 16, 30; 16, 31; 18, 32; 18, 33; 20, 34; 20, 35; 22, 36; 23, 37; 23, 38; 25, 39; 25, 40; 27, 41; 27, 42; 27, 43; 2... | def _radixPass(a, b, r, n, K):
"""
Stable sort of the sequence a according to the keys given in r.
>>> a=range(5)
>>> b=[0]*5
>>> r=[2,1,3,0,4]
>>> _radixPass(a, b, r, 5, 5)
>>> b
[3, 1, 0, 2, 4]
When n is less than the length of a, the end of b must be left unaltered.
>>> b=[... |
0, module; 1, function_definition; 2, function_name:save_yaml; 3, parameters; 4, comment:# type: (Dict, str, bool, bool) -> None; 5, block; 6, identifier:dictionary; 7, identifier:path; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, with_statement; 13, identifier:pretty; 14,... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 5, 10; 5, 11; 5, 12; 8, 13; 8, 14; 9, 15; 9, 16; 10, 17; 11, 18; 11, 19; 12, 20; 12, 21; 19, 22; 20, 23; 21, 24; 22, 25; 23, 26; 24, 27; 24, 28; 24, 29; 25, 30; 25, 31; 26, 32; 26, 33; 28, 34; 29, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 34, 41; 35, 42; 37, 43; 3... | def save_yaml(dictionary, path, pretty=False, sortkeys=False):
# type: (Dict, str, bool, bool) -> None
"""Save dictionary to YAML file preserving order if it is an OrderedDict
Args:
dictionary (Dict): Python dictionary to save
path (str): Path to YAML file
pretty (bool): Whether to ... |
0, module; 1, function_definition; 2, function_name:save_json; 3, parameters; 4, comment:# type: (Dict, str, bool, bool) -> None; 5, block; 6, identifier:dictionary; 7, identifier:path; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, with_statement; 12, identifier:pretty; 13, False; 14, identi... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 3, 9; 5, 10; 5, 11; 8, 12; 8, 13; 9, 14; 9, 15; 10, 16; 11, 17; 11, 18; 17, 19; 18, 20; 18, 21; 19, 22; 20, 23; 20, 24; 20, 25; 21, 26; 22, 27; 22, 28; 24, 29; 24, 30; 25, 31; 26, 32; 26, 33; 27, 34; 27, 35; 28, 36; 29, 37; 30, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43; ... | def save_json(dictionary, path, pretty=False, sortkeys=False):
# type: (Dict, str, bool, bool) -> None
"""Save dictionary to JSON file preserving order if it is an OrderedDict
Args:
dictionary (Dict): Python dictionary to save
path (str): Path to JSON file
pretty (bool): Whether to ... |
0, module; 1, function_definition; 2, function_name:save_json; 3, parameters; 4, block; 5, identifier:val; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, if_statement; 13, return_statement; 14, identifier:pretty; 15, False; 16, identifi... | 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; 10, 22; 11, 23; 11, 24; 11, 25; 12, 26; 12, 27; 13, 28; 21, 29; 21, 30; 22, 31; 24, 32; 25, 33; 26, 34; 26, 35; 27, 36; 31, 37; 32, 38; 33, 39; 34, 40; 35, 41; 35, 42; 36, 43; 37, 4... | def save_json(val, pretty=False, sort=True, encoder=None):
"""
Save data to json string
:param val: Value or struct to save
:type val: None | int | float | str | list | dict
:param pretty: Format data to be readable (default: False)
otherwise going to be compact
:type pretty... |
0, module; 1, function_definition; 2, function_name:revdocs2reverts; 3, parameters; 4, block; 5, identifier:rev_docs; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, identifier:radius; 14, attribute; 15, i... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 6, 13; 6, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 12, 23; 12, 24; 12, 25; 14, 26; 14, 27; 22, 28; 22, 29; 23, 30; 23, 31; 25, 32; 25, 33; 25, 34; 25, 35; 25, 36; 29, 37; 29, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43; 35, 4... | def revdocs2reverts(rev_docs, radius=defaults.RADIUS, use_sha1=False,
resort=False, verbose=False):
"""
Converts a sequence of page-partitioned revision documents into a sequence
of reverts.
:Params:
rev_docs : `iterable` ( `dict` )
a page-partitioned sequence of... |
0, module; 1, function_definition; 2, function_name:dsort; 3, parameters; 4, block; 5, identifier:fname; 6, identifier:order; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_statement... | 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; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 9, 20; 10, 21; 11, 22; 12, 23; 13, 24; 14, 25; 22, 26; 22, 27; 23, 28; 23, 29; 24, 30; 24, 31; 25, 32; 25, 33; 27, 34; 27, 35; 27, 36; 29, 37; 29, 38; 30, 39; 30, 40; 31, 41; 32, 42; 32, 43; 33, 4... | def dsort(fname, order, has_header=True, frow=0, ofname=None):
r"""
Sort file data.
:param fname: Name of the comma-separated values file to sort
:type fname: FileNameExists_
:param order: Sort order
:type order: :ref:`CsvColFilter`
:param has_header: Flag that indicates whether the com... |
0, module; 1, function_definition; 2, function_name:dsort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:order; 7, expression_statement; 8, comment:# Make order conforming to a list of dictionaries; 9, expression_statement; 10, expression_statement; 11, comment:# Verify that all columns exist in file; 12, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 7, 25; 9, 26; 10, 27; 12, 28; 14, 29; 15, 30; 15, 31; 15, 32; 24, 33; 24, 34; 24, 35; 26, 36; 26, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 29, 43; 32, 44; 33,... | def dsort(self, order):
r"""
Sort rows.
:param order: Sort order
:type order: :ref:`CsvColFilter`
.. [[[cog cog.out(exobj.get_sphinx_autodoc()) ]]]
.. Auto-generated exceptions documentation for
.. pcsv.csv_file.CsvFile.dsort
:raises:
* Runtim... |
0, module; 1, function_definition; 2, function_name:get_points_and_weights; 3, parameters; 4, block; 5, default_parameter; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, e... | 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; 5, 26; 5, 27; 6, 28; 6, 29; 7, 30; 7, 31; 8, 32; 8, 33; 9, 34; 9, 35; 10, 36; 11, 37; 12, 38; 13, 39; 14, 40; 15, 41; 16, 42; 17, 43; 18, 44; 19, 45; 20, ... | def get_points_and_weights(w_func=lambda x : np.ones(x.shape),
left=-1.0, right=1.0, num_points=5, n=4096):
"""Quadratude points and weights for a weighting function.
Points and weights for approximating the integral
I = \int_left^right f(x) w(x) dx
given the weighting function w(x) using the... |
0, module; 1, function_definition; 2, function_name:apply_to; 3, parameters; 4, block; 5, identifier:self; 6, identifier:x; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, identifier:columns; 12, False; 13, comment:"""Apply this translation to the given object
The argum... | 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; 9, 15; 10, 16; 10, 17; 10, 18; 10, 19; 10, 20; 10, 21; 10, 22; 14, 23; 14, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 23, 38; 23, 39; 25, 40; 26, 41; 26, 42; 27, 43; ... | def apply_to(self, x, columns=False):
"""Apply this translation to the given object
The argument can be several sorts of objects:
* ``np.array`` with shape (3, )
* ``np.array`` with shape (N, 3)
* ``np.array`` with shape (3, N), use ``columns=True``
* ``T... |
0, module; 1, function_definition; 2, function_name:apply_to; 3, parameters; 4, block; 5, identifier:self; 6, identifier:x; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, identifier:columns; 12, False; 13, comment:"""Apply this rotation to the given object
The argument... | 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; 9, 15; 10, 16; 10, 17; 10, 18; 10, 19; 10, 20; 10, 21; 10, 22; 14, 23; 14, 24; 15, 25; 16, 26; 16, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 23, 38; 23, 39; 25, 40; 26, 41; 26, 42; 27, 43; ... | def apply_to(self, x, columns=False):
"""Apply this rotation to the given object
The argument can be several sorts of objects:
* ``np.array`` with shape (3, )
* ``np.array`` with shape (N, 3)
* ``np.array`` with shape (3, N), use ``columns=True``
* ``Tran... |
0, module; 1, function_definition; 2, function_name:canonical_order; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# A) find an appropriate starting vertex.; 8, comment:# Here we take a central vertex that has a minimal number of symmetrical; 9, comment:# equivalents, 'the highest ato... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 4, 28; 4, 29; 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; 6, 44; 12, 45; 22, 46; 23, 4... | def canonical_order(self):
"""The vertices in a canonical or normalized order.
This routine will return a list of vertices in an order that does not
depend on the initial order, but only depends on the connectivity and
the return values of the function self.get_vertex_string.
... |
0, module; 1, function_definition; 2, function_name:get_subgraph; 3, parameters; 4, block; 5, identifier:self; 6, identifier:subvertices; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, return_statement; 11, identifier:normalize; 12, False; 13, comment:"""Constructs a subgraph of the current graph
... | 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; 9, 15; 9, 16; 10, 17; 15, 18; 15, 19; 15, 20; 15, 21; 15, 22; 15, 23; 15, 24; 15, 25; 15, 26; 15, 27; 15, 28; 15, 29; 15, 30; 15, 31; 16, 32; 18, 33; 19, 34; 20, 35; 21, 36; 21, 37; 21, 38; 23, 39; 25, 40; 26, 41; 27, 42; 28, 43; 2... | def get_subgraph(self, subvertices, normalize=False):
"""Constructs a subgraph of the current graph
Arguments:
| ``subvertices`` -- The vertices that should be retained.
| ``normalize`` -- Whether or not the vertices should renumbered and
reduced to the given... |
0, module; 1, function_definition; 2, function_name:get_closed_cycles; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# A) construct all the cycles; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, while_statement; 13, comment:# B) norma... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 8, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 12, 27; 14, 28; 18, 29; 19, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 27, 44;... | def get_closed_cycles(self):
"""Return the closed cycles corresponding to this permutation
The cycle will be normalized to facilitate the elimination of
duplicates. The following is guaranteed:
1) If this permutation is represented by disconnected cycles, the
cyc... |
0, module; 1, function_definition; 2, function_name:sorted_exists; 3, parameters; 4, block; 5, identifier:values; 6, identifier:x; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""
For list, values, returns the insert position ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 18, 25; 18, 26; 20, 27; 20, 28; 22, 29; 22, 30; 26, 31; 26, 32; 28, 33; 28, 34; 30, 35; 30, 36; 36, 37; 36, 38 | def sorted_exists(values, x):
"""
For list, values, returns the insert position for item x and whether the item already exists in the list. This
allows one function call to return either the index to overwrite an existing value in the list, or the index to
insert a new item in the list and keep the list... |
0, module; 1, function_definition; 2, function_name:sorted_index; 3, parameters; 4, block; 5, identifier:values; 6, identifier:x; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""
For list, values, returns the index location of element x. If x does not ... | 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; 22, 27; 22, 28; 24, 29; 24, 30; 25, 31; 25, 32; 26, 33; 31, 34; 31, 35; 35, 36; 35, 37 | def sorted_index(values, x):
"""
For list, values, returns the index location of element x. If x does not exist will raise an error.
:param values: list
:param x: item
:return: integer index
"""
i = bisect_left(values, x)
j = bisect_right(values, x)
return values[i:j].index(x) + i |
0, module; 1, function_definition; 2, function_name:sort_index; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# sort index; 9, expression_statement; 10, comment:# sort data; 11, expression_statement; 12, comment:"""
Sort the Series by the index. The so... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 9, 14; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 21, 33; 23, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 28, 40; 31, 41; 31, 42; 32, 43;... | def sort_index(self):
"""
Sort the Series by the index. The sort modifies the Series inplace
:return: nothing
"""
sort = sorted_list_indexes(self._index)
# sort index
self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] for x in... |
0, module; 1, function_definition; 2, function_name:_add_missing_rows; 3, parameters; 4, block; 5, identifier:self; 6, identifier:indexes; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, comment:"""
Given a list of indexes, find all the indexes that are not currently in the Series and ma... | 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; 11, 15; 11, 16; 14, 17; 16, 18; 16, 19; 16, 20; 17, 21; 19, 22; 19, 23; 20, 24; 21, 25; 21, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 28, 32; 28, 33 | def _add_missing_rows(self, indexes):
"""
Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for
that index by appending to the Series. This does not maintain sorted order for the index.
:param indexes: list of indexes
:return: ... |
0, module; 1, function_definition; 2, function_name:_insert_missing_rows; 3, parameters; 4, block; 5, identifier:self; 6, identifier:indexes; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, comment:"""
Given a list of indexes, find all the indexes that are not currently in the Series and... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 9, 12; 9, 13; 9, 14; 11, 15; 11, 16; 14, 17; 16, 18; 16, 19; 16, 20; 17, 21; 19, 22; 19, 23; 20, 24; 21, 25; 21, 26; 24, 27; 24, 28; 25, 29; 25, 30; 26, 31; 26, 32; 28, 33; 28, 34; 31, 35; 31, 36; 36, 37; 36, 38; 37, 39; 37, 40 | def _insert_missing_rows(self, indexes):
"""
Given a list of indexes, find all the indexes that are not currently in the Series and make a new row for
that index, inserting into the index. This requires the Series to be sorted=True
:param indexes: list of indexes
:return: nothin... |
0, module; 1, function_definition; 2, function_name:append_row; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index; 7, identifier:value; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""
Appends a row of value to the end of the data. Be v... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 9, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 18, 24; 18, 25; 19, 26; 20, 27; 20, 28; 21, 29; 22, 30; 22, 31; 23, 32; 26, 33; 26, 34; 27, 35; 27, 36; 30, 37; 30, 38; 34, 39; 39, 40 | def append_row(self, index, value):
"""
Appends a row of value to the end of the data. Be very careful with this function as for sorted Series it will
not enforce sort order. Use this only for speed when needed, be careful.
:param index: index
:param value: value
:retur... |
0, module; 1, function_definition; 2, function_name:append_rows; 3, parameters; 4, block; 5, identifier:self; 6, identifier:indexes; 7, identifier:values; 8, expression_statement; 9, comment:# check that the values data is less than or equal to the length of the indexes; 10, if_statement; 11, comment:# check the indexe... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 8, 17; 10, 18; 10, 19; 12, 20; 13, 21; 13, 22; 15, 23; 16, 24; 18, 25; 18, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 29, 42; 29, 43; 30... | def append_rows(self, indexes, values):
"""
Appends values to the end of the data. Be very careful with this function as for sort DataFrames it will not
enforce sort order. Use this only for speed when needed, be careful.
:param indexes: list of indexes to append
:param values:... |
0, module; 1, function_definition; 2, function_name:_sort_columns; 3, parameters; 4, block; 5, identifier:self; 6, identifier:columns_list; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""
Given a list of column names will sor... | 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; 11, 17; 13, 18; 14, 19; 15, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 19, 27; 21, 28; 21, 29; 22, 30; 22, 31; 23, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 25, 39; 25, 40; 26, 41; 26, 42; 27, 43; ... | def _sort_columns(self, columns_list):
"""
Given a list of column names will sort the DataFrame columns to match the given order
:param columns_list: list of column names. Must include all column names
:return: nothing
"""
if not (all([x in columns_list for x in self._co... |
0, module; 1, function_definition; 2, function_name:append_row; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index; 7, identifier:values; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, comment:# append index value; 13, expression_statement; 14, comment:# add data va... | 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; 8, 16; 8, 17; 9, 18; 10, 19; 10, 20; 11, 21; 11, 22; 13, 23; 15, 24; 15, 25; 15, 26; 19, 27; 19, 28; 20, 29; 22, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 28, 38; 28, 39; 29, 40; 30, 41; 30, 42; 30, 43; 31,... | def append_row(self, index, values, new_cols=True):
"""
Appends a row of values to the end of the data. If there are new columns in the values and new_cols is True
they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order.
Use this only... |
0, module; 1, function_definition; 2, function_name:append_rows; 3, parameters; 4, block; 5, identifier:self; 6, identifier:indexes; 7, identifier:values; 8, default_parameter; 9, expression_statement; 10, comment:# check that the values data is less than or equal to the length of the indexes; 11, for_statement; 12, co... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 8, 21; 8, 22; 9, 23; 11, 24; 11, 25; 11, 26; 13, 27; 14, 28; 14, 29; 15, 30; 15, 31; 17, 32; 19, 33; 19, 34; 19, 35; 20, 36; 26, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 31, 43; 32, 44; ... | def append_rows(self, indexes, values, new_cols=True):
"""
Appends rows of values to the end of the data. If there are new columns in the values and new_cols is True
they will be added. Be very careful with this function as for sort DataFrames it will not enforce sort order.
Use this on... |
0, module; 1, function_definition; 2, function_name:sort_index; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:# sort index; 9, expression_statement; 10, comment:# each column; 11, for_statement; 12, comment:"""
Sort the DataFrame by the index. The sort... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 9, 14; 11, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 16, 22; 16, 23; 17, 24; 19, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 21, 31; 23, 32; 24, 33; 26, 34; 29, 35; 29, 36; 30, 37; 30, 38; 31, 39; 31, 40; 32, 41; 32, 42; 33, 43;... | def sort_index(self):
"""
Sort the DataFrame by the index. The sort modifies the DataFrame inplace
:return: nothing
"""
sort = sorted_list_indexes(self._index)
# sort index
self._index = blist([self._index[x] for x in sort]) if self._blist else [self._index[x] fo... |
0, module; 1, function_definition; 2, function_name:tags; 3, parameters; 4, comment:# type: () -> List[str]; 5, block; 6, expression_statement; 7, return_statement; 8, comment:""" Returns all tags in the repo.
Returns:
list[str]: List of all tags in the repo, sorted as versions.
All tags returned by t... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 5, 6; 5, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 12, 14; 12, 15; 14, 16; 14, 17; 16, 18; 16, 19; 18, 20; 18, 21; 20, 22; 20, 23; 21, 24; 21, 25; 21, 26; 24, 27; 25, 28; 25, 29; 26, 30; 26, 31 | def tags():
# type: () -> List[str]
""" Returns all tags in the repo.
Returns:
list[str]: List of all tags in the repo, sorted as versions.
All tags returned by this function will be parsed as if the contained
versions (using ``v:refname`` sorting).
"""
return shell.run(
'g... |
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_default_parameter; 8, typed_default_parameter; 9, typed_default_parameter; 10, typed_default_parameter; 11, typed_default_parameter; 12, typed_default_parameter; 13, typed_default_parameter; 14, ty... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 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; 5, 25; 5, 26; 5, 27; 5, 28; 5, 29; 5, 30; 5, 31; 5, 32; 5, 33; 5, 34; 5, 35; 5, 36; 5, 37; 5, 38; 5, 39; 5, 40; 5, 41; 5, 42; 5, 43; 5, 44; 5, 45; 5, 46; 5, 47; ... | def search(
self,
token: dict = None,
query: str = "",
bbox: list = None,
poly: str = None,
georel: str = None,
order_by: str = "_created",
order_dir: str = "desc",
page_size: int = 100,
offset: int = 0,
share: str = None,
s... |
0, module; 1, function_definition; 2, function_name:keywords; 3, parameters; 4, type; 5, block; 6, identifier:self; 7, typed_default_parameter; 8, typed_default_parameter; 9, typed_default_parameter; 10, typed_default_parameter; 11, typed_default_parameter; 12, typed_default_parameter; 13, typed_default_parameter; 14, ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 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; 5, 19; 5, 20; 5, 21; 5, 22; 5, 23; 5, 24; 5, 25; 5, 26; 5, 27; 5, 28; 5, 29; 5, 30; 5, 31; 5, 32; 5, 33; 5, 34; 7, 35; 7, 36; 7, 37; 8, 38; 8, 39; 8, 40; 9, 41; 9, 42; 9, 43; 10, 44; 10, 45; 10, 46; 11, ... | def keywords(
self,
token: dict = None,
thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8",
query: str = "",
offset: int = 0,
order_by: str = "text",
order_dir: str = "desc",
page_size: int = 20,
specific_md: list = [],
specific_tag: list = ... |
0, module; 1, function_definition; 2, function_name:_field_sort_name; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:name; 7, expression_statement; 8, if_statement; 9, return_statement; 10, comment:"""Get a sort key for a field name that determines the order
fields should be written in.
Fiel... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 7, 10; 8, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 12, 18; 15, 19; 15, 20; 16, 21; 17, 22; 18, 23; 19, 24; 19, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 23, 31; 24, 32; 24, 33; 27, 34; 27, 35; 29, 36; 29, 37; 31, 38; 31, 39; 34, 40; 34, 41; 35, 42; 35, 43... | def _field_sort_name(cls, name):
"""Get a sort key for a field name that determines the order
fields should be written in.
Fields names are kept unchanged, unless they are instances of
:class:`DateItemField`, in which case `year`, `month`, and `day`
are replaced by `date0`, `dat... |
0, module; 1, function_definition; 2, function_name:sorted_fields; 3, parameters; 4, block; 5, identifier:cls; 6, expression_statement; 7, for_statement; 8, comment:"""Get the names of all writable metadata fields, sorted in the
order that they should be written.
This is a lexicographic order, except f... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 7, 11; 10, 12; 10, 13; 11, 14; 13, 15; 13, 16; 14, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 18, 23; 18, 24; 21, 25; 21, 26 | def sorted_fields(cls):
"""Get the names of all writable metadata fields, sorted in the
order that they should be written.
This is a lexicographic order, except for instances of
:class:`DateItemField`, which are sorted in year-month-day
order.
"""
for property in... |
0, module; 1, function_definition; 2, function_name:set_vassals_wrapper_params; 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, expression_statement; 13, return_statement; 14, ... | 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; 12, 23; 13, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 25, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 28, 40; 28, 41; 29, 42; 29, 43; 30, 4... | def set_vassals_wrapper_params(self, wrapper=None, overrides=None, fallbacks=None):
"""Binary wrapper for vassals parameters.
:param str|unicode wrapper: Set a binary wrapper for vassals.
:param str|unicode|list[str|unicode] overrides: Set a binary wrapper for vassals to try before the default... |
0, module; 1, function_definition; 2, function_name:add_query_parameters_to_url; 3, parameters; 4, block; 5, identifier:url; 6, identifier:query_parameters; 7, expression_statement; 8, comment:# Parse the given URL into parts.; 9, expression_statement; 10, comment:# Parse existing parameters and add new parameters.; 11... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 7, 19; 9, 20; 11, 21; 12, 22; 14, 23; 15, 24; 15, 25; 15, 26; 17, 27; 18, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 25, 37; 25, 38; 26, 39; 27, 40; 27, 41; 28, 42; 28, 43; 30, 4... | def add_query_parameters_to_url(url, query_parameters):
"""
Merge a dictionary of query parameters into the given URL.
Ensures all parameters are sorted in dictionary order when returning the URL.
"""
# Parse the given URL into parts.
url_parts = urllib.parse.urlparse(url)
# Parse existing ... |
0, module; 1, function_definition; 2, function_name:merge; 3, parameters; 4, block; 5, identifier:self; 6, identifier:elements; 7, expression_statement; 8, import_from_statement; 9, import_from_statement; 10, comment:# The list2tuple conversion is necessary because mutable objects (e.g. lists) are not hashable; 11, exp... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 8, 15; 9, 16; 9, 17; 9, 18; 11, 19; 12, 20; 13, 21; 14, 22; 15, 23; 16, 24; 16, 25; 17, 26; 18, 27; 19, 28; 19, 29; 29, 30; 29, 31; 31, 32; 32, 33; 32, 34; 34, 35; 34, 36; 35, 37; 35, 38; 36, 39; 36, 40; 39, 41; 39, 42; 41, 43; 41,... | def merge(self, elements):
''' Merges all scraping results to a list sorted by frequency of occurrence. '''
from collections import Counter
from lltk.utils import list2tuple, tuple2list
# The list2tuple conversion is necessary because mutable objects (e.g. lists) are not hashable
merged = tuple2list([value f... |
0, module; 1, function_definition; 2, function_name:in1d_sorted; 3, parameters; 4, block; 5, identifier:ar1; 6, identifier:ar2; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, comment:"""
Does the same than np.in1d but uses the fact that ar1 and... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 10, 17; 11, 18; 13, 19; 13, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 23, 33; 23, 34; 24, 35; 24, 36; 26, 37; 26, 38; 28, 39; 28, 40; 30, 41; 30, 42; 33, 43; 3... | def in1d_sorted(ar1, ar2):
"""
Does the same than np.in1d but uses the fact that ar1 and ar2 are sorted. Is therefore much faster.
"""
if ar1.shape[0] == 0 or ar2.shape[0] == 0: # check for empty arrays to avoid crash
return []
inds = ar2.searchsorted(ar1)
inds[inds == len(ar2)] = 0
... |
0, module; 1, function_definition; 2, function_name:get_parameter_value_from_file_names; 3, parameters; 4, block; 5, identifier:files; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# unique=False; 11, expression_statement; 12, expression_statement; 13, if_sta... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 11, 27; 12, 28; 13, 29; 13, 30; 13, 31; 14, 32; 14, 33; 15, 34; 16, 35; 16, 36; 16, 37; 17, 38; 18, 39; 18, 40; 18, 41; 19, 42; 27, 43; 27, 44; 28,... | def get_parameter_value_from_file_names(files, parameters=None, unique=False, sort=True):
"""
Takes a list of files, searches for the parameter name in the file name and returns a ordered dict with the file name
in the first dimension and the corresponding parameter value in the second.
The file names c... |
0, module; 1, function_definition; 2, function_name:get_data_file_names_from_scan_base; 3, parameters; 4, block; 5, identifier:scan_base; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, if_statement; 13, for_statement; 14, if_sta... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 6, 17; 6, 18; 7, 19; 7, 20; 8, 21; 8, 22; 9, 23; 10, 24; 11, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 13, 31; 14, 32; 14, 33; 15, 34; 15, 35; 16, 36; 18, 37; 18, 38; 18, 39; 18, 40; 18, 41; 24, 42; 24, 43; 25, 44; ... | def get_data_file_names_from_scan_base(scan_base, filter_str=['_analyzed.h5', '_interpreted.h5', '_cut.h5', '_result.h5', '_hists.h5'], sort_by_time=True, meta_data_v2=True):
"""
Generate a list of .h5 files which have a similar file name.
Parameters
----------
scan_base : list, string
List... |
0, module; 1, function_definition; 2, function_name:get_parameter_from_files; 3, parameters; 4, block; 5, identifier:files; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, expression_st... | 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; 6, 18; 6, 19; 7, 20; 7, 21; 8, 22; 8, 23; 9, 24; 10, 25; 11, 26; 12, 27; 12, 28; 13, 29; 13, 30; 14, 31; 16, 32; 16, 33; 16, 34; 17, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 29, 44; 2... | def get_parameter_from_files(files, parameters=None, unique=False, sort=True):
''' Takes a list of files, searches for the parameter name in the file name and in the file.
Returns a ordered dict with the file name in the first dimension and the corresponding parameter values in the second.
If a scan paramet... |
0, module; 1, function_definition; 2, function_name:reduce_sorted_to_intersect; 3, parameters; 4, block; 5, identifier:ar1; 6, identifier:ar2; 7, expression_statement; 8, comment:# Ravel both arrays, behavior for the first array could be different; 9, expression_statement; 10, expression_statement; 11, comment:# get mi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 27; 7, 28; 9, 29; 10, 30; 12, 31; 13, 32; 14, 33; 15, 34; 16, 35; 16, 36; 16, 37; 18, 38; 19, 39; 20, 40; 21, 41; 22, 42; 22, 43; 23, 44; 23, 45... | def reduce_sorted_to_intersect(ar1, ar2):
"""
Takes two sorted arrays and return the intersection ar1 in ar2, ar2 in ar1.
Parameters
----------
ar1 : (M,) array_like
Input array.
ar2 : array_like
Input array.
Returns
-------
ar1, ar1 : ndarray, ndarray
The ... |
0, module; 1, function_definition; 2, function_name:get_hits_in_events; 3, parameters; 4, block; 5, identifier:hits_array; 6, identifier:events; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, try_statement; 13, return_statement; 14, identifier:assume... | 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; 7, 14; 7, 15; 8, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 21; 12, 22; 12, 23; 13, 24; 18, 25; 19, 26; 19, 27; 21, 28; 21, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 26, 35; 26, 36; 27, 37; 28, 38; 30, 39; 30, 40; 30, 41; 31, 42; 31, 43; 31,... | def get_hits_in_events(hits_array, events, assume_sorted=True, condition=None):
'''Selects the hits that occurred in events and optional selection criterion.
If a event range can be defined use the get_data_in_event_range function. It is much faster.
Parameters
----------
hits_array : numpy.arr... |
0, module; 1, function_definition; 2, function_name:natsorted; 3, parameters; 4, block; 5, identifier:seq; 6, default_parameter; 7, expression_statement; 8, import_statement; 9, expression_statement; 10, expression_statement; 11, return_statement; 12, identifier:cmp; 13, identifier:natcmp; 14, string:"Returns a copy of... | 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; 16, 20; 16, 21; 17, 22; 17, 23; 21, 24; 21, 25; 23, 26; 23, 27; 24, 28; 24, 29; 25, 30 | def natsorted(seq, cmp=natcmp):
"Returns a copy of seq, sorted by natural string sort."
import copy
temp = copy.copy(seq)
natsort(temp, cmp)
return temp |
0, module; 1, function_definition; 2, function_name:sort2groups; 3, parameters; 4, block; 5, identifier:array; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, return_statement; 12, identifier:gpat; 13, list; 14, comment:""" Sort an array of strings... | 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; 10, 18; 10, 19; 11, 20; 13, 21; 13, 22; 15, 23; 15, 24; 16, 25; 16, 26; 19, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 22, 33; 24, 34; 24, 35; 27, 36; 28, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 3... | def sort2groups(array, gpat=['_R1','_R2']):
""" Sort an array of strings to groups by patterns """
groups = [REGroup(gp) for gp in gpat]
unmatched = []
for item in array:
matched = False
for m in groups:
if m.match(item):
matched = True
break
if not matched... |
0, module; 1, function_definition; 2, function_name:sort_and_distribute; 3, parameters; 4, block; 5, identifier:array; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, if_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, while_statement; 14, return_statement; 15, ide... | 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; 6, 15; 6, 16; 7, 17; 8, 18; 8, 19; 9, 20; 9, 21; 10, 22; 11, 23; 11, 24; 11, 25; 12, 26; 13, 27; 13, 28; 14, 29; 18, 30; 19, 31; 20, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44... | def sort_and_distribute(array, splits=2):
""" Sort an array of strings to groups by alphabetically continuous
distribution
"""
if not isinstance(array, (list,tuple)): raise TypeError("array must be a list")
if not isinstance(splits, int): raise TypeError("splits must be an integer")
remaining = so... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, typed_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, identifier:section; 15, 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; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 12, 23; 12, 24; 13, 25; 15, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 22, 34; 23, 35; 23, 36; 24, 37; 25, 38; 25, 39; 28, 40; 28, 41; 29, 42; 29, 43; 30, ... | def sort(self, section: int, order=None):
"""Order is defined by the current state of sorting"""
attr = self.header[section]
old_i, old_sort = self.sort_state
self.beginResetModel()
if section == old_i:
self.collection.sort(attr, not old_sort)
self.sort_st... |
0, module; 1, function_definition; 2, function_name:set_collection; 3, parameters; 4, block; 5, identifier:self; 6, identifier:collection; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:"""Reset sort state, set collection and em... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 19, 27; 19, 28; 21, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 31, 35 | def set_collection(self, collection):
"""Reset sort state, set collection and emit resetModel signal"""
self.beginResetModel()
self.collection = collection
self.sort_state = (-1, False)
self.endResetModel() |
0, module; 1, function_definition; 2, function_name:copy; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:items; 10, None; 11, comment:"""Return a new NGram object with the same settings, and
referencing the same items. Copy is shal... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 6, 10; 7, 11; 8, 12; 12, 13; 12, 14; 14, 15; 14, 16; 14, 17; 14, 18; 14, 19; 14, 20; 14, 21; 15, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 17, 28; 18, 29; 18, 30; 19, 31; 19, 32; 20, 33; 20, 34; 21, 35; 21, 36; 23, 37; 23, 38 | def copy(self, items=None):
"""Return a new NGram object with the same settings, and
referencing the same items. Copy is shallow in that
each item is not recursively copied. Optionally specify
alternate items to populate the copy.
>>> from ngram import NGram
>>> from ... |
0, module; 1, function_definition; 2, function_name:items_sharing_ngrams; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, expression_statement; 8, comment:# From matched string to number of N-grams shared with query string; 9, expression_statement; 10, comment:# Dictionary mapping n-gram to string ... | 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; 12, 17; 13, 18; 13, 19; 13, 20; 14, 21; 16, 22; 16, 23; 17, 24; 17, 25; 19, 26; 19, 27; 20, 28; 26, 29; 26, 30; 27, 31; 28, 32; 28, 33; 32, 34; 33, 35; 33, 36; 34, 37; 34, 38; 34, 39; 36, 40; 37, 41; 37, 42; 38, 43; 3... | def items_sharing_ngrams(self, query):
"""Retrieve the subset of items that share n-grams the query string.
:param query: look up items that share N-grams with this string.
:return: mapping from matched string to the number of shared N-grams.
>>> from ngram import NGram
>>> n =... |
0, module; 1, function_definition; 2, function_name:searchitem; 3, parameters; 4, block; 5, identifier:self; 6, identifier:item; 7, default_parameter; 8, expression_statement; 9, return_statement; 10, identifier:threshold; 11, None; 12, comment:"""Search the index for items whose key exceeds the threshold
simil... | 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; 18, 20; 18, 21; 20, 22; 20, 23; 21, 24 | def searchitem(self, item, threshold=None):
"""Search the index for items whose key exceeds the threshold
similarity to the key of the given item.
:return: list of pairs of (item, similarity) by decreasing similarity.
>>> from ngram import NGram
>>> n = NGram([(0, "SPAM"), (1, ... |
0, module; 1, function_definition; 2, function_name:search; 3, parameters; 4, block; 5, identifier:self; 6, identifier:query; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# Identify possible results; 12, for_statement; 13, comment:# Sort results by decrea... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 12, 21; 12, 22; 12, 23; 14, 24; 15, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 23, 36; 24, 37; 24, 38; 27, 39; 27, 40; 27, 41; 32, 42; 32, 43; 34, ... | def search(self, query, threshold=None):
"""Search the index for items whose key exceeds threshold
similarity to the query string.
:param query: returned items will have at least `threshold` \
similarity to the query string.
:return: list of pairs of (item, similarity) by decre... |
0, module; 1, function_definition; 2, function_name:clear; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:"""Remove all elements from this set.
>>> from ngram import NGram
>>> n = NGram(['spam'... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 9, 13; 11, 14; 11, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 16, 22; 16, 23; 18, 24; 18, 25; 20, 26; 20, 27; 27, 28; 27, 29 | def clear(self):
"""Remove all elements from this set.
>>> from ngram import NGram
>>> n = NGram(['spam', 'eggs'])
>>> sorted(list(n))
['eggs', 'spam']
>>> n.clear()
>>> list(n)
[]
"""
super(NGram, self).clear()
self._grams = {}
... |
0, module; 1, function_definition; 2, function_name:union; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, return_statement; 9, identifier:others; 10, comment:"""Return the union of two or more sets as a new set.
>>> from ngram import NGram
>>> a = NGram(... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 11, 12; 11, 13; 12, 14; 12, 15; 13, 16; 16, 17; 16, 18; 17, 19; 17, 20; 18, 21; 19, 22; 19, 23; 21, 24; 23, 25; 23, 26 | def union(self, *others):
"""Return the union of two or more sets as a new set.
>>> from ngram import NGram
>>> a = NGram(['spam', 'eggs'])
>>> b = NGram(['spam', 'ham'])
>>> sorted(list(a.union(b)))
['eggs', 'ham', 'spam']
"""
return self.copy(super(NGra... |
0, module; 1, function_definition; 2, function_name:symmetric_difference; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, expression_statement; 8, return_statement; 9, comment:"""Return the symmetric difference of two sets as a new set.
>>> from ngram import NGram
>>> a = NGram(['s... | 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; 15, 16; 15, 17; 16, 18; 16, 19; 17, 20; 18, 21; 18, 22; 22, 23; 22, 24 | def symmetric_difference(self, other):
"""Return the symmetric difference of two sets as a new set.
>>> from ngram import NGram
>>> a = NGram(['spam', 'eggs'])
>>> b = NGram(['spam', 'ham'])
>>> sorted(list(a.symmetric_difference(b)))
['eggs', 'ham']
"""
... |
0, module; 1, function_definition; 2, function_name:symmetric_difference_update; 3, parameters; 4, block; 5, identifier:self; 6, identifier:other; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# add items present in other; 11, expression_statement; 12, comment:"""Update the set ... | 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; 11, 15; 13, 16; 13, 17; 14, 18; 14, 19; 15, 20; 15, 21; 17, 22; 17, 23; 18, 24; 18, 25; 19, 26; 20, 27; 20, 28; 21, 29; 22, 30; 22, 31; 23, 32; 30, 33; 30, 34; 34, 35; 34, 36 | def symmetric_difference_update(self, other):
"""Update the set with the symmetric difference of itself and `other`.
>>> from ngram import NGram
>>> n = NGram(['spam', 'eggs'])
>>> other = set(['spam', 'ham'])
>>> n.symmetric_difference_update(other)
>>> sorted(list(n))
... |
0, module; 1, function_definition; 2, function_name:download; 3, parameters; 4, block; 5, identifier:directory; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, 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 download(directory, master_token=None, member=None, access_token=None,
source=None, project_data=False, max_size='128m', verbose=False,
debug=False, memberlist=None, excludelist=None,
id_filename=False):
"""
Download data from project members to the target directory.
... |
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, expression_statement; 12, return_statement; 13, identifier:columns; 14, identifier:options; ... | 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; 12, 21; 16, 22; 16, 23; 19, 24; 19, 25; 19, 26; 20, 27; 20, 28; 23, 29; 23, 30; 24, 31; 24, 32; 24, 33; 24, 34; 25, 35; 25, 36; 25, 37; 26, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 2... | def sort(self, *columns, **options):
"""
Return a new query which will produce results sorted by
one or more metrics or dimensions. You may use plain
strings for the columns, or actual `Column`, `Metric`
and `Dimension` objects.
Add a minus in front of the metric (either... |
0, module; 1, function_definition; 2, function_name:getList; 3, parameters; 4, block; 5, identifier:self; 6, identifier:aspList; 7, expression_statement; 8, comment:# Significators; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:# Promissors; 14, expre... | 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; 7, 23; 9, 24; 10, 25; 11, 26; 12, 27; 14, 28; 15, 29; 16, 30; 17, 31; 18, 32; 20, 33; 21, 34; 21, 35; 21, 36; 22, 37; 24, 38; 24, 39; 25, 40; 25, 41; 26, 42; 26, 43; 27, 44; 2... | def getList(self, aspList):
""" Returns a sorted list with all
primary directions.
"""
# Significators
objects = self._elements(self.SIG_OBJECTS, self.N, [0])
houses = self._elements(self.SIG_HOUSES, self.N, [0])
angles = self._elements(self.SIG_ANGLES, ... |
0, module; 1, function_definition; 2, function_name:knt2mlt; 3, parameters; 4, block; 5, identifier:t; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, comment:"""Count multiplicities of elements in a sorte... | 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; 8, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 14, 23; 14, 24; 15, 25; 15, 26; 16, 27; 17, 28; 17, 29; 18, 30; 18, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 24, 38; 24, 39; 25, 40; 25, 41; 27, 42; 33, 43; 34... | def knt2mlt(t):
"""Count multiplicities of elements in a sorted list or rank-1 array.
Minimal emulation of MATLAB's ``knt2mlt``.
Parameters:
t:
Python list or rank-1 array. Must be sorted!
Returns:
out
rank-1 array such that
out[k] = #{ t[i] == t[k] for i < k }
Example:
If ``... |
0, module; 1, function_definition; 2, function_name:get_gallery; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, return_statement;... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 6, 15; 6, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 16, 29; 18, 30; 20, 31; 26, 32; 26, 33; 27, 34; 27, 35; 28, 36; 28, 37; 33, 38; 35, 39; 35, 40; 36, 41; 36, 42; 37, 43; 37, 44;... | def get_gallery(self, section='hot', sort='viral', window='day',
show_viral=True, limit=None):
"""
Return a list of gallery albums and gallery images.
:param section: hot | top | user - defaults to hot.
:param sort: viral | time - defaults to viral.
:param wi... |
0, module; 1, function_definition; 2, function_name:find_neighbors; 3, parameters; 4, block; 5, identifier:neighbors; 6, identifier:coords; 7, identifier:I; 8, identifier:source_files; 9, identifier:f; 10, identifier:sides; 11, expression_statement; 12, for_statement; 13, return_statement; 14, comment:"""Find the tile ... | 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; 11, 14; 12, 15; 12, 16; 12, 17; 13, 18; 15, 19; 15, 20; 16, 21; 16, 22; 17, 23; 17, 24; 17, 25; 17, 26; 17, 27; 22, 28; 23, 29; 25, 30; 25, 31; 27, 32; 27, 33; 27, 34; 29, 35; 29, 36; 30, 37; 30, 38; 31, 39; 32, 40; 32, 41; 33, 42; 33, 43... | def find_neighbors(neighbors, coords, I, source_files, f, sides):
"""Find the tile neighbors based on filenames
Parameters
-----------
neighbors : dict
Dictionary that stores the neighbors. Format is
neighbors["source_file_name"]["side"] = "neighbor_source_file_name"
coords : list
... |
0, module; 1, function_definition; 2, function_name:sortrows; 3, parameters; 4, block; 5, identifier:a; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# We recursively call sortrows to make sure it is sorted best... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 10, 23; 11, 24; 14, 25; 14, 26; 15, 27; 15, 28; 15, 29; 23, 30; 23, 31; 24, 32; 24, 33; 25, 34; 25, 35; 26, 36; 28, 37; 29, 38; 31, 39; 31, 40; 33, 41; 33, 42; 33, 43; 35, 44;... | def sortrows(a, i=0, index_out=False, recurse=True):
""" Sorts array "a" by columns i
Parameters
------------
a : np.ndarray
array to be sorted
i : int (optional)
column to be sorted by, taken as 0 by default
index_out : bool (optional)
return the index I such that a(I) ... |
0, module; 1, function_definition; 2, function_name:my_notes; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, while_statement; 15,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 6, 16; 6, 17; 7, 18; 7, 19; 8, 20; 8, 21; 9, 22; 9, 23; 10, 24; 10, 25; 11, 26; 12, 27; 13, 28; 14, 29; 14, 30; 15, 31; 23, 32; 25, 33; 27, 34; 27, 35; 28, 36; 28, 37; 30, 38; 30, 39; 30, 40; 30, 41; 30, 42; 30, 43; 30, 44; ... | def my_notes(self, start_index=0, limit=100, get_all=False, sort_by='loanId', sort_dir='asc'):
"""
Return all the loan notes you've already invested in. By default it'll return 100 results at a time.
Parameters
----------
start_index : int, optional
The result index ... |
0, module; 1, function_definition; 2, function_name:blacken; 3, parameters; 4, block; 5, identifier:c; 6, expression_statement; 7, if_statement; 8, comment:# Install, allowing config override of hardcoded default version; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# Execute... | 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; 7, 17; 9, 18; 10, 19; 11, 20; 14, 21; 16, 22; 17, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 24, 37; 27, 38; 27, 39; 29, 40; 29, 41; 30, 42; 30, 43; 31,... | def blacken(c):
"""
Install and execute ``black`` under appropriate circumstances, with diffs.
Installs and runs ``black`` under Python 3.6 (the first version it
supports). Since this sort of CI based task only needs to run once per
commit (formatting is not going to change between interpreters) th... |
0, module; 1, function_definition; 2, function_name:_versions_from_changelog; 3, parameters; 4, block; 5, identifier:changelog; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
Return all released versions from given ``changelog``, sorted.
:param dict changelog:
A c... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 6, 9; 7, 10; 8, 11; 10, 12; 10, 13; 11, 14; 11, 15; 13, 16; 13, 17; 13, 18; 15, 19; 16, 20; 16, 21; 17, 22; 17, 23; 18, 24; 21, 25; 24, 26; 24, 27; 26, 28; 26, 29; 27, 30 | def _versions_from_changelog(changelog):
"""
Return all released versions from given ``changelog``, sorted.
:param dict changelog:
A changelog dict as returned by ``releases.util.parse_changelog``.
:returns: A sorted list of `semantic_version.Version` objects.
"""
versions = [Version(x... |
0, module; 1, function_definition; 2, function_name:_get_tags; 3, parameters; 4, block; 5, identifier:c; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, comment:# Version objects sort semantically; 10, return_statement; 11, comment:"""
Return sorted list of release-style tags as semver object... | 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; 10, 16; 12, 17; 12, 18; 14, 19; 14, 20; 15, 21; 16, 22; 16, 23; 19, 24; 19, 25; 20, 26; 21, 27; 21, 28; 21, 29; 21, 30; 21, 31; 21, 32; 23, 33; 24, 34; 24, 35; 27, 36; 32, 37; 32, 38; 34, 39; 34, 40; 36, 41; 38, 42; 39, 43; ... | def _get_tags(c):
"""
Return sorted list of release-style tags as semver objects.
"""
tags_ = []
for tagstr in c.run("git tag", hide=True).stdout.strip().split("\n"):
try:
tags_.append(Version(tagstr))
# Ignore anything non-semver; most of the time they'll be non-release
... |
0, module; 1, function_definition; 2, function_name:sortForSameExpTime; 3, parameters; 4, comment:# , excludeSingleImg=True):; 5, block; 6, identifier:expTimes; 7, identifier:img_paths; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, comment:# for key in list(d.keys()):; 12, comment:# ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 8, 18; 9, 19; 10, 20; 10, 21; 10, 22; 16, 23; 17, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 23, 34; 23, 35; 24, 36; 24, 37; 31, 38; 31, 39; 32, 40; 32, 41; 33, 42; 35, 43; 35, ... | def sortForSameExpTime(expTimes, img_paths): # , excludeSingleImg=True):
'''
return image paths sorted for same exposure time
'''
d = {}
for e, i in zip(expTimes, img_paths):
if e not in d:
d[e] = []
d[e].append(i)
# for key in list(d.keys()):
# if ... |
0, module; 1, function_definition; 2, function_name:actionnames; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""
Returns a alphabetical sorted list of tuples with all known
service- and action-names.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 13, 18; 13, 19; 14, 20; 14, 21; 19, 22; 20, 23; 21, 24; 21, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 25, 31; 25, 32; 26, 33; 27, 34; 27, 35; 30, 36; 30, 37; 32, 38; 33, 39; 34, 40; 34, 41; 36, 42; 36, 43; ... | def actionnames(self):
"""
Returns a alphabetical sorted list of tuples with all known
service- and action-names.
"""
actions = []
for service_name in sorted(self.services.keys()):
action_names = self.services[service_name].actions.keys()
for actio... |
0, module; 1, function_definition; 2, function_name:lookup_field_orderable; 3, parameters; 4, block; 5, identifier:self; 6, identifier:field; 7, expression_statement; 8, try_statement; 9, comment:"""
Returns whether the passed in field is sortable or not, by default all 'raw' fields, that
is fields that... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 7, 9; 8, 10; 8, 11; 10, 12; 10, 13; 11, 14; 11, 15; 11, 16; 12, 17; 13, 18; 16, 19; 17, 20; 17, 21; 19, 22; 20, 23; 20, 24; 21, 25; 23, 26; 23, 27; 26, 28; 26, 29 | def lookup_field_orderable(self, field):
"""
Returns whether the passed in field is sortable or not, by default all 'raw' fields, that
is fields that are part of the model are sortable.
"""
try:
self.model._meta.get_field_by_name(field)
return True
... |
0, module; 1, function_definition; 2, function_name:run; 3, parameters; 4, block; 5, identifier:files; 6, identifier:temp_folder; 7, expression_statement; 8, try_statement; 9, expression_statement; 10, comment:# --quiet because isort >= 4.1 outputs its logo in the console by default.; 11, return_statement; 12, comment:... | 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; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 20, 26; 22, 27; 22, 28; 23, 29; 23, 30; 25, 31; 26, 32; 28, 33; 29, 34; 29, 35; 35, 36; 36, 37; 36, 38; 37, 39; 37, 40; 38, 41; 39, 42; 41, 43; ... | def run(files, temp_folder):
"""Check isort errors in the code base.
For the --quiet option, at least isort >= 4.1.1 is required.
https://github.com/timothycrosley/isort/blob/develop/CHANGELOG.md#411
"""
try:
import isort # NOQA
except ImportError:
return NO_ISORT_MSG
py_... |
0, module; 1, function_definition; 2, function_name:keys; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:key; 12, None; 13, identifier:reverse; 14, False; 15, comment:"""sort the keys before ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 6, 11; 6, 12; 7, 13; 7, 14; 8, 15; 9, 16; 10, 17; 16, 18; 16, 19; 19, 20; 19, 21; 21, 22; 21, 23; 21, 24; 22, 25; 22, 26; 23, 27; 23, 28; 24, 29; 24, 30; 26, 31; 31, 32; 31, 33; 32, 34; 32, 35; 33, 36 | def keys(self, key=None, reverse=False):
"""sort the keys before returning them"""
ks = sorted(list(dict.keys(self)), key=key, reverse=reverse)
return ks |
0, module; 1, function_definition; 2, function_name:lazy_map; 3, parameters; 4, block; 5, identifier:data_processor; 6, identifier:data_generator; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, with_statement; 14, return_statement; ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 10, 21; 10, 22; 11, 23; 11, 24; 12, 25; 13, 26; 13, 27; 14, 28; 20, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 25, 36; 25, 37; 26, 38; 27, 39; 30, 40; 31, 41; 31, 42; 32, 43; 35, ... | def lazy_map(data_processor, data_generator, n_cpus=1, stepsize=None):
"""A variant of multiprocessing.Pool.map that supports lazy evaluation
As with the regular multiprocessing.Pool.map, the processes are spawned off
asynchronously while the results are returned in order. In contrast to
multiprocessin... |
0, module; 1, function_definition; 2, function_name:lazy_imap; 3, parameters; 4, block; 5, identifier:data_processor; 6, identifier:data_generator; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, with_statement; 13, identifier:n_cpus; 14, integer:1; 15, ident... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 7, 14; 8, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 11, 22; 12, 23; 12, 24; 18, 25; 19, 26; 20, 27; 20, 28; 21, 29; 21, 30; 22, 31; 23, 32; 24, 33; 26, 34; 27, 35; 27, 36; 28, 37; 31, 38; 32, 39; 33, 40; 33, 41; 34, 42; 34, 43; 37... | def lazy_imap(data_processor, data_generator, n_cpus=1, stepsize=None):
"""A variant of multiprocessing.Pool.imap that supports lazy evaluation
As with the regular multiprocessing.Pool.imap, the processes are spawned
off asynchronously while the results are returned in order. In contrast to
multiproces... |
0, module; 1, function_definition; 2, function_name:get_dummy_thread; 3, parameters; 4, block; 5, identifier:nsamples; 6, dictionary_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, if_statement; 14, expre... | 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; 6, 18; 7, 19; 8, 20; 9, 21; 10, 22; 11, 23; 12, 24; 12, 25; 13, 26; 13, 27; 14, 28; 15, 29; 15, 30; 16, 31; 17, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 25, 41; 26, 42; 26, 43; 27, 44... | def get_dummy_thread(nsamples, **kwargs):
"""Generate dummy data for a single nested sampling thread.
Log-likelihood values of points are generated from a uniform distribution
in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is
not -np.inf). Theta values of each point are each g... |
0, module; 1, function_definition; 2, function_name:get_dummy_run; 3, parameters; 4, block; 5, identifier:nthread; 6, identifier:nsamples; 7, dictionary_splat_pattern; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, ex... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 7, 27; 8, 28; 9, 29; 10, 30; 11, 31; 12, 32; 13, 33; 13, 34; 14, 35; 16, 36; 16, 37; 17, 38; 18, 39; 18, 40; 18, 41; 22, 42; 23, 43; 23, 44; 23, 45... | def get_dummy_run(nthread, nsamples, **kwargs):
"""Generate dummy data for a nested sampling run.
Log-likelihood values of points are generated from a uniform distribution
in (0, 1), sorted, scaled by logl_range and shifted by logl_start (if it is
not -np.inf). Theta values of each point are each gener... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.