nodes stringlengths 501 22.4k | edges stringlengths 138 5.07k | code stringlengths 108 19.3k |
|---|---|---|
0, module; 1, function_definition; 2, function_name:index; 3, parameters; 4, block; 5, identifier:self; 6, identifier:columnnames; 7, default_parameter; 8, expression_statement; 9, import_from_statement; 10, return_statement; 11, identifier:sort; 12, True; 13, comment:"""Return a tableindex object.
:class:`tab... | 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; 14, 17; 14, 18; 15, 19; 16, 20; 16, 21; 18, 22; 21, 23; 21, 24; 21, 25 | def index(self, columnnames, sort=True):
"""Return a tableindex object.
:class:`tableindex` lets one get the row numbers of the rows holding
given values for the columns for which the index is created.
It uses an in-memory index on which a binary search is done.
By default the t... |
0, module; 1, function_definition; 2, function_name:rownumbers; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, return_statement; 10, identifier:table; 11, None; 12, comment:"""Return a list containing the row numbers of this table.
This method ca... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 8, 13; 8, 14; 9, 15; 13, 16; 13, 17; 14, 18; 15, 19; 15, 20; 18, 21; 19, 22; 19, 23; 20, 24; 21, 25; 21, 26; 25, 27; 25, 28; 26, 29; 29, 30; 29, 31 | def rownumbers(self, table=None):
"""Return a list containing the row numbers of this table.
This method can be useful after a selection or a sort.
It returns the row numbers of the rows in this table with respect
to the given table. If no table is given, the original table is used.
... |
0, module; 1, function_definition; 2, function_name:showstructure; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, return_statement; 12, identifier:dataman; 13, True; 14, identifier:column; 15, True; 16, i... | 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; 23, 29 | def showstructure(self, dataman=True, column=True, subtable=False,
sort=False):
"""Show table structure in a formatted string.
The structure of this table and optionally its subtables is shown.
It shows the data manager info and column descriptions.
Optionally the ... |
0, module; 1, function_definition; 2, function_name:query; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, expression_statement; 14, if_statement; 15, expression_... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 6, 24; 6, 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; 14, 39; 14, 40; 15, 41; 16, 42; 16, 43; 17, 44; 18, 45; ... | def query(self, query='', name='', sortlist='', columns='',
limit=0, offset=0, style='Python'):
"""Query the table and return the result as a reference table.
This method queries the table. It forms a
`TaQL <../../doc/199.html>`_
command from the given arguments and execut... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sortlist; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, if_statement; 15, if_statement... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 7, 17; 7, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 11, 25; 12, 26; 13, 27; 13, 28; 14, 29; 14, 30; 15, 31; 15, 32; 16, 33; 24, 34; 26, 35; 26, 36; 27, 37; 27, 38; 28, 39; 29, 40; 29, 41; 30, 42; 32, 43; 33, 44;... | def sort(self, sortlist, name='',
limit=0, offset=0, style='Python'):
"""Sort the table and return the result as a reference table.
This method sorts the table. It forms a
`TaQL <../../doc/199.html>`_
command from the given arguments and executes it using the
:func:... |
0, module; 1, function_definition; 2, function_name:describe_pdb; 3, parameters; 4, block; 5, identifier:pdb_id; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, comment:"""Get description and metadata of a PDB entry
Parameters
------... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 8, 13; 9, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 17, 22; 17, 23; 19, 24; 19, 25; 21, 26; 21, 27; 23, 28; 23, 29; 25, 30; 27, 31; 29, 32; 29, 33; 31, 34; 31, 35; 33, 36; 34, 37; 34, 38; 35, 39; 38, 40 | def describe_pdb(pdb_id):
"""Get description and metadata of a PDB entry
Parameters
----------
pdb_id : string
A 4 character string giving a pdb entry of interest
Returns
-------
out : string
A text pdb description from PDB
Examples
--------
>>> describe_pdb(... |
0, module; 1, function_definition; 2, function_name:matrix_index; 3, parameters; 4, block; 5, identifier:user; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
Returns the keys associated with each axis of the matrices.
The first key is always the name of the current user, ... | 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; 17, 19; 18, 20; 18, 21; 19, 22; 19, 23; 19, 24; 23, 25; 23, 26; 24, 27; 26, 28; 26, 29; 27, 30; 27, 31; 28, 32; 28, 33; 31, 34; 31, 35; 32, 36; 32, 37 | def matrix_index(user):
"""
Returns the keys associated with each axis of the matrices.
The first key is always the name of the current user, followed by the
sorted names of all the correspondants.
"""
other_keys = sorted([k for k in user.network.keys() if k != user.name])
return [user.nam... |
0, module; 1, function_definition; 2, function_name:assortativity_indicators; 3, parameters; 4, block; 5, identifier:user; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# Use all indicator except reporting variables and attributes; 11, expression_stateme... | 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; 6, 17; 7, 18; 8, 19; 9, 20; 11, 21; 12, 22; 13, 23; 13, 24; 13, 25; 14, 26; 15, 27; 15, 28; 15, 29; 16, 30; 18, 31; 18, 32; 19, 33; 19, 34; 20, 35; 20, 36; 21, 37; 21, 38; 22, 39; 22, 40; 23, 41; 23, 42; 24, 43; 24, 4... | def assortativity_indicators(user):
"""
Computes the assortativity of indicators.
This indicator measures the similarity of the current user with his
correspondants, for all bandicoot indicators. For each one, it calculates
the variance of the current user's value with the values for all his
co... |
0, module; 1, function_definition; 2, function_name:assortativity_attributes; 3, parameters; 4, block; 5, identifier:user; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, comment... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 7, 15; 8, 16; 9, 17; 10, 18; 10, 19; 10, 20; 11, 21; 12, 22; 12, 23; 12, 24; 13, 25; 15, 26; 15, 27; 16, 28; 16, 29; 17, 30; 17, 31; 18, 32; 18, 33; 19, 34; 19, 35; 20, 36; 20, 37; 20, 38; 21, 39; 21, 40; 23, 41; 23, 42; 24, 43; 24... | def assortativity_attributes(user):
"""
Computes the assortativity of the nominal attributes.
This indicator measures the homophily of the current user with his
correspondants, for each attributes. It returns a value between 0
(no assortativity) and 1 (all the contacts share the same value):
th... |
0, module; 1, function_definition; 2, function_name:merge_close; 3, parameters; 4, block; 5, identifier:events; 6, identifier:min_interval; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, return_statement; 13, identifier:merge_to_longer; 14, False... | 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; 11, 18; 11, 19; 11, 20; 12, 21; 16, 22; 16, 23; 17, 24; 17, 25; 20, 26; 23, 27; 23, 28; 26, 29; 26, 30; 26, 31; 29, 32; 30, 33; 31, 34; 33, 35; 34, 36; 34, 37; 35, 38; 35, 39; 36, 40; 37, 41; 37, 42; 37, 43; 3... | def merge_close(events, min_interval, merge_to_longer=False):
"""Merge events that are separated by a less than a minimum interval.
Parameters
----------
events : list of dict
events with 'start' and 'end' times, from one or several channels.
**Events must be sorted by their start time.... |
0, module; 1, function_definition; 2, function_name:_remove_duplicate; 3, parameters; 4, block; 5, identifier:old_events; 6, identifier:dat; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# more convenient, it copies old_event first and then compares; 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; 7, 19; 8, 20; 9, 21; 10, 22; 12, 23; 13, 24; 14, 25; 14, 26; 15, 27; 16, 28; 17, 29; 17, 30; 17, 31; 18, 32; 20, 33; 20, 34; 21, 35; 21, 36; 22, 37; 22, 38; 23, 39; 23, 40; 24, 41; 24, 42; 25, 43; 25, 44... | def _remove_duplicate(old_events, dat):
"""Remove duplicates from the events.
Parameters
----------
old_events : ndarray (dtype='int')
N x 3 matrix with start, peak, end samples
dat : ndarray (dtype='float')
vector with the data after detection-transformation (to compute peak)
... |
0, module; 1, function_definition; 2, function_name:get_app_list; 3, parameters; 4, block; 5, identifier:site; 6, identifier:request; 7, expression_statement; 8, expression_statement; 9, comment:# Sort the apps alphabetically.; 10, expression_statement; 11, comment:# Sort the models alphabetically within each app.; 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; 7, 14; 8, 15; 10, 16; 12, 17; 12, 18; 12, 19; 13, 20; 15, 21; 15, 22; 16, 23; 16, 24; 19, 25; 22, 26; 22, 27; 24, 28; 24, 29; 25, 30; 27, 31; 27, 32; 29, 33; 29, 34; 30, 35; 30, 36; 33, 37; 33, 38; 34, 39; 34, 40; 35, 41; 35, 42; 36, 43; ... | def get_app_list(site, request):
"""
Returns a sorted list of all the installed apps that have been
registered in this site.
"""
app_dict = _build_app_dict(site, request)
# Sort the apps alphabetically.
app_list = sorted(app_dict.values(), key=lambda x: x['name'].lower())
# Sort the mo... |
0, module; 1, function_definition; 2, function_name:sort_dependencies; 3, parameters; 4, block; 5, identifier:self; 6, identifier:image; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, return_statement; 15, iden... | 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; 10, 21; 11, 22; 12, 23; 12, 24; 12, 25; 13, 26; 14, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 22, 35; 22, 36; 25, 37; 26, 38; 26, 39; 27, 40; 27, 41; 30, 42; 36, 43; 36, ... | def sort_dependencies(self, image, dependencies=None):
"""
Topologically sort the docker commands by their requirements
Note:
Circular "requires" dependencies are assumed to have already been checked in
get_external_base_image, they are not checked here
Args:
... |
0, module; 1, function_definition; 2, function_name:makeOfficialGlyphOrder; 3, parameters; 4, block; 5, identifier:font; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, for_statement; 13, expression_statement; 14, return_statement;... | 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; 10, 21; 11, 22; 11, 23; 12, 24; 12, 25; 12, 26; 13, 27; 14, 28; 18, 29; 18, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 22, 36; 22, 37; 23, 38; 23, 39; 26, 40; 26, 41; 26, 42; 27, 43; 27, 4... | def makeOfficialGlyphOrder(font, glyphOrder=None):
""" Make the final glyph order for 'font'.
If glyphOrder is None, try getting the font.glyphOrder list.
If not explicit glyphOrder is defined, sort glyphs alphabetically.
If ".notdef" glyph is present in the font, force this to always be
the first... |
0, module; 1, function_definition; 2, function_name:sorted; 3, parameters; 4, block; 5, identifier:cls; 6, identifier:items; 7, identifier:orders; 8, expression_statement; 9, return_statement; 10, string; 11, call; 12, string_content:Returns the elements in `items` sorted according to `orders`; 13, identifier:sorted; 1... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 8, 10; 9, 11; 10, 12; 11, 13; 11, 14; 14, 15; 14, 16; 16, 17; 16, 18; 18, 19; 18, 20; 19, 21; 19, 22; 20, 23 | def sorted(cls, items, orders):
'''Returns the elements in `items` sorted according to `orders`'''
return sorted(items, cmp=cls.multipleOrderComparison(orders)) |
0, module; 1, function_definition; 2, function_name:get_unique_fields; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, for_statement; 8, return_statement; 9, comment:"""List field names that are unique_together with `sort_order`."""; 10, identifier:unique_together; 11, attribute; 12, block; 13,... | 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; 11, 14; 11, 15; 12, 16; 14, 17; 14, 18; 16, 19; 16, 20; 19, 21; 19, 22; 20, 23; 20, 24; 20, 25; 21, 26; 23, 27; 24, 28; 25, 29; 27, 30; 27, 31; 28, 32; 28, 33; 29, 34; 29, 35; 31, 36; 31, 37; 32, 38; 32, 39; 33, 40; 34, 41; 34, 42; 35, 43... | def get_unique_fields(self):
"""List field names that are unique_together with `sort_order`."""
for unique_together in self._meta.unique_together:
if 'sort_order' in unique_together:
unique_fields = list(unique_together)
unique_fields.remove('sort_order')
... |
0, module; 1, function_definition; 2, function_name:_is_sort_order_unique_together_with_something; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""
Is the sort_order field unique_together with something
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 6, 10; 7, 11; 8, 12; 8, 13; 8, 14; 9, 15; 11, 16; 11, 17; 14, 18; 17, 19; 17, 20; 18, 21; 18, 22; 19, 23; 19, 24; 21, 25; 21, 26; 22, 27; 25, 28; 25, 29; 26, 30; 26, 31; 27, 32; 28, 33; 30, 34; 30, 35; 35, 36 | def _is_sort_order_unique_together_with_something(self):
"""
Is the sort_order field unique_together with something
"""
unique_together = self._meta.unique_together
for fields in unique_together:
if 'sort_order' in fields and len(fields) > 1:
return Tr... |
0, module; 1, function_definition; 2, function_name:_update; 3, parameters; 4, block; 5, identifier:qs; 6, expression_statement; 7, try_statement; 8, comment:"""
Increment the sort_order in a queryset.
Handle IntegrityErrors caused by unique constraints.
"""; 9, block; 10, except_clause; 11, wi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 7, 10; 9, 11; 10, 12; 10, 13; 11, 14; 11, 15; 13, 16; 14, 17; 15, 18; 16, 19; 16, 20; 16, 21; 17, 22; 18, 23; 20, 24; 20, 25; 21, 26; 22, 27; 22, 28; 23, 29; 23, 30; 24, 31; 24, 32; 25, 33; 26, 34; 27, 35; 27, 36; 29, 37; 29, 38; 30, 39; 33, 40; 34, 41; 34, 42; 39, ... | def _update(qs):
"""
Increment the sort_order in a queryset.
Handle IntegrityErrors caused by unique constraints.
"""
try:
with transaction.atomic():
qs.update(sort_order=models.F('sort_order') + 1)
except IntegrityError:
for obj i... |
0, module; 1, function_definition; 2, function_name:set_orders; 3, parameters; 4, block; 5, identifier:self; 6, identifier:object_pks; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, comment:# Call list() on the values right away, so they don't get affected by the; 11, comment:# update() ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 7, 21; 8, 22; 9, 23; 12, 24; 17, 25; 17, 26; 18, 27; 18, 28; 20, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 26, 40; 27, 41; 28, 42; 28, 43; 31, 44; ... | def set_orders(self, object_pks):
"""
Perform a mass update of sort_orders across the full queryset.
Accepts a list, object_pks, of the intended order for the objects.
Works as follows:
- Compile a list of all sort orders in the queryset. Leave out anything that
isn't ... |
0, module; 1, function_definition; 2, function_name:set_sort_cb; 3, parameters; 4, block; 5, identifier:self; 6, identifier:w; 7, identifier:index; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:"""This callback is invoked when the user selects a new sort order
from the ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 8, 11; 9, 12; 10, 13; 12, 14; 12, 15; 13, 16; 13, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 18, 23; 18, 24; 20, 25; 20, 26; 22, 27; 22, 28 | def set_sort_cb(self, w, index):
"""This callback is invoked when the user selects a new sort order
from the preferences pane."""
name = self.sort_options[index]
self.t_.set(sort_order=name) |
0, module; 1, function_definition; 2, function_name:run; 3, parameters; 4, block; 5, identifier:self; 6, list_splat_pattern; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:args; 13, comment:"""Get and set configuration parameters.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 6, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 10, 18; 10, 19; 11, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 18, 28; 18, 29; 19, 30; 22, 31; 22, 32; 24, 33; 24, 34; 25, 35; 25, 36; 26, 37; 27, 38; 28, 39; 28, 40; 29, 41; 30, 42; 31, 43; ... | def run(self, *args):
"""Get and set configuration parameters.
This command gets or sets parameter values from the user configuration
file. On Linux systems, configuration will be stored in the file
'~/.sortinghat'.
"""
params = self.parser.parse_args(args)
conf... |
0, module; 1, function_definition; 2, function_name:export; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, expression_statement; 13, return_statement; 14, identifier:source; 15... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 8, 17; 9, 18; 10, 19; 10, 20; 10, 21; 11, 22; 12, 23; 13, 24; 17, 25; 17, 26; 18, 27; 18, 28; 21, 29; 21, 30; 21, 31; 21, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 28, 40; 28, 41; 29, 42; 30, 43; 31,... | def export(self, source=None):
"""Export a set of unique identities.
Method to export unique identities from the registry. Identities schema
will follow Sorting Hat JSON format.
When source parameter is given, only those unique identities which have
one or more identities from ... |
0, module; 1, function_definition; 2, function_name:export; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, return_statement; 12, comment:"""Export a set of organizations.
Method to export or... | 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; 17, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 23, 31; 23, 32; 24, 33; 25, 34; 26, 35; 28, 36; 28, 37; 28, 38; 28, 39; 29, 40; 29, 41; 30, 42; 30, 43; 30... | def export(self):
"""Export a set of organizations.
Method to export organizations from the registry. Organizations schema
will follow Sorting Hat JSON format.
:returns: a JSON formatted str
"""
organizations = {}
orgs = api.registry(self.db)
for org i... |
0, module; 1, function_definition; 2, function_name:registry; 3, parameters; 4, block; 5, identifier:db; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, with_statement; 10, return_statement; 11, identifier:term; 12, None; 13, comment:"""List the organizations available in the registry.
T... | 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; 10, 17; 14, 18; 14, 19; 15, 20; 16, 21; 16, 22; 16, 23; 20, 24; 21, 25; 21, 26; 21, 27; 23, 28; 24, 29; 24, 30; 26, 31; 26, 32; 27, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 31, 39; 32, 40; 32, 41; 33, 42; 34, 43; 3... | def registry(db, term=None):
"""List the organizations available in the registry.
The function will return the list of organizations. If term
parameter is set, it will only return the information about
the organizations which match that term. When the given term does
not match with any organization... |
0, module; 1, function_definition; 2, function_name:countries; 3, parameters; 4, block; 5, identifier:db; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, function_definition; 10, if_statement; 11, expression_statement; 12, with_statement; 13, return_statement; 14, identifier:code; 15, None; 16, ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 6, 14; 6, 15; 7, 16; 7, 17; 8, 18; 9, 19; 9, 20; 9, 21; 10, 22; 10, 23; 11, 24; 12, 25; 12, 26; 13, 27; 20, 28; 21, 29; 22, 30; 22, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 26, 37; 26, 38; 26, 39; 29, 40; 30, 41; 30, 42; 31, 43; 32, 44... | def countries(db, code=None, term=None):
"""List the countries available in the registry.
The function will return the list of countries. When either 'code' or
'term' parameters are set, it will only return the information about
those countries that match them.
Take into account that 'code' is a c... |
0, module; 1, function_definition; 2, function_name:enrollments; 3, parameters; 4, block; 5, identifier:db; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, if_statement; 13, if_statement; 14, if_statement; 15, if_statement; 16, expr... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 9, 26; 10, 27; 11, 28; 11, 29; 12, 30; 12, 31; 13, 32; 13, 33; 14, 34; 14, 35; 15, 36; 15, 37; 16, 38; 17, 39; 17, 40; 18, 41; 28, 42; 29, 43; 30, 44; 31,... | def enrollments(db, uuid=None, organization=None, from_date=None, to_date=None):
"""List the enrollment information available in the registry.
This function will return a list of enrollments. If 'uuid'
parameter is set, it will return the enrollments related to that
unique identity; if 'organization' p... |
0, module; 1, function_definition; 2, function_name:blacklist; 3, parameters; 4, block; 5, identifier:db; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, with_statement; 10, return_statement; 11, identifier:term; 12, None; 13, comment:"""List the blacklisted entities available in the registry... | 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; 10, 17; 14, 18; 14, 19; 15, 20; 16, 21; 16, 22; 16, 23; 20, 24; 21, 25; 21, 26; 21, 27; 23, 28; 24, 29; 24, 30; 26, 31; 26, 32; 27, 33; 28, 34; 28, 35; 29, 36; 29, 37; 30, 38; 31, 39; 32, 40; 32, 41; 33, 42; 34, 43; 3... | def blacklist(db, term=None):
"""List the blacklisted entities available in the registry.
The function will return the list of blacklisted entities. If term
parameter is set, it will only return the information about the
entities which match that term. When the given term does not match
with any en... |
0, module; 1, function_definition; 2, function_name:__parse; 3, parameters; 4, block; 5, identifier:self; 6, identifier:stream; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, comment:"""Parse Sorting Hat stream"""; 14,... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 8, 15; 9, 16; 10, 17; 11, 18; 12, 19; 14, 20; 15, 21; 16, 22; 16, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 19, 29; 21, 30; 23, 31; 23, 32; 24, 33; 24, 34; 25, 35; 26, 36; 26, 37; 27, 38; 28, 39; 28, 40; 29, 41; 30, 42; 30, 43; 3... | def __parse(self, stream):
"""Parse Sorting Hat stream"""
if not stream:
raise InvalidFormatError(cause="stream cannot be empty or None")
json = self.__load_json(stream)
self.__parse_organizations(json)
self.__parse_identities(json)
self.__parse_blacklist(j... |
0, module; 1, function_definition; 2, function_name:__parse_blacklist; 3, parameters; 4, block; 5, identifier:self; 6, identifier:json; 7, expression_statement; 8, try_statement; 9, comment:"""Parse blacklist entries using Sorting Hat format.
The Sorting Hat blacklist format is a JSON stream that
store... | 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; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 16, 22; 16, 23; 17, 24; 17, 25; 17, 26; 17, 27; 19, 28; 20, 29; 21, 30; 23, 31; 24, 32; 24, 33; 25, 34; 26, 35; 27, 36; 27, 37; 29, 38; 29, 39; 30, 40; 30, 41; 32, 42; 33, ... | def __parse_blacklist(self, json):
"""Parse blacklist entries using Sorting Hat format.
The Sorting Hat blacklist format is a JSON stream that
stores a list of blacklisted entries.
Next, there is an example of a valid stream:
{
"blacklist": [
"John ... |
0, module; 1, function_definition; 2, function_name:__parse_organizations; 3, parameters; 4, block; 5, identifier:self; 6, identifier:json; 7, expression_statement; 8, try_statement; 9, comment:"""Parse organizations using Sorting Hat format.
The Sorting Hat organizations format is a JSON stream which
... | 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; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 16, 22; 16, 23; 17, 24; 17, 25; 17, 26; 17, 27; 17, 28; 19, 29; 20, 30; 21, 31; 23, 32; 24, 33; 25, 34; 26, 35; 26, 36; 27, 37; 28, 38; 28, 39; 28, 40; 30, 41; 30, 42; 31, ... | def __parse_organizations(self, json):
"""Parse organizations using Sorting Hat format.
The Sorting Hat organizations format is a JSON stream which
its keys are the name of the organizations. Each organization
object has a list of domains. For instance:
{
"organizat... |
0, module; 1, function_definition; 2, function_name:import_blacklist; 3, parameters; 4, block; 5, identifier:self; 6, identifier:parser; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, comment:"""Import blacklist.
... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 14, 21; 14, 22; 15, 23; 15, 24; 16, 25; 16, 26; 19, 27; 20, 28; 20, 29; 22, 30; 22, 31; 23, 32; 23, 33; 24, 34; 27, 35; 27, 36; 27, 37; 28, 38; 28, 39; 29, 40; 35, 41; 35, 42; 35, 43; ... | def import_blacklist(self, parser):
"""Import blacklist.
New entries parsed by 'parser' will be added to the blacklist.
:param parser: sorting hat parser
"""
blacklist = parser.blacklist
self.log("Loading blacklist...")
n = 0
for entry in blacklist:
... |
0, module; 1, function_definition; 2, function_name:import_organizations; 3, parameters; 4, block; 5, identifier:self; 6, identifier:parser; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, identifier:overwrite; 12, False; 13, comment:"""Import organizations.
New d... | 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; 14, 18; 14, 19; 17, 20; 17, 21; 19, 22; 19, 23; 20, 24; 20, 25; 20, 26; 21, 27; 21, 28; 21, 29; 24, 30; 25, 31; 25, 32; 26, 33; 26, 34; 28, 35; 28, 36; 29, 37; 30, 38; 31, 39; 31, 40; 32, 41; 33, 42; 33, 43;... | def import_organizations(self, parser, overwrite=False):
"""Import organizations.
New domains and organizations parsed by 'parser' will be added
to the registry. Remember that a domain can only be assigned to
one organization. If one of the given domains is already on the registry,
... |
0, module; 1, function_definition; 2, function_name:import_identities; 3, parameters; 4, block; 5, identifier:self; 6, identifier:parser; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, expression_statement; 13, expression_statement; 14, if_statement; ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 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; 14, 31; 15, 32; 16, 33; 16, 34; 17, 35; 29, 36; 29, 37; 31, 38; 31, 39; 32, 40; 32, 41; 33, 42; 34, 43; 34, 44; ... | def import_identities(self, parser, matching=None, match_new=False,
no_strict_matching=False,
reset=False, verbose=False):
"""Import identities information on the registry.
New unique identities, organizations and enrollment data parsed
by 'pa... |
0, module; 1, function_definition; 2, function_name:initialize; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, if_statement; 14, try_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; 7, 16; 7, 17; 8, 18; 9, 19; 10, 20; 11, 21; 12, 22; 13, 23; 13, 24; 14, 25; 14, 26; 14, 27; 14, 28; 15, 29; 19, 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; 25, ... | def initialize(self, name, reuse=False):
"""Create an empty Sorting Hat registry.
This method creates a new database including the schema of Sorting Hat.
Any attempt to create a new registry over an existing instance will
produce an error, except if reuse=True. In that case, the
... |
0, module; 1, function_definition; 2, function_name:uuid; 3, parameters; 4, block; 5, identifier:source; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, expression_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; 10, 25; 11, 26; 11, 27; 12, 28; 12, 29; 13, 30; 14, 31; 15, 32; 16, 33; 24, 34; 24, 35; 25, 36; 26, 37; 26, 38; 27, 39; 28, 40; 29, 41; 30, 42; 30, 43; 31, 44; ... | def uuid(source, email=None, name=None, username=None):
"""Get the UUID related to the identity data.
Based on the input data, the function will return the UUID associated
to an identity. On this version, the UUID will be the SHA1 of
"source:email:name:username" string. This string is case insensitive,... |
0, module; 1, function_definition; 2, function_name:check; 3, parameters; 4, block; 5, identifier:labels; 6, expression_statement; 7, comment:# type checking; 8, if_statement; 9, if_statement; 10, if_statement; 11, comment:# dimension checking; 12, expression_statement; 13, if_statement; 14, if_statement; 15, if_statem... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 6, 18; 8, 19; 8, 20; 9, 21; 9, 22; 10, 23; 10, 24; 12, 25; 13, 26; 13, 27; 14, 28; 14, 29; 15, 30; 15, 31; 17, 32; 17, 33; 17, 34; 19, 35; 20, 36; 21, 37; 22, 38; 23, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, 44;... | def check(labels):
"""Raise IOError if labels are not correct
`labels` must be a list of sorted numpy arrays of equal
dimensions (must be 1D or 2D). In the case of 2D labels,
the second axis must have the same shape for all labels.
"""
# type checking
... |
0, module; 1, function_definition; 2, function_name:to_items; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, return_statement; 9, identifier:func; 10, identifier:str; 11, comment:"""
Contruct a list of dictionary items.
The items are normalized using:
... | 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; 13, 15; 13, 16; 14, 17; 14, 18; 16, 19; 16, 20; 18, 21; 18, 22; 20, 23; 22, 24; 23, 25; 23, 26; 24, 27; 24, 28; 25, 29; 25, 30; 27, 31; 27, 32; 31, 33; 31, 34 | def to_items(self, func=str):
"""
Contruct a list of dictionary items.
The items are normalized using:
- A sort function by key (for consistent results)
- A transformation function for values
The transformation function will default to `str`, which is a good choic... |
0, module; 1, function_definition; 2, function_name:SortBy; 3, parameters; 4, block; 5, list_splat_pattern; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, identifier:qs; 11, comment:"""Convert a list of Q objects into list of sort instructions"""; 12, assignment; 13, identi... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 5, 10; 6, 11; 7, 12; 8, 13; 8, 14; 8, 15; 9, 16; 12, 17; 12, 18; 15, 19; 19, 20; 19, 21; 19, 22; 20, 23; 20, 24; 21, 25; 22, 26; 23, 27; 23, 28; 24, 29; 25, 30; 26, 31; 27, 32; 27, 33; 29, 34; 30, 35; 30, 36; 31, 37; 35, 38; 35, 39; 36, 40; 37, 41; 37, 42; 40, 43; 4... | def SortBy(*qs):
"""Convert a list of Q objects into list of sort instructions"""
sort = []
for q in qs:
if q._path.endswith('.desc'):
sort.append((q._path[:-5], DESCENDING))
else:
sort.append((q._path, ASCENDING))
return sort |
0, module; 1, function_definition; 2, function_name:toposorted; 3, parameters; 4, block; 5, identifier:nodes; 6, identifier:edges; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, expression_statement; 12, expression_statement; 13, while_statement; 14, return_statement; ... | 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; 10, 19; 10, 20; 11, 21; 12, 22; 13, 23; 13, 24; 14, 25; 16, 26; 16, 27; 17, 28; 17, 29; 20, 30; 20, 31; 21, 32; 21, 33; 22, 34; 22, 35; 24, 36; 24, 37; 24, 38; 24, 39; 27, 40; 27, 41; 29, 42; 29, 43; 30... | def toposorted(nodes, edges):
"""
Perform a topological sort on the input resources.
The topological sort uses Kahn's algorithm, which is a stable sort and will preserve this
ordering; note that a DFS will produce a worst case ordering from the perspective of batching.
"""
incoming = defaultdi... |
0, module; 1, function_definition; 2, function_name:sorted_keywords_by_order; 3, parameters; 4, block; 5, identifier:keywords; 6, identifier:order; 7, expression_statement; 8, comment:# we need to delete item with no value; 9, for_statement; 10, expression_statement; 11, for_statement; 12, for_statement; 13, return_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; 7, 14; 9, 15; 9, 16; 9, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 12, 23; 12, 24; 13, 25; 15, 26; 15, 27; 16, 28; 16, 29; 17, 30; 18, 31; 18, 32; 21, 33; 24, 34; 29, 35; 30, 36; 30, 37; 32, 38; 32, 39; 33, 40; 33, 41; 34, 42; 34, 43; 35... | def sorted_keywords_by_order(keywords, order):
"""Sort keywords based on defined order.
:param keywords: Keyword to be sorted.
:type keywords: dict
:param order: Ordered list of key.
:type order: list
:return: Ordered dictionary based on order list.
:rtype: OrderedDict
"""
# we n... |
0, module; 1, function_definition; 2, function_name:get_layer_modes; 3, parameters; 4, block; 5, identifier:subcategory; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""Return all sorted layer modes from exposure or hazard.
:param subcategory: Hazard or Exposure key.
:type ... | 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; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 19, 23; 19, 24; 21, 25; 24, 26; 24, 27; 26, 28; 27, 29; 27, 30; 30, 31 | def get_layer_modes(subcategory):
"""Return all sorted layer modes from exposure or hazard.
:param subcategory: Hazard or Exposure key.
:type subcategory: str
:returns: List of layer modes definition.
:rtype: list
"""
layer_modes = definition(subcategory)['layer_modes']
return sorted(l... |
0, module; 1, function_definition; 2, function_name:add_ordered_combo_item; 3, parameters; 4, block; 5, identifier:combo; 6, identifier:text; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, for_statement; 14, comment:# otherwise... | 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; 11, 24; 12, 25; 13, 26; 13, 27; 13, 28; 15, 29; 15, 30; 15, 31; 23, 32; 23, 33; 24, 34; 25, 35; 25, 36; 27, 37; 27, 38; 28, 39; 28, 40; 28, 41; 30, 42; 31, 43; 34, 44... | def add_ordered_combo_item(
combo, text, data=None, count_selected_features=None, icon=None):
"""Add a combo item ensuring that all items are listed alphabetically.
Although QComboBox allows you to set an InsertAlphabetically enum
this only has effect when a user interactively adds combo items to
... |
0, module; 1, function_definition; 2, function_name:sort; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:"""Sort list elements by ID."""; 9, call; 10, attribute; 11, argument_list; 12, call; 13, identifier:sort; 14, keyword_argument; 15, identifier:super; 16, a... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 16, 19; 16, 20; 18, 21; 18, 22; 21, 23; 22, 24; 22, 25 | def sort(self):
"""Sort list elements by ID."""
super(JSSObjectList, self).sort(key=lambda k: k.id) |
0, module; 1, function_definition; 2, function_name:sort_by_name; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, comment:"""Sort list elements by name."""; 9, call; 10, attribute; 11, argument_list; 12, call; 13, identifier:sort; 14, keyword_argument; 15, identifier:su... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 6, 8; 7, 9; 9, 10; 9, 11; 10, 12; 10, 13; 11, 14; 12, 15; 12, 16; 14, 17; 14, 18; 16, 19; 16, 20; 18, 21; 18, 22; 21, 23; 22, 24; 22, 25 | def sort_by_name(self):
"""Sort list elements by name."""
super(JSSObjectList, self).sort(key=lambda k: k.name) |
0, module; 1, function_definition; 2, function_name:find_sorted_task_dependencies; 3, parameters; 4, block; 5, identifier:task; 6, identifier:task_name; 7, identifier:task_id; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_s... | 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; 8, 22; 9, 23; 10, 24; 11, 25; 12, 26; 13, 27; 14, 28; 15, 29; 18, 30; 19, 31; 20, 32; 21, 33; 23, 34; 23, 35; 24, 36; 24, 37; 25, 38; 25, 39; 26, 40; 26, 41; 27, 42; 27, 43; 28, 44; ... | def find_sorted_task_dependencies(task, task_name, task_id):
"""Find the taskIds of the chain of trust dependencies of a given task.
Args:
task (dict): the task definition to inspect.
task_name (str): the name of the task, for logging and naming children.
task_id (str): the taskId of th... |
0, module; 1, function_definition; 2, function_name:get_all_artifacts_per_task_id; 3, parameters; 4, block; 5, identifier:chain; 6, identifier:upstream_artifacts; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, if_statement; 11, comment:# Avoid duplicate paths per task_id; 12, for_statement; 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; 7, 14; 8, 15; 9, 16; 9, 17; 9, 18; 9, 19; 10, 20; 10, 21; 12, 22; 12, 23; 12, 24; 13, 25; 15, 26; 15, 27; 17, 28; 17, 29; 19, 30; 19, 31; 19, 32; 21, 33; 22, 34; 22, 35; 23, 36; 23, 37; 24, 38; 30, 39; 30, 40; 32, 41; 32, 42; 33, 43; 33, ... | def get_all_artifacts_per_task_id(chain, upstream_artifacts):
"""Return every artifact to download, including the Chain Of Trust Artifacts.
Args:
chain (ChainOfTrust): the chain of trust object
upstream_artifacts: the list of upstream artifact definitions
Returns:
dict: sorted list... |
0, module; 1, function_definition; 2, function_name:get_upstream_artifacts_full_paths_per_task_id; 3, parameters; 4, block; 5, identifier:context; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_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; 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; 20, 34; 20, 35; 22, 36; 23, 37; 23, 38; 25, 39; 25, 40; 27, 41; 27, 42; 29, 43; 29... | def get_upstream_artifacts_full_paths_per_task_id(context):
"""List the downloaded upstream artifacts.
Args:
context (scriptworker.context.Context): the scriptworker context.
Returns:
dict, dict: lists of the paths to upstream artifacts, sorted by task_id.
First dict represents... |
0, module; 1, function_definition; 2, function_name:_PreparedData; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, if_statement; 11, for_statement; 12, return_statement; 13, identifier:order_by; 14, tuple; 15, comment:"""Prepares ... | 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; 10, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 16, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 20, 31; 22, 32; 22, 33; 23, 34; 26, 35; 28, 36; 28, 37; 29, 38; 29, 39; 30, 40; 31, 41; 33, 42; 34, 43; 34,... | def _PreparedData(self, order_by=()):
"""Prepares the data for enumeration - sorting it by order_by.
Args:
order_by: Optional. Specifies the name of the column(s) to sort by, and
(optionally) which direction to sort in. Default sort direction
is asc. Following formats are ... |
0, module; 1, function_definition; 2, function_name:ToJSCode; 3, parameters; 4, block; 5, identifier:self; 6, identifier:name; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, comment:# We first create the table with the given... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 10, 27; 11, 28; 11, 29; 12, 30; 14, 31; 15, 32; 15, 33; 17, 34; 17, 35; 17, 36; 18, 37; 20, 38; 20, 39; 20, 40; 20, 41; 21, 42; 27, 43; 27, 44; 28,... | def ToJSCode(self, name, columns_order=None, order_by=()):
"""Writes the data table as a JS code string.
This method writes a string of JS code that can be run to
generate a DataTable with the specified data. Typically used for debugging
only.
Args:
name: The name of the table. The name woul... |
0, module; 1, function_definition; 2, function_name:ToHtml; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, expression_statement; 14, expression_st... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 6, 25; 6, 26; 7, 27; 7, 28; 8, 29; 9, 30; 10, 31; 11, 32; 12, 33; 13, 34; 14, 35; 15, 36; 15, 37; 16, 38; 17, 39; 18, 40; 18, 41; 18, 42; 19, 43; 20, 44; 22, 45;... | def ToHtml(self, columns_order=None, order_by=()):
"""Writes the data table as an HTML table code string.
Args:
columns_order: Optional. Specifies the order of columns in the
output table. Specify a list of all column IDs in the order
in which you want the table ... |
0, module; 1, function_definition; 2, function_name:ToCsv; 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, if_statement; 13, expression_statement; 14, function_definition; 15, ... | 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; 6, 19; 6, 20; 7, 21; 7, 22; 8, 23; 8, 24; 9, 25; 10, 26; 11, 27; 12, 28; 12, 29; 13, 30; 14, 31; 14, 32; 14, 33; 15, 34; 17, 35; 17, 36; 17, 37; 18, 38; 26, 39; 26, 40; 27, 41; 27, 42; 28, 43; 28, 44; 29... | def ToCsv(self, columns_order=None, order_by=(), separator=","):
"""Writes the data table as a CSV string.
Output is encoded in UTF-8 because the Python "csv" module can't handle
Unicode properly according to its documentation.
Args:
columns_order: Optional. Specifies the order of columns in the... |
0, module; 1, function_definition; 2, function_name:_ToJSonObj; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, expression_statement; 11, comment:# Creating the column JSON objects; 12, expression_statement; 13, for_statement; 14, co... | 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; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 9, 25; 9, 26; 10, 27; 12, 28; 13, 29; 13, 30; 13, 31; 15, 32; 16, 33; 16, 34; 16, 35; 17, 36; 18, 37; 18, 38; 19, 39; 25, 40; 25, 41; 26, 42; 27, 43; 27, 44; 28,... | def _ToJSonObj(self, columns_order=None, order_by=()):
"""Returns an object suitable to be converted to JSON.
Args:
columns_order: Optional. A list of all column IDs in the order in which
you want them created in the output table. If specified,
all column IDs mus... |
0, module; 1, function_definition; 2, function_name:ToJSon; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, return_statement; 12, identifier:columns_order; 13, None; 14, identifier:order_by; 15, tuple; 16, c... | 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; 11, 20; 17, 21; 17, 22; 18, 23; 19, 24; 22, 25; 22, 26; 23, 27; 23, 28; 24, 29; 25, 30; 25, 31; 26, 32; 28, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 35, 41; 35, 42; 36, 43; 39... | def ToJSon(self, columns_order=None, order_by=()):
"""Returns a string that can be used in a JS DataTable constructor.
This method writes a JSON string that can be passed directly into a Google
Visualization API DataTable constructor. Use this output if you are
hosting the visualization HTML on your si... |
0, module; 1, function_definition; 2, function_name:_radix_sort; 3, parameters; 4, block; 5, identifier:L; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, return_statement; 14, identifier:i; 15, integer:0... | 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; 6, 14; 6, 15; 7, 16; 8, 17; 8, 18; 9, 19; 10, 20; 11, 21; 11, 22; 11, 23; 12, 24; 13, 25; 17, 26; 17, 27; 18, 28; 19, 29; 19, 30; 20, 31; 20, 32; 23, 33; 24, 34; 24, 35; 25, 36; 25, 37; 26, 38; 26, 39; 28, 40; 32, 41; 32, 42; 33, 43; 33, ... | def _radix_sort(L, i=0):
"""
Most significant char radix sort
"""
if len(L) <= 1:
return L
done_bucket = []
buckets = [ [] for x in range(255) ]
for s in L:
if i >= len(s):
done_bucket.append(s)
else:
buckets[ ord(s[i]) ].append(s)
buckets = [ _radix_sort(b, i + 1) for b in buck... |
0, module; 1, function_definition; 2, function_name:fixed_legend_filter_sort; 3, parameters; 4, block; 5, identifier:self; 6, identifier:fixed_legend_filter_sort; 7, expression_statement; 8, expression_statement; 9, comment:# noqa: E501; 10, if_statement; 11, expression_statement; 12, comment:"""Sets the fixed_legend_f... | 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; 10, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 16, 22; 16, 23; 18, 24; 18, 25; 21, 26; 22, 27; 22, 28; 26, 29; 26, 30; 30, 31; 31, 32; 31, 33; 32, 34; 32, 35; 32, 36; 33, 37; 33, 38 | def fixed_legend_filter_sort(self, fixed_legend_filter_sort):
"""Sets the fixed_legend_filter_sort of this ChartSettings.
Whether to display \"Top\"- or \"Bottom\"-ranked series in the fixed legend # noqa: E501
:param fixed_legend_filter_sort: The fixed_legend_filter_sort of this ChartSetting... |
0, module; 1, function_definition; 2, function_name:print_table; 3, parameters; 4, block; 5, identifier:title; 6, identifier:headers; 7, identifier:rows; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, expression_statement; 14, identifier:sort_columns; 15... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 8, 14; 8, 15; 9, 16; 10, 17; 10, 18; 11, 19; 11, 20; 11, 21; 12, 22; 13, 23; 17, 24; 17, 25; 18, 26; 20, 27; 21, 28; 22, 29; 22, 30; 23, 31; 23, 32; 26, 33; 26, 34; 26, 35; 26, 36; 27, 37; 28, 38; 30, 39; 32, 40; 33, 41; 33, 42; 34, 43; 3... | def print_table(title, headers, rows, sort_columns=None):
"""
Print a table of rows with headers using tabulate.
Parameters:
title (:term: string):
String that will be output before the Table.
headers (list or tuple):
List of strings that defines the header for each ... |
0, module; 1, function_definition; 2, function_name:formatted; 3, parameters; 4, comment:# pylint: disable=line-too-long; 5, block; 6, identifier:self; 7, expression_statement; 8, comment:# noqa: E501; 9, comment:# pylint: enable=line-too-long; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comme... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 5, 7; 5, 8; 5, 9; 5, 10; 5, 11; 5, 12; 7, 13; 10, 14; 11, 15; 11, 16; 11, 17; 12, 18; 14, 19; 14, 20; 15, 21; 15, 22; 16, 23; 16, 24; 16, 25; 16, 26; 16, 27; 16, 28; 16, 29; 17, 30; 18, 31; 18, 32; 23, 33; 25, 34; 26, 35; 26, 36; 26, 37; 26, 38; 26, 39; 28, 40; 28, 41; 28, 42; 29, 43... | def formatted(self):
# pylint: disable=line-too-long
"""
Return a human readable string with the statistics for this container.
The operations are sorted by decreasing average time.
The three columns for `ServerTime` are included only if the WBEM server
has returned WBEM... |
0, module; 1, function_definition; 2, function_name:get_clusters; 3, parameters; 4, block; 5, identifier:self; 6, identifier:platform; 7, identifier:retry_contexts; 8, identifier:all_clusters; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, while_statement; 13, expression_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; 4, 14; 4, 15; 9, 16; 10, 17; 11, 18; 12, 19; 12, 20; 13, 21; 14, 22; 15, 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; 22, 36; 22, 37; 28, 38; 28, 39; 30, 40; 31, 41; 32, 42; 32, 43; 3... | def get_clusters(self, platform, retry_contexts, all_clusters):
''' return clusters sorted by load. '''
possible_cluster_info = {}
candidates = set(copy.copy(all_clusters))
while candidates and not possible_cluster_info:
wait_for_any_cluster(retry_contexts)
for ... |
0, module; 1, function_definition; 2, function_name:get_profile_names_and_default; 3, parameters; 4, type; 5, block; 6, parenthesized_expression; 7, expression_statement; 8, with_statement; 9, subscript; 10, comment:"""Return the list of profile names and the default profile object.
The list of names is sorted.
... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 4, 6; 5, 7; 5, 8; 6, 9; 7, 10; 8, 11; 8, 12; 9, 13; 9, 14; 9, 15; 11, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 17, 25; 20, 26; 20, 27; 22, 28; 22, 29; 24, 30; 24, 31; 25, 32; 25, 33; 30, 34; 30, 35; 31, 36; 32, 37; 32, 38; 33, 39; 33, 40; 34, 41; 34, 42; 38, 43 | def get_profile_names_and_default() -> (
typing.Tuple[typing.Sequence[str], typing.Optional[Profile]]):
"""Return the list of profile names and the default profile object.
The list of names is sorted.
"""
with ProfileStore.open() as config:
return sorted(config), config.default |
0, module; 1, function_definition; 2, function_name:print_all_commands; 3, parameters; 4, block; 5, identifier:self; 6, keyword_separator; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, expression_statement; 13, for_statement; 14, if_state... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 7, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 12, 21; 13, 22; 13, 23; 13, 24; 14, 25; 14, 26; 14, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 21, 35; 24, 36; 24, 37; 24, 38; 24, 39; 24, 40; 26, 41; 27, 42; 29, 43; 29,... | def print_all_commands(self, *, no_pager=False):
"""Print help for all commands.
Commands are sorted in alphabetical order and wrapping is done
based on the width of the terminal.
"""
formatter = self.parent_parser._get_formatter()
command_names = sorted(self.parent_pars... |
0, module; 1, function_definition; 2, function_name:rank_dated_files; 3, parameters; 4, block; 5, identifier:pattern; 6, identifier:dir; 7, default_parameter; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:descending; 12, True; 13, comment:"""Search a directory for files that mat... | 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; 19, 22; 19, 23; 20, 24; 20, 25; 21, 26; 23, 27; 23, 28; 26, 29; 26, 30; 29, 31; 29, 32; 30, 33; 30, 34 | def rank_dated_files(pattern, dir, descending=True):
"""Search a directory for files that match a pattern. Return an ordered list of these files by filename.
Args:
pattern: The glob pattern to search for.
dir: Path to directory where the files will be searched for.
descending: Default T... |
0, module; 1, function_definition; 2, function_name:best_structures; 3, parameters; 4, block; 5, identifier:uniprot_id; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, comment:# if output dir is specified b... | 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; 6, 22; 6, 23; 7, 24; 7, 25; 8, 26; 8, 27; 9, 28; 9, 29; 10, 30; 11, 31; 12, 32; 12, 33; 14, 34; 14, 35; 15, 36; 15, 37; 17, 38; 17, 39; 17, 40; 17, 41; 18, 42; 20, 43; 20, 44; 21, 45... | def best_structures(uniprot_id, outname=None, outdir=None, seq_ident_cutoff=0.0, force_rerun=False):
"""Use the PDBe REST service to query for the best PDB structures for a UniProt ID.
More information found here: https://www.ebi.ac.uk/pdbe/api/doc/sifts.html
Link used to retrieve results: https://www.ebi.... |
0, module; 1, function_definition; 2, function_name:map_uniprot_to_pdb; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, comment:# Check if a UniProt ID is attached to the representative sequence; 12, expression... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 4, 18; 4, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 9, 26; 10, 27; 10, 28; 12, 29; 13, 30; 13, 31; 14, 32; 14, 33; 15, 34; 15, 35; 16, 36; 17, 37; 18, 38; 18, 39; 18, 40; 19, 41; 27, 42; 28, 43; 28, 44; 29,... | def map_uniprot_to_pdb(self, seq_ident_cutoff=0.0, outdir=None, force_rerun=False):
"""Map the representative sequence's UniProt ID to PDB IDs using the PDBe "Best Structures" API.
Will save a JSON file of the results to the protein sequences folder.
The "Best structures" API is available at ht... |
0, module; 1, function_definition; 2, function_name:map_uniprot_to_pdb; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, comment:# First get all UniProt IDs and check if they have PDBs; 11, expression_statement; 12, 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; 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; 12, 29; 12, 30; 13, 31; 14, 32; 15, 33; 17, 34; 17, 35; 17, 36; 18, 37; 19, 38; 27, 39; 27, 40; 29, 41; 29, 42; 30, 43; 30, 44; 31,... | def map_uniprot_to_pdb(self, seq_ident_cutoff=0.0, outdir=None, force_rerun=False):
"""Map all representative sequences' UniProt ID to PDB IDs using the PDBe "Best Structures" API.
Will save a JSON file of the results to each protein's ``sequences`` folder.
The "Best structures" API is availabl... |
0, module; 1, function_definition; 2, function_name:get_properties_by_type; 3, parameters; 4, block; 5, identifier:self; 6, identifier:type; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, if_statement; 11, if_statement; 12, expression_statement; 13, for_statement; 14, return_statement; 15, ide... | 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; 11, 22; 11, 23; 12, 24; 13, 25; 13, 26; 13, 27; 14, 28; 21, 29; 22, 30; 22, 31; 23, 32; 24, 33; 24, 34; 26, 35; 26, 36; 27, 37; 27, 38; 27, 39; 28, 40; 28, 41; 29, 42; 31, 43; 31, ... | def get_properties_by_type(self, type, recursive=True, parent_path=""):
"""
Returns a sorted list of fields that match the type.
:param type the type of the field "string","integer" or a list of types
:param recursive recurse to sub object
:returns a sorted list of fields the ma... |
0, module; 1, function_definition; 2, function_name:insert; 3, parameters; 4, block; 5, identifier:self; 6, identifier:index; 7, identifier:key; 8, identifier:value; 9, expression_statement; 10, if_statement; 11, expression_statement; 12, expression_statement; 13, comment:"""Inserts the key, value pair before the item ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, 9; 4, 10; 4, 11; 4, 12; 9, 13; 10, 14; 10, 15; 11, 16; 12, 17; 14, 18; 14, 19; 15, 20; 15, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 19, 27; 19, 28; 20, 29; 21, 30; 22, 31; 22, 32; 23, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 29, 41; 29, 42; 30, 43... | def insert(self, index, key, value):
"""Inserts the key, value pair before the item with the given index."""
if key in self.keyOrder:
n = self.keyOrder.index(key)
del self.keyOrder[n]
if n < index:
index -= 1
self.keyOrder.insert(index, key)
... |
0, module; 1, function_definition; 2, function_name:sort_qualified_edges; 3, parameters; 4, type; 5, block; 6, identifier:graph; 7, generic_type; 8, expression_statement; 9, expression_statement; 10, return_statement; 11, identifier:Iterable; 12, type_parameter; 13, comment:"""Return the qualified edges, sorted first b... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 5, 10; 7, 11; 7, 12; 8, 13; 9, 14; 10, 15; 12, 16; 14, 17; 14, 18; 15, 19; 15, 20; 16, 21; 18, 22; 18, 23; 18, 24; 20, 25; 20, 26; 22, 27; 22, 28; 22, 29; 22, 30; 23, 31; 23, 32; 24, 33; 26, 34; 26, 35; 31, 36; 31, 37; 31, 38; 31, 39; 32, 40; 32, 41; 33, 42; 33, 43;... | def sort_qualified_edges(graph) -> Iterable[EdgeTuple]:
"""Return the qualified edges, sorted first by citation, then by evidence, then by annotations.
:param BELGraph graph: A BEL graph
"""
qualified_edges = (
(u, v, k, d)
for u, v, k, d in graph.edges(keys=True, data=True)
if ... |
0, module; 1, function_definition; 2, function_name:_citation_sort_key; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, identifier:str; 8, expression_statement; 9, return_statement; 10, identifier:t; 11, type; 12, comment:"""Make a confusing 4 tuple sortable by citation."""; 13, call; 14, identifier:EdgeTuple;... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 6, 10; 6, 11; 8, 12; 9, 13; 11, 14; 13, 15; 13, 16; 15, 17; 15, 18; 16, 19; 16, 20; 19, 21; 19, 22; 20, 23; 20, 24; 21, 25; 21, 26; 23, 27; 23, 28; 25, 29; 25, 30; 27, 31; 27, 32 | def _citation_sort_key(t: EdgeTuple) -> str:
"""Make a confusing 4 tuple sortable by citation."""
return '"{}", "{}"'.format(t[3][CITATION][CITATION_TYPE], t[3][CITATION][CITATION_REFERENCE]) |
0, module; 1, function_definition; 2, function_name:clean_pubmed_identifiers; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, generic_type; 8, expression_statement; 9, return_statement; 10, identifier:pmids; 11, type; 12, identifier:List; 13, type_parameter; 14, comment:"""Clean a list of PubMed identifiers wi... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 6, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 11, 16; 13, 17; 15, 18; 15, 19; 16, 20; 16, 21; 17, 22; 19, 23; 21, 24; 23, 25; 23, 26; 24, 27; 25, 28; 25, 29; 26, 30; 26, 31; 28, 32; 28, 33; 32, 34; 32, 35; 35, 36 | def clean_pubmed_identifiers(pmids: Iterable[str]) -> List[str]:
"""Clean a list of PubMed identifiers with string strips, deduplicates, and sorting."""
return sorted({str(pmid).strip() for pmid in pmids}) |
0, module; 1, function_definition; 2, function_name:hash_dump; 3, parameters; 4, type; 5, block; 6, identifier:data; 7, identifier:str; 8, expression_statement; 9, return_statement; 10, comment:"""Hash an arbitrary JSON dictionary by dumping it in sorted order, encoding it in UTF-8, then hashing the bytes.
:param ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 4, 7; 5, 8; 5, 9; 8, 10; 9, 11; 11, 12; 11, 13; 12, 14; 12, 15; 14, 16; 14, 17; 16, 18; 16, 19; 17, 20; 20, 21; 20, 22; 21, 23; 21, 24; 22, 25; 23, 26; 23, 27; 25, 28; 26, 29; 26, 30; 27, 31; 27, 32; 32, 33; 32, 34 | def hash_dump(data) -> str:
"""Hash an arbitrary JSON dictionary by dumping it in sorted order, encoding it in UTF-8, then hashing the bytes.
:param data: An arbitrary JSON-serializable object
:type data: dict or list or tuple
"""
return hashlib.sha512(json.dumps(data, sort_keys=True).encode('utf-8... |
0, module; 1, function_definition; 2, function_name:yield_sorted_by_type; 3, parameters; 4, block; 5, list_splat_pattern; 6, expression_statement; 7, function_definition; 8, return_statement; 9, identifier:typelist; 10, comment:"""
a useful decorator for the collect_impl method of SuperChange
subclasses. Caches... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 5, 9; 6, 10; 7, 11; 7, 12; 7, 13; 8, 14; 12, 15; 13, 16; 13, 17; 16, 18; 16, 19; 17, 20; 18, 21; 19, 22; 19, 23; 19, 24; 21, 25; 21, 26; 23, 27; 23, 28; 24, 29; 26, 30; 27, 31; 28, 32; 29, 33; 33, 34; 33, 35; 35, 36; 35, 37; 36, 38; 36, 39; 39, 40; 39, 41; 40, 42; 41, 43 | def yield_sorted_by_type(*typelist):
"""
a useful decorator for the collect_impl method of SuperChange
subclasses. Caches the yielded changes, and re-emits them
collected by their type. The order of the types can be specified
by listing the types as arguments to this decorator. Unlisted
types wi... |
0, module; 1, function_definition; 2, function_name:build_route_timetable; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, typed_parameter; 9, identifier:DataFrame; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 4, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 5, 18; 5, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 10, 26; 11, 27; 12, 28; 12, 29; 13, 30; 14, 31; 15, 32; 16, 33; 17, 34; 17, 35; 17, 36; 17, 37; 18, 38; 19, 39; 21, 40; 23, 41; 25, 42; 27, 43; 27, 44; 28... | def build_route_timetable(
feed: "Feed", route_id: str, dates: List[str]
) -> DataFrame:
"""
Return a timetable for the given route and dates.
Parameters
----------
feed : Feed
route_id : string
ID of a route in ``feed.routes``
dates : string or list
A YYYYMMDD date stri... |
0, module; 1, function_definition; 2, function_name:almost_equal; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, identifier:bool; 9, expression_statement; 10, if_statement; 11, identifier:f; 12, type; 13, identifier:g; 14, type; 15, comment:"""
Return ``True`` if and only if the given ... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 4, 8; 5, 9; 5, 10; 6, 11; 6, 12; 7, 13; 7, 14; 9, 15; 10, 16; 10, 17; 10, 18; 12, 19; 14, 20; 16, 21; 16, 22; 17, 23; 18, 24; 18, 25; 21, 26; 21, 27; 22, 28; 22, 29; 23, 30; 25, 31; 25, 32; 25, 33; 30, 34; 30, 35; 31, 36; 32, 37; 33, 38; 34, 39; 34, 40; 35, 41; 36, 42; 36, 43; ... | def almost_equal(f: DataFrame, g: DataFrame) -> bool:
"""
Return ``True`` if and only if the given DataFrames are equal after
sorting their columns names, sorting their values, and
reseting their indices.
"""
if f.empty or g.empty:
return f.equals(g)
else:
# Put in canonical ... |
0, module; 1, function_definition; 2, function_name:build_stop_timetable; 3, parameters; 4, type; 5, block; 6, typed_parameter; 7, typed_parameter; 8, typed_parameter; 9, identifier:DataFrame; 10, expression_statement; 11, expression_statement; 12, if_statement; 13, expression_statement; 14, expression_statement; 15, e... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 4, 9; 5, 10; 5, 11; 5, 12; 5, 13; 5, 14; 5, 15; 5, 16; 5, 17; 5, 18; 5, 19; 6, 20; 6, 21; 7, 22; 7, 23; 8, 24; 8, 25; 10, 26; 11, 27; 12, 28; 12, 29; 13, 30; 14, 31; 15, 32; 16, 33; 17, 34; 17, 35; 17, 36; 17, 37; 18, 38; 19, 39; 21, 40; 23, 41; 25, 42; 27, 43; 27, 44; 28... | def build_stop_timetable(
feed: "Feed", stop_id: str, dates: List[str]
) -> DataFrame:
"""
Return a DataFrame containing the timetable for the given stop ID
and dates.
Parameters
----------
feed : Feed
stop_id : string
ID of the stop for which to build the timetable
dates : ... |
0, module; 1, function_definition; 2, function_name:get_unit_property_names; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, if_statement; 9, if_statement; 10, identifier:unit_id; 11, None; 12, string; 13, comparison_operator:unit_id is None; 14, block; 15, call; 16, block... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 6, 10; 6, 11; 7, 12; 8, 13; 8, 14; 9, 15; 9, 16; 9, 17; 12, 18; 13, 19; 13, 20; 14, 21; 14, 22; 14, 23; 14, 24; 15, 25; 15, 26; 16, 27; 17, 28; 21, 29; 22, 30; 22, 31; 22, 32; 23, 33; 24, 34; 26, 35; 26, 36; 27, 37; 27, 38; 27, 39; 28, 40; 29, 41; 29, 42; 31, 43; 31... | def get_unit_property_names(self, unit_id=None):
'''Get a list of property names for a given unit, or for all units if unit_id is None
Parameters
----------
unit_id: int
The unit id for which the property names will be returned
If None (default), will return prop... |
0, module; 1, function_definition; 2, function_name:copy_unit_properties; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sorting; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, identifier:unit_ids; 12, None; 13, string; 14, comparison_operator:unit_ids is None; 15, blo... | 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; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 22, 28; 24, 29; 24, 30; 25, 31; 26, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 31, 38; 31, 39; 34, 40; 34, 41; 35, 42; 35, 43; ... | def copy_unit_properties(self, sorting, unit_ids=None):
'''Copy unit properties from another sorting extractor to the current
sorting extractor.
Parameters
----------
sorting: SortingExtractor
The sorting extractor from which the properties will be copied
uni... |
0, module; 1, function_definition; 2, function_name:copy_unit_spike_features; 3, parameters; 4, block; 5, identifier:self; 6, identifier:sorting; 7, default_parameter; 8, expression_statement; 9, if_statement; 10, if_statement; 11, identifier:unit_ids; 12, None; 13, string; 14, comparison_operator:unit_ids is None; 15,... | 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; 13, 19; 14, 20; 14, 21; 15, 22; 16, 23; 16, 24; 17, 25; 17, 26; 18, 27; 22, 28; 24, 29; 24, 30; 25, 31; 26, 32; 26, 33; 26, 34; 27, 35; 28, 36; 28, 37; 31, 38; 31, 39; 34, 40; 34, 41; 35, 42; 35, 43; ... | def copy_unit_spike_features(self, sorting, unit_ids=None):
'''Copy unit spike features from another sorting extractor to the current
sorting extractor.
Parameters
----------
sorting: SortingExtractor
The sorting extractor from which the spike features will be copied... |
0, module; 1, function_definition; 2, function_name:merge_units; 3, parameters; 4, block; 5, identifier:self; 6, identifier:unit_ids; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, expression_statement; 11, if_statement; 12, string; 13, assignment; 14, identifier:i; 15, call; 16, block; 17, ass... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 9, 15; 9, 16; 10, 17; 11, 18; 11, 19; 11, 20; 11, 21; 12, 22; 13, 23; 13, 24; 15, 25; 15, 26; 16, 27; 16, 28; 17, 29; 17, 30; 18, 31; 20, 32; 20, 33; 20, 34; 20, 35; 20, 36; 20, 37; 20, 38; 20, 39; 20, 40; 20, 41; 20, 42; 20, 43; 2... | def merge_units(self, unit_ids):
'''This function merges two roots from the curation tree according to the given unit_ids. It creates a new unit_id and root
that has the merged roots as children.
Parameters
----------
unit_ids: list
The unit ids to be merged
... |
0, module; 1, function_definition; 2, function_name:split_unit; 3, parameters; 4, block; 5, identifier:self; 6, identifier:unit_id; 7, identifier:indices; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, if_statement; 12, string; 13, assignment; 14, identifier:i; 15, call; 16, block; 17, parenth... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 10, 14; 10, 15; 10, 16; 11, 17; 11, 18; 11, 19; 12, 20; 13, 21; 13, 22; 15, 23; 15, 24; 16, 25; 16, 26; 17, 27; 18, 28; 18, 29; 18, 30; 18, 31; 18, 32; 18, 33; 18, 34; 18, 35; 18, 36; 18, 37; 18, 38; 18, 39; 18, 40; 18, 41; 18, 42; 18, 43... | def split_unit(self, unit_id, indices):
'''This function splits a root from the curation tree according to the given unit_id and indices. It creates two new unit_ids
and roots that have the split root as a child. This function splits the spike train of the root by the given indices.
Parameters
... |
0, module; 1, function_definition; 2, function_name:_find_best_fit; 3, parameters; 4, block; 5, identifier:self; 6, identifier:pbin; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, try_statement; 11, comment:"""
Return best fitness rectangle from rectangles packing _sorted_rect li... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 9, 13; 10, 14; 10, 15; 12, 16; 12, 17; 13, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 17, 25; 19, 26; 19, 27; 19, 28; 20, 29; 21, 30; 23, 31; 24, 32; 24, 33; 25, 34; 25, 35; 27, 36; 27, 37; 28, 38; 29, 39; 29, 40; 31, 41; 32, 42; 32, 43... | def _find_best_fit(self, pbin):
"""
Return best fitness rectangle from rectangles packing _sorted_rect list
Arguments:
pbin (PackingAlgorithm): Packing bin
Returns:
key of the rectangle with best fitness
"""
fit = ((pbin.fitness(r[0], r[1]), k) f... |
0, module; 1, function_definition; 2, function_name:_item_attributes_match; 3, parameters; 4, comment:# type: (CryptoConfig, Dict, Dict) -> Bool; 5, block; 6, identifier:crypto_config; 7, identifier:plaintext_item; 8, identifier:encrypted_item; 9, expression_statement; 10, for_statement; 11, return_statement; 12, comme... | 0, 1; 1, 2; 1, 3; 1, 4; 1, 5; 3, 6; 3, 7; 3, 8; 5, 9; 5, 10; 5, 11; 9, 12; 10, 13; 10, 14; 10, 15; 11, 16; 13, 17; 13, 18; 14, 19; 14, 20; 15, 21; 15, 22; 19, 23; 19, 24; 21, 25; 21, 26; 22, 27; 22, 28; 25, 29; 25, 30; 26, 31; 27, 32; 27, 33; 28, 34; 29, 35; 29, 36; 30, 37; 30, 38; 32, 39; 32, 40; 34, 41; 35, 42; 35, 4... | def _item_attributes_match(crypto_config, plaintext_item, encrypted_item):
# type: (CryptoConfig, Dict, Dict) -> Bool
"""Determines whether the unencrypted values in the plaintext items attributes are the same as those in the
encrypted item. Essentially this uses brute force to cover when we don't know the ... |
0, module; 1, function_definition; 2, function_name:load_css; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, expression_statement; 14, comment:# Re... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 4, 16; 4, 17; 6, 18; 7, 19; 8, 20; 9, 21; 10, 22; 11, 23; 12, 24; 12, 25; 12, 26; 13, 27; 15, 28; 15, 29; 16, 30; 17, 31; 19, 32; 19, 33; 20, 34; 20, 35; 21, 36; 21, 37; 22, 38; 22, 39; 23, 40; 23, 41; 25, 42; 25, 43; 26, 44... | def load_css(self):
"""
Creates a dict of all icons available in CSS file, and finds out
what's their common prefix.
:returns sorted icons dict, common icon prefix
"""
icons = dict()
common_prefix = None
parser = tinycss.make_parser('page3')
style... |
0, module; 1, function_definition; 2, function_name:rules; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, comment:# Sort the data in order to get a consistent output; 10, expression_statement; 11, return_statement; 12, comment:"""
Returns a 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; 8, 14; 8, 15; 8, 16; 10, 17; 11, 18; 13, 19; 13, 20; 15, 21; 15, 22; 16, 23; 17, 24; 17, 25; 23, 26; 23, 27; 23, 28; 25, 29; 25, 30; 26, 31; 26, 32; 27, 33; 28, 34; 30, 35; 30, 36; 31, 37; 33, 38; 33, 39; 33, 40; 34, 41; 34, 42; 36, 43; 3... | def rules(self):
"""
Returns a sorted list of firewall rules.
Returns:
list
"""
list_of_rules = []
for main_row in self.dict_rules:
if 'rules' in main_row:
for rule_row in main_row['rules']:
if 'grants' in rule... |
0, module; 1, function_definition; 2, function_name:_select_mgmt_networks; 3, parameters; 4, block; 5, identifier:self; 6, identifier:conf; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, if_statement; 11, for_statement; 12, return_statement; 13, comment:"""
Select management netw... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 7, 13; 8, 14; 9, 15; 10, 16; 10, 17; 11, 18; 11, 19; 11, 20; 12, 21; 14, 22; 14, 23; 15, 24; 15, 25; 16, 26; 16, 27; 17, 28; 17, 29; 17, 30; 17, 31; 20, 32; 23, 33; 23, 34; 25, 35; 25, 36; 26, 37; 26, 38; 28, 39; 29, 40; 30, 41; 31, 42; 32, 43; ... | def _select_mgmt_networks(self, conf):
"""
Select management networks. If no management network is found, it will
mark the first network found by sorted the network lists. Also adding
default DNS domain, if none is set.
Args:
conf(spec): spec
"""
ne... |
0, module; 1, function_definition; 2, function_name:validate_wavetable; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, comment:# First check for invalid values; 8, expression_statement; 9, if_statement; 10, comment:# Now check for monotonicity & enforce ascending; 11, expression_statement; 12,... | 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; 8, 17; 9, 18; 9, 19; 11, 20; 12, 21; 12, 22; 14, 23; 15, 24; 15, 25; 17, 26; 17, 27; 18, 28; 18, 29; 19, 30; 19, 31; 20, 32; 20, 33; 21, 34; 22, 35; 23, 36; 23, 37; 24, 38; 24, 39; 25, 40; 25, 41; 27, 42; 27, 43; 28, ... | def validate_wavetable(self):
"""Enforce monotonic, ascending wavelength array with no zero or
negative values.
Raises
------
pysynphot.exceptions.DuplicateWavelength
Wavelength array contains duplicate entries.
pysynphot.exceptions.UnsortedWavelength
... |
0, module; 1, function_definition; 2, function_name:getStateIndex; 3, parameters; 4, block; 5, identifier:self; 6, identifier:state; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""
Returns the index of a state by calculating the state code and searching for this code a sor... | 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; 17, 22; 17, 23; 18, 24; 19, 25; 19, 26; 25, 27; 25, 28; 26, 29; 26, 30; 29, 31; 29, 32 | def getStateIndex(self,state):
"""
Returns the index of a state by calculating the state code and searching for this code a sorted list.
Can be called on multiple states at once.
"""
statecodes = self.getStateCode(state)
return np.searchsorted(self.codes,statecodes).astyp... |
0, module; 1, function_definition; 2, function_name:guess_chimera_path; 3, parameters; 4, block; 5, default_parameter; 6, expression_statement; 7, expression_statement; 8, if_statement; 9, if_statement; 10, return_statement; 11, identifier:search_all; 12, False; 13, comment:"""
Try to guess Chimera installation pat... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 5, 11; 5, 12; 6, 13; 7, 14; 8, 15; 8, 16; 8, 17; 9, 18; 9, 19; 10, 20; 14, 21; 14, 22; 15, 23; 15, 24; 17, 25; 17, 26; 18, 27; 19, 28; 22, 29; 22, 30; 23, 31; 25, 32; 26, 33; 28, 34; 30, 35; 30, 36; 30, 37; 30, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43; 34, ... | def guess_chimera_path(search_all=False):
"""
Try to guess Chimera installation path.
Parameters
----------
search_all : bool, optional, default=False
If no CHIMERADIR env var is set, collect all posible
locations of Chimera installations.
Returns
-------
paths: list of... |
0, module; 1, function_definition; 2, function_name:_topo_sort; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# select the operation that will be performed; 12, if_statement; 13, for_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; 6, 17; 6, 18; 7, 19; 8, 20; 9, 21; 10, 22; 12, 23; 12, 24; 12, 25; 13, 26; 13, 27; 13, 28; 14, 29; 14, 30; 15, 31; 15, 32; 15, 33; 16, 34; 20, 35; 20, 36; 21, 37; 21, 38; 22, 39; 22, 40; 24, 41; 24, 42; 24, 43; 25, 44... | def _topo_sort(self, forward=True):
"""
Topological sort.
Returns a list of nodes where the successors (based on outgoing and
incoming edges selected by the forward parameter) of any given node
appear in the sequence after that node.
"""
topo_list = []
qu... |
0, module; 1, function_definition; 2, function_name:execute_sql; 3, parameters; 4, block; 5, identifier:server_context; 6, identifier:schema_name; 7, identifier:sql; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parame... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 3, 11; 3, 12; 3, 13; 3, 14; 3, 15; 3, 16; 4, 17; 4, 18; 4, 19; 4, 20; 4, 21; 4, 22; 4, 23; 4, 24; 4, 25; 4, 26; 4, 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; 15, 43; 16, 44; 16, 45; ... | def execute_sql(server_context, schema_name, sql, container_path=None,
max_rows=None,
sort=None,
offset=None,
container_filter=None,
save_in_session=None,
parameters=None,
required_version=None,
... |
0, module; 1, function_definition; 2, function_name:find_missing_projections; 3, parameters; 4, block; 5, identifier:label_list; 6, identifier:projections; 7, expression_statement; 8, expression_statement; 9, if_statement; 10, for_statement; 11, return_statement; 12, comment:"""
Finds all combinations of labels in ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 7, 12; 8, 13; 9, 14; 9, 15; 10, 16; 10, 17; 10, 18; 11, 19; 13, 20; 13, 21; 14, 22; 14, 23; 15, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 19, 30; 21, 31; 21, 32; 24, 33; 25, 34; 25, 35; 27, 36; 28, 37; 28, 38; 30, 39; 36, 40; 36, 41; 37, 42; 37, 43; ... | def find_missing_projections(label_list, projections):
"""
Finds all combinations of labels in `label_list` that are not covered by an entry in the dictionary of
`projections`. Returns a list containing tuples of uncovered label combinations or en empty list if there are none.
All uncovered label combin... |
0, module; 1, function_definition; 2, function_name:load_projections; 3, parameters; 4, block; 5, identifier:projections_file; 6, expression_statement; 7, expression_statement; 8, for_statement; 9, return_statement; 10, comment:"""
Loads projections defined in the given `projections_file`.
The `projections_fil... | 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; 14, 22; 18, 23; 18, 24; 19, 25; 19, 26; 20, 27; 21, 28; 22, 29; 26, 30; 27, 31; 27, 32; 28, 33; 28, 34; 29, 35; 29, 36; 32, 37; 32, 38; 34, 39; 34, 40; 35, 41; 35, 42; 38, 43; ... | def load_projections(projections_file):
"""
Loads projections defined in the given `projections_file`.
The `projections_file` is expected to be in the following format::
old_label_1 | new_label_1
old_label_1 old_label_2 | new_label_2
old_label_3 |
You can define one projection... |
0, module; 1, function_definition; 2, function_name:label_values; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, return_statement; 9, comment:"""
Return a list of all occuring label values.
Returns:
list: Lexicographically sorted list (str)... | 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; 15, 18; 17, 19; 19, 20; 19, 21; 20, 22; 20, 23; 21, 24; 21, 25 | def label_values(self):
"""
Return a list of all occuring label values.
Returns:
list: Lexicographically sorted list (str) of label values.
Example:
>>> ll = LabelList(labels=[
>>> Label('a', 3.2, 4.5),
>>> Label('b', 5.1, 8.9),
... |
0, module; 1, function_definition; 2, function_name:get_utt_regions; 3, parameters; 4, block; 5, identifier:self; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""
Return the regions of all utterances, assuming all utterances are c... | 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; 16, 26; 16, 27; 16, 28; 16, 29; 16, 30; 16, 31; 16, 32; 16, 33; 23, 34; 24, 35; 25, 36; 26, 37; 27, 38; 27, 39; 27, 40; 28, 41; 28, 42; 29, 43; 3... | def get_utt_regions(self):
"""
Return the regions of all utterances, assuming all utterances are concatenated.
It is assumed that the utterances are sorted in ascending order for concatenation.
A region is defined by offset (in chunks), length (num-chunks) and
a list of referenc... |
0, module; 1, function_definition; 2, function_name:write_separated_lines; 3, parameters; 4, block; 5, identifier:path; 6, identifier:values; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, expression_statement; 13, identifier:separator; 14, string; 1... | 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; 11, 19; 11, 20; 11, 21; 12, 22; 14, 23; 18, 24; 18, 25; 19, 26; 19, 27; 20, 28; 20, 29; 21, 30; 21, 31; 22, 32; 22, 33; 25, 34; 25, 35; 26, 36; 26, 37; 28, 38; 28, 39; 28, 40; 29, 41; 29, 42; 29, 43; 30... | def write_separated_lines(path, values, separator=' ', sort_by_column=0):
"""
Writes list or dict to file line by line. Dict can have list as value then they written
separated on the line.
Parameters:
path (str): Path to write file to.
values (dict, list): A dictionary or a list to writ... |
0, module; 1, function_definition; 2, function_name:sort_set; 3, parameters; 4, block; 5, identifier:s; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, if_statement; 10, return_statement; 11, comment:"""Return a sorted list of the contents of a set
This is intended to be used to iterate over ... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 4, 6; 4, 7; 4, 8; 4, 9; 4, 10; 6, 11; 7, 12; 7, 13; 8, 14; 9, 15; 9, 16; 10, 17; 12, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 16, 24; 17, 25; 17, 26; 18, 27; 18, 28; 19, 29; 21, 30; 21, 31; 24, 32; 28, 33; 28, 34; 29, 35; 29, 36; 31, 37; 32, 38; 32, 39; 36, 40; 38, 41; 38, 42; 39, 43; 3... | def sort_set(s):
"""Return a sorted list of the contents of a set
This is intended to be used to iterate over world state, where you just need keys
to be in some deterministic order, but the sort order should be obvious from the key.
Non-strings come before strings and then tuples. Tuples compare elem... |
0, module; 1, function_definition; 2, function_name:parse_tags; 3, parameters; 4, block; 5, identifier:tagstring; 6, expression_statement; 7, if_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, comment:# Defer splitting of non-quoted sections until we know if there are; 12, com... | 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; 7, 21; 7, 22; 8, 23; 9, 24; 10, 25; 13, 26; 14, 27; 15, 28; 15, 29; 16, 30; 16, 31; 17, 32; 18, 33; 19, 34; 21, 35; 22, 36; 23, 37; 23, 38; 24, 39; 24, 40; 25, 41; 25, 42; 26, 43; 26, 44; 2... | def parse_tags(tagstring):
"""
Parses tag input, with multiple word input being activated and
delineated by commas and double quotes. Quotes take precedence, so
they may contain commas.
Returns a sorted list of unique tag names.
Adapted from Taggit, modified to not split strings on spaces.
... |
0, module; 1, function_definition; 2, function_name:_sort_by_unique_fields; 3, parameters; 4, block; 5, identifier:model; 6, identifier:model_objs; 7, identifier:unique_fields; 8, expression_statement; 9, expression_statement; 10, function_definition; 11, return_statement; 12, comment:"""
Sort a list of models by t... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 3, 7; 4, 8; 4, 9; 4, 10; 4, 11; 8, 12; 9, 13; 10, 14; 10, 15; 10, 16; 11, 17; 13, 18; 13, 19; 15, 20; 16, 21; 17, 22; 17, 23; 19, 24; 19, 25; 19, 26; 21, 27; 23, 28; 23, 29; 25, 30; 25, 31; 26, 32; 27, 33; 27, 34; 29, 35; 29, 36; 31, 37; 31, 38; 32, 39; 32, 40; 34, 41; 34, 42; 37, 43... | def _sort_by_unique_fields(model, model_objs, unique_fields):
"""
Sort a list of models by their unique fields.
Sorting models in an upsert greatly reduces the chances of deadlock
when doing concurrent upserts
"""
unique_fields = [
field for field in model._meta.fields
if field.... |
0, module; 1, function_definition; 2, function_name:find; 3, parameters; 4, block; 5, identifier:self; 6, identifier:datum; 7, expression_statement; 8, if_statement; 9, if_statement; 10, return_statement; 11, comment:"""Return sorted value of This if list or dict."""; 12, boolean_operator; 13, block; 14, boolean_operat... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 7, 11; 8, 12; 8, 13; 9, 14; 9, 15; 10, 16; 12, 17; 12, 18; 13, 19; 14, 20; 14, 21; 15, 22; 15, 23; 17, 24; 17, 25; 18, 26; 18, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 22, 33; 23, 34; 25, 35; 25, 36; 30, 37; 30, 38; 32, 39; 32, 40; 33, 41; 33, 42; 34, 43; ... | def find(self, datum):
"""Return sorted value of This if list or dict."""
if isinstance(datum.value, dict) and self.expressions:
return datum
if isinstance(datum.value, dict) or isinstance(datum.value, list):
key = (functools.cmp_to_key(self._compare)
... |
0, module; 1, function_definition; 2, function_name:get_subset_riverid_index_list; 3, parameters; 4, block; 5, identifier:self; 6, identifier:river_id_list; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, for_statement; 12, expression_statement; 13, expression_st... | 0, 1; 1, 2; 1, 3; 1, 4; 3, 5; 3, 6; 4, 7; 4, 8; 4, 9; 4, 10; 4, 11; 4, 12; 4, 13; 4, 14; 4, 15; 7, 16; 8, 17; 9, 18; 10, 19; 11, 20; 11, 21; 11, 22; 11, 23; 12, 24; 13, 25; 14, 26; 15, 27; 17, 28; 17, 29; 18, 30; 18, 31; 19, 32; 19, 33; 23, 34; 24, 35; 24, 36; 25, 37; 25, 38; 26, 39; 26, 40; 27, 41; 27, 42; 27, 43; 34,... | def get_subset_riverid_index_list(self, river_id_list):
"""
Gets the subset riverid_list from the netcdf file
Optional returns include the list of valid river ids in the dataset
as well as a list of missing rive rids
Parameters
----------
river_id_list: list or :... |
0, module; 1, function_definition; 2, function_name:get_child_type_choices; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, identifier:action; 8, expression_statement; 9, comment:# Get choices from the super class to check permissions.; 10, expression_statement; 11, comment:# Update label with ve... | 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; 12, 19; 13, 20; 14, 21; 15, 22; 15, 23; 16, 24; 18, 25; 18, 26; 19, 27; 19, 28; 20, 29; 20, 30; 21, 31; 21, 32; 23, 33; 23, 34; 23, 35; 26, 36; 26, 37; 28, 38; 28, 39; 33, 40; 33, 41; 33, 42; 34, 43; 35... | def get_child_type_choices(self, request, action):
"""
Override choice labels with ``verbose_name`` from plugins and sort.
"""
# Get choices from the super class to check permissions.
choices = super(ChildModelPluginPolymorphicParentModelAdmin, self) \
.get_child_type... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.