query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Determine the ISO 6346 numeric equivalent of a character.
def code(char): return int(char) if char.isdigit() else letter_code(char)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evalute_number(dialed):\n if (len(dialed) == 11 or len(dialed) == 10) and str(dialed).startswith(\"0\"):\n # UK Number\n return \"+44%s\" % (dialed[1:])\n elif len(dialed) == 6:\n # Local Fishguard numbers\n return \"+441348%s\" % (dialed)\n return None", "def char_to_num...
[ "0.63106596", "0.62892497", "0.6242454", "0.6229222", "0.61676794", "0.6138641", "0.6134803", "0.6132893", "0.6048747", "0.6008274", "0.5899159", "0.58616185", "0.58511186", "0.5842245", "0.58217657", "0.58190435", "0.5784438", "0.5782253", "0.5777213", "0.57736915", "0.57563...
0.61288404
8
Determine the ISO 6346 numeric code for a letter.
def letter_code(letter): value = ord(letter.lower()) - ord('a') + 10 return value + value // 11
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha_number(alpha):\r\n if alpha.isupper() == False:\r\n num = ord(alpha) - 96\r\n return num\r\n elif alpha.isupper() == True:\r\n num = ord(alpha) - 64\r\n return num", "def code(char):\n return int(char) if char.isdigit() else letter_code(char)", "def letter_num(num...
[ "0.7418329", "0.7332461", "0.6975198", "0.6789075", "0.6789075", "0.67152506", "0.65995985", "0.65995985", "0.65719616", "0.6529032", "0.64173263", "0.6383725", "0.63769406", "0.63268995", "0.6257811", "0.62500453", "0.62329525", "0.6205183", "0.61922914", "0.6171451", "0.606...
0.73669213
1
Override parent method to use <= when finding nearest neighbours to ensure a neighbour is returned even at infinite/nan distance
def get_n_nearest_neighbors(self, query, n_neighbors): if not isinstance(n_neighbors, int) or n_neighbors < 1: raise ValueError('n_neighbors must be strictly positive integer') neighbors = vptree._AutoSortingList(max_size=n_neighbors) nodes_to_visit = [(self, 0)] furthest_d =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nearest_neighbour_1d(self):\n x = np.array([2., 1., 4., 5., 3.])\n x_new = np.array([-3, 0, 1.2, 3, 3, 2.5, 4.7, 6])\n val, ind = _nearest_neighbour_1d(x, x_new)\n np.testing.assert_array_equal(val, [1., 1., 1., 3., 3., 2., 5., 5.])\n np.testing.assert_array_equal(ind, [...
[ "0.68682957", "0.6767455", "0.6710233", "0.6681611", "0.6612519", "0.65211624", "0.6501286", "0.6500969", "0.6455676", "0.6419788", "0.63942283", "0.6346417", "0.63382214", "0.63071793", "0.6216757", "0.6211591", "0.61998034", "0.61906844", "0.6184552", "0.61813545", "0.61571...
0.636207
11
Insert item into dynamic vp tree by first adding to pool, and then building a tree from the pool if min size reached Then merge trees of equal sizes so that there are at most log(log (n)) trees, with the largest tree having roughly n/2 nodes
def insert(self, item): self.pool.append(item) if len(self.pool) == self.min_tree_size: self.trees.append(_ExtendedVPTree(self.pool, self.dist_fn)) self.pool = [] while len(self.trees) > 1 and self.trees[-1].size == self.trees[-2].size: a = self.trees.pop() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bst_insert(sizes):\n tree = rbTree_main.BinarySearchTree();\n for i in range(sizes):\n tree.insert(random.random())", "def rbt_insert(sizes):\n tree = rbTree_main.RBTree();\n for i in range(sizes):\n tree.rb_insert(random.random());\n pass", "def _insort(self, node):\n l...
[ "0.65738744", "0.59414244", "0.58873856", "0.5721595", "0.5673607", "0.5613784", "0.5607082", "0.5599457", "0.5549631", "0.54778767", "0.5471518", "0.53812885", "0.5376035", "0.53730154", "0.53416336", "0.5339837", "0.5338522", "0.5326516", "0.5284125", "0.52726436", "0.52688...
0.7945118
0
Return node nearest to query by finding nearest node in each tree and returning the global minimum (including nodes in pool)
def nearest(self, query): nearest_trees = list(map(lambda t: t.get_nearest_neighbor(query), self.trees)) distances_pool = list(zip(map(lambda x: self.dist_fn(x, query), self.pool), self.pool)) best = None best_cost = np.inf for cost, near in nearest_trees + distances_pool: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nearest_neighbor(self, xRand):\n # TODO: Make this more efficient?\n #within a neighborhood of XRand, determine the lowest cost to go\n minCost = np.inf\n minNode = None\n\n for node in self.Tree:\n\n cost = self.compute_dist(node.state_time[0:6], xRand)\n\n ...
[ "0.73361427", "0.73361427", "0.73157585", "0.72876966", "0.7200594", "0.71982765", "0.7060152", "0.70410466", "0.69066334", "0.6884978", "0.68516064", "0.6803381", "0.67801213", "0.6773021", "0.67226744", "0.6675192", "0.6634299", "0.66336787", "0.66082364", "0.65941596", "0....
0.80384624
0
Return all nodes within distance radius of the given query, by collating neighbourhoods for each internal tree (and pool)
def neighbourhood(self, query, radius): tree_neighbourhood = lambda tree: list(map(lambda x: x[1], tree.get_all_in_range(query, radius))) neighbourhood_trees = list(itertools.chain.from_iterable(map(tree_neighbourhood, self.trees))) return neighbourhood_trees + list(filter(lambda x: self.dist_fn...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neighbours(self):\n\n neighbours = []\n root = self.root\n if self == root:\n return neighbours\n\n ########################\n # IMMEDIATELY ADJACENT #\n sizes = [self.maxs[0] - self.mins[0], self.maxs[1] - self.mins[1]]\n coords = [(self.mins[0] + si...
[ "0.6189898", "0.6067114", "0.5967871", "0.5918009", "0.5853346", "0.5850977", "0.57527864", "0.5742722", "0.57373124", "0.57318693", "0.5728062", "0.5716135", "0.5708966", "0.569612", "0.5669883", "0.5667582", "0.5654472", "0.5650004", "0.5642539", "0.56394213", "0.5612371", ...
0.79401344
0
Combine all processed data into a single dataset file.
def data_merge(detector_fields): print("Merging final data...") # load files that contain phase and I/O processed data and store as dfs phase_data = pd.read_csv(results_folder + 'phases/processed/clean_merged_phases.csv', header=0, skipinitialspace=True, usecols=output_fields) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_merge(path, dataset_name=\"processed_data\"):\n files = glob.glob(path+\"**//\"+dataset_name+\".json\")\n logger.info(\"Found {} files under the path {}\".format(len(files),path))\n final_data = []\n\n for file in files:\n assert dataset_name in file\n data = json.load(open(file,...
[ "0.6739214", "0.66117465", "0.6560573", "0.6511757", "0.6500883", "0.6384844", "0.6318141", "0.6245312", "0.6213231", "0.617907", "0.61625206", "0.61625206", "0.6154918", "0.60871774", "0.6077486", "0.6057417", "0.60547507", "0.6008765", "0.5997524", "0.5996574", "0.5979468",...
0.5923977
22
Add a new pair of products with times purchased together if the pair existed, just increase the times purchased otherwise just add the new pair
def add(self, prod1_name, prod2_name, times): if prod1_name == prod2_name: return try: self._purchased.update({PROD1: prod1_name, PROD2: prod2_name, TIMES: {'$exists': True}}, {'$inc': {TIMES: times}}, True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, product, order_type, pickup, drop, quantity=1, update_quantity=False):\n\n #calculate duratin\n start_date = datetime.strptime(pickup, \"%Y-%m-%d %H:%M\")\n end_date = datetime.strptime(drop, \"%Y-%m-%d %H:%M\")\n duration = end_date-start_date\n\n #end of calculati...
[ "0.6113706", "0.6062423", "0.6022032", "0.57448155", "0.5658234", "0.5507529", "0.54974794", "0.5474968", "0.5401568", "0.5374355", "0.5366406", "0.5358892", "0.5353692", "0.5345051", "0.53433794", "0.5340769", "0.53113306", "0.529849", "0.529575", "0.5261819", "0.52604914", ...
0.65889096
0
Insert a list of pairs of products
def insert_product_list(self, prod_list): try: json_list = [] for item in prod_list: json_list.append({PROD1: item[0], PROD2: item[1], TIMES: item[2]}) json_list.append({PROD1: item[1], PROD2: item[0], TIMES: item[2]}) if len(json_list) > 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_products(self):\n logic = ProductLogic()\n \n try:\n # We create the list of product objects\n products = self.objects_factory.create_product_object_list()\n products = set(products)\n\n for product in products:\n logic.inse...
[ "0.6807457", "0.6570509", "0.6336443", "0.6255528", "0.6255528", "0.61996514", "0.60343504", "0.58767706", "0.58759046", "0.5782409", "0.573562", "0.57234836", "0.57141703", "0.5670095", "0.5643585", "0.56378525", "0.5613349", "0.55983883", "0.5590104", "0.5582928", "0.557456...
0.5663004
14
Add a list of pairs of products one by one
def add_product_list(self, prod_list): success = True for item in prod_list: success &= self.add(item[0], item[1], item[2]) if success: print('add_product_list: succeeded') else: print('add_product_list: failed') return success
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pair_product(x1, x2):\n return np.multiply(x1, x2)", "def _product(self, args):\n pools = map(tuple, args) #within original version args defined as *args\n result = [[]]\n for pool in pools:\n result = [x + [y] for x in result for y in pool]\n return result", "def ...
[ "0.6781028", "0.6746401", "0.6640496", "0.6640496", "0.66049224", "0.63687503", "0.6310496", "0.6284612", "0.6192405", "0.6176541", "0.6154426", "0.6141294", "0.611274", "0.6107433", "0.60958445", "0.6090736", "0.60715026", "0.6068512", "0.6038685", "0.6018187", "0.5996263", ...
0.6206119
8
Remove a pair of products
def remove(self, prod1_name, prod2_name): try: self._purchased.remove({PROD1: prod1_name, PROD2: prod2_name}, True ) self._purchased.remove({PROD1: prod2_name, PROD2: prod1_name}, Tru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_for_target(self, target, products):\n for product in products:\n self._products_by_target[target].discard(product)", "def removeProduct(self, *args):\n return _libsbml.Reaction_removeProduct(self, *args)", "def remove(self, pair):\n\n for plug in self.plugleads:\n if...
[ "0.65564406", "0.6426297", "0.6197446", "0.6170158", "0.6084325", "0.5994371", "0.5981625", "0.5929859", "0.5846611", "0.58040714", "0.57658505", "0.5759781", "0.57576233", "0.5746318", "0.5745949", "0.5643254", "0.56427234", "0.5597372", "0.55803734", "0.55684996", "0.556241...
0.60259104
5
Assign a fixed times of the given pair of products with times purchased together
def assign(self, prod1_name, prod2_name, times): try: self._purchased.update({PROD1: prod1_name, PROD2: prod2_name}, {'$set': {TIMES: times}}, True ) self._purchased.update({PROD1: pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def given_a_series_of_prices(self, prices):\n timestamps = [datetime(2015, 5, 28), datetime(2015, 5, 29),\n datetime(2015, 5, 30)]\n for timestamp, price in zip(timestamps, prices):\n self.goog.update(timestamp, price)", "def promotion(time, sum_price):\n time = s...
[ "0.56735665", "0.5642687", "0.5597733", "0.55516917", "0.55381095", "0.54918313", "0.5367134", "0.53548855", "0.53330797", "0.5317737", "0.5311256", "0.5310855", "0.5292983", "0.5248051", "0.5220131", "0.52120817", "0.5160664", "0.51471895", "0.51454437", "0.51453066", "0.514...
0.5754572
0
Recommend the next best relevant product
def recommend_next_product(self, prod_list): scores = defaultdict(float) for prod in prod_list: for item in self._purchased.find({PROD1: prod}): if not item[PROD2] in prod_list: scores[item[PROD2]] += math.log(item[TIMES]) if len(scores) == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _choose_best_option(self):", "def popular_recommend(row):\n actual = new_purchase_row(row)\n return f1(actual, popular_products)", "def step(self):\n highest_offer = None\n\n if self.manager is None:\n highest_rep = 0\n\n else:\n highest_rep = self.manager.r...
[ "0.6451906", "0.6248928", "0.6203764", "0.6144406", "0.610878", "0.60792506", "0.59292257", "0.579324", "0.57634926", "0.5680954", "0.56799036", "0.56428087", "0.56206936", "0.55952084", "0.55937326", "0.5577743", "0.5574243", "0.5536686", "0.55234545", "0.55225116", "0.54792...
0.69993323
0
Get the of times this pair has been purchased together
def get_times(self, prod1_name, prod2_name): try: item = self._purchased.find_one({PROD1: prod1_name, PROD2: prod2_name}) if item == None: return None else: return item[TIMES] except pyerrors.OperationFailure as ex: print(ex.value) except pyerrors....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTimes():", "def getTimes():", "def getTimes():", "def report(self):\n result = {}\n result_buy = 0\n result_sell = 0\n result_outcome = 0\n for pair in self.pairs:\n orders = self.get_orders_for(pair)\n buy, sell = self.get_buy_and_sell_costs(or...
[ "0.5729796", "0.5729796", "0.5729796", "0.5604218", "0.5600595", "0.5598839", "0.5565004", "0.5493396", "0.54700637", "0.54325604", "0.5373735", "0.53556556", "0.53387326", "0.5308763", "0.52820003", "0.5280199", "0.52264136", "0.5214018", "0.52127707", "0.52127707", "0.51249...
0.55778635
6
Trains the classifier model on the training set stored in file trainfile
def train(self, trainfile): sentences_emb,labels=self.read_data(trainfile) logReg = LogisticRegression(penalty="l2",C = 10, multi_class='auto',solver='newton-cg') logReg.fit(sentences_emb,labels) self.clf=logReg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, trainfile):", "def trainModel( self, featureTrain, classTrain):", "def train(self):\n self.log(f\"{self.cur_file_path}\\t\\tInfo: train method invoked!\")\n self.log(f\"{self.cur_file_path}\\t\\tInfo: training {self.model.__class__.__name__} model!\")\n\n self.model.fit(sel...
[ "0.8426095", "0.74116445", "0.73872614", "0.72419417", "0.71222615", "0.7112658", "0.7041241", "0.70203024", "0.7007973", "0.69176805", "0.69125766", "0.6865418", "0.6846726", "0.68443483", "0.68333745", "0.68271935", "0.6823557", "0.6811905", "0.6811905", "0.6811905", "0.681...
0.7566852
1
Predicts class labels for the input instances in file 'datafile' Returns the list of predicted labels
def predict(self, datafile): sentences_emb,labels=self.read_data(datafile) predictions=self.clf.predict(sentences_emb) polarity=[] for p in predictions: if p==1: polarity.append("positive") elif p==0: polarity.append("neutra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, data):\n xdata, _ = self.array_from_cases(data)\n preds = self.model.predict(xdata)\n label_preds = [dict(zip(self.binarizer.classes_, pred)) for pred in preds]\n return label_preds", "def predict(self, datafile):", "def predict(self, test_file_path: str) -> List[D...
[ "0.76404834", "0.7387015", "0.71751606", "0.7162944", "0.7094534", "0.6908485", "0.6878635", "0.6853093", "0.6816419", "0.68157095", "0.6622839", "0.6621277", "0.6613741", "0.65917116", "0.65894985", "0.6565011", "0.65631646", "0.65263724", "0.6513915", "0.6501854", "0.650169...
0.7219323
2
Read the meta information from the FPG file.
def get_wb_addresses(filename): if filename is not None: fptr = open(filename, 'r') firstline = fptr.readline().strip().rstrip('\n') if firstline != '#!/bin/kcpfpg': fptr.close() raise RuntimeError('%s does not look like an fpg file we can ' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_meta(metafn=None):\n\n metadata = {}\n\n # potential future improvement: strip quotation marks from strings, where applicable. Will then need to adjust\n # the indices used to get the dates and times in the functions above \n # (get_DEM_img_times: dtstrings = {\"sourceImage1\":(5,19, '%Y%m%d%H...
[ "0.7055493", "0.70491713", "0.6815708", "0.678142", "0.66057986", "0.63837147", "0.6364409", "0.6312615", "0.6274537", "0.6261746", "0.62187535", "0.61309636", "0.6101534", "0.6093043", "0.609194", "0.6075726", "0.60565966", "0.60202336", "0.6020089", "0.6008801", "0.6007056"...
0.0
-1
load_data takes path and loads in the dataset identified in this project into a pandas df. It then prints high level information about the dataframe for the users reference and returns this dataframe
def load_data(path): columns = ['Item Year', 'Original Value', 'Standard Value', 'Original Currency', 'Standard Currency', 'Orignal Measure', 'Standard Measure', 'Location', 'Commodity'] col_type = [int, float, float, object, object, object, object, object] col_type_dict = di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data():\n df = pd.read_csv(\"https://raw.githubusercontent.com/Andrea-Giuliani/Python-Project/master/data/final_dataset.csv\",sep=',') \n return df", "def loadData(path_file):\n data = pd.read_csv(path_file) \n data.head()\n return data", "def load_data():\n \n data = datasets.lo...
[ "0.67460644", "0.64907336", "0.64832234", "0.6358895", "0.63168895", "0.62954944", "0.62547684", "0.6236128", "0.6230134", "0.6215533", "0.6180172", "0.61594254", "0.6152189", "0.6103808", "0.6073373", "0.6071692", "0.6057447", "0.6054861", "0.6051355", "0.6035068", "0.602572...
0.0
-1
Method to apply ET Conformance
def apply(log, net, marking, final_marking, parameters=None, variant=None): if parameters is None: parameters = {} log = log_conversion.apply(log, parameters, log_conversion.TO_EVENT_LOG) # execute the following part of code when the variant is not specified by the user if variant is No...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inferSpecification(inputExamples, outputExamples, components):", "def uncertainty_ee(self,e1,e2):\n # reco\n unc = (self._eleRecoWeight[(e1.pt(),e1.eta())][1]/self._eleRecoWeight[(e1.pt(),e1.eta())][0] + \\\n self._eleRecoWeight[(e2.pt(),e2.eta())][1]/self._eleRecoWeight[(e2.pt(),e2.eta...
[ "0.520668", "0.5201455", "0.5150791", "0.48542607", "0.48534966", "0.48262239", "0.48014283", "0.4788974", "0.47726873", "0.47622526", "0.47622526", "0.47534707", "0.472562", "0.4701052", "0.46974584", "0.4674532", "0.4657097", "0.46532992", "0.46299773", "0.46085578", "0.460...
0.0
-1
Convenience split function for inverted index attributes. Useful for attributes that contain filenames. Splits the given string s into components parts (directories, filename), discarding the extension and all but the last two directories. What's remaining is split into words and the result is returned.
def split_path(s): dirname, filename = os.path.split(s) fname_noext, ext = os.path.splitext(filename) levels = dirname.strip('/').split(os.path.sep)[2:][-2:] return PATH_SPLIT.split(' '.join(levels + [fname_noext]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_path(s):\n dirname, filename = os.path.split(s)\n fname_noext, ext = os.path.splitext(filename)\n for part in dirname.strip('/').split(os.path.sep)[2:][-2:] + [fname_noext]:\n for match in PATH_SPLIT.split(part):\n if match:\n yield match", "def tokenize(\n ...
[ "0.63968426", "0.6263762", "0.61884594", "0.58648413", "0.5765297", "0.5761506", "0.5726431", "0.56870097", "0.56813276", "0.56165", "0.55843884", "0.5512251", "0.5427378", "0.5423563", "0.54086035", "0.5384905", "0.5383309", "0.5346063", "0.53299356", "0.52875656", "0.528058...
0.7065876
0
Takes a list of mixed types and outputs a unicode string. For example, a list [42, 'foo', None, "foo's' string"], this returns the
def _list_to_printable(value): fixed_items = [] for item in value: if type(item) in (int, long, float): fixed_items.append(str(item)) elif item == None: fixed_items.append("NULL") elif type(item) == unicode: fixed_items.append("'%s'" % item.replace("'",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_list_to_unicode_str(data):\n string = ''\n for i, val in enumerate(data):\n # string = string + unicode(unichr(int(val)))\n string = string + str(int(val))\n return string", "def _get_types_string(types_list):\n type_str = \"\"\n for type in types_list:\n type_str ...
[ "0.70956445", "0.6905875", "0.66197217", "0.6430419", "0.60457647", "0.6029881", "0.5985099", "0.5957578", "0.5839138", "0.58388275", "0.5828249", "0.579073", "0.57889533", "0.57728666", "0.57434475", "0.57249594", "0.5704203", "0.5672486", "0.56484795", "0.56462157", "0.5625...
0.6718685
2
Registers one or more object attributes and/or multicolumn indexes for the given type name. This function modifies the database as needed to accommodate new indexes and attributes, either by creating the object's tables (in the case of a new object type) or by altering the object's tables to add new columns or indexes....
def register_object_type_attrs(self, type_name, indexes = [], **attrs): if len(indexes) == len(attrs) == 0: raise ValueError, "Must specify indexes or attributes for object type" table_name = "objects_%s" % type_name # First pass over the attributes kwargs, sanity-checking provided...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_object_type_attrs(self, type_name, indexes = [], **attrs):\n if len(indexes) == len(attrs) == 0:\n raise ValueError(\"Must specify indexes or attributes for object type\")\n\n table_name = \"objects_%s\" % type_name\n\n # First pass over the attributes kwargs, sanity-ch...
[ "0.77066755", "0.6361328", "0.6264673", "0.61884093", "0.5833767", "0.57452655", "0.57315993", "0.56269467", "0.54736567", "0.544051", "0.54389435", "0.5431951", "0.53999454", "0.5295605", "0.52132535", "0.5177261", "0.5129444", "0.51156485", "0.5099704", "0.50790924", "0.505...
0.7726764
0
Registers a new inverted index with the database. An inverted index maps arbitrary terms to objects and allows you to query based on one or more terms. If the inverted index already exists with the given parameters, no action is performed. name is the name of the inverted index and must be alphanumeric. min and max spe...
def register_inverted_index(self, name, min = None, max = None, split = None, ignore = None): # Verify specified name doesn't already exist as some object attribute. for object_name, object_type in self._object_types.items(): if name in object_type[1] and name != object_type[1][name][2]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_inverted_index(self, name, min = None, max = None, split = None, ignore = None):\n # Verify specified name doesn't already exist as some object attribute.\n for object_name, object_type in self._object_types.items():\n if name in object_type[1] and name != object_type[1][name]...
[ "0.8106289", "0.5157404", "0.513424", "0.49950093", "0.4974171", "0.48789895", "0.48250076", "0.47591364", "0.47572297", "0.4660967", "0.46581295", "0.46503413", "0.464838", "0.46435705", "0.46280825", "0.46089694", "0.46081924", "0.4605972", "0.4580362", "0.4576036", "0.4573...
0.81983155
0
Deletes the specified object.
def delete_object(self, (object_type, object_id)): return self._delete_multiple_objects({object_type: (object_id,)})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_object(self, object):\n object.delete()", "def delete(self, obj=None):\n pass", "def delete(self, obj=None):\n if obj is not None:\n key = \"{}.{}\".format(type(obj).__name__, obj.id)\n try:\n del self.__objects[key]\n except KeyEr...
[ "0.8609504", "0.84928817", "0.8423077", "0.8405551", "0.8397232", "0.83793044", "0.83793044", "0.83793044", "0.83793044", "0.8377723", "0.83596385", "0.83385885", "0.83169276", "0.83169276", "0.83169276", "0.81342936", "0.8100833", "0.80617315", "0.8013819", "0.7979763", "0.7...
0.8175527
15
Deletes all objects returned by the given query. See query() for argument details. Returns number of objects deleted.
def delete_by_query(self, **attrs): attrs["attrs"] = ["id"] results = self.query(**attrs) if len(results) == 0: return 0 results_by_type = {} for o in results: if o["type"] not in results_by_type: results_by_type[o["type"]] = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_by_query(self, query, params = {}):\n params['hitsPerPage'] = 1000\n params['attributesToRetrieve'] = ['objectID']\n\n res = self.search(query, params)\n while (res['nbHits'] != 0):\n object_ids = []\n for elt in res['hits']:\n object_ids....
[ "0.76967055", "0.75710857", "0.7238022", "0.7166252", "0.70217574", "0.6912766", "0.6698922", "0.65711296", "0.6482522", "0.647761", "0.6437574", "0.64066416", "0.63698435", "0.6357176", "0.6343275", "0.6333492", "0.6290694", "0.6279942", "0.6258179", "0.62489057", "0.6222344...
0.71112645
5
Adds an object of type 'object_type' to the database. Parent is a (type, id) tuple which refers to the object's parent. 'object_type' and 'type' is a type name as given to register_object_type_attrs(). attrs kwargs will vary based on object type. ATTR_SIMPLE attributes which a None are not added. This method returns th...
def add(self, object_type, parent = None, **attrs): type_attrs = self._get_type_attrs(object_type) if parent: attrs["parent_type"] = self._get_type_id(parent[0]) attrs["parent_id"] = parent[1] # Increment objectcount for the applicable inverted indexes. inverted_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Add(self, obj_type, name, node=None, obj=None):\n print \"Adding object %s, node: %s\" % (name, node)\n #check for duplicate object\n # also raise error if no such object type\n if self.ObjectExists(obj_type, name):\n raise DuplicateObjectError(name)\n \n ...
[ "0.6409624", "0.62771475", "0.60935414", "0.6087404", "0.60587406", "0.5914331", "0.5884166", "0.55695456", "0.5552869", "0.53761256", "0.53064", "0.52908915", "0.5275135", "0.5275135", "0.5275135", "0.5275135", "0.5275135", "0.52567697", "0.514278", "0.51280934", "0.5127361"...
0.6481042
0
Update an object in the database. For updating, object is identified by a (type, id) tuple or an ObjectRow instance. Parent is a (type, id) tuple or ObjectRow instance, which refers to the object's parent. If specified, the object is reparented, otherwise the parent remains the same as when it was added with add(). att...
def update(self, obj, parent=None, **attrs): if isinstance(obj, ObjectRow): object_type, object_id = obj['type'], obj['id'] else: object_type, object_id = obj type_attrs = self._get_type_attrs(object_type) get_pickle = False # Determine which inverted in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, obj, parent=None, **attrs):\n if self._readonly:\n raise DatabaseReadOnlyError('upgrade_to_py3() must be called before database can be modified')\n object_type, object_id = self._to_obj_tuple(obj)\n\n type_attrs = self._get_type_attrs(object_type)\n get_pickl...
[ "0.74381167", "0.6614651", "0.6315451", "0.61962694", "0.614676", "0.6144914", "0.6054113", "0.6040945", "0.5997564", "0.5952653", "0.5952653", "0.59390825", "0.59053296", "0.5887963", "0.5873624", "0.5767497", "0.57389915", "0.57276726", "0.5707913", "0.5680127", "0.5647404"...
0.786734
0
Query the database for objects matching all of the given attributes
def query(self, **attrs): query_info = {} parents = [] query_type = "ALL" results = [] query_info["columns"] = {} query_info["attrs"] = {} if "object" in attrs: attrs["type"], attrs["id"] = attrs["object"] del attrs["object"] ivti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all(cls, **kwargs):\n return cls.query.filter_by(**kwargs).all()", "def find(cls, attrs):\n return [cls(data) for data in cls.db().find(attrs, True)]", "def findall(cls, *lst, **dct):\n query = cls.where(*lst, **dct).select()\n result = query.execute()\n return resul...
[ "0.6990179", "0.6830054", "0.6592934", "0.6471972", "0.6471972", "0.64145225", "0.6377542", "0.6299601", "0.6221802", "0.613642", "0.61021376", "0.60580194", "0.6044587", "0.60377383", "0.6028511", "0.6022793", "0.60128856", "0.60116005", "0.5982548", "0.5980463", "0.5961357"...
0.596369
20
Scores the terms given in terms_list, which is a list of tuples (terms, coeff, split, ivtidx), where terms is the string or sequence of terms to be scored, coeff is the weight to give each term in this part (1.0 is normal), split is the function or regular expression used to split terms (only used if a string is given ...
def _score_terms(self, terms_list): terms_scores = {} total_terms = 0 for terms, coeff, split, ivtidx in terms_list: if not terms: continue # Swap ivtidx name for inverted index definition dict ivtidx = self._inverted_indexes[ivtidx] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _score_terms(self, terms_list):\n terms_scores = {}\n total_terms = 0\n\n for terms, coeff, split, ivtidx in terms_list:\n if not terms:\n continue\n # Swap ivtidx name for inverted index definition dict\n ivtidx = self._inverted_indexes[ivti...
[ "0.8230414", "0.54937506", "0.54905194", "0.5479236", "0.5440691", "0.5430716", "0.54254556", "0.5392035", "0.53528565", "0.51504266", "0.5112394", "0.510215", "0.5097729", "0.50681865", "0.5062038", "0.4980558", "0.49433053", "0.49381447", "0.49258786", "0.49234137", "0.4917...
0.82383937
0
Removes all indexed terms under the specified inverted index for the given object. This function must be called when an object is removed from the database, or when an ATTR_INVERTED_INDEX attribute of an object is being updated (and therefore that inverted index must be reindexed).
def _delete_object_inverted_index_terms(self, (object_type, object_id), ivtidx): self._delete_multiple_objects_inverted_index_terms({object_type: ((ivtidx,), (object_id,))})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _delete_object_inverted_index_terms(self, obj, ivtidx):\n object_type, object_id = obj\n self._delete_multiple_objects_inverted_index_terms({object_type: ((ivtidx,), (object_id,))})", "def _delete_multiple_objects_inverted_index_terms(self, objects):\n for type_name, (ivtidxes, object_id...
[ "0.81035614", "0.75411546", "0.75411546", "0.6139424", "0.6045582", "0.603692", "0.6007786", "0.60001457", "0.59316987", "0.584059", "0.5829414", "0.5817072", "0.5789952", "0.57787883", "0.5730306", "0.56770205", "0.56318223", "0.5610385", "0.55822736", "0.5505812", "0.549647...
0.80202085
1
objects = dict type_name > (ivtidx tuple, ids tuple)
def _delete_multiple_objects_inverted_index_terms(self, objects): for type_name, (ivtidxes, object_ids) in objects.items(): # Resolve object type name to id type_id = self._get_type_id(type_name) for ivtidx in ivtidxes: # Remove all terms for the inverted ind...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theidfobjectmentioningobjs(idfindex, keyindex, objindex):\n idf, edges = eppystuff.an_idfedges(idfindex)\n objnames = idf_helpers.idfobjectkeys(idf)\n objname = objnames[keyindex]\n idfobjects = idf.idfobjects[objname]\n idfobject = idfobjects[objindex]\n from eppy import walk_hvac\n try:\...
[ "0.62619203", "0.6195102", "0.6129353", "0.60668653", "0.60668653", "0.60462576", "0.59726316", "0.5910517", "0.5824511", "0.5824511", "0.5769879", "0.574441", "0.5735872", "0.5715742", "0.5715742", "0.5702065", "0.5692871", "0.56785494", "0.56541747", "0.56099105", "0.560706...
0.49538565
88
Adds the dictionary of terms (as computed by _score_terms()) to the specified inverted index database for the given object.
def _add_object_inverted_index_terms(self, (object_type, object_id), ivtidx, terms): if not terms: return # Resolve object type name to id object_type = self._get_type_id(object_type) # Holds any of the given terms that already exist in the database # with their id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_object_inverted_index_terms(self, obj, ivtidx, terms):\n object_type, object_id = obj\n if not terms:\n return\n\n # Resolve object type name to id\n object_type = self._get_type_id(object_type)\n\n # Holds any of the given terms that already exist in the data...
[ "0.8023277", "0.61256963", "0.5922523", "0.57880175", "0.5704644", "0.56919354", "0.56858873", "0.56835586", "0.56740934", "0.56609404", "0.56487274", "0.5621855", "0.56036234", "0.55900854", "0.5573914", "0.5557396", "0.5548084", "0.5533701", "0.55311424", "0.53814083", "0.5...
0.7867361
1
Queries the inverted index ivtidx for the terms supplied in the terms argument. If terms is a string, it is parsed into individual terms based on the split for the given ivtidx. The terms argument may also be a list or tuple, in which case no parsing is done. The search algorithm tries to optimize for the common case. ...
def _query_inverted_index(self, ivtidx, terms, limit = 100, object_type = None): t0 = time.time() # Fetch number of files the inverted index applies to. (Used in score # calculations.) objectcount = self._inverted_indexes[ivtidx]['objectcount'] if not isinstance(terms, (list, t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _query_inverted_index(self, ivtidx, terms, limit = 100, object_type = None):\n t0 = time.time()\n # Fetch number of files the inverted index applies to. (Used in score\n # calculations.)\n objectcount = self._inverted_indexes[ivtidx]['objectcount']\n\n if not isinstance(term...
[ "0.7995925", "0.75903076", "0.74195915", "0.64581156", "0.6457221", "0.59554505", "0.5865238", "0.5861748", "0.58322316", "0.5811512", "0.5693761", "0.5638802", "0.5617676", "0.5603782", "0.55951315", "0.55166435", "0.530402", "0.5279322", "0.52687097", "0.52252996", "0.51968...
0.8012516
0
Obtains terms for the given inverted index name. If associated is None, all terms for the inverted index are returned. The return value is a list of 2tuples, where each tuple is (term, count). Count is the total number of objects that term is mapped to. Otherwise, associated is a specified list of terms, and only those...
def get_inverted_index_terms(self, ivtidx, associated = None, prefix = None): if ivtidx not in self._inverted_indexes: raise ValueError, "'%s' is not a registered inverted index." % ivtidx if prefix: where_clause = 'WHERE terms.term >= ? AND terms.term <= ?' where_va...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_inverted_index_terms(self, ivtidx, associated = None, prefix = None):\n if ivtidx not in self._inverted_indexes:\n raise ValueError(\"'%s' is not a registered inverted index.\" % ivtidx)\n\n if prefix:\n where_clause = 'WHERE terms.term >= ? AND terms.term <= ?'\n ...
[ "0.72814137", "0.5312216", "0.51168823", "0.50760156", "0.5040851", "0.49835056", "0.48447284", "0.4833117", "0.48034608", "0.47988817", "0.4782228", "0.46925923", "0.46841052", "0.4615586", "0.461366", "0.45966607", "0.45822227", "0.45699117", "0.45678702", "0.45583963", "0....
0.7293714
0
Test that trailing @ used for extracting does not interfere with untag.
def test_untag_with_trailing_extract(self): fields_to_test = { 'foo@': 'bar-base', 'foo@de@': 'bar-de', 'foo@(.*_FR|.*_SG)@': 'bar-fr', 'nested': { 'nested@': 'nested-base', 'nested@de_AT@': 'nested-de', 'nested@(.*_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mention(result):\n return result.text.find('@') != -1", "def testUnindentedFields(self):\n self.checkParse(\"\"\"\n This is a paragraph.\n \n @foo: This is a field.\"\"\")\n \n self.checkParse(\"\"\"\n This is a paragraph.\n @foo: This is a field.\"\...
[ "0.6034205", "0.59515476", "0.59357536", "0.58285934", "0.57458454", "0.54263383", "0.5389915", "0.5322321", "0.53162247", "0.527235", "0.5249418", "0.5217515", "0.5167631", "0.5140492", "0.5128733", "0.5124771", "0.5098799", "0.5088662", "0.50590724", "0.5033587", "0.5031845...
0.6260769
0
Test that not having a base key does not interfere with untag and locales.
def test_untag_with_no_base(self): fields_to_test = { 'foo@de': 'bar-de', 'baz@de': { 'fum@de': 'boo-de' }, } fields = copy.deepcopy(fields_to_test) self.assertDictEqual({}, document_fields.DocumentFields.untag(fields)) self.ass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unset_key(self):\n context = {'help_key': 'unused-key'}\n self.assertRaises(\n ImproperlyConfigured,\n tags.madcap_flare_help,\n context)", "def __missing__(self, key):\n global MISSING\n MISSING = key # For debugging - save name of missing k...
[ "0.61089957", "0.60943186", "0.6040597", "0.60356236", "0.58925235", "0.58480316", "0.5847725", "0.5817884", "0.5728378", "0.5715855", "0.57137895", "0.57015187", "0.5691672", "0.5673796", "0.56599385", "0.56495875", "0.5617581", "0.56079537", "0.5602262", "0.55924207", "0.55...
0.6586597
0
Untag when there is a none value for the tagged value.
def test_untag_none(self): untag = document_fields.DocumentFields.untag fields_to_test = { 'foo': 'base', 'foo@env.prod': None, } fields = copy.deepcopy(fields_to_test) self.assertDictEqual({ 'foo': 'base', }, untag(fields, locale=None,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, value):\n tags = self.__all_tags()\n if value in tags:\n tags.remove(value)\n self.__post_changes(tags)", "def testNoneValue(self):\n objectID = uuid4()\n user = createUser(u'username', u'password', u'User',\n u'user@exam...
[ "0.6135915", "0.5967588", "0.59159297", "0.580774", "0.57716626", "0.57520264", "0.56370187", "0.56107867", "0.5567301", "0.5549925", "0.55275375", "0.55266446", "0.54774225", "0.5460869", "0.54421735", "0.54349834", "0.54182965", "0.54049665", "0.5401856", "0.5396873", "0.53...
0.64906526
0
Test that updates properly overwrite and are untagged.
def test_update(self): doc_fields = document_fields.DocumentFields({ 'foo@': 'bar', }) self.assertEquals('bar', doc_fields['foo']) doc_fields.update({ 'foo@': 'bbq', }) self.assertEquals('bbq', doc_fields['foo'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update(self):\n pass", "def test_update_case(self):\n pass", "def test_update_metadata(self):\n pass", "def test_update_metadata1(self):\n pass", "def test_partial_update_metadata(self):...
[ "0.723041", "0.723041", "0.723041", "0.7100334", "0.7058294", "0.70286316", "0.6987502", "0.69788766", "0.68703234", "0.6843875", "0.6841047", "0.680045", "0.67363405", "0.66987944", "0.66319287", "0.6622596", "0.6543176", "0.6509451", "0.6463772", "0.6427286", "0.6409471", ...
0.59169775
86
Summary of the time series. include mean, std, max, min and range
def summaryone(x): print 'mean and std are ',np.mean(x), np.std(x) print 'max and min are ',np.max(x), np.min(x) print 'the range is ',np.max(x)-np.min(x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_series_stats(time_series):\n return pd.Series([np.mean(time_series), np.std(time_series), get_frequency(time_series)])", "def show_stats(x):\n print(\"min =\", x.min())\n print(\"max =\", x.max())\n print(\"median =\", np.median(x))\n print(\"average =\", x.mean())\n print(\"std =\...
[ "0.6649429", "0.6533868", "0.6494436", "0.64276904", "0.63289535", "0.6307185", "0.62566227", "0.6218539", "0.6188114", "0.6148697", "0.6121931", "0.60502344", "0.6021406", "0.60148054", "0.5986059", "0.59573406", "0.5942241", "0.5935031", "0.5930992", "0.5924357", "0.5903259...
0.7294873
0
Plot and save one time series.
def plotone(x,y,xlabel,ylabel,filename): fig=plt.figure() ax = fig.add_subplot(111) ax.plot(x,y,linewidth=2.0) plt.ylabel(ylabel) plt.xlabel(xlabel) fig.savefig(filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_timeseries(self, series):\n plt.plot(range(1, len(series) + 1), series)\n plt.title(self.ticker)\n plt.savefig('plots/ARIMA/{0}.pdf'.format(self.ticker))\n plt.show()", "def plot2dTimeSeries(values, title='series', xLabel='time', yLabel='values', savePath='.'):\n plt.plot(...
[ "0.74593556", "0.73596394", "0.71248585", "0.70842844", "0.684327", "0.6759598", "0.67345", "0.6571536", "0.65034944", "0.64912015", "0.64470774", "0.64422935", "0.63846207", "0.63799745", "0.63796836", "0.6315035", "0.6307601", "0.6282471", "0.62733847", "0.6260635", "0.6247...
0.6692859
7
Plot two series in one plot.
def plottwo(x,y1,y2,y1label,y2label,xlabel,ylabel,filename): fig=plt.figure() ax = fig.add_subplot(111) ax.plot(x,y1,'ro-',linewidth=2.0,label=y1label) ax.plot(x,y2,'gs--',linewidth=2.0, label=y2label) plt.ylabel(ylabel) plt.xlabel(xlabel) plt.legend() fig.savefig(filename)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_series(self, t1=0, t2=100, t1p=None, t2p=None):\n \n plot_discretized(self.ts, self.ts_dis, t1=t1, t2=t2, t1p=t1p, t2p=t2p)", "def plot_corr_diff(tseries1, tseries2, fig=None,\r\n ts_names=['1', '2']):\r\n\r\n if fig is None:\r\n fig = plt.figure()\r\n\r\n ax ...
[ "0.6800669", "0.6607004", "0.64603275", "0.6359338", "0.63104266", "0.6293461", "0.627208", "0.6260561", "0.6245822", "0.616296", "0.61425745", "0.61307013", "0.60872036", "0.60725236", "0.60658973", "0.6039061", "0.6036746", "0.60297143", "0.6007434", "0.60052645", "0.596451...
0.6087972
12
Creates and returns a MySQL database engine.
def create_mysql_engine(dbname, prod=True, driver="pymysql"): db_config = toolbox.open_system_config(prod=prod, config_type="DB_CONFIG")[dbname] db_url = URL( drivername="mysql+{}".format(driver), username=db_config.get("username"), password=db_config.get("password"), host=db_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mysql_engine():\n\n return sa.create_engine(\n sa.engine.url.URL(\n drivername=\"mysql+pymysql\",\n username=\"username\", # Change that!!\n password=\"password\", # Change that!!\n host=\"host\", # Change that!!\n port=c.PORT,\n ...
[ "0.77028465", "0.75408655", "0.740179", "0.73909706", "0.71847886", "0.7134698", "0.7087348", "0.70744014", "0.7018489", "0.6846384", "0.679343", "0.6783817", "0.676985", "0.670791", "0.670791", "0.670791", "0.670791", "0.66787875", "0.66645664", "0.6635707", "0.6618998", "...
0.7968073
0
Creates and returns a connection to a Microsoft SQL Server database.
def create_mssql_connection( dbname, prod=True, driver="{ODBC Driver 17 for SQL Server}", driver_type="pyodbc" ): db_config = toolbox.open_system_config(prod=prod, config_type="DB_CONFIG")[dbname] if driver_type == "pyodbc": connection = pyodbc.connect( driver=driver, server=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createConnection(self):\n comp_name = os.environ['COMPUTERNAME']\n conn = py.connect('Driver=ODBC Driver 11 for SQL Server;SERVER=' +\n comp_name + '\\HAZUSPLUSSRVR; UID=SA;PWD=Gohazusplus_02')\n self.conn = conn\n return conn", "def create_connection():\r\n tr...
[ "0.69744205", "0.6950537", "0.67107075", "0.64784396", "0.6422242", "0.6395865", "0.638747", "0.638506", "0.6319929", "0.6319132", "0.6210808", "0.6189856", "0.6167106", "0.61432165", "0.6121374", "0.6109558", "0.61014706", "0.60880446", "0.60853744", "0.60759133", "0.6063821...
0.72884434
0
Returns a connection object to a MySQL database.
def create_pymysql_connection( dbname: str, prod: bool = True, **kwargs ) -> pymysql.connections.Connection: logger = logging.getLogger(__name__) db_config: Dict = toolbox.open_system_config(prod=prod, config_type="DB_CONFIG")[ dbname ] conn: pymysql.connections.Connection = None try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConnection(self):\n if (not self.initialized):\n logging.error(\"Module is not initialized\")\n \n conn_options = {\n 'user': self.user,\n 'password' : self.password,\n 'host' : self.host,\n 'port' : self.port,\n 'databas...
[ "0.81339747", "0.7922805", "0.791989", "0.77317", "0.7596933", "0.75095874", "0.7474045", "0.7447985", "0.7433263", "0.74198616", "0.7402707", "0.7391306", "0.73697084", "0.7291356", "0.725629", "0.7250308", "0.71750826", "0.7170298", "0.71553797", "0.7145148", "0.7131066", ...
0.7328943
13
Fix the dates for the CEMS data Three date/datetime changes (not all implemented) Make op_date a DATE type Make an appropriate INTERVAL type (not implemented) Add a UTC timestamp (not implemented)
def fix_up_dates(df): # Convert to interval: # df = convert_time_to_interval(df) # Convert op_date and op_hour from string and integer to datetime: # Note that doing this conversion, rather than reading the CSV with # `parse_dates=True` is >10x faster. # Make an operating timestamp df["oper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def datefixer(ds):\n\n\n\t# ========== create the new dates ==========\n\tyear = ds.Year\n\n\t# +++++ set up the list of dates +++++\n\tdates = OrderedDict()\n\ttm = [dt.datetime(int(year) , int(np.floor(tm)), int(tm%1*30+1)) for tm in ds.time]\n\tdates[\"time\"] = pd.to_datetime(tm)\n\n\tdates[\"calendar\"] = 'st...
[ "0.6125357", "0.5819586", "0.5773256", "0.57689685", "0.57060605", "0.5502692", "0.55019426", "0.5471219", "0.54283524", "0.54059875", "0.54014325", "0.53956264", "0.53769857", "0.5311041", "0.5306806", "0.5298646", "0.52898556", "0.52759445", "0.5245434", "0.5235692", "0.518...
0.6865202
0
Reframe the CEMS hourly time as an interval NOT YET IMPLEMENTED
def convert_time_to_interval(df): raise NotImplementedError( "This op_interval isn't included in the " + "SQLAlchemy model yet. Figure out what you want to do with interval " + "data first." ) df['op_interval'] = pd.to_datetime( df['op_date'].str.cat(df['op_hour'].astype(str)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finish_hour(self):\n\t\tassert len(self.values) >= 4, 'A fully formed update date is needed.'\n\t\tself.values = self.values[:4]", "def int_21H_44(self):\r\n time_now = datetime.datetime.now()\r\n\r\n hours = time_now.hour\r\n minutes = time_now.minute\r\n seconds = time_now.secon...
[ "0.5955569", "0.5899179", "0.586362", "0.5832983", "0.5738533", "0.56580067", "0.5656543", "0.56431466", "0.56165475", "0.55842906", "0.5531695", "0.5522082", "0.5517026", "0.54948276", "0.548903", "0.5477767", "0.5476642", "0.54562736", "0.54302275", "0.5428698", "0.54281735...
0.4906633
84
Harmonize the ORISPL code to match the EIA data NOT YET IMPLEMENTED
def harmonize_eia_epa_orispl(df): # TODO: implement this. return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, code, codeInfo):\r\n self.Code = code #IRCode\r\n self.CodeInfo = codeInfo #IRCodeInfo\r", "def hs_code_process(si):\n hs_code = re.sub(r'\\W+', '', si.get('hs_code', ''))\n descrip = re.sub(r'\\W+', '', si.get('description_of_goods', ''))\n bl_type = re.sub(r'\\W+', '',...
[ "0.5824118", "0.5785756", "0.57082134", "0.56386423", "0.5578592", "0.5571073", "0.5532403", "0.54825026", "0.5474109", "0.5467477", "0.5395739", "0.5381935", "0.5378068", "0.53727496", "0.536948", "0.53499657", "0.5298256", "0.5270665", "0.52548194", "0.52543354", "0.5252042...
0.55757576
5
Harmonize columns that are added later The load into Postgres checks for consistent column names, and these two columns aren't present before August 2008, so add them in.
def add_facility_id_unit_id_epa(df): if "facility_id" not in df.columns: df["facility_id"] = np.NaN if "unit_id_epa" not in df.columns: df["unit_id_epa"] = np.NaN return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _harmonize_columns(self, parse_dates=None):\n # handle non-list entries for parse_dates gracefully\n if parse_dates is True or parse_dates is None or parse_dates is False:\n parse_dates = []\n\n if not hasattr(parse_dates, '__iter__'):\n parse_dates = [parse_dates]\n\...
[ "0.66006935", "0.6560566", "0.6452825", "0.621741", "0.61326677", "0.6062282", "0.5985592", "0.5894047", "0.5881773", "0.5863339", "0.5851936", "0.58452696", "0.579159", "0.5759374", "0.5725462", "0.57243407", "0.57096153", "0.5677327", "0.5664387", "0.5660616", "0.5643589", ...
0.0
-1
Test whether every element in the series is either missing or in values This is fiddly because isin() changes behavior if the series is totally NaN (because of type issues)
def _all_na_or_values(series, values): series_excl_na = series[series.notna()] if not len(series_excl_na): out = True elif series_excl_na.isin(values).all(): out = True else: out = False return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nan_value(data):\n return data.isnull().any()", "def is_empty(series):\n return series.isna().all()", "def checkNaN(data):\n if data.isnull().values.any():\n N = data.isnull().sum().sum()\n print(\"There are {} missing values.\".format(N))", "def pd_isnan(val):\n return val is N...
[ "0.6702152", "0.65366334", "0.64191544", "0.6405477", "0.6321939", "0.63141245", "0.61905783", "0.6163543", "0.61403567", "0.6065991", "0.60013145", "0.59662825", "0.592186", "0.5896812", "0.5895072", "0.58945686", "0.5826522", "0.5777309", "0.57611376", "0.57524323", "0.5752...
0.73976064
0
Drop these calculated rates because they don't provide any information. If you want these, you can just use a view.
def drop_calculated_rates(df): if not _all_na_or_values(df["so2_rate_measure_flg"], {"Calculated"}): raise AssertionError() if not _all_na_or_values(df["co2_rate_measure_flg"], {"Calculated"}): raise AssertionError() del df["so2_rate_measure_flg"], df["so2_rate_lbs_mmbtu"] del df["co2_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rates(self):\n return self._rates", "def rates(self):\n raise NotImplementedError(\"Must be implemented by subclass.\")", "def get_zero_rates(self):\r\n self.__bootstrap_zero_coupons__()\r\n self.__get_bond_spot_rates__()\r\n return [self.zero_rates[T] for T in self.get_matur...
[ "0.61796653", "0.6036099", "0.5962428", "0.57073414", "0.565551", "0.5630784", "0.56072664", "0.5545332", "0.55377626", "0.5521308", "0.5488782", "0.5419411", "0.5387603", "0.5350166", "0.53407055", "0.53198713", "0.5319001", "0.52960646", "0.52811706", "0.5280485", "0.526765...
0.635766
0
Transform EPA CEMS hourly
def transform(epacems_raw_dfs, verbose=True): if verbose: print("Transforming tables from EPA CEMS:") # epacems_raw_dfs is a generator. Pull out one dataframe, run it through # a transformation pipeline, and yield it back as another generator. for raw_df_dict in epacems_raw_dfs: # There'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_apc(self, day):\n pass", "def OPCtimetransform(data, to):\n \n remove_times = []\n outtimes = []\n times = {'ms':[],'SS':[],'MM':[],'HH':[]}\n\n for i in range(0, len(data)):\n times['HH'] = 0\n times['MM'] = 0\n times['SS'] = 0\n times['ms'] = 0\n...
[ "0.60664696", "0.5939547", "0.5908493", "0.5785593", "0.56355613", "0.55279034", "0.54089785", "0.5343298", "0.53368235", "0.53047395", "0.52986807", "0.52903795", "0.5272429", "0.5263401", "0.5250048", "0.52491313", "0.5201047", "0.519941", "0.51899326", "0.51883954", "0.518...
0.0
-1
Run the detection algorithm
def run(self): # Define our components entry point while True: # for each packet waiting on our input port for packet in self.receive_all('in'): try: image = packet.get("data") log.debug("%s received %s %s", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_image(self):\n\n detect.main(self.nn_args)", "def run(self):\n while True:\n ret, frame = self.classification()\n # valid frame\n if ret == True:\n # output the recognized face\n if self.video_out != None:\n ...
[ "0.77328193", "0.7268141", "0.7214604", "0.71461743", "0.69773424", "0.6935214", "0.6867518", "0.68465203", "0.6806285", "0.6805328", "0.67979944", "0.67744297", "0.6743964", "0.6728882", "0.67030495", "0.66178083", "0.6602134", "0.65822536", "0.65799975", "0.6565747", "0.654...
0.0
-1
Calculates the bins used in the Riemann sum over metallicities
def calculateMetallicityBinEdges(self): if self.binInLogSpace: logMetallicities = np.log10(self.metallicityGrid) b= logMetallicities[:-1] + (logMetallicities[1:] - logMetallicities[:-1])/2. b = 10.**b #the boundaries for integration are not in log space so ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_energy_bins(image, num_bins=4):\r\n h, _ = image.shape\r\n C = np.linspace(0, h//2, num=num_bins+1, dtype=\"int\")\r\n # Create a list of dense square mask\r\n mask_list = [square_mask(image, c) for c in C[1:]]\r\n # Extract a list of hollow mask\r\n square_zones = [~mask_list[k]*mask_lis...
[ "0.63174194", "0.6299061", "0.62940705", "0.6222577", "0.6208876", "0.6017929", "0.598964", "0.59230375", "0.59167486", "0.58886397", "0.58843166", "0.5880696", "0.58755875", "0.58755875", "0.58666515", "0.5855976", "0.58558095", "0.584502", "0.5839998", "0.5780967", "0.57703...
0.6595891
0
This function translates between logOH12 = number density of oxygen to hyrdogen logZZsun = metallicity mass fraction in solar units
def LogOH12vsLogZZsun(self, value, inValue='logOH12'): if (inValue == 'logZZsun'): #translate from logZZsun to logOH12 logOH12 = value + self.logOH12sun return logOH12 elif (inValue == 'logOH12'): #translate from logOH12 to logZZsun logZZsun = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linear_to_mel(frequency):\n return 1127.01048 * np.log(1.0 + frequency / 700.0)", "def hertz_to_mel(freq):\n return 2595.0 * np.log10(1 + (freq / 700.0))", "def hertz_to_mel(self, freq):\n return 3340.0 * log(1 + (freq / 250.0), 9)", "def hz2mel(hz):\r\n return 2595 * np.log10(1+hz/700.0)...
[ "0.64378303", "0.63970214", "0.6097403", "0.60859525", "0.6012672", "0.59911144", "0.5966454", "0.59580696", "0.586378", "0.5845092", "0.58260393", "0.5823959", "0.57857716", "0.5778106", "0.5675272", "0.56143516", "0.5612323", "0.55670613", "0.55585444", "0.5534007", "0.5533...
0.5505402
22
Returns the fraction of the SFR. It combines a
def returnFractionMZ_GSMF(self, Zlower, Zupper, redshift): z = np.copy(redshift) #found that the mask z>4 overwrites input #these prescriptions work in metallicities of unit solar Zupper_Zsun = Zupper/ self.solarMetallicity Zlower_Zsun = Zlower/ self.solarMetallicity #Not com...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getfloat(self, fraction) -> float:\n self.numerator_a = fraction.numerator_a\n self.denominator_b = fraction.denominator_b\n self.fraction = str(self.numerator_a) + '/' + str(self.denominator_b)\n return super().__float__()", "def __float__(self) -> float:\n float_number = ...
[ "0.6898648", "0.6879199", "0.6687929", "0.6375416", "0.6367122", "0.63262564", "0.6292171", "0.6285895", "0.62443894", "0.6208853", "0.6184171", "0.61787236", "0.6174918", "0.616172", "0.6159846", "0.61596227", "0.61131597", "0.611027", "0.61037", "0.6078617", "0.6074802", ...
0.0
-1
fingerspitzengefuhl Cosmic integration paper
def SFR_Neijssel(self, z): SFR = 0.01 * ((1+z)**2.77) / (1 + ((1+z)/2.9)**4.7) * 1e9 #[1e9 for GPc-3] return SFR # [Msun yr-1 Gpc-3] in comoving volume
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def psi_enstrophy(\n Tau, # SGS; (6,64,64,64)\n h = False, # spatial step size\n flag = True): # spectral flag; default is gradient tool\n #---------------------------------------------------------------------#\n # Default variables ...
[ "0.6248479", "0.6207774", "0.61614895", "0.6117317", "0.61117685", "0.6110506", "0.6109973", "0.6097946", "0.608143", "0.6043247", "0.603947", "0.60337144", "0.59739536", "0.59240717", "0.59205556", "0.5892042", "0.5879855", "0.58760244", "0.58726484", "0.5853395", "0.5852051...
0.0
-1
Custom SFR same functional form as Madau et al
def SFR_Custom(self, z): a = self.customSFR[0] b = self.customSFR[1] c = self.customSFR[2] d = self.customSFR[3] SFR = a * ((1+z)**b) / (1 + ((1+z)/c)**d) * 1e9 #[1e9 for GPc-3] return SFR # [Msun yr-1 Gpc-3] in comoving volume
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def falcon():", "def _regr_basic():", "def smethod(fx,L=11,nh=2**8,tstep=2**7,ng=1,df=1.0,nfbins=2**10,sigmaL=None):\r\n \t\r\n df=float(df)\r\n \r\n if type(fx) is list:\r\n fx=np.array(fx)\r\n try:\r\n fn,fm=fx.shape\r\n if fm>fn:\r\n fm,fn=fx.shape\r\n excep...
[ "0.658998", "0.5861054", "0.582489", "0.56668854", "0.5608356", "0.5601948", "0.5588368", "0.5558229", "0.5507446", "0.5393739", "0.53269464", "0.5320055", "0.5313944", "0.5293867", "0.5290645", "0.5257212", "0.5254912", "0.52474356", "0.5243596", "0.52326226", "0.5229233", ...
0.55980986
6
Instead of combining a GSMF and MZ relation you can also directly construct a redshift dependent metallicity distribution In this case we focus on a lognormal distribution
def returnFractionLogNormal(self, Zlower, Zupper, redshift): if self.logNormalPrescription == 'Neijssel Phenomenological': "Based on norman Langer" Z0 = 0.035 alpha = -0.23 sigma = 0.39 elif self.logNormalPrescription == 'Custom Phenomenologica...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_metallicity_distribution(redshifts, min_logZ_COMPAS, max_logZ_COMPAS,\n mu0=0.035, muz=-0.23, sigma_0=0.39, sigma_z=0.0, alpha =0.0,\n min_logZ =-12.0, max_logZ =0.0, step_logZ = 0.01): \n ##################################\n # Log-...
[ "0.7099358", "0.6048183", "0.601982", "0.5922323", "0.58795625", "0.58391565", "0.58315736", "0.57944214", "0.5784503", "0.57521254", "0.5725489", "0.57061166", "0.57040393", "0.56882674", "0.5648836", "0.56422466", "0.5573206", "0.5572834", "0.55553544", "0.55145085", "0.549...
0.5417146
31
This is the main function called in the cosmic integration routine. For a given binNr in the metallicity bins it calculates the MSSFR
def returnMSSFR(self, metallicity=None, agesBirth=None, redshiftBirth=None): # find the bin number lowerBinNr = np.where(self.metallicityGrid == metallicity)[0][0] #we will only calculate the systems of which ages # and redshifts are not -1 (flagged as born too soon) mask =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SFSchmidt10(jd,mag,errmag,nbin=0.1,bmin=5,bmax=2000):\n\n dtarray, dmagarray, sigmaarray = SFarray(jd,mag,errmag)\n ndt=np.where((dtarray<=365))\n dtarray=dtarray[ndt]\n dmagarray=dmagarray[ndt]\n sigmaarray=sigmaarray[ndt]\n\n bins=bincalc(nbin,bmin,bmax)\n #print(len(bins))\n\n\n sf_l...
[ "0.65696776", "0.6289473", "0.62524277", "0.60693973", "0.6062215", "0.58293533", "0.58011806", "0.579511", "0.57943225", "0.57800806", "0.576732", "0.5765215", "0.5763416", "0.5738214", "0.57146233", "0.5697235", "0.56917053", "0.5680746", "0.56798327", "0.56759155", "0.5640...
0.5302065
75
exercise new directory revert facility
def test_revert_2(self): self.image_create(self.rurl) some_files = ["etc/A", "etc/B", "etc/C"] # first try reverting tag that doesn't exist self.pkg("install A@1.1 W@1") self.pkg("verify") self.pkg("revert --tagged alice", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_revert_3(self):\n self.image_create(self.rurl)\n some_files = [\"dev/xxx\", \"dev/yyy\", \"dev/zzz\",\n \"dev/dir1/aaaa\", \"dev/dir1/bbbb\", \"dev/dir2/cccc\",\n \"dev/cfg/ffff\", \"dev/cfg/gggg\",\n ...
[ "0.67572284", "0.66160476", "0.62285644", "0.61401373", "0.6042075", "0.6004498", "0.59423554", "0.59241223", "0.5858682", "0.5839227", "0.58292013", "0.5827911", "0.5822132", "0.5730254", "0.5710568", "0.570762", "0.5701192", "0.566655", "0.5651539", "0.5626604", "0.56164724...
0.60886854
4
duplicate usage in /dev as per Ethan's mail
def test_revert_3(self): self.image_create(self.rurl) some_files = ["dev/xxx", "dev/yyy", "dev/zzz", "dev/dir1/aaaa", "dev/dir1/bbbb", "dev/dir2/cccc", "dev/cfg/ffff", "dev/cfg/gggg", "dev/cfg/dir3/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usage(self, host):", "def showUsage():\n None", "def usage():", "def usage():", "def usage():\n return _usage", "def test_create_same_devices(self):\n command_line = self._MENU + [self._POOLNAME] + self.devices\n self.check_error(StratisCliNameConflictError, command_line, _ERROR)", ...
[ "0.59579253", "0.53823954", "0.5255355", "0.5255355", "0.5218427", "0.5217153", "0.5188536", "0.5177703", "0.5168382", "0.51058227", "0.5101718", "0.5089739", "0.5030349", "0.50100166", "0.50020605", "0.4969143", "0.49685776", "0.49660528", "0.49582165", "0.49555704", "0.4955...
0.0
-1
Make component fields, other info into dict for template context
def make_context( container: ServiceContainer, component_name: str, **kwargs ) -> Dict[str, Any]: from wired_components.component import IWrapComponents, IComponent # Start with all the wrapped components context: Dict[str, Any] = container.get(IWrapComponents) # We get the co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _template_data(self):\n return {\"form\": self.form.render()}", "def _get_render_context(self):\r\n context = {\r\n 'id': self.input_id,\r\n 'value': self.value,\r\n 'status': Status(self.status, self.capa_system.i18n.ugettext),\r\n 'msg': self.msg,\r...
[ "0.65645075", "0.6080614", "0.5978665", "0.58917844", "0.5774367", "0.5748968", "0.57399213", "0.57305616", "0.56950396", "0.5634534", "0.55968183", "0.55514616", "0.5549723", "0.5531995", "0.550397", "0.54978746", "0.5492822", "0.5489106", "0.54887336", "0.54638904", "0.5444...
0.6259585
1
c0 = coords_cut[i] cc0 = c0.cartesian xc, yc, zc = cc0.x.value, cc0.y.value, cc0.z.value x0, y0, d0 = c0.ra.value, c0.dec.value, c0.distance.value ang_max = 180. (sep / d0) / np.pi in_z = (np.absolute(coords.distance.value d0) 1e10]x[np.abs(nr)>1e10]/nr[np.abs(nr)>1e10]), \ np.sum(M[np.abs(nr)>1e10]y[np.abs(nr)>1e10]/n...
def pvector_pp(i, q): c0 = coords_cut[i] ra, dec = c0.ra.value, c0.dec.value r = hp.rotator.Rotator([ra, dec, 0]) sT = np.matmul(r.mat, np.matmul(s_tensor_cut[:,:,i], r.mat.transpose())) evals, evecs = np.linalg.eigh(sT[1:,1:]) evecA, evecB = evecs[:,0], evecs[:,1] if evecB[0] < 0: evecB = -evecB theta = np.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_b (self):\n self.argc = int((len(n.coord[0]))/2)\n self.pts_con = np.array(self.coord[:,self.argc:len(n.coord[0])])\n\n self.xd = self.xdi\n self.zd = self.zdi \n \n for i, x in enumerate(self.xdi):\n self.aux_con = self.pts_con[0] - x ...
[ "0.6363257", "0.60241544", "0.5992478", "0.5950258", "0.5903262", "0.5798193", "0.57892615", "0.578824", "0.57877165", "0.5726131", "0.5708826", "0.56843597", "0.5664259", "0.5659503", "0.56462854", "0.56304055", "0.5615204", "0.5607706", "0.5607545", "0.55574065", "0.5549847...
0.5524634
21
Takes the state code and creates output file for the state
def prep_prov_data(state='CT'): # Read the POS file file = f"{data_path}\pos_other_Dec20.csv" df = pd.read_csv(file, encoding='cp1252') df = df[['PRVDR_NUM', 'ST_ADR', 'CITY_NAME', 'STATE_CD', 'ZIP_CD','FIPS_CNTY_CD', 'CBSA_URBN_RRL_IND']] print(f'Original dataframe has {df.shape[0]} rows') # F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_state_file(self, state):\r\n with open(StudentModuleHistoryCleaner.STATE_FILE, \"w\") as state_file:\r\n state_file.write(state)", "def genStatesCode(self):\n for s, d in self.info['machine'].items():\n transition_code_arr = []\n for t in self.info['transi...
[ "0.6710576", "0.6646066", "0.6246326", "0.61974907", "0.619098", "0.61461467", "0.6093751", "0.6014258", "0.5977046", "0.5960007", "0.5928979", "0.58888406", "0.5832172", "0.5800238", "0.57619494", "0.5753456", "0.57476705", "0.56991893", "0.5686789", "0.5676803", "0.5664246"...
0.0
-1
Launch training of the model with a set of hyperparameters in parent_dir/job_name
def launch_training_job(model_dir,job_name, params, implementation_dir): # Create a new folder in implementation corresponding to the model implementation_dir = os.path.join(implementation_dir, os.path.basename(os.path.normpath(model_dir))) if not os.path.exists(implementation_dir): os.makedirs(impl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launch_training_job(parent_dir, data_dir, job_name, params):\n # Create a new folder in parent_dir with unique_name \"job_name\"\n model_dir = os.path.join(parent_dir, job_name)\n if not os.path.exists(model_dir):\n os.makedirs(model_dir)\n\n # Write parameters in json file\n json_path = ...
[ "0.80069077", "0.7198703", "0.71838933", "0.6437247", "0.63805366", "0.629484", "0.62795806", "0.6278729", "0.62004155", "0.6189536", "0.6156923", "0.6135809", "0.61020046", "0.6097955", "0.60901624", "0.60863006", "0.60771877", "0.6063894", "0.6054576", "0.6025766", "0.60214...
0.7579028
1
Takes a positive list of integers along with a target and returns a subset of
def diophantine_subset_sum(number_list, target, time_limit=TIME_LIMIT): started_at = time.time() # Sort numbers list. number_list = sorted(number_list) # Build sums list. sums_list = [number_list[0]] for n in range(1, len(number_list)): sums_list.append(number_list[n] + sums_list[n-1])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _select_sublist(lst, target):\n ln = len(lst)\n\n # Generate an array that indicates the decision bit for each element in the list.\n # If an element is deterministically true, then no decision bit is needed.\n choice_bits = [None] * ln\n x = 0\n for i in range(0, ln):\n if lst[i][1] n...
[ "0.7094783", "0.65067834", "0.6460729", "0.63038445", "0.6270336", "0.62450624", "0.62270397", "0.61682236", "0.61059326", "0.6029637", "0.6015087", "0.5967162", "0.5875812", "0.5808211", "0.5807387", "0.57974637", "0.5757506", "0.5754575", "0.5735689", "0.5707086", "0.569802...
0.693455
1
Here select interesting offers to notify in tg in where defined additional filters, for example, distance from center less than 30 km and defined period for which offers were created
async def extract_data_to_notify(app): notification_data = await app.db.select( f""" SELECT added_timestamp, total_area, full_url, jk_url, nearest_underground, nearest_underground_dist, price_rur, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_offers_to_send(self) -> Dict[Tuple[float, float], float]:\n partial_asgt = self._neighbors_values.copy()\n offers = dict()\n\n for limited_asgt in generate_assignment_as_dict([self.variable, self._partner]):\n partial_asgt.update(limited_asgt)\n cost = self._...
[ "0.5478844", "0.54343915", "0.5411153", "0.52321213", "0.5225025", "0.51286703", "0.51178557", "0.50775", "0.5036253", "0.5035772", "0.503197", "0.50226885", "0.5009665", "0.5009194", "0.49829316", "0.49653837", "0.49478367", "0.49094522", "0.49093115", "0.4901606", "0.488506...
0.0
-1
Convert unit with default UnitRegistry (i.e, application_registry)
def test_convert_unit_with_pint(test_df, current, to): df = get_units_test_df(test_df) # replace EJ/yr by EJ to test pint with single unit if current == "EJ": df.rename(unit={"EJ/yr": "EJ"}, inplace=True) exp = pd.Series([1.0, 6.0, 138.88, 833.33, 555.55, 1944.44], name="value") assert_con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_unit(self, unit):\n if unit in self.units:\n return self.units[unit]\n elif unit in unit_map:\n return unit_map[unit]\n else:\n raise SBMLError('Unit not recognized: ' + str(unit))", "def test_convert_unit_with_custom_registry(test_df):\n df = ...
[ "0.687325", "0.684293", "0.66271764", "0.6505694", "0.6295247", "0.6124371", "0.5856852", "0.58415043", "0.58247006", "0.5799204", "0.57857335", "0.5764567", "0.5676909", "0.56088245", "0.5580017", "0.5564396", "0.55641305", "0.55638456", "0.5550743", "0.55411625", "0.5519221...
0.0
-1
Convert unit with definition loaded from `IAMconsortium/units` repo
def test_convert_unit_from_repo(test_df): df = get_units_test_df(test_df) exp = pd.Series([1.0, 6.0, 17.06, 102.361, 68.241, 238.843], name="value") assert_converted_units(df, "EJ/yr", "Mtce/yr", exp)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_unit(self, unit):\n if unit in self.units:\n return self.units[unit]\n elif unit in unit_map:\n return unit_map[unit]\n else:\n raise SBMLError('Unit not recognized: ' + str(unit))", "def _get_units_object(self, units):\n if isinstance(unit...
[ "0.73016477", "0.6947638", "0.69390184", "0.69115627", "0.69105035", "0.6857282", "0.6822706", "0.6779308", "0.66278255", "0.6605075", "0.6557178", "0.65434927", "0.6530906", "0.6432699", "0.6416121", "0.6377947", "0.6370534", "0.6358671", "0.63333696", "0.63289326", "0.63137...
0.643053
14
Convert unit conversion with custom UnitRegistry
def test_convert_unit_with_custom_registry(test_df): df = get_units_test_df(test_df).rename(unit={"EJ/yr": "foo"}) # check that conversion fails with application registry with pytest.raises(pint.UndefinedUnitError): df.convert_unit("foo", "baz") # define a custom unit registry ureg = pint....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_unit(self, unit):\n if unit in self.units:\n return self.units[unit]\n elif unit in unit_map:\n return unit_map[unit]\n else:\n raise SBMLError('Unit not recognized: ' + str(unit))", "def convertUnit(*args, fromUnit: AnyStr=\"\", toUnit: AnyStr=\"...
[ "0.72558576", "0.7242834", "0.69972605", "0.67883354", "0.6740144", "0.6727505", "0.6723467", "0.67014116", "0.66655236", "0.6658775", "0.6603207", "0.65299666", "0.64555025", "0.64369696", "0.6419799", "0.64174867", "0.64120305", "0.6399249", "0.63895", "0.6342039", "0.63326...
0.72553796
1
Units and GHG species can be converted.
def test_convert_gwp( test_df, context, current_species, current_expr, to_expr, exp, exp_factor ): # Handle parameters current = current_expr.format(current_species) to = to_expr.format("CO2e") # Expected values exp_values = test_df._data.copy() exp_values[[False, False, True, True, True, T...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to(self, units: str) -> None:\n if self.units == units:\n return\n\n if units not in Variable.VALID_UNIT_CONVERSIONS[self.units]:\n msg = f\"\"\"Not a valid unit conversion. Valid destination units:\n {Variable.VALID_UNIT_CONVERSIONS[self.units]}\"\"\"\n ...
[ "0.57525384", "0.57275754", "0.5674095", "0.5629548", "0.5565156", "0.55589813", "0.5499987", "0.5466268", "0.54491645", "0.5431514", "0.5431423", "0.54084706", "0.54083174", "0.5377826", "0.5314006", "0.5296716", "0.5266335", "0.5263386", "0.52353054", "0.5214933", "0.521232...
0.49707523
59
Unit conversion with bad arguments raises errors.
def test_convert_unit_bad_args(test_pd_df): idf = IamDataFrame(test_pd_df).rename(unit={"EJ/yr": "Mt CH4"}) # Conversion fails with both *factor* and *registry* with pytest.raises(ValueError, match="Use either `factor` or `registry`!"): idf.convert_unit("Mt CH4", "CO2e", factor=1.0, registry=object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convertUnit(*args, fromUnit: AnyStr=\"\", toUnit: AnyStr=\"\", **kwargs)->float:\n pass", "def test_convert_invalid_unit():\n with pytest.raises(ValueError):\n pressure_util.convert(5, INVALID_SYMBOL, VALID_SYMBOL)\n\n with pytest.raises(ValueError):\n pressure_util.convert(5, VALID_SY...
[ "0.80642945", "0.76356244", "0.7445948", "0.7313819", "0.7179943", "0.68142354", "0.6702233", "0.67012995", "0.648865", "0.64848894", "0.637458", "0.63654095", "0.63062716", "0.63011336", "0.6265371", "0.6258366", "0.62375414", "0.6222837", "0.61793447", "0.6161228", "0.61586...
0.7108532
5
Convert units with custom factors.
def test_convert_unit_with_custom_factor(test_df): # unit conversion with custom factor df = get_units_test_df(test_df) exp = pd.Series([1.0, 6.0, 1.0, 6.0, 4.0, 14.0], name="value") assert_converted_units(df, "EJ/yr", "foo", exp, factor=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_units(self):\n for prod in (\"ier\", \"ier_inc_rain\"):\n self.data[prod].data[:] /= 1e6", "def convert_units(data, units):\n # Build the dictionary of units conversions\n convert = {'m' : [1.0, 0., 'm'], \n 'meter' : [1.0, 0., 'm'], \n 'deg C' : [1...
[ "0.7592755", "0.7377087", "0.7234802", "0.72110605", "0.7108356", "0.71072423", "0.70839715", "0.6940497", "0.6894842", "0.68894947", "0.6876686", "0.68304235", "0.6814569", "0.67865115", "0.67414594", "0.67141014", "0.6706773", "0.66971725", "0.6690622", "0.6680311", "0.6671...
0.72322226
3
Convert this object into a dictionary.
def to_dict(self) -> dict: return dict(sentences=[sentence.to_dict() for sentence in self.sentences])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def as_dict(self):\n return asdict(self)", "def to_obj(self):\n return dict()", "def to_dict(self):\n return to_dict(self.__dict__)", "def asdict(self) -> dict:\n return self.__asdict(self)", "def to_dict(self):\n return dict(self)", "def _to_dict(self):\n return...
[ "0.8573397", "0.8572996", "0.8508446", "0.8472537", "0.8470109", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "0.8465864", "...
0.0
-1
Convert this object into a string.
def to_string(self) -> str: return f"<Document, #sentences: {len(self.sentences)}>"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_string(self):\r\n return self.__str__()", "def serialize(self):\n\n return str(self)", "def serialize(self):\n\n\t\treturn str(self)", "def __str__(self):\n return str(self.serialize())", "def to_str(self) -> str:", "def __str__(self):\n return bytes_to_str(bytes(self))...
[ "0.8671065", "0.8303624", "0.8287494", "0.8237525", "0.8199979", "0.8178291", "0.8064898", "0.8064313", "0.80085224", "0.80085224", "0.8003638", "0.79904777", "0.7987857", "0.7974399", "0.7922337", "0.7922337", "0.7921466", "0.7921466", "0.7921466", "0.79149413", "0.78538585"...
0.0
-1
insert a column to tb. if called, all operation related to db must be fitted.
def insert_column(self, tb_name, column_name, data_type): sentences = f""" ALTER TABLE {tb_name} ADD COLUMN {column_name} {data_type}; """ print(sentences) self.commit(sentences)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _addColumn(self, table, column, init_data):\n\t\tcommand = \"ALTER TABLE \" + table + \" ADD COLUMN \" + str(column) + \" \" + getSQLiteType(init_data)\n\t\ttry:\n\t\t\tself._run_command(command)\n\t\texcept sqlite3.OperationalError:\n\t\t\tprint(\"Column \" + str(column) + \" already exists!\")", "def inser...
[ "0.6773", "0.65841776", "0.64992654", "0.6474949", "0.6455139", "0.64373386", "0.6368149", "0.6303153", "0.629054", "0.6239281", "0.6229999", "0.622003", "0.6205193", "0.6202118", "0.6199418", "0.6196598", "0.6169299", "0.6163966", "0.613079", "0.60933846", "0.60929984", "0...
0.76917046
0
Get values for keys
def mget(self, keys: List[K]) -> List[Optional[V]]: raise NotImplementedError('mget must be reimplemented in concrete implementation')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key_values(self):\n return self.key_values", "def values(self):\n with self.__plock:\n return map(self.get, self._keys)", "def values(self):\n return [self[k] for k in self.keys()]", "def values(self):\n return [self[key] for key in self.keys()]", "def values(...
[ "0.78560966", "0.7809564", "0.7629101", "0.76030433", "0.76030433", "0.76030433", "0.75565445", "0.7534844", "0.75304735", "0.7513847", "0.74225706", "0.73467046", "0.72960025", "0.7254402", "0.7246637", "0.71887136", "0.70794696", "0.7065934", "0.6987683", "0.69494283", "0.6...
0.62629557
82
Get a single key
def get(self, key: K) -> Optional[V]: return self.mget([key])[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key(self):\n return self._determine_key()", "def key(key):\n return key", "def get(self, key):\n result = self.search({\n \"field\": \"identity.key\",\n \"operator\": \"=\",\n \"value\": key})\n if len(result) > 1:\n raise Sarasvat...
[ "0.74487877", "0.7393895", "0.73517627", "0.7345837", "0.7345837", "0.7293161", "0.7262227", "0.7217249", "0.71878386", "0.7176885", "0.7176885", "0.7176885", "0.7176885", "0.7176885", "0.7176885", "0.7176885", "0.7176885", "0.7176885", "0.7176885", "0.7176885", "0.7176885", ...
0.0
-1
Get values for keys
def mset(self, kvs: Mapping[K, V]) -> List[bool]: raise NotImplementedError('mset must be reimplemented in concrete implementation')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key_values(self):\n return self.key_values", "def values(self):\n with self.__plock:\n return map(self.get, self._keys)", "def values(self):\n return [self[k] for k in self.keys()]", "def values(self):\n return [self[key] for key in self.keys()]", "def values(...
[ "0.78560966", "0.7809564", "0.7629101", "0.76030433", "0.76030433", "0.76030433", "0.75565445", "0.7534844", "0.75304735", "0.7513847", "0.74225706", "0.73467046", "0.72960025", "0.7254402", "0.7246637", "0.71887136", "0.70794696", "0.7065934", "0.6987683", "0.69494283", "0.6...
0.0
-1
Remove list of keys from the store
def delete(self, keys: List[K]) -> List[bool]: raise NotImplementedError('delete must be reimplemented in concrete implementation')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def removeAllKeys(self) -> None:\n ...", "def delete_many(self, keys):\n raise NotImplementedError()", "def rem(self, keys: Union[str, Iterable]):\n return(self.db.delVal(db=self.sdb, key=self._tokey(keys)))", "def rem(self, keys: Union[str, Iterable]):\n return(self.db.delVal(db=...
[ "0.7374732", "0.7209796", "0.68456185", "0.68456185", "0.68456185", "0.684242", "0.6835356", "0.6829273", "0.6737269", "0.6679472", "0.66645175", "0.6656001", "0.6648994", "0.66087186", "0.6540633", "0.6525455", "0.6507897", "0.6493868", "0.6461113", "0.6430038", "0.6426386",...
0.6642458
13
Clear the whole store
def clear(self) -> bool: raise NotImplementedError('clear must be reimplemented in concrete implementation')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear(self) -> None:\n self._store.clear()", "def clear(self):\n self._store = {}", "def clearStore(self):\n os.remove(self.uid+\".pcl\")\n self.items = []", "def clear(self):\n self.tensor_store.clear()\n self.i = 0", "def clear(self):\n self._storage.c...
[ "0.86360115", "0.8251459", "0.8168097", "0.76454467", "0.754934", "0.7438981", "0.7416115", "0.7318606", "0.7248102", "0.7210689", "0.7210689", "0.7209975", "0.7209975", "0.7209975", "0.7167617", "0.71544695", "0.714768", "0.71438867", "0.7102816", "0.71001446", "0.70647645",...
0.0
-1
Get a bunch of keys either from the cache layer or from the base
def mget(self, keys: List[K]) -> List[Optional[V]]: # Note an explicit check for None, because falsy values can be valid keys valid_index_and_key_list = [(idx, key) for idx, key in enumerate(keys) if key is not None] # Initialize the results results = [None] * len(keys) if valid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _multi_get(self, keys, encoding=\"utf-8\"):\n return [SimpleMemoryBackend._cache.get(key) for key in keys]", "def keys_fetch(self):\n with self.env.begin(write=False) as txn:\n cursor = txn.cursor()\n tot = txn.stat()['entries']\n i = 0\n\n path...
[ "0.6834069", "0.6382025", "0.6335966", "0.62565744", "0.624546", "0.6219669", "0.6212312", "0.61953014", "0.61886495", "0.61742663", "0.6109253", "0.60742164", "0.6064275", "0.60528266", "0.6002826", "0.5956592", "0.59504443", "0.59299576", "0.58935183", "0.58931494", "0.5884...
0.6371455
2
Get value for the key
def get(self, key: K)-> Optional[V]: return self._func(key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_value(self, key):\n pass", "def get_value(self, key):\n return self[key]", "def get_value(self, key):\n return self.data.get(key)", "def get_value(self, key):\n return self[key]['value']", "def get( self, key ):\n if key not in self._values:\n raise Val...
[ "0.8878386", "0.88521105", "0.86971056", "0.8678441", "0.829813", "0.8179047", "0.8178329", "0.8177001", "0.8166392", "0.8132502", "0.8081488", "0.80803794", "0.8015064", "0.7961579", "0.7961579", "0.78647137", "0.78497577", "0.78319174", "0.77768177", "0.7714798", "0.7693951...
0.0
-1
Verifies that the appears in page title
def is_title_matches(self): return "EXNESS - Trader Calculator and Currency Converter" in self.driver.title
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_title(self):\n currenttitle = self.driver.title\n assert self.TITLE in currenttitle, 'Title not expected. Actual: ' + currenttitle + ', Expected: ' + self.TITLE", "def verifyPageTitle(self, titleToVerify):\n try:\n actualTitle = self.getTitle()\n return self.u...
[ "0.7973157", "0.7904546", "0.7394582", "0.73098224", "0.71877354", "0.71312666", "0.71010184", "0.7058365", "0.696883", "0.6958025", "0.6924629", "0.69108593", "0.68864435", "0.68840015", "0.6877334", "0.68517303", "0.6819171", "0.6722788", "0.6661423", "0.66260976", "0.66160...
0.66116136
21
Draw something into the buffer
def draw_tiles(self): db = self.double_buffer if db is not None: span_x = self.width span_y = self.height tiles_x = int(ceil(span_x/256.0)) tiles_y = int(ceil(span_y/256.0)) cc = cairo.Context(db) tiles = self.tile_loader.load_area...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw():", "def draw(self, screen):", "def draw(self):\n pass", "def draw(self):\n pass", "def draw(self):\n pass", "def draw(self):\n pass", "def draw(self):\n\t\tpass", "def draw(self):", "def draw(self):\n self.batch.draw()", "def draw(self):\n rais...
[ "0.82649606", "0.7830266", "0.76652217", "0.76652217", "0.76652217", "0.76652217", "0.7653738", "0.75657344", "0.74521", "0.735082", "0.735082", "0.735082", "0.7295304", "0.72623223", "0.7143406", "0.7132452", "0.71102107", "0.70918834", "0.7013929", "0.6921154", "0.69120276"...
0.0
-1
Throw double buffer into widget drawable
def on_draw(self, widget, cr): #print "starting to draw" if self.double_buffer is not None: self.draw_tiles() cr.set_source_surface(self.double_buffer, 0.0, 0.0) cr.paint() else: print('Invalid double buffer') #print "done drawing" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_buffer(self):\n \n self.shape.buf = [pi3d.Buffer(self.shape, self.verts, self.texcoords, self.inds, self.norms)]\n self.shape.set_draw_details(self.shader, [self.spritesheet.img])", "def draw(self):", "def draw(self, screen):", "def pre_draw(self):", "def on_configure(self, wi...
[ "0.5492979", "0.54373515", "0.541417", "0.5406553", "0.53597254", "0.5355659", "0.5354216", "0.5340868", "0.53357756", "0.5319597", "0.52766144", "0.5271925", "0.5259718", "0.5236922", "0.52361697", "0.5216407", "0.5194417", "0.5152858", "0.51386267", "0.51239336", "0.5107952...
0.6775266
0
Configure the double buffer based on size of the widget
def on_configure(self, widget, event, data=None): print "reconfiguring" # Destroy previous buffer if self.double_buffer is not None: self.double_buffer.finish() self.double_buffer = None # Create a new buffer self.double_buffer = cairo.ImageSurface(cairo....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setBufferSize(self, buffer_size):\n DPxSetDinBuffSize(buffer_size)", "def _changed_size(self, **kw):\n\t\tself._clear_matrix()\n\t\t\n\t\tself._recalc_adjustments()\n\t\t\n\t\tif self.flags() & gtk.REALIZED:\n\t\t\tif kw.get('resize', True): self.queue_resize()\n\t\t\tif kw.get('draw', True): self.que...
[ "0.610253", "0.5766414", "0.5608554", "0.56082743", "0.5588019", "0.55230093", "0.5471639", "0.54091835", "0.5401123", "0.5401123", "0.5352664", "0.53298753", "0.5326704", "0.5319585", "0.53189176", "0.53112936", "0.53038687", "0.5290001", "0.52694154", "0.5253243", "0.524766...
0.6723716
0
Shows a category item
def showItem(category_item_id): return render_template('item.html', item=db.findItem(id=category_item_id))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showCategory(category_id):\n category = session.query(Category).\\\n filter_by(id=category_id).one()\n item = session.query(Item).\\\n filter_by(category_id=category.id)\n return render_template('item.html', category=category, item=item)", "def showItem(category_id):\n category = se...
[ "0.79654604", "0.7739004", "0.7643676", "0.7522781", "0.7224209", "0.702118", "0.7007901", "0.69838154", "0.6969686", "0.68813515", "0.67284054", "0.6714985", "0.67128104", "0.6640791", "0.65600896", "0.6559297", "0.65177655", "0.6493208", "0.6447697", "0.6445132", "0.6391688...
0.7802788
1
Allow user to create new catalog item
def newItem(): if request.method == 'POST': db.createItem( title=request.form['title'], description=request.form['description'], category_id=request.form['category'], user_id=login_session['user_id']) flash("New catalog item created!", 'success') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_item(self, user: User, **kwargs) -> None:", "def addCatalogItem(sport_id):\n\n sport = session.query(Sport).filter_by(id=sport_id).one()\n if request.method == 'POST':\n newCatalogItem = Item(\n name=request.form['itemName'],\n description=request.form['itemDescripti...
[ "0.73387873", "0.69759136", "0.69521016", "0.68233764", "0.6724789", "0.66220343", "0.65843236", "0.6572441", "0.6484448", "0.6453141", "0.6386233", "0.6372381", "0.6363761", "0.6352616", "0.6330959", "0.6315789", "0.63058573", "0.6267776", "0.6242766", "0.6202442", "0.618346...
0.76763475
0
Allows user to edit an existing category item
def editItem(category_item_id): editedItem = db.findItem(id=category_item_id) if editedItem.user_id != login_session['user_id']: return not_authorized() if request.method == 'POST': db.updateItem(editedItem, request.form) return redirect(url_for('showCatalog')) return render_temp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def editItem(category_id, item_id):\n editedItem = session.query(Item).filter_by(id=item_id).one()\n category = session.query(Category).filter_by(id=category_id).one()\n\n if editedItem.user_id != login_session['user_id']:\n flash(\"You are authorised to edit items created by you!\")\n ...
[ "0.79928815", "0.7969549", "0.79305446", "0.76757014", "0.7604712", "0.7579564", "0.7493831", "0.74769086", "0.74194235", "0.7385975", "0.7354665", "0.73481214", "0.7337863", "0.7281295", "0.7241027", "0.723668", "0.71674097", "0.7164873", "0.7072671", "0.70634896", "0.700564...
0.82450867
0
Allows user to delete an existing category item
def deleteItem(category_item_id): itemToDelete = db.findItem(id=category_item_id) if itemToDelete.user_id != login_session['user_id']: return not_authorized() if request.method == 'POST': db.deleteItem(itemToDelete) flash('%s Successfully Deleted' % itemToDelete.title, 'success') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category_delete(request):\n if request.POST:\n cat = get_object_or_404(Category, pk=request.POST.get('id'))\n cat.delete()\n return HttpResponse(status=200)", "def deleteCategory():\n deletecategory = deleteCategoryForm()\n # Look for CSRF token in form, verify POST method, and vali...
[ "0.8067774", "0.8005237", "0.7868571", "0.78579575", "0.7821217", "0.77969927", "0.7698097", "0.7654832", "0.7649916", "0.76128393", "0.75621045", "0.7551869", "0.74583393", "0.74365985", "0.73939204", "0.73760337", "0.734237", "0.726488", "0.7225764", "0.72094333", "0.717729...
0.80150735
1
Returns JSON of all items in catalog
def showItemsJSON(): items = db.getAllItems() return jsonify(CategoryItems=[i.serialize for i in items])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def catalog_json():\n all_categories = (session.query(Categories).all())\n all_items = (session.query(Items).all())\n return jsonify(categories=([all_categories.serialize\n for all_categories in all_categories]),\n items=([all_items.serialize\n ...
[ "0.853434", "0.83946824", "0.7997253", "0.7965265", "0.7584442", "0.7521632", "0.71851015", "0.7113346", "0.7080814", "0.70294416", "0.70173", "0.6980845", "0.6839632", "0.68100387", "0.6775649", "0.67730457", "0.6750319", "0.67496765", "0.66796345", "0.6647565", "0.66201764"...
0.7908903
4
Checks if a string is palindromic.
def ispalindrome(string): if isinstance(string, (str, int, float)): string = str(string).replace(" ", "").lower() if len(string) in [0,1]: return True half_index = len(string) // 2 first = string[:half_index] second = string[-half_index:] if first == secon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_palidrome(word):\n if word == string_reverse(word):\n return True\n else:\n return False", "def is_palindrome(string):\n return", "def isPalindrome(s):\r\n return isPal(toChars(s))", "def is_palindromic(n: int) -> bool:\n str_n = str(n)\n if str_n == str_n[::-1]:\n ...
[ "0.8234154", "0.8193637", "0.8175128", "0.8128422", "0.8093423", "0.805103", "0.8046132", "0.801999", "0.8012599", "0.8002301", "0.79903495", "0.79647315", "0.78919333", "0.7880501", "0.7864277", "0.7843781", "0.78298485", "0.78054845", "0.77765304", "0.7763191", "0.7761727",...
0.7539143
33
Functie om huizen die nog over zijn, efficient aan een batterij te koppelen
def fit_house_in_diamond(houses_copy, batteries): # Output huis die overgebleven is output_missing_house = houses_copy[0].get_output() # Sorteer batterijen resterend capaciteit hoog > laag, en selecteer meest_resterende batterij batteries.sort(key=lambda battery: battery.get_remaining(), reverse=True)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mezclar_bolsa(self):", "def apply(self):", "def podziel(self):\n def fraktal(dlugosc, alpha, poziom):\n \"\"\"Metoda wyznaczajaca fraktal.\n\n Metoda ta przyjmuje dlugosc, kat oraz poziom drzewa.\n Na bazie podanych parametrow wylicza fraktal z podanych w zadaniu wzo...
[ "0.6327021", "0.6093654", "0.6040308", "0.58797973", "0.58797973", "0.57834095", "0.5528101", "0.54579514", "0.5450377", "0.5450377", "0.5450377", "0.5450377", "0.5450377", "0.5419264", "0.5408628", "0.5397332", "0.5381069", "0.53769577", "0.534439", "0.528647", "0.527526", ...
0.0
-1
Compute average return and of steps.
def compute_avg_return_and_steps(environment, policy, num_episodes=10): total_return = 0.0 total_steps = 0.0 for _ in range(num_episodes): time_step = environment.reset() episode_return = 0.0 episode_steps = 0.0 while not time_step.is_last(): action_step = polic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mean(self, sums, step):\n\n return sums/step", "def calculate(self):\n avg = self.sum / self.n if self.n != 0 else 0\n self.running_avg.append(avg)\n return avg", "def average(self):\n return (self.current + self.last) / 2.0", "def average(self, start, end):\n ...
[ "0.7158892", "0.6989263", "0.6973302", "0.68902016", "0.67515194", "0.6697132", "0.652611", "0.6519316", "0.64798063", "0.6475223", "0.64444023", "0.6367762", "0.630979", "0.6308836", "0.62865496", "0.62865496", "0.62865496", "0.62493414", "0.61997265", "0.61639595", "0.61119...
0.75718766
0
Collect game episode trajectories.
def collect_episode(environment, policy, num_episodes, replay_buffer_observer): initial_time_step = environment.reset() driver = py_driver.PyDriver( environment, py_tf_eager_policy.PyTFEagerPolicy(policy, use_tf_function=True), [replay_buffer_observer], max_episodes=num_episodes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, episodes: Union[List[\"_Episode\"], \"_Episode\"]):\n if isinstance(episodes, _Episode):\n episodes = [episodes]\n\n for eps in episodes:\n # Make sure we don't change what's coming in from the user.\n # TODO (sven): It'd probably be better to make sure ...
[ "0.6414621", "0.63026017", "0.6240498", "0.6224731", "0.6224731", "0.6215807", "0.6149335", "0.6149335", "0.6086121", "0.6048319", "0.6045558", "0.6028511", "0.6001478", "0.5987351", "0.59605205", "0.59348625", "0.58955103", "0.5888853", "0.5848818", "0.5830826", "0.5825047",...
0.616832
6
Train and convert the model using TF Agents.
def train_agent(iterations, modeldir, logdir, policydir): # TODO: add code to instantiate the training and evaluation environments # TODO: add code to create a reinforcement learning agent that is going to be trained tf_agent.initialize() eval_policy = tf_agent.policy collect_policy = tf_agent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainModel( self, featureTrain, classTrain):", "def run(self) -> None:\n self.model = self.trainer.train_model(self.model, self.data)", "def training(self) -> None:\n self.compile_model()\n self.train_epoch()\n self.agent.save()", "def train(self):\n self.emission_model...
[ "0.6938712", "0.6882058", "0.6713514", "0.6688264", "0.666646", "0.6585662", "0.6549936", "0.6544408", "0.65219134", "0.6470889", "0.6462349", "0.64333606", "0.643169", "0.63435173", "0.63322496", "0.63154864", "0.6292728", "0.62925255", "0.62748116", "0.62622416", "0.6249937...
0.6190756
32
Return the camera's mac address as the serial number.
def serial_number(self) -> str: return self.mac_address
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_mac_address(self):\n str_hex_mac = uuid.UUID(int=uuid.getnode()).hex[-12:]\n return str_hex_mac", "def mac(self) -> str:\n return self.camera_info[\"wifi_mac\"]", "def mac_address(self) -> str:\n return self._device.mac", "def serial(self) -> str:\n return self.ca...
[ "0.74284977", "0.7396035", "0.7244921", "0.7241079", "0.7186397", "0.71549183", "0.6929182", "0.6929182", "0.68750423", "0.686168", "0.6835941", "0.6835715", "0.68190706", "0.67833877", "0.6717112", "0.6596283", "0.65792704", "0.6549326", "0.6522258", "0.6508936", "0.6494126"...
0.77441496
0
Return the camera's software version.
def software_version(self) -> str: return self.data.get(Attribute.SOFTWARE_VERSION)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def software_version(self) -> str:\n return self.camera_info[\"main_sw_version\"]", "def hardware_version(self) -> str:\n return self.camera_info[\"main_hw_version\"]", "def get_version(self):\r\n return self._arm.get_version()", "def firmware_version(self):\n return self._get_system_...
[ "0.89519215", "0.83684665", "0.74867046", "0.73334736", "0.72057974", "0.71801555", "0.7148547", "0.71403116", "0.71381164", "0.7101077", "0.7082621", "0.7062264", "0.6997098", "0.69791687", "0.69379365", "0.69282806", "0.69030863", "0.6860852", "0.6859731", "0.68596333", "0....
0.7609568
2
Return True if capture clip on motion is active.
def capture_clip_on_motion(self) -> bool: return self.data[Attribute.CAPTURE_CLIP_ON_MOTION]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capture_is_active(self):\n return self.um in self._streams", "def can_activate(self):\n if self.video_library.get_number_of_video_clips() == 0:\n return False\n else:\n return True", "def motion_detection_enabled(self):\n return self._motion_status", "def...
[ "0.6876677", "0.6634053", "0.63762534", "0.6186591", "0.60965234", "0.605035", "0.6013605", "0.6006316", "0.5958077", "0.59114885", "0.5910525", "0.5908825", "0.5908825", "0.58919317", "0.58919317", "0.5860505", "0.5826048", "0.5814718", "0.5800764", "0.5795898", "0.5795898",...
0.8491094
0