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
Sets gpu or cpu as device.
def set_device(gpu_arg): dev = 'cpu' if gpu_arg and torch.cuda.is_available(): dev = 'cuda' elif gpu_arg: print('Not gpu found. Using cpu instead.') return torch.device(dev)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_device(self, cuda=True):\n if cuda and torch.cuda.is_available():\n self.cuda = True\n self.device = torch.device('cuda')\n else:\n self.cuda = False\n self.device = torch.device('cpu')\n\n if self.verbose:\n if not cuda:\n ...
[ "0.78580344", "0.76623416", "0.7637089", "0.7610789", "0.7605773", "0.75491273", "0.74247074", "0.7374936", "0.73403174", "0.7317237", "0.7289666", "0.72644484", "0.72399104", "0.7190007", "0.7136237", "0.69835097", "0.69794333", "0.684509", "0.67909247", "0.6786786", "0.6739...
0.767788
1
Returns classifier with the specified hidden units.
def create_classifier(model, hidden_units=None): defaul_nb_units = 4096 nb_units = hidden_units if hidden_units else defaul_nb_units input_features = model.classifier[0].in_features classifier = nn.Sequential(OrderedDict([ ('fc1', nn.Linear(input_features, nb_units, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_classifier(model, hidden_units):\n in_features = model.classifier._modules['0'].in_features\n classifier = nn.Sequential(OrderedDict([\n ('dropout1', nn.Dropout(0.5)),\n ('fc1', nn.Linear(in_features, hidden_units)), \n ('relu', nn.ReLU()),\n ('dropout2', nn.Dropou...
[ "0.67934304", "0.60427326", "0.55828494", "0.54037946", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5384353", "0.5377559", "0.5351114", "0.534234", "0.52754366", "0.5259303", "0.52519554", "0.52263665", "0.5193453...
0.67931324
1
Validates model performance against testing set
def validation(model, testloader, criterion, device): test_loss = 0 accuracy = 0 for inputs, labels in testloader: inputs = inputs.to(device) labels = labels.to(device) log_ps = model(inputs) test_loss += criterion(log_ps, labels) ps = torch.exp(log_ps) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_validation(self):\n self.validationFails()", "def is_valid(self, data_model: DataModel) -> bool:", "def validate(self):\n self.set_model_mode('eval')\n self.evaluator.reset()\n losses = MetricMeter()\n\n print('Do evaluation on {} set'.format('valid set'))\n d...
[ "0.6591496", "0.65386975", "0.6522569", "0.649261", "0.6423237", "0.638867", "0.6370357", "0.63699144", "0.6362285", "0.63479805", "0.6292155", "0.6241761", "0.6205522", "0.62029135", "0.62016195", "0.6170987", "0.6141245", "0.6137563", "0.6134479", "0.6129895", "0.6120999", ...
0.5785792
76
Saves trained model to a specified save directory with the classifications of the training data.
def create_checkpoint(model, save_dir, train_data): model.class_to_idx = train_data.class_to_idx checkpoint = { 'model': model.name, 'classifier': model.classifier, 'class_to_idx': model.class_to_idx, 'state_dict': model.state_dict() } if save_dir and isdir(save_dir): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveModel(self, save_path):\n if not os.path.exists('/'.join(os.path.split(save_path)[:-1])):\n os.makedirs('/'.join(os.path.split(save_path)[:-1]))\n with open(save_path, 'wb') as fw:\n pickle.dump(self.clf, fw)", "def save_training_model(directory: str, training_model: D...
[ "0.792108", "0.7890227", "0.7669677", "0.76605594", "0.75680846", "0.75657356", "0.75297654", "0.75108254", "0.75076526", "0.75073034", "0.74928135", "0.7473935", "0.745247", "0.744702", "0.741163", "0.73871577", "0.7386952", "0.73726606", "0.7331561", "0.73182833", "0.731514...
0.0
-1
Return modified payload with revision.reference_type changed
def get_unknown_event(self, fixture_name: str) -> str: fixture_data = orjson.loads( self.webhook_fixture_data("semaphore", fixture_name, file_type="json") ) fixture_data["revision"]["reference_type"] = "unknown" return fixture_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fix_type_revisions(type_, rows):\n model = getattr(all_models, type_, None)\n revisions_table = all_models.Revision.__table__\n if not model:\n logger.warning(\"Failed to update revisions for invalid model: %s\", type_)\n return\n\n ids = [row.resource_id for row in rows]\n objects = model.eager_qu...
[ "0.56458133", "0.54508954", "0.5412335", "0.53977835", "0.5386709", "0.53075624", "0.53053695", "0.5242212", "0.5219419", "0.5176573", "0.5170405", "0.5153254", "0.5150153", "0.51363564", "0.5132763", "0.51004815", "0.50710076", "0.506032", "0.50451046", "0.50314474", "0.5004...
0.0
-1
computes signal efficiency (TPR) at given mistagging rate (FPR), supports multiple FPRs
def signal_eff(y_true, y_proba, mistag_rate_thresh, sample_weight=None): if hasattr(mistag_rate_thresh, "__iter__"): effs = [] for t in mistag_rate_thresh: eff = signal_eff(y_proba, y_true, t, sample_weight=sample_weight) effs.append(eff) return effs fpr, tpr, _...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_recall(num_tp, num_fp, num_fn):\n if (num_tp + num_fn) == 0:\n return 0\n else:\n return num_tp / (num_tp + num_fn)", "def fpr_at_995tpr(self):\r\n\r\n return self.fpr_at_confidence(self.confidence_at_tpr(0.995))", "def fpr_at_99tpr(self):\r\n\r\n return self.fpr...
[ "0.62606823", "0.6191", "0.61213005", "0.6041481", "0.5994079", "0.5961398", "0.5953647", "0.59192", "0.5917467", "0.59135425", "0.5894217", "0.5822168", "0.5783463", "0.57831764", "0.5764547", "0.5750534", "0.5686865", "0.56831115", "0.56738174", "0.56625986", "0.56359583", ...
0.52023154
61
calculates signal significance S/sqrt(S+B), where S and B are number of true signal and background samples
def signal_significance( y_true, y_proba, sig2incl_ratio, threshold=None, sample_weight=None ): fpr, tpr, thresholds = roc_curve(y_true, y_proba, sample_weight=sample_weight) n_bkg = (1 - sig2incl_ratio) * 100 n_sig = sig2incl_ratio * 100 B = n_bkg * fpr S = n_sig * tpr significances = S / n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rms(sig):\n\n return np.sqrt(np.sum(np.array(sig)**2)/len(sig))", "def poisson_significance(s,b):\n return np.sqrt(2*((s+b)*np.log(1+s/b)-s))", "def sig_func(x, w, b):\n z = np.dot(x, np.transpose(w)) + b\n try:\n s = 1 / (1 + exp(-z))\n except OverflowError:\n s = float('inf'...
[ "0.6454964", "0.63954824", "0.630515", "0.60133904", "0.5929641", "0.58901566", "0.5835426", "0.5817925", "0.5788015", "0.57416415", "0.5740556", "0.5714146", "0.56751794", "0.56568736", "0.56543106", "0.5635681", "0.5629006", "0.5624984", "0.5623165", "0.56145406", "0.560784...
0.0
-1
returns threshold optimal from point of view of signal significance
def get_optimal_threshold(y_true, y_proba, sig2incl_ratio, sample_weight=None): significances, thresholds = signal_significance( y_true, y_proba, sig2incl_ratio, sample_weight=sample_weight ) return thresholds[np.nanargmax(significances)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_significance_threshold(num_points, confidence_level):\n\n min_absolute_t_value = t_distribution.ppf(\n q=(1. - confidence_level) / 2, df=num_points - 2, loc=0., scale=1.)\n\n # return numpy.power(\n # float(num_points - 2) / min_absolute_t_value ** 2 + 1, -0.5)\n\n return numpy.sqr...
[ "0.6909387", "0.6882819", "0.6882819", "0.6882819", "0.6882819", "0.6882819", "0.68522406", "0.68279696", "0.678176", "0.678045", "0.678045", "0.678045", "0.67218804", "0.65964496", "0.6548787", "0.64782834", "0.6432697", "0.64246833", "0.64161634", "0.637131", "0.6369651", ...
0.6591664
14
computes purity aka precision or PPV
def purity(y_true, y_pred, sample_weight=None): if sample_weight is None: sample_weight = np.ones_like(y_true) TP = np.sum((y_pred) * y_true * sample_weight) FP = np.sum((y_pred) * (y_true == 0) * sample_weight) return TP / (TP + FP)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purity_test(self):\n mean = filter_data(self.data,self.ancestors)['Class'].mean()\n if mean == 0:\n return 0\n elif mean == 1:\n return 1\n return None", "def precisions(self):\n raise NotImplementedError", "def get_product_purity(product):\n retu...
[ "0.64632154", "0.64027184", "0.63683444", "0.6363845", "0.6306878", "0.6197376", "0.61914396", "0.61529857", "0.61088026", "0.6077791", "0.6061475", "0.60298705", "0.60276634", "0.6025647", "0.60096633", "0.60024005", "0.59947544", "0.5990744", "0.5983812", "0.59597224", "0.5...
0.5836949
28
calculates metrics (threshold, tpr, fpr, purity) for given threshold(s)
def calc_metrics(ts, y_proba, y_true, sample_weights=None): if not hasattr(ts, "__iter__"): ts = [ ts, ] if sample_weights is None: sample_weights = np.ones_like(y_proba) purities = [] fprs = [] tprs = [] n_tot_sig = np.sum(sample_weights[y_true == 1]) n_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metrics(x, y, save_folder, threshold, ds_name):\n predicted = model.predict(x)\n predicted[predicted > threshold] = 1\n predicted[predicted <= threshold] = 0\n actual = y\n TP = np.sum(np.logical_and(predicted == 1, actual == 1))\n FN = np.sum(np.logical_and(predicted == 0, actual == 1))\n ...
[ "0.69263595", "0.69115037", "0.6562216", "0.6441035", "0.6343448", "0.63204813", "0.6248199", "0.62383956", "0.62163156", "0.6208174", "0.6113278", "0.6110677", "0.6109333", "0.60995615", "0.6090161", "0.6047639", "0.6033883", "0.60078704", "0.599886", "0.5980891", "0.5977773...
0.5563373
65
finds score threshold closest to the given metric's value in recursive manner
def recursive_threshold_search( metric_name, metric_val, y_proba, y_true, sample_weights=None, verbose=False ): ts_next = np.linspace(0, 1, 11) prev_min = -1 prev_max = 999 ts_final = None n_points = 5 it = 0 eps_rel = 1e-3 while True: it += 1 ts, trps, fprs, purities...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best(template, config, key_seq, metric):\n possibles = get_deep(template, key_seq)\n if 1 == len(possibles):\n return None\n best_score = 2**60\n best_val = None\n for val in possibles:\n set_deep(config, key_seq, val)\n score = metric(config)\n #print \"FFFFFFFFF\", score\n if score <...
[ "0.6242058", "0.60764176", "0.60312897", "0.60109395", "0.5900902", "0.5883688", "0.5838622", "0.58243793", "0.58210593", "0.57580566", "0.5754754", "0.57176447", "0.56844616", "0.56624895", "0.56525797", "0.5631776", "0.56171566", "0.56144166", "0.56032133", "0.5601002", "0....
0.6865603
0
Delete a redshift cluster subnet group.
def _Delete(self): cmd = self.cmd_prefix + [ 'redshift', 'delete-cluster-subnet-group', '--cluster-subnet-group-name', self.name ] vm_util.IssueCommand(cmd, raise_on_failure=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_vm_group(session, cluster, vm_group):\n client_factory = session.vim.client.factory\n group_spec = client_factory.create('ns0:ClusterGroupSpec')\n groups = []\n\n group_spec.info = vm_group\n group_spec.operation = \"remove\"\n group_spec.removeKey = vm_group.name\n groups.append(gr...
[ "0.6717698", "0.65497667", "0.6535989", "0.6361416", "0.62842244", "0.6219916", "0.6177591", "0.6167533", "0.610994", "0.61087596", "0.60966676", "0.6096312", "0.6072783", "0.605781", "0.60560346", "0.6021917", "0.6014034", "0.6008268", "0.59907883", "0.59521925", "0.5951997"...
0.88937056
0
Load word dependencies into graph using networkx. Enables easy traversal of dependencies for parsing particular patterns. One graph is created for each sentence.
def _build_graph(show=False): global G G = nx.Graph() node_labels, edge_labels = {}, {} for idx, dep in enumerate(A.deps): types = ["dependent", "governor"] # nodes, labels for x in types: G.add_node(str(dep[x]), word=dep[x + "Gloss"], pos=A.lookup[dep[x]]["pos"]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dep_parse_reviews(texts: List[Text], nlp: stanza.Pipeline) -> List[ParsedText]:\n\n logging.info('Start dependency parsing...')\n parsed_texts = []\n\n with tqdm(total=len(texts), ncols=PROGRESSBAR_COLUMNS_NUM,\n file=sys.stdout) as progress_bar:\n for text_index, text in enumerate...
[ "0.64596725", "0.59618956", "0.5780951", "0.5758003", "0.57246745", "0.56997263", "0.56932354", "0.56048334", "0.5597195", "0.5587992", "0.55695224", "0.5566718", "0.5560558", "0.5545795", "0.5529371", "0.5502285", "0.54497164", "0.543496", "0.54341555", "0.5427908", "0.54141...
0.5105572
56
If an edge connects to a node (word), return the index of the node
def _get_connected(edge, idx): if str(edge[0]) == str(idx) and A.lookup[int(edge[1])]["word"] != Num: return edge[1] elif str(edge[1]) == str(idx) and A.lookup[int(edge[0])]["word"] != Num: return edge[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _edgeLabel(self, node, parent):\r\n return self.word[node.idx + parent.depth: node.idx + node.depth]", "def edge_index(indexed_triangle, edge):\n for i in range(3):\n triangle_edge = indexed_triangle[(i + 1) % 3], indexed_triangle[(i + 2) % 3]\n if triangle_edge == edge:\n ...
[ "0.65566194", "0.6190244", "0.61681044", "0.6073611", "0.60537326", "0.6007597", "0.5964232", "0.59039056", "0.5896506", "0.5844572", "0.5827229", "0.5819316", "0.57526916", "0.5712475", "0.57093567", "0.5697757", "0.5680633", "0.5608613", "0.5604437", "0.55679816", "0.556712...
0.732996
0
Find a second degree relation within the dependency graph. Used to find subject in a sentence when the measurement unit is a direct object, for example.
def _get_cousin(sibling_idx, dep_type_list, visited_nodes={}): words = [] # Visited nodes prevent recursion from bouncing between two "VB" nodes for dep_type in dep_type_list: for edge in G.edges(data=True): cousin_idx = _get_connected(edge, sibling_idx) allowed_pos = ["NN", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_second_order_dispersion(self):\n raise NotImplementedError('Second Order Dispersion is not Implemented yet.')", "def find_dependent(self, relation):\n\t\treturn re.search('(?<=, ).*(?=-)',relation).group(0)", "def _get_subj_and_obj(verb_node, dependency_tree):\n subj_node_index = verb_no...
[ "0.59521693", "0.5577839", "0.54971015", "0.533284", "0.5237227", "0.5229672", "0.51814", "0.51393384", "0.5111583", "0.5095646", "0.5095038", "0.4999685", "0.4990428", "0.49738032", "0.49619588", "0.4961048", "0.49346897", "0.49318674", "0.49272823", "0.4920199", "0.49002048...
0.0
-1
Adds a word (and its metadata) related to a measurement to the list of all related words for that measurement
def _add_related(related, dep, all_related, index, connector=None): doc = {} doc["relationForm"] = dep doc["rawName"] = related doc["tokenIndex"] = int(index) doc["offsetStart"] = A.lookup[int(index)]["start"] doc["offsetEnd"] = A.lookup[int(index)]["end"] doc["connector"] = "" if connector ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, word: str) -> None:\n self.words.add(word)\n self.added_words.add(word)", "def add_words(self, words):\r\n for word in words:\r\n self.add(word)", "def add(self, word: str) -> None:\n self.d.add(word)", "def add_words(self, words, value):\n if words...
[ "0.6651249", "0.6582952", "0.64778966", "0.63896775", "0.62895304", "0.62871456", "0.62849236", "0.6282664", "0.62679726", "0.6182581", "0.6168457", "0.61679065", "0.61659604", "0.6078923", "0.60761344", "0.6069568", "0.60609025", "0.6058869", "0.6050961", "0.6043219", "0.603...
0.56861186
57
For related words found for a measurement (usually nouns), add any connected adjectives, compounds, or modifiers.
def _add_descriptors(related): for r in related: r["descriptors"] = [] for edge in G.edges(data=True): sibling_idx = _get_connected(edge, r["tokenIndex"]) if sibling_idx and (A.lookup[int(sibling_idx)]["pos"] == "JJ" or edge[2]["dep"] in ["amod", "compound"]): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_related(stats, match, patterns_file):\n all_related = None\n measurement_formats = [\"space_between\", \"attached\", \"hyphenated\"]\n\n all_related = _parse_patterns(match[\"unit_idx\"], match[\"measurement_format\"], patterns_file)\n if all_related == None:\n all_related = _parse_patt...
[ "0.59282726", "0.5896106", "0.57640356", "0.5736976", "0.55327153", "0.5507227", "0.5498549", "0.54563355", "0.5434374", "0.5351359", "0.5312978", "0.52993435", "0.5271659", "0.5256711", "0.5176169", "0.51729816", "0.51703644", "0.51655173", "0.51633793", "0.516039", "0.51557...
0.5840201
2
If measurement is found, runs processed sentence through valid dependency patterns (from JSON file) to find additional words related to measurements
def _check_criteria(dep, dep_obj, all_related, edge, sibling_idx): # Check for a matching dependency type related = [] if edge[2]["dep"] == dep: # Check for matching POS type(s) for pos_logic in dep_obj.keys(): connector = None if isinstance(dep_obj[pos_logic], dict...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing():\n\n # lists which contains paths of keyword and non-keyword utterances\n non_kw_clips, kw_clips = generate_clips_kwds()\n\n non_kw_sent_dict, kw_sent_dict = {}, {}\n templates_dict = {}\n\n # calculate and store MFCC features in a dictionary\n for kw in listdir(kw_path):\n t...
[ "0.60360307", "0.577655", "0.57587236", "0.5471167", "0.54599345", "0.5435434", "0.5412481", "0.5395672", "0.53841865", "0.53812826", "0.53745234", "0.5343501", "0.5333111", "0.5325396", "0.5304026", "0.5294816", "0.5281366", "0.5278556", "0.52714276", "0.5257359", "0.5255737...
0.0
-1
Loads depedency patters JSON file and uses "_check_criteria" to look for words related to measurement (connected via unit token)
def _parse_patterns(unit_idx, measurement_format, patterns_file): all_related = [] for edge in G.edges(data=True): for idx in unit_idx: sibling_idx = _get_connected(edge, idx) if sibling_idx: with open(os.path.join(basedir, patterns_file), "r") as tree: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createDelexData():\n # download the data\n loadData()\n\n # create dictionary of delexicalied values that then we will search against, order matters here!\n dic = delexicalize.prepareSlotValuesIndependent()\n\n\n fin1 = file('data/multi-woz/data.json')\n data = json.load(fin1)\n\n fin2 = f...
[ "0.54548824", "0.51143765", "0.50963867", "0.49581528", "0.49428564", "0.4891463", "0.4842097", "0.48237473", "0.48151132", "0.477723", "0.47634962", "0.47514355", "0.47433817", "0.47344702", "0.4729923", "0.47292587", "0.4725441", "0.4715082", "0.47115362", "0.4704471", "0.4...
0.43452448
98
Calls _parse_patterns() to get words related to a measurement and provides deduplication between related words and grobid response
def _get_related(stats, match, patterns_file): all_related = None measurement_formats = ["space_between", "attached", "hyphenated"] all_related = _parse_patterns(match["unit_idx"], match["measurement_format"], patterns_file) if all_related == None: all_related = _parse_patterns(match["unit_idx"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processwords(list_of_matches, lemmatag = False):\n list_of_matches = [w.lower() for w in list_of_matches]\n # remove nonwords, strip . to normalise \"dr.\"\n if translated_option != 'o' and translated_option != 'u':\n list_of_matches = [w.lstrip('.').rstrip('.') for w in list_of...
[ "0.57819784", "0.55956167", "0.5446848", "0.53935367", "0.53138745", "0.5262453", "0.52373886", "0.52355427", "0.51643676", "0.5153938", "0.51286644", "0.5086422", "0.50284916", "0.502709", "0.50240386", "0.50169647", "0.5012645", "0.5007658", "0.49831492", "0.49702612", "0.4...
0.68618006
0
Reconstruct sentence from CoreNLP tokens raw sentence text isn't retained by CoreNLP after sentence splitting and processing
def _reconstruct_sent(parsed_sentence): sent = "" for x in range(0, len(parsed_sentence["tokens"])): sent += parsed_sentence["tokens"][x]['originalText'] if x + 1 != len(parsed_sentence["tokens"]): # Use character indices from tokens to ensure correct spacing when reconstructing ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_sent(sent):\n #tokenized = word_tokenize(sent.lower())\n tokenizer = Tok()\n tokenized = tokenizer.tokenize(sent.lower())\n return tokenized", "def ie_preprocess(document):\n sentences = nltk.sent_tokenize(document) #NLTK default sentence segmenter\n #print sentences # sentenc...
[ "0.7098648", "0.6799461", "0.6780372", "0.67144334", "0.66657877", "0.66373456", "0.6628849", "0.6603798", "0.65889335", "0.658124", "0.6559917", "0.6551816", "0.6537567", "0.65098137", "0.65090424", "0.65013677", "0.6477535", "0.6473648", "0.6420733", "0.64156705", "0.639688...
0.63481617
22
Toplevel user interface to parsing measurements and related words
def extract(content, corenlp_endpoint, grobid_endpoint, dependency_patterns_file, output_file=None, show_graph=False, pretty=False, simplify=False): all_extractions = [] out = None if output_file: out = codecs.open(output_file, "a", encoding="utf-8") if len(content) < 5: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(args):\n words = dict(tuple( (w.strip().split()[-1],[])\n for w in open(args.w,'r').read().strip().split('\\n')))\n \n for line in sys.stdin:\n line = line.strip().split()\n identifier = line[0]\n start = float(line[1])\n end = float(line[2])\n ...
[ "0.61940575", "0.60122955", "0.58378917", "0.58330756", "0.582991", "0.57581437", "0.5746441", "0.56175154", "0.5589518", "0.55284655", "0.55283326", "0.5495981", "0.5494712", "0.5485213", "0.54700774", "0.54205483", "0.54205483", "0.54006994", "0.53991455", "0.5391652", "0.5...
0.0
-1
Update a state given lifted operator effects and assignments of variables to objects.
def _apply_effects(state, lifted_effects, assignments): new_literals = set(state.literals) determinized_lifted_effects = [] # Handle probabilistic effects. for lifted_effect in lifted_effects: if isinstance(lifted_effect, ProbabilisticEffect): chosen_effect = lifted_effect.sample() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_state(self, *args, **kwargs):\n raise NotImplementedError('Must be implemented in subclasses.')", "def update(self):\r\n\r\n self.target.load_state_dict(self.model.state_dict())\r\n self.target.eval()", "def trigger(self, state, updated_vars):\n for evidence_var in state.get_...
[ "0.65871185", "0.6339028", "0.6116831", "0.6077445", "0.60428387", "0.6041592", "0.6033057", "0.5987334", "0.5967393", "0.5936412", "0.5923244", "0.58867145", "0.5879626", "0.58601105", "0.5793374", "0.57695985", "0.57688415", "0.57530713", "0.5747606", "0.5741208", "0.572888...
0.0
-1
Parse domain and problem PDDL files.
def load_pddl(domain_file, problem_dir, operators_as_actions=False): domain = PDDLDomainParser(domain_file, expect_action_preds=(not operators_as_actions), operators_as_actions=operators_as_actions) problems = [] problem_files = [f for f in glob.glob(os.path.join(problem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_domain(self, domainfile):\n\n with open(domainfile) as dfile:\n dfile_array = self._get_file_as_array(dfile)\n #Deal with front/end define, problem, :domain\n if dfile_array[0:4] != ['(', 'define', '(', 'domain']:\n print('PARSING ERROR: Expected (define (domain ... at start of domain ...
[ "0.66505396", "0.6467314", "0.64256436", "0.6325676", "0.61804026", "0.5982076", "0.5869378", "0.5819066", "0.56918544", "0.56028837", "0.5583641", "0.55689293", "0.5557211", "0.55362827", "0.54675335", "0.53722394", "0.53335005", "0.52810735", "0.5267228", "0.52543795", "0.5...
0.734066
0
Fix the PDDL problem used when reset is called. Useful for reproducible testing. The order of PDDL problems is determined by the names of their files. See PDDLEnv.load_pddl.
def fix_problem_index(self, problem_idx): if problem_idx != self._problem_idx: # Problem is changing, force ourselves to recompute heuristic self._heuristic = None self._problem_idx = problem_idx self._problem_index_fixed = True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fix(self):\n print 'Can\\'t be auto fixed, please select to check and fix it manually.'\n # pm.delete(self.errorNodes)", "def fix(self):\n\n pm.delete(self.errorNodes)\n\n self.run()", "def repair(self):\n self._fix_varnames()\n self._fix_array_meta()\n ...
[ "0.6638633", "0.6013278", "0.59503", "0.58701724", "0.5851896", "0.5790704", "0.57072186", "0.5634207", "0.5346553", "0.53360754", "0.5322868", "0.5284194", "0.5250896", "0.5198766", "0.5178263", "0.51767755", "0.5114635", "0.509438", "0.50937825", "0.50864834", "0.50638026",...
0.0
-1
Set up a new PDDL problem and start a new episode. Note that the PDDL files are included in debug_info. Returns
def reset(self): if not self._problem_index_fixed: # Problem is changing, force ourselves to recompute heuristic self._heuristic = None self._problem_idx = self.rng.choice(len(self.problems)) self._problem = self.problems[self._problem_idx] # Create new heuri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_episode(self):\n self.game.new_episode()", "def add_episode(self, ep):\n #make da season\n ses = self._add_season(ep)\n dvdses = self._add_season(ep, dvd=True) \n self._add_episode(ep, ses)\n self._add_episode(ep, dvdses, dvd=True)", "def episode_start(s...
[ "0.58231205", "0.5659388", "0.53268313", "0.5213738", "0.50608337", "0.49894366", "0.49747914", "0.49538937", "0.49406758", "0.49092963", "0.49033746", "0.48949248", "0.488626", "0.4884744", "0.48753956", "0.48720998", "0.48496214", "0.4848886", "0.4845754", "0.48398882", "0....
0.0
-1
Contains the problem file and domain file for interaction with a planner.
def _get_debug_info(self): info = {'problem_file' : self._problem.problem_fname, 'domain_file' : self.domain.domain_fname } return info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_problem(self, problemfile):\n\n with open(problemfile) as pfile:\n pfile_array = self._get_file_as_array(pfile)\n #Deal with front/end define, problem, :domain\n if pfile_array[0:4] != ['(', 'define', '(', 'problem']:\n print('PARSING ERROR: Expected (define (problem ... at start of pr...
[ "0.6128493", "0.6052136", "0.5818774", "0.57873774", "0.5776756", "0.57579035", "0.56762034", "0.5621781", "0.5585965", "0.5494902", "0.5483071", "0.5478292", "0.54739094", "0.54551816", "0.5443996", "0.54273915", "0.5423484", "0.5403669", "0.53987825", "0.5318302", "0.529959...
0.53419375
19
Helper function for step.
def _select_operator(self, state, action): if self.operators_as_actions: # There should be only one possible operator if actions are operators possible_operators = set() for name, operator in self.domain.operators.items(): if name.lower() == action.predicate.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _step(self) -> None:", "def do_step(self) -> None:", "def _step(self):\n pass", "def step(self):\n\n pass", "def step(self, step=None):\n pass", "def step(self, **kwargs):\n pass", "def step(self):\r\n raise NotImplementedError", "def _step(self, whence):\n ...
[ "0.83871853", "0.8104987", "0.808278", "0.77490157", "0.7590287", "0.7571518", "0.7528303", "0.7474251", "0.74583757", "0.7427325", "0.7389914", "0.73855174", "0.7273823", "0.7273823", "0.7273823", "0.7269436", "0.7164772", "0.7164772", "0.7092026", "0.7061926", "0.70372784",...
0.0
-1
Execute an action and update the state. Tries to find a ground operator for which the preconditions hold when this action is taken. If none exist, optionally raises InvalidAction. If multiple exist, raises an AssertionError, since we assume deterministic environments only. Once the operator is found, the ground effects...
def step(self, action): state, reward, done, debug_info = self.sample_transition(action) self.set_state(state) if "next_state_heuristic" in debug_info: self._current_heuristic = debug_info["next_state_heuristic"] return state, reward, done, debug_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _select_operator(self, state, action):\n if self.operators_as_actions:\n # There should be only one possible operator if actions are operators\n possible_operators = set()\n for name, operator in self.domain.operators.items():\n if name.lower() == action.p...
[ "0.6330442", "0.6059362", "0.5878356", "0.58075154", "0.5766961", "0.5743582", "0.57401145", "0.5734907", "0.5681216", "0.5630804", "0.5612146", "0.5597475", "0.5586847", "0.5572155", "0.5571066", "0.5571066", "0.54944026", "0.5462504", "0.5460059", "0.545523", "0.5449813", ...
0.0
-1
Compute the heuristic for a given state in the current problem.
def compute_heuristic(self, state): if self._shape_reward_mode == "optimal": problem = self.problems[self._problem_idx] # Add action literals to state to enable planning state_lits = set(state.literals) action_lits = set( self.action_space.all_gro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def myHeuristic(state, problem=None):\n #print(\"myHeuristic\")\n #print(problem.isGoalState((1,1)))\n xy2 = problem.goal\n return abs(state[0] - xy2[0]) + abs(state[1] - xy2[1])", "def heuristic(state, problem):\n # It would take a while for Flat Earther's to get accustomed to this paradigm\n ...
[ "0.77781177", "0.76758313", "0.74438214", "0.7409058", "0.7408299", "0.7377791", "0.7353731", "0.7306439", "0.71683395", "0.7154942", "0.70938486", "0.6993468", "0.6966539", "0.6902104", "0.679804", "0.6768399", "0.6738102", "0.67237085", "0.67138356", "0.67086256", "0.669070...
0.77858466
0
Check if the terminal condition is met, i.e., the goal is reached.
def _is_goal_reached(self, state): return self._goal.holds(state.literals)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __is_terminal(self, reward):\n\n # Initialize the terminal signals to false\n done = 0\n exit_cond = 0\n\n # Find readings that are below the set minimum. If there are multiple readings below the threshold, a crash\n # likely occurred and the episode should end\n # pri...
[ "0.7020093", "0.7017447", "0.69116384", "0.68244386", "0.68075067", "0.6680807", "0.6680807", "0.6653254", "0.66359186", "0.6586272", "0.65639853", "0.6538855", "0.6525054", "0.64875966", "0.6464889", "0.6463876", "0.6448849", "0.6413452", "0.6404319", "0.6404319", "0.6379753...
0.6735632
5
Minimization of scalar function of one or more variables using the NelderMead algorithm. Options
def minimize_neldermead(func, x0, args=(), callback=None, maxiter=None, maxfev=None, disp=False, return_all=False, initial_simplex=None, xatol=1e-4, fatol=1e-4, **unknown_options): maxfun = maxfev retall = return_all rho = 1 chi = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimize_nelder_mead(\n objective_func, parameter_guess, verbose=False, which_vars=None, **kwargs\n):\n # Specify a temporary \"modified objective function\" that restricts parameters to be estimated\n if which_vars is None:\n which_vars = np.ones(len(parameter_guess), dtype=bool)\n\n def ob...
[ "0.6544388", "0.6233954", "0.5911002", "0.5827164", "0.57724583", "0.56440806", "0.5639028", "0.5623449", "0.56031287", "0.5538933", "0.5530983", "0.5526603", "0.54923564", "0.5472675", "0.5470594", "0.5461345", "0.5448945", "0.5435215", "0.54291964", "0.5426231", "0.54231167...
0.56205523
8
gets latest prices from google
def get_lp(s): sl = [] for stock in s.symbols: #creates a list of latest stock prices quote = get(stock,"LON") #changes string to integer and removes ',' x = (quote.replace(',','')) x = float(x) sl.append(x) return sl
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scraper_google() -> None:\n\thtmltext = urllib.urlopen('http://www.google.com/finance/getprices?q=GOOG&x=NASD&i=8000&p=40Y&f=c&df=cpct&auto=0&ei=Ef6XUYDfCqSTiAKEMg').read()\n\tregex = '<span id=\"ref_[^.]*_l\">(.+?)</span>'\n\tpattern = re.compile(regex)\n\tresults = re.findall(pattern,htmltext)\n\n\tprint res...
[ "0.69347733", "0.67875", "0.63870096", "0.61877435", "0.612749", "0.6123951", "0.6063879", "0.60071915", "0.5980808", "0.5946027", "0.5914806", "0.5834383", "0.5789362", "0.57667065", "0.57517403", "0.57116723", "0.5685154", "0.56542426", "0.5627405", "0.56184715", "0.5607218...
0.0
-1
Define trackbar callback functon. This function find contours, draw it and approximate it by ellipses.
def process_image( slider_pos ): stor = cvCreateMemStorage(0); # Threshold the source image. This needful for cvFindContours(). cvThreshold( image03, image02, slider_pos, 255, CV_THRESH_BINARY ); # Find all contours. nb_contours, cont = cvFindContours (image02, stor, method=CV_CHAIN_APPROX...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualizeObs():\n fcontourf(fObs, [-2, 2], [-1, 1], [0, 10])", "def generate_contours(edges, colorimg, img):\n cv2.destroyAllWindows()\n cv2.namedWindow(\"Contours\")\n lengthlimit = 20\n arealimit = 20\n\n # create trackbars for length and area filters\n cv2.createTrackbar(\"length\", \...
[ "0.5876805", "0.5702491", "0.5645129", "0.5570451", "0.5464196", "0.5422969", "0.5411139", "0.54027873", "0.53754354", "0.5339906", "0.5320152", "0.53175277", "0.5276528", "0.52756757", "0.5269645", "0.5263124", "0.5260307", "0.5237864", "0.5237864", "0.5237864", "0.5211806",...
0.0
-1
Tests model object creation with Author model. Inserting data into the model and retrieving it.
def test_insert_and_fetch_value(self): author_kent = Author( first_name="Arthur", last_name="Kent", rating=Decimal("4.1"), ) author_kent.save() qs1 = Author.objects.all().values("first_name", "last_name") self.assertEqual(qs1[0]["first_name"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_author(first_name='testfirstname', last_name='testlastname'):\n return Author.objects.create(first_name=first_name, last_name=last_name)", "def test_create_authors(self):\n payload = {\n 'first_name': 'testname1',\n 'last_name': 'testname2',\n 'nickname': 'te...
[ "0.73595816", "0.73528016", "0.6917232", "0.68811285", "0.6825536", "0.66415656", "0.6564151", "0.65254474", "0.64944285", "0.64746404", "0.64741796", "0.64724386", "0.64366996", "0.6363541", "0.63500893", "0.63140833", "0.6293489", "0.62684065", "0.6254518", "0.6235322", "0....
0.66609263
5
Summarize parameters for this event.
def display_parameters(self): l = [] for param in self.parameters.all(): if len(param.value) > 16: l.append(u"{}={}...".format(param.name, param.value[:16])) else: l.append(u"{}={}".format(param.name, param.value)) return "; ".join(l)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _pprint_params(self):\n return {'x_range': self.x_range, 'y_range': self.y_range,\n 'step': self.step, 'shape': self.shape,\n 'type': self.type}", "def parameters(self):\n pass", "def parameters(self):\n return {\n 'label': \"undefined\",\n ...
[ "0.6396715", "0.63709116", "0.63117045", "0.62861097", "0.62311614", "0.621847", "0.6212323", "0.6207824", "0.6176625", "0.6176038", "0.6130998", "0.6082116", "0.6063119", "0.6041642", "0.60286397", "0.59909475", "0.5975385", "0.59752214", "0.5935011", "0.5919475", "0.5914782...
0.0
-1
devbuild your pelican project
def devserve(): click.echo("start devbuild your pelican project...") # copy_mathjax(OUTPUTDIR) def devbuild(): cmd = "pelican -r {INPUTDIR} -o {OUTPUTDIR} -s {CONFFILE}".format( INPUTDIR=INPUTDIR, OUTPUTDIR=OUTPUTDIR, CONFFILE=CONFFILE ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build():\n local('pelican -o {} -s pelicanconf.py'.format(env.deploy_path))", "def build():\n click.echo(\"start build your pelican project...\")\n # copy_mathjax(PUBLISHDIR)\n \n cmd = \"pelican {INPUTDIR} -o {PUBLISHDIR} -s {PUBLISHCONF}\".format(\n INPUTDIR=INPUTDIR,\n PUBLISH...
[ "0.73531723", "0.72916406", "0.69213474", "0.6672579", "0.65727437", "0.65247196", "0.643009", "0.63819474", "0.63819474", "0.63819474", "0.63556075", "0.6300531", "0.62947655", "0.6265211", "0.60080713", "0.5992852", "0.5990836", "0.5957803", "0.59454817", "0.59121513", "0.5...
0.6862831
3
build your pelican project
def build(): click.echo("start build your pelican project...") # copy_mathjax(PUBLISHDIR) cmd = "pelican {INPUTDIR} -o {PUBLISHDIR} -s {PUBLISHCONF}".format( INPUTDIR=INPUTDIR, PUBLISHCONF=PUBLISHCONF, PUBLISHDIR=PUBLISHDIR ) click.echo('start run cmd: {0}'.format(cmd))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build():\n local('pelican -o {} -s pelicanconf.py'.format(env.deploy_path))", "def build():\n clean()\n jekyll('build')", "def project():", "def project():", "def project():", "def build():", "def run():\n build_no_documentation()\n build_sphinx_build()\n #build_sphinx_pdf()\n ...
[ "0.80022466", "0.76572293", "0.68546736", "0.68546736", "0.68546736", "0.65780234", "0.65661544", "0.6554463", "0.65237135", "0.65101284", "0.64570844", "0.6430345", "0.63182557", "0.6287498", "0.6280133", "0.62259513", "0.6225236", "0.621028", "0.6172018", "0.61336464", "0.6...
0.8624505
0
clean your dev output
def devclean(): click.echo("start clean your output folder...") rm(OUTPUTDIR, recursive=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrub():\n\n\tlocal(\"rm -fr dist build\")\n\tlocal(\"find . -name \\\"*.pyc\\\" -exec rm '{}' ';'\")", "def dev_clean():\n clean_files(\"csv\", True)\n clean_files(\"jsontxt\", True)", "def clean():\n clean_flatbuffer_binaries()\n clean_webp_textures()", "def cleanup(self):\n\n print \"Cl...
[ "0.7364518", "0.73120457", "0.6837923", "0.668494", "0.6623341", "0.6565975", "0.6446505", "0.64446104", "0.6430147", "0.64125884", "0.6406645", "0.634509", "0.6311887", "0.6290972", "0.62885344", "0.6266827", "0.6263163", "0.6248267", "0.6231171", "0.6220711", "0.62099195", ...
0.7988176
0
the function can remove file or empty directory(default). use `shutil.rmtree` to remove the nonempty directory,you need add `recursive=True`
def rm(path, recursive=False): path = normalized_path_obj(path) if recursive: shutil.rmtree(path) else: if path.is_file(): path.unlink() else: path.rmdir()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(path):\n if os.path.isdir(path):\n return __rmtree(path)\n else:\n return __rmfile(path)", "def filedelete(fname):\n\n if os.path.exists(fname):\n try:\n if os.path.isdir(fname):\n # delete folder\n shutil.rmtree(fname)\n ...
[ "0.74493027", "0.74453914", "0.7419576", "0.7394465", "0.7334857", "0.72894037", "0.7272433", "0.7267682", "0.72452056", "0.7241015", "0.72252053", "0.71728873", "0.7166979", "0.71343136", "0.71189886", "0.71189886", "0.7117906", "0.7112072", "0.70846575", "0.7047341", "0.703...
0.70209146
22
Funcion que muestra el menu general
def menu(): os.system('clear') print("\nBienvenido a el programa de Prueba de Estructura de datos\nElija una opcion del Menu:"+"\n1. Pilas\n2. Colas\n3. Arboles\n4. Listas Enlazadas\n5. Salir") while True: try: value=int(input("\nIntroduzca la opcion que desea utilizar: ")) excep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_menu():", "def get_menus():\n\n pass", "def menu():\n ferme_fenetre()\n Menu()", "def get_menu(menu_name):\n\n pass", "def get_all_menu():", "def create_menus( self ):", "def menu_inicial():\n clear_window()\n items = [\"Juego Nuevo\", \"Acerca de\", \"Salir\"]\n ...
[ "0.78339934", "0.77571857", "0.76078326", "0.75046766", "0.75032157", "0.74549806", "0.7352306", "0.7082054", "0.7082054", "0.7073202", "0.7056378", "0.70169145", "0.7001436", "0.6964694", "0.6959546", "0.69241935", "0.692284", "0.6848669", "0.6829415", "0.6806498", "0.679571...
0.0
-1
Funcion que nos permite interactuar con el menu de pilas y de Colas
def menuPilas(): print("\nMenu:"+"\n1. Insertar\n2. Extraer\n3. Visualizar\n4. Salir") while True: try: value=int(input("\nIntroduzca la opcion que desea utilizar: ")) except: print("\nWhoops! El valor que introdujiste no es un numero") else: break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mainmenu(self):\n\n global con\n global lt\n global prg\n global afi\n global plv\n \n con = self.sql_conexion()\n lt = lv.Lotes(con)\n prg = prgva.Agenda(con)\n afi = af.Afiliado(con)\n plv = pl.Plan(con)\n \n afi.tabla...
[ "0.724575", "0.7158348", "0.6922546", "0.68737864", "0.67761993", "0.67566514", "0.6718534", "0.67036295", "0.6701396", "0.6701396", "0.6677129", "0.66293347", "0.6628001", "0.66264766", "0.65969384", "0.6530006", "0.65119624", "0.64341694", "0.63456184", "0.63005507", "0.627...
0.5692014
69
Funcion que nos permite evaluar si el elemento que buscamos se encuentra dentro de la lista de colas o pilas
def EnLista(lista,valor): temp=0 for e in lista: if e.name==valor: temp=e else: continue if temp==0: return "El elemento no esta en lista" else: return temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_obstacle(lst):\n for x in lst:\n if x.tag is not None and x.tag == OBSTACLE:\n return True\n else:\n return False", "def feasible(individual):\n val=0;\n for i in individual:\n if viajes[val][6]==True and False==vehiculos_esp[i]:\n return False\n ...
[ "0.5994727", "0.57970995", "0.5789697", "0.5787256", "0.57191974", "0.5712903", "0.55769116", "0.5566167", "0.55592275", "0.5538156", "0.5452695", "0.54103845", "0.5394359", "0.5392133", "0.53865606", "0.53802097", "0.5375944", "0.5356791", "0.53450143", "0.5326142", "0.53155...
0.60702896
0
Permite Insertar valores a la pila
def insertar(self,valor): self.stack.append(valor) print("El valor ha sido agregado correctamente")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_values():\n pass", "def insert(self,table,values):\n self.connect.execute(self.insert_disc[table],values)\n self.connect.commit()", "def insertParametri(self,query_id,l):\r\n\t\tfor i in l:\r\n\t\t\t\tprint \"inserisco parametro {0} per query: {1}\".format(i,query_id)\r\n\t\t\t\...
[ "0.8286711", "0.7152293", "0.70798427", "0.69723827", "0.68307555", "0.6815277", "0.6775598", "0.6719011", "0.6708022", "0.6650979", "0.6629753", "0.66142714", "0.6449198", "0.6397819", "0.6386526", "0.63850045", "0.6359243", "0.63536465", "0.63129246", "0.6296436", "0.628803...
0.61767316
33
Permite eliminar valores en la pila
def extraer(self): valor=self.stack.pop() print (f"Se ha extraido exitosamente el ultimo valor que es: {valor}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove():", "def remove(self,values):\n for box, value in values.items():\n if len(value) == 1:\n for peer in self.peers[box]:\n values = self.remove_digit(values, peer, value)\n return values", "def delval(self):\r\n self.value = None", "...
[ "0.67530596", "0.64012235", "0.63898975", "0.6360818", "0.6349361", "0.6296362", "0.62668365", "0.6251881", "0.6250547", "0.61827505", "0.61698854", "0.6104017", "0.60997653", "0.60929996", "0.6085909", "0.6070808", "0.6068548", "0.6068543", "0.6051044", "0.6042105", "0.60245...
0.0
-1
Permite visualizar los valores de la Pila
def visualizar(self): print(self.stack)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_pi(black, white, pi, p, values, Q):\n pi = pi / sum(pi) * 100\n pi = np.clip(pi, -99, 99)\n pi = pi.reshape((15, 15)).T\n p = p / sum(p) * 100\n p = p.reshape((15, 15)).T\n values = values * 100\n values = np.clip(values, -99, 99)\n values = values.reshape((15, 15)).T\n Q = Q * ...
[ "0.6866491", "0.6569743", "0.6507121", "0.6353629", "0.6313579", "0.6040696", "0.60388625", "0.6030754", "0.59974724", "0.58832794", "0.5839212", "0.5830864", "0.5809039", "0.5785387", "0.57444143", "0.5741815", "0.5732305", "0.5718611", "0.57136774", "0.5689818", "0.56876063...
0.0
-1
Permite extraer los valores de la cola
def extraer(self): valor=self.queue.pop(0) print (f"Se ha extraido exitosamente el primer valor que es: {valor}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mezclar_bolsa(self):", "def parameters(self):", "def values():", "def __init__(self):\n self.nombre_roues = 4\n self.nombre_fauteils = 1\n self.moteur = False\n self.volant = True", "def GetValues(self):", "def entrer(self):\n valeur = getattr(self.objet, self.attri...
[ "0.6273689", "0.60701", "0.60015553", "0.5978444", "0.5929369", "0.5862456", "0.5841793", "0.5837014", "0.5787959", "0.5774656", "0.5771563", "0.5729593", "0.57200116", "0.57200116", "0.5677684", "0.5660802", "0.5633374", "0.5631918", "0.5619658", "0.5574378", "0.55301446", ...
0.0
-1
Permite visualizar los valores de la pila.
def visualizar(self): print(self.queue)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotValue(self):\n V = np.zeros((self.env.W1 + self.env.W2 + 1, self.env.L1 + self.env.L2 + 1))\n\n for y in range(len(V)):\n for x in range(len(V)):\n if ((0 <= x <= L1 and 0 <= y <= W1 + W2) or (L1 <= x <= L1 + L2 and W1 <= y <= W1 + W2)):\n with tor...
[ "0.65835667", "0.6436281", "0.64058965", "0.6396001", "0.6254502", "0.6221434", "0.61877716", "0.6165085", "0.606672", "0.60392666", "0.6014817", "0.590738", "0.587794", "0.58749807", "0.5870784", "0.584899", "0.58429015", "0.5825909", "0.5817491", "0.58160114", "0.5800903", ...
0.0
-1
Creacion de un arbol
def crear_arbol(): print ("En este programa te brindamos 2 opciones para crear arboles, elige la que mas se adapte a tu objetivo") try: crear=int(input("1. Crear un arbol de manera aleatoria\n2. Introducir los datos en forma de arreglo\n")) except: print("Valor Invalido") if cr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def representarArbolAutomatico(self):\n if not self.stepByStep:\n print(\"Pintar paredes en auto\")\n # Reinicio la matrix\n self.reiniciarMatrix()\n if self.arbol.raiz != None:\n # Capturo todos los valores\n for i in self.arbol.returnArbolComoVector():...
[ "0.6128758", "0.6128119", "0.6116085", "0.5917543", "0.58856267", "0.58242875", "0.58242875", "0.57394975", "0.5717106", "0.5597258", "0.553514", "0.5517653", "0.54746145", "0.5417761", "0.539726", "0.52740854", "0.5264729", "0.5256027", "0.5253974", "0.52365226", "0.52185285...
0.6605578
0
Recorrido de un arbol
def recorrido(arbol,numero): while True: if numero==2: print("Con gusto! Estos son los valores de tu recorrido Preorden") print(arbol) return arbol.preorder elif numero==3: print("Con gusto! Estos son los valores de tu recorrido PostOrden") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verElArbol(self):\n ventanaEmergente = Toplevel()\n ventanaEmergente.title(\"Arbol\")\n ventanaEmergente.geometry(\"640x500\")\n tela = Canvas(ventanaEmergente, height=500, width=640, bg = \"snow\")\n\n # Capturo los nodos del arbol\n for i in self.arbol.returnXYDeNodo...
[ "0.6101912", "0.57624006", "0.5522905", "0.5351271", "0.5342351", "0.5283256", "0.5279461", "0.52712744", "0.52445865", "0.5200923", "0.5200188", "0.5194728", "0.5160361", "0.5142416", "0.50951225", "0.5091734", "0.5045318", "0.5028831", "0.50095236", "0.5004031", "0.5000921"...
0.5047212
16
Permite adicionar un Nodo
def add(self,valor): MiNodo=Nodo(valor) if self.size==0: self.first=MiNodo else: current=self.first while current.next!=None: current=current.next current.next=MiNodo self.size+=1 return MiNodo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def empilha(self, novo_dado):\n\n # Cria um novo nodo com o dado a ser armazenado.\n novo_nodo = Nodo(novo_dado)\n\n # Faz com que o novo nodo seja o topo da pilha.\n novo_nodo.anterior = self.topo\n\n # Faz com que a cabeça da lista referencie o novo nodo.\n self.topo = n...
[ "0.6462743", "0.6297467", "0.6096568", "0.5964696", "0.58814406", "0.58749807", "0.5713413", "0.56670576", "0.5593749", "0.55853844", "0.54559785", "0.54525775", "0.5432999", "0.54121864", "0.5390447", "0.53765017", "0.53657013", "0.5358781", "0.5358781", "0.5327352", "0.5325...
0.6201179
2
Permite remover un nodo
def remove(self,valor): if self.size==0: return False else: current=self.first try: while current.next.valor!=valor: current=current.next deleted_node=current.next current.next=deleted_node.next ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove():", "def remove_child(self, nodo):\n if nodo in self.children:\n self.children.remove(nodo)", "def removeNode(self, node):", "def delete(self, node):\n\n # logger_cagada.debug(\"norrando nodo %s\" % (type(node)))\n entry = self.entry_finder.pop(node)\n # log...
[ "0.68646836", "0.6857787", "0.68270314", "0.66663784", "0.6555464", "0.6476688", "0.64565253", "0.64425707", "0.63940865", "0.63710606", "0.63466954", "0.63103527", "0.6281665", "0.62449694", "0.61963826", "0.61721617", "0.61584955", "0.6158132", "0.615736", "0.61475044", "0....
0.6286966
12
Return current date and time as a string.
def get_date_time(): date_time = datetime.now() date_time_string = date_time.strftime("%b-%d-%Y (%H:%M:%S)") return date_time_string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_datetime_string ( ) :\n return get_current_datetime( ).strftime( \"%Y%m%d-%H%M%S\" )", "def time_now() -> str:\n return datetime_to_str(datetime_now())", "def get_now():\r\n now = dt.datetime.now()\r\n now_str = now.strftime(\"%d/%m %H:%M\")\r\n return now_str", "def get_current...
[ "0.86410594", "0.83569145", "0.82452714", "0.81948674", "0.81886935", "0.8177085", "0.8142239", "0.8139969", "0.80767894", "0.8070444", "0.8038072", "0.791959", "0.7906521", "0.7894949", "0.78761137", "0.7829549", "0.78283703", "0.78224957", "0.78067684", "0.77908033", "0.778...
0.7783489
21
Opens or creates database and saves user's input as new row.
def save_db(): # establish connection to db conn = sqlite3.connect('journal_entries.db') # create cursor to execute commands c = conn.cursor() # create table if specified table does not exist c.execute("""SELECT count(name) FROM sqlite_master WHERE type='table' AND na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manual_enter(self):\n self._dbconnect = sqlite3.connect(self._db_file)\n\n # Set row_factory to access columns by name\n self._dbconnect.row_factory = sqlite3.Row\n\n # Create a cursor to work with the db\n self._cursor = self._dbconnect.cursor()", "def save_in_db(self):\n ...
[ "0.6721852", "0.665984", "0.64990216", "0.6484407", "0.6370434", "0.63396734", "0.6318499", "0.6298661", "0.6258855", "0.6246317", "0.6213981", "0.6210083", "0.6175534", "0.6154274", "0.6128392", "0.6117983", "0.6113079", "0.609883", "0.6097581", "0.6079897", "0.60251564", ...
0.64553225
4
Write user's input to text file upon submit.
def save_txt(): # open file and append, if it doesn't exist then create it. with open('journal_entries.txt', 'a+') as f: # .get the input in text widget at the first line, '0th' character, then read until the end f.write("\n" + get_date_time()) for i in range(len(entries)): s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_data():\n # python-name = html-name:\n the_first = request.form[\"first\"]\n the_last = request.form[\"last\"] \n the_dob = request.form[\"dob\"] \n # So... now, use the python-names in your code:\n with open(\"suckers.txt\", \"a\") as sf:\n print(f\"{the_first}, {the_last}, {the_...
[ "0.6854578", "0.65839446", "0.641531", "0.6401695", "0.63185084", "0.63125545", "0.6271092", "0.6252014", "0.6250551", "0.6095141", "0.603167", "0.6023292", "0.6012438", "0.59953266", "0.59260774", "0.5925107", "0.59069604", "0.59004307", "0.5894705", "0.5885723", "0.5883352"...
0.58283037
28
Display popup message confirming submission.
def popup(): msg = messagebox.askyesno('Warning', 'Are you sure you would like to submit?') if msg: # if user clicked yes save_txt() save_db() root.destroy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm(self, action):\n title = \"%s : P L E A S E C O N F I R M\" % action\n question_text = \"<html><b>%s - PLEASE CONFIRM.</b><br/>\"\\\n \"<br/>Do you want to %s %s recordings for the following project?\"\\\n \"<br/><br/>PROJECT : %s\"\\\n \"<br/...
[ "0.66260684", "0.6539852", "0.6471161", "0.6355524", "0.62557465", "0.62470835", "0.62312436", "0.62009865", "0.61841303", "0.61515397", "0.60815936", "0.60523564", "0.60348475", "0.60276926", "0.60237217", "0.59910464", "0.59775865", "0.59559107", "0.5943642", "0.59316874", ...
0.6604227
1
Process the rendered text.
def post_process_text(self, text): return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_text(self, text):\n self._text_paragraph = text.split(\"\\n\")\n self._render()", "def postprocess(self, text):\r\n return text", "def _render(self):\n self.dirty = False\n self.text_lines = [TextLine(self.font, self.font_size, line) for line in self._text_paragraph...
[ "0.7057327", "0.68402267", "0.682954", "0.6825364", "0.68190277", "0.66213334", "0.6580936", "0.6544839", "0.6298009", "0.6239729", "0.62027234", "0.6189792", "0.6182674", "0.6163964", "0.6097475", "0.60929406", "0.60858524", "0.6063205", "0.6039969", "0.6020653", "0.6018607"...
0.66979885
5
Escape dangerous html characters.
def escape(self, text): if not self.escape_html or text is None: return text return ( text.replace('&', '&amp;').replace('<', '&lt;') .replace('>', '&gt;').replace('"', '&quot;').replace("'", '&#39;') )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _escape(html):\n return encoding.force_unicode(html).replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('\"', '&quot;').replace(\"'\", '&#39;')", "def escape(html):\n if not isinstance(html, unicode):\n if not isinstance(html, str):\n html = unicode(html)\n else:\n...
[ "0.8003809", "0.7880653", "0.78005147", "0.7740567", "0.7509861", "0.7441295", "0.73812795", "0.7379608", "0.7371718", "0.7361093", "0.72711486", "0.7238127", "0.72359085", "0.7208979", "0.71628106", "0.71387416", "0.7137548", "0.71287596", "0.7106364", "0.7106364", "0.710513...
0.75325483
4
Escape html characters of all arguments
def escape_args(self, *args): return tuple((self.escape(arg) for arg in args))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(cls, html):\n return (\"%s\" % (html)).replace('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;').replace('\"', '&quot;').replace(\"'\", '&#39;')", "def html_escape(text):\n return escape(text, escape_table)", "def HtmlEscape(text):\n return escape(text, _HTML_ESCAPE_TABLE)", "def ...
[ "0.71000415", "0.69405395", "0.6915922", "0.68983316", "0.67813283", "0.677594", "0.67101085", "0.65880746", "0.65696335", "0.65446335", "0.6535885", "0.6525506", "0.6499121", "0.64812595", "0.6458568", "0.638912", "0.63755196", "0.63381976", "0.6338105", "0.63376164", "0.633...
0.6817887
4
Check if a link has an invalid scheme. Also transform the ``&`` character in ``&`` character.
def escape_link(self, link, smart_amp=True): data = link.split(':', 1) scheme = data[0] if scheme in self.scheme_blacklist: return '' if smart_amp: return link.replace('&', '&amp;') return link
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_link(self, link):\n false_links = [\"wikipedia:\", \"w:\", \"wikitionary:\", \"wikt:\", \"wikinews:\",\n \"n:\", \"wikibooks:\", \"b:\", \"wikiquote:\", \"q:\", \"wikisource:\",\n \"s:\", \"wikispecies:\", \"species:\", \"wikiversity\", \"v:\", \n ...
[ "0.65676564", "0.65118766", "0.6282904", "0.62509656", "0.61940354", "0.61904234", "0.61856216", "0.615911", "0.61529464", "0.6069519", "0.6041988", "0.60321385", "0.59708303", "0.5959572", "0.5953686", "0.5906121", "0.58944297", "0.585033", "0.58366746", "0.5836454", "0.5818...
0.64214295
2
Constructor. Loads the config file and logs in the user.
def __init__(self): self.load_config() self.login()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, config_file_name=\"config.json\"):\n self.config_file_name = config_file_name\n self._config = self._open_config_file()", "def __init__(self):\n\n self.config = load_config()\n self.set_env_var()", "def __init__(self):\n\n self.path = os.path.dirname(os.pat...
[ "0.71448416", "0.7128583", "0.7090821", "0.70454407", "0.69694275", "0.69450074", "0.6912936", "0.6841834", "0.68410355", "0.6786883", "0.67843455", "0.67697686", "0.6765324", "0.67577565", "0.6755933", "0.6753951", "0.6733729", "0.6719248", "0.6701679", "0.6699646", "0.66834...
0.8298619
0
Downloads the website zip for the given id.
def download(self, website_id): print("Attempting to download website with id: " + str(website_id)) # Construct download URL download_url = self.config["base_url"] + "websites/" + \ str(website_id) + "/pages/?action=download-confirm" # Open download ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_data():\n url = 'https://www.dropbox.com/s/h9ubx22ftdkyvd5/ml-latest-small.zip?dl=1'\n urllib.request.urlretrieve(url, 'ml-latest-small.zip')\n zfile = zipfile.ZipFile('ml-latest-small.zip')\n zfile.extractall()\n zfile.close()", "def download():\n response = requests.get(URL, stre...
[ "0.6472666", "0.63869995", "0.6373792", "0.6268572", "0.62413114", "0.6234404", "0.621077", "0.61712956", "0.61457485", "0.61367536", "0.6053691", "0.6003016", "0.60026824", "0.5947067", "0.59446025", "0.5937266", "0.593035", "0.5923485", "0.5918078", "0.59045106", "0.5882042...
0.6989046
0
Downloads all websites from the configured account.
def download_all(self): # Fetch website list self.fetch_website_list() for website in self.website_list: self.download(website['id'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_files(self) -> None:\n\n for name, url in self.files.items():\n print(f\"Download {name.split('/')[-1]}\")\n wget.download(url, os.path.join(\"data\", name))", "def run(self):\n urls_to_download = self._get_links()\n results = ThreadPool(8).imap_unordered(s...
[ "0.64588964", "0.631406", "0.61965954", "0.61314225", "0.6050799", "0.6036285", "0.5998617", "0.59446806", "0.59381914", "0.5903098", "0.5895737", "0.5842743", "0.5808646", "0.5772056", "0.56775916", "0.5641498", "0.56260294", "0.56127065", "0.5600516", "0.5599381", "0.559229...
0.7973969
0
Fetches the list of websites attached to the configured Blockwise account.
def fetch_website_list(self): # Clear list self.website_list = [] # Open websites overview self.browser.open(self.config["base_url"] + "websites") # Find table and iterate over rows for table_row in self.browser.get_current_page().select("table tr"): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_websites(self):\r\n\r\n # Fetch websites\r\n self.fetch_website_list()\r\n\r\n # Print website data\r\n for website in self.website_list:\r\n print(\"ID: {0} | Domain: {1} | Name: {2}\".format(\r\n website['id'], website['domain'], website['name']))", ...
[ "0.69705415", "0.64496094", "0.6446523", "0.64379936", "0.62966555", "0.62397087", "0.60914624", "0.602921", "0.5997532", "0.59600747", "0.58935297", "0.5880731", "0.5796163", "0.5705958", "0.56971353", "0.5683009", "0.5682644", "0.5670518", "0.56336397", "0.5607247", "0.5604...
0.7163119
0
Returns the website id for a given domain name.
def get_website_id_by_domain(self, domain): # Fetch website list self.fetch_website_list() # Loop through website list for website in self.website_list: if(domain == website['domain']): return website['id']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_domain_id_by_domainurl(domain_url):\r\n db = connect()\r\n cursor = db.cursor()\r\n sql_statement = \"\"\"\r\n SELECT domain_id FROM `domains` WHERE domain_url = %(d)s\r\n \"\"\"\r\n try:\r\n cursor.execute(sql_statement, {'d':domain_url})\r\n ...
[ "0.7317684", "0.72144324", "0.7035157", "0.6873132", "0.67911625", "0.671376", "0.6644109", "0.6644109", "0.63495004", "0.63495004", "0.6290365", "0.62296623", "0.6202188", "0.61872786", "0.61872786", "0.61608726", "0.6145458", "0.613091", "0.61277753", "0.6094865", "0.607450...
0.8120632
0
Prints a list of websites associated with this account.
def list_websites(self): # Fetch websites self.fetch_website_list() # Print website data for website in self.website_list: print("ID: {0} | Domain: {1} | Name: {2}".format( website['id'], website['domain'], website['name']))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_website_list(self):\r\n # Clear list\r\n self.website_list = []\r\n\r\n # Open websites overview\r\n self.browser.open(self.config[\"base_url\"] + \"websites\")\r\n\r\n # Find table and iterate over rows\r\n for table_row in self.browser.get_current_page().select...
[ "0.6325658", "0.61330944", "0.6077588", "0.5747504", "0.5638724", "0.5555112", "0.54735076", "0.54468036", "0.54066414", "0.5361679", "0.53399676", "0.533175", "0.5329514", "0.53192073", "0.53176737", "0.530204", "0.5280976", "0.52705723", "0.52683234", "0.52613914", "0.52573...
0.8044255
0
Loads config.json from the same directory as this script.
def load_config(self): with open('config.json', 'r') as f: self.config = json.load(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config():\n here = os.path.dirname(os.path.abspath(__file__))\n config_path = os.path.join(here, 'config.json')\n with open(config_path, encoding='utf-8') as f:\n return json.load(f)", "def load_config():\n config_file = os.path.dirname(os.path.abspath(__file__)) + '/../config.json'\n...
[ "0.8563029", "0.84219563", "0.80251276", "0.7645428", "0.7614385", "0.7579005", "0.7456287", "0.74499804", "0.743456", "0.74128926", "0.7392741", "0.7392741", "0.7377646", "0.73336124", "0.7221225", "0.7219609", "0.72187304", "0.7204541", "0.7178785", "0.7154581", "0.7142258"...
0.79761493
3
Login the user onto the Blockwise site.
def login(self): # Open browser with the login URL self.browser.open(self.config["base_url"] + "login") # Select the login form self.browser.select_form('form[action="/login/"]') # Fill the login form. self.browser["email"] = self.config["email"] self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_user(self):\r\n self.client.login(username=self.user.username, password=\"password\")", "def login(self):\n\t\treturn", "def login(self):\n self.open(base_url + '/login')\n self.type(\"#email\", test_user.email)\n self.type(\"#password\", test_user.password)\n self....
[ "0.79353446", "0.78141594", "0.7754128", "0.7669218", "0.7607488", "0.7597729", "0.75872827", "0.75872827", "0.7543384", "0.75015473", "0.7493236", "0.7468692", "0.7442361", "0.7403341", "0.73700595", "0.7331979", "0.73156995", "0.73001724", "0.7258544", "0.72574526", "0.7256...
0.74163085
13
Saves the .zip file in the HTTP response locally
def save_file(self, response): # Extract filename from response url filename = re.search('[^/]+(?=/$|$)', response.url).group(0) # Prepend download folder name to the filename filename = self.config["folder"] + filename os.makedirs(os.path.dirname(filename), exist_ok=True)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_downloaded_zip(self, dict_entry_to_download):\n\tif self.download_subtitle_zip(dict_entry_to_download) == True:\n\t try:\n\t\tzip_file = open(self.ZipFilePath,\"wb\")\n\t\tzip_file.write(self.zip_string)\n\t\tzip_file.close\t\t\n\t\tprint \"Zipfile: %s saved on hdd.\" % self.ZipFilePath\n\t\tdel self.z...
[ "0.6902448", "0.66956294", "0.6688759", "0.6579057", "0.64489156", "0.6448732", "0.6447668", "0.64060974", "0.6402421", "0.6393668", "0.63743347", "0.63736063", "0.6360812", "0.6353195", "0.6339755", "0.6324033", "0.6292607", "0.620836", "0.611196", "0.6065431", "0.6061819", ...
0.70878065
0
Returns the powerset of an iterable as a list of lists. Much nicer to do this than write out the powerset manually
def powerset(iterable): set_list = list(iterable) return list(chain.from_iterable(combinations(set_list, r) for r in range(len(set_list)+1)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _powerset(iterable: Iterable) -> Iterator:\n s = list(iterable)\n return chain.from_iterable(combinations(s, r) for r in range(len(s)+1))", "def powerset(iterable):\n s = list(iterable)\n return chain.from_iterable(combinations(s, r) for r in range(2, len(s)+1))", "def powerset(iterable...
[ "0.7995444", "0.78815496", "0.78390735", "0.7773861", "0.7773861", "0.7773861", "0.7755637", "0.7737819", "0.7729828", "0.77127105", "0.7662994", "0.7636652", "0.73878515", "0.73080266", "0.73064476", "0.72044474", "0.71921253", "0.71921253", "0.71921253", "0.7172043", "0.716...
0.7981444
1
The fixture consists of a Host (stub) and a few instances ov Vm (Stub).
def setUp(self): self.vmNoQuestion = Vm(name='noQuestion', runtime=Struct(question=None)) self.vmQuestion = Vm(name='Question', runtime=Struct( question=Struct( id='someQuestionId', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_vms_host(self):\n testflow.step(\"Check if VM's started on different hosts\")\n assert (\n ll_vms.get_vm_host(vm_name=conf.VM_NAME[0]) !=\n ll_vms.get_vm_host(vm_name=conf.VM_NAME[1])\n )", "def test_vms_host(self):\n testflow.step(\"Check if VM's starte...
[ "0.66935045", "0.66935045", "0.65910363", "0.6503906", "0.6503906", "0.65038544", "0.6283813", "0.62837225", "0.62711096", "0.62626857", "0.62473446", "0.616982", "0.6159366", "0.6158614", "0.61422443", "0.6120313", "0.6091523", "0.6073946", "0.607355", "0.6051192", "0.601715...
0.697521
0
Restore the original version of `raw_input`.
def tearDown(self): self.rawInputStub.destroy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_input(cls):\n del globals()[\"input\"]", "def switch_input(cls):\n try:\n assert globals()[\"input\"]\n cls.restore_input()\n except KeyError:\n cls.override_input()", "def restore():\n global TERMATTRS\n termios.tcsetattr(stdin, termios.T...
[ "0.7338667", "0.6796647", "0.66573286", "0.6478847", "0.6207503", "0.6061261", "0.5982782", "0.593902", "0.59241813", "0.5902105", "0.58344245", "0.58106554", "0.580696", "0.5782282", "0.5764409", "0.568269", "0.5621175", "0.5617132", "0.5589539", "0.55798477", "0.5572872", ...
0.0
-1
When the `answer` operation is invoked on a vm with no question pending, then we simply print an error message on stderr.
def test_answer_noQuestion(self): try: ## Capture what the SUT is writing to stderr so that we can ## verify it later. sys.stderr = FileWriteCapture(sys.stderr).StartCapture() result = Answer().DoIt(self.host, self.vmNoQuestion.name) expectOnStderr = 'No questions p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_answer_unknownVm(self):\n\n self.failUnlessRaises(pyVmomi.vim.fault.NotFound,\n Answer().DoIt, self.host, 'unknownVm')", "def test__answer_error(\n self,\n actual_answer,\n answer,\n result,\n ):\n test_result = _answe...
[ "0.6581796", "0.6179263", "0.59570175", "0.5787004", "0.5782204", "0.5757554", "0.5593964", "0.5580374", "0.55507004", "0.54772305", "0.5444757", "0.54236877", "0.54154277", "0.54102695", "0.54041255", "0.538641", "0.5381535", "0.53778833", "0.53630346", "0.5362562", "0.53480...
0.75920427
0
This function is a replacement for the Vm.Answer method that does nothing except check that it has been called with expected args.
def _Answer(questionId, choice): self.assertEqual(questionId, self.vmQuestion.runtime.question.id, '_Answer got questionId == "%s"' % questionId + '; expected "%s"' % self.vmQuestion.runtime.question.id) self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_answer_unknownVm(self):\n\n self.failUnlessRaises(pyVmomi.vim.fault.NotFound,\n Answer().DoIt, self.host, 'unknownVm')", "def test_quick_answer(self):\n pass", "def answer(self) -> bool:", "def ok(*args):", "def test_vargs(self):", "def test_validate_answer...
[ "0.63953894", "0.62491506", "0.61643636", "0.59621364", "0.59122556", "0.5903902", "0.5893926", "0.5881168", "0.58808434", "0.58366305", "0.5823478", "0.5727231", "0.5725628", "0.5701808", "0.5681035", "0.5665139", "0.56388825", "0.5604551", "0.55598456", "0.55534905", "0.554...
0.58827156
7
Verify that we raise an appropriate exception if the operation is invoked with an unknown vm name.
def test_answer_unknownVm(self): self.failUnlessRaises(pyVmomi.vim.fault.NotFound, Answer().DoIt, self.host, 'unknownVm')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operation_not_found(self, name):\n raise OperationError(\"Operation '%s' not found\" % name)", "def test_vmfactory_fail(self):\n self.command.output = \"foo.vmx\"\n with self.assertRaises(VMInitError):\n self.command.package = self.input_ovf", "def test_will_not_get_instance...
[ "0.653822", "0.6389487", "0.608852", "0.6059318", "0.60320866", "0.5987542", "0.59446174", "0.5939153", "0.59103185", "0.5847701", "0.5841957", "0.58180857", "0.58157957", "0.5758776", "0.5726958", "0.57252586", "0.5693958", "0.56661975", "0.5659771", "0.56591505", "0.5638999...
0.7320924
0
load imported model instance
def resnet50_ft_dag(weights_path=None, **kwargs): model = Resnet50_ft_dag() if weights_path: state_dict = torch.load(weights_path) model.load_state_dict(state_dict) return model
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self) -> Any:", "def load_model(self):\n pass", "def load(path_to_model):\n pass", "def load_model(self, filename):\r\n pass", "def load_model(self, path):\n pass", "def load_model(self, model_path: str):", "def __load_model(self):\n loaded = load(self.__fi...
[ "0.8518341", "0.8472797", "0.8321444", "0.8093881", "0.80572313", "0.8036239", "0.7939699", "0.7870271", "0.73690176", "0.73228353", "0.7318141", "0.7298541", "0.7289329", "0.72047764", "0.71820366", "0.7167679", "0.7153937", "0.7150925", "0.71245205", "0.71244025", "0.711919...
0.0
-1
Load and parse manifest file. Instances with durations outside [min_duration, max_duration] will be filtered out.
def read_manifest(manifest_path, max_duration=float('inf'), min_duration=0.0): manifest = [] for json_line in codecs.open(manifest_path, 'r', 'utf-8'): try: json_data = json.loads(json_line) except Exception as e: raise IOError("Error reading manifest: %s" % str(e)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self,\n manifest_filepath: Union[str, Path, List[str], List[Path]],\n sample_rate: int,\n n_segments: Optional[int] = None,\n max_duration: Optional[float] = None,\n min_duration: Optional[float] = None,\n ignore_file: Optional[Union[str, Path]] = No...
[ "0.6479079", "0.5563037", "0.55493927", "0.5548722", "0.55397034", "0.54406977", "0.5430423", "0.53386045", "0.5299497", "0.51943964", "0.5189001", "0.5177665", "0.5169128", "0.50688326", "0.50077266", "0.49894947", "0.49510708", "0.49487224", "0.49368173", "0.49202508", "0.4...
0.75650334
0
Download file from url to target_dir, and check md5sum.
def download(url, md5sum, target_dir): if not os.path.exists(target_dir): os.makedirs(target_dir) filepath = os.path.join(target_dir, url.split("/")[-1]) if not (os.path.exists(filepath) and md5file(filepath) == md5sum): print("Downloading %s ..." % url) os.system("wget -c " + url + " -P " +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_from_url(\n url, output_path, overwrite=False, reference_md5=None, is_retry=False\n):\n\n output_filename = Path(output_path).name\n output_filename_bold = f\"{bcolors.BOLD}{output_filename}{bcolors.ENDC}\"\n\n if file_exists(output_path):\n\n if not overwrite:\n\n if ref...
[ "0.7383906", "0.70156795", "0.68874884", "0.6856614", "0.68482125", "0.68470967", "0.6844774", "0.68265927", "0.67949075", "0.67949075", "0.67949075", "0.67853165", "0.6783589", "0.6757384", "0.67429924", "0.67119014", "0.6668384", "0.6666795", "0.66464406", "0.6635062", "0.6...
0.842353
0
Unpack the file to the target_dir.
def unpack(filepath, target_dir, rm_tar=False): print("Unpacking %s ..." % filepath) tar = tarfile.open(filepath) tar.extractall(target_dir) tar.close() if rm_tar == True: os.remove(filepath)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_file(self):\n# path_destination = os.path.join(\n# self.root, self.resources.replace(\".zip\", \"\"))\n# os.makedirs(path_destination, exist_ok=True)\n shutil.unpack_archive(os.path.join(\n self.root, self.resources), self.root)\n os.remove(os.path.j...
[ "0.65952206", "0.63666075", "0.6340507", "0.6295044", "0.6253198", "0.6219203", "0.61759305", "0.61541903", "0.6142236", "0.61058134", "0.6083396", "0.6045192", "0.5964464", "0.59374434", "0.5909122", "0.590736", "0.5891017", "0.58708346", "0.5853136", "0.58025235", "0.576775...
0.70915407
0
A multiprocessing pipeline wrapper for the data reader.
def xmap_readers_mp(mapper, reader, process_num, buffer_size, order=False): end_flag = XmapEndSignal() # define a worker to read samples from reader to in_queue def read_worker(reader, in_queue): for sample in reader(): in_queue.put(sample) in_queue.put(end_flag) # define a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, data, rewrap=False, prefetch=0):\n if rewrap:\n data = [data]\n\n for pipe in self._pipes:\n pipe.feed(data)\n data = pipe\n else:\n iterable = self._prefetch_callable(data, prefetch) if prefetch else data\n for out_data in i...
[ "0.6720047", "0.61600995", "0.6124317", "0.60573536", "0.59831387", "0.596829", "0.590126", "0.58411235", "0.57755744", "0.57365507", "0.5719182", "0.5698383", "0.56877464", "0.5687154", "0.5686592", "0.5682031", "0.56623125", "0.5656268", "0.56135833", "0.5583478", "0.558129...
0.5159957
85
A shortcut for app.run() Needed because the file is called `app` and the app variable is called `app`.
def run(host: Optional[str] = None, port: Optional[int] = None, debug: bool = False, **kwargs): app.run(host=host, port=port, debug=debug, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n app = App()\n app.run()", "def run():\n app.run()", "def main(args=None):\n app()\n return 0", "def main():\n print(\"def main\")\n return APP.run()", "def main():\n app.run(debug=True)", "def main():\n import sys\n FILES.extend(sys.argv[1:])\n app.debug = True\...
[ "0.81365186", "0.812223", "0.7944127", "0.7804016", "0.7646507", "0.7629067", "0.7572146", "0.7537828", "0.7537828", "0.7266342", "0.7243131", "0.71781373", "0.71781373", "0.71781373", "0.71781373", "0.71781373", "0.71781373", "0.71781373", "0.71781373", "0.7160601", "0.71192...
0.0
-1
class method to create user
def create_user(self, email, password, first_name, last_name, phone, credits=0, driver=False, drivers_license=None, profile_picture=None, number_of_rides=0, years_of_experience=0): password_hash = make_password_hash(email, password) return UserModel(email=email, password=password_hash, firs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_create():", "def create_user(email, password, f_name, l_name):\n pass", "def new_user(cls, user):\r\n pass", "def create_user(first_name,last_name,email,password):\n\n\tnew_user = User(first_name,last_name,email,password)\n\treturn new_user", "def create_user(self):\n return User...
[ "0.85116893", "0.8134696", "0.8000132", "0.7988977", "0.7986432", "0.79822546", "0.7957136", "0.7941195", "0.7935601", "0.79228514", "0.7899081", "0.78757465", "0.78415656", "0.7830991", "0.78102684", "0.7791881", "0.7786362", "0.7779956", "0.7769779", "0.77659637", "0.776585...
0.0
-1
Gets information about MS Exchange library.
def getExchangeDllInfo(self, fileName): return self.session.request('exchangedll/%s/' % (fileName))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def exchange_information(self):\n uri = \"/fapi/v1/exchangeInfo\"\n success, error = await self.request(\"GET\", uri)\n return success, error", "def get_exchange_info(self):\n return self.request.get(path=\"/info\")", "def library():\n finder = LibraryFinder()\n p = find...
[ "0.6323647", "0.5877237", "0.5318434", "0.53097844", "0.52070016", "0.51987547", "0.5139076", "0.50803375", "0.50536937", "0.50494665", "0.50386095", "0.5036896", "0.49667156", "0.49667156", "0.4962237", "0.49371502", "0.49032816", "0.4902186", "0.4895918", "0.4878535", "0.48...
0.6277932
1
Starts new file transmit session.
def startNewFileTransmitSession(self, data): return self.session.request('exchangedll/newsession/', 'POST', self.getXML(data, 'fileTransmitRequest'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starting_new_file(self):", "def start(self):\n\t\tself.stream.start_stream()", "def startFile(self, newFileName):\n \n pass", "def continueTransmitFile(self, fileTransmitSessionId, bytesToRead):\n return self.session.request('exchangedll/sessions/%s/data/%s'\n % (fileTrans...
[ "0.6833207", "0.6166744", "0.615599", "0.59899586", "0.5922031", "0.5889781", "0.5888008", "0.5856077", "0.5812332", "0.5720518", "0.5714976", "0.562695", "0.5606064", "0.55556095", "0.55144775", "0.5506584", "0.5506519", "0.5501701", "0.5500204", "0.54865944", "0.54702425", ...
0.8039896
0
Ends current transmit session.
def endTransmitFile(self, fileTransmitSessionId): return self.session.request('exchangedll/sessions/%s/' % (fileTransmitSessionId), 'POST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def EndSession( self ):\r\n\r\n self._socket.write( 'X' ) \r\n # self._connection.write( 'X' ).flush() \r\n\r\n return self.GetServerResponse()", "async def end_session(self):\n\t\t...", "def endSession(self):\n if(self.verb >= DLS_VERB_HIGH):\n print \"--Ending session wit...
[ "0.768969", "0.72552425", "0.683596", "0.6550783", "0.64756095", "0.64474815", "0.6390493", "0.63286483", "0.61426246", "0.6075295", "0.60603434", "0.6048468", "0.6015212", "0.5990399", "0.5989278", "0.5950591", "0.59452134", "0.5924247", "0.59025794", "0.59011406", "0.589734...
0.6655791
3
Cancels current transmit session.
def cancelTransmitFile(self, fileTransmitSessionId): return self.session.request('exchangedll/sessions/%s/' % (fileTransmitSessionId))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel(self):\n GameLoop.getInstance()._cancelation_token = True", "def cancel(self):\n self.session.rollback()", "def cancel(self):\n pass", "def cancel(self):", "def cancel(self):", "def cancel(self):", "def global_cancel(self):\n return self._call_txtrader_api('global...
[ "0.6800063", "0.6725142", "0.67183787", "0.6692529", "0.6692529", "0.6692529", "0.6602187", "0.6559335", "0.655874", "0.6516511", "0.6446328", "0.6446328", "0.64167506", "0.6374579", "0.6341034", "0.62864023", "0.6276948", "0.62272537", "0.6226534", "0.6201803", "0.6195927", ...
0.6523647
9
Reads data from agent in current transmit session.
def continueTransmitFile(self, fileTransmitSessionId, bytesToRead): return self.session.request('exchangedll/sessions/%s/data/%s' % (fileTransmitSessionId, bytesToRead), 'POST')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, read_variable_name):\n if read_variable_name is None:\n error_line = ('ERROR in Agent.read(), read_variable_name is None\\n' \n + \"Agent: \" + str(self.__name__))\n raise Exception(error_line)\n if self.read_variables is None:\n ...
[ "0.6079254", "0.5986378", "0.5829273", "0.5726475", "0.5710255", "0.5653608", "0.562979", "0.56223875", "0.5620118", "0.5583896", "0.5578758", "0.55689657", "0.5563117", "0.5525988", "0.5504534", "0.5494823", "0.54891217", "0.5467806", "0.54640436", "0.5448305", "0.54183227",...
0.0
-1
Yield successive nsized chunks from lst.
def chunks(lst, n): for i in range(0, len(lst), n): yield lst[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(self, lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "def chunks(lst: list, n: int):\n for i in range(0, len(lst), n):\n yield lst[i : i + n]", "def chunks(lst, n):\n for i in range(0, len(lst), n):\n yield lst[i:i + n]", "de...
[ "0.83071756", "0.81939614", "0.81910837", "0.81910837", "0.8190213", "0.81267184", "0.81218547", "0.81218547", "0.80773693", "0.80526286", "0.80526286", "0.80526286", "0.80526286", "0.80526286", "0.80042696", "0.7871678", "0.7845623", "0.7828392", "0.7827006", "0.78138447", "...
0.80533457
19
Convert parsed lines into a string of HTML format for the body text to be displayed on the GUI.
def __init_body_html(self) -> str: html_str = '' is_first = True unseen_idx = self._parsed.unseen for i, parsed_line in enumerate(self._parsed.parsed): line = '' for j, e in enumerate(parsed_line): token = e if isinstance(e, ZHEntit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plain_to_html(plain_text):\n if plain_text is None:\n return \"\"\n\n # We remove trailing whitespace - most notably newlines - so we\n # don't end up with unexpected vertical whitespace in the output.\n html = str(plain_text).rstrip().replace(\"&\", \"&amp;\"). \\\n replace(\"<\", \"...
[ "0.6257783", "0.6228069", "0.61329705", "0.5867111", "0.58233273", "0.57864743", "0.57727003", "0.5770009", "0.5743729", "0.5741245", "0.5707351", "0.5702982", "0.5681599", "0.56545305", "0.56531656", "0.5639295", "0.56326145", "0.5613993", "0.560777", "0.5583388", "0.5548615...
0.6581994
0
To support python 3
def __next__(self): return self.next()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_py3(self):\n if sys.version_info < self.MIN_SUPPORTED_VERSION:\n return\n import miflora # noqa: F401 # pylint: disable=unused-import,import-outside-toplevel", "def is_py3():\n return sys.version_info[0] == 3", "def test_python3(self):\n if sys.version.startswith(\"...
[ "0.6261", "0.6097193", "0.5970718", "0.5905989", "0.5726847", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.56945753", "0.5...
0.0
-1
Returns a stream consisting of the results of applying the given function to the items of this stream.
def map(self, mapper): def _map(iterator): return mapper(next(iterator)) return self.__class__(self, _map)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind(self, f):\n return as_stream_iterator(y for x in self for y in f(x))", "def filter(self, function):\n return FunctionalWrapper(filter(function, self.data))", "def map(self, function):\n return FunctionalWrapper(map(function, self.data))", "def reduce(self, function):\n re...
[ "0.68622994", "0.6546545", "0.65409714", "0.6433659", "0.6394086", "0.6208269", "0.61741555", "0.616061", "0.60999846", "0.60531145", "0.60272384", "0.59801644", "0.5966168", "0.5962581", "0.58892", "0.588588", "0.58688843", "0.584554", "0.5843813", "0.5799488", "0.578355", ...
0.0
-1
Returns a stream consisting of the items of this stream that match the given predicate.
def filter(self, predicate): def _filter(iterator): while True: item = next(iterator) if predicate(item): return item return self.__class__(self, _filter)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(iterable, predicate):\n\n for x in iterable:\n if predicate(x):\n yield x", "def find(self, predicate):\n return [d for d in self.iter_tree if predicate(d)]", "def filter(self, fn: Callable[[Tuple[K, List[V]]], bool]) -> Iterator[Tuple[K, List[V]]]:\n return (entry...
[ "0.64449394", "0.62587917", "0.608575", "0.59240955", "0.5681202", "0.5598102", "0.5537146", "0.5505054", "0.5501148", "0.5482622", "0.5466368", "0.5431415", "0.5402325", "0.5402325", "0.53616846", "0.5353132", "0.5352811", "0.53181934", "0.5312445", "0.5301627", "0.5300709",...
0.7530016
0
Returns a stream consisting of the flattened items of this stream.
def flatten(self): return self.__class__(itertools.chain.from_iterable(self))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flattened(self):\n return [item for inner in self.__items for item in inner]", "def flatten(self) -> List:\n return self._flatten_more(iterable=self, output=type(self)())", "def flatten_stream(chunk_stream: collections.Iterable) -> collections.Iterable:\r\n return chain.from_iterable(chunk...
[ "0.7224654", "0.708998", "0.6988089", "0.6864672", "0.6841566", "0.67606384", "0.67018443", "0.6637012", "0.6624998", "0.6537779", "0.6518443", "0.6412482", "0.6339062", "0.63334167", "0.63313913", "0.623318", "0.6137314", "0.61183965", "0.6106794", "0.6099815", "0.6076354", ...
0.7229144
0
Returns a stream consisting of the flattened items of the results of applying the given function to the items of this stream.
def flatmap(self, mapper): return self.map(mapper).flatten()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flat_map(fn, collection):\n return chain.from_iterable(map(fn, collection))", "def flatmap(func, *iterable) -> Iterator:\n return map(func, chain(*chain(*iterable)))", "def flatmap2(func, *iterable) -> Iterator:\n return map(func, chain(*chain(*chain(*iterable))))", "def reduce(self, function):\...
[ "0.67625535", "0.6406829", "0.6253064", "0.61806154", "0.61720777", "0.6112731", "0.60664326", "0.60455614", "0.6038856", "0.5892853", "0.5849856", "0.58229506", "0.570894", "0.5694387", "0.56796676", "0.564248", "0.56296474", "0.56286246", "0.5621549", "0.56022364", "0.55998...
0.5671029
15
Returns a stream consisting of the distinct items of this stream.
def distinct(self): memory = set() def _distinct(iterator): while True: item = next(iterator) if item in memory: continue memory.add(item) return item return self.__class__(self, _distinct)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distinct(self):\n return DistinctQuery(self)", "def distinct(self):\n qs = copy(self)\n qs._distinct = True\n return qs", "def unique(self):\n return self.element_wise(lambda seqs: list(set(seqs)))", "def distinct(self):\n self.distinct_ = True\n\n return ...
[ "0.6983475", "0.6915483", "0.6780482", "0.64765984", "0.63660026", "0.6359798", "0.6213019", "0.5897391", "0.5876457", "0.58733404", "0.58576953", "0.5810534", "0.57947123", "0.5721542", "0.57094973", "0.56463784", "0.56267685", "0.5607414", "0.5602389", "0.5584928", "0.55782...
0.76015234
0
Returns a stream consisting of items of this stream, truncated to be no longer than max_size in length.
def limit(self, max_size): return self.__class__(itertools.islice(self, max_size))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _truncate(self):\n dif = len(self) - self._maxLen\n if dif > 0:\n #return\n self[:dif] = []", "def _limit_helper(stream: Union[BinaryIO, Generator, List], limit: int) -> Generator:\n for value in stream:\n yield value\n if limit == 1:\n return\n...
[ "0.61745995", "0.58200085", "0.57398564", "0.5702165", "0.5623146", "0.56076515", "0.55688864", "0.55473465", "0.55255014", "0.5505975", "0.5426797", "0.54205805", "0.54120886", "0.5398848", "0.5391275", "0.53815204", "0.53634936", "0.53267366", "0.53238416", "0.5316794", "0....
0.7333502
0
Returns a stream consisting of remaining items of this stream after discarding first n items.
def skip(self, n): return self.__class__(itertools.islice(self, n, None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop(iterable, n, islice=islice):\n return islice(iterable, n, None)", "def drop(n, seq):\n return itertools.islice(seq, n, None)", "def take(self, n): # noqa: N805\n return List(_islice(self, n))", "def drop(iterable, n):\n counter = 0\n for element in iterable:\n if counter <...
[ "0.75482744", "0.7436712", "0.70949703", "0.6980845", "0.69610167", "0.68319", "0.6816474", "0.6816474", "0.6804587", "0.6804587", "0.66202843", "0.651614", "0.64598036", "0.64442784", "0.64442784", "0.6440829", "0.6393749", "0.63775164", "0.6363687", "0.6357983", "0.6342082"...
0.71049416
2
Returns True if all items of this stream match the given predicate, otherwise False.
def all(self, predicate): return all(predicate(item) for item in self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def any(self, predicate):\n return any(predicate(item) for item in self)", "def every(predicate: Predicate[_O]) -> Predicate[Iterable]:\n\n def compare(iterable: Iterable, /) -> bool:\n return all(predicate(item) for item in iterable)\n\n return compare", "def contains_all(self, *items):\n ...
[ "0.77382594", "0.68936706", "0.6524452", "0.6436115", "0.64340085", "0.62692904", "0.6232027", "0.61800313", "0.61774355", "0.6063142", "0.5975139", "0.5963174", "0.5950858", "0.5746089", "0.57256246", "0.5699829", "0.5647988", "0.56100446", "0.56100446", "0.5606734", "0.5571...
0.8018688
0
Returns True if any items of this stream match the given predicate, otherwise False.
def any(self, predicate): return any(predicate(item) for item in self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all(self, predicate):\n return all(predicate(item) for item in self)", "def any(seq, pred=None):\n for elem in itertools.ifilter(pred, seq):\n return True\n return False", "def contains_any(self, *items):\n return any(item in self for item in items)", "def every(predicate: Pred...
[ "0.7588194", "0.68950456", "0.66434777", "0.6561551", "0.641269", "0.64065003", "0.6393193", "0.62992823", "0.626012", "0.6255414", "0.6212287", "0.6013655", "0.5888474", "0.58565855", "0.58562446", "0.5783889", "0.57825863", "0.57219315", "0.56716853", "0.5659902", "0.564959...
0.8048223
0
Returns True if no items of this stream match the given predicate, otherwise False.
def none(self, predicate): return not self.any(predicate)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def any(self, predicate):\n return any(predicate(item) for item in self)", "def all(self, predicate):\n return all(predicate(item) for item in self)", "def no(seq, pred=None):\n for elem in ifilter(pred, seq):\n return False\n return True", "def all(seq, pred=None):\n for elem i...
[ "0.66968435", "0.6578743", "0.6485255", "0.6245035", "0.62410504", "0.61962926", "0.6189238", "0.6089569", "0.6053107", "0.6053107", "0.5953874", "0.58961457", "0.58409333", "0.583326", "0.5788164", "0.5788164", "0.5745407", "0.5716643", "0.570402", "0.567105", "0.5656919", ...
0.7476168
0