query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Replaces the current cache by another | def replace(self, other_cache):
# This is used in avant-idle to replace the content of the cache
# in a process (where no storage normally takes place) by
# that of another where the actual caching of the source is done.
self.cache.clear()
for key in other_cache:
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testReplaceItem(self):\n\n first = \"Little pig, little pig, let me come in!\"\n second = \"Not by the hair on my chinny-chin-chin!\"\n memcache.set('first', first)\n assert memcache.get('first') == first\n memcache.replace('first', second)\n assert memcache.get('first... | [
"0.67452043",
"0.63469607",
"0.6275304",
"0.6189481",
"0.6022924",
"0.60033196",
"0.59268266",
"0.57108635",
"0.56714857",
"0.5612773",
"0.56104547",
"0.55959934",
"0.5594574",
"0.5585767",
"0.5527958",
"0.5526175",
"0.552543",
"0.552472",
"0.55214816",
"0.5506108",
"0.548309... | 0.84599257 | 0 |
Given a filename, returns the corresponding source, either from the cache or from actually opening the file. If the filename corresponds to a true file, and the last time it was modified differs from the recorded value, a fresh copy is retrieved. The contents is stored a a string and returned as a list of lines. If no ... | def get_source(self, filename):
# The main reason we care about ensuring we have the latest version
# of a given file is for the 'avant-idle' project where we could
# 'edit and run' multiple times a given file. We need to ensure that
# the content shown by the traceback is accurate.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_file_source(self, filename):\n try:\n with open(filename, encoding=\"utf8\") as f:\n lines = f.readlines()\n source = \"\".join(lines)\n except Exception:\n lines = []\n source = None\n return source, lines",
"def get_ou... | [
"0.7092788",
"0.6621492",
"0.64070714",
"0.6370972",
"0.6370972",
"0.6359992",
"0.6252963",
"0.6160644",
"0.6033081",
"0.6021885",
"0.599927",
"0.59814626",
"0.58814996",
"0.5880455",
"0.57968",
"0.57867116",
"0.5776293",
"0.5770049",
"0.5722298",
"0.56828374",
"0.567691",
... | 0.8423813 | 0 |
Formats a few lines around a 'bad line', and returns the formatted source as well as the content of the 'bad line'. | def get_formatted_partial_source(self, filename, linenumber, offset):
lines = self.get_source(filename)
if not lines:
return "", ""
begin = max(0, linenumber - self.context)
partial_source, bad_line = highlight_source(
linenumber,
linenumber - begin -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_exception_only(etype, value):\n # Gracefully handle (the way Python 2.4 and earlier did) the case of\n # being called with (None, None).\n if etype is None:\n return [_format_final_exc_line(etype, value)]\n\n stype = etype.__name__\n smod = etype.__module__\n if smod not in (\"_... | [
"0.5942906",
"0.59109855",
"0.5804325",
"0.5789683",
"0.5765263",
"0.5730036",
"0.57251096",
"0.5659315",
"0.5617689",
"0.55531806",
"0.5530319",
"0.54957825",
"0.545304",
"0.5448972",
"0.5432576",
"0.54311997",
"0.54229766",
"0.5407884",
"0.5405036",
"0.53888756",
"0.5380812... | 0.70705295 | 0 |
can SELECT "" AS aliases | def test_can_select_using_alias(self):
if self._cass_version < (2, 0, 0):
raise unittest.SkipTest("Alias in SELECT not supported before 2.0")
try:
self.session.execute('SELECT key, "626972746864617465" AS my_col from test1rf.table_num_col')
except ValueError as e:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __alias(self, alias):\n col = copy.deepcopy(self)\n col.thisptr[\"as_\"] = alias\n return col",
"def test_aliasing() -> None:\n processed = parse_and_process(\n {\n \"aggregations\": [],\n \"groupby\": [],\n \"selected_columns\": [\"tags_value\"],\n ... | [
"0.636288",
"0.6311065",
"0.629858",
"0.6173639",
"0.6164102",
"0.6145213",
"0.6002747",
"0.59780675",
"0.5969748",
"0.5954351",
"0.59196556",
"0.5901071",
"0.58318216",
"0.58098507",
"0.5716049",
"0.5576109",
"0.5519859",
"0.54283607",
"0.5419169",
"0.54156923",
"0.53961104"... | 0.65787524 | 0 |
can SELECT numeric column using dict_factory | def test_can_select_with_dict_factory(self):
self.session.row_factory = dict_factory
try:
self.session.execute('SELECT * FROM test1rf.table_num_col')
except ValueError as e:
self.fail("Unexpected ValueError exception: %s" % e.message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cast_non_numeric_true():\n assert _currency_column_to_numeric(\"foo\", {\"foo\": 42}) == 42",
"def test_dummydb_add_data_to_table_wrong_column_type(self):\n db = DummyDB()\n columns = {\n \"one\": int,\n \"two\": str,\n \"three\": bool,\n }\n ... | [
"0.5937552",
"0.5865882",
"0.58389556",
"0.5803438",
"0.57932466",
"0.57872504",
"0.5761668",
"0.5696834",
"0.5683577",
"0.5645499",
"0.5607317",
"0.5541275",
"0.55096924",
"0.5468403",
"0.5463897",
"0.54299223",
"0.54296225",
"0.5422627",
"0.5389001",
"0.5386752",
"0.5361337... | 0.76515603 | 0 |
Partition the input module into CUTLASSsupported subgraphs. | def partition_for_cutlass(mod):
dense_pat = ("cutlass.dense", make_gemm_pattern(False, None))
dense_bias_pat = ("cutlass.dense_bias", make_gemm_pattern(True, None))
dense_bias_relu_pat = ("cutlass.dense_bias_relu", make_gemm_pattern(True, "relu"))
dense_bias_gelu_fp16_pat = ("cutlass.dense_bias_gelu_fp1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def partition_for_cutlass(mod):\n\n cutlass_patterns = get_patterns_with_prefix(\"cutlass\")\n return transform.FuseOpsByPattern(cutlass_patterns, annotate_codegen=True)(mod)",
"def _split_block(block: PruningBlock, list_output_channels: List[int]) -> List[PruningBlock]:\n if len(list_output_channel... | [
"0.59069586",
"0.53911424",
"0.5344001",
"0.53298855",
"0.5212837",
"0.5204213",
"0.515992",
"0.51125705",
"0.51123255",
"0.51100886",
"0.5097291",
"0.5090909",
"0.5089643",
"0.5088922",
"0.50566685",
"0.50541466",
"0.5050671",
"0.50423294",
"0.50327724",
"0.5027155",
"0.5004... | 0.61335194 | 0 |
Get information necessary for submission for a given number of tasks for a given transformation | def export_getTasksToSubmit( self, transName, numTasks, site = '' ):
res = database.getTransformation( transName )
if not res['OK']:
return self._parseRes( res )
transDict = res['Value']
submitDict = {}
res = database.getTasksForSubmission( transName, numTasks = numTasks, site = site, statusLi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_getTransformationSummary( self ):\n res = database.getTransformations()\n if not res['OK']:\n return self._parseRes( res )\n transList = res['Value']\n resultDict = {}\n for transDict in transList:\n transID = transDict['TransformationID']\n res = database.getTransformation... | [
"0.623155",
"0.60763425",
"0.5879088",
"0.58649737",
"0.5762035",
"0.5725441",
"0.572414",
"0.5709796",
"0.57081753",
"0.5671693",
"0.5655901",
"0.56209475",
"0.56138736",
"0.5600613",
"0.5560714",
"0.5550168",
"0.55358416",
"0.5526346",
"0.551553",
"0.54855865",
"0.54538816"... | 0.686788 | 0 |
Get the summary of the currently existing transformations | def export_getTransformationSummary( self ):
res = database.getTransformations()
if not res['OK']:
return self._parseRes( res )
transList = res['Value']
resultDict = {}
for transDict in transList:
transID = transDict['TransformationID']
res = database.getTransformationTaskStats( tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary(self):\n raise NotImplementedError",
"def get_summary(self):\n return self.model.summary()",
"def summary(self):\r\n self.base.summary()\r\n self.extra_layers.summary()\r\n self.detector.summary()",
"def get_transform(self):\n raise NotImplementedError",
... | [
"0.65079284",
"0.6279362",
"0.62648493",
"0.62475646",
"0.62274456",
"0.62240434",
"0.62154925",
"0.6186748",
"0.61818343",
"0.61730766",
"0.61704767",
"0.614142",
"0.612256",
"0.612256",
"0.6067224",
"0.6067224",
"0.6067224",
"0.6067224",
"0.6067224",
"0.6067224",
"0.6067224... | 0.7311224 | 0 |
This function takes a multibyte key and a multibyte message. It returns a string that is obtained by XORing each byte of the message with each byte of the key which keeps rotating. | def xorstr (key, msg):
# join a list of chars into string where list is generated by
# XORing each of msg bytes with each of the key bytes rotating.
return ''.join([chr(ord(msg[i]) ^ ord(key[i % len(key)])) for i in range (0, len(msg))]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repeating_key_xor(msg_b, key_b):\n l = len(key_b)\n return bytes(key_b[n % l] ^ c_i for n, c_i in enumerate(msg_b))",
"def repeating_key_xor(plaintext, key):\n ciphertext = ''\n i = 0\n\n for byte in plaintext:\n ciphertext += chr(byte ^ key[i])\n\n i = (i + 1) % len(key)\n re... | [
"0.77024674",
"0.74073726",
"0.7340499",
"0.70112485",
"0.69480264",
"0.69072014",
"0.68998545",
"0.6897194",
"0.68671113",
"0.6866306",
"0.6835984",
"0.682718",
"0.6777031",
"0.67250794",
"0.6684219",
"0.6653365",
"0.664022",
"0.663142",
"0.6613621",
"0.6595081",
"0.6535161"... | 0.8094801 | 0 |
This function returns a rank to a string depending on occurrance frequencies of each of the characters in it. | def string_rank (text):
freq_set = {
' ':13.00, 'e':12.70, 't':9.056, 'a':8.167, 'o':7.507, 'i':6.966, 'n':6.749,
's':6.327, 'h':6.094, 'r':5.987, 'd':4.253, 'l':4.025, 'u':2.758, 'b':1.492,
'c':2.782, 'f':2.228, 'g':2.015, 'j':0.153, 'k':0.772, 'm':2.406, 'p':1.929,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def frequencyLetterDic(s):\n pass",
"def score(str_bytes):\n freq_score = sum([character_frequencies.get(chr(letter).lower(), -100) for letter in str_bytes])\n return math.ceil(freq_score * 100) / 100",
"def tally_letters(string):\n output = dict()\n for char in list(string):\n freq = out... | [
"0.67854005",
"0.6674452",
"0.65107816",
"0.6388476",
"0.63569343",
"0.6356804",
"0.6259678",
"0.62542886",
"0.62187475",
"0.61911213",
"0.6176556",
"0.61291283",
"0.6125808",
"0.6125808",
"0.61180437",
"0.60744417",
"0.60263556",
"0.6003472",
"0.5980236",
"0.59661067",
"0.59... | 0.79308665 | 0 |
This function returns a keyphrase guessed from the given cryptotext and keysize | def guess_keyphrase (encr_text, keysize):
# First calculate the number of blocks of keysize length
block_size = (len(encr_text) / keysize) + 1
# Pad the string with appropriate number of NULs to form a blocksize multiple length string
encr_text = encr_text.ljust(block_size * keysize, '\0')
keyphras... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_random_key(self, size=16):\n key = ''.join([random.choice(Characters.get_characters()) for i in range(size)])\n return self.__strengthen_key(key)",
"def crypt(text, passphrase, which):\n text = scrub_string(text)\n passphrase = scrub_string(passphrase)\n letters = (\n shift_... | [
"0.59493685",
"0.58640945",
"0.5855858",
"0.5819205",
"0.57508624",
"0.56276083",
"0.5525338",
"0.549947",
"0.54791176",
"0.5433029",
"0.5421609",
"0.5369842",
"0.53502756",
"0.5331022",
"0.53000695",
"0.5294777",
"0.5280605",
"0.525854",
"0.5245192",
"0.5236226",
"0.52084154... | 0.82391196 | 0 |
This method is called when the viewer is initialized and after every reset Optionally implement this method, if you need to tinker with camera position and so forth. | def viewer_setup(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setupCamera(self) :\n\t\tbase.disableMouse()\n\t\tbase.camera.setPos(self.avatarNP.getPos())\n\t\tbase.camera.setZ(self.avatarNP.getZ()+1.5)\n\t\tbase.camera.setHpr(self.avatarNP.getHpr()[0],0,0)\t\t\n\t\tself.fieldAngle = 46.8\t# similar to human eye;\n\t\t\t\t\t# change this to zoom in/out\n\t\tbase.camLens.... | [
"0.7194849",
"0.7097453",
"0.70574164",
"0.70280343",
"0.6994152",
"0.6966335",
"0.6889367",
"0.6878479",
"0.68556595",
"0.67483926",
"0.674773",
"0.6744065",
"0.6693449",
"0.66212785",
"0.65537935",
"0.6540604",
"0.65329903",
"0.65329903",
"0.65329903",
"0.6499754",
"0.64453... | 0.7616594 | 1 |
Turn to the desired angle. | def turn_to(self, angle, dt):
a = normalize_angle(angle - self.angle)
self.turn_by(a, dt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn(self, angle):\n self.logger.debug(\"turn \" + str(angle))",
"def set_angle(self, angle):\n return self.bot_client.send_command(_Command.SetAngle, angle)",
"def change_angle(self, up_or_down):\n self.angle += up_or_down * math.pi / 180",
"def setAngle(self, angle):\n self.... | [
"0.77043355",
"0.7598602",
"0.74979085",
"0.74784386",
"0.7460302",
"0.7353835",
"0.7312387",
"0.7296793",
"0.7275919",
"0.7238547",
"0.719179",
"0.71872526",
"0.7177033",
"0.71599954",
"0.7158461",
"0.7134644",
"0.70963377",
"0.70953256",
"0.7082544",
"0.7052482",
"0.7042528... | 0.7777582 | 0 |
Generate a VNTR sequence with random mutations. The mutations will be the same across different copies. Params vntr, the DNA copy sequence which is copied. m, the number of SNP mutations that will be randomly introduced. Returns A single copy of the VNTR sequence with m mutations. \ | def introduce_random_mutations(vntr, m):
mutation_sites = np.random.choice(range(len(vntr)), m, replace=False)
m_vntr = []
for site, nucleotide in enumerate(vntr):
if site in mutation_sites:
m_vntr.append(generate_mutation(nucleotide))
else:
m_vntr.append(nucleotide)
return ''.join(m_vntr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutation(chrom, p_m=0.05):\n\n for i in range(len(chrom)):\n # generate number between 0 and 1, responsible for deciding\n # whether to appply mutation\n r = random.uniform(0, 1)\n\n # if r is smaller/equal the mutation probability, mutate!\n if r <= p_m:\n # g... | [
"0.5307359",
"0.5192155",
"0.5192155",
"0.51785797",
"0.5164674",
"0.5141542",
"0.5133362",
"0.51316625",
"0.5131553",
"0.51003075",
"0.50637877",
"0.5054586",
"0.50219107",
"0.50108",
"0.4967241",
"0.4951432",
"0.4938373",
"0.48834544",
"0.48707694",
"0.4847384",
"0.48199373... | 0.76476663 | 0 |
Generate a VNTR sequence with the specified mutations at the specified sites. Params vntr, the DNA copy sequence which is copied. sites, locus where the SNP mutation will be introduced. mutations, a list of mutations. Returns A single copy of the VNTR sequence with mutations at the specified sites. | def introduce_specific_mutations(vntr, sites, mutations):
if len(sites) != len(mutations):
raise Exception('The number of sites and mutations do not correspond.')
m_vntr = list(vntr)
for site, nucleotide in enumerate(m_vntr):
if site in sites:
mut_idx = sites.index(site)
if nucleotide == mutations[mut_id... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def introduce_random_mutations(vntr, m):\n\t\n\tmutation_sites = np.random.choice(range(len(vntr)), m, replace=False)\n\tm_vntr = []\n\tfor site, nucleotide in enumerate(vntr):\n\t\tif site in mutation_sites:\n\t\t\tm_vntr.append(generate_mutation(nucleotide))\n\t\telse:\n\t\t\tm_vntr.append(nucleotide)\n\treturn ... | [
"0.5626054",
"0.47177437",
"0.42131987",
"0.41583866",
"0.41273472",
"0.41054517",
"0.40894073",
"0.40883607",
"0.4083983",
"0.4083983",
"0.4070218",
"0.40296546",
"0.39688498",
"0.39539516",
"0.3937648",
"0.38799438",
"0.38753176",
"0.38158587",
"0.38153952",
"0.38036197",
"... | 0.65976316 | 0 |
Cachebacked exists method. Cache only hits for Locations we know exist. | def exists(ccp_id):
exists = cache.get("location_exists_%s" % ccp_id)
if exists is not None:
return True
else:
exists_db = Location.objects.filter(pk=ccp_id).exists()
if exists_db:
cache.set("location_exists_%s" % ccp_id, True, timeout=3600)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exist(self):",
"def testExists(self):\n ref = cache.CacheReference(self.cache, 'key')\n self.cache._KeyExists.return_value = False\n self.assertFalse(ref.Exists())",
"def testExistsMissing(self):\n ref = cache.CacheReference(self.cache, 'key')\n self.cache._KeyExists.return_value = True\n ... | [
"0.6532097",
"0.64277136",
"0.6395002",
"0.63523626",
"0.63297445",
"0.63152087",
"0.63152087",
"0.61763453",
"0.6130861",
"0.6088515",
"0.6041803",
"0.5984796",
"0.59783524",
"0.59638375",
"0.5956604",
"0.5921877",
"0.5835254",
"0.5794493",
"0.5794173",
"0.5791136",
"0.57742... | 0.6949977 | 0 |
Get one valid line from the serial port, ignoring any erroneous data | def get_valid_line(port):
while True:
try:
# note in the case of serial port overflow some characters left in
# it decode will then throw an exception
return port.readline().decode(encoding='ASCII').strip()
except:
pass # ignore the e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readNonDebugLine(self):\n line = \"D\"\n linesRead = 0\n try:\n while line == None or line == \"\" or line[0] == 'D':\n linesRead += 1\n if linesRead == 100:\n return None\n\n try:\n line = self.serial.readline()\n sys.stdout.write(\".\")\n ... | [
"0.7590753",
"0.6769086",
"0.67336154",
"0.67246145",
"0.6694287",
"0.6616035",
"0.6583669",
"0.64781165",
"0.64222157",
"0.6294857",
"0.62915415",
"0.6278962",
"0.6247034",
"0.62445486",
"0.622831",
"0.62108123",
"0.6171921",
"0.6171921",
"0.61167514",
"0.6073635",
"0.607351... | 0.84977233 | 0 |
Recieves a fixed number of data samples from the serial port. Converts timestamp to seconds and expresses the raw input value as a percentage of its maximum value (1023). Returns the time and percentage values as arrays t[] and percent[] respectively. | def get_data(N,port_name,port_speed):
t = np.zeros(N) # array for timestamps
percent = np.zeros(N) # array for percentage values
# get data from serial port
with serial.Serial(port=port_name,baudrate=port_speed,timeout=2) as myport:
sleep(2) # allow arduino to... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_datapoints(self, rid, t0, t1, nmax = 300):\n self.read_curs.execute(\"SELECT COUNT(*) FROM readings WHERE readout_id = ? AND time >= ? AND time <= ?\", (int(rid), t0, t1))\n if self.read_curs.fetchone()[0] > nmax:\n self.read_curs.execute(\"SELECT avg(time),avg(value) FROM readings... | [
"0.6064227",
"0.6021816",
"0.5860702",
"0.58265907",
"0.58107245",
"0.5694001",
"0.56659734",
"0.559805",
"0.5555691",
"0.5536991",
"0.5519742",
"0.547903",
"0.54070944",
"0.53832203",
"0.53828126",
"0.5376914",
"0.5328985",
"0.53166157",
"0.53156304",
"0.5289635",
"0.5288996... | 0.75997883 | 0 |
Main function. Holds serial port settings and calls on get_data() and file_write(). | def main():
N = 200 # number of samples
port_name = 'COM4' # serial port name
port_speed = 19200 # serial port speed/ baudrate (bits per second)
t,percent = get_data(N,port_name,port_speed) # get data
file_write(t,percent) # write data to file
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(self) :\n\n # Close the serial port in case the previous run didn't closed it properly\n self.serialPortDWM1001_1.close()\n self.serialPortDWM1001_2.close()\n \n # Sleep for one sec\n time.sleep(1)\n \n # Open serial port\n self.serialPortDWM1... | [
"0.66673714",
"0.6348471",
"0.63438296",
"0.6250894",
"0.62133306",
"0.6160983",
"0.615156",
"0.61369705",
"0.6128722",
"0.6102775",
"0.6096401",
"0.6067427",
"0.60530365",
"0.6042071",
"0.60399944",
"0.60398006",
"0.6038704",
"0.6035512",
"0.59890354",
"0.59833527",
"0.59560... | 0.7212588 | 0 |
Perform numerical differentiation by calling the ``dxdt`` method. Paramters | def __call__(self, x, t):
x = validate_input(x, t=t)
if isinstance(t, (int, float)):
if t < 0:
raise ValueError("t must be a positive constant or an array")
t = arange(x.shape[0]) * t
return dxdt(x, t, axis=0, **self.kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compODEdydt(self, t, y, args=None):\r\n return comp.Comp.compODEdydt_diffu(self, t, y, args)",
"def test_dg_dt(self):\n dfn = lambda x: self.model.g(self.s, self.e, x, self.T)\n nderiv = differentiate(dfn, self.t)\n cderiv = self.model.dg_dt(self.s, self.e, self.t, self.T)\n self.assertTru... | [
"0.7016248",
"0.69361097",
"0.6804383",
"0.67951113",
"0.66794807",
"0.65300804",
"0.64966476",
"0.64858246",
"0.64858246",
"0.64737797",
"0.6373898",
"0.6372892",
"0.6352266",
"0.63382345",
"0.6321146",
"0.630121",
"0.6283227",
"0.62816906",
"0.6236406",
"0.61797225",
"0.617... | 0.7255509 | 0 |
Creates a square of rectangles from a bounding box, Feature or FeatureCollection. | def square_grid(
bbox: List[float], n_cells: Union[int, float], options: Dict = {},
) -> FeatureCollection:
return rectangle_grid(bbox, n_cells, n_cells, options) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rectangle(xcenter, ycenter, width, height):\n x1, x2 = xcenter - width, xcenter + width\n y1, y2 = ycenter - height, ycenter + height\n return Shape([Point(x1, y1), Point(x1, y2), Point(x2, y2), Point(x2, y1)])",
"def rect(x: float, y: float, width: float, height: float) -> LineCollection:\n retu... | [
"0.66413796",
"0.64010334",
"0.63548267",
"0.6310541",
"0.63054466",
"0.6284592",
"0.6282141",
"0.6275525",
"0.62733954",
"0.62666655",
"0.62408054",
"0.61883223",
"0.6173386",
"0.61582655",
"0.6151233",
"0.61442584",
"0.6142375",
"0.6133205",
"0.6114281",
"0.60825324",
"0.60... | 0.68952215 | 0 |
Sorts file name by their looking at their dayofyear and hour block code | def __file_sorter(self, filename: str) -> int:
filename = filename.split('/')[-1]
year = int(filename[-3:-1]) # extracts YY from ssssdddh.YYo
day_info = filename[4:8] # extracts dddh from ssssdddh.YYo
day_of_year = int(day_info[:3]) # ddd
hour_block = day_info[-1] # h
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paths_sort(path):\n base_name = os.path.basename(path)\n \n stat_name = base_name.split('.')[0] \n\n date = base_name.split('.')[1]\n \n try:\n date = datetime.datetime.strptime(date, '%Y-%m-%d')\n \n return date, stat_name\n except Exception as e:\n print(e)... | [
"0.65522987",
"0.6036532",
"0.5924664",
"0.5856054",
"0.58341306",
"0.58302736",
"0.5825444",
"0.57813066",
"0.5737469",
"0.5684189",
"0.56800306",
"0.5619507",
"0.5610713",
"0.55951077",
"0.5585952",
"0.5574447",
"0.55037266",
"0.54867095",
"0.5466267",
"0.54434353",
"0.5432... | 0.7976214 | 0 |
Decompresses all downloaded Rinex files inside a specified directory. | def decompress_files(self):
crx2rnx_path = os.path.join(ROOT_DIR, 'CRX2RNX')
if not os.path.isfile(crx2rnx_path):
raise OSError('Cannot find CRX2RNX binary in project directory!')
if glob('{}/*'.format(self.__directory)):
subprocess.run(["gunzip", "-dr", self.__directory... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _uncompress(fname, outdir, msg=msg):\n import os\n assert os.access(fname, os.R_OK), \"could not access [%s]\" % fname\n fname = os.path.abspath(os.path.realpath(fname))\n if not os.path.exists(outdir):\n os.makedirs(outdir)\n orig_dir = os.getcwd()\n try:\n os.chdir(outdir)\n ... | [
"0.6734366",
"0.6269583",
"0.6158027",
"0.61422616",
"0.60502845",
"0.60480267",
"0.60106426",
"0.5998983",
"0.59943736",
"0.5992895",
"0.594012",
"0.5927805",
"0.590243",
"0.5832953",
"0.58247906",
"0.580835",
"0.57950175",
"0.57742256",
"0.57636404",
"0.5752565",
"0.5750407... | 0.7247172 | 0 |
Merges RINEX files and extracts required time window from merged file. | def merge(self):
self.decompress_files()
teqc_path = os.path.join(ROOT_DIR, 'teqc')
if not os.path.isfile(teqc_path):
raise OSError('Cannot find TEQC binary in project directory!')
# currently cannot tell if there are daily logs or not
daily_logs = glob('{}/*0.??o'.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_delta_time(\n username: str | None = None,\n password: str | None = None,\n verbose: bool = False,\n mode: oct = 0o775\n ):\n # retrieve history delta time files\n pull_deltat_file('historic_deltat.data',\n username=username, password=password,\n verbose... | [
"0.55087197",
"0.54753095",
"0.5362552",
"0.52895766",
"0.52009743",
"0.51340944",
"0.5126637",
"0.5122447",
"0.5083839",
"0.4956485",
"0.49437204",
"0.49434453",
"0.4934271",
"0.49225575",
"0.4921824",
"0.49144492",
"0.49025676",
"0.4867515",
"0.48418102",
"0.4840948",
"0.48... | 0.6410398 | 0 |
Check partial rsp but not the while rsp. | def _check_partial_rsp(self, exp, ori):
logging.warning('Start to check if expected_rsp: {} is part of origin_rsp: {}'.format(exp, ori))
# so far, leaf node could be string or list which must be exactly the same
if isinstance(exp, dict):
for k, v in exp.iteritems():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condition_forward_checking(csp, var) :\n return False",
"def condition_forward_checking(csp, var) :\n return False",
"def _is_in_outmost_while_loop(self, op):\n ctxt = self._get_op_control_flow_context(op)\n outer_while_context = control_flow_util.GetContainingWhileContext(ctxt)\n return out... | [
"0.540051",
"0.540051",
"0.5356466",
"0.52993804",
"0.51802635",
"0.5112568",
"0.50418687",
"0.49996877",
"0.49401474",
"0.4930193",
"0.49258524",
"0.492424",
"0.49188444",
"0.49112532",
"0.4911028",
"0.4888663",
"0.4888482",
"0.4887423",
"0.48641187",
"0.48544022",
"0.484821... | 0.59235585 | 0 |
Returns the evaluation metric function based on provided configuration The first of precision, recall... and first of auc, pr can update the inner confusion matrix, make sure to update in order | def get_evaluation_metric(config, logger, device):
metrics = config['eval']['metrics']
if not isinstance(metrics, list):
metrics = [metrics]
curves = config['eval'].get('curves', list())
threshold = config['eval'].get('probability_threshold', 0.5)
num_classes = config['model']['num_cla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_evaluation_metric(config):\n assert 'eval_metric' in config, 'Could not find evalvalutation metric configuration'\n eval_config = config['eval_metric']\n name = eval_config.pop('name')\n\n if name == 'BCEWithLogitsLoss':\n return nn.BCEWithLogitsLoss()\n elif name == 'CrossEntropyLoss... | [
"0.66313076",
"0.6551158",
"0.64049035",
"0.6361392",
"0.6347494",
"0.63319176",
"0.63283426",
"0.6311559",
"0.62876123",
"0.6281167",
"0.6250762",
"0.62177956",
"0.6117379",
"0.6110526",
"0.6107746",
"0.61036915",
"0.6102665",
"0.6100325",
"0.60988206",
"0.6098097",
"0.60924... | 0.6997882 | 0 |
Checks that the NBA API returns a list All Stars that match our expected data. | def test_nba_api_match(nba_api, expected_data):
nba_api.call_all_stars()
api_star_names = nba_api.return_all_star_names()
api_star_names.sort()
expected_stars = expected_data['all_stars']
expected_stars.sort()
assert (api_star_names == expected_stars) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_feature_starrers__no_stars(self):\n feature_1_id = self.feature_1.key.integer_id()\n actual = notifier.FeatureStar.get_feature_starrers(feature_1_id)\n self.assertEqual([], actual)",
"def test_award_list(self):\n resp = self.client.get('/api/v1/awards/')\n self.assertEqual(res... | [
"0.60631937",
"0.57672024",
"0.56862336",
"0.55025303",
"0.5404626",
"0.54018503",
"0.5379259",
"0.53650606",
"0.5360184",
"0.5352282",
"0.5346155",
"0.53406584",
"0.533393",
"0.5325785",
"0.53107846",
"0.5307978",
"0.53071874",
"0.52903676",
"0.5289974",
"0.5278253",
"0.5252... | 0.66825455 | 0 |
Test case for delete_sms_message | def test_delete_sms_message(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_sms_messages(self):\n pass",
"def test_delete_message(self):\n\n with self.client as c:\n with c.session_transaction() as sess:\n sess[CURR_USER_KEY] = self.test_user_id\n\n resp = c.post(f\"/messages/{self.test_msg_id}/delete\")\n\n s... | [
"0.91773945",
"0.7514752",
"0.7502158",
"0.7438375",
"0.7380026",
"0.725539",
"0.7136757",
"0.71223706",
"0.71200097",
"0.711685",
"0.70407176",
"0.6999508",
"0.69591075",
"0.6927136",
"0.6854388",
"0.68229896",
"0.681961",
"0.67976457",
"0.6754506",
"0.67475814",
"0.67141104... | 0.9463168 | 0 |
Test case for delete_sms_messages | def test_delete_sms_messages(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_sms_message(self):\n pass",
"def test_delete_multiple_messages_returns_200(self):\n response = self.client.delete(\n self.url,\n headers={\"Authorization\": self.test_user_token},\n json={\"messageIds\": [self.test_message_one.id, self.test_message_t... | [
"0.9338108",
"0.74968404",
"0.74629694",
"0.74303377",
"0.73786664",
"0.73388475",
"0.7280652",
"0.72503656",
"0.7085368",
"0.703786",
"0.69507295",
"0.6942626",
"0.69220436",
"0.68962616",
"0.6864538",
"0.6848225",
"0.6777019",
"0.67506343",
"0.6736874",
"0.67276883",
"0.671... | 0.9434885 | 0 |
Test case for get_sms_message | def test_get_sms_message(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_smsmessage_user():",
"def _msim_message_test(\n self,\n ad_mo,\n ad_mt,\n mo_sub_id,\n mt_sub_id, msg=\"SMS\",\n max_wait_time=MAX_WAIT_TIME_SMS_RECEIVE,\n expected_result=True):\n\n if msg == \"SMS\":\n for length in self.message_length... | [
"0.79881704",
"0.7352672",
"0.7063218",
"0.6995457",
"0.69243234",
"0.6893073",
"0.6737283",
"0.6715984",
"0.6682555",
"0.66740185",
"0.6670877",
"0.65920496",
"0.65826803",
"0.65732574",
"0.6565553",
"0.6558283",
"0.6541745",
"0.6531631",
"0.6477239",
"0.6433856",
"0.6430533... | 0.9297351 | 0 |
Test case for get_sms_messages_paginated | def test_get_sms_messages_paginated(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_admin_smsmessage_view_list(self):\n response = self.client.get('/admin/sms_module/smsmessage/')\n self.failUnlessEqual(response.status_code, 200)",
"def messages(self, request, *args, **kwargs):\n conversation = self.get_object()\n related = ['user__profile']\n related... | [
"0.6724562",
"0.65855765",
"0.65105736",
"0.64182",
"0.6381551",
"0.63679737",
"0.6311335",
"0.62858313",
"0.62317616",
"0.6117425",
"0.61094904",
"0.61003464",
"0.60537875",
"0.6015613",
"0.59781903",
"0.5955255",
"0.5948406",
"0.59329796",
"0.5931566",
"0.5921035",
"0.58792... | 0.94580793 | 0 |
Test case for get_unread_sms_count | def test_get_unread_sms_count(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unread_count(self):\n self.assertEqual(1, self.alice_inbox.unread_count)\n self.assertEqual(2, self.bob_inbox.unread_count)\n self.assertEqual(0, self.carol_inbox.unread_count)",
"def test_get_unread_status_count(self):\n request = self.factory.get(\"\")\n request.user... | [
"0.7428484",
"0.70662117",
"0.70209134",
"0.69250965",
"0.6768606",
"0.67276937",
"0.6712709",
"0.6593151",
"0.6553094",
"0.6544224",
"0.6512887",
"0.65081185",
"0.64389706",
"0.63705754",
"0.6348602",
"0.6341913",
"0.62964576",
"0.62113786",
"0.6197132",
"0.6195831",
"0.6146... | 0.9400318 | 0 |
Set cursor to head and return value. | def first(self):
if self.head:
self.cursor = self.head
return self.cursor
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_cursor(self, cursor):\n self._cursor = cursor",
"def head(self, head):\n\n self._head = head",
"def before_cursor_next(self, cursor):\n pass",
"def set_cursor(self, cursor):\n for step in self.steps:\n step[1].set_cursor(cursor)\n return self",
"def cu... | [
"0.6844051",
"0.6388312",
"0.6382036",
"0.63685083",
"0.63387054",
"0.62865436",
"0.61413705",
"0.611203",
"0.6081945",
"0.60263824",
"0.60263824",
"0.60263824",
"0.5977552",
"0.59563315",
"0.59563315",
"0.5937925",
"0.59013456",
"0.5896128",
"0.5873023",
"0.58664757",
"0.585... | 0.7369045 | 0 |
Set cursor to next node and return value. | def next(self):
if self.cursor.nref:
self.cursor = self.cursor.nref
return self.cursor
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __next__(self) -> object:\n if not self.current_node:\n raise StopIteration\n\n current_node_value = self.current_node.value()\n self.current_node = self.current_node.next()\n return current_node_value",
"def get_next(self):\n return self.cur_node.next.data",
"... | [
"0.7194746",
"0.68990916",
"0.6886612",
"0.68468225",
"0.68432724",
"0.6704389",
"0.6704389",
"0.6704389",
"0.66177464",
"0.65851474",
"0.6583519",
"0.655754",
"0.65512866",
"0.6538686",
"0.6535491",
"0.65344507",
"0.6525343",
"0.65207446",
"0.64936644",
"0.64655405",
"0.6465... | 0.7529478 | 0 |
Set cursor to previous node and return value. | def previous(self):
if self.cursor.pref:
self.cursor = self.cursor.pref
return self.cursor
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _prev(self, _):\n self.notebook.SetSelection(self.idx-1)",
"def previous(self):\n if len(self.stack) == 1:\n return None\n self.stack.pop()\n return self.get_node()",
"def _PrevExpression(self):\r\n self.RestoreExpression()\r\n self.expressionindex-=1\r\n ret... | [
"0.66671693",
"0.6628972",
"0.6619934",
"0.6541928",
"0.65124005",
"0.64847946",
"0.64836437",
"0.647833",
"0.6466722",
"0.6382392",
"0.6338151",
"0.6337901",
"0.63246906",
"0.63216805",
"0.62919265",
"0.6273135",
"0.6273111",
"0.6258625",
"0.623803",
"0.6217362",
"0.62012714... | 0.79355323 | 0 |
Update the child pointer ID for the current node. | def setChildId(self, childId):
if self.cursor:
self.cursor.childId = childId | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def child_id(self, child_id):\n\n self._child_id = child_id",
"def set_child_id(self, child_key: str, child_run_id: str) -> None:\n self._child_key = child_key\n self._child_run_id = child_run_id",
"def setChild(self, p_int, *__args): # real signature unknown; restored from __doc__ with mu... | [
"0.689228",
"0.6211195",
"0.61113375",
"0.60806096",
"0.6055202",
"0.58166665",
"0.5816543",
"0.5780103",
"0.57617867",
"0.57554656",
"0.5747848",
"0.56829566",
"0.56609714",
"0.5657746",
"0.5638708",
"0.54964876",
"0.54699564",
"0.5466096",
"0.5446065",
"0.54458743",
"0.5434... | 0.7269834 | 0 |
Update the sublist for the current node. | def setSublist(self, sublist):
if self.cursor:
self.cursor.sublist = sublist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_subfiles(self) -> None:\n\t\t# Clear list of subfiles\n\t\tself.subfiles.clear()\n\t\t# Iterate over Nodes\n\t\tfor node in self.nodes:\n\t\t\tfor file in node.get_subfiles():\n\t\t\t\tself.subfiles.add(\"{}/{}\".format(self.xml_dir, file))\n\t\t# Iterate over SubNodes\n\t\tfor subnode in self.subnodes... | [
"0.61103445",
"0.6081414",
"0.60720336",
"0.6036406",
"0.6031752",
"0.5968815",
"0.59568065",
"0.59119153",
"0.5843359",
"0.58083177",
"0.5755129",
"0.5719032",
"0.5716412",
"0.56964624",
"0.56887376",
"0.56816745",
"0.56636894",
"0.56284004",
"0.5576053",
"0.5550335",
"0.554... | 0.6661264 | 0 |
Returns the current list's head node ID, which is the ID of the first node in the sublist. Stored as the child ID in the cursor sublist node. | def getHeadId(self):
if self.cursor:
return self.cursor.childId
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadHeadId(self):\n rec = self.db.selectById(self.tableName, 1)\n if rec:\n self.headId = rec['childId']\n return self.headId\n print('Error! No first sublist record found.')\n return None",
"def getChildId(self):\n if self.cursor:\n return ... | [
"0.7650758",
"0.62124133",
"0.6189284",
"0.5923709",
"0.58960605",
"0.5894876",
"0.5894876",
"0.5833733",
"0.5759456",
"0.57556945",
"0.57405174",
"0.5699721",
"0.5668968",
"0.5661681",
"0.563879",
"0.55798924",
"0.55545825",
"0.555003",
"0.5548141",
"0.551549",
"0.5510951",
... | 0.75668454 | 1 |
Create the table, if it doesn't already exist in the current database. It also reserves the very first record to store the 'head' record ID, since this is mutable (the user can shift data around), thus we need a solid starting point, pointing to the head, wherever it may be in the table at the moment. | def initTable(self):
sql = """ ( nodeId integer PRIMARY KEY,
nextId integer,
childId integer,
label text);
"""
self.db.createTable(self.tableName + sql)
# Reserve the first record as the head pointer, if it's not there
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(self):\n logging.debug('Creating new table')\n if not self._dbconnect or not self._cursor:\n raise Exception('Invalid call to Context Manager method!')\n\n self._cursor.execute(\"create table {} (date text, time text, location text, nodeID text)\".format(self._name)... | [
"0.69965774",
"0.69594985",
"0.6885262",
"0.68815774",
"0.68663996",
"0.67848057",
"0.67747885",
"0.6768667",
"0.67670316",
"0.6716009",
"0.6699258",
"0.6688352",
"0.6677764",
"0.6676013",
"0.66524184",
"0.6649117",
"0.66155744",
"0.66094506",
"0.6579713",
"0.65762913",
"0.65... | 0.8027389 | 0 |
Load all connected nodes beginning with the Head ID from the first record into the provided DoubleLinkList (1dimensional). | def load(self, theList: DoubleLinkList):
nextId = self.loadHeadId()
while nextId:
rec = self.db.selectById(self.tableName, nextId)
theList.addNode(appendIt=True, nodeId=rec['nodeId'], childId=rec['childId'],
label=rec['label'])
nextId = rec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_first(self, data):\n # define the head as the new Node\n self.head = Node(data, next=self.head)\n # if list was empty define th tail as the head\n if self.tail is None:\n self.tail = self.head\n # set the skip back pointer if needed\n if self.head.next i... | [
"0.55087054",
"0.54595256",
"0.54401547",
"0.5433761",
"0.53921384",
"0.5325638",
"0.5285543",
"0.52591926",
"0.52464294",
"0.5234643",
"0.52337515",
"0.52164835",
"0.5213779",
"0.51908237",
"0.5188615",
"0.5157376",
"0.51544315",
"0.5126514",
"0.512166",
"0.51161116",
"0.508... | 0.764213 | 0 |
Load all connected nodes beginning with the Head ID from the first record into the provided ListOfLists (2dimensional), as sublists. Then load each sublist. | def loadListOfLists(self, theList: ListOfLists):
nextListId = self.loadHeadId()
while nextListId:
rec = self.db.selectById(self.tableName, nextListId)
childId = rec['childId']
theList.addList(appendIt=True, nodeId=rec['nodeId'], childId=childId,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(self, theList: DoubleLinkList):\n nextId = self.loadHeadId()\n while nextId:\n rec = self.db.selectById(self.tableName, nextId)\n theList.addNode(appendIt=True, nodeId=rec['nodeId'], childId=rec['childId'],\n label=rec['label'])\n n... | [
"0.6216345",
"0.5365256",
"0.5259983",
"0.5259861",
"0.5232257",
"0.51548785",
"0.5095261",
"0.5067658",
"0.4927808",
"0.48954186",
"0.4870286",
"0.48575258",
"0.4831813",
"0.48301443",
"0.48194122",
"0.4812096",
"0.48102123",
"0.47762698",
"0.47586632",
"0.47257864",
"0.4722... | 0.7120819 | 0 |
Loads the first record of the table, which holds the record ID of the head node in the saved link list. This node ID can change whenever a new head node or sublist node is added or deleted. | def loadHeadId(self):
rec = self.db.selectById(self.tableName, 1)
if rec:
self.headId = rec['childId']
return self.headId
print('Error! No first sublist record found.')
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initTable(self):\n sql = \"\"\" ( nodeId integer PRIMARY KEY,\n nextId integer,\n childId integer,\n label text);\n \"\"\"\n self.db.createTable(self.tableName + sql)\n # Reserve the first record as the head pointer, if it... | [
"0.68827915",
"0.63930523",
"0.6216851",
"0.6096954",
"0.6087707",
"0.5796925",
"0.577951",
"0.57302713",
"0.5709124",
"0.56802595",
"0.567101",
"0.56219554",
"0.5578597",
"0.55124503",
"0.5504878",
"0.5469639",
"0.5436854",
"0.5436854",
"0.5382569",
"0.53682774",
"0.53498465... | 0.7815468 | 0 |
Update node data to the database, filtering out passed siblings which are None. Inserts if there's no node ID, to acquire one from the new record ID, which also updates the previous nodes next ID. Otherwise it updates the old record. | def save(self, node):
if node:
nextId = node.nref.nodeId if node.nref else None
record = dict(nextId=nextId, childId=node.childId, label=node.label)
if not node.nodeId:
node.nodeId = self.db.insert(self.tableName, record)
self.save(node.pref)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, key, node, local_edges, foreign_edges, transaction_id):\n assert self.row_exists(key, transaction_id), \"Key does not exist\"\n\n last_node = self.rows[key][-1]\n node = last_node.copy(node, local_edges, foreign_edges, transaction_id)\n self._create_or_update_row(key, n... | [
"0.61769617",
"0.5661638",
"0.56557274",
"0.5580418",
"0.55544555",
"0.55355906",
"0.550472",
"0.548036",
"0.54486036",
"0.54473084",
"0.54024106",
"0.5401183",
"0.5357976",
"0.53533226",
"0.53431994",
"0.53304696",
"0.52921146",
"0.5160133",
"0.5153682",
"0.5151113",
"0.5146... | 0.6035623 | 1 |
Updates the record id of the head sublist record. | def saveHeadId(self, headId):
self.headId = headId
record = dict(nextId=None, childId=headId, label='head pointer')
self.db.update(1, self.tableName, record) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadHeadId(self):\n rec = self.db.selectById(self.tableName, 1)\n if rec:\n self.headId = rec['childId']\n return self.headId\n print('Error! No first sublist record found.')\n return None",
"def _update_head(self, course_key, index_entry, branch, new_id):\n ... | [
"0.71913046",
"0.5909919",
"0.58707434",
"0.5700044",
"0.55987924",
"0.54624844",
"0.5406612",
"0.53759485",
"0.53540254",
"0.52908164",
"0.52557015",
"0.52411836",
"0.52329826",
"0.52329826",
"0.52329826",
"0.52329826",
"0.52329826",
"0.52329826",
"0.52329826",
"0.52329826",
... | 0.5978991 | 1 |
Saves this node, plus its sibling nodes that also changed due to an add or move operation. The save() method automatically ignores sibling nodes that are None. | def saveNodeAndSiblings(self, node):
self.save(node)
self.save(node.pref)
self.save(node.nref) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_node(self, node: Node):",
"def save_node(self):\n # save node in path2node\n if self.full_path in self.file.path2node:\n print \"** Error, created node with path twice:\\n%s\" % self.full_path\n traceback.print_stack()\n sys.exit(1)\n self.file.path2... | [
"0.6932422",
"0.65741545",
"0.6546616",
"0.60618746",
"0.5862957",
"0.58346206",
"0.58055556",
"0.57477266",
"0.5745581",
"0.5704365",
"0.5703175",
"0.56833416",
"0.5679084",
"0.5679084",
"0.5679084",
"0.56673646",
"0.56533295",
"0.56447184",
"0.5611983",
"0.5579673",
"0.5579... | 0.7666098 | 0 |
performs grid search on first classifier | def grid_search(self, params):
train_X, train_y, dev_X, dev_y = self.extract_train_dev_data()
clf = self.classifiers[0]
pred_y = clf.grid_search(params, train_X, train_y, dev_X)
logger.info(classification_report(dev_y, pred_y)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_gridsearch():\n df = read_df()\n X = df['review']\n y = df['sentiment']\n X_train, X_holdout, y_train, y_holdout = train_test_split(X, y, test_size=0.3, shuffle=True, stratify=y, random_state=222 )\n tfidf = TfidfVectorizer(stop_words='english', max_df=0.8)\n\n stem_pipeline = make_pipelin... | [
"0.69974726",
"0.6735402",
"0.67324466",
"0.6695556",
"0.6673057",
"0.6650854",
"0.6649412",
"0.65965617",
"0.6524784",
"0.65171087",
"0.6510658",
"0.6468258",
"0.6468258",
"0.64501977",
"0.6439914",
"0.64393884",
"0.641694",
"0.63735074",
"0.63232934",
"0.6322927",
"0.631559... | 0.8047581 | 0 |
Generate CPABE public and master secret key and store them in the given files. | def setup(pk_outfile=const.ABE_PK_FILE, msk_outfile=const.ABE_MSK_FILE, pairing_group_curve=const.PAIRING_GROUP_CURVE,
debug=0):
# Instantiate a bilinear pairing map with the given curve
pairing_group = PairingGroup(pairing_group_curve)
# CP-ABE
cpabe = CPabe_BSW07(pairing_group)
# Crea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_keys():\n if os.path.isfile(\"key.txt\"):\n message = \"Key already generated\"\n else:\n secret = secrets.token_urlsafe(64)\n message = \"Secret generated and saved in key.txt\"\n with open(\"key.txt\", \"w\") as fd:\n fd.write(secret)\n return json.dumps({'mes... | [
"0.6466154",
"0.62899786",
"0.6258687",
"0.6202768",
"0.619326",
"0.60750604",
"0.6040009",
"0.60250723",
"0.5998315",
"0.59418607",
"0.5902854",
"0.5875616",
"0.5860685",
"0.5856271",
"0.585434",
"0.58342403",
"0.5815232",
"0.57986635",
"0.57940686",
"0.57940257",
"0.579174"... | 0.63104564 | 1 |
Encrypt data using ABE scheme with the given public key and policy | def encrypt(data=None, pairing_group=None, pk=None, policy=None, debug=0):
# Check if data is set
if data is None:
logging.error('encrypt_seed_key_len data exception')
if debug: # ONLY USE FOR DEBUG
print('EXCEPTION in encrypt_seed_key_len data')
raise Exception
# Chec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt(cls, plaintext, aad, key, iv):",
"def dh_encrypt(pub, message):\n \n Group, private, public = dh_get_key()#generate new DH pair for Alice\n #private key is an integer/scalar and public key is a point on the curve \n \n #check whether public key of Bob is valid and on curve \n assert... | [
"0.6215366",
"0.62131697",
"0.6203424",
"0.6078133",
"0.60329175",
"0.60142803",
"0.5990758",
"0.5970462",
"0.5960776",
"0.5888879",
"0.5764996",
"0.572243",
"0.5712284",
"0.5691664",
"0.5686507",
"0.5678793",
"0.5670466",
"0.56587017",
"0.56128335",
"0.5599599",
"0.5592536",... | 0.63199055 | 0 |
View handle my social connection page | def social_connection(request):
backend_map = {'facebook': {'name': 'facebook', 'connected': False,
'dc_url': reverse('social:disconnect', kwargs={'backend': 'facebook'})},
'google': {'name': 'google-oauth2', 'connected': False,
'dc_ur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def facebook_connect(request, template='socialregistration/facebook.html',\n extra_context=dict()):\n # for facebook the login is done in JS, so by the time it hits our view here there is no redirect step. Look for the querystring values and use that instead of worrying about session.\n connect_object = g... | [
"0.6379492",
"0.62844723",
"0.619812",
"0.61603844",
"0.6102585",
"0.6102585",
"0.5913831",
"0.5828857",
"0.5814265",
"0.58000904",
"0.5722415",
"0.5700442",
"0.5674649",
"0.56717813",
"0.56276107",
"0.5617314",
"0.5616013",
"0.56157875",
"0.5579581",
"0.55725545",
"0.5561613... | 0.75818175 | 0 |
Views thats renders news sources to the home page | def homepage():
general_news=get_sources('general')
business_news=get_sources('business')
sports_news=get_sources('sports')
return render_template('sources.html',general=general_news, business=business_news, sports=sports_news) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n entertainment_news = get_sources('entertainment')\n fashion_news = get_sources('fashion')\n title = 'Vnews'\n return render_template('index.html', title=title, fashion=fashion_news, entertainment=entertainment_news)",
"def home_page_view(request):\n\n\t# Set the variable jse_articles t... | [
"0.75373346",
"0.7415982",
"0.7415839",
"0.73056453",
"0.72505605",
"0.7163801",
"0.71547955",
"0.7132932",
"0.7081197",
"0.7004573",
"0.6854891",
"0.6817566",
"0.6759091",
"0.6715063",
"0.67048156",
"0.66193694",
"0.65456355",
"0.6536079",
"0.65282154",
"0.6526098",
"0.65229... | 0.8323401 | 0 |
View that would return news articles | def NewsArticles():
health_articles = get_articles('health')
education_articles = get_articles('technology')
return render_template('articles.html',health=health_articles, tech =education_articles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def news(request):\n articles = News.objects.all()\n return render(request, 'news.html', {\"articles\": articles})",
"def newsfeed(request):\n article_list = Article.objects.order_by('published_date')\n context = {'article_list': article_list}\n return render(request, 'sacms/newsfeed.html', contex... | [
"0.8422911",
"0.7939385",
"0.7903623",
"0.7807585",
"0.7735028",
"0.7547046",
"0.7498529",
"0.7439669",
"0.743487",
"0.74265945",
"0.7382276",
"0.7278104",
"0.72469956",
"0.7242258",
"0.71915346",
"0.71299",
"0.70865196",
"0.707854",
"0.70623153",
"0.70585346",
"0.7006468",
... | 0.8291898 | 1 |
function that returns the searched articles | def articleSearch(article_name):
search_article_name = article_name.split("")
search_name_format = "+".join(search_article_name)
searched_articles = search_articles(search_name_format)
return render_template('search.html',articles = searched_articles) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_news(request):\n try:\n query_string = ''\n if request.GET['search_text'].strip() != '':\n query_string = '&title='+request.GET['search_text']\n response = requests.get(APIURL + '/articles/?format=json'+query_string)\n parser = json.loads(response.content)\n ... | [
"0.7186117",
"0.6988905",
"0.6960163",
"0.6941734",
"0.6911264",
"0.67364365",
"0.67003137",
"0.66531736",
"0.66310287",
"0.65921223",
"0.65345204",
"0.6490673",
"0.637851",
"0.63575894",
"0.62927914",
"0.6282196",
"0.62599754",
"0.6258574",
"0.6252506",
"0.6247338",
"0.62282... | 0.7510673 | 0 |
Returns the size or number of bytes of the memory module. | def getSize(self) -> int:
return len(self.mem) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSize(self):\n return self.bf.memory()",
"def get_total_memory_size(self):\n return self.drt_manager.get_total_memory_size()",
"def memsize(self):\n return self.xlist(\"get-memsize\")[1][0] * 1024",
"def size_bytes(self):\n size_words = self.size_words()\n if size_words is None:\... | [
"0.7623135",
"0.75418335",
"0.7527066",
"0.7176314",
"0.7151762",
"0.713853",
"0.7124511",
"0.7107852",
"0.70797235",
"0.7068928",
"0.7054791",
"0.7054791",
"0.7054791",
"0.7054791",
"0.7054791",
"0.7054791",
"0.7054791",
"0.7054791",
"0.7054791",
"0.7054791",
"0.7054791",
... | 0.76415974 | 0 |
Retrieve the net gain percentage in total value of portfolio at the end of the backtest | def net_gain_loss_percentage():
try:
with open(folder + 'portfolio_balance.json', encoding='utf-8') as read_file:
data = json.loads(read_file.read(),
object_pairs_hook=OrderedDict)
net_gain_loss = data['final_portfolio'] / portfolio_value
lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_profit(self):",
"def percentageChange(self):\n try:\n curPrice = self.dailyData[-1].currentPrice\n closePrice = self.historicData[-1].closePrice\n except IndexError: # Just return zero when no historic or dailyData is available yet\n return 0.0\n return (curPrice... | [
"0.65579927",
"0.61883414",
"0.61835027",
"0.6162108",
"0.6050546",
"0.6048661",
"0.599609",
"0.59796023",
"0.59576464",
"0.5940993",
"0.5906892",
"0.59037197",
"0.58747596",
"0.58715194",
"0.58649564",
"0.5861075",
"0.5859904",
"0.5809884",
"0.5800906",
"0.5783402",
"0.57765... | 0.67480105 | 0 |
Take `images_per_class` from the train dataset and create a validation set. | def create_validation_split(train_data, fraction_per_class=0.1, shuffle=True):
subset_train_data = []
val_data = []
val_label_counts = {}
class_labels = [i['class']['label'] for i in train_data]
images_per_class = Counter(class_labels)
val_images_per_class = {label: 0 for label in images_per_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_train_validation_test_sets(path_to_json, out_dir, path_to_images,\n train_fraction=0.6,\n validation_fraction=0.2,\n test_fraction=0.2,\n do_print=False):\n assert... | [
"0.70862657",
"0.68533665",
"0.6514909",
"0.65044284",
"0.6460029",
"0.6398828",
"0.6384702",
"0.6384702",
"0.63737273",
"0.6358643",
"0.63232464",
"0.63111234",
"0.63051456",
"0.62699944",
"0.62421966",
"0.622691",
"0.6216368",
"0.61776704",
"0.61775273",
"0.6167151",
"0.616... | 0.7281224 | 0 |
Increases the credit of the card | def charge(self, other):
if self.flag:
self.credit += other
return "{} Tomans has been added to your card credit and now the credit of your card is {} Tomans".format(
other, self.credit)
else:
return "Sorry, your card has expired." | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charge(self, other):\n self.credit += other\n print(\"{} Tomans has been added to your card credit and now the credit of your card is {} Tomans\".format(other,\n self.credit))",
"def ... | [
"0.7035775",
"0.6908582",
"0.6584606",
"0.65523666",
"0.6435155",
"0.63019294",
"0.6200756",
"0.61545724",
"0.6137888",
"0.6132437",
"0.61214805",
"0.6077653",
"0.60740805",
"0.6062242",
"0.60452324",
"0.60144305",
"0.6013067",
"0.5982951",
"0.59137625",
"0.5900946",
"0.58880... | 0.69234675 | 1 |
Increases the credit of the card | def charge(self, other):
self.credit += other
print("{} Tomans has been added to your card credit and now the credit of your card is {} Tomans".format(other,
self.credit)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def charge(self, other):\n if self.flag:\n self.credit += other\n return \"{} Tomans has been added to your card credit and now the credit of your card is {} Tomans\".format(\n other, self.credit)\n else:\n return \"Sorry, your card has expired.\"",
"... | [
"0.69234675",
"0.6908582",
"0.6584606",
"0.65523666",
"0.6435155",
"0.63019294",
"0.6200756",
"0.61545724",
"0.6137888",
"0.6132437",
"0.61214805",
"0.6077653",
"0.60740805",
"0.6062242",
"0.60452324",
"0.60144305",
"0.6013067",
"0.5982951",
"0.59137625",
"0.5900946",
"0.5888... | 0.7035775 | 0 |
Do something with emails messages in the folder. For the sake of this example, print some headers. | def process_mailbox(M):
rv, data = M.search(None, config.email['search'])
if rv != 'OK':
logger.info("No messages found!")
return
for num in data[0].split():
rv, data = M.fetch(num, '(RFC822)')
if rv != 'OK':
logger.error("ERROR getting message", num)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def userMessages(self, path, pattern):\n log(logging.DEBUG, \"Look for files at \" + path + \" with pattern \" + pattern)\n # if folder does not exist\n if not os.path.exists(path):\n return []\n # result message list\n message_list = []\n # retrieve file names\... | [
"0.6262737",
"0.592273",
"0.5789566",
"0.5778403",
"0.56953245",
"0.5670702",
"0.5649647",
"0.5602646",
"0.55907255",
"0.55646175",
"0.55509037",
"0.5533535",
"0.5529366",
"0.5527925",
"0.54993945",
"0.54717857",
"0.5467351",
"0.5438078",
"0.54356897",
"0.54338974",
"0.542173... | 0.612142 | 1 |
get the database data on the last period | def get_data(last):
Table = "ServerRoom"
filter = ""
if last == "lastone":
data = request_meteodata("SELECT * from `ServerRoom` ORDER BY id DESC LIMIT 1 ")
if len(data) == 0:
return [SensorData(datetime.datetime.now(), 0, 0)]
res = []
for d in data:
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data(self, date_time):\n id_columns = ','.join([col for col in self.table_primary_keys if col not in ['EFFECTIVEDATE', 'VERSIONNO']])\n return_columns = ','.join(self.table_columns)\n with self.con:\n cur = self.con.cursor()\n cur.execute(\"DROP TABLE IF EXISTS te... | [
"0.66456187",
"0.66129696",
"0.65368724",
"0.6481614",
"0.6442516",
"0.63483286",
"0.63411635",
"0.6279019",
"0.62594837",
"0.62587345",
"0.62279445",
"0.6175993",
"0.616382",
"0.6153795",
"0.6136147",
"0.61287874",
"0.606596",
"0.6036077",
"0.6036077",
"0.60130566",
"0.59977... | 0.67294055 | 0 |
Lists genomes present in selected reference databases (ensembl, phytozome, refseq) | def list_reference_genomes(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.list_reference_genomes',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_genomes():\n genome_list = yaml.load(open(script_dir + \"/utils/genomes.yaml\",\"r\"))\n print(\"\")\n print(\"\\033[1m%-30s\\t%-30s\\033[0m\" % (\"Reference Name\", \"Location\"))\n for k,v in genome_list.items():\n print(\"%-30s\\t%-30s\" % (k, v))\n print(\"\")",
"def load_refge... | [
"0.72052234",
"0.6681579",
"0.65693146",
"0.6492775",
"0.6463348",
"0.64268726",
"0.60308814",
"0.59824353",
"0.5938681",
"0.5849946",
"0.5805375",
"0.5713854",
"0.5712395",
"0.5681238",
"0.56560886",
"0.56373715",
"0.5536142",
"0.5521856",
"0.5500701",
"0.5477903",
"0.546699... | 0.7649514 | 0 |
Lists genomes indexed in SOLR | def list_solr_genomes(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.list_solr_genomes',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_genomes_in_solr(self, params, context=None):\n return self._client.call_method(\n 'ReferenceDataManager.index_genomes_in_solr',\n [params], self._service_ver, context)",
"def list_genomes():\n genome_list = yaml.load(open(script_dir + \"/utils/genomes.yaml\",\"r\"))\n ... | [
"0.6830845",
"0.65424156",
"0.60664916",
"0.606512",
"0.60501164",
"0.58641434",
"0.5826815",
"0.5826815",
"0.58215374",
"0.58214",
"0.57476413",
"0.56885886",
"0.568328",
"0.5639871",
"0.5536571",
"0.54968697",
"0.549255",
"0.5483767",
"0.545044",
"0.5449478",
"0.5432765",
... | 0.6747959 | 1 |
Index specified genomes in SOLR from KBase workspace | def index_genomes_in_solr(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.index_genomes_in_solr',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_index():\n for site in get_sites():\n text = read_site(site)\n while text == False:\n text = read_site(site) # keep attempting to read until successful\n index_site(site, text)",
"def build_index():\n for site in get_sites():\n text = read_site(site)\n ... | [
"0.6265813",
"0.6265813",
"0.6139362",
"0.61347544",
"0.6121336",
"0.6064185",
"0.60180306",
"0.5999387",
"0.5975277",
"0.596837",
"0.5914677",
"0.5905104",
"0.5903449",
"0.58965874",
"0.5834955",
"0.58183974",
"0.5724497",
"0.57202715",
"0.5687734",
"0.5682116",
"0.5679189",... | 0.72983086 | 0 |
Lists taxa indexed in SOLR | def list_solr_taxa(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.list_solr_taxa',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_taxa_in_solr(self, params, context=None):\n return self._client.call_method(\n 'ReferenceDataManager.index_taxa_in_solr',\n [params], self._service_ver, context)",
"def index_terms(self):\n [[self.set_postings(term, id) for term in NLProcessor.process(doc)] for id, d... | [
"0.6509729",
"0.6357868",
"0.62683314",
"0.60519195",
"0.5974132",
"0.5915071",
"0.591159",
"0.5772863",
"0.5712139",
"0.56651306",
"0.5592324",
"0.556518",
"0.55518234",
"0.554848",
"0.55198777",
"0.55016136",
"0.54998034",
"0.5499193",
"0.5472442",
"0.5457834",
"0.543946",
... | 0.6861536 | 0 |
Loads specified taxa into KBase workspace and indexes in SOLR on demand | def load_taxa(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.load_taxa',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_taxa_in_solr(self, params, context=None):\n return self._client.call_method(\n 'ReferenceDataManager.index_taxa_in_solr',\n [params], self._service_ver, context)",
"def load_tas_lookup():\n logger.info('Loading TAS')\n load_tas()",
"def list_solr_taxa(self, params, ... | [
"0.6498204",
"0.5891013",
"0.57397306",
"0.5648463",
"0.55865234",
"0.54691",
"0.525066",
"0.52232873",
"0.5206583",
"0.5182996",
"0.5106142",
"0.5098938",
"0.50653493",
"0.5048019",
"0.501896",
"0.50153154",
"0.50048745",
"0.49948743",
"0.49922657",
"0.49847096",
"0.49776623... | 0.6328378 | 1 |
Index specified taxa in SOLR from KBase workspace | def index_taxa_in_solr(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.index_taxa_in_solr',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reindex_subcomponent_taxa():\n pass",
"def index_siteroot(context):\n portal = getSite()\n portal.reindexObject()",
"def index_fobj(fobj):\n doc = fileobject_to_dict(fobj)\n if doc is not None:\n #print doc\n SOLR.add(doc)\n else:\n pass",
"def search(terms):\n ... | [
"0.6358017",
"0.6279029",
"0.6045649",
"0.5848363",
"0.5843543",
"0.579074",
"0.57332224",
"0.5654865",
"0.5615632",
"0.55991507",
"0.5592114",
"0.5569687",
"0.556002",
"0.54822147",
"0.54292715",
"0.5420272",
"0.536411",
"0.5358117",
"0.5352065",
"0.5331198",
"0.5322685",
... | 0.71712476 | 0 |
Loads specified genomes into KBase workspace and indexes in SOLR on demand | def load_genomes(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.load_genomes',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_genomes_in_solr(self, params, context=None):\n return self._client.call_method(\n 'ReferenceDataManager.index_genomes_in_solr',\n [params], self._service_ver, context)",
"def load_refgenomes(self, params, context=None):\n return self._client.call_method(\n ... | [
"0.6626249",
"0.60957223",
"0.60924673",
"0.60247797",
"0.59353334",
"0.5797676",
"0.56434065",
"0.55891055",
"0.5580639",
"0.5580639",
"0.55667996",
"0.5544847",
"0.5504955",
"0.54986495",
"0.5482139",
"0.5481608",
"0.545993",
"0.54438055",
"0.5425209",
"0.53886104",
"0.5387... | 0.66491956 | 0 |
Loads NCBI RefSeq genomes into KBase workspace with or without SOLR indexing | def load_refgenomes(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.load_refgenomes',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_genomes(self, params, context=None):\n return self._client.call_method(\n 'ReferenceDataManager.load_genomes',\n [params], self._service_ver, context)",
"def index_gcis(gcis_url, es_url, index, alias, dump_dir):\n conn = get_es_conn(es_url, index, alias)\n refList = ge... | [
"0.6063036",
"0.5841345",
"0.58144426",
"0.5734855",
"0.54659575",
"0.5403981",
"0.5402181",
"0.5332247",
"0.5307035",
"0.5291659",
"0.5222015",
"0.5217969",
"0.5209188",
"0.5207623",
"0.5170394",
"0.51697093",
"0.5144679",
"0.5139786",
"0.51380336",
"0.51057464",
"0.50968397... | 0.61688125 | 0 |
Updates the loaded genomes in KBase for the specified source databases | def update_loaded_genomes(self, params, context=None):
return self._client.call_method(
'ReferenceDataManager.update_loaded_genomes',
[params], self._service_ver, context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gbf_pub_update():\r\n LOG.info(\"Start: Update datasets in RLIDGeo warehouse.\")\r\n month_stamps = [\r\n datetime.date.today().strftime(\"%Y_%m\"),\r\n (\r\n datetime.date.today().replace(day=1)\r\n - datetime.timedelta(days=1)\r\n ).strftime(\"%Y_%m\"),\r\n ... | [
"0.59036124",
"0.57262635",
"0.5505454",
"0.5471788",
"0.5454221",
"0.53054446",
"0.5293783",
"0.52560055",
"0.51999205",
"0.5191524",
"0.51797444",
"0.51658607",
"0.515508",
"0.5140619",
"0.5138678",
"0.5115914",
"0.5101359",
"0.5012815",
"0.49987558",
"0.49879158",
"0.49756... | 0.6448755 | 0 |
Apply a mapping of namevaluepairs to a template. | def apply(self, mapping):
mapping = {name: self.str(value, tolerant=self.tolerant)
for name, value in mapping.items()
if value is not None or self.tolerant}
if self.tolerant:
return self.template.safe_substitute(mapping)
return self.template.su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_template(template: dict, input_: dict) -> None:\n for k, v in template.items():\n config_val = input_.get(k)\n\n if isinstance(v, dict) and k != 'NullHandler':\n map_template(v, input_)\n\n if config_val:\n template[k] = config_val.upper() if k == 'level' else ... | [
"0.6347333",
"0.6122666",
"0.5724706",
"0.55872214",
"0.5524677",
"0.5517751",
"0.549768",
"0.5487899",
"0.53845775",
"0.530882",
"0.5244786",
"0.52417064",
"0.5239383",
"0.5211652",
"0.5148122",
"0.51388305",
"0.51228106",
"0.51005185",
"0.5080841",
"0.5061058",
"0.50332797"... | 0.6634928 | 0 |
Test case for create_nas_share_by_nas | def test_create_nas_share_by_nas(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_test_nas_share(self):\n pass",
"def test_show_nas_share_by_nas(self):\n pass",
"def test_test_result_nas_share(self):\n pass",
"def test_update_nas_share_by_nas(self):\n pass",
"def test_index_nas_shares_by_nas(self):\n pass",
"def test_show_nas_share(self):\n ... | [
"0.87092817",
"0.8525568",
"0.8476073",
"0.8432505",
"0.811207",
"0.8111951",
"0.79742056",
"0.7967393",
"0.7931208",
"0.7835071",
"0.7778211",
"0.7645673",
"0.7638049",
"0.75317097",
"0.7366997",
"0.7344222",
"0.7333957",
"0.7017911",
"0.6752469",
"0.66835386",
"0.65300155",... | 0.95934916 | 0 |
Test case for destroy_nas_share | def test_destroy_nas_share(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_destroy_nas_share_by_nas(self):\n pass",
"def test_destroy_nas_share_by_pool(self):\n pass",
"def test_test_nas_share(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_update_nas_share(self):\n pass",
"def test_update_nas_share_by_nas(... | [
"0.9389554",
"0.8792524",
"0.76362747",
"0.75515646",
"0.7297889",
"0.7273542",
"0.7258762",
"0.7239002",
"0.71278036",
"0.71259034",
"0.71167296",
"0.7033105",
"0.6955307",
"0.6797405",
"0.67879903",
"0.67438823",
"0.6702528",
"0.669155",
"0.6557659",
"0.6553244",
"0.6280817... | 0.95384085 | 0 |
Test case for destroy_nas_share_by_nas | def test_destroy_nas_share_by_nas(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_destroy_nas_share(self):\n pass",
"def test_destroy_nas_share_by_pool(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_test_nas_share(self):\n pass",
"def test_update_nas_share_by_nas(self):\n pass",
"def test_dashboards_v2_delete_sha... | [
"0.9417224",
"0.8834285",
"0.7744262",
"0.758655",
"0.75549483",
"0.7326083",
"0.7300899",
"0.7292167",
"0.72800195",
"0.71851236",
"0.71172214",
"0.70820516",
"0.69532496",
"0.690352",
"0.67362416",
"0.6723919",
"0.67131734",
"0.67035735",
"0.6650557",
"0.6545809",
"0.640851... | 0.9542495 | 0 |
Test case for destroy_nas_share_by_pool | def test_destroy_nas_share_by_pool(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_destroy_nas_share(self):\n pass",
"def test_destroy_nas_share_by_nas(self):\n pass",
"def test_update_nas_share_by_pool(self):\n pass",
"def test_show_nas_share_by_pool(self):\n pass",
"def test_mount_status_nas_share_by_pool(self):\n pass",
"def test_test_nas_... | [
"0.87827253",
"0.87459147",
"0.7914171",
"0.76246",
"0.75718844",
"0.7118149",
"0.7093812",
"0.708217",
"0.68163544",
"0.6781625",
"0.67124707",
"0.66831726",
"0.6607139",
"0.65762645",
"0.6470638",
"0.64604396",
"0.6458959",
"0.64408374",
"0.6336116",
"0.62824637",
"0.624967... | 0.9630253 | 0 |
Test case for index_nas_shares | def test_index_nas_shares(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index_nas_shares_by_nas(self):\n pass",
"def test_index_nas_shares_by_pool(self):\n pass",
"def test_test_result_nas_share(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_show_nas_share_by_nas(self):\n pass",
"def test_test_nas_share... | [
"0.9408521",
"0.8480369",
"0.7828743",
"0.77089137",
"0.76689196",
"0.7658634",
"0.7639658",
"0.7374224",
"0.73682296",
"0.71836025",
"0.70449203",
"0.69670975",
"0.677711",
"0.675877",
"0.670886",
"0.6664895",
"0.6502741",
"0.6135646",
"0.60962385",
"0.5956307",
"0.5926037",... | 0.93974316 | 1 |
Test case for index_nas_shares_by_nas | def test_index_nas_shares_by_nas(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index_nas_shares(self):\n pass",
"def test_index_nas_shares_by_pool(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_show_nas_share_by_nas(self):\n pass",
"def test_update_nas_share_by_nas(self):\n pass",
"def test_test_result_nas_sha... | [
"0.91021",
"0.85721266",
"0.7744076",
"0.7691755",
"0.7667866",
"0.766065",
"0.7447273",
"0.71588457",
"0.7131582",
"0.70934236",
"0.7039851",
"0.6991671",
"0.67114615",
"0.65478647",
"0.6541465",
"0.63235873",
"0.62416536",
"0.6241281",
"0.60786486",
"0.607121",
"0.5646648",... | 0.95178986 | 0 |
Test case for index_nas_shares_by_pool | def test_index_nas_shares_by_pool(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_index_nas_shares_by_nas(self):\n pass",
"def test_index_nas_shares(self):\n pass",
"def test_show_nas_share_by_pool(self):\n pass",
"def test_update_nas_share_by_pool(self):\n pass",
"def test_mount_status_nas_share_by_pool(self):\n pass",
"def test_destroy_nas... | [
"0.84751886",
"0.8132446",
"0.80617833",
"0.80411273",
"0.74651307",
"0.707621",
"0.6979327",
"0.68828",
"0.6788973",
"0.6761283",
"0.6760841",
"0.6421319",
"0.6332053",
"0.6197863",
"0.601423",
"0.59699273",
"0.578675",
"0.5785175",
"0.5685915",
"0.56655633",
"0.5647678",
... | 0.9608631 | 0 |
Test case for mount_status_nas_share | def test_mount_status_nas_share(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mount_status_nas_share_by_nas(self):\n pass",
"def test_mount_status_nas_share_by_pool(self):\n pass",
"def test_test_nas_share(self):\n pass",
"def test_show_nas_share(self):\n pass",
"def test_test_result_nas_share(self):\n pass",
"def test_show_nas_share_by_... | [
"0.9339884",
"0.86251044",
"0.7847734",
"0.77573013",
"0.7702383",
"0.75028086",
"0.7351555",
"0.73283494",
"0.7200713",
"0.69585705",
"0.68284434",
"0.68067634",
"0.6647951",
"0.65063286",
"0.6441414",
"0.6424272",
"0.6211882",
"0.59345067",
"0.5869384",
"0.5858923",
"0.5856... | 0.94080406 | 0 |
Test case for mount_status_nas_share_by_nas | def test_mount_status_nas_share_by_nas(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mount_status_nas_share(self):\n pass",
"def test_mount_status_nas_share_by_pool(self):\n pass",
"def test_test_nas_share(self):\n pass",
"def test_show_nas_share_by_nas(self):\n pass",
"def test_test_result_nas_share(self):\n pass",
"def test_show_nas_share(sel... | [
"0.9223469",
"0.8762923",
"0.8201179",
"0.81886965",
"0.8143352",
"0.8128441",
"0.7978966",
"0.7839654",
"0.7666999",
"0.7568727",
"0.72756267",
"0.72689754",
"0.718854",
"0.70526314",
"0.70140773",
"0.6603129",
"0.6567966",
"0.64892024",
"0.62469953",
"0.6022947",
"0.5962818... | 0.94895434 | 0 |
Test case for mount_status_nas_share_by_pool | def test_mount_status_nas_share_by_pool(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mount_status_nas_share_by_nas(self):\n pass",
"def test_show_nas_share_by_pool(self):\n pass",
"def test_mount_status_nas_share(self):\n pass",
"def test_update_nas_share_by_pool(self):\n pass",
"def test_index_nas_shares_by_pool(self):\n pass",
"def test_destr... | [
"0.85433346",
"0.84213686",
"0.8400509",
"0.81344026",
"0.76243025",
"0.75721836",
"0.7563653",
"0.7507107",
"0.7303699",
"0.72915065",
"0.7267744",
"0.6979238",
"0.69425905",
"0.66233706",
"0.6539754",
"0.6512662",
"0.63295096",
"0.631071",
"0.6240405",
"0.61339945",
"0.6002... | 0.9529886 | 0 |
Test case for show_nas_share | def test_show_nas_share(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_show_nas_share_by_nas(self):\n pass",
"def test_show_nas_share_by_pool(self):\n pass",
"def test_test_result_nas_share(self):\n pass",
"def test_test_nas_share(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_mount_status_nas_share_by... | [
"0.9303875",
"0.85624135",
"0.84599024",
"0.8404861",
"0.8154698",
"0.80376023",
"0.7731183",
"0.75881684",
"0.74865353",
"0.74834853",
"0.73471814",
"0.7230511",
"0.7218506",
"0.7175002",
"0.6964021",
"0.66760683",
"0.64869213",
"0.6413816",
"0.6327175",
"0.6229252",
"0.6192... | 0.94518304 | 0 |
Test case for show_nas_share_by_nas | def test_show_nas_share_by_nas(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_show_nas_share(self):\n pass",
"def test_show_nas_share_by_pool(self):\n pass",
"def test_test_result_nas_share(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_test_nas_share(self):\n pass",
"def test_mount_status_nas_share_by_nas(se... | [
"0.9115962",
"0.8672631",
"0.83680737",
"0.83024406",
"0.81769687",
"0.7848348",
"0.7818351",
"0.7816461",
"0.74024487",
"0.737524",
"0.73302305",
"0.72978896",
"0.7211219",
"0.71098095",
"0.6981241",
"0.69681144",
"0.66827077",
"0.6341193",
"0.633762",
"0.631773",
"0.6093063... | 0.94415253 | 0 |
Test case for show_nas_share_by_pool | def test_show_nas_share_by_pool(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_show_nas_share_by_nas(self):\n pass",
"def test_mount_status_nas_share_by_pool(self):\n pass",
"def test_show_nas_share(self):\n pass",
"def test_update_nas_share_by_pool(self):\n pass",
"def test_index_nas_shares_by_pool(self):\n pass",
"def test_destroy_nas_s... | [
"0.838688",
"0.82205",
"0.82004833",
"0.81190896",
"0.8064236",
"0.76910836",
"0.7640043",
"0.7465289",
"0.7388782",
"0.7017174",
"0.6918035",
"0.68557525",
"0.6643733",
"0.65673494",
"0.65449506",
"0.652991",
"0.6403193",
"0.6230861",
"0.61453474",
"0.5764217",
"0.56883866",... | 0.9581628 | 0 |
Test case for test_nas_share | def test_test_nas_share(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_test_result_nas_share(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_show_nas_share(self):\n pass",
"def test_show_nas_share_by_nas(self):\n pass",
"def test_mount_status_nas_share_by_nas(self):\n pass",
"def test_update_nas_share_b... | [
"0.93370456",
"0.93197984",
"0.9103192",
"0.90562487",
"0.887185",
"0.87910056",
"0.876829",
"0.85913104",
"0.8434087",
"0.8427662",
"0.8250264",
"0.8236316",
"0.8182762",
"0.81814677",
"0.81565195",
"0.76892686",
"0.7569769",
"0.73527855",
"0.69095725",
"0.68744296",
"0.6867... | 0.9618386 | 0 |
Test case for test_result_nas_share | def test_test_result_nas_share(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_test_nas_share(self):\n pass",
"def test_show_nas_share_by_nas(self):\n pass",
"def test_show_nas_share(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_mount_status_nas_share_by_nas(self):\n pass",
"def test_update_nas_share_by_nas(s... | [
"0.87205005",
"0.8468603",
"0.84374386",
"0.84110034",
"0.81306785",
"0.80009717",
"0.79637134",
"0.795491",
"0.7851127",
"0.7800759",
"0.77983934",
"0.7788885",
"0.75479025",
"0.73223394",
"0.73046243",
"0.72120965",
"0.6860787",
"0.6632178",
"0.64907837",
"0.6297669",
"0.62... | 0.957169 | 0 |
Test case for update_nas_share | def test_update_nas_share(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_nas_share_by_nas(self):\n pass",
"def test_update_nas_share_by_pool(self):\n pass",
"def test_test_nas_share(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_test_result_nas_share(self):\n pass",
"def test_destroy_nas_share_by_... | [
"0.94022584",
"0.8667093",
"0.82092834",
"0.8034242",
"0.79996043",
"0.77217346",
"0.76853245",
"0.76770335",
"0.7653774",
"0.7644211",
"0.7401856",
"0.7383217",
"0.73583794",
"0.718956",
"0.7073682",
"0.69962233",
"0.6705802",
"0.658027",
"0.64904004",
"0.6448504",
"0.636371... | 0.9529857 | 0 |
Test case for update_nas_share_by_nas | def test_update_nas_share_by_nas(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_nas_share(self):\n pass",
"def test_update_nas_share_by_pool(self):\n pass",
"def test_create_nas_share_by_nas(self):\n pass",
"def test_test_nas_share(self):\n pass",
"def test_test_result_nas_share(self):\n pass",
"def test_index_nas_shares_by_nas(self... | [
"0.92568874",
"0.868185",
"0.8243654",
"0.8035217",
"0.79071957",
"0.7904033",
"0.7861192",
"0.7808969",
"0.75646436",
"0.75128955",
"0.749248",
"0.7425515",
"0.71185464",
"0.7093589",
"0.70677394",
"0.70360464",
"0.6987904",
"0.6672082",
"0.6565424",
"0.65342563",
"0.6251355... | 0.95343274 | 0 |
Test case for update_nas_share_by_pool | def test_update_nas_share_by_pool(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_nas_share_by_nas(self):\n pass",
"def test_update_nas_share(self):\n pass",
"def test_index_nas_shares_by_pool(self):\n pass",
"def test_show_nas_share_by_pool(self):\n pass",
"def test_destroy_nas_share_by_pool(self):\n pass",
"def test_mount_status_nas... | [
"0.8472414",
"0.83880275",
"0.82184863",
"0.8195564",
"0.81169623",
"0.80361986",
"0.74852073",
"0.74578637",
"0.7348537",
"0.7070271",
"0.7059347",
"0.70257837",
"0.6890321",
"0.68191767",
"0.68162924",
"0.6728974",
"0.6446969",
"0.6397714",
"0.6347254",
"0.616938",
"0.60866... | 0.96373075 | 0 |
Our standard method to evaluate the data. It will fill a DataFrame df which saves the errors for each evaluated setup | def evaluate_data(df_train, w_train, df_test, w_test,
evaluation_setups=None, preprocessing=None):
if evaluation_setups is None:
evaluation_setups = standard_evaluation_setups
if preprocessing is None:
preprocessing = preprocess
if ("weights" in df_train) and df_train["weig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_df(self, df):\n ## Check invariant; model inputs must be subset of df columns\n var_diff = set(self.var).difference(set(df.columns))\n if len(var_diff) != 0:\n raise ValueError(\n \"Model inputs not a subset of given columns;\\n\"\n + \"mis... | [
"0.65705955",
"0.61609674",
"0.61391914",
"0.61067426",
"0.60614115",
"0.60162455",
"0.60003746",
"0.59906065",
"0.59698033",
"0.5951393",
"0.5951041",
"0.5949095",
"0.5932602",
"0.5929731",
"0.59138703",
"0.58937687",
"0.5890896",
"0.5842125",
"0.58418965",
"0.582007",
"0.58... | 0.7769943 | 0 |
Returns roman equivalent to an arabic | def to_roman(an_arabic):
result = ""
for level, symbol in [(1000,"M"),
(900,"CM"),
(500,"D"),
(400,"CD"),
(100,"C"),
(90,"XC"),
(50,"L"),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arabic_to_roman_replace(test_word):\n arabic_word = test_word\n\n \"\"\"\n testWord = \"دَرْس\"\n print(testWord, sep=\" \")\n \"\"\"\n\n # converting into roman characters\n print()\n roman_characters = \"\"\n for letter in arabic_word:\n #print(letter)\n if letter in ... | [
"0.779442",
"0.74281687",
"0.7296251",
"0.7257054",
"0.67278147",
"0.67266434",
"0.6697449",
"0.6658061",
"0.66198784",
"0.65114695",
"0.6464905",
"0.64380807",
"0.639312",
"0.63480544",
"0.6299207",
"0.62872094",
"0.62515366",
"0.62329185",
"0.6206833",
"0.62048817",
"0.6163... | 0.8043565 | 0 |
Helper method that calls ``tokenizer.batch_encode`` if possible, and if not, falls back to calling ``tokenizer.encode`` for each input. | def tokenize(self, inputs):
if hasattr(self.tokenizer, "batch_encode"):
return self.tokenizer.batch_encode(inputs)
else:
return [self.tokenizer.encode(x) for x in inputs] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(batch, tokenizer):\n return tokenizer.batch_encode_plus(batch['sentence'], padding='max_length')",
"def _batch_encode(self, text: List[str]) -> List[List[str]]:\n token_ids: List[List[int]] = self.bert_model.batch_encode([t.strip() for t in text])\n tokens_ids_str: List[List[str]] = [... | [
"0.7312299",
"0.62325454",
"0.62248653",
"0.62079835",
"0.61744493",
"0.60844237",
"0.60585696",
"0.5993476",
"0.59909976",
"0.59304714",
"0.5894535",
"0.5890986",
"0.5826842",
"0.5709089",
"0.57029486",
"0.5684606",
"0.56439316",
"0.56439316",
"0.55587023",
"0.55517715",
"0.... | 0.71921265 | 1 |
distinguishes one vs. many unified input csv files and either sets the single csv as input, or merges all csvs and sets the merged csv as input. | def set_input_csv(self):
if len(self["input_csv"]) > 1:
raise Exception("You must only specify *one* unified CSV file!")
self.csv_path = self["input_csv"][0]
print("Using input file", self.csv_path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_directory_csv(d_in, d_out, target_column, merge_columns):\n\n INPUT_FILES = grab_files(\"*.csv\", d_in)\n\n if not INPUT_FILES:\n logger.warning(\"No matching CSV files found, exiting\")\n exit(2)\n\n for f_csv in INPUT_FILES:\n f_csv_out = os.path.join(d_out, os.path.basen... | [
"0.65366405",
"0.63891923",
"0.63422674",
"0.61547923",
"0.6103674",
"0.6021459",
"0.5971792",
"0.5885629",
"0.58756024",
"0.58568597",
"0.58556205",
"0.57153285",
"0.5673784",
"0.56549925",
"0.563907",
"0.5638952",
"0.56366646",
"0.56365585",
"0.56354904",
"0.5634072",
"0.56... | 0.7068569 | 0 |
Finds and notes decoys that share their sequence with a target PSM. Also counts the number of targets and decoys to get a quick estimate of how many positive/negative training examples can be "claimed". | def find_shitty_decoys(self):
target_seqs = set()
decoy_seqs = set()
with open(self.csv_path, "r") as f:
reader = csv.DictReader(f)
sorted_reader = sorted(
reader,
reverse=self["bigger_scores_better"],
key=lambda d: float(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_target(self):\n tally = {}\n for obj in self.target:\n tally[obj] = 0\n\n ind = 0\n for label in self.labelList:\n filename = self.pathLabel + label\n f = open(filename, 'r')\n content = f.read().split('\\n')\n for line in... | [
"0.59328616",
"0.54016626",
"0.53880644",
"0.53279763",
"0.5304748",
"0.5270805",
"0.52698284",
"0.52169853",
"0.5192627",
"0.5187703",
"0.5163138",
"0.5144442",
"0.5137317",
"0.51321214",
"0.5109379",
"0.5109379",
"0.5092773",
"0.5085388",
"0.5081025",
"0.50582725",
"0.50424... | 0.60678124 | 0 |
Turns the unified CSV column "Protein ID" into a set of all protein IDs. | def parse_protein_ids(csv_field, sep="<|>"):
clean = csv_field.replace("decoy_", "").strip()
prot_id_set = set(clean.split(sep))
return prot_id_set | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_award_ids (self, column):\n raw = self[column]\n vals = map (lambda x:x.strip(), raw.split(','))\n # return list (set (vals))\n return vals\n\n if 0:\n # truncated = filter (None, map (lambda x: len(x)>5 and x[-5:] or None, vals))\n truncated = filte... | [
"0.6303952",
"0.62645626",
"0.60780895",
"0.57484424",
"0.552927",
"0.552591",
"0.53634834",
"0.5353858",
"0.53358835",
"0.53217846",
"0.5320453",
"0.52818024",
"0.523921",
"0.52312315",
"0.5158253",
"0.5154796",
"0.5145234",
"0.512992",
"0.51164055",
"0.51120037",
"0.5105347... | 0.7984387 | 0 |
parses a unified csv file and collects features from each row | def collect_data(self):
categories = []
list_of_feature_lists = []
feature_sets = set()
with open(self.csv_path, "r") as f:
reader = csv.DictReader(f)
# collecting some stats for FDR calculation:
self.PSM_count = 0
self.decoy_count = 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadCSV(input_file):",
"def parse_prefeaturized_csv_data(features_file_path):\n objects = []\n with open(features_file_path) as f:\n # First line contains column titles\n keys = f.readline().strip().split(',')\n for line in f:\n vals = line.strip().split(\",\")\n ... | [
"0.70052725",
"0.67813885",
"0.67507994",
"0.671795",
"0.66744685",
"0.65594405",
"0.6549073",
"0.6524705",
"0.65231276",
"0.6494231",
"0.6469768",
"0.6439672",
"0.6422604",
"0.6382351",
"0.63786244",
"0.6309739",
"0.6285347",
"0.62765247",
"0.6273016",
"0.62624663",
"0.62614... | 0.70409966 | 0 |
Thresholds the values in the GFF file infn and exports the results to the BED file outbed. | def GFFthreshold(infn,outbed):
converterd = {'probe':nodate,'a':nodate,'b':nodate}
logging.debug('reading GFF into record array')
a = csv2rec(infn,
delimiter='\t',
names=('chr','prog','id','start','stop','ratio','a','b','probe'),
converterd=converterd)
l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(inFilepath, outFilepath):\n\n gff_df=read_gff(inFilepath, additional_lst=[\"ID\"])\n attribute_lst=[]\n for _, row in gff_df.iterrows():\n orfId = \"{}_{}\".format(row[\"seqname\"], row[\"ID\"].split(\"_\")[-1])\n att = \"{};orf_id={}\".format(row[\"attribute\"], orfId)\n att... | [
"0.57636285",
"0.5452764",
"0.5443643",
"0.54257494",
"0.5339823",
"0.5275607",
"0.5164848",
"0.51557857",
"0.5153393",
"0.51523715",
"0.509349",
"0.50704485",
"0.5037733",
"0.5014071",
"0.50115407",
"0.49746937",
"0.4944627",
"0.4939648",
"0.49357095",
"0.49293602",
"0.49289... | 0.70352584 | 0 |
print_in_block prints a message fancy | def print_in_block(message):
print("|", message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_in_block(message):\n print(\"=\"*4, message)",
"def do_block():\n print_column()\n print_rows()",
"def do_block():\n print_column()\n print_rows()",
"def print_block():\n do_twice(do_block)\n do_twice(do_block)\n print_column()",
"def print_block():\n do_twice(do_block)... | [
"0.82680213",
"0.72581327",
"0.72581327",
"0.72422236",
"0.72410613",
"0.65806854",
"0.6528688",
"0.64682865",
"0.644541",
"0.64331144",
"0.63909894",
"0.61803967",
"0.61426616",
"0.600337",
"0.6001629",
"0.59299904",
"0.5875311",
"0.58397245",
"0.58374274",
"0.58373517",
"0.... | 0.8424028 | 0 |
Create account in db for testing | def create_test_account(self):
if not hasattr(self, "headers"):
self.headers = {"Content-Type": "application/json"}
self.account = {
"account_number": "11223344",
"pin": "1234",
"first_name": "John",
"last_name": "Doe",
"opening_bal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n account_models.User.objects.create_user(email='mrtest@mypapaya.io', password='WhoAmI', username='aov1')",
"def test_create_user(self):\n pass",
"def test_create_user(self):\n pass",
"def test_create_user(self):\n pass",
"def account():\n\n bank_test = Bank.... | [
"0.7464342",
"0.73190993",
"0.73190993",
"0.73190993",
"0.7251022",
"0.72328395",
"0.7218017",
"0.71607393",
"0.7132524",
"0.71249807",
"0.71243155",
"0.71232057",
"0.70938474",
"0.7090275",
"0.7054926",
"0.7043996",
"0.6997264",
"0.69949186",
"0.69774175",
"0.69712317",
"0.6... | 0.7687588 | 0 |
Login and add Authorization headers | def add_auth_to_headers(self):
if not hasattr(self, "headers"):
self.headers = {"Content-Type": "application/json"}
login = {"account_number": self.account["account_number"],
"pin": self.account["pin"]}
token = json.loads(self.client.post(
"/accounts/log... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _login(self, username, password):\n\n auth_token_header_name = \"X-AuthToken\"\n if auth_token_header_name not in self.headers:\n login_response = self._send(\"/auth/login\", \"POST\", {\n \"username\": username,\n \"password\": password\n })\n ... | [
"0.7459252",
"0.71714276",
"0.7051584",
"0.697408",
"0.6925245",
"0.67969096",
"0.678197",
"0.6740072",
"0.6695989",
"0.66357434",
"0.6629826",
"0.6582317",
"0.65689564",
"0.6558543",
"0.6489001",
"0.6484532",
"0.6425403",
"0.64215344",
"0.6419265",
"0.6415041",
"0.6412059",
... | 0.7460721 | 0 |
The kmlWriter function writes JPEG and TIFF EXIF GPS data to a Google Earth KML file. This file can be opened in Google Earth and will use the GPS coordinates to create 'pins' on the map of the taken photo's location. | def kmlWriter(output_data, output_dir, output_name):
msg = 'Writing ' + output_name + ' KML output.'
print '[+]', msg
logging.info(msg)
# Instantiate a Kml object and pass along the output filename
kml = simplekml.Kml(name=output_name)
for exif in output_data:
if 'Latitude' in exif.keys(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveKML(kmlFile):\n\n tilePath = os.path.basename('map-NYC_heatmap.png')\n north = topLeftLat\n south = bottomRightLat\n east = topLeftLon\n west = bottomRightLon\n \n bytes = KML % (tilePath, north, south, east, west)\n file(kmlFile, \"w\").write(bytes)"... | [
"0.7272041",
"0.70665",
"0.6839336",
"0.6782229",
"0.67590886",
"0.6627731",
"0.6027612",
"0.5821973",
"0.5808136",
"0.5792859",
"0.5754415",
"0.5609513",
"0.55759126",
"0.5573969",
"0.5561544",
"0.555536",
"0.54809815",
"0.5467511",
"0.5448434",
"0.5412696",
"0.533536",
"0... | 0.75549674 | 0 |
Take a move ('color', (row,col)). where row, col are 0indexed (from sgfmill) Figure out which corner it's in Transform it to be in the upper right corner; Returns [corners, move] | def move_to_corner(move):
color, m = move
if not m:
return (None, move)
y, x = m
corners = []
if (x >= 9 and y >= 9):
corners.append(0)
elif (x >= 9 and y <= 9):
corners.append(1)
elif (x <= 9 and y <= 9):
corners.append(2)
elif (x <= 9 and y >= 9):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(self, board):\n\n if board.get_number_of_moves() == 0:\n random_row = randint(0, 2)\n random_column = randint(0, 2)\n\n if random_row == 1 or random_column == 1:\n random_row = 1\n random_column = 1\n elif random_row == 2:\n ... | [
"0.64972967",
"0.63445497",
"0.6259929",
"0.6193406",
"0.6146919",
"0.6122342",
"0.61185247",
"0.60586184",
"0.604872",
"0.60303676",
"0.60222936",
"0.5930572",
"0.58977294",
"0.58832806",
"0.5881443",
"0.5868172",
"0.585934",
"0.58571357",
"0.585504",
"0.5842502",
"0.5817029... | 0.77939284 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.