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
Add regex filter for list_buckets
def list_buckets(self, regex=".*", verbose=False): r = re.compile(regex) if verbose: return [b for b in self.client.list_buckets()['Buckets'] if r.match(b['Name'])] else: return [b['Name'] for b in self.client.list_buckets()['Buckets'] if r.match(b['Name'])]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_buckets():\n pass", "def lst_and_pattern (filer_lst, pattern):\r\n new_filter_lst=[]\r\n for word in filer_lst:\r\n if word_and_pattern(word,pattern):\r\n new_filter_lst.append(word)\r\n return new_filter_lst", "def manipulate_bucketlist():\n pass", "def filter(self,...
[ "0.586817", "0.55524653", "0.52830935", "0.5272527", "0.52650857", "0.5254678", "0.5222747", "0.52066493", "0.5205841", "0.51563156", "0.5121045", "0.5078473", "0.50659263", "0.5062066", "0.50272703", "0.50206465", "0.49811077", "0.4968093", "0.49588022", "0.49551994", "0.495...
0.65801555
0
Deletes an empty S3 bucket. If the force boolean is set to True, the contents of the Bucket will first be deleted before deleting the bucket.
def rm_buckets(self, buckets, force=False): if type(buckets) is list: for bucket in buckets: if force: # Delete contents in buckets self.s3.Bucket(bucket).objects.all().delete() self.s3.Bucket(bucket).delete() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_bucket(Bucket=None):\n pass", "def empty_bucket(self):\n self.s3_handle = boto.connect_s3()\n EmrProcessing.bucket_name = self.generate_unique_name()\n EmrProcessing.bucket = \\\n self.s3_handle.create_bucket(EmrProcessing.bucket_name)\n EmrProcessing.bucket.d...
[ "0.7062464", "0.65046525", "0.6470507", "0.64680624", "0.64647424", "0.6415332", "0.6399446", "0.6285246", "0.6284969", "0.62828344", "0.621096", "0.6130257", "0.6106059", "0.60756004", "0.6058106", "0.6045744", "0.60262597", "0.6025205", "0.60139114", "0.600774", "0.60076284...
0.6157551
11
Herlper function for sagemaker endpoint to get the model.
def model_fn(model_dir): model = models.resnet50(pretrained=True) _ = model.eval() modules=list(model.children())[:-1] model=nn.Sequential(*modules) for p in model.parameters(): p.requires_grad = False device = torch.device('cuda:0' if torch.cuda.is_available() else "cpu") model ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_model(model=gin.REQUIRED):\n return model", "def model(self) -> 'outputs.ModelDefinitionResponse':\n return pulumi.get(self, \"model\")", "def get_model(self):\n # just return the first model, since all replicas are the same\n return self.call_async(0, '_async_get_model').gen()", ...
[ "0.7410248", "0.71194136", "0.70928663", "0.6839625", "0.6834955", "0.6794878", "0.6664329", "0.66214645", "0.6599524", "0.6549601", "0.65286404", "0.6512882", "0.6486325", "0.64742947", "0.64740545", "0.6469362", "0.64668727", "0.6442762", "0.643793", "0.63912064", "0.639053...
0.0
-1
Helper function for sagemaker endpoint to process in input before passing it to the model for inference.
def input_fn(request_body, request_content_type='application/json'): if request_content_type =='application/json': data = json.loads(request_body) data = data['inputs'] im_bytes = base64.b64decode(data) # im_bytes is a binary image im_file = BytesIO(im_bytes) # convert im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_inputs(self, inputs):", "def processInputs(self):", "def handle(self, data, context):\n \n model_input = self.preprocess(data)\n model_out = self.inference(model_input)\n return self.postprocess(model_out)", "def reconstruct_input_ext(self, model_in):", "def _handleI...
[ "0.7226697", "0.68308276", "0.66645557", "0.65536714", "0.62912107", "0.62821937", "0.6260069", "0.6256583", "0.61012626", "0.6086074", "0.6085198", "0.60781735", "0.6076996", "0.60497326", "0.60426235", "0.6018581", "0.60154974", "0.6012859", "0.60122675", "0.5994633", "0.59...
0.6316356
4
Helper function to predict on an image using the model
def predict_fn(input_object, model): if torch.cuda.is_available(): input_object = input_object.cuda() input_object = torch.unsqueeze(input_object, 0) with torch.no_grad(): prediction = model(input_object) return prediction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(model, img):\n\tx = image.img_to_array(img)\n\tx = np.expand_dims(x, axis=0)\n\tx = preprocess_input(x)\n\tpreds = model.predict(x)\n\treturn preds[0]", "def predict(model, img, target_size=(229, 229)): #fixed size for InceptionV3 architecture\r\n if img.size != target_size:\r\n img = img.resize(...
[ "0.8867019", "0.8529402", "0.85072654", "0.85072654", "0.84197754", "0.83164746", "0.8135886", "0.8070641", "0.80379456", "0.8025133", "0.8017958", "0.79701", "0.79278815", "0.7926884", "0.78860533", "0.78191215", "0.77941465", "0.7787423", "0.77626723", "0.7732514", "0.76403...
0.0
-1
Helper function to process the predictions of the model before returning to the user.
def output_fn(predictions, content_type): assert content_type == 'application/json' res = predictions.cpu().numpy().tolist() return json.dumps(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self, predictor_model) -> None:\n self.save_result(self.evaluate(predictor_model))", "def post_process_predictions(self, labels, scene):\n pass", "def postprocess(self, prediction_dict, **params):\r\n pass", "def predict(self, model, context, data):\n pass", "def po...
[ "0.72092456", "0.7191402", "0.7156282", "0.71427643", "0.7134665", "0.7034721", "0.69430745", "0.68148786", "0.6766181", "0.67454034", "0.67367357", "0.6718753", "0.67157257", "0.6698016", "0.6688639", "0.6684228", "0.66806656", "0.66806656", "0.6632434", "0.662545", "0.66078...
0.0
-1
fits the list of models to the training data, thereby obtaining in each case an evaluation score after GridSearchCV crossvalidation
def fit(self, train_features, train_actuals): for name in self.models.keys(): print('-'*shutil.get_terminal_size().columns) print("evaluating {}".format(name).center(columns)) print('-'*shutil.get_terminal_size().columns) estimator = self.models[name] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(train_data, train_target):\r\n for name in models.keys():\r\n est = models[name]\r\n est_params = params2[name]\r\n gscv = GridSearchCV(estimator=est, param_grid=est_params, cv=5)\r\n gscv.fit(train_data, train_target)\r\n print(\"best parameter...
[ "0.7954486", "0.7731242", "0.7684677", "0.7534514", "0.7332475", "0.73269665", "0.724954", "0.7048197", "0.7026531", "0.6991581", "0.698729", "0.6975688", "0.69701505", "0.6937093", "0.69133115", "0.6913214", "0.69001627", "0.6897572", "0.688162", "0.68772936", "0.6853344", ...
0.77692807
1
prints a summary report, ranking the models in terms of highest evaluation score
def evaluation(self): rows_list = [] for name in self.single_classifier_best.keys(): row = {} row['algorithm'] = name row[self.scoring_metric] = self.single_classifier_best[name].best_score_ rows_list.append(row) scoring_df = pd.DataFrame...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report(results, n_top=1):\n for i in range(1, n_top + 1):\n candidates = np.flatnonzero(results['rank_test_score'] == i)\n for candidate in candidates:\n print(f\"Model with rank: {i}\")\n print(f\"Mean validation score: {results['mean_test_score'][candidate]} (std: {resu...
[ "0.74202234", "0.7092146", "0.69710517", "0.6924033", "0.6867207", "0.6762245", "0.6656235", "0.6645233", "0.6630509", "0.6622392", "0.6621752", "0.6604896", "0.6507348", "0.6497034", "0.6488497", "0.6474265", "0.64617085", "0.64440054", "0.64366543", "0.6434623", "0.6421479"...
0.6728507
6
To setup as many loggers as you want
def setup_logger(name, log_file, formatter, level=logging.INFO): handler = logging.FileHandler(log_file, encoding='utf-8') handler.setFormatter(formatter) logger = logging.getLogger(name) logger.setLevel(level) logger.addHandler(handler) return logger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_logging():\n for name, logger in loggers.items():\n logger.setLevel(LOGGING_MAPPING.get(options.logging, logging.DEBUG))\n handler = logging.FileHandler(\n getattr(options, '{}_log_file_path'.format(name))\n )\n formatter = logging.Formatter(\n '%(asct...
[ "0.7959943", "0.7823022", "0.75609726", "0.73259217", "0.72952944", "0.7275272", "0.7097864", "0.7073631", "0.7028831", "0.69955486", "0.69838715", "0.6981615", "0.6956217", "0.693831", "0.69381726", "0.6936294", "0.6925124", "0.6917455", "0.69084036", "0.69073987", "0.689739...
0.0
-1
Attempts to load all .py files in cogs/ as cog extensions. Returns a dictionary which maps cog names to a boolean value (True = successfully loaded; False = not successfully loaded).
async def load_all_extensions(self, reload=False): succeeded = {} for extension in get_extensions(): try: if reload or extension not in self.cogs_loaded: self.load_extension(f'cogs.{extension}') l.info(f"Loaded extension '{extension}'")...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_cogs(self):\n\n path = \"cogs/\" # Should always have a trailing slash\n import_path = path.replace(\"/\", \".\")\n extensions: list[str] = [\n import_path + file.replace(\".py\", \"\")\n for file in os.listdir(path)\n if os.path.isfile(f\"{path}{file...
[ "0.7493008", "0.6975065", "0.6765176", "0.67549616", "0.6704383", "0.6446257", "0.6245783", "0.6138608", "0.6025422", "0.59247637", "0.58972794", "0.5765539", "0.572911", "0.5679842", "0.5670242", "0.5634018", "0.5585175", "0.55337536", "0.54403317", "0.54370046", "0.54080385...
0.71769613
1
This event triggers when the bot joins a guild.
async def on_guild_join(self, guild): l.info(f"Joined {guild.name} with {guild.member_count} users!")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def on_guild_join(self, guild: discord.Guild) -> None:\n logger.info(f'Added to new guild: {guild.name} ({guild.id})')\n\n with self.get_session() as session:\n _guild: Guild = session.query(Guild).get(guild.id)\n if _guild is None:\n session.add(Guild(id=gu...
[ "0.7710114", "0.7107106", "0.6898389", "0.68539816", "0.6643167", "0.66358715", "0.65689564", "0.64946175", "0.6435609", "0.64033157", "0.6399424", "0.6319097", "0.6283885", "0.6263786", "0.6236404", "0.6235235", "0.6224685", "0.6198134", "0.6194945", "0.61734843", "0.6164683...
0.7720383
0
This event triggers on every message received by the bot. Including ones that it sent itself.
async def on_message(self, message): if message.author.bot: return # Ignore all bots. await self.process_commands(message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback_botmessage(self, message):\n pass", "def callback_botmessage(self, message):\n pass", "def callback_botmessage(self, message):\n pass", "async def on_message(self, message: \"steam.Message\") -> None:", "async def on_message(self, message: discord.Message) -> None:\n\n ...
[ "0.73473126", "0.73473126", "0.73473126", "0.70146674", "0.69713724", "0.6857231", "0.6850092", "0.6839847", "0.6813499", "0.6741119", "0.6662499", "0.65737396", "0.65624034", "0.6557369", "0.6556639", "0.654079", "0.6522952", "0.65155643", "0.64774394", "0.6470487", "0.64679...
0.7366499
0
Retrieve the SMILES string describing the drug in the parsed HTML document. We get the SMILES string by locating the HTML id "smiles" and then moving to the next html element. This process is slightly complicated by the fact that the SMILES string is confused for an email due to the presence of @ characters, and so we ...
def get_smiles(parsed_drug_doc): # Source: https://stackoverflow.com/questions/36911296/scraping-of-protected-email def decode_email(e): de = "" k = int(e[:2], 16) for i in range(2, len(e)-1, 2): de += chr(int(e[i:i+2], 16)^k) return de email_protected_map = {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_smiles(molecule_etree):\n SMILES_XPATH = 'hunterdb:Structure/hunterdb:CanonicalSmiles/child::text()'\n return molecule_etree.xpath(SMILES_XPATH, namespaces=HUNTER_DB_NAMESPACE_DICT)[0]", "def to_smiles(rdm):\n smi = _rd_chem.MolToSmiles(rdm)\n return smi", "def get_smiles(self, canonica...
[ "0.6535551", "0.57447743", "0.56670135", "0.5550063", "0.54159063", "0.5406357", "0.5403899", "0.54001135", "0.5337975", "0.5326419", "0.5228338", "0.5192157", "0.51822424", "0.5178734", "0.51761544", "0.5174183", "0.51671416", "0.51321954", "0.5125165", "0.50927156", "0.5081...
0.79599553
0
Retrieve the targets gene names and actions. For the drugs with targets, we can find the section using the id "targets". Those targets may have a gene name listed or not. If the target has a gene name listed, it may have zero or many actions associated.
def get_gene_action_pairs(parsed_drug_doc): gene_action_pairs = [] for target in parsed_drug_doc.select('#targets .card-body'): # We may have zero or one gene names. gene_name_section = target.find(id='gene-name') if gene_name_section: gene_name = gene_name_section.next_sibl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_targets(self):\n\t\treturn self.prDoc['inputs']['data'][0]['targets']", "def targets(self) -> Optional[Union[np.ndarray, Dict[str, np.ndarray]]]:\n return self._targets", "def targets(self):\n\n\t\tstatus, targets = self.execute(self.mission, 'target_list', self.kingdom)\n\n\t\t# Nothing specifi...
[ "0.7006874", "0.6568634", "0.6560847", "0.6494938", "0.64691794", "0.64381784", "0.6420706", "0.6389015", "0.63432276", "0.63212293", "0.62894803", "0.6287679", "0.6269645", "0.61702716", "0.6157602", "0.6147551", "0.61349255", "0.6131919", "0.6126978", "0.61217403", "0.61176...
0.60427153
22
Retrieves the alternative identifiers for other drug info sources. Finds the section using the id "externallinks".
def get_external_links(parsed_drug_doc): external_link_info = list(parsed_drug_doc.find(id='external-links').next_sibling.dl.children) external_links = {} for i in range(0, len(external_link_info), 2): source = external_link_info[i].text value = external_link_info[i+1].text # Ignori...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_possible_ids(self):\n ids = []\n\n dest_data = requests.get(\"https://api.wdpro.disney.go.com/facility-service/destinations/{}\".format(self.__anc_dest_id), headers=getHeaders()).json()\n data = requests.get(dest_data['links']['entertainmentVenues']['href'], headers=getHeaders()).json(...
[ "0.49276513", "0.4869413", "0.47767136", "0.4770535", "0.46834496", "0.4679981", "0.46615496", "0.4660064", "0.4631776", "0.46157798", "0.4613686", "0.4605003", "0.46038538", "0.45956227", "0.4586876", "0.45623347", "0.4550497", "0.45440876", "0.45408326", "0.4525997", "0.449...
0.63020116
0
Retrieves a set of information for a given Drugbank drug identifier.
def get_info_for_identifier(identifier): page = requests.get(f"https://www.drugbank.ca/drugs/{identifier}") parsed_drug_doc = BeautifulSoup(page.text, 'html.parser') smiles = get_smiles(parsed_drug_doc) gene_action_pairs = get_gene_action_pairs(parsed_drug_doc) external_links = get_external_links(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details(self, identifier):\n return self.client.request_with_method(Methods.GET % (self.name, identifier,))", "def _get_drug_entry(self,cid):\n result = None\n search_str = \"drugbank:drug/drugbank:drugbank-id/.[@primary='true']/..[drugbank:drugbank-id='%s']\" % (cid) \n result =...
[ "0.61482173", "0.60460675", "0.5905877", "0.5839129", "0.57571423", "0.5755548", "0.559288", "0.5558541", "0.55240154", "0.54870063", "0.5484556", "0.5463918", "0.5458747", "0.5449955", "0.5438414", "0.5438065", "0.542378", "0.5415125", "0.5409009", "0.5404084", "0.5365181", ...
0.7483154
0
Returns a psycopg2 connection and cursor for performing SQL operations.
def get_postgres_conn_and_cursor(user, password, host): conn = psycopg2.connect(user=user, password=password, host=host, connect_timeout=10) cursor = conn.cursor() return conn, cursor
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect():\n conn = psycopg2.connect(\"dbname=tournament\")\n cursor = conn.cursor()\n return conn, cursor", "def connect_to_db(cls):\n conn = psycopg2.connect(os.environ['DATABASE_URL'])\n conn.autocommit = True\n cursor = conn.cursor()\n\n return cursor", "def databas...
[ "0.7233092", "0.7218752", "0.71600825", "0.71189475", "0.70791066", "0.70302516", "0.7020216", "0.6912193", "0.6889989", "0.68199986", "0.67865926", "0.67730397", "0.67703015", "0.6745654", "0.66291225", "0.6611288", "0.6598095", "0.65797776", "0.6574622", "0.657343", "0.6567...
0.6713615
14
Retrieves the info from Drugbank for the provided identifiers, prepares insert statements for the info and then performs them.
def transact_drug_info(identifiers, user, password, host): drug_info = [] for identifier in identifiers: drug_info.append(get_info_for_identifier(identifier)) def xform_for_insert(t): return str(t).replace('"', "'").replace("None", "NULL") drugs_txs = [] gene_action_pairs_txs = []...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_into_db(self, database):\n\n # insert person\n keys = \"\"\n values = \"\"\n for key, value in self.person.items():\n # location\n if key == \"location\":\n # ensure location is in table\n database.select(f\"\"\"DO $do$ BEGI...
[ "0.5740032", "0.544129", "0.54230183", "0.53802603", "0.5290045", "0.52740854", "0.524837", "0.5180443", "0.5175086", "0.5168618", "0.5155777", "0.51552916", "0.5112063", "0.51112425", "0.5108119", "0.5073048", "0.5065976", "0.50578666", "0.50480336", "0.50229603", "0.5017675...
0.6826996
0
determine if madlib function is substituting input values correctly
def test_madlib_substitution(): actual = madlib(input_values) expected = output_text assert actual == expected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_SMEL_args():\n testing_function('sme', bilinear=False)", "def needs_correction(self, var):\n global matmul_registry\n if var in matmul_registry:\n return True\n else:\n return False", "def test_value_not_masked(self):\n out = mask_args_value(\"quantum fluctuations\", \"qua...
[ "0.5692555", "0.5676673", "0.5592143", "0.5510311", "0.5429809", "0.5424574", "0.5415874", "0.5388544", "0.5388544", "0.5327953", "0.53016853", "0.53009725", "0.5289353", "0.5279792", "0.52717566", "0.5237211", "0.52188444", "0.5212372", "0.52014846", "0.5173144", "0.51723444...
0.64386356
0
check that the correct output is written to the output file
def test_madlib_file_write(): madlib(input_values) file_text = '' with open('assets/updated_madlib_text', 'r') as file: for line in file: file_text += line assert file_text == output_text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_outfile():\n\n out_file = random_filename()\n if os.path.isfile(out_file):\n os.remove(out_file)\n\n try:\n cmd = f'{prg} --cdhit {cdhit} --proteins {proteins} -o {out_file}'\n rv, out = getstatusoutput(cmd)\n assert rv == 0\n\n assert out == ('Wrote 309 of 220,...
[ "0.7176397", "0.704145", "0.69386715", "0.67337406", "0.66338044", "0.6622791", "0.6578286", "0.6571789", "0.65504324", "0.6517622", "0.651574", "0.6431474", "0.64171875", "0.6410496", "0.6388531", "0.6375434", "0.6352387", "0.6347393", "0.62924546", "0.6279441", "0.62728095"...
0.5768482
92
A supplemental reason explaining why the error occurred.
def reason(self) -> Optional[str]: return self._reason
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_reason(self):\n return self._error_reason", "def error(self, e):\n return \"{}: {} ({})\".format(e.__class__.__name__, e.__doc__, e.message)", "def getReason():", "def error_message(self):\n return u'Something wrong with {}, ' \\\n u'try switch to another series p...
[ "0.7387442", "0.7348241", "0.73455167", "0.72017676", "0.69890606", "0.6819124", "0.66734445", "0.66404766", "0.65591633", "0.65591633", "0.65591633", "0.6522138", "0.65061563", "0.6491381", "0.6451334", "0.64434433", "0.6396516", "0.638023", "0.63696414", "0.63674456", "0.63...
0.6052552
70
The date and time when the error occurred.
def created_at(self) -> datetime.datetime: return self._created_at
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_error_time(self) -> str:\n return pulumi.get(self, \"last_error_time\")", "def creationTime(self):\n \n if not self.logMessage is None :\n return self.logMessage[\"date\"]", "def get_error(self):\n return self.exc_info", "def get_system_date_and_time(self):\n ...
[ "0.77884203", "0.68652815", "0.6218321", "0.61531395", "0.6124649", "0.6088202", "0.60838395", "0.6066886", "0.606426", "0.6055204", "0.60251206", "0.6005831", "0.6005831", "0.6005831", "0.5967726", "0.596764", "0.596764", "0.596764", "0.596764", "0.596764", "0.596764", "0....
0.0
-1
The assembly in which the error occurred.
def assembly(self) -> servo.Assembly: return self._assembly
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assembly(self):\n return self._assembly", "def AssemblyName(self) -> str:", "def DependentAssembly(self) -> str:", "def AssemblyFullName(self) -> str:", "def cloud_assembly_artifact(self) -> aws_cdk.aws_codepipeline.Artifact:\n return self._values.get(\"cloud_assembly_artifact\")", "def...
[ "0.7182016", "0.68485934", "0.6469226", "0.6340841", "0.56903553", "0.56903553", "0.56903553", "0.56903553", "0.56903553", "0.56903553", "0.5680746", "0.5550747", "0.5528744", "0.5395854", "0.5395854", "0.5395854", "0.5395854", "0.5395854", "0.5395854", "0.5271151", "0.524506...
0.59339756
4
The servo that was active when the error occurred.
def servo(self) -> Optional[servo.Servo]: return self._servo
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def servo_active(self, *args, **kwargs) -> Any:\n pass", "def status(self):\n return self._bp.get_motor_status(self._port)", "def servo_on(self):\n self.logger.info('Setting servo ON')\n self.electronics.move_servo(1)\n self.config['servo']['status'] = 1", "def controller_s...
[ "0.6637851", "0.59305996", "0.57332313", "0.5726711", "0.5699285", "0.56845474", "0.5684502", "0.56725603", "0.56126374", "0.55574274", "0.55151606", "0.54930377", "0.5473341", "0.54207635", "0.5410516", "0.53283364", "0.5266262", "0.5254195", "0.52259874", "0.52212095", "0.5...
0.6539491
1
The connector that was active when the error occurred.
def connector(self) -> Optional[servo.Connector]: return self._connector
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_connect(self):\n\t\treturn self.connect", "def connector(self):\n if '_connector' not in self.__dict__:\n from meerschaum.connectors.parse import parse_instance_keys\n conn = parse_instance_keys(self.connector_keys)\n if conn:\n self._connector = con...
[ "0.6550373", "0.65121484", "0.63851035", "0.6338511", "0.6338511", "0.6338511", "0.6338511", "0.61361617", "0.601682", "0.6010793", "0.601007", "0.5977922", "0.59642935", "0.59213513", "0.59213513", "0.5902373", "0.58938384", "0.58938384", "0.58938384", "0.58899015", "0.58890...
0.60405296
8
The event that was executing when the error occurred.
def event(self) -> Optional[servo.Event]: return self._event
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_received(self, exc):\n print('Error received:', exc)", "def error(self):\n return self._decorator_wrapper(EventName.error)", "def get_error(self):\n return self.e", "def on_error(self, event: ThreadResult):\n if self._on_error is not None:\n self._on_error(eve...
[ "0.6877498", "0.6843506", "0.6646025", "0.662441", "0.6434842", "0.63798445", "0.63421637", "0.63362867", "0.63362867", "0.63362867", "0.62905455", "0.6284273", "0.6255658", "0.62415266", "0.6234767", "0.619402", "0.61851525", "0.617187", "0.6160047", "0.61394197", "0.6126857...
0.0
-1
Convert string with ',' string float to float
def stof(fstr): return float(fstr.replace(',', '.'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_float(s):\n return float(s.replace(',', '.'))", "def __parse_float(str):\n return float(str.strip().replace(',','.'))", "def string_to_float(value):\n # if no periods (.) then assume commas are decimal separators\n if '.' not in value:\n value = value.replace(',', '.')\n # if de...
[ "0.87650466", "0.8430263", "0.82144356", "0.7461303", "0.7387697", "0.7356403", "0.72832", "0.72675294", "0.7224392", "0.7190248", "0.7182437", "0.71822655", "0.715909", "0.706006", "0.70235217", "0.69940567", "0.69926935", "0.6990524", "0.6957815", "0.68797594", "0.68766946"...
0.80367935
3
Try to find all relevant dart tools.
def configure(cnf): try: cnf.find_program('dart', var='DART') except: Logs.warn("Couldn't find dart executable. It isn't necessary, but why don't you have it...?") cnf.find_program('dart2js', var='DART2JS') try: cnf.find_program('pub', var='PUB') except: Logs.warn("Co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_tools_exist(WARNINGS):\n tools_list = []\n Warning_out = WARNINGS + \"Tool executable warning: \"\n try:\n flash.Flash(args.flash)\n tools_list.append(\"flash\")\n except ValueError:\n Warning_out = Warning_out + \"Flash not in path\"\n try:\n error_correction.E...
[ "0.6521446", "0.64147955", "0.62229186", "0.5955167", "0.5926633", "0.58311886", "0.5808472", "0.57827175", "0.57409465", "0.57075655", "0.57007235", "0.5684141", "0.565486", "0.5642937", "0.56153864", "0.5611737", "0.56057674", "0.5543945", "0.5537143", "0.5501987", "0.54407...
0.0
-1
Create the output folder for the whole dart project output, sift through all source files and make them available as nodes for later processing.
def process_dart(self): self.dartfiles = set() self.jsfiles = set() self.htmlfiles = set() self.cssfiles = set() self.otherfiles = set() for src in self.source: if isinstance(src,str): node = self.path.find_node(src) else: node = src if node.suffix...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_all_files():\n for (name, fn) in lang_module.targets.items():\n path = of_g.options.install_dir + '/' + name\n os.system(\"mkdir -p %s\" % os.path.dirname(path))\n with open(path, \"w\") as outfile:\n fn(outfile, os.path.basename(name))\n print(\"Wrote content...
[ "0.71295595", "0.6861794", "0.6717942", "0.6612976", "0.6493361", "0.63685995", "0.63087445", "0.63026834", "0.63007575", "0.6255641", "0.6225875", "0.6217281", "0.6183958", "0.6169037", "0.6132974", "0.6101475", "0.609835", "0.6097953", "0.6091003", "0.6087792", "0.608724", ...
0.68588585
2
Copy over all source files (html, css, dart, js, etc.) to the target directory.
def apply_dart(self): shutil.copyfile(self.env['DART_JS_BOOTSTRAP'], self.outdir.make_node('dart.js').abspath()) for filetype in ['dartfiles','jsfiles','htmlfiles','cssfiles','otherfiles']: files = getattr(self, filetype) for f in files: if f.is_bld(): outf = self.out...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_source():\n shutil.copytree(\"src\", os.path.join(BUILD_DIR, \"src\"))\n for file in os.listdir(\".\"):\n if os.path.isfile(file):\n shutil.copyfile(file, os.path.join(BUILD_DIR, file))", "def copy_files(self):\n files = ['LICENSE.md', 'CONTRIBUTING.md']\n ...
[ "0.7654222", "0.6983259", "0.6957278", "0.6688869", "0.6667071", "0.6636383", "0.648613", "0.64767617", "0.63112885", "0.6297935", "0.6296973", "0.62937987", "0.6252419", "0.6233549", "0.616186", "0.61171", "0.61103636", "0.6088972", "0.60825247", "0.6061819", "0.5998159", ...
0.6076376
19
Sets the scope for visualization
def set_scope(self, scope): self.vis.set_scope(scope)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope(self, scope):\n self._scope = scope", "def scope(self, scope):\n\n self._scope = scope", "def set_scope(self, value):\n self._set_one_attribute(self.AttributeNames.SCOPE, value)\n return self", "def scope(self, name):\r\n raise NotImplementedError", "def scope_name(...
[ "0.71557474", "0.6992773", "0.64821863", "0.6437079", "0.6400237", "0.62426734", "0.62259716", "0.6182546", "0.6080821", "0.6059979", "0.59588253", "0.5852097", "0.5847752", "0.58445555", "0.5843846", "0.58180714", "0.57963246", "0.57376325", "0.566702", "0.5613966", "0.56080...
0.8688092
0
Draws a map in the background
def draw_map(self): self.vis.draw_map()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _draw_map(screen):\n my_map = HexMap(80, 80, _hex_size=10)\n my_map.generate_with_random_walk(150, iterations=25)\n for tile in my_map:\n # print(tile)\n color = COLORS[tile.type]\n\n tile_color = _modify_color(color)\n pygame.draw.polygon(screen, tile_color, tile.corners)\...
[ "0.7438594", "0.71875733", "0.71379495", "0.71011156", "0.7013649", "0.68864465", "0.68812746", "0.6869771", "0.6788096", "0.6728911", "0.67023903", "0.6584422", "0.65258896", "0.65181553", "0.6514239", "0.6453493", "0.64481187", "0.64455163", "0.6381603", "0.6366488", "0.635...
0.7902193
0
Draws the routes of the ships
def draw_routes(self): self.vis.draw_routes()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_routes(self):\n visualize_tsp.plotTSP([self.best_solution], self.coords)", "def show_positioned_routes(self, routes):\n print(55*\"-\")\n print(\" Positioned Routes:\")\n print(55*\"-\")\n for elem in routes:\n print(str(elem))", "def dump(self):\n ...
[ "0.68161446", "0.63527113", "0.6300826", "0.6296435", "0.6266359", "0.60612214", "0.601034", "0.6004469", "0.600043", "0.5953386", "0.5913259", "0.5910172", "0.58955467", "0.58931464", "0.5875609", "0.58717746", "0.58306396", "0.58220094", "0.58145154", "0.5808135", "0.579943...
0.7103001
0
Draws the predictions of the ships
def draw_predictions(self): self.vis.draw_predictions()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, frame):\n for prediction in self.predictions:\n prediction.draw(frame)", "def plot_predictions(self):\n\n plt.title(\"Targets vs. Predictions\")\n plt.plot(self.T, label=\"Targets\")\n plt.plot(self.Y, label=\"Predictions\")\n plt.xlabel(\"Sample numbe...
[ "0.626214", "0.6031829", "0.59917396", "0.59532815", "0.5945221", "0.59262586", "0.591139", "0.5855403", "0.58285314", "0.5797049", "0.5768138", "0.5755301", "0.57469463", "0.5740562", "0.5700845", "0.56753343", "0.56701136", "0.56557083", "0.565118", "0.5646596", "0.5598298"...
0.6511887
0
Starts the PyQt5Application maximized
def show_dialog(self): self.showMaximized() sys.exit(self.app.exec_())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showMaximized(self):\n self.usualSize = self.size()\n self.setWindowState(Qt.WindowMaximized)\n self.move(0, 0)\n self.setFixedSize(QSize(self.screenSize.width(), self.screenSize.height()))\n self.maximized = True\n QWidget.showMaximized(self)", "def maximize_app( ap...
[ "0.7441274", "0.7221831", "0.6910993", "0.6865379", "0.6588485", "0.65783817", "0.64921206", "0.6491779", "0.6343574", "0.6277894", "0.6226824", "0.6132522", "0.6104767", "0.61045426", "0.6081701", "0.60019153", "0.5911355", "0.5893951", "0.5888113", "0.5679614", "0.5611324",...
0.6986234
2
Zooms to calculated or to user scope
def __button_zoom_clicked(self): self.zoom_to_calc_scope = not self.zoom_to_calc_scope self.vis.change_zoom(self.zoom_to_calc_scope) if self.zoom_to_calc_scope: self.button_zoom.setText("Zoom to user scope") else: self.button_zoom.setText("Zoom to calculated scope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zoom_to(self):\n # Will seek user feedback. QGIS will\n # Pan to first layer loaded", "def zoom(self, amount):\n pass", "def apply_zoom(self):\n self.maparea.setTransform(self.zoom_levels[self.cur_zoom][1])\n self.scene.draw_visible_area()", "def __zoom(self):\n ...
[ "0.70761585", "0.69927603", "0.68108034", "0.65833044", "0.65501726", "0.65094495", "0.65086645", "0.64987355", "0.6489018", "0.64820343", "0.6400203", "0.6360558", "0.62938553", "0.6238079", "0.62361455", "0.6220067", "0.62044436", "0.618074", "0.61599994", "0.6158776", "0.6...
0.7127061
0
Changes the color of route lines and route patches
def __button_routes_line_color_clicked(self): color = QColorDialog.getColor() if color.isValid(): self.vis.change_route_line_color(color.name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_way(graph, way):\n ox.plot_graph_route(graph, way)", "def __button_routes_marker_color_clicked(self):\n color = QColorDialog.getColor()\n if color.isValid():\n self.vis.change_route_marker_color(color.name())", "def _set_color(self, r):\n c = COLORS[self.color]\n ...
[ "0.6682972", "0.6390528", "0.6147725", "0.61077327", "0.60268617", "0.5987641", "0.58574235", "0.58475643", "0.5789604", "0.5737006", "0.5722419", "0.5721481", "0.57162046", "0.5715089", "0.5713998", "0.57114846", "0.5698987", "0.5686852", "0.56804526", "0.56774586", "0.56742...
0.67418104
0
Changes the color of route markers
def __button_routes_marker_color_clicked(self): color = QColorDialog.getColor() if color.isValid(): self.vis.change_route_marker_color(color.name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_markers_color(self, markers_color):\n self.markers_color = markers_color\n self.update_markers(self.markers)", "def set_markers_color(self, markers_color):\n self._set_markers_color(markers_color, key=\"model\")", "def _set_markers_color(self, markers_color, key):\n self.mar...
[ "0.7044057", "0.7002465", "0.677413", "0.6731408", "0.65059507", "0.61693764", "0.60807544", "0.59966314", "0.59300774", "0.5908406", "0.58413565", "0.58325946", "0.58061284", "0.57990813", "0.5794199", "0.5764045", "0.57388026", "0.5721148", "0.5715555", "0.5715183", "0.5710...
0.7659686
0
Changes the color of prediction lines and prediction patches
def __button_prediction_line_color_clicked(self): color = QColorDialog.getColor() if color.isValid(): self.vis.change_prediction_line_color(color.name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_color(self):\n self.plot(update_traces=False, update_waveforms=True)", "def changeColor(self):\n self.layer.new_colormap()", "def __button_prediction_marker_color_clicked(self):\n color = QColorDialog.getColor()\n if color.isValid():\n self.vis.change_predictio...
[ "0.62123764", "0.61652744", "0.60644865", "0.5744471", "0.5587503", "0.5579864", "0.54944956", "0.5475637", "0.54724866", "0.54577696", "0.54441255", "0.54431957", "0.5403518", "0.53859484", "0.5351867", "0.53359157", "0.53151727", "0.530714", "0.52710307", "0.5262313", "0.52...
0.62771994
0
Changes the color of prediction markers
def __button_prediction_marker_color_clicked(self): color = QColorDialog.getColor() if color.isValid(): self.vis.change_prediction_marker_color(color.name())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_markers_color(self, markers_color):\n self._set_markers_color(markers_color, key=\"model\")", "def set_markers_color(self, markers_color):\n self.markers_color = markers_color\n self.update_markers(self.markers)", "def _set_markers_color(self, markers_color, key):\n self.mar...
[ "0.7043545", "0.6805905", "0.65569264", "0.6435788", "0.6404955", "0.63046265", "0.62484235", "0.59784675", "0.59488225", "0.5729172", "0.5657184", "0.5614262", "0.5593371", "0.55903167", "0.55818754", "0.555754", "0.55339634", "0.5522944", "0.55088085", "0.5441992", "0.54185...
0.7464549
0
Changes the line width and patch size
def __button_line_width_clicked(self): val, okPressed = QInputDialog.getDouble(self, "Set line width","Value:", self.line_thickness, 0, 100, 4) if okPressed: self.vis.change_line_width(val) self.line_thickness = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def linewidth(self, size: float):\n for line in self.ax.lines:\n line.set_linewidth(size)\n self.canvas.draw()", "def set_line_thickness(thickness):\r\n global _current_line_thickness\r\n _current_line_thickness = thickness", "def setLineWidth(w=1):\n dislin.linwid(w)", "def...
[ "0.7279491", "0.7156996", "0.7128549", "0.7085972", "0.6764721", "0.65739036", "0.65367657", "0.6462017", "0.6433259", "0.6371664", "0.63704294", "0.63312036", "0.6316157", "0.6217226", "0.61715096", "0.6160285", "0.61116457", "0.6103658", "0.6094712", "0.6082826", "0.6024881...
0.6979117
4
Changes the marker size
def __button_marker_size_clicked(self): val, okPressed = QInputDialog.getDouble(self, "Set marker size","Value:", self.marker_size, 0, 100, 4) if okPressed: self.vis.change_marker_size(val) self.marker_size = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_markers_size(self, markers_size):\n self.markers_size = markers_size\n self.update_markers(self.markers)", "def _set_markers_size(self, markers_size, key):\n self.markers_size[key] = markers_size\n self._update_markers(self.markers, key)", "def changeSize(self, value):\n ...
[ "0.7957097", "0.79468244", "0.7109392", "0.6834395", "0.6767795", "0.66597164", "0.6571444", "0.6549198", "0.65221936", "0.6460304", "0.6456009", "0.64492106", "0.6431153", "0.64193666", "0.641807", "0.641807", "0.63952523", "0.63742155", "0.6358185", "0.6348079", "0.6309966"...
0.8122282
0
Shows only nth marker
def __button_mark_every_clicked(self): val, okPressed = QInputDialog.getInt(self, "Set every n-th marker","Value:", self.mark_every, 1, 1000) if okPressed: self.vis.change_mark_every(val) self.mark_every = val
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_markers(num_markers):\n markers = ['^','o','P','X','*', 'd','<', '>', ',','|', '1','2','3','4','s','p','*','h','+']\n if(num_markers>18):\n sys.exit(\"cannot create more than 18 markers, refactor your code; force exiting\")\n\n return markers[0:num_markers]", "def alert(n):\n f...
[ "0.61066335", "0.58480793", "0.58365047", "0.57498217", "0.5747987", "0.5717928", "0.5526804", "0.54910606", "0.54452956", "0.5429945", "0.54014564", "0.53442556", "0.53102845", "0.52922887", "0.52334106", "0.5230203", "0.5225732", "0.52170223", "0.5191547", "0.51543796", "0....
0.58969164
1
Changes the anomaly threshold and redraw the anomaly annotations, if necessary
def __slider_anomaly_threshold_value_changed(self): val = self.slider_anomaly_threshold.value() / 10000 self.label_anomaly_threshold.setText("Anomaly threshold: %.4f" % round(val, 5)) self.vis.change_anomaly_thresh(val) self.vis.show_anomalies(self.checkbox_anomalies.isChecked()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anomaly():\n\n #Load anomaly dataset\n anomaly_data = LoadDataset(\"dataset/kaggle_anomalies/\",0)\n anomaly_data, anomaly_label, val, val_label = anomaly_data.load_data()\n for i in range (len(anomaly_label)):\n anomaly_label[i] = anomaly_label[i] + 5\n\n #Concatinate test and anomaly\n ...
[ "0.63055974", "0.59972256", "0.5510011", "0.549272", "0.5430622", "0.54203653", "0.5420277", "0.53936905", "0.5356829", "0.53355956", "0.52786005", "0.52670705", "0.5250499", "0.5238121", "0.52195436", "0.52043974", "0.5202424", "0.51902163", "0.5183443", "0.51810884", "0.517...
0.7162049
0
takes the parsed color and returns it in matplotlib format
def parse_color(color): return (color[0], color[1], color[2])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color_val_matplotlib(color):\n color = mmcv.color_val(color)\n color = [color / 255 for color in color[::-1]]\n return tuple(color)", "def getColor(self, _color):\n c = _color.split()\n \n for n in range(len(c)):\n c[n] = float(c[n])\n \n return c", "d...
[ "0.6960643", "0.68371934", "0.6820142", "0.66417915", "0.66331017", "0.6586802", "0.657952", "0.6547312", "0.6425396", "0.6418397", "0.63776857", "0.63485354", "0.63365304", "0.6317147", "0.6297241", "0.6231265", "0.6167969", "0.6115033", "0.60773015", "0.60769904", "0.603920...
0.68683803
1
returns an argument parse, which parses the arugments, which are needed / optional for this component.
def arg_parser(): parser = argparse.ArgumentParser(add_help=False) group = parser.add_argument_group("visualization") group.add_argument("--routes_line_color", nargs=3, action="store", type=float, default=[0.6, 0.2, 0.8], help="the color of the routes line", metavar=("r", "g", "b")) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arg_parse():\n p = ap.ArgumentParser()\n p.add_argument()\n return p.parse_args()", "def _parse_args():\n parser = argparse.ArgumentParser(description=\"\")\n #parser.add_argument(\"args\", metavar=\"N\", type=str, nargs=\"*\", help=\"Positional arguments.\")\n #parser.add_argument(\"\", de...
[ "0.7382645", "0.73573893", "0.7320075", "0.7235577", "0.71779126", "0.7156848", "0.7137164", "0.7116912", "0.7058954", "0.7051867", "0.7033093", "0.70195925", "0.7019295", "0.7008903", "0.69974977", "0.6989396", "0.69782114", "0.69701517", "0.69482166", "0.6924753", "0.690785...
0.0
-1
Converts the object into a dictionary used for serializing
def to_dict(self): result = {'Id': self.get_client_line_id(), 'AgencyId': self.id, 'Number': self.get_line_number(), \ 'Name': self.name.upper(), 'Dir': self.direction, 'Stops': [s.to_dict() for s in self.stops], \ 'Map': [l.to_dict() for l in self.route], 'Night': self.is_ni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self) -> dict:", "def to_dict(self) -> Dict:\n return {'object_id': self.object_id, 'data_id': self.data_id}", "def dict(self):\n return objToDict(self)", "def to_obj(self):\n return dict()", "def convert_to_dict(self):\n # Populate the dictionary with object meta d...
[ "0.7948245", "0.7880991", "0.7832231", "0.7826991", "0.77938557", "0.77315027", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", "0.77305317", ...
0.0
-1
Converts the object into a dictionary used for serializing
def to_dict(self): result = {'Id': self.id, 'Na': self.name, \ 'Sc': self.schedule.to_dict(), 'Lc': self.location.to_dict()} if len(self.connections)>0: result['Co'] = self.connections_to_string() return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self) -> dict:", "def to_dict(self) -> Dict:\n return {'object_id': self.object_id, 'data_id': self.data_id}", "def dict(self):\n return objToDict(self)", "def to_obj(self):\n return dict()", "def convert_to_dict(self):\n # Populate the dictionary with object meta d...
[ "0.79485124", "0.7880778", "0.7831247", "0.782649", "0.7794245", "0.77308095", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", "0.7730069", ...
0.0
-1
Receives a matrix of coordinates and transforms it into a list of Locations
def coordinates_to_locations(coordinates): np_coords = np.array(coordinates) longs, lats = transform(Proj(init=EPSG_IN), Proj(init=EPSG_OUT), np_coords[:, 0], np_coords[:, 1]) length = len(lats) result = [] for i in range(length): loc = Location(lats[i], longs[i]) raw_location = extr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix2list(vertex_matrix): \n flat_array = vertex_matrix.tolist() \n xy_list = [] \n for i in range(0, len(flat_array)): \n xy_list.append( flat_array[i][0] ) \n xy_list.append( flat_array[i][1] ) \n return xy_list", "def coords_to_positions(self, coords):\n return [self.t...
[ "0.63898116", "0.63502413", "0.62159", "0.6157633", "0.61507696", "0.6145018", "0.6046968", "0.6008495", "0.59859973", "0.59842753", "0.5973625", "0.5972133", "0.5960086", "0.59585255", "0.593453", "0.5930561", "0.5909759", "0.59049857", "0.5903449", "0.5894739", "0.5884177",...
0.6808166
0
Given ('503846.58851256', '4791736.67290404') returns (503846, 4791736)
def extract_raw_simple_coordinates (raw_location): pattern = re.compile('(\d+).(\d+)?') x_result = pattern.match(str(raw_location[0])) y_result = pattern.match(str(raw_location[1])) return int(x_result[1]), int(y_result[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tuple(self, string):\n a = re.search('\\((\\d+\\.\\d+), (\\d+\\.\\d+)\\)', string)\n if not a:\n return None\n else:\n return (float(a.group(1)), float(a.group(2)))", "def key_to_coordinates(key):\n stripkey = key.strip(\"(\").strip(\")\").split(\", \")\n ...
[ "0.60521793", "0.6008657", "0.59300464", "0.57546574", "0.573588", "0.5650845", "0.56116116", "0.55786246", "0.55596447", "0.55537593", "0.5545964", "0.5532772", "0.54754543", "0.5463573", "0.5441758", "0.54177845", "0.5398144", "0.5393655", "0.5357906", "0.53475595", "0.5346...
0.5193754
32
Initialises a new ReadingLoader instance to read and process data from files generated by the RED reading task. Arguments data_dir String. Path to the directory that contains data files that need to be loaded. Keyword Arguments output_path String. Path to the file in which processed data needs to be stored, or None to ...
def __init__(self, data_dir, output_path=None, task_name="ReadingTest", \ answer_file=None): # Define the default answer_file. if answer_file is None: answer_file = os.path.join( \ os.path.dirname(os.path.abspath(__file__)), \ "reading_ans...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, data_dir, output_path=None, task_name=\"Q1_Questions\"):\n \n # Remember the task name.\n self._task_name = task_name\n # Load all data.\n self.load_from_directory(data_dir, task_name)\n self.process_raw_data()\n if not (output_path is None):\n ...
[ "0.68810457", "0.6347282", "0.63151276", "0.60448104", "0.59106815", "0.5840321", "0.57810795", "0.5776484", "0.5745916", "0.5745365", "0.569666", "0.5693174", "0.56790227", "0.5678662", "0.5673701", "0.56613", "0.5648839", "0.5613989", "0.5597921", "0.55950487", "0.5570015",...
0.6832593
1
Loads data from a single file. This function overwrites the parent's load_from_file function to allow for the checking of answers. Arguments file_path String. Path to the file that needs to be loaded. Keyword arguments delimiter String. Delimiter for the data file. Default = "," missing List. List of values that code f...
def load_from_file(self, file_path, delimiter=",", missing=None, \ auto_typing=True, string_vars=None): # Load the data from a file. raw = read_behaviour(file_path, delimiter=",", missing=None, \ auto_typing=True, string_vars=["Sentence", "Response"]) # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_from_file(self, file_path, delimiter=\",\", missing=None, \\\n auto_typing=True, string_vars=None):\n \n # Load the data from a file.\n raw = read_behaviour(file_path, delimiter=\",\", missing=None, \\\n auto_typing=True, string_vars=[\"Response\"])\n \n ...
[ "0.73351383", "0.5946088", "0.5934415", "0.58590823", "0.5856287", "0.5807811", "0.57449085", "0.5613772", "0.5591136", "0.55231375", "0.5500807", "0.5500807", "0.54131764", "0.5364186", "0.5352303", "0.5316944", "0.5308802", "0.53043306", "0.52103776", "0.5204313", "0.517564...
0.6975702
1
Computes the variables that need to be computed from this task, and stores them in the self.data dict. This has one key for every variable of interest, and each of these keys points to a NumPy array with shape (N,) where N is the number of participants. The processed data comes from the self.raw dict, so make sure that...
def process_raw_data(self): # Define some variables of interest. vor = ["n_sentences", "n_correct", "p_correct", "median_RT", \ "mean_RT", "stdev_RT", "scaled_stdev_RT"] # Get all participant names, or return straight away if no data was # loaded yet. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_raw_data(self):\n \n # Get all participant names, or return straight away if no data was\n # loaded yet.\n if hasattr(self, \"raw\"):\n participants = self.raw.keys()\n participants.sort()\n else:\n self.data = None\n return...
[ "0.735433", "0.6486896", "0.62451255", "0.61603683", "0.6160291", "0.605454", "0.58846754", "0.587648", "0.587125", "0.58672607", "0.5865694", "0.5862777", "0.5860213", "0.5857704", "0.5793308", "0.57828593", "0.5727415", "0.5701312", "0.56965584", "0.5690695", "0.5669493", ...
0.77125794
0
Extracts the path from the remote URL
def repo_full_name_from_remote(remote_url): # Check whether we have a https or ssh url if remote_url.startswith("https"): path = urllib.parse.urlparse(remote_url) path = path.path # Remove the intial '/' path = path[1:] # Remove extension path = os.path.splitext(p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPathFromUrl(url):\n return __ParseUrl(url)[2]", "def _remote_path(self):\n return self._remote_dir", "def _parse_source(self, response):\n return response.url", "def process_url(url):\n parsed = urlparse(url)\n if parsed.scheme:\n return parsed.netloc, parsed.path\n else...
[ "0.71459997", "0.6760801", "0.6729793", "0.6680723", "0.6593853", "0.65536875", "0.655141", "0.64805835", "0.64625865", "0.6397612", "0.6395385", "0.63676685", "0.6367012", "0.63624704", "0.62920296", "0.6290658", "0.62889403", "0.62657434", "0.6243308", "0.6237244", "0.62331...
0.64504325
9
Make a list of all modules installed in this repository Returns a tuple of two lists, one for local modules and one for nfcore modules. The local modules are represented as direct filepaths to the module '.nf' file. Nfcore module are returned as file paths to the module directories. In case the module contains several ...
def get_installed_modules(dir, repo_type="modules"): # initialize lists local_modules = [] nfcore_modules = [] local_modules_dir = None nfcore_modules_dir = os.path.join(dir, "modules", "nf-core") # Get local modules if repo_type == "pipeline": local_modules_dir = os.path.join(dir, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_modules(self) -> Optional[List[str]]:\n module_list: List[str] = []\n for forge_module in self._forge_modules:\n module_list.append(forge_module.name)\n for git_module in self._git_modules:\n module_list.append(git_module.name)\n return module_list", "de...
[ "0.68389815", "0.6744586", "0.6596824", "0.65812105", "0.6420615", "0.6393576", "0.6108857", "0.6055035", "0.60373896", "0.6012906", "0.5990414", "0.5955053", "0.5934572", "0.59338784", "0.5891398", "0.5880061", "0.5828444", "0.5819975", "0.5815788", "0.5812122", "0.58095336"...
0.7559931
0
Flags a comment. Confirmation on GET, action on POST.
def flag(request, comment_id): try: comment = comments.get_object(pk=comment_id, site__id__exact=SITE_ID) except comments.CommentDoesNotExist: raise Http404 if request.POST: userflags.flag(comment, request.user) return HttpResponseRedirect('%sdone/' % request.path) return...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flag_comment(request, submission_id, comment_id):\n # If not flagged, flag and decrement author's karma.\n # If flagged, undo flag and increment author's karma.\n # If upvoted, undo upvote and decrement author's karma.\n # If downvoted, undo upvote and increment author's karma.\n # No need to d...
[ "0.686533", "0.67600733", "0.6324674", "0.6263772", "0.6260797", "0.61571467", "0.6092327", "0.6090107", "0.6030129", "0.60185254", "0.59647995", "0.596228", "0.5958102", "0.59516764", "0.5940332", "0.5812686", "0.5787282", "0.5782282", "0.5781615", "0.5746764", "0.5725129", ...
0.74663377
0
Deletes a comment. Confirmation on GET, action on POST.
def delete(request, comment_id): try: comment = comments.get_object(pk=comment_id, site__id__exact=SITE_ID) except comments.CommentDoesNotExist: raise Http404 if not comments.user_is_moderator(request.user): raise Http404 if request.POST: # If the comment has already been...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_comment(request, comment_id):\n raise NotImplementedError", "def delete_comment(self, id, **args): \n args.update(id=id)\n return self.fetch(\"/comment/delete\", post_args=args)", "def delete_comment(request, course_id, comment_id):\r\n comment = cc.Comment.find(comment_id)\r\n ...
[ "0.84090346", "0.7925234", "0.78713894", "0.778777", "0.77292603", "0.7653056", "0.7631221", "0.75838006", "0.747952", "0.74310815", "0.741415", "0.73892677", "0.72891563", "0.7151106", "0.7113485", "0.70712", "0.7050842", "0.7023403", "0.69454706", "0.6891005", "0.6881565", ...
0.75836974
8
Set up test variables.
def setUpClass(cls): user = 'postgres' password = 'password' host = '127.0.0.1' port = '5432' database = 'postgres' conn_params = [user, password, host, port, database] ddl = "DROP SCHEMA IF EXISTS test CASCADE" pg_conn = PostgreSQL(*conn_params) p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n test_env_setup()", "def _set_up():\n repl._setUp = self.setUp", "def setUp(self):\n\n # setup init variables\n self.init_vars = {\n 'suppress_logfile': True,\n 'verbosity': 0,\n 'mothur_seed': 54321,\n }\n\n #...
[ "0.7683675", "0.7621648", "0.75302994", "0.73465705", "0.73079515", "0.73079515", "0.72646254", "0.7220895", "0.7213839", "0.7211513", "0.72097087", "0.7171401", "0.7158472", "0.7151176", "0.714493", "0.7141824", "0.7123144", "0.711939", "0.7099598", "0.7091641", "0.7083642",...
0.0
-1
Check connection with Postgresql database.
def test_init(self): self.assertEqual(str(PostgreSQL(*self.conn_params).engine), "Engine(postgresql://test:***@127.0.0.1:" "5432/postgres)")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check():\n conn = None\n try:\n # read connection parameters\n params = config()\n \n # connect to the PostgreSQL server\n print('Connecting to the PostgreSQL database...')\n conn = psycopg2.connect(**params)\n \n # create a cursor\n cur = conn.cursor...
[ "0.8388398", "0.77379507", "0.7704035", "0.7534378", "0.7430744", "0.7258017", "0.7247929", "0.72414553", "0.72246337", "0.7213338", "0.71397334", "0.70725214", "0.7063897", "0.69838053", "0.69833976", "0.6895949", "0.68938076", "0.6883648", "0.68471646", "0.6838498", "0.6829...
0.0
-1
Check execute method launching arbitrary sql queries.
def test_execute(self): pg_conn = PostgreSQL(*self.conn_params) sql = f'''CREATE TABLE table1 (id integer, column1 varchar(100), column2 float)''' pg_conn.execute(sql) sql = "INSERT INTO table1 (id, column1, column2) " \ "VALUES (1, 'Varchar text (100 char...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_query(self, *args, **kwargs):", "def run(self, sql, *args):\n return self.database.execute(sql, args)", "def _execute(self, db):\n raise NotImplementedError", "def execute(self):\n if self.sql is None:\n self.sql = self.construct_query()\n # Only SQL strings...
[ "0.7710323", "0.7611448", "0.760573", "0.75472224", "0.7468983", "0.73805314", "0.73273337", "0.73039377", "0.7269179", "0.7221843", "0.71986544", "0.7172537", "0.71460295", "0.7133281", "0.71269566", "0.71252114", "0.7111323", "0.7058849", "0.7052643", "0.7040104", "0.701126...
0.0
-1
Check if multiple SQL statements are correctly executed.
def test_execute_multiple(self): pg_conn = PostgreSQL(*self.conn_params) sql = f"""CREATE TABLE table1 (id integer, column1 varchar(100), column2 float); INSERT INTO table1 (id, column1, column2) VALUES (1, 'Varchar; text; (100 char)', 123456789.01...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_multiple_sql_statements(statements, fetch=True, cur=None, conn=None, commit=True):\n\n try:\n if conn is None:\n logger.error(\"Connection cannot be None.\")\n raise ValueError(\"Connection cannot be None.\")\n\n if cur is None:\n cur = conn.cursor()\n\n ...
[ "0.6614053", "0.6523383", "0.64463997", "0.6432209", "0.6429317", "0.63709897", "0.636691", "0.6331006", "0.6307495", "0.62796277", "0.6218031", "0.6213825", "0.61856246", "0.61269885", "0.6086156", "0.60775757", "0.6075473", "0.6038134", "0.6027315", "0.60235554", "0.6019292...
0.64520967
2
Saves a few button presses by opening a database and returning the output as a dict
def newConn(): g = sql.connect('user.db') e = g.cursor() return { "close": g.close, "commit": g.commit, "cursor": e }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_press_save(self):\n\n if self.dbChk.isChecked():\n self.processed_fields['db'] = self.dbPath.text()\n self.dbForm = DBFormWindow(self.processed_fields, self)\n self.dbForm.show()\n\n if self.savePathChk.isChecked():\n if self.savePath.text():\n ...
[ "0.6564143", "0.6236265", "0.6148969", "0.61240685", "0.611488", "0.60713863", "0.5928489", "0.5880718", "0.5758679", "0.56460655", "0.56113094", "0.561073", "0.5597487", "0.5554949", "0.55506355", "0.5547778", "0.5542317", "0.55413216", "0.553563", "0.5512199", "0.5506875", ...
0.0
-1
Success function to verify the script was successful
def success(a): print(f'\n\n{a} successfully completed its mission\n\n') return f'{a} successfully completed its mission'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def success(self):\n self.succeeded = True", "def successful(self) -> bool:\n pass", "def print_success():\n print \"Success!\\n\"\n return True", "def test_success(self):\n result = self.test_client.success\n\n assert result == 1", "def execute_success(self, *args, **kwar...
[ "0.75061536", "0.73862875", "0.726931", "0.704134", "0.7001747", "0.68722284", "0.67791456", "0.6714529", "0.6711764", "0.6644389", "0.6643627", "0.6592407", "0.6574083", "0.6555387", "0.65435743", "0.6534694", "0.65240014", "0.6515918", "0.6512348", "0.6486815", "0.6478787",...
0.0
-1
Generates a fresh new iV set and inserts it into the database
def ivgen(pokeId): h = other.newConn() close = h['close'] commit = h['commit'] c = h['cursor'] c.execute(""" INSERT INTO pokeiv (ID, HPiv, Atkiv, Defiv, SpAtkiv, SpDefiv, Speediv) VALUES(?,?,?,?,?,?,?) """, ( pokeId, random.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_set(*, ctx: context.ContextLevel, **kwargs) -> irast.Set:\n ir_set = irast.Set(**kwargs)\n ctx.all_sets.append(ir_set)\n return ir_set", "def prep(self):\n sq1 = 'create table TCVR ( ID, T, C, V, R , primary key ( ID ) ) ;'\n sq2 = 'create table IDX ( ID , A , primary key(A) ) ; '\...
[ "0.6114309", "0.5982679", "0.58786047", "0.5813862", "0.57588804", "0.57500505", "0.5716826", "0.5708162", "0.57074517", "0.5674362", "0.5631915", "0.5614042", "0.5603859", "0.55749154", "0.5509987", "0.54872024", "0.5473928", "0.54687345", "0.54646945", "0.5453792", "0.54522...
0.5858126
3
Load the pretrained model weights
def load_model_weights(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_weights(self):\n if isinstance(self.pretrained, str):\n logger = get_root_logger()\n logger.info(f'load model from: {self.pretrained}')\n load_checkpoint(self, self.pretrained, strict=False, logger=logger)\n elif self.pretrained is None:\n pass\n ...
[ "0.81840134", "0.80532205", "0.7929311", "0.7929236", "0.78598017", "0.7832963", "0.78319764", "0.777211", "0.7706451", "0.76879597", "0.7657897", "0.76478493", "0.76099664", "0.760729", "0.7571413", "0.7569362", "0.7523776", "0.75005925", "0.75003874", "0.7451586", "0.741773...
0.8207032
0
Set models to eval phase
def set_models_eval(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_eval(self):\n for m in self.models.values():\n m.eval()", "def set_eval(self):\n self.model.eval()", "def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()", "def eval(self, logger=None):\n self.model.eval()\n self.mo...
[ "0.8009308", "0.77162427", "0.7589191", "0.7418761", "0.7214322", "0.7055874", "0.66177076", "0.6542605", "0.63525766", "0.63517594", "0.63286924", "0.6325084", "0.6280866", "0.6221048", "0.62003845", "0.61510843", "0.61048037", "0.61048037", "0.6102818", "0.6097981", "0.6087...
0.7940041
1
Get predictions from the model
def get_predictions(self, seq, seq_mask, seq_lens, batch, xyzhe, simulator_next_action): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self): \n return self.model.predict(self.test_x)", "def predictions(self, model):\n return get_predictions_from_df(\n model=model, df=self.prediction_df,\n fixed_effects=self.fixed_effects,\n random_effect=self.random_effect,\n spline=s...
[ "0.8116896", "0.8030417", "0.8019336", "0.7744747", "0.7712386", "0.7704468", "0.77032965", "0.76695955", "0.76569694", "0.7620984", "0.76174486", "0.7608288", "0.7607634", "0.75987077", "0.75403714", "0.7524296", "0.75212175", "0.75183904", "0.749199", "0.7470694", "0.745553...
0.0
-1
Divides the deck in the argument into different most suitable groups.
def build_groups(self, computer_deck): computer_deck.sort() for card in computer_deck: self.add_card_to_grps(card) self.grps = sorted(self.grps, key = lambda x: -len(x)) logger.info(f"In computer.py/build_groups: computer: {self}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comp10001go_score_group(cards):\n \n # Put int a dictionary for each card which is scored based on its value\n # For example, J is 11, Q is 12 and K is 13, Ace is 20\n \n values = {'2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, \n '0': 10, 'J': 11, 'Q': 12, 'K': 13, ...
[ "0.5854269", "0.58211976", "0.57251054", "0.5717913", "0.5682591", "0.56796926", "0.5642106", "0.5632018", "0.5632018", "0.5628769", "0.5623917", "0.5568811", "0.5563554", "0.5456946", "0.5428732", "0.5418285", "0.54075015", "0.5389676", "0.5361663", "0.5338872", "0.53152716"...
0.6242387
0
Recieves a card from a `Dealer` object and returns 1 card back to `Dealer`.
def get_card(self, card): self.add_card_to_grps(card) self.grps = sorted(self.grps, key = lambda x: -len(x)) # check if # of cards forming sets is more than 5; if yes, then break the set to allow computer to form runs num_set_cards = 0 pos = -1 for i in range(len(self.grps)): if len(self.grps[i]) > 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deal_card(self):\n return self._deal(1)[0]", "def get_card (self, card):\n\t\treturn self._card", "def deal_card():\n cards = [11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10]\n card = random.choice(cards)\n return card", "def get_card(self):\n return self.card", "def deal(self):\n c...
[ "0.7169827", "0.706437", "0.6729612", "0.67081213", "0.66025114", "0.65416914", "0.65415263", "0.653731", "0.65286857", "0.64949375", "0.6493163", "0.6435554", "0.63877463", "0.6373744", "0.6334788", "0.6334788", "0.6331747", "0.63296753", "0.62849206", "0.62837", "0.62802374...
0.5650065
68
Adds the card in the argument to most suitable group in self.grps
def add_card_to_grps(self, card): if card.val == self.card_joker.val or card.val == 0: self.jokers.append(card) else: new_grp = True for grp in self.grps[::-1]: if len(grp) >= 4: continue is_a_set = True val = grp[0].val for grp_card in grp: if grp_card.val != val: is_a_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addCard(self,card:Card):\r\n self.cards.append(card)", "def add_card(self, card):\n self.get_cards().append(card)", "def add_card(self, card):\r\n self.hand.append(card)", "def add(self, card):\n if card != None:\n self.cards.append(card)", "def add_card(self, car...
[ "0.6217423", "0.61076695", "0.6085147", "0.6068018", "0.60551304", "0.60551304", "0.60551304", "0.60551304", "0.60133755", "0.6000306", "0.59344244", "0.59153795", "0.5910493", "0.5905643", "0.59050494", "0.5889543", "0.58820134", "0.5878261", "0.5874322", "0.5856528", "0.583...
0.7281589
0
Checks if the computer can win with the current lives and sets.
def did_computer_win(self): num_jokers = len(self.jokers) # check if pure run exists; try forming pure run from groups in range [1, len(self.grps)] so we can form an impure run from the largest group # in case we don't find pure groups then check for pure group at self.grps[0] is_pure_run = False pure_run_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_for_win(self):\n slots_available = any(\n [slot.available for slot in self.board.iter_slots() if not slot.mine]\n )\n if not slots_available:\n self.status = GameStatusEnum.won\n self.end_time = datetime.utcnow()", "def check_win(self):\n re...
[ "0.7037453", "0.6626272", "0.65832794", "0.65387475", "0.6430472", "0.6387966", "0.63278025", "0.6289832", "0.6274004", "0.6270504", "0.6228436", "0.62095755", "0.6208901", "0.6195936", "0.61956155", "0.6182761", "0.6178062", "0.6167011", "0.61247855", "0.6034586", "0.59895",...
0.609196
19
Makes a decision to choose a card from main deck or the discard pile. Returns True if computer chooses a card from discard_pile.
def make_move(self, dealer, discard_pile_card): sleep(2) choose_from_discard = True # if discard pile is empty, choose from main deck if discard_pile_card is None: choose_from_discard = False else: # make a list of all the cards that I can use to make sets and lives cards_needed = [] cards_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_discard(self, inpt):\n \n if inpt.isdigit() == False:\n return 0\n if int(inpt) > len(self.player_hand):\n print(\"\\nNumber of card entered is greater than number of cards\")\n print(\"Please try again \\n\")\n return 0\n if self.p...
[ "0.69175714", "0.66825265", "0.65739834", "0.6558178", "0.6550377", "0.65189797", "0.62760115", "0.6226463", "0.60765135", "0.606275", "0.5966651", "0.5925703", "0.5882706", "0.5850044", "0.5840374", "0.5808426", "0.57955235", "0.5780476", "0.5769852", "0.57402384", "0.571717...
0.73254395
0
String overloading to display the current state of computer.
def __str__(self): string = "{Jokers: " for card in self.jokers: string += str(card)+", " string += "}" for i in range(len(self.grps)): string += ", {group "+str(i+1)+": " for card in self.grps[i]: string += str(card)+", " string += "}" return string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state(self) -> str:", "def display_state(self):\r\n\r\n print('\\n')\r\n print('>>CURRENT STATE')\r\n ct = 0\r\n for i in self.state:\r\n for j in i:\r\n if j == -1:\r\n val = 'X'\r\n else:\r\n val = st...
[ "0.7629006", "0.7334032", "0.72432625", "0.72137904", "0.6987641", "0.6929009", "0.68520045", "0.6841385", "0.6839816", "0.68049437", "0.6786558", "0.674402", "0.6733141", "0.6692852", "0.66683453", "0.6668119", "0.66540915", "0.6580619", "0.65587723", "0.6485935", "0.6461961...
0.0
-1
Initializes the model, creates the required layers.
def __init__(self, name, config): super(RelationalNetwork, self).__init__(name, RelationalNetwork, config) # Get key mappings. self.key_feature_maps = self.stream_keys["feature_maps"] self.key_question_encodings = self.stream_keys["question_encodings"] self.key_outputs = self.st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_layers(self):\n self._init_predictor()\n if self.use_edge_fusion:\n self._init_edge_module()", "def initialisation(self):\n self.create_variables()\n self.create_placeholders()\n self.build_model()\n self.reset_lr(None, True)\n self.build_loss...
[ "0.75353396", "0.7385353", "0.7351519", "0.7341105", "0.73163855", "0.72941434", "0.7234489", "0.72314245", "0.7228721", "0.7154608", "0.7117338", "0.69305784", "0.6902656", "0.68918926", "0.68781185", "0.68505406", "0.684789", "0.68447316", "0.68215775", "0.67649424", "0.673...
0.0
-1
Function returns a dictionary with definitions of input data that are required by the component.
def input_data_definitions(self): return { self.key_feature_maps: DataDefinition([-1, self.feature_maps_depth, self.feature_maps_height, self.feature_maps_width], [torch.Tensor], "Batch of feature maps [BATCH_SIZE x FEAT_DEPTH x FEAT_HEIGHT x FEAT_WIDTH]"), self.key_question_encodings: D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_inputs(self):\n return {}", "def get_required_params():\n return {}", "def input_data_definitions(self):\n return {\n self.key_inputs: DataDefinition(\n [-1]*(self.num_inputs_dims-1) + [self.input_size],\n [list]*(self.num_inputs_dims-1) ...
[ "0.67774713", "0.67546266", "0.6709142", "0.65007764", "0.6477465", "0.6333413", "0.6286046", "0.6230515", "0.6222384", "0.62112576", "0.6200324", "0.61986625", "0.61236846", "0.60840017", "0.60487604", "0.602839", "0.6024194", "0.6021029", "0.6011841", "0.6009006", "0.600900...
0.68205595
0
Function returns a dictionary with definitions of output data produced the component.
def output_data_definitions(self): return { self.key_outputs: DataDefinition([-1, self.output_size], [torch.Tensor], "Batch of outputs [BATCH_SIZE x OUTPUT_SIZE]") }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_data_definitions(self):\n return {}", "def _get_output_dictionary(self):\n\n return_dictionary = {}\n\n for output_path in self.provided_outputs:\n return_dictionary[output_path.full_path] = self.get_value(output_path)\n\n return return_dictionary", "def output...
[ "0.79142004", "0.7396703", "0.72935414", "0.714347", "0.68933153", "0.67715305", "0.6712582", "0.6655782", "0.6595801", "0.6583784", "0.6554832", "0.65446115", "0.6532827", "0.6519101", "0.65083754", "0.64225125", "0.6382813", "0.6379986", "0.63664275", "0.6361891", "0.635461...
0.7505002
1
Main forward pass of the model.
def forward(self, data_streams): # Unpack DataStreams. feat_m = data_streams[self.key_feature_maps] enc_q = data_streams[self.key_question_encodings] # List [FEAT_WIDTH x FEAT_HEIGHT] of tensors [BATCH SIZE x (2 * FEAT_DEPTH + QUESTION_SIZE)] relational_inputs = [] # Ite...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forward(self):\n pass", "def forward(self):\n pass", "def forward(self)->None:", "def forward(self, inputs):\r\n #print (len(inputs))\r\n out = self.fc1(inputs)\r\n out = self.fc2(out)\r\n self.out = out\r\n return out\r\n #raise NotImplementedError...
[ "0.7822591", "0.7822591", "0.765289", "0.7580732", "0.75480294", "0.7357169", "0.73557156", "0.7254156", "0.7254156", "0.7254156", "0.72511846", "0.72418314", "0.7214285", "0.7214285", "0.72078264", "0.72078264", "0.7190793", "0.71742815", "0.7124694", "0.7100066", "0.7100066...
0.0
-1
Initializer for an Anchors layer. Args
def __init__(self, size, stride, ratios=None, scales=None, *args, **kwargs): self.size = size self.stride = stride self.ratios = ratios self.scales = scales if ratios is None: self.ratios = np.array([0.5, 1, 2], keras.backend.floatx()), elif isinstance(rat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, size, stride, ratios=None, scales=None, *args, **kwargs):\n super(Anchors, self).__init__()\n # strides and sizes align with FPN feature outputs (p2-pn)\n self.size = size\n self.stride = stride\n # ratios and scales applied to all feature levels from FPN outpu...
[ "0.6520514", "0.64596355", "0.63083297", "0.6220048", "0.6083319", "0.6031503", "0.5834639", "0.5821119", "0.58128357", "0.579758", "0.5726126", "0.57205045", "0.5690522", "0.56749034", "0.56544065", "0.56527907", "0.5648447", "0.56436676", "0.5642388", "0.56291455", "0.56160...
0.61980695
4
Get package version (without import the package, which may or may not work)
def get_version(): version_dict = {} exec(open("src/chimera/version.py").read(), version_dict) return version_dict['version']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_version():\n return __version__", "def get_version():\n return __version__", "def get_version():\n return __version__", "def _get_package_version():\n file = join(get_root(), 'VERSION')\n\n if exists(file):\n with open(file) as file:\n return file.read()\n\n return...
[ "0.8257111", "0.8257111", "0.8257111", "0.8252309", "0.8199102", "0.81818837", "0.8052985", "0.8032427", "0.80265176", "0.7993858", "0.791491", "0.7886565", "0.78741765", "0.7870378", "0.78658634", "0.7855305", "0.7855305", "0.7855305", "0.7855305", "0.7855305", "0.7855305", ...
0.75629634
47
Encodes a tree to a single string.
def serialize(self, root): def dfs(root): if not root: res.append('None') return res.append(str(root.val)) dfs(root.left) dfs(root.right) res = [] dfs(root) return ','.join(res)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_to_string(tree):\n if type(tree) == Tree:\n return sum(list(map(tree_to_string, tree.children)), [])\n else:\n return [str(tree)]", "def serialize(node, tree=\"\"):\n \n \n if (not node): #Base case\n tree += \"# \"\n return tree\n tree += (str(node.val) + \" ...
[ "0.72254354", "0.7174656", "0.70803744", "0.706792", "0.7032909", "0.7030312", "0.7020698", "0.69704413", "0.6961067", "0.69334626", "0.692108", "0.6879218", "0.6797347", "0.6790119", "0.6790119", "0.6789466", "0.67704153", "0.6743968", "0.6743425", "0.6740732", "0.67361337",...
0.6240413
76
Decodes your encoded data to tree.
def deserialize(self, data): def recursiveDeserialize(stringList): if stringList[0] == 'None': stringList.pop(0) return None root = TreeNode(stringList[0]) stringList.pop(0) root.left = recursiveDeserialize(str...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize(self, data):\n # if data:\n # root = TreeNode(data.pop(0))\n # # root.val = data.pop\n if not data:\n return None\n data = data.split(' ')\n data = iter(data)\n\n def resucsbuild():\n try:\n val = next(dat...
[ "0.75939554", "0.7463827", "0.7094851", "0.7064511", "0.705998", "0.7053173", "0.7051886", "0.7046027", "0.70459527", "0.7039219", "0.69926393", "0.6987736", "0.69776005", "0.6933219", "0.6915955", "0.69115806", "0.68922126", "0.68773776", "0.68404627", "0.68312407", "0.68175...
0.6754275
25
CREATING SIMPLE HASH FOR STRING SEGMENT
def hash(self, text): hashval = 0 for i in xrange(0, len(text)): hashval += ord(text[i])**i return hashval
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hashing_info(string):#KEY HASHING FUNCTION\n nodeInfo = string.encode('utf-8')\n\n #md5 -> 2^7 = 128 bits\n hash_object = hashlib.md5()\n hash_object.update(nodeInfo)\n\n tmp = hash_object.hexdigest()\n tmp = int(tmp,16)\n\n result = tmp >> (128-16)\n return result", "def hash(self) -...
[ "0.60646164", "0.6036968", "0.60261166", "0.59612304", "0.58949095", "0.5887943", "0.5800185", "0.5748991", "0.57090807", "0.57031983", "0.57023823", "0.56927955", "0.5658673", "0.5615038", "0.56005543", "0.5593664", "0.5588162", "0.55861115", "0.55836374", "0.555482", "0.554...
0.0
-1
COMPARES HASHES AND IF MATCHES COMPARES STRINGS
def comparison(self): for i in xrange(len(self.string)-len(self.substring)+1): if self.hash(self.string[i:i+len(self.substring)]) == self.hash(self.substring): if self.string[i:i+len(self.substring)] == self.substring: return i return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_str(person, STRs):\n for key in STRs.keys():\n if (STRs[key] != (int(person[key]))):\n return False\n return True", "def test_diff_inputs_diff_hash(self):\n # same strings, different salts\n self.assertNotEqual(\n hash_str(\"mystring\", salt=\"mysalt1\...
[ "0.6531683", "0.6423325", "0.6307448", "0.6179165", "0.61229", "0.6099527", "0.60961074", "0.59638083", "0.5948264", "0.5800117", "0.5774916", "0.5744077", "0.57222134", "0.5716174", "0.57060426", "0.5671249", "0.5648766", "0.5632812", "0.56064326", "0.5602532", "0.56011814",...
0.565158
16
GETTING INPUT FROM USER
def get_input(self): print(" String --> ", end='') self.string = str(raw_input()) print(" Substring --> ", end='') self.substring = str(raw_input()) return self.string, self.substring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_input(user_input):\n return input(user_input)", "def get_user_text_input(self):\n\t\tuser_input = raw_input('You: ')\n\t\treturn user_input", "def get_user_input(self, msg):\n resp = input(msg)\n return resp", "def getInput(self):\n self.userInput = self.entry.get()", "def r...
[ "0.805252", "0.7764863", "0.7683693", "0.7553891", "0.74886185", "0.7484124", "0.7484124", "0.7364146", "0.7330842", "0.7302058", "0.72245455", "0.72006255", "0.7149695", "0.70963407", "0.7026797", "0.7021885", "0.70192075", "0.7012941", "0.7007525", "0.69753206", "0.6921373"...
0.63883954
83
SEARCHING STRING FOR SUBSTRING
def search(self): if self.substring in [None, ""]: print("Invalid Value For Substring") elif self.string in [None, ""]: print("Invalid Value For String") elif len(self.substring) > len(self.string): print("Length of Substring Less Than String") else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_sub_string_index(self, sub):\n try:\n return self.__dna.index(sub)\n except ValueError:\n raise ValueError", "def kmp_search(full_str, sub_str):\n n, m = len(full_str), len(sub_str)\n result = []\n pi = get_partial_match(sub_str)\n begin, matched = 0, 0\n ...
[ "0.68273073", "0.67984945", "0.65509725", "0.65256196", "0.64502376", "0.6448377", "0.6401995", "0.633604", "0.6309308", "0.6277728", "0.6256694", "0.6214137", "0.61992896", "0.61225504", "0.6088924", "0.60244846", "0.59980816", "0.59627664", "0.5954518", "0.59534174", "0.592...
0.6877445
0
Arguments as input to search
def main(): try: string = sys.argv[1] substring = sys.argv[2] except IndexError: string = None substring = None try: sys.argv[3] except IndexError: pass else: print(" More than expected Number of Arguments") string = None su...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search(self, *args, **kwargs):", "def search(self, *args, **kwargs): # real signature unknown\n pass", "def search():\n pass", "def _processArgsToLogic_search(args, stdout, stderr) :\n\n if args.forceDownload :\n args.download = True\n # Initiliaze action flags\n args.actionFlag...
[ "0.82235056", "0.7940697", "0.7333606", "0.71696407", "0.69658285", "0.68828195", "0.6845856", "0.6817347", "0.6728852", "0.667633", "0.6644063", "0.6619193", "0.6605867", "0.6574141", "0.656597", "0.65625703", "0.65579206", "0.65326357", "0.636116", "0.6324944", "0.6296517",...
0.0
-1
Return ratio of cpu_dt / gpu_dt, which must be nonnegative numbers. If both arguments are zero, return NaN. If only gpu_dt is zero, return Inf.
def advantage(cpu_dt, gpu_dt): assert gpu_dt >= 0 and cpu_dt >= 0 if gpu_dt == 0 and cpu_dt == 0: return numpy.nan elif gpu_dt == 0: return numpy.inf else: return cpu_dt / gpu_dt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def advantage(cpu_dt, gpu_dt):\r\n assert gpu_dt >= 0 and cpu_dt >= 0\r\n if gpu_dt == 0 and cpu_dt == 0:\r\n return numpy.nan\r\n elif gpu_dt == 0:\r\n return numpy.inf\r\n else:\r\n return cpu_dt / gpu_dt", "def _get_cpu_percent(self):\n cpu_delta = None\n total_d...
[ "0.8289752", "0.57311285", "0.56998044", "0.5637458", "0.56284297", "0.56284297", "0.56284297", "0.5575685", "0.5518271", "0.5502139", "0.54596716", "0.5448909", "0.54423946", "0.53975004", "0.5327086", "0.5315263", "0.5311589", "0.5273094", "0.52623266", "0.5258038", "0.5258...
0.8366045
0
The fct k_elemwise_unary_rowmajor_copy(used by cuda.copy()) in cuda_ndarray.cu is not well compiled with nvcc 3.0 and 3.1 beta. We found a workaround, so it sould work correctly. Without the workaround, this test fail.
def test_nvcc_bug(): shape = (5, 4) aa = theano._asarray(numpy.random.rand(*shape), dtype='float32') a = aa[::, ::-1] b = cuda_ndarray.CudaNdarray(aa)[::, ::-1] c = copy.copy(b) d = copy.deepcopy(b) assert numpy.allclose(a, numpy.asarray(b)) assert numpy.allclose(a, numpy.asarray(c)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_nvcc_bug():\r\n shape = (5, 4)\r\n aa = theano._asarray(numpy.random.rand(*shape), dtype='float32')\r\n a = aa[::, ::-1]\r\n\r\n b = cuda_ndarray.CudaNdarray(aa)[::, ::-1]\r\n c = copy.copy(b)\r\n d = copy.deepcopy(b)\r\n\r\n assert numpy.allclose(a, numpy.asarray(b))\r\n assert nu...
[ "0.72793794", "0.6675478", "0.6635744", "0.6531311", "0.641663", "0.6413818", "0.63276094", "0.6325242", "0.63044846", "0.6269978", "0.6264248", "0.6245012", "0.6241492", "0.61380696", "0.6119953", "0.6025284", "0.5999566", "0.59449136", "0.58952457", "0.5869716", "0.58495384...
0.72629005
1
Now we don't automatically add dimensions to broadcast
def test_setitem_rightvalue_ndarray_fails(): a = numpy.arange(3 * 4 * 5) a.resize((3, 4, 5)) a = theano._asarray(a, dtype='float32') _a = cuda_ndarray.CudaNdarray(a) b = theano._asarray([7, 8, 9, 10], dtype='float32') _b = cuda_ndarray.CudaNdarray(b) b5 = theano._asarray([7, 8, 9, 10, 11], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_broadcast_dims():\r\n test((1, 2, 3))\r\n test((2, 1, 3))\r\n test((2, 3, 1))\r\n test2((1, 2, 3))\r\n test2((2, 1, 3))\r\n test2((2, 3, 1))", "def broadcast() -> BroadcastDistribute:\n return _broadcast", "def test_unbroadcast_addbroadcast(self):\r\n\r\n x = matrix()\r\n ...
[ "0.7132095", "0.65440637", "0.6465861", "0.64307284", "0.6218499", "0.60986507", "0.60443056", "0.60276175", "0.60101485", "0.59697133", "0.59408414", "0.5924509", "0.59179515", "0.5914455", "0.5913395", "0.58950126", "0.5822593", "0.5822593", "0.5752906", "0.57098573", "0.57...
0.0
-1
Runs the main loop of GA.
def mainGA(NAME, target_output, target_image): global toolbox print("Target image: {0} Target output: {1}".format(target_image, target_output)) sys.stdout.flush() model = load_model(NAME) fit = Fitness(NAME, model, target_image, target_output) #Genetic operators toolbox.register...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n GLib.MainLoop().run()", "def run():\n main()", "async def _main(self):\n while True:\n time.sleep(1)", "def run():\n\n # Set up environment and agent\n e = Environment() # create environment (also adds some dummy traffic)\n a = e.create_agent(LearningAge...
[ "0.71880895", "0.697151", "0.68249995", "0.6757761", "0.6749307", "0.67318606", "0.67318606", "0.6720229", "0.670469", "0.66957825", "0.66361976", "0.6631058", "0.662005", "0.65912545", "0.65658116", "0.65643406", "0.6554115", "0.6528591", "0.6504754", "0.6492748", "0.6475534...
0.0
-1
This AWS Lambda function is invoked manually or by some other service or APIs. Then this function puts an event to an Amazon EventBridge.
def lambda_handler(event, context): client = boto3.client('events') event_to_put = { "source": "aws-lambda-function" } event_to_put.update(**event) try: response = client.put_events( Entries=[ { 'Source': 'learn.eventbridge', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_event(event: dict):\n\n eventbridge.put_events(Entries=[event])", "def event(event, context):\n# Sample event:\n #\n # _event = { \"Records\":[\n # {\n # \"eventVersion\":\"2.1\",\n # \"eventSource\":\"aws:s3\",\n # \"awsRegion\":\"us-east-1\",\n ...
[ "0.68858373", "0.6696065", "0.66646093", "0.66366494", "0.6604961", "0.6559077", "0.6559077", "0.6540618", "0.6514244", "0.65035176", "0.64954466", "0.64871466", "0.64862555", "0.6477732", "0.6477732", "0.6477732", "0.6477732", "0.6477732", "0.6477732", "0.6477732", "0.647773...
0.7800985
0
Correlate each feature in X, with y (some set of dummmy coded labels).
def correlateX(X, y, corr="spearman"): X = np.array(X) y = np.array(y) ## Force... just in case checkX(X) if corr == "pearson": corrf = pearsonr elif corr == "spearman": corrf = spearmanr else: raise ValueError("stat was not valid.") corrs = []...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _c_correlation(cls, X, y):\n su = np.zeros(X.shape[1])\n for i in np.arange(X.shape[1]):\n su[i] = cls._symmetrical_uncertainty(X[:, i], y)\n return su", "def categorical_correlation(\n feature, target, dataframe, groupfunc, x_label=None, y_label=None\n):\n # Group the d...
[ "0.6572823", "0.6219852", "0.59368616", "0.59086794", "0.5891101", "0.5826224", "0.58046436", "0.57727814", "0.57616276", "0.5715039", "0.57040733", "0.567008", "0.5661006", "0.56605536", "0.5588689", "0.5544566", "0.5544468", "0.543654", "0.54303247", "0.5425722", "0.540244"...
0.6124404
2
Create a desgin matrix from y, an array of integers.
def _create_dm(y, window): pad = np.zeros(window, dtype=np.int) y = np.concatenate([y, pad]) unique_y = np.unique(y)[np.unique(y) != 0] dm = np.zeros((y.shape[0], window * unique_y.shape[0]), dtype=np.int) for t in unique_y: idx_h_a = np.arange(unique_y.shape[0])[unique_y == t] * window ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_matrix(self, y):\n if hasattr(y, \"shape\"):\n if len(y.shape) == 1:\n if isinstance(y, (pd.Series, pd.DataFrame)):\n y = y.to_numpy()\n y = y.reshape([-1, 1])\n else:\n y = np.array(y).reshape([-1, 1])\n\n return y...
[ "0.6806305", "0.63377404", "0.62698895", "0.61298615", "0.6084778", "0.60796237", "0.60313547", "0.5960779", "0.5950431", "0.5856467", "0.58421", "0.58394974", "0.5760737", "0.5756875", "0.575276", "0.5740138", "0.5682571", "0.5678343", "0.5664396", "0.565078", "0.5645922", ...
0.55213827
27
Average trials for each feature in X, using Burock's (2000) method.
def fir(X, y, trial_index, window, tr): # Norm then pad. scaler = MinMaxScaler(feature_range=(0, 1)) X = scaler.fit_transform(X.astype(np.float)) X = np.vstack([X, np.ones((window, X.shape[1]), dtype=np.float)]) # Save the org y names ynames = sorted(np.unique(y)) ynames = unique_sorted_wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def score_samples(self, X):\n ...", "def calculate_average_precision(class_name='', current_neuron_index=current_neuron_index, acts=acts,\n no_files_in_label=no_files_in_label, verbose=verbose, minx='',Q_stop=''):\n #\n current_neuron = acts.get_activations_for_neuron(...
[ "0.6152321", "0.60114884", "0.6004951", "0.59376615", "0.5898992", "0.5895975", "0.5889211", "0.5870478", "0.58671063", "0.58182806", "0.58060247", "0.57809657", "0.57648313", "0.57583666", "0.5748872", "0.574189", "0.57366794", "0.5733893", "0.572314", "0.57068515", "0.56871...
0.0
-1
Average trials for each feature in X
def eva(X, y, trial_index, window, tr): evas = [] eva_names = [] scaler = MinMaxScaler(feature_range=(0, 1)) for j in range(X.shape[1]): Xtrials = [] xj = X[:,j][:,np.newaxis] ## Need 2D # Each feature into trials, rescale too Xtrial, feature_names = by_trial(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_average(X):\n\t# compute average row vector\n\tmean_vector = np.mean(X, axis = 0)\n\treturn(mean_vector)", "def calculate_mean_average_precision(class_name='', current_neuron_index=current_neuron_index, acts=acts, verbose=verbose, minx=0.000000001):\n #\n current_neuron = acts.get_activations_for...
[ "0.64128476", "0.6214273", "0.61815697", "0.6136997", "0.60902673", "0.6084845", "0.595498", "0.5950753", "0.5950473", "0.5936966", "0.59339607", "0.593313", "0.5920305", "0.5912948", "0.59116477", "0.5895597", "0.58873343", "0.58857715", "0.5872557", "0.5864992", "0.5842531"...
0.5755531
33
Calculate band according to Stavenga et al (1993).
def stavenga1993_band_calculation( x: np.ndarray, a: Union[float, np.ndarray], b: Union[float, np.ndarray] ) -> np.ndarray: return np.exp(-a * x**2 * (1 + b * x + 3 / 8 * (b * x) ** 2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_band(value, bands):\n for band in bands:\n if band > value:\n return band", "def bands(self) -> int:\n ...", "def calbands( band = 0, tmo = 30 ) :\n optimizeThresholds(band,tmo)\n flattenPhases(band,tmo)\n calibrateSpectra(band=band,tmo=tmo)", "def DrawBands...
[ "0.6755474", "0.6549916", "0.6544884", "0.62848055", "0.6246133", "0.62358135", "0.62323934", "0.61631835", "0.61161864", "0.6114344", "0.608871", "0.60167605", "0.60042655", "0.5974235", "0.5936892", "0.5935502", "0.5911872", "0.5887876", "0.585313", "0.58207893", "0.5817405...
0.71052694
0
Create Gaussian filter template normalized to the max.
def gaussian_template( wavelengths: np.ndarray, mean: Union[float, np.ndarray], std: Union[float, np.ndarray] = 30.0, ) -> np.ndarray: y = norm.pdf(wavelengths, mean, std) return y / np.max(y, axis=-1, keepdims=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gaussian_filter(size, sigma):\n h = size[0] #height of the template\n w = size[1] #width of the template \n if h % 2 == 0: h += 1 #add 1 if dimensions are even\n if w % 2 == 0: w += 1\n x = math.floor(h/2)\n y = math.floor(w/2) \n sum = 0\n #create ou...
[ "0.7409861", "0.68018997", "0.67854315", "0.65037984", "0.6479504", "0.63791597", "0.6300146", "0.62202877", "0.6173434", "0.6151084", "0.61396915", "0.61290395", "0.61198384", "0.60909826", "0.6076701", "0.6069273", "0.6066046", "0.6016382", "0.59799224", "0.5979191", "0.597...
0.6193196
8
Calculate opsin template according to Stavenga et al (1993).
def stavenga1993_template( wavelengths: np.ndarray, alpha_max: Union[float, np.ndarray], a_alpha: Union[float, np.ndarray] = 380.0, b_alpha: Union[float, np.ndarray] = 6.09, beta_max: Union[float, np.ndarray] = 350.0, A_beta: Union[float, np.ndarray] = 0.29, a_beta: Union[float, np.ndarray] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def produce_13TeV_template(tag_name=\"HKHI\"):\n num_rebin = 1\n file_name = \"inputs/BkgEstimation_Lin/BkgEstimation_NONE_TOPO_PTDEP_\"+tag_name+\"_Lin.root\"\n print \"Input: \", file_name\n fin = ROOT.TFile.Open(file_name, \"read\")\n h_nom = fin.Get(\"bkg_total_gg_full\").Clone(\"bkg_nominal_old...
[ "0.63073283", "0.56289643", "0.5594479", "0.5521098", "0.54792696", "0.54278696", "0.53754073", "0.5372962", "0.5349426", "0.53242576", "0.52706194", "0.52683187", "0.5263925", "0.52538013", "0.52045524", "0.516755", "0.5156881", "0.51513654", "0.5134924", "0.5134404", "0.513...
0.0
-1
Calculate Opsin template according to Govardovskii et al (2000).
def govardovskii2000_template( wavelengths: np.ndarray, alpha_max: Union[float, np.ndarray], A_alpha: Union[float, np.ndarray] = 69.7, a_alpha1: Union[float, np.ndarray] = 0.8795, a_alpha2: Union[float, np.ndarray] = 0.0459, a_alpha3: Union[float, np.ndarray] = 300.0, a_alpha4: Union[float, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def produce_13TeV_template(tag_name=\"HKHI\"):\n num_rebin = 1\n file_name = \"inputs/BkgEstimation_Lin/BkgEstimation_NONE_TOPO_PTDEP_\"+tag_name+\"_Lin.root\"\n print \"Input: \", file_name\n fin = ROOT.TFile.Open(file_name, \"read\")\n h_nom = fin.Get(\"bkg_total_gg_full\").Clone(\"bkg_nominal_old...
[ "0.61078596", "0.5807358", "0.565082", "0.5624882", "0.5605698", "0.5569253", "0.5561828", "0.5541212", "0.5455167", "0.54004294", "0.53838813", "0.5322327", "0.53214216", "0.531339", "0.52193123", "0.5200469", "0.5189568", "0.5186714", "0.5178152", "0.5171504", "0.51658136",...
0.0
-1
Set up private and public key into DiffieHellman object.
def setup_keys(self, dh_object, public_key, private_key): public_numbers = DHPublicNumbers(public_key, dh_object.parameter_numbers) private_numbers = DHPrivateNumbers(private_key, public_numbers) dh_object.private_key = private_numbers.private_key(default_backend())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._keypair = RSA.generate(2048)\n self.public_key = self._keypair.publickey().exportKey()", "def setUp(self):\n\n self.private_key = self.get_new_key()\n self.public_key = self.private_key.public_key()\n\n self.pem_private_key = self.private_key.private...
[ "0.6717525", "0.6687376", "0.6348768", "0.6244429", "0.61797005", "0.6172647", "0.604477", "0.59947807", "0.59289205", "0.59186375", "0.59086144", "0.5873395", "0.5848099", "0.5782095", "0.5766761", "0.5744683", "0.5743434", "0.5717811", "0.5714252", "0.56985873", "0.5693162"...
0.7158014
0