query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Fill in blank areas on the edges of images Applies a Gaussian kernel with width `sigma` to fill in the the first `sigma` width of unfilled points. Then apply a `2 sigma` width Gaussian to fill the next `2 sigma` width of unfilled points. Etc.
def fill(img, sigma=1, erosion=2): img = img.copy() img = skimage.img_as_float(img) h, w, d = img.shape assert d == 4, "image must be RGBA" raw_mask = (img[:, :, 3] != 0) if raw_mask.sum() == 0: return img mask = morphology.binary_erosion(raw_mask, selem=morphology.disk(erosion)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian_kernel(size, sigma): \n \n kernel = np.zeros((size, size))\n\n #####################################\n # START YOUR CODE HERE #\n #####################################\n k = (size - 1) / 2\n sigma_sq = sigma ** 2\n pi_sigma = 1/(2 * np.pi * sigma_sq)\n for i in...
[ "0.61494803", "0.60855705", "0.5982485", "0.5890864", "0.58883697", "0.5880866", "0.586728", "0.5848967", "0.5832641", "0.58226866", "0.5791329", "0.5754669", "0.5750084", "0.57419986", "0.5730211", "0.5723482", "0.57178754", "0.5703451", "0.57008785", "0.569052", "0.56896883...
0.71587646
0
Faster version of `fill` (usually) Try applying `fill` to only a `max_fill` area on the border of the image. If that is not enought to fully fill the border, fall back to default fill. In the latter case this will be slower than the base fill.
def fast_fill(img, sigma=1, erosion=2, max_fill=256): h, w, d = img.shape if (img[:, :, 3] != 0).sum() == 0: return img if min(h, w) <= 2 * max_fill: return fill(img, sigma, erosion) new = img.copy() new[:max_fill] = fill(img[:max_fill], sigma, erosion) new[-max_fill:] = fill(img...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_corners(input_image, fill_value=0, thresh=1, tol=None, fill_below_thresh=True):\n\n s = input_image.shape\n\n if (input_image[0, 0] < thresh) == fill_below_thresh:\n input_image = flood_fill(input_image, (0, 0), fill_value, tolerance=tol)\n if (input_image[-1, 0] < thresh) == fill_below_th...
[ "0.63137245", "0.6278365", "0.6200204", "0.61978185", "0.61965805", "0.60700846", "0.6059652", "0.59688854", "0.59662366", "0.59070265", "0.5903179", "0.589714", "0.588309", "0.5854719", "0.5853577", "0.58095926", "0.58064723", "0.57960904", "0.5779643", "0.56925577", "0.5673...
0.7674791
0
Make a list of all files matching pattern above start_dir
def get_file_tree(start_dir, pattern): files = [] for dir, _, _ in os.walk(start_dir): files.extend(glob(os.path.join(dir, pattern))) return files
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(start_str = \"sim_\"):\n n = len(start_str)\n file_list = [f for f in os.listdir(in_path) if f[0:n] == start_str]\n return file_list", "def file_list(start_dir):\n file_list = []\n for root, dirs, files in os.walk(start_dir):\n for f in files:\n if f[0] ...
[ "0.7556224", "0.74534124", "0.7433997", "0.73215526", "0.7270172", "0.714238", "0.70066285", "0.68156236", "0.6765896", "0.67633706", "0.66958994", "0.6641538", "0.6641126", "0.65933096", "0.6584297", "0.65716815", "0.6567231", "0.6563363", "0.65178543", "0.64578176", "0.6450...
0.727162
4
Starts the agent and required threads This method is called after a successful announce. See fsm.py
def start(self, _): logger.debug("Spawning metric & span reporting threads") self.should_threads_shutdown.clear() self.sensor.start() instana.singletons.tracer.recorder.start()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n try:\n server = Thread(target=self._thread(self._server), name=\"server\")\n server.setDaemon(True)\n server.start()\n for i in range(0, 10):\n client = Thread(target=self._thread(self._client), name=\"client\")\n c...
[ "0.7048922", "0.70160836", "0.69432986", "0.65925646", "0.6582528", "0.6563317", "0.6547528", "0.65365577", "0.6495644", "0.6495458", "0.6423207", "0.63114285", "0.6302858", "0.62941426", "0.6272314", "0.62518716", "0.62287855", "0.6197655", "0.6190885", "0.6187866", "0.61622...
0.6455309
10
This will reset the agent to a fresh unannounced state.
def reset(self): # Will signal to any running background threads to shutdown. self.should_threads_shutdown.set() self.last_seen = None self.from_ = From() # Will schedule a restart of the announce cycle in the future self.machine.reset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n self.agents.reset()\n self._cur_obs, self._cur_lm = self.parallel_env.reset()\n self.agent_cum_rewards = np.zeros((len(self.agents), self.n_states, 1))\n self.agent_contiguous_states = np.full((len(self.agents), self.n_states), True)", "def reset(self):\n ...
[ "0.76829946", "0.74896604", "0.73375666", "0.7282671", "0.71241623", "0.707296", "0.70554495", "0.70078874", "0.6938781", "0.6915796", "0.679774", "0.679774", "0.679774", "0.679774", "0.679774", "0.679774", "0.679774", "0.679774", "0.679774", "0.679774", "0.679774", "0.6749...
0.6977381
8
Check if the Instana Agent is listening on and .
def is_agent_listening(self, host, port): try: rv = False url = "http://%s:%s/" % (host, port) response = self.client.get(url, timeout=0.8) server_header = response.headers["Server"] if server_header == AGENT_HEADER: logger.debug("Host...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isListening(self):\n if not self.proxy:\n self.proxy = self.session.service(\"ALExpressiveListening\")\n return self.proxy.isListening()", "def available(self):\n from pyhs3 import STATE_LISTENING\n return self._connection.api.state == STATE_LISTENING", "def is_listen...
[ "0.69082576", "0.6781381", "0.67236483", "0.66583073", "0.6597917", "0.65964216", "0.6443436", "0.64348936", "0.63661027", "0.62650263", "0.61452365", "0.6133517", "0.607216", "0.6067738", "0.60436565", "0.60321605", "0.6028546", "0.5990147", "0.5979438", "0.59621173", "0.592...
0.70526135
0
With the passed in Discovery class, attempt to announce to the host agent.
def announce(self, discovery): try: url = self.__discovery_url() logger.debug("making announce request to %s", url) response = None response = self.client.put(url, data=to_json(discovery), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def announce(self):\n self.notify(self.newAgent)\n if not self.agent.is_someone_subscribed():\n self.fail(cause=\"Noone Interested\")", "def discovery(self, discovery):\n self._discovery = discovery", "def discover(self):\n self.ola_thread.run_discovery(self.universe.get(), s...
[ "0.5947719", "0.58452016", "0.5585052", "0.5345744", "0.5330744", "0.53060704", "0.51516455", "0.51401395", "0.5137399", "0.5128347", "0.50388765", "0.4961324", "0.4937676", "0.49360597", "0.4907737", "0.48760882", "0.48737139", "0.48590297", "0.485389", "0.48241162", "0.4814...
0.6446654
0
Used after making a successful announce to test when the agent is ready to accept data.
def is_agent_ready(self): try: response = self.client.head(self.__data_url(), timeout=0.8) if response.status_code is 200: return True return False except (requests.ConnectTimeout, requests.ConnectionError): logger.debug("is_agent_ready: h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def announce(self):\n self.notify(self.newAgent)\n if not self.agent.is_someone_subscribed():\n self.fail(cause=\"Noone Interested\")", "def agentIsReady(self, timeout=1.0):\n tpl = TestTemplates.TemplateMessage()\n layer = TestTemplates.TemplateLayer('AGENT')\n laye...
[ "0.7313478", "0.63943017", "0.6235778", "0.61267906", "0.6002321", "0.5996907", "0.59847987", "0.59800845", "0.5911863", "0.59038526", "0.58909684", "0.5882462", "0.5856841", "0.58444357", "0.5817098", "0.57842547", "0.5779018", "0.5732206", "0.57287484", "0.5721912", "0.5716...
0.58059126
15
Used to report entity data (metrics & snapshot) to the host agent.
def report_data(self, entity_data): try: response = None response = self.client.post(self.__data_url(), data=to_json(entity_data), headers={"Content-Type": "application/json"}, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_agent_statistics(ctx):\n data = ctx.obj.get_agent_statistics()\n output_json_data(data)", "def get_report(self):\n raise NotImplementedError('Agent is an abstract base class')", "def send_metrics(self):\n metrics = self.get_metrics()\n if not metrics:\n return\n...
[ "0.61093044", "0.6000067", "0.5698678", "0.565605", "0.5642961", "0.55764127", "0.556718", "0.55512047", "0.5549297", "0.55395067", "0.55278474", "0.5513736", "0.54888225", "0.5475359", "0.54621094", "0.5440199", "0.5429361", "0.54253405", "0.5418064", "0.5406231", "0.5398051...
0.6607751
0
Used to report entity data (metrics & snapshot) to the host agent.
def report_traces(self, spans): try: # Concurrency double check: Don't report if we don't have # any spans if len(spans) == 0: return 0 response = None response = self.client.post(self.__traces_url(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_data(self, entity_data):\n try:\n response = None\n response = self.client.post(self.__data_url(),\n data=to_json(entity_data),\n headers={\"Content-Type\": \"application/json\"},\n ...
[ "0.6607751", "0.61093044", "0.6000067", "0.5698678", "0.565605", "0.5642961", "0.55764127", "0.556718", "0.55512047", "0.5549297", "0.55395067", "0.55278474", "0.5513736", "0.54888225", "0.5475359", "0.54621094", "0.5440199", "0.5429361", "0.54253405", "0.5418064", "0.5406231...
0.0
-1
When the host agent passes us a task and we do it, this function is used to respond with the results of the task.
def task_response(self, message_id, data): try: response = None payload = json.dumps(data) logger.debug("Task response is %s: %s", self.__response_url(message_id), payload) response = self.client.post(self.__response_url(message_id), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doTask(self, *args):\n taskId = self.task.get()\n document = self.document_uuid.get()\n visitor = self.visitor_uuid.get()\n self.output.set(str(self.taskEx.executeTask(visitor, document, taskId)))", "def v2_runner_on_ok(self, result, **kwargs):\n host = result._host\n ...
[ "0.7088486", "0.69689304", "0.6805654", "0.6752405", "0.66966486", "0.6689901", "0.6596285", "0.6581839", "0.65736383", "0.65482795", "0.6531101", "0.6483753", "0.6455989", "0.64454293", "0.64382327", "0.64382327", "0.6400658", "0.6400658", "0.6399235", "0.63619155", "0.63612...
0.0
-1
URL for announcing to the host agent
def __discovery_url(self): port = self.sensor.options.agent_port if port == 0: port = AGENT_DEFAULT_PORT return "http://%s:%s/%s" % (self.host, port, AGENT_DISCOVERY_PATH)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def href(self, request) -> str:\n raise NotImplementedError()", "def arp_announce(self):\n pass", "def url(vmanage_host,vmanage_port,api):\r\n \"\"\" function to get the url provide api endpoint \"\"\"\r\n \r\n return f\"https://{vmanage_host}:{vmanage_port}{api}\"", "def href(self, re...
[ "0.58208126", "0.56645566", "0.55948234", "0.55914885", "0.5587822", "0.5564786", "0.55532277", "0.551836", "0.5515046", "0.54996955", "0.5453796", "0.5452599", "0.5382161", "0.53463817", "0.529863", "0.5288116", "0.5274814", "0.52424526", "0.5193244", "0.51733655", "0.515489...
0.5997673
0
URL for posting metrics to the host agent. Only valid when announced.
def __data_url(self): path = AGENT_DATA_PATH % self.from_.pid return "http://%s:%s/%s" % (self.host, self.port, path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_metrics(prefix, metrics):\n series = []\n\n now = time.time()\n for key, value in metrics.iteritems():\n metric = '{prefix}.{key}'.format(prefix=prefix, key=key)\n point = [(now, value)]\n series.append({'metric':metric, 'points':point})\n\n if len(series) > 0:\n ...
[ "0.5256886", "0.5253679", "0.5166944", "0.50664103", "0.5044957", "0.49670723", "0.49092782", "0.48875695", "0.48006228", "0.47690424", "0.47642314", "0.4738381", "0.47184736", "0.47166058", "0.4677138", "0.4665939", "0.4663787", "0.46527833", "0.4624291", "0.46081275", "0.46...
0.5078013
3
URL for posting traces to the host agent. Only valid when announced.
def __traces_url(self): path = AGENT_TRACES_PATH % self.from_.pid return "http://%s:%s/%s" % (self.host, self.port, path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _submit_url(self, request: Request) -> str:\n variables = [v.replace('/', '%2F') for v in request.variables]\n vars = ','.join(variables)\n return (\n f'https://{self.config.harmony_hostname}/{request.collection.id}'\n f'/ogc-api-coverages/1.0.0/collections/{vars}/cov...
[ "0.55625236", "0.53895074", "0.5079583", "0.5004161", "0.5003211", "0.499963", "0.4992628", "0.49587142", "0.49417904", "0.49353853", "0.49221927", "0.49051777", "0.48803085", "0.48568583", "0.48393092", "0.48316365", "0.48142818", "0.47955108", "0.4783378", "0.4761256", "0.4...
0.75070876
0
URL for responding to agent requests.
def __response_url(self, message_id): if self.from_.pid != 0: path = AGENT_RESPONSE_PATH % (self.from_.pid, message_id) return "http://%s:%s/%s" % (self.host, self.port, path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_agent(self, agent, **_params):\r\n return self.get(self.agent_path % (agent), params=_params)", "def server_agent():", "def __discovery_url(self):\n port = self.sensor.options.agent_port\n if port == 0:\n port = AGENT_DEFAULT_PORT\n\n return \"http://%s:%s/%s\" %...
[ "0.6092282", "0.60644114", "0.598472", "0.58022165", "0.5762841", "0.57238704", "0.5679183", "0.5603477", "0.5465121", "0.5445918", "0.54315805", "0.5402473", "0.54005253", "0.53861636", "0.5383723", "0.53505987", "0.5348304", "0.5343061", "0.53129196", "0.53014225", "0.52822...
0.5733955
5
Convert signed twotailed pvalues in tidy dataframe to two columns of onetailed pvalues.
def convert_to_one_tailed(longpvals): higher_in_dis = longpvals[longpvals['p'] > 0].index longpvals.loc[higher_in_dis, 'p-dis'] = longpvals.loc[higher_in_dis, 'p']/2 higher_in_h = longpvals[longpvals['p'] <= 0].index longpvals.loc[higher_in_h, 'p-h'] = abs(longpvals.loc[higher_in_h, 'p']/2) def p_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transform(self, dataframe: DataFrame) -> DataFrame:", "def transform(self, df):\n temp = df.where(df >= self.df_med, -1)\n temp = temp.where(df <= self.df_med, 1).where(df != self.df_med, 0)\n return temp", "def normalize_price_values(df):\r\n\r\n\tdf_normalize_dict = dict()\r\n\r\n\tf...
[ "0.5283908", "0.5201904", "0.50020725", "0.5000971", "0.4988177", "0.49546647", "0.49204186", "0.49189258", "0.48975918", "0.48936588", "0.48907062", "0.48809013", "0.48784265", "0.48647115", "0.4834164", "0.48318642", "0.4798001", "0.47972462", "0.4755715", "0.47548717", "0....
0.54419976
0
Update the lists that will produce the reproducibility dataframe
def update_reproducibility_df_lists(values, variables, metric_labels, diseaselabels, newvalues, newvariables, newmetric_label, newdisease_label): values += newvalues variables += newvariables metric_labels += [newmetric_label]*len(newva...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_data(self):\n # take care of samples\n patients = self.samples.iloc[:,1].tolist()\n samples = self.samples.iloc[:,0].tolist()\n self.samples = pd.DataFrame(patients,index = samples,columns = ['patient']) # indexed by sample\n #\n # take care of expression data\n cols = self.expression...
[ "0.59460425", "0.57309216", "0.55985343", "0.557751", "0.5576779", "0.5559483", "0.55061835", "0.550185", "0.54883957", "0.5453005", "0.53934854", "0.53604716", "0.53446424", "0.5336182", "0.5329649", "0.5324857", "0.53203195", "0.5312671", "0.5301265", "0.5289845", "0.528326...
0.7305929
0
Returns the number of 'reproducible' OTUs based on weighted Fisher's method.
def reproducibility_from_fisher(disdf, samplesizes, qthresh): ## Turn disdf into tidy dataframe longpvals = copy.deepcopy(disdf) longpvals['otu'] = longpvals.index longpvals = pd.melt(longpvals, id_vars='otu', value_name='p', var_name='study') ## Convert two-tailed signed p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purity(y_true, y_pred, sample_weight=None):\n if sample_weight is None:\n sample_weight = np.ones_like(y_true)\n TP = np.sum((y_pred) * y_true * sample_weight)\n FP = np.sum((y_pred) * (y_true == 0) * sample_weight)\n return TP / (TP + FP)", "def computeNucStats(trues, preds):\n\t#TP, TN, ...
[ "0.6316093", "0.5965013", "0.5906239", "0.57262415", "0.5706524", "0.56523985", "0.5608727", "0.5582598", "0.5562244", "0.5545655", "0.55302846", "0.5526938", "0.5519644", "0.55168486", "0.5516572", "0.54842836", "0.5481821", "0.5480131", "0.5469545", "0.54456204", "0.5429123...
0.5175786
56
Calculate "dysbiosis" metrics in various ways. Metrics can be diseasewise (i.e. one number per disease) or datasetwise (i.e. one number per dataset). There's also one genuswise metric.
def get_dysbiosis_metrics(diseases, datasets, df, pthresh, samplesizes, overall=None): # Keep only OTUs which were signficant in at least one study # if x is zero, this returns zero (i.e. if there is no effect, it # doesn't count as significant so don't worry) sigmap = lambda ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dysbiosis_df(dfpvals, qthresh, samplesizes, overall, dfauc):\n ## Get the tidy dataframe with the \"dysbiosis\" metrics\n datasets = dfpvals.columns.tolist()\n diseases = list(set([i.split('_')[0] for i in datasets]))\n dysbiosis = get_dysbiosis_metrics(diseases, datasets, dfpvals, qthresh, sam...
[ "0.6015697", "0.5291068", "0.52776206", "0.5251048", "0.5233152", "0.52106285", "0.5177707", "0.5171312", "0.5145322", "0.5121666", "0.5097878", "0.50963205", "0.5074108", "0.50674963", "0.5050814", "0.50436914", "0.5038707", "0.5038141", "0.500424", "0.4983577", "0.4978", ...
0.7558074
0
Calculates the dysbiosis dataframe from dfpvals, qthresh, samplesizes, and overall. Also appends results from classifiers (in dfauc) and returns tidy dataframe with all the metrics.
def get_dysbiosis_df(dfpvals, qthresh, samplesizes, overall, dfauc): ## Get the tidy dataframe with the "dysbiosis" metrics datasets = dfpvals.columns.tolist() diseases = list(set([i.split('_')[0] for i in datasets])) dysbiosis = get_dysbiosis_metrics(diseases, datasets, dfpvals, qthresh, samplesizes, o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dysbiosis_metrics(diseases, datasets, df, pthresh, samplesizes,\n overall=None):\n\n # Keep only OTUs which were signficant in at least one study\n # if x is zero, this returns zero (i.e. if there is no effect, it\n # doesn't count as significant so don't worry)\n sigma...
[ "0.6998664", "0.5498175", "0.5398973", "0.5380001", "0.5380001", "0.5376634", "0.5368823", "0.53660005", "0.5334311", "0.5332189", "0.53077316", "0.5301847", "0.528861", "0.52462155", "0.5234512", "0.5225775", "0.5214241", "0.52137834", "0.51803124", "0.51625824", "0.5158908"...
0.8481515
0
Display the arguments, once unparsed a bit.
def display(config, transfo, learner, *args): stderr.write("Config is %s\n" % str(config)) stderr.write("Transfo is %s\n" % str(ktpipes.KtPipe.from_json(config[transfo]))) stderr.write("Learner is %s\n" % str(learner))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_args():\r\n args = \", \".join(sys.argv)\r\n print(\"pfArgs: \" + args)", "def print_args():\n for key, value in vars(ARGS).items():\n print(key + ' : ' + str(value))", "def show(*args):", "def show(*args):", "def show(*args):", "def show(*args):", "def help_args():\n p...
[ "0.7143801", "0.6731004", "0.6720323", "0.6720323", "0.6720323", "0.6720323", "0.66531265", "0.65652806", "0.65269595", "0.64536583", "0.6402993", "0.6223682", "0.6222612", "0.6183233", "0.6172244", "0.6122646", "0.605113", "0.60307616", "0.59918517", "0.5973232", "0.5943456"...
0.0
-1
Apply transformer to nothing for now.
def transform(config, data, transfo, *args, **kwargs): # stderr.write(str((config, data, transfo) + args) + "\n") pipe = ktpipes.KtPipe.from_json(config[transfo]) return pipe.fit_transform(get_raw(data))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _apply_transform(self):\n pass", "def reset_transform(self):\n self._impl.reset_transform()", "def transform():\n pass", "def reset(self):\n self.performed_transformations = False", "def clear_transforms(self): # -> None:\n ...", "def _transform(self, dataset):\n ...
[ "0.71691155", "0.68199676", "0.6553044", "0.6339524", "0.62957394", "0.6062062", "0.6060422", "0.59832287", "0.5966334", "0.5941329", "0.59156865", "0.58845407", "0.58735794", "0.58735794", "0.58735794", "0.58735794", "0.58735794", "0.58735794", "0.58735794", "0.58712626", "0...
0.0
-1
Get part of list past i position included. Return [] is list is shorter
def past_indice(l, i): return l[i:] if i <= len(l) else []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slice_(self, start, stop):\n \n sl = UnorderedList()\n \n current = self.head\n \n for i in range(min(stop, self.length())):\n if i >= start:\n sl.append(current.get_data())\n current = current.get_next()\n \n return s...
[ "0.6184768", "0.601741", "0.6012456", "0.5956669", "0.5904169", "0.580093", "0.57858896", "0.56827193", "0.5681486", "0.5651482", "0.5649691", "0.5639707", "0.56303376", "0.56295496", "0.5620146", "0.561906", "0.56130284", "0.5602169", "0.557603", "0.55745345", "0.5565249", ...
0.7636868
0
Test that the "reset" command exits sandbox process.
def test_reset(u_boot_console): u_boot_console.run_command('reset', wait_for_prompt=False) assert(u_boot_console.validate_exited())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_destroy_exit_code(destroy_result: Result) -> None:\n assert destroy_result.exit_code == 0", "def test_reset_confirmation_failure(self):\n self._create_program_and_course_enrollment(self.program_uuid, self.user)\n\n with pytest.raises(CommandError):\n with self._replace_stdin(...
[ "0.6778436", "0.6716901", "0.66181916", "0.65129143", "0.63427615", "0.63267905", "0.6321782", "0.6269297", "0.6232972", "0.62284225", "0.6225554", "0.61808336", "0.61801964", "0.61580604", "0.61489266", "0.60723764", "0.6021471", "0.6014386", "0.5961628", "0.5912922", "0.591...
0.8134297
0
Test that sending SIGINT to sandbox causes it to exit.
def test_ctrl_c(u_boot_console): u_boot_console.kill(signal.SIGINT) assert(u_boot_console.validate_exited())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SIGINT_handler(signal, frame):\n exit(2)", "def interrupt_handler(signum, frame): #pylint: disable=W0613\n cleanup()\n sys.exit(-2) # Terminate process here as catching the signal\n # removes the close process behaviour of Ctrl-C", "def handle_sigint(signum, frame):\n print(\...
[ "0.6982853", "0.65123326", "0.65023524", "0.64764136", "0.6464763", "0.6406912", "0.63582224", "0.6306273", "0.6264703", "0.6264703", "0.6264703", "0.6200962", "0.61787075", "0.617302", "0.61637104", "0.615935", "0.61270773", "0.6104272", "0.6025733", "0.6016389", "0.5994419"...
0.62300354
11
take 1D float array of rewards and compute discounted reward
def discount_rewards(r, gamma=0.99): discounted_r = np.zeros_like(r) running_add = 0 for t in reversed(xrange(0, r.size)): if r[t] != 0: running_add = 0 # reset the sum, since this was a game boundary (pong specific!) running_add = running_add * gamma + r[t] discounted_r[t] = running_add return disc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reversed(range(0, len(rewards))): \r\n running_add = running_add * reward_discount + rewards[t]\r\n discounted_r[t] = running_add\r\n return discounted_r", "def discoun...
[ "0.8100923", "0.78397125", "0.7792625", "0.7742053", "0.7653779", "0.75987715", "0.7583268", "0.75820553", "0.7579539", "0.7536054", "0.7519005", "0.75047183", "0.7467692", "0.7456702", "0.7433794", "0.7426565", "0.74062765", "0.73950297", "0.7370545", "0.73564714", "0.732851...
0.67952156
33
The body of the script, performs the ddG analysis.
def main(): # Define the names of required input files, and other main configuration variables protein_w_underscores = os.getcwd().split('/')[-1] protein = protein_w_underscores.replace('_', ' ') pdbfile = 'pdb_structure.pdb' # the name of the PDB file pdbchain = None # chain in pdbfile -- there is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n\toptions = parse_arguments()\n\tcodon_counts = parse.codon_freq_table(options.codon)\n\tgenetic_code = parse.genetic_code(options.codon_table, options.gene_code)\n\n\tdc = degenerate_codons(genetic_code=genetic_code,codon_counts=codon_counts)\n\tdc.compute_results()\n\tdc.output(options.output_form...
[ "0.63657075", "0.6178156", "0.6078689", "0.60487807", "0.6030232", "0.60106844", "0.60035735", "0.59393996", "0.5927443", "0.59167916", "0.5914079", "0.5910982", "0.58828115", "0.58798355", "0.58666927", "0.5862811", "0.58627933", "0.58587253", "0.58481026", "0.5842283", "0.5...
0.0
-1
Generates a single random sample inside of the Box. In creating a sample of the box, each coordinate is sampled according to
def sample(self): high = self.high.type(torch.float64) if self.dtype.is_floating_point else self.high.type(torch.int64) + 1 sample = torch.empty(self.shape, dtype=torch.float64) # Masking arrays which classify the coordinates according to interval # type unbounded = ~self.bounde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample(self):\n return gc.rand_state.uniform(low=self.bounds[0], high=self.bounds[1])", "def uniform_box_sampling(n_sample, bounding_box=((0,), (1,))):\n bounding_box = np.array(bounding_box)\n dists = np.diag(bounding_box[1] - bounding_box[0])\n samples = np.random.random_sample((n_sample, b...
[ "0.7316408", "0.7094777", "0.6908877", "0.688248", "0.6867039", "0.67604154", "0.6730934", "0.67241836", "0.67147326", "0.6707393", "0.67002535", "0.6694002", "0.66829145", "0.66407704", "0.66379553", "0.66180235", "0.66173446", "0.6615441", "0.6609112", "0.6608456", "0.65982...
0.6427901
37
CEPH10787 Capture and inspect ceph osd df stats at different stages After pool creation After writing data to a particular object in the pool After marking the acting pg set OSDs as 'out' 1. Create an application pool 2. Capture ceph osd df tree stats 3. Write data to an object of the pool 4. Fetch the acting pg set os...
def run(ceph_cluster, **kw): log.info(run.__doc__) config = kw["config"] test_pass = 0 run_iterations = config["run_iteration"] min_pass = 1 log.info(f"Test is configured to run {run_iterations} iterations") log.info( f"Due to unpredictability of ceph osd df stats," f" and v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_stats(self):\n\t\n\tceph_cluster = \"%s-%s\" % (self.prefix, self.cluster)\n\n\tdata = { ceph_cluster: { } }\n\tadmin_folder=\"/var/run/ceph/\"\n\tif(os.path.isdir(admin_folder)):\n\t\tfiles=os.walk(admin_folder).next()[2]\n else:\n\t\tprint \"No folder exists \"+admin_folder\n\t\treturn -1\n\tabs_p...
[ "0.6354659", "0.60200405", "0.5848191", "0.5670488", "0.56321675", "0.56261504", "0.55338246", "0.55161625", "0.5498631", "0.5488863", "0.54046774", "0.5367444", "0.5302412", "0.5269159", "0.5256216", "0.52082723", "0.5189696", "0.5095138", "0.5063544", "0.5044357", "0.504118...
0.0
-1
Modifies the osd df tree stats dictionary to include additional keys for better traversal
def update_stats_dict(stats_dict: dict) -> dict: dict_copy = {} for node in stats_dict["nodes"]: if node["type"] == "osd": dict_copy.update({node["id"]: node}) elif node["type"] == "host": dict_copy.update({node["name"]: node}) dict_copy.update({"stray": stats_dict[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def improve_tree(tree, freq_dict):\n # todo", "def get_stats(self):\n\t\n\tceph_cluster = \"%s-%s\" % (self.prefix, self.cluster)\n\n\tdata = { ceph_cluster: { } }\n\tadmin_folder=\"/var/run/ceph/\"\n\tif(os.path.isdir(admin_folder)):\n\t\tfiles=os.walk(admin_folder).next()[2]\n else:\n\t\tprint \"No f...
[ "0.61935604", "0.6069216", "0.6001222", "0.576004", "0.57425445", "0.56485784", "0.5601644", "0.5563706", "0.555342", "0.5531584", "0.539289", "0.53479964", "0.5272574", "0.5258337", "0.52559775", "0.5252622", "0.5247009", "0.52317107", "0.51732695", "0.5172705", "0.51663923"...
0.6601258
0
Verifies the deviation in stats
def verify_deviation( config: dict, type: str, stage: str, host_id: str = None, osd_id: int = None, status: str = None, ) -> bool: acting_total_size = ( acting_total_raw_use ) = acting_total_data = acting_total_avail = 0 stored_data_kb = config["WI"] * 4 * 1024 pre_osd_df...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stddev(self):\n self.assertEqual(stddev(list1, sample=False), np.std(list1))\n self.assertEqual(stddev(list1), np.std(list1, ddof=1))", "def test_sufficient_statistics(self):\n assert (\n len(self.data),\n self.data.var(),\n self.data.mean(),\n ...
[ "0.7381295", "0.71577626", "0.69679904", "0.6539895", "0.6536356", "0.6529471", "0.64682317", "0.64345634", "0.63613415", "0.63195497", "0.63113904", "0.63113904", "0.6262971", "0.6247433", "0.62201494", "0.619837", "0.61486155", "0.61385334", "0.6110205", "0.6108499", "0.609...
0.591325
48
Get user_hw_action list ordered by hw_action id desc.
async def get_user_hw_action_list( request: Request, user_id: object = None, name=None, limit: int = 0, offset: int = 0) -> list: ret_val = [] query_str = get_user_hw_action_list_query try: if limit > 0: query_str += ' ORDER BY uhwa.id DESC LIMIT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_user_hw_action_dropdown_list(\n request: Request,\n user_id: object = None,\n name=None,\n limit: int = 0,\n offset: int = 0) -> list:\n ret_val = []\n\n query_str = get_user_hw_action_list_query\n\n try:\n if limit > 0:\n query_str += ' O...
[ "0.67384195", "0.6622735", "0.6605048", "0.59234667", "0.59082854", "0.5831477", "0.55603856", "0.5509714", "0.53983074", "0.5274773", "0.52493", "0.52375597", "0.52054816", "0.5151684", "0.5059717", "0.501881", "0.5018441", "0.50154513", "0.4879599", "0.4847937", "0.4837456"...
0.7527538
0
Get user_hw_action list count.
async def get_user_hw_action_list_count( request: Request, user_id: object = None, name=None) -> int: ret_val = 0 query_str = get_user_hw_action_list_count_query try: async with request.app.pg.acquire() as connection: row = await connection.fetchval(query_str, u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_actions():\n return 6", "def get_number_of_actions(self):\n return self.__environment.action_space.n", "def action_count(self):\n raise NotImplementedError", "async def get_user_hw_action_list(\n request: Request,\n user_id: object = None,\n name=None,\n l...
[ "0.6756155", "0.66021574", "0.6536091", "0.60807174", "0.6020988", "0.59411806", "0.589664", "0.58373946", "0.5837161", "0.5816002", "0.5805106", "0.5792135", "0.5719951", "0.57095796", "0.5677916", "0.56623185", "0.56425726", "0.5635936", "0.55697066", "0.55688494", "0.55645...
0.8094028
0
Get user_hw_action dropdown list.
async def get_user_hw_action_dropdown_list( request: Request, user_id: object = None, name=None, limit: int = 0, offset: int = 0) -> list: ret_val = [] query_str = get_user_hw_action_list_query try: if limit > 0: query_str += ' ORDER BY uha.id DE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_user_hw_action_list(\n request: Request,\n user_id: object = None,\n name=None,\n limit: int = 0,\n offset: int = 0) -> list:\n ret_val = []\n\n query_str = get_user_hw_action_list_query\n\n try:\n if limit > 0:\n query_str += ' ORDER BY u...
[ "0.59505457", "0.5507002", "0.5401321", "0.53395784", "0.53354234", "0.53100324", "0.52825046", "0.52602917", "0.52471375", "0.5244501", "0.52289706", "0.51792496", "0.5178827", "0.51756155", "0.5133339", "0.5132621", "0.51210713", "0.5054093", "0.50498927", "0.5021374", "0.5...
0.72873855
0
Get user_hw_action element by hw_action id.
async def get_user_hw_action_element( request: Request, user_id: object = None, user_hw_action_id: int = 0) -> dict: ret_val = {} query_str = get_user_hw_action_element_query try: async with request.app.pg.acquire() as connection: row = await connection.fetchrow...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def update_user_hw_action_element(\n request: Request,\n user_hw_action_id: int = 0,\n user_id: object = None,\n hw_action_id: object = None,\n value: str = '',\n date_from: object = None,\n date_to: object = None,\n active: bool = True) -> dict:\n\n ...
[ "0.602205", "0.59792584", "0.59128565", "0.58285356", "0.57795525", "0.57200396", "0.5680287", "0.5650404", "0.5606802", "0.55979854", "0.55730385", "0.55720365", "0.54777026", "0.5474907", "0.5447135", "0.5384388", "0.5359117", "0.5357769", "0.5350716", "0.5302518", "0.52932...
0.770337
0
Updated user hw action element.
async def update_user_hw_action_element( request: Request, user_hw_action_id: int = 0, user_id: object = None, hw_action_id: object = None, value: str = '', date_from: object = None, date_to: object = None, active: bool = True) -> dict: ret_val = {} ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Update(self, action, context):\n # type: (QtWidgets.QAction, MenuContext) -> None\n pass", "def command_update_hw(self, cmd):\n # TODO\n pass", "def user_update(user, action, change, data={}):\n return user, action, change()", "def update_user():\n #TODO user update \n ...
[ "0.6150106", "0.59626174", "0.5933568", "0.58857137", "0.58615917", "0.5740417", "0.5662136", "0.56096417", "0.5524114", "0.55016327", "0.5501093", "0.54874814", "0.5487117", "0.5476334", "0.5474875", "0.54568803", "0.5452883", "0.54350376", "0.5420841", "0.5420841", "0.53956...
0.663944
0
Get user hw action location element
async def get_user_hw_action_location_element( request: Request, user_hw_action_id: int = 0, location_id: int = 0) -> dict: ret_val = {} query_str = get_user_hw_action_location_element_query try: async with request.app.pg.acquire() as connection: row = await con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location(self):\n return self.element.location", "def location(self):\n return search.element_name_by_href(self.data.get('location_ref'))", "def get_current_location(self):\n return self.enu_2_local()", "def get_location(self):\n\t\treturn self.location", "def get_location(self):\r...
[ "0.68536544", "0.65936947", "0.6374254", "0.63637877", "0.62197864", "0.6178854", "0.6134134", "0.6015696", "0.6000962", "0.5996341", "0.59563094", "0.59520364", "0.5944723", "0.59436655", "0.5903937", "0.5886975", "0.58827984", "0.5865026", "0.5841604", "0.58148557", "0.5805...
0.652199
2
Delete user hw action location element
async def delete_user_hw_action_location_association( request: Request, user_hw_action_id: int = 0, location_id: int = 0) -> dict: ret_val = {} query_str = delete_user_hw_action_location_element_query try: async with request.app.pg.acquire() as connection: row =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_location(self, location_id):", "def delete_testing_loc():\n\n user_id = session.get('user_id', None)\n test_id = request.form.get('test_id')\n del_testing_saved_locations(user_id, test_id)\n\n flash(\"Location removed!\")\n\n return jsonify(\"Success!\")", "def destroy_unoccupied(requ...
[ "0.7080843", "0.63735086", "0.6227535", "0.6211661", "0.61750007", "0.59836805", "0.59447455", "0.5835343", "0.5828464", "0.5793558", "0.5763661", "0.5722859", "0.5694722", "0.5685501", "0.568324", "0.56825525", "0.56595117", "0.56583446", "0.56460756", "0.56391454", "0.56366...
0.665624
1
Create user hw action location element
async def create_user_hw_action_location_element( request: Request, user_hw_action_id: int = 0, location_id: int = 0) -> dict: ret_val = {} query_str = create_user_hw_action_location_element_query try: async with request.app.pg.acquire() as connection: row = awa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_location(self, location):\n \"Does nothing\"", "async def update_user_hw_action_location_element(\n request: Request,\n user_hw_action_id: int = 0,\n location_id: int = 0) -> dict:\n\n ret_val = {}\n\n try:\n\n user_hw_action_location = await get_user_hw_action...
[ "0.6501098", "0.6049239", "0.5852175", "0.55307126", "0.5457156", "0.5445937", "0.5387072", "0.53646594", "0.526601", "0.5258049", "0.524216", "0.5242155", "0.5239184", "0.52304375", "0.52004963", "0.5198689", "0.51953", "0.519014", "0.51771957", "0.5176893", "0.5176216", "...
0.6528975
0
Update user hw action location association.
async def update_user_hw_action_location_element( request: Request, user_hw_action_id: int = 0, location_id: int = 0) -> dict: ret_val = {} try: user_hw_action_location = await get_user_hw_action_location_element( request, user_hw_action_id=user_hw_action_id, locat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def delete_user_hw_action_location_association(\n request: Request,\n user_hw_action_id: int = 0,\n location_id: int = 0) -> dict:\n\n ret_val = {}\n query_str = delete_user_hw_action_location_element_query\n try:\n\n async with request.app.pg.acquire() as connection:\n ...
[ "0.5593399", "0.54550964", "0.54339", "0.53970563", "0.53875065", "0.5344133", "0.53124726", "0.5286892", "0.52606964", "0.5176878", "0.51755166", "0.5131439", "0.5119593", "0.5117834", "0.50947464", "0.5019211", "0.5009067", "0.50087947", "0.49611032", "0.49488407", "0.49445...
0.67727256
0
Get user hw action location element
async def get_user_hw_action_list_by_location_id( request: Request, user_id: object = None, location_id: int = 0) -> []: ret_val = [] query_str = get_attached_user_hw_action_list_for_location_query try: async with request.app.pg.acquire() as connection: rows = a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location(self):\n return self.element.location", "def location(self):\n return search.element_name_by_href(self.data.get('location_ref'))", "async def get_user_hw_action_location_element(\n request: Request,\n user_hw_action_id: int = 0,\n location_id: int = 0) -> dict:\n...
[ "0.68536544", "0.65936947", "0.652199", "0.6374254", "0.63637877", "0.62197864", "0.6178854", "0.6134134", "0.6015696", "0.6000962", "0.5996341", "0.59563094", "0.59520364", "0.5944723", "0.59436655", "0.5903937", "0.5886975", "0.58827984", "0.5865026", "0.5841604", "0.581485...
0.0
-1
Get list of all user hw action ids attached on location. TU SAM
async def get_attached_user_hw_action_id_list( request: Request, location_id: int = 0) -> []: ret_val = [] query_str = get_attached_hw_action_id_list_for_location_query try: async with request.app.pg.acquire() as connection: rows = await connection.fetch(query_str, loca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_user_hw_action_list_by_location_id(\n request: Request,\n user_id: object = None,\n location_id: int = 0) -> []:\n\n ret_val = []\n query_str = get_attached_user_hw_action_list_for_location_query\n try:\n\n async with request.app.pg.acquire() as connection:\n ...
[ "0.76256377", "0.70122194", "0.60559696", "0.5912093", "0.5893191", "0.5842051", "0.5704554", "0.5671783", "0.564515", "0.56439936", "0.5610305", "0.5608252", "0.5578609", "0.55730045", "0.54980344", "0.54745597", "0.5443029", "0.54367554", "0.54084855", "0.53930837", "0.5378...
0.7853884
0
Delete user hw action list attached to location id.
async def delete_user_hw_action_list_by_location_id( request: Request, user_id: object = None, location_id: int = 0) -> []: ret_val = [] query_str = delete_attached_user_hw_action_list_for_location_query try: # print('THIS IS LOCATION ID: {}'.format(location_id)) att...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def delete_user_hw_action_location_association(\n request: Request,\n user_hw_action_id: int = 0,\n location_id: int = 0) -> dict:\n\n ret_val = {}\n query_str = delete_user_hw_action_location_element_query\n try:\n\n async with request.app.pg.acquire() as connection:\n ...
[ "0.67462575", "0.66135746", "0.63126004", "0.6176471", "0.6121506", "0.60958934", "0.591431", "0.58870196", "0.58680236", "0.5824778", "0.58092797", "0.57698774", "0.57125425", "0.56117177", "0.5607668", "0.55849206", "0.55827045", "0.55230117", "0.55137694", "0.55057746", "0...
0.7934018
0
Draw bounding boxed onto the image
def drawbboxes(img, bboxes, labels): thickness = 5 color = (0, 255, 0) for bbox in bboxes: # top-left is x1, y1; bottom-right is x2,y2 x1, y1, x2, y2, prob, category = ( int(bbox[0]), int(bbox[1]), int(bbox[2]), int(bbox[3]), round(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_bounding_box(self):\n # Gets the bounding box\n xmin, ymin, xmax, ymax = self.get_bounding_box()\n\n # Gets the actual coordinates\n width = xmax - xmin\n height = ymax - ymin\n center_x = xmin + (width)/2\n center_y = ymin + (height)/2\n\n arcade.dr...
[ "0.77712685", "0.76849055", "0.7562201", "0.75134575", "0.73591447", "0.7358335", "0.7353399", "0.73522115", "0.7331908", "0.73184025", "0.7309459", "0.7308429", "0.7307081", "0.7268463", "0.7257159", "0.72540283", "0.72288364", "0.72080255", "0.7205461", "0.7161313", "0.7146...
0.6974417
29
Generate the first N primes
def _findNextPrime(self, N): primes = self.primes nextPrime = primes[-1]+1 while(len(primes)<N): maximum = nextPrime * nextPrime prime = 1 for i in primes: if i > maximum: break if nextPrime % i == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_primes(N):\n primes = set()\n for n in range(2, N):\n if all(n % p > 0 for p in primes):\n primes.add(n)\n yield n", "def gen_primes():\n\n n = 1\n while True:\n while not isPrime(n):\n n += 1\n\n yield n\n n += 1", "def primes(n)...
[ "0.8032095", "0.7940773", "0.7788888", "0.7755533", "0.77396107", "0.77060723", "0.76518106", "0.7612008", "0.7566803", "0.7491498", "0.7489189", "0.7489189", "0.74748844", "0.745746", "0.7439991", "0.74351233", "0.74350524", "0.74298567", "0.740982", "0.73990273", "0.7387336...
0.0
-1
Set up and run the PC algorithm.
def learn(self, data, **kwargs): if isinstance(data, np.ndarray): data = data elif isinstance(data, Tensor): data = data.data else: raise TypeError('The type of tensor must be ' 'Tensor or array, but got {}.' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n grid_tester_cpu = GridTesterCPU()\n\n # parse args, load configuration and create all required objects.\n grid_tester_cpu.setup_grid_experiment()\n\n # GO!\n grid_tester_cpu.run_grid_experiment()", "def main():\n\n # parse arguments\n args = parseArguments()\n\n # read prism...
[ "0.62750775", "0.62392306", "0.62243366", "0.61408746", "0.6078317", "0.6012745", "0.5939468", "0.5867706", "0.5862662", "0.5837344", "0.5825207", "0.5808146", "0.58055526", "0.57992464", "0.57770425", "0.5759497", "0.5742486", "0.574188", "0.57414085", "0.57380426", "0.57267...
0.0
-1
Origin PCalgorithm for learns a skeleton graph It learns a skeleton graph which contains only undirected edges from data. This is the original version of the PCalgorithm for the skeleton.
def origin_pc(data, alpha=0.05, ci_test='gauss'): n_features = data.shape[1] skeleton = np.ones((n_features, n_features)) - np.eye(n_features) nodes = list(range(n_features)) sep_set = {} k = 0 while k <= n_features - 2: for i, j in combinations(nodes, 2): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self):\n\n self.points = [[0.360502, 0.535494],\n [0.476489, 0.560185],\n [0.503125, 0.601218],\n [0.462382, 0.666667],\n [0.504702, 0.5]]\n self.max_neighbors = 4\n self.beta = 1\n self.gr...
[ "0.6040429", "0.5958363", "0.59034085", "0.58729905", "0.58238524", "0.57987046", "0.5795609", "0.57561105", "0.57150114", "0.56617105", "0.5611934", "0.55944544", "0.5586429", "0.5579978", "0.55473566", "0.55459243", "0.55184305", "0.5506417", "0.5499248", "0.5451292", "0.54...
0.0
-1
Extending the Skeleton to the Equivalence Class it orients the undirected edges to form an equivalence class of DAGs.
def orient(skeleton, sep_set): def _rule_1(cpdag): """Rule_1 Orient i——j into i——>j whenever there is an arrow k——>i such that k and j are nonadjacent. """ columns = list(range(cpdag.shape[1])) ind = list(combinations(columns, 2)) for ij in sorted(ind, key=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, graph, head_vertex, tail_vertex):\n super(DirectedGraphEdge, self).__init__(\n graph, head_vertex, tail_vertex)\n self.directed = True", "def edges(self):\n return self.dovetails + self.containments + self.internals", "def edges( self ):\n raise NotImplementedE...
[ "0.62689716", "0.61911035", "0.61797935", "0.61108476", "0.60639524", "0.5973338", "0.5946889", "0.5874214", "0.5860264", "0.5859833", "0.58505654", "0.57446796", "0.5735656", "0.5724727", "0.57156485", "0.5713852", "0.56933445", "0.5674245", "0.5664631", "0.5652197", "0.5646...
0.0
-1
Test if config.yaml file exists in config folder.
def test_config_file(): relevant_path = 'config/config.yaml' abs_path = os.path.realpath(relevant_path) # Check if file exists. assert os.path.exists(abs_path) # Check if file is empty. assert os.stat(abs_path).st_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_configuration(config_file=CONFIG_FILE):\n return os.path.exists(config_file)", "def is_config_exist(self) -> bool:\n return True", "def is_config_exist(self) -> bool:\n pass", "def __check_config(self):\n if not os.path.exists(self.__config_path):\n return False\n ...
[ "0.77379924", "0.7632633", "0.75667185", "0.7397804", "0.7272717", "0.7220745", "0.7140805", "0.7111078", "0.7091864", "0.7063259", "0.7046011", "0.7018934", "0.6968373", "0.6886471", "0.68702066", "0.6865221", "0.6844457", "0.6803416", "0.676057", "0.6751352", "0.67058784", ...
0.7255091
5
Test if redis server is running.
def test_redis_running(): redis_con = redis.Redis( host=CONFIGURATION.db_conn, decode_responses=True) assert redis_con.ping()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redis_available():\n try:\n redis = Redis(host=redis_host, port=redis_port, db=0)\n redis.ping()\n return True\n except ConnectionError as err:\n app.logger.error(f\"Error connecting to Redis!\\n{err}\")\n return False", "def _is_redis_available(self) -> None:\n tr...
[ "0.7799736", "0.745106", "0.7371115", "0.6799531", "0.67003757", "0.6665098", "0.6611009", "0.6577387", "0.64906377", "0.64849025", "0.64692163", "0.64440393", "0.64254373", "0.641254", "0.6397969", "0.63782674", "0.63555396", "0.6347723", "0.63210845", "0.6318967", "0.631784...
0.72339714
3
Handles the spawn animation of the badguy, as well as stepping it. To control the movement of the badguy, use the _step method.
def draw(self, display): if self.timeAlive < self.SPAWN_TIME: size = (self.timeAlive / self.SPAWN_TIME) * self.size deltaSize = self.size - size rect = (self.x + deltaSize/2, self.y + deltaSize/2, size, size) else: rect = self.getRect() pygame.draw.rect(display, self.color, rect)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self):\n # update the score\n isScoreUpdated = self.update_score()\n \n # the player hit an obstacle\n isFail = self.fail()\n if isFail:\n self.inGame = False\n # display an explosion instead of the bird image\n self.bird.img = jpg...
[ "0.7354633", "0.66762555", "0.661416", "0.6475774", "0.6331404", "0.63233566", "0.6284419", "0.6187574", "0.61616313", "0.60236317", "0.59376556", "0.5929646", "0.5860624", "0.5797467", "0.5768062", "0.57603824", "0.5752826", "0.5739384", "0.5737266", "0.5705262", "0.57004684...
0.0
-1
Should be used in sub classes instead of the 'move' method
def _step(self, board, elapsedTime): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n pass", "def move(self):\n raise NotImplementedError", "def move(self, move):\n raise NotImplementedError()", "def handleMove(self):\n pass", "def move(x,y):\r\n pass", "def move(): #py:move\n RUR._move_()", "def _move(self, dx, dy):\n pass...
[ "0.8534061", "0.83637327", "0.8025636", "0.77996737", "0.77613586", "0.77331686", "0.7699105", "0.7663987", "0.7663987", "0.7572486", "0.75487596", "0.7467425", "0.7459893", "0.7332382", "0.73218215", "0.7296372", "0.727472", "0.7264184", "0.72614944", "0.7259982", "0.7240074...
0.0
-1
Random velocity as an integer Between 1050 pixels per second
def _randomVelocity(self): return random.choice([-1, 1]) * random.randint(10, 50)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_velocity():\n vel_dir = np.random.random(2) * 2 - 1\n vel = vel_dir * np.random.randint(2, 6)\n vel = np.where(np.abs(vel) > 1, vel, (vel / vel) * 1).astype(np.float16)\n return vel", "def getRandSpeed(self) -> int:\n num = int(random.uniform(-4,4))\n while(-1<=num and num<=1...
[ "0.7667083", "0.7054428", "0.67863053", "0.66575736", "0.66035014", "0.6495527", "0.6449711", "0.6372023", "0.63706774", "0.6259101", "0.6254404", "0.6229643", "0.61981577", "0.6197165", "0.6170514", "0.61581373", "0.61581373", "0.6146865", "0.61138713", "0.60814106", "0.6081...
0.8211917
0
Initialization for the stats_kstest2 PyEF
def ferret_init(id): axes_values = [ pyferret.AXIS_DOES_NOT_EXIST ] * pyferret.MAX_FERRET_NDIM axes_values[0] = pyferret.AXIS_CUSTOM false_influences = [ False ] * pyferret.MAX_FERRET_NDIM retdict = { "numargs": 2, "descript": "Returns two-sided Kolmogorov-Smirnov test stat. and prob. " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n OWSReport.__init__(self)\n self.stats['type'] = 'OGC:WFS'\n self.stats['operations']['GetFeature'] = {}\n self.stats['operations']['GetFeature']['hits'] = 0\n self.stats['operations']['GetFeature']['resource'] = {}\n self.stats['operations']['GetFeatu...
[ "0.6536536", "0.6523687", "0.6440295", "0.6292426", "0.6216726", "0.61940217", "0.616995", "0.6141823", "0.61197877", "0.6089913", "0.6045456", "0.6023564", "0.60142875", "0.60132265", "0.5993051", "0.59765166", "0.5968956", "0.59576225", "0.594918", "0.5932121", "0.5931817",...
0.0
-1
Define custom axis of the stats_kstest2 Ferret PyEF
def ferret_custom_axes(id): axis_defs = [ None ] * pyferret.MAX_FERRET_NDIM axis_defs[0] = ( 1, 2, 1, "KS,P", False ) return axis_defs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature_axes(self):\n raise NotImplementedError()", "def __init__(self, axis=-1):\n self.axis = axis", "def getAxisValuesEvent(self): \n varID = self.myParent.getVar().id\n axisVar = MV2.array(self.axis)\n axisVar.setAxis(0, self.axis)\n axisVar.id = varID +...
[ "0.5768559", "0.5655012", "0.54957694", "0.5450697", "0.54254967", "0.54239786", "0.534711", "0.53141004", "0.53086776", "0.5305469", "0.5283433", "0.5283112", "0.52304465", "0.5202986", "0.5171157", "0.5163523", "0.5158583", "0.5118967", "0.5083052", "0.508089", "0.50685585"...
0.6452346
0
Performs a twosided KolmogorovSmirnov test that two samples come from the same continuous probability distribution. The samples are given in inputs[0] and inputs[1]. The test statistic value and twotailed probability are returned in result. Undefined data given in each sample are removed (independently from each other)...
def ferret_compute(id, result, resbdf, inputs, inpbdfs): badmask = ( numpy.fabs(inputs[0] - inpbdfs[0]) < 1.0E-5 ) badmask = numpy.logical_or(badmask, numpy.isnan(inputs[0])) goodmask = numpy.logical_not(badmask) sampa = inputs[0][goodmask] badmask = ( numpy.fabs(inputs[1] - inpbdfs[1]) < 1.0E-5 ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ks_test(a,b):\n a,b = np.asarray(a),np.asarray(b)\n if len(a) != len(a):\n raise ValueError(\"a and b must have the same size\")\n \n return stats.ks_2samp(a,b)", "def ks_test_function(dim, thresh):\n def ks_test(table1, table2):\n from scipy.stats import ks_2samp\n sample1 = table1...
[ "0.6880017", "0.6557765", "0.6447936", "0.63107085", "0.61914057", "0.61625147", "0.6154184", "0.6102408", "0.60062313", "0.59758687", "0.59493685", "0.5930745", "0.59161687", "0.59048134", "0.590476", "0.5875343", "0.5870566", "0.58697563", "0.58434045", "0.5839029", "0.5817...
0.0
-1
Returns the nth term of numbers that can be arranged into square geometric shape [1, 4, 9, 16, 25]
def square(n): result = [num * num for num in range(n)] return result[1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_squares(n):\n\n return sum([i * i for i in range(n)])", "def sumn(n):\n return n * (n + 1) // 2", "def make_magic_square(N): # part a\n if N % 2 == 0:\n print('N must be odd.')\n my_magic_square = np.zeros((N, N))\n i = 0\n j = np.ceil(N / 2.).astype(int)\n n = 1\n while...
[ "0.6654097", "0.6645765", "0.6628288", "0.6544411", "0.6495181", "0.64792395", "0.6476472", "0.64307666", "0.6338609", "0.6326272", "0.6326233", "0.63204867", "0.62681097", "0.6245962", "0.62326", "0.6215533", "0.6200931", "0.61916393", "0.6187712", "0.6138505", "0.6131578", ...
0.60689145
24
Returns the nth term of numbers that can be arranged in triangular geometric shapes [1, 3, 6, 10, 15, 21, 28, 36, 45, 55]
def triangle(n): j = 1 k = 1 result = [] for num in range(1, n + 1): result.append(num) j = j + 1 k = k + j return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangular_number(n):\n return n*(n+1) / 2", "def get_triangle_numbers(n):\n r = []\n for i in xrange(1, n + 1):\n t = ((i * (i + 1)) / 2)\n r.append(t)\n return r", "def triangular_number_solution():\n return 5 * partial_sum(199) + 3 * partial_sum(333) - 15 * partial_sum(66)",...
[ "0.73858964", "0.7210311", "0.7092502", "0.6745563", "0.6743962", "0.6701218", "0.6698872", "0.6612875", "0.6611935", "0.65928775", "0.6560771", "0.6393796", "0.6322339", "0.63076645", "0.62178034", "0.6202364", "0.6192739", "0.6190876", "0.6149931", "0.61437035", "0.612709",...
0.63265973
12
Returns the nth term of the numbers that can be arranged as symmetric cube shapes [1, 8, 27, 64]
def cube(n): result = [num*num*num for num in range(n)] return result[1:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cube(n):\n return n**3", "def six_cubed():\n print(math.pow(6,3))", "def six_cubed():\n print(math.pow(6, 3))", "def cube(num):\n return num ** 3", "def collatz(n):\n if n%2==0: return n/2\n else: return 3*n+1", "def cube(x):\n return x ** 3", "def cube(x):\n return x ** 3",...
[ "0.71186316", "0.6480103", "0.64490527", "0.643903", "0.6316823", "0.6301688", "0.6301688", "0.61822426", "0.61690825", "0.6110071", "0.6092846", "0.6074926", "0.60742134", "0.6055168", "0.603976", "0.6007538", "0.5919181", "0.5917835", "0.5869493", "0.5855652", "0.58506876",...
0.66809696
1
This the constructor of the class
def __init__(self, scn_line_list): self.scn_line_list = scn_line_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__ (self) :", "def __init__(self) -> None:\n # TODO: Provide the complete constructor for this object", "def __init__ (self):\n pass", "def __init__(__self__):\n pass", "def __init__(__self__):\n pass", "def __init__(__self__):\n pass", "def __init__(__self_...
[ "0.8620433", "0.8459897", "0.8429507", "0.8239876", "0.8239876", "0.8239876", "0.8239876", "0.8239876", "0.8239876", "0.8239876", "0.8239876", "0.8239876", "0.8239876", "0.82126653", "0.82126653", "0.82126653", "0.82126653", "0.81774354", "0.81774354", "0.81774354", "0.817743...
0.0
-1
Add the the self.scn_line_list variable the command for the utilization of the INIT testbench command.
def DATA_CHECKER_INIT(self, alias, index, file_path): line_to_print = "DATA_CHECKER[{0}] INIT({1}, {2})".format(alias, index, file_path) self.scn_line_list.append(line_to_print)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, scn_line_list):\n self.scn_line_list = scn_line_list", "def at_cmdset_creation(self):\n self.add(Command())", "def __init__(self, command_line: List[str]) -> None:\n self.command_line = list(command_line)", "def __init__(self, command_list, ):\n self.command_lis...
[ "0.6523301", "0.5951089", "0.5943871", "0.5942963", "0.58159584", "0.5575033", "0.5569893", "0.5569893", "0.5542223", "0.5503401", "0.5458512", "0.5442024", "0.5420204", "0.5397194", "0.5389913", "0.53692174", "0.5357473", "0.5353473", "0.5312238", "0.53019863", "0.52967995",...
0.614542
1
Add the the self.scn_line_list variable the command for the utilization of the CLOSE testbench command.
def DATA_CHECKER_CLOSE(self, alias, index): line_to_print = "DATA_CHECKER[{0}] CLOSE({1})".format(alias, index) self.scn_line_list.append(line_to_print)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_command( self, more_command_list ):\n print( f\"adding {more_command_list}\")\n if more_command_list is None: # perhaps was here to reinit to zero length ?? for now a do nothing\n pass\n #self.command_list = more_command_list # [ r\"D:\\apps\\Notepad++\\no...
[ "0.56938934", "0.52051395", "0.52051395", "0.52051395", "0.51754934", "0.51447105", "0.5140671", "0.5131802", "0.511744", "0.5089544", "0.50882906", "0.50165707", "0.50131583", "0.4998877", "0.4987812", "0.4976306", "0.49725762", "0.4971059", "0.49568474", "0.4925168", "0.492...
0.57682115
0
Add the the self.scn_line_list variable the command for the utilization of the START testbench command.
def DATA_CHECKER_START(self, alias, index): line_to_print = "DATA_CHECKER[{0}] START({1})".format(alias, index) self.scn_line_list.append(line_to_print)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, scn_line_list):\n self.scn_line_list = scn_line_list", "def at_cmdset_creation(self):\n self.add(Command())", "def add_command( self, more_command_list ):\n print( f\"adding {more_command_list}\")\n if more_command_list is None: # perhaps was here to reinit to z...
[ "0.6256147", "0.5961203", "0.57699156", "0.575727", "0.5739611", "0.5714668", "0.56547904", "0.5527429", "0.5527429", "0.5519523", "0.5458115", "0.54491293", "0.54426163", "0.54194", "0.54053396", "0.540037", "0.5390845", "0.5390657", "0.5385797", "0.53646606", "0.5325605", ...
0.57352966
5
Add the the self.scn_line_list variable the command for the utilization of the STOP testbench command.
def DATA_CHECKER_STOP(self, alias, index): line_to_print = "DATA_CHECKER[{0}] STOP({1})".format(alias, index) self.scn_line_list.append(line_to_print)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postcmd(self, stop, line):\n return stop", "def postcmd(self, stop, line):\n return stop", "def postcmd(self, stop, line):\n return stop", "def postcmd(self, stop, line):\n return self.stop", "def stop_step_sweep(self):\n self.write(\":SOUR:SWE:CONT:STAT OFF\")", "d...
[ "0.6090302", "0.6090302", "0.6090302", "0.6050907", "0.561089", "0.5430249", "0.5337378", "0.5332673", "0.5306398", "0.52795744", "0.5278078", "0.52357876", "0.52136093", "0.51730543", "0.5147187", "0.5146876", "0.5143253", "0.51426625", "0.5127203", "0.5119826", "0.5065824",...
0.58821964
4
Publishes payload to broker
def publish(self, message: str, message_id: int) -> None: payload: str = self._create_payload(message, message_id) max_payload_bytes = 268435455 if size(payload) > max_payload_bytes: msg = Message.status_message('Message too large.') self.client.queue.put(msg) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish(node, payload, settings):\n entry = dict2node(payload)\n iq = build_iq(node, entry, settings)\n send_message(iq, settings)", "def test_publish(self):\n target_arn = 'testing'\n supercuboid_key = 'acd123'\n message_id = '123456'\n receipt_handle = 'a1b2c3d4'\n message = seriali...
[ "0.72166723", "0.7068219", "0.7034695", "0.7032267", "0.7002271", "0.6954458", "0.69328696", "0.6897745", "0.6872787", "0.68689084", "0.68362576", "0.680708", "0.6782415", "0.6754063", "0.67286843", "0.6695806", "0.6691802", "0.66524065", "0.66524065", "0.6646794", "0.6635083...
0.0
-1
whether or not str is quoted
def is_quoted(str): return ((len(str) > 2) and ((str[0] == "'" and str[-1] == "'") or (str[0] == '"' and str[-1] == '"')))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __is_quote(cls, char):\n return char in (\"'\", '\"')", "def isquoted(token):\n\n # Token is quoted\n return token.startswith((\"'\", '\"')) and token.endswith((\"'\", '\"'))", "def check_if_quotations(string):\n quote_found_double = False\n quote_found_single = False\n for i ...
[ "0.7705723", "0.75687397", "0.7266267", "0.6991756", "0.66225153", "0.66030955", "0.6500596", "0.64395237", "0.63842493", "0.6379116", "0.6355492", "0.6355275", "0.63462305", "0.6330335", "0.62957424", "0.62409854", "0.6199656", "0.6188422", "0.615714", "0.61365765", "0.61364...
0.8505823
0
whether or not str is a URL argument
def is_url_arg(str): return (True if URL_REGEX.match(str[1:-1] if is_quoted(str) else str) else False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_url(string):\n return \"http\" in string", "def __isUrl(self, url):\n if type(url)==str:\n return url.startswith('http://') or url.startswith('https://')\n return False", "def is_url(string):\n try:\n urlparse(string)\n return True\n except:\n retu...
[ "0.7797083", "0.75735813", "0.73908395", "0.7226459", "0.68933237", "0.6872319", "0.6832194", "0.68077755", "0.6775221", "0.67085016", "0.67078424", "0.6691067", "0.6662707", "0.6633087", "0.65910274", "0.65551054", "0.6544095", "0.6522813", "0.649989", "0.6471646", "0.646380...
0.8336535
0
Parses the Dockerfile which is referenced in f, invoking the appropriate methods in delegate
def parse_dockerfile_with_delegate(fp, delegate): mline = False line = '' for line0 in fp.read().splitlines(): # Skip next instruction if AWS_SKIP_REGEX.match(line0): delegate.run_skip() continue # Skip empty lines and comments elif COMMENT_REGEX.mat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_dockerfile_for_args(target):\n import colorama\n build_args = {}\n missing_args = {}\n empty_string = \"\"\n\n # read dockerfile for args that have no value\n try:\n with open(target + '/Dockerfile') as dockerfile:\n for line in dockerfile:\n if line.star...
[ "0.59220093", "0.55810225", "0.5559459", "0.543682", "0.53771085", "0.5376819", "0.5280178", "0.5260183", "0.5223538", "0.52198106", "0.519638", "0.51916337", "0.51782244", "0.51778024", "0.5171943", "0.5130877", "0.5123142", "0.509146", "0.5081681", "0.5074057", "0.5073434",...
0.73493445
0
Invoked when the AWSSKIP tag is encountered
def run_skip(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aws():\n pass", "def aws(ctx): # pylint: disable=unused-argument\n pass # pylint: disable=unnecessary-pass", "def lambda_handler(event, context):\n\n # try:\n # ip = requests.get(\"http://checkip.amazonaws.com/\")\n # except requests.RequestException as e:\n # # Send some cont...
[ "0.5460092", "0.5444555", "0.5390231", "0.5329598", "0.53241765", "0.5292699", "0.5228454", "0.5158473", "0.5130491", "0.5089109", "0.50497895", "0.5013864", "0.50080407", "0.50074095", "0.4966778", "0.4963516", "0.4954065", "0.49429783", "0.4926388", "0.4922026", "0.49124432...
0.0
-1
Invoked when a COMMENT or blank linke is encountered
def run_nop(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_comment(self, token: tokenize.TokenInfo) -> None:\n if not self._is_first_comment(token):\n return # this is a regular comment, not a shebang\n\n is_shebang = self._is_valid_shebang_line(token)\n self._check_executable_mismatch(token, is_shebang=is_shebang)\n if is...
[ "0.64750904", "0.64746445", "0.6356479", "0.6356479", "0.6350611", "0.63118047", "0.6250006", "0.6156523", "0.61275834", "0.61269605", "0.6079321", "0.6042149", "0.6038068", "0.5993506", "0.5990238", "0.5922821", "0.59152925", "0.5913502", "0.5866372", "0.5848782", "0.5844191...
0.0
-1
Invoked when the ENV variable key is assigned value
def run_env(self, key, value): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setitem__(self, key, item):\n super(EnvironmentVariables, self).__setitem__(key, item)\n os.environ[key] = item", "def setenv(self, key, value):\n self._env[key] = value", "def overwrite_environment_variable(self, key, value):\n if value is not None:\n self._printer...
[ "0.71190184", "0.6520684", "0.6477925", "0.6293351", "0.6282099", "0.62065995", "0.6192421", "0.6161247", "0.6156353", "0.6107239", "0.6044714", "0.60414433", "0.5981913", "0.59789765", "0.59789765", "0.59789765", "0.59789765", "0.59789765", "0.59789765", "0.59680593", "0.596...
0.73775166
0
Invoked when cmds should be run
def run_run(self, cmds): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_cmd(self):\r\n self.run = True", "def commands():", "def commands():\n pass", "def commands():\n pass", "def commands():\n pass", "def commands():\n pass", "def cmd(self):", "def run(self):\n self.cmdloop()", "def ConsoleRun(self, command, sender):\n pass", ...
[ "0.70180553", "0.6991362", "0.6942904", "0.6942904", "0.6942904", "0.6942904", "0.6696623", "0.6568137", "0.65501654", "0.6502923", "0.6490506", "0.6482494", "0.64726007", "0.64669955", "0.64531946", "0.6392404", "0.6375683", "0.6352139", "0.63419855", "0.6321749", "0.6284225...
0.8265414
0
Invoked when src should be copied to dst
def run_copy(self, src, dst): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self, src_path: str, tgt_path: str) -> None:", "def move(self, dst, src): # pragma: no cover\n raise NotImplementedError(\"Implement this\")", "def copy_contents(self, dst, src, size, condition=None, **kwargs):\n raise NotImplementedError()", "def copy_tree_checker(src, dst):\n ...
[ "0.684205", "0.66136926", "0.6580783", "0.6557567", "0.6547169", "0.65216875", "0.64992964", "0.6454224", "0.6365512", "0.62888414", "0.62716484", "0.62557656", "0.62125784", "0.62059265", "0.6173281", "0.6138458", "0.6135269", "0.6107685", "0.6085962", "0.6078006", "0.606501...
0.80904776
0
Invoked when src should be added to dst
def run_add(self, src, dst): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_copy(self, src, dst):\n pass", "def add_link (self, src, dst):\n raise NotImplementedError", "def add_req (self, src, dst):\n raise NotImplementedError", "def assign(self, dst, req, src):\n if req == 'null':\n return\n if req in ('write', 'inplace'):\n dst[:] = src\n ...
[ "0.7102323", "0.6734214", "0.662322", "0.65017915", "0.6429906", "0.64043015", "0.63439864", "0.60419446", "0.5963952", "0.5921709", "0.5847843", "0.583667", "0.58271646", "0.58191067", "0.5758026", "0.5722273", "0.572211", "0.57052636", "0.56613034", "0.5647836", "0.56400925...
0.7857617
0
Invoked when working directory should be changed to path
def run_workdir(self, path): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_dir(path): \r\n os.chdir(path)", "def change_to_current_path(to_change_path):\n os.chdir(to_change_path)", "def ChangeDir(self, path: str) -> None:\n ...", "def change_directory(path):\n os.chdir(path)", "def change_dir(self):\n self.working_dir = self.state_frame[0]\n ...
[ "0.7514439", "0.7437762", "0.73405415", "0.7314112", "0.72710043", "0.71237296", "0.7062804", "0.7062006", "0.70327294", "0.6955443", "0.69515866", "0.6932618", "0.69101954", "0.6870481", "0.68302286", "0.68110156", "0.68084985", "0.6769638", "0.675958", "0.6757047", "0.67124...
0.60719484
59
Invoked when an unknown command is run
def run_unknown(self, line): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unknown_command(self, cmd, *parms):\n print >>sys.stderr, \"Unknown command '%s'\" % (cmd)", "def unknown_command(data):\n command = data['command']\n return 'unknown_command: {}'.format(command)", "def default(self, line):\n print \"Command not found\\n\"", "def test_unknown_command(...
[ "0.81760466", "0.7516511", "0.7272017", "0.7190902", "0.6795418", "0.6682707", "0.65958893", "0.6591272", "0.6586724", "0.65395933", "0.6524024", "0.6501731", "0.6486791", "0.64444053", "0.6394469", "0.63827795", "0.63715756", "0.6370947", "0.6359915", "0.6354774", "0.6352545...
0.70297426
4
Method to return the summary without html
def search_listing_summary(self): text = self.listing_summary or self.introduction text = re.sub("<[^<]+?>", "", text) return text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary(self):\n return ''", "def summary_string(self) -> str:", "def summary(self) -> str:\n pass", "def summary(self):\n raise NotImplementedError", "def summary(self) -> str:\n return pulumi.get(self, \"summary\")", "def getSummary(self):\n return self.summary", ...
[ "0.8125443", "0.7835427", "0.77696085", "0.77576923", "0.77117586", "0.7691227", "0.76753163", "0.7572688", "0.75457954", "0.7514042", "0.7514042", "0.7514042", "0.7514042", "0.7514042", "0.7514042", "0.7514042", "0.75101477", "0.7493686", "0.73651654", "0.73521477", "0.73022...
0.70284224
30
Configure multimachine environment variables. It is required for multimachine training.
def configure_nccl(): os.environ["NCCL_SOCKET_IFNAME"] = "ib0" os.environ["NCCL_IB_DISABLE"] = "1" os.environ["NCCL_LAUNCH_MODE"] = "PARALLEL" os.environ["NCCL_IB_HCA"] = subprocess.getoutput( "cd /sys/class/infiniband/ > /dev/null; for i in mlx5_*; " "do cat $i/ports/1/gid_attrs/types/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetEnvironmentVars(self):\n for name, value, section in self._marchConfig():\n fetch_name = self._get_param_name(name, section)\n self._set_env_prop(fetch_name, value)", "def set_env():\n env.local_dotenv_path = os.path.join(\n os.path.dirname(__file__), 'etc/base_image...
[ "0.6803459", "0.6492966", "0.6338214", "0.63271946", "0.6301808", "0.6291753", "0.62452084", "0.6215378", "0.6207081", "0.62049985", "0.61579436", "0.6145428", "0.6145428", "0.6145428", "0.6145428", "0.6145428", "0.6145428", "0.60750026", "0.6015433", "0.5936353", "0.5933769"...
0.0
-1
Helper function to synchronize (barrier) among all processes when using distributed training
def synchronize(): if not dist.is_available(): return if not dist.is_initialized(): return current_world_size = dist.get_world_size() if current_world_size == 1: return dist.barrier()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_barrier():\n parrent_test_barrier(UseSpinLock=False)", "def parrent_test_barrier(UseSpinLock=False):\n test_barrier = SyncUtils.Barrier(4, timeout=0.001, UseSpinLock=UseSpinLock)\n shared_data = SharedArray.SharedNumpyArray((4,), np.float)\n procs = []\n for i in xrange(4):\n proc ...
[ "0.730564", "0.6965498", "0.68372697", "0.65674216", "0.6540994", "0.6431911", "0.6229587", "0.5923169", "0.5672002", "0.55587655", "0.55567956", "0.5555365", "0.5535524", "0.5514487", "0.541196", "0.5395281", "0.53882205", "0.5377751", "0.5253355", "0.5253355", "0.52502173",...
0.62719595
7
Run a HTTP GET Command
def run_get(config, payload, response): message = FakeMessage() message.raw_payload = payload response_queue = queue.Queue() headers = {"Content-Type": "application/json"} with aioresponses() as mocked: mocked.get( TestData.JOB_TEMPLATES_LIST_URL, status=200, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_get(self, api, command):\n return self._make_request_from_command('GET', command)", "def do_GET(self):\n self.http_method = 'GET'\n self.response()", "def do_GET(self):\n self.log.debug('do_GET called')\n self.HeadGet('GET')", "def do_GET(self):\r\n self._send_han...
[ "0.7734067", "0.76776236", "0.7654042", "0.7413864", "0.7293048", "0.7205309", "0.7096142", "0.70521706", "0.70348823", "0.702829", "0.69657195", "0.6962301", "0.69559294", "0.6927291", "0.6889245", "0.6877952", "0.68418443", "0.6814555", "0.67874604", "0.6780152", "0.6743673...
0.0
-1
Validate a GET Response, support filtering of keys
def validate_get_response(response, status, count, job_templates, keys=None): assert (response["status"]) == status json_response = json.loads(response["body"]) assert (json_response["count"]) == count results = json_response["results"] for item in results: matching_item = find_by_id(item["i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _processGETReq(self, args):\r\n try:\r\n action = args['action']\r\n userID = args['userID']\r\n key = args['key']\r\n except KeyError as e:\r\n return fail(InvalidRequest('Request is missing parameter: '\r\n '{0}'....
[ "0.6327493", "0.61642873", "0.61637753", "0.6151533", "0.60929775", "0.6083826", "0.6068708", "0.5998424", "0.59945625", "0.5935338", "0.5933575", "0.5927703", "0.58906925", "0.5883073", "0.58545053", "0.57754713", "0.571918", "0.56881785", "0.5681535", "0.5659925", "0.563357...
0.6159444
3
Compare if all the required keys are present in the response
def compare(this, other, keys): for key in keys: assert this[key] == other[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_get_response(response, status, count, job_templates, keys=None):\n assert (response[\"status\"]) == status\n json_response = json.loads(response[\"body\"])\n assert (json_response[\"count\"]) == count\n results = json_response[\"results\"]\n for item in results:\n matching_item =...
[ "0.7092991", "0.7030919", "0.69357586", "0.6573156", "0.64614594", "0.6458352", "0.6418331", "0.6416819", "0.63974136", "0.63761216", "0.6357081", "0.6346931", "0.6255482", "0.62182325", "0.61747485", "0.61106074", "0.61102325", "0.6108229", "0.61080027", "0.6103094", "0.6083...
0.0
-1
Find an object given its ID from a list of items
def find_by_id(object_id, items): for item in items: if object_id == item["id"]: return item raise Exception(f"Item with {object_id} not found")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object_by_id(self, object_list, object_id):\n obj = None\n for i in object_list:\n if i.get_id() == object_id:\n obj = i\n break\n return obj", "def find_item_by_id(self, item_id: str) -> ClientWorklistItem:\n # print(f'Finding item wit...
[ "0.7937062", "0.7304144", "0.7251918", "0.7070019", "0.705509", "0.7005335", "0.69254357", "0.69254357", "0.6823798", "0.68061745", "0.678606", "0.66440827", "0.6587592", "0.6525803", "0.65205777", "0.6463741", "0.64635897", "0.6457988", "0.64533836", "0.6448341", "0.64291537...
0.84317213
0
Test GZIP of Response Data
def test_execute_get_success_with_gzip(): response_queue = run_get( TestData.RECEPTOR_CONFIG, json.dumps(TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_PAGE_GZIPPED), TestData.JOB_TEMPLATE_RESPONSE, ) result = response_queue.get() response = ast.literal_eval(gzip.decompress(result).decode(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compress_response(self):\n r = GZipMiddleware(self.get_response)(self.req)\n self.assertEqual(self.decompress(r.content), self.compressible_string)\n self.assertEqual(r.get(\"Content-Encoding\"), \"gzip\")\n self.assertEqual(r.get(\"Content-Length\"), str(len(r.content)))", "...
[ "0.7662669", "0.7466027", "0.74310637", "0.74276054", "0.7092217", "0.6946119", "0.6911681", "0.6900273", "0.6785267", "0.6684273", "0.6622609", "0.6614098", "0.65979457", "0.6580155", "0.65671855", "0.6519905", "0.6445194", "0.64434713", "0.63295513", "0.63027114", "0.618010...
0.622714
20
Test GZIP of Response Data with auth based on token
def test_execute_get_success_with_gzip_and_token(): response_queue = run_get( TestData.RECEPTOR_CONFIG_WITH_TOKEN, json.dumps(TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_PAGE_GZIPPED), TestData.JOB_TEMPLATE_RESPONSE, ) result = response_queue.get() response = ast.literal_eval(gzip.decom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compress_response(self):\n r = GZipMiddleware(self.get_response)(self.req)\n self.assertEqual(self.decompress(r.content), self.compressible_string)\n self.assertEqual(r.get(\"Content-Encoding\"), \"gzip\")\n self.assertEqual(r.get(\"Content-Length\"), str(len(r.content)))", "...
[ "0.64231884", "0.6303117", "0.62485754", "0.62033486", "0.6057775", "0.59728307", "0.59655356", "0.58753145", "0.58155596", "0.5787948", "0.5768144", "0.5756306", "0.5748797", "0.57227874", "0.5624076", "0.560112", "0.55530196", "0.55351084", "0.5535004", "0.5500486", "0.5498...
0.6126089
4
Test GZIP of Filtered Response Data
def test_execute_get_success_with_filter_gzip(): response_queue = run_get( TestData.RECEPTOR_CONFIG, json.dumps(TestData.JOB_TEMPLATE_PAYLOAD_FILTERED_SINGLE_PAGE_GZIPPED), TestData.JOB_TEMPLATE_RESPONSE, ) result = response_queue.get() response = ast.literal_eval(gzip.decompress...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compress_response(self):\n r = GZipMiddleware(self.get_response)(self.req)\n self.assertEqual(self.decompress(r.content), self.compressible_string)\n self.assertEqual(r.get(\"Content-Encoding\"), \"gzip\")\n self.assertEqual(r.get(\"Content-Length\"), str(len(r.content)))", "...
[ "0.71517277", "0.71117556", "0.70806825", "0.706735", "0.6641811", "0.65906185", "0.65693676", "0.6560868", "0.6498594", "0.64479876", "0.63366264", "0.6305139", "0.6245202", "0.6183442", "0.61493707", "0.6140885", "0.61400443", "0.6094439", "0.60828453", "0.60821", "0.604796...
0.65055555
8
Test Multiple pages of response coming back
def test_execute_get_success_with_multiple_pages(): response_queue = queue.Queue() message = FakeMessage() message.raw_payload = json.dumps(TestData.JOB_TEMPLATE_PAYLOAD_ALL_PAGES) headers = {"Content-Type": "application/json"} with aioresponses() as mocked: mocked.get( TestData...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_response_is_paginated(self):\r\n user = ViewAfishaTests.mentor\r\n EventFactory.create_batch(50, city=user.profile.city)\r\n client = self.return_authorized_user_client(user)\r\n\r\n response_data = client.get(path=EVENTS_URL).data\r\n\r\n self.assertTrue(\"next\" in res...
[ "0.70876974", "0.6742121", "0.65078133", "0.650118", "0.648242", "0.64380234", "0.6427036", "0.6399775", "0.63872343", "0.6385378", "0.6381569", "0.6349449", "0.6338915", "0.63041335", "0.628687", "0.62860924", "0.6275239", "0.6251562", "0.62098557", "0.6196413", "0.6176467",...
0.6826234
1
When we get a bad data from the server, raise an exception
def test_execute_get_exception(): message = FakeMessage() message.raw_payload = json.dumps(TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_PAGE_GZIPPED) with aioresponses() as mocked: mocked.get( TestData.JOB_TEMPLATES_LIST_URL, status=400, body="Bad Request in Get Call" ) with pyte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process_not_ok_response(content, status):\n if status == codes.bad:\n length = len(content)\n err_msg = (content if length > 0 else str(status))\n raise NoSQLException('Error response: ' + err_msg)\n raise NoSQLException('Error response = ' + str(status))", "de...
[ "0.69448256", "0.67296636", "0.6724068", "0.65987074", "0.65522385", "0.65312415", "0.6489292", "0.64817107", "0.645308", "0.64124894", "0.6410655", "0.6403757", "0.6398741", "0.6364579", "0.63343686", "0.63310015", "0.63203835", "0.6317361", "0.6273221", "0.6248092", "0.6247...
0.0
-1
When we have bad config raise an exception
def test_execute_with_invalid_config_get_exception(): message = FakeMessage() message.raw_payload = json.dumps(TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_PAGE_GZIPPED) with aioresponses(): with pytest.raises(Exception) as excinfo: worker.execute(message, TestData.RECEPTOR_CONFIG_INVALID, queue...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_broken_config(broken_config):\n with pytest.raises(RuntimeError, match=\"Error reading config.yml\"):\n abcconfig.get_config(broken_config)", "def _validate_configurations(self) -> None:\n if self.__exception:\n raise self.__exception", "def _check_config(self):", "def _v...
[ "0.7566465", "0.7465045", "0.72110015", "0.7202663", "0.7164037", "0.7164037", "0.7140516", "0.7104888", "0.70901644", "0.7080957", "0.70069975", "0.7006344", "0.692682", "0.6926806", "0.6913197", "0.68910533", "0.6885606", "0.68723", "0.6815408", "0.68013406", "0.6780599", ...
0.61281
93
GET Request with Single Page
def test_execute_get_success(): response_queue = run_get( TestData.RECEPTOR_CONFIG, json.dumps(TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_PAGE), TestData.JOB_TEMPLATE_RESPONSE, ) response = response_queue.get() validate_get_response( response, 200, TestData.JOB_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page(self, get_tup):\n helper = HttpHelper(self.session)\n path, args = get_tup[0], get_tup[1]\n url = \"{path}?{opts}\".format(path=path,\n opts=urlencode(dict(args)))\n results = helper.get(url)\n return results", "def do_GET(self):...
[ "0.7385643", "0.71472824", "0.70714414", "0.69860846", "0.6974307", "0.692676", "0.6923248", "0.69159395", "0.6812131", "0.6781713", "0.6777007", "0.6743195", "0.67135626", "0.6674695", "0.66589236", "0.6639842", "0.6630248", "0.6611561", "0.6608917", "0.66056067", "0.6600639...
0.0
-1
GET Request with Payload as a dictionary
def test_execute_get_with_dict_payload(): response_queue = run_get( TestData.RECEPTOR_CONFIG, TestData.JOB_TEMPLATE_PAYLOAD_SINGLE_PAGE, TestData.JOB_TEMPLATE_RESPONSE, ) response = response_queue.get() validate_get_response( response, 200, TestData.JOB_TE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, url, payload={}):\n response = self._make_request(\"GET\", url, payload)\n\n return response", "def get_call_api(url, payload, headers):\n return requests.request(\"GET\", url, headers=headers, data=payload)", "def requester(get_args: dict) -> dict:\n get_args.update(dict(apik...
[ "0.6896706", "0.68927366", "0.6731775", "0.6597081", "0.6560979", "0.65118915", "0.65118915", "0.65118915", "0.65118915", "0.65118915", "0.65118915", "0.64140874", "0.63779604", "0.6343178", "0.63411754", "0.63388765", "0.63189054", "0.63189054", "0.6267232", "0.62662274", "0...
0.60303503
49
GET Request where JSON decoding fails
def test_execute_get_with_bad_payload(): message = FakeMessage() message.raw_payload = "fail string" with pytest.raises(json.JSONDecodeError): worker.execute(message, TestData.RECEPTOR_CONFIG, queue.Queue())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_json(self, url, *, timeout, headers):", "def _request_get(self, url):\n try:\n r = requests.get(url)\n except Exception:\n raise Exception('Cannot connect')\n if (r.status_code != 200):\n raise Exception('%d %s' % (r.status_code, r.text))\n if ...
[ "0.6856348", "0.6776485", "0.66875714", "0.6649649", "0.66042346", "0.6572833", "0.6552239", "0.65509236", "0.6546793", "0.6522644", "0.6501262", "0.6501103", "0.6492049", "0.64548063", "0.6415236", "0.63933843", "0.6390137", "0.6360175", "0.6355018", "0.63542426", "0.6353929...
0.0
-1
Helper method to send a HTTP POST
def run_post(payload, response): message = FakeMessage() message.raw_payload = payload response_queue = queue.Queue() headers = {"Content-Type": "application/json"} with aioresponses() as mocked: mocked.post( TestData.JOB_TEMPLATE_POST_URL, status=200, bod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def httpPost(self, url='', data='', params={}, headers={}):\n\n return self.httpRequest('POST', url, data, params, headers)", "def do_POST(self,):\n self.http_method = 'POST'\n self.response()", "def _post(self, *args, **kwargs):\n return self._request('post', *args, **kwargs)", "...
[ "0.7829329", "0.7734023", "0.76505715", "0.76214516", "0.7621347", "0.76111346", "0.7532924", "0.74895674", "0.74728715", "0.7413753", "0.725089", "0.72436345", "0.720868", "0.719806", "0.7191886", "0.718312", "0.71558183", "0.71542454", "0.7107054", "0.7076789", "0.70527303"...
0.0
-1
Helper Method to validate HTTP POST Response
def validate_post_response(response, status, job, keys=None): assert (response["status"]) == status json_response = json.loads(response["body"]) if not keys: keys = list(job.keys()) assert sorted(keys) == sorted(list(json_response.keys())) compare(json_response, job, keys)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_response(self, response):\n pass", "def check_response_invalid_fields(response: HTTPResponse) -> bool:\n return response.status_code == 422", "def _validate_post(self, value, name, result):\n return result", "def validate(self, response):\n return response[\"status_code\"...
[ "0.77280384", "0.7046781", "0.6910517", "0.68594146", "0.6798651", "0.67948645", "0.66036576", "0.65987074", "0.6594993", "0.65495694", "0.65494895", "0.6528237", "0.65219647", "0.6520268", "0.6420314", "0.6390793", "0.637758", "0.63640946", "0.63284475", "0.6291358", "0.6267...
0.62251157
21
HTTP POST Test with Response GZIPPed
def test_execute_post_zip_success(): response_queue = run_post( json.dumps(TestData.JOB_TEMPLATE_POST_PAYLOAD_GZIPPED), TestData.JOB_TEMPLATE_POST_RESPONSE, ) result = response_queue.get() response = ast.literal_eval(gzip.decompress(result).decode("utf-8")) validate_post_response(res...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_execute_post_filtered_zip_success():\n response_queue = run_post(\n json.dumps(TestData.JOB_TEMPLATE_POST_FILTERED_PAYLOAD_GZIPPED),\n TestData.JOB_TEMPLATE_POST_RESPONSE,\n )\n result = response_queue.get()\n response = ast.literal_eval(gzip.decompress(result).decode(\"utf-8\"))...
[ "0.68593013", "0.6803681", "0.676384", "0.64628613", "0.64539945", "0.6378329", "0.63647556", "0.63479835", "0.6330135", "0.6179374", "0.61422855", "0.6009431", "0.5938211", "0.5877152", "0.5824963", "0.5805356", "0.5791459", "0.5783094", "0.5767197", "0.5752411", "0.56747407...
0.6623012
3
HTTP POST Test with Filtered Response GZIPPed
def test_execute_post_filtered_zip_success(): response_queue = run_post( json.dumps(TestData.JOB_TEMPLATE_POST_FILTERED_PAYLOAD_GZIPPED), TestData.JOB_TEMPLATE_POST_RESPONSE, ) result = response_queue.get() response = ast.literal_eval(gzip.decompress(result).decode("utf-8")) validate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_compress_response(self):\n r = GZipMiddleware(self.get_response)(self.req)\n self.assertEqual(self.decompress(r.content), self.compressible_string)\n self.assertEqual(r.get(\"Content-Encoding\"), \"gzip\")\n self.assertEqual(r.get(\"Content-Length\"), str(len(r.content)))", "...
[ "0.64330626", "0.6299873", "0.6263577", "0.61930263", "0.6186077", "0.61293703", "0.6115723", "0.6036706", "0.59558666", "0.59094465", "0.5854884", "0.58485293", "0.5842008", "0.5673604", "0.5652594", "0.5637316", "0.56218165", "0.55327237", "0.5516337", "0.55045617", "0.5497...
0.7019999
0
HTTP POST Test with Exception
def test_execute_post_exception(): message = FakeMessage() message.raw_payload = json.dumps(TestData.JOB_TEMPLATE_POST_PAYLOAD) with aioresponses() as mocked: mocked.post( TestData.JOB_TEMPLATE_POST_URL, status=400, body="Bad Request in Post Call" ) with pytest.raises(Exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_error_post(self):\n Parameters = Parameters()\n response = self.client.open(\n '/error',\n method='POST',\n data=json.dumps(Parameters),\n content_type='application/json')\n self.assert200(response,\n 'Response body is ...
[ "0.75437254", "0.7387431", "0.736382", "0.7348007", "0.73016965", "0.7252912", "0.72147363", "0.7153243", "0.7135948", "0.7082639", "0.70808214", "0.705094", "0.705094", "0.7047066", "0.70229554", "0.7001681", "0.6995351", "0.69787353", "0.69771814", "0.69677734", "0.6958202"...
0.66783404
37
HTTP POST Test with an invalid JMESPath filter
def test_execute_post_exception_invalid_filter(): message = FakeMessage() message.raw_payload = json.dumps( TestData.JOB_TEMPLATE_POST_BAD_FILTERED_PAYLOAD_GZIPPED ) headers = {"Content-Type": "application/json"} with aioresponses() as mocked: mocked.post( TestData.JOB_TE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testInvalidPostPath(self):\n for path in ('framework', 'endpoint', 'invalid'):\n status, _ = self._http_post(path, \"some-data\")\n self.assertEqual(status, 404)", "def test_post_expected_fail_citelet_json(self):\n headers = {'content-type': 'application/json'}\n wi...
[ "0.6825683", "0.6501361", "0.6417516", "0.62426823", "0.6240586", "0.6219567", "0.62133765", "0.6212666", "0.61888427", "0.6133596", "0.61049145", "0.61049145", "0.6080059", "0.60678357", "0.60587895", "0.6031807", "0.5935676", "0.5901608", "0.5891534", "0.5876786", "0.586710...
0.56300384
41
Test to Monitor completion of job
def test_execute_monitor_job_success(): response_queue = queue.Queue() message = FakeMessage() message.raw_payload = json.dumps(TestData.JOB_MONITOR_PAYLOAD) headers = {"Content-Type": "application/json"} with aioresponses() as mocked: mocked.get( TestData.JOB_MONITOR_URL, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_submit_jobs(self):\r\n\r\n submit_jobs([self.command], prefix=\"test_job\")\r\n # Try and wait ten times, could be made nicer with alarm()\r\n for i in range(10):\r\n if exists(self.tmp_result_file):\r\n observed_text = \"\".join(list(open(self.tmp_result_fil...
[ "0.73087347", "0.6947183", "0.68463", "0.6814341", "0.67418075", "0.67418075", "0.67418075", "0.67418075", "0.66835874", "0.665661", "0.6531567", "0.65315014", "0.6526498", "0.65245587", "0.64275444", "0.6395361", "0.6384431", "0.6375023", "0.6321717", "0.63209456", "0.630791...
0.6805068
4
Test to Monitor completion of job
def test_execute_monitor_job_zip_success(): response_queue = queue.Queue() message = FakeMessage() message.raw_payload = json.dumps(TestData.JOB_MONITOR_GZIP_PAYLOAD) headers = {"Content-Type": "application/json"} with aioresponses() as mocked: mocked.get( TestData.JOB_MONITOR_U...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_submit_jobs(self):\r\n\r\n submit_jobs([self.command], prefix=\"test_job\")\r\n # Try and wait ten times, could be made nicer with alarm()\r\n for i in range(10):\r\n if exists(self.tmp_result_file):\r\n observed_text = \"\".join(list(open(self.tmp_result_fil...
[ "0.7307609", "0.69467384", "0.684461", "0.6813679", "0.68045956", "0.6741546", "0.6741546", "0.6741546", "0.6741546", "0.668207", "0.66551685", "0.6531059", "0.6529809", "0.65254843", "0.652426", "0.64274144", "0.639263", "0.6383224", "0.6375118", "0.6320467", "0.6319786", ...
0.5845524
87