query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Converts matched pairs of indices in sorted_small_nodes and sorted_large_nodes into matched pairs of nodeids.
def get_matched_nodeids_from_orderids(sorted_small_nodes, sorted_large_nodes, matched_orderids): orderid2nodeid_func = lambda order_pair: (sorted_small_nodes[order_pair[0]].nodeid, sorted_large_nodes[order_pair[1]].nodeid) return list(map(orderid2nodeid_func, matched_orderids))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_matching_nodeids(small_dmrs, large_dmrs, all_surface=False):\n sorted_small_nodes = sort_nodes(small_dmrs.nodes)\n sorted_large_nodes = sort_nodes(large_dmrs.nodes)\n\n longest_matches = find_longest_matches(sorted_small_nodes, sorted_large_nodes) # list (of lists) of tuples (id_from_sub, id)\n\n ...
[ "0.6820625", "0.5716441", "0.5706402", "0.56754607", "0.55908996", "0.5546528", "0.5427354", "0.5134633", "0.5119809", "0.5119312", "0.50765777", "0.50579196", "0.5057068", "0.5023635", "0.50086886", "0.4989392", "0.49750262", "0.49497184", "0.49187142", "0.48737258", "0.4856...
0.7717208
0
Returns a subgraph of dmrs containing only nodes with subgraph_nodeids and all the links between them.
def get_subgraph(dmrs, subgraph_nodeids): links = [] for nodeid in subgraph_nodeids: node_links = dmrs.get_out(nodeid) for link in node_links: if link.end in subgraph_nodeids: links.append(link) nodes = [dmrs[nodeid] for nodeid in subgraph_nodeids] return Dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subgraphs(graph):\n nodes_powerset = get_nodes_combinations(graph)\n #print(\"Doing\")\n #draw_graph(graph)\n subgraphs = []\n for nodes in nodes_powerset:\n subg = graph.subgraph(nodes)\n nodes = subg.nodes(data=True)\n if nx.is_weakly_connected(subg):\n subg...
[ "0.7035432", "0.6588273", "0.651714", "0.6372824", "0.6290915", "0.6162915", "0.5933553", "0.59246063", "0.59132445", "0.5816567", "0.57999897", "0.57736963", "0.57541233", "0.5741261", "0.566491", "0.5662782", "0.5647418", "0.5560412", "0.5558986", "0.5549748", "0.55334896",...
0.819001
0
Finds matching pairs of nodeids between small_dmrs and large_dmrs.
def get_matching_nodeids(small_dmrs, large_dmrs, all_surface=False): sorted_small_nodes = sort_nodes(small_dmrs.nodes) sorted_large_nodes = sort_nodes(large_dmrs.nodes) longest_matches = find_longest_matches(sorted_small_nodes, sorted_large_nodes) # list (of lists) of tuples (id_from_sub, id) all_matc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_matched_nodeids_from_orderids(sorted_small_nodes, sorted_large_nodes, matched_orderids):\n orderid2nodeid_func = lambda order_pair: (sorted_small_nodes[order_pair[0]].nodeid, sorted_large_nodes[order_pair[1]].nodeid)\n return list(map(orderid2nodeid_func, matched_orderids))", "def get_matches(self,...
[ "0.7055238", "0.5894939", "0.55227906", "0.5489085", "0.54599357", "0.5449781", "0.5447405", "0.5445119", "0.5440812", "0.53929174", "0.53769183", "0.537584", "0.5372282", "0.5365889", "0.53626955", "0.5340169", "0.53266394", "0.5322242", "0.531484", "0.53060037", "0.5296792"...
0.82478267
0
Checks if the model has been fitted.
def _check_if_fitted(self): if not self.fitted: raise AssertionError('Model is not fitted! Fit the model to a ' 'dataset before attempting to plot results.')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_been_fit(self):\n return self.predictor.has_been_fit", "def _check_if_fitted(self):\n if self.covar_module is None:\n raise RuntimeError(\n \"Model has not been fitted. You need to call \"\n \"`fit_fully_bayesian_model_nuts` to fit the model.\"\n ...
[ "0.84510565", "0.8341908", "0.80420315", "0.78471446", "0.76460594", "0.7363085", "0.7329144", "0.7243502", "0.6904458", "0.68524843", "0.6768016", "0.6768016", "0.67104214", "0.65335727", "0.6428695", "0.6424164", "0.63796276", "0.637692", "0.6376009", "0.63072443", "0.62974...
0.8522283
0
This function computes standard deviations of distances between atoms list given
def standarddeviation_of_distances(self, distances, mean=None): if len(distances) == 1: mean = 3.50 self.stddev = 0.2 else: sum = 0 for dis in distances: sum = sum + dis # finding mean mean = sum / len(distances) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def standard_deviation(list):\n num_items = len(list)\n mean = sum(list) / num_items\n differences = [x - mean for x in list]\n sq_differences = [d ** 2 for d in differences]\n ssd = sum(sq_differences)\n\n\n variance = ssd / num_items\n\n sd = sqrt(variance)\n\n return sd", "def _calcula...
[ "0.7164316", "0.7109992", "0.7048701", "0.70070904", "0.69621277", "0.6905012", "0.68864226", "0.6842125", "0.67247325", "0.66839546", "0.6622081", "0.6622081", "0.6580844", "0.6364406", "0.6293041", "0.62749994", "0.6272102", "0.62253296", "0.62046343", "0.61940634", "0.6178...
0.7279174
0
This function computes max and min value and finds the atoms where distance between them is more than max and residues which are not connected
def compute_max_min(self, mean, distances, mat, mol, atoms=[]): min = mean - 0.300 max = mean + 0.500 ats = [] if len(distances) == 1: if distances[0] > max: caats = self.chain.getAtoms().get(lambda x: x.name == "CA") ats.append([caats[0], caat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_min_max_electrode_distances(self):\n distances = pdist(self.get_electrode_positions())\n return distances.min(), distances.max()", "def get_max_and_min(self):\n max_x = float('-inf')\n min_x = float('inf')\n max_y = float('-inf')\n min_y = float('inf')\n m...
[ "0.63975495", "0.6353354", "0.62732863", "0.60797185", "0.60425997", "0.6017662", "0.59481037", "0.5922569", "0.5826767", "0.5818462", "0.57839507", "0.57807755", "0.5779295", "0.5773055", "0.57633895", "0.5706294", "0.5696797", "0.5695814", "0.56732357", "0.5646929", "0.5628...
0.6639326
0
This is the main game loop for playing accordion solitaire
def accordion_game_loop(): while True: # Shows player the cards on the table deck.cards_on_table() # Prompt player to choose from available cards on table or quit player_choice = input( "Pick a card index number or deal a card = d or quit game = q: ") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GAME_LOOP():\n pass", "def play_game(self):\n # need everyone to pass to move to next phase?\n self.deal_cards()\n self.plant_food()", "def play_game():\n pass", "def play_game():\n\n _initial_deal()\n\n main_window.mainloop()", "def GAMEOVER_LOOP():\n ...
[ "0.73572654", "0.71851116", "0.7171762", "0.71476305", "0.70981914", "0.7089904", "0.70830375", "0.7030875", "0.6965971", "0.6901151", "0.6791792", "0.6775212", "0.67203623", "0.67143553", "0.6714", "0.66939676", "0.6681823", "0.6675617", "0.66722625", "0.66714734", "0.662073...
0.7252437
1
Return True if bot was able to actually send private message
def send_private_message(bot, user_id, text): try: __actual_send_message(bot=bot, chat_id=user_id, text=text) return True except TelegramError as e: if e.message == "Unauthorized": return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allow_sudo(message):\n if message.author.id == Guard.AUTHOR and message.channel.type == discord.ChannelType.private:\n return True\n if message.author.id in Guard.SUDO_IDS and message.channel.id in Guard.SUDO_CHANNELS:\n return True\n return False", "def can_send(se...
[ "0.69425625", "0.6856079", "0.6826255", "0.6720108", "0.6696828", "0.66692317", "0.6608927", "0.6549641", "0.6446773", "0.6336873", "0.63162243", "0.62268645", "0.61660624", "0.61466724", "0.612538", "0.6072842", "0.607221", "0.60678214", "0.6051874", "0.60329306", "0.6015381...
0.73651165
0
Return True if bot was able to actually send private photo
def send_private_photo(bot, user_id, url, caption): # Truncate caption if it's too long... if len(caption) >= telegram.constants.MAX_CAPTION_LENGTH: token = "[...]" caption = caption[:-len(token)] + token try: bot.sendPhoto(user_id, photo=url, caption=caption) return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def media_image_remotely_accessible(self) -> bool:\n return True", "def send_private_link(bot, user_id, url):\n try:\n __actual_send_message(bot=bot, chat_id=user_id, text=url + \" \")\n return True\n except Unauthorized:\n return False\n except TelegramError as e:\n #...
[ "0.69891006", "0.63934034", "0.6243591", "0.62283254", "0.60614157", "0.60280484", "0.59461737", "0.5909658", "0.58902806", "0.5760746", "0.574469", "0.57446885", "0.57138896", "0.5699035", "0.5682138", "0.56351286", "0.56053644", "0.5594147", "0.5589981", "0.5575158", "0.556...
0.73184806
0
Find input channels of the yolo model from layer configs.
def get_c(layer_configs): net_config = layer_configs['000_net'] return net_config.get('channels', 3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_channels(self, input_channels):\n return input_channels", "def infer_channels(inputs, transpose=False):\n out_type = infer_type(inputs)\n out_shapes = [get_const_tuple(out_type.checked_type.shape)]\n channels = out_shapes[0][0] if not transpose else out_shapes[0][1]\n return channel...
[ "0.58312744", "0.5742968", "0.56544346", "0.5654426", "0.5552283", "0.54746956", "0.5446388", "0.5428018", "0.5343479", "0.5341048", "0.53252137", "0.53120375", "0.52911556", "0.5288412", "0.5281511", "0.52737856", "0.527295", "0.52729017", "0.5260956", "0.52438396", "0.52409...
0.63726634
0
Set network input batch size. The ONNX file might have been generated with a different batch size, say, 64.
def set_net_batch(network, batch_size): if trt.__version__[0] >= '7': shape = list(network.get_input(0).shape) shape[0] = batch_size network.get_input(0).shape = shape return network
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_batch_size(self, batch_size):\n self.batch_size = batch_size\n self.n_batch = math.ceil(self.n_samples / batch_size)", "def set_batch_size(self, batch_size):\n self.batch_size = batch_size", "def batch_size(self, batch_size: ConfigNodePropertyInteger):\n\n self._batch_size =...
[ "0.7431989", "0.7298853", "0.7241127", "0.69462866", "0.6937012", "0.67112094", "0.6516663", "0.64337176", "0.6352927", "0.6261257", "0.6261257", "0.6261257", "0.6261257", "0.6261257", "0.62382287", "0.61667866", "0.6156479", "0.6126977", "0.60776895", "0.60061693", "0.600216...
0.78923297
0
Measures angle between points u, v and w in positive or negative direction
def _angle(u, v, w, d='+'): vu = np.arctan2(u[1] - v[1], u[0] - v[0]) vw = np.arctan2(w[1] - v[1], w[0] - v[0]) phi = vw - vu if phi < 0: phi += 2 * np.pi if d == '-': phi = 2 * np.pi - phi return np.round(phi, 6)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle(v,w):\n cosx = dot_product(v,w) / (length(v) * length(w))\n #det = determinant(A,B)\n rad = math.acos(cosx) # in radians\n return rad\n #return rad*180/math.pi # returns degrees", "def signed_angle(self, u, v):\n return atan2(u.x * v.y - u.y * v.x, u.x * v.x + u.y * v.y)", "def ...
[ "0.79517096", "0.7312548", "0.7312548", "0.72500753", "0.7232059", "0.7214304", "0.712939", "0.71266484", "0.7106797", "0.70677173", "0.7058549", "0.70381576", "0.70160705", "0.69562507", "0.69332904", "0.6918083", "0.6891398", "0.68336743", "0.6822264", "0.6813132", "0.68025...
0.8139179
0
Constructs optimal polygon and returns pivot points. Based on 'An Optimal Algorithm for Approximating a. Piecewise Linear Function. HIROSHI IMAI and MASAO Iri.'
def optimal_polygon(y, w=0.5, debug=False): # Make sure that we use numpy array y = np.array(y) x = np.arange(len(y)) # Initialization y = np.round(y, 6) p_plus = (x[0], y[0] + w) l_plus = (x[0], y[0] + w) r_plus = (x[1], y[1] + w) s_plus = {(x[0], y[0] + w): (x[1], y[1] + w)} t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AH_polytope_vertices(P,N=200,epsilon=0.001,solver=\"Gurobi\"):\n try:\n P.vertices_2D\n if type(P.vertices_2D) == type(None):\n raise Exception\n except:\n Q=pp.to_AH_polytope(P)\n v=np.empty((N,2))\n prog=MP.MathematicalProgram()\n zeta=prog.NewContin...
[ "0.57646203", "0.5670267", "0.5659422", "0.5649031", "0.5645295", "0.5642635", "0.5558218", "0.5536285", "0.5507396", "0.5487818", "0.548102", "0.54647756", "0.54523736", "0.54472464", "0.5441451", "0.5440161", "0.54328644", "0.54283845", "0.54261845", "0.540085", "0.538319",...
0.64187914
0
Initializes the model with weights and bias Conv layers get random weights from a normal distribution and bias is set to 0
def _initialize_weights(self): for m in self.modules(): if isinstance(m, nn.Conv2d): m.weight.data.normal_(0, 0.05) if m.bias is not None: m.bias.data.zero_()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weights_init(model):\n classname = model.__class__.__name__\n if classname.find('Conv') != -1:\n nn.init.normal_(model.weight.data, 0.0, 0.02)\n elif classname.find('BatchNorm') != -1:\n nn.init.normal_(model.weight.data, 1.0, 0.02)\n nn.init.constant_(model.bias.data, 0)", "def...
[ "0.7880966", "0.77078766", "0.76977557", "0.7682001", "0.7630087", "0.7623425", "0.7612172", "0.7602894", "0.7602894", "0.7602894", "0.75905013", "0.7564779", "0.7564779", "0.75269467", "0.7512145", "0.751193", "0.75105506", "0.75105506", "0.75105506", "0.7505411", "0.748072"...
0.7725655
1
Test that int coefficients list is the same as int args.
def test_polynomial_from_int_list_same_as_from_int_args(self): coeffs = list(range(10)) p1 = Polynomial(coeffs) p2 = Polynomial(*coeffs) self.assertEqual(p1, p2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_polynomial_from_complex_list_same_as_from_complex_args(self):\n coeffs = [1j, 2j, 3j, 4j, 5j]\n\n p1 = Polynomial(coeffs)\n p2 = Polynomial(*coeffs)\n\n self.assertEqual(p1, p2)", "def test_polynomial_from_float_list_same_as_from_float_args(self):\n coeffs = [1.0, 2.0,...
[ "0.6644739", "0.65174896", "0.63068694", "0.6154316", "0.6090756", "0.6005572", "0.5953733", "0.59250826", "0.58949125", "0.5890805", "0.58439744", "0.5775465", "0.56965137", "0.56900537", "0.56873983", "0.5670121", "0.5649684", "0.56389946", "0.5596872", "0.5583224", "0.5582...
0.7663754
0
Test that float coefficients list is the same as float args.
def test_polynomial_from_float_list_same_as_from_float_args(self): coeffs = [1.0, 2.0, 3.0, 4.0, 5.0] p1 = Polynomial(coeffs) p2 = Polynomial(*coeffs) self.assertEqual(p1, p2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_float():\n floatify = fields.FloatField().adapt\n\n for input, expect in [\n (1.1, 1.1),\n (11, 11.0),\n (int(5.7), 5)\n ]:\n assert floatify(input) == expect", "def test_float_single_precision(self):\n data = service_call.encode_call(\"foo\", 1. + 1e-8)\n ...
[ "0.6789111", "0.66062117", "0.6594493", "0.65153867", "0.6490171", "0.6432928", "0.6408931", "0.63205534", "0.621962", "0.62155515", "0.6156101", "0.6154042", "0.6144872", "0.6143194", "0.61035675", "0.609526", "0.6072951", "0.6066457", "0.60082364", "0.60078156", "0.5991443"...
0.7843906
0
Test that complex coefficients list is the same as complex args.
def test_polynomial_from_complex_list_same_as_from_complex_args(self): coeffs = [1j, 2j, 3j, 4j, 5j] p1 = Polynomial(coeffs) p2 = Polynomial(*coeffs) self.assertEqual(p1, p2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_coefficients(self):\n\n coefs = self.cs.coefficients\n\n self.assertEqual(coefs, (1, 0, 1, 0, 0, -1))", "def complex_check(*args, func=None):\n func = func or inspect.stack()[2][3]\n for var in args:\n if not isinstance(var, numbers.Complex):\n name = type(var).__na...
[ "0.64052147", "0.63521355", "0.63007945", "0.62753785", "0.6151941", "0.61271626", "0.61183167", "0.61162865", "0.611375", "0.61096394", "0.6094857", "0.6062941", "0.6048559", "0.60343206", "0.5961963", "0.589964", "0.58850867", "0.58730483", "0.5854286", "0.583472", "0.58049...
0.76808316
0
Test that char coefficients list is the same as string args.
def test_polynomial_from_string_the_same_as_string_args(self): coeffs = "abcdefghijklmnopqrstuvwxyz" p1 = Polynomial(coeffs) p2 = Polynomial(*coeffs) self.assertEqual(p1, p2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_polynomial_from_complex_list_same_as_from_complex_args(self):\n coeffs = [1j, 2j, 3j, 4j, 5j]\n\n p1 = Polynomial(coeffs)\n p2 = Polynomial(*coeffs)\n\n self.assertEqual(p1, p2)", "def test_polynomial_from_float_list_same_as_from_float_args(self):\n coeffs = [1.0, 2.0,...
[ "0.6426459", "0.62890345", "0.61752516", "0.57198757", "0.5683991", "0.56493175", "0.55491936", "0.5545193", "0.5514456", "0.54702836", "0.5439413", "0.5420576", "0.5401311", "0.5392905", "0.5379616", "0.5357651", "0.534969", "0.53487754", "0.5347308", "0.53468424", "0.532293...
0.70586073
0
Test that the default Monomial is 'x'.
def test_default_monomial_is_x(self): m = Monomial() expect = Monomial(1, 1) self.assertEqual(repr(expect), repr(m)) self.assertEqual(str(expect), str(m)) self.assertEqual(expect, m)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binomial_default_init(self):\n expected = Polynomial(1, 1, 0)\n\n b = Binomial()\n\n self.assertEqual(expected, b)", "def test_binomial(self):\n with Model() as model:\n Binomial('x', 10, 0.5)\n steps = assign_step_methods(model, [])\n assert isin...
[ "0.6709728", "0.6651543", "0.6318743", "0.6294019", "0.6075693", "0.6065729", "0.59952956", "0.597316", "0.5902657", "0.5834677", "0.57665014", "0.5745749", "0.57422376", "0.5699372", "0.5690261", "0.5690261", "0.56779015", "0.5614231", "0.5602316", "0.5587988", "0.55691445",...
0.82594764
0
Test that the default Constant is '1'.
def test_default_constant_is_one(self): c = Constant() expect = Constant(1) self.assertEqual(expect, c)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constant(_):\n return 1.", "def test_default(self):\r\n self.assertEqual(self.option.default, 1234)", "def test_constant(x):\n return 18 * x", "def test_const(self):\n\n constvar = const(232)\n for x in constvar.sample(1000):\n self.assertEqual(x, 232)", "def test_...
[ "0.687723", "0.6777304", "0.6772265", "0.66257215", "0.6550163", "0.6449326", "0.64484346", "0.64447016", "0.6430842", "0.6398146", "0.63644564", "0.63301975", "0.6204521", "0.6198143", "0.6190211", "0.61711526", "0.6158516", "0.61557084", "0.61342233", "0.61279845", "0.60566...
0.8484716
0
Test that a binomial is successfully initialized from monomials.
def test_binomial_init_from_monomials(self): m1 = Monomial(3, 3) m2 = Monomial(4, 4) t1 = (3, 3) t2 = (4, 4) expected = Polynomial([m1, m2], from_monomials=True) b1 = Binomial(m1, m2) b2 = Binomial(t1, t2) self.assertEqual(expected, b1) self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binomial_default_init(self):\n expected = Polynomial(1, 1, 0)\n\n b = Binomial()\n\n self.assertEqual(expected, b)", "def test_linear_binomial_init(self):\n a, b = 6, 9\n expected = Polynomial(a, b)\n\n lb = LinearBinomial(a, b)\n\n self.assertEqual(expec...
[ "0.77222264", "0.7684172", "0.75849617", "0.73196894", "0.70824516", "0.68907064", "0.67966276", "0.6383654", "0.6381743", "0.6369938", "0.62478167", "0.6190149", "0.6160251", "0.61240447", "0.61185217", "0.6089801", "0.6064514", "0.6060454", "0.60261905", "0.6021926", "0.599...
0.8368487
0
Test that the default binomial is 'x^2 + x'.
def test_binomial_default_init(self): expected = Polynomial(1, 1, 0) b = Binomial() self.assertEqual(expected, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_binomial(self):\r\n # Check over two calls to see if the random state is correctly updated.\r\n rng_R = random_state_type()\r\n # Use non-default parameters, and larger dimensions because of\r\n # the integer nature of the result\r\n post_r, bin = binomial(rng_R, (7, 12)...
[ "0.71698135", "0.7143859", "0.7033473", "0.699451", "0.67489547", "0.64821094", "0.6462715", "0.6461001", "0.6435561", "0.64303493", "0.6430253", "0.6393817", "0.63917583", "0.6366536", "0.63607436", "0.62750036", "0.623247", "0.62285364", "0.6214193", "0.61374", "0.6132766",...
0.73975796
0
Test that a linear binomial is successfully initialized.
def test_linear_binomial_init(self): a, b = 6, 9 expected = Polynomial(a, b) lb = LinearBinomial(a, b) self.assertEqual(expected, lb)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_linear_binomial_default_init(self):\n expected = Polynomial(1, 1)\n\n b = LinearBinomial()\n\n self.assertEqual(expected, b)", "def test_binomial_default_init(self):\n expected = Polynomial(1, 1, 0)\n\n b = Binomial()\n\n self.assertEqual(expected, b)", "def t...
[ "0.811033", "0.77347654", "0.7542717", "0.73373723", "0.71329874", "0.68804437", "0.63971347", "0.6260769", "0.61828727", "0.6143738", "0.6031708", "0.6009319", "0.59835136", "0.5914772", "0.5914414", "0.5891909", "0.5872258", "0.58556885", "0.58434486", "0.5841006", "0.58192...
0.86035264
0
Test that the default linear binomial is 'x + 1'.
def test_linear_binomial_default_init(self): expected = Polynomial(1, 1) b = LinearBinomial() self.assertEqual(expected, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_linear_binomial_init(self):\n a, b = 6, 9\n expected = Polynomial(a, b)\n\n lb = LinearBinomial(a, b)\n\n self.assertEqual(expected, lb)", "def test_binomial_default_init(self):\n expected = Polynomial(1, 1, 0)\n\n b = Binomial()\n\n self.assertEqual(expe...
[ "0.7473286", "0.7114862", "0.7019656", "0.6945343", "0.6914386", "0.6560414", "0.65247864", "0.6313171", "0.63047546", "0.6264179", "0.6236071", "0.6144576", "0.6119696", "0.6113437", "0.60729533", "0.604535", "0.60433036", "0.5990155", "0.5965983", "0.592644", "0.58875066", ...
0.7432039
1
Test that a trinomial is successfully initialized from monomials.
def test_trinomial_init_from_monomials(self): m1 = Monomial(3, 3) m2 = Monomial(4, 4) m3 = Monomial(5, 5) expected = Polynomial([m1, m2, m3], from_monomials=True) t = Trinomial(m1, m2, m3) self.assertEqual(expected, t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_trinomial_default_init(self):\n expected = Polynomial(1, 1, 1, 0)\n\n t = Trinomial()\n\n self.assertEqual(expected, t)", "def test_binomial_init_from_monomials(self):\n m1 = Monomial(3, 3)\n m2 = Monomial(4, 4)\n t1 = (3, 3)\n t2 = (4, 4)\n expect...
[ "0.7607789", "0.70820785", "0.68559223", "0.6678353", "0.66027355", "0.65215725", "0.6508552", "0.6466536", "0.63836294", "0.6359102", "0.6238134", "0.6004065", "0.5979927", "0.59176403", "0.5879079", "0.58340746", "0.575583", "0.57349175", "0.5723228", "0.56603", "0.5614115"...
0.85773104
0
Test that the default trinomial is 'x^3 + x^2 + x'.
def test_trinomial_default_init(self): expected = Polynomial(1, 1, 1, 0) t = Trinomial() self.assertEqual(expected, t)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_trinomial_init_from_monomials(self):\n m1 = Monomial(3, 3)\n m2 = Monomial(4, 4)\n m3 = Monomial(5, 5)\n expected = Polynomial([m1, m2, m3], from_monomials=True)\n\n t = Trinomial(m1, m2, m3)\n\n self.assertEqual(expected, t)", "def test_quadratic_trinomial_init...
[ "0.7251187", "0.6777519", "0.66679484", "0.61904955", "0.5993573", "0.5939095", "0.59343827", "0.5921262", "0.5867161", "0.5856125", "0.5820007", "0.5761722", "0.57567984", "0.5751864", "0.5721351", "0.5682329", "0.55713683", "0.55346286", "0.54696476", "0.54348075", "0.54323...
0.7325828
0
Test that a quadratic trinomial is successfully initialized.
def test_quadratic_trinomial_init(self): a, b, c = 2, 3, 4 expected = Polynomial(a, b, c) qt = QuadraticTrinomial(a, b, c) self.assertEqual(expected, qt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_quadratic_trinomial_default_init(self):\n expected = Polynomial(1, 1, 1)\n\n qt = QuadraticTrinomial()\n\n self.assertEqual(expected, qt)", "def test_trinomial_default_init(self):\n expected = Polynomial(1, 1, 1, 0)\n\n t = Trinomial()\n\n self.assertEqual(expec...
[ "0.82322776", "0.74678355", "0.7265662", "0.70847714", "0.69415426", "0.6507963", "0.61808145", "0.61517614", "0.59596646", "0.5930612", "0.58924574", "0.58751446", "0.58665466", "0.58505654", "0.5826098", "0.5792503", "0.5769304", "0.5746371", "0.57374394", "0.5714344", "0.5...
0.87185836
0
Test that the default quadratic trinomial is 'x^2 + x + 1'.
def test_quadratic_trinomial_default_init(self): expected = Polynomial(1, 1, 1) qt = QuadraticTrinomial() self.assertEqual(expected, qt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_quadratic_trinomial_init(self):\n a, b, c = 2, 3, 4\n expected = Polynomial(a, b, c)\n\n qt = QuadraticTrinomial(a, b, c)\n\n self.assertEqual(expected, qt)", "def test_trinomial_default_init(self):\n expected = Polynomial(1, 1, 1, 0)\n\n t = Trinomial()\n\n ...
[ "0.7804595", "0.69539523", "0.6805754", "0.64076424", "0.6281322", "0.61109155", "0.6068319", "0.5887185", "0.58835185", "0.58297175", "0.574804", "0.56945467", "0.5653709", "0.5635208", "0.55781317", "0.5573634", "0.5558299", "0.5552016", "0.55515176", "0.5544936", "0.553825...
0.7712339
1
Test that LinearBinomial(0, ?) raises a ValueError.
def test_linear_binomial_fails_leading_zero(self): self.assertRaises(ValueError, LinearBinomial, 0, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_monomial_degree_positive_int(self):\n self.assertRaises(ValueError, Monomial, 1, -1)\n self.assertRaises(ValueError, Monomial, 1, 1.2)", "def test_quadratic_trinomial_fails_leading_zero(self):\n self.assertRaises(ValueError, QuadraticTrinomial, 0, 1)", "def test_linear_binomial_in...
[ "0.72467434", "0.6912627", "0.6889316", "0.6815802", "0.6526083", "0.64662707", "0.64544886", "0.64476573", "0.62807524", "0.6230934", "0.6198869", "0.61734957", "0.6163279", "0.6097373", "0.60639113", "0.60281086", "0.6027279", "0.60225606", "0.6016836", "0.60164136", "0.601...
0.881032
0
Test that QuadraticTrinomial(0, ?) raises a ValueError.
def test_quadratic_trinomial_fails_leading_zero(self): self.assertRaises(ValueError, QuadraticTrinomial, 0, 1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_quadratic_trinomial_init(self):\n a, b, c = 2, 3, 4\n expected = Polynomial(a, b, c)\n\n qt = QuadraticTrinomial(a, b, c)\n\n self.assertEqual(expected, qt)", "def test_quadratic_trinomial_default_init(self):\n expected = Polynomial(1, 1, 1)\n\n qt = QuadraticTr...
[ "0.7169448", "0.6849368", "0.6651373", "0.6453824", "0.6274508", "0.6258277", "0.62512386", "0.6169402", "0.6141827", "0.6130322", "0.612695", "0.6112168", "0.6083564", "0.60681117", "0.60681117", "0.60443914", "0.6040365", "0.599971", "0.599907", "0.59918", "0.59833556", "...
0.88411075
0
Test that monomial only accepts a positive int.
def test_monomial_degree_positive_int(self): self.assertRaises(ValueError, Monomial, 1, -1) self.assertRaises(ValueError, Monomial, 1, 1.2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_linear_binomial_fails_leading_zero(self):\n self.assertRaises(ValueError, LinearBinomial, 0, 1)", "def assert_positive(x):\n \n assert(all(x) >= 0)", "def _is_non_negative_int(item):\n if not isinstance(item, int):\n return False\n return item >= 0", "def one_positive(self)...
[ "0.64496636", "0.64230645", "0.6393725", "0.6347339", "0.63327885", "0.6302501", "0.6286961", "0.62112695", "0.6187927", "0.6166724", "0.6150532", "0.6146198", "0.608574", "0.6075579", "0.60420036", "0.60391825", "0.6016536", "0.6016526", "0.6011341", "0.60089564", "0.5978152...
0.76611537
0
Test that Polynomial from monomials with > 2 tuples fails.
def test_polynomial_with_non_monomial_terms(self): self.assertRaises( TypeError, Polynomial, [(1, 2, 3)], from_monomials=True )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test():\n assert str(Polynomial(0, 1, 0, -1, 4, -2, 0, 1, 3, 0)) == \"3x^8 + x^7 - 2x^5 + 4x^4 - x^3 + x\"\n assert str(Polynomial([-5, 1, 0, -1, 4, -2, 0, 1, 3, 0])) == \"3x^8 + x^7 - 2x^5 + 4x^4 - x^3 + x - 5\"\n assert str(Polynomial(x7=1, x4=4, x8=3, x9=0, x0=0, x5=-2, x3=-1, x1=1)) == \"3x^8 + x^...
[ "0.6752848", "0.66205114", "0.6448485", "0.6309701", "0.619733", "0.6101042", "0.6054037", "0.60104465", "0.59679574", "0.59433794", "0.591065", "0.59005946", "0.58211356", "0.5815051", "0.5810266", "0.5763252", "0.57513654", "0.5706983", "0.5669737", "0.5645254", "0.56404215...
0.7779006
0
Returns True if word[i] is a consonant, False otherwise
def _is_consonant(self, word, i): if word[i] in self.vowels: return False if word[i] == "y": if i == 0: return True else: return not self._is_consonant(word, i - 1) return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_consonant(text):\n return text.lower() in AVRO_CONSONANTS", "def is_consonant(x):\n if is_vowel(x) == True:\n return False\n elif len(x) > 1 or type(x) == int:\n return False", "def basic_check(word):\n if word[-1] == \"b\" or word[-1] == \"g\":\n return False\n conso...
[ "0.756881", "0.7266516", "0.70983154", "0.66584325", "0.64638054", "0.63225394", "0.63023937", "0.6296", "0.606454", "0.6029257", "0.5995777", "0.59618133", "0.58478487", "0.5808676", "0.57903886", "0.5783822", "0.5721623", "0.56929076", "0.5665967", "0.5625816", "0.55507475"...
0.87187904
0
r"""Returns the 'measure' of stem, per definition in the paper
def _measure(self, stem): cv_sequence = "" # Construct a string of 'c's and 'v's representing whether each # character in `stem` is a consonant or a vowel. # e.g. 'falafel' becomes 'cvcvcvc', # 'architecture' becomes 'vcccvcvccvcv' for i in range(len(stem)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStem(self,):\n\t\treturn self.stem;", "def stem(self) -> str:", "def stemWord(self,word):\n if(\"stem\" in self._classes):\n return self._stem.stemmingWord(word)", "def stem(s):\r\n if len(s) < 5 :\r\n return s\r\n \r\n if s[-3:] == 'ing':\r\n if s[-4] == s[-5]...
[ "0.71413904", "0.6885746", "0.6649694", "0.65597755", "0.64486533", "0.6432257", "0.63764393", "0.6274381", "0.6102599", "0.60810894", "0.6079473", "0.6050913", "0.5986306", "0.5979911", "0.5979911", "0.5920591", "0.5897531", "0.58566743", "0.58331126", "0.58018064", "0.57997...
0.725565
0
Returns True if stem contains a vowel, else False
def _contains_vowel(self, stem): for i in range(len(stem)): if not self._is_consonant(stem, i): return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_vowel(text):\n return text.lower() in AVRO_VOWELS", "def is_vowel(self, letter):\n\n if letter in (\"a\", \"e\", \"i\", \"o\", \"u\", \"A\", \"E\", \"I\", \"O\", \"U\"):\n return True\n return False", "def isvowel(phone, semivowels=True):\n if semivowels:\n return (...
[ "0.774371", "0.7515274", "0.71859574", "0.71172595", "0.7006897", "0.6654589", "0.6616312", "0.6613333", "0.65657127", "0.6405958", "0.62813777", "0.6215642", "0.62133026", "0.6119609", "0.6114145", "0.61074984", "0.60806847", "0.60606885", "0.6021445", "0.6012325", "0.600550...
0.8641102
0
Implements condition d from the paper Returns True if word ends with a double consonant
def _ends_double_consonant(self, word): return ( len(word) >= 2 and word[-1] == word[-2] and self._is_consonant(word, len(word) - 1) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ends_cvc(self, word):\n return (\n len(word) >= 3\n and self._is_consonant(word, len(word) - 3)\n and not self._is_consonant(word, len(word) - 2)\n and self._is_consonant(word, len(word) - 1)\n and word[-1] not in (\"w\", \"x\", \"y\")\n ) o...
[ "0.7559633", "0.71442723", "0.70636475", "0.68884534", "0.68107796", "0.64119506", "0.6324027", "0.63016343", "0.62774265", "0.6181726", "0.6108568", "0.5940099", "0.59349805", "0.5891619", "0.58743113", "0.5873399", "0.58639944", "0.58625084", "0.583633", "0.57959324", "0.57...
0.86897075
0
Replaces `suffix` of `word` with `replacement
def _replace_suffix(self, word, suffix, replacement): assert word.endswith(suffix), "Given word doesn't end with given suffix" if suffix == "": return word + replacement else: return word[: -len(suffix)] + replacement
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_suffix(word, suffix):\n suffix, sep, rest = suffix.partition(' ')\n expanded = _add_suffix(word, suffix)\n return expanded + sep + rest", "def suffix_replace(original, old, new):\n ...", "def replace_suffix (name, new_suffix):\n assert isinstance(name, basestring)\n assert isinstance(...
[ "0.7701713", "0.7665795", "0.66624486", "0.64749455", "0.63054746", "0.6149442", "0.61022633", "0.6039127", "0.6027953", "0.6017234", "0.59906757", "0.59685665", "0.5966546", "0.5966546", "0.5966546", "0.5966546", "0.5965606", "0.5955456", "0.59381366", "0.59128815", "0.58945...
0.89509475
0
Applies the first applicable suffixremoval rule to the word Takes a word and a list of suffixremoval rules represented as 3tuples, with the first element being the suffix to remove, the second element being the string to replace it with, and the final element being the condition for the rule to be applicable, or None i...
def _apply_rule_list(self, word, rules): for rule in rules: suffix, replacement, condition = rule if suffix == "*d" and self._ends_double_consonant(word): stem = word[:-2] if condition is None or condition(stem): return stem + replaceme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_rule(word):\n return re.sub(search, replace, word)", "def word_clean(self, word):\n word_ori = word\n if word not in self.vocab_list: # if the word is not in the vocabulary\n word = word.strip(\",.!?\") # delete punctuation, such as periods, commas\n for i in ra...
[ "0.6241091", "0.6044743", "0.58442014", "0.56673056", "0.5549546", "0.55156666", "0.5505275", "0.53335893", "0.53203624", "0.52443767", "0.5229112", "0.52215064", "0.5208779", "0.51806766", "0.51736385", "0.5163402", "0.51501673", "0.51331615", "0.5123183", "0.5071901", "0.50...
0.68673265
0
A demonstration of the porter stemmer on a sample from the Penn Treebank corpus.
def demo(): from nltk import stem from nltk.corpus import treebank stemmer = stem.PorterStemmer() orig = [] stemmed = [] for item in treebank.fileids()[:3]: for (word, tag) in treebank.tagged_words(item): orig.append(word) stemmed.append(stemmer.stem(word)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stemming():\n normalizer = TextNormalizer(stem=True, lemmatize=False)\n assert normalizer.transform([[\"running\"]])[\"corpus\"][0] == [\"run\"]", "def stemming(self,sentence):", "def stemming(data):\n stemmer = PorterStemmer()\n tokens = word_tokenize(str(data))\n new = \"\"\n for w...
[ "0.66189396", "0.60756886", "0.59906495", "0.5933146", "0.586991", "0.58544207", "0.579849", "0.5790065", "0.57402635", "0.57275397", "0.56813854", "0.56547403", "0.55455273", "0.55287206", "0.55226535", "0.547887", "0.545246", "0.541334", "0.53944755", "0.539182", "0.5376576...
0.73346746
0
Utility to make CompeteExperiment instance with HyperGBM.
def make_experiment(train_data, target=None, eval_data=None, test_data=None, task=None, id=None, callbacks=None, searcher=None, search_space=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_model(n_estimators=100, max_depth=3, learning_rate=0.1):\n n_estimators = int(n_estimators)\n max_depth = int(max_depth)\n\n xgb = XGBClassifier(\n max_depth=max_depth,\n n_estimators=n_estimators,\n learning_rate=learning_rate,\n n_jobs=4, # S...
[ "0.57217205", "0.54344875", "0.53623545", "0.5332581", "0.5328322", "0.5291525", "0.5282335", "0.5249221", "0.5209219", "0.519198", "0.51718086", "0.51625144", "0.5155", "0.5141992", "0.50965846", "0.5070264", "0.5041546", "0.5023969", "0.5018331", "0.50119567", "0.50007975",...
0.5751189
0
Add an Agent object to the schedule and logger.
def add(self, agent): self._agents[agent.unique_id] = agent self.logger.add(agent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(self, agent):\n self.agents.append(agent)", "def add_transport(self, agent):\n with self.simulation_mutex:\n self.get(\"transport_agents\")[agent.name] = agent", "def add_manager(self, agent):\n with self.simulation_mutex:\n self.get(\"manager_agents\")[age...
[ "0.70725477", "0.6694526", "0.64406854", "0.63798493", "0.62856185", "0.62606156", "0.614796", "0.60502934", "0.60470253", "0.58610034", "0.5816065", "0.5804319", "0.5753335", "0.57344615", "0.5694131", "0.56772673", "0.5663141", "0.5599108", "0.5599108", "0.55642706", "0.555...
0.7993833
0
Chooses pair of neighboring agents for interaction.
def choose(self): # pick agent A keys = list(self._agents.keys()) keyA = random.choice(keys) agentA = self.model.schedule.agents[keyA] # pick pick agent B keyB = random.choice(agentA.neighbors) agentB = self.model.schedule.agents[keyB] return agentA, age...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getNeighbors(self, current: MstarNode):\n neighbors = []\n options = []\n # Loop over all the agents\n for i in range(self.n_agents):\n node: Node = current.nodes[i]\n options_i = []\n if i in current.collision_set:\n # If the agent in...
[ "0.6246131", "0.6160659", "0.6013721", "0.5978769", "0.59235823", "0.59171003", "0.5906191", "0.58011556", "0.5798789", "0.5789229", "0.5733525", "0.57054895", "0.5646919", "0.563309", "0.5606196", "0.55937165", "0.5591221", "0.55759096", "0.5569078", "0.5550985", "0.55452394...
0.6392958
0
Increments the timer for all agents, then lets one pair of agents interact.
def step(self): #_increment timers for agent in self.agents: agent.tick() # choose agent pair agentA, agentB = self.choose() # interact agentA.step(agentB) agentB.step(agentA) # log results self.logger.log(agentA, agentB) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_one_step(self):\n\t\tfor i in range(len(self.agents)):\n\t\t\tself.agents[i].action(0)", "def _advance_by_action(game, agents, action):\n getLogger(__name__).debug(\"Agent {} action {}\".format(game.current_agent_id, action))\n agent_id_for_action = game.current_agent_id\n\n game.ta...
[ "0.65375125", "0.6455464", "0.64317334", "0.6098815", "0.6074385", "0.60499936", "0.59659934", "0.58917546", "0.58917546", "0.58714443", "0.5799771", "0.57929397", "0.5773467", "0.5762189", "0.57041514", "0.56671137", "0.566299", "0.5604475", "0.5582845", "0.5573922", "0.5562...
0.7061951
0
Characterlevel segmentation for Korean and Japanese
def segment(text: str) -> str: import regex # Chinese text = regex.sub(r"(\p{Han})", r" \1 ", text) # Korean text = regex.sub(r"(\p{Hangul})", r" \1 ", text) # Japenese text = regex.sub(r"(\p{Hiragana})", r" \1 ", text) text = regex.sub(r"(\p{Katakana})", r" \1 ", text) text = text...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uCSIsKatakanaPhoneticExtensions(code):\n ret = libxml2mod.xmlUCSIsKatakanaPhoneticExtensions(code)\n return ret", "def phoc_levels(word: str, levels=DEFAULT_PHOC_LEVELS):\n if levels <= 1:\n return [word]\n # cut_len = float(len(word)) / float(levels)\n # # length of cuts\n # regions...
[ "0.5655067", "0.53225625", "0.5267243", "0.52642506", "0.5255642", "0.52491516", "0.52491516", "0.52444214", "0.5241108", "0.5239331", "0.5196398", "0.5184633", "0.51652074", "0.5114331", "0.5098518", "0.505684", "0.50446427", "0.50386804", "0.5029255", "0.4988901", "0.498705...
0.54035604
1
This reads a file in the shared task format, returns a list of Tuples containing ID and text for each prompt.
def read_trans_prompts(lines: List[str], lowercase=True) -> List[Tuple[str,str]]: ids_prompts = [] first = True for line in lines: if lowercase: line = line.strip().lower() else: line = line.strip() # in a group, the first one is the KEY. # all other...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_prompt_file(prompt_file):\n with io.open(prompt_file, mode=\"r\", encoding='utf-8', errors='ignore') as prompt_f:\n return [prompt_f.readline().rstrip(),\n prompt_f.readline().rstrip()]", "def read_shared_secrets_from_file(f):\n shares = []\n words = []\n for line in f...
[ "0.64376706", "0.60924566", "0.58151025", "0.57231516", "0.5679147", "0.56595516", "0.55473155", "0.55078036", "0.5376893", "0.53262085", "0.528849", "0.52704746", "0.52672356", "0.5224767", "0.51990306", "0.5157543", "0.5151916", "0.50994694", "0.5096022", "0.5082734", "0.50...
0.61813223
1
Set HTTP Adapter with retries to session.
def get_session_retry(self, retries=3, backoff_factor=0.2, status_forcelist=(404, 500, 502, 504), session=None): session = session or requests.Session() retry = Retry(total=retries, read=retries, connect=retries, backoff_factor=ba...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n retries=3,\n backoff_factor=0.3,\n status_forcelist=(500, 502, 504),\n **session_options,\n ):\n super().__init__(**session_options)\n retries = retries or 0\n\n self.retry_ = Retry(\n total=retries,\n read=ret...
[ "0.68190426", "0.656107", "0.65234107", "0.6376474", "0.63384855", "0.6149356", "0.60859877", "0.59891427", "0.5915869", "0.5900037", "0.56298727", "0.56103295", "0.54669577", "0.5369005", "0.53306866", "0.53249484", "0.52559197", "0.52061677", "0.520381", "0.51781654", "0.51...
0.6642945
1
Execute the gremlin query and return the response.
def execute_gremlin_dsl(self, payloads): url = "http://{host}:{port}".format( host=os.environ.get("BAYESIAN_GREMLIN_HTTPINGESTION_SERVICE_HOST", "localhost"), port=os.environ.get("BAYESIAN_GREMLIN_HTTPINGESTION_SERVICE_PORT", "8181")) try: payload = json.dumps(payload...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gremlin_action(token, query):\n http = urllib3.PoolManager(\n cert_reqs=\"CERT_REQUIRED\", ca_certs=certifi.where())\n # Headers are how we pass through the token.\n headers = {\"Content-Type\": \"application/json\"}\n headers[\"X-Language\"] = \"en-us\"\n headers[\"X-Auth-Token\"] = toke...
[ "0.6971977", "0.68545705", "0.68396306", "0.648774", "0.64229923", "0.6413053", "0.62823623", "0.6230398", "0.6107883", "0.60947967", "0.5950436", "0.5908044", "0.5868579", "0.58055663", "0.5708583", "0.57053006", "0.5696164", "0.5694277", "0.5672222", "0.56569475", "0.564822...
0.69799536
0
Return True if this is a dry run.
def is_dry_run(self): # Set this value to true if you want the entire operation to run, but not the ingestion. return os.environ.get('SNYK_DRY_RUN', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_dry_run(self):\n try:\n v = environment.get(\"Run\")\n return v.lower() == \"dry\"\n except KeyError:\n return False", "def dry_run(self) -> pulumi.Output[Optional[bool]]:\n return pulumi.get(self, \"dry_run\")", "def dry_run(self) -> Optional[pulumi...
[ "0.8660792", "0.82843524", "0.82415134", "0.82415134", "0.8056295", "0.7909113", "0.730728", "0.6988308", "0.6706155", "0.66460574", "0.6559852", "0.6550512", "0.64727366", "0.63530636", "0.5957344", "0.5942371", "0.59420216", "0.59149176", "0.59052384", "0.5902616", "0.58874...
0.85207754
1
Return if the delta feed mode is on.
def is_delta_mode_on(self): # Set this value if you want to run only in the diff mode. return os.environ.get('SNYK_DELTA_FEED_MODE', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ison(self):\n return self.dp.state()==PyTango.DevState.ON", "def is_on(self) -> bool:\n return self._zone.data[\"mode\"] == \"override\" and self._zone.data[\"setpoint\"]", "def is_on(self) -> bool:\n return FILTER_STATES[self._client.get_filtermode()][self._num - 1]", "def is_on(se...
[ "0.6230149", "0.6208264", "0.6136685", "0.6106795", "0.6106457", "0.6106457", "0.60758084", "0.60681146", "0.60662746", "0.6063778", "0.604218", "0.59849477", "0.5979635", "0.5978799", "0.5973308", "0.5969429", "0.5938515", "0.5930815", "0.5930815", "0.5930815", "0.5930815", ...
0.8524334
0
Return the time when ingestion needs to run.
def ingestion_run_time(self): # Set the time at which you want the ingestion to run. return os.environ.get('SNYK_INGESTION_RUN_TIME', '12')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingestion_wait_time_in_hours(self) -> Optional[pulumi.Input[float]]:\n return pulumi.get(self, \"ingestion_wait_time_in_hours\")", "def start_time(self) -> float:\r\n ...", "def service_time(self):\r\n #print self.node_monitor_address, self.completion_time - self.node_monitor_launch_ti...
[ "0.69690937", "0.69186443", "0.6906455", "0.6879325", "0.6821513", "0.6761177", "0.66448617", "0.6634086", "0.6615956", "0.6614802", "0.6607203", "0.65681905", "0.65531886", "0.6520282", "0.6514328", "0.65097094", "0.6507765", "0.6504433", "0.6477959", "0.64634866", "0.645584...
0.8267049
0
Disable the snyk retry mechanism.
def is_snyk_retry_disabled(self): # Set this value to false if you want to disable the snyk retry mechanism. return os.environ.get('DISABLE_SNYK_INGESTION_RETRY', 'false').lower() \ in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable(self):\n self.error_code = 'DISABLED'\n self.running = False", "async def disable_protection(self) -> None:\n await self._request(\n \"dns_config\", method=\"POST\", json_data={\"protection_enabled\": False},\n )", "def DisableSSLVerify():\n\n\t\ttry:\n\t\t\tr...
[ "0.6000706", "0.5844188", "0.5841717", "0.5768392", "0.5736762", "0.572624", "0.5550153", "0.549387", "0.5460173", "0.5440041", "0.54355603", "0.5414453", "0.54084843", "0.5406965", "0.5399749", "0.5397114", "0.53927726", "0.5373983", "0.53697103", "0.53442085", "0.52788645",...
0.7940704
0
Return if the vuln mode is on.
def is_vuln_mode_disabled(self): # Set this value if you want the vuln data to be collected in the S3 file. return os.environ.get('DISABLE_VULN_MODE', 'false').lower() in ('1', 'yes', 'true')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_on(self):\n return self._program.get(\"enabled\") is True", "def is_complete_vuln_mode(self):\n return os.environ.get('COMPLETE_VULN_MODE', 'false').lower() in ('1', 'yes', 'true')", "def is_production_mode(self):\n return getattr(self.env, 'mode', None) == 'production'", "def in_...
[ "0.66916114", "0.66532433", "0.6499631", "0.64198023", "0.6398497", "0.6380015", "0.6346437", "0.633201", "0.63165367", "0.63053477", "0.6267307", "0.6243341", "0.6215645", "0.62144536", "0.6212919", "0.61458015", "0.6141528", "0.61412394", "0.6140185", "0.6138267", "0.613293...
0.69225055
0
Version rules for all eco.
def get_version_rules(self, vuln_versions): rules = [] regex_op = "[0-9a-zA-Z\\_\\.\\-]+" regex_vr = "[<>=*]+" """For all the vulnerable versions information that we get, we need to create comparable version object so that we can apply these rules on top of all the available ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_version_rules(self, vuln_versions):\n rules = []\n regex_op = \"[0-9a-zA-Z\\\\_\\\\.\\\\-]+\"\n regex_vr = \"[<>=*]+\"\n \"\"\"For all the vulnerable versions information that we get, we need to create\n comparable version object so that we can apply these rules on top o...
[ "0.6523159", "0.58597827", "0.5845769", "0.5686846", "0.56596136", "0.56483513", "0.562279", "0.55700517", "0.54971206", "0.54971206", "0.5484082", "0.5454093", "0.54378396", "0.540083", "0.53580415", "0.53335285", "0.53335285", "0.53335285", "0.53164405", "0.52835464", "0.52...
0.6416711
1
Create and return a GaussianMixturemodel
def create_model() -> sklearn.mixture.GaussianMixture: logger.info("Creating Gaussian Mixture model") logger.debug( f"Model: GaussianMixture, n_components={data.N_CENTERS}, " + f"covariance_type={COVARIANCE_TYPE}, n_init={N_INIT}, " + f"init_params={INIT_PARAMS}" ) return Gaussia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_and_score_model(\n dataset: np.ndarray\n ) -> Tuple[sklearn.mixture.GaussianMixture, float]:\n model = create_model()\n\n ### Fit model ###\n logger.info(\"Fitting GaussianMixture\")\n model.fit(dataset)\n\n ### Score model ###\n score = model.score(dataset)\n logger.info(f...
[ "0.6825591", "0.6740222", "0.63303256", "0.62117445", "0.6143393", "0.61378485", "0.60949916", "0.60790414", "0.6022479", "0.6014023", "0.59476495", "0.5921224", "0.58957887", "0.5848955", "0.58337665", "0.57924956", "0.5770359", "0.57569426", "0.57394385", "0.57371604", "0.5...
0.87502056
0
Train and score the GaussianMixture model on a given dataset
def train_and_score_model( dataset: np.ndarray ) -> Tuple[sklearn.mixture.GaussianMixture, float]: model = create_model() ### Fit model ### logger.info("Fitting GaussianMixture") model.fit(dataset) ### Score model ### score = model.score(dataset) logger.info(f"GaussianMixture t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, data):\n logger.debug(f'Start fitting GaussianMixtureModel to data of shape {data.shape}...')\n self.gm.fit(data)\n logger.debug(f'Finished fitting GMM')\n self.trained = True", "def train_sklearn(self, config, samples):\n samples = samples.numpy()\n tic = ...
[ "0.7335727", "0.72618", "0.6818932", "0.6561809", "0.650553", "0.6473688", "0.64249563", "0.6259185", "0.625536", "0.6238786", "0.62347734", "0.61418164", "0.6138435", "0.60889834", "0.60720587", "0.60679746", "0.59631103", "0.5959821", "0.5957271", "0.5933085", "0.5920184", ...
0.82078743
0
function reads multifasta files. func concatenates the multifasta by removing "\n" and placing header and sequence as dictionary keyvalue pair. Then returns one .txt file. It requires a directory path and list of files that it is to read.
def read_write_protein_files(dir_path, heme_files): for i in number_of_files: # seqs = {} input_files = (dir_path + heme_files[i]) f = open(input_files) count = 0 # output_file = (dir_path + heme_files[i] + ".txt") # g = open(output_file, "x") with open(input_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_single_to_multi(file_directory):\n all_files = os.listdir(file_directory)\n merged_file = ''\n for file_name in all_files:\n f_single = open(file_directory + '/' + file_name, \"r\")\n data = f_single.read() + '\\n'\n merged_file += data\n date = datetime.datetime.now()\...
[ "0.6466673", "0.6224968", "0.6202852", "0.6003082", "0.5994234", "0.59609765", "0.59053165", "0.5904318", "0.5888675", "0.58625764", "0.58328867", "0.5798885", "0.5784122", "0.5759367", "0.5748032", "0.57226527", "0.57212055", "0.56634516", "0.5660066", "0.56551105", "0.56358...
0.62385464
1
Multiple the image by a constant
def imageMult(img, num): return myimg.imageMult(img.tolist(), num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def montage(images, w_sub, h_sub, step):\n target = Image.new('RGB', (w_sub*step, h_sub*step))\n left = 0\n right = w_sub\n for i in range(len(images)):\n top=(i//step)*h_sub\n target.paste(images[i], (left, top, right, top+h_sub))\n if(i//step < (i+1)//step):#Check if this row is ...
[ "0.6567527", "0.6170886", "0.6098967", "0.6062209", "0.5806136", "0.57838523", "0.57131743", "0.5670568", "0.56413287", "0.5616585", "0.56058776", "0.56037444", "0.5578985", "0.5545909", "0.55414027", "0.55350053", "0.55265033", "0.5499199", "0.5499199", "0.54860795", "0.5482...
0.7266229
0
Add the image by a constant. Make sure the value in my image is from 0 to 1.
def imageAdd(img, num): return myimg.imageAdd(img.tolist(), num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imadd(img):\n\n img = img / 2 + 0.5 # unnormalize\n npimg = img\n plt.imshow(np.transpose(npimg, (1, 2, 0)))", "def iadd_scalar(self, other: float):\n self.set(self.gross + other)", "def add_image(self, image, mode='normal', state='on'):\n raise NotImplementedError", "def setFl...
[ "0.6338049", "0.62775636", "0.61424595", "0.593524", "0.5864383", "0.58004737", "0.57033044", "0.56935203", "0.5672427", "0.5662999", "0.5637787", "0.56332856", "0.5626585", "0.5619824", "0.56094503", "0.56069577", "0.5585251", "0.5574157", "0.55734354", "0.55632955", "0.5532...
0.67746663
0
Make average of two image pixelwisely.
def imageAvg(img1, img2): return myimg.imageAvg(img1.tolist(), img2.tolist())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(rgb1: Tuple[int, int, int], rgb2: Tuple[int, int, int]) \\\n -> Tuple[int, int, int]:\n r = int((rgb1[0] + rgb2[0] + 0.5) / 2)\n g = int((rgb1[1] + rgb2[1] + 0.5) / 2)\n b = int((rgb1[2] + rgb2[2] + 0.5) / 2)\n return r, g, b", "def mse(image1: np.ndarray, image2: np.ndarray) -> np...
[ "0.69791085", "0.66644293", "0.6427036", "0.6408773", "0.636635", "0.63357323", "0.6314909", "0.63091546", "0.6297116", "0.62811303", "0.62430894", "0.62086475", "0.61911947", "0.615902", "0.61560726", "0.6153513", "0.6151613", "0.61290014", "0.6123557", "0.6107312", "0.60888...
0.7687703
0
Return the maximum value of the array of `length` after performing all the `queries`.
def manipulate_array(length, queries): # T(n), S(n) # create the array of zeros of length `length + 1` array = [0] * (length + 1) # S(n) for query in queries: # T(n) start_index, end_index, value = query[0] - 1, query[1], query[2] # increment and decrement the `value` at the start and e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max_param(self):\r\n\r\n sql_str = \"SELECT jsonb_array_length(parameters) as length FROM alarm_condition\"\r\n\r\n param = self.postgres.query_fetch_all(sql_str)\r\n\r\n if param:\r\n\r\n max_param = max([p['length'] for p in param])\r\n else:\r\n\r\n max_...
[ "0.64757967", "0.6343356", "0.6298442", "0.6294446", "0.6255374", "0.61935925", "0.6157313", "0.61473566", "0.6019953", "0.5932734", "0.5894913", "0.5892807", "0.5889901", "0.5872064", "0.586058", "0.58542395", "0.58352023", "0.58348167", "0.5826967", "0.5784949", "0.57823586...
0.7263292
0
Infer by the tag key and value if its an App Engine job
def check_if_app_engine_job(tagkey, tagvalue): if (tagkey == '@app_engine_flex') and (':' in tagvalue): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job(self) -> Union[Dict[Text, Text], CustomJob]:\n pass", "def _record_job_tags(self, job: Job) -> None:\n assert job.task\n\n # Record value tags.\n for value_hash, tags in job.value_tags:\n self.backend.record_tags(\n entity_type=TagEntityType.Value, en...
[ "0.5651085", "0.5556177", "0.5173027", "0.5002312", "0.48833883", "0.47348303", "0.47078177", "0.46986645", "0.4690064", "0.46737456", "0.4657522", "0.46543372", "0.46482596", "0.46184155", "0.4590786", "0.4561573", "0.45330656", "0.45177123", "0.45121172", "0.45019776", "0.4...
0.5828052
0
Implementation of pigeon hole sort algorithm
def pigeon_sort(array): if len(array) == 0: return array # Manually finds the minimum and maximum of the array. min = array[0] max = array[0] for i in range(len(array)): if array[i] < min: min = array[i] elif array[i] > max: max = array[i] # Com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wiggleSort(self, nums):\n nums2=nums.copy()\n nums2.sort()\n n = len(nums)\n if n%2:\n midpoint = n//2\n else:\n midpoint = n//2-1\n j=n-1\n i=midpoint\n point=0\n while j > midpoint:\n nums[point] = nums2[i]\n ...
[ "0.69168335", "0.66820765", "0.66596377", "0.6648649", "0.66138065", "0.659795", "0.65944225", "0.6586554", "0.65688837", "0.65618044", "0.6554407", "0.6545642", "0.6505205", "0.64969915", "0.6456065", "0.6438882", "0.6438063", "0.6437484", "0.6426108", "0.6388984", "0.638215...
0.73136604
0
Generates n_traj trajectories of pi_H in bandit_env, of up to length max_timesteps. No fancy tricks, just rolling them out one at a time.
def gen_human_bandit_trajs(pi_H, bandit_env, max_timesteps=None, n_trajs=10): if max_timesteps==None: max_timesteps = bandit_env.horizon trajs = [] for i in prog_bar(range(n_trajs)): ob = bandit_env.reset() pi_H.reset() best_arm = np.argmax([bandit_env.arms[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fixed_steps_trajectories(self, noise=0, nt=1, ll=0.1, limit=None):\n\n print('Generating Trajectories...')\n for i in tqdm.tqdm(range(self.ntraj)):\n\n if self.hop_distribution == 'gaussian' or self.hop_distribution == 'Gaussian':\n z_position = np.cumsum(\n ...
[ "0.679281", "0.60337883", "0.5926588", "0.5920322", "0.5909478", "0.58606356", "0.57011646", "0.56236327", "0.5557102", "0.55529034", "0.5438898", "0.54227173", "0.53958905", "0.53685904", "0.53121597", "0.52904475", "0.52537346", "0.516319", "0.51491904", "0.5131413", "0.512...
0.76549655
0
Sets the channel_return_no of this ChannelReturnResponse.
def channel_return_no(self, channel_return_no): if self.local_vars_configuration.client_side_validation and channel_return_no is None: # noqa: E501 raise ValueError("Invalid value for `channel_return_no`, must not be `None`") # noqa: E501 self._channel_return_no = channel_return_no
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setChannelResponse(self, channel_response):\n \n \n # Make sure passing a list of CIR for each LightSource\n assert isinstance(channel_response, list)\n \n self.channel_response = channel_response", "def set_channel(self, channel):\n self.response['channel'] =...
[ "0.6294627", "0.6085321", "0.5008838", "0.4983765", "0.49693087", "0.49008304", "0.48862287", "0.48862287", "0.48429367", "0.48349634", "0.48212555", "0.48185545", "0.47737944", "0.47620875", "0.47477123", "0.47156537", "0.46935982", "0.46852058", "0.46425253", "0.4639683", "...
0.8403697
0
Sets the channel_order_no of this ChannelReturnResponse.
def channel_order_no(self, channel_order_no): if self.local_vars_configuration.client_side_validation and channel_order_no is None: # noqa: E501 raise ValueError("Invalid value for `channel_order_no`, must not be `None`") # noqa: E501 self._channel_order_no = channel_order_no
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def channel_return_no(self, channel_return_no):\n if self.local_vars_configuration.client_side_validation and channel_return_no is None: # noqa: E501\n raise ValueError(\"Invalid value for `channel_return_no`, must not be `None`\") # noqa: E501\n\n self._channel_return_no = channel_retur...
[ "0.5976309", "0.556253", "0.5542151", "0.55288607", "0.55288607", "0.54787785", "0.54280263", "0.53573877", "0.5312814", "0.5286618", "0.5286618", "0.5286618", "0.52681977", "0.52556974", "0.5230975", "0.51558375", "0.51558375", "0.51558375", "0.513104", "0.5119577", "0.50451...
0.77330625
0
Sets the merchant_order_no of this ChannelReturnResponse.
def merchant_order_no(self, merchant_order_no): self._merchant_order_no = merchant_order_no
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merchant_id(self, merchant_id):\n\n self._merchant_id = merchant_id", "def merchant_comment(self, merchant_comment):\n if (self.local_vars_configuration.client_side_validation and\n merchant_comment is not None and len(merchant_comment) > 4001):\n raise ValueError(\"In...
[ "0.58518696", "0.5845745", "0.5749896", "0.5568033", "0.5460311", "0.5277167", "0.52146024", "0.50644284", "0.50608397", "0.50608397", "0.50608397", "0.48972586", "0.47842017", "0.47791475", "0.47566214", "0.47566214", "0.47448388", "0.47202748", "0.47101927", "0.46435368", "...
0.81102973
0
Sets the reason of this ChannelReturnResponse.
def reason(self, reason): self._reason = reason
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reason(self, reason: str):\n\n self._reason = reason", "def reason(self, reason):\n allowed_values = [\"CLIENT_ORDER\", \"TRADE_CLOSE\", \"POSITION_CLOSEOUT\", \"MARGIN_CLOSEOUT\", \"DELAYED_TRADE_CLOSE\"] # noqa: E501\n if reason not in allowed_values:\n raise ValueError(\n ...
[ "0.7054716", "0.67173976", "0.6556905", "0.64163667", "0.63738674", "0.63453543", "0.62935936", "0.60364753", "0.5952574", "0.5748696", "0.5732212", "0.5715825", "0.5689847", "0.56836087", "0.56061107", "0.5565012", "0.55112374", "0.5509794", "0.5449831", "0.54487276", "0.543...
0.7186768
0
Sets the customer_comment of this ChannelReturnResponse.
def customer_comment(self, customer_comment): if (self.local_vars_configuration.client_side_validation and customer_comment is not None and len(customer_comment) > 4001): raise ValueError("Invalid value for `customer_comment`, length must be less than or equal to `4001`") # noqa: E5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer(self, customer):\n if customer is None:\n raise ValueError(\"Invalid value for `customer`, must not be `None`\") # noqa: E501\n\n self._customer = customer", "def customer(self, customer):\n\n self._customer = customer", "def customer(self, customer):\n\n se...
[ "0.6495456", "0.6428357", "0.6428357", "0.64145833", "0.6283955", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.6139833", "0.60955757", "0.60955757", "0.60955757", "0.60955757", "0.60454875", "0.595792"...
0.77025354
0
Sets the merchant_comment of this ChannelReturnResponse.
def merchant_comment(self, merchant_comment): if (self.local_vars_configuration.client_side_validation and merchant_comment is not None and len(merchant_comment) > 4001): raise ValueError("Invalid value for `merchant_comment`, length must be less than or equal to `4001`") # noqa: E5...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comment(self, comment):\n\n self.logger.debug(\"In 'comment' setter.\")\n\n self._comment = comment", "def set_comment(self, comment):\n\t\tself.comment_ = comment", "def merchant(self, merchant):\n if merchant is None:\n raise ValueError(\"Invalid value for `merchant`, must...
[ "0.65038735", "0.63781184", "0.6325114", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6198793", "0.6069528", "0.60674477", "0.5976623", "0.5976623", "0.59603655", "0.5939949", "0.5918144", "0.5874753",...
0.7860767
0
Sets the refund_incl_vat of this ChannelReturnResponse.
def refund_incl_vat(self, refund_incl_vat): if (self.local_vars_configuration.client_side_validation and refund_incl_vat is not None and refund_incl_vat < 0): # noqa: E501 raise ValueError("Invalid value for `refund_incl_vat`, must be a value greater than or equal to `0`") # noqa: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refund_excl_vat(self, refund_excl_vat):\n if (self.local_vars_configuration.client_side_validation and\n refund_excl_vat is not None and refund_excl_vat < 0): # noqa: E501\n raise ValueError(\"Invalid value for `refund_excl_vat`, must be a value greater than or equal to `0`\")...
[ "0.58407325", "0.542691", "0.4678022", "0.4579212", "0.44836187", "0.44703972", "0.43823436", "0.43767586", "0.43506703", "0.43438226", "0.42796484", "0.42702028", "0.4248939", "0.4225735", "0.4225735", "0.42237067", "0.42219445", "0.41745552", "0.41586012", "0.41383153", "0....
0.81290156
0
Sets the refund_excl_vat of this ChannelReturnResponse.
def refund_excl_vat(self, refund_excl_vat): if (self.local_vars_configuration.client_side_validation and refund_excl_vat is not None and refund_excl_vat < 0): # noqa: E501 raise ValueError("Invalid value for `refund_excl_vat`, must be a value greater than or equal to `0`") # noqa: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refund_incl_vat(self, refund_incl_vat):\n if (self.local_vars_configuration.client_side_validation and\n refund_incl_vat is not None and refund_incl_vat < 0): # noqa: E501\n raise ValueError(\"Invalid value for `refund_incl_vat`, must be a value greater than or equal to `0`\")...
[ "0.5989941", "0.4850047", "0.46746057", "0.46527916", "0.46527916", "0.46172494", "0.45566002", "0.44703436", "0.4465314", "0.44540542", "0.44144934", "0.4396465", "0.43494147", "0.43349367", "0.43320423", "0.43261135", "0.43095946", "0.42808232", "0.42619446", "0.42608503", ...
0.80779743
0
Returns the "meta" attribute.
def GetMetadata(self): return self.dict['meta']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meta(self):\n return self._meta", "def meta(self):\n return self._meta", "def meta(self):\n return self._meta", "def meta(self):\n return self.spec.meta", "def get_meta(self):\n if hasattr(self, 'meta'):\n return self.meta\n raise NotImplementedError...
[ "0.7887626", "0.7887626", "0.7887626", "0.7715828", "0.76061034", "0.7389086", "0.7384182", "0.7360078", "0.72282654", "0.71128666", "0.7107659", "0.70811987", "0.7066861", "0.7009333", "0.6959186", "0.69163626", "0.68852746", "0.6870586", "0.6870521", "0.68616384", "0.685250...
0.80889535
0
Returns a key having "version_number" as its name.
def GetKey(self, version_number): return self.dict[str(version_number)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version_key(self, version):\n if self._generic_only:\n return GENERIC_VERSION\n else:\n self.check_version_exists(version)\n return version", "def kms_key_version_name(self) -> str:\n return pulumi.get(self, \"kms_key_version_name\")", "def key_vers...
[ "0.79072005", "0.7538215", "0.72869647", "0.6993121", "0.6867462", "0.6741636", "0.6617988", "0.64844215", "0.6324501", "0.63166916", "0.6312392", "0.6282849", "0.62616396", "0.6225029", "0.62159294", "0.61619556", "0.6107714", "0.6094575", "0.609297", "0.6043491", "0.6031558...
0.88732076
0
Removes the key for the given version.
def Remove(self, version_number): self.dict.pop(str(version_number))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_key(stub, key, version):\n try:\n response = stub.Delete(keyval_pb2.DeleteRequest(key=key, current_version=version))\n print(\"Delete result:\")\n print_response(response)\n except grpc.RpcError as exception:\n print_response(exception)", "def delete(self, key, version=None, client=None)...
[ "0.73336995", "0.70064837", "0.6818274", "0.6639974", "0.6605711", "0.65855974", "0.65600413", "0.6526923", "0.6525272", "0.65013343", "0.64504623", "0.64281476", "0.63520795", "0.63413286", "0.62992", "0.62985903", "0.629501", "0.629501", "0.6258015", "0.62471235", "0.623188...
0.75393444
0
Regenerate Julia plane. Populate self.plane with new points (x + y1j), using the stored attributes of xmax, xmin, xlen, ymax, ymin, and ylen to set plane dimensions and resolution. Reset the attribute fs to an empty list so that no functions are transforming the fresh plane.
def refresh(self, c): self.fs = [] super(JuliaPlane,self).__init__(self.xmin,self.xmax,self.xlen,self.ymin,self.ymax,self.ylen) self.apply(julia(self.c)) return self.plane
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh(self):\n\n # delete the existing plane first before recreating our plane by resetting the plane to an empty plane\n self.plane = []\n # calling our create_plane() to redraw our plane.\n self.create_plane()", "def create_plane(self):\n\n # First we calculate our poin...
[ "0.6789748", "0.66232467", "0.60331184", "0.5831451", "0.5779728", "0.5649868", "0.54441464", "0.5423179", "0.5351419", "0.5345408", "0.53309864", "0.5285966", "0.5279662", "0.5263773", "0.5260069", "0.5238848", "0.51807237", "0.51702476", "0.5135503", "0.51050764", "0.506115...
0.6678224
1
Add the function f as the last element of self.fs. Apply f to every point of the plane, so that the resulting value of self.plane is the final output of the sequence of transformations collected in the list self.fs.
def apply(self, f): self.f = f self.fs.append(self.f) self.plane = f(self.plane) #Applies the function to the complex numbers return self.plane
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(self, f):\n for v in self.vertices:\n v.x, v.y, v.z = f(v.coords())", "def add(self, next_f):\n next_f = _n.reshape(next_f, (self.n, 1))\n BroydenSolver.add(self, self.next_x - next_f)", "def map(self, f):\n self.append(Mapper(f))\n return self", "def r...
[ "0.61052746", "0.57206935", "0.56834114", "0.56821305", "0.5593881", "0.55881476", "0.55273324", "0.551477", "0.5480861", "0.54241025", "0.54240394", "0.53816116", "0.5310273", "0.53033745", "0.5257685", "0.5226698", "0.52099603", "0.5201503", "0.51970214", "0.51681215", "0.5...
0.80596006
0
Reset self.xmin, self.xmax, and self.xlen. Also reset self.ymin, self.ymax, and self.ylen. Regenerate the plane with the new range of the x and yaxes, then apply all transformations in fs in the correct order to the new points so that the resulting value of self.plane is the final output of the sequence of transformati...
def zoom(self,xmin,xmax,xlen,ymin,ymax,ylen): self.xmin = xmin self.xmax = xmax self.xlen = xlen self.ymin = ymin self.ymax = ymax self.ylen = ylen r = np.linspace(self.xmin, self.xmax,self.xlen) q = np.linspace(self.ymin, self.ymax, self.ylen) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_plane(self):\n\n # First we calculate our point increment for both the x and y values\n inc_x = (self.xmax - self.xmin)/(self.xlen - 1)\n inc_y = (self.ymax - self.ymin)/(self.ylen - 1)\n\n # This for-loop will add every x-value with every y-value, saving the values column wi...
[ "0.66370714", "0.62600905", "0.61423326", "0.61007524", "0.5964302", "0.5934426", "0.57791674", "0.5686457", "0.56633717", "0.5605181", "0.55986106", "0.5590322", "0.55817604", "0.5570547", "0.55616254", "0.55342376", "0.55335647", "0.552915", "0.5509257", "0.549671", "0.5494...
0.69319344
0
Makes a CSV file of parameters of Julia Plane.
def toCSV(self,filename): with open(filename,'w') as csvfile: np.savetxt("plane.csv",self.plane, delimiter = ',', fmt = '%.0f') #File to save plane in serperate file fi = csv.writer(csvfile, quotechar=' ', delimiter = ',', quoting = csv.QUOTE_MINIMAL) param = [[self.c],[self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_csv(parameters: List['Parameter'], filename: str):\n lines = [parameters[0].keys()]\n for parameter in parameters:\n lines.append(Parameter.to_strs(parameter.values()))\n FileUtiles.csvSave(filename, lines)", "def export_parameters():\n exp_folder = os.path.join(os.getcw...
[ "0.68331075", "0.6388364", "0.6275415", "0.61676794", "0.6147267", "0.602427", "0.60114926", "0.60057014", "0.59806526", "0.5978971", "0.5978356", "0.59731025", "0.5970811", "0.5961754", "0.5958078", "0.5901849", "0.5889835", "0.5877306", "0.58770436", "0.5804098", "0.5803845...
0.71641713
0
Reads a CSV file to initialize parameters of Julia Plane.
def fromCSV(self, filename): with open(filename, newline = '') as csvfile: read = csv.reader(csvfile, delimiter = ',') param = [] for row in read: param.append(row) self.c = complex(param[0][0]) self.xmin = int(param[1][0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadCSV(input_file):", "def from_csv(filename: str) -> List['Parameter']:\n parameters = []\n lines = FileUtiles.csvLoad(filename)\n keys = lines[0]\n for line_idx in range(1, len(lines)):\n values = lines[line_idx]\n parameters.append(Parameter(*((keys[idx],...
[ "0.7135305", "0.7034509", "0.67540026", "0.665479", "0.6642695", "0.64073724", "0.6382871", "0.63169265", "0.62921333", "0.6277636", "0.6221216", "0.62081826", "0.61492264", "0.60764724", "0.60603154", "0.6043205", "0.604271", "0.60336876", "0.60331684", "0.60092753", "0.5961...
0.7474922
0
Create a common UTM Zone for this facility from the emission locations. All emission sources input to Aermod must have UTM coordinates from a single UTM zone. This function will determine the single UTM zone (and hemisphere) to use. Parameter is the emissions location data frame.
def zone2use(el_df): # First, check for any utm zones provided by the user in the emission location file utmzones_df = el_df["utmzone"].loc[el_df["location_type"] == "U"] if utmzones_df.shape[0] > 0: # there are some; find the smallest one utmzones_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UTMZone(x,y):\n\n #take longitudinal coordinate and add 180, then divide by 6 and round up\n lon = int(np.ceil((x + 180)/6))\n \n #determine whether y is in the Northern or Southern Hemisphere\n if y > 0:\n code = 326\n else:\n code = 327\n \n #return epsg of the utm zone\...
[ "0.5641798", "0.561104", "0.5444022", "0.53897405", "0.5191188", "0.5156333", "0.50552934", "0.5047819", "0.49569675", "0.49503422", "0.49464965", "0.48873118", "0.48630908", "0.47566175", "0.47535148", "0.47495285", "0.4746261", "0.47406447", "0.47209072", "0.47020352", "0.4...
0.65852296
0
create the NCTRS TM sender
def createTMsender(): global s_tmSender nctrsTMfields = GRND.NCTRS.NCTRStmFields() nctrsTMfields.spacecraftId = int(UTIL.SYS.s_configuration.SPACECRAFT_ID) s_tmSender = TMsender( portNr=int(UTIL.SYS.s_configuration.NCTRS_TM_SERVER_PORT), nctrsTMfields=nctrsTMfields) if not s_tmSender.openConnectPort(U...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(self):\n self.preprocess_text()\n message_text = self.create_message_text()\n \n telnyx.Message.create(\n from_=configs.source_number,\n to=self.destination_number,\n text=message_text,\n )", "def transmit_mqtt(form_obj):\n # Pr...
[ "0.59782004", "0.56882566", "0.56780106", "0.56402", "0.5576617", "0.55521804", "0.54989284", "0.54920447", "0.54320085", "0.5403926", "0.53929114", "0.5387494", "0.5379403", "0.53553426", "0.535297", "0.5349695", "0.5331534", "0.53287935", "0.5304764", "0.52779084", "0.52779...
0.8348514
0
Return the path and file name for the district file
def get_district_geojson_filename(state=48, district=7, leg_body='US-REP'): state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) state_abbr = str(states.mapping('fips', 'abbr')[state]) district_abbr = leg_body + '-' + state_abbr + district geojson_path = 'static/geojson/'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_district_file(state=48, district=7, leg_body='US-REP'):\r\n\r\n district_file = get_district_geojson_filename(\r\n state=state, district=district, leg_body=leg_body)\r\n geojson_path = 'static/geojson/' \r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district...
[ "0.7071918", "0.6960386", "0.6621741", "0.62491006", "0.6232871", "0.623212", "0.61390775", "0.61094725", "0.6040661", "0.5974864", "0.59741986", "0.5962593", "0.5944961", "0.5944084", "0.5917075", "0.5908154", "0.5887308", "0.586962", "0.58482647", "0.5822973", "0.5816471", ...
0.725018
0
Return the path and filename containing all the voting precincts for a state
def get_statewide_voting_precincts_geojson_filename(state=48): state = "{0:0>2}".format(state) state_abbr = str(states.mapping('fips', 'abbr')[state]) vps_abbr = state_abbr + '-voting-precincts' geojson_path = 'static/geojson/' vps_file = geojson_path + vps_abbr + '.geojson' ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_statewide_voting_precincts(state=48):\r\n vps_file = get_statewide_voting_precincts_geojson_filename(state)\r\n geojson_path = 'static/geojson/' \r\n state = \"{0:0>2}\".format(state)\r\n \r\n if not os.path.isfile(vps_file):\r\n print( \"Downloading statewide voting precincts file\")...
[ "0.6847489", "0.6322313", "0.5351677", "0.5299917", "0.52940583", "0.5193073", "0.5155988", "0.5153351", "0.5126342", "0.51263374", "0.50306314", "0.5029869", "0.50138694", "0.49693334", "0.4967153", "0.49525315", "0.4944202", "0.49423268", "0.4942085", "0.4919951", "0.491437...
0.6948288
0
Return the path and filename to the block groups for a state
def get_state_blockgroups_geojson_filename(state=48): state = "{0:0>2}".format(state) state_abbr = str(states.mapping('fips', 'abbr')[state]) geojson_path = 'static/geojson/' blockgroups_file = geojson_path + state_abbr + '-blockgroups.geojson' return blockgroups_file
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_blockgroups_file(state=48, district=7, leg_body='US-REP', year='2015'):\r\n\r\n blockgroups_file = get_state_blockgroups_geojson_filename(state=state)\r\n \r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district)\r\n \r\n print( blockgroups_file )\r\...
[ "0.6628989", "0.5945026", "0.5553919", "0.550096", "0.5482267", "0.5376674", "0.5358737", "0.5352847", "0.53303385", "0.531927", "0.5284342", "0.5280088", "0.52258277", "0.52131325", "0.52055347", "0.51740414", "0.5135073", "0.51197493", "0.50902367", "0.507188", "0.5070656",...
0.72727156
0
Return the path and filename of the geojson file containing the blockgroups that overlap with the disctrict
def get_bgs_in_district_geojson_filename(state=48, district=7, leg_body='US-REP'): state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) state_abbr = str(states.mapping('fips', 'abbr')[state]) district_abbr = leg_body + '-' + state_abbr + district geojson_path = 'static/ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state_blockgroups_file(state=48, district=7, leg_body='US-REP', year='2015'):\r\n\r\n blockgroups_file = get_state_blockgroups_geojson_filename(state=state)\r\n \r\n state = \"{0:0>2}\".format(state)\r\n district = \"{0:0>2}\".format(district)\r\n \r\n print( blockgroups_file )\r\...
[ "0.6473774", "0.6321107", "0.6056092", "0.6023398", "0.58103925", "0.5692038", "0.56437486", "0.55551565", "0.5517348", "0.54647803", "0.53630453", "0.52194536", "0.5206102", "0.5192708", "0.51699823", "0.51065356", "0.508553", "0.5063602", "0.5030784", "0.49997425", "0.49962...
0.63579464
1
Download the shape file with the statewide voting precincts
def get_statewide_voting_precincts(state=48): vps_file = get_statewide_voting_precincts_geojson_filename(state) geojson_path = 'static/geojson/' state = "{0:0>2}".format(state) if not os.path.isfile(vps_file): print( "Downloading statewide voting precincts file") # TODO down...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_statewide_voting_precincts_geojson_filename(state=48):\r\n state = \"{0:0>2}\".format(state)\r\n \r\n state_abbr = str(states.mapping('fips', 'abbr')[state])\r\n vps_abbr = state_abbr + '-voting-precincts'\r\n geojson_path = 'static/geojson/'\r\n\r\n vps_file = geojson_path + vps_abbr + ...
[ "0.6450894", "0.6127803", "0.57305235", "0.54192525", "0.54037565", "0.5365361", "0.5345263", "0.52702177", "0.5251273", "0.52288437", "0.515574", "0.5103718", "0.5007659", "0.5004499", "0.4989179", "0.49741122", "0.49535117", "0.49394768", "0.4883794", "0.48805475", "0.48643...
0.72121114
0
Download the file, from the Census Bureau, containing the blockgroups for an entire state
def get_state_blockgroups_file(state=48, district=7, leg_body='US-REP', year='2015'): blockgroups_file = get_state_blockgroups_geojson_filename(state=state) state = "{0:0>2}".format(state) district = "{0:0>2}".format(district) print( blockgroups_file ) if not os.path.isf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_blockgroup_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'):\r\n blockgroup_key = 'bg'\r\n if year not in census_data.keys():\r\n census_data[year] = { blockgroup_key: {} }\r\n else:\r\n if blockgroup_key not in census_data[year].keys()...
[ "0.6653839", "0.64528793", "0.58640003", "0.5745723", "0.5719516", "0.56700283", "0.56666577", "0.56636924", "0.5656115", "0.5540057", "0.55270064", "0.54836065", "0.5482237", "0.547984", "0.5452949", "0.5435761", "0.5337991", "0.5328596", "0.53206915", "0.53067183", "0.53053...
0.7388399
0
Find the blockgroups that intersect with a legislative district, e.g., US Congressional District.
def find_blockgroups_in_district(state=48, district=7, leg_body='US-REP', year='2015', debug_is_on=False): shapfile_path = None bgs_in_district_GeoJSON = get_bgs_in_district_geojson_filename(state=state, district=district, leg_body=leg_body) bgs_in_district_JSON = get_bgs_in_district_json_filename(state=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_voting_precincts_in_district(state=48, district=7, leg_body='US-REP'):\r\n vps_in_district_GeoJSON = get_voting_precincts_geojson_filename(\r\n state=state, district=district, leg_body=leg_body)\r\n \r\n if not os.path.isfile(vps_in_district_GeoJSON):\r\n voting_precincts_file ...
[ "0.6244344", "0.57804626", "0.5753308", "0.5734239", "0.5366872", "0.53039515", "0.5282073", "0.52118653", "0.5208916", "0.5207756", "0.5122046", "0.5101411", "0.50755763", "0.5074011", "0.50446886", "0.5027455", "0.5015215", "0.49994236", "0.49861485", "0.49796596", "0.49756...
0.7497956
0
Find the voting precincts that are in a district
def find_voting_precincts_in_district(state=48, district=7, leg_body='US-REP'): vps_in_district_GeoJSON = get_voting_precincts_geojson_filename( state=state, district=district, leg_body=leg_body) if not os.path.isfile(vps_in_district_GeoJSON): voting_precincts_file = get_statewide...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_precinct_votes():\n c.execute(\n \"SELECT Contest_Name, County, Precinct, Sum(Total_Votes) as Votes from v group by County, Precinct, Contest_Name order by Votes ASC\")\n return c.fetchall()", "def make_voting_results_data(categories, district_data = {}, state=48, district=7, leg_body='US-RE...
[ "0.6696587", "0.6194907", "0.57451546", "0.5651497", "0.5444455", "0.52334946", "0.5187955", "0.5183999", "0.5177762", "0.5176289", "0.5124718", "0.51247114", "0.5093308", "0.50823563", "0.5078896", "0.5072995", "0.50637305", "0.5031146", "0.5029899", "0.49966052", "0.4977888...
0.7770079
0
Return the centroid of a district
def get_district_centroid(state=48, district=7, leg_body='US-REP', year='2015'): district_file = get_district_geojson_filename( state=state, district=district, leg_body=leg_body) get_district_file(state=state, district=district, leg_body=leg_body) district = gpd.read_file(district_fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def centroid(self): # -> BaseGeometry:\n ...", "def centroid(self):\n return _property_geo(arctern.ST_Centroid, self)", "def centroid(self) -> PointValue:\n return ops.GeoCentroid(self).to_expr()", "def getCentroid(self):\r\n return self._centroid", "def getCentroid(self):\n ...
[ "0.74505466", "0.7435831", "0.72509575", "0.7125967", "0.7018645", "0.70144373", "0.69940114", "0.69814104", "0.6971411", "0.69401646", "0.6866047", "0.68502235", "0.683639", "0.6806046", "0.6785718", "0.6762197", "0.6724832", "0.6712664", "0.6709017", "0.6675666", "0.6662785...
0.8199656
0
Retrieve the census data for the block groups in a District
def get_blockgroup_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'): blockgroup_key = 'bg' if year not in census_data.keys(): census_data[year] = { blockgroup_key: {} } else: if blockgroup_key not in census_data[year].keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_district_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'):\r\n district_key = 'district'\r\n if year not in census_data.keys():\r\n census_data[year] = { district_key: {} }\r\n else:\r\n if district_key not in census_data[year].keys():\...
[ "0.704894", "0.69166845", "0.6479016", "0.64342415", "0.60648763", "0.6059544", "0.59281117", "0.5923906", "0.5815242", "0.57750034", "0.5763054", "0.5758142", "0.562634", "0.5584639", "0.5564932", "0.553517", "0.54872394", "0.54436797", "0.5401207", "0.53969693", "0.53774947...
0.79287934
0
Retrieve the census data for the entire district
def get_district_census_data(api, fields, census_data = {}, state=48, district=7, leg_body='US-REP', year='2015'): district_key = 'district' if year not in census_data.keys(): census_data[year] = { district_key: {} } else: if district_key not in census_data[year].keys(): ce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data_from_db(district):\n data_frames = get_athena_dataframes()\n df_result = copy.copy(data_frames['new_covid_case_summary'])\n df_result = df_result[df_result['district'] == district.lower()]\n df_result = df_result.loc[:, :'deceased']\n df_result.dropna(axis=0, how='any', inplace=True)\n ...
[ "0.7228065", "0.7227036", "0.7215744", "0.6900608", "0.64591473", "0.63383484", "0.62536275", "0.6246952", "0.6149221", "0.61442184", "0.61019313", "0.6055664", "0.60189295", "0.5955576", "0.59410846", "0.5902425", "0.5897042", "0.5843112", "0.5842985", "0.5830057", "0.581874...
0.7391904
0
Return the fields in a census table
def get_census_fields_by_table(table, year='2015'): variables_file = 'static/data/variables_' + year + '.json' if not os.path.isfile(variables_file): url = 'https://api.census.gov/data/' + year + '/acs/acs5/variables.json' download_file(url, variables_file) fields = [] labels = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_census_params_by_county(columns):\n return {\n 'get': ','.join(columns),\n 'for': 'county:*',\n 'in': 'state:*'\n }", "def _get_fields(self, table):\n fields = list()\n for column in table.columns:\n fields.append({'id': column.name, 'type': str(column.type)})\n ...
[ "0.6081307", "0.5731482", "0.56552404", "0.5635112", "0.5527317", "0.54978526", "0.5469839", "0.5436787", "0.5433822", "0.539986", "0.53911793", "0.5386296", "0.5374896", "0.5369357", "0.53278196", "0.53242815", "0.5323225", "0.5310881", "0.52383465", "0.5238108", "0.5220094"...
0.71227324
0
Store the raw census data in a json file and return the census data
def get_census_data(api, category, fields, district_config_file = 'static/data/district.json', census_data_file='static/data/district-census-data.json', state=48, district=7, leg_body='US-REP', year='2015'): # If district config file exists, only get the census data that's not there ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_cluedata(input_path: str):\n\n\twith open(input_path, 'r') as clue_backup:\n\t\tjson_structure = json.loads(clue_backup.read())\n\n\tassert 'data' in json_structure, \".cluedata file does not have the expected structure\"\n\n\treturn json_structure", "def _parse_and_store_geojson(filename):\n ds = D...
[ "0.60936487", "0.6086147", "0.60323715", "0.59826285", "0.59492034", "0.591327", "0.5887552", "0.5865722", "0.5693939", "0.5684255", "0.56838477", "0.56676584", "0.5661993", "0.56538886", "0.56452644", "0.56280714", "0.56234634", "0.5616633", "0.5601072", "0.5584741", "0.5569...
0.63257444
0
Make the census data on age for a district
def make_age_data(api, district_data = {}, categories = {'Age': {} }, state=48, district=7, leg_body='US-REP', year='2015'): category='Age' district_key='district' blockgroup_key='bg' precinct_key='precinct' tract_key='tract' total_census_field = 'B01001_001E' age_tab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_age_fields():\n under_18_fields = CensusFields.get_under_18_fields()\n\n age_18_to_29_fields = [ \n 'B01001_007E', # Male:!!18 and 19 years\n 'B01001_008E', # Male:!!20 years\n 'B01001_009E', # Male:!!21 years\n 'B010...
[ "0.6409517", "0.622455", "0.60268164", "0.5957785", "0.5914849", "0.5782152", "0.5721964", "0.5643782", "0.5600801", "0.5571286", "0.5469414", "0.54492825", "0.5433194", "0.5431161", "0.5422123", "0.5404909", "0.53833455", "0.53805804", "0.53786755", "0.5366214", "0.53632236"...
0.7490717
0
Make the income data for a district
def make_income_data(api, district_data = {}, categories = {'Income': { }}, state=48, district=7, leg_body='US-REP', year='2015'): category='Income' district_key='district' blockgroup_key='bg' precinct_key='precinct' tract_key='tract' income_table = 'B19001' total_househ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def income(self, fromdt, todt):\r\n return self._buildTransDict(fromdt, todt, Income)", "def make_edu_data( api, district_data = {}, categories = {'Education': { }}, \r\n state=48, district=7, leg_body='US-REP', year='2015' ):\r\n category='Education'\r\n\r\n district_key='district'\r\n block...
[ "0.62920475", "0.6113353", "0.6042079", "0.6008246", "0.60012704", "0.5913185", "0.5710172", "0.56811994", "0.56415194", "0.5636729", "0.55943716", "0.55854857", "0.55605316", "0.5478098", "0.54762095", "0.5367531", "0.534352", "0.5335575", "0.5334637", "0.5333553", "0.532723...
0.7593264
0
Make the race data for a district
def make_race_data( api, district_data = {}, categories = {'Race': { }}, state=48, district=7, leg_body='US-REP', year='2015' ): category='Race' district_key='district' blockgroup_key='bg' precinct_key='precinct' tract_key='tract' race_table = 'B02001' hispanic_table = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_race_data():\n try:\n # get data from client request\n client_data = request.get_json()\n print('\\n------- update_race_data route beginning -------')\n print(f\"recived: \\n {client_data}\")\n\n # race is from databse, while client_data is from front end\n r...
[ "0.5701887", "0.5653621", "0.5564876", "0.5531452", "0.54738396", "0.5387711", "0.5374153", "0.53194153", "0.52401155", "0.5143003", "0.5142375", "0.5136191", "0.5128317", "0.5084612", "0.5083692", "0.5064338", "0.50413984", "0.50080615", "0.4993394", "0.49897987", "0.4975774...
0.73013127
0
Make the education data for a district
def make_edu_data( api, district_data = {}, categories = {'Education': { }}, state=48, district=7, leg_body='US-REP', year='2015' ): category='Education' district_key='district' blockgroup_key='bg' precinct_key='precinct' tract_key='tract' edu_table = 'B15002' edu_total...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_age_data(api, district_data = {}, categories = {'Age': {} },\r\n state=48, district=7, leg_body='US-REP', year='2015'):\r\n category='Age'\r\n \r\n district_key='district'\r\n blockgroup_key='bg'\r\n precinct_key='precinct'\r\n tract_key='tract'\r\n\r\n total_census_field = 'B0...
[ "0.6528546", "0.64214766", "0.6284206", "0.6146757", "0.6046286", "0.5997275", "0.5915004", "0.5872272", "0.5831816", "0.57958627", "0.57088965", "0.5667612", "0.55951506", "0.5594973", "0.5593508", "0.5552994", "0.55382633", "0.5506498", "0.5488644", "0.54758483", "0.5475848...
0.75078404
0
Return the value in the voting results for a given precinct based on various conditions
def query_voting_results(vr_data, precinct, queries): query_result = 0 # Get the voting results for the precinct vr_data = vr_data[ vr_data['precinct'] == precinct ] # for each of the queries return the remaining that match the conditions for col, row in queries: if len( vr_dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_precinct_votes():\n c.execute(\n \"SELECT Contest_Name, County, Precinct, Sum(Total_Votes) as Votes from v group by County, Precinct, Contest_Name order by Votes ASC\")\n return c.fetchall()", "def t(p, vote_count):\n return vote_count[p]", "def result_poll(votes):\n return sum(votes...
[ "0.6866511", "0.6193262", "0.6021859", "0.5718616", "0.5718616", "0.5654299", "0.56460893", "0.5624494", "0.5357243", "0.5343016", "0.5297956", "0.52842486", "0.52389294", "0.5222362", "0.5215099", "0.52003187", "0.51853424", "0.5164715", "0.5159816", "0.5123581", "0.51138216...
0.7000912
0
Build voting results data per precinct and district from Open Elections file
def make_voting_results_data(categories, district_data = {}, state=48, district=7, leg_body='US-REP', election_year='2018', census_year='2016', district_config_file = 'static/data/district.json', voting_precincts_file=None, voting_results_file=None): print( "\nGetting election results per precin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_votes():\n c.execute(\"\"\"CREATE TABLE IF NOT EXISTS v\n (County TEXT, Election_Date TEXT, Precinct TEXT,\n Contest_Group_ID INTEGER, Contest_Type TEXT,\n Contest_Name TEXT, Choice TEXT, Choice_Party TEXT,\n Vote_For INTEGER,\tElection_Day INTEGER, One_Stop INTEGER...
[ "0.6453298", "0.62704986", "0.591759", "0.5638283", "0.5609781", "0.55366975", "0.5454583", "0.5409491", "0.5403494", "0.5342446", "0.53199655", "0.52896106", "0.52841806", "0.52664864", "0.5242544", "0.52125007", "0.51701033", "0.5168771", "0.514175", "0.5128764", "0.5099989...
0.7711749
0