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 |
|---|---|---|---|---|---|---|
Deletes a user with all their group memberships and annotations. Raises UserDeletionError when deletion fails with the appropriate error message. | def delete_user(request, user):
if models.Group.created_by(user).count() > 0:
raise UserDeletionError('Cannot delete user who is a group creator.')
user.groups = []
query = _all_user_annotations_query(request, user)
annotations = es_helpers.scan(client=request.es.conn, query={'query': query})... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_group_user(self, group_id, user_id):\n resp, body = self.delete('groups/%s/users/%s' % (group_id, user_id))\n self.expected_success(204, resp.status)\n return rest_client.ResponseBody(resp, body)",
"def delete_group_user(self, group_id, user_id):\n resp, body = self.delete(... | [
"0.7709257",
"0.7703484",
"0.7367388",
"0.72008383",
"0.7072726",
"0.70564216",
"0.7030477",
"0.7008658",
"0.6981796",
"0.6863864",
"0.6788803",
"0.67228156",
"0.66729933",
"0.6630304",
"0.6622004",
"0.65594506",
"0.65594506",
"0.65594506",
"0.6556061",
"0.65546155",
"0.65170... | 0.8079728 | 0 |
Query matching all annotations (shared and private) owned by user. | def _all_user_annotations_query(request, user):
userid = util.user.userid_from_username(user.username, request)
return {
'filtered': {
'filter': {'term': {'user': userid.lower()}},
'query': {'match_all': {}}
}
} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_user(self, user):\n return self.get_query_set().filter(owner=user)",
"def query_for_users_annotations(userid):\n return {\n \"query\": {\n \"filtered\": {\n \"filter\": {\n \"bool\": {\n \"must\": [{\"term\": {\"user\": ... | [
"0.6253355",
"0.615623",
"0.5896042",
"0.57438487",
"0.5683941",
"0.56579936",
"0.564834",
"0.55757964",
"0.55731523",
"0.5508512",
"0.54578984",
"0.5417006",
"0.5390651",
"0.53888977",
"0.5385194",
"0.5281533",
"0.52674216",
"0.52273947",
"0.51682717",
"0.5153407",
"0.514727... | 0.70422494 | 0 |
Precision at n measure is the number of instances where the any crowd's answer occur within ranker's firs n choices | def arrau_precision_n(test_scores, num_true, all_candidates, punctuation_ids, ns):
precisions = []
for i in range(ns):
precision = 0
for k, item in enumerate(test_scores):
ranks = len(item) - rankdata(item, method='ordinal').astype(int)
#precision += min(1, len(set(ranks[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precision_n(test_scores, num_true, n):\n precisions = []\n for i in range(n):\n precision = 0\n for k, item in enumerate(test_scores):\n ranks = len(item) - rankdata(item, method='ordinal').astype(int)\n precision += min(1, len(set(ranks[:i+1]) & set(range(num_true[k])... | [
"0.7868372",
"0.6981366",
"0.65166986",
"0.64465773",
"0.6366034",
"0.63294137",
"0.63019806",
"0.6251612",
"0.6220773",
"0.6181575",
"0.61753833",
"0.6168363",
"0.61613494",
"0.6156553",
"0.6151793",
"0.6116301",
"0.6098217",
"0.60966325",
"0.60917205",
"0.60729724",
"0.6066... | 0.7150527 | 1 |
Precision at n measure is the number of instances where the any crowd's answer occur within ranker's firs n choices | def precision_n(test_scores, num_true, n):
precisions = []
for i in range(n):
precision = 0
for k, item in enumerate(test_scores):
ranks = len(item) - rankdata(item, method='ordinal').astype(int)
precision += min(1, len(set(ranks[:i+1]) & set(range(num_true[k]))))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arrau_precision_n(test_scores, num_true, all_candidates, punctuation_ids, ns):\n precisions = []\n for i in range(ns):\n precision = 0\n for k, item in enumerate(test_scores):\n ranks = len(item) - rankdata(item, method='ordinal').astype(int)\n #precision += min(1, len... | [
"0.7150745",
"0.6982029",
"0.6517899",
"0.64472157",
"0.6364789",
"0.6329382",
"0.63018847",
"0.62502116",
"0.6222666",
"0.61817133",
"0.6175954",
"0.61682606",
"0.61601776",
"0.61568534",
"0.61513",
"0.6115124",
"0.6097934",
"0.6096462",
"0.60903597",
"0.6072197",
"0.6067092... | 0.7868538 | 0 |
This method copies an existing Excel file and creates a duplicate to preserve the quality of the original. | def make_wb_copy():
shutil.copy(full_target_file_name, path_name + copied_file_name) # copy the file
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_sheet_to_other_file(o_filename, d_filename, sheet_name):\n of = xlrd.open_workbook(o_filename)\n of_sheet = of.sheet_by_name(sheet_name)\n row_number = of_sheet.nrows\n data = list()\n for i in xrange(row_number):\n data.append(of_sheet.row_values(i))\n\n delete_sheet(d_filename, ... | [
"0.61602014",
"0.60682917",
"0.58168906",
"0.578109",
"0.5722309",
"0.561177",
"0.5586791",
"0.5586791",
"0.5586791",
"0.5544571",
"0.55376244",
"0.55023",
"0.5420974",
"0.541845",
"0.54069275",
"0.53857553",
"0.5359739",
"0.5339542",
"0.5334376",
"0.5325545",
"0.52734566",
... | 0.6104586 | 1 |
This method removes empty rows from the Excel file in order to help cohesively merge the different sheets. | def parse_rows(wb, merged_ws):
number_of_sheets = len(wb.worksheets) - 9 # Number of sheets
for sheet_number in range(1, 1 + number_of_sheets): # parse through each sheet
sheet = wb["%s%s" % (sheet_number, "월")] #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remowe_first_sheet(self):\r\n self.output_file.remove_sheet(self.output_file.get_sheet_by_name('Sheet'))\r\n self.output_sheets = self.output_file.get_sheet_names()",
"def cleanSpreadsheet(filepath):\n # import dat\n data = pd.ExcelFile(filepath)\n # create dataframe\n df = data.par... | [
"0.68116975",
"0.6335934",
"0.63070333",
"0.61027026",
"0.5993614",
"0.58847576",
"0.5853425",
"0.5776056",
"0.57126075",
"0.569512",
"0.56632495",
"0.56236815",
"0.5609399",
"0.550714",
"0.5498684",
"0.5416544",
"0.54153377",
"0.54131395",
"0.5396955",
"0.5395547",
"0.539388... | 0.6833406 | 0 |
This method adds headers to an existing Excel file. | def set_headers(ws):
for column in range(1, 1 + len(headers)): # parse through each column in the first row
ws.cell(row=1, column=column).value = headers[column - 1] # add corresponding header value to the Excel file
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def writeExcelHeader(worksheet, titleCols, firstTag, secondTag):\n\tcno = 0\n\tworksheet.write(0, 0, \"Old Tag\")\n\tworksheet.write(0, 1, \"New Tag\")\n\tworksheet.write(1, 0, firstTag)\n\tworksheet.write(1, 1, secondTag)\n\tfor titleCol in titleCols:\n\t\tworksheet.write(3, cno, titleCol)\n\t\tcno = cno + 1",
... | [
"0.70662796",
"0.7016162",
"0.67791307",
"0.66963917",
"0.6574006",
"0.65323216",
"0.652812",
"0.6422144",
"0.6422144",
"0.6411349",
"0.6380649",
"0.6319381",
"0.61990535",
"0.6149402",
"0.61280566",
"0.61006117",
"0.6049567",
"0.6010045",
"0.6004706",
"0.5999683",
"0.5944339... | 0.7911542 | 0 |
This method creates a new workbook to add the merged data. | def create_new_workbook():
merged_wb = openpyxl.Workbook() # create new Workbook
merged_wb["Sheet"].title = "Merged Data" # change the title of the new sheet to "Merged Data"
set_headers(merged_wb["Merged Data"]) # set the headers
merged_wb.save('Merged_Data.xlsx') # sa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_workbook(self):\n try:\n if '.xlsm' in self.file_name or '.xltm' in self.file_name:\n self.wb = load_workbook(self.file_path, keep_vba=True)\n else:\n if '.xlsx' not in self.file_name:\n self.file_name = self.file_name + '.xls... | [
"0.7242462",
"0.6362782",
"0.63080174",
"0.6173109",
"0.5949386",
"0.5896765",
"0.58692735",
"0.58077055",
"0.5807116",
"0.5624669",
"0.5606903",
"0.55897164",
"0.5455668",
"0.54508334",
"0.5442583",
"0.53600067",
"0.52857417",
"0.52741444",
"0.52569807",
"0.52395344",
"0.521... | 0.8516815 | 0 |
processes internal list of game events for this frame | def process_events(self):
gameevents = copy.copy(self.gameevents)
del self.gameevents[:]
while len(gameevents) > 0:
currentevent = gameevents.pop(0)
ticks = currentevent.ticks
time = currentevent.time
eid = currentevent.eid
game = curre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processEvents(self):\n self.framelist = sorted(self.framelist, key=lambda event: event.timestamp, reverse=True)\n self.framequeue = sorted(self.framequeue, key=lambda event: event.timestamp, reverse=True)\n self.packetqueue = sorted(self.packetqueue, key=lambda event: event.timestamp, reve... | [
"0.7132066",
"0.7091471",
"0.67243445",
"0.66704863",
"0.6663386",
"0.6615649",
"0.649209",
"0.63998353",
"0.6369274",
"0.6361923",
"0.6359079",
"0.6327643",
"0.6268408",
"0.6261945",
"0.624194",
"0.6232349",
"0.6207682",
"0.61994195",
"0.6198253",
"0.61626446",
"0.6162572",
... | 0.7538547 | 0 |
test collisions between relevant game entities | def test_collisions(self):
if self.fortress_exists:
if self.smallhex.collide(self.ship):
self.gameevents.add("collide", "small_hex", "ship")
else:
self.smallhex.small_hex_flag = False
for i, shell in enumerate(self.shell_list):
if shell... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simple_collision(self):\n with PhysicsEngineHarness('tests/simple-collision.json') as physics_engine:\n # In this case, the first entity is standing still and the second\n # on a collision course going left to right. The two should bounce.\n # Entity 0 has r=50 and ... | [
"0.7596639",
"0.71421385",
"0.70898914",
"0.7059848",
"0.70242566",
"0.6866689",
"0.682258",
"0.677301",
"0.6714781",
"0.6667873",
"0.66565776",
"0.6647691",
"0.66335905",
"0.6617898",
"0.6570503",
"0.65155715",
"0.65058875",
"0.6502191",
"0.644711",
"0.64056176",
"0.6378853"... | 0.73191863 | 1 |
determine whether any shells or missiles have left the world | def check_bounds(self):
for i, missile in enumerate(self.missile_list):
if missile.out_of_bounds(self.world):
del self.missile_list[i]
self.gameevents.add("bounds_remove", "missile")
for i, shell in enumerate(self.shell_list):
if shell.out_of_bound... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_fail(self):\n failed = False\n for obj in self.world_state.objects:\n failed = failed or obj.lost\n return failed",
"def check_win(self):\n return UNEXPOSED not in self.get_game() and self.get_game().count(FLAG) == len(self.get_pokemon_location)",
"def check_game_... | [
"0.65513104",
"0.6476485",
"0.6369261",
"0.63377595",
"0.6258784",
"0.62471265",
"0.6170603",
"0.61283165",
"0.6101203",
"0.6066138",
"0.60542715",
"0.60477644",
"0.60332453",
"0.601886",
"0.6017714",
"0.59443873",
"0.5941525",
"0.5938948",
"0.59236884",
"0.59152216",
"0.5913... | 0.6539798 | 1 |
before game begins, present the game number | def draw_game_number(self):
self.game_title.draw(self.game_title_rect.topleft)
pygl2d.draw.line((self.SCREEN_WIDTH / 4 , self.SCREEN_HEIGHT / 16 * 8.5), (self.SCREEN_WIDTH / 4 * 3, self.SCREEN_HEIGHT / 16 * 8.5), (255, 255, 255))
pygl2d.draw.line((self.SCREEN_WIDTH / 4 , self.SCREEN_HEIG... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tellGameNumber(self):\n t = time.time() - self.start_time\n d = self.start_duration\n if t < d:\n c = int(255 * (1 - (t / d)))\n self.window.alert(\"Starting game number \" + str(self.game_number))",
"def tellIfStarted(self):\n if self.game_number == 1:\n ... | [
"0.81141317",
"0.65836114",
"0.6399269",
"0.6382704",
"0.63649935",
"0.6296887",
"0.62100714",
"0.6148587",
"0.61379814",
"0.6134857",
"0.6119055",
"0.6103131",
"0.6008791",
"0.59228766",
"0.5919814",
"0.59161675",
"0.5902325",
"0.58964616",
"0.58898777",
"0.58892727",
"0.586... | 0.6869581 | 1 |
Get a list of GraphQLError instances describing each deprecated use. | def find_deprecated_usages(
schema: GraphQLSchema, ast: DocumentNode
) -> List[GraphQLError]:
type_info = TypeInfo(schema)
visitor = FindDeprecatedUsages(type_info)
visit(ast, TypeInfoVisitor(type_info, visitor))
return visitor.errors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warnings(self) -> List[Error]:",
"def warnings(self) -> List[Error]:\n return self._get_warnings()",
"def _check_deprecated(self, name, current, deprecated):\n if name in deprecated and name not in self._emitted_deprecations:\n self._emitted_deprecations.add(name)\n curr... | [
"0.65296215",
"0.6319463",
"0.6216342",
"0.62110144",
"0.6184324",
"0.6184324",
"0.6082326",
"0.6043723",
"0.59797436",
"0.5964801",
"0.5785432",
"0.5783844",
"0.5741733",
"0.5739487",
"0.57344896",
"0.5734044",
"0.5722551",
"0.57008994",
"0.5643492",
"0.5616444",
"0.5546398"... | 0.75682324 | 0 |
Summons the bot to a voice channel. If no channel was specified, it joins your channel. | async def _summon(self, ctx: commands.Context, *, channel: discord.VoiceChannel = None):
if not channel and not ctx.author.voice:
raise VoiceError('You are neither connected to a voice channel nor specified a channel to join.')
destination = channel or ctx.author.voice.channel
if c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _summon(self, ctx: commands.Context, *, channel: discord.VoiceChannel = None):\n if not channel and not ctx.author.voice:\n raise commands.CommandError('You are neither connected to a voice channel nor specified a channel to join.')\n # raise VoiceError()\n\n destinati... | [
"0.7994623",
"0.79571676",
"0.78259104",
"0.7502218",
"0.7294841",
"0.72288424",
"0.7157035",
"0.715218",
"0.71282643",
"0.70567375",
"0.69492954",
"0.69119805",
"0.688251",
"0.68787915",
"0.6877862",
"0.6831129",
"0.68131346",
"0.6808879",
"0.66548604",
"0.66436565",
"0.6581... | 0.79706186 | 1 |
Stops playing song and clears the queue. | async def _stop(self, ctx: commands.Context):
ctx.voice_state.songs.clear()
if not ctx.voice_state.is_playing:
ctx.voice_state.voice.stop()
await ctx.message.add_reaction('⏹') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_song(self):\r\n if self.isPlaying:\r\n self.playSong[0].stop()\r\n self.playSong.clear()\r\n self.isPlaying = False\r\n print(\"Music stopped\")\r\n else:\r\n print(\"Play a song first...\")",
"async def _stop(self, ctx: commands.Conte... | [
"0.76484656",
"0.7379835",
"0.73778087",
"0.73367506",
"0.7251171",
"0.7212808",
"0.71300954",
"0.69270366",
"0.6894649",
"0.6894649",
"0.68877405",
"0.6828252",
"0.6764916",
"0.6759748",
"0.6747041",
"0.67016286",
"0.66890997",
"0.6671761",
"0.66702455",
"0.6481288",
"0.6334... | 0.74031234 | 1 |
Shows the player's queue. You can optionally specify the page to show. Each page contains 10 elements. | async def _queue(self, ctx: commands.Context, *, page: int = 1):
if len(ctx.voice_state.songs) == 0:
return await ctx.send('Empty queue.')
items_per_page = 10
pages = math.ceil(len(ctx.voice_state.songs) / items_per_page)
start = (page - 1) * items_per_page
end = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def queue(self, ctx, page=None):\n player = self.bot.lavalink.players.get(ctx.guild.id)\n if not player.queue:\n return await ctx.send(\"There is nothing queued at the moment :no_entry:\")\n if not page:\n page = 1\n try:\n page = int(page)\n ... | [
"0.73056746",
"0.72860336",
"0.6334626",
"0.612193",
"0.60853297",
"0.58988106",
"0.58633065",
"0.5767603",
"0.5680583",
"0.56544536",
"0.5592289",
"0.5558724",
"0.5549583",
"0.55297834",
"0.5515449",
"0.5453461",
"0.54472625",
"0.54464364",
"0.5423149",
"0.5413205",
"0.53930... | 0.729833 | 1 |
changes color for a role | async def color(self, ctx, roleIn, color):
print("Login as")
print(self.bot.user)
print("-------")
server = ctx.message.guild
role = discord.utils.get(server.roles, id=roleIn) or discord.utils.get(server.roles, name=roleIn) or discord.utils.get(server.roles, name=roleIn.capitaliz... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def rolecolor(self, ctx, role: discord.Role):\n embed = discord.Embed(colour=role.colour, timestamp=datetime.datetime.utcnow())\n embed.add_field(name=\"Name\", value=role.name)\n embed.add_field(name=\"Hex Value\", value=role.color)\n await ctx.send(embed=embed)",
"def changeRo... | [
"0.7825281",
"0.73424315",
"0.7240052",
"0.718948",
"0.70911133",
"0.683065",
"0.6722128",
"0.65484965",
"0.6534496",
"0.653327",
"0.6524975",
"0.6491311",
"0.6448013",
"0.6438304",
"0.6403623",
"0.6403623",
"0.63735366",
"0.63681227",
"0.6347529",
"0.6319683",
"0.6309239",
... | 0.79157376 | 0 |
Set Speech API voice type | async def voice(self, ctx, voice: str):
global voice_type
voice_dict = {
'IN_F': 'en-IN-Wavenet-A',
'IN_M': 'en-IN-Wavenet-C',
'US_F': 'en-US-Wavenet-G',
'US_M': 'en-US-Wavenet-B',
'GB_F': 'en-GB-Wavenet-A',
'GB_M': 'en-GB-Wavenet-... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setvoice(*args):\n try:\n ttsEng.setvoice(args[0])\n except Exception, e:\n logging.error(e)",
"def set_type(self,typ):\n self._typ = typ\n if typ == 'Sine':\n self._type = 7\n elif typ == 'Sawtooth up':\n self._type = 0\n elif typ == 'Sawtooth down':\n self._ty... | [
"0.71702677",
"0.6800281",
"0.67054224",
"0.64883846",
"0.6420173",
"0.6241385",
"0.6023923",
"0.5976198",
"0.5866886",
"0.5862963",
"0.58521384",
"0.5795229",
"0.5788792",
"0.57734674",
"0.5673201",
"0.5673201",
"0.5658263",
"0.56443983",
"0.5627694",
"0.5624566",
"0.5581445... | 0.73412466 | 0 |
Lists example Google Speech API voice codes | async def voicelist(self, ctx):
await send_msg(ctx, 'Voice List', r"""
**AU_M:** Australian Male
**AU_F:** Australian Female
**IN_M:** Indian Male
**IN_F:** Indian Female
**US_M:** Standard Male
**US_F:** Standard Female
**GB_M:** British Male
**GB_F:** British Female
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def voice():\n resp = VoiceResponse()\n\n gather = Gather(num_digits=1, action='/gather')\n gather.say(\n 'For Spanish press 1, for Italian press 2, for German press 3, for French press 4, for Mandarin Chinese '\n 'press 5, for Japanese press 6, to manually enter a language press 9', voice='... | [
"0.6777046",
"0.6622402",
"0.6539807",
"0.611273",
"0.6038883",
"0.6035191",
"0.6012573",
"0.5959518",
"0.59329855",
"0.59007627",
"0.5893425",
"0.587017",
"0.5841877",
"0.5805344",
"0.5781826",
"0.5777068",
"0.5740509",
"0.5706146",
"0.56714606",
"0.5653065",
"0.56443465",
... | 0.69722944 | 0 |
Join voice channel and force bypass restrictions. | async def joinForce(self, ctx):
print("joining")
channel = ctx.author.voice.channel
await channel.connect() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def _join(self, ctx: commands.Context):\n\n destination = ctx.author.voice.channel\n if ctx.voice_state.voice:\n await ctx.voice_state.voice.move_to(destination)\n return\n ctx.voice_state.voice = await destination.connect()\n await ctx.message.add_reaction('... | [
"0.65273523",
"0.64909756",
"0.6384299",
"0.63237643",
"0.63054657",
"0.629726",
"0.6260496",
"0.6193694",
"0.6179695",
"0.6000898",
"0.59756815",
"0.5892782",
"0.5876597",
"0.58530897",
"0.58495593",
"0.5795379",
"0.5727061",
"0.5699195",
"0.5642094",
"0.56312084",
"0.562480... | 0.7571166 | 0 |
Leave voice channel and force bypass restrictions. | async def leaveForce(self, ctx):
await ctx.voice_client.disconnect() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def leave(self, ctx):\n if ctx.guild.voice_client:\n await ctx.guild.voice_client.disconnect()\n await ctx.send(\"Left voice channel.\")\n else:\n await ctx.message.add_reaction('\\U0001F615');\n await ctx.send(\"Not in a voice channel.\")",
"async ... | [
"0.6632035",
"0.6447251",
"0.6378872",
"0.6358157",
"0.633189",
"0.62692326",
"0.62692326",
"0.62486273",
"0.6211148",
"0.62077534",
"0.6200669",
"0.61999506",
"0.61754453",
"0.6170025",
"0.615867",
"0.6107641",
"0.6105342",
"0.6103549",
"0.60168636",
"0.60027325",
"0.5995111... | 0.74256724 | 0 |
Purges the past x number of messages. | async def purge(self, ctx, count: int):
await ctx.channel.purge(limit=count+1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def purge(self, ctx, msg_number: int = 10):\n\n if ctx.guild.id == 202724765218242560:\n return\n\n if msg_number > 100:\n await ctx.error(\"No more than 100 messages can be purged at a time.\")\n return\n\n deleted = await ctx.channel.purge(limit=msg_num... | [
"0.6941161",
"0.6917433",
"0.66518664",
"0.6558561",
"0.65212417",
"0.6429004",
"0.63959247",
"0.6364405",
"0.63350344",
"0.63129735",
"0.6255979",
"0.6237615",
"0.62346834",
"0.61153704",
"0.61031455",
"0.60772455",
"0.6071267",
"0.60565895",
"0.60192704",
"0.60132843",
"0.6... | 0.70881456 | 0 |
a test suite for various sqlalchemy engines. | def _test_engine(engine, service, vendor, expected_meta):
tracer = Tracer()
tracer.writer = DummyWriter()
# create an engine and start tracing.
trace_engine(engine, tracer, service=service)
start = time.time()
@contextlib.contextmanager
def _connect():
try:
conn = engin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_engine(self):\n config = {\n \"url\": 'sqlite://',\n \"connect_args\": {\n \"check_same_thread\": \"false\",\n \"poolclass\": \"pool.StaticPool\"\n }\n }\n engine = self.configurator.setup_engine(config)\n self.asse... | [
"0.7081772",
"0.6789211",
"0.66292816",
"0.6622976",
"0.65551203",
"0.65252316",
"0.64673615",
"0.6427165",
"0.6364955",
"0.63483185",
"0.63366",
"0.6330665",
"0.63108355",
"0.62966716",
"0.6260598",
"0.62586844",
"0.62571675",
"0.62506086",
"0.6246006",
"0.62316394",
"0.6223... | 0.7062062 | 1 |
Check if color is gray (all channels the same). | def is_gray(color):
m = HEX_IS_GRAY_RE.match(color)
return m is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_grayscale(self):\n return self.r == self.g == self.b",
"def is_grayscale(self):\n return self.r == self.g == self.b",
"def is_gray(img: np.ndarray):\n return len(img.shape) == 2 and img.shape[0] > 1 and img.shape[1] > 1",
"def is_colour(self, im):\n hsl = cv2.cvtColor(im, cv2.C... | [
"0.74818885",
"0.74818885",
"0.74253535",
"0.7122847",
"0.70671237",
"0.7005086",
"0.69353694",
"0.6849889",
"0.67171234",
"0.6547366",
"0.63820064",
"0.6364955",
"0.63581353",
"0.63502634",
"0.63459337",
"0.63388515",
"0.63359994",
"0.6330974",
"0.62786305",
"0.62373376",
"0... | 0.8050459 | 0 |
Normailze a decimal alpha value. | def alpha_dec_normalize(dec):
temp = float(dec)
if temp < 0.0 or temp > 1.0:
dec = fmt_float(clamp(float(temp), 0.0, 1.0), 3)
alpha_dec = dec
alpha = "%02X" % round_int(float(alpha_dec) * 255.0)
return alpha, alpha_dec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(score, alpha=15):\n norm_score = score / math.sqrt((score * score) + alpha)\n if norm_score < -1.0:\n return -1.0\n elif norm_score > 1.0:\n return 1.0\n else:\n return norm_score",
"def power_normalize(xx, alpha = 0.5):\r\n\treturn np.sign(xx) * np.abs(xx) ** alpha... | [
"0.6807074",
"0.6603007",
"0.65838134",
"0.6376788",
"0.6223023",
"0.6203214",
"0.62010604",
"0.6155612",
"0.6148457",
"0.6141357",
"0.6123485",
"0.6095738",
"0.6088556",
"0.60614467",
"0.603645",
"0.6004745",
"0.5994622",
"0.5991207",
"0.5981217",
"0.5979628",
"0.5978572",
... | 0.6883276 | 0 |
Normailze a percent alpha value. | def alpha_percent_normalize(perc):
alpha_float = clamp(float(perc.strip('%')), 0.0, 100.0) / 100.0
alpha_dec = fmt_float(alpha_float, 3)
alpha = "%02X" % round_int(alpha_float * 255.0)
return alpha, alpha_dec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alpha(self, percent):\n self._alpha = percent\n self.call('alpha', percent)",
"def normalize(score, alpha=15):\n norm_score = score / math.sqrt((score * score) + alpha)\n if norm_score < -1.0:\n return -1.0\n elif norm_score > 1.0:\n return 1.0\n else:\n return ... | [
"0.73315585",
"0.6611439",
"0.6520565",
"0.6417113",
"0.6306804",
"0.6231205",
"0.6192967",
"0.6157168",
"0.61516863",
"0.6127904",
"0.6068274",
"0.60411215",
"0.60407376",
"0.60190403",
"0.6015102",
"0.59822744",
"0.59693354",
"0.5957152",
"0.5948827",
"0.593568",
"0.5926752... | 0.78474134 | 0 |
Condensed version of context_slicer with more limited options. | def simple_context_slicer(df, method: str = 'None', forecast_length: int = 30):
if method in [None, "None"]:
return df
df = df.sort_index(ascending=True)
if 'forecastlength' in str(method).lower():
len_int = int([x for x in str(method) if x.isdigit()][0])
return df.tail(len_int * f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_context(data, i, j, k, r):\n idxs = (np.array([i+r,i-r,i,i,i,i]),\n np.array([j,j,j+r,j-r,j,j]),\n np.array([k,k,k,k,k+r,k-r]))\n ctx = data[idxs]\n return ctx",
"def slim_down_options(options, count_func, n=25, v=''):\n if len(options) > 100:\n options_... | [
"0.51490486",
"0.50332963",
"0.5008217",
"0.49999797",
"0.49792293",
"0.49620366",
"0.4907236",
"0.4845188",
"0.48261353",
"0.47284138",
"0.4720873",
"0.4705761",
"0.46810788",
"0.46798578",
"0.46739513",
"0.46701092",
"0.46204612",
"0.46111953",
"0.4605151",
"0.46021444",
"0... | 0.6601151 | 0 |
Fit sin to the input time sequence, and return fitting parameters "amp", "omega", "phase", "offset", "freq", "period" and "fitfunc" | def fit_sin(self, tt, yy):
import scipy.optimize
tt = np.array(tt)
yy = np.array(yy)
ff = np.fft.fftfreq(len(tt), (tt[1] - tt[0])) # assume uniform spacing
Fyy = abs(np.fft.fft(yy))
guess_freq = abs(
ff[np.argmax(Fyy[1:]) + 1]
) # excluding the zero... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_sine_params(t, y, P):\n y = y - y.mean()\n amp0 = np.max([np.abs(y.max()), np.abs(y.min())])\n phase0 = 0.0\n offset0 = 0.0\n def f(t, amp, phase, offset):\n return sinefunc(t, P, amp, phase, offset)\n popt, pcov = scipy.optimize.curve_fit(f, t, y, (amp0, phase0, offset0))\n re... | [
"0.7145196",
"0.71323913",
"0.6362291",
"0.6292637",
"0.621292",
"0.61852217",
"0.6064759",
"0.60190344",
"0.5994916",
"0.59853035",
"0.5977299",
"0.5969087",
"0.5915568",
"0.5828104",
"0.5809147",
"0.5801182",
"0.5785961",
"0.57853454",
"0.57593983",
"0.5715409",
"0.56581175... | 0.7416789 | 0 |
Retrieves a specific transformer object from a string. | def retrieve_transformer(
self,
transformation: str = None,
param: dict = {},
df=None,
random_seed: int = 2020,
):
if transformation in (trans_dict.keys()):
return trans_dict[transformation]
elif transformation in list(have_params.keys()):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(\n string: str, *, formatter: Optional[ModelFormatter] = None\n ) -> \"Model\":\n formatter = formatter if formatter is not None else ModelJSONFormatter()\n return formatter.parse(string)",
"def get_transformer() -> TransformerFunc:\n THREAD_LOCALS = access_thread_local... | [
"0.5940749",
"0.5879253",
"0.57541794",
"0.5729143",
"0.5683781",
"0.5639604",
"0.56321627",
"0.5574527",
"0.5548013",
"0.55303156",
"0.5512758",
"0.5509346",
"0.5370215",
"0.5334694",
"0.53013766",
"0.523308",
"0.52235126",
"0.5219802",
"0.5197923",
"0.51730627",
"0.5166097"... | 0.60623825 | 0 |
r""" nth (non central) moment of the Normal distribution | def moment(self, n, mu, sigma):
return scipy_norm.moment(n, mu, sigma) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nth_moment(self, mass, n=3, z=None):\n exp_nth = 0.0\n if n in self._hod:\n exp_nth = self._hod[n](mass, z)\n else:\n first_mom = self.first_moment(mass, z)\n exp_nth = first_mom**n\n alpha_m2 = numpy.where(\n first_mom != 0.0,\n ... | [
"0.6925664",
"0.64605397",
"0.6371878",
"0.6349773",
"0.63285905",
"0.6304035",
"0.62522036",
"0.6227973",
"0.61834866",
"0.6154315",
"0.61533004",
"0.6138132",
"0.61266214",
"0.6103037",
"0.6080615",
"0.6075757",
"0.60737616",
"0.6069539",
"0.60566163",
"0.6052084",
"0.60247... | 0.7143441 | 0 |
This approach is better than the previous one as it does not use extra space. We keep track of two variables as references, maxlevel and sum. maxLevel refers to the highest level reached so far. sum is the total sum of the right view uptil that level. We traverse right child first, so as we go down the level we obtain ... | def getSum2(root, level=0, maxLevel=None, sum=None):
if root == None:
return 0
if maxLevel == None:
maxLevel = [-1]
sum = [0]
if maxLevel[0] < level:
sum[0] += root.data
maxLevel[0] = level
getSum2(root.right, level+1, maxLevel, sum)
getSum2(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_level_maxsum (self):\r\n level_queue = [self]\r\n next_level_queue = []\r\n curr_level = 0\r\n max_sum = -sys.maxsize\r\n while level_queue:\r\n curr_node = level_queue.pop(0)\r\n if curr_node.left:\r\n next_level_queue.append(curr_no... | [
"0.77163315",
"0.7626254",
"0.71954876",
"0.71082497",
"0.67971444",
"0.6661522",
"0.6630408",
"0.6460394",
"0.6457264",
"0.6445148",
"0.63855803",
"0.6293592",
"0.6274472",
"0.6199291",
"0.61836684",
"0.6112749",
"0.6057289",
"0.6044596",
"0.5873906",
"0.5860754",
"0.5838793... | 0.78315043 | 0 |
Parses joint columns to a more readable format | def parse_columns(self):
self.data['ID'], self.data['SSSSSSSS.mmmuuun'] = self.data['ID SSSSSSSS.mmmuuun'].str.split(' ', 1).str
self.data['SSSSSSSS.mmmuuun'] = self.data['SSSSSSSS.mmmuuun'].astype(str).str.strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_column_parts(source):\n return _get_tuple(source, delimiter=' ')",
"def parse_columns(self, columns):\n accession = columns[0]\n refseq_category = columns[4]\n # taxid = columns[5]\n # species_taxid = columns[6] # Helps with dog, for example\n organism_name = co... | [
"0.58300465",
"0.5583173",
"0.5245765",
"0.52374446",
"0.5190688",
"0.5110659",
"0.5107724",
"0.5088825",
"0.50841093",
"0.50678706",
"0.5039605",
"0.5039083",
"0.5002636",
"0.49599484",
"0.4940303",
"0.49379417",
"0.49171132",
"0.49030122",
"0.48991945",
"0.48866022",
"0.488... | 0.6546401 | 0 |
Adds new value to the tree, maintaining BST property. | def add(self, value: object) -> None:
if self.root is None: # If tree is empty
self.root = TreeNode(value)
return
child_node = self.root
parent_node = None
while child_node is not None: # Traversing the tree
parent_node = child_node
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, value: object) -> None:\n #binary search tree == empty\n if self.root is None:\n self.root = TreeNode(value)\n return\n\n #variables loop/traverse bt\n child = self.root\n parent = None\n\n # place node via while loop\n while chil... | [
"0.8248955",
"0.7992989",
"0.7962581",
"0.7912762",
"0.7804022",
"0.7658349",
"0.7628654",
"0.7612346",
"0.76047623",
"0.75998455",
"0.7434677",
"0.74320185",
"0.74145246",
"0.7394661",
"0.7335856",
"0.7312156",
"0.7302819",
"0.7266216",
"0.72300184",
"0.7168642",
"0.71454644... | 0.8094388 | 1 |
Returns True if value parameter is in the BST or False if it isn't. False is also returned if tree is empty. | def contains(self, value: object) -> bool:
cur = self.root
while cur is not None:
if value == cur.value:
return True
elif value < cur.value:
cur = cur.left
else:
cur = cur.right
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contains(self, value: object) -> bool:\n # iterate tree for value\n curr = self.root\n while curr is not None:\n if value == curr.value:\n return True\n elif value < curr.value:\n curr = curr.left\n else:\n curr ... | [
"0.81124634",
"0.7861052",
"0.77063656",
"0.7601288",
"0.7382357",
"0.734886",
"0.71422845",
"0.7138288",
"0.70583344",
"0.7047384",
"0.6992035",
"0.6955919",
"0.68460417",
"0.68308794",
"0.6814742",
"0.6783973",
"0.6736148",
"0.6716641",
"0.6716641",
"0.6708668",
"0.67054045... | 0.788162 | 1 |
Returns value stored in root node. If tree is empty, method should return None. | def get_first(self) -> object:
if self.root is None: # If tree is empty
return None
return self.root.value # Returning root value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root_value(self):\n return self.__root.get_value()",
"def get_first(self) -> object:\n #binary search tree == empty\n if self.root is None:\n return None\n\n # return\n return self.root.value",
"def root(tree):\n\n return tree[0]",
"def get_xml_node_value ... | [
"0.7818051",
"0.76613665",
"0.697164",
"0.69265217",
"0.6892464",
"0.67330015",
"0.67122906",
"0.6711037",
"0.66726214",
"0.6565201",
"0.65605605",
"0.65474355",
"0.65456116",
"0.65299207",
"0.65149134",
"0.6508499",
"0.6508499",
"0.64951956",
"0.6463805",
"0.644734",
"0.6443... | 0.80032796 | 0 |
Removes the root node in the tree. Method must return False if the tree is empty and there is no root node to be removed and True if it is removed | def remove_first(self) -> bool:
if self.root is None: # If tree is empty
return False
if self.leaf(self.root): # If root is a lead
self.root = None
return True
if self.root.right is None:
self.root = self.root.left # Case where root ha... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_first(self) -> bool:\n #tree isempty\n if self.root is None:\n return False\n\n #root== leaf\n if self.is_leaf(self.root):\n self.root = None\n return True\n\n #root has!= right tree\n if self.root.right is None:\n sel... | [
"0.77671605",
"0.689085",
"0.6887413",
"0.68316996",
"0.66235656",
"0.6604138",
"0.65979475",
"0.65031135",
"0.64498526",
"0.6403214",
"0.6372204",
"0.6346645",
"0.6331107",
"0.63281304",
"0.62913775",
"0.62913775",
"0.6251645",
"0.6205663",
"0.6188294",
"0.6134697",
"0.61315... | 0.7402538 | 1 |
Checks and indicates if tree is full | def is_full(self) -> bool:
if self.root is None: # If tree is empty
return True
if self.root.left is None and self.root.right is None: # If tree has single root node
return True
return self.is_full_helper(self.root) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_full(self) -> bool:\n #BST == empty\n if self.root is None:\n return True\n\n #BST == root node\n if self.root.left is None and self.root.right is None:\n return True\n\n #recursive helper\n return self.is_full_helper(self.root)",
"def is_ful... | [
"0.753437",
"0.730664",
"0.7293273",
"0.724038",
"0.7130433",
"0.71066844",
"0.704826",
"0.7036727",
"0.7020625",
"0.6974807",
"0.6972692",
"0.6972692",
"0.6946011",
"0.6932424",
"0.6884039",
"0.6872651",
"0.6870061",
"0.68665886",
"0.68145645",
"0.67875886",
"0.67810786",
... | 0.78445214 | 0 |
Determines and indicates if tree is complete | def is_complete(self) -> bool:
if self.root is None or self.root.left is None and self.root.right is None:
return True # Empty tree or has one node is considered complete
else: # Creating base index to begin traversal
index = 0
count = self.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_complete(self) -> bool:\n #binary search tree == empty\n if self.root is None:\n return True\n\n #binary search tree== perfect\n if self.is_perfect():\n return True\n\n #binary search tree== queue\n q = Queue()\n q.enqueue(self.root)\n\n... | [
"0.7499507",
"0.7051301",
"0.69437",
"0.68194443",
"0.675173",
"0.6664803",
"0.6661053",
"0.6650517",
"0.6443817",
"0.63220465",
"0.62733734",
"0.6269435",
"0.62692815",
"0.6264803",
"0.621177",
"0.620965",
"0.62028944",
"0.61880714",
"0.61588484",
"0.6158352",
"0.6141757",
... | 0.79210836 | 0 |
Determines and indicates if tree is perfect | def is_perfect(self) -> bool:
if self.root is None: # If tree is empty
return True
h = self.height()
return self.is_perfect_helper(self.root, 0, h) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_perfect(self) -> bool:\n #binary search tree==empty\n if self.root is None:\n return True\n\n # loop binary search tree\n height = self.height()\n return self.is_perfect_helper(self.root, 0, height)",
"def checkTree(self, root):\n\t\tif len(self.graph.nodes())... | [
"0.7530488",
"0.6362639",
"0.63358074",
"0.6257702",
"0.6244804",
"0.6227973",
"0.61484617",
"0.614346",
"0.611812",
"0.60080504",
"0.5954746",
"0.59257185",
"0.59234136",
"0.59219205",
"0.5886118",
"0.58838034",
"0.5863036",
"0.58454025",
"0.58383125",
"0.58123827",
"0.58116... | 0.7776398 | 0 |
Counts and returns number of leaves that have no children | def count_leaves(self) -> int:
if self.root is None: # If tree is empty
return 0
return self.count_helper(self.root) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leaf_count(self) -> int:\n if self.children == []:\n return 1\n else:\n return sum([x.leaf_count() for x in self.children])",
"def count_leaves(self) -> int:\n # binary search tree == empty\n if self.root is None:\n return 0\n\n #recursive h... | [
"0.8165063",
"0.78673524",
"0.7788163",
"0.778297",
"0.7632432",
"0.7617847",
"0.750201",
"0.7460292",
"0.74360925",
"0.739089",
"0.7314105",
"0.73054016",
"0.73023474",
"0.7238135",
"0.72338337",
"0.72271705",
"0.7028478",
"0.69378364",
"0.69237834",
"0.68958",
"0.68908614",... | 0.80410475 | 1 |
Generate view for showing revision details. Each revision's documents should only be validation policies. | def show(self, revision):
validation_policies = []
tags = collections.OrderedDict()
success_status = 'success'
for vp in [d for d in revision['documents']
if d['schema'].startswith(types.VALIDATION_POLICY_SCHEMA)]:
validation_policy = {}
valida... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detail_view(self, request, pk):\n instance = self.get_object()\n if self.revision_wanted is not None:\n instance = get_object_or_404(\n instance.revisions, id=self.revision_wanted).as_page_object()\n elif self.is_preview:\n instance = instance.get_lates... | [
"0.64171344",
"0.5993255",
"0.5922065",
"0.58107185",
"0.57779986",
"0.5753471",
"0.5750759",
"0.5738226",
"0.5655285",
"0.564525",
"0.56131005",
"0.5601545",
"0.5574271",
"0.5560538",
"0.5543479",
"0.5537911",
"0.5501484",
"0.5479028",
"0.5416743",
"0.5403072",
"0.5399087",
... | 0.7074264 | 0 |
Defines the `on_publish` callback implementation. See `paho.mqtt.client.Client.on_publish` for more information. | def on_publish(client: mqtt.Client, userdata: Any, mid: int) -> None:
logging.info(f"Successfully published a message: mid={mid}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_publish(client, userdata, mid):\n print(\"Message Published.\")",
"def on_publish(unused_client, unused_userdata, unused_mid):\n\tprint('on_publish')",
"def on_publish(mqttc, obj, mid):\n logger.debug(\"MQTT PUBLISH: mid: \" + str(mid))",
"def on_publish( client, userdata, mid ):\n logging.in... | [
"0.72774845",
"0.7231252",
"0.7134205",
"0.7120813",
"0.70602643",
"0.70493734",
"0.6944918",
"0.6836987",
"0.6798255",
"0.6783485",
"0.6211079",
"0.6037182",
"0.58831716",
"0.58718497",
"0.58710885",
"0.58444774",
"0.5794245",
"0.57754993",
"0.57334346",
"0.57198703",
"0.571... | 0.730315 | 0 |
Decreases the volume. The volume is decreased by `VOLUME_STEP`, given in the configurations file. | def volume_down(self) -> None:
self.volume = max(self.volume - self.config.volume_step, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def volume_decrease():\n request_command(tv_command=TVCommand.volume_decrease)",
"def decrease_volume(self) -> None:\n for _ in range(10):\n self.media.volume_down()\n self.system.notify(f\"Jarvis::Decreased Volume: {self.media.get_volume()['volume']}%\")",
"def volume_down(self):\n... | [
"0.7546047",
"0.74981993",
"0.73946595",
"0.69768447",
"0.69425285",
"0.68609583",
"0.6743155",
"0.67325675",
"0.6719602",
"0.6554001",
"0.6533407",
"0.6532178",
"0.63969135",
"0.62911177",
"0.6283902",
"0.6278761",
"0.62164134",
"0.6180498",
"0.6079263",
"0.6070181",
"0.5868... | 0.77391833 | 0 |
Gets the mute status. Returns bool True if mute, False otherwise | def mute(self) -> bool:
return bool(self.audio_mixer.getmute()[0]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mute(self):\n return on_off_bool(self.get(COMMAND_UIC, 'GetMute')['mute'])",
"def is_volume_muted(self):\n return self._mute",
"def is_volume_muted(self):\n return self._state.get(\"mute\", None)",
"async def get_mute(self) -> bool:\n return await self._pytheos.api.player.... | [
"0.8447197",
"0.7853023",
"0.7816177",
"0.7786548",
"0.7637117",
"0.7604124",
"0.7589401",
"0.75716776",
"0.75716776",
"0.75716776",
"0.7493464",
"0.7490551",
"0.74009085",
"0.7386506",
"0.7377441",
"0.7263709",
"0.70131826",
"0.66592157",
"0.65496236",
"0.64843935",
"0.64833... | 0.82508844 | 1 |
Toggle play/pause status by simulating a space bar press. | def toggle_pause(self) -> None:
self.keyboard.press(Key.space)
self.keyboard.release(Key.space) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toggle_pause(self):\n self.stdin_queue.put(\"toggle\")",
"def pause(self):\n if self.status()['state'] == \"playing\":\n self.toggle_pause()",
"async def toggle_play_pause(self):\n _LOGGER.debug(\"[Foobar2k] In Play / Pause\")\n if (self._power == POWER_ON):\n if (se... | [
"0.7143017",
"0.7049981",
"0.68526906",
"0.6810413",
"0.679659",
"0.679248",
"0.6633295",
"0.660379",
"0.6561756",
"0.64910656",
"0.64739734",
"0.64123636",
"0.6334261",
"0.6333519",
"0.6223811",
"0.62218505",
"0.6202693",
"0.61604315",
"0.61567557",
"0.6146748",
"0.61246824"... | 0.8045744 | 0 |
Skip backward. How much the content will be skipped backward is platform dependant (usually 10 seconds). | def skip_backward(self) -> None:
self.keyboard.press(Key.left)
self.keyboard.release(Key.left) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def skip_backward(self) -> None:\n return await self.relay(\"skip_backward\")()",
"def skip(self):\n self.click_back_button()",
"def skip(self):\r\n length = self.next_byte()\r\n while length != b\"\\x00\" and length:\r\n self.next_bytes(parse_int(length, 'big'))\r\... | [
"0.69819635",
"0.6654638",
"0.63229805",
"0.62982714",
"0.6230928",
"0.616988",
"0.6131812",
"0.61039126",
"0.60554266",
"0.6048928",
"0.5998694",
"0.5979585",
"0.5978513",
"0.59542507",
"0.5950962",
"0.59315985",
"0.59063786",
"0.5886722",
"0.5856295",
"0.5814438",
"0.580931... | 0.68026274 | 1 |
Gets the current status. Returns dict a dictionary containing the current volume/mute status Notes `play/pause` status is not included here because there is no way to actually maintain an always uptodate status. | def status(self) -> dict:
return {"volume": self.volume, "mute": self.mute} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_play_status(self):\n return self.get(COMMAND_UIC, 'GetPlayStatus')",
"def status(self):\n if not self.volume:\n # no volume active\n status = volume_status.NONE\n elif self._status and self._last_status_check >= time.time() - MIN_TIME_BETWEEN_STATUS_CHECKS:\n ... | [
"0.72099084",
"0.71531796",
"0.71227986",
"0.6936893",
"0.69287443",
"0.6808147",
"0.6801078",
"0.67526555",
"0.6697266",
"0.66950464",
"0.66875565",
"0.662277",
"0.66202384",
"0.65583426",
"0.6508056",
"0.6502501",
"0.6497578",
"0.6452174",
"0.6417469",
"0.6393784",
"0.63906... | 0.82339 | 0 |
Publishes on `MQTT_STATUS_TOPIC` the current status (volume/mute). | def update_status(self) -> None:
try:
(rc, mid) = self.mqttc.publish(
self.config.status_topic, json.dumps(self.status), qos=0, retain=False
)
if rc == mqtt.MQTT_ERR_SUCCESS:
logging.info(
f"The request for a status update h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publish_status(client):\n client.publish(config.topic_get, payload=getlight())",
"def mqtt_publish_lwt(status):\n if not mqtt.connected:\n return\n cfg_option = Script.lwt\n cfg_section = mqtt.GROUP_TOPICS\n message = iot.get_status(status)\n try:\n mqtt.publish(message, cfg_o... | [
"0.8209476",
"0.7114468",
"0.70238584",
"0.6671091",
"0.6624879",
"0.66157854",
"0.6437624",
"0.63867337",
"0.6264684",
"0.6235489",
"0.61739427",
"0.6156377",
"0.6087393",
"0.5954078",
"0.58841777",
"0.58271587",
"0.5777121",
"0.5766412",
"0.5760327",
"0.57591856",
"0.575635... | 0.778087 | 1 |
Starts the MQTT client and subscribes to `MQTT_CONTROL_TOPIC` to receive commands. | def start(self) -> None:
# Set logging level
debug_level = logging.DEBUG if self.config.debug else logging.ERROR
logging.basicConfig(
format="[%(asctime)s] %(levelname)-8s %(message)s", level=debug_level
)
try:
# Check if authentication is required for co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_mqtt(self):\n def on_connect(client, userdata, flags, rc):\n logger.debug('MQTT client connected with result code \"%s\"' % rc)\n self.connected = True\n\n for topic in self.subscriptions:\n logger.debug('Subscribing to MQTT topic \"%s\"' % topic)\n ... | [
"0.763236",
"0.76221883",
"0.7471248",
"0.73906124",
"0.7208144",
"0.68606395",
"0.6845953",
"0.6829912",
"0.6781094",
"0.6738791",
"0.6738791",
"0.6649972",
"0.66235065",
"0.6622037",
"0.65514714",
"0.64626807",
"0.6343209",
"0.63389975",
"0.62604994",
"0.62354594",
"0.62292... | 0.7811086 | 0 |
Stops the MQTT client and disconnects from the broker. | def stop(self) -> None:
self.mqttc.disconnect() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop(self):\n if self._connected:\n self._client.loop_stop()\n self._client.disconnect()\n self._connected = False\n logger.info(\"Connection with MQTT Broker closed.\")",
"def stop_mqtt(self):\n if self.mqtt:\n logger.debug('Disconnecting ... | [
"0.8587642",
"0.8142177",
"0.75698906",
"0.7143907",
"0.7085005",
"0.70632106",
"0.70489585",
"0.70416576",
"0.70375",
"0.7019846",
"0.6991122",
"0.6919724",
"0.69057995",
"0.6826272",
"0.67882514",
"0.6742181",
"0.66949403",
"0.6682151",
"0.66718763",
"0.6662771",
"0.6651615... | 0.84184134 | 1 |
Counts how many letters there are in a certain word, and sums the total amount of letters needed to print all the considered numbers in words. | def numberCounts(limit):
sum = 0
for number in range(1,limit+1):
word = number2text(number)
amount = countLetters(word)
sum = sum + amount
return sum | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letterFreq(words):\n dict = {}\n total = 0\n for word in words:#Iterate through words\n for letter in word:#Increment by letter\n count = 0\n for yearCount in words[word]:\n count += yearCount.count#Increment total instances of word\n total += cou... | [
"0.7161771",
"0.7090559",
"0.70718217",
"0.70363235",
"0.70226014",
"0.7012694",
"0.69868827",
"0.6960672",
"0.69187313",
"0.69059414",
"0.6905146",
"0.68910384",
"0.6864671",
"0.6855224",
"0.6850122",
"0.68421316",
"0.6833898",
"0.68244064",
"0.67762583",
"0.6753796",
"0.673... | 0.7156738 | 1 |
Initialize the SVM classifier. All keyword arguments that are not listed will be forwarded to the underlying classifier. In this case, it is sklearn.SVC. For instance, if you pass an argument ``probability=True``, this will be forwarded to the initialization of SVC. Keyword arguments | def __init__(self, **kwargs):
super(SVM, self).__init__()
# initialize some default values for the SVM backend
self.max_iter = kwargs.pop('max_iter', 1e6)
# parameters for k cross validation / hyper-parameter tuning
self.params = [{
'kernel': ['rbf', 'sigmoid', 'pol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_svm(self, classifier_name=\"SVM\", **kwargs):\n if not classifier_name in self.classifiers:\n clf = svm.SVC(**kwargs)\n clf.fit(self.X_train, self.y_train)\n self.classifiers[classifier_name] = clf",
"def __init__(self, foundVariables, trainingData, trainingClass... | [
"0.79733",
"0.77171534",
"0.7263851",
"0.7185841",
"0.69938445",
"0.69591665",
"0.6609604",
"0.64811164",
"0.6366091",
"0.63404393",
"0.63152987",
"0.6285454",
"0.6282035",
"0.62803715",
"0.6228859",
"0.622272",
"0.62143224",
"0.61709386",
"0.61592513",
"0.61273116",
"0.61096... | 0.8087526 | 0 |
Initialize a K Nearest Neighbors (KNN) classifier. All additional keyword arguments will be forwarded to the underlying classifier, which is here ``sklearn.neighbors.KNeighborsClassifier``. Keyword Arguments | def __init__(self, **kwargs):
super(KNN, self).__init__()
self.nneighbors = kwargs.pop('n_neighbors', 5)
self.clf = neighbors.KNeighborsClassifier(n_neighbors=self.nneighbors, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, training_set, k=5):\n super(Knn, self).__init__(training_set)\n self.k = k",
"def __init__(self, train_x, train_y, k_nearest):\n (self.n, self.m) = train_x.shape\n self.k_nearest = k_nearest\n self.train_x = train_x\n self.train_y = train_y",
"def KN... | [
"0.7149776",
"0.70797116",
"0.6975284",
"0.6821038",
"0.6791322",
"0.67046446",
"0.6663235",
"0.6655018",
"0.65654653",
"0.6520154",
"0.6514157",
"0.647115",
"0.6439732",
"0.64261866",
"0.6424116",
"0.6395919",
"0.6339814",
"0.6338555",
"0.6327565",
"0.6300947",
"0.6284601",
... | 0.85269356 | 0 |
Initialize a Logistic Regression Classifier. Additional keyword arguments will be passed to the classifier initialization which is ``sklearn.linear_model.LogisticRegression`` here. Keyword Arguments | def __init__(self, **kwargs):
super(LogisticRegression, self).__init__()
self.C = kwargs.pop("C", 100)
self.clf = _LogisticRegression(C=self.C, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, reg_penalty='l2', reg_inv=1.0, k_fold=5, random_state=0):\n print(\"Initialize model Logistic Regression\")\n self.reg_penalty = reg_penalty\n self.reg_inv = reg_inv\n self.k_fold = k_fold\n self.random_state = random_state\n self.model = sklearn.linear_... | [
"0.7787792",
"0.7666058",
"0.74888206",
"0.7487082",
"0.72947127",
"0.7287355",
"0.7129283",
"0.7129005",
"0.7017122",
"0.6977676",
"0.69515365",
"0.68675447",
"0.682389",
"0.6818422",
"0.66917974",
"0.66808844",
"0.6590966",
"0.65193",
"0.6474951",
"0.63888896",
"0.6388435",... | 0.80850327 | 0 |
This 'initializes' an MLP Classifier. If no further keyword arguments are passed, the initializer is not fully created and the MLP will only be constructed during `run`. If, however, the hidden layer size is specified, the MLP will be constructed fully. Keyword Arguments | def __init__(self, **kwargs):
super(MLP, self).__init__()
# TODO: why lbfgs and not adam?
self.solver = kwargs.pop('solver', 'lbfgs')
self.alpha = kwargs.pop('alpha', 1e-5)
self.random_state = kwargs.pop('random_state', 1)
# determine if the MLP can be initialized or n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, hidden_layer_sizes, activation='relu', reg=0.001, k_fold=5, random_state=0):\n print(\"Initialize model Multi-layer Perceptron\")\n self.hidden_layer_sizes = hidden_layer_sizes\n self.activation = activation\n self.reg = reg\n self.k_fold = k_fold\n self... | [
"0.7369074",
"0.6767576",
"0.6735099",
"0.667496",
"0.6659903",
"0.664559",
"0.65862757",
"0.6564649",
"0.6500761",
"0.6496003",
"0.6479166",
"0.64572686",
"0.64518666",
"0.64242244",
"0.6413298",
"0.64100367",
"0.6396017",
"0.6340929",
"0.6327289",
"0.6311195",
"0.6308913",
... | 0.7740054 | 0 |
Initializes a ShrinkingLDA classifier. Additional arguments will be forwarded to the underlying classifier instantiation, which is ``sklearn.discriminant_analysis.LinearDiscriminantAnalysis`` here. Keyword Arguments | def __init__(self, **kwargs):
super(ShrinkingLDA, self).__init__()
self.solver = kwargs.pop('solver', 'lsqr')
self.shrinkage = kwargs.pop('shrinkage', 'auto')
self.clf = _LinearDiscriminantAnalysis(solver=self.solver, shrinkage=self.shrinkage, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_config(cls, config: Dict[str, Any]) -> \"SkLDA\":\r\n from sklearn.discriminant_analysis import LinearDiscriminantAnalysis\r\n\r\n lda = LinearDiscriminantAnalysis()\r\n lda.set_params(**config[\"params\"])\r\n\r\n for name, value in config[\"attributes\"].items():\r\n ... | [
"0.6772978",
"0.59967935",
"0.5829206",
"0.58245134",
"0.58202404",
"0.57720715",
"0.5574406",
"0.5511249",
"0.5497291",
"0.54501027",
"0.5411887",
"0.5405251",
"0.5380167",
"0.53712744",
"0.53660834",
"0.53598154",
"0.53575224",
"0.53490555",
"0.53481543",
"0.5344804",
"0.53... | 0.8053878 | 0 |
Returns a list of trigger objects that correspond to the rules set in the file filename | def readTriggerConfig(filename):
# Here's some code that we give you
# to read in the file and eliminate
# blank lines and comments
triggerfile = open(filename, "r")
all = [ line.rstrip() for line in triggerfile.readlines() ]
lines = []
for line in all:
if len(line) == 0 or line[0] ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_triggers_from_raw_file(yaml_file: str) -> List[str]:\n # SEARCH PATTERN:\n # At the beginning of the line:\n # - <TRIGGER>:\n # targeting text within the TRIGGER\n pattern = re.compile(r'trigger_name:\\s*(?P<trigger>[\\w_]+)\\s*')\n return find_all_entries(\n yaml_file=yaml_file, p... | [
"0.6980328",
"0.5968882",
"0.5945715",
"0.5864037",
"0.58263505",
"0.57400423",
"0.5730828",
"0.57252336",
"0.57219917",
"0.5702444",
"0.5643222",
"0.56113416",
"0.5609452",
"0.5557887",
"0.5556224",
"0.55456656",
"0.5534501",
"0.55292463",
"0.5528937",
"0.5508027",
"0.547992... | 0.61118656 | 1 |
Converts the list of spans and predicted antecedent indices into clusters of spans for each element in the batch. | def decode(self, output_dict: Dict[str, torch.Tensor]):
# A tensor of shape (batch_size, num_spans_to_keep, 2), representing
# the start and end indices of each span.
batch_top_spans = output_dict["top_spans"].detach().cpu()
# A tensor of shape (batch_size, num_spans_to_keep) represent... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_all_candi_ents(self, batch_inputs, ent_span_labels):\n\n all_candi_ents = []\n all_candi_ent_labels = []\n for idx, seq_len in enumerate(batch_inputs['tokens_lens']):\n ent_span_label = [\n self.vocab.get_token_from_index(label.item(), 'entity_span_labels... | [
"0.6282074",
"0.6258077",
"0.5775749",
"0.5738989",
"0.57176757",
"0.56679994",
"0.56581634",
"0.56327397",
"0.5591919",
"0.5590389",
"0.5584272",
"0.5572484",
"0.5560675",
"0.5519687",
"0.5459194",
"0.5409054",
"0.5375182",
"0.53735495",
"0.5369837",
"0.53569627",
"0.5341081... | 0.68449694 | 0 |
This method generates possible antecedents per span which survived the pruning stage. This procedure is `generic across the batch`. The reason this is the case is that each span in a batch can be coreferent with any previous span, but here we are computing the possible `indices` of these spans. So, regardless of the ba... | def _generate_valid_antecedents(num_spans_to_keep: int,
max_antecedents: int,
device: int) -> Tuple[torch.IntTensor,
torch.IntTensor,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_antecedent_gold_labels(top_span_labels: torch.IntTensor,\n antecedent_labels: torch.IntTensor):\n # Shape: (batch_size, num_spans_to_keep, max_antecedents)\n target_labels = top_span_labels.expand_as(antecedent_labels)\n same_cluster_indicato... | [
"0.5550315",
"0.5550315",
"0.5550315",
"0.55373615",
"0.54277706",
"0.53765005",
"0.5212551",
"0.5188417",
"0.50354105",
"0.49841648",
"0.48158422",
"0.4804906",
"0.4739883",
"0.46752444",
"0.4641308",
"0.4580102",
"0.45601207",
"0.45601207",
"0.45328763",
"0.4526556",
"0.449... | 0.7365419 | 0 |
Computes an embedding representation of pairs of spans for the pairwise scoring function to consider. This includes both the original span representations, the elementwise similarity of the span representations, and an embedding representation of the distance between the two spans. | def _compute_span_pair_embeddings(self,
top_span_embeddings: torch.FloatTensor,
antecedent_embeddings: torch.FloatTensor,
antecedent_offsets: torch.FloatTensor):
# Shape: (batch_size, num_spans_to_k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_span_pair_embeddings(top_span_embeddings: torch.FloatTensor):\n # Shape: (batch_size, num_spans_to_keep, num_spans_to_keep, embedding_size)\n num_candidates = top_span_embeddings.size(1)\n\n embeddings_1_expanded = top_span_embeddings.unsqueeze(2)\n embeddings_1_tiled = emb... | [
"0.7610565",
"0.6865084",
"0.67634887",
"0.63145435",
"0.6034044",
"0.5784151",
"0.5764903",
"0.5729094",
"0.5711145",
"0.5643132",
"0.5643132",
"0.5629556",
"0.5608478",
"0.55509514",
"0.5535342",
"0.5465266",
"0.54003745",
"0.538538",
"0.53403336",
"0.5332685",
"0.5318738",... | 0.70999026 | 1 |
Use CheckWitness to check matching of caller and entity authorized to the registered inheritage. | def authorization_check(input_inheritage_datum):
legal_entity = Get(GetContext, input_inheritage_datum)
legal_entity_is_authorized = CheckWitness(legal_entity) # Boolean
if legal_entity_is_authorized:
print('Authorization confirmed.')
else:
print('Authorization failed.')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RequireWitness(witness):\n Require(CheckWitness(witness))\n return True",
"def Main(operation, args):\n\n caller = args[0] # used with CheckWitness below to conform authorization\n caller_is_authorized = CheckWitness(caller) # Boolean\n\n if not caller_is_authorized:\n print('Action den... | [
"0.60390973",
"0.5355377",
"0.5286836",
"0.5216036",
"0.5156609",
"0.51501906",
"0.51444423",
"0.51412076",
"0.5138445",
"0.50416225",
"0.50233924",
"0.5020726",
"0.50183123",
"0.49943674",
"0.4991051",
"0.49793467",
"0.49559996",
"0.49438474",
"0.49430826",
"0.49415246",
"0.... | 0.6002814 | 1 |
Calling the Main function of this NEO smart contract enables registering a last will or inheritage datum. It also allows to set heirs and transfers of inheritage, which works exactly like the NEO licensing contracts. | def Main(operation, args):
caller = args[0] # used with CheckWitness below to conform authorization
caller_is_authorized = CheckWitness(caller) # Boolean
if not caller_is_authorized:
print('Action denied.')
return False
print('Action granted.')
input_inheritage_datum = args[1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def m_create_test_identities():\n\n # Get the ROOT account (it was created in the deployment of the Smart Contracts)\n ROOT_address, ROOT_key = wallet.account_from_name(\"ROOT\", \"ThePassword\")\n\n # Create the Alastria account for node \"ala\"\n print(f\"\\n==> Creating the Alastria account\")\n ... | [
"0.5759153",
"0.5494022",
"0.548574",
"0.5398242",
"0.52794045",
"0.51847357",
"0.516636",
"0.5163922",
"0.51480204",
"0.51440674",
"0.50547826",
"0.4989229",
"0.49818394",
"0.4974047",
"0.49711946",
"0.4969775",
"0.4968665",
"0.49574026",
"0.49412355",
"0.49326646",
"0.49318... | 0.59938085 | 0 |
Loads and stores the actual data and info about it. crop shape to crop this to (if you want to try algorithm a lot, make dataset smaller to reduce time) usepickled when true, do not load original data, instead take previously loaded+preprocessed pickled data upsample whether to upsample the data according to informatio... | def __init__(self,datafile,crop=False,usepickled=True,upsample=None,medianfilt=False,remove_rohr=False,dtype=None):
if not isinstance(datafile,str) and not isinstance(datafile, unicode):
self.D = datafile
return
self.info = WurzelInfo(datafile)
info = self.info
tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cleaned_data(self):\n try:\n self.train = pd.read_pickle('../input/train_clean.pkl')\n self.test = pd.read_pickle('../input/test_clean.pkl')\n except FileNotFoundError:\n self.load_raw_data()",
"def prepare_data(self, rm_orig: bool = False, tiling: bool = T... | [
"0.6441666",
"0.62836367",
"0.60844165",
"0.60320354",
"0.60308254",
"0.5983879",
"0.5958565",
"0.595047",
"0.5940177",
"0.5929695",
"0.59223896",
"0.58934385",
"0.5868746",
"0.5825709",
"0.58223945",
"0.58215547",
"0.5809224",
"0.57926273",
"0.57720673",
"0.57603604",
"0.576... | 0.7647941 | 0 |
save a pickle, and an upsampled.dat raw data file | def save(self, datafile):
with open(datafile,"wb") as f:
cPickle.dump(self.D, f, cPickle.HIGHEST_PROTOCOL)
upsname = datafile.replace(".pickle",".dat")
print "Saving to upsampled: ", self.D.shape
self.D.tofile(upsname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save(self):\n # TODO: Use local.punny dump (when written)\n with open(filename, 'w') as f:\n pickle = Pickler(f)\n pickle.dump(self.pungen.puns)",
"def pickle(self,data,filename):\n pickle.dump(data, open(filename, 'wb'))",
"def save_synthetic_data(data):\n \n... | [
"0.67512524",
"0.6679278",
"0.66047865",
"0.65051013",
"0.6450605",
"0.6428173",
"0.63059753",
"0.6288153",
"0.628363",
"0.62679696",
"0.61919385",
"0.6181547",
"0.6148863",
"0.6147626",
"0.6144471",
"0.6131465",
"0.61267364",
"0.6124752",
"0.61118966",
"0.60922277",
"0.60845... | 0.8038806 | 0 |
run regression tests for all supported backends This task runs HTSQL regression tests on all combinations of client and server platforms. | def CHECK_ALL():
vms = [py26_vm, py27_vm, pgsql84_vm, pgsql90_vm, pgsql91_vm,
mysql51_vm, oracle10g_vm, mssql2005_vm, mssql2008_vm]
for vm in vms:
if vm.missing():
warn("VM is not built: {}", vm.name)
for vm in vms:
if vm.running():
vm.stop()
errors = 0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_make_server(self):\n\n # nose does not have great support for parameterized tests\n for backend in backends():\n self.tt = minimock.TraceTracker()\n self._check_make_server(backend)\n minimock.restore()",
"def build_test_backends_list( # noqa: C901, PLR091... | [
"0.6142248",
"0.6107093",
"0.61045086",
"0.59906995",
"0.5777073",
"0.5710564",
"0.5702227",
"0.56206304",
"0.56038636",
"0.55857205",
"0.5580863",
"0.55246997",
"0.5523196",
"0.5498721",
"0.54908246",
"0.54678303",
"0.54581964",
"0.5450011",
"0.5439366",
"0.5400352",
"0.5399... | 0.67466563 | 0 |
chooses n labeled indices to labeled returns of new elemnts labelled | def label_n_elements(self, n_elements: int, **kwargs) -> int:
# labels
assert Exception("not implemented") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_labels(self, ind):\n pass",
"def label_n_elements(\n self,\n n_elements: int,\n model,\n data_process_fn,\n ) -> int:\n n_to_sample = min(len(self.unlabelled_idx_set), n_elements)\n model.eval()\n unlabelled_indices = lis... | [
"0.63907474",
"0.6352693",
"0.6329472",
"0.63024724",
"0.6245996",
"0.6064925",
"0.605565",
"0.605293",
"0.60266817",
"0.60136163",
"0.5994621",
"0.5984954",
"0.5974731",
"0.59589845",
"0.5946599",
"0.59450305",
"0.5911087",
"0.5879746",
"0.58767235",
"0.5865442",
"0.58650357... | 0.65571535 | 0 |
Requires the intial meter reading and an intial date in a YYYYMMDD string format. | def __init__(self,initial_meter_reading, initial_date):
self.initial_meter_reading = initial_meter_reading
self.initial_date = initial_date
self.total_units_consumed = 0
self.total_amount_spent = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bad_date_1(self):\n result = self.client.get(\"/search?origin=ORD%2C+Chicago+IL&destination=DFW%2C+Dallas+TX&date=2017-01-01\")\n self.assertNotIn('<meter value=\"70\"', result.data)\n self.assertIn('enter a valid date', result.data)",
"def test_bad_date_2(self):\n result = s... | [
"0.5892624",
"0.57743835",
"0.5654323",
"0.560261",
"0.5535996",
"0.5463853",
"0.5458466",
"0.5427662",
"0.5393306",
"0.53729624",
"0.52889407",
"0.52506244",
"0.5226435",
"0.5223255",
"0.51975995",
"0.51873726",
"0.51818895",
"0.51659155",
"0.514951",
"0.5146609",
"0.5143429... | 0.65958565 | 0 |
Adds units and amount values. | def add_tokens(self, units, amount):
self.total_units_consumed+= units
self.total_amount_spent+= amount
formatted_units= format(self.total_units_consumed, ".2f")
print(f"\nAdded {units}.\nTotal units bought {formatted_units}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _increment_quantity(self, units):\n self.quantity += units",
"def __add__(self, other):\n # can only add using like units\n if not self.unit.is_compatible(other.unit):\n raise TypeError('Cannot add two quantities with incompatible units \"%s\" and \"%s\".' % (self.unit, other.... | [
"0.6816288",
"0.6686461",
"0.6666545",
"0.64462173",
"0.63531774",
"0.63172597",
"0.62612027",
"0.6252208",
"0.6252208",
"0.6252208",
"0.6214208",
"0.6113515",
"0.6109122",
"0.6083356",
"0.5995048",
"0.59567046",
"0.5954634",
"0.5930518",
"0.59236056",
"0.5917771",
"0.5909040... | 0.7359193 | 0 |
Append a single version to leafjson | def add_version_to_leafjson(self, fpath, dist, leafname,
indexjson="index.json"):
leafdir = self.path / leafname
leafjson = leafdir / indexjson
with self.lock_leaf_json(leafname, leafjson) as leafdata:
if fpath.name in set([x['filename'] for x in leafd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_version_to_leaf(self, fpath, leafname,\n indexjson=\"index.json\",\n indexhtml=\"index.html\"):\n leafdir = self.path / leafname\n assert leafdir.exists(), \"Leafdir missing: %s\" %leafdir\n dist = self.at.pkginfo_from_file(fpath, h... | [
"0.6759122",
"0.57262987",
"0.5653308",
"0.55646193",
"0.53592455",
"0.53467655",
"0.52583563",
"0.52166694",
"0.5204067",
"0.51977086",
"0.5153234",
"0.5141711",
"0.51183885",
"0.5115246",
"0.5105357",
"0.5080454",
"0.5076871",
"0.50762695",
"0.5049741",
"0.50454164",
"0.501... | 0.7733302 | 0 |
This function takes a list of cities and returns a list of cities in three dimensions, with all having the same euclidean length. | def _add_weighting_dimension(self, cities):
sqrd_val = lambda x: pow(x[0],2) + pow(x[1],2)
farthest = max(map(sqrd_val, cities))
res = []
for x in cities:
res.append((x[0], x[1], numpy.sqrt(farthest - sqrd_val(x))))
return res | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_matrix(cities):\n\n return [[city1.distance(city2) for city2 in cities]\n for city1 in cities]",
"def compute_distance_pairs(cities):\n global distances_pair\n for city_from in cities:\n distances_pair.append([0 for r in range(city_from.index)]) # cr... | [
"0.68104416",
"0.611199",
"0.59421015",
"0.58291847",
"0.5739379",
"0.56802326",
"0.5661663",
"0.5481587",
"0.5471915",
"0.5471512",
"0.5410235",
"0.5408145",
"0.53785115",
"0.5334731",
"0.5188677",
"0.5133285",
"0.5097538",
"0.50717384",
"0.50564647",
"0.50536096",
"0.505035... | 0.6607015 | 1 |
Load main page which has an overview of all animal classes | def showAnimalClasses():
animal_classes = session.query(AnimalClasses)
animal_families = session.query(ClassFamilies).join(AnimalClasses).all()
try:
return (render_template('animalClasses.html',
animal_classes=animal_classes,
user_name=login_session['username'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_animal(self):\n self._view_animal()",
"def show_homepage():\n\n pets = Pet.query.all()\n rando_pet = get_info_random_pet()\n\n name = rando_pet['petfinder']['pet']['name']['$t']\n age = rando_pet['petfinder']['pet']['age']['$t']\n image = rando_pet['petfinder']['pet']['media']['pho... | [
"0.65287024",
"0.6372867",
"0.63136834",
"0.59395015",
"0.5915072",
"0.58049124",
"0.57691216",
"0.57484514",
"0.5730002",
"0.5678525",
"0.56712204",
"0.56658906",
"0.5646644",
"0.5645996",
"0.5610057",
"0.5598498",
"0.5583818",
"0.5572895",
"0.55581045",
"0.5480074",
"0.5472... | 0.65120715 | 1 |
an inquiry over the unique values of self. | def unique_values(self):
return DiscoDBInquiry(super(DiscoDB, self).unique_values) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique(self):\n # variables for uniques \n self._currentSet = 1\n self._uniqueValue = {}\n\n pd = self._dataTable\n for col in pd:\n arr = pd[col].unique()\n for i in arr:\n unique_entry = ((col,i),)\n self._uniqueValue[uniq... | [
"0.7075152",
"0.68721443",
"0.6454781",
"0.6431276",
"0.6411944",
"0.63915163",
"0.6388828",
"0.6374798",
"0.63444257",
"0.6302618",
"0.61914665",
"0.61761963",
"0.61658645",
"0.6145026",
"0.6122929",
"0.6016905",
"0.5996316",
"0.59914964",
"0.59606606",
"0.59568095",
"0.5954... | 0.70846605 | 0 |
Multicomponent twobody force/force kernel accelerated with Numba's njit decorator. Loops over bonds in two environments and adds to the kernel if bonds are of the same type. | def two_body_mc_jit(bond_array_1, c1, etypes1, bond_array_2, c2, etypes2,
d1, d2, sig, ls, r_cut, cutoff_func,
nspec, spec_mask, bond_mask):
kern = 0
ls1 = 1 / (2 * ls * ls)
ls2 = 1 / (ls * ls)
ls3 = ls2 * ls2
sig2 = sig * sig
bc1 = spec_mask[c1]
bc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def three_body_mc_force_en_jit(bond_array_1, c1, etypes1,\n bond_array_2, c2, etypes2,\n cross_bond_inds_1, cross_bond_inds_2,\n cross_bond_dists_1, cross_bond_dists_2,\n triplets_1, triplets_2,\... | [
"0.6830664",
"0.66358757",
"0.6553903",
"0.63309014",
"0.5937413",
"0.5160957",
"0.51527846",
"0.5112238",
"0.508372",
"0.5081133",
"0.50555575",
"0.49794096",
"0.49758714",
"0.49186537",
"0.49062157",
"0.489783",
"0.4882183",
"0.4880506",
"0.4870511",
"0.48532355",
"0.485323... | 0.68092847 | 1 |
Parse timestamp to get date, hour, minute info, along with extra information which either records a change in state (asleep or awake). | def getinfo(timestamp):
datetime, message = timestamp.split(']')
date, time = datetime.split()
date = date.strip('[')
hour, minute = time.split(':')
message = message.split()
extra = message[1] # either 'asleep', 'up', or '#XXX'
return date, int(hour), int(minute), extra | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract(self, timestamp):\n if not isinstance(timestamp, (str, int)):\n raise TypeError('\"{}\" is not str or int type'.format(type(timestamp)))\n elif isinstance(timestamp, str) and not Timestamp.verify(timestamp):\n raise ValueError('\"{}\" is not a valid timestamp'.format... | [
"0.67047715",
"0.64180183",
"0.6356814",
"0.6159703",
"0.6109991",
"0.596805",
"0.5949019",
"0.5894558",
"0.5890337",
"0.58671594",
"0.5848925",
"0.57857615",
"0.57357436",
"0.5718937",
"0.5702094",
"0.56975126",
"0.5694516",
"0.5680534",
"0.5669474",
"0.5639821",
"0.56350666... | 0.7690927 | 0 |
returns the number of points/rows in the data set. | def get_num_points(self):
dimensions = self.data.shape
return dimensions[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNbRows(self):\n return self.data.shape[1]",
"def n_points(self):\n\n if self.data_reduced:\n return len(self.data_reduced[0])\n else:\n return 0",
"def data_count(self):\r\n\r\n shp = self.df.shape\r\n row_count = shp[0]\r\n return row_coun... | [
"0.80856127",
"0.80212545",
"0.8007088",
"0.7975629",
"0.79718477",
"0.7858655",
"0.7828387",
"0.7727079",
"0.7684411",
"0.7568434",
"0.75577956",
"0.75539523",
"0.75380296",
"0.75021416",
"0.749834",
"0.74500316",
"0.74453664",
"0.74453664",
"0.74282986",
"0.7414466",
"0.739... | 0.8029127 | 1 |
returns a copy of the eigenvectors as a numpy matrix with the eigenvectors as rows. | def get_eigenvectors(self):
return self.eigenVectors | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_eigenvectors(self):\n return self._eigenvectors",
"def GetEigenvectors(self):\n\t\treturn self.Solver.GetEigenvectors()",
"def numpy_eigenvectors(A):\n import numpy\n A = numpy.array(A)\n E, V = numpy.linalg.eigenvectors(A)\n import Num... | [
"0.78133976",
"0.73811644",
"0.73597986",
"0.6682953",
"0.64220715",
"0.637679",
"0.63268673",
"0.62819743",
"0.62661785",
"0.62398136",
"0.6219714",
"0.6208",
"0.62075144",
"0.6167103",
"0.61660385",
"0.6147072",
"0.6128073",
"0.61235046",
"0.6030575",
"0.6015362",
"0.598459... | 0.7813269 | 1 |
ghost objects are objects who arent really parents of there children this is actually affected by figma node objects like GROUPS children of GROUP nodes are not positioned relative to itself. | def is_ghost(self):
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_octree(self):\n if len(self.children) <= 0:\n self.generate_octants()\n for point in self.points:\n self.append_point(point)\n self.points = np.array([])",
"def is_ghost(self):\n return self._is_ghost",
"def is_ghost(self, is_ghost):\n\n self._i... | [
"0.5905378",
"0.5810049",
"0.5776714",
"0.5622885",
"0.5614038",
"0.5556719",
"0.5556106",
"0.55468476",
"0.55206096",
"0.55123657",
"0.5274596",
"0.5255961",
"0.5250529",
"0.52494305",
"0.5246054",
"0.5242387",
"0.523439",
"0.5187646",
"0.5187646",
"0.5171436",
"0.51510173",... | 0.6283604 | 0 |
Continuously checks for response messages and processes them if found. | def _run(self):
self.running = True
while self.running:
try:
print "Response monitor running..."
# Get the message count
messageCount = self.scHandle.amazonSQSManager.getQueueCount(self.scHandle.amazonSQSManager.responsesQueue)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_responses(self):\n try:\n while not self.shutting_down:\n try:\n raw_message = self.kernel_socket.recv()\n response_message = json_decode(utf8(raw_message))\n\n msg_id = KernelClient._get_msg_id(response_message, se... | [
"0.67940724",
"0.6704232",
"0.6657868",
"0.6587176",
"0.65321165",
"0.65191793",
"0.6492873",
"0.64859927",
"0.6388113",
"0.63338125",
"0.62780225",
"0.6247899",
"0.62359226",
"0.62079006",
"0.6178676",
"0.6123276",
"0.61136174",
"0.60990167",
"0.6030589",
"0.6029652",
"0.601... | 0.7458335 | 0 |
Predict the output measures using 30 individually trained neural nets. | def predict_30_single_nets(input_data=rand_input, nets=nets):
predicted = np.zeros((input_data.shape[0], 30))
for i in nets.keys():
predicted[:, i] = nets[i].predict(input_data).ravel()
return y_scaler.inverse_transform(predicted) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval(self): \n inputs,enc_input_weights, outputs, dec_input_weights = self.get_batch()\n predicted_ids = self.model.step(self.sess, inputs, enc_input_weights) \n print(\"=\"*20)\n for i in range(FLAGS.batch_size):\n print(\"* %dth sample target: %s\" % (i,str(outputs[i,1:]-2)))\n for ... | [
"0.6752993",
"0.66978836",
"0.6640598",
"0.65851784",
"0.65636015",
"0.64693135",
"0.6450385",
"0.644087",
"0.6433996",
"0.6424142",
"0.6420486",
"0.6413421",
"0.64131695",
"0.6400773",
"0.6398801",
"0.6386628",
"0.6381602",
"0.6368653",
"0.63674116",
"0.6344516",
"0.6326164"... | 0.7289246 | 0 |
Get the arguments from a random row of ligpy_args to pass to predict_ligpy. Returns end_time output_time_step cool_time initial_T heat_rate maximum_T plant | def get_random_ligpy_args():
rand_index = np.random.randint(0, 249999)
args = ligpy_args[rand_index]
end_time = float(args.split(' ')[0])
output_time_step = float(args.split(' ')[1])
cool_time = int(args.split(' ')[2])
initial_T = float(args.split(' ')[3])
heat_rate = float(args.split(' ')[4... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_predict_ligpy(end_time=end_time, output_time_step=output_time_step,\n cool_time=cool_time, initial_T=initial_T,\n heat_rate=heat_rate, maximum_T=maximum_T, plant=plant):\n call('cp ligpy_benchmarking_files/sa_compositionlist.dat '\n '../../../ligpy/ligpy/data/... | [
"0.60447955",
"0.5237629",
"0.5195751",
"0.5113499",
"0.50936747",
"0.5065414",
"0.5026599",
"0.50022936",
"0.49909994",
"0.49905685",
"0.49113852",
"0.4902275",
"0.48962566",
"0.48938432",
"0.48818117",
"0.48806736",
"0.4862431",
"0.48374677",
"0.48350957",
"0.4831626",
"0.4... | 0.85752475 | 0 |
Create the proper environment to run predict_ligpy() and set up the kinetic model. | def setup_predict_ligpy(end_time=end_time, output_time_step=output_time_step,
cool_time=cool_time, initial_T=initial_T,
heat_rate=heat_rate, maximum_T=maximum_T, plant=plant):
call('cp ligpy_benchmarking_files/sa_compositionlist.dat '
'../../../ligpy/ligpy/data/compositi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_environment(self):\n\t\tbase_layer = 0\n\t\tself.Gravity = 9.81\n\n\t\t#Private data for to define model\n\t\t__model_max_altitude = 87000\n\t\t__atmosphere_layers = {0:0, 11000:1, 20000:2, 32000:3, 47000:4, 51000:5, 71000:6}\n\t\t__layer_base_data = {\n\t\t\t0:{'temp':288.15, 'lapse':-0.0065, 'press':101... | [
"0.61358726",
"0.5876851",
"0.5797861",
"0.57214826",
"0.569199",
"0.569199",
"0.5691718",
"0.5682754",
"0.5678611",
"0.566164",
"0.565625",
"0.55922437",
"0.5561529",
"0.5544014",
"0.55434483",
"0.55295366",
"0.5488543",
"0.5485898",
"0.54810333",
"0.5467549",
"0.5466732",
... | 0.6131551 | 1 |
Clean up after running predict_ligpy(). | def teardown_predict_ligpy():
call('rm -rf bsub.c bsub.o ddat.in fort.11 f.out greg10.in jacobian.c '
'jacobian.o model.c model.o net_rates.def parest rates.def '
'results_dir/', shell=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cleanup(self):\n\n self.netIns = []\n self.netOuts = []\n self.Gradients = [None]*self.size",
"def shutdown(self):\n del self.model\n del self.train_dataset\n del self.test_dataset",
"def cleanup(self):\n if self.cleanup_allowed:\n shutil.rmtree(... | [
"0.7316702",
"0.6955422",
"0.69125533",
"0.6764319",
"0.6755241",
"0.6755241",
"0.6755241",
"0.671298",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6669276",
"0.6655057",
"0.66477305",
... | 0.76612145 | 0 |
Joins given arguments into an url and add trailing slash | def join_url(*args): # type: (*str) -> str
parts = [part[:-1] if part and part[-1] == '/' else part for part in args]
parts.append('')
return '/'.join(parts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _urljoin(self, *args):\r\n\t\treturn \"/\".join(map(lambda x: str(x).rstrip('/'), args))",
"def urljoin(*args):\n\n return \"/\".join(map(lambda x: str(x).rstrip('/'), args))",
"def urljoin(*args):\n return '/'.join(str(a or '').strip('/') for a in args)",
"def _get_url(self, *args):\n if se... | [
"0.8131531",
"0.7927616",
"0.77995026",
"0.76855314",
"0.75716543",
"0.7222249",
"0.70279557",
"0.69136554",
"0.68075687",
"0.6805666",
"0.68026286",
"0.6732238",
"0.671909",
"0.67116797",
"0.6708989",
"0.6694948",
"0.6683536",
"0.6671823",
"0.66548973",
"0.65995556",
"0.6596... | 0.8127026 | 1 |
List of versions for given component with required spec | def versions(self, component_name, spec='*'):
component_name = component_name.lower()
body = self._base_request(
'get',
['components', component_name],
schema=COMPONENT_SCHEMA,
)
return tools.manifest.ComponentWithVersions(
name=component_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component_versions(session):\n # type: (Session) -> Dict[str, Any]\n return _get_dict(session, \"/version\")",
"def get_comp_versions (component):\n vprint (\"Detecting current version for \" + component)\n\n regex = re.compile (r\"version \" + version_restr)\n major = component + \"_major... | [
"0.72386885",
"0.6432817",
"0.6386393",
"0.63429064",
"0.63278764",
"0.62531364",
"0.6252279",
"0.62437165",
"0.61184597",
"0.61171395",
"0.61088806",
"0.6107291",
"0.6080168",
"0.6051575",
"0.5993694",
"0.59879386",
"0.5984854",
"0.59401345",
"0.59385574",
"0.59271145",
"0.5... | 0.76724917 | 0 |
Manifest for given version of component, if version is None most recent version returned | def component(self, component_name, version=None):
response = self._base_request(
'get',
['components', component_name.lower()],
schema=COMPONENT_SCHEMA,
)
versions = response['versions']
if version:
requested_version = tools.manifest.Comp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manifest_version(self):\n manifest = self._read_manifest_json()\n return int(manifest[\"version\"])",
"def get_manifest(self):\n return self.manifest",
"def version(self, version: Optional[str]) -> Optional[ChartVersionInfo]:\n if version is None or version == \"\":\n ... | [
"0.6289913",
"0.624283",
"0.6190238",
"0.6142275",
"0.6134333",
"0.60562783",
"0.6033186",
"0.6014021",
"0.5990452",
"0.59183824",
"0.5855934",
"0.5853843",
"0.584168",
"0.58309156",
"0.57974416",
"0.5766517",
"0.5756577",
"0.5752406",
"0.57426584",
"0.5742467",
"0.57302046",... | 0.6941365 | 0 |
Extract features or diseases and genes of interest from MME request object If the record contains feature(s) with is_observed=True will we will send those to owlsim, otherwise we will the disease(s) of interest, if there are no diseases, will send and gene(s) of interest to owlsim. Essentially the goal is to send the s... | def extract_features_from_mme(patient: MmeRequest) -> List:
features = [clean_feature_ids(feature.id) for feature in patient.features if feature.observed == Observed.yes]
diseases = [clean_feature_ids(disease.id) for disease in patient.disorders]
genes = [clean_feature_ids(genomic_feature.gene.id) for genom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutual_information_estimate(self, approx_prob=False):\n \n # this might be not the right approach\n q_n = self.receptor_activity_estimate(approx_prob=approx_prob)\n q_nm = self.receptor_crosstalk_estimate(approx_prob=approx_prob)\n \n # calculate the approximate ... | [
"0.5173689",
"0.516008",
"0.50586516",
"0.4968085",
"0.49511135",
"0.49510634",
"0.4896924",
"0.48401144",
"0.48384696",
"0.48188362",
"0.47967204",
"0.4788563",
"0.47103927",
"0.46297723",
"0.46042022",
"0.4602445",
"0.46010336",
"0.4594489",
"0.45882726",
"0.4585197",
"0.45... | 0.5915936 | 0 |
update the main html page (replacing updated date) | def update_main_page():
line = house_keeping + '/acis_gain.html'
text = open(line, 'r').read()
today = tcnv. currentTime('Display')
text = text.replace('#DATE#', today)
file = web_dir + '/acis_gain.html'
fo = open(file, 'w')
fo.write(text)
fo.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update( ):\r\n pass",
"def update():\n print(\"current page is \", wikiPageStackTrace[-1].getTitle())\n if wikiPageStackTrace[-1].getUrl() != goalPage.getUrl(): # no victory\n eel.addRoundNumber()\n eel.printInPageList(wikiPageStackTrace[-1].getOnlyLinksListJS())\n eel.upda... | [
"0.6518173",
"0.6512457",
"0.6483891",
"0.64577",
"0.6398741",
"0.63479894",
"0.63479894",
"0.6309669",
"0.62735444",
"0.62288076",
"0.6111147",
"0.60875803",
"0.60766274",
"0.60699505",
"0.6066609",
"0.60589695",
"0.5984037",
"0.59747726",
"0.5881194",
"0.58562994",
"0.58562... | 0.797936 | 0 |
Writes the indexed pairs file, which has two more columns than the input pairs file corresponding to the restriction fragment index of each read. Note that pairs files have 1bp point positions whereas restriction table has 0bp point poisitions. | def attribute_fragments(pairs_file, idx_pairs_file, restriction_table):
# NOTE: Bottlenecks here are 1. binary search in find_frag and 2. writerow
# 1. could be reduced by searching groups of N frags in parallel and 2. by
# writing N frags simultaneously using a single call of writerows.
# Parse and u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_pairs(self, output=None, tmpdir=None):\n\n # FIXME change this to a random file name to avoid overwriting problems\n # default name for output file\n if output is None:\n (basename, _) = os.path.splitext(self.database)\n output = basename + '.abx'\n #... | [
"0.61503303",
"0.5953034",
"0.5889917",
"0.58708245",
"0.5837359",
"0.5780441",
"0.5771669",
"0.5748543",
"0.56858385",
"0.56586254",
"0.5615848",
"0.5535593",
"0.55243206",
"0.5508403",
"0.544239",
"0.5401867",
"0.53499496",
"0.5340001",
"0.5331478",
"0.5275024",
"0.52610815... | 0.7263135 | 0 |
Get the restriction table for a single genomic sequence. | def get_restriction_table(seq, enzyme, circular=False):
chrom_len = len(seq)
wrong_enzyme = "{} is not a valid restriction enzyme.".format(enzyme)
# Restriction batch containing the restriction enzyme
try:
enz = [enzyme] if isinstance(enzyme, str) else enzyme
cutter = RestrictionBatch(en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def range_table(self):\n raise NotImplementedError('Abstract method.')",
"def get_restrictions(grid, row, column):\n block_row, block_col = row//3 , column//3\n row_restrt, col_restrt, box_restrt, hyper_restrt = (set([]), set([]),\n ... | [
"0.49773094",
"0.4953804",
"0.49245068",
"0.48966226",
"0.48627293",
"0.47512305",
"0.46915975",
"0.4648438",
"0.46481824",
"0.46220544",
"0.45907134",
"0.45702237",
"0.45431507",
"0.45336604",
"0.4528613",
"0.45260376",
"0.45152456",
"0.4495501",
"0.449324",
"0.4487569",
"0.... | 0.61276084 | 0 |
Use binary search to find the index of a chromosome restriction fragment corresponding to an input genomic position. | def find_frag(pos, r_sites):
if r_sites[0] != 0:
raise ValueError(
"The first position in the restriction table is not 0."
)
if pos > r_sites[-1]:
raise ValueError(
"Read position is larger than last entry in restriction table."
)
# binary search for t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genome_index(self, chromosome, position):\n if type(chromosome) is str:\n try:\n chromosome = CHROMO_TO_INT[chromosome]\n except KeyError:\n raise ValueError('Invalid chromosome')\n if position > self.offsets[chromosome]:\n raise Valu... | [
"0.6146764",
"0.60833704",
"0.6073326",
"0.59882",
"0.59817207",
"0.5950846",
"0.574812",
"0.5700251",
"0.5694898",
"0.5666446",
"0.5666142",
"0.5665977",
"0.5625461",
"0.5599729",
"0.5583987",
"0.5575507",
"0.5568089",
"0.5562804",
"0.55359846",
"0.55275905",
"0.5526295",
... | 0.68538964 | 0 |
logs summary statistics of fragment length distribution based on an input fragment file. Can optionally show a histogram instead of text summary. | def frag_len(
frags_file_name=DEFAULT_FRAGMENTS_LIST_FILE_NAME,
output_dir=None,
plot=False,
fig_path=None,
):
try:
frag_list_path = os.path.join(output_dir, frags_file_name)
except TypeError:
frag_list_path = frags_file_name
frags = pd.read_csv(frag_list_path, sep="\t")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cli_text_histogram(logy, max_pos, bin_width, graph_width, input_file):\n values = []\n for line in input_file:\n try:\n values.append(float(line.strip()))\n except ValueError:\n click.echo(f'Warning: \"{line.strip()}\" could not be parsed', err=True)\n click.echo(te... | [
"0.5974501",
"0.5855871",
"0.5737661",
"0.5571552",
"0.54857486",
"0.54644877",
"0.54293036",
"0.54106885",
"0.538307",
"0.5371995",
"0.53593224",
"0.53166306",
"0.5313411",
"0.5299175",
"0.5251707",
"0.5247406",
"0.52339566",
"0.5211171",
"0.5158672",
"0.5147245",
"0.5137888... | 0.69249344 | 0 |
Return a regex which corresponds to all possible religation sites given a set of enzyme. | def gen_enzyme_religation_regex(enzyme):
# Split the str on the comma to separate the different enzymes.
enzyme = enzyme.split(",")
# Check on Biopython dictionnary the enzyme.
rb = RestrictionBatch(enzyme)
# Initiation:
give_list = []
accept_list = []
ligation_list = []
# Iterat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _suggest_regexes(content):\n # Grab all regular expressions and compile them\n suggested_regexes = set()\n regex_keywords = TagRegex.objects.all()\n\n # Look for our regular expressions in the content\n for r in regex_keywords:\n if re.search(r.regex, content):\n suggested_rege... | [
"0.6048385",
"0.6029155",
"0.6027045",
"0.56040746",
"0.55752397",
"0.55567074",
"0.5532645",
"0.55006045",
"0.54795575",
"0.54214215",
"0.5420826",
"0.5414125",
"0.5407125",
"0.5393864",
"0.53503644",
"0.534253",
"0.5330092",
"0.53190917",
"0.53152335",
"0.53115654",
"0.5308... | 0.72006804 | 0 |
Obtain a datapoint and event ingest client. | def ingest(self, token, endpoint=None, timeout=None, compress=None):
from . import ingest
if ingest.sf_pbuf:
client = ingest.ProtoBufSignalFxIngestClient
else:
_logger.warn('Protocol Buffers not installed properly; '
'falling back to JSON.')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_signalfx_ingest(self):\n ingest = None\n try:\n client = signalfx.SignalFx()\n ingest = client.ingest(self._ingest_token, endpoint=self._ingest_endpoint,\n timeout=self._ingest_timeout)\n except Exception as e:\n se... | [
"0.6011769",
"0.52960885",
"0.52960885",
"0.52439255",
"0.5187891",
"0.51376545",
"0.5135585",
"0.5085941",
"0.5074855",
"0.50598395",
"0.5041467",
"0.50244033",
"0.49994",
"0.49972418",
"0.4987038",
"0.4984964",
"0.49592924",
"0.49520183",
"0.4938184",
"0.4900327",
"0.488501... | 0.54975486 | 1 |
Create a new replicapoolupdater handle. | def __init__(self, url='', credentials=None,
get_credentials=True, http=None, model=None,
log_request=False, log_response=False,
credentials_args=None, default_global_params=None,
additional_http_headers=None):
url = url or u'https://www.googleapis.com/rep... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(name, template, version):\n NewCommandExecutor().new(name, template, version)",
"def get_updater(optimizer):\n return Updater(optimizer)",
"def do_instance_alloc(self, component_handle, tasklet_info, instance_url):\n logger.debug(\"RwdtstaskletPython: do_instance_alloc function called\")\n... | [
"0.5350817",
"0.5327985",
"0.52336276",
"0.5226912",
"0.5202286",
"0.5202286",
"0.51049644",
"0.50976795",
"0.5095009",
"0.503112",
"0.49582475",
"0.49424207",
"0.49419457",
"0.49353817",
"0.49280187",
"0.49139977",
"0.49038336",
"0.48959026",
"0.4893753",
"0.4891488",
"0.483... | 0.5343541 | 1 |
Called on the particular Update endpoint. Rolls forward the update in state from { ROLLING_FORWARD, ROLLING_BACK, PAUSED }. Noop if invoked in state ROLLED_OUT. | def Rollforward(self, request, global_params=None):
config = self.GetMethodConfig('Rollforward')
return self._RunMethod(
config, request, global_params=global_params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward( self ):\n self._has_change = True\n print( \"Forward\" )",
"def advance_rollout(\n self,\n ) -> Callable[\n [cloud_deploy.AdvanceRolloutRequest], cloud_deploy.AdvanceRolloutResponse\n ]:\n # Generate a \"stub function\" on-the-fly which will actually make\n ... | [
"0.56352866",
"0.5567839",
"0.5535419",
"0.55207354",
"0.5331046",
"0.52234167",
"0.51932794",
"0.5179471",
"0.51519614",
"0.5133532",
"0.51194626",
"0.5118304",
"0.5112777",
"0.5097145",
"0.5097145",
"0.5052831",
"0.50388753",
"0.50293326",
"0.5008456",
"0.49904403",
"0.4989... | 0.5932124 | 0 |
Wraps a method to catch exceptions related to servers. This decorator wraps a method to catch any exceptions having to do with a server that may get thrown. It then logs a server fault in the db. | def wrap_server_fault(function):
@functools.wraps(function)
def decorated_function(self, context, *args, **kwargs):
try:
return function(self, context, *args, **kwargs)
except exception.ServerNotFound:
raise
except Exception as e:
kwargs.update(dict(z... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate_server_exception(method):\n\n @functools.wraps(method)\n def wrapper(self, ctx, instance_id, *args, **kwargs):\n try:\n res = method(self, ctx, instance_id, *args, **kwargs)\n return res\n except nova_exception.ClientException as e:\n if isinstance... | [
"0.72661984",
"0.6816547",
"0.65445817",
"0.6539314",
"0.65099335",
"0.64723104",
"0.63897085",
"0.63262355",
"0.6210573",
"0.61864215",
"0.61529225",
"0.6152908",
"0.61398816",
"0.6100137",
"0.60764253",
"0.6038935",
"0.6008978",
"0.6002133",
"0.59757566",
"0.59751046",
"0.5... | 0.7850816 | 0 |
Align server power state between the database and hypervisor. If the server is not found on the hypervisor, but is in the database, then a stop() API will be called on the server. | def _sync_server_power_state(self, context, db_server,
node_power_state):
# We re-query the DB to get the latest server info to minimize
# (not eliminate) race condition.
db_server.refresh()
db_power_state = db_server.power_state
if db_server.st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sync_instance_power_state(self, context, db_instance, vm_power_state,\n use_slave=False):\n\n # We re-query the DB to get the latest instance info to minimize\n # (not eliminate) race condition.\n db_instance.refresh(use_slave=use_slave)\n db_power... | [
"0.6589169",
"0.61406416",
"0.60706633",
"0.5687525",
"0.5668818",
"0.5509401",
"0.5507918",
"0.54989964",
"0.5371962",
"0.5256692",
"0.5197831",
"0.512389",
"0.50778157",
"0.50768054",
"0.5057652",
"0.5054226",
"0.50536215",
"0.5030139",
"0.50283027",
"0.50092643",
"0.498148... | 0.68366224 | 0 |
Align maintenance states between the database and the hypervisor. | def _sync_maintenance_states(self, context):
try:
nodes = self.driver.get_maintenance_node_list()
except Exception as e:
LOG.warning(
"Failed to retrieve node list when synchronizing "
"maintenance states: %(msg)s" % {"msg": e})
# Just... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maintenance_enter(cls):\n d = directory.connect()\n host = socket.gethostname()\n for attempt in range(3):\n log.info(\"request-evacuation\")\n evacuated = d.evacuate_vms(host)\n if not evacuated:\n # need to call evacuate_vms again to arrive... | [
"0.58716285",
"0.5429699",
"0.53484654",
"0.531434",
"0.52485305",
"0.5224636",
"0.51890564",
"0.51802427",
"0.51659006",
"0.514581",
"0.50961065",
"0.50684994",
"0.5018292",
"0.5010251",
"0.49864325",
"0.49699637",
"0.49496368",
"0.49390718",
"0.49189684",
"0.48539105",
"0.4... | 0.6078129 | 0 |
Set power state for the specified server. | def set_power_state(self, context, server, state):
fsm = utils.get_state_machine(start_state=server.status)
@utils.synchronized(server.uuid)
def do_set_power_state():
LOG.debug('Power %(state)s called for server %(server)s',
{'state': state,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_power_state(self, node, power_state):",
"def _set_power_state(node, target_state):\n amt_common.awake_amt_interface(node)\n client = amt_common.get_wsman_client(node)\n\n method = 'RequestPowerStateChange'\n options = pywsman.ClientOptions()\n options.add_selector('Name', 'Intel(r) AMT Pow... | [
"0.71626437",
"0.71340543",
"0.69831395",
"0.69594836",
"0.6757203",
"0.6678911",
"0.6661659",
"0.65663755",
"0.6515727",
"0.6465062",
"0.6440427",
"0.6371784",
"0.63406837",
"0.62975854",
"0.6286412",
"0.62427014",
"0.62173647",
"0.6208868",
"0.6116122",
"0.6094382",
"0.6077... | 0.8558594 | 0 |
Perform rebuild action on the specified server. | def _rebuild_server(self, context, server, preserve_ephemeral):
self.driver.rebuild(context, server, preserve_ephemeral) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebuild_server(self, server_id):\n response = self._api_request(\n endpoint='application/servers/{}/rebuild'.format(server_id),\n mode='POST')\n return response",
"def rebuild_server(self, context, server, preserve_ephemeral):\n LOG.debug('Rebuilding server: %s', se... | [
"0.71731645",
"0.68236643",
"0.61397624",
"0.6127121",
"0.58281523",
"0.549903",
"0.54321647",
"0.53830284",
"0.53402567",
"0.53074616",
"0.52963567",
"0.5223265",
"0.5146473",
"0.51364803",
"0.50716007",
"0.5024313",
"0.49923334",
"0.4962425",
"0.49247548",
"0.49064425",
"0.... | 0.69436526 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.