sequence stringlengths 546 16.2k | code stringlengths 108 19.3k |
|---|---|
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:check_base_suggested_attributes; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:dataset; 6, block; 6, 7; 6, 9; 6, 19; 6, 20; 6, 29; 6, 39; 6, 48; 6, 74; 6, 75; 6, 124; 6, 137; 6, 152; 6, 165; 6, 180; 6, 189; 6, 198; 6, 207; 6, 216... | def check_base_suggested_attributes(self, dataset):
'''
Check the global suggested attributes for 2.0 templates. These go an extra step besides
just checking that they exist.
:param netCDF4.Dataset dataset: An open netCDF dataset
:creator_type = "" ; //............................ |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:load_from_args_as_dataframe; 3, parameters; 3, 4; 4, identifier:args; 5, block; 5, 6; 5, 8; 5, 21; 5, 58; 5, 67; 5, 71; 5, 185; 5, 281; 5, 290; 5, 313; 5, 323; 5, 346; 5, 365; 5, 366; 5, 388; 5, 410; 5, 425; 5, 454; 6, expression_statement; 6, ... | def load_from_args_as_dataframe(args):
'''
Given parsed variant-loading arguments, return a pandas DataFrame.
If no variant loading arguments are specified, return None.
'''
if not args.variants and not args.single_variant:
return None
if args.variant_source_name:
variant_sourc... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:protected; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:tests; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 22; 9, 34; 9, 44; 9, 54; 9, 64; 9, 74; 9, 85; ... | def protected(self, *tests, **kwargs):
"""Factory of decorators for limit the access to views.
:tests: *function, optional
One or more functions that takes the args and kwargs of the
view and returns either `True` or `False`.
All test must return True to show the vie... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:_verify_multi; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:token; 6, identifier:verifying_keys; 7, default_parameter; 7, 8; 7, 9; 8, identifier:num_required; 9, None; 10, block; 10, 11; 10, 13; 10, 24; 10, 36; 10, ... | def _verify_multi(self, token, verifying_keys, num_required=None):
"""
Verify a JSON-formatted JWT signed by multiple keys is authentic.
Optionally set a threshold of required valid signatures with num_required.
Return True if valid
Return False if not
TODO: support mult... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:parse_pic_field; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:l; 5, identifier:c; 6, identifier:last_section_node; 7, identifier:last_vars; 8, identifier:line; 9, block; 9, 10; 9, 12; 9, 16; 9, 25; 9, 29; 9, 52; 9, 98; 9, 108; 9, ... | def parse_pic_field(l, c, last_section_node, last_vars, line):
"""
Parse a pic field line. Return A VariableNode or None in case of malformed
code.
:param l: The line number (starting from 0)
:param c: The column number (starting from 0)
:param last_section_node: The last section node found
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:getgrouploansurl; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:idgroup; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 16; 9, 71; 9, 77; 9, 111; 10, express... | def getgrouploansurl(idgroup, *args, **kwargs):
"""Request Group loans URL.
How to use it? By default MambuLoan uses getloansurl as the urlfunc.
Override that behaviour by sending getgrouploansurl (this function)
as the urlfunc to the constructor of MambuLoans (note the final 's')
and voila! you ge... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:getclientloansurl; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:idclient; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 16; 9, 71; 9, 77; 9, 111; 10, expre... | def getclientloansurl(idclient, *args, **kwargs):
"""Request Client loans URL.
How to use it? By default MambuLoan uses getloansurl as the urlfunc.
Override that behaviour by sending getclientloansurl (this function)
as the urlfunc to the constructor of MambuLoans (note the final 's')
and voila! yo... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:backup_db; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 9; 4, identifier:callback; 5, identifier:bool_func; 6, identifier:output_fname; 7, list_splat_pattern; 7, 8; 8, identifier:args; 9, dictionary_splat_pattern; 9, 10; 10, identifier:kwargs; 11... | def backup_db(callback, bool_func, output_fname, *args, **kwargs):
"""Backup Mambu Database via REST API.
Makes two calls to Mambu API:
- a POST to request a backup to be made
- a GET, once the backup is ready, to download the latest backup
* callback is a string to a callback URL Mambu will int... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:send; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:stack; 7, type; 7, 8; 8, identifier:Layers; 9, block; 9, 10; 9, 12; 9, 27; 9, 98; 9, 137; 9, 190; 9, 226; 10, expression_statement; 10, 11; 11, c... | def send(self, stack: Layers):
"""
Intercept any potential "AnswerCallbackQuery" before adding the stack
to the output buffer.
"""
if not isinstance(stack, Stack):
stack = Stack(stack)
if 'callback_query' in self._update and stack.has_layer(Update):
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 22; 2, function_name:_send_text; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 13; 4, identifier:self; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:request; 7, type; 7, 8; 8, identifier:Request; 9, typed_parameter; 9, 10; 9, 11; 10, identifier:stack; 11, type; 11, 12; 12, ... | async def _send_text(self,
request: Request,
stack: Stack,
parse_mode: Optional[Text] = None):
"""
Base function for sending text
"""
parts = []
chat_id = request.message.get_chat_id()
for layer ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:setRepayments; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 37; 9, 92; 9, 106; 9, 112; 10, expression_s... | def setRepayments(self, *args, **kwargs):
"""Adds the repayments for this loan to a 'repayments' field.
Repayments are MambuRepayment objects.
Repayments get sorted by due date.
Returns the number of requests done to Mambu.
.. todo:: since pagination logic was added, is not always tr... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:setTransactions; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 33; 9, 88; 9, 102; 9, 108; 10, expression... | def setTransactions(self, *args, **kwargs):
"""Adds the transactions for this loan to a 'transactions' field.
Transactions are MambuTransaction objects.
Transactions get sorted by transaction id.
Returns the number of requests done to Mambu.
.. todo:: since pagination logic was added... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_filter; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:environ; 6, identifier:params; 7, block; 7, 8; 7, 10; 7, 11; 7, 71; 7, 72; 7, 73; 7, 77; 7, 100; 7, 101; 7, 102; 7, 110; 7, 111; 7, 112; 7, 113; 7, 133; 7, 134; 7, 143;... | def _filter(self, environ, params):
"""
Performs final filtering of the request to determine if this
limit applies. Returns False if the limit does not apply or
if the call should not be limited, or True to apply the limit.
"""
# Search for required query arguments
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 41; 2, function_name:show; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 3, 32; 3, 35; 3, 38; 4, identifier:items; 5, default_parameter; 5, 6; 5, 7; 6, identifier:command; 7, string:'dmenu'; 8, default_parameter; 8, 9; 8, 10; 9,... | def show(
items,
command='dmenu',
bottom=None,
fast=None,
case_insensitive=None,
lines=None,
monitor=None,
prompt=None,
font=None,
background=None,
foreground=None,
background_selected=None,
foreground_selected=None)... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:clean_names; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:lines; 5, default_parameter; 5, 6; 5, 7; 6, identifier:ensure_unique_names; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:strip_prefix; 10, False; 11, default_para... | def clean_names(lines, ensure_unique_names=False, strip_prefix=False,
make_database_safe=False):
"""
Clean the names.
Options to:
- strip prefixes on names
- enforce unique names
- make database safe names by converting - to _
"""
names = {}
for row in lines:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:do_help; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:arg; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 11; 9, 12; 9, 88; 10, identifier:arg; 11, comment; 12, block; 12, 13; 12, 84;... | def do_help(self, arg):
"""List available commands with "help" or detailed help with "help cmd"."""
if arg:
# XXX check arg syntax
try:
func = getattr(self, 'help_' + arg)
except AttributeError:
try:
doc = getattr(s... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:make_echoicefield; 3, parameters; 3, 4; 3, 5; 3, 7; 3, 10; 4, identifier:echoices; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, default_parameter; 7, 8; 7, 9; 8, identifier:klass_name; 9, None; 10, dictionary_splat_pattern; 10, 11; 11, ... | def make_echoicefield(echoices, *args, klass_name=None, **kwargs):
"""
Construct a subclass of a derived `models.Field` specific to the type of the `EChoice` values.
Parameters
----------
echoices : subclass of EChoice
args
Passed to the derived `models.Field`
klass_name : str
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 30; 2, function_name:make_dummy; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 17; 3, 20; 3, 23; 3, 26; 3, 28; 4, identifier:instance; 5, default_parameter; 5, 6; 5, 7; 6, identifier:relations; 7, dictionary; 8, default_parameter; 8, 9; 8, 10; 9, identifier:datetime_default... | def make_dummy(instance,
relations = {},
datetime_default = dt.strptime('1901-01-01','%Y-%m-%d'),
varchar_default = "",
integer_default = 0,
numeric_default = 0.0,
*args, **kwargs
):
"""Make an instance... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:read_headers; 3, parameters; 3, 4; 3, 5; 4, identifier:rfile; 5, default_parameter; 5, 6; 5, 7; 6, identifier:hdict; 7, None; 8, block; 8, 9; 8, 11; 8, 20; 8, 161; 9, expression_statement; 9, 10; 10, comment; 11, if_statement; 11, 12; 11, 15; 1... | def read_headers(rfile, hdict=None):
"""Read headers from the given stream into the given header dict.
If hdict is None, a new header dict is created. Returns the populated
header dict.
Headers which are repeated are folded together using a comma if their
specification so dictates.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:send_headers; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 24; 5, 37; 5, 113; 5, 162; 5, 212; 5, 232; 5, 252; 5, 269; 5, 290; 5, 297; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; ... | def send_headers(self):
"""Assert, process, and send the HTTP response message-headers.
You must set self.status, and self.outheaders before calling this.
"""
hkeys = [key.lower() for key, value in self.outheaders]
status = int(self.status[:3])
if status... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:setActivities; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 35; 9, 90; 9, 104; 9, 110; 10, expression_s... | def setActivities(self, *args, **kwargs):
"""Adds the activities for this group to a 'activities' field.
Activities are MambuActivity objects.
Activities get sorted by activity timestamp.
Returns the number of requests done to Mambu.
"""
def activityDate(activity):
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:connect; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 17; 9, 29; 9, 53; 9, 57; 9, 64; 9, 65; 9, 71; 9, ... | def connect(self, *args, **kwargs):
"""Connect to Mambu, make the request to the REST API.
If there's no urlfunc to use, nothing is done here.
When done, initializes the attrs attribute of the Mambu object
by calling the init method. Please refer to that code and pydoc
for furt... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 37; 2, function_name:GetDirections; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 3, 25; 3, 28; 3, 31; 3, 34; 4, identifier:self; 5, identifier:origin; 6, identifier:destination; 7, default_parameter; 7, 8; 7, 9; 8, identifier:sensor; 9... | def GetDirections(self, origin, destination, sensor = False, mode = None, waypoints = None, alternatives = None, avoid = None, language = None, units = None,
region = None, departure_time = None, arrival_time = None):
'''Get Directions Service
Pls refer to the Google Maps Web ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:compactor; 3, parameters; 3, 4; 4, identifier:conf; 5, block; 5, 6; 5, 8; 5, 9; 5, 18; 5, 19; 5, 27; 5, 28; 5, 34; 5, 35; 5, 57; 5, 58; 5, 68; 5, 75; 5, 76; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; ... | def compactor(conf):
"""
The compactor daemon. This fuction watches the sorted set
containing bucket keys that need to be compacted, performing the
necessary compaction.
:param conf: A turnstile.config.Config instance containing the
configuration for the compactor daemon. Note th... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:now; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, with_statement; 9, 10; 9, 15; 10, with_clause; 10, 11; 11, with_item; 11, 12; 12, attribute; 12, 13; 12, ... | def get(self, now):
"""
Get a bucket key to compact. If none are available, returns
None. This uses a configured lock to ensure that the bucket
key is popped off the sorted set in an atomic fashion.
:param now: The current time, as a float. Used to ensure the
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:now; 6, block; 6, 7; 6, 9; 6, 31; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:items; 12, call; 12, 1... | def get(self, now):
"""
Get a bucket key to compact. If none are available, returns
None. This uses a Lua script to ensure that the bucket key is
popped off the sorted set in an atomic fashion.
:param now: The current time, as a float. Used to ensure the
b... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:main_cli; 3, parameters; 4, block; 4, 5; 4, 7; 4, 8; 4, 14; 4, 20; 4, 26; 4, 32; 4, 38; 4, 44; 4, 48; 4, 103; 5, expression_statement; 5, 6; 6, comment; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:args... | def main_cli():
"""CLI minimal interface."""
# Get params
args = _cli_argument_parser()
delta_secs = args.delay
i2cbus = args.bus
i2c_address = args.address
sensor_key = args.sensor
sensor_params = args.params
params = {}
if sensor_params:
def _parse_param(str_param):
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:variant_support; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:variants; 5, identifier:allele_support_df; 6, default_parameter; 6, 7; 6, 8; 7, identifier:ignore_missing; 8, False; 9, block; 9, 10; 9, 12; 9, 26; 9, 41; 9, 42; 9, 60; 9, 73; 9, 8... | def variant_support(variants, allele_support_df, ignore_missing=False):
'''
Collect the read evidence support for the given variants.
Parameters
----------
variants : iterable of varcode.Variant
allele_support_df : dataframe
Allele support dataframe, as output by the varlens-allele-su... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 1, 25; 2, function_name:_wavReadData; 3, parameters; 3, 4; 3, 5; 3, 9; 3, 13; 3, 17; 4, identifier:fid; 5, typed_parameter; 5, 6; 5, 7; 6, identifier:size; 7, type; 7, 8; 8, identifier:int; 9, typed_parameter; 9, 10; 9, 11; 10, identifier:channels; 11, type; 1... | def _wavReadData(fid,
size:int,
channels:int,
encoding:str,
bigendian:bool) -> np.ndarray:
"""
adapted from scipy.io.wavfile._read_data_chunk
assume we are at the data (after having read the size)
"""
bits = int(encoding[3:])
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:refreshButton; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 5, 22; 5, 27; 5, 35; 5, 36; 5, 63; 5, 67; 5, 68; 5, 199; 5, 266; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10... | def refreshButton(self):
"""
Refreshes the button for this toolbar.
"""
collapsed = self.isCollapsed()
btn = self._collapseButton
if not btn:
return
btn.setMaximumSize(MAX_SIZE, MAX_SIZE)
# set up a vertical... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:applyCommand; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 17; 5, 26; 5, 45; 5, 53; 5, 65; 5, 75; 5, 76; 5, 459; 5, 466; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 10, assig... | def applyCommand(self):
"""
Applies the current line of code as an interactive python command.
"""
# generate the command information
cursor = self.textCursor()
cursor.movePosition(cursor.EndOfLine)
line = projex.text.nativestring(curs... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:pager; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:lines; 6, block; 6, 7; 6, 9; 7, expression_statement; 7, 8; 8, comment; 9, try_statement; 9, 10; 9, 250; 10, block; 10, 11; 10, 15; 10, 37; 10, 52; 10, 56; 10, 236; 10, 237; 11... | def pager(self, lines):
"""
Outputs lines to a terminal. It uses
`shutil.get_terminal_size` to determine the height of the terminal.
It expects an iterator that returns a line at a time and those lines
should be terminated by a valid newline sequence.
Behaviour is contro... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:merge; 3, parameters; 3, 4; 4, identifier:constraints; 5, block; 5, 6; 5, 8; 5, 9; 5, 16; 5, 33; 5, 34; 5, 57; 5, 58; 5, 81; 5, 82; 5, 104; 5, 105; 5, 127; 5, 128; 5, 132; 5, 212; 5, 213; 5, 217; 5, 297; 5, 298; 5, 383; 5, 397; 5, 411; 6, expre... | def merge(constraints):
"""Merge ``constraints``.
It removes dupplicate, pruned and merged constraints.
:param constraints: Current constraints.
:type constraints: Iterable of :class:`.Constraint` objects.
:rtype: :func:`list` of :class:`.Constraint` objects.
:raises: :exc:`.ExclusiveConstrain... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:parse_baxter; 3, parameters; 3, 4; 4, identifier:reading; 5, block; 5, 6; 5, 8; 5, 12; 5, 16; 5, 20; 5, 24; 5, 25; 5, 29; 5, 33; 5, 37; 5, 41; 5, 45; 5, 52; 5, 144; 5, 145; 5, 168; 5, 169; 5, 182; 5, 183; 5, 200; 6, expression_statement; 6, 7; ... | def parse_baxter(reading):
"""
Parse a Baxter string and render it with all its contents, namely
initial, medial, final, and tone.
"""
initial = ''
medial = ''
final = ''
tone = ''
# determine environments
inienv = True
medienv = False
finenv = False
tonenv = Fa... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:create; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:query; 6, keyword_separator; 7, default_parameter; 7, 8; 7, 9; 8, identifier:dc; 9, None; 10, block; 10, 11; 10, 13; 10, 34; 10, 55; 11, expression_statement; 11,... | async def create(self, query, *, dc=None):
"""Creates a new prepared query
Parameters:
Query (Object): Query definition
dc (str): Specify datacenter that will be used.
Defaults to the agent's local datacenter.
Returns:
Object: New query ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:execute; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 4, identifier:self; 5, identifier:query; 6, keyword_separator; 7, default_parameter; 7, 8; 7, 9; 8, identifier:dc; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, identif... | async def execute(self, query, *,
dc=None, near=None, limit=None, consistency=None):
"""Executes a prepared query
Parameters:
query (ObjectID): Query ID
dc (str): Specify datacenter that will be used.
Defaults to the agent's local data... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:zip_process; 3, parameters; 3, 4; 4, dictionary_splat_pattern; 4, 5; 5, identifier:kwargs; 6, block; 6, 7; 6, 9; 6, 13; 6, 17; 6, 21; 6, 25; 6, 71; 6, 96; 6, 255; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, as... | def zip_process(**kwargs):
"""
Process zip operations.
:param kwargs:
:return:
"""
str_localPath = ""
str_zipFileName = ""
str_action = "zip"
str_arcroot = ""
for k,v in kwargs.items():
if k == 'path': str_localPath = v
if k == 'action':... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:base64_process; 3, parameters; 3, 4; 4, dictionary_splat_pattern; 4, 5; 5, identifier:kwargs; 6, block; 6, 7; 6, 9; 6, 13; 6, 17; 6, 21; 6, 25; 6, 72; 6, 156; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assign... | def base64_process(**kwargs):
"""
Process base64 file io
"""
str_fileToSave = ""
str_fileToRead = ""
str_action = "encode"
data = None
for k,v in kwargs.items():
if k == 'action': str_action = v
if k == 'payloadBytes'... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:path_localLocationCheck; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:d_msg; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 11; 8, 15; 8, 21; 8, 37; 8, 48; 8, 59; 8, 65; 8, 78; 8, 82; 8, 86; 8,... | def path_localLocationCheck(self, d_msg, **kwargs):
"""
Check if a path exists on the local filesystem
:param self:
:param kwargs:
:return:
"""
b_pull = False
d_meta = d_msg['meta']
if 'do' in d_meta:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:rebuild; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 5, 27; 5, 89; 5, 117; 5, 124; 5, 132; 5, 140; 5, 158; 5, 164; 5, 346; 5, 353; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment... | def rebuild(self):
"""
Rebuilds the data associated with this filter widget.
"""
table = self.tableType()
form = nativestring(self.filterFormat())
if not table and form:
if self.layout().count() == 0:
self.layout().addWidget(... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:filters; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 4, default_parameter; 4, 5; 4, 6; 5, identifier:filter_directory; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:update; 9, False; 10, default_parameter; 10, 11; 10, 12; 11, identifie... | def filters(filter_directory=None, update=False, fmt='table', **kwargs):
"""
Get a list of the available filters
Parameters
----------
filter_directory: str
The directory containing the filter relative spectral response curves
update: bool
Check the filter directory for new filt... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:parse_unit; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:prop; 5, identifier:dictionary; 6, default_parameter; 6, 7; 6, 8; 7, identifier:dt; 8, None; 9, block; 9, 10; 9, 12; 9, 13; 9, 36; 9, 37; 9, 53; 9, 81; 9, 82; 9, 128; 9, 129; 9, 140; 10... | def parse_unit(prop, dictionary, dt=None):
'''Do a fuzzy match for `prop` in the dictionary, taking into account unit suffix.'''
# add the observation's time
try:
dt = timezone.parse_datetime(dictionary.get('date_time'))
except TypeError:
dt = None
# 'prop' is a stub of the property... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:rebuild; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 15; 5, 22; 5, 23; 5, 45; 5, 46; 5, 54; 5, 321; 5, 328; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10... | def rebuild( self ):
"""
Rebuilds the interface for this widget based on the current model.
"""
self.setUpdatesEnabled(False)
self.blockSignals(True)
# clear out all the subwidgets for this widget
for child in self.findChildren(QObject):
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:save; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 5, 30; 5, 38; 5, 50; 5, 51; 5, 55; 5, 64; 5, 255; 5, 256; 5, 274; 5, 280; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, assignment; 9, 10... | def save( self ):
"""
Saves the values from the editor to the system.
"""
schema = self.schema()
if ( not schema ):
self.saved.emit()
return
record = self.record()
if not record:
record = self._model()
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:register; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:service; 6, block; 6, 7; 6, 9; 6, 24; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:response; 12,... | async def register(self, service):
"""Registers a new local service.
Returns:
bool: ``True`` on success
The register endpoint is used to add a new service,
with an optional health check, to the local agent.
The request body must look like::
{
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:save; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 5, 31; 5, 56; 5, 64; 5, 65; 5, 73; 5, 113; 5, 114; 5, 218; 5, 219; 5, 230; 5, 246; 5, 254; 5, 264; 5, 279; 5, 311; 5, 351; 6, expression_statement; 6, 7; 7, comment; 8,... | def save(self):
"""
Saves the changes from the ui to this widgets record instance.
"""
record = self.record()
if not record:
logger.warning('No record has been defined for %s.' % self)
return False
if not self.signalsBlocked():
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:prepare; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 18; 5, 33; 5, 34; 5, 43; 5, 76; 5, 77; 5, 148; 5, 149; 5, 167; 5, 287; 5, 296; 5, 331; 5, 335; 5, 345; 5, 355; 5, 365; 5, 375; 5, 395; 5, 403; 5, 410; 6, expressio... | def prepare(self):
"""
Prepares the information for this graphic.
"""
# determine if we already have a snapshot setup
pixmap = self.property('pixmap')
if pixmap is not None:
return super(XWalkthroughSnapshot, self).prepare()
# otherwi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:depends; 3, parameters; 3, 4; 3, 7; 3, 10; 3, 13; 4, default_parameter; 4, 5; 4, 6; 5, identifier:func; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:after; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, identifier:before; 12, ... | def depends(func=None, after=None, before=None, priority=None):
"""Decorator to specify test dependencies
:param after: The test needs to run after this/these tests. String or list of strings.
:param before: The test needs to run before this/these tests. String or list of strings.
"""
if not (func ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_translate_language_name; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:language_name; 6, block; 6, 7; 6, 9; 6, 17; 6, 21; 6, 22; 6, 23; 6, 48; 6, 49; 6, 50; 6, 79; 6, 104; 6, 105; 6, 106; 6, 120; 6, 136; 6, 137; 6, 138; 6, 155; ... | def _translate_language_name(self, language_name):
"""
Translate a human readable langauge name into its Ideone
integer representation.
Keyword Arguments
-----------------
* langauge_name: a string of the language (e.g. "c++")
Returns
-------
A... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:headerSortAscending; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 15; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, ... | def headerSortAscending( self ):
"""
Sorts the column at the current header index by ascending order.
"""
self.setSortingEnabled(True)
self.sortByColumn(self._headerIndex, QtCore.Qt.AscendingOrder) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:headerSortDescending; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 15; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12,... | def headerSortDescending( self ):
"""
Sorts the column at the current header index by descending order.
"""
self.setSortingEnabled(True)
self.sortByColumn(self._headerIndex, QtCore.Qt.DescendingOrder) |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:from_api; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:api; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 11; 8, 21; 8, 97; 8, 121; 8, 154; 8, 179; 8, 186; 8, 264; 9, expression_statement; 9, 1... | def from_api(cls, api, **kwargs):
""" Parses a payload from the API, guided by `_api_attrs` """
if not cls._api_attrs:
raise NotImplementedError()
def resolve_attribute_type(attr_type):
# resolve arrays of types down to base type
while isinstance(attr_type, l... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:updateEditor; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 17; 5, 25; 5, 35; 5, 39; 5, 43; 5, 56; 5, 57; 5, 105; 5, 114; 5, 115; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, expression_statement; 9, 10; 1... | def updateEditor( self ):
"""
Updates the editor based on the current selection.
"""
# assignt the rule operators to the choice list
rule = self.currentRule()
operator = self.currentOperator()
widget = self.uiWidgetAREA.widget()
edi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:StreamMetrics; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:request_iterator; 6, identifier:context; 7, block; 7, 8; 7, 10; 7, 17; 7, 18; 7, 26; 7, 30; 7, 34; 7, 49; 7, 80; 7, 111; 7, 122; 7, 133; 7, 134; 7, 151; 7, 157; 7... | def StreamMetrics(self, request_iterator, context):
"""Dispatches metrics streamed by collector"""
LOG.debug("StreamMetrics called")
# set up arguments
collect_args = (next(request_iterator))
max_metrics_buffer = 0
max_collect_duration = 0
cfg = Metric(pb=collect... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:prepare_node; 3, parameters; 3, 4; 4, identifier:data; 5, block; 5, 6; 5, 8; 5, 16; 5, 27; 5, 28; 5, 52; 5, 56; 5, 69; 5, 93; 5, 108; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 11; 9, not_operator; 9, 10; 10, identifie... | def prepare_node(data):
"""Prepare node for catalog endpoint
Parameters:
data (Union[str, dict]): Node ID or node definition
Returns:
Tuple[str, dict]: where first is ID and second is node definition
Extract from /v1/health/service/<service>::
{
"Node": {
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:prepare_service; 3, parameters; 3, 4; 4, identifier:data; 5, block; 5, 6; 5, 8; 5, 16; 5, 27; 5, 28; 5, 52; 5, 53; 5, 54; 5, 55; 5, 56; 5, 109; 5, 124; 5, 128; 5, 141; 5, 163; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8,... | def prepare_service(data):
"""Prepare service for catalog endpoint
Parameters:
data (Union[str, dict]): Service ID or service definition
Returns:
Tuple[str, dict]: str is ID and dict is service
Transform ``/v1/health/state/<state>``::
{
"Node": "foobar",
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:add_measurement; 3, parameters; 3, 4; 4, identifier:measurement; 5, block; 5, 6; 5, 8; 5, 10; 5, 25; 5, 39; 5, 52; 5, 63; 5, 78; 5, 86; 5, 97; 5, 98; 5, 119; 5, 120; 5, 126; 6, expression_statement; 6, 7; 7, comment; 8, global_statement; 8, 9; ... | def add_measurement(measurement):
"""Add measurement data to the submission buffer for eventual writing to
InfluxDB.
Example:
.. code:: python
import sprockets_influxdb as influxdb
measurement = influxdb.Measurement('example', 'measurement-name')
measurement.set_tag('foo', 'b... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:refresh; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:reloadData; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:force; 10, False; 11, block; 11, 12; 11, 14; 11, 34; 11, 42; 1... | def refresh(self, reloadData=False, force=False):
"""
Refreshes the record list for the tree.
"""
if not (self.isVisible() or force):
self._refreshTimer.start()
return
if self.isLoading():
return
if reloadDa... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 1, 30; 2, function_name:tornado_run; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:app; 5, default_parameter; 5, 6; 5, 7; 6, identifier:port; 7, integer:5000; 8, default_parameter; 8, 9; 8, 10; 9, identifier:address; ... | def tornado_run(app, port=5000, address="", use_gevent=False, start=True,
monkey_patch=None, Container=None,
Server=None, threadpool=None): # pragma: no cover
"""Run your app in one tornado event loop process
:param app: wsgi application, Microservice instance
:param port: ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 1, 24; 2, function_name:tornado_combiner; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:configs; 5, default_parameter; 5, 6; 5, 7; 6, identifier:use_gevent; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:start; 10, True... | def tornado_combiner(configs, use_gevent=False, start=True, monkey_patch=None,
Container=None, Server=None, threadpool=None): # pragma: no cover
"""Combine servers in one tornado event loop process
:param configs: [
{
'app': Microservice Application or another wsgi app... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:rebuild; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 16; 5, 26; 5, 33; 5, 43; 5, 49; 5, 57; 5, 95; 5, 96; 5, 104; 5, 112; 5, 119; 5, 126; 5, 133; 5, 142; 5, 153; 5, 164; 5, 168; 5, 177; 5, 185; 5, 186; 5, 225; 5, 226; 5, 2... | def rebuild( self ):
"""
Rebuilds the parts widget with the latest text.
"""
navitem = self.currentItem()
if ( navitem ):
navitem.initialize()
self.setUpdatesEnabled(False)
self.scrollWidget().show()
self._originalText = ''
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:syncView; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:recursive; 7, False; 8, block; 8, 9; 8, 11; 8, 12; 8, 20; 8, 28; 8, 33; 8, 41; 8, 49; 8, 57; 8, 71; 8, 83; 8, 84; 8, 89; 8, 106; 9, express... | def syncView(self, recursive=False):
"""
Syncs the information from this item to the view.
"""
# update the view widget
gantt = self.ganttWidget()
tree = self.treeWidget()
if not gantt:
return
vwidget = gantt.viewWi... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 18; 2, function_name:nodes; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 4, identifier:self; 5, keyword_separator; 6, default_parameter; 6, 7; 6, 8; 7, identifier:dc; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:near; 11, None; 12, default_p... | async def nodes(self, *,
dc=None, near=None, watch=None, consistency=None):
"""Lists nodes in a given DC
Parameters:
dc (str): Specify datacenter that will be used.
Defaults to the agent's local datacenter.
near (str): Sort the node list... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 28; 2, function_name:keyphrases_graph; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 4, identifier:keyphrases; 5, identifier:texts; 6, default_parameter; 6, 7; 6, 8; 7, identifier:referral_confidence; 8, float:0.6; 9, default_parameter; 9, 10;... | def keyphrases_graph(keyphrases, texts, referral_confidence=0.6, relevance_threshold=0.25,
support_threshold=1, similarity_measure=None, synonimizer=None,
language=consts.Language.ENGLISH):
"""
Constructs the keyphrases relation graph based on the given texts corpus.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:_hm_verify_message_crc_uk; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, identifier:self; 5, identifier:thermostat_id; 6, identifier:protocol; 7, identifier:source; 8, identifier:expectedFunction; 9, identifier:expectedLength; 1... | def _hm_verify_message_crc_uk(
self,
thermostat_id,
protocol,
source,
expectedFunction,
expectedLength,
datal
):
"""Verifies message appears legal"""
# expectedLength only used for read msgs as always 7 for... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:checks; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 4, identifier:self; 5, identifier:service; 6, keyword_separator; 7, default_parameter; 7, 8; 7, 9; 8, identifier:dc; 9, None; 10, default_parameter; 10, 11; 10, 12; 11, identi... | async def checks(self, service, *,
dc=None, near=None, watch=None, consistency=None):
"""Returns the checks of a service
Parameters:
dc (str): Specify datacenter that will be used.
Defaults to the agent's local datacenter.
near (str): W... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:get; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:cap; 5, list_splat_pattern; 5, 6; 6, identifier:args; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 12; 9, 13; 9, 22; 9, 40; 9, 57; 9, 66; 9, 134; 9, 135; 10, ex... | def get(cap, *args, **kwargs):
"""
Get a terminal capability exposes through the `curses` module.
"""
# Hack for readthedocs.org
if 'READTHEDOCS' in os.environ:
return ''
if kwargs != {}:
raise TypeError("get(): No such argument %r" % kwargs.popitem()[0])
if _cache == {}:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:draw; 3, parameters; 3, 4; 3, 5; 4, identifier:canvas; 5, identifier:mol; 6, block; 6, 7; 6, 9; 6, 16; 6, 24; 6, 33; 6, 73; 6, 74; 6, 237; 6, 238; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, call; 10, 11; 10, ... | def draw(canvas, mol):
"""Draw molecule structure image.
Args:
canvas: draw.drawable.Drawable
mol: model.graphmol.Compound
"""
mol.require("ScaleAndCenter")
mlb = mol.size2d[2]
if not mol.atom_count():
return
bond_type_fn = {
1: {
0: single_bond,
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:salm2map; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 4, identifier:salm; 5, identifier:s; 6, identifier:lmax; 7, identifier:Ntheta; 8, identifier:Nphi; 9, block; 9, 10; 9, 12; 9, 34; 9, 61; 9, 66; 9, 80; 9, 108; 9, 133; 9, 233; 10, expression... | def salm2map(salm, s, lmax, Ntheta, Nphi):
"""Convert mode weights of spin-weighted function to values on a grid
Parameters
----------
salm : array_like, complex, shape (..., (lmax+1)**2)
Input array representing mode weights of the spin-weighted function. This array may be
multi-dimen... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:map2salm; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:map; 5, identifier:s; 6, identifier:lmax; 7, block; 7, 8; 7, 10; 7, 15; 7, 29; 7, 56; 7, 152; 8, expression_statement; 8, 9; 9, comment; 10, import_statement; 10, 11; 11, aliased_import; ... | def map2salm(map, s, lmax):
"""Convert values of spin-weighted function on a grid to mode weights
Parameters
----------
map : array_like, complex, shape (..., Ntheta, Nphi)
Values of the spin-weighted function on grid points of the sphere. This array may have more
than two dimensions, ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:get; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:url; 6, default_parameter; 6, 7; 6, 8; 7, identifier:store_on_error; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:xpath; 11, Non... | def get(self, url, store_on_error=False, xpath=None, rate_limit=None, log_hits=True, log_misses=True):
"""Get a URL via the cache.
If the URL exists in the cache, return the cached value. Otherwise perform the request,
store the resulting content in the cache and return it.
Throws a :c... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:event; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, identifier:event_data; 6, default_parameter; 6, 7; 6, 8; 7, identifier:priority; 8, string:"normal"; 9, default_parameter; 9, 10; 9, 11; 10, identifier:event_method; 11, stri... | def event(self, event_data, priority="normal", event_method="EVENT"):
"""This function will send event packets to the server. This is the
main method you would use to send data from your application to the
server.
Whenever an event is sent to the server, a universally unique event id
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:run; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 13; 5, 14; 5, 34; 5, 56; 5, 57; 5, 72; 5, 82; 5, 83; 5, 89; 5, 90; 5, 96; 5, 97; 5, 228; 5, 229; 5, 233; 5, 234; 5, 247; 5, 248; 5, 249; 5, 375; 5, 376; 5, 385; 5, 393; 6, e... | def run(self):
"""Load climate data and convert to indicator objects
"""
import numpy as np
# get all NUTS region IDs, for linking values to region objects
query = self.session.query(models.NUTS2Region.key,
models.NUTS2Region.id)
region... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 20; 2, function_name:dapply; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:fn; 6, default_parameter; 6, 7; 6, 8; 7, identifier:pairwise; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:symmetric; 11, Tru... | def dapply(self, fn, pairwise=False, symmetric=True, diagonal=False, block=None, **kwargs):
"""
Apply function to each step object in the index
Args:
fn: function to apply. If a list then each function is applied
pairwise: whether to apply the function to pairs of steps
symmetric, d... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_identifySuperGraph; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 30; 5, 38; 5, 47; 5, 75; 5, 81; 5, 90; 5, 99; 5, 351; 5, 361; 5, 371; 6, expression_statement; 6, 7; 7, comment; 8, if_statement; 8, 9; 8, 12; 9, attribute; ... | def _identifySuperGraph(self):
""" A helper function for determining the condensed
representation of the tree. That is, one that does not hold
all of the internal nodes of the graph. The results will be
stored in ContourTree.superNodes and ContourTree.superArcs.
T... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_construct_nx_tree; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:thisTree; 6, default_parameter; 6, 7; 6, 8; 7, identifier:thatTree; 8, None; 9, block; 9, 10; 9, 12; 9, 34; 9, 42; 9, 51; 9, 55; 9, 70; 9, 71; 9, 180; 9, 207... | def _construct_nx_tree(self, thisTree, thatTree=None):
""" A function for creating networkx instances that can be used
more efficiently for graph manipulation than the MergeTree
class.
@ In, thisTree, a MergeTree instance for which we will
construct a networkx... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:_process_tree; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:thisTree; 6, identifier:thatTree; 7, block; 7, 8; 7, 10; 7, 32; 7, 33; 7, 34; 7, 87; 7, 402; 8, expression_statement; 8, 9; 9, comment; 10, if_statement; 10, 11; ... | def _process_tree(self, thisTree, thatTree):
""" A function that will process either a split or join tree
with reference to the other tree and store it as part of
this CT instance.
@ In, thisTree, a networkx.Graph instance representing a
merge tree for which w... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:get_project_content_commit_date; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:root_dir; 6, string:'.'; 7, default_parameter; 7, 8; 7, 9; 8, identifier:exclusions; 9, None; 10, block; 10, 11; 10, 13; 10, 22; 10, 23... | def get_project_content_commit_date(root_dir='.', exclusions=None):
"""Get the datetime for the most recent commit to a project that
affected Sphinx content.
*Content* is considered any file with one of these extensions:
- ``rst`` (README.rst and LICENSE.rst are excluded)
- ``ipynb``
- ``png``... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_table; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:name; 6, block; 6, 7; 6, 9; 6, 93; 6, 94; 6, 154; 6, 155; 6, 177; 6, 178; 6, 203; 7, expression_statement; 7, 8; 8, comment; 9, if_statement; 9, 10; 9, 13; 10, comparison_o... | def get_table(self, name):
"""
Return a table, worksheet pair for the named table
"""
if name is None:
assert self.active_table, "Can't get table without name unless an active table is set"
name = self.active_table.name
if self.active_worksheet:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:assign_valence; 3, parameters; 3, 4; 4, identifier:mol; 5, block; 5, 6; 5, 8; 5, 141; 5, 181; 5, 276; 6, expression_statement; 6, 7; 7, comment; 8, for_statement; 8, 9; 8, 13; 8, 18; 9, pattern_list; 9, 10; 9, 11; 9, 12; 10, identifier:u; 11, i... | def assign_valence(mol):
"""Assign pi electron and hydrogens"""
for u, v, bond in mol.bonds_iter():
if bond.order == 2:
mol.atom(u).pi = 1
mol.atom(v).pi = 1
if mol.atom(u).symbol == "O" and not mol.atom(u).charge:
mol.atom(v).carbonyl_C = 1
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:assign_charge; 3, parameters; 3, 4; 3, 5; 4, identifier:mol; 5, default_parameter; 5, 6; 5, 7; 6, identifier:force_recalc; 7, False; 8, block; 8, 9; 8, 11; 8, 12; 8, 19; 8, 405; 8, 411; 9, expression_statement; 9, 10; 10, comment; 11, comment; ... | def assign_charge(mol, force_recalc=False):
"""Assign charges in physiological condition"""
# TODO: not implemented yet
mol.require("Aromatic")
for i, nbrs in mol.neighbors_iter():
atom = mol.atom(i)
nbrcnt = len(nbrs)
if atom.symbol == "N":
if not atom.pi:
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_get_alphabetical_members; 3, parameters; 3, 4; 3, 5; 4, identifier:obj; 5, identifier:predicate; 6, block; 6, 7; 6, 9; 6, 22; 6, 33; 6, 39; 7, expression_statement; 7, 8; 8, comment; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, ... | def _get_alphabetical_members(obj, predicate):
"""Get members of an object, sorted alphabetically.
Parameters
----------
obj
An object.
predicate : callable
Callable that takes an attribute and returns a bool of whether the
attribute should be returned or not.
Returns
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:run; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 9; 5, 17; 5, 18; 5, 30; 5, 31; 5, 37; 5, 38; 5, 42; 5, 43; 5, 44; 5, 374; 5, 379; 5, 395; 5, 396; 5, 402; 5, 408; 6, expression_statement; 6, 7; 7, comment; 8, comment; 9, e... | def run(self):
"""Run loading of movie appearances.
The wiki page structure for this part cannot be easily handled by simple xpath queries.
We need to iterate over the respective portion of the page and parse appearances.
"""
# make all requests via a cache instance
req... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_argsort; 3, parameters; 3, 4; 3, 5; 4, identifier:y_score; 5, default_parameter; 5, 6; 5, 7; 6, identifier:k; 7, None; 8, block; 8, 9; 8, 11; 8, 19; 8, 29; 8, 43; 9, expression_statement; 9, 10; 10, comment; 11, expression_statement; 11, 12; 1... | def _argsort(y_score, k=None):
"""
Returns the indexes in descending order of the top k score
or all scores if k is None
"""
ranks = y_score.argsort()
argsort = ranks[::-1]
if k is not None:
argsort = argsort[0:k]
return argsort |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:formula; 3, parameters; 3, 4; 4, identifier:mol; 5, block; 5, 6; 5, 8; 5, 15; 5, 22; 5, 28; 5, 202; 5, 227; 5, 231; 5, 263; 6, expression_statement; 6, 7; 7, comment; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; ... | def formula(mol):
"""Chemical formula.
Atoms should be arranged in order of C, H and other atoms.
Molecules should be arranged in order of length of formula text.
"""
mol.require("Valence")
mol.require("Topology")
total_cntr = Counter()
for m in sorted(mols_iter(mol), key=len, reverse=Tr... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_start_action_for_section; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:section; 6, block; 6, 7; 6, 9; 6, 15; 6, 26; 6, 27; 6, 37; 6, 55; 6, 59; 6, 60; 6, 64; 6, 75; 6, 103; 6, 118; 6, 132; 6, 141; 6, 150; 7, expression_statemen... | def _start_action_for_section(self, section):
"""
Start all the actions for a particular section
"""
if section == "configuration":
return
Global.LOGGER.debug("starting actions for section " + section)
# read the configuration of the action
action_co... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:check_completion; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:task; 5, default_parameter; 5, 6; 5, 7; 6, identifier:mark_incomplete; 7, False; 8, default_parameter; 8, 9; 8, 10; 9, identifier:clear; 10, False; 11, default_parameter; ... | def check_completion(task, mark_incomplete=False, clear=False, return_stats=False):
"""Recursively check if a task and all its requirements are complete
Args:
task (derived from luigi.Task): Task to check completion for; check everything 'downstream'
from that task.
mark_incomplete... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_connection_string; 3, parameters; 3, 4; 3, 5; 4, identifier:params; 5, default_parameter; 5, 6; 5, 7; 6, identifier:hide_password; 7, True; 8, block; 8, 9; 8, 11; 8, 19; 8, 29; 8, 39; 8, 49; 8, 59; 8, 69; 8, 79; 8, 80; 8, 109; 8, 110; 8, 17... | def get_connection_string(params, hide_password=True):
"""Get a database connection string
Args:
params (dict): database configuration, as defined in :mod:`ozelot.config`
hide_password (bool): if True, the password is hidden in the returned string
(use this for l... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:movie_network; 3, parameters; 4, block; 4, 5; 4, 7; 4, 8; 4, 17; 4, 18; 4, 24; 4, 25; 4, 33; 4, 41; 4, 42; 4, 43; 4, 44; 4, 45; 4, 78; 4, 87; 4, 88; 4, 106; 4, 115; 4, 116; 4, 167; 4, 176; 4, 177; 4, 178; 4, 179; 4, 201; 4, 202; 4, 208; 4, 214;... | def movie_network():
"""Generate interactive network graph of movie appearances
Output is an html page, rendered to 'movie_network.html' in the output directory.
"""
# page template
template = jenv.get_template("movie_network.html")
# container for template context
context = dict()
# ... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:better_exchook; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 4, identifier:etype; 5, identifier:value; 6, identifier:tb; 7, default_parameter; 7, 8; 7, 9; 8, identifier:debugshell; 9, False; 10, default_parameter; 10, 11; 10, 12... | def better_exchook(etype, value, tb, debugshell=False, autodebugshell=True, file=None, with_color=None):
"""
Replacement for sys.excepthook.
:param etype: exception type
:param value: exception value
:param tb: traceback
:param bool debugshell: spawn a debug shell at the context of the exceptio... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:dump_all_thread_tracebacks; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:exclude_thread_ids; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:file; 9, None; 10, block; 10, 11; 10, 13; 10, 22; 10, 32; 10, 3... | def dump_all_thread_tracebacks(exclude_thread_ids=None, file=None):
"""
Prints the traceback of all threads.
:param set[int]|list[int]|None exclude_thread_ids: threads to exclude
:param io.TextIOBase|io.StringIO file: output stream
"""
if exclude_thread_ids is None:
exclude_thread_ids =... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:_main; 3, parameters; 4, block; 4, 5; 4, 7; 4, 162; 4, 163; 4, 164; 4, 216; 4, 243; 4, 280; 4, 281; 4, 294; 4, 295; 4, 308; 4, 309; 4, 330; 4, 350; 4, 351; 4, 355; 4, 356; 4, 357; 5, expression_statement; 5, 6; 6, comment; 7, if_statement; 7, 8... | def _main():
"""
Some demo.
"""
if sys.argv[1:] == ["test"]:
for k, v in sorted(globals().items()):
if not k.startswith("test_"):
continue
print("running: %s()" % k)
v()
print("ok.")
sys.exit()
elif sys.argv[1:] == ["debug... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:mol_supplier; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:lines; 5, identifier:no_halt; 6, identifier:assign_descriptors; 7, block; 7, 8; 7, 10; 7, 113; 8, expression_statement; 8, 9; 9, comment; 10, function_definition; 10, 11; 10, 12; 10, ... | def mol_supplier(lines, no_halt, assign_descriptors):
"""Yields molecules generated from CTAB text
Args:
lines (iterable): CTAB text lines
no_halt (boolean):
True: shows warning messages for invalid format and go on.
False: throws an exception for it and stop parsing.
... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:render_diagram; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:root_task; 5, identifier:out_base; 6, default_parameter; 6, 7; 6, 8; 7, identifier:max_param_len; 8, integer:20; 9, default_parameter; 9, 10; 9, 11; 10, identifier:hor... | def render_diagram(root_task, out_base, max_param_len=20, horizontal=False, colored=False):
"""Render a diagram of the ETL pipeline
All upstream tasks (i.e. requirements) of :attr:`root_task` are rendered.
Nodes are, by default, styled as simple rects. This style is augmented by any
:attr:`diagram_sty... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:binarize; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:df; 5, identifier:category_classes; 6, default_parameter; 6, 7; 6, 8; 7, identifier:all_classes; 8, True; 9, default_parameter; 9, 10; 9, 11; 10, identifier:dr... | def binarize(df, category_classes, all_classes=True, drop=True,
astype=None, inplace=True, min_freq=None):
"""
Binarize specified categoricals. Works inplace!
Args:
- df: the DataFrame whose columns to binarize
- category_classes: either a dict of (column : [class1, class2, ...... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:find_package_docs; 3, parameters; 3, 4; 3, 5; 4, identifier:package_dir; 5, default_parameter; 5, 6; 5, 7; 6, identifier:skippedNames; 7, None; 8, block; 8, 9; 8, 11; 8, 20; 8, 29; 8, 41; 8, 53; 8, 74; 8, 94; 8, 98; 8, 102; 8, 106; 8, 194; 8, 2... | def find_package_docs(package_dir, skippedNames=None):
"""Find documentation directories in a package using ``manifest.yaml``.
Parameters
----------
package_dir : `str`
Directory of an EUPS package.
skippedNames : `list` of `str`, optional
List of package or module names to skip whe... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_max_id; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, identifier:session; 6, block; 6, 7; 6, 9; 6, 10; 6, 14; 6, 60; 6, 61; 6, 75; 6, 76; 6, 96; 6, 97; 6, 106; 7, expression_statement; 7, 8; 8, comment; 9, comment; 10, expression_stateme... | def get_max_id(cls, session):
"""Get the current max value of the ``id`` column.
When creating and storing ORM objects in bulk, :mod:`sqlalchemy` does not automatically
generate an incrementing primary key ``id``. To do this manually, one needs to know the
current max ``id``. For ORM ob... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_insert_automodapi_configs; 3, parameters; 3, 4; 4, identifier:c; 5, block; 5, 6; 5, 8; 5, 9; 5, 10; 5, 16; 5, 22; 5, 28; 5, 34; 5, 35; 5, 41; 5, 42; 5, 43; 5, 44; 5, 50; 5, 51; 5, 52; 5, 53; 5, 54; 5, 55; 5, 56; 5, 57; 5, 58; 5, 59; 5, 60; 5, ... | def _insert_automodapi_configs(c):
"""Add configurations related to automodapi, autodoc, and numpydoc to the
state.
"""
# Don't show summaries of the members in each class along with the
# class' docstring
c['numpydoc_show_class_members'] = False
c['autosummary_generate'] = True
c['aut... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:build_pipelines_lsst_io_configs; 3, parameters; 3, 4; 3, 5; 3, 6; 4, keyword_separator; 5, identifier:project_name; 6, default_parameter; 6, 7; 6, 8; 7, identifier:copyright; 8, None; 9, block; 9, 10; 9, 12; 9, 13; 9, 20; 9, 24; 9, 34; 9, 35; 9... | def build_pipelines_lsst_io_configs(*, project_name, copyright=None):
"""Build a `dict` of Sphinx configurations that populate the ``conf.py``
of the main pipelines_lsst_io Sphinx project for LSST Science Pipelines
documentation.
The ``conf.py`` file can ingest these configurations via::
from d... |
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:event; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 8; 3, 9; 3, 10; 4, identifier:self; 5, identifier:cuuid; 6, identifier:host; 7, identifier:euuid; 8, identifier:event_data; 9, identifier:timestamp; 10, identifier:priority; 11, block; 11, 12; 1... | def event(self, cuuid, host, euuid, event_data, timestamp, priority):
"""This function will process event packets and send them to legal
checks.
Args:
cuuid (string): The client uuid that the event came from.
host (tuple): The (address, port) tuple of the client.
e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.