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
Produces a string representing one QREL entry
def genQrelStr(queryId, docId, relGrade): return f'{queryId} 0 {docId} {relGrade}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qrelEntry2Str(qrelEntry):\n return genQrelStr(qrelEntry.queryId, qrelEntry.docId, qrelEntry.relGrade)", "def __str__(self) -> str:\n return '[Q]: {} || [A]: {} || [{}]'.format(self.tell, self.answer, self.created.isoformat())", "def __str__(self):\n return f'Name: {self.name}\\nISBN: {self...
[ "0.75320774", "0.656819", "0.6402845", "0.6374799", "0.6345168", "0.6345168", "0.6322846", "0.6321934", "0.62942547", "0.62687206", "0.62434727", "0.62388664", "0.6235534", "0.62252605", "0.622481", "0.6222384", "0.6222352", "0.62121457", "0.6204588", "0.620208", "0.61845046"...
0.618273
21
Convert a parsed QREL entry to string.
def qrelEntry2Str(qrelEntry): return genQrelStr(qrelEntry.queryId, qrelEntry.docId, qrelEntry.relGrade)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseQrelEntry(line):\n\n line = line.strip()\n parts = line.split()\n if len(parts) != 4:\n raise Exception('QREL entry format error, expecting just 4 white-space separted field in the entry: ' + line)\n\n return QrelEntry(queryId=parts[0], docId=parts[2], relGrade=int(parts[3]))", "def f...
[ "0.617721", "0.61493593", "0.61304563", "0.5781973", "0.5565379", "0.54844826", "0.5433155", "0.53735805", "0.5332001", "0.52714926", "0.525061", "0.5247311", "0.5247303", "0.5220838", "0.5220101", "0.51887167", "0.51810044", "0.5169519", "0.5159208", "0.51539856", "0.5140406...
0.7916747
0
Parse one QREL entry
def parseQrelEntry(line): line = line.strip() parts = line.split() if len(parts) != 4: raise Exception('QREL entry format error, expecting just 4 white-space separted field in the entry: ' + line) return QrelEntry(queryId=parts[0], docId=parts[2], relGrade=int(parts[3]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_result_entry(result):\n entry = ParsedEntry()\n\n if \"content\" in result and len(result.content) > 0:\n entry.content = result.content[0].value\n # if not html, have to escape\n if result.content[0].type not in HTML_MIME_TYPES:\n entry.content = cgi.escape(entry.c...
[ "0.57672024", "0.5712222", "0.5657319", "0.5631491", "0.5623684", "0.55867475", "0.55786633", "0.55580145", "0.5541458", "0.55277073", "0.5502825", "0.54569316", "0.53761744", "0.53471315", "0.5338925", "0.53375584", "0.53002876", "0.52926755", "0.52745557", "0.52745557", "0....
0.73139864
0
Read and parse QRELs.
def readQrels(fileName): ln = 0 res = [] with open(fileName) as f: for line in tqdm(f, desc='loading qrels (by line)', leave=False): ln += 1 line = line.strip() if not line: continue try: e = parseQrelEntry(line) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseQrelEntry(line):\n\n line = line.strip()\n parts = line.split()\n if len(parts) != 4:\n raise Exception('QREL entry format error, expecting just 4 white-space separted field in the entry: ' + line)\n\n return QrelEntry(queryId=parts[0], docId=parts[2], relGrade=int(parts[3]))", "def r...
[ "0.6319746", "0.5800978", "0.5731543", "0.5555555", "0.54871035", "0.5411078", "0.5388917", "0.53783035", "0.53458947", "0.53004533", "0.5274036", "0.5265533", "0.5158059", "0.5128103", "0.50959504", "0.5082703", "0.50777197", "0.5048843", "0.5048156", "0.50440925", "0.502144...
0.65417624
0
Take a dictionary of document scores indexed by the document id and produce a list of (document id, score tuples) sorted in the order of decreasing scores.
def getSorteScoresFromScoreDict(queryRunDict): return list(sorted(queryRunDict.items(), key=lambda x: (x[1], x[0]), reverse=True))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_score_ordered(scores, idx):\t\n\treturn [x[1][idx] for x in sorted(scores.items())]", "def sorted_scores(scores):\n\treturn sorted(scores, key=lambda sailor: (total_score(sailor), sailor[1][0]))", "def sort_words(word_dic):\n word_list = []\n for key, value in word_dic.items():\n word = ...
[ "0.6941447", "0.6244914", "0.6080136", "0.60571605", "0.5880722", "0.5799608", "0.5676046", "0.5656475", "0.5655577", "0.55775243", "0.5570335", "0.5536112", "0.5528473", "0.5525277", "0.55218947", "0.5503588", "0.54912657", "0.5486251", "0.54857135", "0.54733294", "0.5434229...
0.72268873
0
Write a dictionarystored run to a file. The input is actually a dictionary of dictinoary. The outer dictionary is a set of queryspecific results indexed by the query id. And the internal dictionary is a set of document scores indexed by the document id. Before writing data, it is resorted within each query.
def writeRunDict(runDict, fileName): with open(fileName, 'wt') as runfile: for qid in runDict: scores = getSorteScoresFromScoreDict(runDict[qid]) for i, (did, score) in enumerate(scores): runfile.write(genRunEntryStr(qid, did, i + 1, score, FAKE_RUN_ID) + '\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_results_to_disk(self, result_path,results):\n with open(result_path+\"/results.txt\",\"w+\") as out:\n\n for query_num in results:\n for doc_num in results[query_num]:\n out.write(str(query_num)+\" 0 \"+doc_num+\" 1 42.38 mt\\n\")\n out.close...
[ "0.64149755", "0.6323092", "0.63185096", "0.623392", "0.6117135", "0.60469115", "0.60431457", "0.6037959", "0.6010059", "0.5962368", "0.594754", "0.5893706", "0.58609116", "0.5851925", "0.58096147", "0.58084553", "0.580037", "0.56999785", "0.5693484", "0.5654092", "0.56539285...
0.7100081
0
Write a list of QRELs to a file.
def writeQrels(qrelList, fileName): with open(fileName, 'w') as f: for e in qrelList: f.write(qrelEntry2Str(e)) f.write('\n')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(lst):\n # TODO", "def write_to_databse(fileName):\n f = open(fileName)\n queries = eval(open(fileName).read())\n for q in queries:\n site.write(q)\n print \"Quries are saved:)\"", "def store_list( q_frame, final, path_out):\n if not os.path.exists( path_out ):\n os.mak...
[ "0.6659388", "0.65668094", "0.64353186", "0.64146936", "0.63622636", "0.6266605", "0.62355745", "0.6232225", "0.6223006", "0.6174213", "0.6137193", "0.6118019", "0.61159784", "0.61075747", "0.61021453", "0.6097921", "0.60946554", "0.60937405", "0.60883534", "0.6078855", "0.60...
0.82695436
0
A simple function to generate one run entry.
def genRunEntryStr(queryId, docId, rank, score, runId): return f'{queryId} Q0 {docId} {rank} {score} {runId}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_run(arn=None):\n pass", "def exe():\n e = entry()\n if e:\n return load(e)", "def DistEntry():\n flags.StartMain(main)", "def console_entry():\n #main()", "def pretty_runlist_entry(num, max_num, command, arguments):\n basename = os.path.splitext(os.path.basename(command))[0]\...
[ "0.61637896", "0.60849404", "0.59185123", "0.5910822", "0.58969253", "0.5850631", "0.58331966", "0.58331966", "0.58331966", "0.5811054", "0.5810959", "0.5786089", "0.5732439", "0.5696852", "0.56688386", "0.5663584", "0.56446594", "0.56446594", "0.56446594", "0.56446594", "0.5...
0.60984117
1
Read QRELs in the form of a dictionary where keys are query IDs.
def readQrelsDict(fileName): result = {} for e in readQrels(fileName): result.setdefault(e.queryId, {})[e.docId] = int(e.relGrade) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dict_list(query_id, qrels):\n rel_list = []\n for query_dict in qrels:\n if int(query_dict['query_num']) == query_id:\n rel_list.append(query_dict)\n\n return rel_list", "def query(self, q):\n for key in self.metadb.query(q):\n yield key, self.datadb[key]", "def...
[ "0.6835832", "0.6125994", "0.58958644", "0.58423054", "0.5777831", "0.57507735", "0.5653117", "0.5650223", "0.5610089", "0.5573849", "0.55595124", "0.5454953", "0.5450803", "0.5422582", "0.5393296", "0.53765213", "0.53625804", "0.53055394", "0.52981114", "0.5297954", "0.52837...
0.73858917
0
Read a run file in the form of a dictionary where keys are query IDs.
def readRunDict(fileName): result = {} with FileWrapper(fileName) as f: for ln, line in enumerate(tqdm(f, desc='loading run (by line)', leave=False)): line = line.strip() if not line: continue fld = line.split() if len(fld) != 6: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_run_info_from_file(file):\n\n with open(file) as f:\n raw = f.read()\n\n lines = raw.split('\\n')\n runs = []\n for line in lines:\n if line == '':\n continue\n comma_splits = line.split(',')\n train_acc = float(comma_splits[0].strip())\n test_acc ...
[ "0.6355188", "0.59160393", "0.5847533", "0.58188874", "0.58029336", "0.5780881", "0.5759118", "0.57484883", "0.56860626", "0.56709135", "0.565064", "0.5644731", "0.5634812", "0.55844283", "0.55820817", "0.55554515", "0.5534645", "0.5521943", "0.5497889", "0.54698205", "0.5465...
0.7821929
0
Evaluate run stored in a file using QRELs stored in a file.
def evalRun(rerankRun, qrelsDict, metricFunc, debug=False): resArr = [] for qid, scoreDict in rerankRun.items(): relsSortedByScores = [] val = 0 if qid in qrelsDict: queryQrelDict = qrelsDict[qid] for did, score in getSorteScoresFromScoreDict(scoreDict): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(pred_file, ref_file):\n ref_dict, pred_dict, query_dict, id_dict = build_pred_ref_dict(ref_file, pred_file, ref_file)\n total, acc, scores = res_eval_with_type_acc(query_dict, pred_dict, ref_dict, id_dict, save=False)\n em = calculate_exact_match(pred_dict, ref_dict)\n print('Comp Acc: {:....
[ "0.597215", "0.5928241", "0.59157866", "0.5755006", "0.57497287", "0.5712579", "0.5587595", "0.55446315", "0.5504432", "0.54999787", "0.54995215", "0.5442724", "0.5438701", "0.5433622", "0.5417852", "0.53815764", "0.53815424", "0.53552645", "0.53552645", "0.52808577", "0.5260...
0.5167078
30
Carry out internal or external evaluation.
def getEvalResults(useExternalEval, evalMetric, rerankRun, qrelFile, runFile=None, useQrelCache=False): if useExternalEval: m = None if evalMetric == METRIC_MAP: m = 'map' elif evalMet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self):\n pass", "def evaluate(self):\n pass", "def evaluate(self) :\n pass", "def eval(self):\n pass", "def eval(self):\n pass", "def eval(self):\n pass", "def evaluate():\n click.echo(\"Not implemented yet. In the future, this command will be u...
[ "0.66934925", "0.66934925", "0.64331764", "0.62767583", "0.62767583", "0.62767583", "0.62206227", "0.60950506", "0.60773194", "0.60610324", "0.6049888", "0.602005", "0.6007762", "0.5988678", "0.59778374", "0.59670454", "0.59487677", "0.593412", "0.5869118", "0.5850919", "0.58...
0.0
-1
Sort itemsets by list of ordered indices. Returns ranked itemsets.
def sort_itemsets(indices, data, itemsets, custom_index_values=None, return_values=False): values = [] custom_index_id = 0 for (name, order) in indices: if name == 'custom': try: values.append([order * v for v in custom_index_values[custom_index_id]]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reorder_sets(sets):\n\n if len(sets) == 1:\n return sets\n\n s = set([])\n\n for ss in sets:\n for i in ss:\n s.add(i)\n\n tree = P(sets)\n\n\n for i in s:\n tree.set_contiguous(i)\n tree = flatten(tree)\n\n return tree.ordering()", "def sort_indices(s...
[ "0.59840685", "0.5871088", "0.58037066", "0.5756595", "0.56122243", "0.5593702", "0.55214834", "0.5464931", "0.5447365", "0.5439025", "0.54177094", "0.5398739", "0.5395633", "0.5359991", "0.52936673", "0.5288645", "0.5272867", "0.5250649", "0.51981884", "0.5194961", "0.516619...
0.75688815
0
Creates the python script necessary to submit the MEM jobs to the batch system
def createScript_sbatch(self): tools_createScript_sbatch( sbatch_script_file_name = self.sbatchFile_addMEM, executable = self.executable_addMEM, command_line_parameters = self.cfgFiles_addMEM_modified, input_file_names = self.inputFiles, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scriptGen(self,tmpd='/tmp/jose',libRev='last',submode='qsub',\n redirect=1,PBSoptions=''):\n jobname=self.name\n outdir=self.outd\n qsubdir=scratchdir+'/qsub/'+todayDate() #subdirectory to deposit the script\n if not os.path.exists(qsubdir): pastry('/bin/mkdir -p '...
[ "0.6900363", "0.6724484", "0.654995", "0.64530903", "0.6366503", "0.63467556", "0.6325721", "0.63027", "0.6214599", "0.6161553", "0.6147396", "0.6122376", "0.61184967", "0.606868", "0.60532546", "0.6047774", "0.6047245", "0.5977596", "0.59358174", "0.59101474", "0.59067476", ...
0.7109882
0
Adds the commands to Makefile that are necessary for running the MEM code
def addToMakefile_addMEM(self, lines_makefile): if self.is_sbatch: lines_makefile.append("sbatch_addMEM:") lines_makefile.append("\t%s %s" % ("python", self.sbatchFile_addMEM)) lines_makefile.append("") for key_file, output_file in self.outputFiles.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __instructions(self):\n\n self += comment('Intel Parallel Studio XE')\n self += packages(ospackages=self.__ospackages)\n self += copy(src=self.__tarball,\n dest=posixpath.join(self.__wd, self.__tarball_name))\n if self.__license and not '@' in self.__license:\n ...
[ "0.5848315", "0.5823324", "0.57588905", "0.56961876", "0.5667787", "0.55985594", "0.55985594", "0.55985594", "0.55985594", "0.5595643", "0.557142", "0.55572766", "0.55293703", "0.5514112", "0.545637", "0.53870964", "0.536825", "0.5344839", "0.53177613", "0.5304923", "0.527652...
0.64476264
0
Add hadd targets to the Makefile
def addToMakefile_hadd(self, lines_makefile): for hadd_out, hadd_in in self.hadd_records.iteritems(): hadd_in_files = hadd_in['output_files'] hadd_fileset_id = hadd_in['fileset_id'] process_name = hadd_in['process_name'] sbatch_hadd_file = os.path.join( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hadd_ex(new_name, files):\n \n l = len(files)\n if l == 1:\n print 'only one file specified, copying %s to %s' % (files[0], new_name)\n assert os.system('cp -p %s %s' % (files[0], new_name)) == 0 # JMTBAD check return code\n print '1 file copied to %s' % new_name\n return T...
[ "0.5552721", "0.5400419", "0.53885555", "0.5352961", "0.53026015", "0.521227", "0.5189179", "0.5171282", "0.5132894", "0.508693", "0.5052858", "0.50106657", "0.49353966", "0.49309725", "0.49256998", "0.48918346", "0.48828074", "0.4844602", "0.48313728", "0.4828164", "0.481639...
0.708559
0
Creates Makefile that runs the MEM
def createMakefile(self, lines_makefile): targets = self.hadd_records.keys() tools_createMakefile(self.makefile, targets, lines_makefile, self.filesToClean, self.is_sbatch) logging.info("Run it with:\tmake -f %s -j %i " % (self.makefile, self.num_parallel_jobs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_memleaks():\n build()\n sh(\"%s psutil\\\\tests\\\\test_memleaks.py\" % PYTHON)", "def addToMakefile_addMEM(self, lines_makefile):\n if self.is_sbatch:\n lines_makefile.append(\"sbatch_addMEM:\")\n lines_makefile.append(\"\\t%s %s\" % (\"python\", self.sbatchFile_addME...
[ "0.61680174", "0.5935793", "0.5723549", "0.5639227", "0.5620911", "0.560683", "0.55755347", "0.5453317", "0.5422136", "0.5360101", "0.5299333", "0.5261882", "0.5261035", "0.52525085", "0.52483064", "0.52471286", "0.5225567", "0.51970416", "0.5196871", "0.51353836", "0.5132524...
0.5192178
19
Creates all necessary config files and runs the MEM either locally or on the batch system
def create(self): for key in self.dirs.keys(): if type(self.dirs[key]) == dict: for dir_type in self.dirs[key].keys(): create_if_not_exists(self.dirs[key][dir_type]) else: create_if_not_exists(self.dirs[key]) # read the file i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def work(self):\n self.config_file = self.args.config\n self.init_config()\n self.init_db()\n\n self.kickoff()", "def init(_config, _run):\n sacred.commands.print_config(_run)\n dump_config_and_makefile()\n\n print()\n print('Initialized storage dir. Now run these commands...
[ "0.61811984", "0.5962312", "0.5945038", "0.5930454", "0.5915416", "0.58961785", "0.58747905", "0.58591765", "0.5837817", "0.58329153", "0.5831141", "0.5814066", "0.58040845", "0.58010054", "0.5763761", "0.5734302", "0.5733068", "0.57085186", "0.56866676", "0.5675613", "0.5667...
0.64692366
0
Runs all Ntuple addMEM jobs either locally or on the batch system.
def run(self): record_software_state(self.sw_ver_file_cfg, self.sw_ver_file_out, DEPENDENCIES) run_cmd( "make -f %s -j %i 2>%s 1>%s" % \ (self.makefile, self.num_parallel_jobs, self.stderr_file_path, self.stdout_file_path), False )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uge(jobs, threads, tmp_dir):\n # NOTE: add later for LOCUS cluster \n pass", "def run_batch(cpu, dtypes, itypes, nt, datafile, N):\n for ((dt, size), it) in itertools.product(dtypes, itypes):\n base = 10**(1/10)\n n = base \n m = 2000000\n while n*size < N:\n i...
[ "0.5688985", "0.55833566", "0.54783225", "0.53617525", "0.5304808", "0.5304808", "0.52620924", "0.5175494", "0.5158173", "0.51086617", "0.5106277", "0.5074169", "0.50725704", "0.50569516", "0.50466245", "0.5034408", "0.50054663", "0.4967807", "0.49644434", "0.4949124", "0.494...
0.0
-1
Get String representation of Experimental method used file of interest. Use header for this information.
def experimental_method(pdb_path): parser = PDBParser(get_header=True) parser.get_structure('', pdb_path) return parser.get_header()['structure_method']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension(self) -> str:", "def methodHelp(self, req, method):\n p = self.get_method(method)\n return '\\n'.join((p.signature, '', p.description))", "def get_info_string(self) -> str:\n return \"Not implemented\"", "def __str__(self):\n\n strme = \"fed method {} {} {} {}\"\\\n ...
[ "0.62963766", "0.62665623", "0.6215433", "0.62099373", "0.5915208", "0.5867127", "0.58381164", "0.5806747", "0.5784804", "0.57736933", "0.5766435", "0.5748317", "0.5711032", "0.5711032", "0.5709923", "0.56892794", "0.5686285", "0.5677971", "0.56770235", "0.56703764", "0.56672...
0.5833955
7
Find available devices to run EGL on. It will return the minor numbers, The minor number for the device is such that the Nvidia device node file for each GPU will have the form /dev/nvidia[minor number]. Avail able only on Linux platform.
def get_available_devices(): executable_path = os.path.join(os.path.dirname(__file__), 'build') try: num_devices = int(subprocess.check_output( ["{}/query_devices".format(executable_path)])) except subprocess.CalledProcessError as e: return [0] FNULL = open(os.devnull, 'w') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gpus():\n try:\n re = subprocess.check_output([\"nvidia-smi\", \"-L\"], universal_newlines=True)\n except OSError:\n return []\n return range(len([i for i in re.split('\\n') if 'GPU' in i]))", "def androidDetectDevices():\n\tdevices = []\n\ttry:\n\t\tif (sys.platform == 'win32'):\n...
[ "0.6562714", "0.65426177", "0.64418447", "0.6440465", "0.64399284", "0.64399284", "0.64344305", "0.6399175", "0.6397971", "0.6376035", "0.6363725", "0.63479066", "0.6269277", "0.6267697", "0.62502813", "0.62355644", "0.61364883", "0.6132447", "0.6094917", "0.6072684", "0.6059...
0.77780443
0
Get the device index to use in pytorch The minor number for the device is such that the Nvidia device node file for each GPU will have the form /dev/nvidia[minor number]. Avail able only on Linux platform.
def get_cuda_device(minor_idx): executable_path = os.path.join(os.path.dirname(__file__), 'build') try: num_devices = int(subprocess.check_output( ["{}/query_devices".format(executable_path)])) except subprocess.CalledProcessError as e: return 0 for i in range(num_devices):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_index(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"device_index\")", "def device_num(self) -> str:\n return pulumi.get(self, \"device_num\")", "def _current_device_index(self) -> int:\n device = PArray._get_current_device()\n if device is None: # not called in...
[ "0.72570884", "0.72109413", "0.71451735", "0.68671006", "0.68392485", "0.68228555", "0.68183947", "0.6812957", "0.6802684", "0.6722583", "0.67002505", "0.6601767", "0.6532514", "0.6519109", "0.6505232", "0.6494063", "0.6482684", "0.6395324", "0.6358353", "0.634921", "0.632758...
0.8265997
0
Check if image file extension match 'ext'
def is_suffix_right(file: Path, extension: str): ext = extension.lower() fext = file.suffix.lower()[1:] jpgs = {"jpg", "jpeg"} if fext in jpgs and ext in jpgs: return True elif fext == ext: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_image_extension(filename):\n\t\n\t# We need to make a test for extention :\n\timport os\n\textension = os.path.splitext(filename)[1]\n\text_ok=['.apm','.bmp','.gif','.ico','.jpeg','.jpg','.odi','.pcx','.png','.ppm','.psd','.tga','.tif','.tiff','.wmf','.xcf','.APM','.BMP','.GIF','.ICO','.JPEG','.JPG','.OD...
[ "0.8510836", "0.82460964", "0.8242744", "0.790605", "0.78503174", "0.773012", "0.75900716", "0.75041", "0.74898267", "0.7443009", "0.7431577", "0.74293053", "0.74175483", "0.7417413", "0.73864245", "0.73125875", "0.7271719", "0.71800363", "0.70967096", "0.70940334", "0.708400...
0.7415507
14
Set the window's configuration.
def configure_ui(self): self.setWindowIcon(self.MAIN_ICON) self.setWindowModality(Qt.ApplicationModal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_window(self, width, height):\n self.configure_surface(width, height)", "def SetWindow(self, w):\r\n\r\n self.window = w", "def _configureWindow(self):\n if self._win_type == WindowType.IMMERSIVE:\n pg.setConfigOptions(\n foreground='d',\n ...
[ "0.75859606", "0.71165055", "0.70187974", "0.7005744", "0.6882975", "0.67949784", "0.6744869", "0.6694935", "0.66007435", "0.6594297", "0.6535419", "0.6406824", "0.6400676", "0.63883495", "0.63820267", "0.63756794", "0.6368127", "0.636234", "0.6302152", "0.628131", "0.626874"...
0.56157684
89
This function provides correcting wrong paths to files and directories. It's a slot which called when both of edit lines is changing. If one of the paths is incorrect, then the error will be removed.
def correct_wrong_path(self): sender = self.sender() # This block provides removing an error under the edit line of the map's filename if sender == self.mapsDirectoryLine and self.incorrect_map_filename: self.VLayout.removeWidget(self.error_maps_lbl) self.error_maps_lbl....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_paths(self):\r\n\t\tself.check_line_edits_and_refresh_filestate()\r\n\t\t# paths\r\n\t\tsource_img_filename = self.source_img_entry.text().replace(\"\\\\\", \"/\")\r\n\t\tsink_dir_name = self.sink_dir_entry.text().replace(\"\\\\\", \"/\")\r\n\t\tsink_db_name_entry_text = self.sink_db_name_entry.text()\r\...
[ "0.6434743", "0.5851415", "0.5772642", "0.57233256", "0.57132787", "0.5556546", "0.5547998", "0.55355173", "0.5520772", "0.5487168", "0.5478769", "0.5449815", "0.54244477", "0.54151076", "0.5398201", "0.5370582", "0.53543586", "0.53484815", "0.5334684", "0.5310021", "0.529975...
0.84562945
0
This module enables or disables the accept button for this dialog window depending on whether there is text in the edit lines.
def enable_accept_button(self): if self.mapsDirectoryLine.text() and self.troopsDirectoryLine.text(): self.acceptButton.setEnabled(True) else: self.acceptButton.setEnabled(False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_okButton_clicked(self):\n self.accept=True", "def on_buttonBox_accepted(self):\n if len(self.lineInput.text()) == 0:\n self.reject()\n else:\n self.input = self.lineInput.text() \n self.accept()", "def acceptClicked(self):\n if len(...
[ "0.7059548", "0.66216075", "0.64704233", "0.63764644", "0.62911826", "0.61641425", "0.61585987", "0.61297405", "0.59587705", "0.5951562", "0.5920374", "0.58046377", "0.57752407", "0.57732236", "0.5757981", "0.5731169", "0.56851196", "0.5679839", "0.566154", "0.5607326", "0.56...
0.72327644
0
It's a slot which is called when the setting button is pressed This method opens the file manager and if a directory or a file is chosen, it fills edit lines
def files_manage(self): sender = self.sender() if sender == self.mapsDirectoryButton: path_to_map, _ = QFileDialog.getOpenFileName(self, caption="Открыть", directory="/", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_File1_toolButton_clicked(self):\n my_file = QtWidgets.QFileDialog.getOpenFileName(self, u'打开文件', '/')\n if my_file[0]:\n self.File1_lineEdit.setText(my_file[0])\n else:\n QtWidgets.QMessageBox.warning(self, u'警告', u'请选择输入文件')", "def onLoad (self):\n #productiv...
[ "0.7056106", "0.69966835", "0.68940663", "0.68738866", "0.6866713", "0.6858465", "0.6858465", "0.685267", "0.6840944", "0.6735564", "0.67051214", "0.6688198", "0.668139", "0.66708505", "0.6670207", "0.66078514", "0.6606934", "0.6594669", "0.657698", "0.65762657", "0.65483475"...
0.7185551
0
It's slot which is called when the accept button is pressed, if it's enabled This method checks that a specified directory or a file is correct and calls the method of creating central widget in the parent widget. Else this method prints an error about that trouble under the edit line and sets particular flags, specify...
def accept(self): map_filename = self.mapsDirectoryLine.text() troops_directory = self.troopsDirectoryLine.text() # This index will be a measure to insert error label under an edit line if an error will be occurred index_map_label = self.VLayout.indexOf(self.map_label) if not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accept(self, *args, **kwargs):\n QtGui.QApplication.setOverrideCursor(QtGui.QCursor(Qt.WaitCursor))\n \n mneRoot = self.ui.lineEditMneRoot.text()\n if str(mneRoot) is '':\n messageBox = QtGui.QMessageBox()\n messageBox.setText(\"Environment variables MNE_ROOT \...
[ "0.6549283", "0.65129936", "0.6496964", "0.6342729", "0.63302416", "0.62414056", "0.62278897", "0.62035453", "0.617841", "0.61445165", "0.6141491", "0.6070426", "0.6044493", "0.596154", "0.5927395", "0.5913186", "0.5898482", "0.58805674", "0.58754504", "0.5850688", "0.5835647...
0.7866559
0
Create Order Consultation Standard Medical
def btn_create_order_con(self): print() print('btn_create_order_con') # Init # Search Partner partner = tre_funcs.get_partner(self, self.patient.name) # Search pricelist pricelist = tre_funcs.get_pricelist(self) # Search product name = 'CONSULTA MEDICA' price_list = '2019' product = tre_func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pl_create_order(self):\n\tprint()\n\tprint('Pl - Create Order')\n\n\n\tpartner = self.env['res.partner'].search([\n\t\t\t\t\t\t\t\t\t\t\t\t\t('name', '=', self.patient.name),\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t#order='appointment_date desc',\n\t\t\t\t\t\t\t\t\t\t\t\tlimit=1,)\n\n\n\t# Create ...
[ "0.5997403", "0.5783128", "0.5642396", "0.5504628", "0.541906", "0.5365111", "0.5362394", "0.53545696", "0.5257514", "0.52405876", "0.5236128", "0.51716906", "0.51556104", "0.51476526", "0.51275605", "0.50959665", "0.5093361", "0.50858736", "0.5084346", "0.5078212", "0.506985...
0.5104012
15
Create Order Procedure 2019 From Recommendations
def btn_create_order_pro(self): print() print('treatment - btn_create_order_pro') # Search Partner partner = tre_funcs.get_partner(self, self.patient.name) # Search pricelist pricelist = tre_funcs.get_pricelist(self) # Search product # Create Product tuple product_tup = [] #for service in self.se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_order(self):\n\tprint()\n\tprint('OH - pl_create_order')\n\n\t# Search Partner\n\tprint()\n\tprint('Search partner')\n\tpartner = self.env['res.partner'].search([\n\t\t\t\t\t\t\t\t\t\t\t\t\t('name', '=', self.patient.name),\n\t\t\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\t\t\t\t#order='appointment_date de...
[ "0.6269989", "0.62364376", "0.6203065", "0.6008139", "0.6007918", "0.58362144", "0.56619346", "0.56101316", "0.5552725", "0.551811", "0.549911", "0.5442458", "0.54327625", "0.5430995", "0.5324714", "0.5315934", "0.52854973", "0.5252717", "0.5247154", "0.5242529", "0.5203079",...
0.59989053
5
Create Service Opens a new form. For Reco choice.
def btn_create_reco(self): print() print('OH - btn_create_reco') # Init res_id = self.id res_model = _model_treatment view_id = self.env.ref('openhealth.treatment_2_form_view').id # Open return { # Mandatory 'type': _model_action, 'name': 'Open Treatment Current', # Window action 'prior...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_service(self):\n self.dlg = ServiceCreateDialog(iface=self.iface, backend=self.backend)\n self.dlg.setWindowFlags(Qt.WindowStaysOnTopHint)\n self.dlg.show()", "def newService(self):\n for item in self.__service_list.selectedItems():\n item.setSelected(False)\n\n ...
[ "0.7184978", "0.7161627", "0.6685957", "0.63697183", "0.6119569", "0.6088428", "0.6053481", "0.6051753", "0.6050262", "0.60397744", "0.6024221", "0.59724677", "0.59567046", "0.59367496", "0.5895749", "0.5887126", "0.58600026", "0.5829561", "0.58239305", "0.5769992", "0.576962...
0.57344526
25
Generic method for creating Services. Compact. And easy to maintain.
def create_service_for_me(self, treatment_id, family, subfamily, physician_id): print() print('Create Service Generic - ', subfamily) # init model_dic = { 'all': _model_service, #'co2': _model_ser_co2, #'excilite': 'openhealth.service_excilite', #'ipl': 'openhealth.service_ipl', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createService(data):\n return Service(data).create()", "def create_service(self, url_data):\n data = {key: value[0] for key, value in url_data}\n\n publish_key = uuid.uuid4().hex\n service_id = uuid.uuid4().hex\n service_name = data['name']\n\n self.fastly_cache[service_...
[ "0.77442056", "0.7001777", "0.6965583", "0.69324523", "0.68919903", "0.6704786", "0.6639285", "0.6636635", "0.66325355", "0.6612868", "0.6570706", "0.6569513", "0.6558918", "0.6532779", "0.65322745", "0.65269345", "0.64953035", "0.64921445", "0.64893615", "0.6462472", "0.6455...
0.62306726
41
drops all the tables defined in "drop_table_queries" query list
def drop_tables(cur, conn): for query in drop_table_queries: cur.execute(query) conn.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_tables(session):\n for query in drop_table_queries:\n session.execute(query)", "def drop_tables(session):\n\n for query in drop_table_queries:\n session.execute(query)", "def drop_tables (cur, conn):\n for query in drop_table_queries:\n cur.execute(query)\n conn.co...
[ "0.87738657", "0.8704623", "0.85902226", "0.8486621", "0.84703714", "0.846386", "0.8450791", "0.8441526", "0.8429193", "0.8363235", "0.81853676", "0.8104734", "0.8016257", "0.800211", "0.7919646", "0.79034376", "0.78497", "0.7820362", "0.77738655", "0.7768701", "0.77539575", ...
0.8541708
10
creates all the tables defined in "create_table_queries" query list
def create_tables(cur, conn): for query in create_table_queries: cur.execute(query) conn.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_tables(session):\n for query in create_table_queries:\n session.execute(query)", "def create_tables(session):\n\n for query in create_table_queries:\n session.execute(query)", "def create_tables(self):\n for query in table_create_sql:\n self.cursor.execute(query...
[ "0.86132455", "0.8574697", "0.8532623", "0.8309845", "0.8308152", "0.83072835", "0.8294059", "0.8262667", "0.82527596", "0.8157106", "0.81245124", "0.80968326", "0.7978261", "0.7951848", "0.79269755", "0.79269755", "0.7827138", "0.775508", "0.76359016", "0.76054025", "0.75461...
0.8336363
11
connects to database specified in the config file, drops and creates staging, fact and dimension tables
def main(): config = configparser.ConfigParser() config.read('dwh.cfg') conn = psycopg2.connect("host={} dbname={} user={} password={} port={}".format(*config['CLUSTER'].values())) cur = conn.cursor() drop_tables(cur, conn) create_tables(cur, conn) conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n config = configparser.ConfigParser()\n config.read('dwh.cfg')\n\n conn = psycopg2.connect(\"host={} dbname={} user={} password={} port={}\".format(*config['CLUSTER'].values()))\n cur = conn.cursor()\n \n load_staging_tables(cur, conn)\n insert_tables(cur, conn)\n\n conn.close(...
[ "0.7464287", "0.7464287", "0.7455873", "0.74330133", "0.7373333", "0.7258284", "0.7227603", "0.71913075", "0.70940065", "0.70294785", "0.6913103", "0.68359804", "0.6630307", "0.6609196", "0.6601219", "0.6571767", "0.6568274", "0.6510074", "0.650525", "0.64658636", "0.64558053...
0.71758443
10
Generate an array of all days with prices for every ticker. Some symbols may not have trading data on some days. This filters out those days, and creates and array of all prices and tickers.
def _getFilteredPrices(self): # Create dict of dates to tickers to prices. date_dict = {} for stock in self.stock_dict.values(): for date in stock.ordered_date_dict.keys(): if date not in date_dict: date_dict[date] = {} date_dict[da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _construct_all_prices(self):\n d = dict([(s+'-', 0.0) for s in self.symbol_list] +\n [(s+'+', 0.0) for s in self.symbol_list])\n d['datetime'] = self.backtest_date\n return [d]", "def gather_stock_data(tickers, save=True):\n prices = pd.DataFrame()\n ts = TimeSeries...
[ "0.67409295", "0.67202425", "0.6456439", "0.64514035", "0.62389207", "0.62224364", "0.60535693", "0.601309", "0.60105884", "0.59593356", "0.59551656", "0.5949486", "0.593729", "0.5920068", "0.5865663", "0.5824194", "0.57976747", "0.57489455", "0.5708646", "0.5707145", "0.5706...
0.7080781
0
Generate the array of price changes.
def _getPriceChangeArray(self): prices = self.price_array[1:] prev_prices = self.price_array[:-1] raw_price_changes = prices / prev_prices expense_array = np.array( [self.stock_dict[ticker].expense_ratio for ticker in self.tickers], dtype=np.float64) expense_array = n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def price_history(self) -> np.ndarray:\n nb_transactions = len(self.game.transactions)\n nb_goods = self.game.configuration.nb_goods\n result = np.zeros((nb_transactions + 1, nb_goods), dtype=np.float32)\n\n temp_game = Game(self.game.configuration, self.game.initialization)\n\n ...
[ "0.66110533", "0.66072136", "0.6545294", "0.61039895", "0.5988195", "0.5960361", "0.5951982", "0.5944508", "0.5913564", "0.58012235", "0.58002996", "0.57225096", "0.5713424", "0.57093674", "0.5703792", "0.56665474", "0.5522286", "0.55150926", "0.54229176", "0.54132736", "0.54...
0.77094185
0
Loads a json file if it nonempty.
def _json_from_file(file: IO[AnyStr]) -> Json: if os.path.getsize(file.name) > 0: return typing.cast(Json, json.load(file)) return {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _load(self):\n if self.file_path.exists():\n with open(self.file_path) as fid:\n self.data = json.load(fid)", "def load_json_file(self, file, default_content=None):\n if os.path.isfile(file) and os.path.getsize(file):\n with open(file, \"r\", encoding=\"utf-...
[ "0.762835", "0.7599969", "0.75057316", "0.7405254", "0.72807854", "0.72572", "0.71229345", "0.70612323", "0.7041013", "0.69666064", "0.6953141", "0.693393", "0.692284", "0.68644524", "0.68295234", "0.6816347", "0.6786634", "0.6776473", "0.67584807", "0.6753719", "0.6745626", ...
0.6703026
23
Merges missing default settings into user settings.
def _merge_settings(default_settings: JsonValue, user_settings: JsonValue, use_default_values: bool) -> JsonValue: if isinstance(default_settings, dict): user_settings = typing.cast(Json, user_settings) for key, default_value in default_settings.items(): if key not in user_settings: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadDefaults(self):\n # (025) Merged into settings.RawSettings.\n pass", "def _inject_defaults(settings, defaults):\n new_settings = {}\n\n if defaults is None:\n return settings\n elif settings is None or len(settings) == 0:\n new_settings = defaults\n else:...
[ "0.72066826", "0.70328254", "0.699051", "0.69179225", "0.6817494", "0.67214745", "0.6703522", "0.6643126", "0.6551807", "0.651397", "0.6509964", "0.64392966", "0.6410869", "0.6405035", "0.63833135", "0.631745", "0.6305927", "0.62964314", "0.6293989", "0.6207525", "0.61430144"...
0.7007204
2
Parses a json settings file and merges in missing defaults.
def load_settings(user_settings_file: IO[AnyStr], use_default_values: bool = True) -> Json: default_settings = load_default_settings() user_settings = load_settings_simple(user_settings_file) return typing.cast(Json, _merge_settings(default_settings, user_settings, use_default_values))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_json_settings(file: str):\n with open(file) as f:\n return json.load(f)", "def json_config_settings_source(settings: BaseSettings) -> Dict[str, Any]:\n full_path = Path(config_dir) / config_name\n logger.debug(f\"Parsing file: {full_path}\")\n if fileio.file_exists(str(fu...
[ "0.71374434", "0.7061503", "0.69584143", "0.69001013", "0.6724808", "0.65126544", "0.6474971", "0.64652", "0.64467615", "0.64318335", "0.6358839", "0.6333143", "0.6325857", "0.6324122", "0.63009304", "0.6262618", "0.6207379", "0.6193889", "0.6193376", "0.6137778", "0.60944533...
0.72829187
0
Raises a value error if duplicates have been counted.
def _raise_if_duplicates(counts: Dict[str, int]) -> None: duplicates: List[str] = [] for nickname, count in counts.items(): if count > 1: duplicates.append(nickname) if len(duplicates) > 0: # TODO This is not always nickname raise ValueError(f'\'nickname\' not unique {dup...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_error(self):\n with self.assertRaises(ValueError):\n Band.count(\n column=Band.name, distinct=[Band.name, Band.popularity]\n ).run_sync()", "def validate_availability(self, value):\n cnt = Counter()\n if value:\n for i in value:\...
[ "0.70410717", "0.6357471", "0.605737", "0.60037196", "0.6002928", "0.5907917", "0.5853888", "0.58534443", "0.58284265", "0.58045846", "0.57278585", "0.5720412", "0.5718681", "0.5674157", "0.56520355", "0.56154764", "0.5604806", "0.55942357", "0.55827755", "0.5576378", "0.5554...
0.6930402
1
Checks the integrity of the list of engine settings.
def check_engine_settings(engine_settings_list: List[Json]) -> None: if not engine_settings_list: raise ValueError('Engine list was empty') nickname_counts: Dict[str, int] = {} for i, engine_settings in enumerate(engine_settings_list): for key in ['nickname', 'path']: if key not ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_settings(self):\n pass", "def check_settings(self):\r\n pass", "def check_all_settings(self):\r\n self.emit(SIGNAL('check_settings()'))", "def checkSettings(self):\n client.checkSettings(self)\n # TODO: Check your settings. Example:\n #\n # if self...
[ "0.671201", "0.6706726", "0.6444116", "0.6335558", "0.6182346", "0.6006436", "0.5979961", "0.5972534", "0.5947237", "0.59175533", "0.59118605", "0.59100354", "0.58788013", "0.5878257", "0.5867958", "0.5811573", "0.5804538", "0.57874286", "0.56914705", "0.5676122", "0.56677115...
0.62922466
4
Parses an engine options file into a dictionary.
def load_engine_options_simple(engine_options_file: IO[AnyStr]) -> engine.ConfigMapping: options: engine.ConfigMapping = {} name_counts: Dict[str, int] = {} for line_in_file in engine_options_file.read().splitlines(): line = typing.cast(str, line_in_file.strip()) if not line or line.startswi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_options(self):\n options = dict()\n while True:\n line = self.rfile.readline().decode(\"utf8\").strip()\n if not line:\n break\n self.log.debug(\"Got line: %s\", line)\n if \":\" not in line:\n self.log.debug(\"Invalid ...
[ "0.7345696", "0.6754468", "0.65925574", "0.6516578", "0.63679355", "0.6275019", "0.6238644", "0.62379575", "0.62147844", "0.6081465", "0.6051997", "0.6026707", "0.601588", "0.60051244", "0.6001563", "0.5991739", "0.5986586", "0.5982635", "0.5954915", "0.58947027", "0.586558",...
0.74689823
0
Parses an engine options file and merges in missing defaults.
def load_engine_options( default_options: List[engine.Option], options_file: IO[AnyStr], exclude_default_values: bool = True) -> engine.ConfigMapping: def is_empty(value: engine.ConfigValue): return value is None or value == '<empty>' engine_options: engine.ConfigMapping = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_engine_options_simple(engine_options_file: IO[AnyStr]) -> engine.ConfigMapping:\n options: engine.ConfigMapping = {}\n name_counts: Dict[str, int] = {}\n for line_in_file in engine_options_file.read().splitlines():\n line = typing.cast(str, line_in_file.strip())\n if not line or lin...
[ "0.68988574", "0.6230676", "0.6218802", "0.6173075", "0.6170455", "0.6135077", "0.61264294", "0.60763556", "0.59360474", "0.5916492", "0.5889376", "0.5873683", "0.5790578", "0.573215", "0.5720919", "0.5708603", "0.57029176", "0.56948304", "0.5682351", "0.5680957", "0.566325",...
0.7057122
0
Checks the integrity of the engine options.
def check_engine_options(default_options: List[engine.Option], engine_options: engine.ConfigMapping) -> None: def check_check(value: engine.ConfigValue): if not isinstance(value, bool): raise ValueError(f'Value \'{value}\' for \'{name}\' not a boolean') def check_spin(option: engine.Option...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_options(options, parser):\n if not options.get('release_environment', None):\n print(\"release environment is required\")\n parser.print_help()\n return os.EX_USAGE\n\n return 0", "def _verify_options(config: configuration.Config) -> None:\n\n if not config.config['species...
[ "0.66546845", "0.63232875", "0.63195765", "0.62439066", "0.619586", "0.6171925", "0.60823643", "0.6081956", "0.6080628", "0.6076199", "0.6055865", "0.59797627", "0.5952743", "0.58518857", "0.5831465", "0.58297694", "0.58243865", "0.5821161", "0.58197397", "0.58147943", "0.580...
0.597804
12
Creates a string representation of an engine option to write to a file.
def _engine_option_string_and_comment(option: engine.Option, value: engine.ConfigValue) -> Tuple[str, str]: if value is None: value = '' name_equals_val = f'{option.name}={value}' if option.type == 'check' or option.type == 'string' or option.type == 'button': return (name_equals_val, f'type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_filename_from_options(opt):\n fs = '{}_emb_{}_hid_{}_de_{}_dd_{}_n_lyrs_{}_lr_{}'.format(\n opt.rnn_cell,\n opt.embedding_size, opt.hidden_size,\n opt.dropout_p_encoder, opt.dropout_p_decoder,\n opt.n_layers, opt.lr)\n\n if opt.optim is not None:\n fs += '_{}'....
[ "0.6393773", "0.6163098", "0.59513646", "0.5796339", "0.570742", "0.565985", "0.5508458", "0.5497294", "0.54812104", "0.5416437", "0.5410234", "0.53872186", "0.53827995", "0.5382446", "0.5371444", "0.5350297", "0.53447205", "0.5316445", "0.531454", "0.53034174", "0.5295298", ...
0.54163146
10
Create string representations of engine options to write to a file.
def engine_options_file_lines(default_options: List[engine.Option], user_options: engine.ConfigMapping) -> List[str]: option_infos: List[Tuple[str, str]] = [] for option in default_options: if option.is_managed() or option.type == 'button': continue value = user_options[option.name] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_filename_from_options(opt):\n fs = '{}_emb_{}_hid_{}_de_{}_dd_{}_n_lyrs_{}_lr_{}'.format(\n opt.rnn_cell,\n opt.embedding_size, opt.hidden_size,\n opt.dropout_p_encoder, opt.dropout_p_decoder,\n opt.n_layers, opt.lr)\n\n if opt.optim is not None:\n fs += '_{}'....
[ "0.64722455", "0.6019288", "0.59901017", "0.59489715", "0.5912976", "0.58811975", "0.5802393", "0.5760834", "0.5759363", "0.57260406", "0.57209575", "0.572049", "0.56972736", "0.55530196", "0.5531413", "0.5490391", "0.5488484", "0.54847646", "0.5483813", "0.54755", "0.5463221...
0.58010626
7
calculates the shape of a matrix
def matrix_shape(matrix): shape = [] while isinstance(matrix, list): shape.append(len(matrix)) matrix = matrix[0] return shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matShape(mat):\n return (len(mat),len(mat[0]))", "def matrix_shape(matrix):\n return [*get_length(matrix)]", "def matrix_shape(matrix):\n return [*get_length(matrix)]", "def matrix_shape(matrix):\n if not matrix:\n return None\n if len(matrix) is 0:\n return [0]\n if type(...
[ "0.8048291", "0.7918595", "0.7918595", "0.77554053", "0.7717326", "0.75373983", "0.74661434", "0.7236693", "0.71243274", "0.6954595", "0.6807329", "0.6807329", "0.6805609", "0.66554475", "0.65739745", "0.64975715", "0.6492027", "0.64321846", "0.6358989", "0.634034", "0.633726...
0.78285253
3
Softmax crossentropy loss with masking.
def masked_softmax_cross_entropy(logits, labels, mask): loss = tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=labels) mask = tf.cast(mask, dtype=tf.float32) mask /= tf.reduce_mean(mask) loss *= mask return tf.reduce_mean(loss)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def masked_softmax_cross_entropy(preds, labels, mask):\n loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels)\n mask = tf.cast(mask, dtype=tf.float32)\n mask /= tf.reduce_mean(mask)\n loss *= mask\n return tf.reduce_mean(loss)", "def masked_softmax_cross_entropy(preds, labels, mask):\...
[ "0.8051919", "0.7999608", "0.7981055", "0.7981055", "0.7981055", "0.7977726", "0.793266", "0.7565911", "0.73568034", "0.73176104", "0.72984004", "0.72922695", "0.716306", "0.71087337", "0.70437163", "0.70108", "0.6905214", "0.68819344", "0.6834542", "0.6830443", "0.6830443", ...
0.77933097
7
Softmax crossentropy loss with masking.
def masked_sigmoid_cross_entropy(logits, labels, mask): labels = tf.cast(labels, dtype=tf.float32) loss = tf.nn.sigmoid_cross_entropy_with_logits(logits=logits, labels=labels) loss=tf.reduce_mean(loss,axis=1) mask = tf.cast(mask, dtype=tf.float32) mask /= tf.reduce_mean(mask) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def masked_softmax_cross_entropy(preds, labels, mask):\n loss = tf.nn.softmax_cross_entropy_with_logits(logits=preds, labels=labels)\n mask = tf.cast(mask, dtype=tf.float32)\n mask /= tf.reduce_mean(mask)\n loss *= mask\n return tf.reduce_mean(loss)", "def masked_softmax_cross_entropy(preds, labels, mask):\...
[ "0.8051919", "0.7999608", "0.7981055", "0.7981055", "0.7981055", "0.7977726", "0.793266", "0.77933097", "0.7565911", "0.73568034", "0.73176104", "0.72984004", "0.72922695", "0.71087337", "0.70437163", "0.70108", "0.6905214", "0.68819344", "0.6834542", "0.6830443", "0.6830443"...
0.716306
13
Save timezoneaware values for created and updated fields.
def save(self, *args, **kwargs): if self.pk is None: self.created = timezone.now() self.updated = timezone.now() super(Base, self).save(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, *args, **kwargs):\n if self.pk is None:\n self.created = timezone.now()\n self.updated = timezone.now()\n super(Base, self).save(*args, **kwargs)", "def save(self, *args, **kwargs):\n if not self.id:\n self.create_date = timezone.now()\n sel...
[ "0.6898697", "0.63491416", "0.6327028", "0.6312949", "0.6275868", "0.61563116", "0.61563116", "0.6146063", "0.6146063", "0.61329794", "0.61329794", "0.6125347", "0.61214924", "0.61214924", "0.6013914", "0.6012528", "0.59893817", "0.5989289", "0.5966557", "0.59067565", "0.5903...
0.69218004
0
Adds indent, quotes specified elements, joins them with ',' and surrounds with parentheses.
def commajoin(array, elements_to_quote, indent=0): result = " " * indent + "(" for i in elements_to_quote: if array[i] == '': array[i] = "NULL" else: array[i] = "'" + str(array[i]) + "'" j = 0 for i in array: result += str(i) if j != len(array) - 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _format_item_list(items, pad=\"'\", sep=', ', end_sep=' and '):\n result = ''\n items = [pad + item + pad for item in items]\n if items:\n if len(items) != 1:\n result = sep.join(items[:-1]) + end_sep + items[-1]\n else:\n result = items[0]\n return result", "d...
[ "0.6104393", "0.6081047", "0.5986766", "0.59865344", "0.5851034", "0.57388306", "0.5737991", "0.5690729", "0.56882364", "0.5627679", "0.56094444", "0.5571577", "0.55558723", "0.5547043", "0.55461544", "0.5525962", "0.54631674", "0.5434451", "0.54077697", "0.54077697", "0.5362...
0.68266034
0
Gets what column matches which language.
def getorder(columns, langs): order = [] for lang in langs: i = 0 for col in columns: if col == lang: order.append(i) i += 1 if len(order) != len(langs): print("Either missing a language or have a duplicate\n") return order
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_column(self, column_or_label):\n c = column_or_label\n if isinstance(c, collections.Hashable) and c in self.column_labels:\n return self[c]\n else:\n assert len(c) == self.num_rows, 'column length mismatch'\n return c", "def _get_col(self, idx):\n ...
[ "0.62636393", "0.61789846", "0.6152711", "0.60966796", "0.6089271", "0.6004885", "0.59756434", "0.5966933", "0.59179723", "0.59012645", "0.58697855", "0.5680194", "0.5678792", "0.5676237", "0.56437963", "0.5629243", "0.56290823", "0.56186384", "0.5599697", "0.559922", "0.5598...
0.0
-1
Writes name inserts to given file.
def writenames(sql, names, indent=0, id_offset=0, lang_offset=0): i = 0 for row in names: j = 0 if i > 0: sql.write(",\n") for name in row: if j > 0: sql.write(",\n") sql.write(commajoin([i+id_offset, j+lang_offset, name], [2], indent))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_file(file, name):\n with open(file, \"a\") as player_list:\n player_list.writelines(name)", "def write_to_file(self, filename: str) -> None:", "def write(self, filename):\n pass", "def write(self, filename):\n pass", "def write(self, fname):\n pass", "def write...
[ "0.70986146", "0.6759375", "0.6651877", "0.6651877", "0.6646314", "0.64887553", "0.6326986", "0.6294738", "0.6240479", "0.6192061", "0.6166432", "0.6140194", "0.6105632", "0.60816085", "0.60777086", "0.6034101", "0.6021925", "0.6008614", "0.6003748", "0.5986355", "0.59844065"...
0.5827592
29
Write and read lang data
def write_lang_city(sql): langs = [] nametemp = [] langorder = [] countries = [] sql.write("INSERT INTO languages(language_id, name, iso2, iso3) VALUES\n") with open("data/lang.csv", 'r', encoding='utf8') as csvfile: reader = csv.reader(csvfile, delimiter=",", quoting=csv.QUOTE_MINIMAL)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setData(data, language=None):", "def loadLanguage(request, lang):\n request.clock.start('loadLanguage')\n from MoinMoin import caching\n # farm notice: for persistent servers, only the first wiki requesting some language\n # gets its cache updated - a bit strange and redundant, but no problem.\n ...
[ "0.6238392", "0.6186492", "0.59919024", "0.586811", "0.58512664", "0.58224833", "0.5787843", "0.574927", "0.57183444", "0.56823564", "0.56302905", "0.5599651", "0.55802834", "0.55779564", "0.5515979", "0.54899395", "0.54727936", "0.5460523", "0.5426006", "0.5410131", "0.53640...
0.49894106
57
Write and read food group data
def write_groups(sql, langs): groups = [] nametemp = [] langorder = [] sql.write("INSERT INTO food_group(food_group_id) VALUES\n") with open("data/groups.csv", 'r', encoding='utf8') as csvfile: reader = csv.reader(csvfile, delimiter=",", quoting=csv.QUOTE_MINIMAL) i = 0 for r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_data():", "def store_grouped_data(data,path):\n i = 0\n for name, group in data:\n l = len(group)\n print name, \", \", l\n if l > 999:\n group.to_csv(path + \"//clean.events\"+ str(i), index=False)\n i += 1", "def add_group_data(self, group_name):\n ...
[ "0.61627614", "0.5857623", "0.57573915", "0.56267273", "0.5603694", "0.5557257", "0.55482465", "0.55239236", "0.54822713", "0.5476876", "0.54660803", "0.5411314", "0.5379378", "0.5371047", "0.53069615", "0.5306003", "0.53000164", "0.526094", "0.52049595", "0.51842505", "0.516...
0.5511003
8
Write and read diet data
def write_groups_diets(sql, langs): groups = [] diets = [] nametemp = [] langorder = [] groups = write_groups(sql, langs) sql.write("INSERT INTO global_diet(preset) VALUES\n") with open("data/diets.csv", 'r', encoding='utf8') as csvfile: reader = csv.reader(csvfile, delimiter=",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_data():", "def write(data):", "def write( data ):", "def write_infodata(self, data):\n if not self._wrt_defined:\n print \"Please, call set_write_cycle_time() first\"\n return False\n if len(data) != 4:\n print \"Infodata block is 4 byte\"\n ...
[ "0.62000924", "0.56546474", "0.56115943", "0.55661196", "0.5428569", "0.53478754", "0.5235032", "0.5196143", "0.5165036", "0.5139188", "0.51169264", "0.5080054", "0.50512236", "0.5031987", "0.5027093", "0.5025451", "0.49980384", "0.49825385", "0.49762046", "0.4923382", "0.490...
0.0
-1
simply converts all csv files in mock data into insert statements
def write_test_data(sql): for fname in sorted(glob.glob("mock_data/*.csv")): print(fname) with open(fname, 'r', encoding='utf8') as csvfile: reader = csv.reader(csvfile, delimiter=",", quoting=csv.QUOTE_MINIMAL) i = 0 for row in reader: if i == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_data(data_type, data, db_cursor, database):\n for each_file in data:\n with open(f'{DATA_PATH}{each_file}.csv') as csv_file:\n csv_reader = csv.reader(csv_file, delimiter=',')\n line_count = 0\n for row in csv_reader:\n # do not process the heade...
[ "0.6758338", "0.6746043", "0.67334425", "0.6713657", "0.66608614", "0.6618824", "0.65960056", "0.65747595", "0.6549408", "0.65186286", "0.65053517", "0.6415094", "0.6390163", "0.6388048", "0.63780886", "0.6363483", "0.6359099", "0.6326339", "0.6316207", "0.6316161", "0.63077"...
0.77306116
0
Converts csv/tsv files from data folders to populate queries.
def main(): langs = [] with open("sql/07_populate.sql", 'w', encoding='utf8') as sql: sql.write("--this file is generated from csv files in data folder\n\n") langs = write_lang_city(sql) write_groups_diets(sql, langs) with open("sql/10_populate_test_data.sql", 'w', encoding='utf8'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_files(file_path):\n # checking your current working directory\n cur_dir = os.getcwd()\n\n # Get your current folder and sub folder event data\n data_dir = os.path.join(cur_dir, 'event_data')\n\n # Create a for loop to create a list of files and collect each\n # file_path\n file_...
[ "0.666231", "0.6443677", "0.62016416", "0.6157668", "0.6114367", "0.61079246", "0.6103801", "0.604604", "0.6014093", "0.596293", "0.595828", "0.5929185", "0.5904661", "0.58836704", "0.5875933", "0.5866737", "0.5864637", "0.58475685", "0.58439934", "0.5835151", "0.58215326", ...
0.5534379
71
PATCH /workers/ Changes the status of this worker.
def patch(self, identifier): data = binary_status_schema(g.payload) if data.get('status') == 'ACTIVE': current_app.config['APPLICATION'].enable_worker(identifier) elif data.get('status') == 'DEACTIVATED': current_app.config['APPLICATION'].disable_worker(identifier) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch(self, id):\n try:\n task = update_status(get_db(), id, Status[api.payload[\"status\"]])\n if not task:\n api.abort(404, \"Invalid Task\")\n return task_to_dict(task)\n except ValueError:\n api.abort(422, \"Invalid Status\")", "def...
[ "0.55095226", "0.55028725", "0.54557097", "0.54305637", "0.5403861", "0.53791434", "0.5377578", "0.5347136", "0.533915", "0.533581", "0.53261644", "0.53202647", "0.52790004", "0.5251339", "0.5215275", "0.5204497", "0.5191661", "0.5185492", "0.5157756", "0.5133342", "0.5130274...
0.74830425
0
if cursor position is on the button, create button frame
def create_frame(self, x: int, y: int): if self.clicked(x, y): x, y, w, h = self.rect self.frame = pygame.Rect(x - 5, y - 5, w + 10, h + 10) else: self.frame = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_buttons(frame):\n button0 = Button(frame, height=2, width=2, text=\" \",\n command=lambda: on_click(button0))\n button0.pack(side=LEFT)\n button1 = Button(frame, height=2, width=2, text=\" \",\n command=lambda: on_click(button1))\n button1.pack(side=LE...
[ "0.6814768", "0.6679351", "0.6611863", "0.65939415", "0.65918565", "0.65649325", "0.6505203", "0.64517725", "0.64417976", "0.6412699", "0.6411252", "0.63671803", "0.63670474", "0.63500637", "0.6341348", "0.6330736", "0.6324912", "0.6308765", "0.62971395", "0.6278057", "0.6218...
0.6383105
11
set a proffesional looking matplotlib style
def set_style(usetex=False): plt.rc('text', usetex=usetex) plt.rc('font', family='Serif') mpl.rcParams['figure.figsize'] = [10, 7] mpl.rcParams['font.size'] = 17 mpl.rcParams['savefig.dpi'] = 150 mpl.rcParams['xtick.minor.visible'] = True mpl.rcParams['ytick.minor.visible'] = True mpl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customize_mpl():\r\n print(\"Setting custom matplotlib visual style\")\r\n\r\n rcParams['figure.figsize'] = (10, 6)\r\n rcParams['figure.dpi'] = 150\r\n rcParams['axes.color_cycle'] = dark2_colors\r\n rcParams['lines.linewidth'] = 2\r\n rcParams['axes.grid'] = True\r\n rcParams['axes.facec...
[ "0.75982976", "0.718391", "0.7182594", "0.7110354", "0.70964205", "0.6949332", "0.6936319", "0.67766124", "0.67148894", "0.6619341", "0.6582537", "0.657382", "0.6467556", "0.64657557", "0.64460784", "0.64151937", "0.6413506", "0.6411621", "0.63958895", "0.6392753", "0.6353010...
0.7470834
1
Get the cached binary distribution archive that was previously built for the given package (name, version) (and optionally URL). If no archive has been cached yet, a new binary distribution archive is created and added to the cache.
def get_binary_dist(package, version, directory, url=None, python='/usr/bin/python', prefix='/usr'): tag = hashlib.sha1(str(version + url).encode()).hexdigest() if url else version cache_file = os.path.join(binary_index, '%s:%s:%s.tar.gz' % (package, tag, get_python_version())) if not os.path.isfile(cach...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cache(name):\n\n return get_component(CachingPackage.COMPONENT_NAME).get_cache(name)", "def cabal_get(name, unpack_to, version=None):\n pkg = name\n if version is not None:\n pkg += \"==\"\n pkg += version\n\n return run([\"cabal\", \"get\", pkg, \"-d\", unpack_to])", "def existing_archive(...
[ "0.62168354", "0.60056436", "0.58326787", "0.5793394", "0.5715711", "0.567902", "0.56164545", "0.5613404", "0.55722487", "0.5547017", "0.55175894", "0.5502366", "0.54943293", "0.54713947", "0.5448375", "0.54424584", "0.54364425", "0.54203945", "0.5413666", "0.54098874", "0.53...
0.7490097
0
Convert a single, unpacked source distribution to a binary distribution. Raises an exception if it fails to create the binary distribution (probably because of missing binary dependencies like system libraries).
def build_binary_dist(package, version, directory, python='/usr/bin/python'): build_timer = Timer() # Make sure the source distribution contains a setup script. setup_script = os.path.join(directory, 'setup.py') if not os.path.isfile(setup_script): msg = "Directory %s (%s %s) doesn't contai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n if self.formats != [\"gztar\"] and self.formats != [\"zip\"]:\n print(\"'setup.py sdist' unsupported format.\")\n sys.exit(1)\n\n if glob.glob(\"*.tar.gz\"):\n print(\"'setup.py sdist' remove existing *.tar.gz files from \"\n \"source directory.\")\n sys.exit(1...
[ "0.6166575", "0.6010504", "0.5875719", "0.5833119", "0.5795637", "0.574525", "0.56041056", "0.55501443", "0.55416507", "0.54898053", "0.5410071", "0.5375483", "0.53528816", "0.53478336", "0.5306484", "0.5289251", "0.52809817", "0.5252052", "0.5176424", "0.51637757", "0.514191...
0.584589
3
Transform a binary distribution archive created with ``python setup.py bdist_dumb format=tar`` into a form that can be cached for future use. This comes down to making the pathnames inside the archive relative to the `prefix` that the binary distribution was built for.
def transform_binary_dist(archive_path, prefix='/usr'): # Copy the tar archive file by file so we can rewrite the pathnames. logger.debug("Transforming binary distribution: %s.", archive_path) logger.debug("Using environment prefix: %s.", prefix) archive = tarfile.open(archive_path, 'r') for me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gz_tar(full_prefix):\n tarfile = os.path.join(outputdir, full_prefix + '.tar')\n try:\n with open(tarfile, 'rb') as f_in, gzip.open(tarfile + '.gz', 'wb') as f_out:\n shutil.copyfileobj(f_in, f_out)\n os.remove(tarfile)\n except Exception as e:\n log.error(\"Tarfile {0}...
[ "0.6624995", "0.5973443", "0.59267676", "0.58510005", "0.5808216", "0.5689753", "0.56756777", "0.5619002", "0.5613805", "0.55668515", "0.5519208", "0.54786164", "0.54553145", "0.5450021", "0.5443351", "0.5413397", "0.5370573", "0.5354789", "0.53475803", "0.53347725", "0.53303...
0.7719703
0
Install a binary distribution created with ``python setup.py bdist`` into the given prefix (a directory like ``/usr``, ``/usr/local`` or a virtual environment).
def install_binary_dist(members, prefix, python='/usr/bin/python', enable_workarounds=True): # TODO This is quite slow for modules like Django. Speed it up! Two choices: # 1. Run the external tar program to unpack the archive. This will # slightly complicate the fixing up of hashbangs. # 2. Us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install(self, spec, prefix):\n make(\"install\", parallel=False)", "def install(self, args=None, target=\"install\"):\n args = args if args else []\n str_args = \" \".join(args)\n if \"DESTDIR=\" not in str_args:\n args.insert(0, \"DESTDIR={}\".format(unix_path(self._co...
[ "0.6706299", "0.65126616", "0.6295004", "0.6238352", "0.60443175", "0.60068166", "0.59957397", "0.5921789", "0.57315", "0.5648719", "0.56375676", "0.55756116", "0.5550347", "0.55466676", "0.5510487", "0.5481524", "0.54365534", "0.54067636", "0.53959805", "0.5365939", "0.53503...
0.6652997
1
Rewrite the hashbang in an executable script so that the Python program inside the virtual environment is used instead of a system wide Python.
def fix_hashbang(python, contents): # Separate the first line in the file from the remainder of the contents # while preserving the end of line sequence (CR+LF or just an LF) and # without having to split all lines in the file (there's no point). lines = contents.splitlines() hashbang = lines[0...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_shebang(self, handle, interpreter):\n if detect_python_script(handle):\n lines = handle.readlines()\n lines[0] = b'#!' + interpreter.encode('ascii') + b'\\n'\n handle = BytesIO(b''.join(lines))\n handle.seek(0)\n return handle", "def process_sh...
[ "0.732829", "0.6517055", "0.64587206", "0.6419364", "0.6301114", "0.5835952", "0.57975733", "0.56519705", "0.5598901", "0.5556552", "0.55436015", "0.55386496", "0.5365093", "0.53436875", "0.5277366", "0.52546036", "0.5249833", "0.524669", "0.5241603", "0.52317417", "0.5179354...
0.66236895
1
Initialize a requirement object.
def __init__(self, requirement): self.pip_requirement = requirement self.setuptools_requirement = requirement.req # In pip-accel 0.10.4 and earlier the list of requirements returned by # unpack_source_dists() contained tuples in the following format. self.old_interface = (se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, req, argv):\n self._req = req\n self._argv = argv\n\n # We use a separate temp dir for each requirement so requirements\n # (from different indices) that happen to have the same archive names\n # don't overwrite each other, leading to a security hole in which t...
[ "0.66898435", "0.63760674", "0.62675565", "0.624149", "0.62248087", "0.62169856", "0.61996937", "0.61996937", "0.61996937", "0.61996937", "0.61813813", "0.61390203", "0.6118997", "0.61149776", "0.6075584", "0.60059315", "0.5966681", "0.5942747", "0.5942747", "0.5931561", "0.5...
0.6283552
2
The name of the Python package (a string). This is the name used to register a package on PyPI and the name reported by commands like ``pip
def name(self): return self.setuptools_requirement.project_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_package_name(self):\n return self.name + '-' + self.version", "def get_package_name(self):\n return self.name + '-' + self.version + '-' + self.release", "def package_name(self) -> str:\n return pulumi.get(self, \"package_name\")", "def package_name(self):\n return self._p...
[ "0.82315797", "0.81423026", "0.8140491", "0.7894246", "0.77295196", "0.76153123", "0.7543961", "0.7487066", "0.7313372", "0.7311747", "0.7251059", "0.72119623", "0.70979613", "0.70932734", "0.7083767", "0.7043299", "0.7035155", "0.70278776", "0.7024797", "0.69871116", "0.6969...
0.64047766
63
The version of the package that ``pip`` wants to install based on the command line options that were given to ``pip`` (a string). Based on
def version(self): return self.pip_requirement.installed_version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_pip_versioned_package_string(\n library_name: str, version_string: str\n) -> str:\n return '%s==%s' % (library_name, version_string)", "def get_version():\n\n version_string = version_from_versioneer()\n\n if not version_string:\n version_string = version_from_pip()\n\n return vers...
[ "0.66763216", "0.6673236", "0.63909316", "0.6285159", "0.62627167", "0.622569", "0.62129605", "0.62005633", "0.61937195", "0.6155948", "0.611179", "0.6058138", "0.6058138", "0.6058138", "0.6058138", "0.6058138", "0.6058138", "0.6058138", "0.6058138", "0.6058138", "0.6058138",...
0.674038
0
The pathname of the directory containing the unpacked source distribution. This is the directory that contains a ``setup.py``
def source_directory(self): return self.pip_requirement.source_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPackageDirectory():\n return os.path.dirname(__file__)", "def get_package_dir():\n return Path(__file__).parent", "def get_install_dir(self):\n return EventGenerator.get_install_dir(self) + \"/madgraph5/src\"", "def get_install_dir(self):\n return EventGenerator.get_install_dir(sel...
[ "0.7882261", "0.78249943", "0.7451742", "0.74421036", "0.73956454", "0.73768854", "0.7256142", "0.7101482", "0.70624197", "0.7059278", "0.694501", "0.6943025", "0.6912458", "0.68570054", "0.6847402", "0.68168926", "0.6816051", "0.6813868", "0.6797789", "0.6795502", "0.6794880...
0.7516564
2
``True`` when the requirement is already installed, ``False`` otherwise.
def is_installed(self): return bool(self.pip_requirement.satisfied_by)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_installed(self):\n return not self.dont_install", "def already_installed(lib_spec, options, working_set=None):\n if 'path' in options:\n return False\n\n if not working_set:\n working_set=pkg_resources.WorkingSet(sys.path)\n\n try:\n working_set.require(lib_spec)\n ...
[ "0.77823555", "0.7527283", "0.7521783", "0.7446945", "0.7324295", "0.72457904", "0.721714", "0.71614337", "0.706286", "0.70098406", "0.69969386", "0.69896317", "0.69786394", "0.69777703", "0.6964472", "0.6922492", "0.69222534", "0.6917151", "0.69150466", "0.69119006", "0.6896...
0.79604423
0
``True`` when the requirement is a transitive dependency (a dependency of a dependency) or ``False`` when the requirement is a direct dependency (specified on pip's command line or in a ``requirements.txt`` file). Based on
def is_transitive(self): return isinstance(self.pip_requirement.comes_from, InstallRequirement)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_dependency(self, dep):\r\n return True", "def _sufficient_deps(cls, deps):\n if cls.MODEL_PACKAGE is None:\n return True\n else:\n for d in deps.conda:\n if cls.MODEL_PACKAGE in d:\n return True\n for d in deps.pip:\n ...
[ "0.7150804", "0.67961425", "0.67164946", "0.65914494", "0.6496702", "0.6477763", "0.633333", "0.63137054", "0.62766606", "0.62700015", "0.6266488", "0.62340945", "0.61870563", "0.61679566", "0.6163255", "0.6157765", "0.6050587", "0.6031543", "0.60234386", "0.6016165", "0.5978...
0.7746789
0
Return a string identifying the currently running Python version.
def get_python_version(): return "py%i.%i" % (sys.version_info[0], sys.version_info[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_python_version() -> str:\n return \"{} {} on {}\".format(\n platform.python_implementation(),\n platform.python_version(),\n platform.system(),\n )", "def pythonversionstr():\n return '{t[0]}.{t[1]}.{t[2]}'.format(t=platform.python_version_tuple())", "def python_version(se...
[ "0.83359855", "0.79305583", "0.7837343", "0.76527643", "0.76474893", "0.7407734", "0.7407734", "0.7396613", "0.7377381", "0.7366962", "0.7349132", "0.7344607", "0.733353", "0.72470134", "0.72237986", "0.7210526", "0.72045714", "0.71998715", "0.7187953", "0.7175396", "0.714991...
0.77854
3
Create a temporary working directory and a virtual environment where pipaccel can be tested in isolation (starting with an empty download cache, source index and binary index and no installed modules) and make sure pip and pipaccel use the directory. Also creates the directories for the download cache, the source index...
def setUp(self): coloredlogs.install(level=logging.DEBUG) # Create a temporary working directory. self.working_directory = tempfile.mkdtemp() # Create a temporary build directory. self.build_directory = os.path.join(self.working_directory, 'build') # Create a tempor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n coloredlogs.install(level=logging.DEBUG)\n # Create a temporary working directory.\n self.working_directory = tempfile.mkdtemp()\n # Create a temporary build directory.\n self.build_directory = os.path.join(self.working_directory, 'build')\n # Create a t...
[ "0.76585984", "0.6998828", "0.6592483", "0.65521127", "0.65169436", "0.648992", "0.632207", "0.62966186", "0.6259255", "0.61760193", "0.6119715", "0.6043009", "0.60395974", "0.60066956", "0.59853506", "0.59688634", "0.595255", "0.5901899", "0.5901053", "0.589884", "0.5891566"...
0.7686593
0
A very basic test of the functions that make up the pipaccel command using the `virtualenv` package as a test case.
def runTest(self): # We will test the downloading, conversion to binary distribution and # installation of the virtualenv package (we simply need a package we # know is available from PyPI). arguments = ['install', '--ignore-installed', 'virtualenv==1.8.4'] # First we do a s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runTest(self):\n # We will test the downloading, conversion to binary distribution and\n # installation of the virtualenv package (we simply need a package we\n # know is available from PyPI).\n arguments = ['install', '--ignore-installed', 'virtualenv==1.8.4']\n # First we d...
[ "0.75798845", "0.69819945", "0.6818097", "0.6713533", "0.6589174", "0.6525606", "0.6503367", "0.63632447", "0.63099754", "0.622459", "0.6204702", "0.6194493", "0.6139652", "0.61071426", "0.6083854", "0.5994085", "0.5992309", "0.59918314", "0.5952341", "0.59369195", "0.586638"...
0.74043363
1
Cleanup the temporary working directory that was used during the test.
def tearDown(self): shutil.rmtree(self.working_directory)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(self):\r\n if self.tempDirectory != None:\r\n shutil.rmtree(self.tempDirectory, True)\r\n self.tempDirectory = None", "def cleanup_temp_dir(context):\n\n try:\n os.chdir(context.cwd)\n except:\n print(\"Current working file record does not exist\")\n\n...
[ "0.8413275", "0.8402331", "0.8346875", "0.8175108", "0.81133807", "0.80950266", "0.8081311", "0.80100954", "0.79845655", "0.7974465", "0.79468673", "0.7941451", "0.7917673", "0.7913126", "0.7907241", "0.7902104", "0.7886492", "0.7886492", "0.7882106", "0.78649205", "0.7860815...
0.78299254
22
Create a temporary txt file from HDF5.
def hdf2txt_tmp(fname): print 'converting HDF5 -> temporary ASCII ...', data, fin = readh5(fname) f = tf.NamedTemporaryFile(suffix='') # create temp file np.savetxt(f, data, fmt='%f') f.seek(0) closeh5(fin) print 'done' return f
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_as_hdf5(self, filename):", "def temporary(cls):\n fh, path = tempfile.mkstemp(suffix='.hdf5')\n os.close(fh)\n self = cls(path, 'w')\n self.path = path\n return self", "def test_create():\n\n with tempfile.TemporaryDirectory() as td:\n fp = os.path.join(td,...
[ "0.6588873", "0.65184367", "0.6387805", "0.6336854", "0.6114972", "0.59868824", "0.592905", "0.5881204", "0.5869554", "0.5852435", "0.58333004", "0.5813109", "0.58126175", "0.5812096", "0.5809681", "0.57816786", "0.57685274", "0.57606965", "0.57593733", "0.57477915", "0.57401...
0.7862914
0
Takes a dataframe of processed eviction data and predictions from an ARIMAX model at the month level. Returns a dataframe grouped by ZIP with a column containing the average percentage of total evictions each ZIP represented
def top_down_forecast_data_processing(original_df,predictions_by_month): transformed_df=original_df.groupby('Month_Year').sum().reset_index()\ [['Month_Year','Eviction_Notice']] percentage_of_month_df = pd.merge(original_df[['Month_Year','Address_Zipcode',\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_down_forecast(original_df,predictions_by_month,months_ahead):\n\n group_by_zip_df = top_down_forecast_data_processing(original_df,predictions_by_month)\n\n zip_perc_df= pd.DataFrame(np.random.randn(1, 4), columns=['zip_predicted','zip_code','perc_of_month','month_year'])\n\n for month in range(mon...
[ "0.6544387", "0.58413523", "0.57256114", "0.56348085", "0.555309", "0.54977405", "0.5485508", "0.54725814", "0.5401345", "0.5389973", "0.536069", "0.5329506", "0.5328788", "0.5302536", "0.52628785", "0.5251212", "0.5242129", "0.522812", "0.52199835", "0.5200968", "0.5185783",...
0.739867
0
Takes a dataframe of processed eviction data and predictions from an ARIMAX model at the month level, as well as the number of months into the future to predict.
def top_down_forecast(original_df,predictions_by_month,months_ahead): group_by_zip_df = top_down_forecast_data_processing(original_df,predictions_by_month) zip_perc_df= pd.DataFrame(np.random.randn(1, 4), columns=['zip_predicted','zip_code','perc_of_month','month_year']) for month in range(months_ahead):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arimax_by_month_forecast_fit_predict (y_train,y_test,months_ahead, months_list):\n predictions_df= pd.DataFrame(np.random.randn(1, 2),\\\n columns=['month_year', 'predicted_evictions'])\n\n now = datetime.datetime.now()\n\n model = pf.ARIMAX(data=y_train,formula='Eviction_Notice~1+CASANF0URN',a...
[ "0.79838103", "0.7393525", "0.725368", "0.69809437", "0.6334739", "0.63147026", "0.6194552", "0.6134306", "0.6121274", "0.6016633", "0.601663", "0.5980682", "0.5806225", "0.57996064", "0.5768583", "0.57633406", "0.5728102", "0.5712658", "0.5658473", "0.5626327", "0.56168824",...
0.6652185
4
Takes a dataframe of processed eviction data as well as a set amount of lagged variables about future datapoints and how many months ahead to include in the prediction.
def arimax_by_month_train_test(model_data,future_data,months_ahead): transformed_df = arima_by_zip_data_transform(model_data) transformed_df=transformed_df.groupby('Month_Year').sum().reset_index() y_train = transformed_df y_test = future_data[['Month_Year','Eviction_Notice','CASANF0URN']] now =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_predictions(year, month):\n \n start_date = str(year)+\"-\"+str(month)+\"-01\"\n end_date = str(year)+\"-\"+str(month)+\"-\"+str(monthrange(year, month)[1])\n\n date_range = pd.date_range(start_date,end_date, freq='D').strftime(\"%Y-%m-%d\").tolist()\n\n # predictfunction \n # do predict...
[ "0.6364175", "0.63334864", "0.6267178", "0.59978694", "0.5987615", "0.5957174", "0.59301317", "0.57890916", "0.5736458", "0.5725275", "0.5689226", "0.56639534", "0.5641206", "0.56295705", "0.5626032", "0.5600229", "0.5582438", "0.55348295", "0.5518111", "0.55100405", "0.55089...
0.5992216
4
Takes in training and test data formatted as time series with an exogenous variable, CASANF0URN, which which represents unemployment rate in San Francisco from the previous year.
def arimax_by_month_forecast_fit_predict (y_train,y_test,months_ahead, months_list): predictions_df= pd.DataFrame(np.random.randn(1, 2),\ columns=['month_year', 'predicted_evictions']) now = datetime.datetime.now() model = pf.ARIMAX(data=y_train,formula='Eviction_Notice~1+CASANF0URN',ar=2, ma=2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arimax_by_month_train_test(model_data,future_data,months_ahead):\n transformed_df = arima_by_zip_data_transform(model_data)\n transformed_df=transformed_df.groupby('Month_Year').sum().reset_index()\n\n y_train = transformed_df\n\n\n y_test = future_data[['Month_Year','Eviction_Notice','CASANF0URN']...
[ "0.6474548", "0.5763003", "0.56484705", "0.56113726", "0.55643433", "0.555857", "0.5496503", "0.5457722", "0.54512095", "0.54455984", "0.543785", "0.5425412", "0.5386848", "0.5385404", "0.53398514", "0.5329046", "0.5323245", "0.5297824", "0.5291544", "0.5286219", "0.527358", ...
0.5213099
28
Activate the DHCP agent.
def run(self): self.sync_state() self.periodic_resync() self.lease_relay.start() self.notifications.run_dispatch(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate(self):\n super().activate()\n self._change_lease_time(self.runner.config.get(\"dhcp_lease_time\"))\n self._scan_finalize()", "def server_activate(self):\n\t\tpass", "def activate_controller(self):\n if self.controller_address:\n #print \"Activating controller...
[ "0.7367523", "0.6174387", "0.6084445", "0.6073693", "0.6065638", "0.6057743", "0.59695095", "0.5860989", "0.5859584", "0.5761732", "0.5749872", "0.5738167", "0.57222456", "0.5659488", "0.56560457", "0.56503", "0.5624306", "0.56200856", "0.56175464", "0.5599799", "0.5599799", ...
0.0
-1
Invoke an action on a DHCP driver instance.
def call_driver(self, action, network): if self.conf.use_namespaces: namespace = NS_PREFIX + network.id else: namespace = None try: # the Driver expects something that is duck typed similar to # the base models. driver = self.dhcp_drive...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_action(host, details, action):\n if details:\n pprint(cs.get_device_details(host))\n if action:\n pprint(cs.device_action(host, action))", "def device_action(self, client, action):\r\n client.deviceAction(action)", "def _RunDHCPCD(self, **kwargs):\n del kwargs\n clea...
[ "0.61030775", "0.5921867", "0.58629996", "0.5762756", "0.57204163", "0.56761485", "0.56761485", "0.55990696", "0.55990696", "0.5535578", "0.55226314", "0.54966766", "0.54925567", "0.5439608", "0.541157", "0.54060113", "0.5376972", "0.537439", "0.53660226", "0.5343927", "0.529...
0.7318727
0
Sync the local DHCP state with Quantum.
def sync_state(self): LOG.info(_('Synchronizing state')) known_networks = set(self.cache.get_network_ids()) try: active_networks = set(self.plugin_rpc.get_active_networks()) for deleted_id in known_networks - active_networks: self.disable_dhcp_helper(dele...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sync_experiment_state_with_ddb(self):\n if self.local_mode:\n self.sync_thread.sync_experiment_state_with_ddb()", "def update(self):\n self._state = get_local_ip()", "def sync():\n sync_ssda()", "def update(self):\n try:\n if not self._sysinfo:\n ...
[ "0.6180898", "0.5961581", "0.56596506", "0.5563325", "0.55320233", "0.5489496", "0.54843223", "0.5393621", "0.5317044", "0.5298483", "0.52749354", "0.5256482", "0.5226604", "0.5218777", "0.51281685", "0.5090927", "0.5090464", "0.50808954", "0.5073649", "0.5064125", "0.5057595...
0.6583717
0
Resync the dhcp state at the configured interval.
def _periodic_resync_helper(self): while True: eventlet.sleep(self.conf.resync_interval) if self.needs_resync: self.needs_resync = False self.sync_state()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_state(self):\n LOG.info(_('Synchronizing state'))\n known_networks = set(self.cache.get_network_ids())\n\n try:\n active_networks = set(self.plugin_rpc.get_active_networks())\n for deleted_id in known_networks - active_networks:\n self.disable_dhcp...
[ "0.62378156", "0.60955244", "0.58129066", "0.5434197", "0.53986806", "0.5379062", "0.53275496", "0.52896744", "0.52710843", "0.51772535", "0.51282424", "0.50909096", "0.5082574", "0.5062422", "0.50369143", "0.49950752", "0.49852315", "0.49442717", "0.49381378", "0.49372518", ...
0.55289453
3
Spawn a thread to periodically resync the dhcp state.
def periodic_resync(self): eventlet.spawn(self._periodic_resync_helper)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n self.sync_state()\n self.periodic_resync()\n self.lease_relay.start()\n self.notifications.run_dispatch(self)", "def sync_state(self):\n LOG.info(_('Synchronizing state'))\n known_networks = set(self.cache.get_network_ids())\n\n try:\n ...
[ "0.6033633", "0.559053", "0.5557032", "0.55510986", "0.5474557", "0.5411881", "0.5409579", "0.5318271", "0.53177303", "0.5296048", "0.5247797", "0.5238221", "0.5237003", "0.5179221", "0.5164641", "0.5161137", "0.515453", "0.5152708", "0.51398647", "0.5128912", "0.51281554", ...
0.50748193
23
Enable DHCP for a network that meets enabling criteria.
def enable_dhcp_helper(self, network_id): try: network = self.plugin_rpc.get_network_info(network_id) except: self.needs_resync = True LOG.exception(_('Network %s RPC info call failed.') % network_id) return if not network.admin_state_up: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dhcp_agent_network_add(self, dhcp_net_info):\n self.turn_on_dhcp_check()", "def enable_network_management(self):\n self._request({\"enable-network-management\": True})", "def elAddNetworkConfigurationWithDhcp(self, device):\n commandSection = self.sectionByName(\"command\")\n # ...
[ "0.6613713", "0.64811337", "0.6424179", "0.6270945", "0.6147416", "0.61341375", "0.603933", "0.5958222", "0.59445256", "0.5920509", "0.5902045", "0.5895537", "0.58745736", "0.57734", "0.5736621", "0.57331413", "0.5694706", "0.5690121", "0.5680276", "0.5655933", "0.56160223", ...
0.75427896
0
Disable DHCP for a network known to the agent.
def disable_dhcp_helper(self, network_id): network = self.cache.get_network_by_id(network_id) if network: if self.call_driver('disable', network): self.cache.remove(network)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dhcp_agent_network_remove(self, dhcp_net_info):\n self.turn_on_dhcp_check()", "def network_delete_end(self, payload):\n self.disable_dhcp_helper(payload['network_id'])", "def _disable_wifi_ap(self):\n call(['systemctl', 'disable', 'hostapd', ])\n call(['systemctl', 'disable', 'd...
[ "0.7135386", "0.6868477", "0.64515764", "0.62737286", "0.62714326", "0.6229779", "0.6223586", "0.6125738", "0.61127055", "0.6056309", "0.59756565", "0.5961324", "0.59271187", "0.5900384", "0.5843378", "0.57802856", "0.57735544", "0.5729633", "0.5697703", "0.56655335", "0.5631...
0.7986895
0
Refresh or disable DHCP for a network depending on the current state of the network.
def refresh_dhcp_helper(self, network_id): old_network = self.cache.get_network_by_id(network_id) if not old_network: # DHCP current not running for network. return self.enable_dhcp_helper(network_id) try: network = self.plugin_rpc.get_network_info(network_id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def network_update_end(self, payload):\n network_id = payload['network']['id']\n if payload['network']['admin_state_up']:\n self.enable_dhcp_helper(network_id)\n else:\n self.disable_dhcp_helper(network_id)", "def disable_dhcp_helper(self, network_id):\n network ...
[ "0.70645887", "0.7003579", "0.6516991", "0.6359894", "0.6336317", "0.61639994", "0.60851556", "0.607324", "0.59917974", "0.5893061", "0.57851523", "0.5669228", "0.56041586", "0.5593157", "0.5579951", "0.54653764", "0.54648304", "0.5416313", "0.5412252", "0.53830546", "0.53794...
0.733629
0
Handle the network.create.end notification event.
def network_create_end(self, payload): network_id = payload['network']['id'] self.enable_dhcp_helper(network_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_graph_end(self, network: Network):\n pass", "def onMessageEnd(self):", "def network_create_event(self, network_info):\n net = network_info['network']\n net_id = net['id']\n net_name = net.get('name')\n network_db_elem = self.get_network(net_id)\n # Check if t...
[ "0.6248566", "0.6031988", "0.57522935", "0.57338864", "0.5701586", "0.5675204", "0.5653594", "0.5636173", "0.5629332", "0.5538093", "0.54424596", "0.5430942", "0.5419787", "0.53785735", "0.53761613", "0.53417826", "0.53303516", "0.5320978", "0.531378", "0.530669", "0.52717966...
0.6849954
0
Handle the network.update.end notification event.
def network_update_end(self, payload): network_id = payload['network']['id'] if payload['network']['admin_state_up']: self.enable_dhcp_helper(network_id) else: self.disable_dhcp_helper(network_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_end(self, status, objective):\n pass # pragma: no cover", "def send_finish_event(self):\n self.status['type'] = '__end__'\n self._send()", "def end(update: Update, context: CallbackContext) -> int:\n update.callback_query.answer()\n\n text = \"See you around!\"\n updat...
[ "0.64979863", "0.63618815", "0.6354132", "0.6308048", "0.6289232", "0.61400086", "0.6041612", "0.60274327", "0.59674954", "0.5949109", "0.5926635", "0.58869374", "0.58779126", "0.5860421", "0.5796766", "0.5758815", "0.57569045", "0.57188445", "0.5713383", "0.5688551", "0.5639...
0.6571846
0
Handle the network.delete.end notification event.
def network_delete_end(self, payload): self.disable_dhcp_helper(payload['network_id'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_IN_DELETE(self, event):", "def _notify_delete(self, cuds_object):", "def on_deleted(self, event):\n\n # the absolute path of the event file/folder\n abs_path = event.src_path\n # replace the root path with a '.' to build a relative path to be sent to server\n relative_ev...
[ "0.6687941", "0.65360117", "0.6504362", "0.6332553", "0.6319839", "0.6128922", "0.6042391", "0.6031273", "0.6013475", "0.6010431", "0.596033", "0.59602207", "0.59489894", "0.58846825", "0.58623254", "0.58432305", "0.5838188", "0.58338237", "0.58286065", "0.5809571", "0.579758...
0.68294984
0
Handle the subnet.update.end notification event.
def subnet_update_end(self, payload): network_id = payload['subnet']['network_id'] self.refresh_dhcp_helper(network_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_subnet_postcommit(self, context):\n if self.rpc_handler is None:\n return\n subnet = self._get_subnet_info(context._subnet)\n if subnet is not None:\n try:\n self.rpc_handler.update_subnet(subnet)\n except:\n pass", "d...
[ "0.66729087", "0.6600842", "0.62174314", "0.6109604", "0.6024752", "0.5942195", "0.5750984", "0.57237357", "0.5659294", "0.5652078", "0.56508094", "0.55938303", "0.55554795", "0.55497646", "0.55028933", "0.5502632", "0.5420597", "0.5417562", "0.5396377", "0.53416765", "0.5335...
0.7799576
0
Handle the subnet.delete.end notification event.
def subnet_delete_end(self, payload): subnet_id = payload['subnet_id'] network = self.cache.get_network_by_subnet_id(subnet_id) if network: self.refresh_dhcp_helper(network.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_subnet_postcommit(self, context):\n if self.rpc_handler is None:\n return\n try:\n self.rpc_handler.delete_subnet({str(context._subnet.get('id', '')): {}})\n except:\n pass", "def delete_subnet_postcommit(self, mech_context):\n LOG.debug(\"d...
[ "0.6993552", "0.6756371", "0.67003113", "0.6559159", "0.647308", "0.6463808", "0.6403783", "0.63142115", "0.6309298", "0.62003213", "0.57914406", "0.5777481", "0.57660466", "0.57313883", "0.57229215", "0.565757", "0.5645164", "0.55317897", "0.55291295", "0.5499232", "0.548507...
0.7865546
0
Handle the port.update.end notification event.
def port_update_end(self, payload): port = DictModel(payload['port']) network = self.cache.get_network_by_id(port.network_id) if network: self.cache.put_port(port) self.call_driver('reload_allocations', network)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_finish_event(self):\n self.status['type'] = '__end__'\n self._send()", "def onMessageEnd(self):", "def end(update: Update, context: CallbackContext) -> int:\n update.callback_query.answer()\n\n text = \"See you around!\"\n update.callback_query.edit_message_text(text=text)\n\n ...
[ "0.6465052", "0.6250917", "0.6206949", "0.6200631", "0.6087534", "0.60749346", "0.60135967", "0.59975713", "0.5883709", "0.58819026", "0.58666104", "0.5856382", "0.58052033", "0.57543814", "0.5744977", "0.5744686", "0.57377493", "0.57021797", "0.56638414", "0.5663316", "0.566...
0.65497047
0
Handle the port.delete.end notification event.
def port_delete_end(self, payload): port = self.cache.get_port_by_id(payload['port_id']) if port: network = self.cache.get_network_by_id(port.network_id) self.cache.remove_port(port) self.call_driver('reload_allocations', network)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_IN_DELETE(self, event):", "def delete_port_postcommit(self, context):\n if self.rpc_handler is None:\n return\n port = self._get_port_info(context)\n if port is not None:\n try:\n self.rpc_handler.delete_port(port)\n except:\n ...
[ "0.6525613", "0.65228605", "0.646454", "0.6217715", "0.62165207", "0.6130076", "0.6126507", "0.6012117", "0.5925986", "0.58993256", "0.5834277", "0.5791649", "0.57853687", "0.57846904", "0.5774742", "0.5691563", "0.5691563", "0.56881493", "0.56836855", "0.5662047", "0.5659632...
0.6916865
0
Make a remote process call to retrieve the active networks.
def get_active_networks(self): return self.call(self.context, self.make_msg('get_active_networks', host=self.host), topic=self.topic)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_networks():\n return get_networks()", "def list_net(self):\n _url = \"http://\" + self.host_ip + \":9696/v2.0/networks\"\n _headers = {'Content-type': 'application/json',\n 'x-auth-token': self.project_info[\"token_project\"]}\n _body = None\n\n response...
[ "0.657749", "0.65077436", "0.638325", "0.6311575", "0.61095214", "0.5842249", "0.57740545", "0.5771512", "0.5732876", "0.5730552", "0.57152635", "0.571397", "0.57076454", "0.57016504", "0.56785256", "0.56415784", "0.5635792", "0.5630904", "0.5617051", "0.55758715", "0.5521408...
0.6694506
0
Make a remote process call to retrieve network info.
def get_network_info(self, network_id): return DictModel(self.call(self.context, self.make_msg('get_network_info', network_id=network_id, host=self.host), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remote_info():\n run('uname -a')", "def do_remote(self, *args):\n return self.do_scpi(':communicate:remote 1')", "def do_local(self, *args):\n return self.do_scpi(':communicate:remote 0')", "def subcmd_getnic_main(args, parameter_info):\n \n from get_nic_inventory import get_nic_in...
[ "0.6053576", "0.60060537", "0.5726204", "0.56940055", "0.5621628", "0.5613466", "0.54797566", "0.544631", "0.5397861", "0.5345061", "0.5319306", "0.5302995", "0.5250394", "0.5229157", "0.52221423", "0.51966923", "0.51758206", "0.513977", "0.5130418", "0.51230186", "0.51097083...
0.0
-1
Make a remote process call to create the dhcp port.
def get_dhcp_port(self, network_id, device_id): return DictModel(self.call(self.context, self.make_msg('get_dhcp_port', network_id=network_id, device_id=device_id, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dhcp_port(self, port):\n LOG.debug(\"create_dhcp_port: %s\", port)\n port['port']['id'] = port['port']['network_id']\n\n # The following MAC address will be assigned to the Linux dummy\n # interface that\n # networking_calico.agent.linux.interface.RoutedInterfaceDriver...
[ "0.6433571", "0.62138724", "0.60005367", "0.59957063", "0.59321785", "0.59223795", "0.5902261", "0.58771735", "0.58316875", "0.5814186", "0.5716689", "0.5710547", "0.5704256", "0.56838495", "0.5680676", "0.5598628", "0.5588033", "0.5549641", "0.553411", "0.55322653", "0.55301...
0.48129672
99