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
Save the anonymised c3d file.
def saveC3D(self, outputdir=None, condition=None, trialno=None): fpath = self.createFilePath(outputdir, condition, trialno) self.trialC3D.write(fpath) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_spi3d(self):\n lut = self.generate_lut()\n file_path = os.path.join(self.output, self.name)\n file_io.save_file(lut, file_path)", "def save(self, path):\n if isinstance(path, str) and path.startswith(\"s3://\"):\n raise NotImplementedError(\"TODO: Implement saving ...
[ "0.6890905", "0.6811769", "0.6598678", "0.6471373", "0.642383", "0.63084406", "0.6303359", "0.627521", "0.62555593", "0.6254733", "0.6240116", "0.6228313", "0.6198321", "0.6152307", "0.6072066", "0.60581666", "0.60330385", "0.6018503", "0.5994799", "0.5973119", "0.59553504", ...
0.7049525
0
takes a parsed yaml node and translates it to a list of arguments that can be passed any subprocess command. for dictionary values the values can only be of type str or list. nested dictionary is not supported.
def _flat_node_to_cmd_line_args(node): if isinstance(node, list): return node elif isinstance(node, dict): return list(itertools.chain(*[['--%s' % key,node[key]] if isinstance(node[key],basestring) else ['--%s' % key] + node[key] for key in node.keys()])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaml_to_args( obj ):\n if isinstance( obj, list ):\n args = []\n for arg in obj:\n for key in arg:\n args.append((key,arg[key]))\n return args\n elif isinstance( obj, dict ):\n return [(key, obj[key]) for key in obj ]\n else:\n return obj", ...
[ "0.66765696", "0.6097904", "0.59122384", "0.5839684", "0.58242154", "0.5823643", "0.5762801", "0.567206", "0.56293094", "0.5592766", "0.5565872", "0.5493016", "0.54782856", "0.5477749", "0.5472146", "0.54652345", "0.5385457", "0.5366413", "0.5267159", "0.5258225", "0.5252986"...
0.6760684
0
Add Capacity via UI.
def add_capacity_ui(self): self.navigate_installed_operators_page() self.do_click(self.infra_loc["ocs_operator"]) self.do_click(self.infra_loc["storage_cluster_tab"]) self.do_click(self.infra_loc["kebab_storage_cluster"]) self.do_click(self.infra_loc["add_capacity_button"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_capacity(self, cap):\n return self.get_interaction().set_capacity(cap)", "def capacity(self, value: typing.Union[str, int, None]):\n self._properties[\"capacity\"] = _types.integer_or_string(value)", "def capacity(self) -> Capacity:\n raw = self._call('GET', 'capacity')\n return...
[ "0.669308", "0.6396389", "0.6279793", "0.6190911", "0.6123263", "0.610596", "0.60797817", "0.604714", "0.6036148", "0.5991488", "0.5956968", "0.5945528", "0.5833985", "0.58118176", "0.5805878", "0.58014524", "0.57177514", "0.5693951", "0.567192", "0.563066", "0.5628445", "0...
0.8122652
0
plotte Parameterkombinationen zu Zeit t, mit erlaubter Abweichung von t um epsilon
def plot_params_at_time(folder, t, epsilon=0.1, show_params=False): # Plot erstellen und beschriften if "2s" not in folder: logging.log(40, "Plot nicht verfuegbar fuer 3-Zustaende Modell") return ax = plt.axes() ax.get_xaxis().get_major_formatter().set_useOffset(False) plt.xlabel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def e_from_p_function(self):\r\n\r\n (fig, ax) = plt.subplots()\r\n ax.plot(\r\n self.dt.momentum_t,\r\n self.dt.eng_t,\r\n marker='o',\r\n linestyle=' ',\r\n color='black',\r\n label='result of measurements',\r\n )\r\n ...
[ "0.61496925", "0.5935934", "0.59310377", "0.5835695", "0.57948995", "0.5774567", "0.5751974", "0.57288474", "0.5722192", "0.56809306", "0.5624164", "0.5594", "0.55729085", "0.5567407", "0.5561646", "0.55605805", "0.55587107", "0.5550242", "0.5546648", "0.55364907", "0.5520724...
0.67288375
0
Yields tuples of (schema_name, function_name)
def functions(self): with self.conn.cursor() as cur: _logger.debug('Functions Query. sql: %r', self.functions_query) cur.execute(self.functions_query % self.dbname) for row in cur: yield row
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generator(fn):\n def wrapped(schema):\n result = fn(schema)\n if result is not None:\n expected_result = _check_for_expected_result(fn.__name__, schema)\n return (fn.__name__, result, expected_result)\n return\n return wrapped", "def yield_column_names(schema:...
[ "0.6727939", "0.62836844", "0.6221021", "0.59776676", "0.59344625", "0.588578", "0.5832448", "0.57567436", "0.5631567", "0.5585038", "0.5553903", "0.55262053", "0.5488672", "0.54839253", "0.5379389", "0.53702706", "0.5357351", "0.5348017", "0.5325605", "0.5268671", "0.526406"...
0.643095
1
Converts an item without children, uses the offset of the match from the start of the HTML as the task ID
def _convert_item(self, match: re.Match) -> str: state, caption = match.groups() return render_item(caption, state != " ", match.start())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mongo_item_to_task(item):\n return Task(\n id=str(item[\"_id\"]),\n task=item[\"task\"],\n args=item[\"args\"],\n kwargs=item[\"kwargs\"],\n wait=item[\"wait\"],\n recurring=item[\"recurring\"],\n when=item[\"when\"],\n )", "def get_tw_item(task: taskw....
[ "0.50826526", "0.50334203", "0.49368155", "0.49145508", "0.48586226", "0.48134792", "0.48118064", "0.48103452", "0.47756848", "0.47478804", "0.47209668", "0.46880686", "0.46830603", "0.46760982", "0.46448636", "0.46284938", "0.45968413", "0.45758584", "0.45556232", "0.45417786"...
0.54481596
0
Converts an item with children, uses the offset of the match from the start of the HTML as the task ID
def _convert_item_with_children(self, match: re.Match) -> str: state, caption = match.groups() return render_item(caption, state != " ", match.start()) + "<ul><li>"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _traverse_1_0_1(item, nodes):\n if 'content' in item.keys():\n ids = []\n for node in item['content']:\n nodes[node['id']] = node\n ids.append(node['id'])\n _traverse_1_0_1(node, nodes)\n item['content'] = ids", "def test_custom_ids(self):\n it ...
[ "0.532541", "0.5295402", "0.5228904", "0.5006564", "0.4999942", "0.4974197", "0.48438826", "0.48322746", "0.4828575", "0.47614872", "0.47370318", "0.4712531", "0.47079116", "0.4680026", "0.46800196", "0.46510932", "0.46390906", "0.4634886", "0.46297765", "0.4618333", "0.46118...
0.58649266
0
ReLU function, takes input h and return result of ReLU(h)
def relu(h): return np.maximum(h, 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relu_prime(h):\n return_value = h\n return_value[return_value <= 0] = 0\n return_value[return_value > 0 ] = 1\n return return_value", "def ReLU(self, x):\n self.x = x\n output = np.maximum(0, x)\n return output", "def _rnn_relu_cell(inputs, hidden, w_ih, w_hh, b_ih, b_hh):\n if b_ih...
[ "0.6746711", "0.664049", "0.6611213", "0.6571714", "0.65068805", "0.64704126", "0.6451632", "0.6394144", "0.634299", "0.6341994", "0.63404304", "0.6331816", "0.63282824", "0.6320288", "0.63083297", "0.6306409", "0.6283333", "0.6253684", "0.62309307", "0.620276", "0.6181885", ...
0.77946955
0
Initialises weights depending on layer sizes and whether Xavier Initialisation is needed
def init_weights(n_input_layer, n_hidden_layer, n_hidden_layer_2, n_output_layer, xavier_init): W1, W2, W3 = None, None, None if xavier_init: # Checks if Xavier initialisation is wanted # Initialises weights depending on number of layers present using: # Normally distributed random number *...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_weights_xavier(self):\n\t\tself.weights = [np.random.uniform(-1/sqrt(size1), 1/sqrt(size1)) for size1, size2 in zip(self.sizes[:-1], self.sizes[1:])]\n\t\tself.biases = [np.zeros([size, ]) for size in self.sizes[1:]]", "def init_weights_(self):\n raise NotImplementedError", "def _initiali...
[ "0.76051825", "0.7580625", "0.7418632", "0.7384778", "0.73651063", "0.72985464", "0.72827876", "0.723169", "0.72292835", "0.72177035", "0.72110796", "0.7196356", "0.7196356", "0.7196356", "0.71878", "0.7185429", "0.7176544", "0.71507525", "0.71335864", "0.71014833", "0.708755...
0.7777824
0
Trains the model based on the system parameters Uses the ReLU function and derivative to train neuron weights Weights are trained depending on the number of layers Batch training is carried out with weights being updated at the end of each bach After each epoch accuracy, error and average weight update (for single laye...
def train(epoch, w1, w2, w3, samples, n_batches, bias_w1, bias_w2, bias_w3, n_hidden_layer, n_hidden_layer_2, batch_size, train_data, train_output, valid_data, valid_output, learning_rate, lmbda, l1): # Initialise empty error and accuracy arrays errors = np.zeros((epoch,)) accuracies = np.zeros((...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self) -> None:\n for _ in range(self.epochs):\n for x, y in zip(self.x_train, self.y_train):\n\n weights_gradient = [\n None for weight in self.weights\n ] # Initializing weight gradients for each layer which are going to be used to upda...
[ "0.7444253", "0.72861606", "0.7262928", "0.7260432", "0.725449", "0.7204505", "0.7139221", "0.7114966", "0.7096684", "0.7072422", "0.7066302", "0.70376366", "0.7002768", "0.699714", "0.69897795", "0.6973925", "0.6948941", "0.6938138", "0.693342", "0.6905513", "0.6872959", "...
0.7422293
1
Get the details for an individual vocab
def retrieve(self, request, pk=None): queryset = Vocab.objects.all() vocab = get_object_or_404(queryset, pk=pk) serializer = VocabDetailSerializer(vocab, context={"request": request}) return Response(serializer.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vocab(which_vocab):\n path = os.path.join(mg.WORKING_PATH, 'vocab', ''.join([which_vocab, '.json'\n ]))\n if os.path.exists(path):\n with open(path, 'r') as js:\n return(json.load(js))\n else:\n return(dict())", "def load_vocab():\n # vocab loaded internally a...
[ "0.70155954", "0.6758839", "0.66370237", "0.658239", "0.641147", "0.6386239", "0.63847965", "0.6307677", "0.6295874", "0.6261076", "0.6252203", "0.6244632", "0.6216861", "0.6213393", "0.61783177", "0.6141274", "0.61408085", "0.61311096", "0.6130657", "0.6122938", "0.6116046",...
0.69035906
1
Return current position of cover. 0 is closed, 100 is open.
def current_cover_position(self): state = self.channel_data.get("state") if state: return 100 - state["shut"] return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_cover_position(self):\n return self._pos", "def current_cover_position(self):\n return 50", "def current_cover_position(self) -> int:\n return int(self._value)", "def current_cover_position(self) -> int | None:\n position = None\n if self.data.levelpercentage is...
[ "0.84004843", "0.8276662", "0.82298696", "0.8225084", "0.821339", "0.8193297", "0.8009616", "0.7996925", "0.7842341", "0.68242145", "0.6570729", "0.6545508", "0.6545042", "0.65387315", "0.635869", "0.634725", "0.634725", "0.63252664", "0.6286137", "0.6246093", "0.6218258", ...
0.8492424
0
Return if the cover is closed.
def is_closed(self): if self.current_cover_position is None: return None return self.current_cover_position == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_closed(self):\n return self.current_cover_position <= 0", "def is_closed(self) -> bool | None:\n if self.current_cover_position is None:\n return None\n return self.current_cover_position == 0", "def is_closed(self):\n # if self.current_cover_position is not None:\...
[ "0.8593738", "0.85137665", "0.84728414", "0.8464409", "0.82930636", "0.7766478", "0.7753021", "0.77493626", "0.77096367", "0.7578489", "0.75766754", "0.7570424", "0.75386494", "0.75386494", "0.7503816", "0.7495912", "0.7482948", "0.74642336", "0.74502677", "0.74016404", "0.72...
0.85620844
1
Model with bottleneck, split, followed by second bottleneck and exp recovery in Eastern pop nu, or ancestral population size defaults to 1. B1= Time of the ancestral population bottleneck. P1= The ancestral population size after bottleneck.
def bottle_split_bottleExpansion((B1,P1,nuW,nuEF,nuEB,TE), (n1,n2), pts): #Define grid to use xx = yy = dadi.Numerics.default_grid(pts) #phi for equilibrium ancestral population phi = dadi.PhiManip.phi_1D(xx) # Now do the population bottleneck event. phi = dadi.Integration.one_pop(phi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config1() :\n data_name = \"titanic\" ### in data/input/\n model_class = 'AutoML' ### ACTUAL Class name for model_sklearn.py\n n_sample = 1000\n\n def post_process_fun(y): ### After prediction is done\n return int(y)\n\n def pre_process_fun(y): ### Before the predic...
[ "0.59412456", "0.5714792", "0.5617969", "0.558789", "0.55688375", "0.5551032", "0.5532042", "0.55194557", "0.5486247", "0.54783905", "0.54762954", "0.54687536", "0.54687536", "0.54687536", "0.54658645", "0.54642564", "0.5456077", "0.5421649", "0.54122037", "0.5380967", "0.537...
0.59255534
1
Model with bottlegrowth, split, followed by second bottleneck and exp recovery in Eastern pop nu, or ancestral population size defaults to 1. nu= Ratio of contemporary to ancient population size T = Time in the past at which growth began
def bottlegrow_split_bottleExpansion((nu,T,nuW,nuEF,nuEB,TE), (n1,n2), pts): #Define grid to use xx = yy = dadi.Numerics.default_grid(pts) #phi for equilibrium ancestral population phi = dadi.PhiManip.phi_1D(xx) # bottlegrowth in ancient population nu_func = lambda t: numpy.exp(numpy....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bottle_split_bottleExpansion((B1,P1,nuW,nuEF,nuEB,TE), (n1,n2), pts): \n #Define grid to use\n xx = yy = dadi.Numerics.default_grid(pts)\n \n #phi for equilibrium ancestral population\n phi = dadi.PhiManip.phi_1D(xx)\n \n # Now do the population bottleneck event.\n phi = dadi.Integratio...
[ "0.63740695", "0.5965839", "0.5927294", "0.58659667", "0.5702715", "0.566868", "0.5498249", "0.54930544", "0.542103", "0.5419258", "0.5402037", "0.5399739", "0.5398051", "0.53829664", "0.53793573", "0.53616595", "0.53513664", "0.5348822", "0.5341492", "0.5327674", "0.53178793...
0.65301913
0
Compute the coefficient matrix of b which is a Toeplitz matrix
def coeff_b(nrows, ncols) -> np.ndarray: coeff_array = np.zeros((nrows, ncols), dtype="complex_") for idx, _ in np.ndenumerate(coeff_array): coeff_array[idx] = 1j * (idx[0] - idx[1]) return coeff_array
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acoeff(self):\n return np.dot(self.mmi,np.dot(self.mmatrix.T,self.bvec))", "def _compute_b_matrix(self) -> None:\n self.b_matrix = self._kronecker_product(tf.eye(self.n_points_int,\n dtype=tf.float64),\n ...
[ "0.6314898", "0.6010264", "0.5852862", "0.57264954", "0.5714183", "0.57140785", "0.56770253", "0.56455976", "0.564191", "0.5627044", "0.56211114", "0.5616878", "0.5616609", "0.5612154", "0.5594928", "0.55856484", "0.5559769", "0.55383754", "0.55161476", "0.55161124", "0.55036...
0.6335417
0
Initialise arrays that will hold momentum and position matrices in their respective basis (only diagonal entries) under unitary timeevolution and computes the momentum and position operators after each iteration and stores them in tensors. Additionally, computes the microcanonical OTOC (c)
def init_compute(params): # unzip dictionary and assign parameters N, M, K, T = params.values() p0 = np.fft.fftfreq(N, 1.0 / N) x0 = np.arange(0, 2 * np.pi, 2 * np.pi / N) p_time_evolution = np.zeros((N, T), dtype="complex_") x_time_evolution = np.zeros((N, T), dtype="complex_") p_time_ev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(M):\n\n t = T.scalar()\n dgamma = T.matrix() # velocity of Euclidean curve\n dsm = T.matrix() # derivative of Euclidean semimartingale\n u = M.FM_element()\n d = M.dim\n\n # Deterministic development\n def ode_development(dgamma,t,u):\n x = u[0:d]\n nu = u[d:].resh...
[ "0.5968374", "0.58851063", "0.5832688", "0.57955104", "0.5791791", "0.5745432", "0.5741553", "0.5735688", "0.57326496", "0.57203805", "0.56878024", "0.5681646", "0.56741714", "0.5659518", "0.56522816", "0.56369907", "0.5602459", "0.5594687", "0.55834895", "0.55351895", "0.551...
0.63071626
0
Tags a photo. Returns true if the photo was tagged, false otherwise. If the photo already has the tag, this is considered a success.
def tag_photo(photo_id, tag_name, user_id=None): db = get_database() photo = get_photo(photo_id, user_id) if not photo: return False tag_name = tag_name.strip().lower() tag = Tag.query.filter_by(tag=tag_name).first() if not tag: tag = Tag(tag=tag_name) db.session.add(tag) db.session.commit() photo = g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_photo_tag(self, tag_name):\n data = self.db.make_query(\n '''select * from photo_tag where tag_name = \"{}\" '''\n .format(tag_name))\n\n if len(data) > 0:\n return True\n return False", "def tag(self, repository: str, tag: Optional[str], force: boo...
[ "0.69589335", "0.6736868", "0.6084362", "0.6025986", "0.5851356", "0.5627572", "0.56024647", "0.55849546", "0.5533153", "0.5501501", "0.5438295", "0.53037816", "0.52874833", "0.5228985", "0.5188661", "0.5185491", "0.5161937", "0.51610476", "0.51548713", "0.51548713", "0.51353...
0.75611085
0
Untags a photo. Returns true if the photo was untagged, false otherwise. If the photo already does not have the tag, this is considered a success.
def untag_photo(photo_id, tag_name, user_id=None): db = get_database() photo = get_photo(photo_id, user_id) if not photo: return False tag_name = tag_name.strip().lower() tag = Tag.query.filter_by(tag=tag_name).first() if not tag: return True photo_tag = PhotoTag.query.filter_by(tag_id=tag.id, photo_id=ph...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_photo(photo_id, tag_name, user_id=None):\n\tdb = get_database()\n\n\tphoto = get_photo(photo_id, user_id)\n\tif not photo:\n\t\treturn False\n\n\ttag_name = tag_name.strip().lower()\n\ttag = Tag.query.filter_by(tag=tag_name).first()\n\tif not tag:\n\t\ttag = Tag(tag=tag_name)\n\t\tdb.session.add(tag)\n\t\t...
[ "0.6170899", "0.60096574", "0.59105897", "0.580249", "0.5790244", "0.57739645", "0.5647035", "0.56177795", "0.54015493", "0.53528", "0.5332508", "0.52831495", "0.5233669", "0.51115745", "0.5084609", "0.50655323", "0.5036791", "0.4999244", "0.4991585", "0.4976553", "0.4951583"...
0.73501134
0
Gets an existing photo. Returns None if the photo_id does not belong to user_id. If user_is not provided, defaults to the currently logged in user.
def get_photo(photo_id, user_id=None): if user_id == None: user_id = current_user.get_user().id return Photo.query.filter_by(id=photo_id, user_id=user_id).first()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image(image_id, user_id):\n\n with image_backend(user_id) as backend:\n return backend.get_image(image_id)", "def get_photo(self, photo_id):\n uri = 'photos/' + photo_id\n return self.make_request(uri)", "def get_photo_path(photo_id, user_id=None):\n\n\tif user_id == None:\n\t\tuser_id ...
[ "0.6505524", "0.6067706", "0.59980583", "0.58206105", "0.56867594", "0.55746037", "0.5572319", "0.5527223", "0.54421145", "0.5316648", "0.53055197", "0.5293172", "0.52736866", "0.5254762", "0.5250345", "0.52422106", "0.5229346", "0.5229346", "0.52186954", "0.5199094", "0.5197...
0.7884641
0
Gets the path (filename) of an existing photo. Returns None if the photo_id does not belong to user_id. If user_is not provided, defaults to the currently logged in user.
def get_photo_path(photo_id, user_id=None): if user_id == None: user_id = current_user.get_user().id photo = Photo.query.filter_by(id=photo_id, user_id=user_id).first() if photo: path = os.path.join(current_app.instance_path, photo.url) return path return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_photo(photo_id, user_id=None):\n\n\tif user_id == None:\n\t\tuser_id = current_user.get_user().id\n\n\treturn Photo.query.filter_by(id=photo_id, user_id=user_id).first()", "def profile_photo(self):\n images_directory_index = 6\n filepath = None\n photo = self.profile_photo_path\n ...
[ "0.6530011", "0.6450243", "0.62919366", "0.5966291", "0.5716511", "0.57012457", "0.5618505", "0.54797435", "0.54769915", "0.54615694", "0.5402259", "0.5347171", "0.53299916", "0.53222126", "0.52954847", "0.52600044", "0.5242613", "0.5219361", "0.5200383", "0.5189885", "0.5147...
0.77551186
0
Sends the full photo to the user. Returns None if the photo_id does not belong to user_id. If user_is not provided, defaults to the currently logged in user.
def send_photo(photo_id, user_id=None): path = get_photo_path(photo_id, user_id) if path: return send_file(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_photo(self, bot, update, photo, **kwargs):\n\n bot.sendChatAction(update.message.chat_id, action=\"upload_photo\")\n return bot.sendPhoto(update.message.chat_id, photo=photo, **kwargs)", "def get_photo(photo_id, user_id=None):\n\n\tif user_id == None:\n\t\tuser_id = current_user.get_user()...
[ "0.63316363", "0.62885314", "0.626324", "0.6196697", "0.6100797", "0.6003126", "0.58738434", "0.58505243", "0.57199496", "0.5655445", "0.551319", "0.54837596", "0.54803497", "0.54596967", "0.54332525", "0.53843236", "0.5357086", "0.5357048", "0.53344876", "0.5292925", "0.5277...
0.74784166
0
Create a photo without any file data with the given name. The photo is assigned to the currently logged in user if user_id is not specified.
def create_photo(name, user_id=None): if user_id == None: user_id = current_user.get_user().id db = get_database() photo = Photo(name=name, user_id=user_id) db.session.add(photo) db.session.flush() return photo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_new_photo(name, file, user_id=None):\n\t# Create photo entry\n\tphoto = create_photo(name)\n\n\t# Save photo\n\tupload_existing_photo(photo, file)\n\n\treturn photo", "def sample_photo(user, title='Lovely Photo'):\n return Photo.objects.create(user=user, title=title)", "def create_image(user_id, ...
[ "0.77914506", "0.67458564", "0.6556521", "0.6267879", "0.6160799", "0.61451906", "0.61112785", "0.60596704", "0.6024128", "0.60183185", "0.59945184", "0.59926754", "0.5988621", "0.59582233", "0.59421927", "0.59314686", "0.58844525", "0.58587587", "0.5837511", "0.574639", "0.5...
0.82998407
0
Creates a new photo and uploads it. The photo is assigned to 'user_id' if provided. Otherwise, the currently logged in user is assigned the photo. Returns the newly created photo.
def upload_new_photo(name, file, user_id=None): # Create photo entry photo = create_photo(name) # Save photo upload_existing_photo(photo, file) return photo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_photo(name, user_id=None):\n\n\tif user_id == None:\n\t\tuser_id = current_user.get_user().id\n\n\tdb = get_database()\n\tphoto = Photo(name=name, user_id=user_id)\n\tdb.session.add(photo)\n\tdb.session.flush()\n\n\treturn photo", "def sample_photo(user, title='Lovely Photo'):\n return Photo.object...
[ "0.7942907", "0.6692077", "0.648388", "0.64003956", "0.63190323", "0.62627196", "0.62396616", "0.6177775", "0.6172136", "0.61542666", "0.61384165", "0.6137287", "0.6108287", "0.6089447", "0.6007912", "0.60071534", "0.5872195", "0.5827818", "0.58083963", "0.5771478", "0.577057...
0.7882051
1
Deletes a photo. The photo is removed from storage as well.
def delete_photo(photo): filename = "%s/%s" % (current_app.instance_path, photo.url) try: os.remove(filename) except: # The file doesn't exist. pass db = get_database() db.session.delete(photo) db.session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def photo_delete(sender, instance, **kwargs):\n\tinstance.photo.delete(False)", "def delete(self, *args, **kwargs):\n self.image.storage.delete(self.image.name)\n delete(self.image)\n super().delete(*args, **kwargs)", "def delete_file(sender, instance, *args, **kwargs):\n if instance.ph...
[ "0.79391176", "0.75871855", "0.7356168", "0.7239739", "0.72220904", "0.7189573", "0.71327937", "0.71310925", "0.69216067", "0.69216067", "0.6832628", "0.6759267", "0.67505664", "0.67434686", "0.67333627", "0.6647772", "0.6622356", "0.6614504", "0.6593143", "0.65862256", "0.65...
0.8375348
0
Rank infinite list of trips using lib trip rank.
def rank_trips(trips:List[Trip]) -> List[int]: trips_dict = {trip.trip_id: trip for trip in trips} trips_ranked_window_five = [] final_ids_ranked = [] for i in range(0, len(trips) - 4, 5): five_ranked_ids = fixtures.rank_trips(trips[i:(i + 5)]) if i+5<len(trips) else fixtures.rank_trips(trips[i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rank_trips_v2(trips:List[Trip]) -> List[int]:\n if len(trips) < 2:\n return trips\n elif len(trips) <= 5:\n return fixtures.rank_trips(trips) \n else:\n ranked_trips = merge_sort_trips(trips)\n return [trip.trip_id for trip in ranked_trips]", "def __rank__(self) -...
[ "0.70010245", "0.61141443", "0.60002804", "0.58735156", "0.585651", "0.57537925", "0.5745264", "0.5699377", "0.5666956", "0.56610733", "0.55326897", "0.5523778", "0.54365784", "0.5432164", "0.5396764", "0.53788555", "0.5371973", "0.5337888", "0.531217", "0.5311249", "0.530889...
0.7134149
0
Encode a 'Signing' message into bytes.
def encode(msg: Message) -> bytes: msg = cast(SigningMessage, msg) signing_msg = signing_pb2.SigningMessage() signing_msg.message_id = msg.message_id dialogue_reference = msg.dialogue_reference signing_msg.dialogue_starter_reference = dialogue_reference[0] signing_msg.dia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_message(message: bytes, sender_private_key: RsaKey) -> bytes:\n return pkcs1_15.new(sender_private_key).sign(SHA256.new(message))", "def sign(self, msg: Dict) -> Dict:\n ser = serialize_msg_for_signing(msg, topLevelKeysToIgnore=[f.SIG.nm,\n ...
[ "0.71510535", "0.68013865", "0.67559075", "0.67180926", "0.6701305", "0.66629297", "0.662252", "0.66030496", "0.6597975", "0.6575549", "0.65619016", "0.6554209", "0.6548688", "0.650956", "0.6498251", "0.64480174", "0.63779855", "0.63758785", "0.63627595", "0.6349911", "0.6349...
0.73898894
0
Decode bytes into a 'Signing' message.
def decode(obj: bytes) -> Message: signing_pb = signing_pb2.SigningMessage() signing_pb.ParseFromString(obj) message_id = signing_pb.message_id dialogue_reference = ( signing_pb.dialogue_starter_reference, signing_pb.dialogue_responder_reference, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(self, crypto):", "def decode_message(self, raw):\n return raw.decode('utf-8')", "def sign(self, bytes):\r\n if not self.hasPrivateKey():\r\n raise AssertionError()\r\n paddedBytes = self._addPKCS1Padding(bytes, 1)\r\n m = bytesToNumber(paddedBytes)\r\n i...
[ "0.61183023", "0.59744656", "0.59650993", "0.595037", "0.5905722", "0.57893497", "0.5763979", "0.57533914", "0.5739624", "0.5720419", "0.5714346", "0.57035404", "0.56965363", "0.5655842", "0.5627187", "0.5618108", "0.56013894", "0.5586349", "0.5549213", "0.55436", "0.55422884...
0.63024235
0
Tests that the authentication backend returns none if the token does not exists
def test_returns_none_if_no_such_token(self): result = PasswordlessAuthenticationBackend().authenticate('no-such-token') self.assertIsNone(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_token(self):\n api_response = requests.get(self.api_config.get_api_url() + \"greetings/isloggedin\",\n headers={\"Authorization\": \"Bearer \" + self.API_TOKEN})\n\n if api_response.status_code == 401 or 403:\n return False\n else:\n ...
[ "0.72637933", "0.7229849", "0.72107416", "0.71965224", "0.7169361", "0.7169361", "0.71229583", "0.7099967", "0.7085434", "0.70067036", "0.70067036", "0.70030606", "0.69727105", "0.6956898", "0.69200426", "0.6906309", "0.69053644", "0.68937737", "0.68885046", "0.6881696", "0.6...
0.8749138
0
Tests that the user with the correct email is returned if the token exists
def test_returns_new_user_with_correct_email_if_token_exists(self): email = 'edith@example.com' token = Token.objects.create(email=email) user = PasswordlessAuthenticationBackend().authenticate(token.uid) new_user = User.objects.get(email=email) self.assertEquals(user, new_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_returns_existing_user_with_correct_email_if_token_exists(self):\r\n email = 'edith@example.com'\r\n existing_user = User.objects.create(email=email)\r\n token = Token.objects.create(email=email)\r\n user = PasswordlessAuthenticationBackend().authenticate(token.uid)\r\n s...
[ "0.8013532", "0.74645233", "0.7451442", "0.74479705", "0.73216754", "0.7300814", "0.72548413", "0.72535205", "0.72382295", "0.704606", "0.699168", "0.693598", "0.6931547", "0.6927095", "0.6908113", "0.68925977", "0.6881654", "0.6880594", "0.68702275", "0.6869365", "0.68570554...
0.79686344
1
tests that the correct user for the token is returned if the user already exists
def test_returns_existing_user_with_correct_email_if_token_exists(self): email = 'edith@example.com' existing_user = User.objects.create(email=email) token = Token.objects.create(email=email) user = PasswordlessAuthenticationBackend().authenticate(token.uid) self.assertEqual...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_returns_new_user_with_correct_email_if_token_exists(self):\r\n email = 'edith@example.com'\r\n token = Token.objects.create(email=email)\r\n user = PasswordlessAuthenticationBackend().authenticate(token.uid)\r\n new_user = User.objects.get(email=email)\r\n self.assertEqu...
[ "0.7521314", "0.7278974", "0.7100507", "0.70321304", "0.6936832", "0.6907738", "0.6905078", "0.68837535", "0.68488425", "0.6830636", "0.6752784", "0.6733311", "0.66693807", "0.666195", "0.665537", "0.66236097", "0.66234034", "0.6618708", "0.6615607", "0.6612222", "0.66108066"...
0.7682538
0
tests the authentication class get_user function returns none if no user was found
def test_returns_none_if_no_user(self): self.assertIsNone(PasswordlessAuthenticationBackend().get_user('edith@example.com'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user():\n try:\n userId = request.args.get('login_as')\n return users[int(userId)]\n except Exception:\n return None", "def test_get_user(self):\n user = User(self.client, \"test-user\", {})\n\n self.assertEqual(user.username, \"test-user\")\n self.assertEq...
[ "0.75293857", "0.74691415", "0.73994565", "0.72023684", "0.7175075", "0.7165074", "0.7147005", "0.714595", "0.7141002", "0.7135205", "0.70909756", "0.7087847", "0.7063624", "0.7053719", "0.7041671", "0.7037213", "0.6999133", "0.6980474", "0.6974275", "0.6974275", "0.6932183",...
0.7773204
0
Generates the QC_Trim commands
def generate_trim_commands(forward_seqs, reverse_seqs, map_file, out_dir, parameters): # we match filenames, samples, and run prefixes samples = make_read_pairs_per_sample(forward_seqs, reverse_seqs, map_file) cmds = [] param_string = _format_params(parameters, ATROPOS_PARAMS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim(qclient, job_id, parameters, out_dir):\n # Step 1 get the rest of the information need to run Atropos\n qclient.update_job_step(job_id, \"Step 1 of 4: Collecting information\")\n artifact_id = parameters['input']\n del parameters['input']\n\n # Get the artifact filepath information\n art...
[ "0.683585", "0.63266486", "0.6288418", "0.6186976", "0.58510095", "0.5763907", "0.5670237", "0.56626654", "0.55723935", "0.55261225", "0.5313643", "0.5313415", "0.5306112", "0.52896935", "0.528762", "0.5241077", "0.52357", "0.52154654", "0.5210487", "0.51883096", "0.5178333",...
0.66786444
1
r"""Download a file from the `url` if it is not in the cache. The file at the `url` is downloaded to the `~/.jhML`.
def get_file(url, file_name=None): cache_dir = os.path.join(os.path.expanduser("~"), ".jhML") if file_name is None: file_name = url[url.rfind('/') + 1:] file_path = os.path.join(cache_dir, file_name) if not os.path.exists(cache_dir): os.mkdir(cache_dir) if os.path.exists(file_path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _download(url):\n \n filename = url.split('/')[-1]\n if os.path.isfile(filename):\n info('Using pre-existed file {} from local system.'.format(filename))\n else:\n info('Downloading {} from OMA Database.'.format(url.split('/')[-1]))\n filename, _ = urlretrieve(url, filename)\n ...
[ "0.7525367", "0.75082433", "0.74431115", "0.7382158", "0.7351716", "0.7316157", "0.7303105", "0.72857004", "0.72617024", "0.7246924", "0.7242186", "0.7224468", "0.7082853", "0.706728", "0.7057179", "0.70281047", "0.70252407", "0.70252407", "0.70156753", "0.70078397", "0.70072...
0.82472557
0
Creates a JWT token for account activation.
def create_jwt_for_account_activation(email: str) -> str: logging.debug('Creating a JWT for account activation - %s', email) return jwt.encode( key=config.JWT_ACTIVATION_SECRET_KEY, algorithm='HS256', payload={ 'sub': 'activation', 'email': email, 'exp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_auth_token():\n data = get_request_data(request)\n address = data.get(\"address\")\n expiration = int(data.get(\"expiration\"))\n\n pk = get_provider_private_key(use_universal_key=True)\n token = jwt.encode({\"exp\": expiration, \"address\": address}, pk, algorithm=\"HS256\")\n token =...
[ "0.7311987", "0.71036845", "0.6983588", "0.68776363", "0.68750894", "0.68676454", "0.6818633", "0.6811045", "0.67879117", "0.67571187", "0.6742507", "0.6725463", "0.6708632", "0.66643095", "0.66524696", "0.6650436", "0.66484785", "0.6637267", "0.6597703", "0.65425956", "0.652...
0.8025082
0
Retrieves an email from the payload of a JWT token. Raises exception if the JWT token is not valid.
def retrieve_email_from_jwt_for_account_activation(token: str) -> str: logging.debug("Retrieving email from JWT for account activation.") try: payload = jwt.decode(token.encode('utf-8'), key=config.JWT_ACTIVATION_SECRET_KEY, algorithm='HS256') except Exception as e: # TODO logging.de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_email():\n headers = request.headers\n token = headers['Authorization'].split()[1]\n return Token.objects(access_token=token).first().email", "def get_email(self, token, uid):\n\n email_info_resp = get_remote(get_config('login.weibo.email_info_url') + token)\n email_info_resp_json ...
[ "0.7630464", "0.7101012", "0.70788604", "0.6519509", "0.6437453", "0.6377152", "0.6299448", "0.62386537", "0.6229537", "0.61632866", "0.6106897", "0.60842735", "0.6023732", "0.60121953", "0.60055405", "0.5980921", "0.5976147", "0.5867186", "0.585634", "0.585634", "0.585634", ...
0.7602766
1
Changes settings that indicate what the solver should be solving for next. Save sol correctly. sol is the solution vector of the last step. sol = anything can be used on first step.
def _advance_settings(self, sol): if self.cond == True: # Save last solution... self.lst_tmp = sol # Check if all timesteps are complete. self.current_T += self.d_T self.step += 1 if self.current_T > self.max_T: retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advance(self, sol):\r\n self.data_saving(sol)\r\n simulation_continues = self._advance_settings(sol)\r\n self.redef_vars()\r\n self.reporting(sol)\r\n self.norm_reporting()\r\n return simulation_continues", "def update_current_sol_and_cost(self,sol=None):\n\n ...
[ "0.66913146", "0.62749034", "0.6065411", "0.60483533", "0.590894", "0.5823087", "0.57761306", "0.5760221", "0.5688091", "0.5680677", "0.56508654", "0.56463283", "0.56280655", "0.56020236", "0.55638695", "0.55544627", "0.55511516", "0.55404", "0.5522256", "0.54638934", "0.5443...
0.68487495
0
Zero step counter and current time
def zero_timings(self): self.step = 0 self.current_T = 0.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self._timestep = np.array([0])", "def zero(self):\n real_dt = self.clock.tick(self.framerate)\n #self.notify(GameClock.REAL_TIME_ADVANCE, real_dt)", "def pre_step(self,status):\n self.t0 = time.time()\n pass", "def _reset(self) -> ts.TimeStep:", "def reset(...
[ "0.7400027", "0.7304187", "0.71039325", "0.6968158", "0.6873948", "0.66307056", "0.6536727", "0.65258205", "0.6445208", "0.6304525", "0.6256326", "0.6243078", "0.62241364", "0.62081534", "0.62007654", "0.618742", "0.61800855", "0.60946125", "0.6082498", "0.6034064", "0.592827...
0.8421047
0
Use matplotlib to spy a matrix
def matrix_spy(self, mtrx): import matplotlib.pylab as pl pl.spy(mtrx,precision=0.01, markersize=1) pl.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_matrix_method(pulse, trap, ToP):\n n0, d = trap.matrix_method(pulse)\n for k in range(len(d)):\n ave_list = []\n timestep = np.arange(0, trap.N+1, 1)\n for i in range(len(d[k])):\n sum2 = 0\n for j in range(len(d[k][i])):\n sum2 += (j) * d[k]...
[ "0.6077472", "0.5964652", "0.58163995", "0.58161247", "0.5802232", "0.5707331", "0.5702342", "0.5663303", "0.56258637", "0.5592297", "0.5566225", "0.5565246", "0.55405426", "0.5539117", "0.5531702", "0.5489525", "0.5462974", "0.5456028", "0.5421599", "0.5407301", "0.53862625"...
0.81376123
0
Check stability of solution. Finds primary eigenvalue of system. Asserts if more than 1.
def check_k_matrix_stability(self): K = self.make_k_matrix() vals, vects = scipy_sparse_eigens(K) principal_val = vals.max() print("ht3_solver:\t'Stiffness' matrix principal eigenvalue was " + str(principal_val)) if principal_val > 1: print("#######...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check(mat, otp):\n prd = mat*otp\n eigval = prd[0]/otp[0]\n print 'computed eigenvalue :' , eigval\n [eigs, vecs] = np.linalg.eig(mat)\n abseigs = list(abs(eigs))\n ind = abseigs.index(max(abseigs))\n print ' largest eigenvalue :', eigs[ind]", "def test_solvers():\n # With P1 elements...
[ "0.64764154", "0.64108884", "0.62699133", "0.62134963", "0.6154984", "0.61546236", "0.61504465", "0.61401653", "0.6127186", "0.6122965", "0.6071393", "0.6069818", "0.601245", "0.5990802", "0.59771967", "0.5934318", "0.59312296", "0.5915107", "0.59050804", "0.58882725", "0.588...
0.68899626
0
Calculate L1, L2 and Linf norms and print to file. File is given by self.norm_path If an expected solution is given, expected L1, L2 and abs erros will also be computed. Expected solution is f(x, t) where x is global coordinate and t is time.
def norm_reporting(self): if self.norm_saving_rule is not None: norm_rule = self.norm_saving_rule(self.step, self.d_T) else: norm_rule = True if self.norm_path is not None and norm_rule: f = open(self.norm_path, 'a', newline="") csvf = csv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_norm(self):\n # loop through all the filename\n for f5 in self.train_database:\n\n # get the precalculated data\n fdata = os.path.splitext(f5)[0] + '_norm.pckl'\n\n # if the file doesn't exist we create it\n if not os.path.isfile(fdata):\n ...
[ "0.55692875", "0.54376626", "0.50235313", "0.4963999", "0.4872999", "0.48711163", "0.48684964", "0.48494893", "0.4843204", "0.48130316", "0.48026887", "0.47972482", "0.4758948", "0.47379422", "0.47259918", "0.46990478", "0.46983588", "0.46347976", "0.46319932", "0.46254238", ...
0.71914333
0
Compare a solution to a FEM reference solution
def compare_solutions(self, FEM_ref_sol, time, series='Temperature', path=None, mesh_mapping=None, save_as_vtu=True): if path == None: path = self.save_path+"_comp_sols.csv" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_solutions(solution, filename):\n with open(filename) as f:\n content = ast.literal_eval(f.read()) # parse string repr of the output to a list\n return solution == content", "def test_get_solution(self):\n pass", "def solution(self, solution: Path, bundle: Bundle):\n ...
[ "0.6210738", "0.57919294", "0.5745451", "0.56757915", "0.565961", "0.56125337", "0.55110097", "0.54660773", "0.542077", "0.54162514", "0.5359694", "0.53146446", "0.5287936", "0.52809936", "0.5276253", "0.5276163", "0.5265088", "0.5264816", "0.52463746", "0.5229991", "0.522897...
0.605295
1
Rendering text in a window and placing data entry fields.
def main_window_text(self) -> None: tk.Label(text='Название книги:').grid(row=0, column=0, padx=10, pady=10) tk.Label(text='Автор:').grid(row=1, column=0, padx=10) tk.Label(text='Жанр:').grid(row=2, column=0, padx=10, pady=10) entry_title = tk.Entry(width=45) entry_title.grid(row...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def displayText(self):\n if self.entryWidget.get().strip() == \"\":\n tkMessageBox.showerror(\"Tkinter Entry Widget\", \"Enter a text value\")\n else:\n self.file_com.write(self.entryWidget.get().strip()+'\\n')", "def textentry(self, parent, variable, label):\n # pack a...
[ "0.6733427", "0.6384407", "0.63377374", "0.63295066", "0.6320589", "0.62267315", "0.6192366", "0.61501503", "0.61278635", "0.61269283", "0.6098317", "0.6081952", "0.60348564", "0.59971297", "0.5979407", "0.5946554", "0.5944347", "0.59384257", "0.5934913", "0.59174144", "0.590...
0.6892847
0
Clears the search bar.
def _clear_search_bar(self): self.search_bar.setText("") self.search_bar.setFocus()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __searchClearMarkers(self):\n self.activeWindow().clearSearchIndicators()", "def resetSearch(entry,searchCommand):\n\taddDataToWidget(entry,\"\")\n\trunCommand(searchCommand)", "def _(event):\n search_buffer = event.cli.buffers[SEARCH_BUFFER]\n\n search_buffer.reset()\n event.cl...
[ "0.7494229", "0.72530705", "0.68444264", "0.663171", "0.6616456", "0.6569816", "0.6538454", "0.65167445", "0.64899653", "0.64673346", "0.64512825", "0.64437383", "0.64305097", "0.64063007", "0.64059985", "0.640341", "0.6392905", "0.6386323", "0.637754", "0.636638", "0.636638"...
0.9045618
0
r""" Initialize the stream with the ast that will produce this stream of objects. The user will almost never use this initializer.
def __init__(self, the_ast): self._ast = the_ast
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__ (self, stream):\n self.classes = [ ]\n self.functions = [ ]\n self.classDocs = [ ]\n\n if stream is not None:\n self.read(stream)", "def __init__(self):\n log.msg(\"Initializing Twitch parser.\")\n\n # initialize our data members\n self.streams = tuple()\n ...
[ "0.68969566", "0.6610674", "0.6556938", "0.6385011", "0.6377803", "0.6377803", "0.63255113", "0.6307727", "0.62828296", "0.6246137", "0.6227066", "0.6206207", "0.6201002", "0.6200042", "0.6173093", "0.6107011", "0.6083679", "0.6070142", "0.602574", "0.6022117", "0.6009696", ...
0.74345356
0
r""" Return the sequence of items as a ROOT TTree. Each item in the ObjectStream will get one entry in the file. The items must be of types that the infrastructure
def AsROOTTTree(self, filename, treename, columns=[]): return ObjectStream(ResultTTree(self._ast, columns, treename, filename))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_file(filename, items, folders):\n filename_abs = os.path.join(ROOT_DATA, filename)\n if os.path.isfile(filename_abs):\n root = ROOT.TFile.Open(filename_abs, \"READ\")\n if not root:\n print(\"File '%s' is not a root file\" % filename_abs)\n return None\n ...
[ "0.5508605", "0.5405508", "0.53563607", "0.5312198", "0.5302163", "0.5286656", "0.52832603", "0.5263575", "0.5256124", "0.5242858", "0.5220302", "0.5193929", "0.5183157", "0.5164565", "0.5151628", "0.5146107", "0.5141552", "0.51360893", "0.512639", "0.509513", "0.5089428", ...
0.6185486
0
We get the notification that the file has been uploaded.
def notify_upload(): file_type = request.json.get("file_type") file_name = request.json.get("file_name") file_path = request.json.get("file_path") file_size = request.json.get("file_size") print("File was uploaded:", file_path, file_name, file_type) # Marks the upload as confirmed. d = datet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_file_upload_status(\n self, file_name: str, status: FileManagementStatus\n ) -> None:\n message = self.message_factory.make_from_file_management_status(\n status, file_name\n )\n if not self.connectivity_service.publish(message):\n self.message_queue.put...
[ "0.72332937", "0.6826099", "0.67252356", "0.669396", "0.6651103", "0.64940315", "0.64732903", "0.6469971", "0.6466714", "0.6447727", "0.64468664", "0.63912904", "0.63696146", "0.63658977", "0.6341158", "0.6338254", "0.6318352", "0.6298421", "0.6280171", "0.62607", "0.61797124...
0.78712845
0
Calculate the probability of achieving all successes Given a certain number of dice, their probability of a success, and the allowed number of rolls/rerolls, calculates the probability of achieving all successes. This implements a recursion I solved when thinking about this problem. f(p,1,n) = p^n, the probability of r...
def probability_of_all_successes(p: float, r: int, n: int) -> float: if r == 1: return pow(p, n) elif n == 0: return 1 else: result = 0 for x in range(0, n+1): result += pow(p, x) * pow(1-p, n-x) * probability_of_all_successes(p, r-1, n-x) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prob_of_roll(dice: Tuple[int, ...], total: Optional[int] = None) -> pd.DataFrame:\n dice = {f'{i}_d{d}': range(1, d + 1) for i, d in enumerate(dice)}\n combinations = list(itertools.product(*dice.values()))\n df = (pd.DataFrame(combinations, columns=dice.keys())\n .assign(total=lambda x: x.su...
[ "0.67905885", "0.6688306", "0.6612852", "0.63708943", "0.63187337", "0.6314003", "0.6271191", "0.6218371", "0.6189899", "0.6186982", "0.61848557", "0.6174344", "0.6172727", "0.61723155", "0.6090661", "0.60187304", "0.59495205", "0.5918823", "0.5900799", "0.58694553", "0.58660...
0.7424197
0
Pretty print the results of probability_of_all_successes
def pretty_print_poas_result(probability: float, rerolls: int, num_objects: int): result = probability_of_all_successes(probability, rerolls, num_objects) print(f"Given {num_objects} dice with a probability of success of {probability} and {rerolls} rolls") print(f"The probability of achieving all successes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_results(self):\n self.accuracy = round(accuracy_score(self.y_val, self.y_pred, 'weighted'), 4)\n self.f1 = round(f1_score(self.y_val, self.y_pred, average='weighted'), 4)\n self.precision = round(precision_score(self.y_val, self.y_pred, average='weighted'), 4)\n\n print(f'Resu...
[ "0.6881748", "0.67664963", "0.6735734", "0.67205274", "0.6649825", "0.661655", "0.65694964", "0.6528802", "0.65250605", "0.65111965", "0.6422836", "0.6419955", "0.63964987", "0.63843995", "0.6353819", "0.63460255", "0.63327503", "0.63321286", "0.6326144", "0.63111883", "0.629...
0.7405338
0
Run simulate_rerolling for a given number of trials and print the result For a given number of trials, run the simulate_rerolling simulation and average all of the results. This gives the expected number of rolls/rerolls we must perform before we have all successes
def average_simulate_rerolling(probability: float, num_objects: int, trials: int): results = [] for _ in range(trials): results.append(simulate_rerolling(probability, num_objects)) print(f"Given {num_objects} dice with a probability of success of {probability}, after {trials} trials") print(f"N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(numTrials):\n # Your Code Here\n hits = 0.0\n for i in range(numTrials):\n result = trial()\n #print result\n hits += result\n return hits / numTrials", "def simulate(self, num_games):\r\n # self.runs = num_games #Initializes a tracker for the number of runs\r\n ...
[ "0.65833175", "0.6366467", "0.6313566", "0.61828446", "0.61517274", "0.61462194", "0.6137604", "0.61247057", "0.6109722", "0.60761017", "0.60535055", "0.6050241", "0.6050134", "0.602638", "0.60069436", "0.59209996", "0.59156096", "0.5860882", "0.5851478", "0.58401924", "0.583...
0.7893863
0
Check if two numbers are within a certain error of each other
def are_close(num1: float, num2: float, error: float) -> bool: if abs(num1-num2) < error: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consistancy_test(a, b, aErr, bErr = 0):#TODO: fully test this aproach\n return int(np.ceil(np.abs(b - a) / np.sqrt(bErr**2 + aErr**2)))", "def within_value(v1, v2):\n percentage = 0.1\n error_allowed = percentage * v1\n high = v1 + error_allowed\n low = v1 - error_allowed\n\n return low <= ...
[ "0.72634363", "0.70664", "0.67628", "0.67364", "0.66185075", "0.6564737", "0.6547066", "0.65314746", "0.6495302", "0.6487915", "0.64297456", "0.6420305", "0.64202654", "0.6413313", "0.63957506", "0.63926774", "0.63817656", "0.6378069", "0.6351713", "0.63172364", "0.63172364",...
0.76745415
0
Some test cases for probability_of_all_successes
def test_probability_of_all_successes(): assert(probability_of_all_successes(1/2,1,2) == 0.25) assert(are_close(probability_of_all_successes(1/6,1,2), 1/36, 0.001)) assert(are_close(probability_of_all_successes(1/2,2,2), 7/16, 0.001))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probability_of_all_successes(p: float, r: int, n: int) -> float:\n\n if r == 1:\n return pow(p, n)\n elif n == 0:\n return 1\n else:\n result = 0\n for x in range(0, n+1):\n result += pow(p, x) * pow(1-p, n-x) * probability_of_all_successes(p, r-1, n-x)\n ...
[ "0.6936601", "0.6664292", "0.66631645", "0.6586792", "0.6584908", "0.6570972", "0.6527964", "0.64336675", "0.62824607", "0.6241327", "0.6203977", "0.6199201", "0.61862606", "0.615248", "0.60994565", "0.60717577", "0.6062275", "0.6058721", "0.60521495", "0.59509856", "0.594080...
0.84885967
0
Allows Users to edit their account info, such as their email and password. Implementation of the AccountSettingsView.
def account_settings(request): assert isinstance(request, HttpRequest) if request.method == "POST": form = UserChangeForm(request.POST, instance=request.user) if form.is_valid(): user = form.save(commit=False) if len(form.cleaned_data["password"]) > 0: us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_settings(request):\n # Include email and password changing in settings handler so form\n # validation errors appear on settings page.\n old_email = request.user.email\n if request.method == 'POST' and 'change_email' in request.POST:\n email_form = ChangeEmailForm(request.POST, old_em...
[ "0.7434128", "0.70122176", "0.65583986", "0.636276", "0.6248716", "0.61849844", "0.6114714", "0.6070023", "0.60032195", "0.6001212", "0.58814716", "0.58777857", "0.5845628", "0.5818513", "0.5755409", "0.5748084", "0.5716239", "0.5675303", "0.5671848", "0.5655881", "0.5651442"...
0.76723003
0
renders the trending page
def trending(request): assert isinstance(request, HttpRequest) try: stocks = StockList.objects.all() hold = [] count = 0 except StockList.DoesNotExist: return print("No Stocks Available") while len(hold) < 8: for stock in stocks: stock.trend = stoc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trending(request):\n\titems = Item.objects.all()\n\ttrending = []\n\n\tfor item in Item.objects.order_by('-dailyVisits'):\n\t\t#Include items that have been uploaded within the past day and havent been sold\n\t\tif (date.today() - item.datePosted).days <= 0 and item.sold_to == None:\n\t\t\tif (len(trending) <=...
[ "0.68559766", "0.6295515", "0.6277298", "0.6245203", "0.622359", "0.61615133", "0.61368996", "0.6067943", "0.60238075", "0.59976786", "0.59772927", "0.5917164", "0.5844733", "0.5836843", "0.5825049", "0.5824816", "0.58095306", "0.5795138", "0.5763063", "0.5749309", "0.5745847...
0.6601207
1
Displays all stocks. User is able to filter stocks, using buttons provided to the user, by Price, Sentiment, and StockName. All of these filters can be toggled to be in either ascending or descending order. Direct implementation of the FilterStockView.
def stocks(request): try: stocks = StockList.objects.all() except StockList.DoesNotExist: stocks = None context = { 'title': 'Filter Stocks', 'year': datetime.now().year, 'user': request.user, 'stocks': stocks, } return render( request, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(self, request):\n\n stocks = Stock.objects.all()\n serializer = StockSerializer(stocks, many=True)\n return Response(serializer.data, status.HTTP_200_OK)", "def retrieveAllDistinctStocks(self):\n return self.db.select_all_distinct_stocks()", "def history():\n \"\"\"Show ...
[ "0.63406605", "0.5798307", "0.5752256", "0.5661666", "0.5644087", "0.56410515", "0.5636392", "0.5636154", "0.5573223", "0.5552212", "0.5549842", "0.5541733", "0.55342644", "0.55234843", "0.5513628", "0.5484633", "0.5403669", "0.53891045", "0.5384445", "0.5316756", "0.53150934...
0.7166876
0
Displays the selected stock, providing the name, sentiment, and the price of said stock. Direct implementation of the StockView.
def stock(request, s_id): assert isinstance(request, HttpRequest) try: #Get the requested stock with (stock_id) stocks = StockList.objects.filter(stock_id=s_id).get() stock_id = stocks.stock_id stock_name = stocks.symbol stock_value = stocks.value #do we have a s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stock_view(request):\n if request.method == 'GET':\n try:\n symbol = request.GET['symbol']\n except KeyError:\n return {}\n try:\n response = requests.get(API_URL + '/stock/{}/company'.format(symbol))\n data = response.json()\n retu...
[ "0.62709934", "0.62612647", "0.62485635", "0.60026693", "0.592461", "0.59138197", "0.58526856", "0.57856214", "0.57244945", "0.5683895", "0.56825393", "0.56317514", "0.56277454", "0.5605878", "0.55981827", "0.5585482", "0.5584243", "0.55689496", "0.55596864", "0.55541444", "0...
0.7422457
0
Allows Users to create a new Watchlist
def create_watchlist(request): # Below loop seems very inefficient, since it querys the database # TODO: See if the below loop can be optimized, or another solution # is available. # Get the current highest watchList_id try: watchlist = WatchList.objects.latest() watchlist_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_watchlist(name, user_id):\n watchlist = Watchlist(\n name = name, \n user_id = user_id\n )\n \n db.session.add(watchlist)\n db.session.commit()\n\n return watchlist", "def __init__(__self__, *,\n watchlist_id: pulumi.Input[str],\n wat...
[ "0.7325427", "0.6267545", "0.6190541", "0.6150246", "0.59611124", "0.5956357", "0.594649", "0.594649", "0.594649", "0.59319955", "0.5924205", "0.5896398", "0.5896398", "0.58567035", "0.5854901", "0.58541435", "0.5847053", "0.58465815", "0.58413273", "0.5820835", "0.5816319", ...
0.723283
1
Deletes a User's Watchlist where watchList_id=id. Redirects to /watchlists/ after execution.
def delete_watchlist(request, w_id): try: watchlist = WatchList.objects.filter(user=request.user).get(watchList_id=w_id) except WatchList.DoesNotExist: return redirect('watchlists') watchlist.delete() return redirect('watchlists')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manage_watchlists(request):\n assert isinstance(request, HttpRequest)\n\n try:\n # Handling deleting Watchlist(s)\n if request.method == \"POST\":\n # Get list of selected checkmark boxes\n watchlists_to_delete = request.POST.getlist('delWatchListId')\n for ...
[ "0.6410832", "0.62330365", "0.61755645", "0.61663187", "0.6013739", "0.592736", "0.58316094", "0.57497805", "0.57326704", "0.56883246", "0.564724", "0.56429976", "0.5639883", "0.56356984", "0.5621058", "0.56124485", "0.560047", "0.55856293", "0.5584695", "0.5572463", "0.55544...
0.8551365
0
Allows Users to create and delete Watchlists from their account. Direct implementation of the ManageWatchlistView.
def manage_watchlists(request): assert isinstance(request, HttpRequest) try: # Handling deleting Watchlist(s) if request.method == "POST": # Get list of selected checkmark boxes watchlists_to_delete = request.POST.getlist('delWatchListId') for watchlist_id in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_watchlist(request, w_id):\n try:\n watchlist = WatchList.objects.filter(user=request.user).get(watchList_id=w_id)\n except WatchList.DoesNotExist:\n return redirect('watchlists')\n watchlist.delete()\n return redirect('watchlists')", "def create_watchlist(request):\n\n # B...
[ "0.6297587", "0.595493", "0.5712135", "0.56618613", "0.5633352", "0.5611895", "0.5321622", "0.53103226", "0.5265301", "0.5262247", "0.52606416", "0.5250518", "0.5248871", "0.5230241", "0.5209476", "0.5166371", "0.51378316", "0.5135525", "0.5120909", "0.5105004", "0.5089999", ...
0.72588384
0
Page where Users can add/remove Stocks from a specific Watchlist Direct implementation of the EditWatchlistView.
def edit_watchlist(request, w_id): assert isinstance(request, HttpRequest) # Get the user's watchlist that matches the provided id try: watchlist = WatchList.objects.filter(user=request.user, watchList_id=w_id).get() watchlist_id = watchlist.watchList_id watchlist_name = watchlist.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def watchlists(request):\n \"\"\"\n Alternative to @login_required decorator: manually test with:\n request.user.is_authenticated\n \"\"\"\n assert isinstance(request, HttpRequest)\n\n # Get all of the user's watchlists\n watchlists = WatchList.objects.filter(user=request.user).all()\n ...
[ "0.58458495", "0.5819087", "0.55722135", "0.5433836", "0.5122696", "0.5097534", "0.5068661", "0.5053849", "0.5053286", "0.4996129", "0.49931148", "0.49425825", "0.48860303", "0.4858759", "0.48571426", "0.48514402", "0.48511544", "0.48433307", "0.4835179", "0.4833105", "0.4820...
0.62513083
0
Initialise given the type and value.
def __init__(self, type, value): self.type = type self.value = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, type, value):\r\n self._type = type\r\n self._value = value", "def __init__(self, type, value,):\n self.type = type\n self.value = value", "def __init__(self, type_: Union[ConstraintTypes, str], value: Any):\n self.type = ConstraintTypes(type_)\n sel...
[ "0.7659906", "0.7468749", "0.6850241", "0.68287164", "0.65762985", "0.6521753", "0.64979446", "0.6404977", "0.6335378", "0.6326324", "0.63115156", "0.6291628", "0.6281383", "0.6281383", "0.6281383", "0.6281383", "0.6281383", "0.6281383", "0.62743884", "0.626497", "0.6212518",...
0.7627943
1
Sets the pthid of this Thread.
def pthid(self, pthid): self._pthid = pthid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thid(self, thid):\n\n self._thid = thid", "def thread_id(self, thread_id):\n\n self._thread_id = thread_id", "def thread_id(self, thread_id):\n\n self._thread_id = thread_id", "def thread_id(self, thread_id):\n\n self._thread_id = thread_id", "def pid(self, pid):\n\n ...
[ "0.72480106", "0.6926966", "0.6926966", "0.6926966", "0.6742504", "0.6742504", "0.6700898", "0.66840965", "0.63728267", "0.627035", "0.622268", "0.6181539", "0.61787826", "0.6133578", "0.6112368", "0.6112368", "0.6035746", "0.59666836", "0.5958457", "0.59483874", "0.5893692",...
0.8066558
0
Sets the received_orders of this Thread.
def received_orders(self, received_orders): self._received_orders = received_orders
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders(self, orders):\n\n self._orders = orders", "def orders(self, orders):\n\n self._orders = orders", "async def on_orders_replaced(self, orders: List[MetatraderOrder]):\n self._orders = orders", "def received_order(self, order):\n\t\tif order.direction == ORDERDIR.IN:\n\t\t\tself...
[ "0.6786346", "0.6786346", "0.6680266", "0.6170726", "0.61563283", "0.603664", "0.5962039", "0.58325493", "0.5801888", "0.57870305", "0.57870305", "0.5752953", "0.56680435", "0.56383055", "0.56383055", "0.56383055", "0.5635519", "0.558436", "0.5562859", "0.55175805", "0.545876...
0.82472265
0
Sets the sender_order of this Thread.
def sender_order(self, sender_order): self._sender_order = sender_order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_task_order(self, order):\n for task in self.tasks:\n task.order = order", "def set_order(self, order):\n self.order = order", "def set_order(self, order):\n self.order = order", "def order(self, order):\n self._order = order", "def SetOrder(self, order):\n ...
[ "0.6738106", "0.67285603", "0.67285603", "0.641746", "0.6392167", "0.63920426", "0.63920426", "0.63920426", "0.6216461", "0.596148", "0.5932994", "0.5864125", "0.5864125", "0.5864125", "0.5864125", "0.5864125", "0.5649165", "0.55945116", "0.5574294", "0.5551362", "0.5378497",...
0.83562696
0
Sets the thid of this Thread.
def thid(self, thid): self._thid = thid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thread_id(self, thread_id):\n\n self._thread_id = thread_id", "def thread_id(self, thread_id):\n\n self._thread_id = thread_id", "def thread_id(self, thread_id):\n\n self._thread_id = thread_id", "def set_tid(self, tid):\n self.__tid = tid", "def pthid(self, pthid):\n\n ...
[ "0.71798706", "0.71798706", "0.71798706", "0.7097371", "0.6712861", "0.5938794", "0.57075554", "0.5689583", "0.5666702", "0.5609876", "0.56035346", "0.56035346", "0.559792", "0.55645794", "0.5563854", "0.5559026", "0.5547788", "0.55468583", "0.5533373", "0.55246586", "0.55246...
0.8122559
0
construct a test method based on on the notebook name, path, and nbconvert Preprocessor options Required Inputs
def get_test(nbname, nbpath, timeout=600): # use nbconvert to execute the notebook def test_func(self): cwd = os.getcwd() passing = True print( "\n---------------------" " Testing {0}.ipynb " "---------------------".format(nbname) ) i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_test_func(nb_name, nb_path, clearoutput=True):\n\n nb_func = f'\\ndef test_{nb_name}():\\n'\\\n f' fpath_rel = {nb_path.split(os.sep)[1:]}\\n'\\\n ' fname = os.path.join(nb_dir, *fpath_rel)\\n'\\\n ' tf.run_notebook(fname, clearoutput=False)\\n'\\\n ...
[ "0.6850153", "0.61747766", "0.60934234", "0.6022499", "0.6000619", "0.5956608", "0.5937648", "0.58694273", "0.58694273", "0.5833995", "0.58074576", "0.5718149", "0.57117265", "0.5710831", "0.5669661", "0.56397384", "0.5630445", "0.5626195", "0.5597108", "0.55695677", "0.55236...
0.6909046
0
Reads in lines from urls.txt, gives the status and other information on them
def readLines(): with open("text/urls.txt", "r") as f: urls = f.readlines() # cleans up the strings urls = [url.replace("\n", "") for url in urls] urls = [url.replace(" ", "") for url in urls] writeLines(urls)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_textfile(inf):\n list_of_urls_to_check = [line.rstrip() for line in inf.readlines()]\n return list_of_urls_to_check", "def read_urls(filename):\n \n urls = []\n with open(filename, 'r') as f:\n for line in f:\n if 'puzzle' in line:\n match = re.search(r...
[ "0.7018254", "0.66988343", "0.66491723", "0.6455066", "0.6397311", "0.6393156", "0.6373262", "0.6252797", "0.6109572", "0.6093909", "0.6017847", "0.5956489", "0.59421873", "0.5919607", "0.5848102", "0.5759251", "0.5747901", "0.57373804", "0.5727888", "0.56903315", "0.568525",...
0.6895754
1
Checks the status of the urlwhat the status number is, and whether it is an Index Of page If there is an errorthe website doens't load, for example, return that error
def checkStatus(url): def checkForIndexPage(r): """Checks whether it a given url is actually an Index Of page. Takes in a Request object""" soup = BeautifulSoup(r.text, 'lxml') head = soup.find('h1') if head != None and head.string != None and ("Index of " in head.string): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_check_url(self,url):\n r = requests.get(url).status_code\n if r==requests.codes.ok:\n return(True)\n else:\n print \"something wrong! status_code: \" + r\n return(False)", "def url_was_found(url=\"localhost:5000/health\"):\n res = requests.get(url)...
[ "0.7355547", "0.7118734", "0.7070988", "0.70274246", "0.6892752", "0.6865774", "0.68003565", "0.67811525", "0.67793566", "0.6762191", "0.6718683", "0.6700998", "0.6630522", "0.6618586", "0.65520173", "0.65444887", "0.65439695", "0.64959097", "0.6469197", "0.6456228", "0.64496...
0.8258082
0
Checks whether it a given url is actually an Index Of page. Takes in a Request object
def checkForIndexPage(r): soup = BeautifulSoup(r.text, 'lxml') head = soup.find('h1') if head != None and head.string != None and ("Index of " in head.string): return "Shows 'Index Of' page ✘" else: return "Displays properly ✓"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_idx(self, url):\n if not url.endswith('.idx'):\n url += '.idx'\n return requests.head(url).ok", "def is_store_page(entry):\n pattern = re.compile(\"^/view\\d*/.*$\")\n return entry[\"method\"] == \"GET\" and pattern.match(entry[\"uri\"]) != None", "def checkStatus(url)...
[ "0.6797171", "0.6227941", "0.6205323", "0.6184429", "0.6150051", "0.57591945", "0.5743825", "0.57144886", "0.5621335", "0.5575922", "0.5543459", "0.5508243", "0.5484011", "0.5478684", "0.54784095", "0.54734105", "0.54732513", "0.5468332", "0.54342926", "0.5427616", "0.5397525...
0.6903802
0
Test when issues do not have a parent issue
def test_get_updated_issues_without_parent(self): with open("issues_without_parent.json", "r") as issues_file: mock_response = issues_file.read() with requests_mock.Mocker() as m: m.register_uri('GET', '/rest/api/2/search', text=mock_response) issues = jiratimereport...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_lacking_parent(self):\n pass", "def test_parent_does_not_exist(self):\n self.bad_data_fail(self.test_data['pants'],\n self.test_data['hats'], 'Parent does not exist')", "def test_add_self_as_parent(self):\n groupa = Group('groupa')\n with pytest.ra...
[ "0.720484", "0.6333494", "0.61962134", "0.6195259", "0.6146895", "0.60996616", "0.60707366", "0.6057688", "0.6027769", "0.59993476", "0.5989757", "0.59845847", "0.5968011", "0.5962105", "0.59547395", "0.5866312", "0.58635676", "0.57914597", "0.574251", "0.574251", "0.57309926...
0.6518267
1
Test the conversion of json issues to object issues
def test_convert_json_to_issues(self): with open("convert_json_to_issues.json", "r") as issues_file: response_json = json.loads(issues_file.read()) issues = jiratimereport.convert_json_to_issues(response_json) issues_expected_result = [ Issue(10005, "MYB-5", "Summary of...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testfromjson(self):\n dicty = {\"id\": 5, \"class\": \"string\", \"list\": [], \"set\": {}}\n self.assertEqual([dicty, dicty],\n Base.from_json_string(json.dumps([dicty, dicty])))", "def test_json_loads_object() -> None:\n assert json_loads_object('{\"c\":1.2}') == {\...
[ "0.6965997", "0.6955709", "0.6955709", "0.6949413", "0.6914408", "0.6651135", "0.65893173", "0.6551188", "0.6508977", "0.6478302", "0.64725137", "0.64644873", "0.6453786", "0.6436468", "0.6400618", "0.6383816", "0.6380621", "0.6368812", "0.63525397", "0.6345754", "0.632622", ...
0.7233345
0
Test the single page response when retrieving Jira issues
def test_get_updated_issues_one_page(self): with open("issues_one_page.json", "r") as issues_file: mock_response = issues_file.read() with requests_mock.Mocker() as m: m.register_uri('GET', '/rest/api/2/search', text=mock_response) issues = jiratimereport.get_updated...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_existing_issue_passes(self):\n response = self.client.get(self.url)\n response_json = response.get_json()\n self.assertEqual(response.status_code, 200)\n self.assertEqual(response_json[\"name\"], TEST_ISSUE_NAME)", "def test_issues_list(self):\n response = self.cli...
[ "0.74503416", "0.7094505", "0.7088346", "0.7062276", "0.6944259", "0.6938249", "0.6899283", "0.68890667", "0.6797187", "0.67301536", "0.67243993", "0.66074836", "0.6581828", "0.65035576", "0.65014946", "0.6477712", "0.64711165", "0.645216", "0.6413023", "0.64115626", "0.63370...
0.77025616
0
Test the multiple pages response when retrieving Jira issues (pagination)
def test_get_updated_issues_multiple_pages(self): with open("issues_multiple_first_page.json", "r") as issues_first_file: mock_response_first_page = issues_first_file.read() with open("issues_multiple_second_page.json", "r") as issues_second_file: mock_response_second_page = iss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_updated_issues_one_page(self):\n with open(\"issues_one_page.json\", \"r\") as issues_file:\n mock_response = issues_file.read()\n\n with requests_mock.Mocker() as m:\n m.register_uri('GET', '/rest/api/2/search', text=mock_response)\n issues = jiratimerep...
[ "0.7250544", "0.71837443", "0.6884279", "0.68545246", "0.68167686", "0.67703754", "0.6695603", "0.6637052", "0.6611962", "0.65908766", "0.6514894", "0.6496308", "0.64865696", "0.6438874", "0.63897264", "0.63649464", "0.63649464", "0.63618314", "0.6316557", "0.6290466", "0.627...
0.75254667
0
Test the single page response when retrieving Jira work logs
def test_get_work_logs_one_page(self): with open("work_logs_first_issue_one_page.json", "r") as first_issue_file: mock_response_first_issue = first_issue_file.read() with open("work_logs_second_issue_one_page.json", "r") as second_issue_file: mock_response_second_issue = second_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_work_logs_multiple_pages(self):\n with open(\"work_logs_multiple_first_page.json\", \"r\") as issues_first_file:\n mock_response_first_page = issues_first_file.read()\n\n with open(\"work_logs_multiple_second_page.json\", \"r\") as issues_second_file:\n mock_respons...
[ "0.6750942", "0.6672471", "0.6070962", "0.6000604", "0.59791046", "0.59626675", "0.596023", "0.593353", "0.5840506", "0.58361435", "0.5819851", "0.58129126", "0.5790163", "0.5786302", "0.576526", "0.5739747", "0.5691096", "0.5661728", "0.5644197", "0.5636788", "0.5630645", ...
0.6994508
0
Test the multiple pages response when retrieving Jira work logs (pagination)
def test_get_work_logs_multiple_pages(self): with open("work_logs_multiple_first_page.json", "r") as issues_first_file: mock_response_first_page = issues_first_file.read() with open("work_logs_multiple_second_page.json", "r") as issues_second_file: mock_response_second_page = is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_work_logs_one_page(self):\n with open(\"work_logs_first_issue_one_page.json\", \"r\") as first_issue_file:\n mock_response_first_issue = first_issue_file.read()\n\n with open(\"work_logs_second_issue_one_page.json\", \"r\") as second_issue_file:\n mock_response_seco...
[ "0.7200031", "0.66805685", "0.6650853", "0.6601061", "0.6430808", "0.63457406", "0.6279656", "0.6261222", "0.621969", "0.6196999", "0.612971", "0.6080827", "0.605526", "0.59867334", "0.59738255", "0.5971564", "0.5957453", "0.5955607", "0.59216136", "0.5888905", "0.58683413", ...
0.743094
0
Test the formatting of the time field when the time is greater than several days
def test_format_optional_time_field(self): formatted_time = jiratimereport.format_optional_time_field(99960, "") expected_result = "27:46:00" self.assertEqual(expected_result, formatted_time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_filter(target_time, format, delta_hours):\n return datetime.strptime(target_time, format) + timedelta(hours=delta_hours) >= datetime.utcnow()", "def time_is_valid(request, day, time, name):\n\n\tif ((day != '0' and day != '6') and time.hour == 21) or time.minute != 0:\n\t\treturn False\n\n\t# George'...
[ "0.6860934", "0.6165199", "0.61254984", "0.6100006", "0.6025755", "0.594662", "0.5908246", "0.58880615", "0.58691204", "0.5866743", "0.5844216", "0.5768878", "0.5734076", "0.5729486", "0.5691129", "0.5662217", "0.56508267", "0.5647204", "0.5638489", "0.56327003", "0.5612369",...
0.6492797
1
Retquired operations for ETL XML to CSV.
def etl_operations(): tap = SQLTaps(db_type='mysql', username='root', password='', host='localhost', db_name='ETLtestDb') conn = tap.get_connection() query = 'SELECT id, filename, student_xml FROM StudentsData' rows = tap.get_row...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(_):\n # Create an XML data frame, which represents the CSV format\n xml_df = xml_to_df(FLAGS.xml_input)\n print(FLAGS.xml_input)\n print(FLAGS.output_path)\n # Convert the data frame into CSV format, and save to the output path\n xml_df.to_csv(FLAGS.output_path, index=None)\n print('S...
[ "0.6848973", "0.6119344", "0.5600611", "0.5541763", "0.5541486", "0.5538107", "0.55232733", "0.54312", "0.5399392", "0.5382571", "0.5359434", "0.5281513", "0.5275438", "0.5271903", "0.526789", "0.52156895", "0.5205032", "0.5199951", "0.5174725", "0.51475275", "0.5137194", "...
0.6973972
0
Function for filtering regions which are smaller than minLength, that is, regions which are too small to contain an intergenic gene.
def filterFunction(region): inset = abs(region.stopGene.location[1] - region.stopGene.location[0])/2 if region.stopGene else 0 return region.stop + inset - region.start > minLength
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_contigs(contig_file, min_length):\n basename_original = os.path.splitext(contig_file)[0] \n basename_filtered = basename_original + \"_min_len_\" + str(min_length)\n contigs_filtered = basename_filtered + \".fasta\"\n num_reads = fasta_filter.seq_length_greater(contig_file, contigs_fi...
[ "0.6610667", "0.6599001", "0.6448203", "0.63962674", "0.5995766", "0.5735804", "0.56986856", "0.5616286", "0.560173", "0.560173", "0.5585641", "0.5506691", "0.54659474", "0.54585403", "0.54376686", "0.54318166", "0.53870505", "0.53555745", "0.53555745", "0.53540766", "0.53393...
0.7461413
0
Fuction converts Jy/beam to Jy/pix
def jyperbeam_to_jyperpix(header, data): convert = np.pi/180 # deg to rads fwhm_to_sigma = 1./(8*np.log(2))**0.5 bmaj = header['BMAJ']*convert bmin = header['BMIN']*convert beam_area = 2.*np.pi*(bmaj*bmin*fwhm_to_sigma*2) # in staradians Jyperpix_data = data/beam_area return Jyperpix_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cgs2jyperbeam(beamsize):\n constant = 1e23#cgs 2 MJy/str\n beamsize *= np.pi/180./3600. # Arcseconds to radians\n beamsolid = beamsize**2*np.pi/(4*np.log(2))\n return constant*beamsolid", "def J_J(h):\n\n h = MTS(h)\n hdot = h.dot\n J_𝒥 = 0.5j * 𝔇inverseLaplacianinverse(\n 0.125...
[ "0.6268127", "0.5918865", "0.58972245", "0.583188", "0.57700664", "0.55387676", "0.5529212", "0.5513946", "0.54779565", "0.545998", "0.543896", "0.54380053", "0.543641", "0.5419115", "0.5406976", "0.5398323", "0.53837305", "0.5373626", "0.5364091", "0.5348948", "0.5344056", ...
0.7008477
0
Benchmark numpy module import.
def test_Numpy_import(benchmark): def Benchmark(): import numpy as np a = np.ndarray(1) del a benchmark(Benchmark)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_numpy_core_multiarray(finder, module):\n module.AddGlobalName(\"arange\")", "def load_numpy_core_umath(finder, module):\n module.AddGlobalName(\"add\")\n module.AddGlobalName(\"absolute\")\n module.AddGlobalName(\"arccos\")\n module.AddGlobalName(\"arccosh\")\n module.AddGlobalName(\"a...
[ "0.6325043", "0.6092226", "0.60902053", "0.6086288", "0.60037786", "0.57273877", "0.54694366", "0.5443474", "0.54396516", "0.5428644", "0.5428636", "0.53996533", "0.53130186", "0.5310884", "0.53034955", "0.5291817", "0.52899164", "0.5268922", "0.5227571", "0.52256954", "0.520...
0.7774883
0
Benchmark keras module import.
def test_Keras_import(benchmark): def Benchmark(): from keras import models m = models.Sequential() del m benchmark(Benchmark)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_keras() -> Any:\n import keras\n keras.losses.weighted_log_loss = weighted_log_loss\n keras.metrics.false_pos = false_pos\n keras.metrics.false_positives = false_pos\n keras.metrics.false_neg = false_neg\n return keras", "def main():\n setup_keras()\n\n args = parse()\n\n trai...
[ "0.6922674", "0.6126091", "0.59120166", "0.5763644", "0.56895125", "0.56394553", "0.5586993", "0.55789703", "0.55661064", "0.554108", "0.55030227", "0.54506975", "0.5448948", "0.54210556", "0.5392779", "0.5350082", "0.5346639", "0.5344349", "0.5337076", "0.5336877", "0.533421...
0.7570074
0
Benchmark tensorflow module import.
def test_Tensorflow_import(benchmark): def Benchmark(): import tensorflow as tf a = tf.Variable(1) del a benchmark(Benchmark)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_tensorflow_import(verbose=False):\n import os\n\n os.environ[\"CUDA_VISIBLE_DEVICES\"] = \"1\"\n\n import tensorflow as tf\n\n tf.compat.v1.disable_eager_execution()\n\n if verbose:\n tf.debugging.set_log_device_placement(True) # logs what device is being used\n gpus = tf.config.e...
[ "0.63114333", "0.6208205", "0.605488", "0.5974686", "0.5898292", "0.5859008", "0.58150566", "0.57757914", "0.57524824", "0.5717537", "0.5694916", "0.5694258", "0.5665611", "0.5643591", "0.5643398", "0.5629247", "0.56084234", "0.5588382", "0.5516901", "0.551364", "0.54921466",...
0.76280653
0
rotatePivot(Vector rotation) This function will take a vector rotation and rotate the curently selected objects pivot to match without affecting their physical display Make sure that you rotate around the cursor and have the entire mesh selected or this will not work. This operates on an xyz euler.
def rotatePivot(rotation): # Rotate in object mode X bpy.ops.object.mode_set(mode='OBJECT') bpy.ops.transform.rotate(value=rotation.x, axis=(1,0,0), constraint_orientation='GLOBAL') # rotate in edit mode X bpy.ops.object.mode_set(mode='EDIT') bpy.ops.mesh.select_all(action='SELECT') b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rotation_pivot(self, rotation_pivot: Pivot):\n pass", "def Pivot(rotation, axis, angle):\n # Check for an invalid coordinate axis.\n if axis not in [0, 1, 2]:\n raise Error('Invalid axis {}. Must be [0, 1, 2].'.format(axis))\n\n radians = math.radians(angle)\n c = math.cos(ra...
[ "0.74697024", "0.6728124", "0.6568968", "0.6513034", "0.63447696", "0.6299606", "0.6126983", "0.5978732", "0.59771883", "0.5927698", "0.59080005", "0.58852196", "0.5876758", "0.58229953", "0.58206", "0.5766183", "0.5760986", "0.57403606", "0.57333255", "0.5731726", "0.5709637...
0.84249556
0
world2local(Vector a,Vector b, float depth) This function will create a vector to translate between points a and b based on a depth.
def world2local(a,b, depth): # calculate angles based on 3 dimensional trigonometry thetaA = atan( (a.z-b.z)/( sqrt( pow(a.x-b.x,2) + pow(a.y-b.y,2) ) ) ) thetaB = atan( (a.y-b.y)/(a.x-b.x) ) # calculate the vector distVec = Vector([cos(thetaB) * cos(thetaA) * depth, sin(thetaB) * cos(thet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def world2local(*, current_location: np.ndarray, current_rotation: np.ndarray,\n world_locations: np.ndarray) -> np.ndarray:\n # Prepares interfaces.\n assert current_location.shape == (3,)\n assert current_rotation.shape == (3,)\n assert len(world_locations.shape) < 3\n world_locations = np.at...
[ "0.5998272", "0.57170975", "0.56982654", "0.55855894", "0.5581537", "0.5494604", "0.5411607", "0.5398915", "0.53970957", "0.53813344", "0.5324072", "0.5313619", "0.5304791", "0.5235172", "0.5225136", "0.51992714", "0.5191363", "0.5187533", "0.51196164", "0.5077635", "0.507373...
0.8632064
0
run the ReHeat class
def run(self): print "\n\n\tPlease Note: Templates are generated based off" print "\t of the OS environment variables that are set." print "\t* Running ReHeat." self.set_creds() self.gen_ip() # used in template description self.gen_tenant_id() if self.reheat_er...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n if not self.config.galfile_pixelized:\n raise ValueError(\"Code only runs with pixelized galfile.\")\n\n self.config.check_files(check_zredfile=False, check_bkgfile=True, check_bkgfile_components=False, check_parfile=True, check_zlambdafile=True)\n\n # Compute the b...
[ "0.6652388", "0.64342934", "0.63346267", "0.6330017", "0.6314298", "0.6261548", "0.6249023", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", "0.6240787", ...
0.6448171
1
instantiate heat orchestration client
def gen_heat_client(self): print "\t* Generating heat client" # request a new auth token from keystone keystone = ksclient.Client(auth_url=self.auth_url, username=self.username, password=self.password, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_client(self) -> None:\n pass", "def init_compute_clients(self):\n\n print \"\\t* instantiating clients\"\n # instantiate nova client\n self.gen_nova_client()\n\n # instantiate neutron client\n self.gen_neutron_client()\n\n # instantiate heat client (used to...
[ "0.6269356", "0.62433255", "0.6221068", "0.60977536", "0.60809094", "0.6057935", "0.60513085", "0.60292315", "0.60128397", "0.60119057", "0.6009989", "0.5977305", "0.5944054", "0.5941497", "0.5909872", "0.5892974", "0.5889855", "0.5876633", "0.587016", "0.5870129", "0.5839777...
0.7973234
0
instantiate nova compute client
def gen_nova_client(self): print "\t* Generating nova client" client = nClient.get_client_class('2') self.novaclient = client(self.username, self.password, self.tenant_name, self.auth_url, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_compute_clients(self):\n\n print \"\\t* instantiating clients\"\n # instantiate nova client\n self.gen_nova_client()\n\n # instantiate neutron client\n self.gen_neutron_client()\n\n # instantiate heat client (used to validate templates)\n self.gen_heat_clie...
[ "0.7364414", "0.7071238", "0.6853191", "0.6742648", "0.66805136", "0.65438086", "0.6509512", "0.64971817", "0.64027095", "0.639064", "0.6300113", "0.6267286", "0.626444", "0.62389755", "0.61541337", "0.61468095", "0.6145711", "0.61278534", "0.61053056", "0.6089302", "0.601651...
0.7996696
0
instantiate neutron networking client
def gen_neutron_client(self): print "\t* Generating neutron client" self.neutronclient = neutronclient.Client(auth_url=self.auth_url, username=self.username, password=self.password, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_client(instance):\r\n neutron_client = utils.get_client_class(\r\n API_NAME,\r\n instance._api_version[API_NAME],\r\n API_VERSIONS,\r\n )\r\n instance.initialize()\r\n url = instance._url\r\n url = url.rstrip(\"/\")\r\n if '2.0' == instance._api_version[API_NAME]:\r\...
[ "0.72397894", "0.7001146", "0.6915458", "0.6756175", "0.66348696", "0.6515556", "0.6512618", "0.6477814", "0.6399194", "0.63689065", "0.62221146", "0.61706036", "0.61108536", "0.60914207", "0.6025074", "0.5990246", "0.5989588", "0.5977329", "0.5937462", "0.5884759", "0.587848...
0.796347
0
generate heat template information
def gen_heat_data(self): print "\t* Generating heat data" self.gen_heat_client() stacks = self.heatclient.stacks print "\t? Please select the stack to generate a template from" # list stacks and prompt user to select apropriate stack template stack_list = [] for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_heat_template(self):\n\n print \"\\t* Generating heat template in file: %s\" % self.heat_filename\n if self.cmdline:\n with open(self.heat_filename, 'w') as f:\n f.write(yaml.safe_dump(self.heat_template))\n\n try:\n self.heatclient.stacks.v...
[ "0.7101407", "0.63630533", "0.6335754", "0.6310076", "0.63050276", "0.62810224", "0.613421", "0.6058323", "0.6015545", "0.60110986", "0.59929484", "0.59886414", "0.5925588", "0.58619004", "0.58209044", "0.5820023", "0.5771631", "0.5749931", "0.57344365", "0.5732815", "0.57276...
0.7476171
0
generate all data necessary for a complete compute template
def gen_compute_data(self): print "\t* Generating combined nova and neutron data" self.init_compute_clients() self.compute_data["heat_template_version"] = "2013-05-23" self.compute_data["description"] = "Generated Template %s on Project %s" % \ (str(datetime.datetime.now().s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate():", "def gen_compute_template(self):\n\n print \"\\t* Generating compute template in file %s\" % self.compute_filename\n if self.cmdline:\n with open(self.compute_filename, 'w') as f:\n f.write(yaml.safe_dump(self.compute_template))\n\n try:\n ...
[ "0.6641693", "0.65589625", "0.6509333", "0.6447313", "0.63695467", "0.63346595", "0.62602806", "0.62217873", "0.61809677", "0.61094594", "0.5971302", "0.5969898", "0.59352905", "0.5894241", "0.5867586", "0.5867586", "0.5867586", "0.5855343", "0.581939", "0.57920444", "0.57622...
0.8048141
0
instantiate nova and neutron clients
def init_compute_clients(self): print "\t* instantiating clients" # instantiate nova client self.gen_nova_client() # instantiate neutron client self.gen_neutron_client() # instantiate heat client (used to validate templates) self.gen_heat_client()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_nova_client(self):\n\n print \"\\t* Generating nova client\"\n client = nClient.get_client_class('2')\n self.novaclient = client(self.username,\n self.password,\n self.tenant_name,\n self.au...
[ "0.7710618", "0.7441814", "0.7179079", "0.6937732", "0.68047905", "0.6802051", "0.64828235", "0.64741975", "0.6403919", "0.62170565", "0.62007624", "0.618936", "0.6181813", "0.61522347", "0.611692", "0.6109957", "0.6080008", "0.6060509", "0.5993093", "0.59743154", "0.5966757"...
0.7575982
1
generate parameters for compute template
def gen_parameters(self): print "\t* Adding parameters to compute template" # get all the server client servers = self.novaclient.servers.list() # add all key_pair_names self.gen_key_name_parameters(servers) # add all images self.gen_image_parameters(servers) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_network_parameters(self):\n\n print \"\\t* Adding net and subnet parameters to compute template\"\n\n # add all the routers\n all_routers = self.neutronclient.list_routers()[\"routers\"]\n self.all_ports = self.neutronclient.list_ports()[\"ports\"]\n\n self.tenant_routers...
[ "0.69365746", "0.6322276", "0.6235999", "0.607797", "0.60738146", "0.6066625", "0.60367715", "0.6012754", "0.5991196", "0.59908175", "0.5963455", "0.59469604", "0.59338236", "0.5911403", "0.58955294", "0.58939403", "0.5887018", "0.585859", "0.5838612", "0.5831838", "0.5817446...
0.78243065
0
generate all the key_pair names and add them to compute_data
def gen_key_name_parameters(self, servers): self.set_of_keys = set(map(lambda server: server.key_name, servers)) key_idx = "" for idx, key_pair in enumerate(self.set_of_keys): data = {"type": "string", "description": "Name of keypair to assign to servers", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_keys():", "def create_key ():", "def createAllKP():\n\tif not os.path.exists(keysDir):\n\t\tos.makedirs(keysDir)\n\tfor info in conf_HVM:\n\t\tkeyName = 'Key-'+info['region']+'-'+info['zone']\n\t\ttry:\n\t\t\tos.remove(keysDir+'/'+keyName+'.pem')\n\t\texcept OSError:\n\t\t\tpass\n\t\tprint \"Key creati...
[ "0.71171194", "0.6204172", "0.6186806", "0.5927455", "0.5921931", "0.58557147", "0.5815631", "0.5814711", "0.5783215", "0.5774029", "0.5745288", "0.5698118", "0.569271", "0.5669536", "0.5652372", "0.56495035", "0.5632463", "0.55735445", "0.5555118", "0.5534517", "0.5503742", ...
0.6606572
1
Generate all the network parameters
def gen_network_parameters(self): print "\t* Adding net and subnet parameters to compute template" # add all the routers all_routers = self.neutronclient.list_routers()["routers"] self.all_ports = self.neutronclient.list_ports()["ports"] self.tenant_routers = filter(lambda rou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_parameters(self, graph, memory_manager):\n # Generate Node Parameters\n parameter_header = \"#ifndef NETWORK_PARAMETERS_H\\n\"\n parameter_header += \"#define NETWORK_PARAMETERS_H\\n\"\n parameter_header += \"#include \\\"pico-cnn/parameters.h\\\"\\n\\n\"\n paramete...
[ "0.7226558", "0.7029073", "0.690551", "0.66989124", "0.66788185", "0.66468537", "0.6645865", "0.6633763", "0.66186553", "0.6609584", "0.6594055", "0.65576833", "0.652973", "0.6528494", "0.6527197", "0.6527197", "0.6520805", "0.65189373", "0.65100914", "0.6491519", "0.64554095...
0.72256935
1
Generate all the resources
def gen_resources(self): print "\t* Adding resources to compute template" # add all the nets and subnets self.gen_net_resources() # add all routers self.gen_router_resources() # add all servers/intances self.gen_server_resources()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources(self):", "def resources(self) -> HTMLBody:\n\t\treturn render_template(\"resources.jinja2\")", "def _load_resources(self):\n puts = (getattr(self, 'project', None) or self).puts\n for resource_type, resource_cls in six.iteritems(AVAILABLE_RESOURCES):\n for name in self.se...
[ "0.7696419", "0.6876106", "0.6563454", "0.6495365", "0.643579", "0.64304537", "0.64114857", "0.6384996", "0.6342217", "0.63224685", "0.62869084", "0.62854594", "0.6255035", "0.62494004", "0.62340724", "0.6227272", "0.62082005", "0.62045", "0.61928815", "0.6183419", "0.6167096...
0.8030165
0
Genererate all net and subnet resources
def gen_net_resources(self): print "\t* Adding net and subnet resources to compute template" networks = self.neutronclient.list_networks()["networks"] # filter all networks that match filtered_networks = [net for net in networks if (net["tenant_id"] == self.tenant_id or (n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_network_resources(self, tenant_id):\n logger.info(\"Creating network resources...\")\n net_name = \"ostf-autoscaling-test-service-net\"\n net_body = {\n \"network\": {\n \"name\": net_name,\n \"tenant_id\": tenant_id\n }\n ...
[ "0.6704986", "0.66477597", "0.6631073", "0.64082897", "0.6147564", "0.6098752", "0.5986638", "0.59644693", "0.58866364", "0.5883728", "0.5876759", "0.582784", "0.5800922", "0.5764724", "0.5711894", "0.5677105", "0.5655168", "0.55968636", "0.55950785", "0.5588146", "0.55799073...
0.7728604
0
Generate all the router resources
def gen_router_resources(self): print "\t* Adding router resources to compute template" from nova import version year = version.version_string() for idx, router in enumerate(self.tenant_routers): router_ports = [] for port in self.all_ports: if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_resources(self):\n\n print \"\\t* Adding resources to compute template\"\n\n # add all the nets and subnets\n self.gen_net_resources()\n\n # add all routers\n self.gen_router_resources()\n\n # add all servers/intances\n self.gen_server_resources()", "def r...
[ "0.73711663", "0.70035046", "0.6320128", "0.6223917", "0.6177516", "0.6145895", "0.61361414", "0.60855603", "0.6077239", "0.606435", "0.60615534", "0.6048417", "0.6031009", "0.6005149", "0.59731054", "0.5948869", "0.5940405", "0.5921544", "0.5920081", "0.590232", "0.5882855",...
0.7725163
0
Generate all the port interface resources
def gen_port_resources(self, server, ports): if (self.SuppressServerStatuses is False): print "\t* Adding all the port interface resources" data = {} port_idx = "0" for idx, port in enumerate(ports): # get fixedips fixed_ip = port._info["fixed_ips...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_resources(self):\n\n print \"\\t* Adding resources to compute template\"\n\n # add all the nets and subnets\n self.gen_net_resources()\n\n # add all routers\n self.gen_router_resources()\n\n # add all servers/intances\n self.gen_server_resources()", "def g...
[ "0.6734918", "0.61334604", "0.5956791", "0.59239084", "0.5892507", "0.57652533", "0.5649685", "0.56255925", "0.56255925", "0.5609952", "0.5608133", "0.5608133", "0.5590049", "0.5590049", "0.55450815", "0.5500373", "0.5474965", "0.54544276", "0.54491496", "0.5437252", "0.54145...
0.71936
0
Generate a yaml file of the heat data
def gen_heat_template(self): print "\t* Generating heat template in file: %s" % self.heat_filename if self.cmdline: with open(self.heat_filename, 'w') as f: f.write(yaml.safe_dump(self.heat_template)) try: self.heatclient.stacks.validate(template...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_heatmap(data, labels_dict, file_title, plot_title):\n\n fig = plt.figure()\n ax = sn.heatmap(data,\n linewidths=0.3)\n figure = ax.get_figure()\n\n if labels_dict:\n ax.set_xlabel(labels_dict[\"x\"])\n ax.set_ylabel(labels_dict[\"y\"])\n if plot_title:\n...
[ "0.6449608", "0.628593", "0.61868024", "0.61316335", "0.5987216", "0.584769", "0.5845132", "0.57526094", "0.57081187", "0.56917256", "0.56857705", "0.56769764", "0.5676154", "0.56494623", "0.56241596", "0.56075615", "0.56025314", "0.55984604", "0.55886304", "0.55846953", "0.5...
0.65655005
0
Load the queries from the given file and tokenize them
def load_queries(self, file): queries = [] with open(file, 'r') as f: for line in f: reg_match = re.match(r'^(\d+).(.*)', line) tokens = self.es_helper.get_tokens(reg_match.group(2).strip()) queries.append(Query(reg_match.group(1).strip(), self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queries_from(self, sql_file, delimiter=\";\"):\n with open(sql_file, \"r\") as file:\n # Split by delimiter\n queries = file.read().split(delimiter)\n # pop the empty line at the end of the file\n queries.pop()\n return queries", "def execute_quer...
[ "0.6716595", "0.62873846", "0.61769223", "0.61609787", "0.61478555", "0.61353004", "0.6041882", "0.5998857", "0.5988838", "0.5981553", "0.5966084", "0.5951582", "0.59339494", "0.5924149", "0.5920559", "0.59034365", "0.5903293", "0.588091", "0.58698344", "0.5858286", "0.583942...
0.79963386
0