query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Create and return a character dictionary with required info | def create_character_dict(character):
characterDict = {}
characterDict["FullName"] = str(character[0])
characterDict["House"] = str(character[1])
characterDict["Origin"] = str(character[2])
characterDict["Culture"] = str(character[3])
characterDict["Religion"] = [x.strip() for x in str(character... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dictionary():\n chars = sorted(ch for ch in string.printable if ch not in (\"\\x0b\", \"\\x0c\", \"\\r\"))\n char2id = dict((ch, i + 1) for i, ch in enumerate(chars))\n char2id.update({\"\": 0})\n id2char = dict((char2id[ch], ch) for ch in char2id)\n vocab_size = len(char2id)\n id2char... | [
"0.7102151",
"0.69187117",
"0.69107294",
"0.68211824",
"0.6746596",
"0.6741283",
"0.6690397",
"0.668705",
"0.66112554",
"0.65226847",
"0.6409016",
"0.61329436",
"0.61255807",
"0.60977304",
"0.6067591",
"0.600179",
"0.59963685",
"0.599442",
"0.5989454",
"0.5949057",
"0.5935389... | 0.7190327 | 0 |
Get latest close price | def latest_close(df):
return df['close'].iloc[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getClosingPrice(self):\t\n\t\treturn self.dataPoints[-1].getDate(), self.dataPoints[-1].getAdjustedValue()",
"def get_last_close(self, symbol):\n if symbol in self.symbol:\n close_price = self.symbol[symbol][\"close\"]\n return close_price\n else:\n print(\n ... | [
"0.7677867",
"0.748153",
"0.7319595",
"0.73104125",
"0.7153184",
"0.70935863",
"0.7019439",
"0.69920504",
"0.69562435",
"0.6892129",
"0.6889681",
"0.6887791",
"0.6857152",
"0.6783069",
"0.67515796",
"0.6690096",
"0.66812325",
"0.6654459",
"0.6648873",
"0.664618",
"0.66026545"... | 0.7564209 | 1 |
Calc average volume for certain days | def mean_vol(df):
return df.tail(5)['volume'].mean(), df.tail(20)['volume'].mean() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aveVolumeCalc(ins, date):\n cal = ins.Currency().Calendar()\n enddate = cal.AdjustBankingDays(date, 0)\n startdate = cal.AdjustBankingDays(date, AVERAGING_PERIOD)\n\n prices=[]\n histprices = acm.FPrice.Select(\"instrument = %s and market = '%s' \\\n and day > '%s' and day... | [
"0.70382154",
"0.66602015",
"0.6620442",
"0.6614305",
"0.6424868",
"0.63720316",
"0.630501",
"0.6283987",
"0.62479305",
"0.61802137",
"0.6177612",
"0.6174427",
"0.61614573",
"0.60009813",
"0.5981109",
"0.59737",
"0.5948696",
"0.59486914",
"0.5938456",
"0.5915193",
"0.591159",... | 0.6701274 | 1 |
Generate stat data for estimate open to close move from yesterday close to today open and for today open to today close | def open_to_close_move(df):
df_temp = df.copy()
df_temp['close_open'] = 1 - df['close'].shift(1) / df['open']
df_temp['open_close'] = 1 - df['open'] / df['close']
df_temp['oc_diff'] = df_temp['open_close'] - df_temp['close_open']
# print pd.cut(df_temp['close_open'], 10)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_to_open_move(df):\n df1 = df.copy()\n\n df1['c2o$'] = df1['open'] - df1['close'].shift(1) # after market\n df1['c2o%'] = df1['c2o$'] / df1['close'].shift(1) # after market\n df1['o2c$'] = df1['close'] - df1['open']\n df1['o2c%'] = df1['o2c$'] / df1['open']\n\n ... | [
"0.617544",
"0.6034194",
"0.55702597",
"0.5554707",
"0.55403155",
"0.5464802",
"0.54282475",
"0.53914773",
"0.53688973",
"0.53677815",
"0.53527915",
"0.53194803",
"0.53027546",
"0.528587",
"0.5283911",
"0.5256884",
"0.52214307",
"0.51381063",
"0.5126753",
"0.5120959",
"0.5116... | 0.62363344 | 0 |
Generate std data for everyday return for estimate today probability pct_change within std or out of std | def std_close(df):
df_temp = df.copy()
df_temp['close_chg'] = df_temp['close'] - df_temp['close'].shift(1)
df_temp['pct_chg'] = df_temp['close'].pct_change()
df_last = df_temp[-60:]
std = round(df_last['pct_chg'].std(), 4)
df_last['above_std'] = df_last['pct_chg'] >= std... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def portfolio_std(weights, test_data):\n\n # computes daily change in returns from 2015-2017\n daily_ret_delta = test_data.pct_change()\n\n # computes the covariance matrix of the above\n cov_matrix = daily_ret_delta.cov()\n\n # initializes weights\n weights_list = []\n\n # iterates over weigh... | [
"0.6320671",
"0.62334234",
"0.6185714",
"0.61374724",
"0.6129272",
"0.6119729",
"0.6071722",
"0.6043714",
"0.6043714",
"0.6020413",
"0.6009936",
"0.59783626",
"0.59685814",
"0.59641707",
"0.59597296",
"0.594335",
"0.59301627",
"0.5927855",
"0.5900694",
"0.58967495",
"0.584623... | 0.63810796 | 0 |
Save an XML object to the report file in the test's work dir. | def _create_xml_report(self, test, xml_obj):
xml_report_path = os.path.join(test.work_dir,
self.XML_REPORT_PATH)
with open(xml_report_path, 'w') as xml_report:
xml_report.write(etree.tostring(xml_obj, pretty_print=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveToXml(self) -> org.jdom.Element:\n ...",
"def save(self, save_path=None):\n if self._xml is None:\n raise IOError(\"There's nothing to save\")\n\n path = self._path_to_xml if save_path is None else save_path\n\n with open(path, 'w') as f:\n rough_string =... | [
"0.6701875",
"0.6698192",
"0.6549589",
"0.64869165",
"0.6481648",
"0.63985515",
"0.60724485",
"0.6054976",
"0.6044329",
"0.6004485",
"0.598313",
"0.59819037",
"0.5944107",
"0.5916538",
"0.5906194",
"0.5871624",
"0.58549803",
"0.5825118",
"0.5807813",
"0.5783819",
"0.5760489",... | 0.77136934 | 0 |
Read file ip proxies | def read_proxies_file(file_name):
lst_prox = []
for ii in open(file_name, 'r').readlines():
# lst_prox.append('https://kimnt93:147828@' + ii.strip())
a = {
'proxy_host': ii.split(":")[0],
'proxy_port': ii.split(":")[-1].strip(),
'proxy_user': 'kimnt93',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_proxies(filePath):\n openfile = open(filePath, 'r')\n t = openfile.read().split('\\n')\n t = [i.replace('\\r','') for i in t] # Get rid of formatting characters\n # Last element is just an empty string, so remove that\n return t[0:len(t)-1]",
"def read_ip(ip_file):\n with open(ip_file, ... | [
"0.6837967",
"0.64355475",
"0.6343858",
"0.6293375",
"0.5962575",
"0.5935494",
"0.58600575",
"0.583917",
"0.58100307",
"0.578705",
"0.5783379",
"0.57452863",
"0.56598884",
"0.5619596",
"0.5608668",
"0.56063044",
"0.55869853",
"0.55696946",
"0.5545527",
"0.5530716",
"0.5525514... | 0.7938 | 0 |
Get all new keyword in current page then save them | def get_new_keywords(self, web_driver, goto):
# while requests.get(goto).status_code > 499:
# print(requests.get(goto).status_code)
# web_driver.quit()
# web_driver = self.create_driver(random.choices(self.proxies, k=2), login=False, adsblock=False)
web_driver.get(go... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self):\n lang = self.languageCombo.currentText()\n kwSet = self.setSpinBox.value()\n self.__keywords[lang][\"Sets\"][kwSet] = self.keywordsEdit.toPlainText()\n \n for lang, keywords in self.__keywords.items():\n Preferences.setEditorKeywords(lang, keywords[\"S... | [
"0.6444647",
"0.6137049",
"0.5928518",
"0.56891054",
"0.566288",
"0.56585616",
"0.5484581",
"0.54574686",
"0.5455011",
"0.5436555",
"0.540915",
"0.539026",
"0.53861743",
"0.53618073",
"0.534783",
"0.53415316",
"0.5321308",
"0.5302369",
"0.5284909",
"0.5284868",
"0.52763075",
... | 0.6535845 | 0 |
permet de rentrer les valeurs donner par la fonction get_next_alea_tiles | def put_next_tiles(p,tiles):
if tiles['mode'].upper() == "INIT":
set_value(p,tiles['0']['lig'],tiles['0']['col'],tiles['0']['val']) # mettre la vleur dans le plateau avec la position donnee de tiles
set_value(p,tiles['1']['lig'],tiles['1']['col'],tiles['1']['val'])
else:
set_value(p,tile... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_next_alea_tiles(plateau, mode):\n from random import randint\n # si le saisie et condition de plateau sont valide\n if mode.upper() == \"INIT\" and get_nb_empty_room(plateau) >= 2 or mode.upper() == \"ENCOURS\" and get_nb_empty_room(plateau) >= 1:\n if mode.upper() == \"INIT\":\n ... | [
"0.61450976",
"0.5716516",
"0.57075524",
"0.56994516",
"0.5440548",
"0.5423626",
"0.5414412",
"0.53983825",
"0.53790134",
"0.53702354",
"0.5350864",
"0.5348182",
"0.5343083",
"0.52942365",
"0.5273575",
"0.52685905",
"0.52685565",
"0.52269155",
"0.52265996",
"0.5218582",
"0.52... | 0.6838531 | 0 |
save `result` as a pickle file to `path` | def save_as_pickle(path: str, result: Any):
make_dirs_for_file(path)
with open(path, 'wb') as f:
pickle.dump(result, f)
if not config.silent:
logger.info(f'Save {path}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_pkl(self, path):\n with open(path, 'wb') as f:\n pkl.dump([self.raw_result, self.skipped_gts, self.skipped_dets], f, protocol=-1)",
"def save(self):\n pickle_save(self.results, 'results', self.main_dir)",
"def save_results(results, results_file: str):\n with open(results... | [
"0.74244875",
"0.71125144",
"0.70853543",
"0.70399654",
"0.7036135",
"0.7029664",
"0.7023948",
"0.6983472",
"0.6983472",
"0.6974177",
"0.6956048",
"0.6931828",
"0.68421876",
"0.6808235",
"0.6753463",
"0.6713725",
"0.6660704",
"0.66359",
"0.653751",
"0.64761746",
"0.6472137",
... | 0.87544113 | 0 |
This method is deprecated. Please switch to AddPayload. | def InvocationAddPayload(builder, payload):
return AddPayload(builder, payload) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_payload(self, payload: Payload) -> Payload:\n ...",
"def payload(self, payload: \"dict\"):\n self._attrs[\"payload\"] = payload",
"def payload(self, payload):\n\n self._payload = payload",
"def payload(self):",
"def set_payload(self, payload):\n self.payload = json.du... | [
"0.7276928",
"0.6467799",
"0.6387171",
"0.6324627",
"0.627483",
"0.6244515",
"0.6162478",
"0.6088767",
"0.605973",
"0.59209675",
"0.5827857",
"0.5806684",
"0.5797318",
"0.578631",
"0.57761383",
"0.57664335",
"0.5753044",
"0.57519054",
"0.573693",
"0.5730827",
"0.5717257",
"... | 0.6579502 | 1 |
This method is deprecated. Please switch to AddEncAlgo. | def InvocationAddEncAlgo(builder, encAlgo):
return AddEncAlgo(builder, encAlgo) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _applyCipher(self, encode):\n pass",
"def _define_encoder(self):\n raise NotImplementedError",
"def _disabled_encrypt(self, *args, **kwargs):\n raise NotImplementedError('\"encrypt\" is not supported by the \"{}\" algorithm'.format(self.java_name))",
"def encodeVigenere(self, key):\n\n ... | [
"0.6037519",
"0.57418525",
"0.57207483",
"0.55389726",
"0.54600817",
"0.54547966",
"0.5428983",
"0.5360626",
"0.5310754",
"0.52639735",
"0.5218609",
"0.5192609",
"0.5185205",
"0.5173978",
"0.51600724",
"0.5150305",
"0.5143862",
"0.5109846",
"0.5109846",
"0.5074217",
"0.504212... | 0.6684856 | 0 |
This method is deprecated. Please switch to AddEncKey. | def InvocationAddEncKey(builder, encKey):
return AddEncKey(builder, encKey) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_encryption(key):\n global_scope['enc'] = Encryption(key.encode())",
"def aes_key_wrap(self, kek: bytes, key_to_wrap: bytes) -> bytes:\n return keywrap.aes_key_wrap(kek, key_to_wrap, default_backend())",
"def _encrypt_aes_key(aes_key: bytes, receiver_public_key: RsaKey) -> bytes:\n cipher_r... | [
"0.6105186",
"0.60651547",
"0.5975493",
"0.5885873",
"0.5863659",
"0.585313",
"0.57608104",
"0.57403666",
"0.56884587",
"0.5685395",
"0.5671908",
"0.56714296",
"0.56714296",
"0.5663349",
"0.56454265",
"0.56327134",
"0.5627396",
"0.56247646",
"0.55570334",
"0.552872",
"0.55285... | 0.6506183 | 0 |
This method is deprecated. Please switch to AddProcedure. | def InvocationAddProcedure(builder, procedure):
return AddProcedure(builder, procedure) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def callproc(self):\n raise NotSupportedError(\"Drill does not support stored procedures\")",
"def start_procedure(self):\n pass",
"def procedure(self):\n return self.__procedure",
"def append_procedures(self, procedures):\n assert(isinstance(procedures, list))\n self.__pro... | [
"0.67979",
"0.6538745",
"0.60263383",
"0.59137857",
"0.58902866",
"0.57210046",
"0.56140167",
"0.5509939",
"0.5292281",
"0.5284939",
"0.5182611",
"0.51818883",
"0.5169962",
"0.5029956",
"0.5010468",
"0.5005772",
"0.49962625",
"0.49687",
"0.49200478",
"0.49151006",
"0.4876814"... | 0.6738193 | 1 |
This method is deprecated. Please switch to AddReceiveProgress. | def InvocationAddReceiveProgress(builder, receiveProgress):
return AddReceiveProgress(builder, receiveProgress) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receiveBroadcastOfDownloadProgress(self, messagesProcessed):\n self.emit(SIGNAL('updateProgressBar(PyQt_PyObject)'), messagesProcessed)",
"def transfer_progress(self, stats):",
"def notify_progress(self, progress_data):\n pass # pragma: no cover",
"def reportProgress(self):\n \n ... | [
"0.62726647",
"0.62274617",
"0.5967287",
"0.5880483",
"0.5809831",
"0.57195956",
"0.57142454",
"0.5623886",
"0.5610447",
"0.5610447",
"0.56027406",
"0.55451",
"0.5427968",
"0.53374374",
"0.53304625",
"0.53023094",
"0.52943885",
"0.52904177",
"0.52903557",
"0.52694607",
"0.526... | 0.7053311 | 0 |
This method is deprecated. Please switch to AddTransactionHash. | def InvocationAddTransactionHash(builder, transactionHash):
return AddTransactionHash(builder, transactionHash) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_transaction(self, hash_bytes: bytes) -> BaseTransaction:\n raise NotImplementedError",
"def add(self, transaction):\n if isinstance(transaction, Transaction):\n # If the transaction already exists\n if(transaction.hash in self.transaction_index):\n prin... | [
"0.6182072",
"0.579372",
"0.5721112",
"0.558423",
"0.5571764",
"0.55593735",
"0.5263189",
"0.5209264",
"0.51997334",
"0.51828766",
"0.5170547",
"0.51660454",
"0.5164888",
"0.5162962",
"0.51499283",
"0.5144493",
"0.5057982",
"0.5040041",
"0.50295126",
"0.4994764",
"0.4970582",... | 0.6741723 | 0 |
This method is deprecated. Please switch to AddCaller. | def InvocationAddCaller(builder, caller):
return AddCaller(builder, caller) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def caller(self, caller):\n\n self._caller = caller",
"def callee(calls):\n calls.append(1)",
"def __call__(self, *args, **kwargs):\n self._Deprecator__warn()\n return self._Deprecator__todeprecate(*args, **kwargs)",
"def call(self):",
"def user_call(self, frame, argument_li... | [
"0.6528352",
"0.571893",
"0.56392395",
"0.5634783",
"0.56314534",
"0.55950105",
"0.55950105",
"0.553705",
"0.55167943",
"0.5463021",
"0.5420897",
"0.54187113",
"0.5411641",
"0.5407335",
"0.5407335",
"0.5407335",
"0.5407335",
"0.5407335",
"0.54052085",
"0.5397888",
"0.5397888"... | 0.6766164 | 0 |
This method is deprecated. Please switch to AddCallerAuthid. | def InvocationAddCallerAuthid(builder, callerAuthid):
return AddCallerAuthid(builder, callerAuthid) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addCallerIDAuthentication(self, voip_username, caller_id):\n self.__addCallerIDAuthenticationCheckInput(voip_username, caller_id)\n loaded_user=user_main.getUserPool().getUserByVoIPUsername(voip_username)\n if loaded_user.userHasAttr(\"caller_id\"):\n caller_ids=loaded_user.getU... | [
"0.6373267",
"0.58595365",
"0.5481692",
"0.5416397",
"0.5313911",
"0.52810615",
"0.52722436",
"0.5248987",
"0.5224012",
"0.5196706",
"0.5180599",
"0.5133499",
"0.5125191",
"0.49767923",
"0.49682376",
"0.4944261",
"0.48965797",
"0.48825708",
"0.48655698",
"0.48448443",
"0.4805... | 0.71681356 | 0 |
This method is deprecated. Please switch to AddCallerAuthrole. | def InvocationAddCallerAuthrole(builder, callerAuthrole):
return AddCallerAuthrole(builder, callerAuthrole) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def InvocationAddCallerAuthid(builder, callerAuthid):\n return AddCallerAuthid(builder, callerAuthid)",
"def _check_caller_authority(caller, role):\r\n if not (caller.is_authenticated() and caller.is_active):\r\n raise PermissionDenied\r\n # superuser\r\n if GlobalStaff().has_user(caller):\r\n... | [
"0.6164065",
"0.59018856",
"0.5193987",
"0.5176978",
"0.51576316",
"0.51549685",
"0.51242304",
"0.51111686",
"0.50729793",
"0.50549215",
"0.4945589",
"0.4943418",
"0.49415055",
"0.4922211",
"0.49215338",
"0.4915264",
"0.48860142",
"0.48680505",
"0.48617655",
"0.4850307",
"0.4... | 0.74832124 | 0 |
Returns drift part of operator collection. | def drift(self) -> Array:
return self._drift | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opschrift(self):\n return self._opschrift.get_waarde()",
"def time_slice(self):\n return self._time_slice",
"def exposuretime(self):\n _, = self.exposuretimes\n return _",
"def getLatestTriStimulusMeasurements(self): \n return self.tristimulus[len(self.tristimulus)-1]",
... | [
"0.56267965",
"0.5447225",
"0.5443726",
"0.5426616",
"0.53221864",
"0.5316858",
"0.5269261",
"0.5267263",
"0.52160937",
"0.5212362",
"0.52002513",
"0.52000004",
"0.5188197",
"0.51810086",
"0.51806635",
"0.5169509",
"0.51448566",
"0.5130017",
"0.51064724",
"0.51048577",
"0.510... | 0.6255158 | 0 |
Returns number of operators the collection is storing. | def num_operators(self) -> int:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_number_operators(self) -> int:\n if self.sons:\n return 1 + sum([son.get_number_operators() for son in self.sons])\n return 0",
"def get_num_applies(self):\n ops = 0\n for _, remainder, _ in self:\n ops += len(remainder)\n return ops",
"def num_o... | [
"0.7395461",
"0.71047944",
"0.7014187",
"0.694882",
"0.6826232",
"0.67552155",
"0.6663144",
"0.66100526",
"0.65686446",
"0.652772",
"0.652772",
"0.6466773",
"0.6457744",
"0.63046545",
"0.6273709",
"0.6273709",
"0.6249401",
"0.62279934",
"0.6209483",
"0.61990255",
"0.6141355",... | 0.8079969 | 0 |
Sends a (k,n,n) Array y of density matrices to a (k,1) Array of dtype object, where entry [j,0] is y[j]. Formally avoids For loops through vectorization. | def package_density_matrices(y: Array) -> Array:
# As written here, only works for (n,n) Arrays
obj_arr = np.empty(shape=(1), dtype="O")
obj_arr[0] = y
return obj_arr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unpackage_density_matrices(y: Array) -> Array:\n return y[0]",
"def get_density(xs, ys, mu, sigma, DIMENSION=2):\n return np.array([[kde(np.array([x,y]), mu, sigma, DIMENSION) for x in xs] for y in ys])",
"def kde_2d_multiple_times(plume_x, plume_y, X, Y):\n Z = []\n positions = np.vstack([X.ra... | [
"0.68365365",
"0.5695859",
"0.54675144",
"0.54338664",
"0.5346529",
"0.52783304",
"0.51943886",
"0.5128729",
"0.5068095",
"0.503721",
"0.50343156",
"0.501111",
"0.49645087",
"0.49603656",
"0.4957421",
"0.49461776",
"0.49433666",
"0.49183524",
"0.49183524",
"0.49163124",
"0.49... | 0.79321015 | 0 |
Inverse function of package_density_matrices, Much slower than packaging. Avoid using unless absolutely needed (as in case of passing multiple density matrices to SparseLindbladCollection.evaluate_rhs). | def unpackage_density_matrices(y: Array) -> Array:
return y[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse(self):\n if not self.is_square():\n raise(ValueError, \"Non-square Matrix does not have an inverse.\")\n if self.h > 2:\n raise(NotImplementedError, \"inversion not implemented for matrices larger than 2x2.\")\n # TODO - your code here\n inverse = []\n if self.h == 1:\n ... | [
"0.61622936",
"0.5764784",
"0.5675796",
"0.5659066",
"0.5618987",
"0.5513068",
"0.5496328",
"0.54614794",
"0.5455784",
"0.54382056",
"0.5431183",
"0.54074746",
"0.54072523",
"0.54059327",
"0.5394992",
"0.5392827",
"0.5373344",
"0.53657925",
"0.53512263",
"0.53306466",
"0.5319... | 0.5839677 | 1 |
Generate DET Curve (i.e., FNR vs FPR). It is assumed FPR and FNR is increasing and decreasing, respectfully. | def draw_det_curve(
fpr,
fnr,
ax=None,
label=None,
set_axis_log_x=True,
set_axis_log_y=False,
scale=100,
title=None,
label_x="FPR",
label_y="FNR (%)",
ticks_to_use_x=(1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e-0),
ticks_to_use_y=(0.01, 0.03, 0.05, 0.10, 0.20, 0.30, 0.40),
fonts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DETCurve(fps, fns):\n axis_min = min(fps[0], fns[-1])\n fig, ax = plt.subplots()\n plt.xlabel(\"FAR\")\n plt.ylabel(\"FRR\")\n plt.plot(fps, fns, '-|')\n plt.yscale('log')\n plt.xscale('log')\n ax.get_xaxis().set_major_formatter(\n FuncFormatter(lambda y, _: '{:.... | [
"0.6690347",
"0.5616817",
"0.55192614",
"0.5331114",
"0.5296439",
"0.52484447",
"0.521676",
"0.51973295",
"0.5178232",
"0.5090134",
"0.50808674",
"0.5068833",
"0.50388896",
"0.503108",
"0.50147516",
"0.5007092",
"0.50069547",
"0.49868703",
"0.49776554",
"0.4977612",
"0.497101... | 0.593344 | 1 |
Plot a violin plot of the distribution of the cosine similarity score of impostor pairs (different people) and genuine pair (same people) the plots are separated by ethnicitygender attribute of the first person of each pair The final plot is saved to 'save_figure_path' | def violin_plot(data, save_figure_path=None):
fontsize = 12
new_labels = ["Imposter", "Genuine"]
palette = {new_labels[0]: "orange", new_labels[1]: "lightblue"}
data["Tag"] = data["label"]
data.loc[data["label"] == 0, "Tag"] = new_labels[0]
data.loc[data["label"] == 1, "Tag"] = new_labels[1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiplot_violin_paper(df, fname, settings):\n\n # Set up the axes with gridspec\n plt.clf()\n fig = plt.figure()\n grid = plt.GridSpec(2, 4, hspace=0.2, wspace=0.2)\n ax_00 = fig.add_subplot(grid[0, 0])\n ax_01 = fig.add_subplot(grid[0, 1], sharey=ax_00)\n ax_02 = fig.add_subplot(grid[0, ... | [
"0.6542211",
"0.61199623",
"0.609782",
"0.6030252",
"0.5937403",
"0.5843274",
"0.58130014",
"0.5782504",
"0.57712305",
"0.57397234",
"0.57394034",
"0.5688773",
"0.5677451",
"0.56739014",
"0.55943656",
"0.5577104",
"0.5568763",
"0.5545875",
"0.55334693",
"0.5518416",
"0.550427... | 0.6299148 | 1 |
Plot the score distribution of the cosine similarity score of impostor pairs (different people) and Genuine pair (same people) the plots are separated by ethnicitygender attribute of the first person of each pair. Curves of different ethnicitygender attribute are distinguished by colors. The final plot is saved to 'sav... | def overlapped_score_distribution(data, log_scale=False, save_figure_path=None):
# set figure size
plt.figure(figsize=(20, 10))
# set color scheme and font size
att_to_color = {
"AM": "blue",
"AF": "orange",
"IM": "green",
"IF": "red",
"BM": "Purple",
"BF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_SOM_BI_skill(clus_num_arr, prec_arr, recall_arr, F1_arr, fig_str, show_plots):\r\n fig = plt.figure()\r\n alpha_val = 0.7\r\n #plt.title(f\"Skill score of different sets of node clusters \\n for {nodes} nodes {var_str} vs GTD\")\r\n plt.scatter(clus_num_arr, prec_arr, label = \"precision\", ma... | [
"0.59859973",
"0.5980721",
"0.5952914",
"0.5802546",
"0.5769424",
"0.5741805",
"0.572637",
"0.57075375",
"0.55987614",
"0.559165",
"0.5562628",
"0.5495083",
"0.54720646",
"0.5444087",
"0.54314315",
"0.54262733",
"0.5403299",
"0.53801006",
"0.5356816",
"0.53502905",
"0.5347959... | 0.6055334 | 0 |
Plot Detection Error Tradeoff (DET) curves. Each curve use data separated by column 'group_by' in 'data'. Each DET curve is created by varying the threshold of the cosine similarity score which locates in 'score' column of 'data'. The final plot has title 'plot_title' and is saved to 'save_figure_path' | def det_plot(data, group_by, plot_title, save_figure_path=None):
subgroups = data.groupby(group_by)
li_subgroups = subgroups.groups
fontsize = 12
fig, ax = plt.subplots(figsize=(8, 8), constrained_layout=True)
for subgroup in li_subgroups:
# for each subgroup
df_subgroup = subgroups... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _det_plot(self, det_curves):\n # figure\n p = default_figure({\n \"x_range\": (-3, 3),\n \"y_range\": (-3, 3),\n \"tools\": \"pan,wheel_zoom,box_zoom,reset\",\n \"toolbar_location\": \"right\"\n })\n\n # transforming calculated results to ... | [
"0.60643005",
"0.6035264",
"0.59248847",
"0.5827404",
"0.58239126",
"0.5822385",
"0.57898307",
"0.5776349",
"0.57604825",
"0.5759028",
"0.5754105",
"0.56955606",
"0.56945676",
"0.5670968",
"0.566598",
"0.56628656",
"0.56418395",
"0.56388783",
"0.5637846",
"0.5629827",
"0.5623... | 0.773918 | 0 |
The partition subroutine of quicksort. | def partition(in_list, l_index: int, r_index: int) -> int:
print("start partition sub-routine")
pivot = in_list[l_index] # the pivot
print(f"pivot value is: {pivot}")
i = l_index + 1 # the i-th index that separates values less than (<i) and greater (>i) of the pivot
for j in range(i,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_partition(self):\n # one swap at the end\n list = [5, 6, 7, 8, 9, 2]\n partition(list, 0, 5)\n # assert list == [2, 6, 7, 8, 9, 5] # should be improved in future",
"def quicksort(ar, istart, iend):\n\n if istart >= iend:\n return ar\n\n i = partition(ar, istart, iend)\n... | [
"0.7608109",
"0.7422642",
"0.72388333",
"0.7235689",
"0.7106752",
"0.7105613",
"0.7013253",
"0.6998576",
"0.69659114",
"0.6932583",
"0.68824553",
"0.68704414",
"0.6859662",
"0.6837286",
"0.68350625",
"0.68311703",
"0.6830766",
"0.6830041",
"0.6810624",
"0.68053865",
"0.679219... | 0.75172704 | 1 |
Plot the duration of the ops against iteration. If you are plotting data with widely different runtimes you probably want to use PlotTimes instead. For instance when readers and writers are in the same mix, the readers will go thru 100 iterations much faster than the writers. The load test tries to be smart about that ... | def PlotIterations(metadata, data):
gp = Gnuplot.Gnuplot(persist=1)
gp('set data style lines')
gp.clear()
gp.xlabel('iterations')
gp.ylabel('duration in second')
gp.title(metadata.AsTitle())
styles = {}
line_style = 1
for dataset in data:
dataset.RescaleTo(metadata.iterations)
x = numpy.aran... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_running_time():\n global counter\n counter += 1\n running_time_targeted = []\n running_time_fast_targeted = []\n \n for node_number in range(10, 1000, 10):\n synthetic_undirected_graph = make_synthetic_undirected_graph(node_number, 5)\n\n start_time = time.time()\n a... | [
"0.6804324",
"0.64600855",
"0.63697535",
"0.6254582",
"0.614016",
"0.6110765",
"0.60925066",
"0.6071546",
"0.6044263",
"0.59926647",
"0.599092",
"0.59533745",
"0.5949644",
"0.5939671",
"0.59135395",
"0.5892315",
"0.58651716",
"0.5830165",
"0.5776621",
"0.5773334",
"0.57541347... | 0.68708545 | 0 |
This adds metadata, in terms of a model, to the identity dict for use by downstream applications. | def add_metadata(self, environ, identity):
if userid:
log.debug("userid of %s" % userid)
try:
from vc.model import user
u = user.user(userid)
u.become(u.role)
except FunctionError, e:
if "model"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_metadata(self, metadata: dict) -> None:",
"def create(self, identity, data=None, record=None, **kwargs):\n record.metadata = data.get('metadata', {})",
"def _generate_model_metadata(out_file, model):\n # Define which FirstLevelModel attributes are BIDS compliant and which\n # should be bun... | [
"0.63464797",
"0.5939923",
"0.59376967",
"0.5846358",
"0.58275265",
"0.5816912",
"0.5816912",
"0.5758697",
"0.57496715",
"0.56849056",
"0.5678888",
"0.5652369",
"0.56416464",
"0.56113076",
"0.557544",
"0.556792",
"0.5545928",
"0.55428255",
"0.5523566",
"0.5512258",
"0.5492608... | 0.7456871 | 0 |
Shows the details of a single person by szemelyi_szam | def show_person(szemelyi_szam):
conn = get_db()
try:
cur = conn.cursor()
try:
# Note: don't use prefixes like "oktatas." above for tables
# within your own schema, as it ruins portability
cur.execute('SELECT nev FROM oktatas.szemelyek WHERE szemelyi_szam = :sz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_person(uuid=None, fanchart=False):\n t0 = time.time()\n uuid = request.args.get(\"uuid\", uuid)\n fanchart_shown = request.args.get(\"fanchart\", fanchart)\n dbg = request.args.get(\"debug\", None)\n u_context = UserContext(user_session, current_user, request)\n\n with PersonReaderTx(\"r... | [
"0.5747962",
"0.57131016",
"0.5615474",
"0.5597739",
"0.55048406",
"0.54735774",
"0.54262304",
"0.5408367",
"0.5362254",
"0.53189063",
"0.5309215",
"0.5280618",
"0.52733725",
"0.52661854",
"0.52470225",
"0.521682",
"0.5202063",
"0.51792806",
"0.5163384",
"0.515481",
"0.514909... | 0.69076616 | 0 |
Demonstrates handling dates from databases and formatting it according to ISO 8601 | def date_test():
conn = get_db()
try:
cur = conn.cursor()
try:
# Note: don't use prefixes like "oktatas." above for tables
# within your own schema, as it ruins portability
# http://www.oracle.com/technetwork/articles/dsl/prez-python-timesanddates-093014.html
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date(self, data):\r\n if self.datetime_formatting == 'rfc-2822':\r\n return format_date(data)\r\n\r\n return data.isoformat()",
"def _format_date(input_date, day_flag, sep_char=\"-\"):\n date_iso = input_date[6:10] + sep_char + input_date[0:2]\n if day_flag:\n dat... | [
"0.6510297",
"0.638973",
"0.6309478",
"0.6280501",
"0.62630874",
"0.62180907",
"0.61081696",
"0.60446525",
"0.60219115",
"0.6005758",
"0.5988821",
"0.5972289",
"0.59622586",
"0.59560853",
"0.59523356",
"0.5927396",
"0.58980155",
"0.5884581",
"0.5882531",
"0.58799124",
"0.5863... | 0.6470827 | 1 |
Lets you test HTTP verbs different from GET, expects and returns data in JSON format | def verb_test():
# it also shows you how to access the method used and the decoded JSON data
return jsonify(method=request.method, data=request.get_json(), url=request.url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get(self):\n return self.doRequest(self.url, method=\"GET\", body=self.input)",
"def test_two_legged_get(self):\n resp, content = self._two_legged(\"GET\")\n self.assertEqual(int(resp['status']), 200)",
"def test_get_method(self):\n self.getPage('/')\n self.assertSta... | [
"0.7386842",
"0.7203227",
"0.7170921",
"0.7162372",
"0.7118212",
"0.70815897",
"0.7051631",
"0.69784915",
"0.6888869",
"0.68721557",
"0.68026114",
"0.68026114",
"0.6785055",
"0.6744668",
"0.6738315",
"0.6706094",
"0.6701752",
"0.6701752",
"0.6683287",
"0.6681289",
"0.6639867"... | 0.7727215 | 0 |
1. feladat /orders.json implementalasa, mely kilistazza az osszes megrendelest | def orders():
# Megnyitjuk az adatbazis kapcsolatot
conn = get_db()
try:
# Letrehozunk egy cursort az adatbazisban a navigalashoz
cur = conn.cursor()
try:
# Ezzel az SQL lekerdezessel kapjuk meg az eredmenytabla megfelelo adatait
cur.execute('SELECT order_id, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_orders(self):\n pass",
"def test_get_order_list(self):\n resp = self.app.get('/orders')\n self.assertEqual(resp.status_code, status.HTTP_200_OK)\n data = json.loads(resp.data)\n self.assertEqual(len(data), 2)",
"def test_load_json(orders_json):\n allocator = R... | [
"0.6791012",
"0.6743073",
"0.67204237",
"0.6706653",
"0.6359773",
"0.63542366",
"0.632425",
"0.6321199",
"0.6274439",
"0.6178063",
"0.61461294",
"0.61375",
"0.6111454",
"0.6028148",
"0.6010037",
"0.6005284",
"0.5986905",
"0.5955941",
"0.5917669",
"0.5893331",
"0.58930343",
... | 0.70279616 | 0 |
1. feladat /orders/.json implementalasa, mely lekeri a parameterkent kapott order_idju megrendeles adatait | def order_w_order_id(order_id):
# Megnyutjuk a kapcsolatot
conn = get_db()
try:
# Keszitunk egy cursort
cur = conn.cursor()
try:
# Ezt a parameteres SQL lekerdezest hajtjuk vegre, mellyel megkapjuk az adott
# order_id-ju megrendelest.
cur.execute('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orders():\n # Megnyitjuk az adatbazis kapcsolatot\n conn = get_db()\n try:\n # Letrehozunk egy cursort az adatbazisban a navigalashoz\n cur = conn.cursor()\n try:\n # Ezzel az SQL lekerdezessel kapjuk meg az eredmenytabla megfelelo adatait\n cur.execute('SELE... | [
"0.69312906",
"0.673151",
"0.6728253",
"0.6681056",
"0.66183215",
"0.6605068",
"0.6598936",
"0.64712906",
"0.64633244",
"0.6455298",
"0.6402341",
"0.630689",
"0.62695587",
"0.62604845",
"0.62572926",
"0.6256348",
"0.6236192",
"0.6204513",
"0.62041676",
"0.6147397",
"0.6093586... | 0.7342789 | 0 |
5. feladat DELETE es PUT utasitasok implementalasa /orders/ cimrol | def my_verb_1(order_id):
conn = get_db()
try:
cur = conn.cursor()
try:
# Ellenorizzuk, hogy letezik e az adott order_id-ju megrendeles
cur.execute("SELECT order_id FROM orders WHERE order_id" +
"= :order_id", order_id=order_id)
result =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_delete_order(request, id):\n\n close_old_connections()\n\n # Not marking it as served if it isn't even ready yet.\n if not request.user.is_authenticated:\n return HttpResponseForbidden(\"You're not authenticated.\")\n \n # Delete the order.\n Order.objects.get(id=id).delete()\n\n ... | [
"0.65182596",
"0.64201367",
"0.62923986",
"0.6286446",
"0.62594235",
"0.6248419",
"0.61520773",
"0.6138321",
"0.612726",
"0.60899955",
"0.6047898",
"0.59387326",
"0.593199",
"0.5920504",
"0.5916275",
"0.5908397",
"0.5868359",
"0.5841372",
"0.5807287",
"0.57780707",
"0.5701538... | 0.67141163 | 0 |
take an array of particles and then return an array containing only the particles that belong to the given galaxy. | def group_part_by_galaxy(snapPart, galaxy, ptype):
if ptype == 'gas':
snapPart = np.array([snapPart[k] for k in galaxy.glist])
elif ptype == 'star':
snapPart = np.array([snapPart[k] for k in galaxy.slist])
else:
raise NotImplemented("Unclear ptype")
return snapPart | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getMultiplicities(self, particleName=\"pion\", where=\"\", orderBy=\"event_id\"):\n whereClause = \"pid=%d\" % self._pid(particleName)\n if where:\n whereClause += \" and \" + where\n tmp = np.asarray(self.db.selectFromTable(\"multiplicities\", \"N\", whereClause=whereClause, or... | [
"0.51909333",
"0.50720644",
"0.49211138",
"0.48750088",
"0.4862877",
"0.48478866",
"0.48184502",
"0.47811744",
"0.47792068",
"0.4777285",
"0.47726387",
"0.47677648",
"0.47590017",
"0.4743294",
"0.47112522",
"0.4703292",
"0.46909022",
"0.46655935",
"0.4655452",
"0.46497214",
"... | 0.5223195 | 0 |
Check the number of gas particles in each galaxy that has nonzero H2 fraction. This will determine how many GMCs we will get in the subgrid step in galaxy.add_GMCs(). If this number is low, then we might as well skip extracting that galaxy. This should no longer be needed after we've added the denseGasThres in the part... | def check_dense_gas(dir='./'):
import glob
import pandas as pd
ff = glob.glob('*.gas')
for i in ff:
f = pd.read_pickle(i)
print(i)
print (f['f_H21'] > 0.0).sum()
print("Total dense gas mass: ")
print(f['m'] * f['f_H21']).sum()
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_particle_mass_for_hydrogen_with_no_mass_number():\n assert particle_mass(\"H\", Z=1) > const.m_p\n assert particle_mass(\"hydrogen\", Z=1) > const.m_p",
"def ISM_fractions_per_cell(**kwargs):\n\n p = copy.copy(params)\n for key,val in kwargs.items():\n setattr(p,key,val)\n\n # Load... | [
"0.5519008",
"0.5283836",
"0.52355564",
"0.5231369",
"0.51467663",
"0.51120955",
"0.51040214",
"0.50977975",
"0.50844216",
"0.50844216",
"0.50844216",
"0.50844216",
"0.5018498",
"0.5012825",
"0.5001004",
"0.5000648",
"0.4993743",
"0.4986448",
"0.49773496",
"0.49540406",
"0.49... | 0.5291886 | 1 |
Loop through snapRange and run main_proc() | def run(self, savepath=None, outname=None, emptyDM=True, caesarRotate=False, LoadHalo=False):
for idx in range(len(self.snapRange)):
self.load_obj_snap(idx, LoadHalo=LoadHalo)
if idx == 0:
gnames, zzz = self.main_proc(savepath=savepath, emptyDM=emptyDM, caesarRotate=caes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n if args.sims[0].lower() == 'all':\n args.sims = xl.get_all_sims(args.base_dir)\n have_full_sim_dir = True\n else:\n have_full_sim_dir = False\n \n for isim in args.sims:\n\n if have_full_sim_dir:\n wdir = isim\n else:\n wdir = xl.... | [
"0.6504704",
"0.59525657",
"0.56970966",
"0.55271876",
"0.5447908",
"0.54100174",
"0.5369783",
"0.533582",
"0.53319687",
"0.5322826",
"0.52638066",
"0.5262259",
"0.51946807",
"0.518759",
"0.5165129",
"0.51197416",
"0.51025736",
"0.50860333",
"0.50855327",
"0.5085338",
"0.5081... | 0.59994763 | 1 |
link galaixes properties from CAESAR via galname so we know all the properties of a given galaxy after running sigame | def link_caesarGalProp_galname(galObj, galname, index, groupID, galnames, mstar, mgas, mbh, fedd_array, sfr, sfrsd, sfrsd_manual, gassd, gassd_manual, gasR, gasR_half, starR_half, Zgas, Zstar, fgas, fh2, gdr, central, mhalo, hid, SFRSD_manual, gasSD_manual, f_h2, bhmdot, DTM, Zmet_massweighted, frad=0.1):
phm, phi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _html_galaxy_properties(html, gal):\n galaxy1, ra1, dec1, diam1 = gal[GALAXYCOLUMN], gal[racolumn], gal[deccolumn], 5 * MOSAICRADIUS / pixscale\n viewer_link = legacyhalos.html.viewer_link(ra1, dec1, diam1, dr10=True)\n\n html.write('<h2>Galaxy Properties</h2>\\n')\n\n html.write('<... | [
"0.6454864",
"0.5920085",
"0.55472094",
"0.5524975",
"0.54309255",
"0.5418953",
"0.51603204",
"0.5145755",
"0.5133671",
"0.51310015",
"0.51091355",
"0.51074696",
"0.50759953",
"0.5046172",
"0.50105846",
"0.49775842",
"0.4955229",
"0.49519417",
"0.49490437",
"0.49488324",
"0.4... | 0.7034468 | 0 |
Rename duplicated galaxies from first box to something else and append to ggg2. Assuming all galaxies are extracted from snapshot036 | def rename_duplicates_across_vol(count, ggg1, ggg2, vol1='25', vol2='50', verbose=True):
c2 = []
for k,v in c1.items():
if v == 0:
c2.append(k)
if verbose:
print("Duplicated galnames between m{:} and m{:}: ".format(vol1, vol2))
print(c2)
if len(c2) > 0:
ove... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autorename_shots(context):\n\n for index, shot in enumerate(context.scene.milkshake_shots):\n shot.code = f\"SH{index + 1 :02}\"\n shot.camera.name = f\"{shot.code}.CAMX.000\"\n for obj in bpy.data.objects:\n if obj.data == shot.camera:\n obj.name = shot.camera... | [
"0.5879405",
"0.548796",
"0.52417886",
"0.52137095",
"0.5136928",
"0.504296",
"0.5035135",
"0.50124913",
"0.5008515",
"0.49980187",
"0.4985966",
"0.49660358",
"0.49591297",
"0.49335054",
"0.49275064",
"0.49140134",
"0.49127313",
"0.49093264",
"0.48879546",
"0.48473114",
"0.48... | 0.6738431 | 0 |
Run all submissions in a queue in a single environment. | def run_queue(queue_id, wes_id=None, opts=None):
queue_log = {}
for submission_id in get_submissions(queue_id, status='RECEIVED'):
submission = get_submission_bundle(queue_id, submission_id)
if submission['wes_id'] is not None:
wes_id = submission['wes_id']
run_log = run_subm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n assert self.queue is not None, \"Must specify queue or override run()\"\n\n while not self.terminated():\n qs = self.queue.objects.filter(status=self.queue.UNSUBMITTED,).order_by(\n \"-seq\"\n )[: django.conf.settings.DAEMONS_MAX_BATCH_SIZE]\n ... | [
"0.6404267",
"0.5961773",
"0.5960397",
"0.5952069",
"0.5950542",
"0.58749634",
"0.5866626",
"0.58308923",
"0.5816435",
"0.5816435",
"0.5809154",
"0.5793522",
"0.57882655",
"0.5786278",
"0.57851624",
"0.5776401",
"0.5753225",
"0.57524985",
"0.573511",
"0.56853825",
"0.56533396... | 0.5965091 | 1 |
On plugin loaded callback. | def plugin_loaded():
events.broadcast("plugin_loaded") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_load(self):\n pass",
"def on_load(self):\n pass",
"def on_load(self):",
"def on_load(self):\n self.__init__()",
"def __init_on_load__(self):",
"def plugin_finalize(self, plugin):",
"def load(self, plugin):\n self.rpc.call(MsfRpcMethod.PluginLoad, [plugin])",
"def _p... | [
"0.76253164",
"0.76253164",
"0.7346931",
"0.73250663",
"0.68481845",
"0.67905945",
"0.67120767",
"0.67110103",
"0.6664134",
"0.6646723",
"0.6627169",
"0.66065717",
"0.6596349",
"0.6589298",
"0.65373266",
"0.6522738",
"0.6499038",
"0.64985526",
"0.64985526",
"0.6474204",
"0.64... | 0.84739614 | 0 |
Generates an Excel spreadsheet for review by a staff member. | def generate_spreadsheet(request, id):
election = get_object_or_404(Election, pk=id)
response = render_to_response("django_elect/spreadsheet.html", {
'full_stats': election.get_full_statistics(),
})
filename = "election%s.xls" % (election.pk)
response['Content-Disposition'] = 'attachment; fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_staff_report_worksheet(self):\n worksheet = self.workbook.create_sheet(title='wagtail staff')\n for record in self._get_staff_report_data():\n worksheet.append(record)",
"def generate_waiter_financial_report_excel_file(self, staff_info, period, month_report, path):\n try:... | [
"0.65885943",
"0.63075346",
"0.6049406",
"0.59836394",
"0.59004736",
"0.58229905",
"0.58148134",
"0.5771395",
"0.5756357",
"0.5742141",
"0.5726083",
"0.5722908",
"0.56842107",
"0.56545544",
"0.5649972",
"0.5625542",
"0.56140697",
"0.5612644",
"0.5594194",
"0.55863124",
"0.558... | 0.6309655 | 1 |
Disassociates accounts (i.e. sets account_ids to NULL) for all Vote objects. 'id' corresponds to the primary key of the Election objects. | def disassociate_accounts(request, id):
election = get_object_or_404(Election, pk=id)
success = False
if request.POST and "confirm" in request.POST:
election.disassociate_accounts()
success = True
return render_to_response("django_elect/disassociate.html", {
"title": "Disassociat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, account_id):\n self.client.delete_account(account_id)",
"def remove_accounts(self):\n current_creds = self._accounts.copy()\n for creds in current_creds:\n self.remove_account(current_creds[creds].credentials.token,\n current_creds[c... | [
"0.5543012",
"0.5416594",
"0.5361996",
"0.52944726",
"0.5285123",
"0.51937306",
"0.514446",
"0.50617516",
"0.5037347",
"0.5018495",
"0.50036097",
"0.4918548",
"0.4914275",
"0.4872306",
"0.4871362",
"0.48646677",
"0.48108402",
"0.47910422",
"0.47871026",
"0.47833773",
"0.47787... | 0.6665044 | 0 |
Read a cutoff value from string 'cutoffs [,]' | def read_cutoffs(string):
if len(string) == 0:
return DEFAULT_CUTOFFS
return _read_ints(string, ',', '--cutoffs') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cut(filename):\n with open(filename, 'r') as f:\n meta = {}\n meta['header'] = f.readline().rstrip('\\n').strip()\n V_INI, V_INC, V_NUM, C, ICOMP, ICUT, NCOMP = f.readline().split()\n meta['V_INI'] = float(V_INI)\n meta['V_INC'] = float(V_INC)\n meta['V_NUM'] =... | [
"0.56753093",
"0.5388141",
"0.5249412",
"0.52109605",
"0.5103673",
"0.49971896",
"0.49843597",
"0.4853499",
"0.48211113",
"0.48191178",
"0.477775",
"0.4759151",
"0.47125772",
"0.46987662",
"0.46928528",
"0.46920845",
"0.46740142",
"0.4665193",
"0.46471676",
"0.46409163",
"0.4... | 0.8116215 | 0 |
Read the content of a ranked list file. | def read_ranked_list(f):
result = []
if f:
stream = f
else:
import sys
stream = sys.stdin
for idx, line in enumerate(stream):
did = line.strip()
result.append(did)
stream.close()
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_labelled_ranked_list(f):\n result = []\n if f:\n stream = f\n else:\n import sys\n stream = sys.stdin\n for idx, line in enumerate(stream):\n ls = line.strip().split(SEP_LABELLED_RANKED_LIST)\n if len(ls) == 1:\n ls.append(None)\n if len(ls)... | [
"0.6346845",
"0.6271526",
"0.6210492",
"0.61043674",
"0.5920318",
"0.59096473",
"0.5894099",
"0.58772326",
"0.5868395",
"0.58647925",
"0.5776252",
"0.57564294",
"0.5736592",
"0.5736592",
"0.5734855",
"0.570887",
"0.56996006",
"0.5697519",
"0.5647634",
"0.5591047",
"0.5572177"... | 0.6781381 | 0 |
Read the content of a labelled ranked list. | def read_labelled_ranked_list(f):
result = []
if f:
stream = f
else:
import sys
stream = sys.stdin
for idx, line in enumerate(stream):
ls = line.strip().split(SEP_LABELLED_RANKED_LIST)
if len(ls) == 1:
ls.append(None)
if len(ls) > 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_ranked_list(f):\n result = []\n if f:\n stream = f\n else:\n import sys\n stream = sys.stdin\n for idx, line in enumerate(stream):\n did = line.strip()\n result.append(did)\n stream.close()\n return result",
"def _load_labels(self, label_path: str) ->... | [
"0.6296241",
"0.60966545",
"0.5932336",
"0.58066905",
"0.5802889",
"0.5722143",
"0.5638221",
"0.5627268",
"0.5627226",
"0.5599928",
"0.55908346",
"0.5590496",
"0.5586053",
"0.5579284",
"0.5557062",
"0.5544542",
"0.55204695",
"0.55178446",
"0.55131865",
"0.5513099",
"0.5467783... | 0.7606346 | 0 |
find videos in playlist[link] and add their info as playlist[videos] as list | def add_videos(playlist):
surl = playlist['link']
# 작은 playlist의 url을 surl에 저장
soup = get_soup(surl)
# 작은 플레이리스트의 html 파싱하여 soup에 저장
print(f" getting videos for playlist: {playlist['title']}")
videos = []
# items are list of video a links from list
items = soup('a', class_='yt-uix-t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_playlists(section):\n global parent_folder\n # 초기값은 빈 값\n print(f\" getting playlists for section: {section['title']}\")\n # section의 인자로 받은 title 출력\n soup = get_soup(section['link'])\n # section의 인자로 받은 link를 get_soup 함수 실행\n # i.e. https://www.youtube.com//user/gjenkinslbcc/playlis... | [
"0.7198842",
"0.68799025",
"0.6704575",
"0.64329284",
"0.6375761",
"0.6263818",
"0.61557496",
"0.6113238",
"0.61086327",
"0.6077219",
"0.60661215",
"0.6029619",
"0.5994642",
"0.5979731",
"0.59733206",
"0.596136",
"0.5936387",
"0.59344584",
"0.59342384",
"0.59148467",
"0.59104... | 0.77092063 | 0 |
create and write channel_name.html file | def html_out(channel, sections):
title = f'YouTube Channel {channel}'
f = open(f'{channel}.html','w')
template = ('<!doctype html>\n<html lang="en">\n<head>\n'
'<meta charset="utf-8">'
'<title>{}</title>\n</head>\n'
'<body>\n{}\n</body>\n</html>')
parts =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_html_file(self, data: str):\n try:\n os.mkdir(\"../\" + self.uri)\n except FileExistsError:\n pass\n\n f = open(\"../\" + self.uri + self.file_name, \"w\")\n f.write(data)\n print(\"[WRITE] written to .html file\")\n f.close()",
"def _w... | [
"0.6678524",
"0.6533355",
"0.6309903",
"0.6251757",
"0.6096223",
"0.60707307",
"0.59470874",
"0.5910516",
"0.5860777",
"0.5846284",
"0.5820962",
"0.58131564",
"0.58091885",
"0.57961935",
"0.57891643",
"0.57833475",
"0.5758827",
"0.57383347",
"0.57228005",
"0.5681514",
"0.5629... | 0.677446 | 0 |
Check if a path is a directory or a Javascript file. | def isJsFile(path):
return os.path.splitext(path)[1] == '.js' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_path(path, isfile=False, isdir=False):\n \n return os.path.isfile(path) if isfile else os.path.isdir(path)",
"def isfile (self, path):\r\n pass",
"def is_js_file(fname):\r\n return REJS.search(fname) and \\\r\n TEST_INDICATOR not in fname",
"def is_dir(self, path):",
"def i... | [
"0.6955638",
"0.68854934",
"0.6867461",
"0.6813485",
"0.6733107",
"0.67058545",
"0.66462976",
"0.66388404",
"0.66310036",
"0.65956014",
"0.65922236",
"0.65789425",
"0.65725803",
"0.652567",
"0.64426196",
"0.64386666",
"0.64261323",
"0.64133996",
"0.6411371",
"0.6381593",
"0.6... | 0.78666943 | 0 |
Load all of the initial documents for the database. Optional create admin user for debugging. Not recommended for deployment. | def loadDocs(db, createAdmin=True):
docs = collectDesignDocs()
if createAdmin:
docs["admins"] = adminDoc
docs["shiftspace"] = adminUser
for k, v in docs.items():
print "Loading %s" % k
db[k] = v
print "Design documents loaded." | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initDB():\n global DATABASE\n\n uid0 = generate_resource_uid('Admin1', 0)\n\n DATABASE[\"users\"] = {\n \"Admin1\": {\n \"Type\": \"admin\",\n \"Password\": \"AdminPass\",\n \"Quota\": int(sys.maxsize),\n \"Resources\": {uid0},\n \"Created\... | [
"0.6571142",
"0.6556159",
"0.6352095",
"0.61963516",
"0.6147831",
"0.61385113",
"0.6106572",
"0.610136",
"0.6080003",
"0.601929",
"0.600915",
"0.60087436",
"0.5991328",
"0.5987307",
"0.59866667",
"0.59841967",
"0.5959315",
"0.5948576",
"0.5945995",
"0.5912456",
"0.5904143",
... | 0.7094747 | 0 |
Initialize the shiftspace database. Defaults to shiftspace for the database name. | def init(dbname="shiftspace"):
server = core.server()
if not server.__contains__(dbname):
print "Creating database %s." % dbname
server.create(dbname)
else:
print "%s database already exists." % dbname
db = server[dbname]
loadDocs(db) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initDatabase(self):\n\n try:\n self.dbase = workflowManager(self.wf_name)\n\n working = self.config['working_d']\n self.dbase.initWorkflow(self.wf_name, working)\n\n except sqlite3.Error as error:\n self.logger.warning('Database %s: %s', self.wf_name, e... | [
"0.6417733",
"0.6353089",
"0.6302074",
"0.6279891",
"0.62701684",
"0.6181921",
"0.6155111",
"0.6130623",
"0.6123865",
"0.6123865",
"0.6089861",
"0.608039",
"0.6072613",
"0.60567087",
"0.5904985",
"0.5868257",
"0.58536255",
"0.58536255",
"0.58509815",
"0.5847917",
"0.5842797",... | 0.7043011 | 0 |
Stores a single image to a LMDB. | def store_single_lmdb(image, image_id, label, lmdb_dir):
map_size = image.nbytes * 1000
# Create a new LMDB environment
env = lmdb.open(str(lmdb_dir + '/' + "single_lmdb"), map_size=map_size)
# Start a new write transaction
with env.begin(write=True) as txn:
# All key-value pairs need to be ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_img_to_db():\n with lite.connect(\"test.db\") as con:\n cur = con.cursor()\n data = read_image_from_fs()\n binary = lite.Binary(data)\n cur.execute(\"INSERT INTO Images(Data) VALUES (?)\", (binary,))",
"def save(image):\n keypoints, description = describe(image)\n artwo... | [
"0.7478127",
"0.7082868",
"0.68501973",
"0.679133",
"0.6695239",
"0.66033703",
"0.6542647",
"0.64780587",
"0.6154905",
"0.61458206",
"0.61176383",
"0.6080713",
"0.60517454",
"0.6024943",
"0.60066134",
"0.5975535",
"0.5970494",
"0.5944301",
"0.5941518",
"0.59096414",
"0.588433... | 0.7753299 | 0 |
find all image files of a specified file format in a specified data directory, and pair them into a dictionary structure with metadata files that share the same basename, and have the specified file format | def get_files(metadata_dir, images_dir, image_format, metadata_format):
all_metadata_files = [x for x in set(os.listdir(metadata_dir)) if x.endswith(metadata_format)]
all_image_files = [x for x in set(os.listdir(images_dir)) if x.endswith(image_format)]
images_and_metadata = {}
for metadata, image in it... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identify_filename_metadata(filename, file_format='CMIP6'):\n if file_format == 'CMIP5':\n components = ['cmor_name', 'table', 'climate_model', 'experiment',\n 'rip_code', 'date_string']\n elif file_format == 'CMIP6':\n components = ['cmor_name', 'table', 'climate_model'... | [
"0.65097827",
"0.6274121",
"0.62497747",
"0.61384773",
"0.60877496",
"0.60721487",
"0.6069389",
"0.60615855",
"0.60427254",
"0.60308796",
"0.60287386",
"0.6003294",
"0.5990342",
"0.5944268",
"0.5942876",
"0.59337336",
"0.5929979",
"0.5922522",
"0.5908401",
"0.58982253",
"0.58... | 0.8323698 | 0 |
read image files, crop based on metadata, store in a LMDB | def create_cropped_image_database(images_and_metadata, metadata_delimiter, metadata_dir, images_dir, lmdb_dir):
passed_metadata_files_counter = 0
empty_metadata_files_counter = 0
for metadata_name, image_name in images_and_metadata.items():
image = cv2.imread(images_dir+image_name)
metadata ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_metadata(self):\n\n cub_dir = self.root / \"CUB_200_2011\"\n images_list: Dict[int, List] = OrderedDict()\n\n with open(str(cub_dir / \"train_test_split.txt\")) as csv_file:\n csv_reader = csv.reader(csv_file, delimiter=\" \")\n for row in csv_reader:\n ... | [
"0.6623845",
"0.648384",
"0.6345527",
"0.62721324",
"0.62647927",
"0.6165798",
"0.6148703",
"0.6132766",
"0.60063463",
"0.6002164",
"0.5968839",
"0.59124553",
"0.590698",
"0.5899908",
"0.5886406",
"0.5862081",
"0.5860615",
"0.585214",
"0.58184576",
"0.57982075",
"0.57960254",... | 0.72428906 | 0 |
Wait for the instance's status to become the given status | def wait_for_instance_status(config, status):
client = config.create_api_client()
InstanceId = config.get('InstanceId')
while True:
time.sleep(20)
req = DescribeInstancesRequest.DescribeInstancesRequest()
result = do_action(client, req)
items = result["Instances"]["Instance"]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_for_status(self, status):\n code = self.instance.state['Code']\n while code != status:\n time.sleep(3)\n self.instance.reload()\n code = self.instance.state['Code']",
"def wait_for_object_status(self, object_name, object_id, status,\n ... | [
"0.79333055",
"0.7158681",
"0.6892945",
"0.6888001",
"0.68578935",
"0.6828951",
"0.68212295",
"0.6819704",
"0.67397577",
"0.6735766",
"0.6725674",
"0.66970015",
"0.6695002",
"0.6675882",
"0.6643066",
"0.6590239",
"0.6579182",
"0.6550829",
"0.6526706",
"0.6521048",
"0.64727783... | 0.8133529 | 0 |
Get a set of Sensor Visibility Exclusions by specifying their IDs. | def get_exclusions(self: object, *args, parameters: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:
return process_service_request(
calling_object=self,
endpoints=EPS,
operation_id="getSensorVisibilityExclusionsV1",
keywords=kwargs,
params=handl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_exclusions(self: object, parameters: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:\n return process_service_request(\n calling_object=self,\n endpoints=EPS,\n operation_id=\"querySensorVisibilityExclusionsV1\",\n keywords=kwargs,\n pa... | [
"0.66234493",
"0.62210065",
"0.6138098",
"0.61352855",
"0.5967789",
"0.5813355",
"0.557514",
"0.55248684",
"0.5421634",
"0.53718734",
"0.5370287",
"0.5339799",
"0.525666",
"0.52566254",
"0.5248243",
"0.5171992",
"0.5136298",
"0.5112229",
"0.49933198",
"0.49820065",
"0.4974652... | 0.7628518 | 0 |
Delete the Sensor Visibility exclusions by ID. | def delete_exclusions(self: object, *args, parameters: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:
return process_service_request(
calling_object=self,
endpoints=EPS,
operation_id="deleteSensorVisibilityExclusionsV1",
keywords=kwargs,
params... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_exclusions(self: object, body: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:\n if not body:\n body = exclusion_payload(passed_keywords=kwargs)\n if kwargs.get(\"id\", None):\n body[\"id\"] = kwargs.get(\"id\", None)\n\n return process_service_request(\... | [
"0.5735494",
"0.56503356",
"0.55933493",
"0.53139466",
"0.5088346",
"0.4999141",
"0.49655464",
"0.49001172",
"0.48824227",
"0.48805022",
"0.48760465",
"0.4860174",
"0.48588076",
"0.48530975",
"0.48530975",
"0.48530975",
"0.48530975",
"0.48530975",
"0.4843838",
"0.48257494",
"... | 0.7144608 | 0 |
Update the Sensor Visibility Exclusions. | def update_exclusions(self: object, body: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:
if not body:
body = exclusion_payload(passed_keywords=kwargs)
if kwargs.get("id", None):
body["id"] = kwargs.get("id", None)
return process_service_request(
calli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateVisibility(self):\r\n # Clear the map\r\n self.ClearVisibilityMap()\r\n \r\n # Only update it if we have a player\r\n if not self.game.player:\r\n return\r\n \r\n max_vis_day = self.data.get('max_visibility', self.game.data['map']['max_visibility'])\r\n max_vis_night = self.d... | [
"0.6090094",
"0.56541675",
"0.5619448",
"0.5538295",
"0.54885936",
"0.53674793",
"0.5325633",
"0.5251479",
"0.524534",
"0.5178574",
"0.51706505",
"0.51386917",
"0.51384777",
"0.5114472",
"0.50687647",
"0.5054725",
"0.5044974",
"0.50019157",
"0.49923",
"0.49793312",
"0.4978571... | 0.6739007 | 0 |
Search for Sensor Visibility Exclusions. | def query_exclusions(self: object, parameters: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:
return process_service_request(
calling_object=self,
endpoints=EPS,
operation_id="querySensorVisibilityExclusionsV1",
keywords=kwargs,
params=paramete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_exclusions(self: object, *args, parameters: dict = None, **kwargs) -> Dict[str, Union[int, dict]]:\n return process_service_request(\n calling_object=self,\n endpoints=EPS,\n operation_id=\"getSensorVisibilityExclusionsV1\",\n keywords=kwargs,\n ... | [
"0.7064011",
"0.60131866",
"0.5885105",
"0.5806043",
"0.57543635",
"0.5280081",
"0.5234697",
"0.52136356",
"0.51016414",
"0.5053311",
"0.5053124",
"0.5047373",
"0.5036092",
"0.50112",
"0.5009891",
"0.5000493",
"0.49404937",
"0.49302125",
"0.49293956",
"0.490863",
"0.49012655"... | 0.7100678 | 0 |
Free energy shift including zero point vibration (eV/atom) | def energy_shift(self) -> float:
return (self.chem_pot_shift +
self.zero_point_vibrational_energy / self.n_atoms) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy_function(self, x):\n \n return -T.dot(T.transpose(x), T.dot(self.W, x)) -\\\n T.dot(T.transpose(self.b), x)",
"def energy(self):\n self.E = - np.sum(self.phi) + 0.5 * self.mass * np.sqrt((self.v_x ** 2 + self.v_y **2))",
"def free_energy(self, v):\n return - T.dot(v, se... | [
"0.6212617",
"0.61472255",
"0.6019363",
"0.5973585",
"0.59720504",
"0.59485227",
"0.5912641",
"0.58608407",
"0.58412075",
"0.57988983",
"0.578417",
"0.5702353",
"0.5697987",
"0.5697468",
"0.5679933",
"0.5665383",
"0.5656652",
"0.5566017",
"0.55454284",
"0.5541071",
"0.5530353... | 0.62163347 | 0 |
Clean_timelog() function takes no inputs and the read_csv line will need to be changed to the file name. Function will create a cleaned dataframe from the timelog file where all jobs that do not have a remove date (considered open at the time the data was pulled) will be set equal to the maximum post_date. | def clean_timelog(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_and_clean(self,in_path):\n in_path = Path(in_path)\n try:\n df = pd.read_csv(in_path, index_col = 0, parse_dates = True, infer_datetime_format = True)\n except:\n print(\"Could not read csv file. Please check the path\")\n finally:\n #attempt t... | [
"0.60123324",
"0.58347446",
"0.565053",
"0.56455606",
"0.5589095",
"0.55227816",
"0.5435895",
"0.52541196",
"0.5252482",
"0.51567477",
"0.51552117",
"0.51524633",
"0.5132202",
"0.5078923",
"0.50475514",
"0.5037775",
"0.5030769",
"0.50280136",
"0.50181127",
"0.50020117",
"0.50... | 0.6167626 | 0 |
Clean_role() function reads in the csv for roles and then the second file is a list of roles that will be mapped to manager, sales, key it, it, and hourly roles. The list of roles can be manipulated in the excel file to change which roles are mapped to which bucket. The second part of the function determines if each ro... | def clean_role(): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_role(self, role):\n if role.name in [r.name for r in self.roles]:\n remaining_if_any_roles = [r.to_python() for r in self.roles if not r.name == role.name]\n if remaining_if_any_roles:\n return db[self.colNam].find_and_modify(query=dict(_id=self.id), update={'... | [
"0.51257455",
"0.4836676",
"0.48200467",
"0.46801916",
"0.46554983",
"0.45804685",
"0.4578667",
"0.45754105",
"0.45713556",
"0.4561977",
"0.45559865",
"0.45441324",
"0.4534929",
"0.4534519",
"0.45338595",
"0.45234147",
"0.44999465",
"0.44896668",
"0.44823596",
"0.44639954",
"... | 0.59877294 | 0 |
Create_date_list() function serves to create a list of date ranges between the minimum post_date and maximum post_date that will then be used as dates for the metric calculations. The date values are derived from the timelog file but can be set manually using a datetime.date variable that is then plugged in as start_da... | def create_date_list(start_date = start_date, end_date = end_date): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_date_list(begin_date, end_date):\n begin_tm = time.strptime(begin_date, \"%Y%m%d\")\n end_tm = time.strptime(end_date, \"%Y%m%d\")\n begin_tv = calendar.timegm(begin_tm)\n end_tv = calendar.timegm(end_tm)\n date_list = []\n for tv in xrange(begin_tv, end_tv+86400, 86400):\n date_li... | [
"0.67807525",
"0.64248705",
"0.63979876",
"0.63816553",
"0.6363185",
"0.6363185",
"0.6289269",
"0.6171191",
"0.6160148",
"0.6119677",
"0.6019041",
"0.59504175",
"0.59277713",
"0.58750707",
"0.58672726",
"0.58516866",
"0.5831865",
"0.5772185",
"0.5761527",
"0.5747344",
"0.5722... | 0.79620326 | 0 |
Co_metrics_fx() starts by creating intermediate lists for each metrics calculation so that every calculation for each company will be stored in a specific list that will then be added to an ordered dictionary. The final cleaned dataframe termed df_final in these codes will be filtered for every unique company identifie... | def co_metrics_fx():
global co_metric_dict, df_co_metrics
co_metric_dict = OrderedDict()
intermediate_date_list = []
intermediate_company_list = []
intermediate_industry_list = []
intermediate_inv_count_list = []
intermediate_inv_50k_list = []
intermediate_inv_100k_list = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sector_metrics_fx():\r\n global df_sector_metrics\r\n \r\n df_sector_metrics = df_co_metrics\r\n drop_company = ['company_ref']\r\n df_sector_metrics.drop(labels = drop_company, axis = 1, inplace = True)\r\n df_sector_metrics = df_sector_metrics.groupby(['date_list', 'sector']).agg({'co_inv_o... | [
"0.67728627",
"0.61042494",
"0.5779781",
"0.55495375",
"0.54724395",
"0.5296963",
"0.5174567",
"0.51732874",
"0.5149728",
"0.51149154",
"0.508904",
"0.5086635",
"0.50662917",
"0.5050073",
"0.5049259",
"0.50430435",
"0.50418866",
"0.50223",
"0.50091326",
"0.5001915",
"0.499304... | 0.79831964 | 0 |
Intermediate lists are created similar to the process for the nonaveraged company metrics. A range is created based on index value using the min and max dates to identify when df_co_metrics moves to data from another company. Average calculation occur between the identified start and end index values. The rolling windo... | def co_average_metrics_fx():
co_inv_overall_28d_list = []
co_inv_50k_28d_list = []
co_inv_100k_28d_list = []
co_inv_manager_28d_list = []
co_inv_sales_28d_list = []
co_inv_key_roles_28d_list = []
co_inv_it_28d_list = []
co_inv_hourly_28d_list = []
co_fut_cost_overall_28d_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rolling_mean(self, metric: str = 'cfs', min: Union[int, float] = None, max: Union[int, float] = None,\n period_count: int = 5, period: str = 'year', start_date: datetime = None,\n end_date: datetime = None, rolling_window: str = '28D',\n ... | [
"0.6634578",
"0.60916686",
"0.5744811",
"0.5580122",
"0.54848814",
"0.547577",
"0.53615445",
"0.5269932",
"0.5206008",
"0.5167006",
"0.51556873",
"0.5117007",
"0.51149595",
"0.5113839",
"0.5109583",
"0.51064914",
"0.5050815",
"0.501343",
"0.50130117",
"0.49863675",
"0.4980665... | 0.7647641 | 0 |
Sector_metrics_fx() creates a copy of the df_co_metrics and then drops the company_ref column in order to enable grouping based on sector and date. Each of the metric columns are grouped by summing all the company metrics that fall into that sector. | def sector_metrics_fx():
global df_sector_metrics
df_sector_metrics = df_co_metrics
drop_company = ['company_ref']
df_sector_metrics.drop(labels = drop_company, axis = 1, inplace = True)
df_sector_metrics = df_sector_metrics.groupby(['date_list', 'sector']).agg({'co_inv_overall': 'sum', '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def co_metrics_fx():\r\n global co_metric_dict, df_co_metrics\r\n co_metric_dict = OrderedDict()\r\n intermediate_date_list = []\r\n intermediate_company_list = []\r\n intermediate_industry_list = []\r\n intermediate_inv_count_list = []\r\n intermediate_inv_50k_list = []\r\n intermediate_in... | [
"0.65883684",
"0.5041753",
"0.4952279",
"0.49171746",
"0.48724744",
"0.47947446",
"0.4786293",
"0.4726134",
"0.4715304",
"0.46766236",
"0.46570578",
"0.4644536",
"0.4643559",
"0.46325514",
"0.4625733",
"0.46225193",
"0.4617091",
"0.46013096",
"0.45734262",
"0.45634806",
"0.45... | 0.80711925 | 0 |
get abi (application binary interface) | def get_abi(self):
abi = subprocess.getoutput('{} -s {} shell getprop ro.product.cpu.abi'.format(ADB_EXECUTOR, self.device_id))
logger.info('device {} abi is {}'.format(self.device_id, abi))
return abi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_address_abi(name, mode):\n dict_event = get_smart_contracts_dict(mode)\n address, abi = dict_event[name]\n\n return address, abi",
"def get_apk(self):",
"def get_binary_name():\n return os.path.basename(inspect.stack()[-1][1])[:16]",
"def check_abi(abi):\n if not abi:\n return N... | [
"0.63040423",
"0.6039445",
"0.599659",
"0.5748162",
"0.55531853",
"0.54362345",
"0.54020774",
"0.53254926",
"0.5293815",
"0.5270582",
"0.52393866",
"0.5237416",
"0.5236233",
"0.522331",
"0.520218",
"0.5142402",
"0.51230645",
"0.50813013",
"0.50642884",
"0.5062789",
"0.5049837... | 0.7431906 | 0 |
download specific minicap.so (they should work together) | def download_target_mnc_so(self):
target_url = '{}/{}/lib/android-{}/minicap.so'.format(MNC_PREBUILT_URL, self.abi, self.sdk)
logger.info('target minicap.so url: ' + target_url)
mnc_so_path = download_file(target_url)
# push and grant
subprocess.check_call([ADB_EXECUTOR, '-s', s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n get_obofoundry(force_download=True)",
"def getMpcorb(url='https://minorplanetcenter.net/iau/MPCORB/MPCORB.DAT.gz', fname='MPCORB.DAT.gz', verbose=True):\n\n #filename = wget.download(url)\n try:\n r = requests.get(url, allow_redirects=True)\n open(fname, 'wb').write(r.content... | [
"0.57513034",
"0.5580873",
"0.549659",
"0.54631865",
"0.5373747",
"0.5365433",
"0.53570956",
"0.5319709",
"0.53019893",
"0.5233805",
"0.5186923",
"0.5146799",
"0.5135857",
"0.5134981",
"0.51258284",
"0.511327",
"0.5082432",
"0.50582886",
"0.49935228",
"0.4986356",
"0.4981097"... | 0.66859454 | 0 |
check if minicap installed | def is_mnc_installed(self):
return self.is_installed('minicap') and self.is_installed('minicap.so') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_installed(self):\n pass",
"def is_gappa_installed():\n dev_null = open(\"/dev/null\", \"w\")\n gappa_test = subprocess.call(\"gappa --help 2> /dev/null\", shell=True)\n return (gappa_test == 0)",
"def pyoptsparse_installed():\n # type: () -> bool\n try:\n from openmdao.api i... | [
"0.6260037",
"0.6113707",
"0.61014247",
"0.60427195",
"0.6017327",
"0.5970088",
"0.59612274",
"0.5886036",
"0.58755404",
"0.586887",
"0.5836067",
"0.57986826",
"0.57951087",
"0.57925385",
"0.57560056",
"0.5747985",
"0.57343644",
"0.57158893",
"0.5711147",
"0.5710337",
"0.5703... | 0.72446686 | 0 |
pull screen shot and move it to target path | def export_screen(self, target_path):
subprocess.check_call([
ADB_EXECUTOR, '-s', self.device_id,
'pull', TEMP_PIC_ANDROID_PATH, target_path
], stdout=subprocess.DEVNULL)
logger.info('export screen shot to {}'.format(target_path)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_shot(self, pic_path):\n self.run_command(f'shell screencap -p /sdcard/screen.png')\n if not path.exists(pic_path):\n self.run_command(f'pull /sdcard/screen.png {pic_path}')\n else:\n raise ADBError(f'{pic_path} already exist')\n self.run_command(f'shell ... | [
"0.62715095",
"0.6248298",
"0.6188212",
"0.5875988",
"0.5865206",
"0.5839719",
"0.5809205",
"0.57954216",
"0.5728796",
"0.569727",
"0.5651475",
"0.56306624",
"0.56192654",
"0.5616689",
"0.55715114",
"0.55715114",
"0.5555525",
"0.5529311",
"0.5493535",
"0.54891455",
"0.5480673... | 0.66822046 | 0 |
Take numpy structured array and extract with requested field into pandas dataframe. | def extract_field(data, fieldname):
# Make every nested structured numpy array into a dataframe of its own
base_frame = pd.DataFrame(data)
time_frame = pd.DataFrame(data['Mean_Acq_Time'])
retrieval_frame = pd.DataFrame(data['Retrieval_Results_Data'])
# Look to see if user requested fieldname exists... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_to_df (a_array,b_as_column='') :\n if b_as_column == '' :\n loc_result = __pd.DataFrame(data=a_array)\n else :\n loc_result = __pd.DataFrame(data=a_array,columns=b_as_column)\n return loc_result",
"def dataframe_with_arrays(include_index=False):\n dtypes = [('i1', pa.int8()), ... | [
"0.6110935",
"0.60033244",
"0.60015434",
"0.59027404",
"0.5765642",
"0.5714347",
"0.56923336",
"0.56882155",
"0.55338335",
"0.55075186",
"0.5494981",
"0.5462878",
"0.53790855",
"0.5353052",
"0.53509164",
"0.52794826",
"0.52574074",
"0.52475953",
"0.5232151",
"0.5214365",
"0.5... | 0.67997867 | 0 |
Plot the difference between two dataframes for a given field. Gives map plots and scatter. Difference is dataframe2 dataframe1 | def evaluate_field_diff(smdf1, smdf2, fieldname, orbitnameone, orbitnametwo, vmin=-1, vmax=1, xaxis='Latitude', save_fig_directory=None):
logging.debug("Evaluating difference between 2 dataframes for field '{}'...".format(fieldname))
logging.debug('The difference runs from 1 -> 2, ie. {} -> {}, 2 subtract 1'.fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plotCompareScatterMatrix(scatterMatrix1, scatterMatrix2, fName=None):\n from matplotlib import pyplot\n\n diff = scatterMatrix1 - scatterMatrix2\n\n pyplot.imshow(diff.todense(), interpolation=\"nearest\")\n pyplot.grid(color=\"0.70\")\n pyplot.xlabel(\"From group\")\n pyplot.ylabel(\"To grou... | [
"0.6443312",
"0.6315528",
"0.6088861",
"0.60622364",
"0.599057",
"0.58939964",
"0.58129615",
"0.57526034",
"0.5699873",
"0.56801784",
"0.5679664",
"0.5664067",
"0.5636017",
"0.56285244",
"0.5617697",
"0.55960536",
"0.55726683",
"0.55687714",
"0.5558291",
"0.5552838",
"0.55288... | 0.69816506 | 0 |
Plot the soil moisture orbit. Gives map plots and scatter. | def plot_sm_orbit(smdf, orbit_name, fieldname='Soil_Moisture', vmin=0, vmax=1, save_fig_directory=None):
logging.debug('Plotting {} orbit, field {}...'.format(orbit_name, fieldname))
fig, m, dot_size = setup_sm_plot(smdf['Latitude'].values, smdf['Longitude'].values)
if fieldname == 'Soil_Moisture':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_moons(epoch = epoch(0)):\n\tfrom PyKEP.orbit_plots import plot_planet\n\tfrom mpl_toolkits.mplot3d import Axes3D\n\timport matplotlib.pyplot as plt\n\t\n\tfig = plt.figure()\n\tax = fig.gca(projection='3d')\n\n\tplot_planet(ax,io,color = 'r', units = JR, t0 = epoch, legend=True)\n\tplot_planet(ax,europa,c... | [
"0.6935004",
"0.68583137",
"0.67280704",
"0.65847456",
"0.6573265",
"0.65687037",
"0.64142007",
"0.6413674",
"0.64013517",
"0.6376612",
"0.6351136",
"0.63484716",
"0.63195926",
"0.6277084",
"0.62593675",
"0.62387866",
"0.6185118",
"0.6158423",
"0.6128664",
"0.61141086",
"0.60... | 0.7066982 | 0 |
Initializes the Windows Registry file mapping. | def __init__(self, key_path_prefix, windows_path):
super(WinRegistryFileMapping, self).__init__()
self.key_path_prefix = key_path_prefix.upper()
self.windows_path = windows_path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self, ascii_codepage=u'cp1252', backend=1, registry_file_reader=None):\n super(WinRegistry, self).__init__()\n self._ascii_codepage = ascii_codepage\n self._backend = backend\n self._registry_file_reader = registry_file_reader\n self._registry_files = {}",
"def __init__(self, ... | [
"0.6742568",
"0.66973376",
"0.6304252",
"0.61596453",
"0.6066608",
"0.57643235",
"0.57633406",
"0.57569975",
"0.5728204",
"0.57046056",
"0.5695877",
"0.5690401",
"0.56234246",
"0.5592474",
"0.55920374",
"0.5566877",
"0.55063933",
"0.5479299",
"0.5445794",
"0.54242307",
"0.534... | 0.72814167 | 0 |
Initializes the Windows Registry. | def __init__(
self, ascii_codepage=u'cp1252', backend=1, registry_file_reader=None):
super(WinRegistry, self).__init__()
self._ascii_codepage = ascii_codepage
self._backend = backend
self._registry_file_reader = registry_file_reader
self._registry_files = {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.registry = {}",
"def __init__(self):\n self._registry = {}",
"def init_hotkeys(self):\n\n\t\tself._interface.init_hotkeys()",
"def init(registry):\n\n global _initialized\n global _keyBindings\n\n if _initialized:\n return False\n\n # Do not hang on... | [
"0.6316195",
"0.62848604",
"0.62473494",
"0.6065683",
"0.60360265",
"0.59538853",
"0.59094834",
"0.59038204",
"0.5886833",
"0.5881652",
"0.5837593",
"0.58334386",
"0.57663333",
"0.57350713",
"0.5711703",
"0.5688143",
"0.56712246",
"0.5640793",
"0.56202185",
"0.5597398",
"0.55... | 0.6684156 | 0 |
Cleans up the Windows Registry object. | def __del__(self):
for key_path_prefix, registry_file in iter(self._registry_files.items()):
self._registry_files[key_path_prefix] = None
if registry_file:
registry_file.Close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_registries(self):\n registry = self.connection.get_finished_registry(name=self.name)\n registry.cleanup()\n registry = self.connection.get_started_registry(name=self.name)\n registry.cleanup()",
"def reset_registries():\n StepRegistry().clear()\n HookRegistry().reset()... | [
"0.69243276",
"0.6555525",
"0.6461345",
"0.6398521",
"0.62997806",
"0.61406314",
"0.610902",
"0.61038715",
"0.6022593",
"0.59810716",
"0.5921123",
"0.58395964",
"0.5823669",
"0.5798987",
"0.57938504",
"0.5790493",
"0.5746743",
"0.5744243",
"0.5742043",
"0.5732021",
"0.5706842... | 0.70479167 | 0 |
Retrieves a cached Registry file for a specific path. | def _GetCachedFileByPath(self, safe_key_path):
longest_key_path_prefix = u''
longest_key_path_prefix_length = len(longest_key_path_prefix)
for key_path_prefix in self._registry_files.iterkeys():
if safe_key_path.startswith(key_path_prefix):
key_path_prefix_length = len(key_path_prefix)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, path):\n\t\treturn self.cache.get(path)",
"def GetFromCache(self, filename):\n return memcache.get('%s%s' % (self.CACHE_PREFIX, filename))",
"def GetFromCache(self, filename):\n return memcache.get('%s%s' % (self.CACHE_PREFIX, filename))",
"def get_image_from_cache(cache, file_path):\n ... | [
"0.74330527",
"0.6664037",
"0.6664037",
"0.65876365",
"0.6472531",
"0.6419633",
"0.6400624",
"0.63513285",
"0.6323365",
"0.6295047",
"0.6247905",
"0.6247905",
"0.61856425",
"0.6146833",
"0.6119168",
"0.6114626",
"0.6074702",
"0.60592175",
"0.6056559",
"0.6031584",
"0.6031584"... | 0.678589 | 1 |
Retrieves the Registry file for a specific path. | def _GetFileByPath(self, safe_key_path):
# TODO: handle HKEY_USERS in both 9X and NT.
key_path_prefix, registry_file = self._GetCachedFileByPath(safe_key_path)
if not registry_file:
for mapping in self._GetFileMappingsByPath(safe_key_path):
# TODO: refactor to pass single path.
path, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Open(self, path, filename, ascii_codepage=u'cp1252'):\n try:\n # TODO: do not pass the full pre_obj here but just\n # the necessary values.\n expanded_path = self._file_path_expander.ExpandPath(\n path, pre_obj=self._pre_obj)\n\n except KeyError as exception:\n logging.warnin... | [
"0.65633655",
"0.6292842",
"0.62244016",
"0.5968396",
"0.595612",
"0.59441036",
"0.591783",
"0.5909321",
"0.5811857",
"0.57662076",
"0.5752327",
"0.56680155",
"0.56609356",
"0.5523769",
"0.5510898",
"0.54955465",
"0.5490831",
"0.54777265",
"0.5450401",
"0.5444503",
"0.5431406... | 0.6760346 | 0 |
Retrieves the Registry file mappings for a specific path. | def _GetFileMappingsByPath(self, safe_key_path):
candidate_mappings = []
for mapping in self._REGISTRY_FILE_MAPPINGS_NT:
if safe_key_path.startswith(mapping.key_path_prefix):
candidate_mappings.append(mapping)
# Sort the candidate mappings by longest (most specific) match first.
candidate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _GetFileByPath(self, safe_key_path):\n # TODO: handle HKEY_USERS in both 9X and NT.\n\n key_path_prefix, registry_file = self._GetCachedFileByPath(safe_key_path)\n if not registry_file:\n for mapping in self._GetFileMappingsByPath(safe_key_path):\n # TODO: refactor to pass single path.\n ... | [
"0.6529628",
"0.6405865",
"0.6346849",
"0.6230724",
"0.5964231",
"0.59292537",
"0.58409697",
"0.57984805",
"0.5718958",
"0.5709814",
"0.566521",
"0.5660426",
"0.5659544",
"0.5617457",
"0.5613812",
"0.55556756",
"0.5547129",
"0.55046874",
"0.5461332",
"0.5461127",
"0.54567325"... | 0.697262 | 0 |
Expand a Registry key path based on path attributes. A Registry key path may contain path attributes. A path attribute is defined as anything within a curly bracket, e.g. "\\System\\{my_attribute}\\Path\\Keyname". If the path attribute my_attribute is defined it's value will be replaced with the attribute name, e.g. "\... | def ExpandKeyPath(self, key_path, path_attributes):
try:
expanded_key_path = key_path.format(**path_attributes)
except KeyError as exception:
raise KeyError(u'Unable to expand key path with error: {0:s}'.format(
exception))
if not expanded_key_path:
raise KeyError(u'Unable to ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand(self, path, dic):\n if dic: path = path % dic\n return os.path.normpath(os.path.expandvars(os.path.expanduser(path)))",
"def expand_flattened_path(flattened_path, value=None, separator='.'):\n split_list = flattened_path.split(separator)\n return add_keys({}, split_list, value)",
... | [
"0.6403004",
"0.57976514",
"0.57902557",
"0.54921675",
"0.5346951",
"0.5305322",
"0.5297346",
"0.5297346",
"0.52719635",
"0.5181307",
"0.51535046",
"0.5144016",
"0.5143204",
"0.51402473",
"0.5110905",
"0.5110465",
"0.50771105",
"0.5069418",
"0.50416523",
"0.49965456",
"0.4940... | 0.7519149 | 0 |
Determines the Registry type based on keys present in the file. | def GetRegistryFileType(self, registry_file):
registry_file_type = definitions.REGISTRY_FILE_TYPE_UNKNOWN
for registry_file_type, key_paths in iter(
self._KEY_PATHS_PER_REGISTRY_TYPE.items()):
# If all key paths are found we consider the file to match a certain
# Registry type.
match ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getType(self, file=None):\n if file is None:\n raise ValueError(\"No file name supplied\")\n\n for patterns, type in self.pattern.items():\n if patterns.search(file):\n return type\n\n return None",
"def getType(file):\n\n with open(file, \"r\") as... | [
"0.5974551",
"0.5901042",
"0.5767286",
"0.56396365",
"0.5501895",
"0.548198",
"0.54752946",
"0.5470402",
"0.5470402",
"0.54554904",
"0.54236794",
"0.54202616",
"0.54006237",
"0.5322685",
"0.5297758",
"0.52940345",
"0.52684766",
"0.5245801",
"0.5239195",
"0.5233227",
"0.52241"... | 0.7526647 | 0 |
Initializes the Windows Registry file reader. | def __init__(self, searcher, pre_obj=None):
super(WinRegistryFileReader, self).__init__()
self._file_path_expander = path_expander.WinRegistryKeyPathExpander()
self._pre_obj = pre_obj
self._searcher = searcher | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self, ascii_codepage=u'cp1252', backend=1, registry_file_reader=None):\n super(WinRegistry, self).__init__()\n self._ascii_codepage = ascii_codepage\n self._backend = backend\n self._registry_file_reader = registry_file_reader\n self._registry_files = {}",
"def __init__(self, ... | [
"0.6660998",
"0.63592553",
"0.59825",
"0.59144247",
"0.5902174",
"0.582916",
"0.5622005",
"0.55853605",
"0.55795765",
"0.554135",
"0.5497614",
"0.5495712",
"0.54827464",
"0.54778254",
"0.54408956",
"0.54395044",
"0.53967404",
"0.53638023",
"0.53464085",
"0.53464085",
"0.52841... | 0.6840558 | 0 |
Searches for a path specification of the path. | def _FindPathSpec(self, path, filename):
# TODO: determine why this first find is used add comment or remove.
# It does not appear to help with making sure path segment separate
# is correct.
find_spec = file_system_searcher.FindSpec(
location=path, case_sensitive=False)
path_specs = list(se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _path_search(self, path: str) -> Any:\n if path is not None:\n value = jmespath.search(path, self.ti_dict, options=self.jmespath_options)\n # self.log.trace(f'feature=transform, action=path-search, path={path}, value={value}')\n return value\n return None",
"def... | [
"0.6593902",
"0.6514129",
"0.63286215",
"0.6161199",
"0.6106346",
"0.6056124",
"0.596175",
"0.596175",
"0.596175",
"0.5942541",
"0.5892992",
"0.58738315",
"0.5870428",
"0.58546174",
"0.5845095",
"0.5845095",
"0.5844165",
"0.5844165",
"0.58107036",
"0.5801461",
"0.5788688",
... | 0.71796894 | 0 |
Opens the Registry file specificed by the path. | def Open(self, path, filename, ascii_codepage=u'cp1252'):
try:
# TODO: do not pass the full pre_obj here but just
# the necessary values.
expanded_path = self._file_path_expander.ExpandPath(
path, pre_obj=self._pre_obj)
except KeyError as exception:
logging.warning(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _OpenPathSpec(self, path_specification, ascii_codepage=u'cp1252'):\n if not path_specification:\n return\n\n file_entry = self._file_system.GetFileEntryByPathSpec(path_specification)\n if file_entry is None:\n return\n\n file_object = file_entry.GetFileObject()\n if file_object is None... | [
"0.7047977",
"0.64100957",
"0.6281523",
"0.6274988",
"0.6181371",
"0.61744547",
"0.61695266",
"0.58671695",
"0.58594024",
"0.57896143",
"0.5759248",
"0.5748732",
"0.57398224",
"0.57383287",
"0.56475824",
"0.56355834",
"0.56220144",
"0.5617376",
"0.5587322",
"0.55292284",
"0.5... | 0.75118554 | 0 |
Check that floating point instructions operate correctly. These ELF files are tested separately using the fp_check method. This means that test failures will be reported so that the contents of registers are printed as floats, rather than as unsigned integers. | def test_fp_elf(elf, expected):
elf_filename = os.path.join(elf_dir, elf)
epiphany = Epiphany()
with open(elf_filename, 'rb') as elf:
epiphany.init_state(elf, elf_filename, '', [], False, is_test=True)
epiphany.max_insts = 10000
epiphany.run()
expected.fp_check(epiphany.state... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_floats(self):\r\n problem_setup = [\r\n # [given_answer, [list of correct responses], [list of incorrect responses]]\r\n [1, [\"1\"], [\"1.1\"]],\r\n [2.0, [\"2.0\"], [\"1.0\"]],\r\n [4, [\"4.0\", \"4.00004\"], [\"4.00005\"]],\r\n [0.00016, [\"... | [
"0.6574816",
"0.6561027",
"0.6560614",
"0.64825135",
"0.6424211",
"0.63536525",
"0.6328501",
"0.6235267",
"0.61552626",
"0.6150907",
"0.61269045",
"0.60670316",
"0.6040816",
"0.60341495",
"0.59835166",
"0.59747964",
"0.5962133",
"0.5954667",
"0.5937494",
"0.587637",
"0.580779... | 0.6788139 | 0 |
Test ELF files that load values from memory into a register. | def test_load(elf, expected):
elf_filename = os.path.join(elf_dir, elf)
epiphany = Epiphany()
with open(elf_filename, 'rb') as elf:
epiphany.init_state(elf, elf_filename, '', [], False, is_test=True)
epiphany.state.mem.write(0x00100004, 4, 0xFFFFFFFF)
epiphany.max_insts = 10000
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_store(elf, expected):\n elf_filename = os.path.join(elf_dir, elf)\n epiphany = Epiphany()\n with open(elf_filename, 'rb') as elf:\n epiphany.init_state(elf, elf_filename, '', [], False, is_test=True)\n epiphany.max_insts = 10000\n epiphany.run()\n expected.check(epipha... | [
"0.6281186",
"0.62174904",
"0.5987822",
"0.59218144",
"0.5900939",
"0.58693075",
"0.5856189",
"0.5691785",
"0.56754375",
"0.56658244",
"0.5640169",
"0.559438",
"0.5594354",
"0.55724865",
"0.557114",
"0.5557021",
"0.55242103",
"0.5520187",
"0.55113524",
"0.5498024",
"0.5443951... | 0.6906202 | 0 |
Test ELF files that transfer data from registers to memory. | def test_store(elf, expected):
elf_filename = os.path.join(elf_dir, elf)
epiphany = Epiphany()
with open(elf_filename, 'rb') as elf:
epiphany.init_state(elf, elf_filename, '', [], False, is_test=True)
epiphany.max_insts = 10000
epiphany.run()
expected.check(epiphany.state, me... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_load(elf, expected):\n elf_filename = os.path.join(elf_dir, elf)\n epiphany = Epiphany()\n with open(elf_filename, 'rb') as elf:\n epiphany.init_state(elf, elf_filename, '', [], False, is_test=True)\n epiphany.state.mem.write(0x00100004, 4, 0xFFFFFFFF)\n epiphany.max_insts = ... | [
"0.6796605",
"0.64603555",
"0.6134516",
"0.6096225",
"0.60948926",
"0.60366607",
"0.5888099",
"0.5741146",
"0.55916744",
"0.55800873",
"0.5533992",
"0.5512519",
"0.55069375",
"0.5501541",
"0.5426784",
"0.54010314",
"0.53639746",
"0.53144646",
"0.52901495",
"0.5282332",
"0.527... | 0.6698088 | 1 |
Check that the testset32 instruction fails if the memory address it is given is too low.. | def test_testset32_fail():
elf_filename = os.path.join(elf_dir, 'testset_fail.elf')
expected_text = """testset32 has failed to write to address %s.
The absolute address used for the test and set instruction must be located
within the on-chip local memory and must be greater than 0x00100000 (2^20).
""" % str(hex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uInt32Compatible(integer):\n return integer < 0x100000000 and integer >= 0",
"def testAbiCompatibility32(self):\n self._TestAbiCompatibility(32)",
"def test_bit_set_bit_index_out_of_range(self):\n value = bytearray()\n value.append(255)\n ops = [bitwise_operations.bit_set(sel... | [
"0.634146",
"0.6090605",
"0.6000255",
"0.5978176",
"0.5927326",
"0.578627",
"0.57603467",
"0.5757133",
"0.57477564",
"0.57062453",
"0.56615865",
"0.5630073",
"0.56069255",
"0.5597249",
"0.5566359",
"0.5534685",
"0.5501622",
"0.54961675",
"0.54846436",
"0.5476325",
"0.54698324... | 0.7298946 | 0 |
Test that if the YAML file doesn't exist then the syncer doesn't do anything with the arborist client | def test_sync_missing_file(syncer, monkeypatch, db_session):
monkeypatch.setattr(syncer, "sync_from_local_yaml_file", "this-file-is-not-real")
with pytest.raises(FileNotFoundError):
syncer.sync()
assert syncer.arborist_client.create_resource.not_called()
assert syncer.arborist_client.create_role... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sync_incorrect_user_yaml_file(syncer, monkeypatch, db_session):\n path = os.path.join(\n os.path.dirname(os.path.realpath(__file__)), \"data/yaml/incorrect_user.yaml\"\n )\n monkeypatch.setattr(syncer, \"sync_from_local_yaml_file\", path)\n with pytest.raises(AssertionError):\n s... | [
"0.685649",
"0.66300994",
"0.6485659",
"0.644258",
"0.64357084",
"0.64008915",
"0.6371307",
"0.6369266",
"0.6366622",
"0.63307995",
"0.625126",
"0.62506944",
"0.6196918",
"0.61653817",
"0.61220896",
"0.61201334",
"0.6088404",
"0.60745054",
"0.60555875",
"0.601999",
"0.6018925... | 0.7024328 | 0 |
Test that if the YAML file doesn't exist then the syncer doesn't do anything with the arborist client | def test_sync_incorrect_user_yaml_file(syncer, monkeypatch, db_session):
path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "data/yaml/incorrect_user.yaml"
)
monkeypatch.setattr(syncer, "sync_from_local_yaml_file", path)
with pytest.raises(AssertionError):
syncer.sync()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sync_missing_file(syncer, monkeypatch, db_session):\n monkeypatch.setattr(syncer, \"sync_from_local_yaml_file\", \"this-file-is-not-real\")\n with pytest.raises(FileNotFoundError):\n syncer.sync()\n assert syncer.arborist_client.create_resource.not_called()\n assert syncer.arborist_clie... | [
"0.7024328",
"0.66300994",
"0.6485659",
"0.644258",
"0.64357084",
"0.64008915",
"0.6371307",
"0.6369266",
"0.6366622",
"0.63307995",
"0.625126",
"0.62506944",
"0.6196918",
"0.61653817",
"0.61220896",
"0.61201334",
"0.6088404",
"0.60745054",
"0.60555875",
"0.601999",
"0.601892... | 0.685649 | 1 |
Verifies that errors from the bulk_update_google_groups method, specifically ones relating to Google APIs, do not prevent arborist updates from occuring. | def test_sync_with_google_errors(syncer, monkeypatch):
monkeypatch.setitem(config, "GOOGLE_BULK_UPDATES", True)
syncer._update_arborist = MagicMock()
syncer._update_authz_in_arborist = MagicMock()
with patch("fence.sync.sync_users.bulk_update_google_groups") as mock_bulk_update:
mock_bulk_updat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bulk_group_errors(self):\n file_path = os.path.join(os.path.dirname(__file__),\n self.testdata_folder,\n self.filename_actg_missing_col)\n data = {\n 'bulk_upload' : open(file_path, 'rb'),\n }\n res = se... | [
"0.5970006",
"0.57956254",
"0.5713077",
"0.55751634",
"0.5552937",
"0.5502611",
"0.5465738",
"0.53905433",
"0.53772277",
"0.536064",
"0.5357293",
"0.53363675",
"0.53231484",
"0.5316456",
"0.5305246",
"0.52972245",
"0.52910197",
"0.5283678",
"0.52824354",
"0.5272029",
"0.52707... | 0.69819593 | 0 |
Test _merge_multiple_dbgap_sftp() is called when sync from dbgap server is true | def test_merge_dbgap_servers(syncer, monkeypatch, db_session):
monkeypatch.setattr(syncer, "is_sync_from_dbgap_server", True)
def mock_merge(dbgap_servers, sess):
return {}, {}
syncer._merge_multiple_dbgap_sftp = MagicMock(side_effect=mock_merge)
syncer._process_dbgap_files = MagicMock(side_ef... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_process_additional_dbgap_servers(syncer, monkeypatch, db_session):\n monkeypatch.setattr(syncer, \"is_sync_from_dbgap_server\", True)\n\n def mock_merge(dbgap_servers, sess):\n return {}, {}\n\n syncer._process_dbgap_files = MagicMock(side_effect=mock_merge)\n\n syncer.sync()\n\n # t... | [
"0.7397646",
"0.59777933",
"0.5868299",
"0.5800005",
"0.5795862",
"0.5755766",
"0.5704689",
"0.567316",
"0.5661111",
"0.5654309",
"0.5599398",
"0.5561381",
"0.54910374",
"0.54531425",
"0.5444378",
"0.54361874",
"0.54316235",
"0.5430757",
"0.54244745",
"0.54241604",
"0.5399357... | 0.7530339 | 0 |
Test that if there are additional dbgap servers, then process_dbgap_files() is called x times where x is of dbgap servers | def test_process_additional_dbgap_servers(syncer, monkeypatch, db_session):
monkeypatch.setattr(syncer, "is_sync_from_dbgap_server", True)
def mock_merge(dbgap_servers, sess):
return {}, {}
syncer._process_dbgap_files = MagicMock(side_effect=mock_merge)
syncer.sync()
# this function will... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_merge_dbgap_servers(syncer, monkeypatch, db_session):\n monkeypatch.setattr(syncer, \"is_sync_from_dbgap_server\", True)\n\n def mock_merge(dbgap_servers, sess):\n return {}, {}\n\n syncer._merge_multiple_dbgap_sftp = MagicMock(side_effect=mock_merge)\n syncer._process_dbgap_files = Mag... | [
"0.6171339",
"0.57866895",
"0.55373555",
"0.54575926",
"0.5442504",
"0.54387754",
"0.5312041",
"0.53083706",
"0.5296513",
"0.52431965",
"0.5242665",
"0.5209783",
"0.5202124",
"0.5189052",
"0.5178506",
"0.5160413",
"0.51507354",
"0.51464564",
"0.51435846",
"0.51057625",
"0.509... | 0.74904686 | 0 |
Test that visas and authorization from them only get added to the database after visa sync job and not by usersync alone. Ensure usersync does not alter visa information. | def test_user_sync_with_visa_sync_job(
mock_discovery,
mock_get_token,
mock_userinfo,
syncer,
db_session,
storage_client,
monkeypatch,
kid,
rsa_public_key,
rsa_private_key,
mock_arborist_requests,
no_app_context_no_public_keys,
):
setup_info = setup_ras_sync_testing(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_view_acls(self):\n v1, v2, v3 = set_resources_and_sync([\n make_video(\n media_id='123', acl=['USER_spqr1', 'USER_abcd1', 'INST_botolph', 'GROUP_1234']),\n make_video(media_id='456', acl=['WORLD']),\n make_video(media_id='789', acl=['CAM']),\n ... | [
"0.6396088",
"0.6150746",
"0.6046819",
"0.601038",
"0.5983864",
"0.5970375",
"0.59305716",
"0.5866604",
"0.5822035",
"0.57329273",
"0.5715385",
"0.56646866",
"0.56457776",
"0.56341404",
"0.56000096",
"0.5577259",
"0.55656123",
"0.5551021",
"0.55419904",
"0.5535808",
"0.551395... | 0.73136127 | 0 |
Test that the mfa_policy is regranted to the user after revoking all their policies. | def test_revoke_all_policies_preserve_mfa(monkeypatch, db_session, syncer):
monkeypatch.setitem(
config,
"OPENID_CONNECT",
{
"mock_idp": {
"multifactor_auth_claim_info": {"claim": "acr", "values": ["mfa"]}
}
},
)
user = User(
us... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_revoke_all_policies_preserve_mfa_no_mfa(monkeypatch, db_session, syncer):\n monkeypatch.setitem(\n config,\n \"OPENID_CONNECT\",\n {\n \"mock_idp\": {\n \"multifactor_auth_claim_info\": {\"claim\": \"acr\", \"values\": [\"mfa\"]}\n }\n },... | [
"0.7246605",
"0.7173086",
"0.7116582",
"0.63030875",
"0.61730075",
"0.6109433",
"0.59968626",
"0.5975485",
"0.5941726",
"0.5891771",
"0.5830954",
"0.58268857",
"0.57462513",
"0.57460177",
"0.5730698",
"0.56934",
"0.5655707",
"0.5646763",
"0.5612143",
"0.5582006",
"0.5566781",... | 0.72853327 | 0 |
Test to ensure the mfa_policy preservation does not occur if the user does not have the mfa resource granted. | def test_revoke_all_policies_preserve_mfa_no_mfa(monkeypatch, db_session, syncer):
monkeypatch.setitem(
config,
"OPENID_CONNECT",
{
"mock_idp": {
"multifactor_auth_claim_info": {"claim": "acr", "values": ["mfa"]}
}
},
)
user = User(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_revoke_all_policies_preserve_mfa_no_idp(monkeypatch, db_session, syncer):\n monkeypatch.setitem(\n config,\n \"OPENID_CONNECT\",\n {\n \"mock_idp\": {\n \"multifactor_auth_claim_info\": {\"claim\": \"acr\", \"values\": [\"mfa\"]}\n }\n },... | [
"0.6447282",
"0.64058924",
"0.6338368",
"0.62860423",
"0.6192313",
"0.6181443",
"0.61726576",
"0.6134831",
"0.6121252",
"0.6121252",
"0.6121252",
"0.60961974",
"0.60658836",
"0.60536104",
"0.6047867",
"0.6047867",
"0.6039211",
"0.6023065",
"0.5984879",
"0.59668726",
"0.593524... | 0.6528378 | 0 |
Tests that arborist_client.revoke_all_policies is still called when an error occurs | def test_revoke_all_policies_preserve_mfa_ensure_revoke_on_error(
monkeypatch, db_session, syncer
):
monkeypatch.setitem(
config,
"OPENID_CONNECT",
{
"mock_idp": {
"multifactor_auth_claim_info": {"claim": "acr", "values": ["mfa"]}
}
},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_revoke_all_policies_preserve_mfa_no_idp(monkeypatch, db_session, syncer):\n monkeypatch.setitem(\n config,\n \"OPENID_CONNECT\",\n {\n \"mock_idp\": {\n \"multifactor_auth_claim_info\": {\"claim\": \"acr\", \"values\": [\"mfa\"]}\n }\n },... | [
"0.6959111",
"0.66762835",
"0.6483767",
"0.60696274",
"0.5986671",
"0.5837496",
"0.57736087",
"0.5762427",
"0.5708409",
"0.5619053",
"0.56027526",
"0.5516744",
"0.5513224",
"0.5494716",
"0.54798704",
"0.54536116",
"0.5428656",
"0.5404861",
"0.53798765",
"0.5378639",
"0.537299... | 0.756951 | 0 |
Convert a float to 16bit integer | def float_to_int_16(x):
return np.float16(x).view(np.int16) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _float_to_16_bit_sample(value):\n sample = int(32767.0 * value)\n byte0 = sample & 255\n byte1 = (sample >> 8) & 255\n return byte0, byte1",
"def to_uint16(f):\n from numpy import array, clip\n\n img = array(clip(f,0,65535)).astype('H')\n return img",
"def bit_to_short(... | [
"0.8176315",
"0.7201929",
"0.719093",
"0.6598807",
"0.6591597",
"0.6581271",
"0.65635055",
"0.6477933",
"0.64631814",
"0.64605254",
"0.64130855",
"0.64052355",
"0.6307552",
"0.63039315",
"0.62919587",
"0.6286062",
"0.6259743",
"0.62177086",
"0.6209409",
"0.61935544",
"0.61900... | 0.822015 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.