query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Change the default mute time for the first warning
async def mutetime(self, ctx): self.data_check(ctx) server = ctx.message.server await self.bot.say("Please make sure to set the time with the correct time prefix at the end. (*For minutes 'm', for hours 'h'*)\n\nPlease type your timeframe now.") muteroletime = await self.bot.wai...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def silly(self):\n print(\"you are getting silly\")\n # 设置时效\n return self._silly if time.localtime(time.time() - self._old_time ).tm_sec < 3 else \"\"", "def mute(self, msg, args):\n if self.mute:\n self.mute=False\n return \"Yay, I can make noise again!\"\n ...
[ "0.66379887", "0.6583036", "0.64880043", "0.63759774", "0.62538433", "0.60617256", "0.60417205", "0.6041509", "0.6038213", "0.6004945", "0.5958664", "0.5876604", "0.5873818", "0.58582634", "0.58320916", "0.5804905", "0.5799879", "0.57906103", "0.5782425", "0.577126", "0.57208...
0.6570229
2
Change the default logging channel
async def defchannel(self, ctx, channel: str): self.data_check(ctx) server = ctx.message.server self.riceCog2[server.id]["defchannel"] = channel dataIO.save_json(self.warning_settings, self.riceCog2) await self.bot.say("Log channel is now: **{}**".format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def log_channel(self, ctx, channel: discord.TextChannel = None):\n if not channel:\n channel = ctx.channel\n await self.config.logChannel.set(channel.id)\n await ctx.send(f\"Set {channel.mention} as the log channel.\")", "def default_channel(self) -> int:\r\n ...", ...
[ "0.7123847", "0.70175403", "0.6570255", "0.64830387", "0.6332038", "0.62707037", "0.624868", "0.62426305", "0.6212537", "0.61848", "0.61565435", "0.61294556", "0.6108638", "0.609223", "0.60079396", "0.600422", "0.59899", "0.59881955", "0.59796906", "0.5962758", "0.5903139", ...
0.6254462
6
Change the default mute channel
async def mutechannel(self, ctx, channel: str): self.data_check(ctx) server = ctx.message.server self.riceCog2[server.id]["mutechannel"] = channel dataIO.save_json(self.warning_settings, self.riceCog2) await self.bot.say("Mute channel is now: **{}**".for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mute():\n request_command(tv_command=TVCommand.mute)", "def default_channel(self) -> int:\r\n ...", "def set_mute(self, track, xclip, ident, value = None):\n if track in self.song().tracks + self.song().return_tracks:\n if value in KEYWORDS:\n track.mute = KEYWORD...
[ "0.7295328", "0.6866574", "0.6760169", "0.6758767", "0.6718204", "0.6717659", "0.6620619", "0.66025364", "0.6576043", "0.6554529", "0.65053433", "0.6501649", "0.63496584", "0.63457906", "0.6340219", "0.6328525", "0.63152057", "0.6284532", "0.62723064", "0.6257629", "0.6211458...
0.70745873
1
Enable/disable poop emojis per warning.
async def poop(self, ctx): self.data_check(ctx) server = ctx.message.server true_msg = "Poop emojis per warning enabled." false_msg = "Poop emojis per warning disabled." if 'poop' not in self.riceCog2[server.id]: self.riceCog2[server.id]['poop'] = True msg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warning(msg):\n click.secho(msg, fg='yellow')", "def setwarnings(self, on):\n # diese Funktion macht eigentlich nichts, ist aber wegen der Kombatibilitaet vorhanden\n print(f\"setwarnings: {on}\")", "def set_warning_message(msg):\n set_message(msg, TYPE_WARNING)", "def has_off_hoo...
[ "0.63431257", "0.6311446", "0.621013", "0.6048843", "0.5918886", "0.58901507", "0.5880735", "0.5856378", "0.58473855", "0.5842127", "0.57939774", "0.57764214", "0.570237", "0.5690204", "0.5689262", "0.5648402", "0.5623375", "0.5589387", "0.5582981", "0.5559005", "0.55539805",...
0.6676167
0
Sets the max amount of warnings before banning.
async def max(self, ctx, limit: int): self.data_check(ctx) server = ctx.message.server self.riceCog2[server.id]["max"] = limit dataIO.save_json(self.warning_settings, self.riceCog2) await self.bot.say("Warn limit is now: \n{}".format(limit))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_limit(self, errors):\n self.limit = errors", "def fail_max(self, number: int) -> None:\n self._fail_max = number", "def _set_maximum(self):\n self._level_gen.maximum_length = self._maximum_length_spinbox.value()\n self._refresh_view()", "def setMaxValue(self, max_value):\r...
[ "0.654042", "0.6494923", "0.63911724", "0.6374496", "0.6374496", "0.6314424", "0.6293381", "0.6276372", "0.6223776", "0.6200474", "0.61566263", "0.61486197", "0.6118835", "0.61178505", "0.60785073", "0.60785073", "0.6045971", "0.5990604", "0.59866846", "0.5978304", "0.5973961...
0.6651524
0
Resets all the warnings settings for this server
async def reset(self, ctx): self.data_check(ctx) server = ctx.message.server author = ctx.message.author channel = ctx.message.channel await self.bot.say("Are you sure you want to reset all warn settings" "for this server?\n" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_vo_warnings():\n from . import converters, xmlutil\n\n # -----------------------------------------------------------#\n # This is a special variable used by the Python warnings #\n # infrastructure to keep track of warnings that have #\n # already been seen. Since we want to ...
[ "0.68874204", "0.65978855", "0.6572569", "0.6325455", "0.63219196", "0.62956953", "0.6222221", "0.61653787", "0.61171895", "0.6100748", "0.6072838", "0.60411966", "0.60370195", "0.60248387", "0.6020337", "0.6015415", "0.5992785", "0.59782493", "0.5889527", "0.5887495", "0.587...
0.66391146
1
Warns the user At 3 warnings the user gets banned
async def warn(self, ctx, user: discord.Member, *, reason: str=None): self.data_check(ctx) server = ctx.message.server author = ctx.message.author channel = ctx.message.channel can_ban = channel.permissions_for(server.me).ban_members can_role = channel.permissions_for(se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def setwarns(self, ctx, user: discord.Member, warnings: int = None):\r\n server = ctx.message.guild\r\n await self._create_warn(server, user)\r\n dataIO.save_json(self.JSON, self.data)\r\n if not warnings:\r\n del self.data[str(server.id)][\"user\"][str(user.id)]\r\n ...
[ "0.73200387", "0.72034127", "0.71872264", "0.69826597", "0.6793577", "0.6774889", "0.65756017", "0.65171593", "0.6483029", "0.6480283", "0.6455941", "0.64477074", "0.6436571", "0.6379987", "0.63394743", "0.633801", "0.6293068", "0.62342507", "0.6227732", "0.61947626", "0.6164...
0.6653829
6
Lists all the warnings on the server
async def warnings(self, ctx): server = ctx.message.server server_id = server.id if not (server_id in self.warnlist2 and self.warnlist2[server_id]): await self.bot.say("No users are currently punished.") return def getmname(mid): member = discord.util...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warnings(self) -> List[Error]:", "def show_warnings(self):\n for w in self.warnings:\n w()", "def print_warning_msgs():\n for err in TypeWarning.warnings:\n print err", "def warnings():\n return THE_LOGGER.warnings", "def get_warning(self) -> List[str]:\n r...
[ "0.770456", "0.7598134", "0.7593386", "0.7340377", "0.7319255", "0.7319255", "0.72906804", "0.7103081", "0.7013889", "0.6998929", "0.6975232", "0.6870305", "0.68418103", "0.6832613", "0.66837364", "0.66837364", "0.66837364", "0.66837364", "0.66837364", "0.66837364", "0.668373...
0.6996399
10
Removes all punishments from a user
async def clean(self, ctx, user: discord.Member): self.data_check(ctx) author = ctx.message.author server = author.server colour = server.me.colour channel = ctx.message.channel can_role = channel.permissions_for(server.me).manage_roles count = self.riceCog[server...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_from_all(self, user_id):\n self.execute(TABELLE['id_users']['delete'], (user_id,))\n self.execute(TABELLE['users']['delete'], (user_id,))\n self.execute(TABELLE['punteggio']['delete'], (user_id,))\n self.execute(TABELLE['items']['delete'], (user_id,))", "async def unplonk(c...
[ "0.64281267", "0.6228037", "0.6227883", "0.6175988", "0.61447144", "0.6088965", "0.6023362", "0.5999493", "0.59890753", "0.59781593", "0.59617126", "0.59501857", "0.5919693", "0.59084785", "0.5895613", "0.587975", "0.58487785", "0.5806367", "0.58034843", "0.5787534", "0.57505...
0.5381608
69
Denies a user from the channel
async def deny(self, ctx, user: discord.Member, *, reason: str=None): self.data_check(ctx) server = ctx.message.server try: defchannel = self.riceCog2[server.id]["defchannel"] except: defchannel = default_channel try: channelmute = self.riceCog...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def disable_channel(self, ctx, *channels: discord.TextChannel):\n channels = channels or (ctx.channel, )\n await ctx.guild_profile.permissions.disable_channels(channels)\n await ctx.send_line(f\"{ctx.emotes.web_emotion.galka} Bot commands and messages has been disabled in specified ch...
[ "0.69338185", "0.68326753", "0.682705", "0.6726867", "0.6698459", "0.6673625", "0.66391855", "0.6590681", "0.65880615", "0.65470666", "0.64331543", "0.6412375", "0.6392064", "0.6370616", "0.63519317", "0.6321365", "0.62852055", "0.6254562", "0.6250523", "0.62453526", "0.61793...
0.74400556
0
Allows a user access to the bnl_discussion channel
async def approve(self, ctx, user: discord.Member): server = ctx.message.server if user.id in self.norole[server.id]: if self.norole[server.id][user.id]['Role'] == True: self.norole[server.id][user.id] = {'Role': False} dataIO.save_json(self.warninglist, self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discussion(cls, user, discussion):\r\n pass", "def discussion(cls, user, discussion):\n pass", "async def botlink(self, ctx):\n async with self.bot.pool.acquire() as conn:\n async with conn.cursor() as cur:\n await cur.execute('SELECT * FROM BLChan...
[ "0.68737555", "0.67139", "0.5716766", "0.5675577", "0.56679726", "0.5620264", "0.56127846", "0.5564718", "0.55637026", "0.5539591", "0.55162585", "0.54908", "0.5459859", "0.5437428", "0.5426162", "0.5424382", "0.54140466", "0.54035497", "0.53987765", "0.5396581", "0.5392257",...
0.0
-1
Schedules role removal, canceling and removing existing tasks if present
def schedule_unpunish(self, delay, member, reason=None): sid = member.server.id if sid not in self.handles: self.handles[sid] = {} if member.id in self.handles[sid]: self.handles[sid][member.id].cancel() coro = self._unpunish(member, reason) handle = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def roledelete(ctx):\r\n await ctx.message.delete()\r\n roles = ctx.guild.roles\r\n roles.pop(0)\r\n for role in roles:\r\n if ctx.guild.roles[-1] > role:\r\n try:\r\n await role.delete()\r\n except:\r\n print(f\"{Fore.RED}[-]ROLE => {For...
[ "0.6023666", "0.60126626", "0.59995973", "0.59774405", "0.5944388", "0.58934695", "0.5858924", "0.5806225", "0.5774572", "0.5719673", "0.5700328", "0.5695284", "0.56681573", "0.5636263", "0.5624972", "0.5621472", "0.56126857", "0.5593397", "0.5568072", "0.5551183", "0.5547398...
0.0
-1
Remove punish role, delete record and task handle
async def _unpunish(self, member, reason=None): role = await self.get_role(member.server) if role: # Has to be done first to prevent triggering on_member_update listener self._unpunish_data(member) await self.bot.remove_roles(member, role) msg = 'Your pun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_role(self):\n pass", "async def deleterole(self, ctx: context.CustomContext, *, role: str):\n\n try:\n selfrole = await Fuzzy[Selfrole].convert(ctx, role)\n except exceptions.NotFoundError:\n return await ctx.send(\n f\"{config.NO} This se...
[ "0.6754979", "0.6515037", "0.6429094", "0.6345236", "0.6264911", "0.6248515", "0.6244448", "0.6150403", "0.61425376", "0.6130304", "0.6115016", "0.60911036", "0.60828775", "0.6081296", "0.6076873", "0.60755014", "0.6073987", "0.6072258", "0.60537714", "0.603652", "0.59932363"...
0.5746151
36
Removes punish data entry and cancels any present callback
def _unpunish_data(self, member): sid = member.server.id if sid in self.json and member.id in self.json[sid]: del(self.json[member.server.id][member.id]) self.save() if sid in self.handles and member.id in self.handles[sid]: self.handles[sid][member.id].cance...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel():", "def cancel(self):", "def cancel(self):", "def cancel(self):", "def cancel_callback(self):\n pass", "def cancel(self, membership, callback=None):", "def do_uncancel(self):\r\n self.write({'cancelled': False})", "def cancel(self):\n pass", "def cancel(self):\n ...
[ "0.6778489", "0.6743055", "0.6743055", "0.6743055", "0.6619101", "0.64514035", "0.6446926", "0.64341253", "0.6416389", "0.6308036", "0.624216", "0.61661917", "0.6153994", "0.61392665", "0.61392665", "0.612689", "0.6091708", "0.6091708", "0.6056875", "0.6044779", "0.6020259", ...
0.67897874
0
Remove scheduled unpunish when manually removed
async def on_member_update(self, before, after): sid = before.server.id if not (sid in self.json and before.id in self.json[sid]): return role = await self.get_role(before.server) if role and role in before.roles and role not in after.roles: #msg += '\nReason...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unschedule(self):\n response = self._post(self.uri_for(\"unschedule\"), json.dumps({}))", "def unscheduleFirst(self, runnable):\n for evt in self.store.query(TimedEvent, TimedEvent.runnable == runnable, sort=TimedEvent.time.ascending):\n evt.deleteFromStore()\n break", "...
[ "0.65993714", "0.6590679", "0.6510555", "0.63896346", "0.6339781", "0.6323853", "0.6283453", "0.61468333", "0.6144455", "0.6100997", "0.6029448", "0.5999924", "0.5970732", "0.5928961", "0.59059906", "0.5892993", "0.58476305", "0.58239007", "0.5790643", "0.5781604", "0.5774017...
0.0
-1
Run when new channels are created and set up role permissions
async def on_channel_create(self, channel): if channel.is_private: return role = await self.get_role(channel.server) if not role: return await self.setup_channel(channel, role)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def setup(self, ctx):\n\n role = discord.utils.get(ctx.guild.roles, name=\"Muted\")\n if role is None:\n return await ctx.send(\"Please create a role named Muted first.\")\n\n for channel in ctx.guild.channels:\n if isinstance(channel, CategoryChannel) or not channe...
[ "0.7146165", "0.68709385", "0.6730583", "0.6636552", "0.6552904", "0.65434235", "0.65048385", "0.64970624", "0.6481724", "0.6449556", "0.62814", "0.6266619", "0.6255693", "0.61546755", "0.60685056", "0.6037555", "0.5989652", "0.59686875", "0.595024", "0.5941272", "0.5921272",...
0.7162985
0
Restore punishment if punished user leaves/rejoins
async def on_member_join(self, member): sid = member.server.id role = await self.get_role(member.server) try: muterole = self.riceCog2[server.id]["muterole"] except: muterole = default_muterole if 'poop' in self.riceCog2[sid]: if self.riceCo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recover(self):\n self.deleted = False\n self.save()\n self.history.create(user_id=self.pk, action=user_history.RECOVERY)", "async def _unpunish(self, member, reason=None):\n role = await self.get_role(member.server)\n if role:\n # Has to be done first to prevent ...
[ "0.6033315", "0.56965053", "0.56557405", "0.56493556", "0.5620881", "0.55810016", "0.5569586", "0.55600715", "0.55598843", "0.55538255", "0.54892564", "0.5457121", "0.5444458", "0.54241955", "0.5418076", "0.5417032", "0.53982425", "0.5396927", "0.5362948", "0.5351537", "0.534...
0.0
-1
Shimazaki and Shinomoto's choice
def SAS(sampled_data, n_min=1, n_max=50): x_max = max(sampled_data) x_min = min(sampled_data) N_MIN = n_min N_MAX = n_max N = range(N_MIN,N_MAX) N = np.array(N) D = (x_max-x_min)/N C = np.zeros(shape=(np.size(D),1)) plt.figure() temp_graph = plt.subplot(1,1,1) for i in r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _choose_best_option(self):", "def decide():", "def __test_choice(L, S, A, R, Y):\n return choice(Y)", "def get_choice(choice):\r\n return {\r\n '0': ('Extraversion', 0.07),\r\n '1': ('Neuroticism', 0.27),\r\n '2': ('Agreeableness', 0.11),\r\n '3': ('Conscientiousness', 0...
[ "0.7283886", "0.6947463", "0.6828651", "0.6736359", "0.66919434", "0.65468824", "0.6509814", "0.6373513", "0.63357234", "0.6327337", "0.6324117", "0.6299979", "0.62955266", "0.62520784", "0.62315863", "0.621866", "0.6199326", "0.6176579", "0.6163692", "0.6154443", "0.61443794...
0.0
-1
Check username is valid or not
def _check_username(self, username): if self.username_regex.search(username) is not None: print("Correct username") return True else: print("Wrong username") return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_username(u):\n return u and USER_RE.match(u)", "def verify_username(entered_username):\n return USER_RE.match(entered_username)", "def is_valid_username(self, username):\n rex = \"^[a-zA-Z]{3,}$\"\n return re.match(rex, username)", "def validate_username(username):\r\n\r\n\t\tmi...
[ "0.8540924", "0.84600514", "0.8454873", "0.8400678", "0.8395739", "0.8378274", "0.835083", "0.8337027", "0.833407", "0.8324205", "0.8316021", "0.8305803", "0.8281563", "0.82359076", "0.8227417", "0.81931025", "0.81915444", "0.81847", "0.8122291", "0.8110087", "0.8095193", "...
0.8756299
0
Check password is valid or not
def _check_password(self, password): if self.password_regex.search(password) is not None: print("Correct password") return True else: print("Wrong password") return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_password(self):\n pass_field = Field(\"\".join(['x' * (int(self.app.config['MAX_PWD_LEN']))]))\n\n valid_password(None, pass_field)", "def is_password_valid(password):\n #TODO : This should also be handled by the front_end\n pass", "def validate_password(data):\n\n ...
[ "0.8513757", "0.8485963", "0.8283479", "0.8146151", "0.8137212", "0.8133873", "0.8050052", "0.80201", "0.80132633", "0.79668003", "0.79447955", "0.7942233", "0.7933791", "0.7915177", "0.7904527", "0.7900205", "0.7898659", "0.78936994", "0.7889744", "0.78833944", "0.78769594",...
0.84296614
2
Compute the transition / transversion ratio between 2 sequences.
def transition_transversion_ratio(sequences): transitions, transversions = 0, 0 for a1, a2 in zip(*sequences): if a1 != a2: #  Transition if a1 in "AG" and a2 in "AG" or a1 in "CT" and a2 in "CT": transitions += 1 # Transversion else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transition_transversion_ratio(dna1: str, dna2: str):\n transition, transversion = transition_transversion(dna1, dna2)\n return transition / transversion", "def exchange_ratio(delta_x, salience, power, dominator):\n\treturn (delta_x * salience * power) / dominator", "def _transition_prob(self, s1, a, ...
[ "0.8323357", "0.62570876", "0.6213251", "0.61981666", "0.6193696", "0.61392045", "0.61392045", "0.6120389", "0.6106429", "0.6084141", "0.6046681", "0.6008842", "0.60011595", "0.59921587", "0.598164", "0.5934761", "0.589579", "0.58842206", "0.5883075", "0.5879665", "0.5867718"...
0.7914035
1
x1, y1 = p1 x2, y2 = p2 return abs(x1 x2) + abs(y1 y2)
def h(p1, p2): # returns diagonal distance x1, y1 = p1 x2, y2 = p2 dx = abs(x1 - x2) dy = abs(y1 - y2) d = 1 # distance between spots d2 = 1 # diagonal distance between spots h = d * (dx + dy) + (d2 - 2 * d) * min(dx, dy) return h
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Dist(p1,p2):\n x1, y1 = p1\n x2, y2 = p2\n return (((x1-x2)*(x1-x2)) + ((y1-y2)*(y1-y2)))**0.5", "def add(self, p1, p2):\n if p1 is None:\n return p2\n if p2 is None:\n return p1\n x1, y1 = p1\n x2, y2 = p2\n if x1 != x2:\n l = self.div_mod_...
[ "0.7514179", "0.74884844", "0.7328659", "0.73015", "0.72653985", "0.7218041", "0.7197124", "0.7157154", "0.71298754", "0.70463127", "0.69635034", "0.69025075", "0.6884231", "0.6866224", "0.67430687", "0.66654086", "0.66528803", "0.6624981", "0.6623209", "0.66115046", "0.66099...
0.0
-1
Initialize a new game.
def new_game(secret_words): attempts=0 word_index = random.randint(0,5) word_to_guess = secret_words[word_index] global mask mask = " _ " * len(secret_words[word_index]) get_input(mask, word_to_guess, user_guesses, attempts, valid_characters, secret_words) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_new_game(self):\n self.game = get_new_game(self.game_config)", "def setup_new_game(self):\r\n self._player = Player()\r\n self._stats = GameStats(self._bb_settings)\r\n self._scoreboard = Scoreboard(self._bb_settings, self._screen)", "def load_game(self):\n game = Ga...
[ "0.8598125", "0.78166926", "0.7622557", "0.7434642", "0.73941463", "0.7344312", "0.73376274", "0.7317985", "0.731301", "0.7292318", "0.72766113", "0.727473", "0.72455007", "0.72032773", "0.7197643", "0.7160199", "0.71532536", "0.7144683", "0.70920235", "0.70626044", "0.700476...
0.0
-1
Receive an imput from the command line
def get_input(mask, word_to_guess, user_guesses, attempts, valid_characters, secret_words): print "\n The word to guess is: ", mask print "\n # of attempts: ", attempts print "\n Insert a letter or a number \n" the_guess = raw_input() the_guess = the_guess.lower() # Check if the input is a valid character vali...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli() -> None:", "def cli() -> None:", "def cmd_appe(args):", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "def cli():", "de...
[ "0.6974208", "0.6974208", "0.69427896", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", "0.6826325", ...
0.0
-1
Generates the mask of the word from the given user_guesses
def calculate_mask(user_guesses, word_to_guess): global mask mask = "" for x in range(0, len(word_to_guess)): if (user_guesses.find(word_to_guess[x]) >= 0): mask += " " + word_to_guess[x] + " " else: mask += " _ " return mask
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_game(secret_words):\n\n\tattempts=0\n\tword_index = random.randint(0,5)\n\tword_to_guess = secret_words[word_index]\n\tglobal mask\n\tmask = \" _ \" * len(secret_words[word_index])\n\tget_input(mask, word_to_guess, user_guesses, attempts, valid_characters, secret_words)\n\treturn", "def word_dropout_mask...
[ "0.6145267", "0.55371237", "0.5457871", "0.544683", "0.5324564", "0.5304264", "0.5295999", "0.5285798", "0.5249013", "0.5234574", "0.5182182", "0.51685196", "0.51628315", "0.51548034", "0.51431024", "0.51308537", "0.5128906", "0.5116537", "0.51101696", "0.50996196", "0.502091...
0.8276276
0
CHeck if the characters inserted by the user is valid
def check_validity(the_guess, valid_characters, user_guesses): validity = True if valid_characters.find(the_guess) < 0 or len(the_guess) != 1 or the_guess in user_guesses: validity = False return validity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_input_valid(char):\n\n # is there a char at all?\n if char is None:\n return False\n\n # check for embedded 0 byte\n if char == \"\\0\":\n return False\n\n return True", "def is_char(user_input):\n # Check lenght of input and if equal to zero return True\n if len(user_in...
[ "0.71006495", "0.70651245", "0.7021906", "0.696923", "0.6923487", "0.68594867", "0.683265", "0.6832604", "0.6829832", "0.67743623", "0.6735952", "0.6682364", "0.6629439", "0.6622188", "0.6613909", "0.6585236", "0.6564499", "0.65518546", "0.6546012", "0.6535175", "0.6534172", ...
0.63602495
30
Check if the caracter inserted by the user is correct
def check_if_guessed(the_guess, word_to_guess): return word_to_guess.find(the_guess)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verificacionUser(nom_usuario):\n \"\"\"La cuenta de usuario solo puede contener:\n - caracteres alfanumericos\n - '-', '_' o '.' \"\"\"\n nom_usuario = str(nom_usuario)\n nom_usuario = nom_usuario.strip()\n nom_usuario = nom_usuario.lower()\n car_validos = 'abc...
[ "0.6732721", "0.64819086", "0.645428", "0.6416279", "0.6403947", "0.63083667", "0.62825984", "0.6218904", "0.620671", "0.6171783", "0.61620474", "0.6136309", "0.6119173", "0.61012673", "0.6080146", "0.60448575", "0.6029895", "0.6012953", "0.60089844", "0.59767014", "0.5974265...
0.0
-1
Check if the user has won. If this is the case it ask to play another game
def check_if_won(user_guesses, word_to_guess,secret_words): you_won = True for x in range(0, len(word_to_guess)): if (user_guesses.find(word_to_guess[x]) < 0): you_won = False return you_won print "Congatulation! You won!" ask_if_new_game(secret_words) return you_won
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_game(self):\n gameOver = None\n if self.turn > 4:\n gameOver = self.check_x_won()\n if gameOver is True:\n self.game_x_won()\n return\n\n gameOver = None\n if self.turn > 5:\n gameOver = self.check_o_won()\n ...
[ "0.7750501", "0.7455842", "0.7404545", "0.73637086", "0.73528016", "0.7265466", "0.72590464", "0.7169383", "0.7153702", "0.7115263", "0.7109775", "0.71027946", "0.7097829", "0.7071012", "0.7058683", "0.7043653", "0.70395255", "0.7026819", "0.7018871", "0.7011866", "0.6983202"...
0.6643391
63
Check if the user has won. If this is the case it ask to play another game
def check_if_lost(attemtps, secret_words): you_lost = False if attemtps > 5: you_lost = True print "Sorry! You lost!" ask_if_new_game(secret_words) return you_lost
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_game(self):\n gameOver = None\n if self.turn > 4:\n gameOver = self.check_x_won()\n if gameOver is True:\n self.game_x_won()\n return\n\n gameOver = None\n if self.turn > 5:\n gameOver = self.check_o_won()\n ...
[ "0.7751878", "0.7459013", "0.7405479", "0.736339", "0.7353561", "0.7265414", "0.72591054", "0.71714664", "0.71556187", "0.71167594", "0.7111432", "0.71062547", "0.7098613", "0.7071893", "0.705954", "0.7042245", "0.70392007", "0.702907", "0.7018693", "0.7011278", "0.69866407",...
0.0
-1
Ask if the user wants to play another game. If yes it restart the game otherwise it returns and stop the game
def ask_if_new_game(secret_words): print "Do you want to play another game? [y/n]" answer = raw_input() if answer not in ["y","n"]: print "Invalid input, press y or n!" ask_if_new_game(secret_words) if answer == "y": new_game(secret_words) else: return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restart_game(self):\n self.play()", "def restart_game():\r\n restart = input(\"Would you like to play again?\\n(y/n):\")\r\n if restart.lower() == \"y\" or restart.lower() == \"yes\":\r\n print(\"\\nStarting New Game!\\n\")\r\n self.scores = {\"p1\":...
[ "0.79459476", "0.7687364", "0.7584438", "0.74871814", "0.74162066", "0.7377489", "0.73724014", "0.73639697", "0.7358792", "0.7358536", "0.73577714", "0.734458", "0.73211443", "0.7264979", "0.72633296", "0.7216783", "0.7171194", "0.7162247", "0.71459764", "0.7112116", "0.70991...
0.6575317
57
Iterable interface to support unpacking. Like a tuple.
def __iter__(self) -> Iterable[Union[Point, LabwareLike]]: return iter( ( self._point, self._labware, ) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_pairs(iterable):\n if isinstance(iterable, Mapping):\n iterable = iterable.items()\n return iter(iterable)", "def item_iter(self, *a):\r\n raise NotImplementedError", "def __iter__(self) -> Iterable[Tuple[float, float]]:\n return iter([self.x, self.y])", "def __iter__(self...
[ "0.6762171", "0.67600924", "0.6672998", "0.6648962", "0.6479138", "0.6322109", "0.6283933", "0.6281331", "0.6281331", "0.6281331", "0.6281331", "0.6275325", "0.6266078", "0.62508196", "0.6227764", "0.62108773", "0.62108773", "0.62108773", "0.62108773", "0.62108773", "0.618774...
0.5991988
38
Alter the point stored in the location while preserving the labware. This returns a new Location and does not alter the current one. It should be used like
def move(self, point: Point) -> "Location": return Location(point=self.point + point, labware=self._given_labware)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_new_location(self, xPos, yPos):", "def modifyPoint(self, *args, **kwargs):\n ...", "def m_location_set(self, x: int, y: int):\n pass", "def location(self, value: 'Point'):\n self.geometry.location = value", "def recenter(self, point=(0, 0)):\n self.center = Point(*point)...
[ "0.661706", "0.63484883", "0.6068533", "0.5985974", "0.59611905", "0.5945547", "0.58425283", "0.5842109", "0.581971", "0.5759998", "0.5724651", "0.5713874", "0.5662971", "0.56431365", "0.56431365", "0.5604625", "0.5598623", "0.5560133", "0.55441254", "0.5518262", "0.5507544",...
0.65251315
1
Convert from Mount to MountType.
def from_hw_mount(mount: Mount) -> MountType: mount_map = {Mount.LEFT: MountType.LEFT, Mount.RIGHT: MountType.RIGHT} return mount_map[mount]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_mount(self, pipette_id: str) -> MountType:\n return self.get(pipette_id).mount", "def getmount_fstype(mypath):\n\n mountpoint = getmount(mypath)\n return get_fs_type(mountpoint)", "def _map_disk_type(cls, str_, bytes_):\n if cls._disk_type is str:\n return str_\n e...
[ "0.5845511", "0.5704253", "0.5299916", "0.52844036", "0.5283897", "0.52315843", "0.5139465", "0.50554425", "0.49810398", "0.49688968", "0.49646065", "0.49543053", "0.49525708", "0.4931082", "0.49108684", "0.48887324", "0.4857151", "0.4855912", "0.4779727", "0.47393698", "0.47...
0.6864618
0
Return this deck slot as an OT2style integer. For example, `SLOT_5.as_int()` and `SLOT_C2.as_int()` are both `5`.
def as_int(self) -> int: return int(self.to_ot2_equivalent().value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_int2(self):\n pass", "def to_int(self) -> int:\n return self.as_int", "def _to_int(self, int_or_card):\r\n if isinstance(int_or_card, Card):\r\n return int_or_card.rank\r\n return int_or_card", "def as_int(self):\n return self.as_type(int)", "def __int_...
[ "0.6547093", "0.63039523", "0.6207353", "0.6067822", "0.59474325", "0.58910245", "0.58675194", "0.572092", "0.5703209", "0.56286436", "0.55955744", "0.5529529", "0.54366064", "0.54061234", "0.53951293", "0.53948313", "0.53841794", "0.5375675", "0.53724205", "0.5355614", "0.53...
0.6906462
0
Return the OT2 deck slot that's in the same place as this one. For example, `SLOT_C2.to_ot3_equivalent()` is `SLOT_5`. If this is already an OT2 deck slot, returns itself.
def to_ot2_equivalent(self) -> DeckSlotName: return _ot3_to_ot2.get(self, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ot3_equivalent(self) -> DeckSlotName:\n return _ot2_to_ot3.get(self, self)", "def slot(self):\n if self.__slot in ApexAP1000.SLOTS:\n return self.__slot\n else:\n raise ValueError('Bad slot number !')", "def get_slot_component(cls, game_object: GameObject) -> U...
[ "0.6851262", "0.58110386", "0.5605592", "0.5500018", "0.5497896", "0.5495197", "0.54897475", "0.54409796", "0.5350285", "0.532955", "0.5259792", "0.51436996", "0.513631", "0.5116294", "0.5075363", "0.5049088", "0.5044446", "0.4984714", "0.4939728", "0.49273053", "0.49171132",...
0.74479717
0
Return the OT3 deck slot that's in the same place as this one. For example, `SLOT_5.to_ot3_equivalent()` is `SLOT_C2`. If this is already an OT3 deck slot, returns itself.
def to_ot3_equivalent(self) -> DeckSlotName: return _ot2_to_ot3.get(self, self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ot2_equivalent(self) -> DeckSlotName:\n return _ot3_to_ot2.get(self, self)", "def get_slot_definition(self, slot: DeckSlotName) -> SlotDefV3:\n deck_def = self.get_deck_definition()\n\n for slot_def in deck_def[\"locations\"][\"orderedSlots\"]:\n if slot_def[\"id\"] == slot...
[ "0.6961423", "0.5790581", "0.5603988", "0.5503632", "0.54033476", "0.53143436", "0.5178085", "0.5116715", "0.5105875", "0.50771475", "0.5001423", "0.49345815", "0.49188447", "0.4890326", "0.48857033", "0.4864505", "0.48465264", "0.47963408", "0.4761921", "0.47075292", "0.4696...
0.7585782
0
Return the deck slot, for the given robot type, that's in the same place as this one. See `to_ot2_equivalent()` and `to_ot3_equivalent()`.
def to_equivalent_for_robot_type(self, robot_type: RobotType) -> DeckSlotName: if robot_type == "OT-2 Standard": return self.to_ot2_equivalent() elif robot_type == "OT-3 Standard": return self.to_ot3_equivalent()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ot2_equivalent(self) -> DeckSlotName:\n return _ot3_to_ot2.get(self, self)", "def to_ot3_equivalent(self) -> DeckSlotName:\n return _ot2_to_ot3.get(self, self)", "def get_card(self, slot):\n return self._starting_card[slot]", "def slot(self):\n if self.__slot in ApexAP1000....
[ "0.57639176", "0.5484779", "0.5414658", "0.5228143", "0.52212596", "0.5173648", "0.51055133", "0.5066155", "0.50325835", "0.5013481", "0.49902755", "0.49877372", "0.4972233", "0.4970885", "0.49407965", "0.4862588", "0.4862588", "0.48622948", "0.48213482", "0.48135367", "0.472...
0.7401026
0
This slot's unique ID, as it appears in the deck definition. This can be used to look up slot details in the deck definition. This is preferred over `.value` or `.__str__()` for explicitness.
def id(self) -> str: return self.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slot(self):\n if self.__slot in ApexAP1000.SLOTS:\n return self.__slot\n else:\n raise ValueError('Bad slot number !')", "def unique_id(self) -> str:\n return self.get_unique_id(wallet=self.wallet_id, nonce=self.nonce)", "def unique_id(self):\n return _spac...
[ "0.699074", "0.6705826", "0.66845423", "0.66596943", "0.665877", "0.66267174", "0.65879273", "0.6586923", "0.65740407", "0.652181", "0.6519821", "0.6513885", "0.65122163", "0.6506125", "0.6506125", "0.6482951", "0.6482902", "0.6473385", "0.6457439", "0.6447112", "0.6447112", ...
0.68129075
1
Stringify to the unique ID. For explicitness, prefer using `.id` instead.
def __str__(self) -> str: return self.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_id() -> str:", "def unique_id(self) -> str:\n return \"{}-{}-{}\".format(*self._id)", "def id_str(self):\n if hasattr(self, 'id'):\n return str(self.id)\n else:\n return 'obj%s' % id(self)", "def makeid(cls):\n return str(uuid.uuid4().hex)", "def...
[ "0.7992248", "0.799199", "0.79288906", "0.7823293", "0.7818084", "0.7818084", "0.7721002", "0.7683557", "0.7611133", "0.7611133", "0.7611133", "0.7611133", "0.7611133", "0.7611133", "0.7611133", "0.7611133", "0.7608357", "0.75371075", "0.7510561", "0.75021845", "0.7396546", ...
0.0
-1
Validate that the email is not already in use.
def clean_email(self): try: user = User.objects.get(email__iexact=self.cleaned_data['email']) except User.DoesNotExist: return self.cleaned_data['email'] raise forms.ValidationError(_("A user with that email already exists."))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_email(self, email):\n if email.data != current_user.email:\n user = User.query.filter_by(email=email.data).first()\n if user:\n raise ValidationError('That email already exists. Please choose another email.')", "def clean_email(self):\n existing = U...
[ "0.7937491", "0.78997964", "0.78647095", "0.77658063", "0.77507335", "0.7686202", "0.76505077", "0.76505077", "0.7643141", "0.7542166", "0.7531488", "0.7512208", "0.749662", "0.7476814", "0.7466274", "0.74633485", "0.74148434", "0.73954046", "0.738715", "0.73804814", "0.73739...
0.6915044
42
Make sure that pytest accepts our fixture.
def test_bar_fixture(testdir): # create a temporary pytest test module testdir.makefile('hadoken.lp', """ % TEST: data-generation, two-in-one p(1..3). % TEST qrule: rule-q, two-in-one q(X): p(X). """) # # run pytest with the following cmd args result = testdir.runpytest( '-p asptest', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUpFixture(self):\n pass", "def _fixture_setup(self):\n pass", "def test_xfail_fixture(broken_fixture):\n pass", "def test_pytest():\n assert True", "def test_pytest():\n assert True", "def tearDownFixture(self):\n pass", "def fixtures():", "def test_setup(self):\n...
[ "0.75484395", "0.7266538", "0.71364397", "0.66730934", "0.66730934", "0.6598851", "0.6472178", "0.64693034", "0.6461597", "0.6433521", "0.6424723", "0.64113086", "0.63919973", "0.6341796", "0.62543505", "0.62461597", "0.623893", "0.6229556", "0.6194085", "0.61656237", "0.6165...
0.6541681
6
Initilize a Neural Network with Relu activation
def __init__(self, input_dim, output_dim, hidden_dim=100, num_layers=2, num_epochs=100, learning_rate=0.001, threshold=0.1): super(ReluNet, self).__init__() self.input_dim = input_dim self.output_dim = output_dim self.hidden_dim = hidden_dim self.num_laye...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_relu_activation(self):\n self.assertEqual([0, 0.5], list(\n af.Relu().output(np.array([-0.5, 0.5]))))\n self.assertEqual([0, 1], list(\n af.Relu().derivative(np.array([-0.5, 0.5]))))", "def setUp(self):\n self.OR_Neuron = Neuron([12, 12], Sigmoid().activate, bi...
[ "0.7209816", "0.68366754", "0.68006027", "0.6610276", "0.66101855", "0.65917623", "0.656505", "0.65629226", "0.65553737", "0.65376914", "0.6473628", "0.64719105", "0.6467027", "0.64669657", "0.6407283", "0.6388062", "0.6372672", "0.63701034", "0.6360551", "0.6339228", "0.6334...
0.7240907
0
Fit function to train the Relu network
def fit(self, train_loader, device): optimizer = optim.Adam(self.parameters(), lr=self.learning_rate) criterion = torch.nn.MSELoss(reduction='mean') max_epoch = self.num_epochs for epoch in range(max_epoch): self.train() train_epoch_loss = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trainNet():", "def fit(self, Xtrain, ytrain):\n self.Xtrain = Xtrain\n self.ytrain = ytrain\n\n max_nn = len(Xtrain)\n # initiate the class and fit the data\n self.knn = neighbors.KNeighborsRegressor(max_nn, weights=self.weights)\n self.knn.fit(Xtrain,ytrain)", "de...
[ "0.68369275", "0.6566205", "0.6494277", "0.64633644", "0.6424828", "0.63894606", "0.6367364", "0.63543034", "0.63250947", "0.6301826", "0.62434185", "0.6240457", "0.62189037", "0.62116075", "0.62037295", "0.61904955", "0.618188", "0.618188", "0.618188", "0.618188", "0.618188"...
0.0
-1
Fit function for hyperparameter tuning
def fit_cv(self, train_loader, val_src, val_trg, device): val_src = torch.as_tensor(val_src).float() val_trg = torch.as_tensor(val_trg).float() val_src = val_src.to(device) val_trg = val_trg.to(device) optimizer = optim.Adam(self.parameters(), lr=self.learning_rate) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X):", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...
[ "0.73332095", "0.72391045", "0.72391045", "0.72391045", "0.72391045", "0.72391045", "0.72391045", "0.72391045", "0.72391045", "0.72391045", "0.72391045", "0.7178491", "0.715531", "0.71537507", "0.7115807", "0.69968015", "0.69968015", "0.69767493", "0.69767493", "0.69767493", ...
0.0
-1
Predict function for trained Relu network to predict
def predict(self, src, device): self.eval() src = torch.as_tensor(src).float() src = src.to(device) return self.forward(src).detach().cpu().numpy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self):\n raise NotImplementedError", "def predict(self):\n\n self.eval()\n return self.forward(self.data)", "def predict_proba(self):\n ...", "def predict(self, predPoints=None):", "def predict():\n import trace\n trace.predict()", "def predict(self, review):...
[ "0.7231873", "0.7148419", "0.71478593", "0.7133508", "0.70611614", "0.7058297", "0.7054681", "0.70483863", "0.7041364", "0.70122135", "0.70122135", "0.7001329", "0.7001329", "0.7001329", "0.6983101", "0.6950582", "0.69337696", "0.69032943", "0.6883933", "0.6883933", "0.684078...
0.0
-1
This function uses recursion to calculate a Fibonacci Series.
def fibonacci(n): if n <= 1: return n else: return (fibonacci(n-1) + fibonacci(n-2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci():\n return sum_series(a=0, b=1)", "def fibonacci(input) :\n\n\n\n\n\n# if input == 0:\n\n# return 0\n\n\n\n# elif input == 1:\n\n# return 1\n\n# else :\n\n# return fibonacci(input-1) + fibonacci(input-2)\n\n\n\n\n return sum_series(input)", "def fibonacci(n):...
[ "0.85920566", "0.8474796", "0.8264067", "0.80484647", "0.8009143", "0.79371625", "0.7815434", "0.77991235", "0.77815336", "0.77454424", "0.77359957", "0.77137643", "0.77104723", "0.7706502", "0.76582104", "0.765722", "0.76426095", "0.7631322", "0.76294273", "0.76259035", "0.7...
0.7485544
39
This function uses recursion to calculate a Lucas Number series.
def lucas(n): if n == 0: return 2 if n == 1: return 1 else: return (lucas(n-1) + lucas(n-2))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Lucas(input) :\n\n # if input == 0 :\n\n # return 2\n # elif input == 1 :\n\n # return 1\n\n # else :\n\n # return Lucas(input-1) + Lucas(input-2)\n\n\n return sum_series(input,2,1)", "def lucas(n):\n lucval = sum_series(n, 2, 1)\n print(lucval)\n return lucva...
[ "0.8256938", "0.7037218", "0.6912806", "0.66147834", "0.659094", "0.6509454", "0.64873713", "0.6447556", "0.6388302", "0.6342167", "0.6342167", "0.6338324", "0.62819463", "0.6275319", "0.6270978", "0.626582", "0.622909", "0.62251407", "0.60551715", "0.59431094", "0.58938193",...
0.66538656
3
Generalized function that calculates a number series based on the provided parameters. Calling this function with no optional parameters will produce numbers from the fibonacci series. Calling it with the optional arguments 2 and 1 will produce values from the lucas numbers. Other values for the optional parameters wil...
def sum_series(n, y=0, z=1): if n == 0: return y elif n == 1: return z else: return (sum_series(n-1, y, z) + sum_series(n-2, y, z))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci(input) :\n\n\n\n\n\n# if input == 0:\n\n# return 0\n\n\n\n# elif input == 1:\n\n# return 1\n\n# else :\n\n# return fibonacci(input-1) + fibonacci(input-2)\n\n\n\n\n return sum_series(input)", "def sum_series(n, x=0, y=1):\n if x == 0 and y == 1:\n return ...
[ "0.7272881", "0.7188072", "0.7171316", "0.70415336", "0.7026301", "0.6986422", "0.6921907", "0.68808997", "0.6853957", "0.67794234", "0.67707324", "0.6751248", "0.66705143", "0.66616684", "0.6630622", "0.6613517", "0.6499733", "0.6485575", "0.6453909", "0.6442043", "0.6438013...
0.63998574
22
Build the Deck Loader for the test
def setUp(self): self.items = [1,2,3,4,5] deckInitializer = DeckInitializer() [deckInitializer.addItem(item, 1) for item in self.items] self.deckLoader = StartingDeckLoader(deckInitializer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_loader(config):\n train_transform = [T.Resize((256, 128)), T.RandomHorizontalFlip(), T.ToTensor(),\n T.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])]\n train_transform = T.Compose(train_transform)\n\n test_transform = [T.Resize((256, 128)), T.ToTensor(),\n ...
[ "0.6564545", "0.6360634", "0.63571835", "0.6323059", "0.6245681", "0.62319267", "0.6199012", "0.6186175", "0.6131993", "0.6125377", "0.61228716", "0.6109008", "0.61022186", "0.61013734", "0.60801584", "0.60114074", "0.60013574", "0.5962817", "0.5953434", "0.59507775", "0.5913...
0.62608194
4
Test that the deck is created properly
def deckCreated(self): deck = self.deckLoader.loadDeck() self.assertTrue(all([item in deck for item in self.items]), "Each item in the deck initializer should be in the deck")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testDeckInit(self):\n # Test Deck getter and itialization\n cardObj = Card('5','s')\n deckObj = Deck()\n deck = deckObj.get_deck()\n self.assertEquals(str(cardObj), str(deck[4]))", "def create_uno_deck():\r\n pass", "def test_get_deck(self):\n my_deck = get_deck...
[ "0.78386056", "0.78181976", "0.7817289", "0.7801003", "0.75754887", "0.75214285", "0.7520781", "0.7493928", "0.74697274", "0.7254102", "0.72316784", "0.7188871", "0.7113905", "0.7106764", "0.7088169", "0.7034932", "0.698655", "0.6961691", "0.69396377", "0.6931241", "0.6816131...
0.791016
0
returns a dictionary whose keys are nodes 0num_nodes1 and values are every other node
def make_complete_graph(num_nodes): if num_nodes < 1: return dict() else: new_dict = dict() for node in range(num_nodes): other_nodes = range(num_nodes) other_nodes.pop(node) new_dict[node]=set(other_nodes) return new_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __node_rep(self):\n node_list_dict = {}\n for (i, beam) in enumerate(self.beams):\n if str(beam['n1']) not in node_list_dict.keys():\n node_list_dict[str(beam['n1'])] = 1\n else:\n node_list_dict[str(beam['n1'])] += 1\n if str(beam['n...
[ "0.75493014", "0.67054236", "0.6597405", "0.65603834", "0.6530207", "0.64825785", "0.63492846", "0.63471687", "0.6331453", "0.6321212", "0.6316108", "0.62537855", "0.61965334", "0.6171001", "0.6168465", "0.6138959", "0.6128185", "0.6119933", "0.61147076", "0.6092369", "0.6080...
0.6594681
3
returns a dictionary whose keys are each node and values are that nodes indegree
def compute_in_degrees(digraph): if type(digraph)!= dict: return "Incorrect input" else: in_dict = dict() for node in digraph.keys(): in_dict[node]=0 for connected_nodes in digraph.values(): for node in connected_nodes: in_dict[nod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_in_degrees (digraph) :\n in_degree = dict()\n\n # initialize the in-degree of each node with 0s\n for key in digraph :\n in_degree[key] = 0\n\n for node in digraph :\n for head_node in digraph[node] :\n in_degree[head_node]+=1\n\n return in_degree", "def compute_in_degrees...
[ "0.80185854", "0.7806412", "0.7609678", "0.7586822", "0.7412839", "0.7412839", "0.739556", "0.73668104", "0.7311377", "0.73003197", "0.72965264", "0.72725254", "0.7228831", "0.7176204", "0.71645045", "0.7128777", "0.7104989", "0.7098354", "0.70734966", "0.70734966", "0.703603...
0.75851476
4
returns a dictionary whose keys are an indegree and values are the number of nodes with that degree
def in_degree_distribution(digraph): if type(digraph)!= dict: return "Incorrect input" else: distribution = dict() for degree in compute_in_degrees(digraph).values(): if degree in distribution: distribution[degree]+=1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_in_degrees(digraph):\r\n indegree_dict = dict()\r\n for node in digraph.keys():\r\n indegree_dict[node] = 0\r\n for head_set in digraph.values():\r\n for head_node in head_set:\r\n indegree_dict[head_node] += 1\r\n #for node in digraph.keys():\r\n # indegree =...
[ "0.78681254", "0.77695", "0.77323365", "0.77175635", "0.7617187", "0.75455236", "0.7534186", "0.7467513", "0.7454945", "0.7427397", "0.73906624", "0.73906624", "0.73455805", "0.73437846", "0.7334302", "0.728487", "0.7257793", "0.7233199", "0.7217071", "0.71683407", "0.7135144...
0.63632125
45
Function to retry a DB API call if connection error was received.
def _retry_on_connection_error(exc): if isinstance(exc, db_exception.DBConnectionError): LOG.warning("Connection error detected. Retrying...") return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _retry(self, f):\n count = 0\n while True:\n try:\n return f()\n # http://initd.org/psycopg/docs/module.html#psycopg2.DatabaseError\n # handle operational error - memory allocation, unexpected disconnect\n except psycopg2.OperationalError...
[ "0.73419887", "0.6960886", "0.69570464", "0.6805043", "0.6794781", "0.6770773", "0.6732037", "0.67143106", "0.6712517", "0.6708021", "0.66556174", "0.6591946", "0.65695596", "0.649803", "0.6485051", "0.6459989", "0.6438161", "0.6438161", "0.64346737", "0.64284915", "0.6415064...
0.78459245
0
Save artifact values in database
def save(self, context, artifact_id, values): session = api.get_session() return api.create_or_update( context, artifact_id, self._serialize_values(values), session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, values):", "def save():", "def save_db(self) -> None:", "def save(self):\n # TODO (Pierre): code", "def save(self, db):\n pass", "def save():\n pass", "def save (self):\n pass", "def persist(self, values):\n pass", "def save(self, *args):\n #...
[ "0.69609433", "0.69091964", "0.68036383", "0.65114707", "0.6507306", "0.64099574", "0.64054704", "0.63791096", "0.6342851", "0.6333765", "0.6333765", "0.6333765", "0.6333765", "0.6333765", "0.6288306", "0.6282621", "0.62559664", "0.622325", "0.6210475", "0.61891514", "0.61891...
0.6549716
3
Create and update blob records in db
def update_blob(self, context, artifact_id, values): session = api.get_session() return api.create_or_update( context, artifact_id, {'blobs': values}, session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_blob ( self, object_class_id, object_instance_id, attribute_name, blob_file, file_name ) :\n try :\n inputs = []\n inputs.append(open(blob_file, 'rb'))\n for input in inputs:\n binary_data = input.read()\n blobfile = self.oracle_cursor.v...
[ "0.6844873", "0.68339884", "0.63741404", "0.6308612", "0.6177214", "0.61760896", "0.6067677", "0.60397136", "0.60139084", "0.59906584", "0.593761", "0.5933804", "0.58961123", "0.5885813", "0.58666456", "0.5828301", "0.58068794", "0.57788336", "0.5757776", "0.57316685", "0.571...
0.6349449
3
Delete artifacts from db
def delete(self, context, artifact_id): session = api.get_session() api.delete(context, artifact_id, session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete():\n\n from slicr.extensions import db\n\n click.echo('deleting database...')\n\n db.drop_all()", "def delete():", "def delete_db():\n db.drop_all()", "def delete(self):\n if not pdbox._args.get(\"dryrun\"):\n result = execute(pdbox.dbx.files_delete_v2, self.path)\n ...
[ "0.6823621", "0.67396307", "0.66788316", "0.66637623", "0.66328824", "0.6586701", "0.65795016", "0.65556276", "0.6508471", "0.6479917", "0.6445165", "0.6397342", "0.6388401", "0.6361312", "0.6323865", "0.6292837", "0.6292436", "0.6261826", "0.62598485", "0.6254914", "0.624081...
0.6131863
33
Return artifact values from database
def get(self, context, type_name, artifact_id, get_any_artifact=False): session = api.get_session() return api.get(context, type_name, artifact_id, session, get_any_artifact)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_values(self, db):", "def artifact(cls):\n return relationship.many_to_one(cls, 'artifact')", "def database_values():\n return TwoValues()", "def RenderValues(self):\n\n retval = copy.deepcopy(self.persistant)\n\n tags = []\n for row in self.db.GetRows('select tag from tags where track...
[ "0.62301946", "0.5914707", "0.56514585", "0.556812", "0.5558917", "0.55402905", "0.5510479", "0.55086505", "0.5481308", "0.5440848", "0.54249436", "0.5405176", "0.53954196", "0.535389", "0.53386796", "0.5334326", "0.52583784", "0.5252394", "0.5225052", "0.5218417", "0.5201256...
0.0
-1
List artifacts from db
def list(self, context, filters, marker, limit, sort, latest, list_all_artifacts=False): session = api.get_session() return api.get_all(context=context, session=session, filters=filters, marker=marker, limit=limit, sort=sort, latest=late...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_list(cs, args):\n data = []\n _, repositories = cs.repositories.list(args.project_id)\n for repo in repositories:\n _, tags = cs.repositories.list_tags(repo)\n for tag in tags:\n _, manifests = cs.repositories.get_manifests(repo, tag)\n manifests['Name'] = repo\n...
[ "0.6497614", "0.62386703", "0.60873485", "0.608293", "0.6058392", "0.598802", "0.59787583", "0.5956971", "0.59386355", "0.5887751", "0.58522004", "0.5791677", "0.5776047", "0.577001", "0.5766433", "0.5725019", "0.567835", "0.56732196", "0.5670832", "0.5668681", "0.5663074", ...
0.5470894
37
Count the number of artifacts for the tenant.
def count_artifact_number(self, context, type_name=None): session = api.get_session() return api.count_artifact_number(context, session, type_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_deployments_count(self):\n pass", "async def count(self) -> int:\n return (\n await self.document_model.get_motor_collection().count_documents(\n self.get_filter_query()\n )\n )", "def get_datasets_count(request):\n organization_id = req...
[ "0.70028967", "0.6253097", "0.62479025", "0.61345184", "0.6010261", "0.5917181", "0.58992636", "0.58735883", "0.58410645", "0.58410645", "0.58410645", "0.58410645", "0.5840967", "0.5840093", "0.58336943", "0.581419", "0.5799123", "0.5788795", "0.57787454", "0.5770824", "0.576...
0.6987582
1
Calculate the amount of uploaded data for tenant.
def calculate_uploaded_data(self, context, type_name=None): session = api.get_session() return api.calculate_uploaded_data(context, session, type_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_storage(self):\n return self._total_storage", "def total_files_to_process(self) -> float:\n return pulumi.get(self, \"total_files_to_process\")", "def calculate_total_size(apps, schema_editor):\n Data = apps.get_model(\"flow\", \"Data\")\n for data in Data.objects.all():\n ...
[ "0.64483", "0.63534814", "0.62647516", "0.61787975", "0.5975532", "0.5971462", "0.59702533", "0.59611386", "0.5929874", "0.591614", "0.5898222", "0.58712864", "0.5854661", "0.582835", "0.58092016", "0.5807339", "0.57871646", "0.57760394", "0.5766214", "0.5758709", "0.57416147...
0.6580297
0
Note this is not a general solution for ALL possible recursive calls.
def generate_recursive_rules(limit): return [ # 8: 42 | 42 8 - recursion creates the pattern: 42 | 42 42 | 42 42 42 etc... f"8: {' | '.join([('42 ' * x).strip() for x in range(1, limit + 1)])}", # 11: 42 31 | 42 11 31 - recursion creates the pattern: 42 31 | 42 42 31 31 | 42 42 42 31 31 31 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recursive():\n with Local() as tun:\n tun.call(recursive)", "def step(tree):\n if type(tree) == list and type(tree[0]) == tuple:#This basically looks for any applications it can do directly. These applications are the ones where the function is already defined through abstraction. That's why it ...
[ "0.64005625", "0.60955304", "0.60120666", "0.59537405", "0.5939161", "0.59378874", "0.59256077", "0.5857472", "0.58511436", "0.5798678", "0.57827175", "0.57305735", "0.5730278", "0.5640187", "0.560676", "0.5587093", "0.5468042", "0.54672", "0.5436198", "0.54184806", "0.541804...
0.0
-1
Solution to the problem
def solution(raw_data): recursion_limit = 5 # hardcoded value based on empirical exploration data = preprocess(raw_data, recursion_limit) solver = MonsterMessage(data) return solver.solve()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):", "def solve(self):\n pass", "def solve(self):\n pass", "def solve(self):\n ...", "def problem_298():\n pass", "def solvate(self):\n\n pass", "def solution(s):", "def get_sol(self):", "def test_get_solution(self):\n pass", "def solution(self)...
[ "0.7423277", "0.7013315", "0.7013315", "0.69836867", "0.6830721", "0.6752851", "0.64645183", "0.6391518", "0.63800526", "0.63478065", "0.61165357", "0.6100315", "0.6074178", "0.60716605", "0.60713553", "0.60587716", "0.60174394", "0.5986508", "0.59821045", "0.59797627", "0.59...
0.0
-1
Create a generic socket for binding
def __init__(self, bindHost = HOST, bindPort = PORT): self.theSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print('Socket created') try: self.theSocket.bind((bindHost, bindPort)) except socket.error as msg: print('Bind failed. Error Code : ' +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_socket():\n sock = socket.socket()\n return sock", "def socket(name=None, type=SOCK_STREAM, i2p_router=(\"127.0.0.1\",7657)):\n if type == SOCK_STREAM:\n # make a streaming socket\n return _StreamSocket(i2p_router)\n raise Exception(\"cannot make socket of unknown type {}\"....
[ "0.75248337", "0.74504685", "0.7293226", "0.72078735", "0.6942763", "0.69232", "0.6901618", "0.68650615", "0.6852329", "0.6788948", "0.6773746", "0.6756569", "0.6751513", "0.67073625", "0.6682721", "0.6622934", "0.66212296", "0.66016024", "0.6599928", "0.65394753", "0.6499597...
0.6827103
9
Opens the socket for listening. Once connected returns the connection stream for message transmission
def listen(self): self.theSocket.listen(0) print('Socket now listening') #wait to accept a connection - blocking call self.conn, self.addr = self.theSocket.accept() print('Connected with ' + self.addr[0] + ':' + str(self.addr[1])) return self.conn
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen(self):\r\n # Create socket server\r\n server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)\r\n\r\n if server:\r\n # Configure socket server\r\n try:\r\n server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\r\n server....
[ "0.7126151", "0.6963919", "0.6812247", "0.6765562", "0.67437005", "0.67379373", "0.67334294", "0.658196", "0.6511441", "0.64611155", "0.6439569", "0.6438799", "0.64075774", "0.6406498", "0.6385714", "0.6383656", "0.63751084", "0.63746387", "0.6372696", "0.63167804", "0.631678...
0.68621236
2
Transmits a message across the socket
def transmit(self, msg): # send our message to the client self.conn.sendall(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(self, message):\r\n\t\tself.__tcpSocket.write(message.encode('utf8'))", "def send(message):\n\tmessage = message.encode()\n\tconn.send(message)", "def transmit(self, message):\n pass", "def send(self, message):\n self.sock.send(message)", "def send_message(self, message):\n\n...
[ "0.798556", "0.7861458", "0.7852766", "0.78308", "0.7751874", "0.765345", "0.76362926", "0.7619916", "0.7607291", "0.7594528", "0.7582208", "0.7561715", "0.7410909", "0.7372731", "0.7353522", "0.7350811", "0.7322519", "0.7300317", "0.7277413", "0.725539", "0.72407967", "0.7...
0.8276167
0
Closes the socket and releases the port
def close(self): # close the connection and the socket self.conn.close() self.theSocket.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.socket is not None:\n try:\n self.socket.shutdown(2)\n except Exception:\n pass\n try:\n self.socket.close()\n except Exception:\n pass\n self.socket = None", "def ...
[ "0.75745505", "0.7520388", "0.7520388", "0.7520388", "0.7520388", "0.7520388", "0.7520388", "0.74808604", "0.7469165", "0.7411991", "0.73915285", "0.73915285", "0.73839206", "0.7373347", "0.7351798", "0.7295434", "0.72707087", "0.7247217", "0.72419554", "0.72334135", "0.72313...
0.6854753
43
Endpoint returning updated sensors data
def get_metrics() -> Response: try: with get_cursor(db_creds, commit=False) as cur: data = get_sensors_data(cur) return jsonify(status_code=200, data=data) except psycopg2.Error as e: return jsonify( message=f"Psycopg2 driver error: {type(e)}", args=e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n if self._api is not None:\n \"\"\"Fetch the latest data\"\"\"\n self._api.get()\n \n \"\"\"set our sensor values\"\"\"\n self._current_temperature = self._api._temperature\n self._current_humidity = self._api._humidity\n ...
[ "0.69263685", "0.67534375", "0.67344683", "0.65311176", "0.65252787", "0.6499493", "0.6481013", "0.64106464", "0.6389556", "0.6384", "0.6332417", "0.6328573", "0.6311241", "0.6310034", "0.62539667", "0.6239011", "0.6238906", "0.6232463", "0.62084335", "0.6180473", "0.6167958"...
0.0
-1
Endpoint returning updated healthcheck data
def get_healthcheck() -> Response: try: with get_cursor(db_creds, commit=False) as cur: cur.execute("SELECT * FROM events.healthchecks") data = cur.fetchall() return jsonify(status_code=200, data=data) except psycopg2.Error as e: return jsonify( messa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_health():\n return flask.jsonify(status=\"up\")", "def health_check():\n app.logger.info(\"Health Check!\")\n return Response(\"All Good!\", status=200)", "def healthcheck():\n return make_response(jsonify(status=200, message='Healthy'), status.HTTP_200_OK)", "def health_check():\n ...
[ "0.71149075", "0.7089122", "0.6871938", "0.68474406", "0.681666", "0.68130916", "0.66928166", "0.6683401", "0.66758454", "0.667033", "0.66678536", "0.65907925", "0.65864116", "0.65427077", "0.65298206", "0.65147936", "0.6506738", "0.64992595", "0.64821154", "0.6472329", "0.64...
0.63142323
28
Endpoint receiving sensors data
def post_sensors_data() -> Response: try: payload = request.get_json() with get_cursor(db_creds, commit=True) as cur: logger.info(request.data) q = ( f"INSERT INTO events.sensors (measure_type, unit, value) VALUES ('{payload['measure_type']}', " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_realtime_info(self):\n self.socket_datastream.sendto(b\"!r\", self.ip_port_arduino_datastream)\n self.socket_datastream.sendto(b\"!s\", self.ip_port_arduino_datastream)", "def get_sensor_data(self):\n # Initialize ROS msgs\n imu_raw_msg = Imu()\n imu_msg = Imu()\n ...
[ "0.68858415", "0.66007024", "0.6381826", "0.6373809", "0.6321996", "0.6308858", "0.62616175", "0.62301725", "0.6224252", "0.62106484", "0.60904527", "0.6087152", "0.6061135", "0.60452735", "0.6044256", "0.603626", "0.59865624", "0.59538865", "0.5934143", "0.5886515", "0.58865...
0.0
-1
Endpoint receiving Rapsberry healthcheck data
def post_healthcheck() -> Response: try: payload = request.get_json() with get_cursor(db_creds, commit=True) as cur: q = ( f"INSERT INTO events.healthchecks (healtcheck_type, unit, value) VALUES ('{payload['healthcheck_type']}', " f"'{payload['unit']}', '{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onPing(self, payload):", "def test_health_check(self):\n result = self.app.get('/v1/health')\n\n # assert the status code of the response 200 (OK)\n self.assertEqual(result.status_code, 200)\n self.assertEqual(result.data, b'UP')", "def health_check():\n app.logger.info(\"Hea...
[ "0.6287025", "0.6257467", "0.6245014", "0.61758745", "0.6159938", "0.6157036", "0.60178006", "0.5913619", "0.5881953", "0.58725893", "0.5870541", "0.5866021", "0.58020115", "0.57901454", "0.5782122", "0.57791257", "0.5764756", "0.5728463", "0.5725035", "0.5720875", "0.5709467...
0.0
-1
Endpoint triggering plant watering on user request
def post_watering() -> Response: try: payload = request.get_json() response = activate_watering( env_vars["twilio_account_sid"], env_vars["twilio_auth_token"], env_vars["twilio_supersim_sid"], payload["quantity_ml"], ) with get_cursor(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(self):\n policies = json.loads(self.request.get('policies'))\n request = json.loads(self.request.get('request_json'))\n response = json.loads(self.request.get('response_json'))\n\n maybe_notify_backend('LEASED', response['hostname'], policies)\n maybe_notify_lessee(request, response)", "d...
[ "0.5578581", "0.5462895", "0.5353694", "0.5348839", "0.5341505", "0.5335219", "0.5324055", "0.5320257", "0.52994764", "0.5296214", "0.52925473", "0.52828044", "0.52616644", "0.5255552", "0.5255112", "0.52539307", "0.52539307", "0.52539307", "0.52539307", "0.52539307", "0.5253...
0.55854774
0
Endpoint fetching plant data from cache or from Trefle API
def search_plant_info(name: str) -> Response: try: data = get_plant_info(name, 100) return jsonify(status_code=200, data=data) except Exception as e: return jsonify( message=f"Internal Server Error: {type(e)}", args=e.args, status_code=500, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_temp_data(url):\n res = requests.get(url)\n return res.json()", "async def fetch_data(self) -> T:", "def fetch_data(self):", "def get(self, *args, **kwargs):\n\n dc_id = request.args.get('id')\n # cpu = request.args.get('tcpu')\n # memory =request.args.get('tmemory')\n ...
[ "0.6073614", "0.60280013", "0.6022476", "0.59945756", "0.5890105", "0.5832073", "0.578801", "0.577489", "0.5766504", "0.5766504", "0.5766504", "0.5727373", "0.5722828", "0.5702612", "0.5701475", "0.5701475", "0.5697409", "0.5690267", "0.5678803", "0.56575215", "0.56575215", ...
0.58302623
6
Endpoint receiving an image and querying Plant.id to identify the plant species
def identify_plant(): if "file" not in request.files: return jsonify( message=f"Bad Request: file missing", status_code=400, error_type="Bad Request", ) file = request.files["file"] # if user does not select file, browser also # submit a empty part wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_equipment_by_id_image(self):\n pass", "def cmd_image_id(client, args):\n image = client.get_image(args.image_id)\n data = image.__dict__\n generate_output({'image': data})", "def testimage_handler(self):\n\t\t\n\t\tthings = Thing.objects.all()\n\t\tif len( things ):\n\t\t\tthing = thin...
[ "0.5888729", "0.58802485", "0.5856984", "0.57904935", "0.56651866", "0.5609407", "0.55560356", "0.5510127", "0.5479047", "0.5466157", "0.54660016", "0.5436323", "0.5421763", "0.54160196", "0.54146", "0.5403488", "0.5400763", "0.53866816", "0.5370986", "0.53696334", "0.5364186...
0.70259756
0
Set up a manager with an empty L{Listener} L{WeakKeyDictionary}, an empty eventQueue, and a timer used for timestamps.
def __init__(self,eventTimer,debugger): from weakref import WeakKeyDictionary self.listeners = WeakKeyDictionary() self.eventTypesToListeners = WeakKeyDictionary() self.eventQueue = [] self.eventTimer = eventTimer self.debugger = debugger
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, timer: Timer):\n self.all_event_notifier = AllEventNotifier()\n self.empty_queue_event_notifier = EmptyQueueEventNotifier(self.all_event_notifier)\n self.end_trading_event_notifier = EndTradingEventNotifier(self.all_event_notifier)\n self.scheduler = Scheduler(timer)"...
[ "0.67159414", "0.63050383", "0.626442", "0.6218855", "0.6203074", "0.6143775", "0.6116397", "0.5990086", "0.5908518", "0.59002894", "0.5810577", "0.575337", "0.5748086", "0.57281965", "0.5724485", "0.56653446", "0.5642506", "0.55996543", "0.5587808", "0.5581674", "0.5570367",...
0.6799975
0
Registers a listener with the event manager to be nofitied when the events in the attribute eventTypes of the listener are received.
def registerListener( self, listener ): for evType in listener.eventTypes: self.eventTypesToListeners.setdefault(evType,[]).append(listener) self.listeners[ listener ] = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(self, event_type, listener, priority=50):\n if type(event_type) not in [int, str]:\n event_type = fqcn(event_type)\n\n if event_type not in self.listeners:\n self.listeners[event_type] = 99 * [None]\n\n if not self.listeners[event_type][priority]:\n ...
[ "0.66918576", "0.64830554", "0.644387", "0.644145", "0.6406527", "0.63426816", "0.6330731", "0.62404734", "0.62347907", "0.6183672", "0.6178377", "0.61638117", "0.59902275", "0.59348255", "0.5913496", "0.5893763", "0.58693016", "0.57966113", "0.5740057", "0.5663427", "0.56596...
0.7047778
0
Removes a listener from the dictionary of listeners.
def unregisterListener( self, listener ): # FIXME---! eventTypesToListeners! if listener in self.listeners: del self.listeners[ listener ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_listener(self, listener: CBListenerType) -> None:\n with self._lock:\n self._listeners.remove(listener) # type: ignore[arg-type]", "def unregister(self, listener):\n for event_type in self.listeners:\n for event_listeners in self.listeners[event_type]:\n ...
[ "0.79921174", "0.792932", "0.748127", "0.7476969", "0.7469774", "0.7276478", "0.7270496", "0.7200036", "0.7083176", "0.70451224", "0.69708145", "0.68594605", "0.67795736", "0.6667826", "0.65575266", "0.64203864", "0.6329957", "0.62994105", "0.6131681", "0.612122", "0.60885185...
0.7649141
2
Sends an event to the listeners which should be notified depending on the type of event. The manager will also set the time stamp of the event.
def post( self, event ): event.timeFired = self.eventTimer.getTime() if self.debugger.SYMBOLS_ENABLED: self.debugger.logMsg(event) ##SOME LISTENERS SHOULD START THEIR OWN THREADS (eventually) for listener in self.eventTypesToListeners.get(type(event),[]): lis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(self, event):\r\n self.events.append(event)", "def fire(self, event_type: str, event=None) -> None:\n for listener in self.event_listeners.get(event_type, []):\n if asyncio.iscoroutinefunction(listener):\n asyncio.run_coroutine_threadsafe(\n lis...
[ "0.6892095", "0.6409433", "0.6407833", "0.63883036", "0.62509346", "0.62336004", "0.62126154", "0.61663187", "0.6155925", "0.6149709", "0.61396813", "0.61255926", "0.6096925", "0.609254", "0.60713875", "0.6000448", "0.59904265", "0.5961882", "0.59416336", "0.5938059", "0.5912...
0.5990827
16
Runs the model on the given data.
def run_epoch(session, model, eval_op=None, verbose=False): # Clean initialization start_time = time.time() costs = 0.0 iters = 0 output = None state = session.run(model.initial_state) # Values to extract from running the graph (cost, final state, and may be eval_op) fetches = {'cost':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, data, training=False):\n # Set mode\n if training:\n self._model.train()\n else:\n self._model.eval()\n # Compute\n return self._model(data)", "def handle(self, data, context):\n \n model_input = self.preprocess(data)\n model_out = self.inference(model_...
[ "0.76660347", "0.7267563", "0.7143195", "0.7115813", "0.7104576", "0.6933755", "0.69280547", "0.69213235", "0.6887816", "0.6862756", "0.66742575", "0.66258603", "0.65225", "0.645919", "0.6350541", "0.62935895", "0.6250189", "0.6240309", "0.6234658", "0.6230404", "0.62262917",...
0.0
-1
Element is an etree.ElementTree.Element object, root is the immediate parent node
def __init__(self, element, parent): super(XMLObj, self).__setattr__('element', element) super(XMLObj, self).__setattr__('parent', parent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseXml(self, element, parent):\n doRec = self.__builder.create(element, parent)\n parent = self.__builder.getCurrent()\n self.__builder.setParser(self)\n if self.check4Id(element) is True:\n self.addElementById(element, parent)\n\n if doRec is False:\n ...
[ "0.65215284", "0.641877", "0.64019424", "0.6370378", "0.6363819", "0.6353294", "0.6353294", "0.6353294", "0.6353294", "0.6353294", "0.6324178", "0.6309363", "0.62130517", "0.62098795", "0.6197952", "0.617757", "0.6090116", "0.6065394", "0.6043166", "0.6041294", "0.6032596", ...
0.61888176
15
Remove current item from persistent storage
def remove_self(self): self.parent.remove(self.element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_remove(self):\n storage.close()", "def __delitem__(self, key):\n del self._get_storage()[key]", "def delete_item(self):\n\n\t\tdb.session.delete(self)\n\t\tdb.session.commit()", "def delete(self):\n self.storage.delete(basket=self)\n self.uncache()\n self._data = No...
[ "0.7606461", "0.74336743", "0.7377616", "0.73235285", "0.7088004", "0.70649964", "0.6999497", "0.6970149", "0.6954515", "0.693503", "0.6861639", "0.68514884", "0.68458354", "0.6837437", "0.6810709", "0.6808225", "0.6806991", "0.6806991", "0.68031543", "0.6792585", "0.67736757...
0.0
-1
kwargs will store the values as strings into XML with the keys as attributes > XMLGroupOverlay object which supports python object syntax
def add_bu_group(self, **kwargs): _stringify_kw(kwargs) bu_group = ElementTree.Element(xml_strings['backup_group'], **kwargs) self._root.append(bu_group) return XMLGroupOverlay(bu_group, self._root)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _adjust_kwargs(cls, **kwargs):\r\n tag = kwargs.pop('tag', 'unknown')\r\n kwargs['policy'] = {'{tag}/{url_name}'.format(tag=tag, url_name=kwargs['url_name']): kwargs['policy']}\r\n\r\n kwargs['xml_node'].text = kwargs.pop('text', None)\r\n\r\n kwargs['xml_node'].attrib.update(kwargs...
[ "0.571485", "0.5661827", "0.55824167", "0.54921454", "0.5459864", "0.52782536", "0.52485794", "0.51320666", "0.51277363", "0.5094977", "0.5042357", "0.50241184", "0.5010459", "0.50082844", "0.5007445", "0.49933472", "0.49791485", "0.4975978", "0.49738112", "0.49184176", "0.49...
0.5277526
6
loop for print bates men personal score.
def personal_scores(self,BATESMEN): for team in BATESMEN: print("\n"+team) for batesmen in BATESMEN[team]: print(batesmen)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disp_score():", "def print_scores(self):\n ### FILL IN ###", "def score_display():\n data = score_reader()\n for index, datum in enumerate(data):\n score_format = \"%s ...... %s/%s\" % (datum[0].capitalize(), datum[1], datum[2])\n print(score_format)", "def print_scores(self):\...
[ "0.7387781", "0.67674154", "0.65090066", "0.643027", "0.6418636", "0.6384892", "0.63276595", "0.6233606", "0.62122846", "0.618866", "0.6184044", "0.61717796", "0.6169131", "0.613882", "0.6125767", "0.60773987", "0.60144097", "0.5996277", "0.5973306", "0.5938897", "0.5928707",...
0.7688414
0
Mollify the spectral reconstruction of a discontinuous function to reduce the effect of Gibbs phenomenon. Perform a realspace convolution of a spectral reconstruction with an adaptive unitmass mollifier.
def MollifyQuad(theta, c_j, a_n, x): N = a_n.shape[0]-1 offset = x convolution = np.empty(len(x)) I_N = lambda y: T.chebval(y, a_n) I_Nf = lambda y: I_N(y) if -1 <= y <= 1 else 0 for idx, off_x in enumerate(offset): c_jx = c_j - off_x dx = lambda y: sqrt(theta*N*min(ab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussbroad(w, s, hwhm):\n \"\"\"\n History\n --------\n Dec-90 GB,GM\n Rewrote with fourier convolution algorithm.\n Jul-91 AL\n Translated from ANA to IDL.\n 22-Sep-91 JAV\n Relaxed constant dispersion check# vectorized, 50% faster.\n 05-Ju...
[ "0.62474847", "0.6198961", "0.61482286", "0.60719943", "0.5814345", "0.56698304", "0.56487894", "0.56322384", "0.5585082", "0.5557196", "0.555", "0.55296403", "0.547741", "0.547594", "0.54757226", "0.5469066", "0.5454285", "0.5423175", "0.542271", "0.5410447", "0.5341667", ...
0.0
-1
Mollify the spectral reconstruction of a discontinuous function to reduce the effect of Gibbs phenomenon. Perform a realspace convolution of a spectral reconstruction with an adaptive unitmass mollifier.
def MollifyQuadBuffer(theta, c_j, a_n, x): N = a_n.shape[0]-1 deltax = 2.0/(len(x)-1) I_N = lambda y: T.chebval(y, a_n) I_Nf = lambda y: I_N(y) if -1 <= y <= 1 else 0 buff_right = lambda y: I_N(2.0-y) if 1.0<y<1.4 else 0 buff_left = lambda y: I_N(-(2.0+y)) if -1.4<y<-1.0 else 0 I_N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussbroad(w, s, hwhm):\n \"\"\"\n History\n --------\n Dec-90 GB,GM\n Rewrote with fourier convolution algorithm.\n Jul-91 AL\n Translated from ANA to IDL.\n 22-Sep-91 JAV\n Relaxed constant dispersion check# vectorized, 50% faster.\n 05-Ju...
[ "0.6247588", "0.61991626", "0.61470723", "0.60712576", "0.58125955", "0.56679094", "0.5646067", "0.5629914", "0.55860007", "0.55557656", "0.55482763", "0.5530241", "0.5477079", "0.54766566", "0.54749393", "0.546992", "0.5454619", "0.54232293", "0.54218656", "0.54114205", "0.5...
0.4855187
85
Piecewise mollify the spectral reconstruction of a discontinuous function to reduce the effect of Gibbs phenomenon. Perform a realspace convolution of a spectral reconstruction with an adaptive unitmass mollifier.
def PiecewiseMollify(theta, c_j, a_n, x): N = a_n.shape[0]-1 sanity_check = np.empty(len(x)) mollified = np.array([]) mollified_err = np.array([]) I_N = lambda y: T.chebval(y, a_n) chi_top = lambda y,f : f(y) if -1 <= y <= 1 else 0 I_N_top = lambda y: chi_top(y, I_N) c_jplus = np.ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deconvolution(obs, green, lambd):\n\n nr, nt = obs.shape\n num = np.zeros(nt)\n den = np.zeros(nt)\n\n for ir in range(len(obs)):\n\n OBS = fft(obs[ir, :])\n GRE = fft(green[ir, :])\n\n # Sum all\n num = num + np.conj(GRE) * OBS\n den = den + np.conj(GRE) * GRE\n\...
[ "0.622184", "0.62181246", "0.6092272", "0.6026057", "0.58169574", "0.5727908", "0.5724725", "0.57090276", "0.5611442", "0.55707", "0.5551798", "0.5548391", "0.55181", "0.54871875", "0.5456233", "0.53850615", "0.5381547", "0.5357171", "0.535263", "0.5343674", "0.53416723", "...
0.0
-1
Computes the immediate counterfactual regret at each information set for each player. This is defined as 1 / T max_a \sum_{t=1}^T \sum_{h \in I} u_i^{sigma^t}(ha) u_i^{sigma^t}(h), where u_i^sigma(h) is the counterfactual value to player i = player(I) of being in node h.
def compute_immediate_regret(game: extensive_game.ExtensiveGame, strategies: List[extensive_game.Strategy]) -> \ (List[float], List[Dict[Any, float]]): all_info_set_regrets = [] for t, strategy in enumerate(strategies): node_regrets = collections.defaultdict(dict) # This function fills i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_player_score():\n\n progress_bar = ProgressBar(label=\"Computing universes\")\n\n survivals_count = 0\n for i in range(PARALLEL_UNIVERSES_COUNT):\n if simulate_universe():\n survivals_count += 1\n progress_bar.set_progression((i + 1) / PARALLEL_UNIVERSES_COUNT)\n\n ...
[ "0.53083366", "0.50491804", "0.503973", "0.5003304", "0.5000362", "0.49662566", "0.4949448", "0.4948674", "0.4944811", "0.49384162", "0.4934841", "0.49127766", "0.49112374", "0.49108008", "0.48997846", "0.48962733", "0.48750165", "0.4851145", "0.48397088", "0.48348284", "0.48...
0.556017
0
Computes the expected utility at each node for each player.
def compute_expected_utility(game: extensive_game.ExtensiveGame, sigma_1: extensive_game.Strategy, sigma_2: extensive_game.Strategy): expected_utility_1 = collections.defaultdict(float) expected_utility_2 = collections.defaultdict(float) _, _ = compute_expected_utility_recursiv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_expected_utility_recursive(\n game: extensive_game.ExtensiveGame,\n node: extensive_game.ExtensiveGameNode,\n sigma_1: extensive_game.Strategy,\n sigma_2: extensive_game.Strategy,\n expected_utility_1: Dict[extensive_game.ExtensiveGameNode, float],\n expected_u...
[ "0.74631435", "0.6185281", "0.6166061", "0.580099", "0.571101", "0.5659522", "0.5641758", "0.55759627", "0.55676126", "0.55207443", "0.5508547", "0.55081666", "0.54969245", "0.5464592", "0.5441873", "0.5419201", "0.5398628", "0.5382284", "0.535586", "0.5311224", "0.52831244",...
0.6158116
3
Computes the expected utility of the given node for each player. This is defined as v_i(sigma, h) = sum_{z in Z_h} u_i(z) pi^sigma(h, z), where Z_h is the set of terminal nodes with h as a prefix, and pi^sigma(h, z) is the product of all probabilities in the strategy profile sigma on the route from h to z.
def compute_expected_utility_recursive( game: extensive_game.ExtensiveGame, node: extensive_game.ExtensiveGameNode, sigma_1: extensive_game.Strategy, sigma_2: extensive_game.Strategy, expected_utility_1: Dict[extensive_game.ExtensiveGameNode, float], expected_utility_2: D...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_utility(sim,sol,par):\n\n # unpack\n u = sim.utility\n \n for t in range(par.T):\n for i in prange(par.simN):\n \n if par.do_2d:\n u[i] += par.beta**t*utility.func_2d(sim.c[t,i],sim.d1[t,i],sim.d2[t,i],par)\n else:\n u[i] +=...
[ "0.5732998", "0.5646686", "0.56003314", "0.55983436", "0.54921854", "0.54629326", "0.5456845", "0.53569305", "0.53542536", "0.5327965", "0.5269349", "0.5227534", "0.51743656", "0.51472896", "0.514705", "0.5138735", "0.5131935", "0.50796586", "0.50725347", "0.5044816", "0.5044...
0.7044944
0
Search for the best move (choice of column for the token)
def go(self, brd): # Your code here self.calc_heuristic(brd) return self.minimax(brd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_move(state: GameState) -> None:", "def next_move(self, board):\n \n return self.best_move(self.score_columns(board))", "def find_best_move(board):\n new_board = board.get_board()\n\n # X | X | X <-- Check for win on this row\n # ---------\n # 3 | 4 | 5\n ...
[ "0.7414944", "0.7094101", "0.68662715", "0.6845814", "0.681587", "0.67281663", "0.65924704", "0.64685076", "0.641652", "0.63707304", "0.6366281", "0.63273597", "0.63148254", "0.63096637", "0.6306017", "0.6269623", "0.6262679", "0.62592477", "0.62471694", "0.6212598", "0.62056...
0.0
-1
Returns the reachable boards from the given board brd. The return value is a tuple (new board state, column number where last token was added).
def get_successors(self, brd): # Get possible actions freecols = brd.free_cols() # Are there legal actions left? if not freecols: return [] # Make a list of the new boards along with the corresponding actions succ = [] for col in freecols: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_successors(self, brd):\n # Get possible actions\n freecols = brd.free_cols()\n # Are there legal actions left?\n if not freecols:\n return []\n # Make a list of the new boards along with the corresponding actions\n succ = []\n for col in freecols:...
[ "0.63505876", "0.58677834", "0.5781971", "0.57273066", "0.5699906", "0.5691483", "0.56231874", "0.55608493", "0.55115855", "0.5491904", "0.54474413", "0.5417632", "0.5368523", "0.5334432", "0.5326626", "0.5321706", "0.53070617", "0.5301228", "0.52538997", "0.5232307", "0.5210...
0.6339619
1
Initialize the paginator and set some default values.
def __init__(self, query, page=1, limit=20): self.query = query self.page = page self.limit = limit self.__prepare()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_django_paginator(self, pages):\n self._npages = pages.num_pages\n self._data = pages", "def init_pages(self, inp):\n if inherits_from(inp, \"evennia.utils.evtable.EvTable\"):\n # an EvTable\n self.init_evtable(inp)\n self._paginator = self.paginator_...
[ "0.8024142", "0.68513936", "0.65112203", "0.6375003", "0.6272134", "0.6217972", "0.6213938", "0.6198783", "0.61725485", "0.61528504", "0.6120735", "0.60715044", "0.6057223", "0.60544026", "0.59783983", "0.59783983", "0.59715897", "0.5971338", "0.59601116", "0.59120667", "0.58...
0.5756518
25
Return whether or not there are previous pages from the currently displayed page.
def has_previous(self): return self.page > 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_previous(self):\n return self.current_page > 1", "def has_prev(self):\n return self.page > 1", "def has_prev(self):\n return self.page > 1", "def has_previous(self) -> bool:\n return self.published_before().count() != 0", "def previous_page(self):\n\n\t\tif not self.is_p...
[ "0.882928", "0.85812926", "0.85812926", "0.7818793", "0.757213", "0.74441236", "0.72574216", "0.70782685", "0.69289106", "0.68758", "0.6799423", "0.6752267", "0.66575694", "0.66365916", "0.66365916", "0.66365916", "0.65581673", "0.6478808", "0.6467624", "0.6420017", "0.641290...
0.87382364
1
Return the previous page object if the page exists.
def previous(self): if self.has_previous: previous_id = self.page - 1 if self._cached_previous and self._cached_previous.id == previous_id: return self._cached_previous self._cached_previous = Page(previous_id) return self._cached_previous
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def previous_page(self):\r\n if self.page.has_previous():\r\n previous = self.page.previous_page_number()\r\n if previous == 1:\r\n if 'page' in self.query_dict:\r\n del self.query_dict['page']\r\n else:\r\n self.query_dict['p...
[ "0.7538804", "0.7452312", "0.7428078", "0.7344983", "0.72339845", "0.7119872", "0.7118858", "0.70535684", "0.7038007", "0.7024775", "0.6851784", "0.6807013", "0.67470986", "0.6734867", "0.6686041", "0.66336405", "0.6593018", "0.65825015", "0.656229", "0.656229", "0.654805", ...
0.84087425
0
Return whether or not there are more pages from the currently displayed page.
def has_next(self): return self.page < self.pages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_more_pages(self):\n return self._has_more", "def _check_for_more_pages(self):\n self._has_more = len(self._items) > self.per_page\n\n self._items = self._items[0:self.per_page]", "def has_next(self):\n return self.current_page < self.pages", "def have_to_paginate(self):\n ...
[ "0.9098234", "0.7850018", "0.7724325", "0.7670458", "0.73365647", "0.7302383", "0.72137177", "0.71362853", "0.70297205", "0.6986276", "0.6791974", "0.6724778", "0.6710453", "0.67010367", "0.669695", "0.66286564", "0.65845263", "0.6572757", "0.6523769", "0.65030503", "0.646331...
0.7634209
5
Return the next page object if another page exists.
def next(self): if self.has_next: next_id = self.page + 1 if self._cached_next and self._cached_next.id == next_id: return self._cached_next self._cached_next = Page(next_id) return self._cached_next
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_page(browser):\n pages = browser.find(class_='pages')\n for page in pages:\n if page.string == NEXT_PAGE:\n return page\n return None", "def _get_next_page(questionnaire, page):\n pages = PageDB(questionnaire).get_pages()\n i = 0\n nr_of_pages = PageDB(questionnaire)....
[ "0.72533864", "0.7130815", "0.6885224", "0.6694369", "0.6602497", "0.6595447", "0.65267885", "0.65267885", "0.64323646", "0.63298297", "0.619076", "0.6183238", "0.6151279", "0.6151279", "0.6151279", "0.6146552", "0.6146552", "0.61445075", "0.61284256", "0.6117008", "0.6081957...
0.75209236
0
The total amount of pages to be displayed based on the number of results and the limit being displayed.
def pages(self): if not self.limit: return 0 # pragma: no cover else: return int(ceil(self.total / float(self.limit)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pagecount(self):\r\n \r\n return len(self.results) // self.perpage + 1", "def pages(self):\n if self.total > 0 and self.limit > 0:\n return int(ceil(self.total / float(self.limit)))\n return 1", "def paging_results(self):\n\n return 30", "def get_total_page(s...
[ "0.84447044", "0.8412819", "0.81260425", "0.8078535", "0.8027013", "0.80233735", "0.80150545", "0.7710515", "0.7700835", "0.7603633", "0.7562372", "0.7547492", "0.7488338", "0.7451107", "0.73773104", "0.72934484", "0.7266558", "0.72562885", "0.72224087", "0.7176976", "0.70799...
0.85739416
0
An iterable containing the number of pages to be displayed.
def iter_pages(self): for num in range(1, self.pages + 1): yield Page(num)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_num_of_pages(self):", "def pages(self):\n if self._PAGES < 0:\n self.page(1)\n return self._PAGES", "def pages(self):\n return int(ceil(self.count / float(self.page_size)))", "def number_of_pages(self):\n return self._number_of_pages", "def pages(self):\n ...
[ "0.7910008", "0.757842", "0.7327331", "0.7315304", "0.72495705", "0.7192671", "0.7156982", "0.7105721", "0.70693594", "0.6707878", "0.6691973", "0.663016", "0.6613251", "0.66087705", "0.65976113", "0.6572968", "0.6525282", "0.64859027", "0.6480895", "0.6464402", "0.6463601", ...
0.6568869
16
Calculate NDCG. The function assumes, we already sorted everything in the order of decreasing scores.
def __call__(self, relsSortedByScores, qrelDict): idcg = self._dcg(sorted(qrelDict.values(), reverse=True)) return self._dcg(relsSortedByScores) / idcg if idcg > 0 else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ndcg(relevances, rank=10):\n best_dcg = dcg(sorted(relevances, reverse=True), rank)\n if best_dcg == 0:\n return 0.\n return dcg(relevances, rank) / best_dcg", "def _dcg(scores, discount=np.log2):\n scores = np.nan_to_num(scores)\n ranks = np.arange(1, len(scores) + 1)\n disc = disco...
[ "0.7706102", "0.7589097", "0.7228468", "0.7171138", "0.7094153", "0.7087854", "0.7068036", "0.70546424", "0.69466734", "0.67094135", "0.67041653", "0.66926247", "0.6691362", "0.66396123", "0.66211337", "0.65662634", "0.6523564", "0.6415667", "0.64123493", "0.6379668", "0.6338...
0.5376932
52
Calculate mean average precision. The function assumes, we already sorted everything in the order of decreasing scores.
def __call__(self, relsSortedByScores, qrelDict): result = 0. postQty = len(qrelDict) pos = 0 for i, rel in enumerate(relsSortedByScores): if rel > RELEVANCE_THRESHOLD: pos += 1. result += pos / (i + 1.) return result / postQty
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_average_precision(sort_data):\n count_1 = 0\n sum_precision = 0\n for index in range(len(sort_data)):\n if sort_data[index][1] == 1:\n count_1 += 1\n sum_precision += 1.0 * count_1 / (index + 1)\n return sum_precision / count_1", "def meanavgprecision2(actual, pr...
[ "0.77344364", "0.74331063", "0.74262094", "0.7386094", "0.737146", "0.73609775", "0.73609775", "0.73066443", "0.7253883", "0.71996194", "0.71860397", "0.71547127", "0.7134254", "0.7134254", "0.70606595", "0.70552933", "0.70182127", "0.7003582", "0.6988085", "0.69863576", "0.6...
0.0
-1