query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Summary Conversion utility function to change a string to a boolean value | def str2bool(v):
return v.lower() in ("yes", "true", "t", "1") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toBool( string ):\r\n return string == 'true'",
"def __str_to_bool(self, s):\n if s == 'True':\n return True\n elif s == 'False':\n return False\n else:\n raise ValueError",
"def str2bool(self, v):\n \tprint('Entering conversion function')\n ... | [
"0.82284486",
"0.822721",
"0.81267166",
"0.8084117",
"0.80827653",
"0.80172193",
"0.7960088",
"0.7928931",
"0.791422",
"0.791422",
"0.791422",
"0.791422",
"0.78829443",
"0.78829443",
"0.7879823",
"0.7879823",
"0.7816764",
"0.78087926",
"0.77887946",
"0.7782294",
"0.77746755",... | 0.75583744 | 44 |
Modifying a relevant parameter varies the id | def testIdUnique(self):
ids = {}
# Vary parameters that affect the work or input data,
# verify each id is unique
for params in itertools.product(RequestNames, TaskNames, Inputs,
Masks, Dbses, Acdcs):
ele = WorkQueueElement(RequestName=params[0], TaskName=params[1],
Inputs=params[2], Mask=params[3],
Dbs=params[4], ACDC=params[5]
)
self.assertFalse(ele.id in ids)
ids[ele.id] = None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, params):",
"def updateParameters(self, parameters):",
"def edit_parameter(request, parameter, **_kwargs):\n pass",
"def setParameter(self, name, value):",
"def set_params(self, params):",
"def setParam(self,param,value):\n if param in self.params.keys():\n self.param... | [
"0.6807237",
"0.6658205",
"0.65233225",
"0.6505701",
"0.6448187",
"0.6411622",
"0.6372013",
"0.6352617",
"0.62440944",
"0.62277305",
"0.62242615",
"0.620523",
"0.6153092",
"0.6048831",
"0.6048226",
"0.60286516",
"0.60258704",
"0.5929915",
"0.5924847",
"0.59063226",
"0.5906306... | 0.0 | -1 |
Id calculation ignores irrelavant variables | def testIdIgnoresIrrelevant(self):
ele = WorkQueueElement(RequestName='testIdIgnoresIrrelevant')
this_id = ele.id
for params2 in itertools.product(Progress, Priority, Teams,
ParentQueueUrl, ParentQueueId):
ele = WorkQueueElement(RequestName='testIdIgnoresIrrelevant',
PercentSuccess=params2[0],
Priority=params2[1], TeamName=params2[2],
ParentQueueUrl=params2[3], ParentQueueId=params2[4],
)
# id not changed by changing irrelvant parameters
self.assertEqual(ele.id, this_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getID():",
"def myID() -> np.int:\r\n return 304976335",
"def myID() -> np.int:\r\n return 304976335",
"def getID(self) -> int:\n ...",
"def computed_id(o):\n\n if o.id is not None and o.id.startswith(namespace + \":\"):\n return o.id\n\n return \"{i.namespace}:{i.accession}\"... | [
"0.6965709",
"0.66915977",
"0.66915977",
"0.6408313",
"0.6380176",
"0.63801146",
"0.6366658",
"0.63340586",
"0.62703955",
"0.625153",
"0.6239315",
"0.6189976",
"0.61724937",
"0.6164234",
"0.61216956",
"0.61216956",
"0.61216956",
"0.61216956",
"0.61216956",
"0.61216956",
"0.61... | 0.0 | -1 |
Id fixed once calculated | def testIdImmutable(self):
ele = WorkQueueElement(RequestName='testIdImmutable')
before_id = ele.id
ele['RequestName'] = 'somethingElse'
self.assertEqual(before_id, ele.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getID():",
"def _id(self):\n pass",
"def get_id(self):\n pass",
"def get_id(self):\n pass",
"def get_id(self):\n pass",
"def get_id(self):\n pass",
"def getID(self) -> int:\n ...",
"def id(self):\n return super().id()",
"def get_id(self): # prag... | [
"0.8015635",
"0.77718854",
"0.737665",
"0.737665",
"0.737665",
"0.737665",
"0.7365289",
"0.7344646",
"0.73083365",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.7295948",
"0.... | 0.0 | -1 |
Can override id generation | def testSetId(self):
ele = WorkQueueElement(RequestName='testIdImmutable')
before_id = ele.id
ele.id = 'something_new'
self.assertEqual('something_new', ele.id)
self.assertNotEqual(before_id, ele.id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_id(self) -> str:\n self._id += 1\n return str(self._id)",
"def _id(self):\n pass",
"def getID():",
"def id(self):\n return super().id()",
"def get_id(self):\n pass",
"def get_id(self):\n pass",
"def get_id(self):\n pass",
"def get_id(self):\n ... | [
"0.7583523",
"0.7535949",
"0.7486512",
"0.7395324",
"0.7243221",
"0.7243221",
"0.7243221",
"0.7243221",
"0.7229202",
"0.7213171",
"0.72104",
"0.7167073",
"0.71457255",
"0.7135989",
"0.71343046",
"0.7091023",
"0.7088569",
"0.7062956",
"0.7051366",
"0.70383215",
"0.7037999",
... | 0.0 | -1 |
Workqueue element site restriction check (same as workRestrictions) | def testPassesSiteRestriction(self):
# test element ala MonteCarlo
ele = WorkQueueElement(SiteWhitelist=["T1_IT_CNAF", "T2_DE_DESY"], SiteBlacklist=["T1_US_FNAL"])
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
# test element with input dataset
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": []}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertFalse(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertFalse(ele.passesSiteRestriction("T2_DE_DESY"))
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_DE_DESY"]}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
# test element with input and parent dataset
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": []}
ele['ParentFlag'] = True
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": []}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertFalse(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertFalse(ele.passesSiteRestriction("T2_DE_DESY"))
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_DE_DESY"]}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_DE_DESY"))
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_DE_DESY"]}
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": ["T1_IT_CNAF", "T2_CH_CERN", "T2_DE_DESY"]}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
# test element with input, parent and pileup dataset
ele['PileupData'] = {"/MY/DATASET/NAME": []}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertFalse(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertFalse(ele.passesSiteRestriction("T2_DE_DESY"))
ele['PileupData'] = {"/MY/DATASET/NAME": ["T2_US_Nebraska", "T1_IT_CNAF"]}
self.assertFalse(ele.passesSiteRestriction("T1_IT_CNAF"))
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T1_IT_CNAF", "T2_DE_DESY"]}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertFalse(ele.passesSiteRestriction("T2_DE_DESY")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPassesSiteRestrictionLocationFlags(self):\n # test element ala MonteCarlo\n ele = WorkQueueElement(SiteWhitelist=[\"T1_IT_CNAF\", \"T2_DE_DESY\"], SiteBlacklist=[\"T1_US_FNAL\"])\n self.assertFalse(ele.passesSiteRestriction(\"T1_US_FNAL\"))\n self.assertFalse(ele.passesSiteRestr... | [
"0.6806962",
"0.5811562",
"0.5728457",
"0.53757226",
"0.5239149",
"0.52173674",
"0.5165484",
"0.51420397",
"0.51234454",
"0.5076183",
"0.5031014",
"0.50261384",
"0.5019831",
"0.5010309",
"0.50060636",
"0.49717343",
"0.4966067",
"0.49175805",
"0.49115157",
"0.49010026",
"0.489... | 0.7161033 | 0 |
Workqueue element site restriction check (same as workRestrictions) | def testPassesSiteRestrictionLocationFlags(self):
# test element ala MonteCarlo
ele = WorkQueueElement(SiteWhitelist=["T1_IT_CNAF", "T2_DE_DESY"], SiteBlacklist=["T1_US_FNAL"])
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
# test element with input dataset
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": []}
ele['NoInputUpdate'] = True
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_DE_DESY"]}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
# test element with input and parent dataset
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": []}
ele['ParentFlag'] = True
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": []}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_DE_DESY"]}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_DE_DESY"]}
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": ["T1_IT_CNAF", "T2_CH_CERN", "T2_DE_DESY"]}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
# test element with input, parent and pileup dataset
ele['PileupData'] = {"/MY/DATASET/NAME": []}
ele['NoPileupUpdate'] = True
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
ele['PileupData'] = {"/MY/DATASET/NAME": ["T2_US_Nebraska", "T1_IT_CNAF"]}
self.assertFalse(ele.passesSiteRestriction("T2_US_Nebraska"))
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T1_IT_CNAF", "T2_DE_DESY"]}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY"))
# only the pileup flag enabled now
ele['NoInputUpdate'] = False
ele['PileupData'] = {"/MY/DATASET/NAME": []}
self.assertFalse(ele.passesSiteRestriction("T1_US_FNAL"))
self.assertFalse(ele.passesSiteRestriction("T2_CH_CERN"))
self.assertTrue(ele.passesSiteRestriction("T1_IT_CNAF"))
self.assertTrue(ele.passesSiteRestriction("T2_DE_DESY")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPassesSiteRestriction(self):\n # test element ala MonteCarlo\n ele = WorkQueueElement(SiteWhitelist=[\"T1_IT_CNAF\", \"T2_DE_DESY\"], SiteBlacklist=[\"T1_US_FNAL\"])\n self.assertFalse(ele.passesSiteRestriction(\"T1_US_FNAL\"))\n self.assertFalse(ele.passesSiteRestriction(\"T2_C... | [
"0.71603197",
"0.58114254",
"0.5727928",
"0.53752995",
"0.5239392",
"0.5217931",
"0.5166661",
"0.5141289",
"0.51245993",
"0.50754255",
"0.5030956",
"0.50263387",
"0.5020246",
"0.50115657",
"0.5005242",
"0.49711114",
"0.49657822",
"0.49160054",
"0.49109706",
"0.4902486",
"0.48... | 0.68061155 | 1 |
Workqueue element data location check (same as workRestrictions) | def testPossibleSites(self):
# test element ala MonteCarlo
ele = WorkQueueElement(SiteWhitelist=["T1_IT_CNAF", "T2_DE_DESY"])
self.assertItemsEqual(possibleSites(ele), ["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset but no location
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": []}
self.assertEqual(possibleSites(ele), [])
# test element with InputDataset and no match location
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_CH_CERN"]}
self.assertEqual(possibleSites(ele), [])
# test element with InputDataset and valid location
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_CH_CERN", "T2_DE_DESY"]}
self.assertEqual(possibleSites(ele), ["T2_DE_DESY"])
# test element with InputDataset and ParentData with no location
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_CH_CERN", "T2_DE_DESY"]}
ele['ParentFlag'] = True
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": []}
self.assertEqual(possibleSites(ele), [])
# test element with InputDataset and ParentData with no match location
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": ["T1_IT_CNAF"]}
self.assertEqual(possibleSites(ele), [])
# test element with InputDataset and ParentData with valid location
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": ["T1_US_FNAL", "T2_DE_DESY"]}
self.assertEqual(possibleSites(ele), ["T2_DE_DESY"])
# test element with InputDataset, PileupData and ParentData with no location
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_CH_CERN", "T2_DE_DESY"]}
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": ["T2_DE_DESY"]}
ele['PileupData'] = {"/MY/DATASET/NAME": []}
self.assertEqual(possibleSites(ele), [])
# test element with InputDataset, PileupData and ParentData with no match location
ele['PileupData'] = {"/MY/DATASET/NAME": ["T1_IT_CNAF", "T2_CH_CERN"]}
self.assertEqual(possibleSites(ele), [])
# test element with InputDataset, PileupData and ParentData with valid location
ele['PileupData'] = {"/MY/DATASET/NAME": ["T1_IT_CNAF", "T2_DE_DESY"]}
self.assertEqual(possibleSites(ele), ["T2_DE_DESY"]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPassesSiteRestrictionLocationFlags(self):\n # test element ala MonteCarlo\n ele = WorkQueueElement(SiteWhitelist=[\"T1_IT_CNAF\", \"T2_DE_DESY\"], SiteBlacklist=[\"T1_US_FNAL\"])\n self.assertFalse(ele.passesSiteRestriction(\"T1_US_FNAL\"))\n self.assertFalse(ele.passesSiteRestr... | [
"0.654463",
"0.5903362",
"0.5859422",
"0.5752581",
"0.5205748",
"0.51877534",
"0.5177837",
"0.51099944",
"0.50905395",
"0.50632966",
"0.50272065",
"0.4999938",
"0.49811572",
"0.49782753",
"0.4969903",
"0.4963938",
"0.49328744",
"0.4932683",
"0.49310413",
"0.49182191",
"0.4902... | 0.5117706 | 7 |
Workqueue element data location check, using the input and PU data location flags | def testPossibleSitesLocationFlags(self):
ele = WorkQueueElement(SiteWhitelist=["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset and no location, but input flag on
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": []}
ele['NoInputUpdate'] = True
self.assertItemsEqual(possibleSites(ele), ["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset and one match, but input flag on
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_IT_CNAF", "T2_CH_CERN"]}
self.assertItemsEqual(possibleSites(ele), ["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset and one match, but pu flag on
ele['NoInputUpdate'] = False
ele['NoPileupUpdate'] = True
self.assertEqual(possibleSites(ele), ["T1_IT_CNAF"])
# test element with InputDataset and one match, but both flags on
ele['NoInputUpdate'] = True
self.assertItemsEqual(possibleSites(ele), ["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset and ParentData and no location, but both flags on
ele['ParentFlag'] = True
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": []}
self.assertItemsEqual(possibleSites(ele), ["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset and ParentData and no location, but input flag on
ele['NoPileupUpdate'] = False
self.assertItemsEqual(possibleSites(ele), ["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset and ParentData and no location, but pileup flag on
ele['NoInputUpdate'] = False
ele['NoPileupUpdate'] = True
self.assertEqual(possibleSites(ele), [])
# test element with InputDataset, PileupData and ParentData with no location, but pileup flag on
ele['Inputs'] = {"/MY/BLOCK/NAME#73e99a52": ["T1_US_FNAL", "T2_CH_CERN", "T2_DE_DESY"]}
ele['ParentData'] = {"/MY/BLOCK2/NAME#002590494c06": ["T2_DE_DESY"]}
ele['PileupData'] = {"/MY/DATASET/NAME": []}
self.assertEqual(possibleSites(ele), ["T2_DE_DESY"])
# test element with InputDataset, PileupData and ParentData with no location, but both flags on
ele['NoInputUpdate'] = True
self.assertItemsEqual(possibleSites(ele), ["T1_IT_CNAF", "T2_DE_DESY"])
# test element with InputDataset, PileupData and ParentData with no location, but input flag on
ele['NoPileupUpdate'] = False
self.assertEqual(possibleSites(ele), []) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testPassesSiteRestrictionLocationFlags(self):\n # test element ala MonteCarlo\n ele = WorkQueueElement(SiteWhitelist=[\"T1_IT_CNAF\", \"T2_DE_DESY\"], SiteBlacklist=[\"T1_US_FNAL\"])\n self.assertFalse(ele.passesSiteRestriction(\"T1_US_FNAL\"))\n self.assertFalse(ele.passesSiteRestr... | [
"0.5973574",
"0.5559499",
"0.5359043",
"0.53462744",
"0.5329235",
"0.5259342",
"0.5239512",
"0.5232094",
"0.50799614",
"0.50530607",
"0.50330347",
"0.5014102",
"0.5005369",
"0.49977046",
"0.49977046",
"0.498443",
"0.49674127",
"0.49529317",
"0.4934858",
"0.4912697",
"0.490666... | 0.5818764 | 1 |
Return the ticker symbol for the most volatile stock. | def get_most_volatile(prices):
# TODO: Fill in this function.
#I have tried to select the specific column and then apply the standard deviation to
# check the volatility to a column to see how it works.
price_modified=prices.groupby(prices['ticker'])
# print(price_modified.price.rolling(2).std()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stock_symbol_with_highest_cap():\n #data2 = _cap_str_to_mln_float('cap')\n symbol_max = dict()\n for items in data:\n if items['symbol'] in symbol_max.keys():\n symbol_max[items['symbol']] = max(symbol_max[items['symbol']], _cap_str_to_mln_float(items['cap']))\n else:\n ... | [
"0.73184305",
"0.73052907",
"0.7163544",
"0.66528296",
"0.6418395",
"0.63728684",
"0.6284872",
"0.6214044",
"0.6164067",
"0.6094851",
"0.6092842",
"0.6059251",
"0.5812685",
"0.5807902",
"0.5805853",
"0.57953954",
"0.5773496",
"0.5746638",
"0.57129055",
"0.5663562",
"0.5645486... | 0.5974573 | 12 |
Test run get_most_volatile() with stock prices from a file. | def test_run(filename='prices.csv'):
prices = pd.read_csv(filename, parse_dates=['date'])
print("Most volatile stock: {}".format(get_most_volatile(prices))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_stock(db, openfile):\n pass",
"def get_most_volatile(prices):\n \n prices = prices.set_index('date')\n\n stock_return_volatility = []\n\n for ticker in prices.ticker.unique():\n prices_for_ticker = prices[prices['ticker'] == ticker]['price']\n log_return = np.log(prices_for_... | [
"0.5832539",
"0.57833153",
"0.56723505",
"0.54061973",
"0.53237814",
"0.5318612",
"0.5297799",
"0.52888286",
"0.5231948",
"0.5163269",
"0.5150431",
"0.50361997",
"0.49637398",
"0.49448463",
"0.4941156",
"0.4928857",
"0.48964813",
"0.4896082",
"0.4889873",
"0.48582286",
"0.484... | 0.7938999 | 1 |
Make dictionary of chosen objects to be passed to new file | def make_cp_objs(self):
self.cp_objs = {
'institution': True,
'lab': True,
'session': True,
'devices': True,
'electrode_groups': True,
'electrodes': True,
'epochs': True,
'trials': True,
'subject': True,
'acquisition': [],
'stimulus': [],
'ecephys': [],
'behavior': [],
'surveys': False,
}
# Raw data
if self.chk_raw.isChecked():
self.cp_objs['acquisition'].append(self.raw_name)
# Processed data
for chk in self.checks_processing_ecephys:
if chk.isChecked():
self.cp_objs['ecephys'].append(chk.text())
for chk in self.checks_processing_behavior:
if chk.isChecked():
self.cp_objs['behavior'].append(chk.text())
# Mic recording
for chk in self.checks_mic:
if chk.isChecked():
self.cp_objs['acquisition'].append(chk.text())
# Speaker stimuli
for chk in self.checks_stimuli:
if chk.isChecked():
self.cp_objs['stimulus'].append(chk.text())
# Surveys
if self.chk_surveys.isChecked():
self.cp_objs.update({'surveys': True})
# User-defined info
if self.chk_intervals.isChecked():
self.cp_objs.update({'intervals': True}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dicts(self):\n \n # remove this string from filename to make output file names more manageable\n pre_output1 = self.file1.replace(\"_Guys121919_CGH_1100_Jul11\", '')\n pre_output2 = self.file2.replace(\"_Guys121919_CGH_1100_Jul11\", '')\n \n # Build the output file ... | [
"0.64928",
"0.59820205",
"0.5809367",
"0.5799942",
"0.5785956",
"0.56438625",
"0.5595179",
"0.5577841",
"0.5568515",
"0.55599827",
"0.555925",
"0.5538971",
"0.55101997",
"0.5504869",
"0.5487848",
"0.5425487",
"0.5421385",
"0.5405953",
"0.53714365",
"0.5369012",
"0.5337038",
... | 0.5119001 | 64 |
Compute the expiration timestamp. | def expiry(self):
return time() + self.ttl * (0.95 + 0.1 * random()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_expiration(self, expiration_seconds):\n timestamp = time.time()\n if self.nbf:\n timestamp = self.nbf\n return timestamp + expiration_seconds",
"def expiration_time(self) -> str:\n return pulumi.get(self, \"expiration_time\")",
"def expiration_time(self) -> pulum... | [
"0.7844554",
"0.7835779",
"0.7663788",
"0.73386246",
"0.7301841",
"0.7247038",
"0.7099563",
"0.7069381",
"0.7038838",
"0.6991793",
"0.6925813",
"0.69131446",
"0.6910873",
"0.6910349",
"0.68614995",
"0.68614995",
"0.68614995",
"0.68613726",
"0.6858448",
"0.6830009",
"0.6819656... | 0.66698056 | 28 |
A signal that expiry lists are being rotated. | def moving(self):
self.orig_expires = self.expires
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_lists(self):\n for item in self.new_expiry:\n item.moving()\n self.expiry = sorted(self.new_expiry, key=lambda x:x.orig_expires)\n self.new_expiry = []\n return",
"def rotate(self):\n pass",
"def test_rotate_expiration(self):\n created = datetime.... | [
"0.7450476",
"0.6328296",
"0.60353696",
"0.6008251",
"0.5963904",
"0.59102225",
"0.58383256",
"0.58383256",
"0.5720906",
"0.55878884",
"0.55298686",
"0.5465525",
"0.5446814",
"0.54423416",
"0.5436252",
"0.53980494",
"0.5361833",
"0.5344558",
"0.5306663",
"0.53066033",
"0.5245... | 0.5646821 | 9 |
True if expires is not equal to orig_expires. | def updated(self):
return self.expires != self.orig_expires | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_expires(self):\n # We aren't bother going to test the actual time in expires, that\n # way lies pain with broken tests later.\n up = self.get(self.good_data)\n hdrs = dict(up.get_headers(1))\n lm = datetime(*utils.parsedate_tz(hdrs['Last-Modified'])[:7])\n exp = d... | [
"0.7073698",
"0.69195384",
"0.6914716",
"0.69129467",
"0.67846453",
"0.6679914",
"0.660565",
"0.65767676",
"0.6557804",
"0.6405459",
"0.638651",
"0.63783026",
"0.6330744",
"0.6310361",
"0.6259558",
"0.6224024",
"0.6209609",
"0.6207446",
"0.61312985",
"0.61132365",
"0.609304",... | 0.76405764 | 0 |
Called to move/remove one item. Returns True if the item was purged, False if it was moved to self.new_expiry. | def remove_one(self):
item = self.expiry.pop(0)
if item.updated:
self.new_expiry.append(item)
return
del self.index[item.target]
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self,item):\r\n raise AbstractError\r\n return False",
"def drop(self, item: Item) -> bool:\n if item in self.bag:\n self.__bag.remove(item)\n self.room._add_item(item)\n return True\n return False",
"def is_expired(self, key, now=None, re... | [
"0.6366809",
"0.63568",
"0.60818267",
"0.6010963",
"0.5990624",
"0.5990624",
"0.5898597",
"0.58695376",
"0.58585554",
"0.5826926",
"0.58192736",
"0.58165",
"0.57956797",
"0.5775258",
"0.574607",
"0.56877345",
"0.5676406",
"0.5663184",
"0.56496775",
"0.563791",
"0.5600733",
... | 0.696654 | 0 |
Promotes new_expiry to expiry. | def rotate_lists(self):
for item in self.new_expiry:
item.moving()
self.expiry = sorted(self.new_expiry, key=lambda x:x.orig_expires)
self.new_expiry = []
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_expiration(self, new_expiration):\n if self.is_cancellable:\n if self.expiration!=new_expiration:\n log.info(\"bo#%s: modify expiration of pending order\" % self.ticket)\n dt = get_datetime()\n new_expiration = dt_td_to_dt(new_expiration, dt... | [
"0.6488498",
"0.6143769",
"0.5902444",
"0.5682059",
"0.5525352",
"0.54472095",
"0.5412708",
"0.5358802",
"0.5306796",
"0.5305444",
"0.52702665",
"0.5263881",
"0.5237109",
"0.52044123",
"0.519679",
"0.5190725",
"0.5186643",
"0.5186452",
"0.5183078",
"0.5131201",
"0.5110786",
... | 0.4541154 | 83 |
Purge stuff from the cache which is expired/oldest. Stuff is purged which is older than TTL or if the total number of entries is in excess of MAX_ASSOCS. | def purge(self):
if not self.index:
return
now = time()
while self.expiry[0].orig_expires <= now or len(self.index) > MAX_ASSOCS:
self.remove_one()
if not self.expiry:
if not self.index:
return
self.rotate_lists()
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _purge_expired_items():\n now = time.time()\n keys = data_table.keys()\n\n for key in keys:\n num_unique_vals = len(data_table[key])\n\n # We iterate through in reverse, because otherwise deleting an \n # entry will cause frivolous edge cases.\n iteration_scheme = range(num_unique_vals)\n ite... | [
"0.7540263",
"0.7274658",
"0.7212392",
"0.71395636",
"0.6828041",
"0.6794092",
"0.6781577",
"0.6743768",
"0.6684985",
"0.66247",
"0.65925604",
"0.6568118",
"0.647569",
"0.64700687",
"0.64508235",
"0.64348704",
"0.64143634",
"0.6377659",
"0.62273985",
"0.62217367",
"0.622053",... | 0.77597445 | 0 |
Add an A / AAAA / CNAME record or update its TTL. | def add(self, artifact, ttl):
self.purge()
target = ( isinstance(artifact, DNSArtifact)
and str(artifact.remote_address) or artifact.name
).lower().rstrip('.')
fqdns = [ name.lower().rstrip('.') for name in artifact.onames ]
if target in self.index:
self.index[target].update(fqdns)
return
association = Association(target, fqdns, ttl)
self.index[target] = association
(self.new_expiry or self.expiry).append(association)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_adddnsrecord(kasserver, kasapi):\n kasserver.add_dns_record(\"test1.example.com\", \"CNAME\", \"www.example.com\")\n assert kasapi.requests_contains(\"add_dns_settings\")",
"def create_A_record(self, heroku_host_ip, domain, ttl):\n r = self.api.post_create_record(\n d... | [
"0.6417897",
"0.63499707",
"0.62343067",
"0.6197827",
"0.6090352",
"0.60900843",
"0.60561013",
"0.6020354",
"0.5921421",
"0.58620906",
"0.58464813",
"0.5838573",
"0.5774162",
"0.5759228",
"0.5743711",
"0.5732135",
"0.5655507",
"0.56232876",
"0.5612264",
"0.557543",
"0.5550441... | 0.58218277 | 12 |
Cache refresh. This task never exits. | async def periodic_refresh(self):
started_cycle = time()
while True:
now = time()
if (now - started_cycle) < CYCLE_DELAY:
await asyncio.sleep(CYCLE_DELAY - (now - started_cycle) + 1)
started_cycle = time()
await self.refresh_cache()
# Never exits. | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _refresh_cache(self, data_dict):\r\n pass",
"async def _timein_refresh(self):\n\t\t\n\t\tawait self.refresh_cache()",
"def reload_cache(self):\n self.data = self.read_data_cache()",
"def _refresh_cache(self):\r\n if self._cache_refresh:\r\n Thread(target=self._cache_refres... | [
"0.74130094",
"0.74087775",
"0.73764193",
"0.7310007",
"0.70633215",
"0.68871635",
"0.6640558",
"0.6637406",
"0.6552622",
"0.6521286",
"0.6484531",
"0.64227074",
"0.6389429",
"0.63400716",
"0.6333347",
"0.63207334",
"0.6314618",
"0.6312136",
"0.6300594",
"0.63005465",
"0.6259... | 0.67033917 | 6 |
What is the common TLD? | def match_len(chain):
previous,current = chain[-2:]
previous = [ x for x in reversed(str(previous).split('.')) ]
current = [ x for x in reversed(str(current).split('.')) ]
max_length = min(( len(x) for x in (previous,current) ))
i = 0
while i < max_length:
if previous[i] != current[i]:
return i
i += 1
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tld(text):\r\n # Patch up the url as necessary\r\n domain = get_domain(text)\r\n parse_dict = parse_domain(domain)\r\n root_domain = parse_dict['tld']\r\n return root_domain",
"def domain(self):\n return get_tld(self.url, fail_silently=True)",
"def domain(cls) -> str:\n r... | [
"0.64785725",
"0.62836677",
"0.5950124",
"0.5920633",
"0.5829534",
"0.5829517",
"0.57869846",
"0.57834756",
"0.57776415",
"0.57776415",
"0.5721498",
"0.5566537",
"0.5565944",
"0.55281645",
"0.5508286",
"0.54641896",
"0.5432569",
"0.5424741",
"0.542398",
"0.542398",
"0.5422762... | 0.0 | -1 |
String representation of board | def __str__(self):
result = ""
for line in self.board:
for i in line:
if i is None:
result += " "
else:
result += i + " "
result += "\n"
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def board_string(self):\n s = \"\"\n for i, v in enumerate(self.board):\n # if i % 81 == 0:\n # s += \"\\n\"\n if v is None:\n s += \"0\"\n else:\n if v.color == StoneColor.black:\n s += \"1\"\n ... | [
"0.8722435",
"0.8528507",
"0.82706046",
"0.82696027",
"0.82436645",
"0.8209577",
"0.8197674",
"0.8181283",
"0.8159793",
"0.8147646",
"0.8139678",
"0.8094481",
"0.80887604",
"0.80644387",
"0.80472785",
"0.80399215",
"0.8001671",
"0.7960363",
"0.79084516",
"0.790375",
"0.790038... | 0.80104905 | 16 |
Returns the translation using google translate you must shortcut the language you define (French = fr, English = en, Spanish = es, etc...) if not defined it will detect it or use english by default | def translate(atext,fromlang,tolang):
rtext=""
base_link = "http://translate.google.com/m?hl=%s&sl=%s&q=%s"
url = base_link % (tolang, fromlang, atext)
print(url)
headers={'Accept-Charset': 'utf-8'}
r = requests.get(url,headers=headers)
content = r.content.decode('utf-8')
if r.status_code != 200:
print("ERROR")
print(r.status_code)
print(r.headers)
print("content",content)
time.sleep(1)
else:
soup = bs4.BeautifulSoup(content,'html.parser')
# print(soup) # div class="t0"
res=soup.find("div",attrs={"class":"t0"})
# print("res:",res)
print("res.text:",res.text)
rtext=res.text
return rtext | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate():\n text = request.args.get('text')\n\n # Send a request to Google's Translate REST API using your API credentials defined above\n ans = service.translations().list(source='en', target='zh-CN', q=text).execute()\n\n # Return translated text back to user\n return ans['translations'][0]... | [
"0.7598732",
"0.75559896",
"0.709899",
"0.6986836",
"0.6938133",
"0.6855862",
"0.6825383",
"0.6810703",
"0.68092215",
"0.6790813",
"0.6641163",
"0.66265553",
"0.66010326",
"0.6597009",
"0.65803766",
"0.65706986",
"0.6543134",
"0.653197",
"0.64164877",
"0.6413953",
"0.63990265... | 0.6308857 | 26 |
Takes a list of phrases | def translate_wrapper(atext):
print("translating:",atext)
res=""
res=translate(atext,"pl","fr")
time.sleep(0.5)
print("translation:",res)
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phraseMaker(self):\n phrase_lst = []\n phrase = str(self.phrase_ent.get())\n keyword = str(self.keyword_ent.get())\n for i in range(self.city_lbx.size()):\n city = str(self.city_lbx.get(i))\n new_phrase = re.sub(keyword, city, phrase)\n phrase_lst.ap... | [
"0.68447465",
"0.680886",
"0.67371297",
"0.66061956",
"0.65849555",
"0.6478591",
"0.6410098",
"0.6358224",
"0.6335107",
"0.6332004",
"0.6325246",
"0.63094497",
"0.62669474",
"0.6244008",
"0.61137474",
"0.6064396",
"0.6040395",
"0.59628874",
"0.59497434",
"0.5949318",
"0.59333... | 0.0 | -1 |
Get distance between two words | def get_word_distance(word1: str, word2: str) -> bool:
letters_different = 0
for x, y in zip(word1, word2):
if x != y:
letters_different += 1
if letters_different > 1:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(self, word_a, word_b):\n word_a, word_b = word_a.upper(), word_b.upper()\n s_a = self.word_lookup[word_a]\n s_b = self.word_lookup[word_b]\n j = 1\n max_len = min(len(s_a), len(s_b))\n while j <= max_len:\n if s_a[-j] != s_b[-j]:\n br... | [
"0.79919",
"0.77045596",
"0.7653083",
"0.7644155",
"0.7548269",
"0.74936485",
"0.7458876",
"0.7359264",
"0.73570937",
"0.72695506",
"0.7210004",
"0.71801555",
"0.71711296",
"0.71555823",
"0.71531683",
"0.7134384",
"0.71238184",
"0.71183634",
"0.70562166",
"0.70456564",
"0.699... | 0.7285668 | 9 |
Get common letters of two words | def get_common_letters(word1: str, word2: str) -> str:
common = ''
for x, y in zip(word1, word2):
if x == y:
common += x
return common | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_shared_prefix(word1: str, word2: str) -> str:\n shared_prefix = \"\"\n for char1, char2 in zip(word1, word2):\n if char1 == char2:\n shared_prefix += char1\n else:\n break\n return shared_prefix",
"def shared_words(text1, text2):\r\n\r\n list1 = tokenize(te... | [
"0.7009229",
"0.6888572",
"0.68849295",
"0.6847381",
"0.68469286",
"0.6775948",
"0.67034924",
"0.6648536",
"0.6633855",
"0.6592176",
"0.6583248",
"0.6566062",
"0.6548944",
"0.6540705",
"0.6511979",
"0.6449228",
"0.644169",
"0.64145076",
"0.6395596",
"0.637349",
"0.63393426",
... | 0.88774985 | 0 |
Remove country code (995), + and from phone number. | def clean_phone(self):
data = self.cleaned_data['phone']
data = data.strip(' +').replace('-', '')
if len(data) == 12:
data = data[3:]
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_area_code(phone):\n\n if not phone.startswith('+46'):\n return phone\n else:\n return '0' + phone[3:]",
"def clean_phone(number):\n numberlist = re.findall(\"\\d\",number)\n new_number = \"\".join(numberlist)\n if len(new_number) == 8:\n \tnew_number = \"010\" + new_nu... | [
"0.8244583",
"0.7488292",
"0.7327585",
"0.7275571",
"0.72250795",
"0.720034",
"0.7163961",
"0.7041883",
"0.69297963",
"0.68606514",
"0.659699",
"0.6537094",
"0.65096045",
"0.6497232",
"0.6438996",
"0.6412471",
"0.6401837",
"0.6400007",
"0.6238846",
"0.62221634",
"0.62221634",... | 0.729629 | 3 |
Tests the filtering for a plan by its metal level to only match silver level plans. | def test_filtering_plans_by_metal_level_matches_only_silver(self):
silver_plan_inputs = [
{
'plan_id': '05276NA2900195',
'state': 'MI',
'metal_level': 'Silver',
'rate': '283.39',
'rate_area': '1'
},
{
'plan_id': '05276NA2900195',
'state': 'MI',
'metal_level': 'silver',
'rate': '283.39',
'rate_area': '1'
}
]
non_silver_plan_inputs = [
{
'plan_id': '68493CI1477769',
'state': 'SC',
'metal_level': 'Bronze',
'rate': '214.57',
'rate_area': '21'
},
{
'plan_id': '09812TP4606635',
'state': 'NV',
'metal_level': 'Platinum',
'rate': '331.363599',
'rate_area': '1'
},
{
'plan_id': '11698OD6718414',
'state': 'SC',
'metal_level': 'Gold',
'rate': '269.54',
'rate_area': '8'
},
{
'plan_id': '70547DK6596753',
'state': 'FL',
'metal_level': 'Catastrophic',
'rate': '241.1',
'rate_area': '57'
}
]
for silver_plan in silver_plan_inputs:
result = filter_plan_metal_level(silver_plan, DESIRED_METAL_LEVEL)
self.assertEqual(True, result)
for non_silver_plan in non_silver_plan_inputs:
result = filter_plan_metal_level(
non_silver_plan,
DESIRED_METAL_LEVEL
)
self.assertEqual(False, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_instrument_inventory_filtering():\n filt = 'GR150R'\n data = mm.instrument_inventory('niriss',\n add_filters={'filter': filt},\n return_data=True)\n\n filters = [row['filter'] for row in data['data']]\n\n assert all([i == filt... | [
"0.537246",
"0.53307503",
"0.529262",
"0.51645184",
"0.51426303",
"0.50996315",
"0.5073268",
"0.5032784",
"0.50168383",
"0.49994883",
"0.485873",
"0.48476052",
"0.48407164",
"0.4840311",
"0.48165542",
"0.48065767",
"0.47913322",
"0.47656873",
"0.47651768",
"0.47596028",
"0.47... | 0.84512395 | 0 |
Test that the zipcode data is cleaned properly and contains only unique rate areas. | def test_clean_zipcode_data_is_unique(self):
input = {
'11111': [('NY', '5')],
'22222': [('WI', '2')],
'33333': [('WI', '2'), ('NY', '5')],
'44444': [('WI', '2'), ('WI', '2')],
'55555': [('WI', '2'), ('WI', '2'), ('NY', '5')],
'66666': [('WI', '2'), ('WI', '2'), ('NY', '5'), ('NY', '5')],
'77777': [
('WI', '2'),
('WI', '2'),
('NY', '5'),
('NY', '5'),
('CA', '7')
]
}
expected = {
'11111': [('NY', '5')],
'22222': [('WI', '2')],
'33333': [('WI', '2'), ('NY', '5')],
'44444': [('WI', '2')],
'55555': [('WI', '2'), ('NY', '5')],
'66666': [('WI', '2'), ('NY', '5')],
'77777': [('WI', '2'), ('NY', '5'), ('CA', '7')]
}
cleaned_rate_areas = clean_zipcode_rate_areas(input)
# Compare each set of rate areas for every zipcode; sort the values to
# make sure we're comparing the data correctly.
for zipcode, rate_areas in cleaned_rate_areas.items():
self.assertEqual(sorted(rate_areas), sorted(expected[zipcode])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_only_five_digit_zipcodes_match(self):\n\n incorrect_zipcodes = ['1', 'abcdef', '123ab', '12345-6789', 'abc-def']\n non_string_zipcodes = [1, [123, 143], {'test': '123'}, 344.234, True]\n cleaned_zipcode_data_input = {'11111': [('NY', '5')]}\n cleaned_plan_data_input = {('NY', '... | [
"0.64460033",
"0.62175375",
"0.61588347",
"0.60202265",
"0.60172653",
"0.5865516",
"0.58646524",
"0.5859416",
"0.57990336",
"0.57793456",
"0.5748033",
"0.57366174",
"0.57348245",
"0.5724401",
"0.57015634",
"0.55580825",
"0.5512242",
"0.5489846",
"0.54823476",
"0.54728675",
"0... | 0.85351896 | 0 |
Tests the plan ratea data is cleaned properly and is returned with sorted unique values for each rate area. | def test_clean_plan_rates_sorts_and_makes_data_unique(self):
input = {
('IN', '1'): [
'304.5',
'422.28',
'386.79',
'382.7',
'332.21',
'422.28',
'382.7'
],
('SD', '2'): [
'279.4',
'250.14',
'270.13',
'274.56',
'247.67',
'279.4',
'270.13'
],
('FL', '63'): [
'398.14',
'330.9',
'324.61',
'398.14',
'345.91',
'214.32',
'330.9'
],
('FL', '54'): [
'428.03',
'294.87',
'339.6',
'409.72',
'294.44'
]
}
expected = {
('IN', '1'): [
'304.5',
'332.21',
'382.7',
'386.79',
'422.28'
],
('SD', '2'): [
'247.67',
'250.14',
'270.13',
'274.56',
'279.4'
],
('FL', '63'): [
'214.32',
'324.61',
'330.9',
'345.91',
'398.14'
],
('FL', '54'): [
'294.44',
'294.87',
'339.6',
'409.72',
'428.03'
]
}
cleaned_plan_data = clean_plan_rates(input)
self.assertEqual(expected, cleaned_plan_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_clean_zipcode_data_is_unique(self):\n\n input = {\n '11111': [('NY', '5')],\n '22222': [('WI', '2')],\n '33333': [('WI', '2'), ('NY', '5')],\n '44444': [('WI', '2'), ('WI', '2')],\n '55555': [('WI', '2'), ('WI', '2'), ('NY', '5')],\n ... | [
"0.6119881",
"0.56413275",
"0.5277127",
"0.5233631",
"0.52200216",
"0.5073727",
"0.506989",
"0.4968094",
"0.49477315",
"0.49471563",
"0.4938029",
"0.49331796",
"0.49196985",
"0.49146998",
"0.48825213",
"0.48451757",
"0.48303533",
"0.48172814",
"0.4804989",
"0.47885492",
"0.47... | 0.7310434 | 0 |
Tests that when the conditions are right, a zipcode is properly mapped to a rate. | def test_zipcode_is_successfully_mapped(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': [('NY', '5')]}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = '294.87'
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected, slcsp_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_only_five_digit_zipcodes_match(self):\n\n incorrect_zipcodes = ['1', 'abcdef', '123ab', '12345-6789', 'abc-def']\n non_string_zipcodes = [1, [123, 143], {'test': '123'}, 344.234, True]\n cleaned_zipcode_data_input = {'11111': [('NY', '5')]}\n cleaned_plan_data_input = {('NY', '... | [
"0.66684675",
"0.60333157",
"0.5978363",
"0.58802783",
"0.5841937",
"0.5741159",
"0.5704098",
"0.565133",
"0.55974364",
"0.5566235",
"0.54648787",
"0.5458494",
"0.5457171",
"0.5455862",
"0.5448905",
"0.544727",
"0.5438281",
"0.5421464",
"0.5415892",
"0.5403968",
"0.5398028",
... | 0.69216657 | 0 |
Tests that if no matching rate is found for a zipcode, an empty string is returned instead per the exercise instructions. | def test_no_rate_found_is_empty_string(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'22222': [('NH', '12')]}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = ''
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected, slcsp_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_string_returned_if_no_plans_are_found(self):\n\n zipcode = '11111'\n cleaned_zipcode_data_input = {'11111': [('WI', '9')]}\n cleaned_plan_data_input = {('WI', '9'): []}\n\n expected = ''\n\n slcsp_rate = retrieve_slcsp_for_zipcode(\n zipcode,\n ... | [
"0.6593722",
"0.65769804",
"0.6516567",
"0.64187825",
"0.640926",
"0.6383783",
"0.6159052",
"0.60808915",
"0.5918545",
"0.5846181",
"0.5840774",
"0.57913196",
"0.57867366",
"0.57632065",
"0.57513416",
"0.57177305",
"0.5681527",
"0.5549766",
"0.5544274",
"0.552554",
"0.5523862... | 0.7299004 | 0 |
Tests that a rate is not returned when a zipcode is given in a format that is not 5 digits. | def test_only_five_digit_zipcodes_match(self):
incorrect_zipcodes = ['1', 'abcdef', '123ab', '12345-6789', 'abc-def']
non_string_zipcodes = [1, [123, 143], {'test': '123'}, 344.234, True]
cleaned_zipcode_data_input = {'11111': [('NY', '5')]}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = ''
for incorrect_zipcode in incorrect_zipcodes:
slcsp_rate = retrieve_slcsp_for_zipcode(
incorrect_zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected, slcsp_rate)
for non_string_zipcode in non_string_zipcodes:
slcsp_rate = retrieve_slcsp_for_zipcode(
non_string_zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected, slcsp_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CheckZipCode(zipcode):\n # see if there are enough digits\n if (len(zipcode) >= 5):\n # check if numerical\n try:\n int(zipcode)\n return True\n except:\n return False\n else:\n return False",
"def zip_code(self, value):\n regex = c... | [
"0.69980687",
"0.6726815",
"0.6431161",
"0.6381496",
"0.60074365",
"0.59789",
"0.5864694",
"0.5857582",
"0.58574224",
"0.57995015",
"0.56933093",
"0.5647003",
"0.55855864",
"0.5554181",
"0.55517066",
"0.554926",
"0.5535344",
"0.5522636",
"0.5497078",
"0.5466229",
"0.54006547"... | 0.72417444 | 0 |
Tests that an empty string is returned if no plan areas exist for a given zipcode. | def test_empty_string_returned_if_no_plan_areas_exist(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': []}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = ''
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected, slcsp_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_string_returned_if_too_many_plan_areas_exist(self):\n\n zipcode = '11111'\n cleaned_zipcode_data_input = {'11111': [('WI', '9'), ('NY', '5')]}\n cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}\n\n expected = ''\n\n slcsp_rate = retrieve_slcsp... | [
"0.70404387",
"0.60167426",
"0.5886546",
"0.57227695",
"0.5487004",
"0.51963043",
"0.51898575",
"0.518254",
"0.51716274",
"0.51694894",
"0.51153564",
"0.5086501",
"0.50733477",
"0.50481135",
"0.50416213",
"0.501723",
"0.49452177",
"0.49212265",
"0.49157584",
"0.4908836",
"0.4... | 0.7164315 | 0 |
Tests that an empty string is returned if more than one plan area exists for a given zipcode. | def test_empty_string_returned_if_too_many_plan_areas_exist(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': [('WI', '9'), ('NY', '5')]}
cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}
expected = ''
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected, slcsp_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_string_returned_if_no_plan_areas_exist(self):\n\n zipcode = '11111'\n cleaned_zipcode_data_input = {'11111': []}\n cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}\n\n expected = ''\n\n slcsp_rate = retrieve_slcsp_for_zipcode(\n zip... | [
"0.6895567",
"0.58014107",
"0.5796688",
"0.5711699",
"0.5480371",
"0.5380354",
"0.53440535",
"0.53259677",
"0.52647734",
"0.5237509",
"0.52233595",
"0.5210759",
"0.51686174",
"0.5094478",
"0.5078834",
"0.507732",
"0.50009465",
"0.4994607",
"0.49879083",
"0.49855915",
"0.49532... | 0.7240199 | 0 |
Tests that an empty string is returned if no plans can be found for a rate area for the given zipcode. | def test_empty_string_returned_if_no_plans_are_found(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': [('WI', '9')]}
cleaned_plan_data_input = {('WI', '9'): []}
expected = ''
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected, slcsp_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_string_returned_if_no_plan_areas_exist(self):\n\n zipcode = '11111'\n cleaned_zipcode_data_input = {'11111': []}\n cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}\n\n expected = ''\n\n slcsp_rate = retrieve_slcsp_for_zipcode(\n zip... | [
"0.7914988",
"0.76495504",
"0.71094406",
"0.6995623",
"0.60355145",
"0.5981296",
"0.55346155",
"0.53053886",
"0.5250968",
"0.52387214",
"0.5198258",
"0.5195553",
"0.51005745",
"0.50772595",
"0.50772595",
"0.50772595",
"0.506577",
"0.5051987",
"0.49778143",
"0.49772865",
"0.49... | 0.72965056 | 2 |
Tests that an empty string is returned if no plans can be found for a rate area for the given zipcode. | def test_empty_string_returned_if_too_few_plans_are_found(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': [('WI', '9')]}
cleaned_plan_data_input = {('WI', '9'): []}
cleaned_plan_data_input = {('WI', '9'): ['324.6']}
expected = ''
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected, slcsp_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_string_returned_if_no_plan_areas_exist(self):\n\n zipcode = '11111'\n cleaned_zipcode_data_input = {'11111': []}\n cleaned_plan_data_input = {('NY', '5'): ['294.44', '294.87', '339.6']}\n\n expected = ''\n\n slcsp_rate = retrieve_slcsp_for_zipcode(\n zip... | [
"0.79157263",
"0.7650365",
"0.72963923",
"0.69952196",
"0.6037761",
"0.5979161",
"0.5532687",
"0.530107",
"0.5254216",
"0.5242594",
"0.519833",
"0.51938957",
"0.51037765",
"0.50752366",
"0.50752366",
"0.50752366",
"0.50643766",
"0.505265",
"0.49800697",
"0.49795222",
"0.49593... | 0.7109269 | 3 |
Tests that if a rate can be returned, it is always formatted to two decimal places. | def test_rate_always_formatted_to_two_decimal_places(self):
zipcode = '11111'
cleaned_zipcode_data_input = {'11111': [('NY', '5')]}
cleaned_plan_data_inputs = [
{('NY', '5'): ['294.24', '294']},
{('NY', '5'): ['294.24', '294.7']},
{('NY', '5'): ['294.24', '294.3452']},
{('NY', '5'): ['294.24', '294.24']}
]
# NOTE: Formatting a decimal.Decimal value will result in rounding.
expected_results = ['294.00', '294.70', '294.35', '294.24']
for i, cleaned_plan_data_input in enumerate(cleaned_plan_data_inputs):
slcsp_rate = retrieve_slcsp_for_zipcode(
zipcode,
cleaned_zipcode_data_input,
cleaned_plan_data_input
)
self.assertEqual(expected_results[i], slcsp_rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_rating(instance, args):\r\n raw_rating = instance.rating(args)\r\n # Do string conversion here\r\n if not raw_rating:\r\n str_rating = 'N/A'\r\n else:\r\n str_rating = \"{0:.2f}\".format(raw_rating)\r\n return str_rating",
"def _exchange_amount(amount, rate):\n return ... | [
"0.635572",
"0.62793225",
"0.61580366",
"0.59902906",
"0.59895074",
"0.59418416",
"0.59058857",
"0.5860149",
"0.58415556",
"0.57754457",
"0.57288945",
"0.57193255",
"0.5702747",
"0.5680467",
"0.56775796",
"0.56678134",
"0.5606319",
"0.56051075",
"0.5598586",
"0.5582338",
"0.5... | 0.6863517 | 0 |
Tests that the prepared output matches the structure of the input with the given sample data. This test simulates the data having already been loaded from the source CSV files. | def test_output_matches_structure_of_input(self):
input_header = ['zipcode', 'rate']
input_slcsp_zipcodes = ['11111', '22222', '33333', '44444', '55555']
input_zipcode_data = {
'11111': [('NY', '5')],
'22222': [('WI', '2')],
'33333': [('WI', '2'), ('NY', '5')],
'55555': [('FL', '63')]
}
input_plan_data = {
('NY', '5'): [
'304.5',
'422.28',
'386.79',
'382.7',
'332.21',
'422.28',
'382.7'
],
('WI', '2'): [
'279.4',
'250.14',
'270.13',
'274.56',
'247.67',
'279.4',
'270.13'
],
('FL', '63'): [
'398.14'
]
}
expected_output = OrderedDict({
'11111': '332.21', # Rate found
'22222': '250.14', # Rate found
'33333': '', # Rate not found - too many rate areas
'44444': '', # Rate not found - zipcode wasn't found
'55555': '' # Rate not found - too few rates
})
# Check that the header row default is set properly.
self.assertEqual(input_header, SLCSP_OUTPUT_FIELD_NAMES)
# Clean the data to prepare it for calculating the second lowest cost
# silver plan for a given zipcode.
cleaned_zipcode_data = clean_zipcode_rate_areas(input_zipcode_data)
cleaned_plan_data = clean_plan_rates(input_plan_data)
# Prepare the data for final output.
prepared_slcsp_output = prepare_slcsp_output(
input_slcsp_zipcodes,
cleaned_zipcode_data,
cleaned_plan_data
)
# Check that the expected output matches what was produced with the
# prepared output.
self.assertEqual(expected_output, prepared_slcsp_output) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_csv(test_data,tmp_path):\n\n for d in test_data:\n\n gpm = GenotypePhenotypeMap(genotype=d[\"genotype\"],\n wildtype=d[\"wildtype\"],\n phenotype=d[\"phenotype\"],\n uncertainty=d[\"uncertainty\... | [
"0.65351576",
"0.65287954",
"0.6525061",
"0.6442356",
"0.6430248",
"0.64176047",
"0.6353845",
"0.6350602",
"0.6283764",
"0.62174934",
"0.61636066",
"0.61620665",
"0.6152545",
"0.6113748",
"0.6090614",
"0.6067925",
"0.6056985",
"0.6048181",
"0.6027991",
"0.60095495",
"0.600161... | 0.6228441 | 9 |
Compute search convolution of inputs. | def get_output_for(self, inputs, **kwargs):
Apow = inputs[0]
X = inputs[1]
def compute_output(w, a, x):
return self.op( (T.dot(a, x).transpose() * T.addbroadcast(T.reshape(w, (w.shape[0],1)),1)), axis=1)
def scan_hops(apow, x, w, h):
out, _ = theano.scan(fn=compute_output,
non_sequences=[x],
sequences=[w, apow],
n_steps = h)
return self.nonlinearity(out.transpose())
out, _ = theano.scan(fn=scan_hops,
non_sequences=[self.W, self.n_hops],
sequences=[Apow, X],
n_steps = X.shape[0])
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clConvolution(self, size, mask):",
"def compute(self, node, input_vals):\r\n #assert len(input_vals) == 2\r\n #start = time.time()\r\n strides = node.const_attr\r\n ish = list(input_vals[0].shape)\r\n fsh = list(input_vals[1].shape)\r\n filter = input_vals[1].astype(... | [
"0.68156195",
"0.6408768",
"0.63821524",
"0.6362361",
"0.618494",
"0.61471",
"0.60897416",
"0.60678774",
"0.60351264",
"0.6013964",
"0.59767866",
"0.597003",
"0.5939472",
"0.5939385",
"0.5926253",
"0.5916104",
"0.5914873",
"0.59097123",
"0.59076554",
"0.5892097",
"0.5880909",... | 0.0 | -1 |
echo back text into conversation | def echo(bot, event, *args):
raw_arguments = event.text.split(maxsplit=3)
if len(raw_arguments) >= 3:
if raw_arguments[2] in bot.conversations.catalog:
# e.g. /devilbot echo <convid> <text>
# only admins can echo messages into other conversations
admins_list = bot.get_config_suboption(event.conv_id, 'admins')
if event.user_id.chat_id in admins_list:
convid = raw_arguments[2]
else:
convid = event.conv_id
raw_arguments = [ _("<b>only admins can echo other conversations</b>") ]
else:
# assumed /devilbot echo <text>
convid = event.conv_id
raw_arguments = event.text.split(maxsplit=2)
_text = raw_arguments[-1].strip()
if _text.startswith("raw:"):
_text = _text[4:].strip()
else:
# emulate pre-2.5 bot behaviour and limitations
_text = re.escape(_text)
yield from command.run(bot, event, *["convecho", "id:" + convid, _text]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def echo(update, context):\r\n update.message.reply_text(update.message.text)",
"def echo(update, context):\n update.message.reply_text(update.message.text)",
"def echo(update, context):\n update.message.reply_text(update.message.text)",
"def echo(update, context):\n update.message.reply_text(upd... | [
"0.7427679",
"0.73122656",
"0.73122656",
"0.73122656",
"0.73122656",
"0.70895636",
"0.7034065",
"0.7015307",
"0.69716316",
"0.694557",
"0.69337946",
"0.6905217",
"0.686102",
"0.68140686",
"0.67544764",
"0.6733791",
"0.6731721",
"0.6705971",
"0.6694809",
"0.66839635",
"0.66431... | 0.6441627 | 40 |
broadcast a message to chats, use with care | def broadcast(bot, event, *args):
if args:
subcmd = args[0]
parameters = args[1:]
if subcmd == "info":
"""display broadcast data such as message and target rooms"""
conv_info = [ "<b><pre>{}</pre></b> ... <pre>{}</pre>".format(bot.conversations.get_name(convid), convid)
for convid in _internal["broadcast"]["conversations"] ]
if not _internal["broadcast"]["message"]:
yield from bot.coro_send_message(event.conv, _("broadcast: no message set"))
return
if not conv_info:
yield from bot.coro_send_message(event.conv, _("broadcast: no conversations available"))
return
yield from bot.coro_send_message(event.conv, _(
"<b>message:</b><br />"
"{}<br />"
"<b>to:</b><br />"
"{}".format(_internal["broadcast"]["message"],
"<br />".join(conv_info))))
elif subcmd == "message":
"""set broadcast message"""
message = ' '.join(parameters)
if message:
if message.lower().strip().startswith(tuple([_.lower() for _ in bot._handlers.bot_command])):
yield from bot.coro_send_message(event.conv, _("broadcast: message not allowed"))
return
_internal["broadcast"]["message"] = message
else:
yield from bot.coro_send_message(event.conv, _("broadcast: message must be supplied after subcommand"))
elif subcmd == "add":
"""add conversations to a broadcast"""
if parameters[0] == "groups":
"""add all groups (chats with users > 1, bot not counted)"""
for convid, convdata in bot.conversations.get().items():
if(len(convdata["participants"]) > 1):
_internal["broadcast"]["conversations"].append(convid)
elif parameters[0] == "ALL":
"""add EVERYTHING - try not to use this, will message 1-to-1s as well"""
for convid, convdata in bot.conversations.get().items():
_internal["broadcast"]["conversations"].append(convid)
else:
"""add by wild card search of title or id"""
search = " ".join(parameters)
for convid, convdata in bot.conversations.get().items():
if search.lower() in convdata["title"].lower() or search in convid:
_internal["broadcast"]["conversations"].append(convid)
_internal["broadcast"]["conversations"] = list(set(_internal["broadcast"]["conversations"]))
yield from bot.coro_send_message(event.conv, _("broadcast: {} conversation(s)".format(len(_internal["broadcast"]["conversations"]))))
elif subcmd == "remove":
if parameters[0].lower() == "all":
"""remove all conversations from broadcast"""
_internal["broadcast"]["conversations"] = []
else:
"""remove by wild card search of title or id"""
search = " ".join(parameters)
removed = []
for convid in _internal["broadcast"]["conversations"]:
if search.lower() in bot.conversations.get_name(convid).lower() or search in convid:
_internal["broadcast"]["conversations"].remove(convid)
removed.append("<b><pre>{}</pre></b> (<pre>{}</pre>)".format(bot.conversations.get_name(convid), convid))
if removed:
yield from bot.coro_send_message(event.conv, _("broadcast: removed {}".format(", ".join(removed))))
elif subcmd == "NOW":
"""send the broadcast - no turning back!"""
context = { "explicit_relay": True } # prevent echos across syncrooms
for convid in _internal["broadcast"]["conversations"]:
yield from bot.coro_send_message(convid, _internal["broadcast"]["message"], context=context)
yield from bot.coro_send_message(event.conv, _("broadcast: message sent to {} chats".format(len(_internal["broadcast"]["conversations"]))))
else:
yield from bot.coro_send_message(event.conv, _("broadcast: /devilbot broadcast [info|message|add|remove|NOW] ..."))
else:
yield from bot.coro_send_message(event.conv, _("broadcast: /devilbot broadcast [info|message|add|remove|NOW]")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def broadcast(msg):\n\n for sock in clients:\n sock.send(bytes(msg, \"utf-8\"))",
"def broadcast(msg):\r\n for user in clients:\r\n msg_client(msg, user)",
"def broadcast(msg, prefix=\"\",ChatRoom=None): # prefix is for name identification. \n if not ChatRoom == None :\n f... | [
"0.74888134",
"0.74571055",
"0.7399891",
"0.7377366",
"0.7268873",
"0.7235125",
"0.7114163",
"0.7107474",
"0.7065511",
"0.7023068",
"0.7012259",
"0.69823974",
"0.6930214",
"0.69030565",
"0.6890666",
"0.68516475",
"0.68341285",
"0.68301284",
"0.6821246",
"0.6774895",
"0.676991... | 0.6675279 | 24 |
list all users in current hangout (include g+ and email links) | def users(bot, event, *args):
yield from command.run(bot, event, *["convusers", "id:" + event.conv_id]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_users():",
"def user_list(ctx):\n data = ctx.obj.get_all_users()\n output_json_data(data)",
"def user_list(server_object, client, address, command_args):\n\n\tmsg = \"\"\n\n\t#: Create a formatted string of all the users.\n\tfor usr in server_object.usrs.values():\n\t\tmsg += usr + '\\n'\n\n\... | [
"0.7221727",
"0.7219136",
"0.6808157",
"0.673355",
"0.66700226",
"0.6655391",
"0.6643791",
"0.663619",
"0.65880525",
"0.6549635",
"0.65195817",
"0.6506965",
"0.64932907",
"0.6472283",
"0.64379746",
"0.6411952",
"0.63867265",
"0.63722616",
"0.6327566",
"0.63135463",
"0.6303251... | 0.0 | -1 |
find people by name | def user(bot, event, *args):
search = " ".join(args)
if not search:
raise ValueError(_("supply search term"))
search_lower = search.strip().lower()
search_upper = search.strip().upper()
segments = [hangups.ChatMessageSegment(_('results for user named "{}":').format(search),
is_bold=True),
hangups.ChatMessageSegment('\n', hangups.SegmentType.LINE_BREAK)]
all_known_users = {}
for chat_id in bot.memory["user_data"]:
all_known_users[chat_id] = bot.get_hangups_user(chat_id)
for u in sorted(all_known_users.values(), key=lambda x: x.full_name.split()[-1]):
fullname_lower = u.full_name.lower()
fullname_upper = u.full_name.upper()
unspaced_lower = re.sub(r'\s+', '', fullname_lower)
unspaced_upper = re.sub(r'\s+', '', u.full_name.upper())
if( search_lower in fullname_lower
or search_lower in unspaced_lower
# XXX: turkish alphabet special case: converstion works better when uppercase
or search_upper in remove_accents(fullname_upper)
or search_upper in remove_accents(unspaced_upper) ):
link = 'https://plus.google.com/u/0/{}/about'.format(u.id_.chat_id)
segments.append(hangups.ChatMessageSegment(u.full_name, hangups.SegmentType.LINK,
link_target=link))
if u.emails:
segments.append(hangups.ChatMessageSegment(' ('))
segments.append(hangups.ChatMessageSegment(u.emails[0], hangups.SegmentType.LINK,
link_target='mailto:{}'.format(u.emails[0])))
segments.append(hangups.ChatMessageSegment(')'))
segments.append(hangups.ChatMessageSegment(' ... {}'.format(u.id_.chat_id)))
segments.append(hangups.ChatMessageSegment('\n', hangups.SegmentType.LINE_BREAK))
yield from bot.coro_send_message(event.conv, segments) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_by_name(self, name):\r\n return self.__filter(self.get_all_persons(), lambda x: name.lower().strip() in x.name.lower().strip())",
"def find_people(self, name=''):\n ## fixme -- can this query be combined?\n ## like this: db.inventory.find( { $or: [ { qty: { $lt: 20 } }, { sale: tr... | [
"0.8087586",
"0.80193865",
"0.7613154",
"0.7182396",
"0.7113466",
"0.7042476",
"0.6963772",
"0.68694234",
"0.6862454",
"0.68385226",
"0.68384284",
"0.68031275",
"0.6738345",
"0.66732985",
"0.6662252",
"0.66605294",
"0.6651283",
"0.6622626",
"0.65612906",
"0.65581536",
"0.6552... | 0.0 | -1 |
list all hangouts, supply keywords to filter by title | def hangouts(bot, event, *args):
text_search = " ".join(args)
lines = []
for convid, convdata in bot.conversations.get(filter="text:" + text_search).items():
lines.append("<b>{}</b>: <em>`{}`</em>".format(convdata["title"], convid))
lines.append(_('<b>Total: {}</b>').format(len(lines)))
if text_search:
lines.insert(0, _('<b>List of hangouts with keyword:</b> "<pre>{}</pre>"').format(text_search))
yield from bot.coro_send_message(event.conv, "<br />".join(lines)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hangouts(bot, event, *args):\n\n text_search = \" \".join(args)\n line = \"<b>List of hangouts with keyword:</b> \\\"{}\\\"<br />\".format(text_search)\n\n for conv in bot.list_conversations():\n conv_name = get_conv_name(conv)\n if text_search.lower() in conv_name.lower(): # For blank k... | [
"0.73923945",
"0.569828",
"0.5560075",
"0.5533528",
"0.55277205",
"0.5525617",
"0.54996574",
"0.5444355",
"0.5396228",
"0.5325632",
"0.5320193",
"0.5297989",
"0.52948684",
"0.52716166",
"0.525805",
"0.5255838",
"0.5218868",
"0.5202857",
"0.5202308",
"0.51878214",
"0.5180707",... | 0.7244985 | 1 |
exits current or other specified hangout | def leave(bot, event, conversation_id=None, *args):
arglist = list(args)
if conversation_id == "quietly":
arglist.append("quietly")
conversation_id = False
if not conversation_id:
conversation_id = event.conv_id
yield from command.run(bot, event, *["convleave", "id:" + conversation_id, " ".join(arglist)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remote_kill():",
"def quit(phenny, input):\n # Can only be done in privmsg by the owner\n if input.sender.startswith('#'): return\n if input.owner: \n phenny.write(['QUIT'])\n __import__('sys').exit(0)",
"def logout (self):\r\n self.sendline(\"exit\")\r\n index = self.expect([EOF, \"... | [
"0.60694605",
"0.60482144",
"0.6013676",
"0.5961392",
"0.59434426",
"0.5921607",
"0.5867641",
"0.58337927",
"0.58198786",
"0.5794014",
"0.57757974",
"0.5737049",
"0.57220066",
"0.57193136",
"0.5717689",
"0.57057047",
"0.570546",
"0.5675549",
"0.56520367",
"0.56438935",
"0.562... | 0.0 | -1 |
reload config and memory, useful if manually edited on running bot | def reload(bot, event, *args):
yield from bot.coro_send_message(event.conv, "<b>reloading config.json</b>")
bot.config.load()
yield from bot.coro_send_message(event.conv, "<b>reloading memory.json</b>")
bot.memory.load() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload(bot, event, *args):\n bot.config.load()\n bot.memory.load()",
"def reload_config(self):\n pass",
"def rehash(self):\n logging.info(\"Rehashing started\")\n modules = self.cmd_plugins.get_modules()\n CommandBot.pause(self)\n PlugBot.stop(self)\n\n loggi... | [
"0.82988477",
"0.7730746",
"0.7237101",
"0.7000755",
"0.6990611",
"0.69861",
"0.69167477",
"0.69043493",
"0.68545073",
"0.68489516",
"0.67825955",
"0.6778113",
"0.67457616",
"0.6589509",
"0.65724033",
"0.6516148",
"0.6433054",
"0.6433054",
"0.6330398",
"0.62764126",
"0.623042... | 0.7807844 | 1 |
displays or modifies the configuration | def config(bot, event, cmd=None, *args):
# consume arguments and differentiate beginning of a json array or object
tokens = list(args)
parameters = []
value = []
state = "key"
for token in tokens:
if token.startswith(("{", "[", '"', "'")):
# apparent start of json array/object, consume into a single list item
state = "json"
if state == "key":
parameters.append(token)
elif state == "json":
value.append(token)
else:
raise ValueError("unknown state")
if value:
parameters.append(" ".join(value))
if cmd == 'get' or cmd is None:
config_args = list(parameters)
value = bot.config.get_by_path(config_args) if config_args else dict(bot.config)
elif cmd == 'test':
num_parameters = len(parameters)
text_parameters = []
last = num_parameters - 1
for num, token in enumerate(parameters):
if num == last:
try:
json.loads(token)
token += " <b>(valid json)</b>"
except ValueError:
token += " <em>(INVALID)</em>"
text_parameters.append(str(num + 1) + ": " + token)
text_parameters.insert(0, "<b>config test</b>")
if num_parameters == 1:
text_parameters.append(_("<em>note: testing single parameter as json</em>"))
elif num_parameters < 1:
yield from command.unknown_command(bot, event)
return
yield from bot.coro_send_message(event.conv, "<br />".join(text_parameters))
return
elif cmd == 'set':
config_args = list(parameters[:-1])
if len(parameters) >= 2:
bot.config.set_by_path(config_args, json.loads(parameters[-1]))
bot.config.save()
value = bot.config.get_by_path(config_args)
else:
yield from command.unknown_command(bot, event)
return
elif cmd == 'append':
config_args = list(parameters[:-1])
if len(parameters) >= 2:
value = bot.config.get_by_path(config_args)
if isinstance(value, list):
value.append(json.loads(parameters[-1]))
bot.config.set_by_path(config_args, value)
bot.config.save()
else:
value = _('append failed on non-list')
else:
yield from command.unknown_command(bot, event)
return
elif cmd == 'remove':
config_args = list(parameters[:-1])
if len(parameters) >= 2:
value = bot.config.get_by_path(config_args)
if isinstance(value, list):
value.remove(json.loads(parameters[-1]))
bot.config.set_by_path(config_args, value)
bot.config.save()
else:
value = _('remove failed on non-list')
else:
yield from command.unknown_command(bot, event)
return
else:
yield from command.unknown_command(bot, event)
return
if value is None:
value = _('Parameter does not exist!')
config_path = ' '.join(k for k in ['config'] + config_args)
segments = [hangups.ChatMessageSegment('{}:'.format(config_path),
is_bold=True),
hangups.ChatMessageSegment('\n', hangups.SegmentType.LINE_BREAK)]
segments.extend(text_to_segments(json.dumps(value, indent=2, sort_keys=True)))
yield from bot.coro_send_message(event.conv, segments) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_new_config(self):\n print highlight(self.content, self.lexer(), Formatter())",
"def show_config() -> None:\n with _config_lock:\n config_util.show_config(\n _section_descriptions, cast(Dict[str, ConfigOption], _config_options)\n )",
"def configuration():",
"def con... | [
"0.72588235",
"0.7135416",
"0.69778156",
"0.6961172",
"0.6961172",
"0.69073594",
"0.6902952",
"0.68950194",
"0.67778105",
"0.67531836",
"0.6752861",
"0.6740131",
"0.67381626",
"0.6703439",
"0.6701336",
"0.66371745",
"0.66144705",
"0.6612495",
"0.65891933",
"0.65686184",
"0.65... | 0.0 | -1 |
get your user id | def whoami(bot, event, *args):
if bot.memory.exists(['user_data', event.user_id.chat_id, "nickname"]):
try:
fullname = '{0} ({1})'.format(event.user.full_name.split(' ', 1)[0]
, bot.get_memory_suboption(event.user_id.chat_id, 'nickname'))
except TypeError:
fullname = event.user.full_name
else:
fullname = event.user.full_name
yield from bot.coro_send_message(event.conv, _("<b><pre>{}</pre></b>, chat_id = <i>{}</i>").format(fullname, event.user.id_.chat_id)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_id(self):\n return self.id_user",
"def get_id(self):\n return self.user_id",
"def get_id(self): \n\t\treturn (self.user_id)",
"def get_id(self) -> int:\n return self.user_id",
"def get_user_id(self):\n raise NotImplementedError",
"def get_user_id():\n user_id =... | [
"0.8573851",
"0.8466169",
"0.83694476",
"0.8316009",
"0.823462",
"0.81970227",
"0.81609654",
"0.81415033",
"0.81415033",
"0.81415033",
"0.81251734",
"0.81044585",
"0.80949605",
"0.80545497",
"0.8026332",
"0.8026332",
"0.80024433",
"0.80024433",
"0.7988893",
"0.79770106",
"0.7... | 0.0 | -1 |
get current conversation id | def whereami(bot, event, *args):
yield from bot.coro_send_message(
event.conv,
_("You are at <b><pre>{}</pre></b>, conv_id = <i><pre>{}</pre></i>").format(
bot.conversations.get_name(event.conv),
event.conv.id_)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_presentation_id(self):\r\n i = self.mainWidget.talkComboBox.currentIndex()\r\n return self.mainWidget.talkComboBox.model().index(i, 1).data(QtCore.Qt.DisplayRole).toString()",
"async def get_chat_id(conn, chat):\n query = db.chats.select().where(db.chats.c.name == chat)\n ... | [
"0.6970969",
"0.6949727",
"0.67635965",
"0.6569151",
"0.650528",
"0.6463532",
"0.64468443",
"0.6399521",
"0.6366804",
"0.6358743",
"0.6315672",
"0.6293074",
"0.62367743",
"0.62367743",
"0.62367743",
"0.62367743",
"0.62367743",
"0.62367743",
"0.62367743",
"0.62367743",
"0.6236... | 0.0 | -1 |
Get the absolute path of the given path relative to the project root. | def root(*args):
return join(abspath(dirname(__file__)), *args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def absolute_path(path):\n return os.path.abspath(\n os.path.join(\n os.path.dirname(__file__),\n \"..\",\n path\n )\n )",
"def get_abspath(path: str) -> str:\n if os.path.isabs(path):\n return path\n\n return os.path.join(os.path.dirname(__file__... | [
"0.8670202",
"0.84047705",
"0.8294552",
"0.821738",
"0.820904",
"0.8198882",
"0.811792",
"0.8009987",
"0.79817665",
"0.79465127",
"0.79298115",
"0.79059446",
"0.7758221",
"0.76706994",
"0.7659717",
"0.761842",
"0.7523429",
"0.74900115",
"0.7480654",
"0.74671346",
"0.74658513"... | 0.0 | -1 |
Initializes a Map with the given number of buckets. | def new(num_buckets=256):
aMap = [] #creating empty list aMap
for i in range(0, num_buckets):
aMap.append([]) #append num_buckets into aMap
return aMap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(num_buckets=256):\n\t#sets aMap variable to an empty list\n\t#then fills that list with the specified number of other empty lists ('buckets') \n\t#returns the new aMap\n\taMap = []\n\tfor i in range(0, num_buckets):\n\t\taMap.append([])\n\treturn aMap",
"def new(num_buckets=256):\n aMap=[]",
"def ne... | [
"0.8146247",
"0.8119073",
"0.7875877",
"0.7073408",
"0.67659897",
"0.6762607",
"0.6628239",
"0.66029876",
"0.6587286",
"0.6574333",
"0.65716136",
"0.6556335",
"0.64881253",
"0.6487887",
"0.64756536",
"0.64513785",
"0.64458674",
"0.637114",
"0.6361271",
"0.6350683",
"0.6333639... | 0.82026 | 0 |
Given a key this will create a number and then convert it to an index for the aMap's buckets. | def hash_key(aMap, key):
return hash(key) % len(aMap) #(this will give numbers between 0 and 255) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _bucket_index(self, key):\n # Calculate the given key's hash code and transform into bucket index\n return hash(key) % len(self.buckets)",
"def _bucket_index(self, key):\n # return hash(key) % len(self.buckets)\n hash_value = 0 # hash is set to 0\n for char in key: # iterat... | [
"0.7262226",
"0.7042629",
"0.6687089",
"0.6593907",
"0.6530378",
"0.6441333",
"0.63708365",
"0.63708365",
"0.63523155",
"0.63339436",
"0.6318475",
"0.6303372",
"0.6251505",
"0.6200127",
"0.6150734",
"0.6006674",
"0.59949756",
"0.59552133",
"0.5903876",
"0.58886397",
"0.581383... | 0.603992 | 15 |
Returns the index, key, and value of a slot found in a bucket. Returns 1, key, and default (none if not set) when not found. | def get_slot(aMap, key, default=None):
bucket = get_bucket(aMap, key)
for i, kv in enumerate(bucket):
k, v = kv
if key == k:
return i, k, v
return -1, key, default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_slot(aMap, key, default=None):\n\t#now that we know which bucket the key could be in\n\t#we iterate through all the elements of that bucket until it finds the key\n\t\n\tbucket = get_bucket(aMap, key)\n\t\n\tfor i, kv in enumerate(bucket):\n\t#enumerate returns a tuple containing the count (starting at 0) ... | [
"0.79758656",
"0.773949",
"0.6553314",
"0.64808375",
"0.6404719",
"0.62866116",
"0.62866116",
"0.62585574",
"0.6220723",
"0.6191381",
"0.6135561",
"0.61248016",
"0.61166006",
"0.6086522",
"0.5985429",
"0.5919926",
"0.5919475",
"0.5899041",
"0.5883153",
"0.58819985",
"0.586089... | 0.79655206 | 1 |
Gets the value in a bucket for the given key, or the default. | def get(aMap, key, default=None):
i, k, v = get_slot(aMap, key, default=default)
return v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, key):\n # Find bucket where given key belongs\n # Check if key-value entry exists in bucket\n # If found, return value associated with given key\n # Otherwise, raise error to tell user get failed\n # Hint: raise KeyError('Key not found: {}'.format(key))\n key... | [
"0.75909036",
"0.72930884",
"0.7238413",
"0.7228342",
"0.7209287",
"0.7198019",
"0.7187625",
"0.71601707",
"0.71571046",
"0.71557206",
"0.7116578",
"0.7103366",
"0.70757085",
"0.70705044",
"0.70379204",
"0.7030813",
"0.70154697",
"0.7009432",
"0.6978222",
"0.6965656",
"0.6956... | 0.65300626 | 48 |
Sets the key to the value, replacing any existing value. | def set(aMap, key, value):
bucket = get_bucket(aMap, key)
i, k, v = get_slot(aMap, key)
if i >= 0:
# the key exists, replace it
bucket[i] = (key, value)
else:
# the key does not, append to create it
bucket.append((key, value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, key, value):\n self.remove(key)\n self.add(key, value)",
"def set(self, key, value):\n self._data[key] = value",
"def set(self, key, value):\n self._data[key] = value",
"def set(self, key, value):",
"def set(self, key, value):",
"def set_value(self, key, value):\... | [
"0.8234508",
"0.8196163",
"0.8196163",
"0.8098003",
"0.8098003",
"0.8071703",
"0.797768",
"0.7930369",
"0.7925891",
"0.7905772",
"0.78749925",
"0.784121",
"0.7819039",
"0.77950263",
"0.77950263",
"0.77950263",
"0.7767018",
"0.7767018",
"0.77196425",
"0.77172077",
"0.76859033"... | 0.0 | -1 |
Deletes the given key from the Map. | def delete(aMap, key):
bucket = get_bucket(aMap, key)
for i in xrange(len(bucket)):
k, v = bucket[i]
if key == k:
del bucket[i]
break | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, key):\n self.map.pop(key, None)",
"def delete(self, key):\r\n index = self.search(key)\r\n if self.contains_key_at(key, index):\r\n del self.keys[index]",
"def delete(self, key):\n try: \n self.pop(key)\n \n except KeyError: \n ... | [
"0.8674209",
"0.8070946",
"0.8042204",
"0.8000676",
"0.799619",
"0.7985804",
"0.79814565",
"0.7755277",
"0.7707507",
"0.7682551",
"0.767121",
"0.76492697",
"0.7647049",
"0.7551489",
"0.75297976",
"0.75272954",
"0.75068957",
"0.75001955",
"0.74767476",
"0.7428676",
"0.74073803... | 0.78218615 | 7 |
Prints out what's in the Map. | def list(aMap):
for bucket in aMap:
if bucket:
for k, v in bucket:
print k, v | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_map(self):\n for line in self.map:\n print(\"\".join(line))",
"def show_map(self):\n print(self.__str__())",
"def print_map(self):\n for row in self.world_map:\n for cell in row:\n print(cell, end=\"\")\n print()",
"def show_map(ma... | [
"0.8725545",
"0.8150838",
"0.81311876",
"0.8006684",
"0.7795288",
"0.7684873",
"0.7540106",
"0.7459364",
"0.74092364",
"0.73927355",
"0.7263824",
"0.7254908",
"0.7188095",
"0.7177206",
"0.71670544",
"0.7104245",
"0.71041894",
"0.70907617",
"0.70189255",
"0.69896406",
"0.69779... | 0.6425096 | 45 |
this keyword is used to grep keywords in a file, then return matching lines.\n filePath is the full path of the file.\n searchKeyWord is the keyword filter.\n isPattern is the flag indicate if searchKeyword is a normal search string or regular expression pattern.\n isCaseSensitive is the flag indicate if searchKeyword is case sensitive.\n timeout default to 0, mean not timeout wait.\n retry_interval is default to 20, mean every 20s will check the log once.\n Fromline default to 0, which mean from which line to search the content.\n The return value is a list for all the matched lines content.\n | def grep_local_file(filePath, searchKeyWord, isPattern=True, isCaseSensitive=True, Fromline=0, timeout=0, retry_interval=0):
returnMatchLines = []
current = time.time()
timout_value = float(timeout)
maxtime = current + timout_value
while (current <= maxtime):
fileObj = open(filePath, "r")
allLines = fileObj.readlines()
fileObj.close()
allLines=allLines[int(Fromline):]
if isPattern == False:
for line in allLines:
if isCaseSensitive and line.find(searchKeyWord) != -1:
returnMatchLines.append(line)
if not isCaseSensitive and line.lower().find(searchKeyWord.lower()) != -1:
returnMatchLines.append(line)
else:
if isCaseSensitive == False:
pattern = re.compile(searchKeyWord, re.I)
else:
pattern = re.compile(searchKeyWord)
for line in allLines:
match = pattern.search(line)
if match:
returnMatchLines.append(line)
if len(returnMatchLines) < 1:
if timout_value == 0:
break
current = time.time()
time.sleep(float(retry_interval))
else:
break
return returnMatchLines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dictionary_file_lines_for_keywords(self):\n keywords_iter = iter(self.keywords)\n next_keyword = keywords_iter.next()\n print(\"Searching for keyword {}\".format(next_keyword))\n\n self.dictionary_file.open_handle()\n result_lines = list()\n while next_keyword:\n ... | [
"0.620735",
"0.61173135",
"0.6065361",
"0.6045502",
"0.5981804",
"0.5717122",
"0.57109797",
"0.5688",
"0.56368005",
"0.5602805",
"0.5584422",
"0.55832374",
"0.5575134",
"0.5572834",
"0.5553349",
"0.5479438",
"0.5465954",
"0.54646385",
"0.541022",
"0.536871",
"0.53384507",
"... | 0.76741695 | 0 |
Modify the old contents to new contents.\n oldFile is the original file fullpath.\n newFile is the output file fullpath.\n | def Modify_lines(oldFile, newFile, modifydic):
fd = open(oldFile, "r")
lines = fd.readlines()
fd.close()
for key in modifydic.keys():
for i in range(len(lines)):
if lines[i].find(key) != -1:
lines[i]=lines[i].replace(key, modifydic[key])
fd = open(newFile, "w")
fd.writelines(lines)
fd.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_old_new_file(self, old_file, new_file):\n Gumtree.gumtree.setOldAndNewFile(old_file, new_file)",
"def replace_in_file(path, old, new):\n with open(path) as fp:\n content = fp.read()\n\n lpf.ensure_removed(path)\n with open(path, 'w') as fp:\n fp.write(content.replace(old, ne... | [
"0.73039925",
"0.683418",
"0.6784003",
"0.6522194",
"0.64244884",
"0.64235234",
"0.6308947",
"0.6202852",
"0.6194239",
"0.6156984",
"0.6144471",
"0.6144471",
"0.6132543",
"0.6120333",
"0.6111946",
"0.6105388",
"0.6005788",
"0.59978384",
"0.5990765",
"0.598989",
"0.5956652",
... | 0.5691663 | 34 |
Modify the old contents to new contents.\n oldFile is the original file fullpath.\n newFile is the output file fullpath.\n case_insensitive is True or false.\n | def Modify_lines_matching_pattern(oldFile, newFile, modifydic, case_insensitive):
fd = open(oldFile, "r")
lines = fd.readlines()
fd.close()
for key in modifydic.keys():
if case_insensitive == True:
pattern = re.compile(key, re.I)
else:
pattern = re.compile(key)
for i in range(len(lines)):
if pattern.search(lines[i]):
lines[i] = re.sub(pattern, modifydic[key], lines[i])
fd = open(newFile, "w")
fd.writelines(lines)
fd.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replaceLine(oldFile, string1, string2, newString, newFile = \"TempFile\", mvFile = True):\n with open(oldFile, \"r\") as oldfile, open(newFile, \"w\") as newfile:\n oldfile_read = oldfile.readlines()\n for line in oldfile_read:\n line_number = oldfile_read.index(line)\n i... | [
"0.6301766",
"0.6221288",
"0.61109865",
"0.6051536",
"0.6004594",
"0.59841347",
"0.59138376",
"0.58587974",
"0.58379644",
"0.5784545",
"0.57423884",
"0.57423884",
"0.57224125",
"0.5713668",
"0.5694037",
"0.5662745",
"0.56497025",
"0.5639031",
"0.56102854",
"0.5609075",
"0.559... | 0.66408944 | 0 |
Must be called at the start of the execute method. Requres self.parent to be set though. | def gui_init(self):
if not self.parent is None:
self.parent.children.append(self)
self.children = []
self.priority = PRIORITY_GUI_ELEMENTS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_parent(self, parent):\n self.__parent = parent",
"def on_parent_changed(self):\n pass",
"def _set_parent(self, parent):\n assert self._parent == None # implementing reparenting requires more work\n self._parent = parent",
"def __init__(self, parent):\n self._parent... | [
"0.7055857",
"0.6956532",
"0.68381613",
"0.66947806",
"0.667968",
"0.667968",
"0.667968",
"0.667968",
"0.6649174",
"0.6649174",
"0.6632888",
"0.6632888",
"0.6609972",
"0.6582578",
"0.6560431",
"0.65357274",
"0.6534041",
"0.6511221",
"0.64896256",
"0.64857435",
"0.6483478",
... | 0.0 | -1 |
Stub designed to be called every frame. | def update(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frame(self):",
"def dispatch_frame(self, frame):",
"def test_stub(self):\n pass",
"def __init__(self):\n Frame.__init__(self, spec.FRAME_HEARTBEAT, 0)",
"def frames():\n raise RuntimeError('Must be implemented by subclasses.')",
"def __init__(self, frame):\n self.frame = f... | [
"0.67758244",
"0.6738759",
"0.6546954",
"0.64710164",
"0.63565457",
"0.62726927",
"0.60270774",
"0.6023457",
"0.59866047",
"0.5885328",
"0.5885328",
"0.5817396",
"0.5783843",
"0.5783843",
"0.5783843",
"0.5783843",
"0.57834935",
"0.5780529",
"0.5770622",
"0.5741516",
"0.573583... | 0.0 | -1 |
Override this method to respond to the mouse hovering. Called AFTER mouse_enter if that method gets called. | def mouse_over(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_hover(self) -> None:",
"def mouse_enter(self):\n pass",
"def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):\n self.setCursor(Qt.ArrowCursor)",
"def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):\n self.setCursor(Qt.ArrowCursor)",
"def hoverEnterEvent(self, even... | [
"0.82596284",
"0.82400256",
"0.7596146",
"0.7596146",
"0.7585354",
"0.746606",
"0.72723836",
"0.72469157",
"0.715166",
"0.70885944",
"0.7083147",
"0.7055447",
"0.7015012",
"0.69966567",
"0.6956015",
"0.6937374",
"0.69364107",
"0.6927758",
"0.6825649",
"0.68089414",
"0.6644783... | 0.8150122 | 2 |
Override this method to respond to the mouse not being over the element. Called AFTER mouse_out if that method gets called. | def mouse_not_over(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_out(self):\n pass",
"def mouse_over(self):\n pass",
"def on_unhover(self) -> None:",
"def mouse_out(self, event):\r\n self['background'] = self.defaultBackground",
"def MouseOverItem(self,item):\r\n pass",
"def OnMouse(self,event):\r\n if event.Moving():\r\n ... | [
"0.82283014",
"0.7914597",
"0.7469889",
"0.7266409",
"0.69720304",
"0.67417073",
"0.6612279",
"0.65831256",
"0.6578622",
"0.6568934",
"0.6539237",
"0.65102863",
"0.6490017",
"0.63950545",
"0.6386635",
"0.633578",
"0.6321943",
"0.6312482",
"0.6304269",
"0.62664276",
"0.6236682... | 0.8337129 | 0 |
Override this method to respond to the mouse entering the element. | def mouse_enter(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_over(self):\n pass",
"def enterEvent(self, ev):\n self.setFocus(Qt.MouseFocusReason)\n self.__pointerLeftWidget = False\n self.setCursor(self.defaultCursor)\n QGraphicsView.enterEvent(self, ev)",
"def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):\n ... | [
"0.72074497",
"0.7113512",
"0.7032834",
"0.7032834",
"0.69916975",
"0.69322693",
"0.6845052",
"0.6836298",
"0.6764046",
"0.6755759",
"0.6748612",
"0.65055966",
"0.649724",
"0.64849204",
"0.6443039",
"0.64336354",
"0.64145774",
"0.64126825",
"0.6396133",
"0.6368497",
"0.633384... | 0.85851264 | 0 |
Override this method if to respond to the mouse leaving the element. | def mouse_out(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_mouse_leave (self, event):\n\n\t\tif not self.clicked:\n\n\t\t\tself.cursor_position = [-1,-1]\n\t\t\tself.redraw_canvas()\n\t\t\tself.hide_tip()#self.timer1 = gobject.timeout_add(2000, self.hide_tip)",
"def hoverLeaveEvent(self, event: 'QGraphicsSceneHoverEvent'):\n QApplication.instance().restore... | [
"0.7270982",
"0.71157235",
"0.704455",
"0.7016063",
"0.67757094",
"0.6765137",
"0.67564774",
"0.6679935",
"0.6604109",
"0.6557472",
"0.6523289",
"0.6511427",
"0.6496346",
"0.641088",
"0.64010245",
"0.62832344",
"0.62736565",
"0.6220964",
"0.62058276",
"0.6200299",
"0.6186985"... | 0.7645027 | 0 |
Override this method to respond to the left mouse button being held down over the element. | def mouse_left_down(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leftButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.LEFT_BUTTON)",
"def mouse_left_up(self):\n pass",
"def mouse_right_down(self):\n pass",
"def OnLeftDown(self, event): # ANDY some PAN ideas from http://code.google.com/p/pyslip/\n if event.ShiftDown():\n eve... | [
"0.7982013",
"0.7962645",
"0.77094394",
"0.7422216",
"0.7344164",
"0.73293656",
"0.7312629",
"0.72654736",
"0.72546726",
"0.72282684",
"0.72147775",
"0.71788275",
"0.717061",
"0.7139647",
"0.70763767",
"0.7069452",
"0.7060475",
"0.70085615",
"0.6988899",
"0.6951568",
"0.69106... | 0.8459492 | 0 |
Override this method to respond to the left mouse button being released on the element. | def mouse_left_up(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouseReleaseEvent(self, event):\n button = event.button()\n\n # select an item on which we clicked\n item = self.itemAt(event.x(), event.y())\n if item:\n self.setCurrentItem(item)\n if button == 1:\n print \"SIMPLE LEFT CLICK\"",
"def mouse_le... | [
"0.7712217",
"0.77117985",
"0.75974166",
"0.7530598",
"0.7514149",
"0.7402424",
"0.7371776",
"0.7358954",
"0.72312045",
"0.7079388",
"0.70650333",
"0.70383614",
"0.7029258",
"0.70134234",
"0.7007504",
"0.69767445",
"0.69388354",
"0.68525803",
"0.6844571",
"0.6785241",
"0.6761... | 0.75677735 | 3 |
Override this method to respond to the right mouse button being held down over the element. | def mouse_right_down(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_right_up(self):\n pass",
"def rightButtonDown(self):\n\t\tautopy.mouse.toggle(True,autopy.mouse.RIGHT_BUTTON)",
"def onRightDown(self, event):\n\n pass",
"def rightButtonUp(self):\n\t\tautopy.mouse.toggle(False,autopy.mouse.RIGHT_BUTTON)",
"def RightClick(self):\n self._PressRigh... | [
"0.7990627",
"0.7949314",
"0.7513452",
"0.73088235",
"0.7308333",
"0.7301941",
"0.7238975",
"0.7186552",
"0.7162225",
"0.7041994",
"0.69716364",
"0.69352114",
"0.69093263",
"0.6895724",
"0.6866687",
"0.6828164",
"0.6804783",
"0.6775382",
"0.6756245",
"0.67409694",
"0.67354745... | 0.85940593 | 0 |
Override this method to respond to the right mouse button being released on the element. | def mouse_right_up(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_right_down(self):\n pass",
"def on_mouse_release(self, x, y, button, key_modifiers):\r\n pass",
"def mouse_release_event(self, x: int, y: int, button: int):\n pass",
"def on_mouse_release(self, x, y, button):\n pass",
"def rightButtonDown(self):\n\t\tautopy.mouse.toggl... | [
"0.7984992",
"0.7669759",
"0.7560166",
"0.745702",
"0.73336405",
"0.7120719",
"0.7056546",
"0.7043819",
"0.70383954",
"0.68456197",
"0.6824234",
"0.68107015",
"0.67931944",
"0.6708472",
"0.6638119",
"0.6634257",
"0.6535301",
"0.6518771",
"0.6508248",
"0.6502479",
"0.6477549",... | 0.7677217 | 1 |
Override this method to respond to the middle mouse button being held down over the element. | def mouse_middle_down(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_middle_up(self):\n pass",
"def on_mouse_release(self, x, y, button, key_modifiers):\r\n pass",
"def mouse_right_up(self):\n pass",
"def on_mouse_release(self, x, y, button):\n pass",
"def ev_mousebuttonup(self, event: MouseButtonUp) -> None:",
"def ev_mousebuttondown... | [
"0.7794178",
"0.73346615",
"0.7278942",
"0.7235611",
"0.71748966",
"0.71505445",
"0.7085906",
"0.70397234",
"0.7038093",
"0.69910294",
"0.69589084",
"0.69151455",
"0.69036335",
"0.68575525",
"0.6837659",
"0.6815109",
"0.68076855",
"0.67690843",
"0.6741163",
"0.67272973",
"0.6... | 0.8144935 | 0 |
Override this method to respond to the middle mouse button being released on the element. | def mouse_middle_up(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_mouse_release(self, x, y, button):\n pass",
"def on_mouse_release(self, x, y, button, key_modifiers):\r\n pass",
"def mouse_release_event(self, x: int, y: int, button: int):\n pass",
"def mouse_middle_down(self):\n pass",
"def ev_mousebuttonup(self, event: MouseButtonUp) ... | [
"0.7939974",
"0.78150564",
"0.77264124",
"0.7405234",
"0.72475106",
"0.7165971",
"0.70476747",
"0.70099586",
"0.6967954",
"0.6950922",
"0.6937272",
"0.69269466",
"0.6920002",
"0.6874369",
"0.684507",
"0.6809855",
"0.67554647",
"0.67411256",
"0.67261755",
"0.67031986",
"0.6685... | 0.7241948 | 5 |
Override this method to respond to the mouse wheel spinning when the mouse is being held down over the element. | def mouse_wheel_down(self):
if not self.scroll_element is None:
self.scroll_element.mouse_wheel_down() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_mouse_wheel(self, e): # pragma: no cover\n super(TraceView, self).on_mouse_wheel(e)\n if e.modifiers == ('Alt',):\n start, end = self._interval\n delay = e.delta * (end - start) * .1\n self.shift(-delay)",
"def on_mouse_press(self, event):\n self.on_m... | [
"0.71962875",
"0.71476215",
"0.7129475",
"0.69585156",
"0.6720184",
"0.6612791",
"0.6487933",
"0.642528",
"0.6412528",
"0.64030284",
"0.6369889",
"0.6330504",
"0.6318762",
"0.6288254",
"0.62793976",
"0.6234082",
"0.62089163",
"0.6207074",
"0.6181349",
"0.61734873",
"0.6170471... | 0.7533816 | 0 |
Override this method to respond to the mouse wheel spinning when the mouse is being held down over the element. | def mouse_wheel_up(self):
if not self.scroll_element is None:
self.scroll_element.mouse_wheel_up() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mouse_wheel_down(self):\n if not self.scroll_element is None:\n self.scroll_element.mouse_wheel_down()",
"def on_mouse_wheel(self, e): # pragma: no cover\n super(TraceView, self).on_mouse_wheel(e)\n if e.modifiers == ('Alt',):\n start, end = self._interval\n ... | [
"0.7533228",
"0.71954405",
"0.7149048",
"0.6959555",
"0.67212677",
"0.6612315",
"0.6487572",
"0.6425213",
"0.64136875",
"0.64034486",
"0.63715255",
"0.6332197",
"0.6320124",
"0.62879443",
"0.6280145",
"0.6234647",
"0.6210043",
"0.6206643",
"0.6182813",
"0.61733097",
"0.617065... | 0.7129238 | 3 |
Returns the pointer to the GUI object that is under the screen coordinates passed in to the coordinates parameter. current_best should be None unless called from this method. | def handle_input(self, coordinates, current_best = None):
if self.disable:
return current_best
if self.is_coords_in_bounds(coordinates):
if current_best is None or self.z <= current_best.z:
current_best = self
else:
if self._currently_hovered:
self.mouse_out()
self._currently_hovered = False
self.mouse_not_over()
for child in self.children:
current_best = child.handle_input(coordinates, current_best)
return current_best | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_gui(self):\n return self._current_gui",
"def getlocalbestcoordinate(self):\n return self.localbest.coordinate",
"def get_below(self):\n current_index = ALL_WINDOWS.index(self)\n if current_index == 0:\n return BASE_SCREEN\n\n return ALL_WINDOWS[current_... | [
"0.6390522",
"0.58366036",
"0.56894904",
"0.54773855",
"0.5454908",
"0.5454908",
"0.5435594",
"0.53845",
"0.53640234",
"0.5357284",
"0.53187394",
"0.53144544",
"0.53096515",
"0.5299734",
"0.52627397",
"0.5261838",
"0.52561283",
"0.52342606",
"0.52289695",
"0.52089494",
"0.520... | 0.6283108 | 1 |
Must be called at the start of the execute method. Make sure that image has been set before calling this. A None image will draw a generic button. | def gui_init(self):
GUI_element.gui_init(self)
self.hover_sound = False
if not self.image is None:
self.generic_button = False
self.width = self.image.width if self.width == 0 else self.width
self.height = self.image.height if self.height == 0 else self.height
else:
# Set up a generic button
self.generic_button = True
self.image = self.game.core.media.gfx['gui_button_generic_background']
self.draw_strategy = "gui_button"
# fixed height
self.height = 30
# Create the text
self.generic_button_text_object = Text(self.game.core.media.fonts["generic_buttons"], self.x, self.y + (self.height / 2), TEXT_ALIGN_CENTER, self.generic_button_text)
self.generic_button_text_object.z = self.z - 1
self.generic_button_text_object.colour = (1.0,1.0,1.0)
# Set up the width, if we have a larger than normal width then we want to centre the text.
if self.width < self.generic_button_text_object.text_width + 20:
self.width = self.generic_button_text_object.text_width + 20
self.generic_button_text_object.x += (self.width / 2)
self.sequence_count = self.image.num_of_frames
self.draw_strategy_call_parent = False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_image(self):\n button = self.buttons.checkedButton()\n if button is None:\n return\n\n button.click()",
"def boutton(self,img1,x,y):\r\n self.button.append(self.creat_image(img1,x,y))",
"def showBtnImg(*args, **kwargs):\n\targs[0].get_image().show()",
"def s... | [
"0.70161515",
"0.70027477",
"0.6839604",
"0.677396",
"0.67521006",
"0.6693708",
"0.6679425",
"0.66226333",
"0.63661647",
"0.6363211",
"0.6360723",
"0.63584304",
"0.6267832",
"0.624993",
"0.6242955",
"0.62371415",
"0.62187743",
"0.62062895",
"0.6200216",
"0.61864775",
"0.61708... | 0.70079434 | 1 |
Cleans up generic button text. | def On_Exit(self):
GUI_element.On_Exit(self)
if self.generic_button:
self.generic_button_text_object.Kill() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_text(self):\n # use the .children attribute to access all widgets that are \"in\" another widget\n self.root.ids.Title.text = \"\"\n self.root.ids.Artist.text = \"\" #Empty the text boxes\n self.root.ids.Year.text = \"\"\n for instance in self.root.ids.entr... | [
"0.71367276",
"0.6654607",
"0.62674713",
"0.62383723",
"0.6229657",
"0.62284523",
"0.6159789",
"0.6159789",
"0.6125323",
"0.6115299",
"0.60665995",
"0.60454965",
"0.60393435",
"0.6017328",
"0.600761",
"0.59775025",
"0.59645116",
"0.59597695",
"0.5940703",
"0.5930928",
"0.5929... | 0.0 | -1 |
Override this to hook into selection | def on_selected_new_item(self, item):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_selection(self):\n raise NotImplementedError",
"def _on_select(self, object):\n pass",
"def onSelected(self):\n pass",
"def select(self):\r\n pass",
"def select(self):\n pass",
"def select(self):\n pass",
"def misc_select(self, event):\n\n sel... | [
"0.7809181",
"0.76719594",
"0.7624841",
"0.7551666",
"0.73993313",
"0.73993313",
"0.70904946",
"0.7071494",
"0.7046047",
"0.70314103",
"0.6925105",
"0.6867852",
"0.68644136",
"0.67947495",
"0.6785362",
"0.67763144",
"0.6772083",
"0.66005945",
"0.6589057",
"0.65776175",
"0.657... | 0.62326604 | 41 |
Called when the slider is dragged. Designed to be overridden to add custom behaviour. | def slider_dragged(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_slider(self, instance, value):\n self.slider.bind(value=self.update_proxy)\n self.bind(pos=self.hack_position)\n self.slider.bind(pos=self.hack_position)",
"def mouseDragged(self, point, delta):\n pass",
"def dragEnterEvent(self, event):",
"def drag(self, event):\n s... | [
"0.71016735",
"0.6670154",
"0.65497184",
"0.6326585",
"0.6050225",
"0.6031739",
"0.6006089",
"0.6001614",
"0.5967166",
"0.5907364",
"0.5884901",
"0.5763239",
"0.57620794",
"0.576003",
"0.57411623",
"0.56494236",
"0.56295526",
"0.56161594",
"0.56027746",
"0.56000704",
"0.56000... | 0.882381 | 0 |
Save the RMS and the model | def save_auxiliary_stats(self):
self.rms.save_rms() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save():",
"def save(self):\n print(\"==> Saving model to\", self.model_dir)\n self.model.save(self.model_dir)",
"def save_model(self):\n pass",
"def save(self,model_path):\n pass\n # filename = \"Models/\"+model_path+\"1.sav\"\n # pickle.dump(self.crf_model, open... | [
"0.7302422",
"0.72884136",
"0.7273365",
"0.72314125",
"0.72195584",
"0.7218506",
"0.7167318",
"0.71472657",
"0.71167964",
"0.71082217",
"0.71005446",
"0.70474595",
"0.7043401",
"0.6990493",
"0.69831663",
"0.696337",
"0.69589764",
"0.69570756",
"0.6942004",
"0.69397706",
"0.69... | 0.0 | -1 |
Restore the RMS and the model | def restore_auxiliary_stats(self):
self.rms.restore_rms() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self):\n\n self.brain.restore_checkpoint()",
"def restore(self):\n self.igate.restore()\n self.fgate.restore()\n self.ogate.restore()\n super(LSTM, self).restore()",
"def _restore(self, a_path):\n super(RDPAnalyzer, self)._restore(a_path)\n self._mod... | [
"0.7601171",
"0.7543818",
"0.72456396",
"0.7160926",
"0.7156663",
"0.71135336",
"0.7106162",
"0.7077936",
"0.70766246",
"0.7028947",
"0.6989924",
"0.6961817",
"0.6961006",
"0.6929173",
"0.69193035",
"0.6906893",
"0.6885233",
"0.6881164",
"0.6835818",
"0.68012977",
"0.67983717... | 0.69908047 | 10 |
maintain the listbox containing all anime | def update_list(*args):
search_term = search_var.get()
all_anime = load(open(Save_file_dir.joinpath("anime_save.p"), "rb"))
all_anime_list = []
for key, value in all_anime.items():
all_anime_list.append(key)
libox_all_anime.delete(0, END)
for item in all_anime_list:
if search_term.lower() in item.lower():
libox_all_anime.insert(END, item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_libox_all_anime():\n ## print(\"update_libox_all_anime is runnig\")\n a = libox_all_anime.get(0, END)\n ## print(\"the contents or a :\", a)\n b = []\n for x in a:\n ## print(\"this is x: \", x)\n b.append(x)\n ## print(x)\n for x in updated_your_anime():\n ... | [
"0.671851",
"0.6260187",
"0.5981027",
"0.5977746",
"0.593248",
"0.5867335",
"0.5842246",
"0.5801796",
"0.5682856",
"0.56715244",
"0.5624754",
"0.5609787",
"0.55960953",
"0.55914015",
"0.5534456",
"0.5519105",
"0.5510638",
"0.54329985",
"0.54270685",
"0.5414526",
"0.5371495",
... | 0.61596596 | 2 |
function that ensures that the anime in user choosen listbox isn't in all anime listbox | def update_libox_all_anime():
## print("update_libox_all_anime is runnig")
a = libox_all_anime.get(0, END)
## print("the contents or a :", a)
b = []
for x in a:
## print("this is x: ", x)
b.append(x)
## print(x)
for x in updated_your_anime():
if x in b:
b.remove(x)
c = sorted(b)
## print(b)
libox_all_anime.delete(0, END)
for x in c:
libox_all_anime.insert(END, x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_list(*args):\n\n search_term = search_var.get()\n all_anime = load(open(Save_file_dir.joinpath(\"anime_save.p\"), \"rb\"))\n\n all_anime_list = []\n for key, value in all_anime.items():\n all_anime_list.append(key)\n\n libox_all_anime.delete(0, END)\n\n for item in all_anime_lis... | [
"0.5358605",
"0.5259478",
"0.5149276",
"0.51280844",
"0.51028097",
"0.50867",
"0.50787604",
"0.5066245",
"0.5039338",
"0.5033899",
"0.50224185",
"0.5019272",
"0.49440777",
"0.49417982",
"0.4912668",
"0.49124354",
"0.49081933",
"0.4905151",
"0.49043363",
"0.48986632",
"0.48858... | 0.58440846 | 0 |
Quit the Tcl interpreter. All widgets will be destroyed. | def close():
# final()
# pack_forget(p
dump(your_anime, open(Save_file_dir.joinpath("users_anime_save.p"), "wb")) # store user anime in file
dump(putback, open(Save_file_dir.joinpath("putback_save.p"), "wb")) # store putback in file
frame1.quit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quit(self) -> None:\n global tcl_interp\n\n for child in tuple(self._children.values()):\n child.destroy()\n\n self._tcl_call(None, \"destroy\", self.tcl_path)\n self._tcl_call(None, \"destroy\", self.wm_path)\n\n tcl_interp = None\n\n self.app.quit()",
"d... | [
"0.844571",
"0.7491263",
"0.73512673",
"0.72736156",
"0.71561265",
"0.71103084",
"0.705774",
"0.7029557",
"0.700763",
"0.69826657",
"0.6969417",
"0.69682014",
"0.69428045",
"0.69416267",
"0.69058084",
"0.68633515",
"0.6805044",
"0.67926675",
"0.67690897",
"0.6764437",
"0.6718... | 0.0 | -1 |
Set up GenericRelations for a given actionable model. Needed because actstream's generic relationship setup functionality is brittle and unreliable. | def actstream_register_model(model):
for field in ('actor', 'target', 'action_object'):
generic.GenericRelation(Action,
content_type_field='%s_content_type' % field,
object_id_field='%s_object_id' % field,
related_name='actions_with_%s_%s_as_%s' % (
model._meta.app_label, model._meta.module_name, field),
).contribute_to_class(model, '%s_actions' % field)
setattr(Action, 'actions_with_%s_%s_as_%s' % (model._meta.app_label, model._meta.module_name, field), None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_add_relation_types(self):\n pass",
"def test_add_relation_type(self):\n pass",
"def test_change_relation_types(self):\n pass",
"def init_model(connection):\n db = connection\n\n for obj in common.__dict__.itervalues():\n if type(obj) == type and issubclass(obj, comm... | [
"0.5983358",
"0.5731366",
"0.5586986",
"0.5551285",
"0.5508221",
"0.54468006",
"0.53996897",
"0.53723776",
"0.5369516",
"0.53591746",
"0.53363955",
"0.53126204",
"0.52928793",
"0.5236608",
"0.52262175",
"0.5187518",
"0.5169628",
"0.5126868",
"0.5075861",
"0.5060441",
"0.50516... | 0.6793783 | 0 |
Return the name of the Subreddit. | def getSubredditName(self):
return self.nameOfSubreddit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sub_name(self):\n return self.sub_name",
"def get_subreddit(self):\r\n from pylons import g\r\n from r2.models import Subreddit, Sub, NotFound, Default\r\n try:\r\n if not self.hostname or self.hostname.startswith(g.domain):\r\n if self.path.startswit... | [
"0.7218869",
"0.68938684",
"0.65898365",
"0.64519304",
"0.6427484",
"0.6427484",
"0.63539076",
"0.61308515",
"0.61308515",
"0.61308515",
"0.6120958",
"0.60964257",
"0.6078476",
"0.6078476",
"0.6071652",
"0.6050746",
"0.60496366",
"0.60496366",
"0.60496366",
"0.6042231",
"0.60... | 0.8894763 | 0 |
Changes the subreddit name. Name of the subreddit you want to change to. | def setSubreddit(self, subredditName):
self.nameOfSubreddit = subredditName
self.subreddit = self.praw.subreddit(nameOfSubreddit) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_name(self, new_name):\r\n self.__name = new_name",
"def update_name(self, new_name):\r\n self.__name = new_name",
"def ChangeName(self, newName):\n if newName != \"\":\n newPath = self.format + os.sep + \"playlists\" + os.sep + newName + \".txt\"\n os.repla... | [
"0.6665063",
"0.6665063",
"0.6544932",
"0.6535344",
"0.638324",
"0.63765067",
"0.63743895",
"0.636293",
"0.6334866",
"0.612783",
"0.612274",
"0.612274",
"0.6089802",
"0.6071336",
"0.60371286",
"0.6034261",
"0.6018913",
"0.6016731",
"0.6003661",
"0.59978575",
"0.591629",
"0.... | 0.77809405 | 0 |
Returns a lists of integers of scores of the posts. | def getScore(self):
self.scoreList = [submissionsss.score for submissionsss in self.subreddit.top(time_filter = 'day', limit = self.limits)]
return self.scoreList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scores(self) -> List[float]:\n if not self.prediction:\n return []\n return [sentence.score for sentence in self.prediction.sentences]",
"def get_scores(self):\n return self.score",
"def scores_(self):\n return self.predictor.scores_",
"def get_scores(self) -> tuple... | [
"0.71532154",
"0.7128279",
"0.69161886",
"0.6607638",
"0.6482073",
"0.64766103",
"0.6364357",
"0.634786",
"0.6333597",
"0.63325065",
"0.62894195",
"0.6277977",
"0.6263328",
"0.6218913",
"0.62156534",
"0.6215061",
"0.6183405",
"0.61831903",
"0.6175631",
"0.6165583",
"0.6138198... | 0.75239307 | 0 |
Returns a list of the usernames who submtited the posts. | def getAuthor(self):
self.authorList = [submission.author for submission in self.subreddit.top(time_filter = 'day', limit = self.limits)]
return self.authorList | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_names(self):\n results = []\n for user_detail in self.users:\n results.append(user_detail.user_name)\n results.sort()\n return results",
"def get_usernames(self, selector: Optional[Callable[[User], bool]]=None) -> Set[str]:\n return set([u.name for u in self... | [
"0.71548444",
"0.6687395",
"0.6663389",
"0.6552909",
"0.6470417",
"0.6286781",
"0.6268391",
"0.6217846",
"0.621024",
"0.61485726",
"0.61086756",
"0.60461813",
"0.6028446",
"0.599786",
"0.5986858",
"0.59823453",
"0.59707206",
"0.59585667",
"0.5952254",
"0.5942639",
"0.59390914... | 0.5680975 | 51 |
Buffer some data to a stream to a node's input. Whenever the node is available to read a value from the matching input, this will send the next value. | def buffer_input(self, node, direction, values):
self.num_buffered_inputs += len(values)
self.buffered_input.setdefault(node, {}).setdefault(direction,
[]).extend(values) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def onRecv(self, data):\n self.stream += data\n while self.handleStream(): pass",
"def process(self, data):\n if self.__head:\n self.__head.send(Element(\n stream_id=self.id,\n data=data))",
"def fillBuffer():\n buff[bufferCounter].ne... | [
"0.64942396",
"0.633012",
"0.6143053",
"0.60902137",
"0.6055283",
"0.59665143",
"0.579951",
"0.57874286",
"0.57657534",
"0.575062",
"0.574913",
"0.57437265",
"0.5728528",
"0.5725628",
"0.57216823",
"0.5718914",
"0.57108384",
"0.57058454",
"0.56562674",
"0.56273276",
"0.560687... | 0.690997 | 0 |
Return whether there are any buffered inputs remaining. | def has_buffered_inputs(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bufferIsFull(self):\n return len(self.buffer) == self.bufferSize",
"def has_next(self):\n # type: () -> bool\n return len(self.buffer) > 0",
"def full(self):\n return len(self.future_buffer) == self.CAPACITY",
"def are_buffers_empty(self): \n i = 0\n for i... | [
"0.73473984",
"0.7152609",
"0.69882053",
"0.6975826",
"0.69175136",
"0.6868512",
"0.6840837",
"0.68094856",
"0.6788063",
"0.6750303",
"0.6736553",
"0.6732254",
"0.6728499",
"0.6708489",
"0.6695467",
"0.6695467",
"0.6695467",
"0.6695467",
"0.6689184",
"0.66471004",
"0.6631454"... | 0.77823186 | 0 |
Run the TIS100. This will run in a loop, indefinitely, until the caller shuts it down. | def run(self):
node_runs = [
(node, node.run())
for node in self.nodes
if node.loaded
]
while True:
for node, node_run in node_runs:
if node in self.buffered_input and node.mode == Node.READ:
for d, values in self.buffered_input[node].iteritems():
if values and not node.has_inputs(d):
node.write_input(d, values.pop(0))
self.num_buffered_inputs -= 1
break
yield next(node_run) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run():\n step = 0\n while traci.simulation.getMinExpectedNumber() > 0:\n traci.simulationStep()\n step+=1\n traci.close()\n sys.stdout.flush()",
"def run(self):\n r = rospy.Rate(100)\n while not rospy.is_shutdown():\n r.sleep()",
"def run(self):\n r... | [
"0.6080334",
"0.5913255",
"0.59084845",
"0.571762",
"0.56885445",
"0.5673747",
"0.56668985",
"0.56465936",
"0.5634277",
"0.5626945",
"0.56069297",
"0.5605396",
"0.558712",
"0.5569848",
"0.55664796",
"0.555276",
"0.5545663",
"0.55426747",
"0.5537829",
"0.5537783",
"0.5525708",... | 0.0 | -1 |
Run algorigthm for T epochs on training data X. Arguments | def run( self, X, T, params_dir=u'./tmp_params', callback=None, Xt=None ):
opt_proc( self, X, T, params_dir, callback, Xt ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _run_epoch(sess, model, args, data, index=0, tb_summaries=None,\n id_to_word=None, train_op=None, verbose=False):\n epoch_start_time = time.time()\n # total cost and number of words evaluated in this epoch\n costs, total_words = 0.0, 0.0\n # epoch size is number of batches in each epo... | [
"0.65769637",
"0.6517428",
"0.6459593",
"0.63946986",
"0.6393091",
"0.6393091",
"0.63270414",
"0.63143504",
"0.6300678",
"0.6300678",
"0.6300678",
"0.6300678",
"0.6300678",
"0.6298494",
"0.6290961",
"0.6284542",
"0.6277587",
"0.6206769",
"0.6197609",
"0.6168225",
"0.61648196"... | 0.0 | -1 |
Initialize hyperparameters for the spectralmixture kernel. Weights are all set to be uniformly distributed, means are given as the peaks in the frequency spectrum, and variances are given by a random sample from a uniform distribution with a max equal to the max distance. | def initSMParamsFourier(Q, x, y, sn, samplingFreq, nPeaks, relMaxOrder=2):
x = np.atleast_2d(x)
y = np.atleast_2d(y)
n, D = x.shape
w = np.zeros(Q)
m = np.zeros((D,Q))
s = np.zeros((D,Q))
w[:] = np.std(y) / Q
hypinit = {
'cov': np.zeros(Q+2*D*Q),
'lik': np.atleast_1d(np.log(sn)),
'mean': np.array([])
}
# Assign hyperparam weights
hypinit['cov'][0:Q] = np.log(w)
# Assign hyperparam frequencies (mu's)
signal = np.array(y.ravel()).ravel() # Make into 1D array
n = x.shape[0]
k = np.arange(n)
ts = n/samplingFreq
frqx = k/float(ts)
frqx = frqx[range(n/2)]
frqy = np.fft.fft(signal)/n
frqy = abs(frqy[range(n/2)])
# Find the peaks in the frequency spectrum
peakIdx = np.array([])
while not peakIdx.any() and relMaxOrder > 0:
peakIdx = spsig.argrelmax(np.log(frqy**2), order=relMaxOrder)[0]
relMaxOrder -= 1
if not peakIdx.any():
raise ValueError("Data doesn't have any detectable peaks in Fourier space."
" Switching to a different kernel besides the spectral "
"mixture is recommended.")
# Find specified number (nPeaks) largest peaks
sortedIdx = frqy[peakIdx].argsort()[::-1][:nPeaks]
sortedPeakIdx = peakIdx[sortedIdx]
hypinit['cov'][Q + np.arange(0,Q*D)] = np.log(frqx[sortedPeakIdx])
# Assign hyperparam length scales (sigma's)
for i in range(0,D):
xslice = np.atleast_2d(x[:,i])
d2 = spat.distance.cdist(xslice, xslice, 'sqeuclidean')
if n > 1:
d2[d2 == 0] = d2[0,1]
else:
d2[d2 == 0] = 1
maxshift = np.max(np.max(np.sqrt(d2)))
s[i,:] = 1./np.abs(maxshift*np.random.ranf((1,Q)))
hypinit['cov'][Q + Q*D + np.arange(0,Q*D)] = np.log(s[:]).T
return hypinit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)",
"def initialize_parameters(self):\n for i in range(1, self.L):\n self.W[i - ... | [
"0.6774762",
"0.6662212",
"0.6590797",
"0.6580719",
"0.653845",
"0.65343827",
"0.6457986",
"0.6452538",
"0.64459723",
"0.64149785",
"0.6335864",
"0.62844634",
"0.6237224",
"0.61584514",
"0.61222535",
"0.6107818",
"0.6079155",
"0.6045198",
"0.5999778",
"0.5988833",
"0.598171",... | 0.5759183 | 59 |
Initialize hyperparameters for the spectralmixture kernel. Weights are all set to be uniformly distributed, means are given by a random sample from a uniform distribution scaled by the Nyquist frequency, and variances are given by a random sample from a uniform distribution scaled by the max distance. | def initSMParams(Q, x, y, sn):
x = np.atleast_2d(x)
y = np.atleast_2d(y)
n, D = x.shape
w = np.zeros(Q)
m = np.zeros((D,Q))
s = np.zeros((D,Q))
w[:] = np.std(y) / Q
hypinit = {
'cov': np.zeros(Q+2*D*Q),
'lik': np.atleast_1d(np.log(sn)),
'mean': np.array([])
}
for i in range(0,D):
# Calculate distances
xslice = np.atleast_2d(x[:,i])
d2 = spat.distance.cdist(xslice, xslice, 'sqeuclidean')
if n > 1:
d2[d2 == 0] = d2[0,1]
else:
d2[d2 == 0] = 1
minshift = np.min(np.min(np.sqrt(d2)))
nyquist = 0.5/minshift
m[i,:] = nyquist*np.random.ranf((1,Q))
maxshift = np.max(np.max(np.sqrt(d2)))
s[i,:] = 1./np.abs(maxshift*np.random.ranf((1,Q)))
hypinit['cov'][0:Q] = np.log(w)
hypinit['cov'][Q + np.arange(0,Q*D)] = np.log(m[:]).T
hypinit['cov'][Q + Q*D + np.arange(0,Q*D)] = np.log(s[:]).T
return hypinit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)",
"def initialize_parameters(self):\n for i in range(1, self.L):\n self.W[i - ... | [
"0.6870166",
"0.67820096",
"0.66796654",
"0.667258",
"0.6586674",
"0.65543795",
"0.64954084",
"0.64887315",
"0.64326423",
"0.64283997",
"0.6424432",
"0.6400535",
"0.63936627",
"0.6386461",
"0.62629104",
"0.62402385",
"0.6229552",
"0.61286724",
"0.6112169",
"0.61040556",
"0.60... | 0.5852104 | 56 |
Takes in and returns hyperparameters as an array of the same length. The elements of are pairs [lower, upper], and the corresponding hyperparameter is sampled from a uniform distribution in the interval [lower, upper]. If instead of a pair we have a number in , then we assign that value as the appropriate hyperparameter. | def initBoundedParams(bounds, sn=[]):
hypinit = {
'cov': np.zeros(len(bounds)),
'lik': np.atleast_1d(np.log(sn)),
'mean': np.array([])
}
# Sample from a uniform distribution
for idx, pair in enumerate(bounds):
# Randomize only if bounds are specified
if isinstance(pair, collections.Iterable):
hypinit['cov'][idx] = np.random.uniform(pair[0], pair[1])
# If no bounds, then keep default value always
else:
hypinit['cov'][idx] = pair
return hypinit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hyperparameter_values(hyper):\n import ConfigSpace.hyperparameters as CSH\n\n if isinstance(hyper, CSH.CategoricalHyperparameter):\n return hyper.choices, False\n\n if isinstance(hyper, CSH.NumericalHyperparameter):\n return [hyper.lower, hyper.upper], True\n \n if isinstan... | [
"0.56640446",
"0.55604845",
"0.54990536",
"0.5466633",
"0.545822",
"0.5446241",
"0.54428786",
"0.5440141",
"0.5407368",
"0.54070425",
"0.5364159",
"0.5364159",
"0.5360082",
"0.5337372",
"0.53170127",
"0.53168845",
"0.53137463",
"0.5287289",
"0.52689487",
"0.52573603",
"0.5253... | 0.57418513 | 0 |
Function to create the body of the script files, staging their start. Arguments | def _get_body(script_lines, num_cores_simul, silence=False):
# Stage the commands every 1 second.
body = "parallel -j {num_cores_simul} << EOF_PARALLEL\n"
body = body.format(num_cores_simul=num_cores_simul)
if silence:
redirect = "&> /dev/null"
else:
redirect = ""
for i, line in enumerate(script_lines):
new_line = line.rstrip() + redirect + "\n"
if i < num_cores_simul:
new_line = "sleep {i}; ".format(i=i) + new_line
body = body+new_line
body += "EOF_PARALLEL\n"
return body | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_body(self) -> str:\n # Always include default.js\n files = [os.path.join(self.directory, \"default.js\")]\n\n # Find increasingly less specific files based on the request path.\n paths = self.path.replace(\"/\", \"\").split(\".\")\n while paths:\n files.appen... | [
"0.6124697",
"0.5976339",
"0.59500986",
"0.58982635",
"0.58647656",
"0.58493876",
"0.58317494",
"0.5793027",
"0.5780693",
"0.57572126",
"0.57238114",
"0.5718613",
"0.5701785",
"0.5697892",
"0.5668426",
"0.5664624",
"0.56439966",
"0.5624458",
"0.55910456",
"0.5544138",
"0.5516... | 0.52663946 | 43 |
Returns number of coordinates in string. | def counting_coordinates(string):
num_of_commas = string.count(',')
num_of_cords = num_of_commas + 1
return num_of_cords | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_string_info(string):\n line_count = 1\n column_count = 1\n for char in string:\n if char == '\\n':\n column_count = 1\n line_count += 1\n else:\n column_count += 1\n return Coords(line_count, column_count, len(string))",
"def length(s: str) -> in... | [
"0.6940831",
"0.6308547",
"0.62703896",
"0.60827315",
"0.6065635",
"0.6045179",
"0.60267836",
"0.5949909",
"0.59459907",
"0.5829819",
"0.57608765",
"0.5755629",
"0.57515347",
"0.57390684",
"0.57338333",
"0.5683465",
"0.56755596",
"0.5655975",
"0.5646916",
"0.56432575",
"0.558... | 0.82952464 | 0 |
Copy contents of arr1 to arr2. | def copy_arr1_to_arr2(arr1, arr2, k, num_of_cords):
for i in range(k):
for j in range(num_of_cords):
arr2[i][j] = arr1[i][j] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign(array1, array2):\n for i in range(len(array1)):\n array2[i] = array1[i]",
"def cat_arrays(arr1, arr2):\n newarr = [0 for i in range(len(arr1) + len(arr2))]\n for i in range(len(arr1)):\n newarr[i] = arr1[i]\n for i in range(len(arr2)):\n newarr[i + len(arr1)] = arr2[i]... | [
"0.73633987",
"0.67356104",
"0.6724997",
"0.6570111",
"0.65166664",
"0.6294176",
"0.6041236",
"0.60094804",
"0.5956681",
"0.5945453",
"0.5928697",
"0.5916138",
"0.59127474",
"0.5909704",
"0.5871539",
"0.5759969",
"0.5749519",
"0.57420987",
"0.57081336",
"0.56879663",
"0.56604... | 0.7642252 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.