query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Return the number of nodes of the graph with degree equal to k.
def number_of_nodes_of_degree_k(G, k): return sum(1 for v in nodes(G) if degree(G, v) == k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_min_degree_nodes(G):\n return number_of_nodes_of_degree_k(G, min_degree(G))", "def number_of_degree_one_nodes(G):\n return number_of_nodes_of_degree_k(G, 1)", "def TotalEdges(K):\n m = int(sum(K)/2.0)\n return m", "def count_k(n, k):\n if n == 0:\n return 1\n elif n < 0...
[ "0.7179775", "0.70837146", "0.70535874", "0.69478965", "0.6746134", "0.6665099", "0.66564804", "0.6648317", "0.662262", "0.6609778", "0.6602278", "0.66003984", "0.6576425", "0.65309584", "0.64766246", "0.64579976", "0.6452831", "0.64117116", "0.6408402", "0.636896", "0.636145...
0.909367
0
Return the number of nodes of the graph with degree equal to 1. A vertex with degree equal to 1 is also called a leaf.
def number_of_degree_one_nodes(G): return number_of_nodes_of_degree_k(G, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_nodes(self):\n return self.number_of_vertices()", "def number_of_min_degree_nodes(G):\n return number_of_nodes_of_degree_k(G, min_degree(G))", "def count_nodes(self):\n # return len(self.extract_nodes())\n return sum([1] + [b.count_nodes() for b in self.branches])", "def...
[ "0.7021722", "0.6968527", "0.6946803", "0.6933818", "0.69279313", "0.6896567", "0.68660283", "0.6862271", "0.6850285", "0.6797134", "0.67911965", "0.6747342", "0.6704993", "0.6700521", "0.6696474", "0.66844493", "0.66773546", "0.66750956", "0.66535753", "0.66454065", "0.66454...
0.8025048
0
Return the number of nodes of the graph with degree equal to the minimum degree of the graph.
def number_of_min_degree_nodes(G): return number_of_nodes_of_degree_k(G, min_degree(G))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_of_degree_one_nodes(G):\n return number_of_nodes_of_degree_k(G, 1)", "def min_degree(self):\n\n cur_min = None\n for u in self._graph:\n cur_degree = self.degree(u)\n if cur_min is None or cur_min > cur_degree:\n cur_min = cur_degree\n asser...
[ "0.76048285", "0.749614", "0.7394663", "0.7334024", "0.7228397", "0.71794593", "0.7032244", "0.70263904", "0.7016211", "0.7009683", "0.7006877", "0.6999903", "0.698994", "0.6984856", "0.69532245", "0.6942442", "0.6873219", "0.68630534", "0.68291557", "0.67875236", "0.6763183"...
0.8846296
0
Return the number of nodes of the graph with degree equal to the maximum degree of the graph.
def number_of_max_degree_nodes(G): return number_of_nodes_of_degree_k(G, max_degree(G))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def maxDegree(self):\n maxdegree = 0\n for n in self.nodes.itervalues():\n if maxdegree < n.degree():\n maxdegree = n.degree()\n return maxdegree", "def max_degree(self):\n\n cur_max = None\n for u in self._graph:\n cur_degree = self.degree(...
[ "0.811592", "0.77598906", "0.7680621", "0.7597259", "0.7591686", "0.7591686", "0.7563622", "0.7494683", "0.74826163", "0.74477327", "0.7436453", "0.73804784", "0.72966635", "0.72033256", "0.71184003", "0.7094391", "0.7084717", "0.70475197", "0.70473033", "0.7044382", "0.70217...
0.8882899
0
Return a list of the unique degrees of all nodes in the closed neighborhood of the nodes in `nbunch`.
def closed_neighborhood_degree_list(G, nbunch): if isinstance(nodes, collections.abc.Iterable): return list(set(degree(G, u) for u in set_closed_neighborhood(G, nbunch))) else: return list(set(degree(G, u) for u in closed_neighborhood(G, nbunch)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighborhood_degree_list(G, nbunch):\n if isinstance(nodes, collections.abc.Iterable):\n return list(set(degree(G, u) for u in set_neighborhood(G, nbunch)))\n else:\n return list(set(degree(G, u) for u in neighborhood(G, nbunch)))", "def get_degree_of_nodes(self) -> list:\n return ...
[ "0.76620954", "0.5554535", "0.53256595", "0.52846473", "0.52290624", "0.5227455", "0.52169853", "0.51680535", "0.5161214", "0.5134029", "0.51124555", "0.5104724", "0.51037556", "0.50881773", "0.50786", "0.50770056", "0.50752866", "0.50689185", "0.5063954", "0.5057775", "0.505...
0.7842689
0
Return True if G is cubic, and False otherwise. A graph is cubic if it is regular of degree 3.
def is_cubic(G): return is_k_regular(G, 3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sub_cubic(G):\n return max_degree(G) <= 3", "def is_quadratic(self) -> bool:\n return self.args[0].is_affine() and self.args[1].is_constant()", "def is_regular(G):\n return min_degree(G) == max_degree(G)", "def isPartialCube(G):\n try:\n MediumForPartialCube(G)\n return T...
[ "0.8132608", "0.6300366", "0.59569275", "0.59526336", "0.59198135", "0.5906876", "0.5855152", "0.57995415", "0.57452655", "0.5712047", "0.5682574", "0.5665522", "0.5638262", "0.55928856", "0.5564508", "0.5499596", "0.54722923", "0.54518193", "0.54363924", "0.5359346", "0.5318...
0.8403406
0
Calculates the rolling mean of the input values and creates a new list with the mean values uniformly spaced over time, how much time is between the values is set by the time interval parameter
def calculate_rolling_mean(pulse_data, time_interval, debug=False): calculated_mean_list = [] # start time = time of first recording start_time = pulse_data[0][0] # interval end time = start_time + time_interval end_time = start_time + time_interval # current_chunk_list current_chunk = []...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _running_mean(self, inputData, wgts): # {{{\n\n nt = len(inputData)\n sp = (len(wgts) - 1)/2\n runningMean = inputData.copy()\n for k in range(sp, nt-(sp+1)):\n runningMean[k] = sum(wgts*inputData[k-sp:k+sp+1].values)\n\n return runningMean # }}}", "def movinga...
[ "0.7052557", "0.69685996", "0.69497275", "0.69497275", "0.6816954", "0.6801106", "0.6723819", "0.671535", "0.6695174", "0.66881514", "0.6629005", "0.662408", "0.6611648", "0.6559988", "0.65559036", "0.654467", "0.6510376", "0.65046906", "0.6495388", "0.6493706", "0.6436684", ...
0.74477494
0
Adds trailing zeroes to make the list the target length
def add_trailing_zeros(un_trailed_data, target_length): # Cut the list of it's longer then target length if len(un_trailed_data) > target_length: return un_trailed_data[:target_length] un_trailed_data.extend([0 for _ in range(target_length - len(un_trailed_data))]) return un_trailed_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_or_truncate(some_list, target_len):\n return some_list[:target_len] + [0]*(target_len - len(some_list))", "def add_leading_zero(values: []) -> []:\n return [f\"{v:02d}\" for v in values]", "def pad(l,target_length,pad_element):\n return l+(target_length-len(l))*[pad_element]", "def p...
[ "0.7381257", "0.6970354", "0.69537866", "0.681655", "0.6815191", "0.6780128", "0.6728", "0.6705292", "0.6650162", "0.66151303", "0.6528701", "0.6502649", "0.65020394", "0.64630836", "0.64371926", "0.64330995", "0.64320594", "0.6366613", "0.6325861", "0.6323414", "0.63219017",...
0.83649147
0
Evaluate weights based on parameters and patterns.
def eval_weights( self, patterns: dict[str, dict[str, Any]], param: Optional[dict[str, float]] = None, item_index: Optional[Any] = None ) -> dict[str, dict[Region, ArrayLike]]: weights: dict[str, dict[Region, ArrayLike]] = {} for connect, regions in self.weights.items...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _CalculateOutput(weights, patern):\n assert len(weights) == len(patern)\n return _ApplyThreshold(sum([w * x for w, x in zip(weights, patern)]))", "def __call__(self, weights, dw, learning_rate=1.0):\n\n # Put your code here.\n\n new_weights = weights - learning_rate * dw\n\n return...
[ "0.6625659", "0.6247268", "0.602727", "0.6011186", "0.5980338", "0.5975999", "0.59524167", "0.5943767", "0.5905138", "0.589631", "0.58524454", "0.58324826", "0.58305377", "0.58289903", "0.57695764", "0.5745729", "0.57299334", "0.57080865", "0.57070553", "0.56927943", "0.56925...
0.73160213
0
Sample a float value uniformly between `min` and `max`.
def double(min: float, max: float, step: float = None): parameter = models.V1beta1ParameterSpec( parameter_type="double", feasible_space=models.V1beta1FeasibleSpace(min=str(min), max=str(max)), ) if step is not None: parameter.feasible_space.step = str(step) return parameter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRandomFloat(minFloat, maxFloat):\n random.uniform(minFloat, maxFloat)", "def floatGenerator(min=-2 ** 31, max=2 ** 31):\n while True:\n yield random.uniform(min, max)", "def uniform_sample(minv, maxv):\n return np.random.uniform(minv, maxv)", "def between(min, max):\n return random....
[ "0.79188645", "0.7719397", "0.7102615", "0.70827293", "0.7080701", "0.7063744", "0.7049254", "0.6860736", "0.6850677", "0.6832986", "0.680662", "0.67213184", "0.671683", "0.6641495", "0.6622842", "0.6568863", "0.6469009", "0.6455054", "0.64547884", "0.6369457", "0.6364442", ...
0.0
-1
Sample an integer value uniformly between `min` and `max`.
def int(min: int, max: int, step: int = None): parameter = models.V1beta1ParameterSpec( parameter_type="int", feasible_space=models.V1beta1FeasibleSpace(min=str(min), max=str(max)), ) if step is not None: parameter.feasible_space.step = str(step) return parameter
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def between(min, max):\n return random.random() * (max - min) + min", "def int_rand(self, minimum, maximum):\n return floor(random.random() * (maximum - minimum + 1)) + minimum", "def get_rand_number(min_value, max_value):\r\n range = max_value - min_value\r\n choice = random.uniform(0,1)\r\n ...
[ "0.78410244", "0.7743483", "0.77224237", "0.75899225", "0.7341361", "0.73406506", "0.7304407", "0.72689164", "0.72391504", "0.72321516", "0.72245985", "0.72053266", "0.7170186", "0.7152535", "0.71334624", "0.7118944", "0.7093476", "0.6985933", "0.69423974", "0.69423974", "0.6...
0.0
-1
Save backward propagation gradient w.r.t input.
def _register_backward_hooks(self): def _record_gradients(module, grad_in, grad_out): self.gradients = grad_in[0] for _, module in self.model.named_modules(): if isinstance(module, nn.modules.conv.Conv2d) and module.in_channels == 3: return module.register_backwa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_for_backward(self, *values):\n if self.no_grad:\n return\n self._saved_values = values", "def backward(ctx, grad_output):\n\n # This is a pattern that is very convenient - at the top of backward\n # unpack saved_tensors and initialize all gradients w.r.t. inputs to...
[ "0.7593512", "0.716703", "0.70963293", "0.70832187", "0.7027662", "0.6942099", "0.6898596", "0.6891025", "0.6851543", "0.6848896", "0.6846199", "0.6839333", "0.6835652", "0.6834995", "0.68336415", "0.6782747", "0.6752299", "0.67496425", "0.67486525", "0.6727802", "0.6723275",...
0.0
-1
Computes the binary mask given an index.
def _get_idx_mask(idx, timespan): eye = tf.constant(np.eye(timespan, dtype='float32')) return tf.gather(eye, idx)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bit(number, index):\n return (int(number) & (1 << index)) >> index", "def binarize(self, mask):\n\n mask[mask > 0] = 1\n return mask", "def get_bit(number, index):\n return (number >> index) & 1", "def __getitem__(self, index):\n nth_short, nth_bit = divmod(index, BitArray....
[ "0.66919196", "0.6655189", "0.6601061", "0.65182275", "0.6476276", "0.64631444", "0.6428441", "0.6428441", "0.6379654", "0.63371724", "0.6274754", "0.61817795", "0.61709225", "0.61707664", "0.6157283", "0.61440307", "0.60602", "0.60387194", "0.602247", "0.5970064", "0.5861652...
0.5127094
77
Create vertical log_binning. Used for peak sale.
def vertical_log_binning(p, data): import math import operator index, value = zip(*sorted(data.items(), key=operator.itemgetter(1))) bin_result = [] value = list(value) bin_edge = [min(value)] i = 1 while len(value) > 0: num_to_bin = int(math.ceil(p * len(value))) # print...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logbins(bin_min, bin_max, nbins):\n bin_edges = np.logspace(np.log10(bin_min), np.log10(bin_max), nbins+1)\n bin_centers = 10**((np.log10(bin_edges[1:]) +\n np.log10(bin_edges[:-1])) / 2.)\n bins = np.zeros(nbins)\n return bin_edges, bin_centers, bins", "def append_binning_...
[ "0.5995802", "0.5868862", "0.5826217", "0.5703413", "0.5632627", "0.55899554", "0.5299665", "0.5253915", "0.5240777", "0.5055922", "0.5051672", "0.50265205", "0.5023136", "0.5019155", "0.500964", "0.5005783", "0.50055325", "0.49962184", "0.49922308", "0.49862748", "0.49450138...
0.6886946
0
Create a new city
def post_city(state_id): state = storage.get("State", state_id) if state is None: abort(404) json_obj = request.get_json() if not request.json: return jsonify("Not a JSON"), 400 if 'name' not in json_obj: return jsonify("Missing name"), 400 json_obj['state_id'] = state_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_city(state_id):\n state_name_exist = storage.get(State, state_id)\n if state_name_exist is None:\n abort(404)\n new_city = request.get_json(silent=True)\n if new_city is None:\n return \"Not a JSON\", 400\n if 'name' in new_city:\n new_city['state_id'] = state_id\n ...
[ "0.78408885", "0.76259685", "0.7609526", "0.73762584", "0.7357969", "0.73408", "0.7278895", "0.7270069", "0.72250426", "0.7201784", "0.71914876", "0.71906376", "0.7126059", "0.70909745", "0.680503", "0.67492276", "0.654149", "0.64796656", "0.6442384", "0.64152867", "0.6413839...
0.7042505
14
Append a node of value val to the last element of the linked list.
def addAtTail(self, val): node = Node(val) if self.head == None: self.head = node return cur = self.head while cur.next != None: cur = cur.next cur.next = node node.prev = cur
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, val):\n new_node = Node(val)\n last = self.tail\n if last is None:\n new_node.next = self.head\n self.head = new_node\n self.tail = new_node\n else:\n last.next = new_node\n new_node.previous = last\n sel...
[ "0.8424462", "0.82147866", "0.8186856", "0.81357986", "0.8052315", "0.7948477", "0.7925372", "0.78887033", "0.78506285", "0.78264034", "0.7728796", "0.76958585", "0.76826465", "0.76162595", "0.7610815", "0.76095194", "0.7523299", "0.7492772", "0.7427015", "0.73848057", "0.737...
0.8069407
4
2.1 Onedimensional normal distributed sample
def sample_normal_distributed_value(samples_to_average=12): samples = np.random.random(samples_to_average) return np.average(samples) - 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_normal_data(num_sample, num_dim, loc):\n return np.random.normal(\n size=(num_sample, num_dim), loc=loc, scale=1. / np.sqrt(num_dim))", "def noise_normal():\n return scale * rng.normal(size=shape)", "def normal_dist(n_dim=2, l_amount=[100, 100], bias=[-2, 2], seed=1):\n data =...
[ "0.73423237", "0.7335003", "0.7115336", "0.6998667", "0.6964631", "0.6949271", "0.69055104", "0.68293065", "0.6813631", "0.6797823", "0.6797823", "0.67391205", "0.67227364", "0.67198175", "0.67123264", "0.6704595", "0.66424936", "0.6641183", "0.6624577", "0.65813273", "0.6570...
0.7119496
2
2.2 Normal distributed samples
def sample_normal_distributed_values(samples_to_generate=1, samples_to_average=12, offset=0.0): result = [] for _ in range(0, samples_to_generate): result.append(sample_normal_distributed_value(samples_to_average) + offset) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noise_normal():\n return scale * rng.normal(size=shape)", "def _generate_normal_data(num_sample, num_dim, loc):\n return np.random.normal(\n size=(num_sample, num_dim), loc=loc, scale=1. / np.sqrt(num_dim))", "def normal_sufficient_stat(samples):\n # clearly wrong cause we dont know std...
[ "0.72551364", "0.70065385", "0.69727606", "0.69666946", "0.6919484", "0.688981", "0.688464", "0.6865245", "0.6855263", "0.6742982", "0.670551", "0.66808176", "0.66020006", "0.6580309", "0.6550435", "0.65448797", "0.6544227", "0.6541434", "0.6526295", "0.6526295", "0.65221936"...
0.6509772
22
Clean up keys to produce underscored column names
def get_cleaned_column_names(self): fixed = [] for k in self.stats.keys(): pieces = [] splitter = k.split(".") for s in splitter: either = re.split(' |-', s) if len(either) > 1: parts = [either[0].lower()] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix_col_names(self):\n col_names = [] \n for n in self.df.columns:\n coln = n.lower()\n coln = re.sub(\"([-_.\\(\\) ])\", '_', coln)\n coln = re.sub(\"([+: ])\", '', coln)\n col_names.append(coln)\n self.df.columns = col_names", "def edit_colum...
[ "0.6718087", "0.66043806", "0.66034055", "0.64485407", "0.6427179", "0.64170694", "0.6356697", "0.6341464", "0.6332916", "0.63002896", "0.6290945", "0.6273911", "0.62287784", "0.6087182", "0.6081805", "0.60810316", "0.6064116", "0.6031927", "0.5987463", "0.5985132", "0.594479...
0.6751551
0
Build a Django database query to return transactions of the given type. We return a Django "Q" object that encapsulates a query against the Transaction table to return only those transactions which match the transaction type and account parameters. Note that this works even if no transaction type has been specified; in...
def _build_type_query(account, params): if params.get("type") == None: return Q(debit_account=account) | Q(credit_account=account) elif params.get("type") == "charges_paid": return (Q(type=Transaction.TYPE_CHARGE) & Q(debit_account=account)) elif params.get("type") == "charge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_totals_by_type(account, params):\n query = _build_success_query()\n query = query & _build_type_query(account, params)\n\n if \"conversation\" in params:\n query = query & _build_conversation_query(params['conversation'])\n\n if \"date\" in params:\n query = query & _build_date_q...
[ "0.66469485", "0.5792593", "0.5589069", "0.5325454", "0.5138663", "0.5097718", "0.50115526", "0.5001591", "0.49878553", "0.49664664", "0.49225894", "0.4907005", "0.48783943", "0.48702374", "0.48674", "0.4852237", "0.48518854", "0.48128876", "0.48048517", "0.4793264", "0.47825...
0.7643141
0
Test dequeue() with empty queue.
def test_dequeue_empty(self): self.assertIsNone(self.store.dequeue('/queue/nonexist')) self.assertFalse(self.store.has_frames('/queue/nonexist')) self.assertEqual(self.store.size('/queue/nonexist'), 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dequeue_empty(empty_queue):\n with pytest.raises(ValueError):\n empty_queue.dequeue()", "def test_dequeue(empty_dog_q):\n assert empty_dog_q.dequeue() is False", "def test_dequeue_of_empty_queue(empty_queue):\n with pytest.raises(ValueError) as e:\n empty_queue.dequeue()\n as...
[ "0.8918903", "0.8613108", "0.8586284", "0.8331655", "0.83229274", "0.8241028", "0.8218216", "0.82071906", "0.8158364", "0.8007606", "0.7865546", "0.7854035", "0.78182507", "0.7790055", "0.77562386", "0.7741897", "0.7736913", "0.7709703", "0.75968194", "0.75596833", "0.7532797...
0.8431301
3
Retrieves the commit hash of a branch.
def get_branch_hash(repo_name, branch_name="master"): github = _get_github_admin() try: repository = github.repository(config.github_organization, repo_name) return repository.branch(branch_name).commit.sha except AttributeError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve_commit_hash(path_to_repo):\n cmd = 'cd {0} && git rev-parse HEAD'.format(path_to_repo)\n return subprocess.check_output(cmd, shell=True).strip()", "def get_git_commit_hash() -> str:\n return fannypack.utils.get_git_commit_hash(str(pathlib.Path(__file__).parent))", "def _get_commit_hash(pa...
[ "0.74165624", "0.7385295", "0.73193", "0.7052727", "0.70314854", "0.6969456", "0.6956713", "0.6765631", "0.6747595", "0.67394775", "0.6710737", "0.6703621", "0.66002744", "0.65855217", "0.65681034", "0.6457127", "0.6454914", "0.64518726", "0.64459413", "0.6433558", "0.6419790...
0.7860321
0
Retrieves a commit message, given a repository name and a commit hash. The commit hash should be the unabbreviated hash.
def get_commit_message(repo_name, commit_hash): github = _get_github_admin() try: repository = github.repository(config.github_organization, repo_name) return repository.git_commit(commit_hash).message except AttributeError: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_commit_message(repo_name: str, commit_id: str) -> str:\n res = cc_client.get_commit(\n repositoryName=repo_name,\n commitId=commit_id,\n )\n commit_message = res[\"commit\"][\"message\"].strip()\n return commit_message", "def _get_commit_hash(path, commit):\n try:\n ...
[ "0.76929915", "0.695942", "0.6838772", "0.67271787", "0.67210454", "0.6696089", "0.6646352", "0.64968646", "0.64293957", "0.63738555", "0.6294961", "0.6277971", "0.62530375", "0.6234326", "0.61724406", "0.61561257", "0.6125198", "0.610571", "0.6056647", "0.6054678", "0.602793...
0.8747213
0
r"""Implements numpy.isclose Returns a boolean array where two arrays are elementwise equal within a tolerance. The tolerance values are positive, typically very small numbers. For finite values, two floating point values are considered equivalent if [ |ab|\leq T_\text{abs}+T_\text{rel}|b| ] where $T_\text{abs}$ and $T...
def isclose(a, b, rtol=1e-05, atol=1e-08): return numpy.abs(a - b) <= (atol + rtol * numpy.abs(b))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isclose(a, b, rtol=1.e-5, atol=1.e-8, equal_nan=False):\n def within_tol(x, y, atol, rtol):\n with np.errstate(invalid='ignore'):\n result = np.less_equal(abs(x - y), atol + rtol * abs(y))\n if np.isscalar(a) and np.isscalar(b):\n result = bool(result)\n return re...
[ "0.753451", "0.74615544", "0.73311937", "0.7280523", "0.7279795", "0.721564", "0.7175168", "0.7166597", "0.7149722", "0.7149722", "0.71219754", "0.7100682", "0.70946115", "0.7079061", "0.7071074", "0.707095", "0.7033749", "0.7000948", "0.6999923", "0.6860795", "0.68198186", ...
0.7545167
0
Apply CV to circuit.
def cv(self, ctl, tgt): return self.append(CvGate(), [ctl, tgt], [])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_vcc(self,vcc):\n if type(vcc)==type((1,)):\n vcc = VelocityContrastCurve(*vcc)\n dmags = self.dmags(vcc.band)\n rvs = self.RV\n self.apply_constraint(VelocityContrastCurveConstraint(rvs,dmags,vcc,name='secondary spectrum'))", "def set_cv(self, cv):\n self.c...
[ "0.6341685", "0.62913674", "0.59433055", "0.5792045", "0.57238054", "0.5700309", "0.5635754", "0.5569476", "0.5558079", "0.5549508", "0.55304915", "0.54291284", "0.5428705", "0.5390077", "0.5369976", "0.52346885", "0.5136725", "0.5117024", "0.5112906", "0.5092839", "0.5087732...
0.65661883
0
Return binary array used to mask input to Latent NODE encoders. The binary array contains 1 when hidden state should be updated, and 0 otherwise. The array is set based on the desired changepoints to evaluate.
def get_mask_array(seg_len, cps): mask = torch.zeros((len(cps), seg_len - cps[0])) for i in range(len(cps)): mask[i, cps[i] - cps[0]:] += 1 return mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_onsets(bool_arr):\n int_arr = bool_arr.astype(int)\n onsets = np.diff(int_arr, axis=1)\n onsets[onsets < 0] = 0\n\n return onsets", "def available_mask(self) -> np.ndarray:\n pass", "def mask_act(self):\n # mask_act = np.zeros([self.ypix,self.xpix]).astype('bool')\n ...
[ "0.61269015", "0.59924495", "0.5977051", "0.5953601", "0.59393436", "0.5809917", "0.57931733", "0.57127756", "0.57099813", "0.5706591", "0.56453496", "0.56234974", "0.5572939", "0.5563105", "0.55406547", "0.55279124", "0.5520233", "0.55098563", "0.54800195", "0.54791373", "0....
0.5209808
44
Set up the von Mises material
def __init__(self, **kwargs): # Check inputs K = kwargs.get("K", 0.0) G = kwargs.get("G", 0.0) H = kwargs.get("H", 0.0) Y0 = kwargs.get("Y0", 0.0) BETA = kwargs.get("BETA", 0.0) errors = 0 if K <= 0.0: errors += 1 logger.error("Bul...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_state(self, V):\n\n logs.log_info('You are using the KV channel: Kv1.3, Morris-Leclar ')\n\n self.time_unit = 1.0e3\n\n self.vrev = -65 # reversal voltage used in model [mV]\n\n self.ions = ['K']\n self.rel_perm = [1]\n self.kinetic_gate = True\n self....
[ "0.6382273", "0.6275163", "0.62604463", "0.62596655", "0.61890316", "0.6174571", "0.61716443", "0.6131447", "0.6123745", "0.61136407", "0.61127037", "0.6097704", "0.6097349", "0.6091762", "0.5943694", "0.5942238", "0.589296", "0.5846751", "0.5816047", "0.5808911", "0.5800748"...
0.0
-1
Gets the p and (1p)percentile as an approximation of the boundaries of the histogram.
def get_histogram_min_max_with_percentile(hist, is_normalized, percentile=None): if not is_normalized: hist = cv2.normalize(hist) if percentile is None: percentile = 0.01 t_min = 0 t_max = 255 min_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_percentile_points(hist_vals, hist_bins, percentile_value, celeb_score=None):\n\t# Create Series of bin values and weights from the histogram (so can sort and retain indices)\n\thist_df = pd.DataFrame(zip(hist_bins, hist_vals), columns=['value', 'weight'])\n\t# Sort the histogram values by weight\n\thist_df...
[ "0.7165912", "0.69307667", "0.6610386", "0.6527545", "0.65075463", "0.6437661", "0.64085394", "0.624444", "0.622567", "0.62156063", "0.6169702", "0.616209", "0.61426", "0.6106156", "0.61027426", "0.60653925", "0.60544795", "0.6046766", "0.60454094", "0.6026693", "0.5998628", ...
0.6411308
6
Create a temporary file within the specified directory and return the absolute path to the new file. The file will be deleted after the current test is completed. contents write contents to the new file if supplied dedent dedent contents before writing to file? directory where to create the new file (create a temporary...
def mktemp(self, contents=None, dedent=True, directory=None): if not directory: directory = self.mkdtemp() fd, path = tempfile.mkstemp(dir=directory) if contents: if dedent: contents = self.dedent(contents) os.write(fd, contents) os.clo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_tmp_file(tmp_file, contents):\n base_dir = os.path.dirname(tmp_file)\n if not os.path.exists(base_dir):\n os.makedirs(base_dir)\n\n with open(tmp_file, \"w\") as tmp_file:\n tmp_file.write(contents)", "def make_file(contents=None):\n with NamedTemporaryFile(mode='wt', encodi...
[ "0.77964234", "0.70252097", "0.6990213", "0.6965387", "0.6936547", "0.6836122", "0.6836122", "0.6816025", "0.67642206", "0.67258346", "0.6706949", "0.6609251", "0.65881854", "0.6541091", "0.6530787", "0.65106845", "0.6508019", "0.6483207", "0.64650726", "0.6463209", "0.635843...
0.786184
0
Returns True if this priority queue is empty.
def is_empty(self): return self._n == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empty(self) -> bool:\n return self._pqueue.empty()", "def is_empty(self) -> bool:\n return self.heap.is_empty()", "def is_empty(self):\n return len(self._queue) == 0", "def IsEmpty(self):\r\n return len(self._queue) == 0", "def empty(self):\n\n return True if self.queue.s...
[ "0.8866961", "0.8744104", "0.8682393", "0.864213", "0.86137396", "0.8608628", "0.8564768", "0.85643613", "0.85643613", "0.85643613", "0.8557136", "0.8540782", "0.8540782", "0.85178584", "0.84957963", "0.8485358", "0.8459562", "0.8417116", "0.8413661", "0.8405261", "0.8387122"...
0.0
-1
Returns the number of keys on this priority queue.
def size(self): return self._n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_keys(self) -> int:\n return self.root.get_num_keys_total()", "def num_keys(self):\n return len(self._keys)", "def lenkeys(self):\n return len(self)", "def __len__(self) -> int:\n return len(self._keys)", "def size(self):\n # Het aantal elementen in de knop kom...
[ "0.8500783", "0.80764496", "0.785026", "0.73499703", "0.727855", "0.71771204", "0.70168316", "0.6981416", "0.6981416", "0.69769615", "0.69667625", "0.6956516", "0.69228786", "0.69228786", "0.69228786", "0.6902115", "0.6899317", "0.68644655", "0.68412346", "0.6826096", "0.6809...
0.62720686
96
Moves item at index k down to a legal position on the heap.
def _sink(self, k): while 2*k <= self._n: j = 2*k if j < self._n and self._less(j, j+1): j += 1 if not self._less(k, j): break self._exch(k, j) k = j
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, k):\n self.heap.append(k)\n self.heap_size += 1\n self.pos[k[1]] = self.heap_size-1\n self.swap_up(self.heap_size-1)\n return", "def add2heap(heap, item, k):\n if len(heap) < k:\n heapq.heappush(heap, item)\n else:\n heapq.heappushpop(heap, ...
[ "0.71104616", "0.6787004", "0.65762943", "0.6534307", "0.64851356", "0.6482383", "0.64666384", "0.640795", "0.6348046", "0.6288416", "0.6217718", "0.6145766", "0.61394364", "0.6133434", "0.61325055", "0.6117759", "0.61078316", "0.6071506", "0.60410786", "0.60326916", "0.60301...
0.5608701
50
Moves item at index k up to a legal position on the heap.
def _swim(self, k): while k > 1 and self._less(k//2, k): self._exch(k, k//2) k = k//2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert(self, k):\n self.heap.append(k)\n self.heap_size += 1\n self.pos[k[1]] = self.heap_size-1\n self.swap_up(self.heap_size-1)\n return", "def add2heap(heap, item, k):\n if len(heap) < k:\n heapq.heappush(heap, item)\n else:\n heapq.heappushpop(heap, ...
[ "0.72411484", "0.69713545", "0.66985524", "0.6594586", "0.63912845", "0.6386844", "0.6366503", "0.6319001", "0.63131964", "0.62735313", "0.6235859", "0.6222644", "0.61840695", "0.6172214", "0.61676866", "0.6148573", "0.60231733", "0.5998745", "0.59788936", "0.59622306", "0.59...
0.5852138
26
Copies the contents of the heap to a new array of size capacity.
def _resize(self, capacity): temp = [None] * capacity for i in range(1, self._n + 1): temp[i] = self._pq[i] self._pq = temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heapify(self) -> None:\n i = self.size\n\n while i <=0:\n self.restore_down(i)\n i -=1", "def _resize(self, capacity):\n temp = [None] * capacity\n for i in range(1, self._n + 1):\n temp[i] = self._pq[i]\n self._pq = temp", "def heapify(self, not_a_heap):...
[ "0.6644493", "0.65593135", "0.64219004", "0.63554424", "0.614432", "0.6101688", "0.6046516", "0.6015482", "0.58580786", "0.58354795", "0.58151823", "0.57843095", "0.5700918", "0.5697188", "0.568745", "0.56288874", "0.56175685", "0.55924004", "0.55680794", "0.55655485", "0.555...
0.65390766
2
Check if item at index i is less than item at index j on the heap.
def _less(self, i, j): return self._pq[i] < self._pq[j]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def less(self, i, j):\n return self.storage[i].priority < self.storage[j].priority", "def _less(self, i, j):\n return self._pq[i].priority < self._pq[j].priority", "def __greater(self, i, j):\n return self.__queue[i] > self.__queue[j]", "def _up_heap(self, j):\n p = self._parent(j)\n ...
[ "0.76228637", "0.7418441", "0.6809246", "0.6730395", "0.6693641", "0.6665212", "0.6633426", "0.6581373", "0.6511015", "0.6466783", "0.6418034", "0.63084763", "0.6215946", "0.614957", "0.6143081", "0.61205244", "0.61012113", "0.6028531", "0.60253745", "0.59826595", "0.5975343"...
0.7643317
0
Exchanges the position of items at index i and j on the heap.
def _exch(self, i, j): self._pq[i], self._pq[j] = self._pq[j], self._pq[i]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _exchange(self, i, j):\n self._heap[i], self._heap[j] = self._heap[j], self._heap[i]", "def sift_up(self, i):\n while i // 2 > 0 and self.heaplist[i // 2] < self.heaplist[i]:\n self.heaplist[i // 2], self.heaplist[i] = self.heaplist[i], self.heaplist[i // 2]\n i //= 2", ...
[ "0.80476207", "0.72062", "0.7100718", "0.7068087", "0.6989149", "0.6945142", "0.68642455", "0.6837964", "0.6829503", "0.67749876", "0.6756597", "0.674192", "0.67024845", "0.6701138", "0.6648444", "0.66393864", "0.6616323", "0.65911084", "0.6519289", "0.65113163", "0.6502738",...
0.68442553
7
Constructs a new rational value. numerator (default 0) denominator (default 1)
def __init__(self, numerator=0, denominator=1): if isinstance(numerator, Rational): denominator *= numerator.getDenominator() numerator = numerator.getNumerator() if isinstance(denominator,Rational): numerator *= denominator.getDenominator() denominator = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rational(*args, **kw):\n if rational.impl is None: rational.impl = Rational()\n return rational.impl(*args, **kw)", "def __init__(self, numerator, denominator=1):\n self.numerator = numerator\n self.denominator = denominator\n if self.denominator is not 0 :\n gcd = math.gcd(...
[ "0.72323996", "0.72052574", "0.7103024", "0.7032196", "0.6590097", "0.6590097", "0.6575564", "0.6443665", "0.639477", "0.6340662", "0.63117266", "0.6286521", "0.6170741", "0.6164579", "0.61532044", "0.6126778", "0.6108304", "0.6042372", "0.59943336", "0.5980924", "0.59807307"...
0.7409133
0
Return rational raised to given exponent. If exponent is integral, result is still a rational. If exponent is floatingpoint, result is floating point.
def __pow__(self, exp): if isinstance(exp, (int,long)): if exp >= 0: return Rational(self._numer ** exp, self._denom ** exp) else: # invert return Rational(self._denom ** exp, self._numer ** exp) else: return float(self) ** exp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rational(*args, **kw):\n if rational.impl is None: rational.impl = Rational()\n return rational.impl(*args, **kw)", "def power(self, exponent: float):\n (theta,) = self.params\n return RZXGate(exponent * theta)", "def to_rational(value):\r\n try:\r\n # int, long, or fraction\r\n ...
[ "0.5678421", "0.55508953", "0.55426794", "0.5540621", "0.54503226", "0.53997946", "0.5398697", "0.532657", "0.5325404", "0.5313978", "0.53135175", "0.52895355", "0.5248687", "0.523524", "0.51911986", "0.5147664", "0.5147008", "0.51406807", "0.5132777", "0.5122353", "0.5090704...
0.6218958
0
Returns a string representation of the rational. If the denominator is one, it is not displayed. If the rational is undefined, 'Undefined' is returned.
def __repr__(self): if self._denom == 0: return 'Undefined' elif self._denom == 1: return str(self._numer) else: return str(self._numer) + '/' + str(self._denom)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRational(self):\r\n return str(self.reducedNumerator) + \"/\" + str(self.reducedDenominator)", "def __str__(self):\r\n whole_number = self.numerator//self.denominator\r\n \r\n if whole_number != 0: \r\n new_numerator = self.numerator - (whole_number*self.denomina...
[ "0.7010774", "0.68214256", "0.6239608", "0.6143022", "0.6107703", "0.60994595", "0.60804933", "0.6046217", "0.5833344", "0.57912064", "0.57704633", "0.5736143", "0.57103235", "0.56931776", "0.56275517", "0.56021434", "0.5483176", "0.5473066", "0.5460495", "0.5454565", "0.5452...
0.7363554
0
Return package version as listed in `__version__` in `init.py`.
def get_version(package): init_py = open(os.path.join(package, '__init__.py')).read() return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_package_version():\n return VERSION", "def get_version(package):\n init_py = read(os.path.join(package, '__init__.py'))\n version = re.search(\"__version__ = \\'(.*)\\'\", init_py)\n return version.group(1) if version else ''", "def get_version(package):\n with open(os.path.join(package,...
[ "0.8658586", "0.8522551", "0.84818155", "0.8418715", "0.84098756", "0.83957505", "0.838898", "0.83860415", "0.83769035", "0.8372804", "0.8335057", "0.833214", "0.8285455", "0.81823987", "0.81191856", "0.80554175", "0.8023924", "0.7975143", "0.78928864", "0.78839236", "0.78755...
0.8370828
14
Get the determinant determinant
def getDet(self): return self.det
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determinant(self):\n return _almathswig.Transform_determinant(self)", "def determinant(self):\n\t\tif not self.is_square():\n\t\t\traise(ValueError, \"Cannot calculate determinant of non-square matrix.\")\n\t\tif self.row_len > 2:\n\t\t\traise(NotImplementedError, \"Calculating determinant not impleme...
[ "0.8305476", "0.818115", "0.81550866", "0.79842734", "0.79683363", "0.7936901", "0.79082745", "0.78230315", "0.7809309", "0.7809309", "0.7629604", "0.75442857", "0.75266564", "0.7446015", "0.7346922", "0.7249511", "0.7232949", "0.7225165", "0.7174779", "0.71140933", "0.705728...
0.734461
15
Reset metrics for reporting loss and perplexity.
def reset_metrics(self): self.metrics['loss'] = 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reset_metrics(self):\n self.train_loss = []\n self.val_loss = []", "def reset_metrics(self):\n super().reset_metrics()\n self.metrics['lmloss'] = 0.0\n self.metrics['lm_num_tokens'] = 0\n self.metrics['correct_tokens'] = 0\n self.metrics['preds'] = []", "de...
[ "0.8604127", "0.8231897", "0.77977246", "0.7597039", "0.757658", "0.7575642", "0.7572477", "0.7572477", "0.73501915", "0.7274863", "0.7212128", "0.7181018", "0.69847053", "0.69847053", "0.6967835", "0.6965888", "0.69607633", "0.6956463", "0.6926", "0.69008285", "0.6869715", ...
0.8550732
1
Check if the URL has a file extension matching any of the provided extensions.
def has_extension(url, extensions): parsed_url = urlparse(url) path = parsed_url.path extension = os.path.splitext(path)[1].lower() return extension in extensions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)", "def has_file_allowed_extension(filename, extensions):\n filename_lower = filename.lower()\n return any(filename_lower.endswith(ext) for ext in extensions)", "def has_file_allowed_extension(filename,...
[ "0.79430985", "0.7886591", "0.7886591", "0.7886591", "0.7886591", "0.7886591", "0.78168875", "0.7807008", "0.7494002", "0.7462726", "0.7407155", "0.73788947", "0.7292562", "0.7283554", "0.7190893", "0.71625566", "0.71562785", "0.70783514", "0.70299214", "0.6994107", "0.693973...
0.8755924
0
Support function for calculating Softmax of x.
def Softmax(x): return np.exp(x) / np.sum(np.exp(x), axis=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x):\n # pass # TODO: Compute and return softmax(x)\n x2 = x - np.amax(x)\n return np.exp(x2)/ np.sum(np.exp(x2), axis = 0)", "def softmax(x):\n x -= np.max(x) # For numeric stability\n x = np.exp(x)\n x /= np.sum(x)\n\n return x", "def softmax(x):\r\n\te_x = np.exp(x - np.max...
[ "0.87888896", "0.87650365", "0.8761585", "0.8758316", "0.8758316", "0.8725373", "0.87247026", "0.87141454", "0.8713842", "0.87104684", "0.86924255", "0.8690564", "0.8690564", "0.8690564", "0.8690564", "0.8690564", "0.8690564", "0.8690564", "0.8690564", "0.8690564", "0.8690564...
0.88119155
0
Returns local time as string
def get_cur_time(): ts = time.time() return datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_time() -> str:\n return strftime(\"%H:%M:%S\", localtime())", "def time_string():\n return datetime.utcnow().strftime(DATETIME_FORMAT)", "def get_current_time_string() -> str:\n return datetime.datetime.now().isoformat()", "def get_time(): \n now = datetime.datetime.now()\n time = ...
[ "0.7603277", "0.73686206", "0.7341063", "0.73163444", "0.72532266", "0.7249208", "0.7237107", "0.7221006", "0.7179754", "0.7172183", "0.71286774", "0.71098626", "0.70929277", "0.708485", "0.70824236", "0.70735663", "0.70456135", "0.7033838", "0.702202", "0.70101804", "0.69831...
0.0
-1
Establish required plugins and HTTP routes.
def init(config): config['tiddlyspace.version'] = __version__ init_plugin(config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setupRoutes():\n # import all in the routes/ dir\n __import__('routes')", "def setup_routes(self):\n self._bottle_app.route('/', [GET], self.status)\n self._bottle_app.route('/about', [GET], self.home)\n self._bottle_app.route('/control', [POST], self.control_server)\n sel...
[ "0.71812046", "0.68640125", "0.6527159", "0.6453364", "0.6226102", "0.62157077", "0.6077932", "0.5977342", "0.59601367", "0.59538233", "0.5949119", "0.59418094", "0.59400225", "0.5938106", "0.5936007", "0.5926404", "0.59113586", "0.5905307", "0.5904899", "0.59032714", "0.5896...
0.0
-1
Weights are sampled from a zero truncated negative binomial.
def ztnb(self,r=5,p=0.5,max_length=20): probs = [0.0] for k in range(1,max_length+1): probability = scipy.misc.comb(k + r -1,k) * (p ** k) * ((1.0 -p) ** r) probs.append(probability) self.weights = probs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zero_negative_weights(self):\n for k in range(len(self)):\n self[k] *= 0 if self[k] < 0 else 1\n self.finalized = True\n return self", "def init_weights_(self):\n np.random.seed(777)\n return np.random.randn(self.total_weights) * 0.1", "def random_weight():\n ...
[ "0.7088532", "0.7035604", "0.69514954", "0.68209344", "0.68052816", "0.6759153", "0.6738849", "0.67117554", "0.6652549", "0.6652549", "0.6652549", "0.6652549", "0.65778154", "0.6572405", "0.65655065", "0.6563697", "0.654604", "0.65369534", "0.65319324", "0.6528466", "0.650472...
0.0
-1
All nonprod habitats have the same workflow, so just test one.
def test_not_prod(self): expected = "stagexservices1" collated_service_yamls = { "stagex": { expected: 5, "stagexservices2": 10, "stagex-ineligibile-non-services-box3": 1, }, } actual = autosuggest.suggest_hosts_for_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workflows():\n pass", "def test_FinancesAdvicesWorkflow(self):\n def _check_date(item, modified_date, volatile_date):\n '''Check that item modified date was updated.'''\n new_modified_date = item.modified()\n self.assertNotEqual(modified_date, new_modified_date)\n ...
[ "0.6300555", "0.6176232", "0.6077675", "0.5854535", "0.5796419", "0.5763882", "0.57440656", "0.5704468", "0.5703407", "0.57010424", "0.57004076", "0.56829435", "0.56716454", "0.56574225", "0.561467", "0.56108135", "0.5604192", "0.56041265", "0.55373114", "0.5522815", "0.55182...
0.53124684
59
String representation of square
def __str__(self): return "{}/{}".format(self.width, self.height)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n string_obj = \"[Square] {}/{}\".format(self.__size, self.__size)\n return string_obj", "def __str__(self):\n out = \"[Square] ({}) {}/{} - {}\"\n return (out.format(self.id, self.x, self.y, self.size))", "def __str__(self):\n s = \"[Square] ({:d}) {:d}/{:...
[ "0.79417175", "0.78927934", "0.76672935", "0.7612203", "0.7605606", "0.7594214", "0.7568459", "0.7558624", "0.7504888", "0.7480059", "0.73735523", "0.7256875", "0.71636695", "0.71461874", "0.6994229", "0.699181", "0.69019777", "0.6885847", "0.68607205", "0.6777313", "0.671945...
0.6137455
72
Return sha256 of given string.
def _get_sha(fetched): return hashlib.sha256(fetched.encode()).hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_string_256(string):\n return hl.sha256(string).hexdigest()", "def hash_string_256(string):\r\n return hl.sha256(string).hexdigest()", "def hash_string_256(string):\n\n return hl.sha256(string).hexdigest()", "def stringhash(string):\n digester = hashlib.sha256()\n digester.update(bytes...
[ "0.85663885", "0.85622185", "0.855973", "0.82493556", "0.81702125", "0.8092383", "0.80661774", "0.7818595", "0.75128114", "0.74891657", "0.7448902", "0.7437246", "0.74045295", "0.73568296", "0.72981405", "0.7274325", "0.7222253", "0.7206395", "0.71502", "0.7101542", "0.706953...
0.63412917
63
Creates and saves a User with the given email, date of birth and password.
def create_user(self, email, password=None): if not email: raise ValueError('Users must have an email address') user = self.model( email=self.normalize_email(email), ) user.set_password(password) user.save(using=self._db) return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password,\n is_staff, is_superuser, **extra_fields):\n now = timezone.now()\n if not email:\n raise ValueError('The given email must be set')\n email = self.normalize_email(email)\n user = self.model(email=email,\n ...
[ "0.81546026", "0.81305367", "0.8107395", "0.8098282", "0.8083993", "0.8078478", "0.8073247", "0.80615944", "0.8061434", "0.8040791", "0.8031472", "0.80222136", "0.80172515", "0.801283", "0.80103856", "0.8008831", "0.8004529", "0.7999172", "0.7992534", "0.79828453", "0.7981847...
0.0
-1
Creates and saves a superuser with the given email, date of birth and password.
def create_superuser(self, email, password): user = self.create_user( email, password=password, ) user.is_admin = True user.save(using=self._db) return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, email, date_of_birth, password):\n user = self.create_user(\n email,\n password=password,\n date_of_birth=date_of_birth,\n\n )\n user.is_admin = True\n user.save(using=self._db)\n return user", "def create_superuser(se...
[ "0.8193982", "0.81588477", "0.8147194", "0.8047828", "0.8046815", "0.80064356", "0.8006133", "0.79983854", "0.79913336", "0.79751766", "0.7969442", "0.7969442", "0.7969442", "0.7967593", "0.7967593", "0.7967593", "0.7967593", "0.7958177", "0.7944435", "0.79290116", "0.7920999...
0.77036154
87
Does the user have a specific permission?
def has_perm(self, perm, obj=None): # Simplest possible answer: Yes, always return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_perm(self, user, permission='w'):\n \n #TODO: r&a permission\n return (self.creator == user)", "def has_permission(self):\n return cualquier_permiso(self.request.user, self.get_permission_required())", "def has_permission(self):\n return True", "def has_permission(s...
[ "0.8337183", "0.80980706", "0.79992574", "0.79753554", "0.7878511", "0.7868948", "0.78656554", "0.78656554", "0.78605974", "0.7830997", "0.78211176", "0.7818423", "0.77560943", "0.7738886", "0.7728217", "0.7728217", "0.7728217", "0.7728217", "0.7728217", "0.7701872", "0.76940...
0.0
-1
Calculate the accuracy of the network, by comaring the class of the max value from the softmax to the true label of every input x in X
def calc_accuracy(sm_out: np.array, Y: np.array): n_correct = np.sum(np.argmax(Y, 0) == np.argmax(sm_out, 0)) # sum number of correct classifications return round((n_correct / Y.shape[1]) * 100, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiclass_accuracy(preds, y):\n rounded_preds = torch.argmax(nf.softmax(preds),1)\n correct = (rounded_preds == y).float() #convert into float for division \n acc = correct.sum()/len(correct)\n return acc", "def accuracy(model, input, target):\n output = model.forward(input)\n return (outp...
[ "0.7763251", "0.7385598", "0.7367118", "0.726153", "0.72551835", "0.72551835", "0.71897286", "0.7178992", "0.71726453", "0.7171267", "0.71423984", "0.7133017", "0.7132189", "0.7125881", "0.7104465", "0.70881456", "0.7075908", "0.70580196", "0.7020694", "0.7007933", "0.698626"...
0.6552123
95
Plot accuracy and loss graphs for the training process
def plot_acc_and_loss(acc_lst: list, loss_lst: list, dataset_name: str, data_type: str, xlabel_title: str = 'Epoch'): epochs_lst = [i for i in range(len(acc_lst))] fig, ax1 = plt.subplots() color = 'tab:red' ax1.set_xlabel(xlabel_title) ax1.xaxis.set_major_locator(MaxNLocator(integer=True)) a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accuracy_plot(self,train_accuracy,test_accuracy,train_color='g',test_color='b'):\n plt.plot(range(len(test_accuracy)),train_accuracy,color=train_color,label='Train Acc w/ {} hidden dims'.format(self.hidden_dims))\n plt.plot(range(len(test_accuracy)),test_accuracy,color=test_color,label='Test Acc ...
[ "0.83458394", "0.8264738", "0.8223635", "0.8195923", "0.81773084", "0.8177044", "0.81581604", "0.8096917", "0.80522597", "0.8002076", "0.79781044", "0.7942933", "0.7922191", "0.79146475", "0.790443", "0.79029083", "0.78881127", "0.7775717", "0.77690464", "0.7768162", "0.77647...
0.7092084
80
send a numpy array with metadata
def send_array(socket, A, flags=0, copy=True, track=False): md = dict( dtype = str(A.dtype), shape = A.shape, ) socket.send_json(md, flags|zmq.SNDMORE) return socket.send(A, flags, copy=copy, track=track)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_np_array(self, np_array):\n data = pickle.dumps(np_array)\n # GET MESSAGE LENGTH\n m_size = struct.pack(\"L\", len(data))\n # SEND DATA\n print(\"sending object of size\", len(data), \"back to client\")\n self.client_socket.sendall(m_size + data)", "def serializ...
[ "0.69578165", "0.66142195", "0.65245533", "0.6460982", "0.6445735", "0.632394", "0.63205945", "0.61907536", "0.6167736", "0.61572784", "0.6133336", "0.6108114", "0.6097836", "0.6097347", "0.6092564", "0.608265", "0.6069084", "0.6058808", "0.60509187", "0.60484374", "0.6032366...
0.6243381
9
Compute number of ngrams in a string of length string_length.
def n_gram_number(string_length, n): return string_length - n + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_ngrams(n, text):\n return (len(text) - n) + 1", "def ngram_count(word, ngrams):\n return len(set(ngrams).intersection(compute_ngrams([word])))", "def length(string):\n return len(undecorate(string))", "def precook(s, n=4):\r\n words = s.split()\r\n counts = defaultdict(int)\r\n for ...
[ "0.7537836", "0.66969985", "0.6581395", "0.6522866", "0.6458408", "0.63964754", "0.63964754", "0.6372108", "0.6304544", "0.62661886", "0.62405974", "0.6231191", "0.62216705", "0.6193423", "0.6191357", "0.61898947", "0.6170759", "0.6150876", "0.61427516", "0.6123222", "0.61176...
0.79022133
0
Name of the user
def name(self): return self._user_dict['name']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_name(self) -> str:\n return pulumi.get(self, \"user_name\")", "def user_name(self) -> str:\n return pulumi.get(self, \"user_name\")", "def get_user_name(self):\n pass", "def user_name(self) -> str:\n return self._user_name", "def user_name(self) -> str:\n return ...
[ "0.90602577", "0.90602577", "0.90267307", "0.89494187", "0.89494187", "0.88759464", "0.88759464", "0.8871282", "0.88655657", "0.8835846", "0.8834678", "0.883248", "0.883248", "0.8795832", "0.8795832", "0.8795832", "0.8790677", "0.8443076", "0.8394047", "0.83766085", "0.829691...
0.8459626
17
Get all books and reviews on user's shelves
def reviews(self, page=1): resp = self._client.session.get("/review/list.xml", {'v': 2, 'id': self.gid, 'page': page}) return [review.GoodreadsReview(r) for r in resp['reviews']['review']]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_shelf(self, user_id, shelf_name):\n url = \"https://www.goodreads.com/review/list\"\n params = {'v': 2,\n 'id': user_id,\n 'shelf': shelf_name,\n 'sort': 'isbn',\n 'per_page': 200,\n 'key' : self.key} \n\n ...
[ "0.6651716", "0.6578213", "0.6450995", "0.6079195", "0.5854275", "0.58440745", "0.57290524", "0.56938034", "0.564859", "0.5635111", "0.56127465", "0.5548427", "0.54871756", "0.5484074", "0.54766935", "0.5441988", "0.536992", "0.53564304", "0.53542775", "0.53487146", "0.527790...
0.0
-1
Get the index of the start node
def get_start_index(self): for index, node in enumerate(self.nodes): if node.is_start: return index return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_index(self) -> int:\r\n return self.data.get(\"startIndex\")", "def start_index(self):\n return self.container['start_index']", "def starting_nodes(self):\r\n return self.start_node", "def get_curline_index_start():\n for subindex, token in enumerate(reversed(tokens[:ind...
[ "0.7911821", "0.7845161", "0.73400193", "0.72989446", "0.7291116", "0.72374743", "0.7219915", "0.71917444", "0.7128248", "0.7096856", "0.70002544", "0.6898064", "0.6886391", "0.68854207", "0.68751013", "0.6858257", "0.68269724", "0.6813359", "0.6805091", "0.67988825", "0.6770...
0.9154327
0
Computes the absolute value (L1) norm between wet and target feature vectors Scales output so that closer distances result in higher rewards
def calculate_reward(self, dry: np.ndarray, wet: np.ndarray, target: np.ndarray): l1_norm = np.mean(np.abs(wet - target)) reward = 1.0 / (1.0 + l1_norm) return reward
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm(self):\n tot = 0.0\n for word in self.model:\n tot += self.model[word]\n ltot = log(tot, 2)\n for word in self.model:\n self.model[word] = log(self.model[word], 2) - ltot", "def __call__(self, features):\n norm = list()\n def normalize(vect...
[ "0.68885624", "0.6615538", "0.6600509", "0.6552613", "0.6431327", "0.6405872", "0.6331638", "0.6308582", "0.6303436", "0.62829554", "0.62747866", "0.626725", "0.625531", "0.625531", "0.625531", "0.62431234", "0.62204164", "0.6218234", "0.61825573", "0.6171971", "0.6156533", ...
0.0
-1
Decorator to define a `block `_ processor command.
def block_processor(f): def new_func(*args, **kwargs): # noinspection PyShadowingNames def block_processor(state: State, processors: Iterable[ProcessorType]) -> None: start = datetime.datetime.now() new_args, new_kwargs = state.preprocess_arguments(args, kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block(func):\n if func not in INPUT_BLOCK:\n INPUT_BLOCK.add(func)\n return func", "def instruction(comment):\n def decorator(function):\n def wrapper(*args, **kwargs):\n return [\"\\n// %s\" % comment] + function(*args, **kwargs)\n return wrapper\n return decorato...
[ "0.6159707", "0.5674247", "0.55788285", "0.55086744", "0.54002094", "0.534246", "0.5314156", "0.5299505", "0.5296884", "0.5241456", "0.51711696", "0.51703006", "0.51663506", "0.51204455", "0.5094891", "0.50678027", "0.50452334", "0.50058967", "0.50050473", "0.4963417", "0.495...
0.6996245
0
Return app for gunicorn to serve
def create_app(): app = Flask(__name__) app.register_blueprint(route_bp) reload_tmpls() print(f"COVID_DATA_BASE={COVID_DATA_BASE}") print("create_app done.") return app
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n app = server.app\n return app", "def wsgi_app():\n return bottle.default_app()", "def gunicorn(port, worker, mode):\n FlaskGunicorn(application).run()", "async def get_application(self) -> aiohttp.web.Application:\n s = await server.Server.new(\n strategy=\"mirrored...
[ "0.765702", "0.730618", "0.7186588", "0.7156055", "0.7066478", "0.69530725", "0.67914504", "0.6728043", "0.67043346", "0.6664485", "0.6620899", "0.6585148", "0.6518459", "0.6516047", "0.65085274", "0.6473263", "0.64722437", "0.6455731", "0.64465094", "0.63886845", "0.63424367...
0.0
-1
Gets the distance between two location objects, in meters
def get_distance_meters(locA, locB): dlat = locB.lat - locA.lat dlon = locB.lon - locA.lon return math.sqrt((dlat**2) + (dlon**2)) * 1.1131195e5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_distance_meters(aLocation1, aLocation2):\n dlat = aLocation2.lat - aLocation1.lat\n dlong = aLocation2.lon - aLocation1.lon\n return math.sqrt((dlat*dlat) + (dlong*dlong)) * 1.113195e5", "def get_distance_metres(location_1, location_2):\n dlat = location_2.lat - location_1.lat\n dlong = lo...
[ "0.8261945", "0.8116388", "0.8049456", "0.80026513", "0.80026513", "0.80026513", "0.80026513", "0.79388946", "0.77556896", "0.7699942", "0.7635322", "0.76077557", "0.7547994", "0.74546087", "0.7426855", "0.7405647", "0.7363398", "0.7285576", "0.724041", "0.72309244", "0.72021...
0.7904274
8
Temperature of the sensor in Celsius
def get_temperature(self): raw = (self.read(AMG88XX_TTHH << 8)) | self.read(AMG88XX_TTHL) return _signed_12bit_to_float(raw) * self.AMG8833_THERMISTOR_CONVERSION
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def temperaturecelsius(self, mess, args):\n sensor = TemperatureSensor()\n return sensor.getTemperatureCelsius()", "def temperature(self):\n\t\tt = self._i2c.readfrom_mem(self._addr, 0x0E, 2)\n\t\treturn (t[0] + t[1]*256) * 0.0625;", "def temperature(self):\n self.pi.i2c_write_device(self._h...
[ "0.8378524", "0.83175355", "0.830122", "0.8218308", "0.81908774", "0.8074753", "0.80686444", "0.80639946", "0.8060821", "0.8060576", "0.8012536", "0.79860485", "0.7982504", "0.79136664", "0.7858954", "0.7858954", "0.7848107", "0.77717566", "0.7766098", "0.77090883", "0.768669...
0.7421169
52
The value of the event if it is available. The value is available when the event has been triggered.
def value(self): if self._value is PENDING: raise AttributeError('Value of %s is not yet available' % self) return self._value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def val(self, event: Event) -> Any:\r\n try:\r\n return event[self.name]\r\n except KeyError:\r\n if self.strict:\r\n raise Break()\r\n else:\r\n raise Continue()", "def value(self):\n return self._handle(\"value\")", "def get_...
[ "0.75905013", "0.71892995", "0.7107093", "0.70692146", "0.7045523", "0.7045523", "0.7045523", "0.7045523", "0.7045523", "0.7045523", "0.7045523", "0.70173454", "0.7008356", "0.7008356", "0.7008356", "0.7008356", "0.7008283", "0.69712734", "0.69625413", "0.6930946", "0.6899889...
0.6899385
23
This function uses gaussian function with given parameter sigma to smoothen all the aligned MR Images.
def gaussian_smoothing(self, regex, split_on, in_folder, out_folder): counter = 0 for directory in os.walk(in_folder): # Walk inside the directory for file in directory[2]: # Match all files ending with 'regex' input_file = os.path.join(director...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussianFilter(self, array=numpy.empty(0), sigma=1.8, m=9):\n self.__printStatus(\n \"Gaussian filter sigma=\" + str(sigma) + \", m=\" + str(m) + \"...\"\n )\n if not array.any():\n array = self.image_array\n self.image_array = cv2.GaussianBlur(array, (m,m), si...
[ "0.6339313", "0.63284105", "0.63014525", "0.6256544", "0.6195188", "0.6191237", "0.608002", "0.60764253", "0.6064828", "0.60474503", "0.6047412", "0.60397583", "0.60207653", "0.6019611", "0.60107476", "0.5987585", "0.59829885", "0.59782034", "0.5935497", "0.59343547", "0.5927...
0.0
-1
Given the gaussian smoothed images this function reduces the dimensionality of the images by half.
def subsample(self, regex, split_on, in_folder, out_folder): counter = 0 for directory in os.walk(in_folder): # Walk inside the directory for file in directory[2]: # Match all files ending with 'regex' input_file = os.path.join(directory[0], file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussianSmoothing(image):\n imageArray = np.array(image)\n gaussianArr = np.array(image)\n sum = 0\n\n for i in range(3, image.shape[0] - 3):\n for j in range(3, image.shape[1] - 3):\n sum = applyGaussianFilterAtPoint(imageArray, i, j)\n gaussianArr[i][j] = sum\n\n r...
[ "0.6544849", "0.6306759", "0.62854034", "0.6184757", "0.6174233", "0.6153343", "0.61152023", "0.60850537", "0.6084906", "0.60835963", "0.60781914", "0.6052458", "0.59721076", "0.5965177", "0.59313506", "0.5923413", "0.5919832", "0.5885607", "0.58796144", "0.5874699", "0.58643...
0.0
-1
Parses the given text and returns a list of links that are parsed from the text. This method delegates to parser providers that can parse output from different kinds of formats. If no links are found then an empty list is returned. text the text to scan for file links. 'text' can not be None.
def parse(self, text): if text is None: raise ValueError("text can not be None") links = [] for provider in self._providers: links.extend(provider.parse(text)) return links
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_generic_txt_export(text_file: IO[str], **_kwargs) -> Iterable[Link]:\n\n text_file.seek(0)\n for line in text_file.readlines():\n if not line.strip():\n continue\n\n # if the line is a local file path that resolves, then we can archive it\n try:\n if Path(...
[ "0.71900153", "0.68787324", "0.6497824", "0.6324783", "0.63184017", "0.62354153", "0.6225407", "0.6213159", "0.6169793", "0.61450195", "0.6109761", "0.60976547", "0.6043314", "0.5918175", "0.5851738", "0.5815896", "0.57389104", "0.5727333", "0.5683647", "0.56835395", "0.56732...
0.7962011
0
This method should be implemented by subclasses. It takes a text as argument (never None) and then returns a list of Link objects. If no links are found then an empty list is expected. The Link class is defined in this module. If you do not override this method then a NotImplementedError will be thrown. text the text t...
def parse(self, text): raise NotImplementedError("need to implement a parse method")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, text):\n if text is None:\n raise ValueError(\"text can not be None\")\n\n links = []\n\n for provider in self._providers:\n links.extend(provider.parse(text))\n\n return links", "def parse_generic_txt_export(text_file: IO[str], **_kwargs) -> Iter...
[ "0.7867334", "0.68417865", "0.65259093", "0.6382206", "0.6290856", "0.6210416", "0.620545", "0.6156433", "0.61520743", "0.6063902", "0.6016342", "0.6005948", "0.593195", "0.5930653", "0.59245825", "0.5910786", "0.58645844", "0.5834773", "0.57790905", "0.57550895", "0.5751625"...
0.6605241
2
Creates an instance of this model from a dictionary
def from_dictionary(cls, dictionary): if dictionary is None: return None # Extract variables from the dictionary id = dictionary.get('id') number = dictionary.get('number') owner_name = dictionary.get('ownerName') owner_addres...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(cls, dictionary):\n return cls(**dictionary)", "def create(cls, dictionary):\n return cls(**dictionary)", "def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionar...
[ "0.81669754", "0.81669754", "0.81394345", "0.8026969", "0.80048424", "0.79882926", "0.7945546", "0.78800553", "0.7842587", "0.7836289", "0.7815562", "0.78098834", "0.78021747", "0.78016543", "0.78016543", "0.78016543", "0.78016543", "0.78016543", "0.78016543", "0.78016543", "...
0.0
-1
Transform an array with one flattened image per row, into an array in which images are reshaped and layed out like tiles on a floor.
def tile_tensor_array(X, tile_shape, img_shape=None, tile_spacing=(0, 0)): assert len(tile_shape) == 2 assert len(tile_spacing) == 2 tile_shape = (int(tile_shape[0]), int(tile_shape[1])) tile_spacing = (int(tile_spacing[0]), int(tile_spacing[1])) if img_shape is None: img_shape = (int(X.sha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FlattenData(imgData):\n flatImg = []\n for row in imgData:\n for pixel in row:\n flatImg.append(pixel)\n return flatImg", "def nest_image_array(image_array, filter_size):\n # Matrix\n nested_image_array = [[None]*(filter_size) for i in range(int(len(image_array)/filter_size))...
[ "0.7035818", "0.6745841", "0.6678417", "0.6653403", "0.6568259", "0.65613544", "0.65584105", "0.65584105", "0.65584105", "0.65584105", "0.65584105", "0.6465384", "0.64236957", "0.6416058", "0.638984", "0.6368432", "0.63464254", "0.63277733", "0.63176334", "0.62847096", "0.627...
0.60364884
44
Sets the code of this CreateSequenceRequest.
def code(self, code): if self.local_vars_configuration.client_side_validation and code is None: # noqa: E501 raise ValueError("Invalid value for `code`, must not be `None`") # noqa: E501 if (self.local_vars_configuration.client_side_validation and code is not None and len(c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_code(self, code):\n self.__code = code", "def code(self, code):\n\n self._code = code", "def code(self, code):\n\n self._code = code", "def code(self, code):\r\n\r\n self._code = code", "def set_code(self, code):\n self.element.set_code(code)", "def setCode(self...
[ "0.71589553", "0.70685965", "0.70685965", "0.69575244", "0.65988034", "0.64484626", "0.6105445", "0.6033243", "0.6026479", "0.5990854", "0.59768134", "0.5971711", "0.59205294", "0.5699071", "0.5689528", "0.5644483", "0.5639867", "0.5615062", "0.5576758", "0.5569169", "0.55601...
0.5906644
13
Sets the min_value of this CreateSequenceRequest.
def min_value(self, min_value): self._min_value = min_value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_min(self, min_value):\n self._min = min_value", "def SetMin(self, value):\n self.Min = value\n self.sliderValue.SetMin( int(value*self.float_convert) )\n self.sliderValue.SetPageSize(5)\n self._check_value()", "def min(self):\n self.value = 0", "def do_min(se...
[ "0.8164278", "0.72195333", "0.67813236", "0.6580534", "0.655836", "0.65580016", "0.65257496", "0.6508956", "0.6508956", "0.6508956", "0.6498963", "0.6458115", "0.6438924", "0.6388062", "0.6384116", "0.62467724", "0.6226589", "0.6179891", "0.61758244", "0.6128629", "0.6111593"...
0.82129323
0
Sets the start of this CreateSequenceRequest.
def start(self, start): self._start = start
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setStart(self, start, log=None):\r\n setAttribute(self, 'start', start, log)", "def set_start(self, start):\n self._reset(self)\n self.start = start", "def setStart(self, Start):\n self.Start = Start", "def start(self, start):\r\n self.__dict__['start'] = numpy.array(start)\r\n...
[ "0.7193437", "0.71152747", "0.6924956", "0.68714523", "0.6683673", "0.65754473", "0.63801074", "0.63801074", "0.63426244", "0.62841517", "0.62841517", "0.62841517", "0.62841517", "0.62841517", "0.62841517", "0.62841517", "0.6271413", "0.62329024", "0.62149906", "0.6211435", "...
0.7077918
6
Sets the cycle of this CreateSequenceRequest.
def cycle(self, cycle): self._cycle = cycle
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def payment_cycle(self, payment_cycle):\n\n self._payment_cycle = payment_cycle", "def set_duty_cycle(self,duty_cycle):\n \n self.duty_cycle = duty_cycle\n if self._pwm != None:\n self.stop_pwm()\n self.start_pwm()", "def getCycle (self):\n return self.n...
[ "0.5907531", "0.5291439", "0.5154627", "0.5139945", "0.50912106", "0.49956933", "0.49956933", "0.49528462", "0.49351355", "0.49225086", "0.48719746", "0.4778985", "0.46987757", "0.46571064", "0.46304962", "0.45948234", "0.45715857", "0.45704877", "0.45645848", "0.45564696", "...
0.68904215
1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _repr_model_(self):\n return str(self)", "def __str__(self):\n\n return str(self.model)", "def get_model_string(self):\n raise NotImplementedError()", "def __str__(self):\n return self.model", "def serialize_model(self):\n return dill.dumps(self.model)", "def __str_...
[ "0.8602374", "0.85093755", "0.8237104", "0.8050309", "0.80128866", "0.79348034", "0.78766525", "0.77898884", "0.7786461", "0.7745792", "0.7627315", "0.76055235", "0.757999", "0.7514394", "0.75038797", "0.75035286", "0.74850684", "0.7440529", "0.74325883", "0.74239755", "0.740...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, CreateSequenceRequest): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n return not self == other", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other):\n return self.__dict__ != other.__dict__", "def __eq__(self, other):\n return not self.__ne__(other)", ...
[ "0.8410411", "0.8391477", "0.8172175", "0.81410587", "0.80920255", "0.8088807", "0.80676955", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Calculates the repeatable euclidian distance length of the unit cell in the Miller Incex direction specified.
def repeated_length(self, direction=np.zeros(shape=(1, 3))): lengths = np.zeros(shape=(3, 1)) for i in range(3): if direction[i] == 0: lengths[i] = 1e6 else: t = 0.5 * self.box[i, i] / float(direction[i]) lengths[i] = 2 * sqrt( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_cable_length(self):\n\n added_length = 1.0 + self._design.get(\"percent_added_length\", 0.0)\n self.length = round(\n (\n self.free_cable_length\n + (self._distance_to_landfall - self.touchdown / 1000)\n + self._distance_to_interconn...
[ "0.59140265", "0.5893804", "0.58413935", "0.58398575", "0.5795936", "0.5718771", "0.56291777", "0.5536831", "0.55224216", "0.5478952", "0.54769784", "0.54744405", "0.54702944", "0.54598397", "0.54593784", "0.5455316", "0.5431439", "0.5399314", "0.5394915", "0.53925484", "0.53...
0.6424977
0
Takes a number and returns True if it's a prime number, otherwise returns False.
def is_prime(number): if number == 2 or number == 3: return True if number <= 0 or number % 2 == 0 or number % 3 == 0: return False for i in range(2, int(number ** 0.5) + 1): if number % i == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(number: int) -> bool:\n if number < 2:\n return False\n elif number == 2:\n return True\n else:\n divisor_number = 2\n while divisor_number <= math.sqrt(number):\n if number % divisor_number == 0:\n return False\n divisor_number...
[ "0.87339145", "0.8720853", "0.8666654", "0.86388564", "0.8605469", "0.8487509", "0.84554845", "0.8383295", "0.8373637", "0.8353297", "0.8352095", "0.8344219", "0.8344219", "0.83173317", "0.8301981", "0.82616985", "0.82438177", "0.82284105", "0.8224162", "0.8221473", "0.821993...
0.8525011
5
The identity_block is the block that has no conv layer at shortcut Arguments
def identity_block(input_tensor, kernel_size, filters, stage, block): nb_filter1, nb_filter2, nb_filter3 = filters conv_name_base = 'res' + str(stage) + block + '_branch' bn_name_base = 'bn' + str(stage) + block + '_branch' x = Convolution2D(nb_filter1, 1, 1, name=conv_name_base + '2a')(input_tensor) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_block(input_tensor, kernel_size, filters, stage, block, use_bias=True, pretrain=False, data_dict=None):\r\n nb_filter1, nb_filter2, nb_filter3 = filters\r\n conv_name_base = 'res' + str(stage) + block + '_branch'\r\n bn_name_base = 'bn' + str(stage) + block + '_branch'\r\n\r\n x = setool....
[ "0.74289453", "0.72440964", "0.72374606", "0.72064394", "0.71887946", "0.715454", "0.71544397", "0.7076201", "0.7065115", "0.7055314", "0.70296574", "0.70296574", "0.7012959", "0.6998513", "0.6998513", "0.6947203", "0.68867576", "0.68676025", "0.6861343", "0.6815053", "0.6805...
0.72569615
2
conv_block is the block that has a conv layer at shortcut Arguments
def conv_block(input_tensor, kernel_size, filters, stage, block, strides=(2, 2)): nb_filter1, nb_filter2, nb_filter3 = filters conv_name_base = 'res' + str(stage) + block + '_branch' bn_name_base = 'bn' + str(stage) + block + '_branch' x = Convolution2D(nb_filter1, 1, 1, subsample=strides, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_block(input_tensor, kernel_size, filters, stage, block,use_bias=True, pretrain=False,strides=2, data_dict=None):\r\n nb_filter1, nb_filter2, nb_filter3 = filters\r\n conv_name_base = 'res' + str(stage) + block + '_branch'\r\n bn_name_base = 'bn' + str(stage) + block + '_branch'\r\n\r\n x = set...
[ "0.7577787", "0.7508393", "0.7371754", "0.72778666", "0.72767574", "0.7223469", "0.72192603", "0.71982", "0.7193955", "0.711559", "0.7101654", "0.7076912", "0.70728767", "0.7049052", "0.7047674", "0.7015571", "0.70044017", "0.6998261", "0.699667", "0.699667", "0.69669795", ...
0.7231876
6
Evaluate an expression in many different environments. This function accepts the same arguments as `eval`, but takes a list of environments instead of just one. The call eval_bulk(e, envs) is equivalent to [eval(e, env) for env in envs]. However, using `eval_bulk` is much faster than repeatedly calling `eval` on the sa...
def eval_bulk( e : Exp, envs : [{str:object}], use_default_values_for_undefined_vars : bool = False): if not envs: return [] e = purify(e) ops = [] types = { v.id : v.type for v in free_vars(e) } vars = OrderedSet(itertools.chain(types.keys(), free_funcs(e).keys()))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval(e : Exp, env : {str:object}, *args, **kwargs):\n return eval_bulk(e, (env,), *args, **kwargs)[0]", "def evaluate_all(**kwargs):\n evaluator.evaluate_all(**kwargs)", "def batch_eval(self, exprs, n, extra_constraints=(), exact=None):\n raise NotImplementedError()", "def evaluate_expressio...
[ "0.685922", "0.6182164", "0.61820614", "0.59720105", "0.58348036", "0.58157045", "0.5746197", "0.5414362", "0.5390244", "0.5356567", "0.53202844", "0.53067565", "0.5282488", "0.5235772", "0.51904184", "0.5186689", "0.5170276", "0.5165577", "0.5141102", "0.5138726", "0.5131300...
0.77205396
0
Produce an arbitrary value of the given type. eval(construct_value(t), {}) == mkval(t)
def mkval(type : Type): return eval(construct_value(type), {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_value(t : Type) -> Exp:\n if is_numeric(t):\n e = ENum(0)\n elif t == BOOL:\n e = EFALSE\n elif t == STRING:\n e = EStr(\"\")\n elif is_collection(t):\n e = EEmptyList()\n elif isinstance(t, TTuple):\n e = ETuple(tuple(construct_value(tt) for tt in t....
[ "0.7671619", "0.6997938", "0.67407656", "0.64640534", "0.64240354", "0.6207909", "0.613866", "0.61093545", "0.60316354", "0.5842205", "0.56733334", "0.56587124", "0.5656185", "0.55005604", "0.54444736", "0.54356074", "0.54059917", "0.5399492", "0.5396886", "0.53743386", "0.53...
0.8486673
0
Construct an arbitrary expression e of the given type. eval(construct_value(t), {}) == mkval(t)
def construct_value(t : Type) -> Exp: if is_numeric(t): e = ENum(0) elif t == BOOL: e = EFALSE elif t == STRING: e = EStr("") elif is_collection(t): e = EEmptyList() elif isinstance(t, TTuple): e = ETuple(tuple(construct_value(tt) for tt in t.ts)) elif isi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mkval(type : Type):\n return eval(construct_value(type), {})", "def uneval(t : Type, value) -> Exp:\n res = _uneval(t, value)\n assert eval(res, {}) == value\n return res", "def construct(type, value=None):\n return type() if value is None else type(value)", "def make_expr(expr: ExprType):...
[ "0.7507443", "0.60327363", "0.5977161", "0.5811026", "0.5593624", "0.55910987", "0.54193324", "0.54057175", "0.53998095", "0.5366679", "0.53501964", "0.5330542", "0.5227292", "0.519018", "0.51882404", "0.5137975", "0.513723", "0.510937", "0.50825316", "0.5079952", "0.49984622...
0.803029
0
Used by scipy.opimize.fminbound to optimize for lambda
def g_of_lambda(lambduh): global itrepeats logging.info("itrepeats: %d", itrepeats) dictPartition, dictQ, dictE, dictF = repeated_runs(g1, delta, tolerance, lambduh, Zgraph, itrepeats) label_dict_lam[lambduh] = dictPartition Qlam[lambduh]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, lambda_):\n if lambda_ <= self.mu:\n return self[:lambda_]\n if lambda_ < self.lambda_:\n return self[:self.mu] + self[self.mu - lambda_:]\n if lambda_ > self.lambda_:\n return self[:self.mu] + (lambda_ - self.lambda_) * [0] + self[self.mu:]\...
[ "0.6686925", "0.6570494", "0.65490913", "0.6506491", "0.64717805", "0.643426", "0.64286435", "0.63601166", "0.62854004", "0.6283267", "0.6221838", "0.61789125", "0.6134299", "0.61239904", "0.61065775", "0.61033916", "0.6100904", "0.60963243", "0.6049565", "0.603346", "0.60236...
0.0
-1
Makes a Flask response with a JSON encoded body
def output_json(data, code, headers=None): settings = current_app.config.get('RESTFUL_JSON', {}) if current_app.debug: settings.setdefault('indent', 4) settings.setdefault('sort_keys', not PY3) """对响应字典进行外层包装""" if 'message' not in data: # 如果视图自定义了错误信息, 则不再添加默认的外层包装 data = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response(data):\n return jsonify(data)", "def jsonify(*args: t.Any, **kwargs: t.Any) -> Response:\n return current_app.json.response(*args, **kwargs)", "def json_response(json_string):\n return app.response_class(json_string, mimetype='application/json')", "def _view_function_response() -> Respons...
[ "0.78274524", "0.75691473", "0.72475874", "0.72379166", "0.7224005", "0.7187352", "0.7095689", "0.70263803", "0.7025495", "0.70188093", "0.7000875", "0.69565684", "0.6926021", "0.69087857", "0.6856938", "0.68447983", "0.68447983", "0.6834034", "0.68111014", "0.67724", "0.6753...
0.6669657
25
Shifts `ranks2` forward by `lag` number of entries. Removes the tail ends of the rank vectors that fall off after shifting. Then returns the dot product normalized by the number of entries that were used in the dot. For instance, suppose ranks1 = [1, 2, 3, 4] ranks2 = [4, 3, 2, 1] lag = 2. After shifting and removing t...
def dot_normalized(ranks1, ranks2, lag=0, use_zeros=False): assert len(ranks1) == len(ranks2), \ "Rank vectors are not the same length" # Count the number of entries that would be zeroed out # in either vector num_zeros = 0 if not use_zeros: num_zeros = np.sum((ranks1 * ranks2) =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_dot_normalized(ranks1, ranks2, min_lag=0, max_lag=12, use_zeros=False):\n dots = [dot_normalized(ranks1, ranks2, lag, use_zeros) \\\n for lag in range(min_lag, max_lag + 1)]\n return np.amax(dots)", "def simulate(ranks1, ranks2, num_trials=10000, min_lag=0, max_lag=12, use_zeros=...
[ "0.59738606", "0.5721394", "0.51025504", "0.487085", "0.46651834", "0.46456128", "0.45797646", "0.4546088", "0.45284554", "0.44852948", "0.4466676", "0.44436187", "0.4411859", "0.43964696", "0.4380408", "0.43570843", "0.43293014", "0.42762113", "0.42697024", "0.42673805", "0....
0.7550424
0
Given two rank vectors, repeatedly permutes ranks and gets the largest normalized dot product. Return all simulated values. Like `dot_normalized()`, this assumes we are shifting `rank2` forward.
def simulate(ranks1, ranks2, num_trials=10000, min_lag=0, max_lag=12, use_zeros=False): # Used to simulate a single trial. The input is not used def simulate_single_trial(_): np.random.shuffle(ranks1) return largest_dot_normalized(ranks1, ranks2, min_lag, max_lag, use_zeros) # Make a co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_dot_normalized(ranks1, ranks2, min_lag=0, max_lag=12, use_zeros=False):\n dots = [dot_normalized(ranks1, ranks2, lag, use_zeros) \\\n for lag in range(min_lag, max_lag + 1)]\n return np.amax(dots)", "def dot_normalized(ranks1, ranks2, lag=0, use_zeros=False):\n assert len(rank...
[ "0.75973755", "0.7536336", "0.6012593", "0.5588312", "0.5391731", "0.5350395", "0.53233945", "0.5285785", "0.52559763", "0.5177417", "0.5139676", "0.50912863", "0.5089984", "0.5075916", "0.5050228", "0.5038039", "0.50312215", "0.49717748", "0.4960725", "0.4954934", "0.4951614...
0.6622486
2
3x3 convolution with padding
def SparseConv3x3(in_planes, out_planes, stride=1, indice_key=None): return spconv.SubMConv3d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False, indice_key=indice_key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv3x3(in_planes, out_planes, stride=1, padding=1, groups=1, dilation=1, zero_init=False):\n conv = nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=padding, groups=groups, bias=False, dilation=dilation)\n if zero_init:\n conv.weight.data.zero_()\n return conv", "def co...
[ "0.73706514", "0.7335249", "0.7216377", "0.72037584", "0.72037584", "0.7199952", "0.7192902", "0.7183875", "0.7178802", "0.7172082", "0.71645725", "0.71645725", "0.716185", "0.7156602", "0.7156602", "0.7156602", "0.7156602", "0.7156602", "0.7156602", "0.7156602", "0.7156602",...
0.0
-1
Gets the unique ID for this AirStation. An AirStation object is identified by its unique 64bit MAC address of the network card that it is using.
def get_id(self): return self._id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self):\n return self.station_id", "def unique_id(self) -> str:\n return self._info.device_identification", "def unique_id(self) -> str:\n return 'lmag_' + self._mac_address", "def unique_id(self):\n serial = self._accessory_info[\"serial-number\"]\n return f\...
[ "0.73244447", "0.73036075", "0.7258451", "0.718001", "0.7133785", "0.705949", "0.70417005", "0.7039883", "0.7026533", "0.6997716", "0.6977054", "0.697172", "0.6910323", "0.6887649", "0.6881423", "0.68681836", "0.68681836", "0.686478", "0.6863782", "0.6822987", "0.68145984", ...
0.0
-1
Gets the current temperature as reported by the BMP085/BMP180 sensor. For more information on how this reading is obtained, please see the
def get_temp(self): return Adafruit_DHT.read_retry(Adafruit_DHT.DHT22, DHT22_PIN)[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadTemperature():\n global bus\n global addressCompass\n global tempOffest \n\n # Read the data from the compass chip\n try:\n bus.write_byte(addressCompass, 0x00)\n [status, xh, xl, yh, yl, zh, zl, who, sm, oxh, oxl, oyh, oyl, ozh, ozl, temp, c1, c2] = bus.read_i2c_block_data(add...
[ "0.8022303", "0.8018967", "0.798728", "0.7986672", "0.7982644", "0.7981246", "0.79522765", "0.7943946", "0.7913353", "0.7880554", "0.7880441", "0.7842956", "0.7807763", "0.77370566", "0.77273417", "0.7725328", "0.770126", "0.7690616", "0.76617444", "0.7654985", "0.7623417", ...
0.7228347
70
Gets the current altitude as reported by the BMP085/BMP180 sensor. For more information on how this reading is obtained, please see the
def get_altitude(self): return self._bmp.read_altitude()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def altitude(self):\n self._pull()\n return self._altitude", "def get_altitude(self):\n return self.vehicle.location.global_relative_frame.alt", "def altitude(self):\n return self._position.altitude", "def get_altitude(self):\n if self.is_module_queried['Altitude'] is False...
[ "0.8431863", "0.8366296", "0.8110305", "0.7967901", "0.78488594", "0.7713928", "0.7087731", "0.6729977", "0.66145396", "0.66033494", "0.64960015", "0.6493608", "0.6442824", "0.6112543", "0.610509", "0.60501784", "0.5936744", "0.59315234", "0.5884972", "0.58553797", "0.585306"...
0.8895391
0
Gets the current particular matter reading as a concentration per unit volume as reported by the Shinyei PPD42NJ sensor. For more information on how this reading is obtained, please see the
def get_pm(self): # Flush the existing input buffer to ensure a fresh reading self._pm.flushInput() res = self._pm.read(24) # Add up each of the bytes in the frame sum = 0 for i in range(0, 22): sum = sum + int(res[i].encode("hex"), 16) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_sensor(self):\n return self.fluid", "def get_celsius_reading(self, channel):\n return float(self.query(f\"CRDG? {channel}\"))", "def read_Temperature(self):\r\n temp = self.read_rawTemperature()\r\n #print(temp)\r\n temperature = temp / 520\r\n print('Temp. in...
[ "0.66506666", "0.6371005", "0.63089395", "0.62459445", "0.6173032", "0.6152712", "0.6057", "0.602769", "0.5998595", "0.5965022", "0.5952085", "0.5937536", "0.58888644", "0.5842389", "0.58293045", "0.5799248", "0.57451266", "0.57331926", "0.56981915", "0.56700337", "0.5659209"...
0.0
-1
Gets the current CO2 reading as a concentration in parts per million (ppm) as reported by the MG811 sensor. For more information on how this reading is obtained, please see the
def get_co2(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_co(self):\n\n return ADC.read(CO_PIN) * 1.8", "def _calculate_co2(meter_readings, region_code):\n total_reading = 0\n total_average = 0\n days_affected_by_readings = set()\n for meter_reading in meter_readings:\n reading_mwh = meter_reading.reading / 3.412 / 1000 # convert from...
[ "0.7514826", "0.6844526", "0.64294535", "0.6339422", "0.63010395", "0.62364715", "0.62314826", "0.61890095", "0.61735934", "0.61250037", "0.6118749", "0.60522735", "0.6045577", "0.6034205", "0.6017236", "0.5925337", "0.5924856", "0.59091616", "0.5902768", "0.58837295", "0.586...
0.56483996
38
Gets the current Ultra Violent Index (UVI) as reported by the Reyax UVI01 sensor. For more information on how this reading is obtained, please see the
def get_uv(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uvi(self) -> int:\n return self.period[\"uvi\"]", "def uv_index(self) -> float:\n self._take_reading()\n return ((self._uvacalc * self._uvaresp) + (self._uvbcalc * self._uvbresp)) / 2", "def uvs(self):\n self._mode = UV\n while not self.data_ready:\n sleep(0.01...
[ "0.7212064", "0.7142792", "0.67415524", "0.6529213", "0.6522131", "0.6518511", "0.6435096", "0.6299796", "0.6266392", "0.62261033", "0.61529803", "0.6055209", "0.60511047", "0.59509265", "0.57929474", "0.57604724", "0.5750083", "0.5748438", "0.5736212", "0.5730056", "0.572132...
0.6385186
7
Closes all of the open resources for this AirStation. This method should be invoked at the end of life for each AirStation object.
def close(self): # Stop the GpsPoller in the extra thread if it is running if self._gpsp.running and self._mode == FIELD_MODE: self._gpsp.running = False self._gpsp.join()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n\n for store in self.open_stores:\n store.close()", "def close(self):\n for instance in self._instances.values():\n instance.close()", "def closeAll(self):\n for switch in self.listOfSwitchManagers.keys():\n self.closeConnection(switch)", ...
[ "0.71695036", "0.68416166", "0.67619944", "0.6758494", "0.67338985", "0.66815317", "0.66815317", "0.6579698", "0.6482952", "0.6470092", "0.64306504", "0.6426319", "0.6413861", "0.6395811", "0.63917494", "0.6373906", "0.63630223", "0.6359003", "0.63536745", "0.63447005", "0.63...
0.0
-1
Checks whether the circular deque is empty or not.
def isEmpty(self) -> bool: return self.size == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isEmpty(self):\r\n if self.deque == []:\r\n return True\r\n else:\r\n return False", "def is_empty(self):\r\n return self._front is None", "def empty(self) -> bool:\r\n return len(self.que) == 0", "def IsEmpty(self):\r\n return len(self._queue) == 0", ...
[ "0.84904665", "0.79952466", "0.797942", "0.7884375", "0.7856874", "0.78458536", "0.7801018", "0.779773", "0.7794861", "0.7790167", "0.77685225", "0.7643523", "0.7640217", "0.76394296", "0.7638272", "0.7616961", "0.7616961", "0.76165646", "0.7612466", "0.7610717", "0.7602621",...
0.0
-1
Checks whether the circular deque is full or not.
def isFull(self) -> bool: return self.size == self.maxlen
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isFull(self):\r\n if len(self.deque) == self.k:\r\n return True\r\n else:\r\n return False", "def queue_is_full(self):\r\n return True if len(self.queue) == self.size else False", "def isEmpty(self):\r\n if self.deque == []:\r\n return True\r\n ...
[ "0.8301718", "0.77408415", "0.7725141", "0.761176", "0.7578566", "0.75717837", "0.75717837", "0.75717837", "0.75717837", "0.7430312", "0.7428449", "0.73853135", "0.7319007", "0.7308779", "0.7305965", "0.7268572", "0.7265363", "0.7249674", "0.7247203", "0.7244032", "0.7201029"...
0.6908244
54
Test case for get_custom_emoji Get all custom emoji
def test_get_custom_emoji(self): headers = { 'Accept': 'application/json', } response = self.client.open( '/api/v1/realm/emoji', method='GET', headers=headers) self.assert200(response, 'Response body is : ' + respons...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def fetch_emojis(self) -> typing.Sequence[emojis_.KnownCustomEmoji]:\n return await self.app.rest.fetch_guild_emojis(self.id)", "async def get_custom_emojis(self, ctx):\n emojis = '\\n'.join(['{1} `:{0}:`'.format(e.name, str(e)) for e in ctx.message.guild.emojis])\n\n if len(emojis) > ...
[ "0.77013737", "0.76026726", "0.73415756", "0.692459", "0.6771434", "0.6765459", "0.66816497", "0.65746033", "0.6543114", "0.654167", "0.6456461", "0.6422146", "0.63928896", "0.63860893", "0.6383848", "0.6352569", "0.63437295", "0.6217976", "0.61960846", "0.61509156", "0.61448...
0.7770977
0