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
draw a generic stretched rectangle
def rectStreatch(self,(x,y,xs,ys),(u,v,us,vs)): # do clipping now: color = Vec4(1,1,1,1) w = self.w h = self.h u,v,us,vs = u/w,1-v/h,(u+us)/w,1-(v+vs)/h self.drawer.rectangle( x,y,xs,ys, u,v,us-u,vs-v, #u/self.w,v/self.h,us/self.w,vs/self.h, color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectDraw(rect):\n ax = plt.gca()\n w = max(0, rect[1] - rect[0])\n h = max(0, rect[3] - rect[2])\n ax.add_patch(patches.Rectangle((rect[0], rect[2]), w, h, edgecolor='g', facecolor='none'))", "def drawRectangle(width, height, tilt, penColor, fillColor):\n Lucia.color(penColor,fillColor)\n L...
[ "0.7395274", "0.72937334", "0.7197906", "0.71213543", "0.70573896", "0.7036794", "0.7014493", "0.7004895", "0.6928151", "0.69037634", "0.68924004", "0.6890206", "0.68809015", "0.68503785", "0.6802015", "0.67864347", "0.6693077", "0.66908354", "0.66905236", "0.6684021", "0.667...
0.7258826
2
Gifts a bottle of cola!
async def cola( client, event, user: ('user', 'To who?') = None, ): if user is None: source_user = client target_user = event.user else: source_user = event.user target_user = user return Embed(description = f'{source_user:f} just gifted a bottle of cola to {target_user:f} !')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def climb(self):\n print(\"Inside WoodElf.climb\")", "def cool(self):\n self.t = self.t - 1", "def jump(self):\r\n if self.grounded == True:\r\n self.vel.y = -13", "def bounce(self, diff):\r\n\r\n self.direction = (180 - self.direction) % 360\r\n self.dir...
[ "0.61283803", "0.58139145", "0.57736254", "0.56313497", "0.56194353", "0.5569861", "0.55651504", "0.55542326", "0.5510675", "0.55064046", "0.55052066", "0.54641354", "0.54107416", "0.5409724", "0.53897583", "0.53766644", "0.53678995", "0.53670925", "0.53559333", "0.5348638", ...
0.0
-1
Shows the guild's icon.
async def guild_icon( event, choice: (GUILD_ICON_CHOICES, 'Which icon of the guild?' ) = 'icon', ): guild = event.guild if (guild is None) or guild.partial: return Embed('Error', 'The command unavailable in guilds, where the application\'s bot is not in.') if choice == 'icon': name = 'icon' url = guild.icon_url_as(size = 4096) hash_value = guild.icon_hash elif choice == 'banner': name = 'banner' url = guild.banner_url_as(size = 4096) hash_value = guild.banner_hash elif choice == 'discovery_splash': name = 'discovery splash' url = guild.discovery_splash_url_as(size = 4096) hash_value = guild.discovery_splash_hash else: name = 'invite splash' url = guild.invite_splash_url_as(size = 4096) hash_value = guild.invite_splash_hash if url is None: color = (event.id >> 22) & 0xFFFFFF return Embed(f'{guild.name} has no {name}', color = color) color = hash_value & 0xFFFFFF return Embed(f'{guild.name}\'s {name}', color = color, url = url).add_image(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def icon(self, ctx: lifesaver.Context):\n if not ctx.guild.icon:\n await ctx.send(\"This server doesn't have a custom icon.\")\n return\n\n await ctx.send(ctx.guild.icon.replace(format=\"png\"))", "def icon(self) -> str:\n return ICON_SERVER", "def icon(self):\n...
[ "0.79320234", "0.7129427", "0.6738884", "0.6581648", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6533175", "0.6479007", "0.6479007", "0.63814235", "0.6271272", "0.62624985", "0.62624985", "0.62624985"...
0.754903
1
Converts the given Discord snowflake to time.
async def id_to_datetime_( snowflake: ('int', 'Id please!'), ): time = id_to_datetime(snowflake) return f'{time:{DATETIME_FORMAT_CODE}}\n{elapsed_time(time)} ago'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch2time(time):\n\tvalue = datetime.datetime.fromtimestamp(time)\n\tNormal = value.strftime('%Y-%m-%d %H:%M:%S')\n\tprint(normal)\n\treturn normal", "def conv_time(stamp):\n value = datetime.fromtimestamp(stamp)\n return value.strftime('%Y-%m-%d %H:%M:%S')", "def get_time(text_time):\n # return ...
[ "0.5873298", "0.58109105", "0.58083147", "0.5758464", "0.56725055", "0.5670564", "0.5648157", "0.5589003", "0.5543408", "0.5492668", "0.53174144", "0.53155077", "0.5314277", "0.52799726", "0.5264059", "0.5256253", "0.5210616", "0.5203832", "0.5203313", "0.51997644", "0.519302...
0.6189894
0
What should I exactly repeat?
async def repeat( text: ('str', 'The content to repeat') ): if not text: text = 'nothing to repeat' return InteractionResponse(text, allowed_mentions = None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeated_iteration(self) -> global___Statement.Iteration.RepeatedIteration:", "def _do_iteration(self):\n return True", "def everytime(self):\n return True", "def naked_singles(self):\n self.change = True\n while self.change:\n self.naked_round()", "def test_repea...
[ "0.67247885", "0.62914574", "0.62090546", "0.61698216", "0.61460817", "0.6112917", "0.6105271", "0.59547746", "0.5865101", "0.58294857", "0.5821225", "0.5808737", "0.5754446", "0.5729373", "0.570239", "0.5692832", "0.56896436", "0.5685115", "0.5657328", "0.56556696", "0.56434...
0.0
-1
Shows the guild's features.
async def guild_features(event): guild = event.guild return Embed( f'{guild.name}\'s features', ', '.join(sorted(feature.name for feature in guild.iter_features())), ).add_thumbnail( guild.icon_url )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def features():\n\n return render_template('features.html')", "def print_features(self):\n print(feature_print_string.format(self.client_id,\n *tuple(map(lambda x: str(int(x)).zfill(4), self.features))))", "def display_features():\n\n # Parse the URL, check...
[ "0.7203288", "0.66593146", "0.6396423", "0.62870073", "0.620836", "0.60858047", "0.6041121", "0.6025823", "0.59256774", "0.59256774", "0.59256774", "0.59229654", "0.58711076", "0.580933", "0.57830375", "0.5771818", "0.5696934", "0.56376654", "0.56083906", "0.5593481", "0.5589...
0.81271005
0
why are you using this commands?
async def why(client): yield get_neko_life(client, 'why')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd(self):", "def use(self):", "def commands():", "def cli(ctx):", "def cli(ctx):", "def main(self):", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main...
[ "0.711543", "0.6806908", "0.6717425", "0.6515996", "0.6515996", "0.65114516", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0.649807", "0...
0.0
-1
Checks whether the user is banned.
async def is_banned(client, event, user: ('user', 'Who should I check?') ): if not event.user_permissions.can_ban_users: abort('You need to have `ban users` permissions to do this.') if not event.channel.cached_permissions_for(client).can_ban_users: abort('I need to have `ban users` permissions to do this.') yield # Acknowledge the event. try: ban_entry = await client.guild_ban_get(event.guild, user) except DiscordException as err: if err.code == ERROR_CODES.unknown_ban: ban_entry = None else: raise embed = Embed(f'Ban entry for {user:f}').add_thumbnail(user.avatar_url) if ban_entry is None: embed.description = 'The user **NOT YET** banned.' else: embed.description = 'The user is banned.' reason = ban_entry.reason if reason is None: reason = '*No reason was specified.*' embed.add_field('Reason:', reason) yield embed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def bot_check(self, ctx):\n blocked = await self.db.fetchrow(\n \"\"\"\n SELECT *\n FROM blocks\n WHERE user_id=$1\n \"\"\",\n ctx.author.id,\n )\n if blocked is None:\n return True\n raise BlackListed", ...
[ "0.7057368", "0.66175896", "0.6572682", "0.65161735", "0.65136915", "0.64439887", "0.6424201", "0.6409703", "0.6405958", "0.6392394", "0.6381361", "0.636146", "0.63393056", "0.62737966", "0.6236421", "0.61819464", "0.6176241", "0.61632884", "0.61577547", "0.6119847", "0.60957...
0.6633141
1
Shows your or the selected user's id.
async def user_id( event, user_id: ('user_id', 'Get the id of an other user?', 'user') = None, ): if user_id is None: user_id = event.user.id return str(user_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_user(request, user_id):\n return render(request, 'users/view_user.html',\n { })", "def show_user(user_id):\n user = User.query.get(user_id)\n\n return render_template('user.html',user=user)", "def show_user():\n\n return render_template('user/show_by_user.html', title='Show Profile...
[ "0.70061904", "0.6974337", "0.6950619", "0.6897555", "0.6804346", "0.67851716", "0.6750138", "0.67339456", "0.66650236", "0.66331357", "0.6614428", "0.65648824", "0.65122503", "0.65082175", "0.6507262", "0.65002286", "0.6484979", "0.6484979", "0.6449136", "0.6417354", "0.6394...
0.66290426
10
Enables the ping command in your guild.
async def enable_ping( client, event, allow: ('bool', 'Enable?') = True, ): guild = event.guild if guild is None: abort('Guild only command.') if not event.user_permissions.can_administrator: abort('You must have administrator permission to invoke this command.') application_commands = await client.application_command_guild_get_all(guild) for application_command in application_commands: # If you are not working with overlapping names, a name check should be enough. if application_command.name == ping.name: command_present = True break else: command_present = False if allow: if command_present: content = 'The command is already present.' else: await client.application_command_guild_create(guild, ping.get_schema()) content = 'The command has been added.' else: if command_present: await client.application_command_guild_delete(guild, application_command) content = 'The command has been disabled.' else: content = 'The command is not present.' return Embed('Success', content)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def ping_command(self, ctx):\n ping = int(self.client.latency * 1000)\n embed = Embed(\n title=\"Pong!\", description=f\"My ping is {ping}ms.\", color=Color.green()\n )\n await ctx.send(embed=embed)", "async def ping(self, ctx):\r\n embed = discord.Embed(\r\n ...
[ "0.66952026", "0.6496358", "0.64724076", "0.64568186", "0.6376278", "0.6348216", "0.6326083", "0.6313369", "0.62750304", "0.62690145", "0.6257727", "0.6251653", "0.62509406", "0.62384945", "0.6231913", "0.62314135", "0.62132555", "0.61965", "0.61832154", "0.61657685", "0.6158...
0.7750108
0
Returns the selected thread channel's name's length.
async def thread_channel_name_length( channel: ('channel_group_thread', 'Select a thread channel.') ): return len(channel.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def text_channel_name_length(\n channel: Channel\n):\n return len(channel.name)", "async def voice_channel_name_length(\n channel: P('channel', 'Select a voice channel', channel_types = [ChannelType.guild_voice])\n):\n return len(channel.name)", "def channel_size(self):\n if self.chann...
[ "0.79556036", "0.7465818", "0.67134553", "0.6301943", "0.62970394", "0.6221772", "0.61826706", "0.6180919", "0.61410934", "0.6127651", "0.61114144", "0.60849816", "0.6030827", "0.6022877", "0.6015919", "0.60124755", "0.5999161", "0.59950984", "0.5956299", "0.59463084", "0.594...
0.89964545
0
Returns the selected voice channel's name's length.
async def voice_channel_name_length( channel: P('channel', 'Select a voice channel', channel_types = [ChannelType.guild_voice]) ): return len(channel.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def text_channel_name_length(\n channel: Channel\n):\n return len(channel.name)", "async def thread_channel_name_length(\n channel: ('channel_group_thread', 'Select a thread channel.')\n):\n return len(channel.name)", "def namelength(self):\n return self[\"namelength\"]", "def __len_...
[ "0.7998428", "0.72766817", "0.67870444", "0.6776061", "0.6695213", "0.6688253", "0.6598871", "0.65934974", "0.64694244", "0.63770723", "0.6338646", "0.63136065", "0.6306306", "0.63023925", "0.6284565", "0.62841916", "0.62841916", "0.6279189", "0.6251116", "0.62204427", "0.620...
0.88903457
0
Returns the name of the touhou character by it's popularity position.
async def character_popularity( position: P('number', 'Please select a number between 1 and 20', min_value = 1, max_value = 20) ): return MOST_POPULAR_TOUHOU_CHARACTERS[position - 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _name_champion(self):\n # TODO BREAK TIES\n return max(self.teams, key=lambda team: len(team.wins))", "def get_name():\n\n return character['Name']", "def name_at_position(self, i: int) -> str:\n return self.names[i]", "def pname(name):\n ranks = list(reversed(name.split(';')))...
[ "0.615823", "0.61189646", "0.60745996", "0.57972014", "0.5788074", "0.5758207", "0.57052803", "0.5668703", "0.55920833", "0.55471593", "0.55327225", "0.55151343", "0.5483696", "0.547799", "0.54644465", "0.5454449", "0.542765", "0.5390605", "0.53518206", "0.532722", "0.5312515...
0.7177974
0
Edit's the selected user's nick.
async def set_nick( client, event, user: ('user', 'Who\'s?'), nick: P(str, 'Their new nick', min_length = 1, max_length = 32) = None, ): yield await client.user_guild_profile_edit(event.guild, user, nick=nick) yield f'{user:f}\'s nick has been updated'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def nick(\n self, context: Context, user: discord.User, *, nickname: str = None\n ) -> None:\n member = context.guild.get_member(user.id) or await context.guild.fetch_member(\n user.id\n )\n try:\n await member.edit(nick=nickname)\n embed = disc...
[ "0.776619", "0.77194846", "0.7687911", "0.7260133", "0.7148028", "0.70996314", "0.7096527", "0.70569235", "0.7005244", "0.7001775", "0.69678086", "0.6683608", "0.6653393", "0.6652248", "0.6580551", "0.64776564", "0.63855416", "0.6336465", "0.6322602", "0.6313675", "0.62873036...
0.78686786
0
Do I love the cake or nah?
async def cake_love( cake_name: ('str', 'Please pick a cake.') ): return f'Hmmm, yes, I love {cake_name} {EMOJI_CAKE} as well.'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hey(self, msg):\n if issilence(msg):\n return \"Fine. Be that way.\"\n elif isshouting(msg):\n return \"Woah, chill out!\"\n elif isquestion(msg):\n return \"Sure.\"\n else:\n return \"Whatever.\"", "def cheer(self, songs):\n if s...
[ "0.6295088", "0.6273097", "0.6258943", "0.6227304", "0.6204726", "0.61615497", "0.6159582", "0.59585387", "0.5934847", "0.59218514", "0.59041053", "0.58519816", "0.58450353", "0.5841008", "0.5827716", "0.5822664", "0.58197415", "0.58001065", "0.5781325", "0.57723594", "0.5735...
0.5283887
72
Uses the selected spell
async def cast( event, spell: ('str', 'select a spell'), ): spell = get_spell_or_abort(spell) return f'{event.user:f} just used {spell}; It is super effective!'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def func(self):\n spell_list = sorted(SPELLS.keys())\n args = self.args.lower()\n args = args.strip(\" \")\n caller = self.caller\n spell_to_learn = []\n\n if not args or len(args) < 3: # No spell given\n caller.msg(\"Usage: learnspell <spell name>\")\n ...
[ "0.6842631", "0.6699569", "0.6081688", "0.6040999", "0.57929784", "0.578911", "0.57451016", "0.56992674", "0.5644914", "0.56293833", "0.5603479", "0.5585289", "0.5547602", "0.5472606", "0.54705864", "0.5456883", "0.5443241", "0.54431385", "0.5424684", "0.5421093", "0.5412749"...
0.69981647
0
Uses the selected spell
async def upgrade( event, spell: ('str', 'select a spell'), ): spell = get_spell_or_abort(spell) return f'{event.user:f} just upgraded their {spell}; It was a *next* level move!'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def cast(\n event,\n spell: ('str', 'select a spell'),\n):\n spell = get_spell_or_abort(spell)\n \n return f'{event.user:f} just used {spell}; It is super effective!'", "def func(self):\n spell_list = sorted(SPELLS.keys())\n args = self.args.lower()\n args = args.strip(\...
[ "0.6996071", "0.68401766", "0.6699092", "0.6081234", "0.6041909", "0.57928914", "0.5791414", "0.57462186", "0.5697205", "0.56437635", "0.56266904", "0.5601367", "0.5584377", "0.5549065", "0.54703563", "0.5469989", "0.5459944", "0.5440879", "0.5421685", "0.5419961", "0.5412594...
0.5441747
17
Role claimer message. (Owner only)
async def role_claimer(event): # Double check. if not event.user_permissions.can_administrator: abort('Admin only') return InteractionResponse('Claim role by clicking on it', components = ROLE_CLAIMER_COMPONENTS)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def role_command():", "def myrole(var, wrapper, message):\n\n ps = get_participants()\n if wrapper.source not in ps:\n return\n\n role = get_main_role(wrapper.source)\n if role in Hidden:\n role = var.HIDDEN_ROLE\n\n evt = Event(\"myrole\", {\"role\": role, \"messages\": []})\n if...
[ "0.71692383", "0.6773015", "0.67139935", "0.671385", "0.6711312", "0.6706758", "0.66896105", "0.6675753", "0.66679424", "0.6658029", "0.65519524", "0.6475669", "0.6427986", "0.64168537", "0.6382526", "0.6370835", "0.63680696", "0.63477904", "0.63449776", "0.63068354", "0.6286...
0.6386162
14
What is your weakness?
async def choose_your_poison(): return InteractionResponse(embed = Embed('Choose your poison'), components = CHOOSE_YOUR_POISON_ROW)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weakness(self):\r\n return self.weakness", "def is_weak(self):\n return self.binding == 'STB_WEAK'", "def think(self):\n pass", "def set_weakness(self, weakness):\r\n self.weakness = weakness", "def _perturbInPlaceHard(self):\n die", "def weak(self):\n re...
[ "0.6916549", "0.6191317", "0.6120857", "0.6110386", "0.61050045", "0.59646535", "0.5898822", "0.5773751", "0.5765894", "0.56700367", "0.5658522", "0.5572783", "0.5559927", "0.54725146", "0.54229736", "0.5415567", "0.53906286", "0.53847134", "0.5383323", "0.538081", "0.5376386...
0.0
-1
Adds an emoji to the guild.
async def add_emoji( client, event, emoji: ('str', 'The emoji to add.'), name: ('str', 'Custom name to add the emoji with.') = None ): if not client.is_owner(event.user): abort('Owner only!') emoji = parse_emoji(emoji) if emoji is None: abort('That\'s not an emoji.') if emoji.is_unicode_emoji(): abort('Cannot add unicode emojis') if name is None: name = emoji.name else: if len(name) > 32: abort('Name length can be max 32.') embed = Embed('Are you sure to add this emoji?').add_field('Name:', name).add_image(emoji.url) message = yield InteractionResponse(embed = embed, components = ADD_EMOJI_COMPONENTS) try: component_interaction = await wait_for_component_interaction( message, timeout = 300.0, check = functools.partial(check_is_user_same, event.user) ) except TimeoutError: component_interaction = None cancelled = True else: if component_interaction.interaction == ADD_EMOJI_BUTTON_CANCEL: cancelled = True else: cancelled = False if cancelled: embed.title = 'Adding emoji has been cancelled.' else: embed.title = 'Emoji has been added!' async with client.http.get(emoji.url) as response: emoji_data = await response.read() await client.emoji_create(event.guild, name, emoji_data) yield InteractionResponse(embed = embed, components = None, message = message, event = component_interaction)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emoji(self, new_emoji):\n self._manager._items[self.name][\"emoji\"] = new_emoji", "async def process_add_emoji(\n emoji,\n emoji_name,\n user_id,\n ctx: commands.Context = None,\n inter: AppCmdInter = None,\n allowed_mentions=None,\n):\n response_deferred = await defer_inter(inte...
[ "0.7171064", "0.71063775", "0.6896429", "0.68556017", "0.6616149", "0.6526354", "0.6435637", "0.64106715", "0.6385405", "0.6366206", "0.6337566", "0.6321024", "0.6158689", "0.60777974", "0.60739106", "0.6055111", "0.6034358", "0.6017389", "0.5974898", "0.5964543", "0.586553",...
0.75170183
0
Picks who I like the most from the attenders.
async def pick(client, event): users = [event.user] message = yield InteractionResponse(render_joined_users(users), allowed_mentions = None, components = BUTTON_ATTEND) try: async for component_interaction in iter_component_interactions( message, timeout = 60.0, check = functools.partial(check_is_user_unique, users) ): users.append(component_interaction.user) # limit the amount of users to 10. if len(users) == 10: break yield InteractionResponse( render_joined_users(users), allowed_mentions = None, event = component_interaction ) except TimeoutError: component_interaction = None most_liked = pick_most_liked(client, users) content_parts = ['From:'] for user in users: content_parts.append('\n') content_parts.append(user.mention) content_parts.append('\n\nI like ') content_parts.append(most_liked.mention) content_parts.append(' the most.') content = ''.join(content_parts) yield InteractionResponse( content, allowed_mentions = most_liked, components = None, message = message, event = component_interaction )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_winner(): \r\n max_health = Titan.max_health()\r\n winners = tuple((titan.name for titan in Titan.titans if titan.health == max_health))\r\n return winners", "def get_most_popular_merchants(self):\n if self.model:\n return self.model.wv.index_to_key[: self.num_re...
[ "0.5782652", "0.5748125", "0.57463026", "0.57423043", "0.57265854", "0.5470534", "0.54608333", "0.54510725", "0.5380608", "0.5367481", "0.5348207", "0.53333825", "0.5278549", "0.52687156", "0.5235468", "0.52225065", "0.52134794", "0.5213257", "0.52034616", "0.5179194", "0.517...
0.5174069
21
Creates an introduction embed after filling a form.
async def introduce_myself(): return INTRODUCTION_FORM
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_intro():\n return render_template(\"survey_start.html\", survey_title = survey.title, \n survey_instructions = survey.instructions)", "def _build_about_embed(self) -> discord.Embed:\n with self.about_aoc_filepath.open(\"r\", encoding=\"utf8\") a...
[ "0.6209566", "0.612537", "0.61086917", "0.6101209", "0.6089631", "0.58237666", "0.5739323", "0.57388747", "0.56776726", "0.56432605", "0.56215453", "0.5612619", "0.56114054", "0.5608273", "0.56033593", "0.55977595", "0.554897", "0.5476212", "0.54698044", "0.54592586", "0.5456...
0.5328627
27
Add role to a user.
async def add_role( client, event, user: ('user', 'User to add role to'), role: ('role', 'The role to give'), ): # Check for permissions if not event.user_permissions.can_manage_roles: abort('You need `manage roles` permission to invoke this command.') if not event.guild.cached_permissions_for(client).can_manage_roles: abort('I need `manage roles` permission to execute this command.') if not event.user.has_higher_role_than(role): abort('You must have higher role than the role you are trying to give.') if not client.has_higher_role_than(role): abort('I must have higher role than the role you are trying to give.') # Using `.copy_to` on forms works as well. return ADD_ROLE_FORM.copy_with( title = f'Add role {role.name} to {user.full_name}', custom_id = f'add_role.{user.id}.{role.id}', )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def addrole(self, ctx, user: discord.Member=None, *, role=None):\r\n if user is None or role is None:\r\n return await ctx.send(\"Incorrect usage! *;addrole @user role*\")\r\n r = discord.utils.get(ctx.guild.roles, name=str(role))\r\n if r is None:\r\n return await ...
[ "0.82571524", "0.8177443", "0.78452474", "0.7781555", "0.77604127", "0.7734932", "0.7703948", "0.76375777", "0.7601349", "0.74736786", "0.74103475", "0.7407653", "0.7396722", "0.73556995", "0.73501986", "0.72284776", "0.7225049", "0.71885777", "0.7181446", "0.71257436", "0.70...
0.8291285
0
Add a new waifu to the database!
async def add_waifu(): return WAIFU_FORM
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_database():\n db_conn.execute(\"INSERT INTO Fietsenstalling (Naam, Achternaam, Adress, FietsNr, PIN) VALUES \"\n \"(?, ?, ?, ?, ?);\",(Naam, Achternaam, Adress, FietsNr, PIN))\n\n db_conn.commit()", "def addUsertoDatabase(self):\r\n self.c.execute(\"\"\"INSERT INTO stud...
[ "0.62806755", "0.6170017", "0.60218495", "0.59828955", "0.5796458", "0.57776827", "0.5697804", "0.5691923", "0.56790346", "0.5661239", "0.56476194", "0.5644497", "0.563909", "0.5632404", "0.5625129", "0.5596024", "0.5571909", "0.55557925", "0.55294317", "0.55294317", "0.55242...
0.67905253
0
Returns an added waifu.
async def get_waifu( name: ('str', 'Their name?') ): try: waifu = WAIFUS[name.casefold()] except KeyError: abort(f'There is no waifu named like: {name}.') return waifu.embed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def add_waifu():\n return WAIFU_FORM", "def wave_add_new():\n return _u2i(_pigpio_command(_control, _PI_CMD_WVNEW, 0, 0))", "def wishlist_add(request):\n\n result = {}\n\n u = request.user\n\n p = Product.objects.get_by_sku(request.POST['sku'])\n\n if p is None:\n result[\"result\...
[ "0.6947331", "0.5965967", "0.5626294", "0.5455911", "0.53932244", "0.5364499", "0.53162444", "0.5274032", "0.5195086", "0.5140979", "0.5055691", "0.5050816", "0.504182", "0.5026168", "0.50212723", "0.498674", "0.4972312", "0.49669898", "0.4939952", "0.49216947", "0.49164072",...
0.61611295
1
Edits a waifu. | You must own her.
async def edit_waifu( event, name: ('str', 'Their name?'), field : (['age', 'bio', 'hair'], 'Which field to edit?'), ): key = name.casefold() try: waifu = WAIFUS[key] except KeyError: abort(f'There is no waifu named like: {name}.') if waifu.user is not event.user: abort('You can only edit waifus added by yourself.') text_input = FIELD_TO_TEXT_INPUT[field] # We auto-fill the current value text_input = text_input.copy_with(value = FIELD_TO_ATTRIBUTE[field].__get__(waifu, Waifu)) return Form( f'Editing {waifu.name}', [text_input], custom_id = f'{CUSTOM_ID_WAIFU_EDIT_BASE}{key}', )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit():", "def home_edituser():\n\tpass", "def update_user():", "def update_user():\n #TODO user update \n pass", "async def add_waifu():\n return WAIFU_FORM", "def update(self, user: U) -> None:\n ...", "def edit():\n database.ask(mode='single')\n F = database.check(single=Tr...
[ "0.703681", "0.67200714", "0.6531209", "0.6521494", "0.64730537", "0.6406972", "0.6234079", "0.61912", "0.61450255", "0.60919994", "0.60782635", "0.59584224", "0.59353", "0.5903634", "0.5852486", "0.5777315", "0.57746786", "0.5765526", "0.5761504", "0.57450265", "0.57444936",...
0.7640311
0
Shows the given custom emoji.
async def show_emoji( emoji_name: str ): emoji = parse_emoji(emoji_name) if emoji is None: abort('Please give an emoji') if emoji.is_unicode_emoji(): abort('Cannot link unicode emojis.') return f'**Name:** {emoji} **Link:** {emoji.url}'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def emoji(self, ctx):\n emb = discord.Embed(colour=self.color)\n emb.add_field(name='Usage', value=f'```{self.bot.command_prefix}emoji <emojiname>```')\n await ctx.message.edit(embed=emb)", "def is_custom_emoji(self):\n ...", "async def getemoji(self, ctx):\n pass", "...
[ "0.74917614", "0.6761148", "0.6492297", "0.619809", "0.61710256", "0.6136859", "0.61155015", "0.6039681", "0.59957427", "0.5945978", "0.5936778", "0.5936708", "0.58585626", "0.5836026", "0.5809411", "0.5724715", "0.5692132", "0.5662418", "0.5606713", "0.55910206", "0.5587064"...
0.75498223
0
Returns the selected text channel's name's length.
async def text_channel_name_length( channel: Channel ): return len(channel.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def voice_channel_name_length(\n channel: P('channel', 'Select a voice channel', channel_types = [ChannelType.guild_voice])\n):\n return len(channel.name)", "async def thread_channel_name_length(\n channel: ('channel_group_thread', 'Select a thread channel.')\n):\n return len(channel.name)", ...
[ "0.7989445", "0.77088827", "0.67712826", "0.6691694", "0.6674016", "0.6535482", "0.64485866", "0.6269007", "0.6205133", "0.61872053", "0.6186812", "0.6179118", "0.6176119", "0.6155029", "0.61237496", "0.6103924", "0.60789996", "0.60677344", "0.6062524", "0.6050127", "0.605012...
0.85015506
0
Encode a position given in float arguments latitude, longitude to a geohash which will have the character count precision.
def geohash_encode(latitude, longitude, precision=12): lat_interval, lon_interval = (-90.0, 90.0), (-180.0, 180.0) base32 = '0123456789bcdefghjkmnpqrstuvwxyz' geohash = [] bits = [16, 8, 4, 2, 1] bit = 0 ch = 0 even = True while len(geohash) < precision: if even: mid = (lon_interval[0] + lon_interval[1]) / 2 if longitude > mid: ch |= bits[bit] lon_interval = (mid, lon_interval[1]) else: lon_interval = (lon_interval[0], mid) else: mid = (lat_interval[0] + lat_interval[1]) / 2 if latitude > mid: ch |= bits[bit] lat_interval = (mid, lat_interval[1]) else: lat_interval = (lat_interval[0], mid) even = not even if bit < 4: bit += 1 else: geohash += base32[ch] bit = 0 ch = 0 return ''.join(geohash)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(latitude, longitude, precision=12):\n lat_interval, lon_interval = (-90.0, 90.0), (-180.0, 180.0)\n geohash = []\n bits = [ 16, 8, 4, 2, 1 ]\n bit = 0\n ch = 0\n even = True\n while len(geohash) < precision:\n if even:\n mid = (lon_interval[0] + lon_interval[1]) / ...
[ "0.7769761", "0.7752675", "0.72821146", "0.71992105", "0.6168017", "0.61100185", "0.59604454", "0.5934149", "0.5906312", "0.5894907", "0.5872776", "0.58589303", "0.56805354", "0.5602078", "0.5597624", "0.5574245", "0.5522198", "0.5442411", "0.537271", "0.5353991", "0.53291243...
0.79064786
0
Return the header of request.
def _get_request_header() -> Dict: metas, envs = get_full_version() header = { **{f'jinameta-{k}': str(v) for k, v in metas.items()}, **envs, } return header
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_header(self):\n return self._header", "def getHeader():\n return _HEADER", "def header(self):\n return self._header", "def header(self):\n return self._header", "def header(self):\n return self._header", "def getHeader(self):\n return self.data.header", "de...
[ "0.8271102", "0.8128856", "0.7752471", "0.7752471", "0.7752471", "0.77344984", "0.76949877", "0.7601719", "0.7559333", "0.75524616", "0.7516345", "0.7507523", "0.72965723", "0.72964346", "0.72653186", "0.7242549", "0.72425336", "0.7175708", "0.7161306", "0.71201324", "0.71052...
0.69505686
28
Push the executor pacakge to Jina Hub.
def push(self) -> None: with ImportExtensions(required=True): import requests pkg_path = Path(self.args.path) if not pkg_path.exists(): self.logger.critical(f'`{self.args.path}` is not a valid path!') exit(1) request_headers = self._get_request_header() try: # archive the executor package with TimeContext(f'Packaging {self.args.path}', self.logger): md5_hash = hashlib.md5() bytesio = archive_package(pkg_path) content = bytesio.getvalue() md5_hash.update(content) md5_digest = md5_hash.hexdigest() # upload the archived package form_data = { 'public': self.args.public if hasattr(self.args, 'public') else False, 'private': self.args.private if hasattr(self.args, 'private') else False, 'md5sum': md5_digest, 'force': self.args.force, 'secret': self.args.secret, } method = 'put' if self.args.force else 'post' hubble_url = get_hubble_url() # upload the archived executor to Jina Hub with TimeContext( f'Pushing to {hubble_url} ({method.upper()})', self.logger, ): resp = getattr(requests, method)( hubble_url, files={'file': content}, data=form_data, headers=request_headers, ) if 200 <= resp.status_code < 300: # TODO: only support single executor now image = resp.json()['executors'][0] uuid8 = image['id'] secret = image['secret'] visibility = image['visibility'] info_table = [ f'\t🔑 ID:\t\t' + colored(f'{uuid8}', 'cyan'), f'\t🔒 Secret:\t' + colored( f'{secret}', 'cyan', ) + colored( ' (👈 Please store this secret carefully, it wont show up again)', 'red', ), f'\t👀 Visibility:\t' + colored(f'{visibility}', 'cyan'), ] if 'alias' in image: info_table.append(f'\t📛 Alias:\t' + colored(image['alias'], 'cyan')) self.logger.success(f'🎉 Executor `{pkg_path}` is pushed successfully!') self.logger.info('\n' + '\n'.join(info_table)) usage = ( f'jinahub://{uuid8}' if visibility == 'public' else f'jinahub://{uuid8}:{secret}' ) self.logger.info(f'You can use it via `uses={usage}` in the Flow/CLI.') elif resp.text: # NOTE: sometimes resp.text returns empty raise Exception(resp.text) else: resp.raise_for_status() except Exception as e: # IO related errors self.logger.error( f'Error while pushing `{self.args.path}` with session_id={request_headers["jinameta-session-id"]}: ' f'\n{e!r}' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launch():\n\n core.openflow.addListenerByName(\"ConnectionUp\", _handle_ConnectionUp)\n log.info(\"Hub running\")", "def pull(self) -> None:\n cached_zip_filepath = None\n try:\n scheme, name, tag, secret = parse_hub_uri(self.args.uri)\n\n executor = HubIO.fetch(name...
[ "0.6232041", "0.5887297", "0.58601266", "0.58165723", "0.5768271", "0.56156373", "0.55585796", "0.55408835", "0.5533365", "0.5520638", "0.5495429", "0.54430073", "0.5429095", "0.5398484", "0.53716093", "0.53678733", "0.5364028", "0.53437376", "0.5337322", "0.5332302", "0.5331...
0.7116745
0
Fetch the executor meta info from Jina Hub.
def fetch( name: str, tag: Optional[str] = None, secret: Optional[str] = None, ) -> HubExecutor: with ImportExtensions(required=True): import requests pull_url = get_hubble_url() + f'/{name}/?' path_params = {} if secret: path_params['secret'] = secret if tag: path_params['tag'] = tag request_headers = HubIO._get_request_header() pull_url += urlencode(path_params) resp = requests.get(pull_url, headers=request_headers) if resp.status_code != 200: if resp.text: raise Exception(resp.text) resp.raise_for_status() resp = resp.json() result = HubExecutor( resp['id'], resp.get('alias', None), resp['tag'], resp['visibility'], resp['image'], resp['package']['download'], resp['package']['md5'], ) return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_info(self):\n return self._execute_info", "def get_hub_info(self, session_key):\n \n username = None\n password = None\n hub_address = None\n hub_port = None\n \n uri = urllib.quote('/servicesNS/nobody/insteon_control/admin/alert_actions/send_in...
[ "0.5562067", "0.5546919", "0.5502387", "0.54784894", "0.542903", "0.5346842", "0.532653", "0.5297018", "0.5291502", "0.52755237", "0.5223626", "0.52146435", "0.5180011", "0.51614326", "0.51614326", "0.5159329", "0.51201266", "0.51103526", "0.5103046", "0.5100491", "0.50945884...
0.530817
7
Pull the executor package from Jina Hub.
def pull(self) -> None: cached_zip_filepath = None try: scheme, name, tag, secret = parse_hub_uri(self.args.uri) executor = HubIO.fetch(name, tag=tag, secret=secret) if not tag: tag = executor.tag uuid = executor.uuid image_name = executor.image_name archive_url = executor.archive_url md5sum = executor.md5sum if scheme == 'jinahub+docker': # pull the Docker image with TimeContext(f'pulling {image_name}', self.logger): image = self._client.images.pull(image_name) if isinstance(image, list): image = image[0] image_tag = image.tags[0] if image.tags else '' self.logger.success( f'🎉 pulled {image_tag} ({image.short_id}) uncompressed size: {get_readable_size(image.attrs["Size"])}' ) return if exist_local(uuid, tag): self.logger.debug( f'The executor `{self.args.uri}` has already been downloaded.' ) return # download the package with TimeContext(f'downloading {self.args.uri}', self.logger): cache_dir = Path( os.environ.get( 'JINA_HUB_CACHE_DIR', Path.home().joinpath('.cache', 'jina') ) ) cache_dir.mkdir(parents=True, exist_ok=True) cached_zip_filename = f'{uuid}-{md5sum}.zip' cached_zip_filepath = download_with_resume( archive_url, cache_dir, cached_zip_filename, md5sum=md5sum, ) with TimeContext(f'unpacking {self.args.uri}', self.logger): try: install_local( cached_zip_filepath, uuid, tag, install_deps=self.args.install_requirements, ) except Exception as ex: raise HubDownloadError(str(ex)) except Exception as e: self.logger.error( f'Error when pulling the executor `{self.args.uri}`: {e!r}' ) finally: # delete downloaded zip package if existed if cached_zip_filepath is not None: cached_zip_filepath.unlink()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(self) -> None:\n\n with ImportExtensions(required=True):\n import requests\n\n pkg_path = Path(self.args.path)\n if not pkg_path.exists():\n self.logger.critical(f'`{self.args.path}` is not a valid path!')\n exit(1)\n\n request_headers = self._g...
[ "0.641738", "0.61639076", "0.58618015", "0.5724971", "0.53448755", "0.52730477", "0.5237997", "0.5234491", "0.52015465", "0.51506555", "0.5101893", "0.5095056", "0.5087197", "0.50491524", "0.5016268", "0.50123864", "0.5008125", "0.50051403", "0.4996761", "0.4936391", "0.49340...
0.77400756
0
Function identifie_cross Identifie the person in the set of corrds given by PoseNet using both methods
def identifie_cross(self, image, keypoints_list, keypoint_coords, lambda_factor=0.8): return self.char_color.identifie_cross(image, keypoints_list, keypoint_coords, lambda_factor=lambda_factor)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crossover(cross):\r\n @functools.wraps(cross)\r\n def ecspy_crossover(random, candidates, args):\r\n if len(candidates) % 2 == 1:\r\n candidates = candidates[:-1]\r\n moms = candidates[::2]\r\n dads = candidates[1::2]\r\n children = []\r\n for i, (mom, dad) i...
[ "0.58072054", "0.5740432", "0.5660291", "0.5618433", "0.54590535", "0.5400549", "0.53195125", "0.5265565", "0.5245429", "0.5224387", "0.51929295", "0.51769614", "0.5158133", "0.5128788", "0.5099165", "0.50943536", "0.50907815", "0.5070936", "0.50548255", "0.5045334", "0.50396...
0.5539348
4
Function put_histogram Create the histogram of color of the person under it Color field
def put_histogram(self, img, coords): self.char_color.update(img, coords)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_histogram(self, tag, values, global_step=None, bins='tensorflow'):\n values = make_np(values)\n self.vis.histogram(make_np(values), opts={'title': tag})", "def makeHistogram(values, numBins, xLabel, yLabel, title=None):", "def hist(self):\r\n plt.hist(self.data_array, bins='auto', ...
[ "0.6663404", "0.6595014", "0.63798743", "0.63636565", "0.63032633", "0.6286832", "0.62409437", "0.62236524", "0.6212975", "0.62078536", "0.6198712", "0.6159521", "0.61527514", "0.61278516", "0.6118984", "0.60784984", "0.60736775", "0.60601574", "0.6052596", "0.6043766", "0.60...
0.7029851
0
Reopen streams here to prevent buffering.
def reopen_streams(self): sys.stdin = os.fdopen(0, 'r', 0) sys.stdout = os.fdopen(1, 'w', 0) sys.stderr = os.fdopen(2, 'w', 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reopen():", "def refresh(self) -> None:\n if self._is_buffer_full():\n self.stream.close()\n self._open_stream() # re-initial self.stream\n self._buffer = bytearray()\n self._buffer_pointer = -1", "def reopen_files(self):\r\n for log in (self.error_log...
[ "0.7697773", "0.6703574", "0.6626337", "0.6617042", "0.654685", "0.65099376", "0.6501303", "0.6500059", "0.64899385", "0.64335364", "0.6267602", "0.6215058", "0.61688745", "0.61634976", "0.61516905", "0.6137321", "0.61222017", "0.6106612", "0.6052286", "0.6048962", "0.6047413...
0.80338305
0
it's required that the object be in SORT1
def finalize(self): self.set_as_sort1()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sorted(self): \n pass", "def sortby(self):\n ...", "def reversesort(self):\n ...", "def set_as_sort1(self):\n if self.is_sort1:\n #if self.analysis_code == 1:\n #self.nonlinear_factor = np.nan\n #print(self.data_code)\n #...
[ "0.6844052", "0.6644081", "0.64807296", "0.63492376", "0.6294889", "0.6287909", "0.6287909", "0.62629074", "0.6159198", "0.6130732", "0.60078466", "0.6003925", "0.58911306", "0.5833647", "0.5817837", "0.57982904", "0.5785331", "0.5744834", "0.5734182", "0.57251596", "0.569137...
0.60771483
10
the data is in SORT1, but the flags are wrong
def set_as_sort1(self): if self.is_sort1: #if self.analysis_code == 1: #self.nonlinear_factor = np.nan #print(self.data_code) #print(self._times, type(self._times)) #aaa return #print(f'{self.class_name}-{self.table_name}') self.table_name = SORT2_TABLE_NAME_MAP[self.table_name] self.sort_bits[1] = 0 # sort1 self.sort_method = 1 assert self.is_sort1 is True, self.is_sort1 self._update_time_word()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data_for_sorting() -> NoReturn:\n raise NotImplementedError", "def data_for_sorting() -> NoReturn:\n raise NotImplementedError", "def reversesort(self):\n ...", "def oldsortslice(self):\n ...", "def data_for_sorting():\n return RaggedArray([[1, 0], [2, 0], [0, 0]])", "def sortK...
[ "0.53327185", "0.53327185", "0.53093725", "0.52391124", "0.5232353", "0.52152324", "0.52016133", "0.5197189", "0.51695603", "0.5158035", "0.51258236", "0.5116387", "0.51104957", "0.5099126", "0.5062088", "0.5054855", "0.5042443", "0.5038638", "0.5018408", "0.50026417", "0.499...
0.6509692
0
Render view to show appointment has been scheduled successfully
def complete_appointment(request, calendar_id): calendar = Calendar.objects.get(pk=calendar_id) return render(request, 'complete_appointment.html', {'calendar': calendar})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule(request):\r\n\r\n return render(request, 'editorial/schedule.html', {})", "def schedule(request):\n return render(request, 'vaxcharts/schedule.html')", "def completed_appointments(request):\n appointments = AppointmentRequests.objects.all().filter(completed=True)\n return render(reques...
[ "0.73396885", "0.71008706", "0.69112563", "0.68383145", "0.6778799", "0.67298746", "0.6640715", "0.65311074", "0.6378886", "0.632984", "0.62694013", "0.6260236", "0.62068444", "0.62027246", "0.6160487", "0.6143634", "0.6137082", "0.6105613", "0.6103373", "0.60935265", "0.6009...
0.6915958
2
View a customized calendar
def calendar_view(request, calendar_id): calendar_obj = Calendar.objects.get(pk=calendar_id) try: appointments = Appointment.objects.all().filter(calendar=calendar_obj) appointments = jsonify(appointments) except: appointments = [] calendar_obj = calendar_obj.serialize() calendar_obj["non_working_days"] = [day for day in [0, 1, 2, 3, 4, 5, 6] if day not in calendar_obj["working_days"]] return render(request, 'calendar_view.html', {'calendar_obj': calendar_obj, 'appointments': appointments})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_cal(request, year=None, month=None):\n if year == None:\n # get the current comic as a starting point\n lToday = Comic.objects.filter(published=True).order_by('-date')[0].date\n year = lToday.year\n month = lToday.month\n\n return calendar(request, year, month)", "def c...
[ "0.7174143", "0.6856298", "0.68165946", "0.65732276", "0.64761686", "0.64670926", "0.6392814", "0.6325244", "0.6318216", "0.61248857", "0.61215866", "0.61215866", "0.611085", "0.6099675", "0.6070785", "0.60701156", "0.60354185", "0.6012115", "0.6007833", "0.60075265", "0.6006...
0.5767331
44
View function to handle our create appointment form
def save_appointment_details(request, calendar_id): def schedule_mail(reminder_date, appointment): # Configure our scheduler for reminder try: trigger = DateTrigger(run_date=reminder_date) scheduler.add_job(send_appointment_mail, args=[appointment], trigger=trigger) except Exception as exp: print(exp) def schedule_sms(reminder_date, appointment): # Configure our scheduler for reminder try: trigger = DateTrigger(run_date=reminder_date) scheduler.add_job(send_appointment_sms, args=[appointment], trigger=trigger) except Exception as exp: print(exp) start_time = request.GET['start_time'][:19] end_time = request.GET['end_time'][:19] start_time = datetime.strptime(start_time, "%Y-%m-%dT%H:%M:%S") end_time=datetime.strptime(end_time, "%Y-%m-%dT%H:%M:%S") calendar_obj = Calendar.objects.get(pk=calendar_id) # if this is a POST request we need to process the form data if request.method == 'POST': # create a form instance and populate it with data from the request: form = AppointmentForm(request.POST) # check whether it's valid and save it if form.is_valid(): # Save appointment details mobilephone = form.data['mobilephone'] email = form.data['email'] first_name = form.data['first_name'] last_name = form.data['last_name'] notes = form.data['notes'] appointment = Appointment(start_time=start_time, end_time=end_time, first_name=first_name, last_name=last_name, email=email, mobilephone=mobilephone, notes=notes) appointment.calendar = calendar_obj appointment.save() try: send_appointment_mail(appointment) # send appointment details email except Exception as exp: print(exp) try: send_appointment_sms(appointment) # send appointment details sms except Exception as exp: print(exp) # Calculate reminder schedule dates reminder1 = start_time - timedelta(hours=2) reminder2 = start_time - timedelta(hours=24) reminder3 = start_time - timedelta(days=7) # Schedule mails schedule_mail(reminder1, appointment) schedule_mail(reminder2, appointment) schedule_mail(reminder3, appointment) # Schedule sms schedule_sms(reminder1, appointment) schedule_sms(reminder2, appointment) schedule_sms(reminder3, appointment) return redirect(reverse('appointment:complete_appointment', args=[calendar_id])) # if a GET (or any other method) we'll create a blank form else: form = AppointmentForm() return render(request, 'appointment_form.html', {'form': form, 'start_time': start_time, 'end_time': end_time, 'office_location': calendar_obj.office_location})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_appointment():\n\n form = AppointmentForm()\n\n if form.validate_on_submit():\n\n appointment = Appointment(\n title = form.title.data,\n description = form.description.data,\n location = form.location.data,\n start = form.start.data,\n ...
[ "0.7959271", "0.7628927", "0.7594305", "0.75070536", "0.6968844", "0.6689058", "0.65166914", "0.6325348", "0.62968016", "0.6250767", "0.6221335", "0.6216348", "0.62076926", "0.6130234", "0.6045082", "0.59900767", "0.59859955", "0.5985113", "0.5973313", "0.5966656", "0.5902615...
0.5967904
19
Delete an appointment from the appointment table
def delete_appointment(request, appointment_id): appointment_id = appointment_id if not appointment_id: return HttpResponse("Please provide an appointment Id"), 406 try: appointment = Appointment.objects.get(id=int(appointment_id)) except: return HttpResponse("No appointment with that ID exist"), 404 appointment.delete() return HttpResponse("Successfully Deleted")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_patient_appointment():\n if request.method == 'POST':\n appointment_id = request.form['appointment_id']\n response_delete_patient_appointment = requests.post(server_url + 'patient/delete_appointment', json={\n 'appointment_id': appointment_id\n })\n response_del...
[ "0.7246865", "0.69911546", "0.6967758", "0.69243217", "0.6683708", "0.6667006", "0.64580506", "0.6360693", "0.63219357", "0.6229985", "0.6189006", "0.6186252", "0.6182702", "0.615862", "0.61367667", "0.6119257", "0.6077346", "0.60747683", "0.60690594", "0.6059356", "0.605511"...
0.7938065
0
Creates a customisable calendar
def create_calendar(request): if request.method == 'POST': form = CalendarForm(request.POST) if form.is_valid(): calendar = form.save(commit=False) # prvent form from saving since we need to link company calendar.company = request.user.company calendar.save() return redirect('appointment:calendar_list') else: form = CalendarForm() return render(request, 'calendar_form.html', {'form': form})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_calendar(\n self, name=None, cal_id=None, supported_calendar_component_set=None\n ):\n return self.calendar_home_set.make_calendar(\n name,\n cal_id,\n supported_calendar_component_set=supported_calendar_component_set,\n )", "def create_events_cal...
[ "0.7056294", "0.69618356", "0.69175917", "0.68492675", "0.66771054", "0.6389119", "0.63841164", "0.633121", "0.6214401", "0.6132738", "0.6132738", "0.61323744", "0.60814935", "0.6077951", "0.6074474", "0.605173", "0.603549", "0.6033712", "0.60026586", "0.5928988", "0.58628964...
0.5768252
24
For a given reward function and horizon, calculate the MaxEnt policy that gives equal weight to equal reward trajectorie \s
def calcMaxEntPolicy(trans_mat, horizon, r_weights, state_features): n_states = np.shape(trans_mat)[0] n_actions = np.shape(trans_mat)[1] partition = np.zeros((n_states, 1)) policy = np.zeros((n_states, n_actions)) partition[n_states-1] = 1 reward = np.exp(np.dot(r_weights, state_features.T)) # Calculate partition function for each state and policy value for (state,action) for i in range(horizon): new_partition = partition for state in range(n_states): for action in range(n_actions): p = np.array([trans_mat[state, action, new_state]*reward[state]*partition[new_state] for new_state in range(n_states)]) policy[state, action] = np.sum(p) new_partition[state] = np.sum(policy[state, :]) if state == n_states-1: new_partition[state] = 1 partition = new_partition # Local action probability computation for state in range(n_states): for action in range(n_actions): if partition[state] != 0.0: policy[state, action] = policy[state, action] / partition[state] return policy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_policy(env, policy, V, discount_factor):\n\n for state in range(env.nS):\n # for a given state compute state-action value.\n action_values = one_step_lookahead(env, state, V, discount_factor)\n\n # choose the action which maximizes the state-action value.\n policy[state] =...
[ "0.65174586", "0.6455131", "0.62911916", "0.6210671", "0.61917514", "0.6106755", "0.60980415", "0.60720646", "0.6065897", "0.60095304", "0.5995886", "0.5988406", "0.59755456", "0.5938648", "0.59124494", "0.5908187", "0.58875597", "0.58874375", "0.58826035", "0.5856284", "0.58...
0.71800405
0
Given a MaxEnt policy, begin with the start state distribution and propagate forward to find the expected state frequencies over the horizon
def calcExpectedStateFreq(trans_mat, horizon, start_dist, policy): n_states = np.shape(trans_mat)[0] n_actions = np.shape(trans_mat)[1] # Copy start_dist for complete horizon, states x horizon exp_svf = np.zeros((n_states, horizon)) exp_svf[0,0] = 1.0 # Calculate Expected State Frequency for (state, time) pair for time in range(1, horizon): for state, action, new_state in product(range(n_states), range(n_actions), range(n_states)): exp_svf[new_state, time] += (exp_svf[state, time-1]* policy[state, action]* trans_mat[state, action, new_state]) state_freq = exp_svf.sum(axis=1) return state_freq
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calcMaxEntPolicy(trans_mat, horizon, r_weights, state_features):\n\tn_states = np.shape(trans_mat)[0]\n\tn_actions = np.shape(trans_mat)[1]\n\n\tpartition = np.zeros((n_states, 1))\n\tpolicy = np.zeros((n_states, n_actions))\n\n\tpartition[n_states-1] = 1\n\treward = np.exp(np.dot(r_weights, state_features.T))...
[ "0.6379594", "0.6345793", "0.62748617", "0.6227867", "0.61537546", "0.60586053", "0.60436994", "0.60436994", "0.6035179", "0.6025242", "0.6023306", "0.60075766", "0.5958909", "0.59503", "0.5950126", "0.5924466", "0.5919219", "0.5919196", "0.5918052", "0.58889544", "0.5880986"...
0.70631313
0
Compute expected feature expectations from demonstration trajectories
def find_feature_expectations(state_features, demos): feature_exp = np.zeros(state_features.shape[1]) for demo in demos: for state in demo: feature_exp += state_features[state] # Expected feature_exp return feature_exp/np.shape(demos)[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_predictor():", "def test_basic(self):\n data = get()\n metrics = [verif.metric.Within(),\n verif.metric.A(), # Hit\n verif.metric.B(), # FA\n verif.metric.C(), # Miss\n verif.metric.D(), # Correct rejection\n v...
[ "0.6707237", "0.6620154", "0.6500564", "0.64482635", "0.6439859", "0.6421214", "0.6377413", "0.6242838", "0.62241733", "0.61963874", "0.61854374", "0.6150502", "0.6111971", "0.6109932", "0.60865235", "0.60865235", "0.6078514", "0.6074583", "0.6064137", "0.6050908", "0.6041128...
0.6980132
0
Compute a MaxEnt reward function from demonstration trajectories
def maxEntIRL(trans_mat, state_features, demos, seed_weights, n_epochs, horizon, learning_rate): feature_exp = find_feature_expectations(state_features, demos) n_states = np.shape(trans_mat)[0] n_actions = np.shape(trans_mat)[1] n_features = np.shape(state_features)[1] r_weights = np.zeros(n_features) + seed_weights # Probability for initial state trajectories start_state_count = np.zeros(n_states) for demo in demos: start_state_count[demo[0]] += 1 p_start_dist = start_state_count / np.shape(demos)[0] # Iterate for epoch in range(n_epochs): # print("epoch: {}".format(epoch)) # Calculate Max Ent Policy policy = calcMaxEntPolicy(trans_mat, horizon, r_weights, state_features) # Calculate Expected State Frequency expected_svf = calcExpectedStateFreq(trans_mat, horizon, p_start_dist, policy) # Update reward weights using gradient gradient = feature_exp - expected_svf.T.dot(state_features) r_weights += learning_rate * gradient print epoch, np.linalg.norm(gradient) print policy print policy.argmax(axis=1) return r_weights
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dense_reward(self) -> float:\n y = 1\n target_goal_dists = []\n for target_shape in self.__debris_shapes:\n target_pos = target_shape.shape_body.position\n goal_pos = (target_pos[0], y) # Top of screen.\n dist = np.linalg.norm(target_pos - goal_pos)\n ...
[ "0.6783421", "0.6575619", "0.646106", "0.64347804", "0.63848096", "0.63675916", "0.63455665", "0.6339959", "0.63341564", "0.6327008", "0.63198864", "0.6301124", "0.62738556", "0.627058", "0.62632287", "0.6244055", "0.62065756", "0.61828387", "0.61823547", "0.61772585", "0.617...
0.65270555
2
Unfolds a tensor T into a matrix, taking the dimension "dim" of T as the first dimension of the matrix, and flattening all the other dimensions into the other one dimension of the matrix. dim starts from 0.
def unfold(T, dim): Tm=np.moveaxis(T, dim, 0) return Tm.reshape(T.shape[dim],-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten(tensor):\n C = tensor.size(1)\n # new axis order\n axis_order = (1, 0) + tuple(range(2, tensor.dim()))\n # Transpose: (N, C, D, H, W) -> (C, N, D, H, W)\n transposed = tensor.permute(axis_order)\n # Flatten: (C, N, D, H, W) -> (C, N * D * H * W)\n return transposed.contiguous().vie...
[ "0.7043688", "0.6872559", "0.6866148", "0.6625046", "0.6595738", "0.6544334", "0.6462534", "0.6318924", "0.63155955", "0.6307684", "0.6298893", "0.62986493", "0.62389565", "0.6198749", "0.6193831", "0.6192542", "0.6138287", "0.60814816", "0.6069293", "0.6062363", "0.60362655"...
0.81962144
0
nMode product of a tensor T and a matrix M, the summation is made along the nth dim. definition in paper "A MULTILINEAR SINGULAR VALUE DECOMPOSITION" by LIEVEN DE LATHAUWER , BART DE MOOR , AND JOOS VANDEWALLE For example, n with value 0, 1, or 2, would specify the 1st, 2nd or 3rd dim of the tensor T. For the matrix M, this function always take the second dimension, as if to multiply T by M on the left side.
def nModeProduct(T, M, n): P=tensordot(T, M, axes=([n], [1])) return np.rollaxis(P, len(T.shape)-1, n)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ttm(t, m, k):\n\n dim_list = [] # initialize a list to save dimension index to transpose the tensor reshapped from 2D matrix\n shape_list = [] # initialize a list to save the dimensions to reshape 2D matrix back to tensor\n total_dim = len(t.shape)\n for i in range(total_dim):\n dim_list.a...
[ "0.60840887", "0.5962957", "0.5834595", "0.57553023", "0.5729404", "0.56230754", "0.55998474", "0.558549", "0.55777717", "0.5541569", "0.54854864", "0.54752266", "0.53972495", "0.53863096", "0.53441954", "0.5337099", "0.5322091", "0.5305267", "0.5296987", "0.52967924", "0.527...
0.84308904
0
High order svd of ddim tensor A. so that A = S (1) u1 (2) u2 (3) u3 ... (d) ud, "(n)" means nmode product. S is the core, u1,u2,u3, ... are orthogonal basis. definition in paper "A MULTILINEAR SINGULAR VALUE DECOMPOSITION" by LIEVEN DE LATHAUWER , BART DE MOOR , AND JOOS VANDEWALLE
def HOSVD(A, k=None, tol=None): d=len(A.shape) if d==2: u, s, vt=svd(A, full_matrices=False) U=[u, vt.T] S=np.diag(s) else: U=[None]*d for j in range(0, d): U[j], s, vt=svd(unfold(A, j), full_matrices=False) S=A.copy() for i in range(0, d): S=nModeProduct(S, U[i].T, i) if k is not None: if isinstance(k, int): # if only one integer is assigned to k k=k*np.ones((len(A.shape),), dtype=int) S=subTensor(S, k=k) for j in range(0, d): U[j]=U[j][:, :k[j]] return S, U
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def svd0(A):\n M,N = A.shape\n if M>N: return sla.svd(A, full_matrices=True)\n else: return sla.svd(A, full_matrices=False)", "def svd(self, X): # [5pts]\n N,D = X.shape[0],X.shape[1]\n if X.ndim == 3:\n U = np.zeros((N,N,3))\n S = np.zeros((min(N,D),3))\n V = ...
[ "0.7485799", "0.7444824", "0.7392306", "0.73218936", "0.7318503", "0.7112886", "0.70934653", "0.7035592", "0.70275265", "0.7018896", "0.6982395", "0.6862845", "0.67582536", "0.67388934", "0.66284513", "0.6591925", "0.65776706", "0.6568088", "0.65605414", "0.65488946", "0.6543...
0.64440066
22
This is a recursive partioned QR. about two times faster than QR for tall matrices
def fast_qr(A): N,M=A.shape if N < M: Q, R =qr(A) # not tall matrices, use normal qr elif M>16: # the minimal partition size is 32 R=np.zeros((M,M)) k= np.ceil(M/2).astype(int) qa, R[:k, :k]=fast_qr(A[:,:k]) R[:k,k:] = np.dot(qa.T, A[:,k:]) qb, R[k:, k:]=fast_qr(A[:,k:]-np.dot(qa, R[:k,k:])) Q = np.hstack((qa, qb)) else: # reach the smallest partition size, no more partitions, use normal qr Q, R =qr(A) return Q, R
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def qr(in_A):\n # input checks\n Ndim = numpy.ndim(in_A)\n assert Ndim == 2\n N,M = numpy.shape(in_A)\n assert N==M\n D,P = in_A[0,0].data.shape\n\n # prepare R and QT\n R = in_A.copy()\n QT = numpy.array([[UTPS(numpy.zeros((D,P))) for c in range(N)] for r in range(N) ])\n for n in ra...
[ "0.7430045", "0.71422714", "0.6963531", "0.68576527", "0.6795892", "0.66816163", "0.65249866", "0.65225244", "0.65213066", "0.65106", "0.64953566", "0.6453057", "0.64338183", "0.64164525", "0.63908815", "0.63486344", "0.62450737", "0.6244796", "0.62227124", "0.62222993", "0.6...
0.74643546
0
This is a new version of extend_dims() function of numpy, it extend multiple dims rather than one.
def new_expand_dims(a, axes): # if int is passed, retain the same behaviour if type(axes) == int: return np.expand_dims(a, axes) # insert axes to given indices for ax in sorted(axes): a = np.expand_dims(a, ax) return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend(a, b):\n if np.isscalar(a):\n return a\n # CRUFT: python 2.7 support\n extra_dims = (1,)*(b.ndim-a.ndim)\n return a.reshape(a.shape + extra_dims)\n # python 3 uses\n #extra_dims = (np.newaxis,)*(b.ndim-a.ndim)\n #return a[(..., *extra_dims)]", "def expand_dims(array):\n ...
[ "0.70451933", "0.6982546", "0.673844", "0.66155654", "0.65966463", "0.64626193", "0.6444467", "0.6379055", "0.62785256", "0.62534416", "0.6246189", "0.6212844", "0.61804307", "0.61784613", "0.60776794", "0.5881329", "0.58224505", "0.57709056", "0.57032615", "0.569746", "0.566...
0.642201
7
Populates CLOUDS variable with mappings from providers to clouds
def _populate_clouds(): for key, value in list(globals().items()): if not key.startswith('_') and key.endswith( 'Cloud') and key != 'Cloud': if not value._controller_cls: continue if issubclass(value, Cloud) and value is not Cloud: CLOUDS[value._controller_cls.provider] = value # Add aliases to CLOUDS dictionary for key, value in config.PROVIDERS.items(): driver_name = value['driver'] cloud_aliases = [key] + value['aliases'] if CLOUDS.get(driver_name): for alias in cloud_aliases: CLOUDS[alias] = CLOUDS[driver_name] else: value = next((CLOUDS.get(alias) for alias in cloud_aliases if CLOUDS.get(alias)), None) if value: for alias in cloud_aliases: CLOUDS[alias] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_clouds(auth=None):\n get_operator_cloud(auth)\n get_openstack_cloud(auth)", "def setup_clouds(auth=None):\n get_operator_cloud(auth)\n get_openstack_cloud(auth)", "def get_clouds():\n clouds = [ x.get('cloud') for x in Schedconfig.objects.values('cloud').distinct() ]\n locale.setloc...
[ "0.5848229", "0.5848229", "0.5762712", "0.5732575", "0.55106837", "0.5443013", "0.54311204", "0.5407812", "0.5398516", "0.5377608", "0.5274966", "0.52417177", "0.5234368", "0.52056146", "0.5200299", "0.5192333", "0.51870906", "0.51459664", "0.5107439", "0.50989896", "0.508725...
0.8129826
0
Add cloud This is a class method, meaning that it is meant to be called on the class itself and not on an instance of the class. You're not meant to be calling this directly, but on a cloud subclass
def add(cls, owner, name, user=None, id='', **kwargs): if not name: raise RequiredParameterMissingError('name') if not owner or not isinstance(owner, Organization): raise BadRequestError('owner') if Cloud.objects(owner=owner, name=name, deleted=None): raise CloudExistsError() cloud = cls(owner=owner, name=name) if id: cloud.id = id fail_on_error = kwargs.pop('fail_on_error', True) fail_on_invalid_params = kwargs.pop('fail_on_invalid_params', False) cloud.ctl.add(user, **kwargs) return cloud
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cloud(self, cloud):\n\n self._cloud = cloud", "def add_cloud_region(self, position):\n region = self.cloud_region_selector(position)\n self.regions[id(region)] = region", "def cloud_cover(self):\r\n raise NotImplementedError", "def add_subcommand(self, command):\n comma...
[ "0.6437736", "0.62252134", "0.6021022", "0.5750617", "0.5715046", "0.5662575", "0.55289835", "0.54481226", "0.5443279", "0.5443279", "0.54299885", "0.5409173", "0.53697765", "0.53604543", "0.5280927", "0.5277254", "0.5239339", "0.52346087", "0.5227393", "0.5209213", "0.518730...
0.5768774
3
Decide whether the minitaur has fallen. If the up directions between the base and the world is larger (the dot product is smaller than 0.5), the minitaur is considered fallen.
def is_fallen(self): orientation = self.minitaur_env.minitaur.GetBaseOrientation() rot_mat = self.minitaur_env._pybullet_client.getMatrixFromQuaternion(orientation) local_up = rot_mat[6:] return (np.dot(np.asarray([0, 0, 1]), np.asarray(local_up)) < 0.3)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def at_goal(self):\n return self.distance_from_goal < self.robot.wheels.base_length/2", "def at_goal(self):\n return self.distance_from_goal < self.robot.wheels.base_length/2", "def is_upper(self):\n return self.z < 0", "def is_at_wall(self):\n return self.distmin < self.distmax*0...
[ "0.63688046", "0.63688046", "0.58916235", "0.58059263", "0.5784403", "0.5761813", "0.57414496", "0.5711356", "0.5707844", "0.5697768", "0.5675407", "0.56628335", "0.56495374", "0.56233096", "0.55607885", "0.555384", "0.55337554", "0.5527628", "0.5523818", "0.55205244", "0.550...
0.72476137
0
Write a FreeSurfer label.
def write_label(filename, label, verbose=None): with open(filename, 'wb') as fid: n_vertices = len(label.vertices) data = np.zeros((n_vertices, 5), dtype=np.float) data[:, 0] = label.vertices data[:, 1:4] = label.coords # self.pos #1e3 * data[:, 4] = label.values fid.write(b("#%s\n" % label.comment)) fid.write(b("%d\n" % n_vertices)) for d in data: fid.write(b("%d %f %f %f %f\n" % tuple(d))) return label
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeLabel(self, label):\r\n\r\n # Label declaration.\r\n self.filename.write(\"({}:{})\\n\".format(self.actualFile.upper(), label.upper()))", "def write_label(self, label):\n self._write_line('label ' + label) # TODO generate unique labels?", "def write_label(self, label: str) -> Non...
[ "0.6604549", "0.6554617", "0.6488683", "0.59178406", "0.58213866", "0.58023846", "0.5709398", "0.5536997", "0.54463476", "0.5442079", "0.5411397", "0.5353073", "0.5349966", "0.50120467", "0.49916384", "0.49916384", "0.49916384", "0.49916384", "0.49916384", "0.49916384", "0.49...
0.5579701
7
Return sparse matrix with edges as an adjacency matrix.
def mesh_edges(tris): if np.max(tris) > len(np.unique(tris)): raise ValueError('Cannot compute connectivity on a selection of ' 'triangles.') npoints = np.max(tris) + 1 ones_ntris = np.ones(3 * len(tris)) a, b, c = tris.T x = np.concatenate((a, b, c)) y = np.concatenate((b, c, a)) edges = coo_matrix((ones_ntris, (x, y)), shape=(npoints, npoints)) edges = edges.tocsr() edges = edges + edges.T return edges
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_adjacency_matrix(graph):\n index_1 = [edge[0] for edge in graph.edges()]\n index_2 = [edge[1] for edge in graph.edges()]\n values = [1 for edge in graph.edges()]\n node_count = max(max(index_1)+1,max(index_2)+1)\n A = sparse.coo_matrix((values, (index_1,index_2)),shape=(node_count,node_co...
[ "0.7717279", "0.743809", "0.7303273", "0.7291218", "0.72357076", "0.72152543", "0.7204456", "0.7193659", "0.71897316", "0.7153426", "0.7127393", "0.7073265", "0.70631844", "0.7041357", "0.7021406", "0.69531685", "0.69405574", "0.6906811", "0.69028586", "0.6890784", "0.6887394...
0.0
-1
Compute adjacency matrix weighted by distances. It generates an adjacency matrix where the entries are the distances between neighboring vertices.
def mesh_dist(tris, vert): edges = mesh_edges(tris).tocoo() # Euclidean distances between neighboring vertices dist = np.linalg.norm(vert[edges.row, :] - vert[edges.col, :], axis=1) dist_matrix = csr_matrix((dist, (edges.row, edges.col)), shape=edges.shape) return dist_matrix
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjacency(dist, idx):\n M, k = dist.shape\n assert M, k == idx.shape\n assert dist.min() >= 0\n # Weights.\n sigma2 = np.mean(dist[:, -1]) ** 2\n #print sigma2\n dist = np.exp(- dist ** 2 / sigma2)\n\n # Weight matrix.\n I = np.arange(0, M).repeat(k)\n J = idx.reshape(M * k)\n ...
[ "0.73236233", "0.7304077", "0.6892268", "0.68493205", "0.6665239", "0.66055983", "0.6592866", "0.6582315", "0.6490363", "0.6472683", "0.64540255", "0.6431121", "0.63700914", "0.63675284", "0.6365074", "0.63617116", "0.6358854", "0.6308832", "0.6292462", "0.628894", "0.6278451...
0.58099884
65
The purpose of this code is to be able to quickly load any kind of data using pickle.
def Load_Data(savedfilename): import pickle try: with open(savedfilename, 'rb') as handle: loaded_data = pickle.load(handle) print 'loaded successfully, fileloaded as as:\nloaded_data' return loaded_data except: import numpy as np loaded_data = np.load(savedfilename) return loaded_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loads(data):\n return cPickle.loads(data)", "def load_pickle_data(filename):\n path = \"../tmp/{}.pckl\".format(filename)\n if os.path.exists(path):\n print(\"LOADING PCKL FILE FROM {}\".format(path))\n f = open(path, 'rb')\n obj = pickle.load(f)\n f.close()\n retu...
[ "0.7677762", "0.75456476", "0.74007934", "0.7386416", "0.7347391", "0.7306865", "0.7306865", "0.7251167", "0.7192325", "0.71690726", "0.7146814", "0.7142319", "0.71218973", "0.70928425", "0.70679253", "0.7051632", "0.7041608", "0.7021551", "0.694763", "0.69178104", "0.6917255...
0.6825503
31
Reads the entire contents of a file into a single string using the read() method.
def readfile(filename): infile = open(filename, "r") # open file for reading # Use Python's file read function to read the file contents filetext = infile.read().splitlines() infile.close() # close the file return filetext # the text of the file, as a single string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(file):\n with open(file, 'r') as f:\n file_string = f.read()\n return file_string", "def read(file):\n with open(file, 'r') as file:\n return file.read()", "def read_file(path): #TODO implementme, handling paths more intelligently\n f = open(path, \"r\")\n string = f....
[ "0.8052589", "0.7846758", "0.7786236", "0.7739382", "0.7731349", "0.7712797", "0.7707567", "0.75548965", "0.75135463", "0.7509113", "0.7501244", "0.74897665", "0.74849457", "0.7474526", "0.7474349", "0.74655485", "0.74514276", "0.74224454", "0.74033785", "0.7400379", "0.73938...
0.72099614
38
This function reads the product database
def read_product(filename=None): if not filename: filename = settings.PRODUCT_FILENAME return pd.read_csv(filename, sep='|')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products(self) -> dict:\n\t\tproducts = dict()\n\n\t\tdb = Database()\n\t\tdb.create_connection(self._file_path)\n\t\trows = db.get_products()\n\t\tdb.close_connection()\n\n\t\tfor row in rows:\n\t\t\tif row[0] not in products:\n\t\t\t\ttry:\n\t\t\t\t\tproducts[row[0]] = Product(row[0], row[1], row[2], row...
[ "0.7133278", "0.7089956", "0.6694715", "0.66771376", "0.6661934", "0.6568496", "0.65388924", "0.64580315", "0.64211625", "0.63623816", "0.63278025", "0.631014", "0.628087", "0.62696344", "0.62645537", "0.6238003", "0.6236366", "0.6181283", "0.6149317", "0.61312556", "0.611616...
0.63234115
11
This function reads the transaction data
def read_transactions(filename=None): if not filename: filename = settings.TRANSACTION_FILENAME return pd.read_csv(filename, sep='|', parse_dates=[4])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadTransaction(self, request, context):\n context.code(beta_interfaces.StatusCode.UNIMPLEMENTED)", "def _read_data(self):", "def readOneData(self):\n\t\tpass", "def read(self):", "def read_data(self):\n raise NotImplementedError", "def ReadTransaction(self, request, timeout, metadata=None,...
[ "0.70743924", "0.69511247", "0.63940114", "0.637214", "0.6344855", "0.6343588", "0.62778604", "0.62692773", "0.62457216", "0.62457216", "0.61528605", "0.6124101", "0.611082", "0.6027867", "0.6005437", "0.5953495", "0.59025943", "0.5887277", "0.5887277", "0.5887277", "0.587844...
0.56860703
27
This function reads the meteo for a given day
def read_meteo_day(filename=None): if not filename: filename = settings.METEO_DAY_FILENAME return pd.read_csv(filename, sep=';', parse_dates=[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findReadData(day,scope,chan,shot):\n return readData(conf.dataDir + \"%d_01_2013_osc%d/C%dosc%d-%05d.txt\" % (day, scope, chan, scope, shot),\n conf.timeDelay[scope,chan],\n conf.ampMult[scope,chan])", "def get_weather_on_date(date, meteo_day, store_id):\n return meteo_d...
[ "0.59969056", "0.5583099", "0.5550923", "0.54960376", "0.5361208", "0.52583355", "0.5196197", "0.5166738", "0.5159462", "0.51388514", "0.5126825", "0.5095728", "0.50937", "0.5065566", "0.5062365", "0.5062365", "0.5062365", "0.5062365", "0.5062365", "0.50592273", "0.50472623",...
0.6528976
0
This function reads the meteo for a given week
def read_meteo_week(filename=None): if not filename: filename = settings.METEO_WEEK_FILENAME # This function is the date parser for the week parser = lambda x: pd.datetime.strptime(x, '%Y%W') return pd.read_csv(filename, sep=';', parse_dates=[4], date_parser=parser)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weekly():", "def LoadWeeklyChart(self, week):\n file = '%s.html' % week\n if file in os.listdir(self.HTML_DIR):\n print 'Loading chart for week of %s' % week\n with open(os.path.join(self.HTML_DIR, file), 'r') as f:\n chart = f.read()\n else:\n chart = self.DownloadWeeklyChart(...
[ "0.6283611", "0.5888736", "0.5871395", "0.5666913", "0.5573738", "0.556567", "0.5563634", "0.5530871", "0.5527525", "0.54581827", "0.54551387", "0.54536134", "0.539935", "0.53837866", "0.53796595", "0.53618705", "0.5316805", "0.5285709", "0.52359337", "0.52143586", "0.5210340...
0.7170781
0
This function reads the temperature data
def read_temp(filename=None): if not filename: filename = settings.TEMP_FILENAME return pd.read_csv(filename, sep=';', parse_dates=[3], dtype={0: object, 2: object, 3: object})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_temperature():\n temp = 0.0\n with open(\"daily_temp.txt\", \"r\") as f:\n temp = float(f.readline())\n\n return temp", "def readtemperature(self, cTemp):\r\n\t\tdata = bus.read_byte_data(SI7015_DEFAULT_ADDRESS, SI7015_REG_STATUS)\r\n\t\twhile (data & 0x01) != 0 :\r\n\t\t\tdata = bus.rea...
[ "0.7990609", "0.7562184", "0.7501336", "0.7451494", "0.7336076", "0.7219707", "0.71506214", "0.7078098", "0.70765", "0.7061153", "0.70357513", "0.7020464", "0.6986411", "0.68525434", "0.6827719", "0.68100756", "0.67881316", "0.676591", "0.672111", "0.6678112", "0.66756356", ...
0.0
-1
This function gives us all the weather information/prediction for a given day in a given store
def get_weather_on_date(date, meteo_day, store_id): return meteo_day[(meteo_day['STO_EAN'] == store_id) & (meteo_day['DATE_KEY'] == date)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weather_details(self, days: int = None):\n forecast = super().get_weather_forecast(self.BASE_URL)\n headers = [\n \"date\",\n \"min_temp\",\n \"max_temp\",\n \"phrase\",\n \"probability\",\n \"wind_speed\"]\n if days is ...
[ "0.6687217", "0.65223783", "0.64728045", "0.64251363", "0.6395729", "0.63380027", "0.6210881", "0.61134636", "0.59816873", "0.59385264", "0.589162", "0.58533895", "0.5828796", "0.58262205", "0.58206254", "0.57987386", "0.576516", "0.5762254", "0.5755952", "0.57303375", "0.571...
0.6820833
0
This function gives us the sum of all sales value for a given product on a given date. It also return the quantity of products sold in weight
def get_volume_product_on_date(product_barcode, date, store_id, transactions): transactions_day = transactions[(transactions['STO_EAN'] == store_id) & (transactions['BARCODE'] == product_barcode) & (transactions['TRX_DATETIME'] >= pd.to_datetime(date).date()) &(transactions['TRX_DATETIME'] < (pd.to_datetime(date) + pd.DateOffset(1)))] # If the transaction does not exist return None if transactions_day.empty: return None return {"price": np.sum(transactions_day['SAL_AMT_WTAX'].values), "weight": np.sum(transactions_day['SAL_UNIT_QTY_WEIGHT'].values)}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_daily_product_sales(self):\n self.products['daily'] = self.products['session_start_date'].apply(lambda x: convert_dt_to_day_str(x))\n self.products = self.products.query(\"payment_amount == payment_amount\")\n self.products['payment_amount'] = self.products['payment_amount'].apply(lamb...
[ "0.68591684", "0.6359811", "0.6157366", "0.60738873", "0.6023802", "0.5834238", "0.58238226", "0.5762609", "0.5700813", "0.56557745", "0.5614207", "0.5598102", "0.5577538", "0.55420864", "0.5539422", "0.55292135", "0.5523316", "0.54981434", "0.54949695", "0.5454806", "0.54391...
0.6372925
1
This function convert a date to the corresponding type of the day (working day/holiday/MonSun)
def generate_day_type(date): cal = France() if cal.is_holiday(date): # If Mon-Friday if date.weekday() in range(5): return 0. else: return 1. else: if date.weekday() in range(5): return 1. else: return 0.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_to_day_of_week(date):\n return date.weekday()", "def number_to_day(n):\n if n == 1:\n return \"Sunday\"\n elif n == 2:\n return \"Monday\"\n elif n == 3:\n return \"Tuesday\"\n elif n == 4:\n return \"Wednesday\"\n elif n == 5:\n return \"Thursday\"\n...
[ "0.65448165", "0.6300779", "0.61504966", "0.61332077", "0.612294", "0.6048355", "0.60400957", "0.6037049", "0.60039747", "0.5941737", "0.5941737", "0.5905311", "0.5904082", "0.58850664", "0.5838948", "0.58364326", "0.58314884", "0.580064", "0.5735178", "0.5730053", "0.5729248...
0.73416775
0
This function generates the weather conditions using a minitype trapezium distribution the temperature and its type
def generate_weather_conditions(temperature, temp_type): if temp_type == "MIN" or temperature < 5: if temperature > 10: return 0 elif temperature >= 0: return (10.-temperature)/10. else: return 1 elif temp_type == "AVG": if temperature > 25: return 0 elif temperature >= 15: return (25.-temperature)/(25.-15) elif temperature >= 5: return (temperature-5.)/(15-5.) elif temp_type == "MAX": if temperature > 40: return 1 elif temperature >= 20: return (temperature-20)/(40.-20) else: return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genWeather():\n\n weather = random.choice(weather_conditions.keys())\n condition = weather_conditions[weather]\n (tMax, tMin) = condition[\"temperature\"]\n (pMax, pMin) = condition[\"pressure\"]\n (hMax, hMin) = condition[\"humidity\"]\n\n return weather + \"|\" + str(round(random.uniform(tM...
[ "0.6137704", "0.5869371", "0.57176363", "0.5665171", "0.56162924", "0.5519943", "0.55192375", "0.54380035", "0.54261625", "0.5379157", "0.52772623", "0.52344805", "0.52321464", "0.5232041", "0.52294254", "0.52078223", "0.5178827", "0.51737756", "0.5172065", "0.51715505", "0.5...
0.74097484
0
This function generates the training and testing data
def generate_training_testing_dataset(store_id, transactions, meteo_day, max_days=2500, single_barcode=0): # Get the minimum and maximum of date in the transactions min_date = transactions[(transactions['STO_EAN'] == store_id)].min()['TRX_DATETIME'].date() max_date = transactions[(transactions['STO_EAN'] == store_id)].max()['TRX_DATETIME'].date() # Get the number of days between the two date num_days = (max_date - min_date).days # Get the list of unique products barcode in the transactions products_barcode = transactions['BARCODE'].unique() # Only do one single barcode if activated if single_barcode is not None: products_barcode = [products_barcode[single_barcode]] # Array to contain all training data all_data_first_level = [] # For each day and for each product for day in xrange(num_days): print(day) # If we have already considered more days than allowed, stop if day > max_days: break # Get the date corresponding to this day date = min_date + pd.DateOffset(day) # Get the weather of the date weather = get_weather_on_date(date, meteo_day, store_id).head(n=1) # If the weather is empty we skip this day if weather.empty: continue # For each product to include for product_barcode in products_barcode: # Get the volume and inventory data volume = get_volume_product_on_date(product_barcode, date, store_id, transactions) # If no volume could be found skip this date,product pair if volume is None: continue # Get the type of the current date day_type = generate_day_type(date) # Generating complex features based on the simpler one # This contains respectively yesterday, the day before yesterday and the same day as current one in # previous week yesterday = date - pd.DateOffset(1) two_days_ago = date - pd.DateOffset(2) one_week_ago = date - pd.DateOffset(7) # Get the day type of yesterday and 2 days ago day_type_yesterday = generate_day_type(yesterday) day_type_2days_ago = generate_day_type(two_days_ago) # Get the volume of yesterday, 2days ago and 1 week ago volume_yesterday = get_volume_product_on_date(product_barcode, yesterday, store_id, transactions) volume_2days_ago = get_volume_product_on_date(product_barcode, two_days_ago, store_id, transactions) volume_one_week_ago = get_volume_product_on_date(product_barcode, one_week_ago, store_id, transactions) # Get the total sales and the total weight of product done yesterday, 2 days ago and 1 week ago volume_price_yesterday = 0 volume_weight_yesterday = 0 if volume_yesterday is not None: volume_price_yesterday = volume_yesterday["price"] volume_weight_yesterday = volume_yesterday["weight"] volume_price_2days_ago = 0 volume_weight_2days_ago = 0 if volume_2days_ago is not None: volume_price_2days_ago = volume_2days_ago["price"] volume_weight_2days_ago = volume_2days_ago["weight"] volume_price_one_week_ago = 0 volume_weight_one_week_ago = 0 if volume_one_week_ago is not None: volume_price_one_week_ago = volume_one_week_ago["price"] volume_weight_one_week_ago = volume_one_week_ago["weight"] # Using historical weather data weather_yesterday = get_weather_on_date(yesterday, meteo_day, store_id).head(n=1) temperature_min_yesterday = 0 temperature_max_yesterday = 0 if not weather_yesterday.empty: temperature_min_yesterday = weather_yesterday['TEMPERATURE_VALUE_MIN'].values[0] temperature_max_yesterday = weather_yesterday['TEMPERATURE_VALUE_MIN'].values[0] #tmp = [weather['TEMPERATURE_VALUE_MIN'].values[0], weather['TEMPERATURE_VALUE_MAX'].values[0], # weather['PRECIPITATION_VALUE'].values[0], weather['SUNSHINE_DURATION'].values[0], # weather['SNOW_DEPTH'].values[0], day_type, volume["price"], volume["weight"]] # Saving Features tmp = [weather['TEMPERATURE_VALUE_MIN'].values[0], weather['TEMPERATURE_VALUE_MAX'].values[0], day_type, volume["price"], volume_price_yesterday,volume_weight_yesterday, volume_price_2days_ago, volume_weight_2days_ago, volume_price_one_week_ago, volume_weight_one_week_ago, temperature_min_yesterday, temperature_max_yesterday,day_type_yesterday, day_type_2days_ago, volume["weight"]] all_data_first_level.append(tmp) return all_data_first_level
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_train_test(self):\n x, y = self.read_data()\n x_train, y_train, x_test, y_test = self.sample_data(x, y)\n self.train = (x_train, y_train)\n self.test = (x_test, y_test)", "def generate_train_test_data(data_dir = '../../att_faces'):\n\n train_data = [ [ read_image('%s/s...
[ "0.8281578", "0.77893066", "0.76956064", "0.7368539", "0.7366503", "0.72501296", "0.721362", "0.7188087", "0.71556234", "0.71437585", "0.7139229", "0.71196824", "0.7102774", "0.71003747", "0.70315087", "0.70204693", "0.7020253", "0.69788855", "0.69752514", "0.69714016", "0.69...
0.6950932
20
>>> set_N(2) >>> from sudoku_state import N, N_2, N_3, N_4 >>> board = SudokuBoard() >>> squares = [SudokuSquare(id=i) for i in range(N_4)] >>> state = SudokuState(squares=squares, board=board) >>> StatePrinter.print_board_state(state) ====+========+==== | | | | ++ | | | | ====+========+==== | | | | ++ | | | | ====+========+====
def apply_to_sets(cls, sets): for sq_set in sets: sqs_with_val = {} sqs_by_bitmask = {} for sq in iter(sq_set): for sq2 in iter(sq_set): if sq2.known_value: sq.eliminate(sq2) pvals = sq.possible_values() if sq.bitmask not in sqs_by_bitmask: sqs_by_bitmask[sq.bitmask] = [] sqs_by_bitmask[sq.bitmask].append(sq) for val in pvals: if val not in sqs_with_val: sqs_with_val[val] = [] sqs_with_val[val].append(sq) for val, sqs in sqs_with_val.iteritems(): if len(sqs) == 1: sqs[0].set_value(val) for bm, sqs in sqs_by_bitmask.iteritems(): if len(sqs) > 1: pvals = list(SudokuSquare.bitmask_to_possible_values(bm)) if len(sqs) == len(pvals): for sq in iter(sq_set): if sq not in sqs: sq.eliminate(sqs[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printState(self,board):\n self.printBoard(board.getBoard())\n self.printScore(board,board.getScore())", "def test_state(\n size: Union[int, tuple],\n num_berries: int,\n number_steps: int,\n state_sizes: List[int] = [3, 5],\n) -> None:\n for state_size in state_sizes:\n ga...
[ "0.6484789", "0.63871104", "0.6277676", "0.61892223", "0.617585", "0.6139663", "0.6053929", "0.603311", "0.60163975", "0.60072374", "0.59916526", "0.59657776", "0.59387004", "0.5936951", "0.59288216", "0.5927014", "0.5874181", "0.58594954", "0.58288336", "0.57523865", "0.5734...
0.0
-1
Calculate net income after federal and state tax
def calc_tax(state: str, income: float, federal_tax: float = 10.0): states_taxes = { "AL": ("Alabama", 5), "AK": ("Alaska", 3), "FL": ("Florida", 4), "IL": ("Illinois", 8), } state = state.upper() if state not in states_taxes: raise AssertionError("Taxes calculation of '{}' is not available. List: {}" .format(state, states_taxes.keys())) net = income - (income * federal_tax / 100) print("Net after Federal Taxes:", net) tax_to_deduct = net * states_taxes[state][1] / 100.0 net = net - tax_to_deduct print("Net after {} Taxes: {}".format(states_taxes[state][0], net))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def monthly_net_income(gross_income, income_tax):\n return gross_income - income_tax", "def calculate_taxes(self, proforma, technologies):\n tax_calcs = copy.deepcopy(proforma)\n # 1) Redistribute capital cost according to the DER's MACRS value to get depreciation\n for der_inst in techno...
[ "0.7409301", "0.67553556", "0.66763127", "0.6645111", "0.64896935", "0.64231426", "0.63536626", "0.6341549", "0.6228795", "0.61981183", "0.61333615", "0.6070119", "0.6002093", "0.5992931", "0.59346694", "0.5908333", "0.589499", "0.58864194", "0.5868002", "0.585597", "0.583016...
0.7955427
0
reads in a file and returns np.arrays containing values for frequency and amplitude
def makespectfile(afile): x = [] y = [] with open(afile) as f: for line in f: if line.startswith('#'): continue (freq,flux) = line.split() x.append(float(freq)) y.append(float(flux)) return (np.asarray(x),np.asarray(y))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_filter_data(filename):\n gains = []\n freqs = []\n freq_scale = 0\n with open(filename) as f:\n for line in f:\n words = line.split()\n if line.startswith('Freq'):\n _, scale = words[0].split(\"(\")\n scale = scale.rstrip(\")\")\n ...
[ "0.7232917", "0.71028847", "0.709317", "0.6883066", "0.6783753", "0.67701334", "0.67288643", "0.6692682", "0.6670123", "0.66636634", "0.66447705", "0.65392363", "0.64900935", "0.6441326", "0.6395796", "0.63950247", "0.637628", "0.6370568", "0.6367199", "0.6345476", "0.6340855...
0.7644199
0
Use apply_default decorator for the `default_args` feature to work properly; deprecated. In previous versions, all subclasses of BaseOperator must use apply_default decorator for the" `default_args` feature to work properly. In current version, it is optional. The decorator is applied automatically using the metaclass.
def apply_defaults(func: T) -> T: warnings.warn( "This decorator is deprecated. \n" "\n" "In previous versions, all subclasses of BaseOperator must use apply_default decorator for the " "`default_args` feature to work properly.\n" "\n" "In current version, it is optional. The decorator is applied automatically using the metaclass.\n", RemovedInAirflow3Warning, stacklevel=3, ) # Make it still be a wrapper to keep the previous behaviour of an extra stack frame @wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) return cast(T, wrapper)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_defaults(func: T) -> T:\n warnings.warn(\n \"This decorator is deprecated. \\n\"\n \"\\n\"\n \"In previous versions, all subclasses of BaseOperator must use apply_default decorator for the \"\n \"`default_args` feature to work properly.\\n\"\n \"\\n\"\n \"In c...
[ "0.82795125", "0.6885742", "0.6571699", "0.6179261", "0.60997844", "0.60997844", "0.60086507", "0.597563", "0.5938139", "0.59069514", "0.5854104", "0.57146806", "0.5672426", "0.5663039", "0.56135994", "0.55640954", "0.5539715", "0.5507615", "0.5487402", "0.5466438", "0.543263...
0.8326598
0
Remove or similar decorators as well as and .
def remove_task_decorator(python_source: str, task_decorator_name: str) -> str: def _remove_task_decorator(py_source, decorator_name): if decorator_name not in py_source: return python_source split = python_source.split(decorator_name) before_decorator, after_decorator = split[0], split[1] if after_decorator[0] == "(": after_decorator = _balance_parens(after_decorator) if after_decorator[0] == "\n": after_decorator = after_decorator[1:] return before_decorator + after_decorator decorators = ["@setup", "@teardown", task_decorator_name] for decorator in decorators: python_source = _remove_task_decorator(python_source, decorator) return python_source
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_decorators(self):\n self._decorators = []", "def apply_decorators(*decorators):\n def dec(fn):\n for d in reversed(decorators):\n fn = d(fn)\n return fn\n return dec", "def del_functions(self, *args):\n if len(args) > 0:\n attrs = args\n ...
[ "0.6751675", "0.6575618", "0.64617324", "0.6306262", "0.62398183", "0.61137396", "0.59577435", "0.5811717", "0.5579527", "0.55659074", "0.55599767", "0.5556737", "0.5375476", "0.537497", "0.53370106", "0.53344274", "0.53249407", "0.53044754", "0.5283288", "0.5226591", "0.5209...
0.57927924
8
Sending request with all mandatory fields with valid values
def test_01(self): assert 'True' == Api.requestBlock('test-01')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_validation_request(self):\r\n self.send_request(send_function=self._assemble_and_send_validation_request)", "def validate_request(req):\n mandatory_fields = conf[\"api\"][\"mandatory-fields\"]\n optional_fields = conf[\"api\"][\"optional-fields\"]\n\n if not req.content_length:\n ...
[ "0.67361516", "0.6645965", "0.64985675", "0.61909497", "0.6140521", "0.61338866", "0.60920036", "0.60691214", "0.60643446", "0.60591084", "0.60197985", "0.6019011", "0.5985431", "0.59851086", "0.5952253", "0.5949522", "0.594586", "0.5931081", "0.5922004", "0.5914755", "0.5897...
0.0
-1
Send null value in Key field
def test_02(self): assert 'False' == Api.requestBlock('test-02')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setnoempty(self, key, value):\r\n if value:\r\n self[key] = value", "def get(self, key):\n return \"\"", "def test_key_no_data(self):\n key = Key({})\n\n assert key.warning is None\n assert key.in_car is None", "def __missing__(self, key):\n return key...
[ "0.6627444", "0.64162874", "0.63429326", "0.6278156", "0.62152123", "0.61957705", "0.60758203", "0.6026496", "0.5976624", "0.58816373", "0.5840957", "0.583311", "0.58217424", "0.5807191", "0.5738377", "0.5710752", "0.570884", "0.57058185", "0.57004374", "0.5699024", "0.569884...
0.0
-1
Send special characters in Key field
def test_03(self): assert 'False' == Api.requestBlock('test-03')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_key(self, key):\n return smart_str(key)", "def _safe_key(self, key):\n if isinstance(key, str):\n key = key.encode('UTF-8')\n return key", "def _GetKeyString(self):", "def _GetKeyString(self):", "def _encode_key(self, key: str) -> str:\n return key", "de...
[ "0.7182007", "0.7139797", "0.70063776", "0.70063776", "0.6996293", "0.69241786", "0.69132024", "0.6771149", "0.6679707", "0.64687204", "0.64204514", "0.6416963", "0.6211138", "0.6207948", "0.6200801", "0.61796457", "0.6146467", "0.6136251", "0.6111352", "0.6108621", "0.609082...
0.0
-1
Send null value in OrderId field
def test_04(self): assert 'False' == Api.requestBlock('test-04', charOrder='')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return self.order_id", "def save(self, *args, **kwargs):\n if not self.order_number:\n self.order_number = self._generate_order_number()\n super().save(*args, **kwargs)", "def save(self, *args, **kwargs):\n if not self.order_number:\n self....
[ "0.6216553", "0.6184329", "0.6184329", "0.618138", "0.59689295", "0.5936228", "0.5936228", "0.5936228", "0.5925615", "0.57500046", "0.5691294", "0.5583406", "0.55813485", "0.54496884", "0.5350011", "0.52729756", "0.52557564", "0.523138", "0.52178276", "0.51731664", "0.5152120...
0.0
-1
Check length of OrderId fields (len = 50)
def test_05(self): assert 'True' == Api.requestBlock('test-05', charOrder=50)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateID(id):\n\n if re.compile('[0-9]+').match(id) == None:\n output.completeOutputError(InvalidArgumentCount(descape =\"'%s' is not a valid Id. ID should be numeric with Length = '%s' \" \n\t\t\t% (id, lib.constants._ATTR_ID_LENGHT)))\n return -1\n else:\n # Check for the lenght ...
[ "0.6525614", "0.63231474", "0.6213551", "0.6202628", "0.6070328", "0.5964003", "0.5954448", "0.59133357", "0.58616084", "0.5828075", "0.5762874", "0.5752543", "0.57474065", "0.57324255", "0.56937385", "0.56560177", "0.5625483", "0.5602283", "0.5593534", "0.5563847", "0.555935...
0.0
-1
Check length of OrderId fields (len = 51)
def test_06(self): assert 'False' == Api.requestBlock('test-06', charOrder=51)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateID(id):\n\n if re.compile('[0-9]+').match(id) == None:\n output.completeOutputError(InvalidArgumentCount(descape =\"'%s' is not a valid Id. ID should be numeric with Length = '%s' \" \n\t\t\t% (id, lib.constants._ATTR_ID_LENGHT)))\n return -1\n else:\n # Check for the lenght ...
[ "0.6447101", "0.64331466", "0.6345241", "0.6291078", "0.5997579", "0.59655714", "0.58881146", "0.58828425", "0.58140504", "0.57821655", "0.5780664", "0.5711595", "0.5706793", "0.56825346", "0.5664026", "0.5637399", "0.55534965", "0.5535516", "0.55239874", "0.5517009", "0.5496...
0.0
-1
Send special characters in OrderId field
def test_07(self): assert 'False' == Api.requestBlock('test-07', charOrder='~!@#$%%^&*()=_+<>?/')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_id(self) -> str:\n return pulumi.get(self, \"order_id\")", "def __str__(self):\n\n return f'{self.order_id}'", "def __str__(self):\n return self.order_id", "def _escape_identifier(self, value):\n\n return value.replace('\"', '\"\"')", "def format_item(self, order):\n ...
[ "0.6710151", "0.66620994", "0.6476178", "0.61907893", "0.6042138", "0.59341186", "0.5875805", "0.58528703", "0.5759892", "0.5745699", "0.5745699", "0.5745699", "0.56400716", "0.5607561", "0.56031054", "0.55670196", "0.55341715", "0.55016094", "0.548358", "0.54751325", "0.5448...
0.0
-1
Send different values in OrderId fields
def test_08(self): assert 'False' == Api.requestBlock('test-08', differentOrderId=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_id(self) -> str:\n return pulumi.get(self, \"order_id\")", "def order_id(self, order_id):\n\n self._order_id = order_id", "def order_id(self, order_id):\n\n self._order_id = order_id", "def order_id(self, order_id):\n\n self._order_id = order_id", "def __str__(self):\n...
[ "0.65247154", "0.64482886", "0.64482886", "0.64482886", "0.6383491", "0.6324064", "0.6154994", "0.59831274", "0.59831274", "0.5879656", "0.5852313", "0.5837288", "0.5810877", "0.57971513", "0.57876205", "0.57637125", "0.5755213", "0.56966513", "0.5617328", "0.55985826", "0.55...
0.0
-1
Send null value in Amount fields
def test_09(self): assert 'False' == Api.requestBlock('test-09')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_blank_value_19(field):\n if field.null:\n return None\n else:\n return ''", "def get_amount(self):\n\t\tif self.amount is not None:\n\t\t\treturn self.amount\n\t\treturn abort(400, {\"message\" : \"please provide the amount to process\"})", "def _get_blank_value_18(field):\n if ...
[ "0.60821736", "0.59436923", "0.5912167", "0.56709254", "0.56709254", "0.56709254", "0.55559736", "0.5472613", "0.54673105", "0.5452079", "0.54242957", "0.53854245", "0.53854245", "0.5326176", "0.5292764", "0.52759343", "0.5254463", "0.52461946", "0.5239521", "0.5234681", "0.5...
0.0
-1
Send value with dot in Amount fields
def test_10(self): assert 'False' == Api.requestBlock('test-10')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _amount(amount, asset='HBD'):\n assert asset == 'HBD', 'unhandled asset %s' % asset\n return \"%.3f HBD\" % amount", "def amount_ui(self) -> str:\n return \"{:,.2f}\".format(self.amount)", "def obtain_amount(cls, amount_string):\n return float(string.replace(amount_string, ',', '.'))", ...
[ "0.61124015", "0.59985334", "0.5889612", "0.58480203", "0.5810647", "0.5727278", "0.5675556", "0.5655621", "0.56539106", "0.56217325", "0.56098205", "0.5542181", "0.5542173", "0.5525029", "0.5482661", "0.5476994", "0.5462194", "0.5462194", "0.54560274", "0.5453152", "0.545157...
0.0
-1
Send different values in Amount fields
def test_11(self): assert 'False' == Api.requestBlock('test-11')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAmount1(*args):", "def onchange_amount(self, cr, uid, ids, amount, rate, partner_id, journal_id, currency_id, ttype, date, payment_rate_currency_id, company_id, context=None):\n if not context:\n context = {}\n default = super(account_voucher, self).onchange_amount(cr, uid, ids, a...
[ "0.6432208", "0.6382008", "0.63806385", "0.63244236", "0.62620044", "0.6146637", "0.6121447", "0.6117151", "0.6043075", "0.6043075", "0.6043075", "0.6043075", "0.6043075", "0.6043075", "0.6043075", "0.6043075", "0.6043075", "0.6030417", "0.59542346", "0.5954213", "0.59393656"...
0.0
-1
Send null value in PAN fields
def test_12(self): assert 'False' == Api.requestBlock('test-12')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_blank_value_19(field):\n if field.null:\n return None\n else:\n return ''", "def _get_blank_value_18(field):\n if field.null:\n return None\n else:\n return field.value_to_string(None)", "def noneType(value):\r\n return ''", "def nullValueToNan(self) ->...
[ "0.6484191", "0.6448958", "0.59863204", "0.5944134", "0.5895153", "0.5776917", "0.5776917", "0.57559484", "0.5753347", "0.5635493", "0.5596744", "0.5581456", "0.5563318", "0.5559931", "0.553137", "0.55202323", "0.5512284", "0.5512284", "0.5512284", "0.54971886", "0.54971886",...
0.0
-1
Send special characters in PAN fields
def test_13(self): assert 'False' == Api.requestBlock('test-13')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_value_special_chars(self):\n raw = [\n 0x48,\n 0x65,\n 0x79,\n 0x21,\n 0x3F,\n 0x24,\n 0x20,\n 0xC4,\n 0xD6,\n 0xDC,\n 0xE4,\n 0xF6,\n 0xFC,\n 0x...
[ "0.5532932", "0.55261433", "0.5418894", "0.5382547", "0.537889", "0.5318266", "0.529304", "0.52344793", "0.51329744", "0.51327187", "0.5014577", "0.49969777", "0.49740544", "0.49352726", "0.49252382", "0.48906183", "0.48848042", "0.48798963", "0.48445666", "0.48431173", "0.48...
0.0
-1
Send valid value with dot in PAN fields
def test_14(self): assert 'False' == Api.requestBlock('test-14')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_value(self, value):\n if value is None:\n return value\n value = value.replace(\" \", \"\").replace(\".\", \"\")\n if value:\n return \"%s.%s.%s.%s\" % (value[0:3], value[3:7], value[7:11], value[11:])\n return value", "def __CheckValue1(self, value, ...
[ "0.5938703", "0.56705576", "0.5377418", "0.53041655", "0.5300826", "0.52765805", "0.52583504", "0.5224343", "0.51931864", "0.5167671", "0.5139161", "0.51147896", "0.50964856", "0.5069219", "0.50668114", "0.50606614", "0.5044426", "0.50388306", "0.5020225", "0.49950588", "0.49...
0.0
-1
Send null value in EMonth fields
def test_15(self): assert 'False' == Api.requestBlock('test-15')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def month(self):\n return 0", "def month(self):\n return 0", "def _get_blank_value_19(field):\n if field.null:\n return None\n else:\n return ''", "def _fill_date(self):\n if not self.date['year']:\n self.date['year'] = self.DEFAULT_DATE['year']\n if...
[ "0.5866896", "0.5866896", "0.57713896", "0.5746307", "0.57161075", "0.56837165", "0.5625904", "0.55780524", "0.5558474", "0.54825336", "0.53664184", "0.532997", "0.5325653", "0.530205", "0.52342147", "0.5223373", "0.5202048", "0.51526874", "0.5086805", "0.5086271", "0.5052253...
0.0
-1
Send special characters in EMonth fields
def test_16(self): assert 'False' == Api.requestBlock('test-16')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _french_month(month):\n mois = \"janvfévrmarsavr-mai-juinjuilaoûtseptoct-nov-déc-\"\n mois_loc = re.search(month.lower(), mois.lower())\n if mois_loc:\n mois_no = (mois_loc.start() + 4) / 4\n return \"0{}\".format(mois_no)", "def _monthName(self, month):\n if month is not None:\...
[ "0.5688062", "0.5482961", "0.548005", "0.5468909", "0.54230297", "0.5412855", "0.530084", "0.52983487", "0.52577066", "0.51923347", "0.5177958", "0.5175429", "0.5157469", "0.5145739", "0.51417935", "0.5081514", "0.5069298", "0.5042676", "0.5035212", "0.5016211", "0.5014319", ...
0.0
-1
Send boundary values EMonth field (EMonth= 12)
def test_19(self): assert 'True' == Api.requestBlock('test-19')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_Month(self, value):\n super(GetTimestampFromDateParametersInputSet, self)._set_input('Month', value)", "def effective_invoice_month(self) -> pulumi.Input['GoogleTypeDateArgs']:\n return pulumi.get(self, \"effective_invoice_month\")", "def _build_efem_month(self,list_efem_month):\n\n ...
[ "0.5634143", "0.54065627", "0.53806704", "0.5306783", "0.5197246", "0.5181283", "0.5181283", "0.51676494", "0.51546735", "0.51468223", "0.51246095", "0.51028955", "0.5069277", "0.50182337", "0.5016101", "0.49582988", "0.49270567", "0.49263218", "0.48897153", "0.483824", "0.48...
0.0
-1
Send boundary values EMonth field (EMonth= 13)
def test_20(self): assert 'False' == Api.requestBlock('test-20')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_Month(self, value):\n super(GetTimestampFromDateParametersInputSet, self)._set_input('Month', value)", "def effective_invoice_month(self) -> pulumi.Input['GoogleTypeDateArgs']:\n return pulumi.get(self, \"effective_invoice_month\")", "def _build_efem_month(self,list_efem_month):\n\n ...
[ "0.5468577", "0.5368627", "0.5341315", "0.5172529", "0.50481325", "0.50441164", "0.5039868", "0.503057", "0.503057", "0.49822402", "0.49742725", "0.49465922", "0.4936865", "0.49367988", "0.49274474", "0.4890884", "0.48314846", "0.47565252", "0.47438386", "0.47341046", "0.4731...
0.0
-1
Send boundary values EMonth field (EMonth= 00)
def test_21(self): assert 'False' == Api.requestBlock('test-21')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_Month(self, value):\n super(GetTimestampFromDateParametersInputSet, self)._set_input('Month', value)", "def month(self):\n return 0", "def month(self):\n return 0", "def effective_invoice_month(self) -> pulumi.Input['GoogleTypeDateArgs']:\n return pulumi.get(self, \"effect...
[ "0.5586388", "0.5486472", "0.5486472", "0.52544075", "0.52388316", "0.52369255", "0.5221326", "0.511121", "0.51008004", "0.50837576", "0.5038402", "0.50014496", "0.49831936", "0.4924879", "0.49113798", "0.4900271", "0.48797706", "0.4850321", "0.48187506", "0.48154077", "0.480...
0.0
-1
Send boundary values EMonth field (EMonth= 01)
def test_22(self): assert 'True' == Api.requestBlock('test-22')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_Month(self, value):\n super(GetTimestampFromDateParametersInputSet, self)._set_input('Month', value)", "def _build_efem_month(self,list_efem_month):\n\n def add_value_dict(key, dict_data, msj=None):\n if key in dict_data.keys():\n dict_data[key] = dict_data[key] + ...
[ "0.56795377", "0.5456256", "0.5432058", "0.5432058", "0.5389009", "0.5362143", "0.5330217", "0.52422476", "0.52419305", "0.52336526", "0.5153409", "0.5141174", "0.5082032", "0.5056412", "0.50128525", "0.49637815", "0.49588114", "0.49463055", "0.489759", "0.48916426", "0.48840...
0.0
-1
Send null value in EYear field
def test_23(self): assert 'False' == Api.requestBlock('test-23')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_param_year_is_none(self):\n test_date = get_by_values(Ordinal.first, Weekday.Saturday, Month.May)\n self.assertEquals(date.today().year, test_date.year)", "def set_year(self, year: int) -> None:\n if year <= 0:\n # Seriously, are you trying to convince me this song was ma...
[ "0.6695768", "0.64100987", "0.63534063", "0.63534063", "0.63534063", "0.63124233", "0.6275319", "0.60871744", "0.5998854", "0.5980421", "0.5950252", "0.58238184", "0.58105856", "0.5803543", "0.57519025", "0.5699215", "0.5694554", "0.56552154", "0.5642766", "0.5622533", "0.559...
0.0
-1
Send special characters in EYear field
def test_24(self): assert 'False' == Api.requestBlock('test-24')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def year(cls, year: typing.Union[int, str])->str:\n yearstr: str\n if isinstance(year, int):\n yearstr = str(year)\n else:\n yearstr = year\n return cls.DATE_AND_TIMES_SIGIL + yearstr + \"-01-01T00:00:00/9\"", "def test_get_cve_id_year_format_with_letters(reg_use...
[ "0.65770954", "0.6452787", "0.6308937", "0.624988", "0.62376374", "0.6176575", "0.6136731", "0.6083706", "0.6080361", "0.6062085", "0.5893685", "0.5889238", "0.58616006", "0.5854368", "0.5846842", "0.58077604", "0.5788896", "0.57787496", "0.57771987", "0.57497287", "0.5738843...
0.0
-1
Check expired and current years (EYear = 18)
def test_25(self): assert 'False' == Api.requestBlock('test-25')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_exp_year(passport: map) -> bool:\n if passport.get('eyr'):\n if int(passport['eyr']) >= 2020 and int(passport['eyr']) <= 2030:\n return True\n\n return False", "def is_valid_expiration_year(expiration_year: int) -> bool:\n return expiration_year.isnumeric() and 2020 <= int...
[ "0.69972354", "0.6889879", "0.6804469", "0.67775863", "0.67520446", "0.67160755", "0.6709071", "0.66965705", "0.6668055", "0.66046906", "0.6600447", "0.6594519", "0.65294313", "0.65037", "0.6477345", "0.647229", "0.6437253", "0.64222205", "0.64183605", "0.6384004", "0.6373696...
0.0
-1
Check expired and current years (EYear = 19)
def test_26(self): assert 'False' == Api.requestBlock('test-26')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_expiration_year(expiration_year: int) -> bool:\n return expiration_year.isnumeric() and 2020 <= int(expiration_year) <= 2030", "def validate_exp_year(passport: map) -> bool:\n if passport.get('eyr'):\n if int(passport['eyr']) >= 2020 and int(passport['eyr']) <= 2030:\n return...
[ "0.69665146", "0.6962839", "0.6833878", "0.67656463", "0.6731954", "0.6701308", "0.66782004", "0.6657464", "0.6603246", "0.656257", "0.6515073", "0.6505968", "0.6495955", "0.64820564", "0.6465929", "0.6452773", "0.64282364", "0.6425703", "0.64153063", "0.6412585", "0.63467216...
0.0
-1
Send null value in CardHolder field
def test_27(self): assert 'False' == Api.requestBlock('test-27')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_blank_value_19(field):\n if field.null:\n return None\n else:\n return ''", "def _get_blank_value_18(field):\n if field.null:\n return None\n else:\n return field.value_to_string(None)", "def testNoneValue(self):\n objectID = uuid4()\n user = creat...
[ "0.5914556", "0.5837562", "0.55973685", "0.557087", "0.5547278", "0.5503616", "0.5483212", "0.5483212", "0.5483212", "0.5462632", "0.5440998", "0.54318625", "0.54166967", "0.53936404", "0.5383697", "0.5375955", "0.53558004", "0.53320044", "0.53124905", "0.5299287", "0.5295345...
0.0
-1