sequence
stringlengths
492
15.9k
code
stringlengths
75
8.58k
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 32; 2, function_name:usearch_chimera_filter_de_novo; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:fasta_filepath; 5, default_parameter; 5, 6; 5, 7; 6, identifier:output_chimera_filepath; 7, None; 8, default_parame...
def usearch_chimera_filter_de_novo( fasta_filepath, output_chimera_filepath=None, output_non_chimera_filepath=None, abundance_skew=2.0, log_name="uchime_de_novo_chimera_filtering.log", usersort=False, HALT_EXEC=False, save_intermediate_files=False, ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 56; 2, function_name:usearch_cluster_seqs_ref; 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; 3, 41; 3, 44; 3, 47; 3, 50; 3, 53; 4, identifier:fasta_filepath; 5, default_parameter; 5, 6; 5, 7; 6, identifier:o...
def usearch_cluster_seqs_ref( fasta_filepath, output_filepath=None, percent_id=0.97, sizein=True, sizeout=True, w=64, slots=16769023, maxrejects=64, log_name="usearch_cluster_seqs.log", usersort=True, HALT_EXEC=False, save_i...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 30; 2, function_name:assign_reads_to_otus; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 3, 27; 4, identifier:original_fasta; 5, identifier:filtered_fasta; 6, default_parameter; 6, 7; 6, 8; 7, identifier:output_filepath; 8, None; 9, def...
def assign_reads_to_otus(original_fasta, filtered_fasta, output_filepath=None, log_name="assign_reads_to_otus.log", perc_id_blast=0.97, global_alignment=True, HALT_EXEC=F...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 32; 2, function_name:sort_by_abundance_usearch61; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 3, 29; 4, identifier:seq_path; 5, default_parameter; 5, 6; 5, 7; 6, identifier:output_dir; 7, string:'.'; 8, default_parameter; 8, 9; 8, 10...
def sort_by_abundance_usearch61(seq_path, output_dir='.', rev=False, minlen=64, remove_usearch_logs=False, HALT_EXEC=False, outp...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:sort_by_length_usearch61; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 4, identifier:seq_path; 5, default_parameter; 5, 6; 5, 7; 6, identifier:output_dir; 7, string:"."; 8, default_parameter; 8, 9; 8, 10; 9, identifier:minlen; ...
def sort_by_length_usearch61(seq_path, output_dir=".", minlen=64, remove_usearch_logs=False, HALT_EXEC=False, output_fna_filepath=None, log_name="...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 38; 2, function_name:usearch61_fast_cluster; 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; 4, identifier:intermediate_fasta; 5, default_parameter; 5, 6; 5, 7; 6, identifier:percent_id; 7, float:0.97; 8, default_par...
def usearch61_fast_cluster(intermediate_fasta, percent_id=0.97, minlen=64, output_dir=".", remove_usearch_logs=False, wordlength=8, usearch61_maxrejects=8, ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 47; 2, function_name:usearch61_smallmem_cluster; 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; 3, 41; 3, 44; 4, identifier:intermediate_fasta; 5, default_parameter; 5, 6; 5, 7; 6, identifier:percent_id; 7, f...
def usearch61_smallmem_cluster(intermediate_fasta, percent_id=0.97, minlen=64, rev=False, output_dir=".", remove_usearch_logs=False, w...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:normalize; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 49; 8, for_statement; 8, 9; 8, 12; 8, 20; 9, pattern_list; 9, 10; 9, 11; 10, identifier:key; 11, identifier:of...
def normalize(self, **kwargs): for key, offset in sorted(kwargs.items()): if key in self: delta = offset - self[key] for key in self.keys(): self[key] += delta break return self
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 15; 2, function_name:_modifyInternal; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:self; 5, keyword_separator; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:purge; 11, False; 12, de...
def _modifyInternal(self, *, sort=None, purge=False, done=None): sortAll, sortLevels = sort is not None and sort or ([], {}) doneAll, doneLevels = done is not None and done or ([], {}) def _mark(v, i): if done is None: return v[:4] def _mark_(index, regexp...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_getPattern; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:ipattern; 6, default_parameter; 6, 7; 6, 8; 7, identifier:done; 8, None; 9, block; 9, 10; 9, 17; 9, 42; 9, 51; 9, 72; 9, 127; 9, 133; 9, 139; 9, 365; 10, if_stateme...
def _getPattern(self, ipattern, done=None): if ipattern is None: return None if ipattern is True: if done is not None: return ([(None, None, done)], {}) return ([(0, False)], {}) def _getReverse(pm): return pm == '-' def _ge...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 19; 2, function_name:view; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:sort; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:purge; 10, False; 11, default_parameter; 11, 12; 11...
def view(self, sort=None, purge=False, done=None, undone=None, **kwargs): View(self.model.modify( sort=self._getPattern(sort), purge=purge, done=self._getDone(done, undone) ), **kwargs)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 17; 2, function_name:modify; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:sort; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:purge; 10, False; 11, default_parameter; 11, 12; 11, 13;...
def modify(self, sort=None, purge=False, done=None, undone=None): self.model.modifyInPlace( sort=self._getPattern(sort), purge=purge, done=self._getDone(done, undone) )
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:inorder; 3, parameters; 3, 4; 3, 6; 4, list_splat_pattern; 4, 5; 5, identifier:iterables; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 19; 8, 32; 8, 48; 8, 52; 8, 89; 8, 94; 8, 107; 8, 113; 8, 175; 8, 185; 8, 188;...
def inorder(*iterables, **kwargs): reverse = kwargs.pop("reverse", False) keyfunc = kwargs.pop("key", lambda x: x) if kwargs: raise TypeError("invalid keyword argument '%s'" % kwargs.keys()[0]) nextvals = {} for iterable in iterables: next = iter(iterable).next try: nextval = next() nextvals[next] = ke...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:add_tag; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:tag; 6, identifier:value; 7, block; 7, 8; 7, 20; 7, 24; 7, 46; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:index; 11, call; 11, 12; 11, 1...
def add_tag(self, tag, value): index = bisect_left(self.tags, (tag, value)) contains = False if index < len(self.tags): contains = self.tags[index] == (tag, value) if not contains: self.tags.insert(index, (tag, value))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:sort; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:self; 5, identifier:key; 6, default_parameter; 6, 7; 6, 8; 7, identifier:by; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:external; 11...
def sort(self, key, by=None, external=None, offset=0, limit=None, order=None, alpha=False, store_as=None): if order and order not in [b'ASC', b'DESC', 'ASC', 'DESC']: raise ValueError('invalid sor...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:zrange; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 13; 4, identifier:self; 5, identifier:key; 6, default_parameter; 6, 7; 6, 8; 7, identifier:start; 8, integer:0; 9, default_parameter; 9, 10; 9, 11; 10, identifier:stop; 11, unary_operator:-; 11...
def zrange(self, key, start=0, stop=-1, with_scores=False): command = [b'ZRANGE', key, start, stop] if with_scores: command += ['WITHSCORES'] return self._execute(command)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:zrem; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:key; 6, list_splat_pattern; 6, 7; 7, identifier:members; 8, block; 8, 9; 9, return_statement; 9, 10; 10, call; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, identifie...
def zrem(self, key, *members): return self._execute([b'ZREM', key] + list(members))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:zremrangebyscore; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:key; 6, identifier:min_score; 7, identifier:max_score; 8, block; 8, 9; 9, return_statement; 9, 10; 10, call; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 1...
def zremrangebyscore(self, key, min_score, max_score): return self._execute([b'ZREMRANGEBYSCORE', key, min_score, max_score])
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 16; 2, function_name:zrevrange; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 13; 4, identifier:self; 5, identifier:key; 6, default_parameter; 6, 7; 6, 8; 7, identifier:start; 8, integer:0; 9, default_parameter; 9, 10; 9, 11; 10, identifier:stop; 11, unary_operator:-;...
def zrevrange(self, key, start=0, stop=-1, with_scores=False): command = [b'ZREVRANGE', key, start, stop] if with_scores: command += ['WITHSCORES'] return self._execute(command)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_sortObjects; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:orderby; 6, string:'created'; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 14; 9, 36; 9, 46; 9, 55; 9, 83; 10, expression_s...
def _sortObjects(orderby='created', **kwargs): o = [] for m in kwargs.values(): for l in iter(m): o.append(l) o = list(set(o)) sortfunc = _sortByCreated if orderby == 'created' else _sortByModified if six.PY2: o.sort(sortfunc) else: o.sort(key=functools.cmp_to...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_sortByCreated; 3, parameters; 3, 4; 3, 5; 4, identifier:a; 5, identifier:b; 6, block; 6, 7; 7, if_statement; 7, 8; 7, 15; 7, 18; 7, 30; 8, comparison_operator:<; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:a; 11, identifier:created...
def _sortByCreated(a, b): if a.created < b.created: return 1 elif a.created > b.created: return -1 else: return 0
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_sortByModified; 3, parameters; 3, 4; 3, 5; 4, identifier:a; 5, identifier:b; 6, block; 6, 7; 7, if_statement; 7, 8; 7, 15; 7, 18; 7, 30; 8, comparison_operator:<; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:a; 11, identifier:modifi...
def _sortByModified(a, b): if a.modified < b.modified: return 1 elif a.modified > b.modified: return -1 else: return 0
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 31; 2, function_name:wngram2idngram; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 3, 10; 3, 13; 3, 16; 3, 19; 3, 22; 3, 25; 3, 28; 4, identifier:input_file; 5, identifier:vocab_file; 6, identifier:output_file; 7, default_parameter; 7, 8; 7, 9; 8, identifier:buffersize; ...
def wngram2idngram(input_file, vocab_file, output_file, buffersize=100, hashtablesize=2000000, files=20, compress=False, verbosity=2, n=3, write_ascii=False, fof_size=10): cmd = ['wngram2idngram', '-vocab', os.path.abspath(vocab_file), '-idngram', os.path.abspath(output_file)] if bu...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:get_top; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:stat; 6, identifier:n; 7, block; 7, 8; 8, return_statement; 8, 9; 9, subscript; 9, 10; 9, 29; 10, call; 10, 11; 10, 12; 11, identifier:sorted; 12, argument_list; 12, 13...
def get_top(self, stat, n): return sorted(self.stats, key=lambda x: getattr(x, stat), reverse=True)[:n]
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:toposort; 3, parameters; 3, 4; 3, 5; 4, identifier:initialAtoms; 5, identifier:initialBonds; 6, block; 6, 7; 6, 11; 6, 17; 6, 21; 6, 27; 6, 31; 6, 35; 6, 51; 6, 63; 6, 69; 6, 74; 6, 142; 6, 152; 6, 164; 6, 178; 6, 180; 6, 185; 7, expression_sta...
def toposort(initialAtoms, initialBonds): atoms = [] a_append = atoms.append bonds = [] b_append = bonds.append ahash = {} bhash = {} for atom in initialAtoms[1:]: ahash[atom.handle] = 1 for bond in initialBonds: bhash[bond.handle] = bond next = initialAtoms[0] a_...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:flip_uuid_parts; 3, parameters; 3, 4; 4, identifier:uuid; 5, block; 5, 6; 5, 15; 5, 31; 5, 40; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:flipped_uuid; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, ident...
def flip_uuid_parts(uuid): flipped_uuid = uuid.split('-') flipped_uuid[0], flipped_uuid[2] = flipped_uuid[2], flipped_uuid[0] flipped_uuid = '-'.join(flipped_uuid) return flipped_uuid
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:SortedSet; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:name; 6, default_parameter; 6, 7; 6, 8; 7, identifier:initial; 8, None; 9, block; 9, 10; 10, return_statement; 10, 11; 11, call; 11, 12; 11, 15; 12, attribute; 12, 13...
def SortedSet(self, name, initial=None): return types.SortedSet(name, self.api, initial)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:add; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:member; 6, identifier:score; 7, block; 7, 8; 8, return_statement; 8, 9; 9, call; 9, 10; 9, 15; 10, attribute; 10, 11; 10, 14; 11, attribute; 11, 12; 11, 13; 12, identifier:...
def add(self, member, score): return self.client.zadd(self.name, member, score)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:deserialize; 3, parameters; 3, 4; 3, 5; 4, identifier:cls; 5, identifier:value; 6, block; 6, 7; 6, 16; 6, 26; 6, 36; 6, 47; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:parsed; 10, call; 10, 11; 10, 14; 11, attribute...
def deserialize(cls, value): parsed = json.loads(value) if "name" not in parsed: raise ValueError("No peer name.") if "ip" not in parsed: raise ValueError("No peer IP.") if "port" not in parsed: parsed["port"] = DEFAULT_PEER_PORT return cls(par...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:apply_config; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:config; 6, block; 6, 7; 6, 19; 6, 37; 6, 45; 6, 57; 6, 63; 6, 73; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:s...
def apply_config(self, config): self.host = config.get("host", "127.0.0.1") self.configured_ports = config.get("ports", [config.get("port")]) self.discovery = config["discovery"] self.metadata = config.get("metadata", {}) self.update_ports() self.check_interval = config["...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:get_key; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:key; 6, None; 7, default_parameter; 7, 8; 7, 9; 8, identifier:keyfile; 9, None; 10, block; 10, 11; 10, 68; 11, if_statement; 11, 12; 11, 15; 12, comparison_ope...
def get_key(key=None, keyfile=None): if key is None: if keyfile is None: key = environ.get('CRYPTOYAML_SECRET') if key is None: raise MissingKeyException( '''You must either provide a key value,''' ''' a path to a key or its val...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 27; 2, function_name:getList; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 3, 21; 3, 24; 4, identifier:self; 5, identifier:full_path; 6, default_parameter; 6, 7; 6, 8; 7, identifier:type; 8, integer:1; 9, default_parameter; 9, 10; 9, 11; 10, identif...
def getList(self, full_path, type = 1, dept = 0, sort = 'name', order = 'asc', startnum = 0, pagingrow = 1000, dummy = 56184): if type not in range(1, 6): print "Error getList: `type` should be between 1 to 5" return False data = {'orgresource': full_path, 'type':...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:list_assignment_groups; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:course_id; 6, default_parameter; 6, 7; 6, 8; 7, identifier:exclude_assignment_submission_types; 8, None; 9, default_parameter...
def list_assignment_groups(self, course_id, exclude_assignment_submission_types=None, grading_period_id=None, include=None, override_assignment_dates=None, scope_assignments_to_student=None): path = {} data = {} params = {} path["course_id"] = course_id if include is not Non...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_sorted_keys; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 39; 6, try_statement; 6, 7; 6, 16; 7, block; 7, 8; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:keys; 11, subscript; 11, 12; 11, 15; 12, att...
def _sorted_keys(self): try: keys = self._cache['sorted_keys'] except KeyError: keys = self._cache['sorted_keys'] = sorted(self.keys(), key=parse_version) return keys
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:query; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:self; 5, identifier:query; 6, default_parameter; 6, 7; 6, 8; 7, identifier:filters; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:columns; 11, None;...
def query(self, query, filters=None, columns=None, sort=None, start=0, rows=30): if not columns: columns = ["*", "score"] fields = {"q": query, "json.nl" :"map", "fl": ",".join(columns), "start": str(start), "rows": str(rows...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 21; 2, function_name:search_videohub; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 3, 15; 3, 18; 4, identifier:cls; 5, identifier:query; 6, default_parameter; 6, 7; 6, 8; 7, identifier:filters; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:status; 1...
def search_videohub(cls, query, filters=None, status=None, sort=None, size=None, page=None): url = getattr(settings, "VIDEOHUB_API_SEARCH_URL", cls.DEFAULT_VIDEOHUB_API_SEARCH_URL) headers = { "Content-Type": "application/json", "Authorization": settings.VIDEOHUB_API_TOKEN, ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:insert; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:key; 6, identifier:value; 7, block; 7, 8; 7, 15; 7, 25; 8, expression_statement; 8, 9; 9, call; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identifier:self; 12, ide...
def insert(self, key, value): self._find_lte(key) node = self._create_node(key, value) self._insert(node)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:sort; 3, parameters; 3, 4; 3, 5; 3, 7; 4, identifier:self; 5, list_splat_pattern; 5, 6; 6, identifier:sorting; 7, dictionary_splat_pattern; 7, 8; 8, identifier:kwargs; 9, block; 9, 10; 9, 14; 9, 61; 9, 74; 10, expression_statement; 10, 11; 11, ...
def sort(self, *sorting, **kwargs): sorting_ = [] for name, desc in sorting: field = self.meta.model._meta.fields.get(name) if field is None: continue if desc: field = field.desc() sorting_.append(field) if sorting_:...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:split; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:indices; 6, block; 6, 7; 7, return_statement; 7, 8; 8, list_comprehension; 8, 9; 8, 16; 9, call; 9, 10; 9, 11; 10, identifier:LogicalNetworkList; 11, argument_list; 11, 12; 11,...
def split(self, indices): return [LogicalNetworkList(self.hg, part) for part in np.split(self.__matrix, indices)]
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 7; 2, function_name:movies_box_office; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, dictionary_splat_pattern; 5, 6; 6, identifier:kwargs; 7, block; 7, 8; 7, 17; 7, 27; 7, 34; 8, expression_statement; 8, 9; 9, assignment; 9, 10; 9, 11; 10, identifier:path; 11,...
def movies_box_office(self, **kwargs): path = self._get_path('movies_box_office') response = self._GET(path, kwargs) self._set_attrs_to_values(response) return response
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:get_parents; 3, parameters; 4, block; 4, 5; 4, 14; 4, 28; 4, 49; 5, expression_statement; 5, 6; 6, assignment; 6, 7; 6, 8; 7, identifier:distributions; 8, call; 8, 9; 8, 10; 9, identifier:get_installed_distributions; 10, argument_list; 10, 11; ...
def get_parents(): distributions = get_installed_distributions(user_only=ENABLE_USER_SITE) remaining = {d.project_name.lower() for d in distributions} requirements = {r.project_name.lower() for d in distributions for r in d.requires()} return get_realnames(remaining - requirements)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_realnames; 3, parameters; 3, 4; 4, identifier:packages; 5, block; 5, 6; 6, return_statement; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:sorted; 9, argument_list; 9, 10; 9, 20; 10, set_comprehension; 10, 11; 10, 17; 11, attribute; 11, 12; 11, ...
def get_realnames(packages): return sorted({get_distribution(p).project_name for p in packages}, key=lambda n: n.lower())
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:build_sort; 3, parameters; 4, block; 4, 5; 4, 7; 4, 18; 4, 30; 4, 43; 5, expression_statement; 5, 6; 6, string:'''Build sort query paramter from kwargs'''; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:sorts; 10, call...
def build_sort(): '''Build sort query paramter from kwargs''' sorts = request.args.getlist('sort') sorts = [sorts] if isinstance(sorts, basestring) else sorts sorts = [s.split(' ') for s in sorts] return [{SORTS[s]: d} for s, d in sorts if s in SORTS]
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort; 3, parameters; 3, 4; 4, identifier:transactions; 5, block; 5, 6; 6, return_statement; 6, 7; 7, subscript; 7, 8; 7, 34; 8, call; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:transactions; 11, identifier:sort; 12, argument_list; ...
def sort(transactions): return transactions.sort(key=lambda x: datetime.datetime.strptime(x.split(':')[0], '%Y-%m-%d'))[:]
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:duplicates; 3, parameters; 3, 4; 3, 5; 4, identifier:base; 5, identifier:items; 6, block; 6, 7; 7, for_statement; 7, 8; 7, 9; 7, 10; 8, identifier:item; 9, identifier:items; 10, block; 10, 11; 11, if_statement; 11, 12; 11, 26; 12, boolean_opera...
def duplicates(base, items): for item in items: if item.similarity(base) and not item.equality(base): yield item
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:sort; 3, parameters; 3, 4; 3, 5; 4, identifier:base; 5, identifier:items; 6, block; 6, 7; 7, return_statement; 7, 8; 8, call; 8, 9; 8, 10; 9, identifier:sorted; 10, argument_list; 10, 11; 10, 12; 10, 17; 11, identifier:items; 12, keyword_argume...
def sort(base, items): return sorted(items, key=base.similarity, reverse=True)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:Subclasses; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:cls; 5, default_parameter; 5, 6; 5, 7; 6, identifier:sort_by; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:reverse; 10, False; 11, block; 11, 12; 11, 18; 11, 48; 11, 57; 1...
def Subclasses(cls, sort_by=None, reverse=False): l = list() for attr, value in get_all_attributes(cls): try: if issubclass(value, Constant): l.append((attr, value)) except: pass if sort_by is None: sort_by =...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:subclasses; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:sort_by; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:reverse; 10, False; 11, block; 11, 12; 11, 18; 11, 47; 12, expr...
def subclasses(self, sort_by=None, reverse=False): l = list() for attr, _ in self.Subclasses(sort_by, reverse): value = getattr(self, attr) l.append((attr, value)) return l
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:organize_dir; 3, parameters; 3, 4; 4, identifier:orig_dir; 5, block; 5, 6; 5, 8; 5, 24; 5, 33; 5, 46; 5, 53; 5, 109; 5, 116; 5, 122; 5, 342; 6, expression_statement; 6, 7; 7, string:'''scans through the given directory and organizes DICOMs that...
def organize_dir(orig_dir): '''scans through the given directory and organizes DICOMs that look similar into subdirectories output directory is the ``orig_dir`` with ``-sorted`` appended to the end''' tags = [ (0x10,0x20), (0x8,0x21), (0x8,0x31), (0x8,0x103e) ] orig_d...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:reconstruct_files; 3, parameters; 3, 4; 4, identifier:input_dir; 5, block; 5, 6; 5, 8; 5, 17; 6, expression_statement; 6, 7; 7, string:'''sorts ``input_dir`` and tries to reconstruct the subdirectories found'''; 8, expression_statement; 8, 9; 9...
def reconstruct_files(input_dir): '''sorts ``input_dir`` and tries to reconstruct the subdirectories found''' input_dir = input_dir.rstrip('/') with nl.notify('Attempting to organize/reconstruct directory'): for r,ds,fs in os.walk(input_dir): for f in fs: if f[0]=='.': ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:lint; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:targets; 6, block; 6, 7; 6, 13; 6, 23; 6, 45; 6, 57; 6, 67; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:LinterRunner; 1...
def lint(self, targets): LinterRunner.targets = targets linters = self._config.get_linter_classes() with Pool() as pool: out_err_none = pool.map(LinterRunner.run, linters) out_err = [item for item in out_err_none if item is not None] stdout, stderr = zip(*out_err) ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:_linear_interp; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:curve; 5, identifier:test_x; 6, default_parameter; 6, 7; 6, 8; 7, identifier:round_result; 8, False; 9, block; 9, 10; 9, 14; 10, expression_statement; 10, 11; 11, assignment; 11, 12...
def _linear_interp(curve, test_x, round_result=False): index = 0 for index in range(len(curve) - 1): if curve[index][0] == curve[index + 1][0]: continue if curve[index][0] <= test_x <= curve[index + 1][0]: slope = ((curve[index + 1][1] - curve[index][1]) / ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:bound_weights; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:weights; 5, default_parameter; 5, 6; 5, 7; 6, identifier:minimum; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:maximum; 10, None; 11, block; 11, 12; 11, 19; 11, 92; 11,...
def bound_weights(weights, minimum=None, maximum=None): bounded_weights = weights[:] if minimum is not None and maximum is not None: if maximum < minimum: raise ValueError bounded_weights = [bw for bw in bounded_weights if minimum <= bw[0] <= maximum] e...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:weighted_rand; 3, parameters; 3, 4; 3, 5; 4, identifier:weights; 5, default_parameter; 5, 6; 5, 7; 6, identifier:round_result; 7, False; 8, block; 8, 9; 8, 23; 8, 38; 8, 46; 8, 55; 8, 59; 8, 72; 8, 76; 9, if_statement; 9, 10; 9, 16; 10, compari...
def weighted_rand(weights, round_result=False): if len(weights) == 1: return weights[0][0] weights = sorted(weights, key=lambda w: w[0]) x_min = weights[0][0] x_max = weights[-1][0] y_min = 0 y_max = max([point[1] for point in weights]) attempt_count = 0 while attempt_count < 500...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:_cmp_key; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:obj; 7, None; 8, block; 8, 9; 8, 17; 8, 31; 8, 45; 9, if_statement; 9, 10; 9, 12; 10, not_operator; 10, 11; 11, identifier:obj; 12, block; ...
def _cmp_key(self, obj=None): if not obj: obj = self line_nr = int(obj.line_nr) if obj.line_nr else 0 col = int(obj.col) if obj.col else 0 return (obj.path, line_nr, col, obj.msg)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_create_output_from_match; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:match_result; 6, block; 6, 7; 6, 13; 6, 22; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:full_path; 10, subscript; 10, 11; 10, 1...
def _create_output_from_match(self, match_result): full_path = match_result['full_path'] path = self._get_relative_path(full_path) return LinterOutput(self.name, path, match_result['msg'])
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:get_cached_filename; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 7; 4, identifier:self; 5, identifier:filename; 6, identifier:extention; 7, default_parameter; 7, 8; 7, 9; 8, identifier:settings_list; 9, None; 10, block; 10, 11; 10, 26; 11, expression_...
def get_cached_filename(self, filename, extention, settings_list=None): cached_name = "_".join([filename, self.get_hash()]) return ".".join([cached_name, extention])
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 10; 2, function_name:sort_func; 3, parameters; 3, 4; 3, 7; 4, default_parameter; 4, 5; 4, 6; 5, identifier:variant; 6, identifier:VARIANT1; 7, default_parameter; 7, 8; 7, 9; 8, identifier:case_sensitive; 9, False; 10, block; 10, 11; 11, return_statement; 11, 12; 1...
def sort_func(variant=VARIANT1, case_sensitive=False): return lambda x: normalize( x, variant=variant, case_sensitive=case_sensitive)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_notify_reader_writes; 3, parameters; 3, 4; 4, identifier:writeto; 5, block; 5, 6; 5, 10; 5, 43; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:satisfied; 9, list:[]; 10, for_statement; 10, 11; 10, 12; 10, 13; 11, ident...
def _notify_reader_writes(writeto): satisfied = [] for var in writeto: if var.readable: for reader in var.readers: reader.notify_read_ready() if reader.satisfied: satisfied.append(reader) return Closure.sort(satisfied)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:getFilePathsWithExtensionsInDirectory; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:dirTree; 5, identifier:patterns; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort; 8, True; 9, block; 9, 10; 9, 14; 9, 63; 9, 72; 10, expression_statement...
def getFilePathsWithExtensionsInDirectory(dirTree, patterns, sort=True): filePaths = [] for root, dirs, files in os.walk(dirTree): for filePath in files: for pattern in patterns: if fnmatch.fnmatch(filePath, pattern): fullPath = os.path.join(root, filePath...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:shellsort; 3, parameters; 3, 4; 4, identifier:inlist; 5, block; 5, 6; 5, 13; 5, 22; 5, 29; 5, 35; 5, 130; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:n; 9, call; 9, 10; 9, 11; 10, identifier:len; 11, argument_list; 1...
def shellsort(inlist): n = len(inlist) svec = copy.deepcopy(inlist) ivec = range(n) gap = n / 2 while gap > 0: for i in range(gap, n): for j in range(i - gap, -1, -gap): while j >= 0 and svec[j] > svec[j + gap]: temp = svec[j] ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:rankdata; 3, parameters; 3, 4; 4, identifier:inlist; 5, block; 5, 6; 5, 13; 5, 22; 5, 26; 5, 30; 5, 37; 5, 114; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:n; 9, call; 9, 10; 9, 11; 10, identifier:len; 11, argument_l...
def rankdata(inlist): n = len(inlist) svec, ivec = shellsort(inlist) sumranks = 0 dupcount = 0 newlist = [0] * n for i in range(n): sumranks = sumranks + i dupcount = dupcount + 1 if i == n - 1 or svec[i] != svec[i + 1]: averank = sumranks / float(dupcount) + ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 12; 2, function_name:to_json; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 4, identifier:self; 5, keyword_separator; 6, default_parameter; 6, 7; 6, 8; 7, identifier:indent; 8, None; 9, default_parameter; 9, 10; 9, 11; 10, identifier:sort_keys; 11, False; 12, block; 12, ...
def to_json(self, *, indent=None, sort_keys = False): return json.dumps({k: v for k, v in dict(self).items() if v is not None}, indent=indent, sort_keys=sort_keys, default=self._try_dict)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:get_sort_field; 3, parameters; 3, 4; 3, 5; 4, identifier:attr; 5, identifier:model; 6, block; 6, 7; 7, try_statement; 7, 8; 7, 21; 8, block; 8, 9; 9, if_statement; 9, 10; 9, 18; 10, call; 10, 11; 10, 16; 11, attribute; 11, 12; 11, 15; 12, attri...
def get_sort_field(attr, model): try: if model._meta.get_field(attr): return attr except FieldDoesNotExist: if isinstance(attr, basestring): val = getattr(model, attr, None) if val and hasattr(val, 'sort_field'): return getattr(model, attr).sor...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sorted_query_paths; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 6, return_statement; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:list; 9, argument_list; 9, 10; 10, call; 10, 11; 10, 12; 11, identifier:reversed; 12, argument_list; 12, ...
def sorted_query_paths(self): return list(reversed(sorted(p[0] for p in self.namespace.alias_to_query_paths.get(self.name))))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:add_arguments; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:actions; 6, block; 6, 7; 6, 22; 7, expression_statement; 7, 8; 8, assignment; 8, 9; 8, 10; 9, identifier:actions; 10, call; 10, 11; 10, 12; 11, identifier:sorted; 12, a...
def add_arguments(self, actions): actions = sorted( actions, key=operator.attrgetter('option_strings')) super(SortedHelpFormatter, self).add_arguments(actions)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_iter_indented_subactions; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:action; 6, block; 6, 7; 7, try_statement; 7, 8; 7, 15; 7, 19; 8, block; 8, 9; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier...
def _iter_indented_subactions(self, action): try: get_subactions = action._get_subactions except AttributeError: pass else: self._indent() if isinstance(action, argparse._SubParsersAction): for subaction in sorted( ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_sort2sql; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:sort; 6, block; 6, 7; 6, 13; 7, if_statement; 7, 8; 7, 10; 8, not_operator; 8, 9; 9, identifier:sort; 10, block; 10, 11; 11, return_statement; 11, 12; 12, string:""; 13, re...
def _sort2sql(self, sort): if not sort: return "" return SQL_ORDERBY + sql_list([quote_column(o.field) + (" DESC" if o.sort == -1 else "") for o in sort])
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:optimize_batch; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:batchsize; 7, integer:10; 8, default_parameter; 8, 9; 8, 10; 9, identifier:returns; 10, string:'best'; 11, default_para...
def optimize_batch(self, batchsize=10, returns='best', paralell=True): if returns not in ('best', 'all'): raise ValueError('returns must be either "best" or "all"') starts = [np.random.rand(self.m * 2) * 10 for i in range(batchsize)] if paralell: with Pool() as p: ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:list_gewesten; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:sort; 7, integer:1; 8, block; 8, 9; 8, 11; 8, 81; 8, 117; 8, 128; 9, expression_statement; 9, 10; 10, string:''' List all `gew...
def list_gewesten(self, sort=1): ''' List all `gewesten` in Belgium. :param integer sort: What field to sort on. :rtype: A :class`list` of class: `Gewest`. ''' def creator(): res = crab_gateway_request(self.client, 'ListGewesten', sort) tmp = {} ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:list_provincies; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:gewest; 7, integer:2; 8, block; 8, 9; 8, 11; 8, 26; 8, 58; 8, 94; 8, 105; 9, expression_statement; 9, 10; 10, string:''' Lis...
def list_provincies(self, gewest=2): ''' List all `provincies` in a `gewest`. :param gewest: The :class:`Gewest` for which the \ `provincies` are wanted. :param integer sort: What field to sort on. :rtype: A :class:`list` of :class:`Provincie`. ''' try...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 11; 2, function_name:list_gemeenten; 3, parameters; 3, 4; 3, 5; 3, 8; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:gewest; 7, integer:2; 8, default_parameter; 8, 9; 8, 10; 9, identifier:sort; 10, integer:1; 11, block; 11, 12; 11, 14; 11, 38;...
def list_gemeenten(self, gewest=2, sort=1): ''' List all `gemeenten` in a `gewest`. :param gewest: The :class:`Gewest` for which the \ `gemeenten` are wanted. :param integer sort: What field to sort on. :rtype: A :class:`list` of :class:`Gemeente`. ''' ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:list_gemeenten; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:sort; 7, integer:1; 8, block; 8, 9; 8, 11; 8, 67; 8, 103; 8, 114; 9, expression_statement; 9, 10; 10, string:''' List all `ge...
def list_gemeenten(self, sort=1): ''' List all `gemeenten` in Vlaanderen. :param integer sort: What field to sort on. :rtype: A :class:`list` of :class:`Gemeente`. ''' def creator(): url = self.base_url + '/municipality' h = self.base_headers ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:list_kadastrale_afdelingen; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 8; 5, 39; 5, 74; 6, expression_statement; 6, 7; 7, string:''' List all `kadastrale afdelingen` in Flanders. :param integer sort: Field to so...
def list_kadastrale_afdelingen(self): ''' List all `kadastrale afdelingen` in Flanders. :param integer sort: Field to sort on. :rtype: A :class:`list` of :class:`Afdeling`. ''' def creator(): gemeentes = self.list_gemeenten() res = [] f...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:list_kadastrale_afdelingen_by_gemeente; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:gemeente; 6, default_parameter; 6, 7; 6, 8; 7, identifier:sort; 8, integer:1; 9, block; 9, 10; 9, 12; 9, 36; 9, 42; 9, 107; 9, 143; 9, 15...
def list_kadastrale_afdelingen_by_gemeente(self, gemeente, sort=1): ''' List all `kadastrale afdelingen` in a `gemeente`. :param gemeente: The :class:`Gemeente` for which the \ `afdelingen` are wanted. :param integer sort: Field to sort on. :rtype: A :class:`list` of ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:list_percelen_by_sectie; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:sectie; 6, block; 6, 7; 6, 9; 6, 15; 6, 23; 6, 33; 6, 39; 6, 107; 6, 143; 6, 154; 7, expression_statement; 7, 8; 8, string:''' List all percelen in a ...
def list_percelen_by_sectie(self, sectie): ''' List all percelen in a `sectie`. :param sectie: The :class:`Sectie` for which the percelen are wanted. :param integer sort: Field to sort on. :rtype: A :class:`list` of :class:`Perceel`. ''' sid = sectie.id ai...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 14; 2, function_name:get_urls; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:order; 7, string:"total_clicks desc"; 8, default_parameter; 8, 9; 8, 10; 9, identifier:offset; 10, None; 11, default_paramete...
def get_urls(self, order="total_clicks desc", offset=None, count=None): req_data = [ None, order, fmt_paging(offset, count) ] return self.request("query:Message_Url", req_data)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:get_message_urls; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:message_id; 6, default_parameter; 6, 7; 6, 8; 7, identifier:order; 8, string:"total_clicks desc"; 9, block; 9, 10; 9, 23; 10, expression_statement; 10, 11; 11,...
def get_message_urls(self, message_id, order="total_clicks desc"): req_data = [ { "message_id": str(message_id) }, order, None ] return self.request("query:Message_Url", req_data)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 29; 2, function_name:trade_history; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 3, 26; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:from_; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, None; 11,...
def trade_history( self, from_=None, count=None, from_id=None, end_id=None, order=None, since=None, end=None, pair=None ): return self._trade_api_call( 'TradeHistory', from_=from_, count=count, from_id=from_id, end_id=end_id, order=order, since=since, end=end, pair=pa...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 26; 2, function_name:trans_history; 3, parameters; 3, 4; 3, 5; 3, 8; 3, 11; 3, 14; 3, 17; 3, 20; 3, 23; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:from_; 7, None; 8, default_parameter; 8, 9; 8, 10; 9, identifier:count; 10, None; 11, defaul...
def trans_history( self, from_=None, count=None, from_id=None, end_id=None, order=None, since=None, end=None ): return self._trade_api_call( 'TransHistory', from_=from_, count=count, from_id=from_id, end_id=end_id, order=order, since=since, end=end )
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_atom_type_symbol; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:cls; 5, identifier:calc; 6, dictionary_splat_pattern; 6, 7; 7, identifier:kwargs; 8, block; 8, 9; 8, 17; 8, 25; 8, 36; 9, expression_statement; 9, 10; 10, assignment; 10, 11; ...
def get_atom_type_symbol(cls,calc,**kwargs): parameters = calc.out.output dictionary = parameters.get_dict() if 'basis_set' not in dictionary.keys(): return None return sorted(dictionary['basis_set'].keys())
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_url; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 19; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:prefix; 9, boolean_operator:or; 9, 10; 9, 18; 10, boolean_operator:and; 10, 11; 10, 17; 11, parent...
def sort_url(self): prefix = (self.sort_direction == "asc") and "-" or "" return self.table.get_url(order_by=prefix + self.name)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:append; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:newconfig; 6, block; 6, 7; 6, 52; 6, 102; 6, 115; 6, 136; 7, for_statement; 7, 8; 7, 9; 7, 21; 8, identifier:attr_name; 9, tuple; 9, 10; 9, 11; 9, 12; 9, 13; 9, 14; 9, 15; 9, ...
def append(self, newconfig): for attr_name in ( 'title', 'body', 'author', 'date', 'strip', 'strip_id_or_class', 'strip_image_src', 'single_page_link', 'single_page_link_in_feed', 'next_page_link', 'http_header' ): current_set = getattr(self, a...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:__exportUsers; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:self; 5, identifier:sort; 6, default_parameter; 6, 7; 6, 8; 7, identifier:limit; 8, integer:0; 9, block; 9, 10; 9, 14; 9, 23; 9, 34; 9, 38; 9, 81; 10, expression_statement; 10, 11; 1...
def __exportUsers(self, sort, limit=0): position = 1 dataUsers = self.getSortedUsers(sort) if limit: dataUsers = dataUsers[:limit] exportedUsers = [] for u in dataUsers: userExported = u.export() userExported["position"] = position ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 4; 2, function_name:zset_example; 3, parameters; 4, block; 4, 5; 4, 10; 4, 15; 4, 21; 4, 27; 4, 40; 4, 62; 4, 71; 4, 78; 4, 85; 4, 92; 4, 101; 4, 106; 4, 113; 5, import_from_statement; 5, 6; 5, 8; 6, dotted_name; 6, 7; 7, identifier:uuid; 8, dotted_name; 8, 9; 9, ...
def zset_example(): from uuid import uuid4 from redis import StrictRedis from zato.redis_paginator import ZSetPaginator conn = StrictRedis() key = 'paginator:{}'.format(uuid4().hex) for x in range(1, 18): conn.zadd(key, x, chr(96 + x)) p = ZSetPaginator(conn, key, 6) print(p.coun...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:paths_by_depth; 3, parameters; 3, 4; 4, identifier:paths; 5, block; 5, 6; 6, return_statement; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:sorted; 9, argument_list; 9, 10; 9, 11; 9, 26; 10, identifier:paths; 11, keyword_argument; 11, 12; 11, 13; 1...
def paths_by_depth(paths): return sorted( paths, key=lambda path: path.count(os.path.sep), reverse=True )
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:normalize_date; 3, parameters; 3, 4; 4, identifier:date; 5, block; 5, 6; 5, 8; 5, 117; 6, expression_statement; 6, 7; 7, string:'''normalize the specified date to milliseconds since the epoch If it is a string, it is assumed to be some ...
def normalize_date(date): '''normalize the specified date to milliseconds since the epoch If it is a string, it is assumed to be some sort of datetime such as "2015-12-27" or "2015-12-27T11:01:20.954". If date is a naive datetime, it is assumed to be UTC. If numeric arguments are...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:format_float; 3, parameters; 3, 4; 3, 5; 4, identifier:x; 5, identifier:max_width; 6, block; 6, 7; 6, 9; 6, 28; 6, 37; 6, 46; 7, expression_statement; 7, 8; 8, string:'''format_float will ensure that a number's decimal part is truncated to ...
def format_float(x, max_width): '''format_float will ensure that a number's decimal part is truncated to fit within some bounds, unless the whole part is wider than max_width, which is a problem you need to sort out yourself. ''' whole_width = int(math.log10(abs(x) + 1)) + 1 sign_width = 1 if x ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:__cleanup; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 14; 5, 53; 5, 75; 5, 82; 5, 90; 5, 97; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 13; 8, attribute; 8, 9; 8, 12; 9, attribute; 9, 10; 9, 11; 10, identifier:self;...
def __cleanup(self): self._run.value = False if check_process_termination(proc = self._proc, timeout = 2*self.interval, prefix = '', auto_...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:regroup; 3, parameters; 3, 4; 3, 5; 4, identifier:target; 5, identifier:expression; 6, block; 6, 7; 6, 13; 7, if_statement; 7, 8; 7, 10; 8, not_operator; 8, 9; 9, identifier:target; 10, block; 10, 11; 11, return_statement; 11, 12; 12, string:''...
def regroup(target, expression): if not target: return '' return [ {'grouper': key, 'list': list(val)} for key, val in groupby(obj_list, lambda v, f=expression.resolve: f(v, True)) ]
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 23; 2, function_name:entityTriples; 3, parameters; 3, 4; 3, 5; 3, 6; 3, 9; 3, 12; 4, identifier:rdfGraph; 5, identifier:anEntity; 6, default_parameter; 6, 7; 6, 8; 7, identifier:excludeProps; 8, False; 9, default_parameter; 9, 10; 9, 11; 10, identifier:excludeBNod...
def entityTriples(rdfGraph, anEntity, excludeProps=False, excludeBNodes=False, orderProps=[RDF, RDFS, OWL.OWLNS, DC.DCNS]): temp = [] if not excludeProps: excludeProps = [] for x, y, z in rdfGraph.triples((anEntity, None, None)): if excludeBNodes and isBlankNode(z): ...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:msvd; 3, parameters; 3, 4; 4, identifier:m; 5, block; 5, 6; 5, 20; 5, 28; 5, 34; 5, 42; 5, 48; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 12; 8, pattern_list; 8, 9; 8, 10; 8, 11; 9, identifier:u; 10, identifier:s; 11, identifier:vdg...
def msvd(m): u, s, vdgr = np.linalg.svd(m) order = s.argsort() s = s[order] u= u[:,order] vdgr = vdgr[order] return u, s, vdgr.conj().T
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 6; 2, function_name:_rows_sort; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, identifier:rows; 6, block; 6, 7; 7, return_statement; 7, 8; 8, call; 8, 9; 8, 10; 9, identifier:sorted; 10, argument_list; 10, 11; 10, 12; 11, identifier:rows; 12, keyword_argument; ...
def _rows_sort(self, rows): return sorted(rows, key=lambda row: (row[self._key_start_date], row[self._key_end_date]))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 8; 2, function_name:get_rows; 3, parameters; 3, 4; 3, 5; 4, identifier:self; 5, default_parameter; 5, 6; 5, 7; 6, identifier:sort; 7, False; 8, block; 8, 9; 8, 13; 8, 51; 9, expression_statement; 9, 10; 10, assignment; 10, 11; 10, 12; 11, identifier:ret; 12, list:...
def get_rows(self, sort=False): ret = [] for _, rows in sorted(self._rows.items()) if sort else self._rows.items(): self._rows_int2date(rows) ret.extend(rows) return ret
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:get_entries; 3, parameters; 3, 4; 4, identifier:path; 5, block; 5, 6; 5, 14; 5, 57; 5, 63; 5, 69; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 11; 8, pattern_list; 8, 9; 8, 10; 9, identifier:dirs; 10, identifier:files; 11, expression_...
def get_entries(path): dirs, files = [], [] for entry in os.listdir(path): if os.path.isdir(os.path.join(path, entry)): dirs.append(entry) else: files.append(entry) dirs.sort() files.sort() return dirs, files
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort; 3, parameters; 3, 4; 4, identifier:ctx; 5, block; 5, 6; 5, 14; 5, 22; 5, 30; 5, 38; 5, 49; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:head; 9, attribute; 9, 10; 9, 13; 10, attribute; 10, 11; 10, 12; 11, identi...
def sort(ctx): head = ctx.parent.head vcf_handle = ctx.parent.handle outfile = ctx.parent.outfile silent = ctx.parent.silent print_headers(head, outfile=outfile, silent=silent) for line in sort_variants(vcf_handle): print_variant(variant_line=line, outfile=outfile, silent=silent)
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_sort_to_str; 3, parameters; 3, 4; 4, identifier:self; 5, block; 5, 6; 5, 10; 5, 14; 5, 53; 5, 67; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:params_list; 9, list:[]; 10, expression_statement; 10, 11; 11, assignment...
def _sort_to_str(self): params_list = [] timestamp = "" for k, v in self._solr_params['sort'].items(): if k != "timestamp": params_list.append(" ".join([k, v])) else: timestamp = v params_list.append(" ".join(['timestamp', timestamp...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:_get_video_ts_file_paths; 3, parameters; 3, 4; 4, identifier:dvd_path; 5, block; 5, 6; 5, 14; 5, 18; 5, 46; 6, expression_statement; 6, 7; 7, assignment; 7, 8; 7, 9; 8, identifier:video_ts_folder_path; 9, call; 9, 10; 9, 11; 10, identifier:join...
def _get_video_ts_file_paths(dvd_path): video_ts_folder_path = join(dvd_path, "VIDEO_TS") video_ts_file_paths = [] for video_ts_folder_content_name in listdir(video_ts_folder_path): video_ts_folder_content_path = join(video_ts_folder_path, video_ts_folder_content_name) if isfile(video_ts_fol...
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 5; 2, function_name:sort_ranges; 3, parameters; 3, 4; 4, identifier:inranges; 5, block; 5, 6; 6, return_statement; 6, 7; 7, call; 7, 8; 7, 9; 8, identifier:sorted; 9, argument_list; 9, 10; 9, 11; 10, identifier:inranges; 11, keyword_argument; 11, 12; 11, 13; 12, i...
def sort_ranges(inranges): return sorted(inranges,key=lambda x: (x.chr,x.start,x.end,x.direction))
0, module; 0, 1; 1, function_definition; 1, 2; 1, 3; 1, 9; 2, function_name:subtract_ranges; 3, parameters; 3, 4; 3, 5; 3, 6; 4, identifier:r1s; 5, identifier:r2s; 6, default_parameter; 6, 7; 6, 8; 7, identifier:already_sorted; 8, False; 9, block; 9, 10; 9, 16; 9, 34; 9, 38; 9, 53; 9, 57; 9, 61; 9, 254; 10, import_from...
def subtract_ranges(r1s,r2s,already_sorted=False): from seqtools.stream import MultiLocusStream if not already_sorted: r1s = merge_ranges(r1s) r2s = merge_ranges(r2s) outputs = [] mls = MultiLocusStream([BedArrayStream(r1s),BedArrayStream(r2s)]) tot1 = 0 tot2 = 0 for loc in mls: v = loc.payloa...