query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Updates tree with new infections and stores information about new
def measure(self, recommender): self._manage_new_infections(recommender.users_hat.value, recommender.infection_state) self.observe(self.diffusion_tree.number_of_nodes(), copy=False) self._old_infection_state = np.copy(recommender.infection_state.value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateTree(self):\n self.reset()\n self.resetTree() \n self.read()", "def _tree_update(self, new_tree: Tree, event: Event):\n raise NotImplementedError()", "def updatetree(self):\n if self.node:\n self.node.update()\n self.draw()", "def _auxRefreshTree(self, tree_...
[ "0.7097137", "0.6863075", "0.6561149", "0.63185143", "0.6186158", "0.6152338", "0.61417896", "0.6036651", "0.6019624", "0.6018832", "0.5895768", "0.58878404", "0.5868002", "0.58640766", "0.5825007", "0.57873863", "0.5766704", "0.57249945", "0.5709253", "0.5633454", "0.5605295...
0.0
-1
Plots the tree using the Networkx library API.
def draw_tree(self): nx.draw(self.diffusion_tree, with_labels=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotTree(self):\n t = self.make(self.tree)\n t.draw()", "def plot_tree(tree, name):\n graph = pydot.Dot(graph_type='graph')\n tree_graph = pydot.Cluster(\n graph_name=\"Learner Tree\",\n label=\"Learner Tree\",\n fontsize=\"15\",\n )\n graphlegend = pydot.Cluste...
[ "0.84178543", "0.7434519", "0.70544666", "0.70324796", "0.70190734", "0.68298215", "0.6808153", "0.6801817", "0.6801509", "0.678496", "0.67640483", "0.67397344", "0.66852444", "0.66803414", "0.667726", "0.6659991", "0.66083467", "0.6587126", "0.65706104", "0.6558903", "0.6558...
0.7235767
2
Returns a measure of structural virality. Returns
def get_structural_virality(self): num_nodes = self.diffusion_tree.number_of_nodes() return wiener_index(self.diffusion_tree) / (num_nodes * (num_nodes - 1))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fraction_of_infectious_virus(self) -> _VectorisedFloat:\n return self.virus.viable_to_RNA_ratio * (1 - self.host_immunity)", "def fraction_of_infectious_virus(self) -> _VectorisedFloat:\n return 1.", "def getViscosityLaw(self):\n return self.viscosityLaw", "def compute_volume(self) -...
[ "0.62442523", "0.61286414", "0.60827076", "0.60565484", "0.6045784", "0.60139126", "0.5982267", "0.5955694", "0.58917797", "0.5873444", "0.584239", "0.5830845", "0.5823968", "0.5816936", "0.5791665", "0.57834685", "0.5768636", "0.5765892", "0.5763708", "0.57599145", "0.573346...
0.7318086
0
Measures the average range (across users) of item attributes for items users were recommended at a time step. Used as a measure of within list recommendation diversity
def measure(self, recommender): items_shown = recommender.items_shown if items_shown.size == 0: # at beginning of simulation, there are no recommendations, # so we log a `None` value self.observe(None) return recommended_item_attr = recommender.it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_predictions(actives, train_rdd_gbitem_dict, train_rdd_gbuser_dict, num_items):\n active_user = actives[0][0]\n active_item = actives[0][1]\n\n # -----------------------------------\n # train_rdd_gbitem_dict = (item, ([(user,r),(user,r)...],avg_of_item))\n # train_rdd_gbuser_dict = (user, [(...
[ "0.63024384", "0.5934979", "0.58648264", "0.5863556", "0.58444667", "0.5841134", "0.580924", "0.57839996", "0.5736375", "0.57359916", "0.56896806", "0.56890374", "0.5681781", "0.5677384", "0.56624997", "0.5658554", "0.5627349", "0.561665", "0.56071526", "0.5561088", "0.555942...
0.7054138
0
Split the last dimension into (num_heads, depth). Transpose the result such that the shape is (batch_size, num_heads, seq_len, depth)
def split_heads(self, x, batch_size): x = tf.reshape(x, (batch_size, -1, self.num_heads, self.depth)) return tf.transpose(x, perm=[0, 2, 1, 3])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_heads(x, batch_size, num_heads, depth):\n x = tf.reshape(x, (batch_size, -1, num_heads, depth))\n return tf.transpose(x, perm=[0, 2, 1, 3])", "def _split_heads(x, num_heads):\n\tshape_lst = bert_utils.get_shape_list(x)\n\tdepth = shape_lst[-1]\n\tbatch = shape_lst[0]\n\tseq = shap...
[ "0.79167247", "0.7599264", "0.7481323", "0.73289317", "0.7253544", "0.7161259", "0.705449", "0.6593404", "0.6588756", "0.6588756", "0.6527045", "0.63732386", "0.62700814", "0.60761714", "0.60019857", "0.5990543", "0.5914784", "0.5881012", "0.5855259", "0.58284926", "0.5773926...
0.7250492
11
Inits Movie with parameters movie_title, poster_image, trailer_youtube and review_imdb.
def __init__(self, movie_title, poster_image, trailer_youtube, review_imdb): self.title = movie_title self.poster_image_url = poster_image self.trailer_youtube_url = trailer_youtube self.imdb_url = review_imdb
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, movie_title, movie_storyline, movie_poster_image_url, movie_trailer):\n\t\tself.title = movie_title\n\t\tself.storyline = movie_storyline\n\t\tself.poster_image_url = movie_poster_image_url\n\t\tself.trailer_youtube_url = movie_trailer", "def __init__(self, movie_title, movie_storyline, poster...
[ "0.7487349", "0.73171014", "0.7302299", "0.728411", "0.7268446", "0.72576356", "0.723372", "0.7217655", "0.7213409", "0.7186125", "0.71557635", "0.715567", "0.7118879", "0.7104062", "0.70794713", "0.69712996", "0.6897454", "0.68907535", "0.6795655", "0.6761041", "0.6745814", ...
0.7561743
0
Assert `mean` aggfunc returns the same values as `average` with equal weights.
def test_avg_mean(forecasters): y = make_forecasting_problem() forecaster = EnsembleForecaster(forecasters) forecaster.fit(y, fh=[1, 2, 3]) mean_pred = forecaster.predict() forecaster_1 = EnsembleForecaster(forecasters, aggfunc="mean", weights=[1, 1]) forecaster_1.fit(y, fh=[1, 2, 3]) avg_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multiple_equal_weights(self):\n df = self.df.copy()\n weights = np.array([1.0 / len(df.index)] * len(df.index))\n out = nan_weighted_mean(df.values, weights=weights)\n self.assertTrue(\n np.allclose(out, np.average(df.values, weights=weights, axis=0))\n )", ...
[ "0.80318874", "0.7917933", "0.7491748", "0.7478012", "0.7416002", "0.7332966", "0.71670896", "0.68208194", "0.67587596", "0.6553819", "0.64296246", "0.6391525", "0.636191", "0.6341783", "0.63208413", "0.6271881", "0.6256403", "0.62454754", "0.6226937", "0.62077683", "0.619926...
0.6780406
8
Assert aggfunc returns the correct values.
def test_aggregation_unweighted(forecasters, y, aggfunc): forecaster = EnsembleForecaster(forecasters=forecasters, aggfunc=aggfunc) forecaster.fit(y, fh=[1, 2, 3]) actual_pred = forecaster.predict() predictions = [] _aggfunc = VALID_AGG_FUNCS[aggfunc]["unweighted"] for _, forecaster in forecas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def agg(self, values, agg_func):\n assert len(values) > 0, \"Empty list of values\"\n f = agg_func.strip().lower()\n assert f in self.__AGGREGATIONS, \"Aggregation function \" + agg_func + \" is not valid\"\n\n ret = 0 # just to avoid \"Local variable might be referenced before assignm...
[ "0.6288633", "0.6043896", "0.59823674", "0.5838905", "0.5815745", "0.57400197", "0.57151836", "0.56909937", "0.5671473", "0.566555", "0.5657786", "0.5644742", "0.563922", "0.56219685", "0.56038195", "0.55829823", "0.55639493", "0.55471826", "0.5496884", "0.54636925", "0.54589...
0.55470717
18
Assert weighted aggfunc returns the correct values.
def test_aggregation_weighted(forecasters, y, aggfunc, weights): forecaster = EnsembleForecaster( forecasters=forecasters, aggfunc=aggfunc, weights=weights ) forecaster.fit(y, fh=[1, 2, 3]) actual_pred = forecaster.predict() predictions = [] for _, forecaster in forecasters: f =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_weighted_results():\n pass", "def test_aggregation_unweighted(forecasters, y, aggfunc):\n forecaster = EnsembleForecaster(forecasters=forecasters, aggfunc=aggfunc)\n forecaster.fit(y, fh=[1, 2, 3])\n actual_pred = forecaster.predict()\n\n predictions = []\n\n _aggfunc = VALID_AGG_...
[ "0.69678855", "0.69622105", "0.68174344", "0.64943796", "0.62034446", "0.61748505", "0.61683464", "0.610991", "0.6063537", "0.60567755", "0.60419095", "0.6034405", "0.60315365", "0.6015006", "0.59978324", "0.59898674", "0.5972689", "0.5967299", "0.59628946", "0.5956217", "0.5...
0.72802424
0
Check if invalid aggregation functions return Error.
def test_invalid_aggfuncs(forecasters, aggfunc): y = make_forecasting_problem() forecaster = EnsembleForecaster(forecasters=forecasters, aggfunc=aggfunc) forecaster.fit(y, fh=[1, 2]) with pytest.raises(ValueError, match=r"not recognized"): forecaster.predict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_forbid_aggregation(self):\n\n bad_examples = \"\"\"\nsum([score]) ->\nAggregations are not allowed in this field.\n\nsum([score])\n^\n===\nsum(score) ->\nAggregations are not allowed in this field.\n\nsum(score)\n^\n===\nsum(department) ->\nA str can not be aggregated using sum.\n\nsum(department)\...
[ "0.6858648", "0.6550308", "0.61447114", "0.60995835", "0.609905", "0.59968966", "0.59887826", "0.57757694", "0.57358176", "0.5663834", "0.55953944", "0.5573108", "0.5552472", "0.5536463", "0.55199814", "0.5469119", "0.54419756", "0.541829", "0.53880364", "0.5378703", "0.53744...
0.5788905
7
Convert a Python list (xy list of a shape) into a Numpy matrix of vertices
def list2matrix_homog(xy_shape): vertex_array = [] for i in range(0, len(xy_shape), 2): vertex_x = xy_shape[ i] vertex_y = xy_shape[i + 1] extra_element = 1.0 vertex = [vertex_x, vertex_y, extra_element] vertex_array.append(vertex) vertex_matrix = num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices(tri, vertex_list):\n dim = len(vertex_list[0])\n p = numpy.zeros((3, dim))\n for j in range(3):\n p[j] = vertex_list[tri[j]]\n return p", "def _vertex_arrays_to_list(x_coords_metres, y_coords_metres):\n\n _check_polyline(\n x_coords_metres=x_coords_metres, y_coords_metre...
[ "0.69606847", "0.6807603", "0.66569346", "0.6394897", "0.62601906", "0.6189537", "0.61764187", "0.6162913", "0.61064583", "0.60833645", "0.607453", "0.60307765", "0.5982219", "0.59796184", "0.59634584", "0.5934088", "0.5903811", "0.5898226", "0.58964306", "0.588976", "0.58892...
0.76167476
0
Convert Numpy matrix of vertices into a Python list (xy list of a shape)
def matrix2list(vertex_matrix): flat_array = vertex_matrix.tolist() xy_list = [] for i in range(0, len(flat_array)): xy_list.append( flat_array[i][0] ) xy_list.append( flat_array[i][1] ) return xy_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vertex_arrays_to_list(x_coords_metres, y_coords_metres):\n\n _check_polyline(\n x_coords_metres=x_coords_metres, y_coords_metres=y_coords_metres)\n\n num_vertices = len(x_coords_metres)\n vertex_list_xy_metres = []\n for i in range(num_vertices):\n vertex_list_xy_metres.append((x_coo...
[ "0.7413975", "0.7025411", "0.68816763", "0.6750809", "0.6745582", "0.66855454", "0.65625846", "0.6517452", "0.64930856", "0.6437436", "0.64248884", "0.6411927", "0.6367023", "0.63419783", "0.6332802", "0.6315702", "0.63048035", "0.62930965", "0.6277304", "0.62731403", "0.6272...
0.8255958
0
Shift the shape in the xdirection and ydirection by shift_x and shift_y respectively.
def Translate(shift_x, shift_y): shifted = numpy.matrix([[1.0, 0.0, 1.0 ], [0.0, 1.0, 1.0 ], [shift_x, shift_y, 1.0 ]]) return shifted
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate_shape(shape, x_shift, y_shift):", "def translate_shape(shape, x_shift, y_shift): \n new_shape = [] \n for i in range(int(len(shape)/2 )): \n x_new = shape[2*i] + x_shift \n y_new = shape[2*i+1] + y_shift \n new_shape.append(x_new) \n new_shape.append(y_new) \n ...
[ "0.71501184", "0.6926701", "0.68378925", "0.67621315", "0.6599585", "0.6575673", "0.655384", "0.6439177", "0.6411115", "0.63591564", "0.62583876", "0.61242646", "0.6087045", "0.59914124", "0.5948126", "0.59432817", "0.5911263", "0.58916354", "0.58784395", "0.58392805", "0.583...
0.59613466
14
Copy the worldview and its immediate neighbours.
def locality_copy(self): new = copy(self) new.north = copy(self.north) new.south = copy(self.south) new.east = copy(self.east) new.west = copy(self.west) return new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return _coordsys.coordsys_copy(self)", "def copy(self):\n\t\tb = Board(self.size, self.end_count)\n\t\tfor x in range(self.size):\n\t\t\tfor y in range(self.size):\n\t\t\t\tb.tiles[x][y] = self.tiles[x][y]\n\t\treturn b", "def copy(self):\n return self.__class__(*self.maps[:-1],...
[ "0.61862814", "0.57994807", "0.5732002", "0.5688422", "0.5686226", "0.5660167", "0.5655698", "0.56276125", "0.56194663", "0.56163204", "0.56155884", "0.56155884", "0.5602962", "0.56004703", "0.55852944", "0.5538871", "0.5536237", "0.5529703", "0.5507877", "0.5504208", "0.5503...
0.6385162
0
Test whether this location is the last place the current person has visited.
def is_most_recent_location(self, person):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_current_location(self):\n return self.location_set.current_location is not None", "def is_finish(self,location):\n return location[0] == self.columns - 1 and location[1] == self.rows - 1", "def is_last_position(self):\r\n return self.position >= len(self.rule.rightside)", "def is...
[ "0.7002344", "0.6673924", "0.660607", "0.65718144", "0.65527457", "0.6518544", "0.6288451", "0.62500423", "0.6199464", "0.6172359", "0.6069799", "0.60570204", "0.6023481", "0.5978436", "0.5900725", "0.58284974", "0.5796673", "0.5783083", "0.5769586", "0.5756217", "0.57546085"...
0.7422763
0
Allow sorting of people.
def __lt__(self, other): return self.name < other.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortby(self):\n ...", "def people(persons):\n sorted_list = sorted(persons, key=lambda k: k['age'])\n return sorted_list", "def sorted(self): \n pass", "def _place_list_for_person(self, person):\n list = []\n for event in self.sort:\n if ( even...
[ "0.728682", "0.69563615", "0.6764732", "0.6616113", "0.64332837", "0.6432068", "0.63607216", "0.62676686", "0.62516946", "0.6250053", "0.62266594", "0.6220339", "0.6183714", "0.6153633", "0.6141533", "0.6140396", "0.6140396", "0.6107826", "0.6089885", "0.60787123", "0.6062166...
0.0
-1
Injure this person by a certain amount (amount<=1.0) amount may be negative to heal
def injure(self, amount): self.health -= amount if self.health < 0.0: self.health = 0.0 if self.health > 1.0: self.health = 1.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def give_raise(self,amount=5000):\n self.salary += amount", "def give_raise(self, amount=5000):\n self.salary += amount", "def heal(self, amount: int) -> str:\n if self.hp + amount > MAX_HP:\n amount = MAX_HP - self.hp\n new_hp = self.hp + amount\n self.hp = new_h...
[ "0.6924608", "0.69075024", "0.69006264", "0.6801079", "0.67490596", "0.6691288", "0.66403013", "0.6638185", "0.65639347", "0.64924115", "0.64563555", "0.6416064", "0.630171", "0.6301572", "0.62866527", "0.62706417", "0.62615544", "0.6211703", "0.6164884", "0.6131726", "0.6104...
0.7328159
0
Convenience method for self.diary.log(...)
def log(self, event_cls, *args, **kw): args = list(args) args.append(self.time) args.append(self) args.append(self.worldview.locality_copy()) self.diary.log(self.time, event_cls(*args, **kw))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, message):", "def _log(self, message):\n pass", "def log(self, message: str):", "def log_message(self, format, *args):", "def logger(self, value):\n pass", "def log(self, level, msg, *args, **kwargs):\n pass", "def do_log(self, arg):\n arg = \" %s :custom l...
[ "0.77647996", "0.76023424", "0.7586511", "0.73101985", "0.7211697", "0.718583", "0.71120936", "0.7088803", "0.7069826", "0.7067038", "0.7059218", "0.7045978", "0.70359576", "0.70248723", "0.70237345", "0.7021706", "0.70182997", "0.69959927", "0.69920385", "0.6989792", "0.6963...
0.6743905
35
Swap suits to remove most symmetries. Modifies cards in place Fails to remove some in the case where there is a lowerranked pair or triple that shares a suit with a higherranked card.
def swap_suits(cards): cards_need_swap = cards new_suit = 5 while cards_need_swap.shape[0] > 0: suit = cards_need_swap[0,1] cards[cards[:,1] == suit, 1] = new_suit new_suit += 1 cards_need_swap = cards[cards[:,1] < 5] cards[:,1] = cards[:,1] - 4 return cards
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_suits(cards):\n cards_need_swap = cards\n new_suit = 5\n while cards_need_swap.shape[0] > 0:\n suit = cards_need_swap[0,1]\n cards[cards[:,1] == suit, 1] = new_suit\n new_suit += 1\n cards_need_swap = cards[cards[:,1] < 5]\n cards[:,1] = cards[:,1] - 4\n return c...
[ "0.731475", "0.6521344", "0.64044553", "0.5974011", "0.58290917", "0.57423127", "0.56717587", "0.55904925", "0.55786467", "0.5472148", "0.5469577", "0.54659194", "0.5464322", "0.5456538", "0.54394937", "0.54057246", "0.5331853", "0.5318002", "0.5312691", "0.530591", "0.530110...
0.73551816
0
to learn the attention of one channel and the rest channels
def channelAttention(self,x): b, c, h, w = x.shape pre_x = x.contiguous().view(b, c, h * w) att_x, relations = self.forward_unified(pre_x, pre_x, pre_x) att_x = att_x.contiguous().view(b, c, h, w) return att_x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _attention(self, inputs):\n attn_weights = K.batch_dot(x=inputs,\n y=K.permute_dimensions(inputs,\n pattern=(0, 2, 1)))\n return K.permute_dimensions(attn_weights, (0, 2, 1))", "def attention(self, decode...
[ "0.6191988", "0.6182749", "0.61674166", "0.6110955", "0.60878927", "0.6033937", "0.60321414", "0.6014058", "0.60054046", "0.5966352", "0.5961111", "0.59551805", "0.5920994", "0.59022796", "0.5893938", "0.58766156", "0.5868471", "0.5847925", "0.58348364", "0.5827881", "0.58140...
0.62221354
0
to learn the attention of one position and the other position in spicial scale.
def pixelAttention(self,x): b, c, w, h = x.shape pre_x = x.permute(0, 2, 3, 1) pre_x = pre_x.contiguous().view(b, h * w, c) att_x, relations = self.forward_unified(pre_x, pre_x, pre_x) att_x = att_x.contiguous().view(b, h, w, c) att_x = att_x.permute(0, 3, 1, 2) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_attention(t1, t2):\n dim = t1.shape.as_list()[2]\n init = tf.constant_initializer(1.0 / dim)\n\n t1_logits = ops.last_dim_weighted_sum(t1, \"t1_w\")\n t2_logits = ops.last_dim_weighted_sum(t2, \"t2_w\")\n\n dot_w = tf.get_variable(\n \"dot_w\", shape=dim, initializer=init, dtype=tf.float32)\n...
[ "0.59121007", "0.5880821", "0.58658934", "0.57155955", "0.56898075", "0.5676364", "0.5617764", "0.54645956", "0.5413231", "0.53985935", "0.5354993", "0.5340669", "0.53163207", "0.53115535", "0.53035134", "0.5289783", "0.5286561", "0.5261909", "0.52617943", "0.5252311", "0.525...
0.51107275
38
to learn the self_attention of n objects
def blockAttention(self,x): b, n, c, w, h = x.shape pre_x = x.contiguous().view(b, n, -1) att_x, relations = self.forward_unified(pre_x, pre_x, pre_x) att_x = att_x.contiguous().view(b, n, c, w, h) return att_x
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learn(self,n):\n for i in range(n):\n self.class_counts,self.feature_counts = self.em_step(self.class_counts,\n self.feature_counts)", "def learn(self):\n pass", "def learn(self):\n pass", "def learn(self):\n ...
[ "0.72311056", "0.66329956", "0.66329956", "0.6434422", "0.6313986", "0.6202342", "0.6121104", "0.6064416", "0.6046662", "0.5997235", "0.5904722", "0.58928293", "0.58772796", "0.5854052", "0.5809342", "0.576956", "0.5754304", "0.5736277", "0.5731372", "0.57274973", "0.57257706...
0.0
-1
Create test client, add sample data.
def setUp(self): db.drop_all() db.create_all() self.client = app.test_client() User.query.delete() Team.query.delete() # SET DATE ## curr_date = datetime.datetime.now().strftime('%Y-%m-%d') ## ADD USERS ## coach1 = User(username="coach_E", pass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_client(self):\n pass", "def test_client_create(self):\n pass", "def setUp(self):\n self.client = DummyClient()", "def testclient():\n base_url = PARAMS.get(\"url\") + \"/v2\"\n client = Client(\n base_url=base_url,\n headers={\n \"Authorizat...
[ "0.7501162", "0.720549", "0.7062802", "0.6803163", "0.6757587", "0.6726198", "0.6722994", "0.668832", "0.668832", "0.668832", "0.668832", "0.66681767", "0.6666075", "0.6655439", "0.6596407", "0.65942925", "0.6584745", "0.6527722", "0.65173876", "0.65142703", "0.64355755", "...
0.0
-1
List all naf tournaments from members.thenaf.net
def load_tournaments(renew_time=3600, force=False): filename = "data/naf_tourneys.html" LOG.debug("Loading tournaments") last_modified = round((time.time() - os.path.getmtime(filename))) LOG.debug("data/naf_tourneys.html modified %ss ago", last_modified) if force or last_modified > renew_time: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_tournaments(renew_time=False, force=None):\n filename = \"data/naf_tourneys.html\"\n LOG.debug(\"Listing tournaments\")\n\n if renew_time or force:\n return load_tournaments(renew_time=renew_time, force=force)\n tournaments = load_cached(nafparser.parse_tournaments, filename)\n\n ret...
[ "0.7149776", "0.62914014", "0.6109366", "0.5846553", "0.57829034", "0.56696373", "0.5601255", "0.5601255", "0.5601255", "0.5601255", "0.55882907", "0.55572516", "0.55448544", "0.55409384", "0.54748046", "0.54364485", "0.53815234", "0.53773314", "0.5302785", "0.52871", "0.5272...
0.5313395
18
List all naf tournaments from members.thenaf.net
def list_tournaments(renew_time=False, force=None): filename = "data/naf_tourneys.html" LOG.debug("Listing tournaments") if renew_time or force: return load_tournaments(renew_time=renew_time, force=force) tournaments = load_cached(nafparser.parse_tournaments, filename) return tournaments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tournament_list():\n database = TinyDB('db.json')\n tournament_list = database.table('tournaments').all()\n return tournament_list", "def display_tournament_list():\r\n for tournament in tournaments_table:\r\n print(tournament['Nom'])", "def house_members(*, verbose=False):\n...
[ "0.62914014", "0.6109366", "0.5846553", "0.57829034", "0.56696373", "0.5601255", "0.5601255", "0.5601255", "0.5601255", "0.55882907", "0.55572516", "0.55448544", "0.55409384", "0.54748046", "0.54364485", "0.53815234", "0.53773314", "0.5313395", "0.5302785", "0.52871", "0.5272...
0.7149776
0
addone function takes a number as an array with an element for each digit. It adds one to the number and returns the result as a similar array. Any leading zeroes will be removed.
def addone(arg): for s in arg[:]: if s == 0: # Remove any leading zeroes arg.remove(s) if arg[len(arg) - 1] != 9: arg[len(arg) - 1] += 1 # Add one to the last element. else: # If the last number is nine then the second last # element must also be changed. if le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plusOne(self, digits: List[int]) -> List[int]:\n n = len(digits)\n for i in reversed(range(n)):\n # set all the nines at the end of array to zeros\n if digits[i] == 9:\n digits[i] = 0\n\n # here we have the rightmost not-nine \n else:\n # increase this...
[ "0.7688615", "0.7510205", "0.64064455", "0.63816565", "0.6377803", "0.6266959", "0.6123707", "0.6068747", "0.5995501", "0.59779876", "0.5936203", "0.58488744", "0.5805329", "0.56270254", "0.558196", "0.5570155", "0.5533241", "0.5513251", "0.55027306", "0.54867077", "0.5482474...
0.86135465
0
Saves score to db
def create(cls, data): doc = { "type": cls.type, **data } db_utils.set_created_at(doc) LOG.debug("Adding score {} with data: {}".format(cls.type, data)) return DB.save(doc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_db(name: str, score: float):\n score = float(score)\n\n with open('db.json') as fo:\n data = loads(fo.read())\n\n data[name] = score\n\n with open('db.json', 'w') as fo:\n fo.write(dumps(data))", "def save_scores(self):\n\n with open('.scores.pickle', 'wb') as f:\n ...
[ "0.715416", "0.69668126", "0.69310766", "0.6872937", "0.6851604", "0.6812061", "0.6766803", "0.6747991", "0.6744735", "0.6700026", "0.6619312", "0.65273136", "0.6497375", "0.640503", "0.6403405", "0.6376395", "0.63477", "0.63327163", "0.6325372", "0.62925833", "0.62912065", ...
0.57981735
91
Gets score counts per player in a date scope
def counts_per_players(cls, date_scope): return cls._counts_per("player_name", date_scope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def counts_per_teams(cls, date_scope):\n return cls._counts_per(\"player_team\", date_scope)", "def games_count(self, start_date, end_date): # noqa\n if start_date > end_date:\n raise RuntimeError(\"End date must be beyond start\")\n cur_date = start_date\n tot_gc = default...
[ "0.70805335", "0.61034626", "0.5999346", "0.59791017", "0.5965352", "0.5873043", "0.582727", "0.5764276", "0.5752803", "0.57515305", "0.56772786", "0.5654991", "0.5558223", "0.55491227", "0.5534203", "0.55316144", "0.5500438", "0.5496959", "0.5493157", "0.54864126", "0.547416...
0.7679463
0
Gets score counts per team in a date scope
def counts_per_teams(cls, date_scope): return cls._counts_per("player_team", date_scope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def games_count(self, start_date, end_date): # noqa\n if start_date > end_date:\n raise RuntimeError(\"End date must be beyond start\")\n cur_date = start_date\n tot_gc = defaultdict(int)\n while cur_date <= end_date:\n teams_playing = self._teams_playing_one_day(c...
[ "0.6440161", "0.6400013", "0.6081967", "0.593549", "0.5931942", "0.5877388", "0.58412147", "0.5751432", "0.57329845", "0.5712143", "0.5702498", "0.5694906", "0.5685514", "0.56634647", "0.56083405", "0.55377275", "0.54963267", "0.54125893", "0.54095155", "0.54077744", "0.53844...
0.7475803
0
Creates a root device object.
def __init__(self): super(UpnpEmbeddedDevice, self).__init__() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_root_device_instance(self, manufacturer:str, modelNumber: str, modelDescription: str) -> UpnpRootDevice:\n deviceClass = UpnpRootDevice\n if manufacturer is not None and modelNumber is not None and modelDescription is not None:\n extkey = generate_extension_key(manufacturer, mod...
[ "0.7622642", "0.6808447", "0.650578", "0.650578", "0.6462673", "0.6353511", "0.61486673", "0.60996056", "0.60711485", "0.6047455", "0.59923583", "0.59328663", "0.5872992", "0.5866362", "0.5858065", "0.58089036", "0.5802254", "0.5801608", "0.5791029", "0.5775517", "0.5775132",...
0.5388762
39
Updates the embedded devices description.
def update_description(self, host, baseUrl, description): self._host = host self._urlBase = baseUrl self._description = description return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _populate_embedded_devices(self, factory, description):\n # pylint: disable=no-self-use,unused-argument\n raise AKitSemanticError(\"Embedded devices inside an embedded device is currently not supported.\")", "def update(self):\n self.device = self._api.device_query(self._hardware_address...
[ "0.7054676", "0.60299516", "0.5912329", "0.58961916", "0.5896006", "0.58923954", "0.5791732", "0.57783717", "0.5647076", "0.5647076", "0.5566036", "0.5546734", "0.5529445", "0.55041945", "0.5477634", "0.5455053", "0.544172", "0.5414883", "0.5405733", "0.5384925", "0.53810143"...
0.5044277
57
This method is overloaded to prohibit the poplulation of embedded devices insided embedded devices.
def _populate_embedded_devices(self, factory, description): # pylint: disable=no-self-use,unused-argument raise AKitSemanticError("Embedded devices inside an embedded device is currently not supported.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop_adv_devices(self):\r\n if self.localSDK.devList:\r\n del self.localSDK.devList[:]\r\n try:\r\n self.localSDK.get_devices() # Get list of boards from KSDK manifest file\r\n except IOError:\r\n self.localSDK.devList = ['None']\r\n retu...
[ "0.58297354", "0.5809984", "0.57054234", "0.565818", "0.56520927", "0.56433535", "0.56425285", "0.5591485", "0.55774033", "0.557727", "0.54898685", "0.54536617", "0.54339343", "0.5404499", "0.5364736", "0.5357825", "0.5357825", "0.5336527", "0.5275434", "0.52752054", "0.52625...
0.49261054
79
Compute matches when text is a simple name. Return a list of all keywords, builtin functions and names currently defined in self.namespace that match.
def global_matches(self, text): matches = [] n = len(text) for list in [keyword.kwlist, __builtin__.__dict__, self.namespace]: for word in list: if word[:n] == text: matches.append(word) return matc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_matches(self, text):\n import keyword\n matches = []\n n = len(text)\n for word in keyword.kwlist:\n if word[:n] == text:\n matches.append(word)\n for nspace in [builtins.__dict__, self.namespace]:\n for word, val in nspace.items():...
[ "0.81320006", "0.7065873", "0.7050401", "0.69584954", "0.6639191", "0.65908337", "0.64813334", "0.61590165", "0.60079956", "0.55892473", "0.5545319", "0.5419989", "0.53929675", "0.53920263", "0.53830427", "0.53503126", "0.5301055", "0.5280724", "0.52775556", "0.52568513", "0....
0.7634869
1
Compute matches when text contains a dot. Assuming the text is of the form NAME.NAME....[NAME], and is evaluatable in self.namespace, it will be evaluated and its attributes (as revealed by dir()) are used as possible completions. (For class instances, class members are also considered.)
def attr_matches(self, text): m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text) if not m: return [] expr, attr = m.group(1, 3) object = eval(expr, self.namespace) words = dir(object) if hasattr(object,'__class__'): words.append('__class__') w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def python_matches(self,text):\n #print 'Completer->python_matches' # dbg\n if \".\" in text:\n try:\n matches = self.attr_matches(text)\n if text.endswith('.') and self.omit__names:\n if self.omit__names == 1:\n ...
[ "0.67350745", "0.6467589", "0.5659091", "0.56373996", "0.55783284", "0.54272413", "0.53458554", "0.528147", "0.5278319", "0.52603084", "0.5194667", "0.51900584", "0.51714355", "0.5169853", "0.5109693", "0.5102715", "0.50885576", "0.50000334", "0.49939442", "0.4941889", "0.491...
0.6702154
1
Construct a layernorm module in the TF style (epsilon inside the square root).
def __init__(self, hidden_size, eps=1e-12): super(BertLayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.bias = nn.Parameter(torch.zeros(hidden_size)) self.variance_epsilon = eps
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verhulst(nb_init, t0, tf, eps, methode, gamma, K) :\n f=lambda y,t : gamma*y*(1-y/K)\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n return Y", "def malthusiens(nb_init, t0, tf, eps, methode, gamma ) :\n\n f=lambda y, t : gamma*y\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n ...
[ "0.62758327", "0.60142326", "0.5795031", "0.5740771", "0.55372477", "0.5517929", "0.54223156", "0.54113936", "0.5386929", "0.5368306", "0.53505456", "0.52857476", "0.52559835", "0.52327746", "0.5227854", "0.5224699", "0.5219319", "0.5218825", "0.51930606", "0.51930606", "0.51...
0.0
-1
Allow input of data on event
def view_event(request, event_id): event = get_object_or_404(Event, pk=event_id) context = {'event': event } return render_to_response('event_view.html', context, context_instance=RequestContext(request))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_input(self, event):\n pass", "def ev_textinput(self, event: TextInput) -> None:", "def handle_keyboard_data(data):\n pass", "def handle_input(data: dict):", "def ev_textinput(self, event: tcod.event.TextInput) -> T | None:", "def on_user_input(self, dut_address, reply_boolean, expect...
[ "0.75046116", "0.69239", "0.6504716", "0.6503113", "0.64280546", "0.636753", "0.63566643", "0.62977934", "0.6292795", "0.62885463", "0.623799", "0.62167597", "0.62059057", "0.61748546", "0.6164931", "0.6164055", "0.61352056", "0.61321485", "0.6082178", "0.60712785", "0.606794...
0.0
-1
Display a list of Event paginated
def list_event(request): event_list = Event.objects.all() paginator = Paginator(event_list, 5) try: page = int(request.GET.get('page', '1')) except ValueError: page = 1 # If page request (9999) is out of range, deliver last page of results. try: event_list = paginator.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_events_list():\r\n\tevents_list = Page.objects.filter(tags='events').order_by('-created')\r\n\treturn {'events_list': events_list}", "def event_list(request):\n if request.method == 'GET':\n if request.GET.get('search'):\n request_terms = request.GET.get('search')\n searc...
[ "0.83030045", "0.7657986", "0.7629149", "0.7394973", "0.7273532", "0.71547526", "0.6988922", "0.6988497", "0.6924161", "0.6869403", "0.68199164", "0.6779448", "0.67320573", "0.671834", "0.67172897", "0.6673681", "0.66686934", "0.65960234", "0.6561609", "0.65346944", "0.651391...
0.849096
0
Allow input of data on event
def form_event(request, event_id): event = get_object_or_404(Event ,pk=event_id) if request.method == "POST": form = EventForm(request.POST, instance=event) if form.is_valid(): form.save() else: form = EventForm(instance=event) context = {'event': event, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_input(self, event):\n pass", "def ev_textinput(self, event: TextInput) -> None:", "def handle_keyboard_data(data):\n pass", "def handle_input(data: dict):", "def ev_textinput(self, event: tcod.event.TextInput) -> T | None:", "def on_user_input(self, dut_address, reply_boolean, expect...
[ "0.75049454", "0.69242203", "0.6504036", "0.6501898", "0.6428295", "0.6366693", "0.6354882", "0.62957245", "0.6294693", "0.629008", "0.62417084", "0.62185454", "0.6202413", "0.6175176", "0.6166408", "0.61663496", "0.61377245", "0.61337566", "0.6082846", "0.6071894", "0.607018...
0.0
-1
Allow input of data on member
def view_member(request, member_id): member = get_object_or_404(Member, pk=member_id) context = {'member': member } return render_to_response('member_view.html', context, context_instance=RequestContext(request))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, value):\n self.data_validator(value)", "def d_input(self):\n pass", "def validate_input(self, *args):\n return", "def input(self):\r\n pass", "def _validate(self, instance, value):", "def pass_data(self, data):\n self.data = data\n self.load_in...
[ "0.6091474", "0.60770625", "0.5984453", "0.59829456", "0.59364", "0.5923605", "0.5848573", "0.5848573", "0.578865", "0.5777267", "0.57750106", "0.57236516", "0.57038593", "0.5688617", "0.5682563", "0.5680961", "0.56385183", "0.5597286", "0.5586429", "0.55672604", "0.55592513"...
0.0
-1
Display a list of Member paginated
def list_member(request): member_list = Member.objects.all() paginator = Paginator(member_list, 5) try: page = int(request.GET.get('page', '1')) except ValueError: page = 1 # If page request (9999) is out of range, deliver last page of results. try: member_list = pagina...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(request):\n assert isinstance(request, HttpRequest)\n\n form = SearchForm(request.GET or None)\n if form.is_valid():\n search_name = form.data['search_name']\n member_list = Member.objects.filter( Q(name__icontains=search_name) | Q(full_name__icontains=search_nam...
[ "0.78345263", "0.70588547", "0.7022545", "0.6863475", "0.67834175", "0.6747191", "0.6563027", "0.6514594", "0.64230216", "0.637318", "0.6352936", "0.6283344", "0.62146246", "0.6173804", "0.6141176", "0.61208135", "0.61201227", "0.610306", "0.6090148", "0.6090148", "0.60892296...
0.83615065
0
Allow input of data on member
def form_member(request, member_id): member = get_object_or_404(Member ,pk=member_id) if request.method == "POST": form = MemberForm(request.POST, instance=member) if form.is_valid(): form.save() else: form = MemberForm(instance=member) context = {'member': member, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, value):\n self.data_validator(value)", "def d_input(self):\n pass", "def validate_input(self, *args):\n return", "def input(self):\r\n pass", "def _validate(self, instance, value):", "def pass_data(self, data):\n self.data = data\n self.load_in...
[ "0.60913104", "0.60763896", "0.59840703", "0.5982266", "0.5936191", "0.5923617", "0.58483535", "0.58483535", "0.5788462", "0.57769746", "0.5774602", "0.5723344", "0.5703288", "0.5688608", "0.5682276", "0.5680635", "0.56381243", "0.55968136", "0.5586484", "0.5567039", "0.55590...
0.0
-1
Compile the regexes in grammar
def __init__(self): for item in grammar: item['matches_compiled'] = {} for name,pattern in item['matches'].items(): item['matches_compiled'][name] = \ re.compile(pattern, re.IGNORECASE) item['semantics_compiled'] = {} for name,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compile_regex(self):\n self.raw = self._compile('rawLevel')\n self.run = self._compile('runLevel')\n self.sample = self._compile('sampleLevel')\n self.agg = self._compile('aggLevel')", "def _compileRegex(self):\n\t\tself.__punctuationRegex = re.compile(\"|\".join(self._punctuatio...
[ "0.72584164", "0.67762935", "0.67014307", "0.66918826", "0.6617731", "0.6525257", "0.6477457", "0.63297504", "0.6174383", "0.60777885", "0.60444814", "0.6012791", "0.6005029", "0.6004373", "0.59888434", "0.5980766", "0.5979322", "0.59718186", "0.5966301", "0.5963155", "0.5953...
0.6124754
9
Parse input using NLTK parser+chunker
def nlp_parse(self, input): resp = {} resp['type'] = 'nomatch' VDB_set = {} WP_set = {} tagset = self.build_tagset(input) resp['words'] = self.build_keywords(tagset) w = resp['words'] if not w: if constants.DEBUG: log.debug("No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, tokenizer):\n pass", "def parser(sent_list): #input: list of sentences", "def parse(raw_query, EXPAND_SET = False):\r\n\t\r\n\t# tokenize and tag the query using nltk tools, use .lower() to standardize the input\r\n\ttokenized_query = nltk.word_tokenize(raw_query.lower())\r\n\ttagged_que...
[ "0.676532", "0.6750108", "0.6618776", "0.65109926", "0.649654", "0.6220005", "0.6132676", "0.6083811", "0.60810405", "0.6036656", "0.60250545", "0.5985231", "0.5939019", "0.5930759", "0.5887026", "0.5864591", "0.58607024", "0.58260447", "0.5798554", "0.5759019", "0.57415426",...
0.61024725
7
Get the internal registry.
def internal_registry(self) -> Dict[str, Resource]: return self.manager.registry
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registry(self):\n return self.__registry", "def registry(self):\n return self._registry", "def get_unit_registry():\n\n global _unit_registry\n\n # Cache the unit registry for speedier access\n if _unit_registry is None:\n return reload_unit_registry()\n else:\n retu...
[ "0.838872", "0.8387603", "0.73312694", "0.70455664", "0.691805", "0.6821618", "0.6715011", "0.66693926", "0.66524637", "0.6613443", "0.6613443", "0.6500425", "0.64740384", "0.6458545", "0.6450646", "0.6366988", "0.6355886", "0.6339974", "0.6274995", "0.62644315", "0.62457114"...
0.8258994
2
Get the mapping prefixes that should be skipped to their reasons (strings).
def get_skip(self) -> Mapping[str, str]: return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prefixes(context: str = \"go\"):\n context = load_context(context)\n extended_prefix_map = context.as_extended_prefix_map()\n converter = Converter.from_extended_prefix_map(extended_prefix_map)\n cmaps = converter.prefix_map\n # hacky solution to: https://github.com/geneontology/go-site/issu...
[ "0.6458126", "0.6146187", "0.5821375", "0.5761392", "0.5677433", "0.56264687", "0.5600088", "0.5573373", "0.54468733", "0.5427342", "0.53815764", "0.5332524", "0.53015023", "0.5299096", "0.5292142", "0.5283038", "0.5278991", "0.52788407", "0.5266334", "0.5259487", "0.5258129"...
0.59197617
2
Align the external registry.
def _align(self): for external_id, external_entry in sorted(self.external_registry.items()): if external_id in self.skip_external: continue bioregistry_id = self.external_id_to_bioregistry_id.get(external_id) # There's already a mapping for this external ID t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def align(self):\n ...", "def temporally_align_data_interfaces(self):\n pass", "def AlignFieldmaps(self):\n for entry in self.entry_map['fmap']:\n info = self.info[entry]\n\n# Register the magnitude image at the shortest TR to the T1-IR\n# structural image.\n...
[ "0.6081261", "0.557019", "0.5147257", "0.49545655", "0.49139827", "0.48331964", "0.48314154", "0.46982148", "0.45978466", "0.45773122", "0.45580065", "0.45571685", "0.45098197", "0.45003244", "0.4498881", "0.44842976", "0.44819683", "0.44467154", "0.44428003", "0.44403112", "...
0.6750257
0
Prepare a dictionary to be added to the bioregistry for each external registry entry. The default implementation returns `external_entry` unchanged. If you need more than that, override this method.
def prepare_external(self, external_id: str, external_entry: Dict[str, Any]) -> Dict[str, Any]: return external_entry
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _align(self):\n for external_id, external_entry in sorted(self.external_registry.items()):\n if external_id in self.skip_external:\n continue\n\n bioregistry_id = self.external_id_to_bioregistry_id.get(external_id)\n # There's already a mapping for this ex...
[ "0.5661854", "0.52508706", "0.52203363", "0.4919496", "0.48606208", "0.48559207", "0.48190767", "0.48090026", "0.47993204", "0.4797935", "0.47642413", "0.47563672", "0.47513482", "0.4740633", "0.47319844", "0.4727857", "0.4723997", "0.47188598", "0.47101957", "0.47030905", "0...
0.77220005
0
Write the internal registry.
def write_registry(self) -> None: self.manager.write_registry()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __write(self, registry_data: list) -> None:\n with open(self.__registry_filepath, 'w+') as registry_file:\n registry_file.seek(0)\n registry_file.write(json.dumps(registry_data))\n registry_file.truncate()", "def write(self):\n\t\traise NotImplementedError('%s: No writ...
[ "0.71736217", "0.6395241", "0.6308655", "0.6276962", "0.6276962", "0.6197535", "0.6197535", "0.6181082", "0.61420774", "0.60741246", "0.60397553", "0.60311437", "0.59387153", "0.5858807", "0.58051056", "0.5795055", "0.5783678", "0.5652679", "0.56347007", "0.562523", "0.562328...
0.8478858
0
Align and output the curation sheet.
def align( cls, dry: bool = False, show: bool = False, force_download: Optional[bool] = None, ) -> None: instance = cls(force_download=force_download) if not dry: instance.write_registry() if show: instance.print_curation_table() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_sheet(sheet_to_be_formatted, output_name):\n\n wb = load_workbook(sheet_to_be_formatted)\n # ws = book['Sheet1']\n ws = wb.active\n\n columns_to_keep_unhidden = ['index', 'company_name','price_90_days_ago', 'price_30_days_ago', 'price_21_days_ago', \n 'price_7_...
[ "0.56579214", "0.5517449", "0.5478366", "0.54658437", "0.52604353", "0.5230534", "0.5222758", "0.52020246", "0.51637006", "0.5143857", "0.51387686", "0.5129854", "0.51248664", "0.5093642", "0.5041381", "0.5038929", "0.50342596", "0.49654126", "0.49563086", "0.49545103", "0.49...
0.466461
78
Construct a CLI for the aligner.
def cli(cls): @click.command() @click.option("--dry", is_flag=True, help="if set, don't write changes to the registry") @click.option("--show", is_flag=True, help="if set, print a curation table") @click.option( "--no-force", is_flag=True, help="if set, do not force re-downl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmdline_parser():\n parser = argparse.ArgumentParser(description=\"\"\" \"\"\")\n parser.add_argument(\"-i1\",\n help=\"\"\"viral alignments\"\"\",\n dest=\"viral\",\n required=True)\n parser.add_argument(\"-i2\",\n ...
[ "0.6725033", "0.6607274", "0.6418465", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "0.6382979", "...
0.5967073
84
Get a sequence of items that will be ech row in the curation table.
def get_curation_row(self, external_id, external_entry) -> Sequence[str]: # noqa:DAR202 rv = [] for k in self.curation_header: value = external_entry.get(k) if value is None: rv.append("") elif isinstance(value, str): rv.append(value.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence_items(self):\r\n seq_css = 'ol#sequence-list>li>a>p'\r\n return self.q(css=seq_css).map(self._clean_seq_titles).results", "def items(self):\r\n for column in self.table.columns:\r\n yield (column, self[column.name])", "def items(self):\n return zip(self._sequ...
[ "0.6003368", "0.58419013", "0.5718137", "0.5499399", "0.54639125", "0.5459525", "0.54581946", "0.5413328", "0.53819495", "0.5363526", "0.5357809", "0.53151834", "0.53015083", "0.5299001", "0.5241888", "0.5216109", "0.5214752", "0.52066666", "0.52004117", "0.5199581", "0.51903...
0.477345
100
Write the curation table to a TSV.
def write_curation_table(self) -> None: path = EXTERNAL.joinpath(self.key, "curation.tsv") rows = list(self._iter_curation_rows()) if not rows: if path.is_file(): path.unlink() return path.parent.mkdir(exist_ok=True, parents=True) with pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_tsv(self, filename):\n f = open(filename,'wb')\n wr = csv.writer(f,delimiter='\\t',quoting=csv.QUOTE_ALL)\n colrow = []\n for col in self.cols:\n colrow.append('<undefined>' if len(col) == 0 else unicode(iter(col).next()).encode('unicode-escape'))\n wr.writerow(colrow)\n for row in...
[ "0.6911387", "0.68106085", "0.65260524", "0.64977854", "0.64346373", "0.61961037", "0.6176493", "0.61177903", "0.6073387", "0.6044617", "0.58639824", "0.58490986", "0.582473", "0.5821321", "0.5815019", "0.58101106", "0.5785907", "0.5764009", "0.570739", "0.5705173", "0.567227...
0.589101
10
Print the curation table.
def print_curation_table(self, **kwargs) -> None: s = self.get_curation_table(**kwargs) if s: print(s) # noqa:T201
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_table(self):\n print(\"%-12s%-12s%-12s%-12s%-12s\" % (\"index\",\"balance\",\"payment\",\"interest\",\"amortization\"))\n print(\"-------------------------------------------------------------\")\n for i in self.table[\"index\"]:\n print(\"%-12i%-12i%-12i%-12i%-12i\" % (sel...
[ "0.7252084", "0.7043366", "0.6997914", "0.6970662", "0.68268204", "0.6667863", "0.65658396", "0.6513143", "0.64058745", "0.6379583", "0.6373463", "0.6369926", "0.633189", "0.63122463", "0.627458", "0.6262004", "0.6254405", "0.62401485", "0.6236742", "0.62190664", "0.6151593",...
0.72845334
0
Prepare and start the sequence acquisition. Write frame in an tiff file during acquisition. This function use the labjack to detect a camera trigger.
def sequenceAcqLabjackTrig(mmc, nbImages, maxFrames, expRatio, deviceLabel, ledList, tiffWriterList, textFile, labjack, window, app, exit): #readOutFrame = 10 #ms ##Minimal time between 2 frames (cf page 45 zyla hardware guide) #timeStamps.append(time()) #Useless to have a timestamp here exp = flo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _frameSaving(self):\n self.mmc.clearCircularBuffer()\n imageCount=0\n self.mmc.startContinuousSequenceAcquisition(1)\n while(imageCount<(self.nbFrames) and self.acqRunning and self.loopRunning):\n if self.mmc.getRemainingImageCount() > 0: #Returns number of image in circu...
[ "0.66560525", "0.66160214", "0.59900504", "0.597327", "0.5946283", "0.592411", "0.59203595", "0.58946085", "0.58694327", "0.58440864", "0.5773642", "0.57569706", "0.5754705", "0.57376325", "0.57085884", "0.5704029", "0.56933516", "0.5685275", "0.56782025", "0.5663697", "0.566...
0.58092505
10
Prepare and start the sequence acquisition. Write frame in an tiff file during acquisition. This function use the labjack to detect a camera trigger.
def sequenceAcqLabjackTrig2(mmc, nbImages, maxFrames, expRatio, deviceLabel, ledList, tiffWriterList, textFile, labjack, window, app, exit): #readOutFrame = 10 #ms ##Minimal time between 2 frames (cf page 45 zyla hardware guide) #timeStamps.append(time()) #Useless to have a timestamp here exp = fl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _frameSaving(self):\n self.mmc.clearCircularBuffer()\n imageCount=0\n self.mmc.startContinuousSequenceAcquisition(1)\n while(imageCount<(self.nbFrames) and self.acqRunning and self.loopRunning):\n if self.mmc.getRemainingImageCount() > 0: #Returns number of image in circu...
[ "0.6655961", "0.661718", "0.5988536", "0.597382", "0.59228516", "0.59199524", "0.58925843", "0.58694386", "0.584409", "0.58088", "0.5771378", "0.5757235", "0.57543904", "0.57374334", "0.5708323", "0.57027847", "0.5692867", "0.5683424", "0.56785035", "0.5662035", "0.56600606",...
0.5945944
4
Make turtle t draw a square of with side sz.
def drawSquare(t, sz): t.shape("turtle") while 1: if sz > 200: break for j in range (36): t.left(10) sz = sz + 1 if j%2 == 1: t.color("red") else: t.color("blue") for i in range(4): t.forward(sz) t.left(90) sz = sz + 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_square(turtle, size):\n\n square = range(4)\n\n for line in square:\n alexa.forward(size)\n alexa.left(90)", "def make_square(turt,sz):\n for i in range(4):\n turt.forward(sz)\n turt.left(90)", "def draw_square():\r\n turtle.forward(100)\r\n turtle.le...
[ "0.8070417", "0.8039957", "0.774589", "0.7098677", "0.6976722", "0.6861428", "0.6785766", "0.6780308", "0.6778455", "0.6728188", "0.6636653", "0.65735304", "0.6547466", "0.6542052", "0.6403489", "0.63923377", "0.63704145", "0.6338713", "0.6337131", "0.6320703", "0.6318662", ...
0.85142684
0
Used for automatic time based ending of quests.
def force_done(self): if self.can_done(): return self.done() else: # we can not set that quest to done regularly, so we force it # nobody gets any experience and we might need a special notification for this self.quest.done = True self.quest.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end(self, won, reason):\n pass\n # replace with your end logic", "def end(self, time, reward):\n return True", "def end_time(self):\n pass", "def end_time(self) -> float:\r\n ...", "def finish(self, finish_time=None):\n pass", "def done_action(self) -> None:\...
[ "0.656753", "0.65287447", "0.64753294", "0.64367896", "0.6436146", "0.6408996", "0.62925214", "0.62605107", "0.6227713", "0.6177872", "0.61477166", "0.6123459", "0.6116317", "0.60349846", "0.60272604", "0.6016484", "0.60000616", "0.59916973", "0.5985124", "0.596463", "0.59600...
0.0
-1
Gets the data from a given slug, returns a JSON respone from the Helix API endpoint
def get_data(slug: str) -> dict: response = get("data", slug=slug) try: return response["data"][0] except KeyError as e: log.error(f"Ran into exception: {e}") log.error(f"Response: {response}") return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def getProductDetailBySlug(self, slug=None):\n payload = {}\n \n if slug:\n payload[\"slug\"] = slug\n \n\n # Parameter validation\n schema = CatalogValidator.getProductDetailBySlug()\n schema.dump(schema.load(payload))\n \n\n url_with...
[ "0.68774015", "0.6794511", "0.66812634", "0.6649883", "0.65714777", "0.65092707", "0.64786947", "0.6264475", "0.6155149", "0.60536057", "0.60405624", "0.59062344", "0.5894154", "0.585762", "0.58429706", "0.5822873", "0.5815605", "0.5812659", "0.5802165", "0.5779416", "0.57777...
0.77147025
0
Gets the data for given slug, returns a tuple first entry being the mp4_url used to download the clip, second entry being the title of the clip to be used as filename.
def get_clip_data(slug: str) -> tuple: clip_info = get_data(slug) if "thumbnail_url" in clip_info and "title" in clip_info: # All to get what we need to return # the mp4_url and title of the clip thumb_url = clip_info["thumbnail_url"] slice_point = thumb_url.index("-previ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data(slug: str) -> dict:\r\n response = get(\"data\", slug=slug)\r\n\r\n try:\r\n return response[\"data\"][0]\r\n except KeyError as e:\r\n log.error(f\"Ran into exception: {e}\")\r\n log.error(f\"Response: {response}\")\r\n return response", "def download_clip(clip:...
[ "0.62556016", "0.62428874", "0.55988955", "0.54840624", "0.54813236", "0.54214275", "0.540999", "0.538477", "0.53262895", "0.53129536", "0.52874196", "0.5253897", "0.5250813", "0.5233298", "0.5196757", "0.5182033", "0.51498044", "0.5142984", "0.512994", "0.5127548", "0.511784...
0.8549872
0
Used for printing the download progress
def get_progress(count, block_size, total_size) -> None: percent = int(count * block_size * 100 / total_size) print(f"Downloading clip... {percent}%", end="\r", flush=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_progress(self):\n \n print 'Completed %d of %d' %(self.progress_id, self.total_work)\n self.progress_id += 1", "def _print_progress(self):\n if self.current_training_size % 1000 == 0:\n print(self.current_training_size, end='')\n elif self.current_training...
[ "0.7822493", "0.7672975", "0.75927395", "0.75803006", "0.7568847", "0.75567335", "0.7505376", "0.74961805", "0.74940753", "0.74914426", "0.74773335", "0.73411936", "0.7307862", "0.72979075", "0.72837406", "0.72772455", "0.7248799", "0.71521616", "0.7150122", "0.7094859", "0.7...
0.7450158
11
Splits up the URL given and returns the slug of the clip.
def get_slug(clip: str) -> str: slug = clip.split("/") return slug[len(slug) - 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slug_from_url(url):\n\n find_replaces = [\n ('http(s)?://', ''),\n ('\\.', '-'),\n ('/', '-'),\n ]\n\n for find, replace in find_replaces:\n url = re.sub(find, replace, url)\n\n return url", "def _split_url(url):\n return url[1:].split('/')", "def get_slug(sel...
[ "0.6573873", "0.6397004", "0.6325671", "0.62193835", "0.61308074", "0.60969", "0.60584766", "0.6047683", "0.60388464", "0.5998331", "0.5956057", "0.5953348", "0.5937267", "0.5903982", "0.58827615", "0.5872457", "0.58718574", "0.5865004", "0.5849255", "0.57959837", "0.57903177...
0.78426516
0
Downloads the clip, does not return anything.
def download_clip(clip: str, basepath: str) -> None: slug = get_slug(clip) mp4_url, clip_title = get_clip_data(slug) # Remove special characters so we can save the video regex = re.compile("[^a-zA-Z0-9_]") clip_title = clip_title.replace(" ", "_") if CLIP_TITLE == "title" else slug out_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_cover(self) -> None:\n self.cover_path = None\n if self.cover_url is None:\n Logger.Logger.log('No cover picture found for this song.')\n return\n Logger.Logger.log('Retrieving cover picture from iTunes...')\n url_hash: str = md5(self.cover_url.encode('ut...
[ "0.5969689", "0.576693", "0.5721179", "0.561436", "0.561436", "0.5589499", "0.5550476", "0.553288", "0.55146897", "0.54741114", "0.5457423", "0.5455695", "0.54392725", "0.54390466", "0.54390466", "0.5427849", "0.5362654", "0.53607637", "0.53044415", "0.52991045", "0.52852416"...
0.6272273
0
Gets the top clips for given game, returns JSON response from the Kraken API endpoint.
def get_clips(category: str, path: str) -> dict: data = {} PARAMS[MODE] = category response = get("top_clips", headers=HEADERS, params=PARAMS) if "clips" in response: for clip in response["clips"]: data[clip["tracking_id"]] = { "url": "https://clips.twi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_all_top_10(self) -> 'Response':\n headers = {\n 'Content-Type': 'application/json',\n 'Accept': 'application/vnd.lichess.v3+json'\n }\n response = await self._client.request(method=RequestMethods.GET, url=USERS_PLAYER_URL, headers=headers)\n return re...
[ "0.649867", "0.6287386", "0.61398864", "0.61083853", "0.6087414", "0.6057744", "0.5892684", "0.587624", "0.57806104", "0.5774665", "0.57705295", "0.570377", "0.56656986", "0.55479366", "0.55076", "0.5493204", "0.5483413", "0.5470106", "0.54600656", "0.5455603", "0.54535437", ...
0.5818894
8
Downloads clips, returns a list of streamer names.
def download_clips(data: dict, length: float, path: str) -> list: amount = 0 length *= 60 names = [] for clip in data: download_clip(data[clip]["url"], path) length -= data[clip]["duration"] name = data[clip]["display_name"] amount += 1 if name no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_live_streamers(self) -> 'Response':\n headers = {\n 'Content-Type': 'application/json',\n }\n response = await self._client.request(method=RequestMethods.GET,\n url=USERS_LIVE_STREAMERS_URL,\n ...
[ "0.57559013", "0.53566355", "0.53493756", "0.53475106", "0.52516747", "0.5216363", "0.5199266", "0.51281935", "0.51072365", "0.50970334", "0.5091703", "0.5090108", "0.5083827", "0.5082633", "0.5065399", "0.50641793", "0.5059439", "0.5045423", "0.5039622", "0.50376827", "0.503...
0.6597001
0
Concretize a spec with nondefault options in an environment. Make sure that when we ask for a matching spec when the environment is active that we get the instance concretized in the environment.
def test_match_spec_env(mock_packages, mutable_mock_env_path): # Initial sanity check: we are planning on choosing a non-default # value, so make sure that is in fact not the default. check_defaults = spack.cmd.parse_specs(["a"], concretize=True)[0] assert not check_defaults.satisfies("foobar=baz") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_env_spec_make_workaround(env: LlvmEnv):\n env.reset(benchmark=\"cbench-v1/bitcount\")\n env.spec._kwargs[ # pylint: disable=protected-access\n \"benchmark\"\n ] = \"cbench-v1/bitcount\"\n with env.spec.make() as new_env:\n assert new_env.benchmark == env.benchmark", "def __ini...
[ "0.52778894", "0.5273832", "0.5237516", "0.52121687", "0.5153508", "0.51231545", "0.48871702", "0.48617077", "0.48567748", "0.47990334", "0.47969693", "0.4748159", "0.47394314", "0.47262514", "0.4722297", "0.47121826", "0.4707871", "0.47060472", "0.4698635", "0.4697722", "0.4...
0.5025732
6
Ensure that ConfigSetAction is doing the right thing.
def test_concretizer_arguments(mutable_config, mock_packages): spec = spack.main.SpackCommand("spec") assert spack.config.get("concretizer:reuse", None) is None spec("--reuse", "zlib") assert spack.config.get("concretizer:reuse", None) is True spec("--fresh", "zlib") assert spack.config.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_config(self):", "def test_conflicting_actions(self):\n\n err = pyramid_config.ConfigurationError\n self.assertRaises(err, self.factory) # calls the includeme", "def test_safe(self):\n\n conf = configuration(\n category(\n 'test',\n Parame...
[ "0.6267934", "0.6074447", "0.6070502", "0.6009013", "0.58821166", "0.58627784", "0.5845754", "0.570631", "0.570631", "0.5699852", "0.5699852", "0.5686381", "0.5678665", "0.5676008", "0.5599686", "0.5584741", "0.5535828", "0.5507596", "0.5479177", "0.5474924", "0.5466765", "...
0.0
-1
Plot the skeleton based on joint angle data
def visualise_from_joints(self, ax): ax.set_xlim(-2,2) ax.set_ylim(-2,2) ax.set_zlim(-1,1) self.joint2pos() skeleton_points = self.skeleton_param['list_points'] skeleton_segments = self.skeleton_param['list_segments'] for seg in skeleton_segments: point_ini = skeleton_segments[seg]['points'][0] x_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_full_skeleton(input_image, joints, all_joints=None, draw_edges=True, vis=None, all_vis=None, radius=None):\n\n \n joints = joints + 112\n print(joints)\n\n if radius is None:\n radius = max(4, (np.mean(input_image.shape[:2]) * 0.01).astype(int))\n\n colors = {\n 'pink': np.arr...
[ "0.6712119", "0.66732395", "0.6326688", "0.6149413", "0.6103602", "0.60394126", "0.57644", "0.57560295", "0.57036847", "0.5674877", "0.56541306", "0.55659026", "0.5548639", "0.5521969", "0.5489853", "0.547457", "0.5472636", "0.5417708", "0.539933", "0.5385514", "0.5375", "0...
0.6926737
0
Returns latitude and longitude.
async def lat_long(zip_code: str, country: str) -> Sequence[float]: key: str = f"{zip_code}, {country}" url: str = f'http://www.datasciencetoolkit.org/street2coordinates/{key.replace(" ", "+")}' async with aiohttp.ClientSession() as session: async with session.get(url) as response: resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geolocation(self):\n if self.latitude and self.longitude:\n return self.longitude, self.latitude", "def coordinates(self):\n return self.latitude, self.longitude", "def getLngLat(self):\n lat = None\n lng = None\n exif_data = self.get_exif_data()\n if \"...
[ "0.80100036", "0.7491967", "0.7471748", "0.7453064", "0.74518454", "0.74210477", "0.7373584", "0.73724455", "0.7307737", "0.72870207", "0.7231296", "0.7096985", "0.7032187", "0.6950929", "0.6939933", "0.68792295", "0.6872782", "0.6870527", "0.68537533", "0.68281883", "0.68262...
0.0
-1
Register call records namespace.
def register(blueprint): blueprint.add_route(post, "/call-records", methods=['POST'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_recorder(self, groupname, tablename, recorder,\n timeseries=False):\n self.open_db()\n tab = self.get_table(groupname, tablename)\n if timeseries is False:\n self.add_row(tab, recorder())\n else:\n self.recorders.append((tab, r...
[ "0.51874465", "0.5077612", "0.5027467", "0.49655706", "0.49356636", "0.4900239", "0.4900239", "0.4899169", "0.48648772", "0.48585153", "0.48410738", "0.48243338", "0.4807487", "0.48033518", "0.4797804", "0.47961318", "0.47794095", "0.4770171", "0.47700715", "0.47573164", "0.4...
0.52914554
0
Read filefooter metadata from each individual piece. Since this operation can be painfully slow in some cases, abort if any metadata or statistics are missing
def _get_md_row_groups(pieces): row_groups = [] for piece in pieces: for rg in range(piece.get_metadata().num_row_groups): row_group = piece.get_metadata().row_group(rg) for c in range(row_group.num_columns): if not row_group.column(c).statistics: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_metadata():\n\n create_output(ARGS.out)\n index = pre.pixz.read_index(ARGS.traffic)\n\n try:\n tmp = tempfile.mkdtemp(prefix=\"ictf2017_cache_\")\n print(\"Using temporary cache for extracted files at {}\".format(tmp))\n\n file_indexes = [i for i in range(len(index))\n ...
[ "0.60882914", "0.55803096", "0.5514509", "0.55087686", "0.55087686", "0.54893374", "0.5471986", "0.54566586", "0.545227", "0.5429195", "0.5382588", "0.5363607", "0.534647", "0.5325232", "0.5310612", "0.53077656", "0.5306999", "0.5297029", "0.529208", "0.5279255", "0.527717", ...
0.0
-1
Determine how to access metadata and break read into ``parts`` This logic is mostly to handle `gather_statistics=False` cases, because this also means we should avoid scanning every file in the dataset.
def _determine_dataset_parts(fs, paths, gather_statistics, filters, dataset_kwargs): parts = [] if len(paths) > 1: if gather_statistics is not False: # This scans all the files dataset = pq.ParquetDataset( paths, filesystem=fs, filters=filters, **dataset_kwargs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract(self):\r\n self._data = []\r\n for fname in self.files:\r\n meta = dict(filename=fname)\r\n\r\n # Perform the actual metadata extraction\r\n fname = os.path.splitext(self.filter_filename(fname))[0]\r\n values = fname.split(self.sep)\r\n\r\n ...
[ "0.6003094", "0.5807587", "0.5770916", "0.5663388", "0.5620173", "0.5604538", "0.5548953", "0.55457515", "0.55446166", "0.55306935", "0.55277216", "0.5524769", "0.55243605", "0.5494944", "0.5478514", "0.546195", "0.5459989", "0.54192567", "0.5416553", "0.53937715", "0.5377363...
0.6683663
0
Format a report in HTML
def get_html_report(cfg_file=None, cfg=None): rval = "" if cfg is not None: # use it pass elif cfg_file is not None: cfg = CrawlConfig.add_config(filename=cfg_file) else: cfg = CrawlConfig.add_config() db = CrawlDBI.DBI(dbtype="crawler") last_rpt_time = rpt_lib....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_html_report():\n display(HTML('report_page.html'))", "def pretty_html_report(self, report, header):\n\t\t# Use a nice style for the table view\n\n\t\t# Build an html table from the report and it's header\n\t\thtml_table = \"<table id=\\\"t01\\\">\"\n\t\thtml_table += \"<caption><b>Tracking Sta...
[ "0.72927934", "0.71423423", "0.69298834", "0.69140023", "0.6805506", "0.67813575", "0.67666703", "0.67604965", "0.6707439", "0.6675773", "0.65653753", "0.6501293", "0.64967006", "0.6393157", "0.6388295", "0.6316796", "0.6277492", "0.62656116", "0.62604576", "0.6252544", "0.62...
0.5737316
67
Format the CV report in HTML
def get_html_cv_report(db, last_rpt_time): rval = "" if not db.table_exists(table="checkables"): return rval rval += ("<h2>%s</h2>\n" % cv_sublib.report_title()) diml = [{'name': 'cos', 'pop': "type = 'f' and ? < last_check", 'samp': "type = 'f' and checksum = 1 and ? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview():\r\n html = create_html_report()\r\n return html", "def save_html(self, report_summary, file_name, folder):\n myfile = open(file_name, \"w\")\n myfile.write(t('! DOCTYPE html') + nl())\n myfile.write(t('html') + nl())\n myfile.write(t('head') + nl())\n myfil...
[ "0.6857024", "0.6329301", "0.6285875", "0.6268089", "0.6226494", "0.62075233", "0.61447465", "0.6047048", "0.60389507", "0.59905636", "0.595511", "0.5953522", "0.5907026", "0.58661455", "0.5827086", "0.5820692", "0.5806999", "0.57924706", "0.5770915", "0.5728266", "0.5708893"...
0.63381964
1
Format the MPRA report in HTML
def get_html_mpra_report(db, last_rpt_time): if not db.table_exists(table="mpra"): return "" rval = ("<h2>%s</h2>\n" % mpra_sublib.report_title()) body = '' hfmt = " %-5s %-20s %-20s %-20s %8s\n" bfmt = " %-5s %-20s %-20s %-20s %8d\n" mdelta = 0 pdelta = 0 rows = mpr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_html_report():\n display(HTML('report_page.html'))", "def format_report_header(self):", "def report_processing_qc(analysis_dir,html_file):\n # Initialise the HTML report\n processing_qc = Document(\"Processing report for %s\" %\n os.path.basename(analysis_di...
[ "0.6548287", "0.6382216", "0.6350493", "0.63070124", "0.6249452", "0.6193579", "0.61822295", "0.6177774", "0.6018906", "0.59797597", "0.59589267", "0.5935615", "0.5932245", "0.5914714", "0.5901026", "0.5877641", "0.58640754", "0.58531994", "0.5836908", "0.5832936", "0.5818078...
0.6652169
0
Format the TCC report in HTML
def get_html_tcc_report(db, last_rpt_time): rval = "" if not db.table_exists(table='tcc_data'): return rval rval = ("<h2>%s</h2>\n" % tcc_sublib.report_title()) checks = correct = error = 0 rows = tcc_sublib.recent_records(last_rpt_time, db=db) for (t, l, h, c, e) in rows: che...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_html(self) -> str:\n source_name = escape(self.source_name)\n (covered, lines) = self.coverage_stats()\n lines_stats = \"{} / {} ({} lines of code)\".format(covered, lines, len(self.source_code))\n (br_covered, br_count, calls_covered, calls_count) = self.branch_stats()\n ...
[ "0.61556923", "0.60551417", "0.6044294", "0.6040636", "0.60342383", "0.5991108", "0.5984696", "0.5921795", "0.5864797", "0.5859054", "0.58359385", "0.57773423", "0.57677716", "0.5733748", "0.57317203", "0.57093257", "0.56609064", "0.5646776", "0.5618573", "0.55744916", "0.557...
0.68484527
0
Extracts url from html
def extract_url(td): url = td.find('a',href=True)['href'] return url
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_url(self, url, html):\n html = self.getHtmlContent(html, 'content')\n new_urls = self.getValidUrlsFromHtml(html)\n return new_urls", "def extractUrl(self, href):\n url = ''\n pattern = re.compile(r'(http[s]?://[^&]+)&', re.U | re.M)\n url_match = pattern.sear...
[ "0.6942664", "0.694266", "0.67256683", "0.6684412", "0.66800857", "0.65427136", "0.65086895", "0.64643157", "0.6385671", "0.63537264", "0.6315027", "0.630541", "0.62315476", "0.61999756", "0.6182553", "0.6172405", "0.6132446", "0.6130918", "0.6104548", "0.60942876", "0.607704...
0.7369381
0
Extracts text from html
def extract_text(td): text = td.find('a',href=True).text return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_text(html, guess_punct_space=True):\n sel = cleaned_selector(html)\n return selector_to_text(sel, guess_punct_space=guess_punct_space)", "def html_to_text(html):\n s = TextExtractorHTMLParser()\n s.feed(html)\n return s.get_text()", "def extract_page_text(html):\n soup = bs4.Beaut...
[ "0.7791069", "0.7684028", "0.7683524", "0.7471255", "0.7464041", "0.74003136", "0.7259061", "0.7134363", "0.7097741", "0.7085013", "0.7047965", "0.69694406", "0.69121873", "0.69020706", "0.6863355", "0.6851142", "0.680404", "0.6749167", "0.6742216", "0.67198294", "0.6711281",...
0.69887584
11
Extract unique ID from url
def extract_id(url): trail_id = url.replace('https://www.trailforks.com/trails/','').replace('/','') return trail_id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self, url):\n return url.split('/')[-1]", "def id_from_url(url):\n return url.split('-')[-1].split('.html')[0]", "def _id_from_url(url):\n url = re.sub(r'\\?.*', '', url)\n video_id = url.split('/')[-2]\n return video_id", "def get_clean_url(url, unique_id):\n sea...
[ "0.8380673", "0.81195986", "0.80006224", "0.7679931", "0.75390005", "0.75193775", "0.73941654", "0.73696965", "0.7283127", "0.7201107", "0.7174527", "0.71031886", "0.7055173", "0.70551497", "0.70354474", "0.6988878", "0.6982627", "0.69719243", "0.6964515", "0.6903353", "0.688...
0.79425615
3
1 sh 0 sz
def _select_market_code(code): code = str(code) if code[0] in ['5', '6', '9'] or code[:3] in ["009", "126", "110", "201", "202", "203", "204"]: return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_size(args):", "def shar():\n pass", "def do_sh(self, none):\n print(\"**** Not Implemented\")", "def size(*args):", "def make_square(turt,sz):\n for i in range(4):\n turt.forward(sz)\n turt.left(90)", "def shopen():\n\tsh('o')", "def _s2bl(size):\n return size*...
[ "0.63248545", "0.5898294", "0.58236194", "0.5499801", "0.52991474", "0.52804255", "0.51600564", "0.5145358", "0.51127124", "0.5105524", "0.50900805", "0.5079548", "0.50585145", "0.5053135", "0.5038149", "0.4947009", "0.494617", "0.49350992", "0.49325883", "0.4879849", "0.4873...
0.0
-1
Allows resource methods to return models, lists of models, and nested dicts including models; calls public_dict() on all objects that provide it.
def return_dict(f): @wraps(f) def wrapper(*args, **kwargs): return dictify(f(*args, **kwargs)) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opt_get_all_models_rest_api():\n return retrieve_all_models()", "def on_get_resource(self, req, resp, **params):\n instance = self.get_object(**params)\n resp.json(**instance.as_resource)", "def handle_models_request():\n # TODO: add sort and filter by creation/modification date\n re...
[ "0.6702457", "0.65570825", "0.6285609", "0.6211514", "0.6006195", "0.5948634", "0.59445965", "0.5880195", "0.5846682", "0.5846682", "0.5846682", "0.58263266", "0.58077884", "0.57976645", "0.5784321", "0.5751144", "0.5739015", "0.57262045", "0.5678348", "0.56772375", "0.567575...
0.0
-1
Moves get/post arguments into the arg list.
def extend_with_args(f): @wraps(f) def wrapper(*args, **kwargs): if request.get_json(): kwargs.update(request.get_json()) # WARNING: This may get us into trouble when it comes to # list-style "get" args. kwargs.update({k: v for k, v in request.args.iteritems()}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transform_args(self) -> None:\n self.args = None if self.args == [] else self.args", "def _set_arguments(self):\n self._arguments = []", "def _set_args(self, args):\n if not args:\n self.arg = None\n elif len(args) == 1:\n self.arg = args[0]\n else:...
[ "0.7024696", "0.62392586", "0.6223757", "0.61863637", "0.6133016", "0.6104633", "0.6030061", "0.599919", "0.59782875", "0.5964543", "0.59543717", "0.5943862", "0.58861876", "0.58676785", "0.58403295", "0.5811097", "0.57581645", "0.5723659", "0.57110935", "0.5691672", "0.56877...
0.0
-1
Assignment of users to queues
def cli() -> None: pass # pragma: no cover
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_user(self, queue: SubnetQueue, *args):", "def task_queue_users():\n users = firebase_admin.auth.list_users().iterate_all()\n for user in users:\n if user.disabled: # skip disabled users\n continue\n # add user task\n add_task(url_for(\"task_queue_podcasts\"), {\"...
[ "0.7112401", "0.65540063", "0.6523784", "0.6046179", "0.5905534", "0.58399224", "0.5835143", "0.57973343", "0.57812953", "0.5747986", "0.570831", "0.5543441", "0.5543441", "0.5543441", "0.5516011", "0.5516011", "0.551184", "0.55012774", "0.54841727", "0.54561526", "0.5411173"...
0.0
-1
List all users and their assignments to queues.
def list_command(ctx: click.Context, user_ids: Tuple[int], queue_ids: Tuple[int]) -> None: with RossumClient(context=ctx.obj) as rossum: queue_users = rossum.get_queues((USERS,), users=user_ids) user_queues: Dict[int, List[List[Optional[str]]]] = {} for queue in queue_users: if queue_ids an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task_queue_users():\n users = firebase_admin.auth.list_users().iterate_all()\n for user in users:\n if user.disabled: # skip disabled users\n continue\n # add user task\n add_task(url_for(\"task_queue_podcasts\"), {\"user_uid\": user.uid})\n\n return OK_RESPONSE", "d...
[ "0.6420194", "0.62280095", "0.61567736", "0.6114229", "0.6111416", "0.60904527", "0.6056923", "0.59933186", "0.59414256", "0.5924326", "0.5871818", "0.58335733", "0.5831743", "0.58315027", "0.5815715", "0.5800357", "0.5722068", "0.57204676", "0.5710141", "0.57079506", "0.5701...
0.71933156
0
Helper Function for isvalid, Checks if s1, s2 are a valid bracket pair
def isValidPair(self,s1,s2): if (s1 == '(' and s2 == ')'): return True if (s1 == '[' and s2 == ']'): return True if (s1 == '{' and s2 == '}'): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match(str1, str2):\n if ( (str2 == '[' and str1 == ']')\n or (str2 == '{' and str1 == '}')\n or (str2 == '(' and str1 == ')')):\n return True\n return False", "def multi_bracket_validation(input):\n brackets = Stack()\n for i in input:\n if i == '(' or i == '[' or...
[ "0.6902342", "0.6578745", "0.64985824", "0.6201826", "0.6157199", "0.61534166", "0.6116992", "0.60981786", "0.60610473", "0.5993438", "0.5981416", "0.5980033", "0.5964657", "0.59297395", "0.58786607", "0.5873677", "0.5793385", "0.57868797", "0.57779795", "0.5727495", "0.57272...
0.86355895
0
Checks if s contains valid ({[]}) pair in correct order
def isValid(self, s: str) -> bool: st = [] for char in s: if (len(st) != 0): e = st[-1] if (self.isValidPair(e,char)): st.pop() continue st.append(char) return (len(st)==0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isValid(self, s):\n # 1\n if not s:\n return True\n\n # 2\n if not len(s) % 2 == 0:\n return False\n\n comp = {\n ')': '(',\n ']': '[',\n '}': '{',\n }\n stack = []\n\n for char in s:\n # 3...
[ "0.6825853", "0.6750236", "0.6749478", "0.66877943", "0.6573299", "0.6547619", "0.6510734", "0.6484433", "0.62763965", "0.6209836", "0.61905116", "0.61400807", "0.60200226", "0.59876984", "0.5978047", "0.5973066", "0.5904061", "0.58395123", "0.5775908", "0.5752234", "0.563264...
0.69817543
0
Runs a BFS Traversal, Returning a 2D Array representing notes at each level of the tree. One dimension representing each level, and it's array representing nodes at that level. q is a queue of child nodes, starting from the root, down to the end.
def levelOrder(self, root: TreeNode) -> List[List[int]]: result = [] if(root is None): return result q = deque([root]) while(q): n = len(q) level = [] for i in range(0,n): f = q.popleft() level.append(f.val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs_traversal_queue(self):\n queue = ArrayQueue()\n if not self.root:\n print(\"Tree is empty\")\n return\n queue.enqueue(self.root)\n\n while (queue.length() > 0):\n node = queue.dequeue()\n print(node.data, end=\" \")\n if nod...
[ "0.7717397", "0.71512514", "0.7137357", "0.68200314", "0.6652208", "0.6628352", "0.66126645", "0.6381496", "0.6362987", "0.6343037", "0.62802523", "0.6268586", "0.6243742", "0.6185299", "0.6096152", "0.60347956", "0.60323125", "0.59980357", "0.59462214", "0.5933634", "0.59022...
0.0
-1
Returns a list with the order traversal of elements in the tree Uses a strategy type pattern with parameters strategy = {PRE,POST,IN} For respective order traversals
def RecursiveTraversal(self, root: TreeNode, strategy: str) -> List[int]: result = [] if (root): if strategy == 'POST': if (root.left is not None): result = result + self.RecursiveTraversal(root.left,strategy) if (root.right is not None): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse_postorder(operation):\n\n nodes_postorder = []\n def recurse(node):\n if isinstance(node, Operation):\n for input_node in node.input_nodes:\n recurse(input_node)\n nodes_postorder.append(node)\n\n recurse(operation)\n return nodes_postorder", "...
[ "0.6355085", "0.63519377", "0.6300792", "0.628017", "0.62159055", "0.61725616", "0.6165398", "0.61307913", "0.6094408", "0.60663015", "0.60005105", "0.5948831", "0.594843", "0.59415513", "0.5918404", "0.5880077", "0.58614326", "0.58589536", "0.58558935", "0.5847287", "0.58438...
0.695369
0
S1 is like call stack s2 is the container nodes in s
def StackBasedTraversal(self,root: TreeNode, strategy: str) -> List[int]: if(not root): return ans = [] s1,s2 = [],[] s1.append(root) while(s1): x = s1[-1] s1.pop() s2.append(x) if(x.left): s1.append(x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.s1 = Stack()\n self.s2 = Stack()", "def pool_snps(parent1, parent2):", "def __init__(self):\n # Use list to represent Stack \n self.s1 = []\n self.s2 = []\n # Note the first item to make peek() faster\n self.first = None", "def __ini...
[ "0.6528504", "0.6369448", "0.62064385", "0.6019769", "0.5988017", "0.5758984", "0.56731415", "0.5416152", "0.5399732", "0.5384572", "0.53297", "0.5311962", "0.5303379", "0.5283734", "0.5267882", "0.5263877", "0.52613163", "0.52601475", "0.5260031", "0.52584153", "0.52553326",...
0.0
-1
Compute the GaussLobatto quadrature
def jacobi_gauss_lobatto_nodes(alpha, beta, N, # noqa: N803 backend=None, force_dim_axis=False): x = np.zeros((N + 1,)) if N == 0: x[0] = 0 return x x[0] = -1 x[-1] = 1 if N > 1: quad = JacobiGaussQuadrature(alpha + 1, beta + 1, N - 2, back...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_quad_gauss(lmax,alm):\n return libcurvedsky.bispec.make_quad_gauss(lmax,alm)", "def test_ln_gauss(self):\n Q = likelihood()\n test_object = test_values_for_likelihood()\n experimental_values = [0.9,2.1,3.2]\n errors = [0.5,0.4,0.3]\n reference_q_value = 0.273472222222...
[ "0.71848667", "0.70720714", "0.68945396", "0.67597324", "0.6756922", "0.65686566", "0.6545775", "0.6480314", "0.647398", "0.6451015", "0.64494395", "0.6436806", "0.6406376", "0.6401095", "0.6389199", "0.63581395", "0.6356061", "0.63102597", "0.630343", "0.63029367", "0.624232...
0.0
-1
Compute the LegendreGaussLobatto quadrature nodes.
def legendre_gauss_lobatto_nodes(N, # noqa: N803 backend=None, force_dim_axis=False): return jacobi_gauss_lobatto_nodes(0, 0, N, backend=backend, force_dim_axis=force_dim_axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReferenceElement(N):\n\n # Legendre polynomials are Jacobi(alpha,beta) polynomials\n alpha=0.; beta=0;\n\n # Gauss-Lobatto quadrature points for Legendre polynomials\n # According to Hesthaven+Warburton (p. 448, JacobGL.m) these\n # are the order N-2 Gauss quadrature points of Jacobi polynomials...
[ "0.58593106", "0.58049333", "0.57061964", "0.5585701", "0.5494929", "0.5449645", "0.5404597", "0.5396169", "0.53935695", "0.53853106", "0.5384895", "0.53766567", "0.5354576", "0.5340692", "0.5332809", "0.53303593", "0.5283502", "0.5264142", "0.52536964", "0.5246925", "0.52407...
0.62280107
0
Sets the learning rate to the initial LR decayed by 10 every 30 epochs
def adjust_learning_rate(initial_lr, optimizer, epoch, every_epoch): lr = initial_lr * (0.1 ** (epoch // every_epoch)) for param_group in optimizer.param_groups: param_group['lr'] = lr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr", "def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l...
[ "0.79122996", "0.79058665", "0.77745456", "0.77334857", "0.7730185", "0.7722212", "0.7721426", "0.771838", "0.7708323", "0.76928985", "0.767362", "0.7665062", "0.7665062", "0.7665062", "0.76536506", "0.7641248", "0.7638249", "0.7637116", "0.7625168", "0.7623629", "0.7620543",...
0.7848773
2
Generate a base64 encoded reference to a given Django ORM instance.
def serialize_model_instance(instance): ref = [instance.__class__.__module__, instance.__class__.__name__, instance.pk] dumped_ref = json.dumps(ref).encode('utf-8') return b64encode(dumped_ref).decode('utf-8')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base64_string(self) -> global___Expression:", "def serialize(obj):\n result = base64.urlsafe_b64encode(obj)\n # this workaround is needed because in case of python 3 the\n # urlsafe_b64encode method returns string of 'bytes' class.\n result = result.decode()\n return result", "def serialized...
[ "0.65252703", "0.6164654", "0.6147635", "0.60311043", "0.5965339", "0.5942643", "0.5856737", "0.57892215", "0.5784739", "0.5777973", "0.57017314", "0.56621474", "0.56593806", "0.5639606", "0.5626723", "0.55980736", "0.55938447", "0.5560814", "0.55501676", "0.55286133", "0.552...
0.67707986
0
Load Django ORM instance from base64 encoded reference.
def deserialize_model_instance(encoded): dumped_ref = b64decode(encoded) ref = json.loads(dumped_ref.decode('utf-8')) model_module = import_module(ref[0]) model_class = getattr(model_module, ref[1]) return model_class.objects.get(pk=ref[2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loads(cls, data: str) -> \"Serializable\":\n instance = dill.loads(base64.b64decode(data.encode(\"ascii\")))\n if not isinstance(instance, cls):\n raise TypeError(f\"Unpickled object is not of type {cls}\")\n return instance", "def deserialize(obj):\n result = base64.urlsaf...
[ "0.60619754", "0.59615856", "0.5860249", "0.5757516", "0.5731678", "0.5695101", "0.5684532", "0.56761885", "0.5633992", "0.54312295", "0.5369191", "0.5346863", "0.5322224", "0.5310522", "0.5259935", "0.5250897", "0.5246336", "0.5245134", "0.5214885", "0.5203839", "0.51985216"...
0.65203667
0
Download data of one study from database
def download_data(study, engine, has_trips=True, filter_coverage=False): def to_datetime(df): df["started_at"] = pd.to_datetime(df["started_at"], utc=True) df["finished_at"] = pd.to_datetime(df["finished_at"], utc=True) return df exclude_purpose_tist = [ "Light Rail", "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_dataset(self):\n raise NotImplementedError", "def download():\n return response.download(request,db)", "def download():\n return response.download(request,db)", "def download():\n return response.download(request,db)", "def download():\n return response.download(request,db)"...
[ "0.6781899", "0.6684006", "0.6684006", "0.6684006", "0.6684006", "0.6684006", "0.6684006", "0.6534695", "0.65255445", "0.64752614", "0.64643145", "0.6462871", "0.646285", "0.64577276", "0.6406183", "0.6401371", "0.6401371", "0.6401371", "0.6401371", "0.6401371", "0.6401371", ...
0.6257936
50
Filter out users where tracking coverage is too low
def filter_tracking_coverage(sp, locs, tpls, trips): print("\t filter by tracking coverage") def filter_user_by_number_of_days( sp, tpls, coverage=0.7, min_nb_good_days=28, filter_sp=True ): nb_users = len(sp.user_id.unique()) sp_tpls = sp.append(tpls).sort_values(["user_id", "star...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prune(self):\n target_user_ids = self.get_queryset().values_list('id', flat=True)\n exclude_user_ids = SentDrip.objects.filter(date__lt=conditional_now(),\n drip=self.drip_model,\n user__id__in=tar...
[ "0.56458056", "0.5546361", "0.5329408", "0.5329177", "0.52725947", "0.526916", "0.5250236", "0.5200599", "0.5181351", "0.5166104", "0.51466775", "0.51419705", "0.5112545", "0.5094425", "0.50508887", "0.4991155", "0.49397007", "0.49257168", "0.49173298", "0.49149612", "0.49059...
0.68626004
0
Given the locations and staypoints OF ONE USER, generate the graph
def generate_graph( locs_user, sp_user, study, trips_user=None, gap_threshold=None ): # print(sp_user["location_id"]) # print(locs_user) AG = ActivityGraph( sp_user, locs_user, trips=trips_user, gap_threshold=gap_threshold, ) # Add purpose feature if study == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_locations(\n staypoints,\n method=\"dbscan\",\n epsilon=100,\n num_samples=1,\n distance_metric=\"haversine\",\n agg_level=\"user\",\n activities_only=False,\n print_progress=False,\n n_jobs=1,\n):\n if agg_level not in [\"user\", \"dataset\"]:\n raise AttributeErr...
[ "0.659939", "0.59695464", "0.58203804", "0.5736499", "0.57258886", "0.5721508", "0.56901395", "0.56083816", "0.5594009", "0.55866593", "0.5553673", "0.55434465", "0.55286705", "0.5508056", "0.5475889", "0.547315", "0.54577315", "0.5440168", "0.5398705", "0.53711665", "0.53706...
0.720365
0
Reduce to the nodes with highest degree (in + out degree)
def keep_important_nodes(graph, number_of_nodes): sorted_dict = np.array( [ [k, v] for k, v in sorted( dict(graph.degree()).items(), key=lambda item: item[1], ) ] ) use_nodes = sorted_dict[-number_of_nodes:, 0] graph = g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def degree_graph(g):\n return max(degree_node(g, node) for node in g)", "def layer_out_degree(self, layer_id):\n ...", "def max_degree_node(g, d, connected):\n if not connected:\n deg = d\n else:\n deg = {k: v for k, v in d.items() if k in connected}\n if not deg:\n retu...
[ "0.6181302", "0.5884981", "0.5822757", "0.5800841", "0.5687816", "0.5639941", "0.54734296", "0.5471626", "0.5468302", "0.546607", "0.544309", "0.5424738", "0.5419244", "0.54152405", "0.54112226", "0.54112226", "0.5405578", "0.5396399", "0.53594226", "0.5346556", "0.5326148", ...
0.0
-1
Decorator to transform tuple into a series
def to_series(func): @wraps(func) def add_series(center, home_center): normed_center = func(center.x, center.y, home_center) return pd.Series(normed_center, index=["x_normed", "y_normed"]) return add_series
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform_series(obj):\n vals = obj.values\n return transform_array(vals)", "def fit_transform(self,\n series: Union[TimeSeries, Sequence[TimeSeries]],\n *args,\n **kwargs) -> Union[TimeSeries, List[TimeSeries]]:\n return self.fit(se...
[ "0.6347814", "0.5983925", "0.59830374", "0.57251686", "0.5697443", "0.55903757", "0.5556683", "0.5526106", "0.55077857", "0.55077857", "0.54631025", "0.54327905", "0.5429192", "0.53740853", "0.5326982", "0.5293809", "0.5269717", "0.52383643", "0.5229252", "0.5213238", "0.5200...
0.61962026
1
Normalize (x, y) point by home center with haversine distance
def get_haversine_displacement(x, y, home_center): sign_x = 1 if x > home_center.x else -1 displacement_x = ti.geogr.point_distances.haversine_dist( x, home_center.y, home_center.x, home_center.y )[0] sign_y = 1 if y > home_center.y else -1 displacement_y = ti.geogr.point_distances.haversine...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center_normalize(x):\n return (x - K.mean(x)) / K.std(x)", "def center_normalize(x):\n return (x - K.mean(x)) / K.std(x)", "def center(x):\n return x - x.mean()", "def project_normalize_coordinates(node_feats, transformer=None, crs=None):\n # get home node:\n home_node = node_feats.iloc[\n...
[ "0.6706094", "0.6706094", "0.6531805", "0.6390352", "0.6324326", "0.6195097", "0.61200726", "0.608594", "0.59820485", "0.59815353", "0.59811616", "0.59621364", "0.59285176", "0.5893189", "0.58789176", "0.5869087", "0.5867697", "0.5864994", "0.58597124", "0.5850982", "0.584125...
0.67650664
0
As input to the DL model, we want coordinates relative to home. To do so, we project the coordinates if possible or use the haversine distance.
def project_normalize_coordinates(node_feats, transformer=None, crs=None): # get home node: home_node = node_feats.iloc[ (node_feats["in_degree"] + node_feats["out_degree"]).argmax() ] home_center = home_node["center"] @to_series def get_projected_displacement(x, y, home_center): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project(self, (lng, lat)):\n x = lng * DEG_TO_RAD\n lat = max(min(MAX_LATITUDE, lat), -MAX_LATITUDE)\n y = lat * DEG_TO_RAD\n y = math.log(math.tan((math.pi / 4) + (y / 2)))\n return (x*EARTH_RADIUS, y*EARTH_RADIUS)", "def get_haversine_displacement(x, y, home_center):\n sign_x = 1 if x > home_center...
[ "0.6284721", "0.6001774", "0.5923108", "0.59172964", "0.5848251", "0.58461255", "0.5788823", "0.5744928", "0.5701934", "0.56556606", "0.56522423", "0.56383795", "0.5605939", "0.556082", "0.5559464", "0.55476177", "0.5541876", "0.55329305", "0.55219483", "0.5511411", "0.549560...
0.6179198
1