sequence
stringlengths
492
15.9k
code
stringlengths
75
8.58k
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, 28; 6, 38; 6, 47; 6, 73; 6, 121; 6, 134; 6, 149; 6, 162; 6, 177; 6, 186; 6, 195; 6, 204; 6, 213; 6, 223; 6, 2...
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, 387; 5, 409; 5, 424; 5, 453; 6, expression_statement; 6, 7; 7, st...
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_source_...
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, 20; 9, 32; 9, 42; 9, 52; 9, 62; 9, 72; 9, 83; 9, 87; ...
def protected(self, *tests, **kwargs): _role = kwargs.pop('role', None) _roles = kwargs.pop('roles', None) or [] _csrf = kwargs.pop('csrf', None) _url_sign_in = kwargs.pop('url_sign_in', None) _request = kwargs.pop('request', None) if _role: _roles.append(_rol...
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, 22; 10, 34; 10, 44; 10, ...
def _verify_multi(self, token, verifying_keys, num_required=None): headers, payload, raw_signatures, signing_inputs = _unpack_token_json(token) if num_required is None: num_required = len(raw_signatures) if num_required > len(verifying_keys): return False if len(h...
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, 14; 9, 23; 9, 27; 9, 50; 9, 95; 9, 105; 9, 118; 9,...
def parse_pic_field(l, c, last_section_node, last_vars, line): parent_node = None raw_tokens = line.split(" ") tokens = [] for t in raw_tokens: if not t.isspace() and t != "": tokens.append(t) try: if tokens[0].upper() == "FD": lvl = 1 else: ...
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, 14; 9, 69; 9, 75; 9, 109; 10, expression_sta...
def getgrouploansurl(idgroup, *args, **kwargs): getparams = [] if kwargs: try: if kwargs["fullDetails"] == True: getparams.append("fullDetails=true") else: getparams.append("fullDetails=false") except Exception as ex: pass ...
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, 14; 9, 69; 9, 75; 9, 109; 10, expression_s...
def getclientloansurl(idclient, *args, **kwargs): getparams = [] if kwargs: try: if kwargs["fullDetails"] == True: getparams.append("fullDetails=true") else: getparams.append("fullDetails=false") except Exception as ex: pass ...
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): from datetime import datetime try: verbose = kwargs['verbose'] except KeyError: verbose = False try: retries = kwargs['retries'] except KeyError: retries = -1 try: force_download_latest = b...
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, 25; 9, 96; 9, 135; 9, 188; 9, 224; 10, if_statement; 10, 11; 10, 17; 11, not_oper...
def send(self, stack: Layers): if not isinstance(stack, Stack): stack = Stack(stack) if 'callback_query' in self._update and stack.has_layer(Update): layer = stack.get_layer(Update) try: msg = self._update['callback_query']['message'] excep...
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): parts = [] chat_id = request.message.get_chat_id() for layer in stack.layers: if isinstance(layer, (lyr.Text, lyr....
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, 33; 9, 88; 9, 102; 9, 108; 10, function_definition...
def setRepayments(self, *args, **kwargs): def duedate(repayment): try: return repayment['dueDate'] except KeyError as kerr: return datetime.now() try: reps = self.mamburepaymentsclass(entid=self['id'], *args, **kwargs) except At...
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, 29; 9, 84; 9, 98; 9, 104; 10, function_definitio...
def setTransactions(self, *args, **kwargs): def transactionid(transaction): try: return transaction['transactionId'] except KeyError as kerr: return None try: trans = self.mambutransactionsclass(entid=self['id'], *args, **kwargs) ...
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, 64; 7, 68; 7, 91; 7, 99; 7, 119; 7, 128; 7, 135; 7, 142; 7, 150; 7, 160; 7, 171; 7, 187; 7, 202; 7, 216; 7, 231; 7, 35...
def _filter(self, environ, params): if self.queries: if 'QUERY_STRING' not in environ: return False available = set(qstr.partition('=')[0] for qstr in environ['QUERY_STRING'].split('&')) required = set(self.queries) if n...
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): names = {} for row in lines: if strip_prefix: row['name'] = row['name'][row['name'].find('-') + 1:] if row['indexed_by'] is not None: row['indexed_by']...
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; 7, if_statement; 7, 8; 7, 9; 7, 85; 8, identifier:arg; 9, block; 9, 10; 9, 81; 10, try_statement; 10, 11; 10, 22; 11, block; 11, 12; 12, expression_state...
def do_help(self, arg): if arg: try: func = getattr(self, 'help_' + arg) except AttributeError: try: doc = getattr(self, 'do_' + arg).__doc__ if doc: self.stdout.write("%s\n" % str(doc)) ...
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): assert issubclass(echoices, EChoice) value_type = echoices.__getvaluetype__() if value_type is str: cls_ = models.CharField elif value_type is int: cls_ = models.IntegerField elif value_type is float: cls_ = m...
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 ): init_data = { ...
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, 18; 8, 155; 9, if_statement; 9, 10; 9, 13; 10, comparison_operator:is; 10, 11; 10, 12; 11, identifi...
def read_headers(rfile, hdict=None): if hdict is None: hdict = {} while True: line = rfile.readline() if not line: raise ValueError("Illegal end of headers.") if line == CRLF: break if not line.endswith(CRLF): raise ValueError("HTTP req...
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, 22; 5, 35; 5, 105; 5, 152; 5, 190; 5, 210; 5, 230; 5, 247; 5, 268; 5, 275; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:hkeys; 9, list_comprehe...
def send_headers(self): hkeys = [key.lower() for key, value in self.outheaders] status = int(self.status[:3]) if status == 413: self.close_connection = True elif "content-length" not in hkeys: if status < 200 or status in (204, 205, 304): pass ...
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, 31; 9, 86; 9, 100; 9, 106; 10, function_definition...
def setActivities(self, *args, **kwargs): def activityDate(activity): try: return activity['activity']['timestamp'] except KeyError as kerr: return None try: activities = self.mambuactivitiesclass(groupId=self['encodedKey'], *args, **kw...
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, 15; 9, 27; 9, 51; 9, 55; 9, 62; 9, 68; 9, 72; 9, 76; 9, ...
def connect(self, *args, **kwargs): from copy import deepcopy if args: self.__args = deepcopy(args) if kwargs: for k,v in kwargs.items(): self.__kwargs[k] = deepcopy(v) jsresp = {} if not self.__urlfunc: return offset = ...
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, 15; 5, 23; 5, 29; 5, 49; 5, 59; 5, 66; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:db; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, ...
def compactor(conf): db = conf.get_database('compactor') limit_map = LimitContainer(conf, db) config = conf['compactor'] if get_int(config, 'max_updates', 0) <= 0: LOG.warning("Compaction is not enabled. Enable it by " "setting a positive integer value for " ...
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; 7, with_statement; 7, 8; 7, 13; 8, with_clause; 8, 9; 9, with_item; 9, 10; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, identifier:lock; 13, block...
def get(self, now): with self.lock: items = self.db.zrangebyscore(self.key, 0, now - self.min_age, start=0, num=1) if not items: return None item = items[0] self.db.zrem(item) return item
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, 29; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:items; 10, call; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, identifie...
def get(self, now): items = self.script(keys=[self.key], args=[now - self.min_age]) return items[0] if items else None
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, 11; 4, 17; 4, 23; 4, 29; 4, 35; 4, 41; 4, 45; 4, 100; 5, expression_statement; 5, 6; 6, assignment; 6, 7; 6, 8; 7, identifier:args; 8, call; 8, 9; 8, 10; 9, identifier:_cli_argument_parser; 10, argume...
def main_cli(): 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): key, value = str_param.split('=') ...
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, 59; 9, 72; 9, 81; 9, 1...
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-suppo...
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: bits = int(encoding[3:]) if bits == 8: data = np.fromfile(fid, dtype=np.ubyte, count=size) if channels > 1: data = data.r...
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, 14; 5, 20; 5, 25; 5, 33; 5, 60; 5, 64; 5, 195; 5, 262; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:collapsed; 9, call; 9, 10; 9, 13; 10, attr...
def refreshButton(self): collapsed = self.isCollapsed() btn = self._collapseButton if not btn: return btn.setMaximumSize(MAX_SIZE, MAX_SIZE) if self.orientation() == Qt.Vertical: btn.setMaximumHeight(12) else: btn.setMaximumWi...
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, 14; 5, 23; 5, 42; 5, 50; 5, 62; 5, 72; 5, 447; 5, 454; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:cursor; 9, call; 9, 10; 9, 13; 10, attribut...
def applyCommand(self): cursor = self.textCursor() cursor.movePosition(cursor.EndOfLine) line = projex.text.nativestring(cursor.block().text()) at_end = cursor.atEnd() modifiers = QApplication.instance().keyboardModifiers() mod_mode = at_end or...
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; 7, try_statement; 7, 8; 7, 244; 8, block; 8, 9; 8, 13; 8, 35; 8, 50; 8, 54; 8, 231; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, i...
def pager(self, lines): try: line_count = 0 if self._output_filename: print(f"Output is also going to '{self.output_file}'") self._output_file = open(self._output_filename, "a+") terminal_columns, terminal_lines = shutil.get_terminal_size(fallb...
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, 13; 5, 30; 5, 53; 5, 76; 5, 98; 5, 120; 5, 124; 5, 201; 5, 205; 5, 282; 5, 365; 5, 379; 5, 393; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:op...
def merge(constraints): operators = defaultdict(set) for constraint in constraints: operators[constraint.operator].add(constraint.version) if gt in operators: gt_ver = sorted(operators[gt])[-1] else: gt_ver = None if ge in operators: ge_ver = sorted(operators[ge])[-1]...
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, 10; 5, 14; 5, 18; 5, 22; 5, 26; 5, 30; 5, 34; 5, 38; 5, 42; 5, 49; 5, 139; 5, 162; 5, 175; 5, 192; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identif...
def parse_baxter(reading): initial = '' medial = '' final = '' tone = '' inienv = True medienv = False finenv = False tonenv = False inichars = "pbmrtdnkgnsyhzl'x" chars = list(reading) for char in chars: if char in 'jw' and not finenv: inienv,medienv,fine...
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, 31; 10, 52; 11, if_statement; 11, 12; 11, 15; 12,...
async def create(self, query, *, dc=None): if "Token" in query: query["Token"] = extract_attr(query["Token"], keys=["ID"]) response = await self._api.post("/v1/query", params={"dc": dc}, data=query) return response.body
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): query_id = extract_attr(query, keys=["ID"]) response = await self._api.get( "/v1/query/%s/execute" % query_id, params={"dc": dc, "near": near, "limit": limit}, c...
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, 11; 6, 15; 6, 19; 6, 23; 6, 69; 6, 94; 6, 253; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:str_localPath;...
def zip_process(**kwargs): str_localPath = "" str_zipFileName = "" str_action = "zip" str_arcroot = "" for k,v in kwargs.items(): if k == 'path': str_localPath = v if k == 'action': str_action = v if k == 'payloadFile': str_zipFile...
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, 11; 6, 15; 6, 19; 6, 23; 6, 69; 6, 151; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:str_fileToSave; 10...
def base64_process(**kwargs): str_fileToSave = "" str_fileToRead = "" str_action = "encode" data = None for k,v in kwargs.items(): if k == 'action': str_action = v if k == 'payloadBytes': data = v if k ==...
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, 13; 8, 19; 8, 35; 8, 46; 8, 57; 8, 63; 8, 76; 8, 80; 8, 84; 8, 95; 8,...
def path_localLocationCheck(self, d_msg, **kwargs): b_pull = False d_meta = d_msg['meta'] if 'do' in d_meta: if d_meta['do'] == 'pull': b_pull = True if 'local' in d_meta: d_local ...
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, 14; 5, 25; 5, 87; 5, 115; 5, 122; 5, 130; 5, 138; 5, 156; 5, 162; 5, 342; 5, 349; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:table; 9, call; 9, 10...
def rebuild(self): table = self.tableType() form = nativestring(self.filterFormat()) if not table and form: if self.layout().count() == 0: self.layout().addWidget(QLabel(form, self)) else: self.layout().itemAt(0).widget().setText(fo...
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): if filter_directory is None: filter_directory = resource_filename('svo_filters', 'data/filters/') p_path = os.path.join(filter_directory, 'filter_list.p') updated = False if not os.path.isfile(p_path): os.system('to...
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, 35; 9, 51; 9, 78; 9, 123; 9, 134; 10, expression_statement; 10, 1...
def parse_unit(prop, dictionary, dt=None): '''Do a fuzzy match for `prop` in the dictionary, taking into account unit suffix.''' try: dt = timezone.parse_datetime(dictionary.get('date_time')) except TypeError: dt = None matches = [k for k in dictionary.keys() if prop in k] try: ...
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, 13; 5, 20; 5, 42; 5, 50; 5, 313; 5, 320; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:self; 10, identifier:setUpdatesEnabled; ...
def rebuild( self ): self.setUpdatesEnabled(False) self.blockSignals(True) for child in self.findChildren(QObject): child.setParent(None) child.deleteLater() schema = self.schema() if ( schema ): self.setEnabled(True) uifil...
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, 14; 5, 28; 5, 36; 5, 48; 5, 52; 5, 61; 5, 249; 5, 267; 5, 273; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:schema; 9, call; 9, 10; 9, 13; 10, attribut...
def save( self ): schema = self.schema() if ( not schema ): self.saved.emit() return record = self.record() if not record: record = self._model() save_data = [] column_edits = self.findChildren(XOrbColumnEdit) for w...
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, 22; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:response; 10, await; 10, 11; 11, call; 11, 12; 11, 17; 12, attribute...
async def register(self, service): response = await self._api.put("/v1/agent/service/register", data=service) return response.status == 200
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, 14; 5, 29; 5, 54; 5, 62; 5, 70; 5, 110; 5, 214; 5, 225; 5, 241; 5, 249; 5, 259; 5, 274; 5, 306; 5, 346; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:re...
def save(self): record = self.record() if not record: logger.warning('No record has been defined for %s.' % self) return False if not self.signalsBlocked(): self.aboutToSaveRecord.emit(record) self.aboutToSave.emit() values = self.s...
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, 15; 5, 30; 5, 39; 5, 72; 5, 143; 5, 161; 5, 281; 5, 290; 5, 325; 5, 329; 5, 339; 5, 349; 5, 359; 5, 369; 5, 389; 5, 397; 5, 404; 6, expression_statement; 6, 7; 7, assignment; ...
def prepare(self): pixmap = self.property('pixmap') if pixmap is not None: return super(XWalkthroughSnapshot, self).prepare() widget = self.property('widget') if type(widget) in (unicode, str): widget = self.findReference(widget) if not widget: ...
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): if not (func is None or inspect.ismethod(func) or inspect.isfunction(func)): raise ValueError("depends decorator can only be used on functions or methods") if not (after or before or priority): raise ValueError("depends decorator ne...
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, 15; 6, 19; 6, 44; 6, 73; 6, 98; 6, 112; 6, 128; 6, 145; 6, 152; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; ...
def _translate_language_name(self, language_name): languages = self.languages() language_id = None for ideone_index, ideone_language in languages.items(): if ideone_language.lower() == language_name.lower(): return ideone_index simple_languages = dict((k,v.spl...
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, 13; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:self; 10, identifier:setSortingEnabled; 11, argument_list; 11, 12...
def headerSortAscending( self ): 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, 13; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:self; 10, identifier:setSortingEnabled; 11, argument_list; 11, 1...
def headerSortDescending( self ): 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, 19; 8, 90; 8, 114; 8, 147; 8, 172; 8, 179; 8, 252; 9, if_statement; 9, 10; 9, 14; 10, n...
def from_api(cls, api, **kwargs): if not cls._api_attrs: raise NotImplementedError() def resolve_attribute_type(attr_type): while isinstance(attr_type, list): attr_type = attr_type[0] if attr_type == 'self': attr_type = cls ...
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, 14; 5, 22; 5, 32; 5, 36; 5, 40; 5, 53; 5, 101; 5, 110; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:rule; 9, call; 9, 10; 9, 13; 10, attribute;...
def updateEditor( self ): rule = self.currentRule() operator = self.currentOperator() widget = self.uiWidgetAREA.widget() editorType = None text = '' if ( rule ): editorType = rule.editorType(operator) if ( widget and editorType ...
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, 15; 7, 23; 7, 27; 7, 31; 7, 46; 7, 77; 7, 108; 7, 119; 7, 130; 7, 147; 7, 153; 7, 159; 7, 163; 7, 167;...
def StreamMetrics(self, request_iterator, context): LOG.debug("StreamMetrics called") collect_args = (next(request_iterator)) max_metrics_buffer = 0 max_collect_duration = 0 cfg = Metric(pb=collect_args.Metrics_Arg.metrics[0]) try: max_metrics_buffer = int(cfg...
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, 14; 5, 25; 5, 49; 5, 53; 5, 66; 5, 90; 5, 105; 6, if_statement; 6, 7; 6, 9; 7, not_operator; 7, 8; 8, identifier:data; 9, block; 9, 10; 10, return_statement; 10, 11; 11, ...
def prepare_node(data): if not data: return None, {} if isinstance(data, str): return data, {} if all(field in data for field in ("Node", "Service", "Checks")): return data["Node"]["Node"], data["Node"] result = {} if "ID" in data: result["Node"] = data["ID"] for ...
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, 14; 5, 25; 5, 49; 5, 102; 5, 117; 5, 121; 5, 134; 5, 156; 6, if_statement; 6, 7; 6, 9; 7, not_operator; 7, 8; 8, identifier:data; 9, block; 9, 10; 10, return_statement...
def prepare_service(data): if not data: return None, {} if isinstance(data, str): return data, {} if all(field in data for field in ("Node", "Service", "Checks")): return data["Service"]["ID"], data["Service"] if all(field in data for field in ("ServiceName", "ServiceID")): ...
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, 23; 5, 37; 5, 50; 5, 61; 5, 76; 5, 84; 5, 95; 5, 116; 5, 122; 6, global_statement; 6, 7; 7, identifier:_buffer_size; 8, if_statement; 8, 9; 8, 11; 9, not_...
def add_measurement(measurement): global _buffer_size if not _enabled: LOGGER.debug('Discarding measurement for %s while not enabled', measurement.database) return if _stopping: LOGGER.warning('Discarding measurement for %s while stopping', ...
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, 32; 11, 40; 11, 49; 1...
def refresh(self, reloadData=False, force=False): if not (self.isVisible() or force): self._refreshTimer.start() return if self.isLoading(): return if reloadData: self.refreshQueryRecords() self._refreshTimer.stop() self.wo...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 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; 10, str...
def tornado_run(app, port=5000, address="", use_gevent=False, start=True, monkey_patch=None, Container=None, Server=None, threadpool=None): if Container is None: from tornado.wsgi import WSGIContainer Container = WSGIContainer if Server is None: from torna...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 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; 11, d...
def tornado_combiner(configs, use_gevent=False, start=True, monkey_patch=None, Container=None, Server=None, threadpool=None): servers = [] if monkey_patch is None: monkey_patch = use_gevent if use_gevent: if monkey_patch: from gevent import monkey ...
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, 14; 5, 24; 5, 31; 5, 41; 5, 47; 5, 55; 5, 93; 5, 101; 5, 109; 5, 116; 5, 123; 5, 130; 5, 139; 5, 150; 5, 161; 5, 165; 5, 174; 5, 182; 5, 221; 5, 228; 5, 451; 5, 490; 5, 497; 6...
def rebuild( self ): navitem = self.currentItem() if ( navitem ): navitem.initialize() self.setUpdatesEnabled(False) self.scrollWidget().show() self._originalText = '' partsw = self.partsWidget() for button in self._buttonGroup.buttons(): s...
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, 17; 8, 25; 8, 30; 8, 38; 8, 46; 8, 54; 8, 68; 8, 80; 8, 85; 8, 102; 9, expression_statement; 9, 10;...
def syncView(self, recursive=False): gantt = self.ganttWidget() tree = self.treeWidget() if not gantt: return vwidget = gantt.viewWidget() scene = vwidget.scene() cell_w = gantt.cellWidth() tree_offset_y = tree.header().height() + 1 t...
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): params = {"dc": dc, "near": near} response = await self._api.get("/v1/catalog/nodes", params=params, watch=watch, ...
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): similarity_measure = similarity_measure or relevance.ASTRelevanceMeasure() table...
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 ): badresponse = 0 if protocol == constants.HMV3_ID: checksum = datal[len(datal) - ...
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): service_id = extract_attr(service, keys=["ServiceID", "ID"]) params = {"dc": dc, "near": near} response = await self._api.get("/v1/health/checks", service_id, ...
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, 19; 9, 37; 9, 53; 9, 62; 9, 129; 10, if_statement; 10, 11; 10...
def get(cap, *args, **kwargs): if 'READTHEDOCS' in os.environ: return '' if kwargs != {}: raise TypeError("get(): No such argument %r" % kwargs.popitem()[0]) if _cache == {}: try: curses.setupterm() except: pass s = _cache.get(cap) if not s: ...
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, 14; 6, 22; 6, 31; 6, 71; 6, 233; 7, expression_statement; 7, 8; 8, call; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:mol; 11, identifier:re...
def draw(canvas, mol): mol.require("ScaleAndCenter") mlb = mol.size2d[2] if not mol.atom_count(): return bond_type_fn = { 1: { 0: single_bond, 1: wedged_single, 2: dashed_wedged_single, 3: wave_single, }, 2: { 0: cw_doub...
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, 32; 9, 59; 9, 64; 9, 78; 9, 106; 9, 131; 9, 231; 10, if_statement; 10,...
def salm2map(salm, s, lmax, Ntheta, Nphi): if Ntheta < 2 or Nphi < 1: raise ValueError("Input values of Ntheta={0} and Nphi={1} ".format(Ntheta, Nphi) + "are not allowed; they must be greater than 1 and 0, respectively.") if lmax < 1: raise ValueError("Input value of lma...
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, 13; 7, 27; 7, 54; 7, 150; 8, import_statement; 8, 9; 9, aliased_import; 9, 10; 9, 12; 10, dotted_name; 10, 11; 11, identifier:...
def map2salm(map, s, lmax): import numpy as np map = np.ascontiguousarray(map, dtype=np.complex128) salm = np.empty(map.shape[:-2]+(N_lm(lmax),), dtype=np.complex128) if map.ndim>2: s = np.ascontiguousarray(s, dtype=np.intc) if s.ndim != map.ndim-2 or np.product(s.shape) != np.product(ma...
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): try: cached = self._query(url, xpath).one() if log_hits: config.logger.info("Request cache hit: " + url) if cached.status_code != requests.codes.ok: ...
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"): logger.debug("event: " + str(event_data)) euuid = uuid.uuid1() logger.debug("<%s> <euuid:%s> Sending event data to server: " "%s" % (str(self.cuuid), str(euuid), str(self.server))) if not self.listener.l...
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, 11; 5, 31; 5, 53; 5, 68; 5, 78; 5, 84; 5, 90; 5, 217; 5, 221; 5, 234; 5, 346; 5, 355; 5, 363; 6, import_statement; 6, 7; 7, aliased_import; 7, 8; 7, 10; 8, dotted_name; 8, 9; 9, i...
def run(self): import numpy as np query = self.session.query(models.NUTS2Region.key, models.NUTS2Region.id) region_ids = self.client.df_query(query).set_index('key')['id'].to_dict() data = next(self.requires()).load() nuts = NUTS2GeoJSONInputFil...
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): search_keys = [k for k, v in kwargs.items() if isinstance(v, list) and len(v) > 1] functions = util.make_list(fn) search = list(product(functions, util.dict_product(kwargs))) results = [] for fn, kw in search...
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, 28; 5, 36; 5, 45; 5, 71; 5, 77; 5, 86; 5, 95; 5, 331; 5, 341; 5, 351; 6, if_statement; 6, 7; 6, 10; 7, attribute; 7, 8; 7, 9; 8, identifier:self; 9, identifier:deb...
def _identifySuperGraph(self): if self.debug: sys.stdout.write("Condensing Graph: ") start = time.clock() G = nx.DiGraph() G.add_edges_from(self.edges) if self.short_circuit: self.superNodes = G.nodes() self.superArcs = G.edges() ...
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, 32; 9, 40; 9, 49; 9, 53; 9, 68; 9, 175; 9, 202; 10, if_state...
def _construct_nx_tree(self, thisTree, thatTree=None): if self.debug: sys.stdout.write("Networkx Tree construction: ") start = time.clock() nxTree = nx.DiGraph() nxTree.add_edges_from(thisTree.edges) nodesOfThatTree = [] if thatTree is not None: ...
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, 30; 7, 83; 7, 359; 8, if_statement; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:self; 11, identif...
def _process_tree(self, thisTree, thatTree): if self.debug: sys.stdout.write("Processing Tree: ") start = time.clock() if len(thisTree.nodes()) > 1: leaves = set( [ v for v in thisTree.nodes() ...
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, 20; 10, 31; 10, 35...
def get_project_content_commit_date(root_dir='.', exclusions=None): logger = logging.getLogger(__name__) extensions = ('rst', 'ipynb', 'png', 'jpeg', 'jpg', 'svg', 'gif') content_paths = [] for extname in extensions: content_paths += get_filepaths_with_extension( extname, ...
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, 91; 6, 151; 6, 173; 6, 198; 7, if_statement; 7, 8; 7, 11; 8, comparison_operator:is; 8, 9; 8, 10; 9, identifier:name; 10, None; 11, block; 11, 12; ...
def get_table(self, name): 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: table = self.active_worksheet.get_table(name) assert tabl...
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, 139; 5, 179; 5, 273; 6, for_statement; 6, 7; 6, 11; 6, 16; 7, pattern_list; 7, 8; 7, 9; 7, 10; 8, identifier:u; 9, identifier:v; 10, identifier:bond; 11, call; 11, 12; 1...
def assign_valence(mol): 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 if mol.atom(v).symbol == "O" and not mol....
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, 16; 8, 398; 8, 404; 9, expression_statement; 9, 10; 10, call; 10, 11; 10, 14; 11, attribute;...
def assign_charge(mol, force_recalc=False): 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: mol.atom(i).charge_phys = 1 elif nbrcnt == 1 and atom.pi == 2: ...
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, 20; 6, 31; 6, 37; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:fields; 10, call; 10, 11; 10, 12; 11...
def _get_alphabetical_members(obj, predicate): fields = dict(inspect.getmembers(obj, predicate)) keys = list(fields.keys()) keys.sort() return {k: fields[k] for k in keys}
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, 14; 5, 26; 5, 32; 5, 36; 5, 346; 5, 351; 5, 367; 5, 373; 5, 379; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:request_cache; 9, call; 9, 10; 9, 13; 10, ...
def run(self): request_cache = cache.get_request_cache() session = client.get_client().create_session() self.mark_incomplete() universes = [] with session.no_autoflush: movies = session.query(models.Movie).all() for movie in movies: article...
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, 17; 8, 27; 8, 41; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:ranks; 1...
def _argsort(y_score, k=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, 13; 5, 20; 5, 26; 5, 200; 5, 225; 5, 229; 5, 261; 6, expression_statement; 6, 7; 7, call; 7, 8; 7, 11; 8, attribute; 8, 9; 8, 10; 9, identifier:mol; 10, identifier:require; 11,...
def formula(mol): mol.require("Valence") mol.require("Topology") total_cntr = Counter() for m in sorted(mols_iter(mol), key=len, reverse=True): cntr = Counter() for i in m: cntr += mol.atom(i).composition() text = [] Cs = cntr.pop("C", 0) if Cs: ...
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, 13; 6, 24; 6, 34; 6, 52; 6, 56; 6, 60; 6, 71; 6, 99; 6, 114; 6, 128; 6, 137; 6, 146; 7, if_statement; 7, 8; 7, 11; 8, comparison...
def _start_action_for_section(self, section): if section == "configuration": return Global.LOGGER.debug("starting actions for section " + section) action_configuration = Global.CONFIG_MANAGER.sections[ section] if len(action_configuration) == 0: Global...
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): to_clear = dict() is_complete, stats = _check_completion(task, mark_incomplete=mark_incomplete, clear=clear, ...
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, 17; 8, 27; 8, 37; 8, 47; 8, 57; 8, 67; 8, 77; 8, 105; 8, 164; 8, 170; 9, expressi...
def get_connection_string(params, hide_password=True): connection_string = params['driver'] + '://' user = params.get('user', None) password = params.get('password', None) host = params.get('host', None) port = params.get('port', None) database = params.get('database', No...
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, 14; 4, 20; 4, 28; 4, 36; 4, 69; 4, 78; 4, 96; 4, 105; 4, 156; 4, 165; 4, 186; 4, 192; 4, 198; 4, 210; 4, 277; 4, 329; 4, 364; 4, 378; 4, 388; 4, 398; 4, 417; 4, 424; 5, expression_statement; 5, 6...
def movie_network(): template = jenv.get_template("movie_network.html") context = dict() cl = client.get_client() session = cl.create_session() query = session.query(models.Movie.id, models.Movie.name, models.Movie.url, mo...
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): if file is None: file = sys.stderr def output(ln): file.write(ln + "\n") color = Color(enable=with_color) output(color("EXCEPTION", color.fg_colors[1], bold=True)) all_locals, all...
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, 20; 10, 30; 10, 33; 11, i...
def dump_all_thread_tracebacks(exclude_thread_ids=None, file=None): if exclude_thread_ids is None: exclude_thread_ids = [] if not file: file = sys.stdout import threading if hasattr(sys, "_current_frames"): print("", file=file) threads = {t.ident: t for t in threading.enu...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:_main; 3, parameters; 4, block; 4, 5; 4, 160; 4, 210; 4, 235; 4, 272; 4, 285; 4, 298; 4, 317; 4, 337; 4, 341; 5, if_statement; 5, 6; 5, 16; 5, 64; 5, 92; 5, 133; 6, comparison_operator:==; 6, 7; 6, 14; 7, subscript; 7, 8; 7, 11; 8, attribute; 8...
def _main(): 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_shell"]: debug_shell(loc...
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, 111; 8, function_definition; 8, 9; 8, 10; 8, 12; 9, function_name:sdf_block; 10, parameters; 10, 11;...
def mol_supplier(lines, no_halt, assign_descriptors): def sdf_block(lns): mol = [] opt = [] is_mol = True for line in lns: if line.startswith("$$$$"): yield mol[:], opt[:] is_mol = True mol.clear() opt.clear(...
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): import re import codecs import subprocess from ozelot import config from ozelot.etl.tasks import get_task_name, get_task_param_string lines = [u"digraph G {"] if horizontal: lines.append(u"ran...
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): if type(category_classes) is not dict: columns = set(category_classes) category_classes = {column: df[column].unique() for column in columns} else: columns = category_c...
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, 18; 8, 27; 8, 39; 8, 51; 8, 72; 8, 92; 8, 96; 8, 100; 8, 104; 8, 191; 8, 261; 8, ...
def find_package_docs(package_dir, skippedNames=None): logger = logging.getLogger(__name__) if skippedNames is None: skippedNames = [] doc_dir = os.path.join(package_dir, 'doc') modules_yaml_path = os.path.join(doc_dir, 'manifest.yaml') if not os.path.exists(modules_yaml_path): raise...
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, 11; 6, 56; 6, 70; 6, 90; 6, 99; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:id_base; 10, None; 11, for_statement; 1...
def get_max_id(cls, session): id_base = None for c in [cls] + list(cls.__bases__): for base_class in c.__bases__: if base_class.__name__ == 'Base': if id_base is None: id_base = c else: ra...
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, 12; 5, 18; 5, 24; 5, 30; 5, 36; 5, 42; 5, 50; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 11; 8, subscript; 8, 9; 8, 10; 9, identifier:c; 10, string...
def _insert_automodapi_configs(c): c['numpydoc_show_class_members'] = False c['autosummary_generate'] = True c['automodapi_toctreedirnm'] = 'py-api' c['automodsumm_inherited_members'] = True c['autodoc_inherit_docstrings'] = True c['autoclass_content'] = "class" c['autodoc_default_flags'] = ...
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, 17; 9, 21; 9, 31; 9, 44; 9, 51; 9, 58; 9...
def build_pipelines_lsst_io_configs(*, project_name, copyright=None): sys.setrecursionlimit(2000) c = {} c = _insert_common_sphinx_configs( c, project_name=project_name) c = _insert_html_configs( c, project_name=project_name, short_project_name=project_name) c...
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): response = None if host in self.encrypted_hosts: logger.debug("Encrypted!") client_key = self.registry[cuuid]["encryption"] else: logger.debug("Not encrypted :<") client_key = No...