query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Returns a boolean based on whether a compound is in the results_bank.
def in_results(compound): name = decode(compound) return (name in results_bank)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_result(self):\n return len(self.__analysis_items) > 0", "def returnbank(self, number):\n found = False\n for bank in self.__banks:\n if bank.number() == str(number):\n found = True\n if bank.signed_in() and not bank.returned() and bank.out():\...
[ "0.6159643", "0.604946", "0.604946", "0.604946", "0.604946", "0.604946", "0.604946", "0.604946", "0.5748905", "0.57098573", "0.565031", "0.5626413", "0.5608055", "0.5572737", "0.55627126", "0.55351025", "0.5524578", "0.5524361", "0.5505981", "0.5503703", "0.5484099", "0.548...
0.85297555
0
Sorts bank of tested compounds by fitness and returns all tested compounds and the matches to results_bank.
def bank_sorter(bank): keys = np.argsort(bank[:,-1]) for j in range(len(bank)): # sort the paramterized vectors sorted_bank[j,:] = bank[keys[j],:] # call decoder and get symbol symbol_bank.append(decode(sorted_bank[j,0:3])) final_bank = [name for name in symbol_bank if (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort(self):\r\n self.candidates.sort(key=self.sortFitness)\r\n return", "def sorting_by_criteria(self, result):\r\n\t\tresult = sorted(result, key=lambda r: r[0])\r\n\t\tflag = False\r\n\t\tm = result[0][0]\r\n\t\tfor i in range(len(result)):\r\n\t\t\tif (result[i][0] == m): continue\r\n\t\t\tf...
[ "0.6388571", "0.5894608", "0.5641683", "0.5509073", "0.5504837", "0.5406956", "0.5371244", "0.5371244", "0.53352666", "0.5308971", "0.5289217", "0.5256687", "0.5203157", "0.5197841", "0.51945937", "0.5190222", "0.51738715", "0.51638985", "0.51456845", "0.5135054", "0.50837296...
0.7010597
0
Return domain resolving data
def domain_resolve(self, domain): a_result = server.resolve(domain, 'A') mx_result = server.resolve(domain, 'MX') ns_result = server.resolve(domain, 'NS') domain_data = {} domain_data.setdefault('resolving', {'A': a_result}) domain_data['resolving']['MX'] = mx_result ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info(self):\n\n return self.call(method='getDomain', args=[self.domainname])", "def __resolve_domain(self, domain=''):\n _ip = []\n if self.__is_ip_address(domain):\n # print hostname + \" is IP address\"\n _ip.append(domain)\n return _ip\n r = dns...
[ "0.6899921", "0.67502177", "0.65307397", "0.65247995", "0.62917715", "0.6278581", "0.62307304", "0.62253255", "0.62251425", "0.62024367", "0.6178895", "0.6131382", "0.61205953", "0.61032474", "0.6041803", "0.5987019", "0.5986583", "0.5934399", "0.5932087", "0.5931082", "0.592...
0.7850649
0
This method will populate relevant domain data for the report
def populate_domain_data(self, domain): self.domain_resolve(domain) domain_data = server.get_domain_data(domain)['data']['userdata'] self.domain_data[domain] = self.domain_resolve(domain) if domain in self.domain_data.keys(): try: self.domain_data[domain]['d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n if not self._instance:\n self._instance = \\\n self.appresponse.reports.create_instance(self._data_defs)\n\n results = self._instance.get_data()['data_defs']\n\n for i, res in enumerate(results):\n source_name = self._data_defs[...
[ "0.6501202", "0.61003387", "0.60356617", "0.59860444", "0.59097356", "0.5909532", "0.5879609", "0.58599466", "0.5822343", "0.581348", "0.5812627", "0.5800824", "0.5713205", "0.56737435", "0.56517106", "0.5631203", "0.5611418", "0.56093293", "0.5596616", "0.55854404", "0.55687...
0.6134511
1
Returns the retreat point for this drop.
def retreat_point(self) -> Point2: return self._retreat_point
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_point(self):\n return self.point", "def GetPoint(self):\r\n\r\n return self._pointDrag", "def GetDistanceFromDropPoint(self):\n return self.distanceFromDropPoint", "def getPoint(self):\n return self.point", "def getPoint(self):\n return self.point", "def getPoin...
[ "0.6205253", "0.61747456", "0.60841507", "0.60626036", "0.60626036", "0.59564924", "0.5847012", "0.5777757", "0.5642907", "0.56333435", "0.5625281", "0.5600656", "0.55396116", "0.54987967", "0.54749066", "0.5467446", "0.5444632", "0.54279864", "0.5393402", "0.5392938", "0.538...
0.79545134
0
A mock for the PyPI JSON API.
def mock_api(): with open(os.path.join(HERE, 'response.json'), 'r') as fp: webargs_response = fp.read() # A valid package with a proper response responses.add( responses.GET, 'https://pypi.python.org/pypi/webargs/json', body=webargs_response, content_type='application...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_json_spec(self):\n pass", "def test_json() -> Response:\n response = requests.get('https://httpbin.org/json')\n return jsonify(response.json())", "def test_mocked_get_json_format(self):\n c = Client()\n response = c.get(\"/apimock/mocked/mocked_get?format=json\")\n ...
[ "0.6583999", "0.6412735", "0.62196594", "0.62122977", "0.61060745", "0.6100766", "0.6067879", "0.60595685", "0.60207385", "0.60036296", "0.59488505", "0.5924338", "0.59220356", "0.59178627", "0.591409", "0.5899338", "0.5867134", "0.58441156", "0.58416617", "0.5806017", "0.579...
0.6546759
1
Decorator. Use this to transform functions into `ExecutorJob` instances that can submit themselves directly to the executor.
def job(self, fn): if isinstance(self._self, concurrent.futures.ProcessPoolExecutor): raise TypeError( "Can't decorate {}: Executors that use multiprocessing " "don't support decorators".format(fn) ) return ExecutorJob(executor=self, fn=fn)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_as_parameter(f):\n f.job_as_parameter = True\n return f", "def submit(self, func, *args, **kwargs):\n errors = []\n arguments = []\n keyword_arguments = {}\n result = None\n try:\n for arg in args:\n if isinstance(arg, futures.Future) and...
[ "0.6382967", "0.62970304", "0.614269", "0.61273", "0.59183955", "0.5899991", "0.587239", "0.5862351", "0.5825663", "0.5822746", "0.5736169", "0.5711719", "0.5709834", "0.5694107", "0.56936324", "0.56843954", "0.56780016", "0.5670894", "0.5664963", "0.5655577", "0.5645097", ...
0.7136034
0
Print the FBU posteriors in each bin
def printPosteriors(posteriors): for i,p in enumerate(posteriors): print(u" > Bin {0}: {1:.2f} \u00B1 {2:.2f}".format(i,np.mean(p),np.std(p))) # \u00B1 is the same as $\pm$ in unicode return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _printHist(self):\n bins = [0] * self.displayBins\n binSize = self.maxValue / self.displayBins\n displaySamps = self.samples[:]\n displaySamps.sort()\n currLimit = binSize\n binIndex = 0\n partIndex = 0\n while partIndex < self.numParticles:\n ...
[ "0.59057724", "0.5715625", "0.5700542", "0.5684591", "0.5299968", "0.527956", "0.52606434", "0.5242189", "0.52314425", "0.5192294", "0.5187503", "0.51301795", "0.5119507", "0.5117471", "0.5117471", "0.5114441", "0.5089483", "0.50679404", "0.5050347", "0.50184", "0.501502", ...
0.6522777
0
Plot the FBU posteriors
def plotPosteriors(posteriors): for i,p in enumerate(posteriors): plt.hist(p,bins=20,histtype='stepfilled',alpha=0.5, density=True,label='Bin {0}'.format(i)) plt.legend() plt.ylabel("Probability") plt.xlabel("Posterior") return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot_posteriors(self, variants=[]):\n if variants == []:\n variants = list(self.posteriors.keys())\n for variant in variants:\n sns.kdeplot(self.posteriors[variant].get_posterior_sample(),\n shade=True,\n color=self.posteriors[v...
[ "0.65598464", "0.6554029", "0.65262", "0.6520956", "0.63833225", "0.63242656", "0.6303884", "0.6295722", "0.62931997", "0.6190114", "0.61799294", "0.6171929", "0.61223245", "0.60660785", "0.6050307", "0.6047654", "0.6015423", "0.6004264", "0.5959574", "0.59439635", "0.5902507...
0.6646742
0
Draw the FBU trace as a function of step
def plotTrace(trace): for t in trace: plt.plot(range(len(t)),t,alpha=0.5) plt.ylabel("Trace") plt.xlabel("Step") return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace(self, out):\n if self.step == 0:\n out.write(\"# %5s %16s %8s %8s %7s\\n\" \\\n % ('Step', 'Current energy', 'Av shift',\n 'Mx shift', 'Funcs'))\n log = \"%7d %16.5f %8.4f %8.4f %7d\\n\" \\\n % (self.step, self.current_e...
[ "0.65611726", "0.61729395", "0.61729395", "0.61729395", "0.61729395", "0.61729395", "0.61729395", "0.61729395", "0.61729395", "0.61729395", "0.61717606", "0.61343384", "0.61343384", "0.61343384", "0.61343384", "0.61343384", "0.61343384", "0.61343384", "0.61343384", "0.61343384"...
0.6259788
1
Plot the prior and posterior of a nuisance parameter in FBU
def nuisancePriorPosterior(nuis,name): n,bins,patched = plt.hist(nuis,bins=40,alpha=0.5,color='g',lw=0, density=True, histtype='stepfilled') gbins = np.arange(-4,4,0.1) gaus = norm.pdf(gbins,0.,1.) line = plt.plot(gbins,gaus,'r',lw=2) (mm,ss) = norm.fit(nuis) p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_plateau(x,y,p,n,Vdc):\n fig = plt.figure()\n ax = fig.add_subplot(111)\n ax.set_xlabel('Vrf [V]')\n ax.set_ylabel('Current [nA]')\n fig.suptitle('Vdc = '+str(Vdc)+' n = '+str(n), fontsize=24)\n \n plt.plot(x,y,'x',label='Experimental data') \n t = np.linspace(min(x),max(x),1000...
[ "0.61586595", "0.5949154", "0.58637744", "0.5855694", "0.5826239", "0.5820621", "0.5781771", "0.5777543", "0.5696212", "0.56903845", "0.5643705", "0.56324136", "0.56087404", "0.5595404", "0.55904984", "0.5582951", "0.5576029", "0.55661625", "0.5562234", "0.5559114", "0.555722...
0.6401338
0
Plot the response matrix Assume the response matrix is 2d array (truth,reco) dimensions Reco is plotted as the xaxis Make histogram in matplotlib using 'weights' argument to handle the bin content, and dummy values for the x/y
def plotResponseMatrix(resmat,bins=[]): try: shape = resmat.shape except AttributeError: resmat = np.array(resmat) shape = resmat.shape # use data from the histogram as 'weights' # use 'dummy' values for the center of the bin if not bins: nbinsx = shape[1] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotHist(self):\n X = []\n Y = []\n for item in self.hist.items():\n X.append(int(item[0]))\n Y.append(int(item[1]))\n plt.bar(X,Y, align='center')\n plt.xticks([1,2,3,4,5,6,7])\n plt.ylim(0,len(self.responses))\n plt.title(self.text)\n ...
[ "0.64443445", "0.63525134", "0.6231955", "0.60671943", "0.5963688", "0.5885673", "0.5884021", "0.5858955", "0.5849255", "0.5831966", "0.5810196", "0.5789396", "0.57882583", "0.5767254", "0.57629174", "0.5729133", "0.571147", "0.56867903", "0.56853384", "0.56845474", "0.567993...
0.7770726
0
1) Block the Storage 2) Wait for I/O error 3) Wait for interval=sleep_after_io_error before unblocking the storage. This wait interval for 'KILL' must be not less than 80 sec (engine implementation. For other options leave_paused and auto_resume it must not be 80. The default for tests is 10 sec) 4) Unblock the Storage
def block_unblock_storage(request): vms_to_pause = request.node.cls.vms_to_pause sleep_after_io_error = request.getfixturevalue("sleep_after_io_error") results = [] with ThreadPoolExecutor( max_workers=len(conf.RESUME_BEHAVIOR_VMS) ) as executor: for item in vms_to_pause: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait(self):\n conn = None\n try:\n conn = libvirt.open(\"qemu:///system\")\n while True:\n time.sleep(10)\n try:\n state = conn.lookupByName(self.domain).info()[0]\n except (libvirt.libvirtError, TypeError, Ind...
[ "0.5847353", "0.5608128", "0.5573966", "0.5535189", "0.5535189", "0.54685885", "0.5388311", "0.5346292", "0.53449816", "0.53239393", "0.5313974", "0.53107005", "0.528272", "0.5263094", "0.52355313", "0.52351785", "0.5227347", "0.52214926", "0.5217583", "0.5216832", "0.5207658...
0.71310824
0
Get a queryset filtered by perms for the user.
def for_user(self, user, perms, any_perm=False, with_superuser=False): if not has_guardian: return self.all() perms = [perms] if isinstance(perms, str) else perms return get_objects_for_user( user, perms, klass=self.model, any_perm=an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwargs).filter(user=self.request.user)\n return qs", "def get_queryset(self, request):\n qs = super().get_queryset(request)\n return qs.filter(user=request.user)", "def get_queryset(self):\n return ...
[ "0.67729986", "0.64800894", "0.6447097", "0.6425419", "0.6320951", "0.6320826", "0.6319103", "0.62921715", "0.62558794", "0.61816895", "0.61814433", "0.6141446", "0.6141446", "0.6141446", "0.61404645", "0.6115105", "0.61137193", "0.6113468", "0.61040956", "0.6076187", "0.6071...
0.6972515
0
Abstraction of the functionality for parsing each project/activity listed in an XML file a branch of the XML tree representing a single project country code for the country where the project is taking place object containing all country data data for all the sectors
def get_activities(iati_activity, code, countries, sector_data): project_title = iati_activity.find('title').text # check to make sure all projects have same prefix raw_project_id = (iati_activity.find('iati-identifier').text) project_id = parse_iati_id(raw_project_id) raw_project_info = iati_acti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseProject(self):\r\n self.project['name'] = self.root.configuration.name\r\n self.project['chip'] = ''\r\n\r\n #TODO: parse into tree structure\r\n self.project['srcs'] = []\r\n self.searchGroups(self.root, self.project['srcs'])\r\n\r\n self.project['defs'] = []\r\n...
[ "0.621247", "0.5758202", "0.5517565", "0.5339518", "0.53320867", "0.5331592", "0.5267115", "0.525882", "0.5250608", "0.5243575", "0.5235694", "0.52301383", "0.51239645", "0.5104126", "0.50908446", "0.50882214", "0.50570786", "0.50352675", "0.5034881", "0.50190586", "0.5014190...
0.6184777
1
Access the text of the node in the RunInfo.xml file and returns an arrow date object.
def _get_rundate_obj(self): rundate = self.root[0].find('Date').text # possible formats found in RunInfo.xml: # "170712" (YYMMDD) # "20170712" (YYYYMMDD) # "6/27/2018 4:59:20 PM" (M/D/YYYY h:mm:ss A) # "2021-04-21T20:48:39Z" (YYYY-MM-DDTHH:mm:ssZ) [seen on NextSeq...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ElaborateDate():\n return str(root.find('elaborado').text) # root.find('elaborado') returns the direct child 'elaborado' of root. ...\n # ... An equivalent way to get the same result is ( root[1].text ), where ...\n # ... root[1] represents 'elaborado' tag and it's the 2d direct child of root.", ...
[ "0.62936455", "0.56848335", "0.5448578", "0.5261788", "0.52612877", "0.52592343", "0.5223165", "0.52167124", "0.5207833", "0.51716375", "0.51554316", "0.51197284", "0.5117094", "0.5117094", "0.50877833", "0.50727427", "0.5062735", "0.5052241", "0.50412315", "0.5032912", "0.50...
0.6744174
0
Return machine name and lane count based on tile count Machine names aim to conform to the NCBI SRA controlled
def machine_model_from_tile_count(self): tc = self.tile_count() machine=None if tc == 2: log.info("Detected %s tiles, interpreting as MiSeq nano run.",tc) machine = {"machine":"Illumina MiSeq","lane_count":1} elif tc == 8: log.info("Detected %s tiles,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_virtual_machine_count_metrics1(self):\n pass", "def getThreadCountForSLRUMNode(hostname, errStream):\n qhcmd = [\"sinfo\",\"-n\", hostname, \"-o\", '\"%15N %10c\"']\n process=subprocess.Popen(qhcmd,stdout=subprocess.PIPE)\n sinfoCPUsRE = re.compile(r'^\\S+\\s+(\\d+)')\n qhout=\"\"...
[ "0.5979236", "0.5949881", "0.59250945", "0.5435278", "0.5428305", "0.538992", "0.5349115", "0.530328", "0.52822465", "0.52544695", "0.5212402", "0.5209256", "0.5160058", "0.51565456", "0.5141061", "0.5125356", "0.51197004", "0.51159704", "0.5112599", "0.5092367", "0.50912243"...
0.69176394
0
Convert a video to a set of images and save them.
def video2photos(video_path, save_dir): count = 0 video_name = video_path.split('/')[-1][:-4] vidcap = cv2.VideoCapture(video_path) success, image = vidcap.read() while success: cv2.imwrite('%s%s_frame%d.jpg'%(save_dir, video_name, count), image) success, image = vidcap.read() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imagesFromVideo(vid_path, out_path):\n if not os.path.exists(vid_path):\n raise ValueError(\"Input video file %s does not exist.\" % vid_path)\n\n cap = skvideo.io.FFmpegReader(vid_path)\n frame_nr, _, _, _ = cap.getShape()\n\n with tqdm.tqdm(total=frame_nr) as pbar:\n for i, frame in...
[ "0.7416166", "0.73561096", "0.7354831", "0.7024521", "0.7021022", "0.6957531", "0.6665582", "0.6657185", "0.65774", "0.64420676", "0.6340335", "0.6240892", "0.6226338", "0.62249947", "0.62209827", "0.6192568", "0.61916894", "0.61712766", "0.6152751", "0.61338866", "0.6116236"...
0.756117
0
Get the list of video paths in a certain directory.
def load_video_paths(dir): VIDEO_EXTENSIONS = ['.mov', '.MOV', '.mp4'] video_paths = [] # traverse directory to obtain only paths to videos for dir_name, _, paths in sorted(os.walk(os.path.expanduser(dir))): for path in paths: if any(path.endswith(extensions) for extensions in VIDEO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_videos_in_directory(directory: str):\n\n all_files_and_folders = os.listdir(directory)\n\n only_videos = []\n for file in all_files_and_folders:\n if is_video(file):\n only_videos.append(file)\n ...\n\n return only_videos", "def get_videos_of_folder(folder):\n\n ...
[ "0.7474624", "0.74389285", "0.7075196", "0.70026755", "0.69016343", "0.67232525", "0.6663334", "0.66573036", "0.66242665", "0.6568508", "0.6524587", "0.65234184", "0.64984256", "0.6490416", "0.6458124", "0.64473474", "0.6398316", "0.6362526", "0.63353693", "0.6327331", "0.628...
0.7889351
0
Given a descriptor and an owner object this attempts to resolve an already existing instance that matches the descriptor and return it, or alternatively create a new instance and persist it with the matching scope if such a scope exists.
def resolve_or_ensure_dependency(descr, owner, box_init=False): if isinstance(owner, DependencyDescriptor): raise RuntimeError('Dependencies cannot be mounted on dependency ' 'descriptors.') elif not isinstance(owner, DependencyMount): raise RuntimeError('Dependencies ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_or_create_with_slug(owner, instance):\n try:\n return Tag.objects.get(owner=owner, slug=makeslug(instance.name))\n except Tag.DoesNotExist:\n instance.owner = owner\n instance.save()\n return instance", "def search(instance, owner, descriptor):\n ...
[ "0.5236216", "0.51030356", "0.4899222", "0.4847763", "0.48213053", "0.4770009", "0.47611004", "0.47405356", "0.47288707", "0.4701671", "0.467685", "0.4667519", "0.46602032", "0.46588966", "0.46385717", "0.46377766", "0.4568738", "0.4562586", "0.45443928", "0.45189145", "0.447...
0.6121742
0
get_all_names(exclude_values=None) Retrieve a collection of the names of all values.
def get_all_names(cls, exclude_values: Iterator['CommonGameTagCategory'] = None) -> Tuple[str]: name_list: Tuple[str] = tuple([value.name for value in cls.get_all(exclude_values=exclude_values)]) return name_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_names(cls, exclude_values: Iterator['CommonBusinessAdvertisingType'] = None) -> Tuple[str]:\n name_list: Tuple[str] = tuple([value.name for value in cls.get_all(exclude_values=exclude_values)])\n return name_list", "def get_all_names(cls, exclude_values: Iterator['CommonBucksType'] = No...
[ "0.80881196", "0.7989676", "0.6999588", "0.6810667", "0.675643", "0.62676376", "0.62259984", "0.6196865", "0.6072567", "0.60370296", "0.6003248", "0.59762275", "0.59489065", "0.59466296", "0.59466296", "0.5857917", "0.58561236", "0.5852346", "0.5832665", "0.5825008", "0.58055...
0.80437225
1
get_comma_separated_names_string(exclude_values=None) Create a string containing all names of all values, separated by a comma.
def get_comma_separated_names_string(cls, exclude_values: Iterator['CommonGameTagCategory'] = None) -> str: return ', '.join(cls.get_all_names(exclude_values=exclude_values))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_comma_separated_names_string(cls, exclude_values: Iterator['CommonBusinessAdvertisingType'] = None) -> str:\n return ', '.join(cls.get_all_names(exclude_values=exclude_values))", "def get_comma_separated_names_string(cls, exclude_values: Iterator['CommonBucksType'] = None) -> str:\n return ...
[ "0.87692165", "0.8762308", "0.6980476", "0.69163024", "0.6891439", "0.5498651", "0.54714996", "0.52446216", "0.524454", "0.5047359", "0.5044583", "0.50196385", "0.49636444", "0.4960123", "0.4954984", "0.49393448", "0.49071342", "0.4903188", "0.48932296", "0.48823506", "0.4851...
0.883508
0
convert_to_vanilla(value) Convert a value into the vanilla TagCategory enum.
def convert_to_vanilla(value: 'CommonGameTagCategory') -> Union[TagCategory, None]: if value is None or value == CommonGameTagCategory.INVALID: return TagCategory.INVALID if isinstance(value, TagCategory): return value mapping = dict() if hasattr(TagCategory, 'Moo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_from_vanilla(value: Union[int, TagCategory]) -> 'CommonGameTagCategory':\n if value is None or value == TagCategory.INVALID:\n return CommonGameTagCategory.INVALID\n if isinstance(value, CommonGameTagCategory):\n return value\n mapping = dict()\n if has...
[ "0.82870394", "0.6474124", "0.6387124", "0.6379293", "0.63223875", "0.6080958", "0.59973675", "0.55496967", "0.54486305", "0.5162874", "0.5106951", "0.50256234", "0.5015164", "0.50019777", "0.49626517", "0.49201912", "0.48852012", "0.48777172", "0.4861175", "0.48610252", "0.4...
0.81581044
1
convert_from_vanilla(value) Convert a value into a CommonTagCategory enum.
def convert_from_vanilla(value: Union[int, TagCategory]) -> 'CommonGameTagCategory': if value is None or value == TagCategory.INVALID: return CommonGameTagCategory.INVALID if isinstance(value, CommonGameTagCategory): return value mapping = dict() if hasattr(TagCat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_vanilla(value: 'CommonGameTagCategory') -> Union[TagCategory, None]:\n if value is None or value == CommonGameTagCategory.INVALID:\n return TagCategory.INVALID\n if isinstance(value, TagCategory):\n return value\n mapping = dict()\n if hasattr(TagCat...
[ "0.82687", "0.693499", "0.68909585", "0.679486", "0.6744596", "0.6589648", "0.649274", "0.5615093", "0.55661035", "0.52417326", "0.5211465", "0.516138", "0.5094616", "0.5071677", "0.49403134", "0.49266583", "0.489508", "0.48770243", "0.4857484", "0.4838501", "0.4813751", "0...
0.85750157
0
Returns the path to the main directory of a dataset.
def dataset_path(dataset, work_dir=consts.WORK_DIR): return join_path(work_dir, consts.DATA_DIR, dataset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_path(cls):\n basepath = os.path.dirname(__file__)\n filepath = os.path.abspath(\n os.path.join(basepath, \"..\", \"datasets\", get_env('DATA_FILENAME')))\n return filepath", "def dataset_dir(self):\n return self._dataset_dir", "def get_dataset_path(dataset: st...
[ "0.8022111", "0.793983", "0.7724553", "0.760623", "0.743435", "0.7395934", "0.7334338", "0.7223761", "0.7215189", "0.7193677", "0.717177", "0.71455944", "0.7145291", "0.71405476", "0.7116877", "0.7081616", "0.7075519", "0.7021476", "0.6978904", "0.6968586", "0.6968586", "0....
0.82498145
0
Returns the path to the outputs directory of a dataset.
def out_path(dataset, work_dir=consts.WORK_DIR): return join_path(dataset_path(dataset, work_dir), consts.OUTPUT_DIR)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_path(self):\r\n return '%s/%s' % (os.path.abspath(os.path.dirname(__file__) + 'outputs'),\r\n self.identifier)", "def get_output_path():\n return os.getcwd() + \"/output/\"", "def outputdir():\n return __OUTPUT_DIR__", "def get_data_dir() -> str:\n os.maked...
[ "0.7563762", "0.7531817", "0.74276286", "0.73197514", "0.72906774", "0.7282567", "0.7196323", "0.7160397", "0.71223736", "0.71149784", "0.7091527", "0.70784944", "0.706791", "0.7038557", "0.7038145", "0.6964772", "0.68880755", "0.68873173", "0.6880297", "0.68795675", "0.68748...
0.8259348
0
Returns the path to the indices directory of a dataset.
def indexes_path(dataset, work_dir=consts.WORK_DIR): return join_path(dataset_path(dataset, work_dir), consts.INDEXES_DIR)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dataset_path(dataset, work_dir=consts.WORK_DIR):\r\n return join_path(work_dir, consts.DATA_DIR, dataset)", "def dataset_dir(self):\n return self._dataset_dir", "def out_path(dataset, work_dir=consts.WORK_DIR):\r\n return join_path(dataset_path(dataset, work_dir), consts.OUTPUT_DIR)", "def i...
[ "0.69170535", "0.6482714", "0.635061", "0.6305727", "0.6247156", "0.62084097", "0.61789423", "0.6034254", "0.60136056", "0.59544593", "0.5881047", "0.5877882", "0.5877271", "0.5871797", "0.58517206", "0.58000183", "0.5799459", "0.57658565", "0.5761805", "0.5743858", "0.572568...
0.8147882
0
Returns the path to the directory where all the tools are located.
def get_tools_path(work_dir=consts.WORK_DIR): return join_path(work_dir, consts.TOOLS_DIR)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_helper_path(tool):\n return os.path.join(TOOLS_DIR, tool)", "def GetPackageDirectory():\n return os.path.dirname(__file__)", "def cvd_tools_path(self):\n return self._cvd_tools_path", "def find_path():\n __dir_path__ = os.path.dirname(os.path.realpath(__file__))\n return __dir_path...
[ "0.7704155", "0.7049724", "0.70227116", "0.6932044", "0.67958343", "0.6794986", "0.676562", "0.66989625", "0.6693114", "0.6683765", "0.6657846", "0.66452956", "0.6643246", "0.6635367", "0.66296184", "0.660193", "0.660193", "0.6600785", "0.659935", "0.6597177", "0.6570359", ...
0.8339719
0
Joins the args to a single CSV line (with a line break at the end).
def to_csv_line(*args): return ','.join([str(value) for value in args]) + '\n'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def concatena(*args):\n linea = ''\n for l in args:\n linea += str(l if l else '')\n return linea", "def csv_line(input_list):\n good_strings = [csv_friendly_string(x) for x in input_list]\n return string.join(good_strings, \",\") + \"\\n\"", "def write_csv(data, arg2, arg3):\n\n with ...
[ "0.672392", "0.62428284", "0.6097496", "0.60912585", "0.5999718", "0.59968615", "0.59912103", "0.59868705", "0.5961727", "0.5890047", "0.577448", "0.5761129", "0.5677031", "0.5672738", "0.56325984", "0.5613758", "0.5602568", "0.55791754", "0.5559343", "0.5550203", "0.55404735...
0.84551895
0
Extracts the list of values from a CSV line.
def from_csv_line(line): return line.strip().split(',')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values(line):\n return [v.strip() or None for v in text(line).split(',')]", "def parse_line(line):\n vals = []\n pos = comma = openq = closeq = 0\n while True:\n comma = line.find(',', pos)\n openq = line.find('\"', pos)\n if comma < 1:\n vals.append(line[pos:])\n ...
[ "0.76018417", "0.7304956", "0.72488254", "0.70957273", "0.67893904", "0.6769218", "0.6720401", "0.6704532", "0.6667913", "0.6525911", "0.65242", "0.6433637", "0.63534075", "0.6337114", "0.6337114", "0.6328988", "0.6282633", "0.62492156", "0.62321717", "0.6226981", "0.6226981"...
0.82795817
0
Retrieves a Tool instance based on a prefix to the tool's name.
def get_tool(prefix): candidates = [tool for tool in TOOLS if tool.startswith(prefix.lower())] if not candidates: print("No tools match prefix %s. Available tools are: %s" % (prefix, TOOLS.keys())) return None if len(candidates) > 1: print("Ambiguous prefix %s (matches %s)" % (...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tool(cls, tool_name):\n if cls.tool_dict is None:\n # Init the module_dict once.\n cls.tool_dict = {tool.name: tool for tool in cls.get_pb().tools}\n return cls.tool_dict.get(tool_name)", "def build_tool(self, doc, entity):\n match = self.tool_re.match(entity)\n...
[ "0.6486651", "0.64573145", "0.64130616", "0.6234922", "0.61162", "0.60630673", "0.56569403", "0.5580769", "0.5492873", "0.547718", "0.5466573", "0.543575", "0.5384701", "0.5372936", "0.5354391", "0.5328934", "0.53236675", "0.53223693", "0.52688366", "0.5220492", "0.5189239", ...
0.7602962
0
Set encoding in accordance with the terminal
def set_terminal_encoding(encoding='utf_8'): sys.stdin = codecs.getreader(encoding)(sys.stdin) sys.stdout = codecs.getwriter(encoding)(sys.stdout) sys.stderr = codecs.getwriter(encoding)(sys.stderr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_encoding(cls, encoding):\n import sys\n default_stdout = sys.stdout\n default_stderr = sys.stderr\n #importlib.reload(sys)\n #sys.setdefaultencoding(encoding)\n sys.stdout = default_stdout\n sys.stderr = default_stderr", "def set_encoding(self, encoding):\...
[ "0.7753078", "0.7431094", "0.7264491", "0.7111574", "0.68433654", "0.68001443", "0.67838854", "0.66772336", "0.66283727", "0.6621308", "0.6615054", "0.65762883", "0.6450226", "0.6348208", "0.628847", "0.6257959", "0.6215196", "0.6088833", "0.6066494", "0.6041192", "0.6005853"...
0.8193208
0
CUDA version of the calc X function Find the ration of the active layer to the protective layer minus 1
def calc_x(x, ALD,PL): ## jit works row, col = cuda.grid(2) if row < ALD.shape[0] and col < ALD.shape[1]: if PL[row,col] != 0 : x[row,col] = (ALD[row,col] / PL[row,col]) - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def offset_to_uvd(self, x):\n self.batch_size = x.shape[0]\n self.W = x.shape[2]\n self.H = x.shape[3] \n self.D = 5\n self.grid_size = self.W*self.H*self.D\n \n grid_linear = x.reshape(self.batch_size, 64, -1)\n\n index = torch.from_numpy(np.asarray(n...
[ "0.6363954", "0.6331525", "0.6094874", "0.59222585", "0.58650947", "0.5860942", "0.5820519", "0.5804815", "0.57717425", "0.572791", "0.5713983", "0.5708005", "0.5705112", "0.5674194", "0.56690884", "0.5661184", "0.565243", "0.5651396", "0.5645875", "0.56375295", "0.5633886", ...
0.6823909
0
CUDA sigmoid 2 poi calculation function POI = K / C + A x ^ B
def calc_new_sig2_poi(new_poi, params, x, above_idx): K_a = 0 C_a = 1 A_a = 2 B_a = 3 K_b = 4 C_b = 5 A_b = 6 B_b = 7 row, col = cuda.grid(2) if row < x.shape[0] and col < x.shape[1]: if above_idx[row,col] == True: new_poi[row, col] = params[K_a] / \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _lambda(xi):#xi=xis; xi=Phi.dot(w); xi = 0\n div0 = np.divide(1, (2*xi),where=xi!=0)\n return (div0 * (sigmoid(xi)-(1/2)))", "def sigmoid(z):\n \n return 1 / (1 + np.exp(-z))#your code here", "def sigmoid(z):\n return 1 / (1 + e ** -z)", "def calc_new_hill_poi(new_poi, params, x, above_id...
[ "0.6254849", "0.6156578", "0.60991484", "0.60180855", "0.597135", "0.5947934", "0.5933495", "0.5902696", "0.58800155", "0.5854712", "0.58530974", "0.5828795", "0.58283114", "0.58182395", "0.58182395", "0.58182395", "0.5814351", "0.58121985", "0.5807147", "0.5797886", "0.57957...
0.6284754
0
CUDA hill poi calculation function POI = (B(x^n))/(1+(x^n))
def calc_new_hill_poi(new_poi, params, x, above_idx): B_a = 0 N_a = 1 B_b = 2 N_b = 3 row, col = cuda.grid(2) if row < x.shape[0] and col < x.shape[1]: if above_idx[row,col] == True: new_poi[row, col] = \ params[B_a] * (x[row, col] ** params[N_a]) \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_x(x, ALD,PL): ## jit works\n\n row, col = cuda.grid(2)\n if row < ALD.shape[0] and col < ALD.shape[1]:\n if PL[row,col] != 0 :\n x[row,col] = (ALD[row,col] / PL[row,col]) - 1", "def _precompute_xl(self, p: int) -> List[int]:\n res = [1]\n val = 1\n for _ in r...
[ "0.63826853", "0.6085892", "0.5960288", "0.5954528", "0.593742", "0.59004676", "0.587008", "0.5806953", "0.57731485", "0.5754985", "0.57356864", "0.5688362", "0.56705403", "0.5658432", "0.56550384", "0.5648116", "0.5632966", "0.56209254", "0.55941284", "0.5585483", "0.5582952...
0.6532948
0
CUDA linear poi calculation function POI = a + (b x )
def calc_new_linear_poi(new_poi, params, x, above_idx): a_a = 0 b_a = 1 a_b = 2 b_b = 3 row, col = cuda.grid(2) if row < x.shape[0] and col < x.shape[1]: if above_idx[row,col] == True: new_poi[row, col] = params[a_a] + (params[b_a] + x[row, col]) else: n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_new_hill_poi(new_poi, params, x, above_idx):\n B_a = 0\n N_a = 1\n B_b = 2\n N_b = 3\n \n row, col = cuda.grid(2)\n if row < x.shape[0] and col < x.shape[1]:\n if above_idx[row,col] == True: \n new_poi[row, col] = \\\n params[B_a] * (x[row, col] ** par...
[ "0.6608198", "0.64731747", "0.63503915", "0.6268177", "0.62193304", "0.5753673", "0.5680785", "0.5593075", "0.5573657", "0.55683506", "0.5546391", "0.55432135", "0.5528417", "0.55260503", "0.5483437", "0.5467479", "0.54541206", "0.5423997", "0.5421107", "0.54113495", "0.54036...
0.71463907
0
CUDA update POI function where cell in in current_cell_mask poi[n] = poi[n1] + new
def update_poi (POIn, POInm1, new, current_cell_mask): row, col = cuda.grid(2) if row < POIn.shape[0] and col < POIn.shape[1]: POIn[row,col] = 0 if current_cell_mask[row,col] == True: POIn[row,col] = POInm1[row,col] + new[row,col]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_new_linear_poi(new_poi, params, x, above_idx):\n a_a = 0\n b_a = 1\n a_b = 2\n b_b = 3\n\n row, col = cuda.grid(2)\n if row < x.shape[0] and col < x.shape[1]:\n if above_idx[row,col] == True: \n new_poi[row, col] = params[a_a] + (params[b_a] + x[row, col])\n else...
[ "0.63701636", "0.62619597", "0.6117122", "0.593161", "0.58100563", "0.57049567", "0.56974447", "0.5571888", "0.55289775", "0.55237937", "0.5508575", "0.54947346", "0.54243577", "0.538219", "0.53804606", "0.5349243", "0.53312445", "0.5319509", "0.5313948", "0.53112155", "0.526...
0.84210634
0
CUDA calc change. Calculates cohort the change for each cell.
def calc_change (change_amnts, rate_of_transition, from_cohort, present): row, col = cuda.grid(2) if row < from_cohort.shape[0] and col < from_cohort.shape[1]: change_amnts[row,col] = \ rate_of_transition[row,col] * from_cohort[row,col] if present[row, col] and change_amnts[row, co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_concentrations_batch(self): \n #--- Update the cell concentrations ---\n # dX_i/dt = mu_i*(1-rmp/100)*X_i*(1 - sum(i,(1-rmp/100)X(i))/carrying_capacity) or \n # (X_i(t+dt) - X_i(t))/dt = mu*(1-rmp/100)*X_i(t)*(1 - sum(i,(1-rmp/100)*X_i(t))/carrying_capacity)\n # where rmp is...
[ "0.56052387", "0.5582978", "0.54880106", "0.5454546", "0.544207", "0.54047835", "0.53826034", "0.53276867", "0.53138334", "0.5265648", "0.5238402", "0.52302736", "0.5151833", "0.5149516", "0.5089221", "0.5061779", "0.5051967", "0.5027821", "0.50277597", "0.50079554", "0.49970...
0.7268781
0
This checks for any area in the cohort 'name' that should be transitioned to the next cohort, and then transitions the area. Using Cuda sub functions.
def transition(name, year, grids, control): ## SETUP ------------------------------------------------- cc = control['cohorts'][name + '_Control'] from_cohort_a0 = grids.area[name + '--0', year] from_cohort = grids.area[name, year] transitions_to = cc['transitions_to'] to_cohort_a0 = grids.area[t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_change (change_amnts, rate_of_transition, from_cohort, present):\n row, col = cuda.grid(2)\n\n if row < from_cohort.shape[0] and col < from_cohort.shape[1]:\n change_amnts[row,col] = \\\n rate_of_transition[row,col] * from_cohort[row,col] \n if present[row, col] and change_a...
[ "0.51401657", "0.49740306", "0.49308982", "0.47320154", "0.47157001", "0.46848956", "0.46142554", "0.4563574", "0.453027", "0.4519545", "0.44052562", "0.439295", "0.43918347", "0.43602103", "0.43419707", "0.4335598", "0.43300962", "0.43269694", "0.4321539", "0.43087542", "0.4...
0.5972531
0
Load config data from the given dictionary
def loadFromDict(self, d): self._data = d self._doDefaults()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_dict(self, dict_):\n policies = dict_.get('policies', None)\n super(Config, self).load_from_dict(\n {k: v for k, v in six.iteritems(dict_) if k != 'policies'})\n if policies is not None:\n self.policies = policies", "def _load_dict(self, cfg_dict): # type...
[ "0.70741373", "0.6807803", "0.66922706", "0.66145873", "0.6596828", "0.6590065", "0.6578988", "0.6530456", "0.6519345", "0.64975446", "0.6466328", "0.64141494", "0.63720274", "0.6333778", "0.6330049", "0.63075095", "0.62964666", "0.62916553", "0.62674767", "0.6256244", "0.624...
0.69155014
1
Write config data to disk. If this config object already has a path, it will write to it. If it doesn't, one must be passed during this call.
def write(self, path=None): if not self._path and not path: raise ConfigException("no config path given") if path: self._path = path if "~" in self._path: self._path = os.path.expanduser(self._path) f = open(self._path, "w") f.write(json.dum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, path):\n with open(path, \"w\") as fh_:\n fh_.write(self.config())", "def write(self, path):\n with open(path, \"w\") as fh_:\n fh_.write(self.config())", "def write(self, config_path=CONFIG_PATH):\n\n with open(self.full_path(config_path), 'w') as con...
[ "0.7548781", "0.7548781", "0.75079894", "0.7281511", "0.71883273", "0.7100847", "0.704911", "0.7036829", "0.7036239", "0.7033129", "0.69540733", "0.69481", "0.6907595", "0.6875716", "0.68339187", "0.6778976", "0.67623246", "0.67601097", "0.67335343", "0.6647167", "0.6617381",...
0.8039303
0
Use the given API key config specified by `keyID` during subsequent API calls
def useKeyID(self, keyID): if keyID not in self._data["keys"]: raise ConfigException("keyID does not exist: %s" % keyID) self._keyID = keyID
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_api_key(new_api_key):\n global api_key\n api_key = new_api_key", "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def SetAPIKey(self, api_key):\n self._api_key = api_key", "def update_key(self, key):\n self._api_key = key", "def api_key(self, api_key):\n\n self....
[ "0.7007791", "0.6857665", "0.6857665", "0.67050457", "0.65302604", "0.6447463", "0.64085895", "0.6387832", "0.6359355", "0.63579786", "0.6354722", "0.63433", "0.6312342", "0.6309244", "0.6299176", "0.6263985", "0.6216683", "0.6193545", "0.6170056", "0.61216277", "0.6082163", ...
0.7160212
0
Retrieve the current keyID in use.
def getCurrentKeyID(self): return self._keyID
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_id(self):\n return self._key_id", "def get_key_id(self):", "def key_id(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"key_id\")", "def get_key(self) -> int:\n return self.key", "def get_key(self) -> int:\n return self.__key", "def key_id(self) -> Optional[pul...
[ "0.8174162", "0.7999906", "0.78918487", "0.7890347", "0.7788469", "0.7662939", "0.763362", "0.763362", "0.75873655", "0.7487337", "0.7483511", "0.742846", "0.7422265", "0.7414743", "0.7414743", "0.7414743", "0.7414743", "0.7334044", "0.73206645", "0.7295978", "0.72735643", ...
0.8631672
0
Get key configuration specified by `keyID`, or current keyID.
def getKeyConfig(self, keyID=None): k = keyID if keyID is not None else self._keyID if not k or k not in self._data["keys"]: raise ConfigException("request key does not exist: %s" % k) return self._data["keys"][k]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAPIKey(self, keyID=None):\n kcfg = self.getKeyConfig(keyID)\n\n if \"key\" not in kcfg:\n raise ConfigException(\"invalid config: missing api key\")\n\n return kcfg[\"key\"]", "def getKey( self, key ):\n if key in self.conf:\n return self.conf[key]\n ...
[ "0.70311964", "0.66468763", "0.6629625", "0.6621125", "0.6307755", "0.6290675", "0.6255978", "0.6223715", "0.6183983", "0.6129322", "0.6119", "0.60520715", "0.604946", "0.6008863", "0.60035104", "0.5976387", "0.5941135", "0.5801539", "0.5795333", "0.57267535", "0.5687694", ...
0.7829595
0
Determine if a key config is write locked.
def isKeyWriteLocked(self, keyID=None): kcfg = self.getKeyConfig(keyID) return "writeLock" in kcfg and kcfg["writeLock"] is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_locked(self):\n return bool(int(self._fp(self.F_LOCKED).read()))", "def is_unlocked(self):\r\n return self._lock.is_unlocked()", "def is_unlocked(self):\r\n return self._lock_fd is None", "def is_locked(self) -> bool | None:\n return self.instrument.is_locked", "def is_locked(sel...
[ "0.67807084", "0.6750857", "0.67123634", "0.65514684", "0.64833754", "0.6476519", "0.64693725", "0.6463783", "0.6404972", "0.6403845", "0.64003277", "0.6388595", "0.6378683", "0.6371364", "0.6361959", "0.6347338", "0.63171285", "0.62596416", "0.62367374", "0.62320876", "0.620...
0.81333876
0
Retrieve the NS1 API Key for the given keyID
def getAPIKey(self, keyID=None): kcfg = self.getKeyConfig(keyID) if "key" not in kcfg: raise ConfigException("invalid config: missing api key") return kcfg["key"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_key(api_key):\n api.get(api_key)", "def get_api_key(self):\r\n url = '{0}/{1}'.format(self.get_url(), 'api_key')\r\n\r\n return http.Request('GET', url), parsers.parse_json", "def get_apikey_from_keyring(platform_id='public', # type: str\n ...
[ "0.69642043", "0.68517745", "0.6625591", "0.66048187", "0.64791757", "0.6457141", "0.63021", "0.627811", "0.62074715", "0.61611676", "0.614123", "0.6093965", "0.60805523", "0.5981537", "0.5981537", "0.5981537", "0.5981537", "0.5967801", "0.59617597", "0.59499335", "0.59468013...
0.70755905
0
Trigger a Pushcut notification.
def trigger_pushcut(notification: str, data=None) -> int: headers = {"API-Key": os.environ["PUSHCUT_API_TOKEN"]} url = f"https://api.pushcut.io/v1/notifications/{urllib.parse.quote(notification)}" return requests.post(url, json=data, headers=headers).status_code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_notification (event):\n Publisher.sendMessage (event)", "def execute(self):\n return LOGGER.info(f\"{datetime.datetime.now()} - Sending notification in Slack\")", "def Trigger(self):\n\t\tpayload = { \"Arg1\": self.href }\n\t\treturn self._execute('trigger', payload=payload, response_object=No...
[ "0.63674605", "0.6217406", "0.6209962", "0.6106195", "0.6082461", "0.5937042", "0.5905942", "0.57575047", "0.5751072", "0.5742639", "0.5710641", "0.5670716", "0.56423235", "0.5606163", "0.55936605", "0.55522496", "0.54980206", "0.54980206", "0.54905194", "0.5487692", "0.54834...
0.7434513
0
Parses a LUT file
def _parse_LUT(self): with open(self._filepath, 'r') as file: for line in file: line = line.strip() if line.startswith('TITLE'): self._title = line[len('TITLE'):].strip() if self._title.startswith('"'): s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(self, infile):\r\n raise NotImplementedError()", "def parse_trflp(lines):\r\n\r\n sample_ids = []\r\n otu_ids = []\r\n data = []\r\n non_alphanum_mask = re.compile('[^\\w|^\\t]')\r\n # not sure why the above regex doesn't cover the following regex...\r\n dash_space_mask = re.compil...
[ "0.62708634", "0.61336213", "0.61090523", "0.59860456", "0.58890086", "0.5881114", "0.58517784", "0.58419526", "0.5787055", "0.57652414", "0.57475245", "0.57359177", "0.57068384", "0.5706627", "0.56573254", "0.56486183", "0.56470084", "0.56431055", "0.5639411", "0.56375515", ...
0.7670758
0
Six lines per peak 1,1,2,99,1,2,'Jurgen','20HG1|20HN' ^ assignment info 2.340,0.050,0.041,9.049,0.026,0.026,2.000 ^ Chemical shift 1 ^ Chemical shift 2 26 0 0.0000E+00,8.0715E+06 ^ peak volume 20,5,20,1
def readPeakList(self, fn, status='keep'): nTmessage("Reading: %s" % fn) txt = readTextFromFile(fn) _path,name,_ext = nTpath( fn ) peakList = PeakList( name=name, status=status ) splitLineList = txt.splitlines() # Init here after some content is added; can't be done in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectrum_parser():\n from tools import file_importer, file_outporter\n from random import random\n # from math import log10\n \n print(\"this is spectrum parser\")\n \n relPath = \"bob/processed/OST-24-05-2017_combined.csv\"\n outPath = \"bob/processed/OST-24-05-2017_combined_no0_spectrum.csv\"\n inpF...
[ "0.5926682", "0.58446", "0.56718", "0.56148905", "0.5499841", "0.5489818", "0.54775524", "0.5419867", "0.5397305", "0.53897446", "0.53651804", "0.5363732", "0.5353451", "0.5342842", "0.53354234", "0.5311557", "0.5293222", "0.52828187", "0.5258526", "0.5253045", "0.5250882", ...
0.59452105
0
Tests the mutaiton, when a custom function is provided
def test_mut_customFunc(self): def spec_func(): a = np.random.randint(0,5) while a == 1: a = np.random.randint(0,5) return a domain = {0:{'min':0,'max':5},1:{'min':-5,'max':5},2:{'func':spec_func}} sol = np.array([0,0,0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def c_test_mutate_function(self, function):\r\n return 1", "def istest(func):\n func.__test__ = True\n return func", "def test_function(arg):\n return arg * 2", "def test_function(arg_1):\n return arg_1 * 2", "def dummy_fn(self, *args, **kwargs):", "def test_that_original_func_saved():...
[ "0.7345887", "0.6622086", "0.6597295", "0.64178073", "0.62403595", "0.6222571", "0.6146261", "0.61035746", "0.60930216", "0.60868895", "0.6059464", "0.6048569", "0.602646", "0.5993764", "0.59784234", "0.59322274", "0.5904292", "0.5904258", "0.5896631", "0.5892162", "0.5868061...
0.7054692
1
Test the recombination and the hot_regions provided
def test_recomb(self): sol1, sol2 = [0,0,0,0],[1,1,1,1] hot_regions = [0,0,0,1] ##NOTE: sum(hot_regions) shouls always be 1 rec_events = 1 sol = list(d.recombine(sol1,sol2,rec_events,hot_regions)) print(f"recomb sol: {sol}") self.assertTrue( (sol == [0,0,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_build_genomic_regions(self):\n\n CDS = pybedtools.BedTool(\"\"\"chr1\\t7700\\t7900\\tfoo\\t0\\t+\\n\n chr1\\t7999\\t8500\\tfoo\\t0\\t+\\n\"\"\", from_string = True)\n UTR5 = pybedtools.BedTool(\"\"\"chr1\\t7499\\t7700\\tfoo\\t0\\t+\\n\"\"\", from_string = Tr...
[ "0.57967705", "0.56689626", "0.56322116", "0.5576564", "0.53773236", "0.5324869", "0.5280804", "0.52485895", "0.51819634", "0.5068489", "0.5059407", "0.5058089", "0.5053531", "0.5041906", "0.5026302", "0.50150365", "0.49997157", "0.49892414", "0.49887782", "0.49616218", "0.49...
0.73532724
0
Test that all evm contract entries in the packaged global DB have legal data
def test_evm_contracts_data(globaldb): serialized_chain_ids = [x.serialize_for_db() for x in ChainID] with globaldb.conn.read_ctx() as cursor: cursor.execute('SELECT address, chain_id, abi, deployed_block FROM contract_data') for entry in cursor: assert is_checksum_address(entry[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_evm_abi_data(globaldb):\n abis_set = {0}\n with globaldb.conn.read_ctx() as cursor:\n cursor.execute('SELECT id, value FROM contract_abi')\n for entry in cursor:\n assert isinstance(entry[0], int)\n # read the abi, and make sure it's the most compressed version it...
[ "0.63726306", "0.6258769", "0.61966866", "0.6144972", "0.61352324", "0.6065043", "0.60140806", "0.5990689", "0.59619606", "0.5952573", "0.5928535", "0.592221", "0.5913163", "0.58939886", "0.58402085", "0.5839988", "0.5813142", "0.5753996", "0.57510674", "0.5749262", "0.574265...
0.7348178
0
Test that the evm abi entries in the packaged globalDB have legal data
def test_evm_abi_data(globaldb): abis_set = {0} with globaldb.conn.read_ctx() as cursor: cursor.execute('SELECT id, value FROM contract_abi') for entry in cursor: assert isinstance(entry[0], int) # read the abi, and make sure it's the most compressed version it can be ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_evm_contracts_data(globaldb):\n serialized_chain_ids = [x.serialize_for_db() for x in ChainID]\n with globaldb.conn.read_ctx() as cursor:\n cursor.execute('SELECT address, chain_id, abi, deployed_block FROM contract_data')\n for entry in cursor:\n assert is_checksum_address(...
[ "0.62466234", "0.5945528", "0.5720762", "0.5685077", "0.5682008", "0.56163996", "0.5465044", "0.5405287", "0.5381414", "0.5369001", "0.5335433", "0.5325524", "0.531506", "0.52768105", "0.52352834", "0.52352834", "0.52317584", "0.5214126", "0.5209774", "0.5208618", "0.5188797"...
0.7495331
0
Test that if a contract / abi is missing in the globaldb, it is searched in the packaged db.
def test_fallback_to_packaged_db(ethereum_inquirer: 'EthereumInquirer'): with GlobalDBHandler().conn.read_ctx() as cursor: # Delete one contract and its abi cursor.execute( 'SELECT contract_data.address, contract_abi.value FROM contract_data INNER JOIN ' 'contract_abi ON cont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_evm_abi_data(globaldb):\n abis_set = {0}\n with globaldb.conn.read_ctx() as cursor:\n cursor.execute('SELECT id, value FROM contract_abi')\n for entry in cursor:\n assert isinstance(entry[0], int)\n # read the abi, and make sure it's the most compressed version it...
[ "0.6099078", "0.57985014", "0.57985014", "0.57985014", "0.55810773", "0.5528027", "0.54674643", "0.5413324", "0.5392852", "0.5374912", "0.53526634", "0.535108", "0.5349278", "0.5331811", "0.53304803", "0.53240764", "0.5319467", "0.52327853", "0.52127725", "0.5207715", "0.5185...
0.7311227
0
Tests that you can send a thank you note
def test_thank_you_note(monkeypatch): mr.initialize_donors() monkeypatch.setattr('builtins.input', lambda x: 'Maggie') assert mr.thank_you_note() == mr.display_thank_you_note('Maggie') monkeypatch.setattr('builtins.input', lambda x: 'Doug') assert mr.thank_you_note() == 'Donor Doug not found.' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_thank_you(fullname):\n print(f'Thank you {fullname} for your generous donation!')", "def thank_you():\n donor = get_donor()\n if donor != 'q':\n donation = get_donation()\n add_donation(donor, donation, DONORS)\n display_email(donor, donation)\n handle_user_input(get_use...
[ "0.6774531", "0.6712743", "0.64382035", "0.63703215", "0.6352786", "0.630669", "0.62857854", "0.6265665", "0.62179285", "0.61924124", "0.6189659", "0.61604244", "0.61376387", "0.61326903", "0.6120612", "0.6114769", "0.61029917", "0.6099996", "0.6099207", "0.60678035", "0.6050...
0.70323735
0
Tests that donordb writes the correct thank you files
def test_thank_you_files(monkeypatch): mr.initialize_donors() monkeypatch.setattr('builtins.input', lambda x: '') mr.thank_you_files('') file_count = len([name for name in os.listdir('./thanks/')]) assert file_count == 7 shutil.rmtree('./thanks/') assert mr.thank_you_files('/') == f'Permiss...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_write_thank_you_letter():\n mr.initialize_donors()\n now = datetime.datetime.now()\n mr.write_thank_you_letter('.', 'Maggie')\n assert os.path.isfile('Maggie ' + now.strftime(\"%Y-%m-%d\") + \".txt\")\n\n with open('./Maggie ' + now.strftime(\"%Y-%m-%d\") + \".txt\") as filename:\n c...
[ "0.77602863", "0.6636946", "0.65686554", "0.6234059", "0.62164587", "0.6063528", "0.6014388", "0.5995661", "0.5946508", "0.5921581", "0.59022933", "0.5856694", "0.56895775", "0.5673157", "0.5644687", "0.55642015", "0.5548065", "0.5546706", "0.5536035", "0.55268264", "0.550276...
0.68330014
1
Test that a thank you letter is written to the disk containing the correct information
def test_write_thank_you_letter(): mr.initialize_donors() now = datetime.datetime.now() mr.write_thank_you_letter('.', 'Maggie') assert os.path.isfile('Maggie ' + now.strftime("%Y-%m-%d") + ".txt") with open('./Maggie ' + now.strftime("%Y-%m-%d") + ".txt") as filename: contents = filename.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_letters_to_file():\n for donor in donors_data:\n message = get_thankyou_message(donor)\n filename = donor[\"name\"].replace(\" \", \"_\") + \".txt\"\n print(\"write letter:\", donor[\"name\"])\n with open(filename, 'w') as outfile:\n outfile.write(message)", "d...
[ "0.6288521", "0.61344993", "0.60785055", "0.59058535", "0.5879224", "0.5875735", "0.5804249", "0.5722122", "0.57185036", "0.5706272", "0.5676844", "0.5667037", "0.56661874", "0.56535083", "0.5636376", "0.5611923", "0.55529416", "0.5528477", "0.551974", "0.5497962", "0.5478625...
0.7902348
0
Tests renaming a donor
def test_rename_donor(monkeypatch): #Not finished mr.initialize_donors() monkeypatch.setattr('mailroom.get_value', lambda x, y: 'q') mr.rename_donor() # assert False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_rename_fail(cleandir, fake_db):\n cmd = commands.Rename(['bad_alias', 'NEW'])\n with pytest.raises(errors.AliasNotDefinedError):\n cmd()", "def testRename(self):\n def _check(results):\n self.assertEqual(results[0], b'')\n self.assertEqual(results[1], b'testfile...
[ "0.6270247", "0.6264941", "0.61603016", "0.614278", "0.6042707", "0.6030805", "0.5977568", "0.59510463", "0.589795", "0.589327", "0.58855724", "0.5877101", "0.5859073", "0.5856539", "0.5856371", "0.5839769", "0.5821788", "0.5821788", "0.5805988", "0.57962275", "0.5794977", ...
0.72820073
0
Get a threelayer model with the given parameters.
def get_threelayer_model(muam694=muam694, oxys=oxys, bvfs=bvfs, thicknesses=thicknesses, return_full=False): model_params = pd.Series({ 'muam694': muam694, 'muabo_1': bvfs[0]*oxys[0], 'muabd_1': bvfs[0]*(1-oxys[0]), 'muabo_2': bvfs[1]*oxys[1], 'muabd_2': bvfs[1]*(1-oxys[1]),...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(width=128, height=128, depth=64):\n inputs = keras.Input((width, height, depth, 1))\n x = layers.Conv3D(filters=64, kernel_size=3, activation=\"relu\")(inputs)\n x = layers.MaxPool3D(pool_size=2)(x)\n x = layers.BatchNormalization()(x)\n x = layers.Conv3D(filters=64, kernel_size=3, act...
[ "0.7228281", "0.66158843", "0.63671553", "0.6212228", "0.6129231", "0.6041084", "0.6009188", "0.59824175", "0.5965208", "0.59425724", "0.5941189", "0.58832896", "0.588221", "0.587176", "0.5782833", "0.5775983", "0.57451534", "0.57398826", "0.5727751", "0.5660739", "0.565783",...
0.7581818
0
Test changing of climate related switch entities.
async def test_adam_climate_switch_changes(opp, mock_smile_adam): entry = await async_init_integration(opp, mock_smile_adam) assert entry.state is ConfigEntryState.LOADED await opp.services.async_call( "switch", "turn_off", {"entity_id": "switch.cv_pomp"}, blocking=True, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_adam_climate_switch_entities(opp, mock_smile_adam):\n entry = await async_init_integration(opp, mock_smile_adam)\n assert entry.state is ConfigEntryState.LOADED\n\n state = opp.states.get(\"switch.cv_pomp\")\n assert str(state.state) == \"on\"\n\n state = opp.states.get(\"switch.fibar...
[ "0.66595787", "0.65887177", "0.6565201", "0.64002216", "0.6356585", "0.62903285", "0.6286884", "0.62104875", "0.6198069", "0.61500144", "0.6143811", "0.612385", "0.611922", "0.60998255", "0.60761386", "0.60715485", "0.60471714", "0.60471714", "0.60365295", "0.60173005", "0.60...
0.6881824
0
Test creation of climate related switch entities.
async def test_stretch_switch_entities(opp, mock_stretch): entry = await async_init_integration(opp, mock_stretch) assert entry.state is ConfigEntryState.LOADED state = opp.states.get("switch.koelkast_92c4a") assert str(state.state) == "on" state = opp.states.get("switch.droger_52559") assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_switch(\n hass: HomeAssistant, mock_bridge_v2, v2_resources_test_data\n) -> None:\n await mock_bridge_v2.api.load_test_data(v2_resources_test_data)\n\n await setup_platform(hass, mock_bridge_v2, \"switch\")\n # there shouldn't have been any requests at this point\n assert len(mock_bri...
[ "0.6456185", "0.6370758", "0.6358555", "0.6196781", "0.6139982", "0.6120898", "0.6095086", "0.6028632", "0.6023716", "0.5959425", "0.5954612", "0.5944619", "0.59211916", "0.5898789", "0.58660775", "0.5860389", "0.5797785", "0.579579", "0.57832146", "0.5782789", "0.57821345", ...
0.6540604
0
Test changing of power related switch entities.
async def test_stretch_switch_changes(opp, mock_stretch): entry = await async_init_integration(opp, mock_stretch) assert entry.state is ConfigEntryState.LOADED await opp.services.async_call( "switch", "turn_off", {"entity_id": "switch.koelkast_92c4a"}, blocking=True, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _on_power_change(\n self, entity: Union[str, dict], attribute: str, old: str, new: str, kwargs: dict\n ) -> None:\n power = float(new)\n if (\n self.app.state != self.app.States.running\n and power >= self.args[CONF_RUNNING_THRESHOLD]\n ):\n self....
[ "0.6620416", "0.653353", "0.6515359", "0.64980555", "0.6282676", "0.6251372", "0.6222983", "0.6201593", "0.6173575", "0.6151477", "0.6141584", "0.6134675", "0.6116549", "0.6094101", "0.6081729", "0.60630447", "0.6045823", "0.6039294", "0.6033907", "0.6021154", "0.5974021", ...
0.6545773
1
Reads a MPFile from a file.
def from_file(filename): fileExt = os.path.splitext(filename)[1][1:] with zopen(filename, "rt") as f: return MPFile.from_string(f.read(), fileExt)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_from_file(self, filename: str) -> None:", "def read_file(file):\n with open(file, \"r\") as fid:\n return fid.read()", "def _file_read(fname):\n if not os.path.exists(fname):\n parser.error(\"File '{0}' not found.\".format(fname))\n return open(fname, 'r')", "def r...
[ "0.65296227", "0.63332516", "0.61171234", "0.60807914", "0.6034484", "0.6029216", "0.60289454", "0.59934974", "0.5991734", "0.59887844", "0.5970708", "0.59593713", "0.59396726", "0.59295917", "0.5906775", "0.59052795", "0.587623", "0.58757406", "0.5873319", "0.58678544", "0.5...
0.6654355
0
Reads a MPFile from a string.
def from_string(data, fileExt): data = '\n'.join([ # remove all comment lines first line for line in data.splitlines() if not line.lstrip().startswith("#") ]) parser = RecursiveParser(fileExt) parser.parse(data) return MPFile(parser)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_file(filename):\n fileExt = os.path.splitext(filename)[1][1:]\n with zopen(filename, \"rt\") as f:\n return MPFile.from_string(f.read(), fileExt)", "def readstring(self, fstring):\n return self.parse(fstring)", "def read_string(string):\n # Mystery arguments:\n st...
[ "0.6577847", "0.5992308", "0.5926575", "0.5884929", "0.5848187", "0.5740262", "0.5606468", "0.5569974", "0.55316603", "0.55237466", "0.54961884", "0.5458588", "0.5455856", "0.5449911", "0.5437467", "0.54274255", "0.541583", "0.541583", "0.5405282", "0.54006034", "0.53945", ...
0.6008074
1
Writes MPFile to a file. The supported kwargs are the same as those for the MPFile.get_string method and are passed through directly.
def write_file(self, filename, **kwargs): with zopen(filename, "wt") as f: f.write(self.get_string(**kwargs))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_file(*args, **kwargs): # real signature unknown\n pass", "def write_to_file(self, filename: str) -> None:", "def write(self, arg, **kwargs):\r\n if hasattr(arg, 'seek'):\r\n self._tofile(arg, **kwargs)\r\n else:\r\n with open(arg, 'wb') as fid:\r\n ...
[ "0.6689349", "0.6334519", "0.63303274", "0.6318888", "0.5922984", "0.586581", "0.5835977", "0.5835977", "0.57520294", "0.5740457", "0.57054657", "0.5668836", "0.5617296", "0.56096816", "0.5605764", "0.55472964", "0.5543589", "0.55166155", "0.55166155", "0.5450808", "0.5421509...
0.6624189
1
Read in a file and build the fuel matrix based on the file contents
def add_fuel(self, filename): with open(filename) as f: content = f.readlines() content = [x.strip() for x in content] y = 0 for line in content: x_max = min(self.width - 1, len(line)) for x in range(x_max): self.fuel[x][y] = int(o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fromfile(self, path):\n\t\tdata = filetools.read_data(path)\n\t\tprint \"File read: %i lines\" % len(data)\n\t\tself.build_matrix(data)", "def read (cls, fileName):\n out = cls ()\n \n with open(fileName) as fid:\n for line in fid:\n line = line.strip()\n \n ...
[ "0.7472209", "0.68027914", "0.6767878", "0.6677094", "0.6618163", "0.65478665", "0.65413797", "0.64956033", "0.6475068", "0.6471232", "0.645116", "0.64241624", "0.64102566", "0.6382648", "0.6350866", "0.63399696", "0.63279474", "0.6311035", "0.6270023", "0.6224651", "0.620886...
0.71034616
1
Run every locaiton through a burn step, update the surrounding spots with the new temp.
def burn_step(self): change = np.full((self.width, self.height), 0) for x in range(0, self.width - 1): for y in range(0, self.height - 1): # How fast we go through the fuel if random.randrange(2) == 0: self.fire_check_point(x, y, change) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self):\n for c in self.spill_list:\n \n self._schedule.step()", "def step(self):\n self.world.slosh_oceans()\n self.world.transfer_energy_vertically()\n self.world.transfer_energy_horizontally()\n self.world.absorb_energy_from_core()\n self.wor...
[ "0.63872206", "0.61594284", "0.6018499", "0.596619", "0.58071613", "0.57441187", "0.56078917", "0.55899584", "0.55753434", "0.5552219", "0.5524545", "0.5514967", "0.55060965", "0.5498795", "0.54894394", "0.54859334", "0.5470321", "0.54590124", "0.5458783", "0.5432481", "0.540...
0.7074203
0
Given a 1channel array of class keys, colour code the segmentation results. Arguments
def colour_code_segmentation(image, label_values): # w = image.shape[0] # h = image.shape[1] # x = np.zeros([w,h,3]) # colour_codes = label_values # for i in range(0, w): # for j in range(0, h): # x[i, j, :] = colour_codes[int(image[i, j])] label_values = [label_val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vis_seg(img, seg, palette, alpha=0.5):\n vis = np.array(img, dtype=np.float32)\n mask = seg > 0\n vis[mask] *= 1. - alpha\n vis[mask] += alpha * palette[seg[mask].flat]\n vis = vis.astype(np.uint8)\n\n # own code - Jasper\n total_pixels = totalNumPixels(seg, palette)\n # print(\"color_s...
[ "0.63310254", "0.6293841", "0.62409276", "0.6159219", "0.61587006", "0.60980403", "0.6087003", "0.6028163", "0.6001943", "0.59416837", "0.5833429", "0.5789314", "0.5780241", "0.57791024", "0.5741311", "0.57079804", "0.5646981", "0.564146", "0.564146", "0.5627415", "0.5592005"...
0.6437694
0
[defines a new custom element.]
def define(self, name, constructor, options=None): if '-' not in name: raise ValueError('Invalid custom element name. Must contain hypen: ' + name) # el = document.createElement(name) # el.constructor = constructor from domonic.html import tag from domonic.dom import ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_element(self, tag_base_name, *args, **attributes):\n el = ET.Element(self.tag_full_name(tag_base_name), **attributes)\n if args:\n (text,) = args\n el.text = text\n return el", "def makeelement(self, _tag, attrib=None, nsmap=None, **_extra): # real signature unk...
[ "0.66233563", "0.6355095", "0.6117942", "0.6078161", "0.6078161", "0.6071005", "0.60604686", "0.6018048", "0.59968543", "0.59446955", "0.5936502", "0.5881647", "0.5853543", "0.5838777", "0.5820583", "0.5816721", "0.5814564", "0.5814564", "0.57992333", "0.57869035", "0.5754305...
0.7135249
0
Returns the value of the doNotTrack attribute of the Navigator object
def doNotTrack(self): # return False return 'lol'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def also_track(self):\n return self._also_track", "def getTrackingFlag():\n return simuConfig[\"FLAG.TRACKING\"]", "def ignore_dnt(self):\n # type: () -> bool\n return self._ignore_dnt", "def dont_track(obj):\n obj._dont_track = True\n return obj", "def track(self):\r\n\t\treturn ...
[ "0.5591527", "0.5474313", "0.5282521", "0.51604736", "0.5140249", "0.5120797", "0.5066716", "0.503765", "0.50373536", "0.49582604", "0.49555683", "0.495252", "0.49314004", "0.49153078", "0.490518", "0.4901477", "0.48717403", "0.4871675", "0.486713", "0.48535725", "0.48470953"...
0.5911957
0
Returns the maximum number of touch points Navigator
def maxTouchPoints(self): return 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_view_max(self):\n return self._view_max", "def node_count_max(self) -> int:\n return int(self.graph_tuple_stats.node_count_max or 0)", "def max_positions(self):\n return self.args.max_positions", "def maxTargets(self):\n return self._getAttribute(Attribute.maxTargets)", "def max...
[ "0.6489628", "0.6299255", "0.6214852", "0.62058556", "0.6202385", "0.61888355", "0.6160381", "0.6087263", "0.6074066", "0.6063557", "0.6032469", "0.6028634", "0.59937507", "0.5984426", "0.5977126", "0.59686434", "0.5936085", "0.58908945", "0.5832625", "0.58127165", "0.5811794...
0.80592984
0
Registers a new protocol handler Navigator
def registerProtocolHandler(scheme, url, title): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_handler(self, handler):\r\n self.handler = handler", "def _register(self, comm, handler):", "def register(self, msg_type, handler):\n # Should check type is valid\n if not handler and msg_type in self.handlers.keys():\n del self.handlers[msg_type]\n retur...
[ "0.607209", "0.60364527", "0.6035808", "0.5788643", "0.5713086", "0.57052964", "0.5686027", "0.5682698", "0.56627846", "0.55118316", "0.5489896", "0.54486316", "0.54095554", "0.53828686", "0.53544205", "0.5348569", "0.5283371", "0.52782905", "0.5261455", "0.52474374", "0.5234...
0.6720755
0
Requests a new MediaKeySystemAccess object Navigator
def requestMediaKeySystemAccess(keySystem, supportedConfigurations): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_access(self):\n pass", "def accessoriesMenu():\n pref = QtGui.QAction(mw)\n pref.setText(\"Command panel\")\n pref.setObjectName(\"CommandPanel\")\n pref.triggered.connect(onPreferences)\n try:\n import AccessoriesMenu\n AccessoriesMenu.addItem(\"CommandPanel\")\n ...
[ "0.50202763", "0.5019276", "0.5009071", "0.49969393", "0.49790287", "0.49416128", "0.47892502", "0.4677711", "0.4656313", "0.46431246", "0.4604423", "0.46008736", "0.45536715", "0.45482442", "0.45430893", "0.45383158", "0.4477115", "0.4477018", "0.44738144", "0.44694597", "0....
0.5913501
0
Returns whether the browser Navigator can share files
def canShare(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share():\n return True", "def is_screenshare(self):\n return self._is_screenshare", "def multi_share_enabled(self) -> bool:\n return pulumi.get(self, \"multi_share_enabled\")", "def isBrowseable(self, service):\n\t\treturn False", "def is_host_sharing_enabled(self):\n\t\treturn bool(ca...
[ "0.702554", "0.6779506", "0.6564974", "0.6154479", "0.60005563", "0.598512", "0.595053", "0.5927496", "0.5868117", "0.58583564", "0.5850223", "0.58211696", "0.5808024", "0.57376623", "0.57300204", "0.5658534", "0.55719835", "0.55525833", "0.55491304", "0.5535621", "0.5528527"...
0.7450079
0
Clears the app badge Navigator
def clearAppBadge(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_app(package):\n G.DEVICE.clear_app(package)", "def reset(self):\n self.menu.removeAll()", "def clear(self) -> None:\n ...", "def clear(self):\n #for counterName in self.counters:\n # del self.counters[counterName]\n self.counters={}\n self.title=None"...
[ "0.60813797", "0.5779066", "0.5758168", "0.56971365", "0.56904656", "0.56855553", "0.5679755", "0.5667761", "0.5657065", "0.56205505", "0.56041664", "0.55671287", "0.55670136", "0.55670136", "0.55670136", "0.55670136", "0.55670136", "0.55670136", "0.55670136", "0.55604714", "...
0.813238
0
Returns the battery information Navigator
def getBattery(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_battery_information(self):\n BATTERY_DEVTYPE_GAMEPAD = 0x00\n BATTERY_DEVTYPE_HEADSET = 0x01\n # Set up function argument types and return type\n XInputGetBatteryInformation = xinput.XInputGetBatteryInformation\n XInputGetBatteryInformation.argtypes = [ctypes.c_uint, ctyp...
[ "0.72584903", "0.68921745", "0.68102103", "0.6482005", "0.64766127", "0.63499147", "0.6307779", "0.6306283", "0.627058", "0.62319887", "0.6212237", "0.62002534", "0.6184202", "0.6184202", "0.6184202", "0.6184202", "0.6184202", "0.6184202", "0.6133123", "0.6130775", "0.6105538...
0.698159
1
Returns whether the browser Navigator supports Java
def javaEnabled(self): return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_java():\n\n os_java='/usr/bin/java'\n\n if os.path.exists(os_java):\n return True\n else:\n return False", "def is_java_agent(self):\r\n return self.has_label('java_agent')", "def is_java(self):\r\n return self.has_label('java')", "def is_jvm(self):\r\n return se...
[ "0.67825764", "0.63989794", "0.6380727", "0.6347271", "0.6192456", "0.58186704", "0.5695502", "0.56624585", "0.56254894", "0.5467433", "0.54294884", "0.5294855", "0.5282257", "0.5280369", "0.5276829", "0.5239195", "0.52252954", "0.5198802", "0.51956254", "0.5189983", "0.51782...
0.6455693
1
Returns the local storage object
def localStorage(self): return self._localStorage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_storage(self):\n return self.storage", "def get_storage(local_path=None, redis_index=None):\n from config import STORAGE\n if STORAGE[\"Method\"] == \"local\":\n return LocalStorage(path=local_path or STORAGE.get(\"LocalPath\"))\n elif STORAGE[\"Method\"] == \"redis\":\n ret...
[ "0.7460989", "0.73226506", "0.7071732", "0.704861", "0.69267845", "0.676851", "0.6756871", "0.6688144", "0.6636148", "0.6606044", "0.6480308", "0.6480153", "0.6453116", "0.63672066", "0.633645", "0.6326526", "0.6326039", "0.63245815", "0.63123065", "0.62244594", "0.6161823", ...
0.74600065
1
Returns the session storage object
def sessionStorage(self): return self._sessionStorage
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session(self):\n return self.session_store.get_session()", "def session(self):\n return self.session_store.get_session(backend=\"datastore\")", "def get_session(self):\n sst = SessionStore(session_key=self.session_key)\n sst[BACKEND_SESSION_KEY] = cas_backend\n return sst", "...
[ "0.7604154", "0.75149846", "0.73910844", "0.7375011", "0.7375011", "0.7321325", "0.7290081", "0.7272489", "0.71787995", "0.7118319", "0.71107876", "0.7082378", "0.70740485", "0.7012683", "0.6997852", "0.6985712", "0.6977842", "0.69419813", "0.69115144", "0.68625855", "0.68243...
0.8536082
0
Gives focus to an element
def focus(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _focus(self, element):\n actions = ActionChains(self.selenium.driver)\n actions.move_to_element(element).click().perform()\n self.selenium.set_focus_to_element(element)", "def setFocus(*args):", "def setFocus(*args):", "def setFocus(*args):", "def setFocus(*args):", "def XPSetKey...
[ "0.85310316", "0.74520737", "0.74520737", "0.74520737", "0.74520737", "0.7369307", "0.733207", "0.7136212", "0.7129923", "0.70070255", "0.69538426", "0.6950083", "0.6932122", "0.6932122", "0.6932122", "0.6932122", "0.67677176", "0.6718271", "0.6705171", "0.6684202", "0.665397...
0.74829966
1
Returns the History object for the window
def history(self): raise NotImplementedError # from domonic.webapi.history import History # return History()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_history(self):\n return self.history", "def history(self):\n return self._history", "def history(self):\n return self._history", "def get_history(self):\n return self.__history[:]", "def history(self):\n return self.info['history']", "def history(self):\n ...
[ "0.69826376", "0.68307877", "0.68307877", "0.68293446", "0.67832285", "0.67071366", "0.6698171", "0.6692629", "0.66247016", "0.6622851", "0.65212226", "0.64316285", "0.6330274", "0.63271475", "0.6318716", "0.629463", "0.6288419", "0.62348986", "0.6170638", "0.61509866", "0.61...
0.6973343
1
Returns the Navigator object for the window
def navigator(self): return self._navigator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_window(self):\n \n # get window from browser\n return self.browser.get_window()", "def get_window(self):\n\n if not self.window:\n self.window_manager = window.WindowManager(self)\n self.window = self.window_manager.window\n\n return self.window", ...
[ "0.67363214", "0.669033", "0.65515447", "0.6456249", "0.64066434", "0.6360317", "0.63192266", "0.62890154", "0.6241877", "0.62367517", "0.62350875", "0.62326866", "0.62066436", "0.61871606", "0.6122989", "0.6122989", "0.60762244", "0.60681885", "0.5982146", "0.5979354", "0.59...
0.68321353
0
Get SQLs used in ContextStore Returns
def get_sqls(self): return { "prepare_check": "select id from dbo.sysobjects where id = object_id('{0}')".format(self.table_name), "prepare_create": "create table {0} (channel NVARCHAR(20), channel_user_id NVARCHAR(100), timestamp DATETIME2, topic_name NVARCHAR(100), topic_status NVARCHA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sqls(self):\n return {\n \"prepare_check\": \"select id from dbo.sysobjects where id = object_id('{0}')\".format(self.table_name),\n \"prepare_create\": \"create table {0} (channel NVARCHAR(20), channel_user_id NVARCHAR(100), user_id NVARCHAR(100), timestamp DATETIME2, name NVA...
[ "0.6611019", "0.62493545", "0.61458546", "0.6047766", "0.6000757", "0.5992837", "0.59740704", "0.5946405", "0.5943148", "0.5915558", "0.5889455", "0.58350456", "0.5771015", "0.5767224", "0.57606363", "0.5752794", "0.5726901", "0.57247156", "0.57110536", "0.5681492", "0.566115...
0.68268514
0
Get SQLs used in UserStore Returns
def get_sqls(self): return { "prepare_check": "select id from dbo.sysobjects where id = object_id('{0}')".format(self.table_name), "prepare_create": "create table {0} (channel NVARCHAR(20), channel_user_id NVARCHAR(100), user_id NVARCHAR(100), timestamp DATETIME2, name NVARCHAR(100), nic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sqls(self):\n return {\n \"prepare_check\": \"select id from dbo.sysobjects where id = object_id('{0}')\".format(self.table_name),\n \"prepare_create\": \"create table {0} (channel NVARCHAR(20), channel_user_id NVARCHAR(100), timestamp DATETIME2, topic_name NVARCHAR(100), topic...
[ "0.62720776", "0.62461567", "0.62087053", "0.6175525", "0.6115894", "0.6115173", "0.60775787", "0.60414094", "0.5992726", "0.59043276", "0.58788896", "0.5846991", "0.5827653", "0.57789207", "0.57686657", "0.5754185", "0.5730463", "0.57054156", "0.5700048", "0.5676407", "0.566...
0.7158523
0
returns googles supported translate languages.
def get_langs(): temp = "" translate_client = translate.Client() for i in translate_client.get_languages(): temp += i['name'] + ": " + i['language'] + "\n" return temp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_languages():\n utility = queryUtility(ILanguageAvailability)\n if utility is not None:\n return utility.getAvailableLanguages()\n return [DEFAULT_LANGUAGE]", "def supported_languages(self):\n return SUPPORT_LANGUAGES", "def supported_languages(self) -> list[str]:\n r...
[ "0.7505235", "0.7376453", "0.7201434", "0.70853764", "0.70515877", "0.70173264", "0.7000344", "0.6955109", "0.6902494", "0.6873672", "0.6828671", "0.67519647", "0.6723953", "0.66199255", "0.6551415", "0.6508603", "0.6500117", "0.64134645", "0.63992846", "0.6373975", "0.631599...
0.74446857
1
Ouroboros method. The entity is officially activated to be usable. At this point, the entity has established the client corresponding entity, and its cell part can be created here.
def onClientEnabled(self): INFO_MSG("Avatar[%i-%s] entities enable. spaceUTypeB=%s, entityCall:%s" % (self.id, self.playerName, self.spaceUTypeB, self.client)) Teleport.onClientEnabled(self) if self._destroyTimer > 0: self.delTimer(self._destroyTimer) self._destroyTimer = 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def async_create_entity(event: Event) -> None:\n async_add_entities([AxisSwitch(event, device)])", "def spawn_orb(self):\n x_pos = random.randint(0, self.config.arena_size[0] - 1)\n y_pos = random.randint(0, self.config.arena_size[1] - 1)\n self.arena[x_pos][y_pos] = Tile.ORB", "def...
[ "0.54665536", "0.5379791", "0.5217929", "0.5190116", "0.5174889", "0.51442677", "0.5139909", "0.5117439", "0.5100084", "0.5096504", "0.5072969", "0.50598943", "0.50541246", "0.50471765", "0.50422883", "0.50403583", "0.5037434", "0.50236946", "0.5012775", "0.49861175", "0.4963...
0.5419247
1
Defined method. Create a cell entity
def createCell(self, space): self.createCellEntity(space) DEBUG_MSG("Avatar::createCell")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cells(self):\n raise NotImplementedError(\n \"create_cells function not reimplemented from base class\")", "def create_cell(self, cid):\n self.cells[cid] = Cell()", "def _create_cell(self,row_number,cell_number):\n cell = Cell(self)\n cell.x = cell_number * sel...
[ "0.7237636", "0.70952666", "0.6978179", "0.6728125", "0.64303994", "0.61934", "0.61240983", "0.6123892", "0.60437393", "0.60319746", "0.5933127", "0.59145105", "0.59029764", "0.5868343", "0.5850921", "0.58459437", "0.5823805", "0.5806415", "0.5785444", "0.5764964", "0.5735907...
0.77362716
0
Return input masks for all inputs of nx_node.
def get_input_masks(nx_node, nx_graph): input_edges = list(nx_graph.in_edges(nx_node["key"])) input_masks = [nx_graph.nodes[input_node]["output_mask"] for input_node, _ in input_edges] return input_masks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_input_masks(nx_node, nx_graph):\n input_edges = list(nx_graph.in_edges(nx_node['key']))\n input_masks = [nx_graph.nodes[input_node]['output_mask'] for input_node, _ in input_edges]\n return input_masks", "def fill_input_masks(nx_node, nx_graph):\n input_edges = sorted(list(nx_graph.in_edges(n...
[ "0.83040684", "0.7720233", "0.7444091", "0.6945355", "0.6653077", "0.6648955", "0.64191484", "0.64183325", "0.6292306", "0.62491256", "0.6188669", "0.6188669", "0.61699057", "0.6152772", "0.6030292", "0.60127866", "0.5985747", "0.5980768", "0.594564", "0.5945007", "0.5920376"...
0.8293051
1
Propagates input mask through nx_node.
def identity_mask_propagation(nx_node, nx_graph): input_masks = get_input_masks(nx_node, nx_graph) assert len(input_masks) == 1 nx_node["input_masks"] = input_masks nx_node["output_mask"] = input_masks[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identity_mask_propagation(nx_node, nx_graph):\n input_masks = get_input_masks(nx_node, nx_graph)\n assert len(input_masks) == 1\n nx_node['input_masks'] = input_masks\n nx_node['output_mask'] = input_masks[0]", "def mask_propagation(\n cls, node: NNCFNode, graph: NNCFGraph, tensor_processo...
[ "0.80650234", "0.7022191", "0.65827215", "0.62988365", "0.62038034", "0.5997845", "0.59874195", "0.594405", "0.5881275", "0.5856101", "0.58493125", "0.58228886", "0.58228296", "0.574259", "0.55995286", "0.5578353", "0.55769694", "0.5573545", "0.5550615", "0.5533706", "0.55307...
0.79982126
1
A wrapper function to test the input given by a user. If EOFError or KeyboardInteruppt excepttions occure, return 'None'
def safe_input(): try: input("Please enter something: ") except EOFError: return None except KeyboardInterrupt: return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_(text=''):\n while True:\n try:\n thing = input(text)\n if thing == '':\n raise ValueError\n else:\n return thing\n except (EOFError, KeyboardInterrupt, ValueError):\n print()", "def cont():\n\n try:\n ...
[ "0.73423505", "0.7210288", "0.6993089", "0.69548965", "0.6790611", "0.6744164", "0.6617577", "0.65305", "0.65033233", "0.6483723", "0.6477958", "0.64115095", "0.64115095", "0.63885415", "0.63444966", "0.63225734", "0.63116014", "0.6310782", "0.6310374", "0.6294325", "0.629177...
0.7777992
0
append the original path and file name strips special chars remove spaces (replace with underscore) convert to lowercase
def prep_file_name(path, file): name = path.__str__() + '~' + file.__str__() name = name.lower() name = name.replace(' ', '_') name = re.sub('[^a-z0-9\-_!.~]+', '', name) return name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowercase(self, given_path):\n filename = os.path.basename(given_path).lower()\n return given_path.replace(os.path.basename(given_path), filename)", "def sanitize_filename(file_path: str) -> str:\n file_name = file_path.lower().replace(\" \", \"_\").replace(\".\", \"_\")\n file_name = \"\...
[ "0.6995417", "0.6826136", "0.6778831", "0.6731807", "0.67201424", "0.66109914", "0.66068923", "0.6583505", "0.64531416", "0.64342517", "0.6388891", "0.6370598", "0.63407785", "0.63366973", "0.63137543", "0.6296708", "0.62931216", "0.6281843", "0.6281687", "0.6237664", "0.6234...
0.7484257
0
Evicts Idle Connections periodically from a Connection Pool
def run(self): while True: if not self.pool.queue.qsize() <= self.maxIdle: logging.info("Evicting Idle Connections, Queue Size: %s" % self.pool.queue.qsize()) connection = self.pool.queue.get(False) connection.dispose() time.sleep(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _idle(self):\n # self._purge_timedout()\n # ...", "async def cleanup(self) -> None:\n for _ in range(self.pool_size):\n conn = await self.acquire()\n conn.close()", "async def cleanup(self):\n for _ in range(self.pool_size):\n conn = self.pool.ge...
[ "0.6471048", "0.6374793", "0.62753284", "0.624803", "0.60733575", "0.5946974", "0.5802404", "0.5754826", "0.57455474", "0.5722124", "0.5695149", "0.56296223", "0.55917925", "0.5554217", "0.5552082", "0.5527621", "0.55187285", "0.5513473", "0.55006385", "0.54986686", "0.549597...
0.73818725
0
Rolls a dice in NdN format.
async def roll(self, dice: str): try: rolls, limit = map(int, dice.split('d')) except Exception: await self.bot.say('Format has to be in NdN!') return result = ', '.join(str(random.randint(1, limit)) for r in range(rolls)) await self.bot.say(result)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def roll(self, ctx, dice : str):\n try:\n rolls, limit = map(int, dice.split('d'))\n except Exception:\n await ctx.send('Format has to be in NdN!')\n return\n\n result = ', '.join(str(random.randint(1, limit)) for r in range(rolls))\n await ctx.sen...
[ "0.74619555", "0.73647946", "0.72999996", "0.71917075", "0.71317565", "0.7023572", "0.6970697", "0.69684446", "0.6963433", "0.6953782", "0.69421136", "0.691508", "0.69086003", "0.68810964", "0.6837781", "0.6817717", "0.68018115", "0.6789313", "0.6772065", "0.676708", "0.67551...
0.75542825
0
Pauses the scaling group, causing all scaling policy executions to be rejected until unpaused. This is an idempotent change, if it's already paused, this does not raise an error.
def pause_scaling_group(log, transaction_id, scaling_group, dispatcher): if not tenant_is_enabled(scaling_group.tenant_id, config_value): raise NotImplementedError("Pause is not implemented for legay groups") return perform(dispatcher, conv_pause_group_eff(scaling_group, transaction_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pause_scaling_group(self, request):\n group = self.store.get_scaling_group(\n self.log, self.tenant_id, self.group_id)\n return controller.pause_scaling_group(\n self.log, transaction_id(request), group, self.dispatcher)", "def conv_pause_group_eff(group, transaction_id):\...
[ "0.7711779", "0.72564363", "0.6947891", "0.63971376", "0.6323556", "0.6200588", "0.6197848", "0.6197715", "0.6197715", "0.617591", "0.61642057", "0.6159052", "0.6127139", "0.6086533", "0.6084649", "0.6073788", "0.6070744", "0.6051046", "0.6035837", "0.6028317", "0.5985923", ...
0.7651059
1
Resumes the scaling group, causing all scaling policy executions to be evaluated as normal again. This is an idempotent change, if it's already paused, this does not raise an error.
def resume_scaling_group(log, transaction_id, scaling_group, dispatcher): if not tenant_is_enabled(scaling_group.tenant_id, config_value): raise NotImplementedError( 'Resume is not implemented for legacy groups') return perform(dispatcher, conv_resume_group_eff(transaction...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resume_scaling_group(self, request):\n group = self.store.get_scaling_group(\n self.log, self.tenant_id, self.group_id)\n return controller.resume_scaling_group(\n self.log, transaction_id(request), group, self.dispatcher)", "def resume(self):\n self._paused = False...
[ "0.7377113", "0.6823035", "0.68173075", "0.67731863", "0.6730245", "0.6475461", "0.64655304", "0.6402684", "0.63168967", "0.61975884", "0.61960137", "0.615186", "0.611367", "0.6024462", "0.60244006", "0.59981763", "0.59981763", "0.59981763", "0.59502614", "0.59137785", "0.585...
0.74009234
0
Logs a convergence event to the audit log
def _do_convergence_audit_log(_, log, delta, state): audit_log = audit(log) if delta < 0: msg = "Deleting {0}".format(-delta) event_type = "convergence.scale_down" else: msg = "Starting {convergence_delta} new" event_type = "convergence.scale_up" msg += " servers to sat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_log(self):\n pass", "def log_event(event):\n LOGGER.info(\"====================================================\")\n LOGGER.info(event)\n LOGGER.info(\"====================================================\")", "def _log_convergence(self) -> None:\n assert (\n self._c...
[ "0.62110317", "0.61187285", "0.59951985", "0.59460974", "0.59412044", "0.5824268", "0.5684228", "0.5574092", "0.5570679", "0.5570555", "0.55412114", "0.55274874", "0.54917747", "0.54917747", "0.5462159", "0.54112834", "0.5409676", "0.53951705", "0.5351986", "0.5343814", "0.53...
0.6533176
0
Check the global cooldowns (when was the last time any policy was executed?) and the policy specific cooldown (when was the last time THIS policy was executed?)
def check_cooldowns(log, state, config, policy, policy_id): this_now = datetime.now(iso8601.iso8601.UTC) timestamp_and_cooldowns = [ (state.policy_touched.get(policy_id), policy['cooldown'], 'policy'), (state.group_touched, config['cooldown'], 'group'), ] for last_time, cooldown, coold...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def check_cooldown(self, ctx: commands.context):\n if not self.enable_cooldown:\n return True\n\n now = datetime.utcnow()\n\n # Exclude bot owner from all cooldowns\n if await checks.is_owner(ctx):\n return True\n\n # Return if author never been in coo...
[ "0.67061263", "0.6570649", "0.6345861", "0.6345861", "0.6345861", "0.6345861", "0.6345861", "0.6345861", "0.6345861", "0.6240309", "0.6215452", "0.5991046", "0.59393", "0.5935412", "0.5906958", "0.58777", "0.58412534", "0.5801426", "0.5776125", "0.5776125", "0.56709665", "0...
0.7705101
0
Calculate a new desired number of servers based on a policy and current number of servers, assign that new desired number to ``state.desired``, and return the difference.
def apply_delta(log, current, state, config, policy): if "change" in policy: desired = current + policy['change'] elif "changePercent" in policy: percentage = policy["changePercent"] change = int((current * (Decimal(percentage) / 100)).to_integral_value(ROUND_UP)) desired = curre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_delta(log, state, config, policy):\n current = len(state.active) + len(state.pending)\n return apply_delta(log, current, state, config, policy)", "def _policy_improvement(self) -> Tuple[np.ndarray, np.ndarray]:\n # Start with a (random) policy\n policy = np.zeros([self.state_dim...
[ "0.5894039", "0.58565456", "0.57727647", "0.5739047", "0.5652997", "0.55196124", "0.5479433", "0.54622865", "0.54548603", "0.5421168", "0.53931934", "0.53512293", "0.5348897", "0.5341795", "0.5340509", "0.53297186", "0.5303016", "0.51606256", "0.5160117", "0.51256555", "0.512...
0.67047685
0
Apply a delta based on the ``active`` and ``pending`` server data stored away on ``state``.
def calculate_delta(log, state, config, policy): current = len(state.active) + len(state.pending) return apply_delta(log, current, state, config, policy)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_delta(log, current, state, config, policy):\n if \"change\" in policy:\n desired = current + policy['change']\n elif \"changePercent\" in policy:\n percentage = policy[\"changePercent\"]\n change = int((current * (Decimal(percentage) / 100)).to_integral_value(ROUND_UP))\n ...
[ "0.6238662", "0.57293975", "0.5685518", "0.5633349", "0.5620547", "0.5571388", "0.5504557", "0.54794496", "0.54384816", "0.53754896", "0.53611124", "0.5195377", "0.51761645", "0.51083076", "0.5098036", "0.5088107", "0.5069392", "0.5054142", "0.5048286", "0.50236833", "0.50164...
0.67476094
0
Given a group and server ID, determines if the server is a member of
def _is_server_in_group(group, server_id): try: response, server_info = yield Effect(TenantScope( retry_effect(get_server_details(server_id), retry_times(3), exponential_backoff_interval(2)), group.tenant_id)) except NoSuchServerE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_member_of_group(self, mail, group):\n members = self.get_group_members(group)\n\n if mail in members:\n return True\n return False", "def is_user_in_group(user, group):\n users = group.get_users()\n if user in users:\n return True\n return False", "def in_...
[ "0.657713", "0.65740675", "0.6550847", "0.65021956", "0.6476825", "0.6476586", "0.64285344", "0.6395408", "0.63951486", "0.63300115", "0.6293658", "0.6292875", "0.6266438", "0.62650996", "0.6214821", "0.6151612", "0.60696363", "0.606858", "0.6066733", "0.60198796", "0.5991939...
0.79783934
0