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 |
|---|---|---|---|---|---|---|
Test that admin can delete a product | def test_admin_delete_product(self):
resp = self.admin_register()
reply = self.admin_login()
token = reply['token']
product = dict(
prod_name='NY_denims',
category='denims',
stock=20,
price=150
)
resp = self.client.post(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_non_admin_cannot_delete_product(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n )\n re... | [
"0.83574384",
"0.83247185",
"0.8285091",
"0.82623804",
"0.8177644",
"0.8141131",
"0.80846477",
"0.80198777",
"0.8002211",
"0.7932145",
"0.7909494",
"0.7733621",
"0.7691911",
"0.7655855",
"0.756794",
"0.7516048",
"0.75010175",
"0.7476865",
"0.74705225",
"0.7435304",
"0.7377097... | 0.8554349 | 0 |
Test that a non admin cannot delete a product | def test_non_admin_cannot_delete_product(self):
resp = self.admin_register()
reply = self.admin_login()
token = reply['token']
product = dict(
prod_name='NY_denims',
category='denims',
stock=20,
price=150
)
resp = self.clien... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_not_my_product(self):\n self._require_login(self.user1)\n response = self.client.delete('/api/1.0/products/2/')\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)",
"def test_admin_cannot_delete_nonexistant_product(self):\n resp = self.admin_register()... | [
"0.8456681",
"0.82070416",
"0.8153313",
"0.772525",
"0.750598",
"0.75052166",
"0.7497598",
"0.74397874",
"0.73591393",
"0.7334757",
"0.7330903",
"0.72217363",
"0.72114277",
"0.71953607",
"0.7125004",
"0.70727336",
"0.70629984",
"0.6935391",
"0.69298255",
"0.6893835",
"0.68860... | 0.834971 | 1 |
Test that admin cannnot delete a product from empty Inventory | def test_admin_cannot_delete_product_from_empty_Inventory(self):
resp = self.admin_register()
reply = self.admin_login()
token = reply['token']
resp = self.client.delete(
'/api/v1/products/1',
content_type='application/json',
headers={'Authori... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_admin_cannot_delete_nonexistant_product(self):\n resp = self.admin_register()\n reply = self.admin_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='denims',\n stock=20,\n price=150\n )\n ... | [
"0.79532677",
"0.7735564",
"0.7528131",
"0.7521453",
"0.7518936",
"0.746801",
"0.7354772",
"0.72263944",
"0.71801",
"0.71784055",
"0.7171436",
"0.7112214",
"0.7106493",
"0.70771635",
"0.6879483",
"0.68655676",
"0.68639493",
"0.68453324",
"0.6812393",
"0.6777014",
"0.67697865"... | 0.8764794 | 0 |
Test that admin cannnot delete a nonexistant product | def test_admin_cannot_delete_nonexistant_product(self):
resp = self.admin_register()
reply = self.admin_login()
token = reply['token']
product = dict(
prod_name='NY_denims',
category='denims',
stock=20,
price=150
)
resp = se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_not_my_product(self):\n self._require_login(self.user1)\n response = self.client.delete('/api/1.0/products/2/')\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)",
"def test_non_admin_cannot_delete_product(self):\n resp = self.admin_register()\n ... | [
"0.8434453",
"0.81416374",
"0.8129146",
"0.79895574",
"0.7884565",
"0.7712441",
"0.7642063",
"0.75856626",
"0.7577927",
"0.757099",
"0.7507489",
"0.75073075",
"0.75018024",
"0.7473333",
"0.7418871",
"0.7409584",
"0.72817427",
"0.7275699",
"0.72678584",
"0.7262097",
"0.7227959... | 0.8506851 | 0 |
Test ComBat feature harmonization. | def test_combat():
# Check if example data directory exists
example_data_dir = th.find_exampledatadir()
# Check if example data required exists
features = glob.glob(os.path.join(example_data_dir, 'examplefeatures_Patient*.hdf5'))
if len(features) < 7:
message = 'Too few example features for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_feature(feature, value, good_features):\r\n\tbase_write(good_features,\"bin/stanford-ner-2015-04-20/base.prop\")\r\n\tbase_prop = open(\"bin/stanford-ner-2015-04-20/base.prop\", \"a\")\r\n\tbase_prop.write(feature.strip() + \"=\" + str(value) + \"\\n\")\r\n\tbase_prop.close()\r\n\r\n\t#Test read base.prop... | [
"0.652699",
"0.64427763",
"0.6373243",
"0.6333925",
"0.6331873",
"0.6215436",
"0.6211196",
"0.59231627",
"0.59107846",
"0.5880464",
"0.5870288",
"0.58623254",
"0.58284056",
"0.58262885",
"0.58067703",
"0.5803254",
"0.57745475",
"0.5774168",
"0.57514584",
"0.5704505",
"0.57006... | 0.6563471 | 0 |
Returns true for all hostclasses which aren't tagged as nonZDD hostclasses | def is_deployable(self, hostclass):
return ((hostclass in self._hostclasses and
is_truthy(self._hostclasses[hostclass].get("deployable"))) or
hostclass not in self._hostclasses) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def IsNoHost(self):\n if self.no_host:\n return True\n return any([node.no_host for node in self.GetAncestorGroups()])",
"def is_opaque(self, classobj):\n try:\n return self.instance_vars[classobj] == []\n except KeyError:\n return False",
"def has_ghosts(self):\n... | [
"0.6732368",
"0.61149806",
"0.60162634",
"0.598662",
"0.5910872",
"0.57612085",
"0.5761027",
"0.5724565",
"0.57139426",
"0.56720996",
"0.56686395",
"0.5650766",
"0.5641392",
"0.56388974",
"0.5596937",
"0.55439645",
"0.55356926",
"0.5530277",
"0.55288005",
"0.5514988",
"0.5490... | 0.66115427 | 1 |
Returns the integration test for this hostclass, or None if none exists | def get_integration_test(self, hostclass):
return (hostclass in self._hostclasses and
self._hostclasses[hostclass].get("integration_test")) or None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_test(self,test_id):\n for test in self.suite.get_tests():\n if test.id == test_id:\n return test\n return None",
"def GetHWTestSuite(self):\n hw_tests = self._run.config['hw_tests']\n if not hw_tests:\n # TODO(milleral): Add HWTests back to lumpy-chrome-... | [
"0.6346583",
"0.6162359",
"0.5884836",
"0.5876703",
"0.55224764",
"0.5468428",
"0.5372038",
"0.529812",
"0.52784747",
"0.52683514",
"0.5250328",
"0.52476835",
"0.5240323",
"0.5180137",
"0.51473355",
"0.51330215",
"0.51204187",
"0.5118088",
"0.5116481",
"0.50992554",
"0.508809... | 0.8695572 | 0 |
Promote AMI to specified stage. And, conditionally, make executable by production account if ami is staged as tested. | def _promote_ami(self, ami, stage):
prod_baker = self._disco_bake.option("prod_baker")
promote_conditions = [
stage == "tested",
prod_baker,
ami.tags.get("baker") == prod_baker,
]
try:
self._disco_bake.promote_ami(ami, stage)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stage(self, stage: osbuild.Stage):",
"def deploy():\n stage(branch='live', role='live')",
"def setup(self, stage: Optional[str] = None) -> None:",
"def deploy():\n test()\n if not env.is_staging:\n backup()\n prepare()\n restart_api()",
"def Stage(self, descriptor, app_dir, runtim... | [
"0.600044",
"0.58983445",
"0.5597183",
"0.55506766",
"0.55401236",
"0.5401714",
"0.5389094",
"0.53601116",
"0.5331389",
"0.52924347",
"0.526997",
"0.52426094",
"0.5238283",
"0.5174726",
"0.5095269",
"0.5092394",
"0.50896496",
"0.5085712",
"0.5071455",
"0.50698596",
"0.5068133... | 0.7794168 | 0 |
Line is correctlt split and missing/corrupetd fields are checked. | def test_read_line(self):
expected_data = ['\"lu, jr\"','ming-yuan','\"DRUG,1\"',135.999,True,3]
input_string = '001,\"LU, JR\",MING-YUAN,\"DRUG,1\",135.999\n'
data = read_line(input_string)
self.assertEqual(expected_data[0],data[0])
self.assertEqual(expected_data[1],data[1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_Lines(self):\n\n pass",
"def check_record(idline,nclline,sepline,qualiline):\n return check_idline(idline) and check_sepline(sepline)",
"def is_line(self): \n return False",
"def check_line(self):\n if not self.hosts and not self.line:\n self.msg(\"There is... | [
"0.68945944",
"0.65980923",
"0.64360386",
"0.64280456",
"0.640811",
"0.6315471",
"0.62812597",
"0.6233146",
"0.61786985",
"0.617687",
"0.6170383",
"0.61697614",
"0.6118626",
"0.6044029",
"0.6039419",
"0.6007905",
"0.60070646",
"0.6002585",
"0.5974007",
"0.5965619",
"0.5962297... | 0.6924609 | 0 |
Unique drug list dict is correctly returned. | def test_get_unique_drug_list(self):
dict1 = self.test_dict
dict2 = get_unique_drug_list(self.test_sorted_tuple)
self.assertEqual(dict1, dict2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_drugs(self):\n if self.results is not None:\n return tuple(self.results['drug'].unique())",
"def _get_unique_genres(connection):\n print('---Getting unique genres---')\n genreDict = {}\n cursor = connection.cursor()\n cursor.execute(\"SELECT * FROM shared_genres;\")\n ... | [
"0.6729187",
"0.5912013",
"0.57591486",
"0.5738331",
"0.5666848",
"0.5649718",
"0.5634769",
"0.562001",
"0.56132656",
"0.5601305",
"0.55995375",
"0.55618244",
"0.55507255",
"0.5541687",
"0.5520323",
"0.5516712",
"0.5491589",
"0.54879695",
"0.54779065",
"0.54644716",
"0.545142... | 0.68579596 | 0 |
Total cost of each drug is correct. | def test_get_total_cost_each_drug(self):
list1 = self.test_total_cost_each_drug
list2 = get_total_cost_each_drug(self.test_sorted_tuple, self.test_dict)
self.assertEqual(list1, list2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cost(self) -> float:",
"def tablecost(self):\n subtotal_getter = operator.attrgetter(\"subtotal\")\n\n cost = 0.0\n\n cost += sum(map(subtotal_getter, self.materials))\n cost += sum(map(subtotal_getter, self.processes))\n cost += sum(map(subtotal_getter, self.fasteners))\n ... | [
"0.7039642",
"0.68268335",
"0.6784941",
"0.67635846",
"0.6760325",
"0.66375047",
"0.66135275",
"0.65899247",
"0.65713847",
"0.6541224",
"0.6456955",
"0.6456513",
"0.6444531",
"0.6374481",
"0.6351378",
"0.63261276",
"0.6230316",
"0.6212625",
"0.6205208",
"0.6195797",
"0.618874... | 0.68602717 | 1 |
Checks if a string is a permutation of a palindrome by populating a map and counting the occurrences of letters. O(N) | def is_palindrome_permutation(string):
letter_to_count = dict()
for letter in string:
letter_to_count[letter] = letter_to_count.get(letter, 0) + 1
residual = 0
for count in letter_to_count.values():
residual += count % 2
# there are can be a single letter with an odd character co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palindrom_permutation(string: str):\n string = re.sub(r'\\W+', '', string.lower())\n\n chars = dict()\n for c in string:\n chars[c] = chars[c] + 1 if c in chars else 1\n\n almost_not_okey = False\n for val in chars.values():\n if val % 2 == 1:\n if not almost_not_okey:\n... | [
"0.79791397",
"0.7845905",
"0.7619931",
"0.7566796",
"0.72823507",
"0.7219113",
"0.72079515",
"0.71518576",
"0.7108441",
"0.6992611",
"0.69697845",
"0.6915593",
"0.6882766",
"0.6821809",
"0.6709572",
"0.6699704",
"0.65028495",
"0.6462751",
"0.645578",
"0.64369947",
"0.6321017... | 0.81786555 | 0 |
Compute the cycle consistenty loss. L_cyc = lamA [Expectation of L1_norm(F(G(A)) A)] + lamb [Expectation of L1_norm(G(F(B)) B)] | def __cycle_consistency_loss(self, reconstructedA, reconstructedB):
loss = self.opt.lamA * tf.reduce_mean(tf.abs(reconstructedA - self.realA)) + \
self.opt.lamB * tf.reduce_mean(tf.abs(reconstructedB - self.realB))
return loss | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cycle_consistency_loss(self, ra, rb, fa, fb):\n with tf.device(\"/gpu:0\"):\n backward_loss = tf.reduce_mean(tf.abs(self.Ga2b(fa) - rb))\n with tf.device(\"/gpu:1\"):\n forward_loss = tf.reduce_mean(tf.abs(self.Gb2a(fb) - ra))\n loss = self.lambda1 * forward_loss ... | [
"0.661372",
"0.61719704",
"0.60370505",
"0.5863777",
"0.569097",
"0.5663334",
"0.56262916",
"0.5592393",
"0.54651314",
"0.5444343",
"0.53959835",
"0.5394466",
"0.53734285",
"0.53725505",
"0.5371813",
"0.5362057",
"0.5342894",
"0.53264534",
"0.5277725",
"0.5275031",
"0.5255691... | 0.6959504 | 0 |
Compute the identity loss. L_idt = lamda_idt [lamA [Expectation of L1_norm(F(A) A)] + lamB [Expectation of L1_norm(G(B) B)]] | def __identity_loss(self, identA, identB):
loss = self.opt.lambda_ident * (self.opt.lamA * tf.reduce_mean(tf.abs(identB - self.realA)) + \
self.opt.lamB * tf.reduce_mean(tf.abs(identA - self.realB)))
return loss | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def l1_loss(inputs, reduction='mean', **kwargs):\n args = ArgHelper.parse(locals())\n args['reduction'] = reduction.upper()\n op_lib = loss_ops_lib.L1Loss\n if context.executing_eagerly():\n return op_lib \\\n .instantiate(reduction=args['reduction']) \\\n .apply(inputs)\n ... | [
"0.5652646",
"0.5454709",
"0.5431929",
"0.5346413",
"0.52700704",
"0.5245193",
"0.5241548",
"0.5189512",
"0.51814455",
"0.51782507",
"0.51747054",
"0.5168681",
"0.5149222",
"0.51125103",
"0.510106",
"0.50966114",
"0.5086483",
"0.50756854",
"0.50619715",
"0.5041158",
"0.502635... | 0.69998527 | 0 |
Parses a tensorflow.SequenceExample into an image and caption. | def parse_sequence_example(serialized, image_id, image_feature, caption_feature):
context, sequence = tf.parse_single_sequence_example(
serialized,
context_features={
image_id : tf.FixedLenFeature([], dtype=tf.int64),
image_feature: tf.FixedLenFeature([], dtype=tf.string)
}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_sequence_example(serialized, image_feature, caption_feature):\n\tcontext, sequence = tf.parse_single_sequence_example(\n\t\t\tserialized,\n\t\t\tcontext_features={\n\t\t\t\t\timage_feature: tf.FixedLenFeature([], dtype=tf.string)\n\t\t\t},\n\t\t\tsequence_features={\n\t\t\t\t\tcaption_feature: tf.FixedLe... | [
"0.7773432",
"0.70653176",
"0.6706283",
"0.66781205",
"0.66210777",
"0.6502138",
"0.63294804",
"0.63211375",
"0.62616134",
"0.62233996",
"0.6201436",
"0.6195922",
"0.6186161",
"0.6184599",
"0.6164636",
"0.6148699",
"0.6147658",
"0.614749",
"0.6147216",
"0.61331445",
"0.609978... | 0.7657589 | 1 |
Run demo, testing whether input words are beer related. | def run_demo():
while True:
embeddings = beer_emb.embed_doc(input("Test if words are beer-related: "),
word_filter=False)
for word_vec in embeddings:
print(is_beer_related(word_vec)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_run():\r\n print(count_words(\"cat bat mat cat bat cat\", 3))\r\n print(count_words(\"betty bought a bit of butter but the butter was bitter\", 3))",
"def test_run():\n print count_words(\"cat bat mat cat bat cat\", 3)\n print count_words(\"betty bought a bit of butter but the butter was bit... | [
"0.64361274",
"0.63639456",
"0.63639456",
"0.61933094",
"0.5985079",
"0.59168476",
"0.58774954",
"0.58620715",
"0.58588994",
"0.5743201",
"0.57326597",
"0.57213676",
"0.5714051",
"0.57126486",
"0.5685293",
"0.56775856",
"0.56722903",
"0.56616175",
"0.56303006",
"0.5619225",
"... | 0.7582199 | 0 |
Load parsed beautifulsoup object holding the full html | def load_parsed(self):
with open(self.fname) as f:
self.parsed = BeautifulSoup(f.read(), features="html.parser") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_website(self):\n# r = urllib.request.urlopen(self.url).read()\n r = requests.get(self.url).content \n self.soup = bs(r, \"lxml\")",
"def load_page(self) -> bs4.BeautifulSoup:\n\n res = requests.get(self.url)\n\n res.raise_for_status()\n return bs4.Beautif... | [
"0.7414255",
"0.7408412",
"0.7246797",
"0.7061659",
"0.6892907",
"0.68442833",
"0.6834316",
"0.6795834",
"0.6783969",
"0.67211264",
"0.67171395",
"0.6716718",
"0.66845864",
"0.6660223",
"0.660617",
"0.65939754",
"0.6587271",
"0.6559653",
"0.65470797",
"0.6519594",
"0.65095526... | 0.7917264 | 0 |
Iterator over maintext paragraph elements; this includes footnotes. | def _paragraphs_raw(self):
for par in self.parsed.find_all("p")[self.PAR_START:]:
yield par | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linked_text_paragraphs(self):\n for par in self._main_paragraphs_raw():\n par_links = par.find_all('a')\n if len(par_links) == 0:\n self.main_count += len(par.text)\n yield par.text\n else:\n for el in par.contents:\n ... | [
"0.70568925",
"0.6538393",
"0.630119",
"0.6105424",
"0.59029144",
"0.5857844",
"0.56422466",
"0.561061",
"0.5597017",
"0.5584193",
"0.55805284",
"0.55002755",
"0.5490439",
"0.5486235",
"0.5449823",
"0.5444187",
"0.5435644",
"0.5427534",
"0.5414275",
"0.54038227",
"0.5385818",... | 0.6565161 | 1 |
Checks whether an element contains footnote text. | def is_footnote_text(self, par):
return (par is not None) and ("foot" in par.attrs.get("class", [])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_footnote(self, par):\n if par.find_next_sibling('p') is None:\n return False\n return self.is_footnote_text(par) or self.is_footnote_link(par)",
"def is_footnote_link(self, par):\n return self.is_footnote_text(par.find_next_sibling('p'))",
"def is_footnote(self):\n ... | [
"0.72341335",
"0.688278",
"0.6498541",
"0.6382326",
"0.61090255",
"0.6085547",
"0.59022486",
"0.5810465",
"0.5732255",
"0.5724639",
"0.56633186",
"0.55054045",
"0.54965115",
"0.5481354",
"0.54613525",
"0.5442589",
"0.5437752",
"0.54305816",
"0.53904307",
"0.5370518",
"0.53681... | 0.80490977 | 0 |
Checks whether an element is a link adjacent to footnote text. | def is_footnote_link(self, par):
return self.is_footnote_text(par.find_next_sibling('p')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_footnote(self, par):\n if par.find_next_sibling('p') is None:\n return False\n return self.is_footnote_text(par) or self.is_footnote_link(par)",
"def is_link(s):\n return (len(s) == 2 and is_link(s[1])) or s == empty",
"def check_link(self, link, links_para):\n href =... | [
"0.69997984",
"0.6757967",
"0.6695195",
"0.66264176",
"0.66264176",
"0.66264176",
"0.63451207",
"0.6296661",
"0.6101461",
"0.60751194",
"0.604954",
"0.6045755",
"0.60173523",
"0.5861832",
"0.5820362",
"0.5799617",
"0.5760772",
"0.57050264",
"0.5704481",
"0.5701879",
"0.569843... | 0.8036169 | 0 |
Checks whether a paragraph element is part of a footnote. | def is_footnote(self, par):
if par.find_next_sibling('p') is None:
return False
return self.is_footnote_text(par) or self.is_footnote_link(par) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_footnote_text(self, par):\n return (par is not None) and (\"foot\" in par.attrs.get(\"class\", []))",
"def is_footnote_link(self, par):\n return self.is_footnote_text(par.find_next_sibling('p'))",
"def is_footnote(self):\n return self.style['float'] == 'footnote'",
"def check_mark... | [
"0.8045934",
"0.7436927",
"0.6865161",
"0.60696536",
"0.60482085",
"0.6026402",
"0.6006918",
"0.57114613",
"0.56973517",
"0.56481415",
"0.5624542",
"0.55489916",
"0.5463017",
"0.53871185",
"0.52857167",
"0.5267883",
"0.5256443",
"0.5246128",
"0.5203835",
"0.5170078",
"0.51535... | 0.79070187 | 1 |
Walk over pararaphs in the main text. If a footnote link is found, jump to that paragraph, then back to the main text. | def linked_text_paragraphs(self):
for par in self._main_paragraphs_raw():
par_links = par.find_all('a')
if len(par_links) == 0:
self.main_count += len(par.text)
yield par.text
else:
for el in par.contents:
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segment_paragraphs(root_el, cites=[]):\n from capdb.models import Citation\n\n last_el_ends_mid_sentence = False\n join_with_last_el = False\n html_to_prepend_to_next_el = ''\n\n # build a lookup like {\"935 F.3d\": 1, \"123 Mass.\": 2}\n reporter_indexes = {}\n for i, cite in enumerate(Ci... | [
"0.5886465",
"0.58725065",
"0.58705807",
"0.57472676",
"0.56360775",
"0.55975014",
"0.5573705",
"0.5540514",
"0.54371405",
"0.54029816",
"0.53338504",
"0.53178537",
"0.5315798",
"0.5282773",
"0.52491987",
"0.52362645",
"0.5195637",
"0.5168886",
"0.513893",
"0.51377296",
"0.51... | 0.6464983 | 0 |
Material saver. Saves material and their properties the JSON file for type building elements. If the Project parent is set, it automatically saves it to the file given in Project.data. Alternatively you can specify a path to a file with Materials. If this file does not exist, a new file is created. | def save_material(material, data_class):
data_class.material_bind["version"] = "0.7"
add_to_json = True
warning_text = ("Material with same name and same properties already "
"exists in JSON, consider this material or revising your "
"properties")
for id, check ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_material(filename, mat):\n out = np.array([mat.wav, mat.eps.real, mat.eps.imag,\n mat.mu.real, mat.mu.imag]).T\n header = \"Wavelength\\teps_real\\teps_imag\\tmu_real\\tmu_imag\"\n miepy.array_io.save(filename, out, header=header)",
"def WriteStructuralMaterialsjson(save_path... | [
"0.57051945",
"0.55286336",
"0.54615587",
"0.53826904",
"0.5350502",
"0.53496337",
"0.5319556",
"0.52859074",
"0.5285472",
"0.52815086",
"0.5229431",
"0.5202984",
"0.5185666",
"0.5141686",
"0.5140259",
"0.513041",
"0.51060146",
"0.5105606",
"0.50921017",
"0.5083165",
"0.50725... | 0.65841603 | 0 |
Create a new Settings, reading from a default location for the given domain (~/Library/Preferences/%s.plist). | def __init__(self, domain='com.markfickett.gors'):
settingsDir = os.path.expanduser(self.__SETTINGS_DIR)
if not os.path.isdir(settingsDir):
os.makedirs(settingsDir)
self.__settingsFileName = os.path.join(settingsDir,
domain + '.plist')
if os.path.isfile(self.__settingsFileName):
self.__settings = plist... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings_create(ctx):\n # Choose where and whether to save the configuration file.\n path = ctx.obj['load_path']\n if path:\n click.confirm(\n 'A settings file already exists. Continuing will override it. '\n 'Do you want to continue?',\n abort=True,\n )\... | [
"0.5657144",
"0.548896",
"0.5319334",
"0.5285291",
"0.52768016",
"0.5255273",
"0.5222265",
"0.5218223",
"0.5189833",
"0.5173989",
"0.5170184",
"0.51397663",
"0.513596",
"0.5086622",
"0.50810987",
"0.50810987",
"0.50761354",
"0.5024908",
"0.5006228",
"0.5000491",
"0.5000396",
... | 0.7057614 | 0 |
Get the full name of the given keyName under the current group. If extant is True, only return extant keys; otherwise return None. | def __getKey(self, keyNameRaw, extant=True):
fullKeyName = self.__DELIMITER.join(
self.__currentGroupNames + [str(keyNameRaw)])
if extant and (fullKeyName not in self.__settings):
return None
return fullKeyName | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_name(self) -> Optional[str]:\n return pulumi.get(self, \"key_name\")",
"def get_name(self):\n return self.key().name().split(':', 1)[1]",
"def extract_key_name(self):\n # quick and dirty regex parsing..\n # consider using gnupg.\n _, out, _ = self.as_user('/usr/bin/gp... | [
"0.61867285",
"0.6151179",
"0.59994215",
"0.59087443",
"0.59087443",
"0.58050305",
"0.57887447",
"0.57743907",
"0.57119745",
"0.5711618",
"0.56672543",
"0.5649241",
"0.5592001",
"0.55778885",
"0.55366206",
"0.55205065",
"0.55190045",
"0.55060714",
"0.55060714",
"0.55060714",
... | 0.77827585 | 0 |
This function gets the total occurrences of words and syllables in the original Unicode Garshana corpus. To do this, it opens a .csv file with utf16 encoding, and splits on commans, expecting the line of sumerian text to be in the 8th column. Filters annotations from each line, and tracks the occurrence of each word an... | def get_counts(data):
word_count = {}
syll_count = {}
infile = data.corpus
try:
open_file = codecs.open(infile, 'r', encoding='utf-16')
for line in open_file:
line = line.lower()
# Remove tablet indexing info and line numbers. Grab only text data
li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_word_counts(filename):\n raw_rows = csv_rows(filename)\n word_counts = defaultdict(lambda: 0)\n\n for line_number, raw_row in enumerate(raw_rows, 2):\n count = int(raw_row[\"count\"])\n ipa = raw_row[\"IPA\"]\n if '*' in ipa:\n continue\n\n # Fixes random badness.. hopefully doesn't hi... | [
"0.6335053",
"0.57268775",
"0.57179636",
"0.5714977",
"0.57052946",
"0.5632471",
"0.56277466",
"0.56243765",
"0.5612738",
"0.5593558",
"0.55885386",
"0.5571546",
"0.5560268",
"0.55578226",
"0.55549335",
"0.55408674",
"0.55253506",
"0.5510573",
"0.55039716",
"0.5502862",
"0.55... | 0.65279776 | 0 |
Returns the accounting period that is currently valid. Valid is an accounting_period when the current date lies between begin and end of the accounting_period | def get_current_valid_accounting_period():
current_valid_accounting_period = None
for accounting_period in AccountingPeriod.objects.all():
if accounting_period.begin < date.today() and accounting_period.end > date.today():
return accounting_period
if not current_valid... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCurrentValidAccountingPeriod():\n currentValidAccountingPeriod = None\n for accountingPeriod in AccountingPeriod.objects.all():\n if accountingPeriod.begin < date.today() and accountingPeriod.end > date.today():\n return accountingPeriod\n if currentValidAccoun... | [
"0.82862264",
"0.6872075",
"0.65232825",
"0.6370569",
"0.6290718",
"0.60823673",
"0.6040515",
"0.6040515",
"0.6040515",
"0.6040515",
"0.6040515",
"0.6040515",
"0.6040515",
"0.6040515",
"0.6018042",
"0.6012301",
"0.5940794",
"0.59097856",
"0.5859212",
"0.5821298",
"0.5755713",... | 0.8423247 | 0 |
Transform mp3 file into wav format calling bash and using mpg123 or ffmpeg. | def mp3_to_wav(mp3_file, wav_file, encoder='mpg123'):
if encoder == 'mpg123':
bash_command = ['mpg123', '-w', wav_file, '--mono', mp3_file]
else:
bash_command = ['ffmpeg', '-i', mp3_file, wav_file]
subprocess.run(bash_command) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mp3_to_wav(show_progress=True):\n\n # Define a devnull var to supress subprocess output\n devnull = open(os.devnull, 'w')\n\n # Get a list of the filepath for each of the mp3 files in each subdirectory of data/fma_small\n file_list = glob.glob('./../data/fma_small/*/*.mp3')\n\n # Get the number ... | [
"0.73525465",
"0.7225452",
"0.7119044",
"0.70570403",
"0.67239785",
"0.6696764",
"0.6579686",
"0.6547333",
"0.6539131",
"0.6505683",
"0.6481485",
"0.64209044",
"0.6362076",
"0.6354701",
"0.632691",
"0.6275299",
"0.62359387",
"0.6216278",
"0.6215746",
"0.61728823",
"0.6155799"... | 0.8660163 | 0 |
Limit arrays of frequency and features by maximum frequency and bottom frequency. | def limit_by_freq(freq, features, upper_limit, lower_limit=None):
# Copy into arrays, in order to apply mask
freq = np.array(freq, dtype=np.float)
features = np.array(features, dtype=np.float)
# Mask for bottom limit
if lower_limit is not None:
bottom_mask = freq >= lower_limit
featu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findMaximal(freqSet):",
"def __restrict_features_freq(self, min_count=1):\n col_idx = self.X.tocsc().nonzero()[1]\n counter = np.bincount(col_idx)\n print(\"Counter:\", len(counter))\n include_cols = np.where(counter > min_count)[0]\n return include_cols",
"def fit_featur... | [
"0.6321469",
"0.5905518",
"0.5899971",
"0.5845656",
"0.5827781",
"0.5711425",
"0.55240804",
"0.5505938",
"0.54641736",
"0.5451525",
"0.5440867",
"0.5408901",
"0.5367295",
"0.53634137",
"0.5352045",
"0.5324692",
"0.53187746",
"0.53122324",
"0.5303038",
"0.52815557",
"0.5275447... | 0.72728205 | 0 |
Check if song is already transformed into temp. | def check_wav(song, source_folder, temp_folder, encoder='mpg123'):
# Name of files
song_name, extension = os.path.splitext(song)
mp3_file = os.path.join(source_folder, song)
if '.wav' != extension:
wav_file = os.path.join(temp_folder, song_name + '.wav')
try:
if not os.path.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isTemp(self,object):\n return (object in self.tempObjects)",
"def test_transform_track_album_based_on_album_title_no_match_album(self):\n track = Track(artist='Artist', album='Album 3', title='Title',\n tracknum=1, seconds=60)\n transform = Transform(1,\n cond_album... | [
"0.56140214",
"0.54819727",
"0.542196",
"0.5414857",
"0.5397536",
"0.5393968",
"0.5390524",
"0.53878826",
"0.53857505",
"0.5385733",
"0.5346858",
"0.5340154",
"0.53382695",
"0.5315191",
"0.5310992",
"0.53011787",
"0.52986276",
"0.5296976",
"0.5272015",
"0.5269272",
"0.5257539... | 0.5619942 | 0 |
Return the free space in Gigabits. | def get_free_gb():
mem_info = get_mem_info()
free_gb = float(mem_info['MemAvailable'].value) / 10**6
return free_gb | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cgts_vg_free_space():\n\n try:\n # Determine space in cgts-vg in GiB\n vg_free_str = subprocess.check_output( # pylint: disable=not-callable\n ['vgdisplay', '-C', '--noheadings', '--nosuffix',\n '-o', 'vg_free', '--units', 'g', 'cgts-vg'],\n close_fds=Tru... | [
"0.7192137",
"0.6909616",
"0.690619",
"0.68786997",
"0.6813705",
"0.67277247",
"0.66669893",
"0.6577275",
"0.6504887",
"0.65012854",
"0.64604944",
"0.6451814",
"0.6396979",
"0.63525146",
"0.63032967",
"0.6267119",
"0.6259522",
"0.62487036",
"0.6246622",
"0.62347066",
"0.62068... | 0.75012624 | 0 |
True if it can't run, else otherwise. Condition is Gb of RAM memory available. | def ram_condition(min_gb=3):
return get_free_gb() < min_gb | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_if_sufficient_memory():\n percent_memory = psutil.virtual_memory().percent\n if percent_memory > 75:\n raise ValueError('Please use a device with more CPU ram or a smaller dataset')",
"def memory_check(self) -> bool:\n available_bytes = psutil.virtual_memory().available\... | [
"0.7269116",
"0.68143415",
"0.66817755",
"0.64842796",
"0.6442835",
"0.6359018",
"0.6243431",
"0.6243431",
"0.62134373",
"0.61970484",
"0.58983666",
"0.58968914",
"0.5888447",
"0.5873215",
"0.58724576",
"0.57852805",
"0.5777731",
"0.57357985",
"0.57344395",
"0.5731109",
"0.56... | 0.6852558 | 1 |
The camera that took the image | def camera(self):
return self.__camera | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camera(self):\n return self._camera",
"def camera(self):\n return self._camera",
"def query_camera(self):\n ok, orig_pic = self.vs.read() # Read video stream\n if ok: # If no errors\n orig_pic = imutils.rotate(orig_pic, angle=self.camera_rot)\n curr_pic =... | [
"0.8029401",
"0.8029401",
"0.7391439",
"0.7336508",
"0.7180209",
"0.711195",
"0.711195",
"0.71046424",
"0.70813036",
"0.70528156",
"0.69937193",
"0.69860065",
"0.69809467",
"0.68731916",
"0.6841381",
"0.6825675",
"0.68190277",
"0.680215",
"0.6788457",
"0.6687622",
"0.66858554... | 0.81577206 | 0 |
r""" Property for the exterior orientation parameters | def exteriorOrientationParameters(self):
return self.__exteriorOrientationParameters | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orient(self):\n return self.__ph.get('orient', PH_ORIENT_HORZ)",
"def get_orientation(self):\r\n return self.__orientation",
"def Orientation(self, *args):\n return _Adaptor3d.Adaptor3d_TopolTool_Orientation(self, *args)",
"def orientation(self):\n return self._orientation",
... | [
"0.61678284",
"0.61665916",
"0.61640745",
"0.60078",
"0.60078",
"0.5891339",
"0.5885623",
"0.58542037",
"0.5838997",
"0.5836636",
"0.5822891",
"0.58147955",
"0.5795377",
"0.57695895",
"0.57024115",
"0.56947505",
"0.56763643",
"0.5612986",
"0.5593346",
"0.5587369",
"0.5578711"... | 0.80023855 | 0 |
The rotation matrix of the image Relates to the exterior orientation | def rotationMatrix(self):
R = Compute3DRotationMatrix(self.exteriorOrientationParameters[3], self.exteriorOrientationParameters[4],
self.exteriorOrientationParameters[5])
return R | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rotation_angle(self, image):\n \n # TODO: Make real functionality\n return 0",
"def rotation_matrix(self):\n return self.affine_matrix[0:3][:, 0:3]",
"def rotation(self):\n\t\treturn self.piv.a.rotate.v",
"def matrix(self):\n return self._rotation",
"def rotation(... | [
"0.7759922",
"0.77279866",
"0.7530842",
"0.7502491",
"0.7206852",
"0.71904266",
"0.7162689",
"0.71563435",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7058655",
"0.7005358",
"0.6981667",
... | 0.77768993 | 0 |
r""" Compute inner orientation parameters | def ComputeInnerOrientation(self, imagePoints):
# implementing observation vectors
imagePoints = imagePoints.reshape(np.size(imagePoints), 1)
fMarks = self.camera.fiducialMarks.reshape(np.size(self.camera.fiducialMarks), 1)
n = int(len(imagePoints)) # number of observations
u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ComputeInverseInnerOrientation(self):\n a0 = self.innerOrientationParameters[0]\n b0 = self.innerOrientationParameters[1]\n a1 = self.innerOrientationParameters[2]\n a2 = self.innerOrientationParameters[3]\n b1 = self.innerOrientationParameters[4]\n b2 = self.innerOrie... | [
"0.687762",
"0.6436624",
"0.58278096",
"0.578275",
"0.57705504",
"0.5755263",
"0.5649262",
"0.5623161",
"0.5620293",
"0.5616361",
"0.55939484",
"0.55838054",
"0.5497484",
"0.54887134",
"0.54881567",
"0.54828835",
"0.54536176",
"0.5438182",
"0.5438182",
"0.54221433",
"0.541117... | 0.7024464 | 0 |
Computes the geometric inner orientation parameters | def ComputeGeometricParameters(self):
# extracting inner orientation params
a0 = self.innerOrientationParameters[0]
b0 = self.innerOrientationParameters[1]
a1 = self.innerOrientationParameters[2]
a2 = self.innerOrientationParameters[3]
b1 = self.innerOrientationParameters... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def magnitude_orientation(gx, gy):\n \n magnitude = np.sqrt(gx**2 + gy**2)\n orientation = (np.arctan2(gy, gx) * 180 / np.pi) % 180\n \n return magnitude, orientation",
"def ComputeInverseInnerOrientation(self):\n a0 = self.innerOrientationParameters[0]\n b0 = self.... | [
"0.6358747",
"0.6289955",
"0.626587",
"0.6029137",
"0.5908361",
"0.5868645",
"0.5784191",
"0.57483953",
"0.5706465",
"0.5689375",
"0.5624956",
"0.5610132",
"0.5609869",
"0.560806",
"0.5597778",
"0.5587196",
"0.5573857",
"0.5553297",
"0.55513024",
"0.55361223",
"0.5525677",
... | 0.740137 | 0 |
Computes the parameters of the inverse inner orientation transformation | def ComputeInverseInnerOrientation(self):
a0 = self.innerOrientationParameters[0]
b0 = self.innerOrientationParameters[1]
a1 = self.innerOrientationParameters[2]
a2 = self.innerOrientationParameters[3]
b1 = self.innerOrientationParameters[4]
b2 = self.innerOrientationPara... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse(self):\n def inv(v):\n v[0], v[1] = v[1] , v[0]\n for v in [self.point1 , self.pointN , self.unitv, self.normalv]:\n inv(v)\n\n self.points = numpy.roll(self.points,1,axis=1)\n self.a, self.b = self.b, self.a\n self.angle = numpy.arccos( self.uni... | [
"0.63808596",
"0.6343662",
"0.63060564",
"0.6252362",
"0.61781716",
"0.61693305",
"0.61612785",
"0.61262125",
"0.61208826",
"0.6098615",
"0.609339",
"0.60388464",
"0.59626293",
"0.59568155",
"0.5946826",
"0.5945765",
"0.59148675",
"0.5901364",
"0.5894338",
"0.5879606",
"0.586... | 0.7558201 | 0 |
Transforms camera points to image points | def CameraToImage(self, cameraPoints):
# setting up the required matrices
a0 = self.innerOrientationParameters[0]
b0 = self.innerOrientationParameters[1]
a1 = self.innerOrientationParameters[2]
a2 = self.innerOrientationParameters[3]
b1 = self.innerOrientationParameters[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imageFromCamera(self, points, hide_backpoints=True):\n points = np.array(points)\n # set small z distances to 0\n points[np.abs(points[..., 2]) < 1e-10] = 0\n # transform the points\n with np.errstate(divide='ignore', invalid='ignore'):\n transformed_points = np.ar... | [
"0.75200397",
"0.7221418",
"0.72199947",
"0.71426326",
"0.71409965",
"0.7138931",
"0.7127518",
"0.7100937",
"0.70733917",
"0.6988374",
"0.69729286",
"0.69044685",
"0.6830623",
"0.6829222",
"0.6822007",
"0.6778279",
"0.67171186",
"0.6710748",
"0.66177326",
"0.661222",
"0.65576... | 0.73480624 | 1 |
Compute exterior orientation parameters. This function can be used in conjecture with ``self.__ComputeDesignMatrix(groundPoints)`` and ``self__ComputeObservationVector(imagePoints)`` | def ComputeExteriorOrientation(self, imagePoints, groundPoints, epsilon):
# cameraPoints = self.ImageToCamera(imagePoints)
cameraPoints = imagePoints
self.__ComputeApproximateVals(cameraPoints, groundPoints)
l0 = self.__ComputeObservationVector(groundPoints.T)
l0 = np.reshape(l0,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exteriorOrientationParameters(self):\n return self.__exteriorOrientationParameters",
"def ComputeInnerOrientation(self, imagePoints):\n # implementing observation vectors\n imagePoints = imagePoints.reshape(np.size(imagePoints), 1)\n\n fMarks = self.camera.fiducialMarks.reshape(n... | [
"0.71254003",
"0.68282026",
"0.6420376",
"0.61255026",
"0.61024475",
"0.5787343",
"0.57387304",
"0.5717728",
"0.5698031",
"0.567763",
"0.5626359",
"0.55450577",
"0.5525408",
"0.5507461",
"0.54807997",
"0.54278624",
"0.5404268",
"0.53900427",
"0.5351375",
"0.5299402",
"0.52918... | 0.69500554 | 1 |
Transforming ground points to image points | def GroundToImage(self, groundPoints):
X0 = float(self.exteriorOrientationParameters[0])
Y0 = float(self.exteriorOrientationParameters[1])
Z0 = float(self.exteriorOrientationParameters[2])
xp = float(self.camera.principalPoint[0])
yp = float(self.camera.principalPoint[1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GroundToImage_RzRyRz(self, groundPoints):\n X0 = float(self.exteriorOrientationParameters[0])\n Y0 = float(self.exteriorOrientationParameters[1])\n Z0 = float(self.exteriorOrientationParameters[2])\n\n xp = float(self.camera.principalPoint[0])\n yp = float(self.camera.princip... | [
"0.647679",
"0.6467655",
"0.6214912",
"0.61901563",
"0.61635965",
"0.60568637",
"0.6051804",
"0.6028781",
"0.60097945",
"0.5999861",
"0.5963049",
"0.59306324",
"0.5910674",
"0.5894894",
"0.5861491",
"0.5838941",
"0.58371437",
"0.5833094",
"0.58130443",
"0.58091205",
"0.580821... | 0.7286386 | 0 |
Transforming ground points to image points | def GroundToImage_RzRyRz(self, groundPoints):
X0 = float(self.exteriorOrientationParameters[0])
Y0 = float(self.exteriorOrientationParameters[1])
Z0 = float(self.exteriorOrientationParameters[2])
xp = float(self.camera.principalPoint[0])
yp = float(self.camera.principalPoint[1])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GroundToImage(self, groundPoints):\n X0 = float(self.exteriorOrientationParameters[0])\n Y0 = float(self.exteriorOrientationParameters[1])\n Z0 = float(self.exteriorOrientationParameters[2])\n\n xp = float(self.camera.principalPoint[0])\n yp = float(self.camera.principalPoint... | [
"0.7286386",
"0.6467655",
"0.6214912",
"0.61901563",
"0.61635965",
"0.60568637",
"0.6051804",
"0.6028781",
"0.60097945",
"0.5999861",
"0.5963049",
"0.59306324",
"0.5910674",
"0.5894894",
"0.5861491",
"0.5838941",
"0.58371437",
"0.5833094",
"0.58130443",
"0.58091205",
"0.58082... | 0.647679 | 1 |
Transforms Image point to a Ray in world system | def ImageToRay(self, imagePoints):
pass # delete after implementations | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pointToWorld( nImageX, nImageY, rDepth, rMaxX = 320, rMaxY = 240, rFieldOfViewX = 60, rFieldOfViewY = 40 ):\n # convert to [-0.5,0.5]\n rCenteredX = ( nImageX / rMaxX ) - 0.5;\n rCenteredY = ( nImageY / rMaxY ) - 0.5;",
"def project_to_image_plane(self, point_in_world, timestamp):\n\n camera_... | [
"0.69458926",
"0.6836335",
"0.633762",
"0.62048507",
"0.6087586",
"0.6003151",
"0.5976462",
"0.5972177",
"0.5914467",
"0.58434325",
"0.58393484",
"0.58110195",
"0.57184476",
"0.5707809",
"0.570757",
"0.5687363",
"0.5659299",
"0.56507516",
"0.5646074",
"0.5632133",
"0.5627521"... | 0.7174655 | 0 |
Generating grid of points biased by ppa (principal point delta) | def GeneratePointsImg(self, n, ppa):
x = np.linspace(0,self.camera.sensorSize,n)+ppa[0]
y = np.linspace(0,self.camera.sensorSize,n)+ppa[1]
return np.meshgrid(x, y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_pt(pt=None,):\n global dim\n mod_rand_pt = []\n\n for i_ in range(dim):\n for j_ in range(i_, dim):\n mod_rand_pt.append(pt[i_] * pt[j_])\n\n mod_rand_pt.append(1.)\n return mod_rand_pt",
"def projection_P(P_prime):\n sorted_prime = -np.sort(-P_prime, axis=1) # Des... | [
"0.60559386",
"0.59712946",
"0.59704006",
"0.595379",
"0.5917291",
"0.58962584",
"0.58279955",
"0.582432",
"0.5792295",
"0.57677454",
"0.5709391",
"0.5696328",
"0.56858194",
"0.56748235",
"0.5633881",
"0.5615407",
"0.56149656",
"0.560475",
"0.560267",
"0.5601162",
"0.5589663"... | 0.6255561 | 0 |
Description When is given a directory name that exist Expected Result Shows log that directory was found | def test_has_directory_log(self, check_fn_true, caplog):
#setup
records = caplog.records
has_directory = extractor.make_has_directory(os.path.isdir)
directory_path = "./data/observed"
#when
test1 = has_directory(directory_path)
#result
assert le... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_doesnt_have_directory_log(self, check_fn_false, caplog):\n\n #setup\n records = caplog.records\n has_directory = extractor.make_has_directory(os.path.isdir)\n directory_path = \"./data/tests\"\n \n #when\n test2 = has_directory(directory_path)\n\n #r... | [
"0.74612963",
"0.66516936",
"0.6648649",
"0.6637668",
"0.6592905",
"0.65451527",
"0.6507091",
"0.6476768",
"0.6445445",
"0.64397144",
"0.641731",
"0.6323137",
"0.6317305",
"0.6291415",
"0.6287829",
"0.6264551",
"0.62638617",
"0.62398607",
"0.6232754",
"0.6224753",
"0.62079227... | 0.7359447 | 1 |
Description When is given a directory name that doesnt exist Expected Result returns False | def test_doesnt_have_directory(self, check_fn_false):
# setup
has_directory = extractor.make_has_directory(os.path.isdir)
# when
test2 = has_directory("./data/tests")
# result
assert test2 is False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_dir_exist():\n if os.path.isdir(path_structure):\n return True\n else:\n return False",
"def __is_directory_name(filename):\n return filename[-1] == '/'",
"def is_valid_directory(args):\n if args.directory is not None:\n return True\n return False",
"def is_d... | [
"0.7637506",
"0.7587286",
"0.75317335",
"0.7509946",
"0.7493378",
"0.74204826",
"0.74024594",
"0.7333082",
"0.7327076",
"0.7321167",
"0.73203564",
"0.72724897",
"0.7250266",
"0.7245775",
"0.7242602",
"0.7218288",
"0.7178371",
"0.71603537",
"0.71599776",
"0.714316",
"0.7106386... | 0.7918296 | 0 |
Description When is given a directory name that doesnt exist Expected Result Shows log that directory wasn't found | def test_doesnt_have_directory_log(self, check_fn_false, caplog):
#setup
records = caplog.records
has_directory = extractor.make_has_directory(os.path.isdir)
directory_path = "./data/tests"
#when
test2 = has_directory(directory_path)
#result
ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testNoSuchDirectory(self):\n\n self.assertRaises(OSError,\n parse_package,\n \"no_such_directory\")",
"def test_ensure_dir_exists(self):\n pass",
"def check_dir(directory: str, err_string: str) -> None:\n if not pathlib.Path(directory).is_d... | [
"0.7097761",
"0.69815487",
"0.6958049",
"0.69345635",
"0.68600756",
"0.6768691",
"0.67403984",
"0.67001784",
"0.66480124",
"0.65875924",
"0.6568089",
"0.6561216",
"0.6556799",
"0.6535799",
"0.6534498",
"0.6532836",
"0.6514325",
"0.65090376",
"0.64824975",
"0.6481356",
"0.6477... | 0.7614185 | 0 |
Description When is given a directory path that has forecast as parent folder and csv file with desired name Expected Result returns dictionary with right data | def test_forecast_folder_path(self):
#setup
filepath = ".data/forecast/Kano-KN_-9.09_7.39.json"
expected_result = {
"type": "forecast",
"city": "Kano",
"state": "KN",
"coordinates": ['-9.09', '7.39'],
"forecast": {}
}
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_isys_output(path_to_csv,directory_details):\n isys_results=open(path_to_csv).readlines()\n partial_paths_list=[]\n #below we are starting with the second row because the first row has the column\n # headings \n start=1\n for item in isys_results[start:]:\n partial_path=item.split... | [
"0.60329616",
"0.5951354",
"0.5933117",
"0.59185493",
"0.5806007",
"0.57351774",
"0.5663706",
"0.5627654",
"0.562072",
"0.55951595",
"0.55628073",
"0.55555654",
"0.5554841",
"0.5539798",
"0.5537601",
"0.5528273",
"0.5500308",
"0.5499843",
"0.54943573",
"0.54920584",
"0.548131... | 0.6474041 | 0 |
Description When is given a csv_filepath and output_filepath and its the first time reading it Expected Result creates a json file with right values | def test_first_time_reading_csv_file(self):
# Create a temporary directory for test files
temp_dir = "test_files/observed"
os.makedirs(temp_dir, exist_ok=True)
# Create a test CSV file
csv_filepath = os.path.join(temp_dir, "Abadia-BA_-11.56_-37.52.csv")
with open(csv_fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_json_from_csv(csv_file, delimiter, cols_delimiter, keep, dic_types, infer_types, max_docs, json_file, per_line):\n\n # Get header of csv\n header_csv = get_header_csv(csv_file, cols_delimiter)\n\n # Create structure of json\n print(' [INFO] Creating json\\'s structure')\n jstruct = creat... | [
"0.711705",
"0.6895903",
"0.6818029",
"0.6596224",
"0.6538705",
"0.6498996",
"0.647413",
"0.64032245",
"0.632765",
"0.63111657",
"0.6258295",
"0.62576884",
"0.62437224",
"0.6213409",
"0.6196973",
"0.6165735",
"0.6092725",
"0.6078405",
"0.607367",
"0.60391676",
"0.6012014",
... | 0.7492845 | 0 |
Description When is given a csv_filepath and output_filepath and already exists the file Expected Result concatenate the old json file with the values found in 2nd reading. | def test_when_file_already_exist(self):
# Create a temporary directory for test files
temp_dir = ["test_files/observed", "test_files/forecast", "test_files/output"]
for dir in temp_dir:
os.makedirs(dir, exist_ok=True)
# Create the 1st csv file
first_csv_filepath = o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def collate_similar_data(input_csv_file_path, output_csv_file_path):\n if not input_csv_file_path or not output_csv_file_path:\n return\n with open(output_csv_file_path, 'w') as file_object:\n csv_writer = csv.writer(file_object, delimiter=',')\n csv_writer.writerow(\n (... | [
"0.66875005",
"0.65311",
"0.64833546",
"0.6277665",
"0.6257637",
"0.5997841",
"0.5968701",
"0.58972067",
"0.5896129",
"0.5890339",
"0.58322793",
"0.5827144",
"0.580506",
"0.57693833",
"0.5767864",
"0.5731467",
"0.57120144",
"0.56666887",
"0.56376743",
"0.5627514",
"0.5622011"... | 0.69841707 | 0 |
Description When is given a csv_filepath and output_filepath and one of the columns has blank character Expected Result creates a json file ignoring blank column | def test_blank_column(self):
# Create a temporary directory for test files
temp_dir = "test_files/observed"
os.makedirs(temp_dir, exist_ok=True)
# Create a test CSV file
csv_filepath = os.path.join(temp_dir, "Abadia-BA_-11.56_-37.52.csv")
with open(csv_filepath, "w", ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_to_csv_with_no_rows_returns_none(self):\n output = row_handling.to_csv(rows=[], csv_path=self.csv_path)\n assert output is None",
"def write_csv_file(csv_output_file, full_data):\n j = 0\n csv_file_path = make_dir(csv_output_file)\n\n # csv_file_path = os.path.join(csv_file_path, ... | [
"0.6778147",
"0.66215456",
"0.6587748",
"0.6419415",
"0.6071375",
"0.60661834",
"0.6063572",
"0.6040226",
"0.60079324",
"0.59419805",
"0.5918246",
"0.5916295",
"0.5871361",
"0.58706796",
"0.58664465",
"0.5850558",
"0.5849682",
"0.5848059",
"0.5840836",
"0.58217335",
"0.577176... | 0.6656623 | 1 |
Delete a log file. | def delete_log(file_path):
if os.path.exists(file_path):
print('Deleting log %s...' % file_path)
os.remove(file_path)
else:
raise ValueError("File %r doesn't exists - cannot delete." % file_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_log():\n log_path = Path.cwd() / \"premise.log\"\n if log_path.exists():\n log_path.unlink()",
"def delete_file(fileName):\n os.remove(fileName)\n print (\"Deleteing file: \" + str(fileName))\n write_log()\n read_log()",
"def delete_log(filename):\n log_di... | [
"0.77605826",
"0.7727856",
"0.73945826",
"0.7313134",
"0.72794944",
"0.7045915",
"0.7009386",
"0.6897459",
"0.6797494",
"0.6758738",
"0.6743915",
"0.6732991",
"0.671415",
"0.66890925",
"0.6686626",
"0.6566584",
"0.6561632",
"0.6561151",
"0.65555596",
"0.6545941",
"0.6545941",... | 0.8215973 | 0 |
retorna o valor de graus Farenheit convertido para Celsius | def toCelsius(farenheit):
return (farenheit - 32)*5 / 9 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_f_to_c(temp_in_farenheit): ## ##\n celsiustemp = round((temp_in_farenheit - 32) * 5/9, 1) ##\n return celsiustemp ##",
"def convert_f_to_c(temp_in_f... | [
"0.8010471",
"0.7904015",
"0.7749893",
"0.7748052",
"0.77476305",
"0.77396774",
"0.76843536",
"0.7657182",
"0.76182777",
"0.7557405",
"0.74652946",
"0.72664905",
"0.7263454",
"0.7263454",
"0.7261374",
"0.72476894",
"0.7239142",
"0.72153395",
"0.7209384",
"0.7199643",
"0.71753... | 0.8065382 | 0 |
Return github API URL as string | def get_api_url(self):
url = 'https://api.{}/repos/{}/{}/git/'.format(HOST_GITHUB, \
self.repo, self.product)
return url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def github_url(self):\n return self.github.replace('.git', '')",
"def github_link(self):\n if self.test_type == TestType.commit:\n test_type = 'commit'\n test_id = self.commit\n else:\n test_type = 'pull'\n test_id = self.pr_nr\n\n return f\... | [
"0.79492223",
"0.72487265",
"0.7181632",
"0.7154561",
"0.7106888",
"0.6985907",
"0.6885024",
"0.68606704",
"0.682998",
"0.6809253",
"0.6746705",
"0.67292404",
"0.6727469",
"0.67142564",
"0.6706738",
"0.66876775",
"0.66692704",
"0.66497993",
"0.6614878",
"0.6613082",
"0.658479... | 0.83484757 | 0 |
Get a specific tag's data from Github API. | def get_tag(self, sha):
return self.get_url_data(self.api_url + 'tags/' + sha) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tag(self, tag):\n resp = self.get(_u.build_uri(\"tag\", domain=self.domain),\n data={'tag': tag})\n return utils.handle_response(resp)",
"def find_by_id(self, tag, params={}, **options):\n path = \"/tags/%s\" % (tag)\n return self.client.get(path, params... | [
"0.67847025",
"0.6460267",
"0.63765323",
"0.6361611",
"0.6254757",
"0.6193532",
"0.6165435",
"0.5924588",
"0.5913108",
"0.5913108",
"0.5889115",
"0.58397275",
"0.5831963",
"0.58196306",
"0.581669",
"0.57963234",
"0.57881856",
"0.57807654",
"0.57554406",
"0.57134587",
"0.56990... | 0.65368634 | 1 |
Github API can only return all tags, but we only want the latest. | def get_latest_tags(self):
start = len(self.tags) - self.num_comparisons
tags = self.tags
latest = []
for i in xrange(len(tags)):
if i >= start:
parts = tags[i]['ref'].split('/')
release_num = parts[2]
sha = tags[i]['object']['... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def latest_github_tag():\n release_tags_github_url = \"https://api.github.com/repos/rackerlabs/openstack-guest-agents-unix/tags\"\n release_tags_json = urllib2.urlopen(release_tags_github_url)\n release_tags_data = json.load(release_tags_json)\n return str(release_tags_data[0]['name'])[1:]",
"def do_... | [
"0.7582535",
"0.67998123",
"0.65141267",
"0.64969236",
"0.6446542",
"0.640628",
"0.6393738",
"0.6162547",
"0.5983191",
"0.5975903",
"0.59552914",
"0.5918902",
"0.5868156",
"0.58608156",
"0.5853621",
"0.58516884",
"0.5850484",
"0.5837113",
"0.5833859",
"0.5821743",
"0.5812356"... | 0.6986198 | 1 |
Return github tag release URL as string | def get_url_tag_release(self, release_num):
url = 'https://{}/{}/{}/releases/tag/{}'.format(
HOST_GITHUB,
self.repo,
self.product,
release_num
)
return url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_url(fp: str) -> str:\n return f\"https://github.com/pantsbuild/pants/blob/release_{PANTS_SEMVER}/{fp}\"",
"def get_url_tag_commit(self, git_sha):\n\n url = 'https://{}/{}/{}/commit/{}'.format(\n HOST_GITHUB,\n self.repo,\n self.product,\n git_sha\n ... | [
"0.7346837",
"0.7119125",
"0.6906928",
"0.6849196",
"0.6814661",
"0.6633057",
"0.6601647",
"0.65425444",
"0.65085566",
"0.6498361",
"0.6480949",
"0.6473229",
"0.63616604",
"0.63453585",
"0.63183016",
"0.62817633",
"0.62013495",
"0.6147767",
"0.61303365",
"0.61104536",
"0.6100... | 0.7984513 | 0 |
Return github tag commit SHA URL as string | def get_url_tag_commit(self, git_sha):
url = 'https://{}/{}/{}/commit/{}'.format(
HOST_GITHUB,
self.repo,
self.product,
git_sha
)
return url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def git_url(fp: str) -> str:\n return f\"https://github.com/pantsbuild/pants/blob/release_{PANTS_SEMVER}/{fp}\"",
"def github_url(self):\n return self.github.replace('.git', '')",
"def repo_link(repo):\n return \"https://github.com/\" + repo",
"def url_for(self: Self, commit_sha: str, path: str,... | [
"0.71973187",
"0.69282585",
"0.6792901",
"0.6748358",
"0.66634905",
"0.6656634",
"0.6605502",
"0.6590671",
"0.65770376",
"0.6560338",
"0.6532101",
"0.65264523",
"0.6505128",
"0.6500491",
"0.6499007",
"0.64897436",
"0.63229996",
"0.6280397",
"0.6262036",
"0.6240915",
"0.619329... | 0.8073723 | 0 |
Parse CHANGELOG for latest tag. | def get_changelog(self, commit_sha):
url = 'https://{}/{}/{}/' + commit_sha + '/CHANGELOG'
url = url.format(HOST_GITHUB_RAW, self.repo, self.product)
req = requests.get(url)
lines = req.text
first = self.latest_tags[self.num_comparisons - 1][VERS]
last = self.latest_ta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_latest_update(self, resp: Dict[str, Any], latest_version: str) -> str:\n latest_release = resp.get(\"releases\", {}).get(latest_version)\n if latest_release is not None and isinstance(latest_release, list):\n release_artifact_dates = []\n for artifact in latest_releas... | [
"0.616343",
"0.6080337",
"0.6000073",
"0.59245783",
"0.58972937",
"0.5849398",
"0.58468693",
"0.57212126",
"0.569988",
"0.56685996",
"0.5651651",
"0.5609761",
"0.5598691",
"0.5501291",
"0.549835",
"0.54694337",
"0.5457894",
"0.5446662",
"0.5412487",
"0.53381616",
"0.53150606"... | 0.6108666 | 1 |
Constructs release notes for Bugzilla service deployment ticket. | def get_release_notes(self):
notes = self.output.get_header('RELEASE NOTES')
notes += 'https://{}/{}/{}/releases'.format(HOST_GITHUB, \
self.repo, self.product) + '\n'
notes += self.output.get_sub_header('COMPARISONS')
notes += self.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_notes(version, author, git_ref_target, git_ref_source, build_type):\n print('generating release notes')\n if git_ref_source:\n if git_ref_source != 'HEAD':\n git_ref_source = 'origin/{}'.format(git_ref_source)\n changelog = run('git log origin/{}..{}'.format(git_ref_targe... | [
"0.7133973",
"0.62649",
"0.6180011",
"0.61652756",
"0.57979625",
"0.5698693",
"0.56655735",
"0.56425494",
"0.55498487",
"0.55108356",
"0.5495176",
"0.5493605",
"0.5473608",
"0.54344285",
"0.5391342",
"0.5365955",
"0.5322172",
"0.5317257",
"0.5311151",
"0.52918744",
"0.5264947... | 0.6374402 | 1 |
Gets the confidence of this PcrTestRecordResult. | def confidence(self):
return self._confidence | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confidence(self) -> float:\n return self._confidence",
"def confidence(self) -> float:\n return float(self.class_scores[self.class_num])",
"def detection_confidence(self):\n return self._detection_confidence",
"def get_medie_confidence(self):\n return self.__medie_confidence",... | [
"0.74183095",
"0.695079",
"0.6752761",
"0.62172127",
"0.6101365",
"0.59268916",
"0.59007055",
"0.58964837",
"0.58102906",
"0.5795349",
"0.5786901",
"0.57829434",
"0.5746195",
"0.56174123",
"0.56115687",
"0.5601758",
"0.55095553",
"0.55019873",
"0.545608",
"0.5437329",
"0.5400... | 0.7580267 | 1 |
Prompt user for input and continue to do so until input is valid. This function takes two required inputs, the message to display, and the limit of characters required. If the user enters something too long, they are prompted again until the input is correct. If the optional isNumber parameter is True, then it will als... | def LimitedInput(message, limit, isNumber=False):
keepAsking = True
while keepAsking:
answer = input(message)
if len(answer) > limit:
print("The input must be", limit, "characters or less.")
else:
keepAsking = False
if isNumber is True and CheckNumber(answ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_number(message: str) -> int:\n global number\n assert isinstance(message, str), \"message should be a string\"\n stop_condition2 = False\n while not stop_condition2:\n try:\n number = int(input(message))\n if number < lower_range:\n print(\"Please pic... | [
"0.6210186",
"0.60945845",
"0.6090262",
"0.59687257",
"0.5932961",
"0.5927148",
"0.59168947",
"0.58883595",
"0.5841568",
"0.58019143",
"0.5782949",
"0.5775905",
"0.5761319",
"0.5716825",
"0.57102144",
"0.5705627",
"0.5701563",
"0.5696017",
"0.56239253",
"0.5619944",
"0.556302... | 0.83368486 | 0 |
This function returns True if userInput can be converted to a number and returns False if it cannot. | def CheckNumber(userInput):
try:
float(userInput)
return True
except(ValueError):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_number(value_if_allowed):\n if value_if_allowed == '':\n return True\n try:\n float(value_if_allowed)\n return True\n except ValueError:\n return False",
"def __checkInput(self, var):\n try:\n int(var)\n\n except:\n return Fals... | [
"0.7273646",
"0.710573",
"0.70342",
"0.700277",
"0.6989638",
"0.69800496",
"0.6931918",
"0.68965924",
"0.68937594",
"0.68852633",
"0.6882689",
"0.68496823",
"0.6842476",
"0.6823968",
"0.68192196",
"0.68040407",
"0.679756",
"0.6784865",
"0.67602575",
"0.6758838",
"0.673784",
... | 0.86746126 | 0 |
This function prompts the user for a date using the message variable. User will continue to be prompted until the format is correct. The date format is very specific in the format DD/MM/YYYYY This function will confirm there are the right number of characters, the / are in the right place, the input are numbers, the da... | def DateInput(message):
askAgainMessage = "The date must be in the format DD/MM/YYYY"
keepAsking = True
while keepAsking:
answer = input(message)
# First we check if there are two / by splitting using / and looking
# for 3 items in the returned list.
dateCheck = answer.split(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_date(message, param):\n while True:\n try:\n day, month, year = input(message).split(param)\n return str(datetime.datetime(int(year), int(month), int(day)).strftime(\"%d/%m/%Y\"))\n except ValueError:\n continue",
"def enter_date... | [
"0.7718624",
"0.74047714",
"0.7254131",
"0.6943424",
"0.681888",
"0.6775938",
"0.6571638",
"0.65667284",
"0.6505889",
"0.6504818",
"0.6378474",
"0.6291643",
"0.6249938",
"0.61674076",
"0.61129284",
"0.61053425",
"0.6080972",
"0.6056492",
"0.60186255",
"0.5945199",
"0.5924336"... | 0.8515413 | 0 |
takes first row of tworow belief np array and converts it to dict indexed by label of positive beliefs | def np_to_belief(np_array,labels):
return dict((l,np_array[0,i]) for i,l in enumerate(labels)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_original_labels(array, threshold=0.5, initialization_value=999):\r\n \r\n binarized, belief = get_binarized_and_belief(array=array, threshold=threshold)\r\n \r\n #sanity check\r\n if binarized.shape != belief.shape:\r\n raise ValueError('Sanity check did not pass.')\r\n ... | [
"0.6541998",
"0.6310633",
"0.5895067",
"0.566295",
"0.5637139",
"0.5578173",
"0.55679846",
"0.55309737",
"0.54985076",
"0.5497383",
"0.54970396",
"0.5491054",
"0.5483852",
"0.5483852",
"0.54637516",
"0.54519457",
"0.5446611",
"0.5395349",
"0.53934413",
"0.53921664",
"0.538463... | 0.78097486 | 0 |
takes a list of votes and predicts based on threshold returns true iff fraction of true votes >= f | def thresh_vote(lst, f):
if len(lst) == 0: # guess 0 by default (appropriate for our dataset)
q = 0
else:
q = float(sum(lst)) / len(lst)
return q >= f | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binary_predict(probs, threshold = 0.5):\n return (probs >= threshold) * np.ones(len(probs))",
"def sensitivity(\n targets: List[int], preds: List[float], threshold: float = 0.5\n) -> float:\n return recall(targets, preds, threshold)",
"def get_predict(prediction, threshold):\n\n prediction[predic... | [
"0.6548085",
"0.6381974",
"0.6354342",
"0.6264731",
"0.6184546",
"0.6126238",
"0.61081564",
"0.60839015",
"0.6067138",
"0.60335726",
"0.5974422",
"0.59717226",
"0.5970143",
"0.59656197",
"0.5960877",
"0.5954389",
"0.59533507",
"0.5947933",
"0.5928161",
"0.5925397",
"0.5925221... | 0.7472907 | 0 |
Takes dictionaries of predicted and ground truth and returns confusion matrix | def confusion_matrix(predicted, gt):
tp = [k for k in predicted if predicted[k] and gt[k]]
tn = [k for k in predicted if not predicted[k] and not gt[k]]
fp = [k for k in predicted if predicted[k] and not gt[k]]
fn = [k for k in predicted if not predicted [k] and gt[k]]
return tp, tn, fp, fn | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_confusion_matrix_intersection_mats(groundtruth, predicted):\n\n confusion_matrix_arrs = {}\n\n groundtruth_inverse = np.logical_not(groundtruth)\n predicted_inverse = np.logical_not(predicted)\n\n confusion_matrix_arrs['tp'] = np.logical_and(groundtruth, predicted)\n confusion_matrix_arrs['t... | [
"0.7215619",
"0.71285826",
"0.7120823",
"0.70471257",
"0.70212066",
"0.6992223",
"0.696946",
"0.6948753",
"0.6921117",
"0.69178545",
"0.6913209",
"0.69081",
"0.68527514",
"0.6760738",
"0.675917",
"0.6750563",
"0.6734669",
"0.6700748",
"0.6682267",
"0.6672295",
"0.66603005",
... | 0.72815716 | 0 |
Returns argmax, max of dictionary | def argmax(d):
return max(d.iteritems(), key=operator.itemgetter(1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def argMax(self):\n if len(self.keys()) == 0: return None\n all = list(self.items())\n values = [x[1] for x in all]\n maxIndex = values.index(max(values))\n return all[maxIndex][0]",
"def argMax(self):\n if len(list(self.keys())) == 0:\n return None\n a... | [
"0.7893945",
"0.7893012",
"0.78599966",
"0.7807235",
"0.7397014",
"0.7194823",
"0.7194823",
"0.7194823",
"0.7170892",
"0.7158785",
"0.7147766",
"0.71402246",
"0.71295154",
"0.71241313",
"0.7121471",
"0.7005879",
"0.6961847",
"0.6961493",
"0.69519615",
"0.68631655",
"0.6839727... | 0.83839536 | 0 |
Produce nboot bootstrap samples from applying func to data | def bootstrap(data,func,nboot):
n = len(data)
resamples = np.array([[random.choice(data) for i in range(n)]
for j in range(nboot)])
return np.apply_along_axis(func, 1, resamples) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bootstrap(data):\r\n size = int(len(data))\r\n train = resample(data, n_samples=size, replace=True)\r\n test = data.drop(train.index) \r\n return train[encoded_features], train[target], test[encoded_features], test[target]",
"def bootstrap_replicate_1d(data, func):\r\n bs_sample = np.rand... | [
"0.7176311",
"0.71086556",
"0.7089425",
"0.7087817",
"0.7020718",
"0.68657595",
"0.6752474",
"0.6727999",
"0.6657717",
"0.63728184",
"0.62784743",
"0.62304413",
"0.62304413",
"0.61555386",
"0.60460633",
"0.6008815",
"0.6005979",
"0.6003459",
"0.59947544",
"0.5991532",
"0.5978... | 0.8077993 | 0 |
trace finds the line, the filename and error message and returns it to the user | def trace():
import traceback
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
# script name + line number
line = tbinfo.split(", ")[1]
# Get Python syntax error
#
synerror = traceback.format_exc().splitlines()[-1]
return line, __file__, synerror | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trace():\n import traceback, inspect\n tb = sys.exc_info()[2]\n tbinfo = traceback.format_tb(tb)[0]\n filename = inspect.getfile(inspect.currentframe())\n # script name + line number\n line = tbinfo.split(\", \")[1]\n # Get Python syntax error\n #\n synerror = traceback.format_exc().... | [
"0.7392801",
"0.7135186",
"0.6529018",
"0.63906014",
"0.6296253",
"0.6159555",
"0.6074369",
"0.6055162",
"0.6053701",
"0.60512197",
"0.60511047",
"0.60449284",
"0.6025194",
"0.5981327",
"0.5965538",
"0.592666",
"0.5902943",
"0.5831507",
"0.580618",
"0.5780158",
"0.57784814",
... | 0.7310826 | 1 |
In this function, you will instantiate several times, given the data provided. Then, you will open "sh_additional_info.csv" and for each line in that file, perform an operation using one of the methods of one of your classes. Follow the commented instructions in this main() function. Refer to Problem Set 07 README.md f... | def main():
# Refer to Problem Set 07 README.md for instructions and tips.
# 6.1: Read in < sh_basic_info.csv >
basic_info = read_csv_file('sh_basic_info.csv')
# 6.2: Create instances of < SuperHeroine >
heroines = {}
for hero in basic_info:
heroines[hero['name']] = SuperHeroine(her... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n raw_data = pd.read_csv('data/raw_hospital_data.csv')\n\n fe_data = new_features(raw_data)\n fe_data = compressing_admission_type(data)\n fe_data = age_to_cat(fe_data)\n fe_data = compressing_careunit(fe_data)\n fe_data = compressing_curr_serv(fe_data)\n fe_data = compressing_ethn... | [
"0.6210108",
"0.60456717",
"0.60032433",
"0.5947413",
"0.5876277",
"0.58508295",
"0.58461136",
"0.5834677",
"0.57999545",
"0.57364744",
"0.5730089",
"0.57000756",
"0.5691697",
"0.5639754",
"0.5626317",
"0.56223726",
"0.55977935",
"0.55886185",
"0.5551414",
"0.55287653",
"0.55... | 0.6953013 | 0 |
Updates x, y (memoryshared) coordinates with actual mouse position with a given frequency. | def stream(bus, address, frequency, x, y, stop_trigger):
mouse = Mouse.list_connected(bus=bus, address=address)[0]
delay = 1./frequency
while not stop_trigger:
x1, y1 = mouse.get_position_change()
x.value += x1
y.value += y1
time.sleep(delay) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follow(self):\n\t\tpos = pygame.mouse.get_pos()\n\t\tself.x = pos[0]\n\t\tself.y = pos[1]\n\t\tself.draw()",
"def mouse_position_event(self, x: int, y: int):\n pass",
"def update_pointer(self):\n pointer_length = -self.pointer_frac * self.radius\n # Add pi/2 to the angle because we con... | [
"0.5839249",
"0.57032055",
"0.5696799",
"0.56878513",
"0.5680848",
"0.56477594",
"0.5643513",
"0.56162447",
"0.5613641",
"0.56051666",
"0.558602",
"0.55699193",
"0.5541605",
"0.5541605",
"0.5534065",
"0.5533534",
"0.5528136",
"0.5512954",
"0.5495194",
"0.54931223",
"0.548661"... | 0.6736627 | 0 |
Returns the focal length of the telescope. | def focal_length(self):
return self.f * self.diameter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def estimate_focal_length(self):\n fl = (self.fiber_diameter / 2) / np.tan(np.deg2rad(self.fov / 2))\n\n return fl",
"def length(self) -> ir.FloatingValue:\n return ops.GeoLength(self).to_expr()",
"def bspb_focalLength():\n shotCam = pm.PyNode('shot_cam').getShape()\n return str(shot... | [
"0.7237808",
"0.6786899",
"0.6465912",
"0.63727885",
"0.6352939",
"0.62659967",
"0.61646885",
"0.616444",
"0.61160403",
"0.6020924",
"0.5934602",
"0.5932981",
"0.59197545",
"0.5891779",
"0.588042",
"0.58679926",
"0.584611",
"0.58384174",
"0.58230686",
"0.5822641",
"0.5822641"... | 0.8241378 | 0 |
Returns the plate scale as an `~astropy.units.Quantity`. | def plate_scale(self):
return 206265 * uu.arcsec / (self.diameter.to('mm') * self.f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale(self):\n return self.scale_factor / CONSTANTS.AU",
"def getScale(self):\n return _libsbml.Unit_getScale(self)",
"def scale(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"scale\")",
"def scale(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"scale\")",
... | [
"0.7407171",
"0.73354304",
"0.7272574",
"0.7260109",
"0.72580636",
"0.71984255",
"0.7091628",
"0.7008195",
"0.69788766",
"0.6805889",
"0.6759866",
"0.67273027",
"0.67187494",
"0.6713132",
"0.6710965",
"0.6695409",
"0.6635227",
"0.6599181",
"0.65680814",
"0.6560833",
"0.656083... | 0.7882506 | 0 |
Identifies genes that are significantly enriched for insertions (CTGs). This function takes a DataFrame of insertions, coming from multiple samples, and identifies if any genes are more frequently affected by an insertion than would be expected by chance. These genes are called Commonly Targeted Genes (CTGs). CTGs are ... | def test_ctgs(
insertions, # type: List[Insertion]
reference, # type: Reference
gene_ids=None, # type: Set[str]
chromosomes=None, # type: Set[str]
pattern=None, # type: str
per_sample=True, # type: bool
window=None #type: Tuple[int, int]
):
# Default t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genes_GT():\n df1=pd.read_csv(config['geneInfo'], sep=\" \")\n df1=df1[df1.chr == '22']\n df2=pd.read_csv(config['counts'], sep=\" \")\n genes=df1.merge(df2.gene_id, on=\"gene_id\")\n return list(set(genes['gene_id']))",
"def process_cgc(path, return_dataframe=False, fusions=False):\n # rea... | [
"0.62168896",
"0.5950708",
"0.5604085",
"0.5591386",
"0.5474958",
"0.54715043",
"0.5465627",
"0.5456833",
"0.535208",
"0.5323605",
"0.5284358",
"0.52755475",
"0.5262531",
"0.52539337",
"0.52331626",
"0.520046",
"0.5148381",
"0.507968",
"0.5076866",
"0.5065854",
"0.5053424",
... | 0.6928965 | 0 |
Subsets insertions for given gene windows. | def _subset_to_windows(
insertions, # type: List[Insertion]
gene_windows # type: Dict[str, Tuple[str, int, int]]
): # type: (...) -> List[Insertion]
# Create lookup trees.
trees = {
chrom: IntervalTree.from_tuples((i[1:]) for i in chrom_int)
for chrom, chrom_int in itertools.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_windows(sliding_windows_file, genes_file, output_file):\n\n\t# Read sliding windows file and create a list in the form\n\t# genes = [('gene1', 1000, 2000), ('gene2', 4000, 45000)]\n\tgenes = []\t\t# this could be a dictionary but I prefer not\n\tfor line in genes_file:\n\t\tline = line.strip()\n\n\t\ti... | [
"0.5770418",
"0.53267133",
"0.52984023",
"0.51812553",
"0.51691467",
"0.51118696",
"0.5079057",
"0.50481063",
"0.50467324",
"0.5036095",
"0.50196743",
"0.50149506",
"0.49723238",
"0.49606135",
"0.49236315",
"0.49137327",
"0.48717156",
"0.48612767",
"0.48102915",
"0.48091227",
... | 0.7655855 | 0 |
Tests a given genomic region for enrichment in insertions. | def test_region(
insertions, # type: List[Insertion]
reference_seq, # type: pyfaidx.Fasta
region, # type: Tuple[str, int, int]
pattern=None, # type: Optional[str]
intervals=None, # type: Optional[Iterable[Tuple[str, int, int]]]
total=None, # type: Optional[int]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_build_genomic_regions(self):\n\n CDS = pybedtools.BedTool(\"\"\"chr1\\t7700\\t7900\\tfoo\\t0\\t+\\n\n chr1\\t7999\\t8500\\tfoo\\t0\\t+\\n\"\"\", from_string = True)\n UTR5 = pybedtools.BedTool(\"\"\"chr1\\t7499\\t7700\\tfoo\\t0\\t+\\n\"\"\", from_string = Tr... | [
"0.6306166",
"0.5873809",
"0.5715272",
"0.5644633",
"0.5633991",
"0.5508607",
"0.55017656",
"0.5482008",
"0.53994864",
"0.53851366",
"0.53696203",
"0.53695005",
"0.53581506",
"0.5352486",
"0.5298148",
"0.5286712",
"0.52787757",
"0.5276704",
"0.52690274",
"0.5268633",
"0.52497... | 0.6274175 | 1 |
Counts occurrences of pattern within given genomic region. | def count_region(
reference_seq, # type: pyfaidx.Fasta
region, # type: Tuple[str, int, int]
pattern=None # type: Optional[str]
): # type: (...) -> int
chrom, start, end = region
seq = reference_seq[chrom][int(start):int(end)]
return _count_sequence(seq, regex=_build_regex(patte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count(pattern, string, overlapping=True, sensitive=True, regexp=False):\n return len(SE.findall(pattern, string, overlapping, sensitive, regexp))",
"def pattern_count(DNA, pattern, start=0, end=0, mutation_thresh=0):\n if start < 0 or start >= len(DNA):\n raise ValueError(\"The starting posi... | [
"0.690619",
"0.6891801",
"0.6734169",
"0.661228",
"0.64735407",
"0.64611524",
"0.645101",
"0.6441295",
"0.643269",
"0.63974696",
"0.6269934",
"0.6190485",
"0.61015546",
"0.5953266",
"0.5953266",
"0.58486587",
"0.57067573",
"0.56916803",
"0.56484526",
"0.56377214",
"0.56303567... | 0.7694619 | 0 |
Counts occurrences of pattern in sequence. | def _count_sequence(sequence, regex=None):
# type: (pyfaidx.Sequence, Pattern[str]) -> int
if regex is None:
count = len(sequence)
else:
count = sum((1 for _ in regex.finditer(str(sequence))))
return count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pattern_count(sequence, pattern):\n return len(re.findall(r'(?=' + pattern + ')', sequence))",
"def count_pattern(sentence, pattern):\n n = len(pattern)\n counter = 0\n for i in range(len(sentence) - n + 1):\n if sentence[i:i+n] == pattern:\n counter += 1\n\n return count... | [
"0.8225791",
"0.757032",
"0.74906814",
"0.7362785",
"0.7350869",
"0.73212504",
"0.7278474",
"0.7140979",
"0.707895",
"0.6971106",
"0.6928305",
"0.6643842",
"0.65604806",
"0.64908123",
"0.6395848",
"0.6317644",
"0.6313916",
"0.6293871",
"0.62750435",
"0.62558323",
"0.6236206",... | 0.76051104 | 1 |
Merges overlapping genomic intervals. | def merge_genomic_intervals(intervals):
# type: (Iterable[Tuple[str, int, int]]) -> Iterable[Tuple[str, int, int]]
# Group intervals by chromosome.
grouped_intervals = itertools.groupby(
sorted(intervals), operator.itemgetter(0))
# Now yield merged intervals per chromosome.
for chrom, grp ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_ranges():",
"def test_merge_intervals():\n\n a = pybedtools.example_bedtool(\"a.bed\") # path to test file a\n # This file looks like this:\n # chr1\t1\t100\tfeature1\t0\t+\n # chr1\t100\t200\tfeature2\t0\t+\n # chr1\t150\t500\tfeature3\t0\t-\n # chr1 900\t950\tfeature4\t0\t+\n\n ... | [
"0.75773865",
"0.6600593",
"0.6574509",
"0.6569135",
"0.63968265",
"0.63313943",
"0.6322615",
"0.624788",
"0.6216611",
"0.6146239",
"0.6133331",
"0.60140103",
"0.60021335",
"0.59763306",
"0.5970033",
"0.58648163",
"0.58545077",
"0.57922995",
"0.57907534",
"0.57814354",
"0.572... | 0.6790975 | 1 |
Read CSV in folder "general" in database. Also used in setup.py | def open_general(file, setup=False):
try:
if setup is False:
p = datapath(True, 'general', file)
df = _pd.read_csv(p + '.csv')
elif setup is True:
p = datapath(True, 'general', file)
df = _pd.read_csv(p + '.py')
else:
df = None # n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_csv():",
"def getFake(directory=\"../FakeRealNews/Data\"):\r\n return pd.read_csv(directory + \"/Fake.csv\")",
"def read_csv_file(self):\n pass",
"def _read_csv(self):\n self.function_name = '_read_csv'\n with open(os.path.join(self.task.downloads, self.csv_name)) as csv_file... | [
"0.6300106",
"0.61802393",
"0.6075419",
"0.60727006",
"0.606177",
"0.6019453",
"0.5933561",
"0.58593744",
"0.5730161",
"0.5652817",
"0.56373644",
"0.5618824",
"0.55967456",
"0.5585875",
"0.55683404",
"0.5567126",
"0.5550129",
"0.5536807",
"0.55361545",
"0.55278426",
"0.550909... | 0.65410346 | 0 |
Determines whether the discrepancy has been sufficiently resolved; used as return value for fix_discrepancy. | def discrepancy_resolved(self):
# If there's a discrepancy and distance change matches the existing data, we're good.
if self.distance_change == self.existing_data:
return True
# If recommend_updates, i.e., if self.distance_change == self.new_data, we'll update the data and we're goo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_solved(self):\n if not self._find_empty():\n return True\n else:\n return False",
"def is_solved(self):\n\n marker = self._marker\n amount_of_pegs = 0\n for row in marker:\n for i in row:\n if i == \"*\":\n ... | [
"0.6593381",
"0.622655",
"0.62037015",
"0.6201302",
"0.6191842",
"0.61888754",
"0.60700476",
"0.6044539",
"0.6014487",
"0.6009676",
"0.5961862",
"0.5950892",
"0.5950892",
"0.59451425",
"0.5910703",
"0.58750445",
"0.5857207",
"0.582537",
"0.5819653",
"0.580809",
"0.5805597",
... | 0.7586293 | 0 |
Run when the palette is closed | def on_palette_close(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify(self, args):\r\n try:\r\n self.cmd_object_.on_palette_close()\r\n\r\n except:\r\n app = adsk.core.Application.cast(adsk.core.Application.get())\r\n ui = app.userInterface\r\n ui.messageBox('Failed During Palette Close:\\n{}'.format(traceback.form... | [
"0.767233",
"0.6960615",
"0.67901963",
"0.6604122",
"0.6592666",
"0.64696324",
"0.64392585",
"0.6405782",
"0.6362652",
"0.6352815",
"0.6348606",
"0.6346555",
"0.63247025",
"0.6313968",
"0.6289701",
"0.6276552",
"0.6267763",
"0.62607265",
"0.62607265",
"0.6249281",
"0.623151",... | 0.91420245 | 0 |
Function is run when the palette is executed. Useful to gather initial data and send to html page | def on_palette_execute(self, palette: adsk.core.Palette):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify(self, args):\r\n app = adsk.core.Application.cast(adsk.core.Application.get())\r\n ui = app.userInterface\r\n try:\r\n\r\n # Create and display the palette.\r\n palette = ui.palettes.itemById(self.cmd_object_.palette_id)\r\n\r\n if not palette:\r\n ... | [
"0.71663606",
"0.5976665",
"0.59089667",
"0.5755218",
"0.57544327",
"0.56373245",
"0.5611845",
"0.56111276",
"0.5609256",
"0.55880344",
"0.5586924",
"0.5578858",
"0.5556275",
"0.5524903",
"0.55076844",
"0.5467774",
"0.54665",
"0.5456171",
"0.543333",
"0.543",
"0.5428835",
"... | 0.6666663 | 1 |
Builds the selection spec. | def build_selection_spec(client_factory, name):
sel_spec = client_factory.create('ns0:SelectionSpec')
sel_spec.name = name
return sel_spec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_selection ( self ,\n tag , \n algotype ,\n inputs , \n *args ,\n **kwargs ) :\n sel_tag = '%s_Selection' % tag\n sel_name = 'Sel%sFor%s' % ( tag , se... | [
"0.6188935",
"0.59599125",
"0.5944895",
"0.55326456",
"0.5366692",
"0.5328713",
"0.53118664",
"0.53038955",
"0.5270639",
"0.5265871",
"0.5262976",
"0.5192852",
"0.518418",
"0.51645607",
"0.51583874",
"0.5150827",
"0.5110556",
"0.5098783",
"0.5098783",
"0.50898474",
"0.5065787... | 0.72015435 | 0 |
Builds the traversal spec object. | def build_traversal_spec(client_factory, name, spec_type, path, skip,
select_set):
traversal_spec = client_factory.create('ns0:TraversalSpec')
traversal_spec.name = name
traversal_spec.type = spec_type
traversal_spec.path = path
traversal_spec.skip = skip
traversa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_recursive_traversal_spec(client_factory):\r\n visit_folders_select_spec = build_selection_spec(client_factory,\r\n \"visitFolders\")\r\n # For getting to hostFolder from datacenter\r\n dc_to_hf = build_traversal_spec(client_factory, \"dc_to_hf\", \"Datacenter\"... | [
"0.6779343",
"0.64210516",
"0.57740533",
"0.55809647",
"0.5465794",
"0.5431072",
"0.5333568",
"0.52883077",
"0.5245698",
"0.52180934",
"0.5119556",
"0.5117688",
"0.5117688",
"0.5085158",
"0.504372",
"0.5026567",
"0.5005321",
"0.4998705",
"0.4986079",
"0.49831903",
"0.49652678... | 0.70819336 | 0 |
Builds the Recursive Traversal Spec to traverse the object managed object hierarchy. | def build_recursive_traversal_spec(client_factory):
visit_folders_select_spec = build_selection_spec(client_factory,
"visitFolders")
# For getting to hostFolder from datacenter
dc_to_hf = build_traversal_spec(client_factory, "dc_to_hf", "Datacenter",
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_object_spec(client_factory, root_folder, traversal_specs):\r\n object_spec = client_factory.create('ns0:ObjectSpec')\r\n object_spec.obj = root_folder\r\n object_spec.skip = False\r\n object_spec.selectSet = traversal_specs\r\n return object_spec",
"def HierarchyIterator(obj):\n w... | [
"0.63169825",
"0.577359",
"0.5654486",
"0.5466749",
"0.5373837",
"0.52702874",
"0.5185981",
"0.517904",
"0.50982857",
"0.50975597",
"0.5090196",
"0.5065294",
"0.50485235",
"0.50385857",
"0.503404",
"0.49969995",
"0.4953721",
"0.4944381",
"0.49171883",
"0.4908716",
"0.49081615... | 0.6471344 | 0 |
Builds the Property Spec. | def build_property_spec(client_factory, type="VirtualMachine",
properties_to_collect=["name"],
all_properties=False):
property_spec = client_factory.create('ns0:PropertySpec')
property_spec.all = all_properties
property_spec.pathSet = properties_to_collec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_property_filter_spec(client_factory, property_specs, object_specs):\r\n property_filter_spec = client_factory.create('ns0:PropertyFilterSpec')\r\n property_filter_spec.propSet = property_specs\r\n property_filter_spec.objectSet = object_specs\r\n return property_filter_spec",
"def build(sel... | [
"0.6053929",
"0.595817",
"0.5930383",
"0.5877144",
"0.5749173",
"0.56912214",
"0.5589146",
"0.5584564",
"0.5541774",
"0.5472907",
"0.54651445",
"0.53387296",
"0.5295169",
"0.5217021",
"0.5211193",
"0.51826376",
"0.51688266",
"0.5148735",
"0.5138071",
"0.5137829",
"0.51148397"... | 0.69546396 | 0 |
Builds the Property Filter Spec. | def build_property_filter_spec(client_factory, property_specs, object_specs):
property_filter_spec = client_factory.create('ns0:PropertyFilterSpec')
property_filter_spec.propSet = property_specs
property_filter_spec.objectSet = object_specs
return property_filter_spec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_prop_filter_spec(client_factory, obj_spec, prop_spec):\r\n prop_filter_spec = \\\r\n client_factory.create('ns0:PropertyFilterSpec')\r\n prop_filter_spec.propSet = prop_spec\r\n prop_filter_spec.objectSet = obj_spec\r\n return prop_filter_spec",
"def get_prop_filter_spec(client_factory... | [
"0.6691381",
"0.6613962",
"0.6211153",
"0.60873485",
"0.59203535",
"0.5826266",
"0.5766887",
"0.546501",
"0.54321504",
"0.5387858",
"0.5352514",
"0.5318498",
"0.53072774",
"0.52971756",
"0.52805036",
"0.5272654",
"0.5242891",
"0.5188393",
"0.51839644",
"0.5144999",
"0.5102500... | 0.76600534 | 0 |
Gets the properties of the Managed object specified. | def get_object_properties(vim, collector, mobj, type, properties):
client_factory = vim.client.factory
if mobj is None:
return None
usecoll = collector
if usecoll is None:
usecoll = vim.get_service_content().propertyCollector
property_filter_spec = client_factory.create('ns0:P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_object_properties(vim, collector, mobj, type, properties):\n client_factory = vim.client.factory\n if mobj is None:\n return None\n usecoll = collector\n if usecoll is None:\n usecoll = vim.service_content.propertyCollector\n property_filter_spec = client_factory.create('ns0:Pr... | [
"0.66242605",
"0.6595597",
"0.65718126",
"0.65414923",
"0.64137036",
"0.63451725",
"0.6315363",
"0.6177473",
"0.61558604",
"0.61558604",
"0.61421597",
"0.61126566",
"0.6106942",
"0.6099833",
"0.60941976",
"0.6071322",
"0.6071322",
"0.6018031",
"0.599956",
"0.5993409",
"0.5958... | 0.679616 | 0 |
Builds the Property Filter Spec Object. | def get_prop_filter_spec(client_factory, obj_spec, prop_spec):
prop_filter_spec = \
client_factory.create('ns0:PropertyFilterSpec')
prop_filter_spec.propSet = prop_spec
prop_filter_spec.objectSet = obj_spec
return prop_filter_spec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_property_filter_spec(client_factory, property_specs, object_specs):\r\n property_filter_spec = client_factory.create('ns0:PropertyFilterSpec')\r\n property_filter_spec.propSet = property_specs\r\n property_filter_spec.objectSet = object_specs\r\n return property_filter_spec",
"def get_prop_... | [
"0.76403946",
"0.65880555",
"0.6298685",
"0.6076335",
"0.597899",
"0.5965586",
"0.5764983",
"0.5655848",
"0.56413084",
"0.5557564",
"0.5519107",
"0.5488389",
"0.54726166",
"0.5452801",
"0.544979",
"0.5363146",
"0.5314718",
"0.51662815",
"0.5132564",
"0.5092276",
"0.50902605",... | 0.66637796 | 1 |
Gets the list of properties for the collection of objects of the type specified. | def get_properties_for_a_collection_of_objects(vim, type,
obj_list, properties):
client_factory = vim.client.factory
if len(obj_list) == 0:
return []
prop_spec = get_prop_spec(client_factory, type, properties)
lst_obj_specs = []
for obj i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_properties_for_a_collection_of_objects(vim, type,\n obj_list, properties):\n client_factory = vim.client.factory\n if len(obj_list) == 0:\n return []\n prop_spec = get_prop_spec(client_factory, type, properties)\n lst_obj_specs = []\n for ... | [
"0.7357272",
"0.65244734",
"0.6457637",
"0.6373247",
"0.6370086",
"0.6297487",
"0.62510055",
"0.62469465",
"0.6221552",
"0.6219856",
"0.6206821",
"0.610221",
"0.60433024",
"0.60395074",
"0.5994236",
"0.59763896",
"0.59744734",
"0.59715617",
"0.59705645",
"0.5961555",
"0.59590... | 0.74611396 | 0 |
Run `code` with profiler. Used by ``%prun`` and ``%run p``. | def _run_with_profiler(self, code, opts, namespace):
# Fill default values for unspecified options:
opts.merge(Struct(D=[''], l=[], s=['time'], T=['']))
prof = profile.Profile()
try:
prof = prof.runctx(code, namespace, namespace)
sys_exit = ''
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_code(profiler):\n print('\\n')\n ps = pstats.Stats(profiler).strip_dirs().sort_stats('cumulative')\n ps.print_stats(10)",
"def runner(code, out_stream):\n code_obj = compiler.compile_source(code)\n vm = virtual_machine.VirtualMachine(out_stream)\n vm.run_code(code_obj)",
"def part... | [
"0.6385464",
"0.62743026",
"0.6012042",
"0.5954541",
"0.5947372",
"0.5926711",
"0.5884469",
"0.5836414",
"0.5775137",
"0.5737329",
"0.5666656",
"0.5654356",
"0.55813533",
"0.55803514",
"0.555477",
"0.55139744",
"0.5504729",
"0.5470353",
"0.5440272",
"0.5439059",
"0.5430186",
... | 0.7272947 | 0 |
read feature file, find out mass shift then correct | def feature_file_mass_correction(feature_filename: str):
output_feature_filename = feature_filename + '.mass_corrected'
ppm_shift = []
with open(feature_filename, 'r') as f:
reader = csv.reader(f, delimiter=',')
header = next(reader)
seq_index = header.index("seq")
mz_index =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_msp(infile_name,feat_lim_file=\"\",\n\t\t\t sum_feats=False,selected_features=[],\n\t\t\t max_dist=275,step_size=0.005,feat_bins=[],\n\t\t\t top_peaks=50,windowed_mode=False):\n\n\tinfile = open(infile_name)\n\n\tif len(feat_lim_file) > 0:\n\t\tselected_features = [float(f.strip()) for f in open(feat_lim_... | [
"0.61413145",
"0.6100522",
"0.56102365",
"0.55467093",
"0.55414826",
"0.5517877",
"0.55111635",
"0.5491323",
"0.5489486",
"0.54673564",
"0.5458751",
"0.54487556",
"0.5440117",
"0.5364303",
"0.53435946",
"0.53398484",
"0.5336551",
"0.5330061",
"0.5308056",
"0.5289896",
"0.5265... | 0.6439688 | 0 |
Factory method to create a cache object from github/spilchen/baseball_id_db This is called as part of package initialization and so can be refered to via the Lookup variable. >>> from baseball_id import Lookup >>> Lookup.from_yahoo_ids([10794, 9542, 7578]) | def create(cls):
ssl._create_default_https_context = ssl._create_unverified_context
c = lookup.Cache('https://raw.githubusercontent.com/spilchen/baseball_id_db/main/master.csv')
return c | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_fake(cls):\n source = pkg_resources.open_text('baseball_id', 'sample.master.csv',\n encoding='iso-8859-1')\n c = lookup.Cache(source)\n return c",
"def construct(cls, obs_lists, platform_id):\n step = 0\n LookupTable = []\n ... | [
"0.6530035",
"0.5592927",
"0.5449668",
"0.54129845",
"0.5390788",
"0.5236379",
"0.52326137",
"0.52017933",
"0.5083397",
"0.50474405",
"0.49929607",
"0.4948093",
"0.49268007",
"0.48906374",
"0.48458242",
"0.48337904",
"0.4833684",
"0.48185053",
"0.481795",
"0.4808004",
"0.4792... | 0.6934165 | 0 |
Factory method to create a fake data source This refers to a static data file that is in the current package. This function exists for testing purposes as it avoids network traffic to get the actual uptodate ID mapping. | def create_fake(cls):
source = pkg_resources.open_text('baseball_id', 'sample.master.csv',
encoding='iso-8859-1')
c = lookup.Cache(source)
return c | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_data_source_soaps_id_dynamic_datas_get(self):\n pass",
"def init_locally_processed_dataset(directory, source_datasets, uuid_=None):\n md = ptype.DatasetMetadata(\n id_=uuid_,\n # Default creation time is creation of an image.\n creation_dt=datetime.datetime.utcfromtimestam... | [
"0.6308188",
"0.62671566",
"0.6175177",
"0.61343235",
"0.5995582",
"0.5915337",
"0.59063405",
"0.58865434",
"0.5807432",
"0.57975435",
"0.5794116",
"0.57484156",
"0.5740665",
"0.56791466",
"0.56658155",
"0.56552786",
"0.5642972",
"0.56229484",
"0.5622516",
"0.56089175",
"0.56... | 0.70590085 | 0 |
The extracter moves files. Arguments input_folder and output_folder are set through GUI. Based on the values in the column called column_name in the spreadsheet, files are copied from input_folder to output_folder. Here, these are the gilbert_numbers in the spreadsheet fed from main(). The are matched to the file names... | def extracter(spreadsheet, column_name):
print header, "Running the extracter."
root=Tkinter.Tk()
root.withdraw()
root.update()
input_folder=tkFileDialog.askdirectory(title="Inputfolder: Please choose a directory that contains your corpus files")
root=Tkinter.Tk()
root.withdraw()
root.update()
output_fold... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_sample_folder(self, input_folder, target_folder, sample_name):\n print(f'processing {sample_name} folder.')\n # first make a subfolder to contain the images - e.g. 'target_folder/sample_name'\n sample_dir = join(target_folder, sample_name)\n if not os.path.exists(sample_dir):\n... | [
"0.6164347",
"0.5919336",
"0.5901154",
"0.58560616",
"0.57583755",
"0.5725686",
"0.571907",
"0.56493175",
"0.55794436",
"0.5573059",
"0.55641127",
"0.55598956",
"0.5552147",
"0.55351996",
"0.5534053",
"0.5514603",
"0.55066884",
"0.5490536",
"0.54603547",
"0.5438883",
"0.54376... | 0.76440537 | 0 |
Build or update a Ticker metrics using a Quotecast object. Only the metrics which can be converted to float are supported. But that should be enough to handle all the real use cases. | def build_ticker_from_quotecast(
quotecast: Quotecast,
references: Dict[int, List[str]] = None,
ticker: Ticker = None,
) -> Ticker:
if references is None:
references = dict()
if ticker is None:
ticker = Ticker()
# SETUP PRODUCTS & METRICS
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.data.update()\n stats = self.data.stats\n ticker = self.data.ticker\n\n if self.type == \"exchangerate\":\n self._attr_state = ticker[self._currency].p15min\n self._attr_unit_of_measurement = self._currency\n elif self.type == \"trad... | [
"0.504665",
"0.49457982",
"0.482276",
"0.47894225",
"0.47741964",
"0.47666577",
"0.4716032",
"0.46845242",
"0.46796387",
"0.46367455",
"0.46182653",
"0.4578131",
"0.4567336",
"0.4567215",
"0.45670658",
"0.4566002",
"0.4552697",
"0.45424986",
"0.45123693",
"0.44995657",
"0.448... | 0.6156283 | 0 |
Rebuild the request from history (self.__references). | def rebuild_request(self) -> Quotecast.Request:
references = self.references
request = Quotecast.Request()
for vwd_id, metric in references.values():
request.subscriptions[vwd_id].append(metric)
return request | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild(self):\n _logger.info( \"Rebuilding the API Caches...\" )\n\n # fill out the data structures\n self._buildApiTypesList()\n #_buildMayaTypesList()\n \n self._buildMayaReservedTypes(force=True)\n\n self._buildApiRelationships()\n\n # merge in the ma... | [
"0.5566847",
"0.546248",
"0.54090655",
"0.5392603",
"0.5335858",
"0.5311608",
"0.52756536",
"0.52722096",
"0.52640605",
"0.5223405",
"0.5222167",
"0.5147405",
"0.5122049",
"0.5031895",
"0.50197256",
"0.5009398",
"0.5008371",
"0.49860406",
"0.49698722",
"0.4964786",
"0.4964781... | 0.67901736 | 0 |
check to see whether an id is for a group | def is_group(id):
return id.startswith('G') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_uuid(self, obj, groupid):\n if self.get_uuid(obj) == groupid:\n return True",
"def alreay_in_group(self,uid,group_id):\n uid = str(uid)\n user_group_list = self.get_group_list_via_uid(uid)\n return True if group_id in user_group_list else False",
"def is_group(s... | [
"0.7496174",
"0.7397895",
"0.7248163",
"0.72468346",
"0.7207925",
"0.7201284",
"0.71829623",
"0.715947",
"0.7065384",
"0.70614374",
"0.6950488",
"0.69323575",
"0.68989813",
"0.6898132",
"0.686232",
"0.6849973",
"0.682175",
"0.68139756",
"0.6812948",
"0.6809037",
"0.6806396",
... | 0.81725055 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.