query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Flush data and dispose stream
def flush_and_dispose(self): yield self.flush() self.dispose()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flush(self, data):", "def flush(self):\n self._stream.flush()", "def _close_stream(self):\n if self.stream:\n try:\n if not self.stream.closed:\n self.stream.flush()\n self.stream.close()\n finally:\n self.s...
[ "0.7562036", "0.74502873", "0.7204735", "0.7163517", "0.6788774", "0.6694124", "0.66281307", "0.66063815", "0.66062015", "0.65169686", "0.6492155", "0.64790374", "0.64739585", "0.64717114", "0.6460515", "0.64388275", "0.641191", "0.63762635", "0.63762635", "0.63762635", "0.63...
0.65826124
9
Copy content of this stream to different stream Stream can be either asynchronous stream or python binary stream.
def copy_to(self, stream, bufsize=None): bufsize = bufsize or PRETZEL_BUFSIZE if isinstance(stream.write(b''), int): # destination stream is synchronous python stream try: while True: stream.write((yield self.read(bufsize))) except ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_stream(self):\n return DataStream(\n data_type=self.data_type,\n name=self.name,\n labels=self.labels.copy(),\n callbacks=self.callbacks.copy(),\n uid=self.uid)", "def copyStreamToStream(streamFrom, streamTo, input_length=sys.maxint, offset=...
[ "0.6567908", "0.6458702", "0.63707775", "0.63395", "0.6333425", "0.6158691", "0.6021784", "0.5996409", "0.59475935", "0.58277017", "0.57225204", "0.5707159", "0.5683792", "0.56806785", "0.56806785", "0.56780136", "0.56698525", "0.56685907", "0.56647164", "0.56537086", "0.5566...
0.71742684
0
Get a program id from program.program_id. This is not an actual attribute of cirq.Circuit, but thanks to the magic of python, it can be! If your circuit does not have a program_id, this function will return a uuid4(). Program ids can only contain alphanumeric and _ so we replace
def _get_program_id(program: Any): if not hasattr(program, 'program_id'): return str(uuid.uuid4()) program_id: str = program.program_id program_id = program_id.replace(':', '') parts = program_id.split('/') parts.append(str(uuid.uuid4())) chars_per_part = math.floor(64 / len(parts)) - 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def program_uuid(self):\n return self.kwargs['program_uuid']", "def unique_id(self):\n return f\"bhyve:program:{self._program_id}\"", "def prog_id(self):\n return self.properties.get(\"ProgID\", None)", "def generate_fwan_process_id() -> str:\n return str(uuid.uuid4())", "def get_re...
[ "0.79068476", "0.7264113", "0.65031767", "0.6405029", "0.6306429", "0.6228734", "0.6212107", "0.62085164", "0.6196261", "0.6175726", "0.6149326", "0.61228895", "0.6092414", "0.604155", "0.60018843", "0.59885347", "0.5971074", "0.5971074", "0.5971074", "0.5952242", "0.5940573"...
0.8863723
0
Maintain a respectful queue of work
async def execute_in_queue(func, tasks, num_workers: int): queue = asyncio.Queue() async def worker(): while True: task = await queue.get() print(f"Processing {task.fn}. Current queue size: {queue.qsize()}") await func(task) print(f"{task.fn} completed") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monitor_queue(self):\n\n while True:\n job = self.queue.next()\n if job:\n # print(\"found %s\" % (job.job_id))\n\n job_name = job.payload[\"job_name\"]\n\n if job_name in self.mul_func_map:\n\n t = self.mul_func_map[j...
[ "0.6978231", "0.69729084", "0.6931101", "0.68955994", "0.6872209", "0.68439406", "0.6832862", "0.6821273", "0.6793218", "0.6765122", "0.67272234", "0.6726119", "0.67211956", "0.6699042", "0.6697412", "0.6669965", "0.6655158", "0.6640652", "0.6640652", "0.6579681", "0.6564476"...
0.0
-1
Handles user input to remove a file or set of files from the selected DISTRESS network. This functionality can all be overriden via the configuration file.
def delete(socket, args, config, library, cmd=False): files=args['<nameid>'] ignore=args['--ignore'] for nameid in files: receipt = library.get_receipt( nameid ) if not receipt: if cmd: print "Could not find receipt for:",nameid if not ignore: return False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleRemoveFile(self):\n for w in self.filesList.selectedItems():\n self.filesList.removeFile(w.text(2))\n self.metadataList.clear()\n self.metadataList.setRowCount(0)\n self.metadataList.setHorizontalHeaderLabels([\"Metadata Header\", \"Value\"])\n self.personalD...
[ "0.59984297", "0.5738072", "0.5735693", "0.570255", "0.5700912", "0.55771846", "0.557139", "0.5505206", "0.54967844", "0.54964334", "0.5432532", "0.54182154", "0.5397033", "0.5331703", "0.53284043", "0.52995676", "0.52982754", "0.5277517", "0.5267115", "0.521343", "0.5203183"...
0.54584485
10
Find needle in known_hosts
def match_hosts(needle): matched_hosts = [] with open(known_hosts_path, "r") as known_hosts_file: for line in known_hosts_file: host, _, _ = line.split(" ") if needle in host: matched_hosts.append(host) return matched_hosts
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_host_key(self, value):\n for key in self:\n if value in key.hosts:\n return key\n return None", "def findwhois_server(self, buf, hostname, query):\n nhost = None\n match = re.compile('Domain Name: {}\\s*.*?Whois Server: (.*?)\\s'.format(query), flags...
[ "0.67115235", "0.5897425", "0.58485895", "0.5797194", "0.5788939", "0.57481563", "0.56678516", "0.56509316", "0.5648003", "0.5577273", "0.55597615", "0.5547292", "0.55391026", "0.5459835", "0.5459835", "0.538749", "0.53682864", "0.53653854", "0.5352104", "0.53495044", "0.5329...
0.78194994
0
Select a particular host
def select_host(hosts): print("Select a host to delete:\n") for i, host in enumerate(hosts): print("[{0}] {1}".format(i, host)) print("[X] Cancel\n") selections = str(input("Choose a host (csv allowed): ")) if "x" in selections.lower(): return [] hosts = [hosts[int(host)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_host(host_list):\n if len(host_list) > 1:\n print('[+] Detected multiple hosts: (Port 62001 will be the first and default port for adb devices)')\n for host_id, host in enumerate(host_list):\n print(f\" > ({host_id+1}) {host}\")\n print('[+] Input t...
[ "0.7400062", "0.7396214", "0.6528219", "0.65000296", "0.64538556", "0.640917", "0.63133", "0.6268976", "0.62632835", "0.6248636", "0.6248354", "0.6248354", "0.6156825", "0.61134", "0.6086269", "0.60218847", "0.60055834", "0.5921318", "0.5917707", "0.5866374", "0.5859256", "...
0.5990763
17
Delete a particular host
def delete_host(host): lines = [] with open(known_hosts_path, "r") as f: lines = f.readlines() with open(known_hosts_path, "w") as f: for line in lines: if host != line.split()[0]: f.write(line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_host(self, conf, tenant_id, network_id, host_id):\n\t\tpass", "def delete(self, host_id):\n self._delete('/os-hosts/%s' % host_id)", "def host_delete(self, host):\n\n endpoint = '/Domain/Host/Delete'\n\n params = {\n 'Host' : host,\n }\n \n respon...
[ "0.85617054", "0.83163726", "0.8190062", "0.78757465", "0.7744529", "0.7730757", "0.7690718", "0.7684262", "0.7683934", "0.7637056", "0.75802505", "0.7510345", "0.7424208", "0.7371803", "0.73513824", "0.722818", "0.71924126", "0.7182905", "0.717348", "0.7128607", "0.7064725",...
0.73869604
13
Function for computing attention on several heads simultaneously Splits tensor to be multi headed.
def split_heads(self, tensor, batch_size): # (batch_size, seq_len, output_dim) -> (batch_size, seq_len, n_heads, head_depth) splitted_tensor = tensor.view(batch_size, -1, self.n_heads, self.head_depth) return splitted_tensor.transpose(1, 2) # (batch_size, n_heads, seq_len, head_depth)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _MultiHeadedAtten(\n self, name, num_heads=None, enable_qkv_proj_in_onestep=False\n ):\n p = self.params\n if num_heads is None:\n num_heads = p.num_heads\n attn_memory_tpl = layers.LSHTaskWithMultiplierLayer.Params().Set(\n log_num_buckets=p.attn_log_num_buckets,\n num_hash_f...
[ "0.6686328", "0.6551467", "0.6496521", "0.6359135", "0.6349045", "0.63056546", "0.6289936", "0.62841004", "0.6159032", "0.61402965", "0.61257666", "0.605103", "0.5996085", "0.59759814", "0.59319884", "0.5907628", "0.5905594", "0.5892423", "0.58865345", "0.58604753", "0.581902...
0.0
-1
Select next node based on decoding type.
def _select_node(self, logits): # assert tf.reduce_all(logits) == logits, "Probs should not contain any nans" if self.decode_type == "greedy": selected = torch.argmax(logits, dim=-1) # (batch_size, 1) elif self.decode_type == "sampling": # logits has a shape of (batch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next(node):\n return node['next']", "def _next(self):\n node = self.head\n while node != None:\n yield node.data\n node = node.right", "def next():", "def next():", "def get_next_decoder(current_decoder, decoder_dict):\n switch = { ...
[ "0.5909177", "0.55684704", "0.5517093", "0.5517093", "0.5508113", "0.5435157", "0.5415138", "0.5362074", "0.5362074", "0.5362074", "0.5341539", "0.53378487", "0.53029335", "0.52910507", "0.528096", "0.52807254", "0.52695376", "0.5262345", "0.52601093", "0.5259646", "0.5239189...
0.0
-1
Takes a state and graph embeddings, Returns a part [h_N, D] of context vector [h_c, h_N, D], that is related to RL Agent last step.
def get_step_context(self, state, embeddings): # index of previous node prev_node = state.prev_a.to(self.dev) # (batch_size, 1) # from embeddings=(batch_size, n_nodes, input_dim) select embeddings of previous nodes cur_embedded_node = embeddings.gather(1, prev_node.view(prev_node.shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_nn(cell, rnn_size, input_data, vocab_size, embed_dim):\n embed = get_embed(input_data, vocab_size, embed_dim) \n output, final_state = build_rnn(cell, embed)\n \n logits = tf.contrib.layers.fully_connected(output, vocab_size, activation_fn=None)\n #final_state = tf.identity(final_stat...
[ "0.5710615", "0.5697232", "0.56184053", "0.5616776", "0.5595174", "0.5548798", "0.5524491", "0.5477435", "0.54760706", "0.54628956", "0.54440236", "0.54390854", "0.53898245", "0.5347198", "0.5345448", "0.5341874", "0.5341261", "0.53183186", "0.53023475", "0.53003037", "0.5272...
0.7374239
0
Computes MultiHead Attention part of decoder
def decoder_mha(self, Q, K, V, mask=None): # Add dimension to mask so that it can be broadcasted across heads # (batch_size, seq_len_q, seq_len_k) --> (batch_size, 1, seq_len_q, seq_len_k) if mask is not None: mask = mask.unsqueeze(1) attention = scaled_attention(Q,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attention_module_multi_head(roi_feat, position_embedding,\n nongt_dim, fc_dim, feat_dim,\n dim=(1024, 1024, 1024),\n group=16, index=1):\n dim_group = (dim[0] / group, dim[1] / group, dim[2] / group)\n nongt_roi_...
[ "0.65307134", "0.6444963", "0.6292002", "0.60863566", "0.6076711", "0.6036302", "0.6034969", "0.60121447", "0.5967123", "0.59568924", "0.5932581", "0.59028465", "0.5889598", "0.58632296", "0.58586293", "0.5821471", "0.58062166", "0.58036745", "0.57800764", "0.5769691", "0.576...
0.0
-1
SingleHead attention sublayer in decoder, computes logprobabilities for node selection.
def get_log_p(self, Q, K, mask=None): compatibility = torch.matmul(Q, K.transpose(-2, -1)) / math.sqrt(Q.shape[-1]) compatibility = torch.tanh(compatibility) * self.tanh_clipping if mask is not None: compatibility = compatibility.masked_fill(mask == 1, -1e9) log_p = F.log_softm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model_multihead_attention_multiscaleCNN4_covermore(self,\n dim_attention,headnum,\n embedding_vec,\n load_weights=False, weight_dir=None,\n nb_filter...
[ "0.539668", "0.5370601", "0.5208628", "0.5201065", "0.5195737", "0.5145377", "0.51447594", "0.506822", "0.5060384", "0.5052498", "0.5042207", "0.5021003", "0.50186706", "0.49782065", "0.49544263", "0.4953579", "0.49511325", "0.49411935", "0.4940318", "0.4935457", "0.49295557"...
0.0
-1
Forward and calculate loss for REINFORCE algorithm in a memory efficient way. This sacrifices a bit of performance but is way better in memory terms and works by reordering the terms in the gradient formula such that we don't store gradients for all the seguence for a long time which hence produces a lot of memory cons...
def fwd_rein_loss(self, inputs, baseline, bl_vals, num_batch, return_pi=False): on_training = self.training self.eval() with torch.no_grad(): cost, log_likelihood, seq = self(inputs, True) bl_val = bl_vals[num_batch] if bl_vals is not None else baseline.eval(inputs, cost...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backward_linear(Data):\n\n # data\n graph = tf.Graph()\n X = Data[0]\n Y_ = Data[1]\n\n if X.shape[0] != Y_.shape[0]:\n raise Exception(\"The quantity of Input X and Compare Y_ are not same!\")\n\n Loss = []\n with graph.as_default():\n print(\"This is the process of all the ...
[ "0.67428344", "0.67154306", "0.6599166", "0.658898", "0.6557158", "0.65417147", "0.6540556", "0.65325093", "0.65008616", "0.649814", "0.6443805", "0.64413273", "0.64185274", "0.64034337", "0.6393763", "0.639042", "0.63873094", "0.638429", "0.6372747", "0.6360011", "0.6358676"...
0.6155039
49
Forward method. Works as expected except and as described on the paper, however if pre_selects is None which hence implies that pre_cost should be none it's because fwd_rein_loss is calling it; check that method for a description of why this is useful.
def forward(self, inputs, return_pi=False, pre_selects=None, pre_cost=None): self.batch_size = inputs[0].shape[0] state = self.problem(inputs) # use CPU inputs for state inputs = self.set_input_device(inputs) # sent inputs to GPU for training if it's being used sequences = [] l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pre_forward(\n state: _State,\n handles: List[FlatParamHandle],\n unshard_fn: Callable,\n module: nn.Module,\n input: Any,\n):\n state.training_state = TrainingState.FORWARD_BACKWARD\n state._exec_order_data.record_pre_forward(handles, module.training)\n for handle in handles:\n ...
[ "0.6193878", "0.61060727", "0.59223294", "0.58666104", "0.5782265", "0.56982285", "0.5692076", "0.56716996", "0.5626985", "0.55718166", "0.5547559", "0.5527229", "0.55199444", "0.5519439", "0.5519075", "0.5505503", "0.5492375", "0.54898894", "0.54689044", "0.546703", "0.54422...
0.53767645
32
Move vehicle in direction based on specified velocity vectors.
def send_ned_velocity(uvwLoc): vel = 5. * 2. # m/s at average cdf=.5 m = norm(7.8, 15.22).cdf(np.sum(uvwLoc**2.)) uvwLocNorm = -(uvwLoc / np.abs(uvwLoc).max()) uvwVel = m * vel * uvwLocNorm velocity_x, velocity_y, velocity_z = uvwVel[1], uvwVel[0], uvwVel[2] rospy.logdebug("{} m={} mXv={} uvw={...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_velocity(self):\n # Set thruster (up/down) movement\n if self.thrusters:\n self.velocity_y -= self.gravity\n else:\n self.velocity_y += self.velocity_slowing\n\n # Set left movement\n if self.moving_left:\n self.velocity_x -= self.gravi...
[ "0.68131894", "0.66878253", "0.66767144", "0.6664651", "0.6620746", "0.6420614", "0.6397649", "0.6369574", "0.6361948", "0.6354659", "0.63036567", "0.63017106", "0.6244916", "0.6221734", "0.6219887", "0.62121576", "0.6205084", "0.619217", "0.61751765", "0.61676943", "0.616657...
0.0
-1
converts index from NED coordinate in array X to index of array J
def indXtoJ(indX): return np.unravel_index(indX % xx.size, xx.shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xy_to_index(x, y):\n index = y * columns + x\n return index", "def one_dim_index(self, i, j):\n return int(i + j * self.nx)", "def index(i, j):\n return i * N + j", "def coor2idx(x, y):\r\n a = round(x/4000,0)*4000\r\n b = (round_down(y/4000,0)+0.5)*4000\r\n i = int((a - 24000)/...
[ "0.6976895", "0.68221605", "0.6785867", "0.66706675", "0.66188246", "0.6592676", "0.6390636", "0.6366008", "0.6351581", "0.632472", "0.6315053", "0.62955177", "0.6266986", "0.6242964", "0.621769", "0.62147", "0.6204049", "0.61921877", "0.6169835", "0.6155819", "0.6117954", ...
0.79179806
0
take hold of a lock on a resource
def lock(self, nick, channel, resourcestr): return (channel, self._lock(nick, nick, resourcestr))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, resource: LockResource, timeout: timedelta) -> Lock:", "def thread_lock(self, bay_uuid):\n try:\n self.acquire()\n yield\n except exception.OperationInProgress:\n raise\n except: # noqa\n with excutils.save_and_reraise_exception...
[ "0.7309355", "0.6777241", "0.6667399", "0.66405743", "0.6597714", "0.6532337", "0.6528202", "0.6514019", "0.65129644", "0.64891016", "0.6484085", "0.64838254", "0.6482276", "0.6467895", "0.6449373", "0.64459926", "0.638227", "0.6381445", "0.6355099", "0.6349529", "0.63402885"...
0.0
-1
add a new resource to the database
def register(self, nick, channel, resourcestr): resources, multi = self.splitResources(resourcestr) for r in resources: if r in self.locks: raise LockBotException('ERROR, resource "%s" is already registered' % r, resourcestr, self.verb) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_resource(self, resource_name, resource):\n self.resources[resource_name] = resource", "def save(database, resource):\n # TODO\n pass", "def add_resource(self, *args, **kwargs):\n return self._resources_manager.add_resource(*args, **kwargs)", "def add(self):\n\n db.session.a...
[ "0.6960172", "0.68792987", "0.6706377", "0.6657957", "0.6657957", "0.6652387", "0.6512611", "0.63855875", "0.6365135", "0.63592577", "0.6354482", "0.63451076", "0.63057184", "0.6290238", "0.62426555", "0.62412417", "0.6189581", "0.6189581", "0.6189581", "0.6187583", "0.618330...
0.0
-1
remove a resource from the database
def unregister(self, nick, channel, resourcestr): resources, multi = self.getlocks(resourcestr) for r in resources: if self.locks[r]: raise LockBotException('ERROR, resource "%s" is locked by %s' % (r, self.locks[r]), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove():\n\n db_remove()", "def remove_resource(self, graph_db):\n with mutex:\n neo_resource.delete_node(graph_db, self.index)", "def remove(self):\n db.session.delete(self)\n db.session.commit()", "def remove(self, resource, **kwargs):\n log.info(\n ...
[ "0.7847243", "0.75787425", "0.72596234", "0.717408", "0.712051", "0.697973", "0.6978793", "0.6978793", "0.6957655", "0.6940326", "0.6937562", "0.69012076", "0.68811667", "0.6876065", "0.6858983", "0.6839443", "0.6837163", "0.6831113", "0.6767776", "0.6735871", "0.6728387", ...
0.0
-1
release the resource lock
def unlock(self, nick, channel, resourcestr): resources, multi = self.getlocks(resourcestr) # iterate over all resources once to check for errors for r in resources: l = self.locks[r] if not l.owner: raise LockBotException("%s is already free" % r, resourc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release(self):\n fcntl.flock(self.lock_file, fcntl.LOCK_UN)", "def release_lock(self):\n self._multistore._unlock()", "def unlock(lock):\n lock.release()", "def release(self):\r\n if self.is_locked:\r\n os.close(self.fd)\r\n os.unlink(self.lockfile)\r\n ...
[ "0.80886894", "0.80755836", "0.7986181", "0.7926654", "0.7918799", "0.7900972", "0.7896809", "0.775062", "0.775062", "0.7637013", "0.76329345", "0.76111454", "0.7588846", "0.75005966", "0.7448573", "0.74279904", "0.7386935", "0.73810226", "0.7365187", "0.73564476", "0.7331302...
0.0
-1
assign a resource lock to someone else other than the caller
def assignlock(self, nick, channel, assignee, resourcestr): return (channel, self._lock(nick, assignee, resourcestr))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lock_resource(self, resource, user_name):\n for sub_resource in resource.get_sub_resources():\n self._lock_resource(sub_resource, user_name)\n\n resource.owner = user_name\n resource.owner_time = datetime.now()\n resource.save()", "def __call__(self, o):\n if no...
[ "0.7998552", "0.6857944", "0.65522623", "0.65328693", "0.63625455", "0.6329278", "0.6238407", "0.6220345", "0.6207784", "0.619553", "0.61907506", "0.61907345", "0.6148036", "0.6120895", "0.6093301", "0.608594", "0.6082099", "0.60701936", "0.6067369", "0.6031181", "0.60109025"...
0.69686687
1
release a resource lock even if the caller does not hold the lock (USE WITH CAUTION)
def freelock(self, nick, channel, resourcestr): resources, multi = self.getlocks(resourcestr) # iterate over all resources once to check for errors for r in resources: if not self.locks[r].owner: raise LockBotException('ERROR: resource %s is already unlocked' % r, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unlock(lock):\n lock.release()", "def release_lock(self):\n self._multistore._unlock()", "def release_lock(self):\n if self.lock:\n self.lock.release()", "def release_lock():\r\n get_lock.n_lock -= 1\r\n assert get_lock.n_lock >= 0\r\n # Only really release lock o...
[ "0.7918944", "0.7745639", "0.7699182", "0.7658934", "0.75480586", "0.7525814", "0.7482436", "0.74612516", "0.74337447", "0.73481554", "0.73064387", "0.73064387", "0.7155336", "0.71434677", "0.71340674", "0.7126347", "0.7125614", "0.71157146", "0.71079975", "0.7076271", "0.706...
0.64460754
51
try to take the lock, or get on queue if it is currently locked
def waitlock(self, nick, channel, resourcestr): return (channel, self._lock(nick, nick, resourcestr, wait=True))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock(self):\r\n return self._lock", "def get_lock(self, name, try_=False):\n lock = Lock(self, name, try_)\n with lock as got_lock:\n yield got_lock", "def acquire_nowait(self) -> None:\n task = get_current_task()\n if self._owner_task == task:\n raise R...
[ "0.6813398", "0.67853355", "0.677115", "0.670761", "0.66525537", "0.6612082", "0.66009504", "0.6573312", "0.6546076", "0.653102", "0.6525628", "0.65045685", "0.64708346", "0.64623094", "0.6449686", "0.6447692", "0.64386505", "0.6394093", "0.63887835", "0.63136595", "0.6301616...
0.0
-1
list locked resources and their owners
def status(self, nick, channel): lockeditems = sorted([item[0] for item in self.locks.items() if item[1].owner]) if len(lockeditems) == 0: return (channel, "There are no locked resources") else: messages = [] messages += [(channel, "Status of locked resources...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locks(self):\r\n params = {'f' : 'json'}\r\n url = \"%s/lockInfos\" % self._url\r\n return self._con.post(url, params)['lockInfos']", "def lock_resources(self, request):\n locked_resources = []\n\n client = request.worker.name\n user_name, _ = client.split(\":\") # ...
[ "0.66722405", "0.6582977", "0.6438537", "0.634539", "0.6334195", "0.60580474", "0.60307276", "0.5862831", "0.58229685", "0.58210385", "0.58006316", "0.57709336", "0.57266915", "0.5692866", "0.5691849", "0.5633208", "0.56149334", "0.55855703", "0.55745804", "0.5522181", "0.550...
0.68914664
0
list all registered resources
def list(self, nick, channel): if len(self.locks.keys()) == 0: return (channel, "There are no registered resources") else: return (channel, "List of registered resources: %s" % ', '.join(sorted(self.locks.keys())))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resources(self):\n return []", "def get_resources():\n return Response(f\"{Resource.get_all_resources()}\", 200, mimetype='text/plain')", "def resources(self):\r\n return self.page.object_list", "def list(self):\n resources = self._os_resource_manager.list()\n resource_...
[ "0.78437096", "0.7594706", "0.7558492", "0.75522166", "0.7542724", "0.7387004", "0.73857987", "0.73242646", "0.7251398", "0.7248098", "0.72020996", "0.71079016", "0.71052307", "0.70958483", "0.70832217", "0.70832217", "0.70832217", "0.6993058", "0.6984397", "0.6976492", "0.69...
0.0
-1
display this help message
def help(self, nick, channel): def getCmdArguments(handler): return inspect.getargspec(handler)[0][3:] helpTuples = [] rules = self.getRules() processedHandlers = set() for _, handler in rules: if handler in processedHandlers: continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_help(self):\n pass", "def help():", "def help(self) -> str:\n\t\treturn None", "def help():\n print(UI.HELP)", "def printhelp():", "def help(self):\n res = \"\"", "def show_help():\n messagebox.showinfo(title='How to Use', message=\"It's really easy.\")", "def ...
[ "0.8669022", "0.83941054", "0.8359416", "0.83579797", "0.8353962", "0.82706004", "0.82511544", "0.82244396", "0.81900793", "0.8179038", "0.8179038", "0.8173914", "0.8168498", "0.81642497", "0.8164061", "0.81596285", "0.81596285", "0.8117534", "0.8091054", "0.80642176", "0.802...
0.0
-1
Draw a series of values as a histogram line. Each yvalue is the count of a histogram bin. If xvalues are also given, they are the bin centers. If no xvalues are given, the yvalues are bined at integers starting with 0.
def draw_point_hist(y, x=None, **kwargs): if len(y) < 2: raise RuntimeError("Need at least 2 points for histogram") if x is None: # Use integers starting at 0 x = np.arange(len(y)) else: # Use given x, and ensure points are sorted x = np.array(x) isort = np.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeHistogram(values, numBins, xLabel, yLabel, title=None):", "def makeHistogram(values, numBins, xLabel, yLabel, title=None):\r\n pylab.hist(values, bins = numBins)\r\n pylab.xlabel(xLabel)\r\n pylab.ylabel(yLabel)\r\n if title != None:\r\n pylab.title(title)\r\n pylab.show()", "def ...
[ "0.73796916", "0.6798891", "0.67624927", "0.67370737", "0.6501336", "0.6177134", "0.6069408", "0.6060996", "0.6033122", "0.60297614", "0.6015766", "0.59853196", "0.5974089", "0.597163", "0.5960965", "0.59432226", "0.5934229", "0.59233856", "0.592121", "0.58921146", "0.5887044...
0.6794348
2
Convenience function to draw a spectrum.
def draw_spectrum(meas, x, rel=False, scale=True, **kwargs): if rel: s0 = meas.spec(meas.spec.central) s = meas.spec(x) line = draw_point_hist(100*(s/s0-1), **kwargs) plt.ylabel('Relative offset percentage') if scale: rescale_plot() else: line = draw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_spectra(meas, normalize=True):\n\n # Draw the plain spectrum\n x = list(meas.spec.central)\n lfull = draw_spectrum(meas, x, scale=True, label='full')\n\n x[meas.spec.ipar('xsec_sig')] = 1\n x[meas.spec.ipar('xsec_bg1')] = 0\n x[meas.spec.ipar('xsec_bg2')] = 0\n lsig = draw_spectrum(me...
[ "0.6886257", "0.67275256", "0.66948736", "0.6687127", "0.6679135", "0.66400295", "0.6405625", "0.6373359", "0.63331544", "0.62864983", "0.6221333", "0.62205774", "0.6168466", "0.6124746", "0.6118125", "0.60210186", "0.59727067", "0.59527946", "0.5943664", "0.5928661", "0.5904...
0.6519947
6
Build a template measurment object.
def build_template_meas(name='example'): meas = templates.TemplateMeasurement(name) meas.set_lumi(1, 0.02) # Base shape for the signal, triangular distribution sig = np.array([10000, 12500, 15000, 12500, 10000], dtype=float) # Add a source for the signal src_sig = meas.new_source('sig', sig) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_template(self, state: gamelib.AdvancedGameState):\n for unit in self.BASE_TEMPLATE:\n if state.get_resource(state.CORES) > self.UNIT_COSTS[unit[1]]:\n if state.can_spawn(unit[1], unit[0]):\n state.attempt_spawn(unit[1], unit[0])\n\n low_health_un...
[ "0.605412", "0.605101", "0.60259765", "0.5781559", "0.5705319", "0.5661125", "0.5560697", "0.54971033", "0.5424929", "0.53872424", "0.5383353", "0.53767645", "0.5330913", "0.5301977", "0.5290818", "0.5241824", "0.5231358", "0.5226303", "0.5188401", "0.5178917", "0.51679087", ...
0.7202414
0
Generate a plausible data spectrum for a pseudoexperiment in which the true underlying parameters are not known.
def make_pseudo(meas, systs=True, signal=True, stats=True): # Get the scales for the paramters controlling the spectrum scales = meas.spec.scales # Randomize the true underlying values for constrained parameters truth = np.array(meas.spec.central) if systs: # Vary the constrained parameter...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_spectrum(self):\n matlab_method = self.matlab_mapper[self.matlab_script]\n n, dm, peak_locations, omega_res, n_shell, gamma_amp = matlab_method(float(self.n_max), float(self.n_max_s),\n float(self.num_channels), float(self.scale),\n ...
[ "0.63703376", "0.61298424", "0.6076039", "0.6042859", "0.60020065", "0.5754672", "0.5692847", "0.56431437", "0.56001097", "0.5560816", "0.55325127", "0.5526705", "0.54973495", "0.5476813", "0.54699695", "0.54654425", "0.5463588", "0.54630315", "0.5450797", "0.5449483", "0.541...
0.6240589
1
Sample the likelihood space with a Markov Chain Monte Carlo.
def run_mcmc(meas, x, nsamples, covm=None, scales=None): mcmc = MCMC(meas.spec.npars) mcmc.set_values(x) if covm is not None and scales is None: mcmc.set_covm(covm) elif scales is not None: mcmc.set_scales(scales) else: raise ValueError("Must provide covariance OR scales") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sample_lam(self, cur_y, cur_z):\n old_loglik = self._loglik(cur_y, cur_z)\n old_lam = self.lam\n \n # modify the feature ownership matrix\n self.lam = np.random.beta(1,1)\n new_loglik = self._loglik(cur_y, cur_z)\n move_prob = 1 / (1 + np.exp(old_loglik - new_logli...
[ "0.6364029", "0.6157119", "0.61371166", "0.59664613", "0.59470826", "0.59432334", "0.5931655", "0.5923204", "0.5896645", "0.5854254", "0.58510005", "0.5840389", "0.5831509", "0.57536685", "0.5750755", "0.5727051", "0.57206815", "0.57000595", "0.56945896", "0.568531", "0.56829...
0.0
-1
Assess the structure of the likelihood space with all parameters shifted to +1 sigma.
def asses_space(meas): truth = list(meas.spec.central) truth[meas.spec.ipar('syst_s1')] = 1 data = meas.spec(truth) meas.spec.set_data(data) lls, xs, rels, prob = minutils.find_minima(meas.spec) print("Found %d minima with likelihoods:" % len(lls)) print(', '.join(["%.3f" % l for l in lls]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sample_likelihood_params(self):\n if self.marginalize:\n # We integrated out `beta` a la Bayesian linear regression.\n pass\n else:\n self._sample_beta_and_sigma_y()", "def __log_likelihood(self, params, *args):\n\t\tX, y, feature_set, lambda_reg, empirical_wei...
[ "0.59982514", "0.59781104", "0.59630436", "0.5947138", "0.5790235", "0.57825786", "0.57464623", "0.5710098", "0.5587495", "0.556041", "0.55523425", "0.55367815", "0.55273217", "0.5508631", "0.549958", "0.5497607", "0.54881877", "0.5447547", "0.5439081", "0.5427865", "0.541616...
0.0
-1
Generate a fake data spectrum using a template measurement spectrum, and randomizing its parameters. Then fit this fake data to see if its true underlying parameters can be recovered.
def measure_template(meas): # Make a pseudo-experiment data, truth = make_pseudo(meas) meas.spec.set_data(data) # First fit without randomization fit_first, _, _ = minutils.single_fit(meas.spec, randomize=False) # Global fit with randomization to find better minimum minx, ll, minimizer = mi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_data(path=resource_filename('locals', 'data/fake/'), mag_range=(11.13,18)):\n # Get some random spectra\n try:\n files = glob.glob('/user/jfilippazzo/Models/ACES/default/*.fits')[::50]\n except:\n files = glob.glob('/Users/jfilippazzo/Documents/Modules/_DEPRECATED/limb_dark_jeff...
[ "0.63488543", "0.6271454", "0.605595", "0.5991764", "0.59657055", "0.5922426", "0.58975416", "0.5804206", "0.57323813", "0.5716077", "0.57142216", "0.5693554", "0.5623713", "0.561851", "0.56114596", "0.5588405", "0.54932594", "0.54904705", "0.548813", "0.548179", "0.5470604",...
0.504452
75
Draw a spectrum with a parameter fluctuated to +/ 1 sigma, for each parameter. Unconstrained parameters are set to +/ 1.
def draw_spectra(meas, normalize=True): # Draw the plain spectrum x = list(meas.spec.central) lfull = draw_spectrum(meas, x, scale=True, label='full') x[meas.spec.ipar('xsec_sig')] = 1 x[meas.spec.ipar('xsec_bg1')] = 0 x[meas.spec.ipar('xsec_bg2')] = 0 lsig = draw_spectrum(meas, x, scale=F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_spectrum():\n filename = \"parameters.txt\"\n #If the file exists already, we should read the parameters from memory. \n #If the file does not exist, default variables are in Variables.py\n if path.exists(filename): \n para= open(filename,\"r\")\n para_lines = para.readlines(...
[ "0.5893153", "0.58147323", "0.58019096", "0.5797836", "0.57860005", "0.5742457", "0.5662904", "0.56534266", "0.5623216", "0.5619086", "0.557973", "0.5557214", "0.5554759", "0.54910123", "0.54774016", "0.5462636", "0.54308754", "0.5417131", "0.54069245", "0.54056835", "0.53973...
0.63044024
0
Return a random date between two dates, either as epoch seconds or human readable string.
def randdate(field): timefmt = "%B %d, %Y %H:%M:%S" if 'format' in field.keys() and field['format'] != 'stamp': start = int(time.mktime(time.strptime(field['start'], timefmt))) end = int(time.mktime(time.strptime(field['end'], timefmt))) else: start = field['start'] end = fie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_date(date_from='01/01/1970', date_to='01/01/2019'):\n try:\n time_from = time.mktime(time.strptime(date_from, '%d/%m/%Y'))\n time_to = time.mktime(time.strptime(date_to, '%d/%m/%Y'))\n assert time_from <= time_to\n except (ValueError, AssertionError) as e:\n print(e)\n ...
[ "0.761147", "0.75701857", "0.73856366", "0.72474754", "0.7162615", "0.7155106", "0.71383643", "0.71084374", "0.71084374", "0.71084374", "0.71084374", "0.71084374", "0.7099026", "0.70805055", "0.68570757", "0.6788878", "0.66872346", "0.66075", "0.6586677", "0.6356645", "0.6351...
0.63875705
19
Return the appropriate (lambda) function for the given field
def bind_function(field): t = field['type'] try: if t == 'int': return lambda x: random.randint(field['min'], field['max']) elif t == 'float': return lambda x: field['min'] + ((field['max'] - field['min']) * random.random()) elif t == 'string': return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def picker(field_name):\n return lambda row: row[field_name]", "def picker(field_name):\n return lambda row: row[field_name]", "def use_cached_field(anki: AnkiDeck, mid: int, field: int) -> FieldFunction[str]:\n return lambda sort_field: lookup_field(anki, mid, field, sort_field)", "def _generateLam...
[ "0.6644591", "0.6644591", "0.63634723", "0.60030925", "0.59671044", "0.5951441", "0.5808804", "0.57361925", "0.57241744", "0.5697697", "0.568813", "0.5683597", "0.56689215", "0.56686634", "0.56650335", "0.5607115", "0.5566443", "0.5554812", "0.5526383", "0.55215496", "0.55166...
0.6951546
0
Write the contents into the xls tables.
def write_xls(contents, filepath): if isinstance(contents, dict): wb = xlwt.Workbook() ws = wb.add_sheet('sheet 1') if not isinstance(contents, OrderedDict): print("contents should be a instance of 'OrderedDict'.") for i, (head, content) in enumerate(contents.items()): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_xls(self):\n self.wb = xlwt.Workbook()\n ws = self.wb.add_sheet('Sheet1')\n heading_style = xlwt.easyxf('font: bold true; alignment: horizontal center, wrap true;')\n extra_row = 0\n if self.date:\n date_style = xlwt.easyxf('font: bold true; alignment: horizontal left, wrap true;')...
[ "0.68169695", "0.6532215", "0.6330335", "0.6291492", "0.62891114", "0.6191087", "0.61149186", "0.60687804", "0.60447156", "0.6033515", "0.60242647", "0.601848", "0.6017455", "0.5963695", "0.5960102", "0.59508705", "0.5922449", "0.5917792", "0.58684105", "0.58632475", "0.58558...
0.584632
21
Given the DATA, then pickle it into the PATH.
def pickle_dump(data, path): ba = os.path.dirname(os.path.join(os.getcwd(), path)) print(ba) if os.path.exists(ba): print("Exist") else: print("Not Exist") pickle.dump(data, open(os.path.join(os.getcwd(), path), 'wb'), protocol=pickle.HIGHEST_PROTOCOL)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_data_pickle(PATH, data, dataset, filename):\n with open(PATH + '/' + dataset + \"_\" + filename + \".pkl\",\"wb\") as f:\n pickle.dump(data,f)\n print(filename, \"created\")", "def _save_data(self, data):\n path = os.path.join(self._cache_path, '%s.data' % self._name)\n\n f = ...
[ "0.7468239", "0.72949636", "0.72261554", "0.71485525", "0.7036902", "0.69876665", "0.68345493", "0.6828924", "0.6784259", "0.6766072", "0.6744111", "0.6680099", "0.66214156", "0.66212255", "0.6545225", "0.65206987", "0.6472664", "0.6466441", "0.64605117", "0.6456279", "0.6450...
0.7054465
4
From the PATH get the DATA.
def pickle_load(path): data = pickle.load(open(os.path.join(os.getcwd(), path), 'rb')) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_path_data(self, path):\n url = self.api_server + path\n return self.get_url_data(url)", "def get_data(path):\n return os.path.join(_ROOT, 'data', path)", "def get_data(path):\n root = os.path.abspath(os.path.dirname(__file__))\n return os.path.join(root, 'data', path)", "def ge...
[ "0.79337823", "0.76894516", "0.7435934", "0.73360354", "0.715587", "0.7088204", "0.69893074", "0.6930001", "0.68865585", "0.6830704", "0.67435986", "0.6663715", "0.66344297", "0.65767264", "0.6565499", "0.6555404", "0.65155256", "0.6461694", "0.64513165", "0.64495975", "0.644...
0.0
-1
Check the duplicate path. If there is a same filepath, for example 'file/tests.txt', Then this path will be 'file/tests(1).txt' If 'file/tests(1).txt' also exists, then this path will be 'file/tests(2).txt'
def check_duplicate_path(filepath): if not os.path.exists(os.path.join(os.getcwd(), filepath)): return filepath i = 1 splits = filepath.split(".") head, tail = '.'.join(splits[:-1]), splits[-1] while os.path.exists(os.path.join(os.getcwd(), "%s(%d).%s" % (head, i, tail))): i += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate_timestamp_path(existing_path):\n logfile = parse.parse_filename(existing_path)\n index = 0\n while index < 25:\n if index == 0:\n suffix = ''\n else:\n suffix = '-%02d' % index\n\n new_path = parse.unparse_filename(\n (\n l...
[ "0.66834664", "0.66339064", "0.65070987", "0.6452547", "0.6442084", "0.6263671", "0.6235103", "0.61986953", "0.618657", "0.6059476", "0.60134727", "0.59828204", "0.58634245", "0.58248854", "0.5793048", "0.57827705", "0.5739223", "0.57352346", "0.5700874", "0.5699016", "0.5665...
0.7494454
0
Invert a list of numbers, add a small number to avoid division by zero.
def apply_confidence_inversion(data: pd.DataFrame, uncertainty_measure: str) -> Tuple[Any, Any]: if uncertainty_measure not in data: raise KeyError("The key %s not in the dictionary provided" % uncertainty_measure) # Make sure no value is less than zero. min_not_zero = min(i for i in data[uncertai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def floor_inplace(a):", "def inverse(self, x):\n x = np.asarray(x)\n def r(vec):\n return utils.recycled(vec, as_=x)\n if self.zero is not None and self.multiplier is not None:\n x = x / r(self.multiplier) + r(self.zero)\n elif self.zero is not None:\n ...
[ "0.600199", "0.59363973", "0.5918509", "0.5888451", "0.58583796", "0.58359736", "0.573017", "0.5699582", "0.5694955", "0.569064", "0.5688833", "0.56841904", "0.5665943", "0.5644668", "0.559575", "0.5592835", "0.5587856", "0.5576161", "0.5572586", "0.5534111", "0.5517688", "...
0.0
-1
Run from the command line
def main(): era = dt.datetime.now() parser = xlslisp_compile_argdoc() args = parser.parse_args() space = os.path.splitext(args.file)[0] # Import the Values of Sheets of one Xlsx File sheet_by_name = openpyxl.load_workbook(args.file, data_only=True) sheet_by_name_keys_list = sheet_by_nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli(args): # noqa; pylint: disable=unused-argument", "def cli():\n config, auth, execute_now = read_command_line_arguments()\n main(config, auth, execute_now)", "def cli():\n pass", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():",...
[ "0.7901053", "0.7876391", "0.7841544", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "0.7735341", "...
0.0
-1
Parse the commandline args per topoffile arg doc
def xlslisp_compile_argdoc(): doc = __main__.__doc__ prog = doc.strip().splitlines()[0].split()[1] description = list(_ for _ in doc.strip().splitlines() if _)[1] epilog_at = doc.index("dependencies:") epilog = doc[epilog_at:] parser = argparse.ArgumentParser( prog=prog, descr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_args():\n help_text = \"\"\"\n Analyzer of the frequency of use of nouns in the headings of posts on hubr.com\n \"\"\"\n parser = argparse.ArgumentParser(\n description=help_text\n )\n parser.add_argument(\n '-p',\n '--pages',\n type=int,\n dest='page_...
[ "0.7149355", "0.71120995", "0.6781854", "0.67598855", "0.67295283", "0.6718709", "0.67026305", "0.66968477", "0.6638329", "0.66280264", "0.6622432", "0.66204315", "0.6615597", "0.6614482", "0.66136837", "0.66085476", "0.6605811", "0.6577573", "0.6563334", "0.65595543", "0.655...
0.0
-1
Map row indices 0 1 2 ... to Excel A .. Z, AA .. ZZ, AAA .. XFD ...
def excel_az_mark(row_index): marks = "" az = string.ascii_uppercase base = len(az) width = 1 # width 1 for Excel A .. Z, 2 for AA .. ZZ, etc floor = 0 # min index of this width ceil = base # one beyond the max index of this width while ceil <= row_index: width += 1 flo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toindex(col, row):\n a2z = 'ABCDEFGHIJLKMNOPQRSTUVWXYZ'\n\n total = 0\n mult = 0\n for char in col:\n total += (a2z.find(char) + (26 * mult))\n mult += 1\n\n return total, row - 1", "def generate_excel_colmap(end_after=\"CS\"):\n alpha = [chr(i) for i in range(ord('A'), ord('Z...
[ "0.61751103", "0.59768474", "0.59152246", "0.5844486", "0.56204456", "0.56035423", "0.5514038", "0.54950935", "0.5492066", "0.5488739", "0.5472828", "0.54693335", "0.54417187", "0.5389668", "0.53833336", "0.53810394", "0.53658247", "0.5351053", "0.5351053", "0.53202826", "0.5...
0.57663226
4
Exit nonzero now, unless __main__.__doc__ equals "parser.format_help()"
def exit_unless_main_doc_eq(parser): file_filename = os.path.split(__file__)[-1] main_doc = __main__.__doc__.strip() parser_doc = parser.format_help() got = main_doc got_filename = "./{} --help".format(file_filename) want = parser_doc want_filename = "argparse.ArgumentParser(..." dif...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _usage(args, contents): # pragma: no cover\n sys.exit(0)", "def invoke(self) -> int:\n if self.parser is not None:\n self.parser.print_help()\n return 0", "def help(self, dummy):\r\n help = self.doc + \"\\n\"\r\n if help.find(\"%s\") > 0:\r\n help = help...
[ "0.6791217", "0.6745974", "0.67159116", "0.6627217", "0.6616108", "0.6601277", "0.64934665", "0.64894", "0.6480547", "0.64597464", "0.6455681", "0.64500916", "0.63771254", "0.635731", "0.63474774", "0.63474774", "0.63447297", "0.63438344", "0.632575", "0.6322747", "0.6318159"...
0.7570494
0
Add cells to make every row as wide as the widest row
def rows_complete(rows, cell): completed_rows = list() if rows: max_row_width = max(len(_) for _ in rows) for row in rows: completed_row = row + ((max_row_width - len(row)) * [cell]) completed_rows.append(completed_row) return completed_rows
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_width(sheet):\r\n column_widths = []\r\n for row in sheet.iter_rows():\r\n for i, cell in enumerate(row):\r\n try:\r\n # if cell alignment is vertical, use 4, else len(str(cell.value)\r\n if cell.alignment.textRotation == 90:\r\n cel...
[ "0.63688403", "0.6182518", "0.6171803", "0.60856235", "0.60856235", "0.5965144", "0.5938641", "0.58785474", "0.58003074", "0.57560503", "0.56418216", "0.5596207", "0.55565286", "0.55456686", "0.5537626", "0.551584", "0.54317534", "0.5418037", "0.5411256", "0.5403474", "0.5402...
0.0
-1
Like Print, but flush don't write Stdout and do write and flush Stderr
def stderr_print(*args, **kwargs): sys.stdout.flush() print(*args, **kwargs, file=sys.stderr) sys.stderr.flush() # else caller has to "{}\n".format(...) and flush
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pflush(*args, **kwargs):\n print(*args, **kwargs)\n sys.stdout.flush()", "def print_flush(msg):\n print(msg, end='')\n sys.stdout.flush()", "def flush(self):\n if self.stderr:\n sys.__stderr__.flush()\n else:\n sys.__stdout__.flush()", "def nostdout():\n\n ...
[ "0.7566904", "0.720894", "0.71354693", "0.6839325", "0.67390317", "0.6726788", "0.6714382", "0.6707161", "0.6686574", "0.6686574", "0.6625729", "0.65611565", "0.6557721", "0.6555904", "0.65412784", "0.6498742", "0.6490778", "0.64754987", "0.64341015", "0.64341015", "0.6431635...
0.6017821
42
Generates a hash from a file.
def add_hash(path): if re.search(r"^/.+", path): path = path[1:] # If a story, fix the path. is_story = False original_path = path if re.search(r"^\d{4}\-\d{2}\-\d{2}", path): path = "static/stories/%s.json" % path is_story = True blocksize = 32768 file_hash = hashl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_from_file(file_path):\r\n return hash_from_code(open(file_path, 'rb').read())", "def hashfile(file):\n\n hasher = hashlib.sha256()\n\n with open(file, 'rb') as afile:\n buf = afile.read(BLOCKSIZE)\n hasher.update(buf)\n\n return(hasher.hexdigest())", "def hash_file(filename):...
[ "0.8413941", "0.8247085", "0.8025007", "0.8014472", "0.8008434", "0.80050236", "0.80050236", "0.8000812", "0.7981743", "0.79328674", "0.7855871", "0.77818984", "0.77593553", "0.7746413", "0.7743753", "0.76894206", "0.7664323", "0.76567453", "0.7637276", "0.7627875", "0.762194...
0.0
-1
When bot is ready and online it prints that its online
async def on_ready(): bot.timer_manager = timers.TimerManager(bot) logger.debug("Bot is ready!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def event_ready():\n print(f\"{BOT_NICK} is online!\")", "async def do_online():\n\n download = urllib.request.urlopen(server_api)\n data = json.loads(download.read())\n online = data['online']\n await bot.send_message(c, online)", "async def on_ready(self):\n info =...
[ "0.82676", "0.788439", "0.7646275", "0.7383779", "0.73371416", "0.73308116", "0.7241785", "0.71805227", "0.71140397", "0.7073804", "0.70223606", "0.699956", "0.6934657", "0.6911272", "0.6857944", "0.6857944", "0.68562305", "0.6849317", "0.68489826", "0.6846909", "0.6825786", ...
0.68757445
14
This will square the value
def square(a): return(a**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square(value):\n return value ** 2", "def square(x):\n\n\treturn x * x", "def square_value(s):\n return s ** 2", "def my_square(y):\n\treturn (y ** 2)", "def sq(self, x):\n\t\treturn x * x", "def my_square(x):\n return x ** 2", "def square(x):\n return x * x", "def square(x: float) ->...
[ "0.85597026", "0.7863827", "0.77941453", "0.76777524", "0.76651424", "0.7657983", "0.7602298", "0.7587247", "0.75729704", "0.75606704", "0.75402296", "0.74971664", "0.7484949", "0.7417916", "0.7403273", "0.7390915", "0.7238024", "0.7178847", "0.712606", "0.7096003", "0.705398...
0.72208315
17
Extracts the resource id from the provided resource. This method validates the input resource dict and checks that the properties which names are passed in `props` argument match corresponding lists in `allowed` argument. In case of mismatch exception of type exc is raised.
def _extract_resource(resource: Optional[dict], allowed_vals: tuple[tuple[str, ...]], exc: Type[exception.CinderException], resource_name: str, props: tuple[str] = ('status',)) -> Optional[str]: resource_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_id(resource_instance, resource):\n if resource and \"id\" in resource:\n return resource[\"id\"] and encoding.force_str(resource[\"id\"]) or None\n if resource_instance:\n return (\n hasattr(resource_instance, \"pk\")\n and encoding.force_str(resource_inst...
[ "0.6286703", "0.61337155", "0.60168695", "0.5848513", "0.58351415", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5820666", "0.5730958", "0.5730958", "0.5730958", "0.5730958", "0.5730958", "0.5730958", "0.5730958", ...
0.78969824
0
Extracts and validates the volume size. This function will validate or when not provided fill in the provided size variable from the source_volume or snapshot and then does validation on the size that is found and returns said validated size.
def _extract_size(size: int, source_volume: Optional[objects.Volume], snapshot: Optional[objects.Snapshot], backup: Optional[objects.Backup]) -> int: def validate_snap_size(size: int) -> None: if snapshot and size < snapshot.volume_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manage_existing_get_size(self, volume, existing_ref):\n\n target_vol_name = existing_ref['source-name']\n\n self.client_login()\n try:\n size = self.client.get_volume_size(target_vol_name)\n return size\n except stx_exception.RequestError as ex:\n LO...
[ "0.6791952", "0.6446001", "0.63496536", "0.63496536", "0.63496536", "0.6164712", "0.6164712", "0.6162713", "0.60178965", "0.5974615", "0.59507203", "0.5860648", "0.58097893", "0.58046275", "0.57876194", "0.5696484", "0.56486726", "0.56468433", "0.56148785", "0.560581", "0.554...
0.8289146
0
Checks image existence and validates the image metadata.
def _get_image_metadata(self, context: context.RequestContext, image_id: Optional[str], size: int) -> Optional[dict[str, Any]]: # Check image existence if image_id is None: return None # NOTE(harlow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def images_exist(self):\n pass", "def check_image(image):\n\n if not path.isfile(image):\n raise ImageException('Error: Singularity image \"%s\" not found.' % image)\n return True", "def check_image(self, tag):\n image_name = self.build_image_name(tag)\n try:\n self...
[ "0.7366039", "0.73193944", "0.7294394", "0.7135925", "0.6935113", "0.69088024", "0.6900316", "0.6767054", "0.67597514", "0.66630125", "0.6647561", "0.6628914", "0.6463892", "0.64394933", "0.6425224", "0.63961387", "0.6390532", "0.63888633", "0.63705474", "0.63301325", "0.6322...
0.5633726
91
Extracts and returns a validated availability zone list. This function will extract the availability zone (if not provided) from the snapshot or source_volume and then performs a set of validation checks on the provided or extracted availability zone and then returns the validated availability zone.
def _extract_availability_zones( self, availability_zone: Optional[str], snapshot, source_volume, group: Optional[dict], volume_type: Optional[dict[str, Any]] = None) -> tuple[list[str], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_availability_zones(self, context, resource_type,\n availability_zones):", "def validate_availability_zones(self, context, resource_type,\n availability_zones):\n if not availability_zones:\n return\n if le...
[ "0.63943464", "0.57642007", "0.56424534", "0.54593474", "0.54593474", "0.54593474", "0.54593474", "0.54593474", "0.54593474", "0.5400208", "0.526738", "0.5254807", "0.5165108", "0.5131632", "0.50807095", "0.5023778", "0.5017825", "0.48526326", "0.48313126", "0.48292732", "0.4...
0.7768819
0
Returns a volume_type object or raises. Never returns None.
def _get_volume_type( context: context.RequestContext, volume_type: Optional[Any], source_volume: Optional[objects.Volume], snapshot: Optional[objects.Snapshot], image_volume_type_id: Optional[str]) -> objects.VolumeType: if volume_type: re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_type(self) -> Optional['ContainerRecipeEbsInstanceBlockDeviceSpecificationVolumeType']:\n return pulumi.get(self, \"volume_type\")", "def volume_type(self) -> Optional['ImageRecipeEbsInstanceBlockDeviceSpecificationVolumeType']:\n return pulumi.get(self, \"volume_type\")", "def volume_...
[ "0.7283127", "0.7193424", "0.7087327", "0.68482715", "0.68080485", "0.6795139", "0.6580239", "0.6580239", "0.6580239", "0.6423317", "0.62992185", "0.6290493", "0.6046961", "0.6025863", "0.5984102", "0.5798099", "0.5745572", "0.573968", "0.5659779", "0.5654844", "0.55516165", ...
0.67574567
6
Creates a database entry for the given inputs and returns details. Accesses the database and creates a new entry for the to be created volume using the given volume properties which are extracted from the input kwargs (and associated requirements this task needs). These requirements should be previously satisfied and v...
def execute(self, context: context.RequestContext, optional_args: dict, **kwargs) -> dict[str, Any]: src_volid = kwargs.get('source_volid') src_vol = None if src_volid is not None: src_vol = objects.Volume.get_by_id(context, src_volid)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_volume(self, context, volume_id, request_spec=None,\n filter_properties=None, allow_reschedule=True,\n snapshot_id=None, image_id=None, source_volid=None,\n source_replicaid=None, consistencygroup_id=None):\n\n ctx_dict = context.__di...
[ "0.5725086", "0.5718247", "0.565376", "0.55094403", "0.54922634", "0.54513985", "0.5444849", "0.5347211", "0.5332229", "0.53095233", "0.52728635", "0.52706724", "0.5251625", "0.5236023", "0.5232849", "0.52302337", "0.52094674", "0.52048177", "0.5203383", "0.51883715", "0.5169...
0.6186938
0
Constructs and returns the api entrypoint flow.
def get_flow(db_api, image_service_api, availability_zones, create_what, scheduler_rpcapi=None, volume_rpcapi=None): flow_name = ACTION.replace(":", "_") + "_api" api_flow = linear_flow.Flow(flow_name) api_flow.add(ExtractVolumeRequestTask( image_service_api, availability_zone...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def entry_point():", "def entry_point():", "def entry_point():", "def main():\n return execute_api(Freta(), [Endpoint], __version__)", "def start_flow(api_url):\n authorization_url, state = client.authorization_url(authorization_base_url)\n webbrowser.open(authorization_url)\n redirect_response...
[ "0.6311223", "0.6311223", "0.6311223", "0.6176308", "0.59881395", "0.5891488", "0.5844838", "0.5835675", "0.5780259", "0.5699845", "0.5690561", "0.5665652", "0.5637382", "0.56177443", "0.5609358", "0.5598943", "0.5583704", "0.5568971", "0.5568607", "0.5525004", "0.5508841", ...
0.5800678
8
Function to convert string objects to Python spatial objects
def spatializer(row): ############################# # coordinates field ############################# try: # look for the coordinates column data = row['coordinates'].strip(' \t\n\r') except: pass try: import shapel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geos_geom_from_py(ob, create_func=...): # -> tuple[Any | Unknown, Unknown]:\n ...", "def convertor(geometry, method=\"wgs2gcj\"):\n if geometry['type'] == 'Point':\n coords = geometry['coordinates']\n coords[0], coords[1] = methods[method](coords[0], coords[1])\n elif geometry['type']...
[ "0.6853914", "0.64596736", "0.6459579", "0.62780887", "0.62452716", "0.61807716", "0.60729116", "0.59981173", "0.59837383", "0.58806914", "0.58697754", "0.5864173", "0.5859972", "0.5858616", "0.5851232", "0.5834999", "0.5803715", "0.57748467", "0.5740699", "0.5716194", "0.567...
0.0
-1
Takes Keyhole Markup Language Zipped (KMZ) or KML file as input. The output is a pandas dataframe, geopandas geodataframe, csv, geojson, or shapefile.
def keyholemarkup2x(file,output='df'): r = re.compile(r'(?<=\.)km+[lz]?',re.I) try: extension = r.search(file).group(0) #(re.findall(r'(?<=\.)[\w]+',file))[-1] except IOError as e: logging.error("I/O error {0}".format(e)) if (extension.lower()=='kml') is True: buffe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readKML(filename):\n\n kml_file = path.join(filename)\n\n #### se leen los elementos del KML\n with open(kml_file) as f:\n folder = parser.parse(f).getroot().Document.Folder\n\n #### se separan los elementos, nombres de los puntos y las coordenadas\n plnm=[]\n cordi=[]\n for pm in f...
[ "0.62045234", "0.59694266", "0.5614283", "0.5588096", "0.55593634", "0.55198014", "0.54530036", "0.5381782", "0.53294533", "0.532009", "0.52355796", "0.52240384", "0.52035177", "0.51956874", "0.51648325", "0.5145558", "0.51388747", "0.51381135", "0.50973314", "0.5092485", "0....
0.7567482
0
Emits metric to datadog. Returns nothing.
def emit(source, event, event_type): if event_type in ALLOWED_EVENTS: statsd.increment( "segment.event", tags=[ "source:" + source, "event:" + "-".join(event.split()), "type:" + event_type, ], )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emit(self, metric):\n metric_data = self.unmarshal(metric)\n self.logger.log(\n self.log_level, metric.DEFAULT_LOG_FORMAT.format(**metric_data)\n )", "def sendMeasurement(self, metric, value, source, timestamp=None):\n sys.stdout.write('{0} {1} {2} {3}\\n'.format(metric...
[ "0.69526815", "0.69020224", "0.6604191", "0.6255041", "0.62070864", "0.61427426", "0.6100609", "0.5948163", "0.58825403", "0.5874048", "0.5786339", "0.5769456", "0.576064", "0.57383424", "0.57234097", "0.57168025", "0.5674542", "0.56710356", "0.5647139", "0.5640953", "0.56353...
0.0
-1
Verifies signature (ensures matched shared secrets). Returns Bool.
def check_signature(signature, data): if SIGNATURE_DISABLED: return True # check signature try: digest = hmac.new( SEGMENT_SHARED_SECRET.encode(), msg=data, digestmod=hashlib.sha1 ).hexdigest() if digest == signature: return True else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(self, request, consumer, token, signature):\r\n built = self.sign(request, consumer, token)\r\n return built == signature", "def check_signature(signature, *args, **kwargs):\n return hmac.compare_digest(signature, create_signature(*args, **kwargs))", "def verify(signature: Signature,...
[ "0.77133894", "0.7456966", "0.7451283", "0.7370368", "0.7342798", "0.723132", "0.723132", "0.7131091", "0.7098203", "0.70439786", "0.7042887", "0.70322865", "0.6982362", "0.6980211", "0.69460005", "0.6936151", "0.6911655", "0.68586284", "0.6817355", "0.67785805", "0.67738426"...
0.76915914
1
Main function. Accepts JSON payload on POST only.
def segment2datadog(source): print(f"Received request on /api/{source}") signature = request.headers.get("x-signature", "") if not check_signature(signature=signature, data=request.data): abort(403, "Signature not valid.") content = request.get_json() event_type = content["type"] if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_post_parse_json(self, *args, **kwargs): # real signature unknown\n pass", "def post_algorithm():\n try:\n request_json = request.get_json()\n result = json.dumps([])\n response = app.response_class(\n response=result,\n status=200,\n mimetype...
[ "0.7054873", "0.6815509", "0.67008907", "0.66781956", "0.6614997", "0.6503812", "0.64270383", "0.6375233", "0.62853044", "0.62853044", "0.62686986", "0.62677866", "0.6220274", "0.6206321", "0.6182537", "0.611851", "0.6091516", "0.6067001", "0.6007093", "0.5983591", "0.5981839...
0.0
-1
Return count number of prime numbers, starting at 2.
def primes(count): primes = [] number_to_check = 2 while len(primes) < count: # check if number is prime # if prime, add to list # if not prime, move on # increment number to check is_prime = True for num in range(2,number_to_check): if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_primes(n):\n i, total = 1, 0\n while i <= n:\n if is_prime(i):\n total += 1\n i += 1\n return total", "def count_prime():\n nums = []\n for i in range(2, 10000):\n if is_prime(i):\n nums.append(i)\n return nums", "def prime_pi(n):\n if n...
[ "0.7909468", "0.7787611", "0.7671918", "0.73836786", "0.70847523", "0.7067671", "0.7066009", "0.7037659", "0.6979948", "0.69589514", "0.6910707", "0.67586225", "0.67508656", "0.6749178", "0.67472607", "0.67446923", "0.67408115", "0.66339564", "0.6617919", "0.6593536", "0.6567...
0.6282796
35
lowercase sentence `sent` given as parameter
def lowercase(self, sent): SPECIAL_TAG_PREFIX = ur"__" _sent = [] for w in sent: # make sure w is in network vocabulary if not w.startswith(SPECIAL_TAG_PREFIX) and \ w.lower() in self.word_vectors.getVocab(): _sent.append(w.lower()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lower_caser(self, sentence):\n return sentence.strip().lower()", "def lowerCase(self,phrase):\n if(\"normalizeText\" in self._classes):\n return self._normalize.lowerCase(phrase)", "def handle_sentence_simple(self, sentence, ctxinfo):\n global text_version\n global mo...
[ "0.7798232", "0.70910996", "0.6897251", "0.67695826", "0.67441666", "0.6727888", "0.66985834", "0.6653774", "0.6544608", "0.6498189", "0.64789736", "0.6471879", "0.6421757", "0.64176786", "0.64147437", "0.6348549", "0.6320604", "0.6318996", "0.6287475", "0.6287458", "0.626490...
0.7131649
1
this function returns a list with word vectors for the given sentence
def text_to_vecs(self): # convert word strings into word vectors sent_vec = [] for w in self.sentence: if w in self.word_vectors.getVocab(): sent_vec.append( self.word_vectors.getWordVectors()[w] ) else: sent_vec.append( self.word_vectors.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word2vec(self, sentence: str):\n tokens = nltk.word_tokenize(sentence)\n v = [self.word_dict.get(token, 0) for token in tokens]\n return v", "def _words_to_vec(self, sentence):\n return torch.FloatTensor([self._use_embeddings(word) for word in sentence])", "def sentences2vec(sel...
[ "0.82366437", "0.7883474", "0.7258772", "0.7223416", "0.7195357", "0.7181377", "0.7163394", "0.7127464", "0.7067281", "0.7060212", "0.6987103", "0.68918663", "0.6876809", "0.6845333", "0.68435115", "0.6823049", "0.68151784", "0.67574716", "0.67419696", "0.6704787", "0.6700244...
0.7729908
2
Get permissions for a given path.
def getPermission(self, session, category, action, path): path = path.decode('utf-8') try: operation = getOperation(category, action) except KeyError as error: session.log.exception(error) error = TBadRequest( 'Action %r not possible on catego...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_permission(path):\n return oct(stat.S_IMODE(os.stat(path).st_mode))", "def octopus_permissions_get(self, msg, args):\r\n return self.permissions.get_permissions()", "def get_permissions():\n return config.get_cfg_storage(ID_PERMISSION)", "def get_permissions(self):\n\t\treturn call_sdk_f...
[ "0.68241113", "0.6537136", "0.64681613", "0.64153135", "0.62711513", "0.60393375", "0.60207146", "0.5920989", "0.5871282", "0.5864923", "0.58453476", "0.5794055", "0.5773593", "0.5764084", "0.5757678", "0.57044595", "0.57008797", "0.56832653", "0.567347", "0.566702", "0.56650...
0.59620655
7
Update permissions for a given path.
def updatePermission(self, session, category, action, path, policyAndExceptions): path = path.decode('utf-8') try: operation = getOperation(category, action) except KeyError as error: session.log.exception(error) error = TBadRequest( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_permissions(path, permission='777'):\r\n if os.path.exists(path):\r\n subprocess.call('chmod -R %s %s'%(permission,path),shell=True)\r\n else:\r\n raise NameError('invalid path %s'% path)", "def chmod(self, path, mod):\n self._call(\"SETPERMISSION\", method=\"put\", path=pat...
[ "0.76146567", "0.7123683", "0.6615019", "0.6444273", "0.63782036", "0.6246743", "0.62407917", "0.61677694", "0.6152735", "0.60507303", "0.60146147", "0.6010073", "0.58685565", "0.5853819", "0.5815282", "0.57976615", "0.57416964", "0.5725209", "0.57007605", "0.5695074", "0.568...
0.6568419
3
Generate a presigned URL to share an S3 object
def create_presigned_url(bucket_name, object_name, expiration=3600): # Generate a presigned URL for the S3 object s3_client = boto3.client('s3') try: response = s3_client.generate_presigned_url('get_object', Params={'Bucket': bucket_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_presigned_url(bucket_name, object_name):\n\n logger = logging.getLogger(\"SimpleReplayLogger\")\n\n s3_client = boto3.client('s3')\n try:\n response = s3_client.generate_presigned_url('get_object',\n Params={'Bucket': bucket_name,\n ...
[ "0.781918", "0.7818755", "0.775786", "0.7680955", "0.7658105", "0.7649027", "0.76473826", "0.7646118", "0.76096344", "0.75693727", "0.7362465", "0.73525697", "0.73306215", "0.7309494", "0.7161238", "0.7114588", "0.70948786", "0.7060615", "0.70502365", "0.7022286", "0.70070326...
0.76516396
5
Generate classification samples (images + target variable) and beta.
def load(n_samples=100, shape=(30, 30, 1), snr=2., sigma_logit=5., random_seed=None, **kwargs): X3d, y, beta3d = dice5regression.load(n_samples=n_samples, shape=shape, r2=1.0, random_seed=random_seed, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_train_batch(self):\r\n batch = []\r\n labels =[]\r\n num_groups = self.batch_size // self.batch_k\r\n sampleed_classes = np.random.choice(self.train_class_ids,num_groups,replace=False)\r\n for class_id in sampleed_classes:\r\n img_fname = np.random.choice(se...
[ "0.6656381", "0.64440495", "0.6413988", "0.638363", "0.63697946", "0.6313206", "0.63107324", "0.6300423", "0.62833965", "0.6268202", "0.62545025", "0.6234451", "0.62101275", "0.62069523", "0.6193542", "0.61783683", "0.6169238", "0.61611104", "0.6116174", "0.61135644", "0.6112...
0.0
-1
Get code block based on position in codes, sized based on opcode.
def get_code_block(self, pos, opcode): if opcode == 99: print('99 IS THE END') block_size = 0 return [self.codes[pos]] elif opcode in (1, 2, 7, 8): block_size = 4 elif opcode in (5, 6): block_size = 3 elif opcode in (3,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_code(self, data_start, data_size, offset):\n first_block = 0x1000 - data_start % 0x1000\n full_blocks = ((data_size + (data_start % 0x1000)) / 0x1000) - 1\n left_over = (data_size + data_start) % 0x1000\n\n code = \"\"\n\n # Deal with reads that are smaller than a block\n...
[ "0.6831133", "0.5879704", "0.58197665", "0.57767147", "0.5509524", "0.53633565", "0.53602576", "0.53167605", "0.52453434", "0.5240448", "0.52288264", "0.52158344", "0.520227", "0.51487017", "0.51393586", "0.5114082", "0.5100469", "0.50978047", "0.50817233", "0.5070789", "0.50...
0.8200708
0
Get the opcode string from a codeblock.
def get_opcode(self, code): opcode = int(str(code)[-2:]) return opcode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_op_code_str(self, op):\n try:\n from tflite.BuiltinOperator import BuiltinOperator\n except ImportError:\n raise ImportError(\"The tflite package must be installed\")\n\n op_code_list_idx = op.OpcodeIndex()\n op_code_id = self.model.OperatorCodes(op_code_li...
[ "0.6249712", "0.5808073", "0.5758956", "0.57538587", "0.570763", "0.570763", "0.5671009", "0.56138945", "0.55983204", "0.55761415", "0.557361", "0.55591536", "0.5555312", "0.5523228", "0.5506385", "0.5496092", "0.5473834", "0.5467974", "0.5443687", "0.54090476", "0.53862494",...
0.6715364
0
Get the two modes for a code block's parameters.
def get_modes(self, code_block): # FUCK YOU INDEX ERRORS, LIST COMPS, AND EVEN YOU LAMBDAS I DON'T NEED PRETTY # 0 = pos mode # 1 = imm mode modes, mode_codes = [0, 0], list(reversed(str(code_block[0])))[2:] x = 0 for mode in mode_codes: modes[x] = int(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_modes(self):\n return self.__modes", "def partial_modes(self, level, node=None):\n if node:\n return self.operator.modes[self._index_list(level, node)]\n\n indeces = [self._index_list(level, i) for i in range(2**level)]\n return np.hstack(tuple([self.operator.modes[idx...
[ "0.6424788", "0.6175102", "0.6116689", "0.60188097", "0.5950464", "0.5902551", "0.58972424", "0.5825283", "0.5721097", "0.565327", "0.5622471", "0.558995", "0.5571778", "0.5556218", "0.5544023", "0.5539861", "0.5522755", "0.54928595", "0.54884505", "0.54445195", "0.54361504",...
0.712229
0
Get the value for each code based on if it's position mode (pos_mode) or immediate mode (imm_mode) and its position in the code block.
def get_values(self, code_block): pos_mode, imm_mode = 0, 1 x, values = 1, [] modes = self.get_modes(code_block) for mode in modes: if mode == pos_mode: values.append(int(self.codes[code_block[x]])) elif mode == imm_mode: va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_modes(self, code_block):\r\n # FUCK YOU INDEX ERRORS, LIST COMPS, AND EVEN YOU LAMBDAS I DON'T NEED PRETTY\r\n # 0 = pos mode\r\n # 1 = imm mode\r\n modes, mode_codes = [0, 0], list(reversed(str(code_block[0])))[2:]\r\n x = 0\r\n for mode in mode_codes:\r\n ...
[ "0.73331314", "0.5679162", "0.5547544", "0.5291059", "0.52655387", "0.52335066", "0.52260995", "0.5219121", "0.520287", "0.51944584", "0.5185736", "0.51602906", "0.51379883", "0.50631815", "0.5047685", "0.50382125", "0.50302804", "0.48911408", "0.48609778", "0.4847673", "0.48...
0.79959965
0
Remove the base line using a SavitzkyGolay method
def remove_baseline(self): print(" \t Apply Savitzky-Golay filter \t %d" %self.nwin) base_savgol = signal.savgol_filter(self.input, self.nwin, 1) self.input_nobase = self.input - base_savgol
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cut_line(self):\r\n self.parachute.pop(0)", "def remove_line(self, origin):\n current_tile = self.board[origin[0]][origin[1]]\n\n if current_tile.is_dot:\n temp = current_tile.next\n current_tile.next = None\n current_tile = temp\n\n # Remove color...
[ "0.7042391", "0.64433926", "0.6224675", "0.61690134", "0.61472166", "0.60406417", "0.59359074", "0.593024", "0.59090394", "0.5900306", "0.5895631", "0.5871592", "0.58644634", "0.58512706", "0.58499116", "0.5848815", "0.58475477", "0.58448726", "0.57755435", "0.5750193", "0.57...
0.66475266
1
denoise the data using the 2stage kurtosis denoising
def denoise(self): #make sure the data has a len dividible by 2^2 self.len_swt = self.len while not (self.len_swt/4).is_integer(): self.len_swt -= 1 inp = self.input_nobase[:self.len_swt] self.wave = pywt.Wavelet(self.wave_type) nLevel = pywt.swt_max_level(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ICA_Denoise(Y, ica_model, noise_std):\n\n # TODO: YOUR CODE HERE", "def filter_denoise(self, x):\n b, a = self.c_notch\n return filtfilt(b, a, x)", "def MVN_Denoise(Y, mvn_model, noise_std):\n return calc_weiner_filter(Y, mvn_model.mean, mvn_model.cov, noise_std)", "def run_denoising(...
[ "0.6254114", "0.6207546", "0.61320424", "0.5874847", "0.5839554", "0.57731473", "0.5748484", "0.5744758", "0.5728441", "0.572605", "0.56469405", "0.56469405", "0.56469405", "0.56418467", "0.56233346", "0.56080765", "0.55805033", "0.5566257", "0.55619085", "0.55411446", "0.552...
0.68143743
0
Detect bursts of activity.
def get_burst(self): print('\t Detect bursts \t\t\t %d %1.2f' %(self.burst_s,self.burst_gamma)) # compute the cum sum of the positive values of the datan ... _tmp = np.copy(self.input_denoised) _tmp[_tmp<0] = 0 _tmp += 1E-12 self.input_cummulative = np.cumsum(_tmp) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_burst_dispersion(self):\n # some reproducible arbitrariness\n np.random.seed(7342642)\n\n n = 25\n t_max = 50\n dt = 0.1\n n_sim = 10\n \n G = RateHVCLayer(n)\n\n burst_starts = []\n for i in xrange(n_sim):\n M = simulation.StateMonitor(G, 'out')\n sim = simulation....
[ "0.6244456", "0.6123166", "0.5961598", "0.5944838", "0.5854187", "0.56908864", "0.5619055", "0.5532552", "0.5509673", "0.5503266", "0.54505146", "0.5449114", "0.5444159", "0.54377466", "0.5432748", "0.53841823", "0.5360802", "0.53578424", "0.5348974", "0.53150326", "0.5264427...
0.5991301
2
Compute the rolling kurtosis.
def _rolling_kts(y,N): # number of points nPTS,N2 = len(y), int(N/2) # define the out kts = np.zeros(nPTS) # for all points comopute snr for i in range(nPTS): s,e = i-N2, i+N2 if s<0: s = 0 if s > nPTS-1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kurtosis(self) -> float:\n return float(ss.kurtosis(self.tsdf.pct_change(), fisher=True, bias=True, nan_policy='omit'))", "def calc_kurtosis(sig):\n return kurtosis(sig)", "def kurtosis(r):\n demeaned_r = r - r.mean()\n # use the population standard deviation, so set dof=0\n sigma_r = r...
[ "0.7280021", "0.72142196", "0.70349604", "0.6872883", "0.68170637", "0.679628", "0.62929606", "0.6168766", "0.6020426", "0.5842821", "0.5828331", "0.5625072", "0.56153303", "0.56038046", "0.5593879", "0.55546606", "0.55122936", "0.538985", "0.53348935", "0.5323968", "0.530855...
0.73427486
0
Check if the characters in string s are in ASCII, U+0U+7F.
def isascii(s): return len(s) == len(s.encode())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __contains_nonascii_characters(string):\n for c in string:\n if not ord(c) < 128:\n return True\n return False", "def ascii_hexchar(s: str) -> bool:\n return frozenset(s).issubset(_ascii_h)", "def ascii_printable(s: str) -> bool:\n return frozenset(s).issubset(...
[ "0.77660894", "0.76544166", "0.7450944", "0.7449345", "0.7429723", "0.74006027", "0.7388017", "0.73855674", "0.73839515", "0.706439", "0.69804156", "0.6951423", "0.6786677", "0.67115295", "0.6556867", "0.6519561", "0.65190905", "0.64559346", "0.6436238", "0.6435861", "0.63829...
0.75282675
3
Authenticates the user either by existing pickle token, or generate new one // TODO add instruction on how to get the credentials.json
def get_creds(): # If modifying these scopes, delete the file token.pickle. SCOPES = ['https://www.googleapis.com/auth/gmail.readonly'] creds = None dir_pre = '../secrets' # The file token.pickle stores the user's access and refresh tokens, and is # created automatically when the authorization f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(self):\n #it's weird i have to do this here, but the code makes this not simple\n auth_json={'email':self.user, 'password':self.password}\n #send a post with no auth. prevents an infinite loop\n auth_response = self.post('/auth', data = json.dumps(auth_json), auth =\n ...
[ "0.6854116", "0.67800575", "0.67152345", "0.66444993", "0.66333526", "0.6539042", "0.6511123", "0.6445077", "0.63270456", "0.6323045", "0.63152647", "0.6270948", "0.6254854", "0.624649", "0.6243996", "0.62366295", "0.6230506", "0.623001", "0.6220421", "0.6217435", "0.6210547"...
0.0
-1
list basic user info
def list_user_info(service): profile = service.users().getProfile(userId='me').execute() return profile
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info(self):\n response = self.query('user_info')\n return response", "def list_users(item):\n users = User.load_all_users(item)\n for user in users:\n print(user.username)", "def show_user_info():\n \n vprint( 'Effective User :', os.geteuid())\n vprint( 'Effective Gr...
[ "0.74712443", "0.7329571", "0.7306948", "0.7285574", "0.7219221", "0.7200625", "0.71875286", "0.7088998", "0.7065823", "0.70622015", "0.70473915", "0.70473146", "0.70240086", "0.7016065", "0.7005358", "0.69844407", "0.6974977", "0.69546765", "0.69373524", "0.6934553", "0.6922...
0.68284345
31
get a nice string summary of a curation
def getannotationstrings2(cann): cdesc = '' if cann['description']: cdesc += cann['description'] + ' (' if cann['annotationtype'] == 'diffexp': chigh = [] clow = [] call = [] for cdet in cann['details']: if cdet[0] == 'all': call.append(cde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary_string(self) -> str:", "def summary(self):\n return ''", "def summary(self) -> str:\n pass", "def summary(self):\r\n return '%s%s: %s%s %s%s' % (BLUE, self.title,\r\n GREEN, self.description,\r\n NORMAL, se...
[ "0.7652006", "0.70306504", "0.69144917", "0.68029356", "0.67171127", "0.66573215", "0.66102165", "0.6602745", "0.65948147", "0.6494361", "0.6470903", "0.6447873", "0.639542", "0.6391767", "0.63757336", "0.6369811", "0.636381", "0.6358612", "0.63477284", "0.6311934", "0.629051...
0.0
-1
The start handler must perform setup method
def setup(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _start(self):\n pass", "def setupStarted(self, *args, **kwargs): # real signature unknown\n pass", "def start(self):\n ...", "def _start(self):", "def start (self):\n pass", "def start (self):\n pass", "def start(self):\r\n pass", "def start(self):\n ...
[ "0.80769825", "0.8064321", "0.7994348", "0.78918386", "0.78906196", "0.78906196", "0.7853309", "0.7844179", "0.7844179", "0.7844179", "0.7844179", "0.7844179", "0.7844179", "0.7844179", "0.7844179", "0.78069323", "0.78069323", "0.78069323", "0.78069323", "0.78069323", "0.7806...
0.71826375
78
If the successful execution of the handler, will run this method
def finish(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler(self, *args, **kwargs):\n return True", "def on_success(self):\n pass", "def on_success(self) -> None:", "def _handle_task_succeeded(self):\n if self.on_success:\n return self.on_success(self)\n else:\n return HandlerResult.cont()", "def OnSucce...
[ "0.7266319", "0.7121877", "0.70454407", "0.7027097", "0.69653887", "0.68011975", "0.6729216", "0.670248", "0.670248", "0.670248", "0.670248", "0.670248", "0.670248", "0.6698354", "0.6684048", "0.66771865", "0.6661995", "0.66406864", "0.66227895", "0.6568652", "0.6522288", "...
0.0
-1
Called after this handler lifecycle,this method does not allow an exception is thrown.
def destroy(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_exception(self):\n pass", "def handle(self) -> None:", "def handle(self):", "def exception_handler(self, exception):\n pass", "def handle(self):\n raise NotImplementedError", "def handle_err(self):\n pass", "def error(self, handler):\n pass", "def _on_excepti...
[ "0.7447773", "0.7214745", "0.7060776", "0.6870695", "0.6805715", "0.67974174", "0.671484", "0.6667653", "0.6628348", "0.6628348", "0.6628348", "0.6628348", "0.6628348", "0.65371287", "0.6492414", "0.6466798", "0.6466798", "0.64180535", "0.64134246", "0.63910395", "0.6383068",...
0.0
-1
Start a request,this method does not allow an exception is thrown.
def start_request(self,request_handler,client_address): logger.debug('start_request(%s:%s)' % client_address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_request(self):\n self.session_manager.start_request()", "def _StartRequest(self, request_id, manager):\n pending_path = self._GetRequestPathname(request_id, self._PENDING)\n with open(pending_path, 'r') as f:\n request_object = pickle.load(f)\n manager.StartTask(request_id, request...
[ "0.7657946", "0.69753915", "0.69528455", "0.69419944", "0.67416626", "0.6675796", "0.6675425", "0.6604838", "0.66033286", "0.6578297", "0.65579545", "0.655595", "0.65280735", "0.63916385", "0.6389097", "0.6380641", "0.6327037", "0.6309479", "0.62897944", "0.62629443", "0.6260...
0.6528585
12
Verify request,this method does not allow an exception is thrown.
def verify_request(self, request_handler, client_address): logger.debug('verify_request(%s:%s)' % client_address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_request(self, request, client_address):\n\t\treturn True", "def verify(self, response):", "def verify(self, request):\n return Response(None, status=status.HTTP_204_NO_CONTENT)", "def verify(self):\r\n pass", "def verify(self):\n pass", "def verify(self):\n pass", ...
[ "0.7655331", "0.7453941", "0.69403994", "0.6904828", "0.6823398", "0.6823398", "0.67689514", "0.6765635", "0.6706381", "0.66113174", "0.6601375", "0.6520301", "0.65013844", "0.641781", "0.6360182", "0.63253134", "0.63203263", "0.6315326", "0.62872684", "0.6265284", "0.6264860...
0.6829749
4
Handler is called when an exception occurs,this method does not allow an exception is thrown.
def handle_error(self, request_handler, client_address): logger.debug('handle_error(%s:%s)' % client_address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception_handler(self, exception):\n pass", "def on_exception(self):\n pass", "def _on_exception(self, exception):\n pass", "def handle_expt(self):\r\n self._perform_on_error_handling()", "def error(self, handler):\n pass", "def handle_err(self):\n pass", ...
[ "0.84199923", "0.82593095", "0.7844722", "0.77625847", "0.77586204", "0.7583584", "0.7447186", "0.73315513", "0.72311974", "0.72022784", "0.71068513", "0.7021926", "0.696029", "0.69080865", "0.6901035", "0.6872464", "0.6855411", "0.6828169", "0.676794", "0.6766311", "0.672959...
0.64839387
33
Closing request called,this method does not allow an exception is thrown.
def close_request(self,request_handler, client_address): logger.debug('close_request(%s:%s)' % client_address)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_request(self, request):\n\t\tpass", "def close_request(self, request):\n\t\trequest.close()", "def closeRequest(self):\n self.get_bmc_website()\n self.__closeMyRequest = Close(self.browser)\n self.__closeMyRequest.closeRequest()", "def close(self):", "def close(self):", "de...
[ "0.87857294", "0.8312502", "0.75678617", "0.706756", "0.706756", "0.706756", "0.706756", "0.706756", "0.706756", "0.706756", "0.706756", "0.706756", "0.706756", "0.6996744", "0.6996744", "0.6996744", "0.69872475", "0.69872475", "0.6945814", "0.693658", "0.69229454", "0.6922...
0.71879524
3
Function that performs a convolution on images with channels
def convolve_channels(images, kernel, padding='same', stride=(1, 1)): m = images.shape[0] image_h = images.shape[1] image_w = images.shape[2] filter_h = kernel.shape[0] filter_w = kernel.shape[1] s1 = stride[0] s2 = stride[1] if padding == 'valid': pad_h = 0 pad_w = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clConvolution(self, size, mask):", "def convolve_channels(images, kernel, padding='same', stride=(1, 1)):\n m, h, w, c = images.shape\n KernelHeight, kernelWidth, c = kernel.shape\n StrideHeight, StrideWidth = stride\n\n if padding == 'valid':\n PaddingHeight = 0\n PaddingWidth = 0\...
[ "0.78048617", "0.76200247", "0.75978273", "0.7558364", "0.74831325", "0.7368806", "0.73137546", "0.72811294", "0.722849", "0.7214952", "0.71894956", "0.71754706", "0.71480143", "0.71439964", "0.7123431", "0.7122098", "0.7074655", "0.70513123", "0.70480937", "0.7038724", "0.70...
0.77049017
1
Copy test data to working directory so ``parse_spec`` works properly for both ``stsynphot`` and ASTROLIB PYSYNPHOT.
def setup_module(module): for datafile in datafiles: src = get_pkg_data_filename(os.path.join('data', datafile)) shutil.copyfile(src, datafile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processSpecs(self):\n specSubDirName=\"_spec\"\n codestructure = CodeStructure()\n for dir in self._dirs:\n if q.system.fs.exists(q.system.fs.joinPaths(dir,specSubDirName)):\n files=q.system.fs.listPyScriptsInDir(q.system.fs.joinPaths(dir,specSubDirName))\n ...
[ "0.54588157", "0.5456994", "0.54161704", "0.54131126", "0.5380832", "0.535379", "0.53135467", "0.52902395", "0.52726877", "0.5257501", "0.5230544", "0.52054006", "0.5198462", "0.51969486", "0.51810604", "0.5168432", "0.513813", "0.5131549", "0.51290935", "0.5128934", "0.51254...
0.5101221
23
Clean up test data in working directory.
def teardown_module(module): for datafile in datafiles: os.remove(datafile)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n shutil.rmtree(self._data_dir_path)", "def tearDown(cls):\n\n # cls.test_mmp_series_object.clean_out_data_seriesobj()\n # reusable data struct\n cls.test_mmp_series_object.clean_out_data_seriesobj()\n cls.test_dataset_testresults.clear()\n # reusable...
[ "0.7803513", "0.76463795", "0.7637779", "0.7631515", "0.7631515", "0.7625458", "0.7618858", "0.7587505", "0.75759536", "0.75549775", "0.7548522", "0.75451297", "0.7540642", "0.75375634", "0.75086534", "0.7506745", "0.750453", "0.7503099", "0.74924654", "0.74106455", "0.739894...
0.69839936
97
An instrumented Template render method, providing a signal that can be intercepted by the test system Client
def instrumented_test_render(self, context): signals.template_rendered.send(sender=self, template=self, context=context) return self.nodelist.render(context)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_to_template_mock(*_args):", "def _render(self) -> str:\n html = self._template.render(self._transient_context)\n self._transient_context = None\n return html", "def patch_render_template(self):\n mock_render = Mock(spec=render_template)\n mock_render.return_value =...
[ "0.685287", "0.6700654", "0.66776145", "0.6645942", "0.66436213", "0.6585426", "0.6585426", "0.6585426", "0.6585426", "0.6585426", "0.6585426", "0.6547666", "0.65277296", "0.65042114", "0.6500498", "0.64901316", "0.6445812", "0.64102834", "0.64102834", "0.64102834", "0.638103...
0.75868696
0
Register dataset related changes. For local datasets, look them up, record the dataset event, queue dagruns, and broadcast the dataset event
def register_dataset_change( self, *, task_instance: TaskInstance, dataset: Dataset, extra=None, session: Session, **kwargs ) -> None: dataset_model = session.scalar(select(DatasetModel).where(DatasetModel.uri == dataset.uri)) if not dataset_model: self.log.warning("DatasetModel ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datasets(self, datasets):\n\n self._datasets = datasets", "def add_to_dataset(self, dataset: Dataset):\n pass", "def datasets(self, datasets):\n self.__datasetsAll = datasets\n self.__datasets = list(datasets)\n self.__axisDomains = None\n for ds in self.__datasets...
[ "0.56935036", "0.56498915", "0.5641686", "0.54096603", "0.5342046", "0.5339496", "0.5286913", "0.52014285", "0.5195956", "0.5182093", "0.5152727", "0.5134192", "0.50968635", "0.5025282", "0.5021174", "0.5016711", "0.49956772", "0.4995023", "0.49723122", "0.49516952", "0.49417...
0.7455701
0
Retrieve the dataset manager.
def resolve_dataset_manager() -> DatasetManager: _dataset_manager_class = conf.getimport( section="core", key="dataset_manager_class", fallback="airflow.datasets.manager.DatasetManager", ) _dataset_manager_kwargs = conf.getjson( section="core", key="dataset_manager_kw...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_manager(self):\n\n return self._data_manager", "def _get_data_manager(self):\n\n ftype = self.conf['General']['save_as']\n if ftype == 'npz':\n return NPZDataManager(self.conf, self.log)\n elif ftype == 'hdf5':\n return HDF5DataManager(self.conf, sel...
[ "0.84404564", "0.7547824", "0.69010204", "0.6821794", "0.6821317", "0.6761993", "0.67312783", "0.6668024", "0.6635121", "0.6446262", "0.64157367", "0.6388273", "0.6379517", "0.63311225", "0.62744164", "0.6216641", "0.618155", "0.61262697", "0.6106576", "0.6034368", "0.6029758...
0.7545222
2
Create the cifar10 dataset.
def create_cifar10_dataset(cifar_dir): ds = de.Cifar10Dataset(cifar_dir) training = True resize_height = 224 resize_width = 224 rescale = 1.0 / 255.0 shift = 0.0 repeat_num = 10 batch_size = 32 # define map operations random_crop_op = vision.RandomCrop((32, 32), (4, 4, 4, 4)) #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cifar10(transform=transforms.ToTensor()):\n\n\t# Directories\n\tscript_dir = os.path.dirname(os.path.realpath(__file__))\n\tdata_dir = os.path.join(script_dir, 'data', 'cifar10')\n\n\t# Load training set, downloading if necessary\n\tdataset = datasets.CIFAR10(data_dir, train=True, transform=transform, download...
[ "0.7966689", "0.75073844", "0.7161493", "0.71176726", "0.7109075", "0.7096102", "0.69510275", "0.6845723", "0.6814827", "0.68126905", "0.68040884", "0.670599", "0.66763234", "0.6664927", "0.65709835", "0.656717", "0.64492744", "0.6426107", "0.6410631", "0.6406311", "0.6405234...
0.7870253
1
If an identical token already exists in dictionary, will merge tokens and cumulate their counts. Checks to see that morphology and pronunciations are identical, otherwise the tokens will not be merged.
def AddToken(self, token, merge=False): token.SetLangId(self.id_) if not merge: self.tokens_.append(token) else: exists = self.MatchToken(token) if exists is None: self.tokens_.append(token) else: exists.IncrementCount(token.Count())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_token_counters(\n token_counter1: Dict[str, int], token_counter2: Dict[str, int]\n ) -> Dict[str, int]:\n for token, number in token_counter2.items():\n if token in token_counter1:\n token_counter1[token] += number\n else:\n token_count...
[ "0.66677827", "0.595904", "0.5881344", "0.5862591", "0.58134353", "0.5744879", "0.5677451", "0.5661367", "0.56101036", "0.553344", "0.53926057", "0.5391481", "0.5351704", "0.53189", "0.5299593", "0.5298756", "0.5296687", "0.5291537", "0.5290174", "0.52845526", "0.5283439", ...
0.51305556
43
Merge identical tokens and cumulate their counts. Checks to see that morphology and pronunciations are identical, otherwise the tokens will not be merged.
def CompactTokens(self): map = {} for token_ in self.tokens_: hash_string = token_.EncodeForHash() try: map[hash_string].append(token_) except KeyError: map[hash_string] = [token_] ntokens = [] keys = map.keys() keys.sort() for k in keys: token_ = map[k][0] for otok...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_token_counters(\n token_counter1: Dict[str, int], token_counter2: Dict[str, int]\n ) -> Dict[str, int]:\n for token, number in token_counter2.items():\n if token in token_counter1:\n token_counter1[token] += number\n else:\n token_count...
[ "0.6380701", "0.6303569", "0.5749085", "0.56798166", "0.5565582", "0.5413877", "0.536061", "0.53069425", "0.52431405", "0.52182555", "0.51754475", "0.5064471", "0.50563955", "0.50545037", "0.50540966", "0.5040915", "0.5038194", "0.5008785", "0.4992635", "0.49735785", "0.49611...
0.5457384
5
Renders photorealistic images of a droplet interface in data from Michael or Pablo's simulations, given a case config file and render config file.
def photorealistic(case_config_filepath, render_config_filepath): # Load config file with all common directory names dirname_config = configparser.ConfigParser() dirname_config.read("dirname.cfg") # Get information from config files cconfd = load_config.get_config_params(case_config_filepath) # C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def surf_tempmap(case_config_filepath, render_config_filepath):\n\n # Load config file with all common directory names\n dirname_config = configparser.ConfigParser()\n dirname_config.read(\"dirname.cfg\")\n\n # Get information from config files\n cconfd = load_config.get_config_params(case_config_fi...
[ "0.6152582", "0.5941791", "0.58843994", "0.5855938", "0.57763773", "0.5693176", "0.5657049", "0.55853724", "0.55809975", "0.5573157", "0.55586225", "0.552534", "0.54541004", "0.5444121", "0.540116", "0.5400519", "0.53548855", "0.5344291", "0.5332354", "0.53094125", "0.5267152...
0.7577917
0
Renders surface temperature images of a droplet interface in data from Michael or Pablo's simulations, given a case config file and render config file.
def surf_tempmap(case_config_filepath, render_config_filepath): # Load config file with all common directory names dirname_config = configparser.ConfigParser() dirname_config.read("dirname.cfg") # Get information from config files cconfd = load_config.get_config_params(case_config_filepath) rc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photorealistic(case_config_filepath, render_config_filepath):\n\n # Load config file with all common directory names\n dirname_config = configparser.ConfigParser()\n dirname_config.read(\"dirname.cfg\")\n\n # Get information from config files\n cconfd = load_config.get_config_params(case_config_...
[ "0.6288007", "0.58538276", "0.5514038", "0.5480608", "0.5456143", "0.5447625", "0.54016596", "0.53474796", "0.5288365", "0.5260717", "0.525005", "0.5233247", "0.5214957", "0.52136034", "0.52131844", "0.5211817", "0.52017117", "0.5193529", "0.51920855", "0.5187744", "0.5187449...
0.7388833
0