query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Delete x amount of bot messages
async def purge_bot(self, ctx: Context, amount=1): if amount > 100: amount = 100 if amount < 0: return def check(message): return message.author == self.bot.user await ctx.channel.purge(limit=amount, before=ctx.message, check=check)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def clear(ctx, number):\n \"\"\":param: ctx\"\"\"\n \"\"\":param: number\"\"\"\n \"\"\"return \"\"\"\n number = int(number) \n counter = 0\n async for x in bot.logs_from(ctx.message.channel, limit = number):\n if counter < number:\n await bot.delete_message(x)\n ...
[ "0.77481544", "0.74987745", "0.7497183", "0.74901724", "0.7450936", "0.7391438", "0.7284043", "0.72562885", "0.7247382", "0.72472167", "0.723992", "0.7219219", "0.7213015", "0.71938187", "0.71436745", "0.7127978", "0.7118271", "0.7010183", "0.70031136", "0.6978605", "0.693893...
0.68364984
25
Mute a guild member or members
async def mute(self, ctx: Context, members: commands.Greedy[discord.Member], reason="no reason"): role = discord.utils.get(ctx.guild.roles, name="Muted") member_display = [] for i, member in enumerate(members): if role in member.roles: await ctx.send(f"guild member ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def mute(self, ctx):\n author = ctx.message.author\n channel = author.voice.channel\n members = channel.members\n for member in members:\n user = ctx.guild.get_member(member.id)\n await user.edit(mute=True)\n\n embed = await embeds.generate_embed(ctx, ...
[ "0.7798901", "0.7653592", "0.7627444", "0.7607709", "0.7532494", "0.74977887", "0.73828864", "0.7333656", "0.72878605", "0.7239192", "0.7226959", "0.7169681", "0.7156518", "0.7127044", "0.7124568", "0.7110185", "0.71043926", "0.70797306", "0.703087", "0.70285445", "0.70230985...
0.7674223
1
Write an image to test.db.
def write_img_to_db(): with lite.connect("test.db") as con: cur = con.cursor() data = read_image_from_fs() binary = lite.Binary(data) cur.execute("INSERT INTO Images(Data) VALUES (?)", (binary,))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveimage(item, db, collection):\n db[collection].insert(item)", "def save(image):\n keypoints, description = describe(image)\n artwork = {\n \"keypoints\": keypoints,\n \"description\": description,\n \"path\": image,\n \"date\": datetime.datetime.utcnow()\n }\n artwork_id = db.insert(art...
[ "0.7373012", "0.7175326", "0.71352047", "0.6815754", "0.6807879", "0.6787691", "0.6778175", "0.6721558", "0.6720335", "0.6696877", "0.66842467", "0.6601382", "0.6474795", "0.6465839", "0.6422823", "0.64141035", "0.6392812", "0.63747716", "0.6346009", "0.6345806", "0.6333592",...
0.8434261
0
Create the response for a resource. Note this will only be called on a GET, POST, PUT request if always_return_data is True
def create_response(self, *args, **kwargs): response = super(BaseCorsResource, self).create_response(*args, **kwargs) return self.add_cors_headers(response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_response(self, request, data, response_class=HttpResponse, **response_kwargs):\n desired_format = self.determine_format(request)\n serialized = self.serialize(request, data, desired_format)\n return response_class(content=serialized, content_type=build_content_type(desired_format), ...
[ "0.6794443", "0.6617301", "0.6503219", "0.6503219", "0.6445713", "0.6368175", "0.6348978", "0.6338609", "0.6336879", "0.6330831", "0.63300097", "0.63257605", "0.63113374", "0.6286923", "0.6273269", "0.62628484", "0.6165178", "0.61453694", "0.6124009", "0.61124665", "0.6100291...
0.66331303
1
Decorator for views that checks that the user has erp_profile
def has_erp_profile(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=reverse_lazy('err404')): actual_decorator = user_passes_test( lambda u: hasattr(u, "erp_profile") and hasattr(u, "profile"), login_url=login_url, redirect_field_name=redirect_field_name ) if functio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_profile(view):\n\n @wraps(view)\n @logged_in\n def fn(request, secret, trader_id, *args, **kargs):\n userinfo = db.get_userinfo(trader_id, get_language())\n if not userinfo:\n return login(request, method='GET')\n elif not userinfo['has_profile']:\n db.de...
[ "0.76568276", "0.69592255", "0.6944093", "0.65327114", "0.6404756", "0.6388112", "0.6247443", "0.6241699", "0.6219992", "0.6187993", "0.6109641", "0.608303", "0.6006323", "0.5981015", "0.59427375", "0.5938246", "0.5929341", "0.59123516", "0.5907608", "0.5900019", "0.5887762",...
0.7765793
0
Decorator for views that checks that the user has a user profile
def has_profile(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None): actual_decorator = user_passes_test( lambda u: hasattr(u, "profile"), login_url=login_url, redirect_field_name=redirect_field_name ) if function: return actual_decorator(function) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_profile(view):\n\n @wraps(view)\n @logged_in\n def fn(request, secret, trader_id, *args, **kargs):\n userinfo = db.get_userinfo(trader_id, get_language())\n if not userinfo:\n return login(request, method='GET')\n elif not userinfo['has_profile']:\n db.de...
[ "0.7905618", "0.73479795", "0.7147784", "0.7146184", "0.71173114", "0.705866", "0.70349056", "0.6999847", "0.66646326", "0.6623005", "0.6602829", "0.6560755", "0.6560755", "0.650255", "0.64435893", "0.6377723", "0.63118523", "0.6300441", "0.6290367", "0.62779605", "0.62259173...
0.74741435
1
return all symptoms for which argument 'symptom' is part of
def getSymptomsContaining(self, symptom): symptoms = set(symptom.split(' ')) results = [] for s in self.symptoms_list: s_words = set(s.split(' ')) if symptoms.issubset(s_words): results.append(s) return results
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_symptoms() -> list:\n symptoms = Doctor.get_initial_symptoms()\n for idx, value in enumerate(symptoms):\n print(idx + 1, end=': ')\n print(value.upper())\n symptom_num = input_integer('Which symptom do you have? Enter number (i.e 1): ') - 1\n symptom_list...
[ "0.729774", "0.6769729", "0.65302926", "0.6448432", "0.61154723", "0.5945253", "0.58878523", "0.56006974", "0.5502541", "0.54182994", "0.5376759", "0.5260897", "0.5219278", "0.52069443", "0.5190516", "0.5150393", "0.51492196", "0.5087444", "0.50456643", "0.5043214", "0.504192...
0.77760214
0
Draw arrow on the axes handle
def draw_arrow(axes, startx, starty, orient, arrow_len=5.0, color='black', lw=2.0): xy = (startx, starty) dxy = (np.cos(orient) * arrow_len, np.sin(orient) * arrow_len) xytext = tuple(map(sum, zip(xy, dxy))) axes.annotate( "", xy=xy, xytext=xytext, arrowprops=dict(arrowst...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DrawArrow(self, dc):\r\n\r\n rect = self.GetClientRect()\r\n point = wx.Point()\r\n\r\n point.x = (rect.GetLeft() + rect.GetRight()) / 2\r\n point.y = (rect.GetTop() + rect.GetBottom()) / 2\r\n rx, ry = wx.Size(), wx.Size()\r\n \r\n if self._direction == wx.TOP:...
[ "0.73847747", "0.71111363", "0.7061056", "0.69017327", "0.67877436", "0.67556757", "0.6676412", "0.66021013", "0.6527514", "0.65216935", "0.64992094", "0.6465742", "0.6425135", "0.6399125", "0.6398421", "0.6351686", "0.6322302", "0.63152665", "0.6263304", "0.6232509", "0.6205...
0.73055685
1
Simple batch NoData setting function. Makes raster data more arcmap viewing friendly Function inputs a list of raster (usually tifs) files and sets no data values. This function does not actually change the raster values in any way, and simply defines which numerical values to be considered NoData in metadata.
def define_null(rastlist, NoData_Value, Quiet=False): rastlist = core.enf_rastlist(rastlist) # iterate through each file in the filelist and set nodata values for rastname in rastlist: arcpy.SetRasterProperties_management(rastname,data_type="#",statistics="#", stats_file="#",n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def null_define(rastlist, NoData_Value):\n\n rastlist = enf_rastlist(rastlist)\n\n # iterate through each file in the filelist and set nodata values\n for rastname in rastlist:\n\n arcpy.SetRasterProperties_management(rastname,data_type=\"#\",statistics=\"#\",\n stats_file=\"#\",...
[ "0.72974336", "0.7241666", "0.7143281", "0.651706", "0.625011", "0.61252016", "0.6117665", "0.59925294", "0.5877693", "0.5832034", "0.5785689", "0.56626743", "0.56555873", "0.5561985", "0.55513155", "0.55437225", "0.55164975", "0.55005044", "0.54243237", "0.5375087", "0.53462...
0.7073412
3
Convert a PEP8 style snake_case name to CamelCase.
def snake_to_camel_case(name: str, initial: bool = False) -> str: chunks = name.split('_') converted = [s.capitalize() for s in chunks] if initial: return ''.join(converted) else: return chunks[0].lower() + ''.join(converted[1:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _snake_to_camel(name, strict=False):\n if strict:\n name = name.lower()\n terms = name.split('_')\n return terms[0] + ''.join([term.capitalize() for term in terms[1:]])", "def snake_to_camel(name):\n return \"\".join([piece.capitalize() for piece in name.split(\"_\")])", "def convert_cam...
[ "0.8722328", "0.86448616", "0.86045545", "0.84399647", "0.8409399", "0.8391545", "0.8358493", "0.8346304", "0.83353233", "0.8328296", "0.8270133", "0.8268014", "0.8250524", "0.82255864", "0.81961244", "0.8191365", "0.80719817", "0.8044909", "0.8016167", "0.7963714", "0.796371...
0.8577034
3
Convert a row result to dictionary mapping column names to cells.
def _get_cell_map(row: TRowResult) -> Dict[bytes, TCell]: if row.sortedColumns is not None: return {c.columnName: c.cell for c in row.sortedColumns} elif row.columns is not None: return row.columns else: # pragma: no cover raise RuntimeError("Neither columns nor sortedColumns is ava...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_dict(row):\n return dict((key[0], value) for key, value in zip(colnames, row))", "def result_dict(result):\n result_dict = [row.__dict__ for row in result]\n\n return result_dict", "def tsvRowToDict(row):\n return {col: getattr(row, col) for col in row._columns_}", "def __unp...
[ "0.7710213", "0.7126339", "0.7108276", "0.71065724", "0.7101688", "0.69340724", "0.68978256", "0.68587095", "0.6840473", "0.6826047", "0.67793435", "0.6755068", "0.6755068", "0.66425586", "0.6635001", "0.6548808", "0.6485044", "0.6480184", "0.6480184", "0.6480184", "0.6433391...
0.71205336
2
Overflow proof computation of 1 / (1 + exp(z)))
def logistic_grad(z): idx_pos = np.where(z >= 0.) idx_neg = np.where(z < 0.) res = np.empty(z.shape) res[idx_pos] = 1. / (1. + np.exp(-z[idx_pos])) res[idx_neg] = 1 - 1. / (1. + np.exp(z[idx_neg])) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expexp(x,y,z,p):\n\n \"\"\"\n Fermat's little theorem can be exploited to handle large values.\n This theorem states that:\n (a^p) is equivalent to (a mod p)\n This is the same as:\n (a^(p - 1)) is equivalent to (1 mod p)\n Thus, modular exponentiation can be done with (p - 1) to g...
[ "0.6893364", "0.68503934", "0.67295206", "0.67154175", "0.6635257", "0.65601474", "0.6532952", "0.6522998", "0.64652026", "0.64570564", "0.6441028", "0.6436002", "0.6406633", "0.6398662", "0.639482", "0.6387767", "0.638655", "0.6364744", "0.6335979", "0.632939", "0.6321783", ...
0.0
-1
Get tfjob training job.
def get_train_job(self, name, random_effect_config_obj, gdmix_config): training_data_dir, validation_data_dir, metadata_file, partition_list_file = self.get_train_input_paths(name) output_model_dir, training_score_dir, validation_score_dir = self.get_train_output_paths(name) gdmix_params = Para...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_training_job(cls, job: TrainingJob) -> Job:\n return Job(\n job.hyperparameters[\"model\"],\n job.hyperparameters[\"dataset\"],\n _extract_configuration(job),\n _extract_performance(job),\n source_job=job,\n )", "def job(self):\n ...
[ "0.6936078", "0.65779877", "0.63019204", "0.6277382", "0.62594163", "0.610316", "0.6086363", "0.6046689", "0.5985707", "0.5926784", "0.5839552", "0.5791399", "0.5774715", "0.57548416", "0.57445526", "0.5743346", "0.5735228", "0.570632", "0.5704499", "0.56114984", "0.5591558",...
0.55723095
22
Sends log embed to discord via webhook if defined in .env file.
async def send_webhook(self): if webhook_url: webhook = Webhook.from_url(webhook_url, adapter=AsyncWebhookAdapter(self.session)) await webhook.send(embed=self.embed)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n # Webhook URL\r\n self.WEBHOOK = DiscordWebhook(url=\"https://discord.com/api/webhooks/806990374996410368/QqilGNrBo652oBEnsuX-BMkU1e8_PGIO4ENiyiQF_V6qtuQLkT6Z_1-lFmzmatp9M8Mz\")\r\n \r\n # Executing Function\r\n # self.ExecuteEmbed()\r", "def discord_web...
[ "0.616778", "0.6161725", "0.6159451", "0.61169064", "0.61029345", "0.6072034", "0.6070274", "0.6007856", "0.596607", "0.593763", "0.59196246", "0.58304673", "0.5730168", "0.56920475", "0.56509453", "0.5646842", "0.5646842", "0.56140065", "0.56010145", "0.5578977", "0.5546449"...
0.57074887
13
Returns the url to access a particular shipping instance.
def get_absolute_url(self): return reverse('shipping-detail', args=[str(self.trip_number)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shipping_address(self) -> 'outputs.ShippingAddressResponse':\n return pulumi.get(self, \"shipping_address\")", "def shipping_address(self) -> 'outputs.ShippingAddressResponse':\n return pulumi.get(self, \"shipping_address\")", "def shipping_address(self) -> 'outputs.ShippingAddressResponse':\...
[ "0.62658817", "0.62658817", "0.62658817", "0.6244006", "0.6114832", "0.6054192", "0.5928809", "0.59005904", "0.59005904", "0.59005904", "0.59005904", "0.59005904", "0.59005904", "0.59005904", "0.59005904", "0.5898782", "0.5884156", "0.58772564", "0.5822437", "0.58027816", "0....
0.661378
0
String for representing the Model object.
def __str__(self): return self.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )", "def __str__(self):\n \n res =...
[ "0.82368803", "0.79901737", "0.7849152", "0.78468513", "0.77520275", "0.7625378", "0.7625378", "0.76225406", "0.76225406", "0.75483394", "0.7522958", "0.7470355", "0.7469358", "0.7447144", "0.7447144", "0.74314755", "0.7427648", "0.7389925", "0.7351721", "0.73424315", "0.7322...
0.0
-1
Returns the url to access a detail record for this contract.
def get_absolute_url(self): return reverse('contract-detail', args=[str(self.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details_url(self):\n if self._data.get('details_url'):\n path = self._data.get('details_url')\n try:\n path, hash_ = path.split('#')\n hash_ = '#' + hash_\n except ValueError:\n hash_ = ''\n return '{}?from_activity...
[ "0.70604056", "0.673758", "0.6643366", "0.65935445", "0.6561319", "0.65450984", "0.65194595", "0.6454398", "0.644531", "0.64104235", "0.64049244", "0.63917714", "0.63602287", "0.63547605", "0.6344795", "0.6344449", "0.6321107", "0.6321107", "0.630728", "0.6296801", "0.6293275...
0.6766415
1
>>> from solutions import isnegative >>> type(isnegative(0)) >>> isnegative(4) False >>> isnegative(0) False >>> isnegative(6) True
def isnegative(x): if x < 0 : return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_negative(self, a):\n return a < 0", "def is_nonnegative(self, a):\n return a >= 0", "def is_nonpositive(self, a):\n return a <= 0", "def is_positive(self, a):\n return a > 0", "def is_negated(x) -> bool:\n return not (x & 1 == 0)", "def _is_non_negative_int(item):\n ...
[ "0.7401165", "0.7270185", "0.72323954", "0.71389914", "0.7020085", "0.6917465", "0.68903625", "0.6837466", "0.67249215", "0.6683886", "0.6682441", "0.66616535", "0.66399103", "0.6597558", "0.65926963", "0.6568332", "0.6557648", "0.65293634", "0.65061605", "0.649253", "0.64570...
0.79147977
0
>>> from solutions import average >>> type(average([1, 2, 3])) >>> average([1, 2, 3]) 2.0 >>> average([4, 6, 8, 10, 12]) 8.0 >>> average([1, 2]) 1.5
def average(l): return float(sum(l)/len(l))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def avg(lst: list):\n return sum(lst) / len(lst)", "def average(lst):\n return sum(lst)/len(lst)", "def avg(list):\n return sum(list) / len(list)", "def main():\n print(average([2, 4, 6, 8, 20, 50, 70]))", "def avg(l):\n return (sum(l)/float(len(l)))", "def number_list_average(numbers):\n ...
[ "0.79171735", "0.7860328", "0.7771493", "0.7750546", "0.7648696", "0.7593932", "0.75804037", "0.7373194", "0.7357592", "0.735255", "0.7319006", "0.72868216", "0.7286525", "0.72804683", "0.7266818", "0.72645277", "0.724221", "0.7238001", "0.71999824", "0.71998405", "0.71632415...
0.783011
2
Get the amount of precipitation on this moment.
def precipitation_now(self) -> Optional[float]: for precip in self.precipitation_from_now: return precip.value return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precipitation_forecast_total(self) -> float:\n return sum(item[1] for item in self.precipitation)", "def precipitation_forecast_average(self) -> Optional[float]:\n precipitation = self.precipitation\n if not precipitation:\n return None\n return self.precipitation_forec...
[ "0.74376404", "0.685225", "0.63134015", "0.625613", "0.6245581", "0.6229303", "0.6184947", "0.6184947", "0.6154793", "0.6080454", "0.605403", "0.6033319", "0.596729", "0.5919479", "0.59120697", "0.5910181", "0.5890121", "0.58310145", "0.5821227", "0.5779116", "0.5763275", "...
0.75490516
0
Get the average expected precipitation.
def precipitation_forecast_average(self) -> Optional[float]: precipitation = self.precipitation if not precipitation: return None return self.precipitation_forecast_total / len(precipitation)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def average(self):\n return self.summation() / self.count()", "def getAverage(self):\n return sum(self.scores) / len(self.scores)", "def calculateAverage(self, data):\n\n nValidTrials = data['nValid'][-1]\n nRewardTrials = data['nRewarded'][-1]\n return float(nRe...
[ "0.68928885", "0.6834946", "0.6799861", "0.6770467", "0.6746747", "0.67297393", "0.6698538", "0.6698538", "0.6694594", "0.6689713", "0.665651", "0.665651", "0.665651", "0.66474044", "0.6628745", "0.66119254", "0.65147996", "0.65032446", "0.6502673", "0.6496023", "0.64799803",...
0.73215616
0
Get precipitation from now.
def precipitation_from_now(self) -> List[PrecipitationAt]: now = datetime.now() return [ precip for precip in self.precipitation if precip.timestamp >= now ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precipitation_now(self) -> Optional[float]:\n for precip in self.precipitation_from_now:\n return precip.value\n return None", "def precipitation():\n last_date = session.query(Measurement.date).order_by(Measurement.date.desc()).first()\n last_year = dt.date(2017, 8, 23) - dt.t...
[ "0.78949505", "0.6811585", "0.67470664", "0.673407", "0.66315824", "0.6471088", "0.628823", "0.6172839", "0.615218", "0.61413497", "0.61377007", "0.61036247", "0.6096725", "0.60690176", "0.6010114", "0.59863585", "0.59835964", "0.59796995", "0.5951345", "0.5900548", "0.589497...
0.7035007
1
Constructor. options the list of options for the `Tkinter.Entry` constructor; an additional 'value' option could be specified in order to set the initial value of the filter.
def __init__(self, parent, **options): # Store the variable, otherwise the callback won't be invoked; it # is like tkinter makes use of weakrefs self._var = StringVar(options.pop('value', '')) options.update(textvariable=self._var) self._proxy = tkinter.Entry(parent, **options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parent, **options):\n self._placeholder = options.pop('placeholder', '')\n\n if self._placeholder:\n options.update(value=self._placeholder)\n self._proxy = Filter(parent, **options)\n\n def _on_focus_in_event(evt):\n if self.get() == self._place...
[ "0.6471188", "0.635089", "0.5668355", "0.56105953", "0.54705113", "0.5419807", "0.54096186", "0.5394258", "0.53553295", "0.53378487", "0.53068864", "0.52960014", "0.5273476", "0.5249059", "0.5210141", "0.515542", "0.51124936", "0.5078553", "0.5062761", "0.50592434", "0.505073...
0.60679567
2
Sets the value of the filter. value the new filter value.
def set(self, value): self._proxy.delete(0, tkinter.END) self._proxy.insert(0, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_FilterValue(self, value):\n super(GetCallbackDataInputSet, self)._set_input('FilterValue', value)", "def setFilter(self, column, value) -> None:\n if not self.hasFilter(column):\n column_name = self._dataframe.columns[column]\n self._filters[column_name] = value\n ...
[ "0.81996375", "0.6933717", "0.68891186", "0.6877673", "0.6872791", "0.678382", "0.672529", "0.672529", "0.672529", "0.66755205", "0.6567076", "0.64696985", "0.6426786", "0.64147073", "0.6402942", "0.63972765", "0.6383252", "0.6383252", "0.6383252", "0.6383252", "0.6383252", ...
0.0
-1
Constructor. options the list of options of the `Tkinter.Frame` constructor; an additional 'placeholder' option could be specified in order to set the placeholder for the filter.
def __init__(self, parent, **options): self._placeholder = options.pop('placeholder', '') if self._placeholder: options.update(value=self._placeholder) self._proxy = Filter(parent, **options) def _on_focus_in_event(evt): if self.get() == self._placeholder: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parent, **kwargs):\n filter_values = kwargs.pop('filter_values', [])\n\n self._proxy = tkinter.Frame(parent, **kwargs)\n\n last_filter = FilterWithPlaceholder(self._proxy,\n placeholder='<Add new>',\n ...
[ "0.75193864", "0.6141101", "0.6004331", "0.59633917", "0.5791976", "0.567846", "0.567792", "0.5636572", "0.55872196", "0.5538854", "0.55017674", "0.5466698", "0.5372633", "0.53039545", "0.5291298", "0.52823716", "0.5267848", "0.5258127", "0.525099", "0.52346885", "0.52231836"...
0.62358516
1
Constructor. options the list of options for the `Tkinter.Frame` constructor; an additional 'filter_values' option (list of strings) could be specified in order to initialize the filter bar with the specified set of filters.
def __init__(self, parent, **kwargs): filter_values = kwargs.pop('filter_values', []) self._proxy = tkinter.Frame(parent, **kwargs) last_filter = FilterWithPlaceholder(self._proxy, placeholder='<Add new>', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, parent, fields, callback=None, closecallback=None):\n Frame.__init__(self, parent)\n self.parent = parent\n self.callback = callback\n self.closecallback = closecallback\n self.fields = fields\n self.filters = []\n self.addFilterBar()\n add...
[ "0.64826083", "0.6277029", "0.5817046", "0.5709903", "0.5662294", "0.5644694", "0.5592458", "0.54903656", "0.545534", "0.5436006", "0.54279757", "0.54159945", "0.54068583", "0.5370743", "0.5358217", "0.534413", "0.5333991", "0.5316232", "0.530375", "0.5236715", "0.5226319", ...
0.7411854
0
Returns the magnitude of the vector.
def __abs__(self): return hypot(self.x, self.y)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnitude(self): # @todo @caution check: something wrong?\n\n return (math.sqrt(reduce(lambda x, y: x+y,\n [x**2 for x in self.vector])))", "def magnitude(v: Vector) -> float:\n return math.sqrt(sum_of_squares(v))", "def magnitude(vector):\n return math.sqrt(sum_of_squares(vecto...
[ "0.8613963", "0.8073114", "0.8044896", "0.80385244", "0.7986384", "0.79468423", "0.7940081", "0.77658945", "0.76870775", "0.76260734", "0.76260734", "0.76118505", "0.75793225", "0.75790787", "0.7550049", "0.75192785", "0.74860656", "0.7478015", "0.74277246", "0.7243205", "0.7...
0.0
-1
Replace p in variable with "." character. TODO Fails if last letter is a "p" Variables with "." character had them previously replaced with a "p" character to avoid periods in a folder name.
def __replace_p_for_per__(self, text): # | - __replace_p_for_per__ lst = [pos for pos, char in enumerate(text) if char == "p"] # Replaces character at lett with a period if both the previous # and next character are numeric for lett in lst: # COMBAK # Sk...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_dot(data):\n data = re.sub(\"[.]\", \" . \", data)\n return data", "def handle_dots(string):\n if '.' in string:\n if string[-1] == '.':\n string = string[:-1]\n else:\n string = string.replace('.', '. ')\n\n return string", "def replace_dots(filename...
[ "0.6483151", "0.63436085", "0.62748134", "0.6038883", "0.5996114", "0.5942767", "0.5879662", "0.5809394", "0.5760867", "0.56397575", "0.5586598", "0.55618554", "0.5535774", "0.5501471", "0.5484439", "0.5465551", "0.5445529", "0.54231155", "0.5411442", "0.54035795", "0.5385255...
0.7070417
0
Checks if queue is empty
def is_empty(self): if self.head is None: return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_empty(self):\n return self.queue == []", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.queue) == 0", "def is_empty(self):\n return len(self.__queue) > 0", "def is_empty(self):\n return len(self.the_queue) == 0", "def ...
[ "0.89086026", "0.88597846", "0.88597846", "0.88391805", "0.8817961", "0.87150127", "0.86679065", "0.8643777", "0.860195", "0.85867566", "0.8574571", "0.8494406", "0.84759986", "0.8460539", "0.8446537", "0.83741766", "0.8369822", "0.8358287", "0.8358287", "0.831682", "0.827828...
0.0
-1
Plot the given confusion matrix cm as a matrix using and return the resulting axes object containing the plot.
def plot_confusion_matrix(cm, classes, xlabel, ylabel, normalize=False, cmap=plt.cm.Blues): vmin = None vmax = None if normalize: cm = cm.astype('float') / cm.sum(axis=1)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=None, ax=None, rotate_y=True, cmap='Blues'):\n if ax is None:\n fig, ax = plt.subplots(figsize=(8, 6))\n\n # If cm not put in, create one\n if isinstance(cm, list) or isinstance(cm, tuple):\n cm = confusion_matrix(cm[0], cm[1])\n if not classes:\n ...
[ "0.7833931", "0.7704035", "0.7646946", "0.7590556", "0.75545114", "0.7553369", "0.75483483", "0.7506119", "0.7479015", "0.74110323", "0.7409289", "0.73988664", "0.7355505", "0.7346693", "0.7339266", "0.7329321", "0.732829", "0.73270524", "0.73253083", "0.7309869", "0.73084706...
0.73283285
16
Load an image from path and return the corresponding np array
def load(path): print("path", path) print(Path(path).is_file()) if Path(path).is_file(): img = image.imread(path) print(f"Loading image of dimensions {img.shape[0]} x " f"{img.shape[1]}") return np.array(img) raise FileNotFoundError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_img(path: str) -> np.ndarray:\n \n return np.array(Image.open(path))", "def loadImage(img_path):\n\n img = Image.open(img_path)\n np_img = np.array(img)\n return (np_img)", "def loadImage(self, path: str) -> ndarray:\n try:\n self.img = np.asarray(Image.open(path))\n\n...
[ "0.8904769", "0.8510568", "0.8498624", "0.84052414", "0.83818793", "0.8362678", "0.8362678", "0.8247801", "0.8086406", "0.80538297", "0.8048714", "0.8033133", "0.7959859", "0.78730464", "0.7857398", "0.782003", "0.7794916", "0.7778447", "0.77642596", "0.7737531", "0.7719111",...
0.88544345
1
Returns the configuration parameters of the model.
def get_params(self): return { 'dropout': self._dropout, 'layer_size': self._layer_size, 'num_layers': self._num_layers, 'embedding_layer_size': self._embedding_layer_size, 'controller_type': self._controller_type }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_configuration_parameters_values(self):\n return (self.timestamp, self.model_name, self.model.WEIGHT_PATH, self.model.FIT_HISTORY_PATH,\n self.learning_rate, self.load_weights, self.freeze_layers, self.margin,\n self.hard_sampling_batch_size, self.batch_size, self.number...
[ "0.7990217", "0.7930042", "0.75088614", "0.7491878", "0.74077034", "0.73973525", "0.73719037", "0.734099", "0.7326397", "0.72808266", "0.72660464", "0.72557265", "0.72244453", "0.7169459", "0.71642935", "0.71578586", "0.70651275", "0.7040393", "0.7038968", "0.7031743", "0.698...
0.68735325
46
Remove all actors from renderer, prepare for destruction.
def close(self): self.renderer.RemoveActor(self._crosshair.actor) self.renderer.RemoveActor(self._scalar_bar_actor) self.renderer.RemoveActor(self._orientation_annotation) self.renderer.RemoveActor(self._corner_annotation) for layer in self._layers : sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clean_actors(self):\n for actor in self.actor_list:\n actor.destroy()", "def clear_actors(self):\n if self._actors:\n for actor in list(self._actors):\n try:\n self.remove_actor(actor, reset_camera=False, render=False)\n ex...
[ "0.7703138", "0.74796385", "0.64244276", "0.63409066", "0.6312541", "0.62732476", "0.6261495", "0.62513936", "0.62191254", "0.61581737", "0.6118134", "0.6115581", "0.6091879", "0.6089108", "0.6066934", "0.60586613", "0.6053655", "0.6047972", "0.60463434", "0.6042318", "0.6034...
0.68038595
2
Insert a new layer at specified position. The colormap defaults to a gray colormap. If the colormap's display range is None, it defaults to the image range.
def insert_layer(self, index, image, colormap=None, opacity=1.0) : if colormap is None : colormap = Colormap(colormaps["gray"], None, False, False, False) if colormap.display_range is None : colormap.display_range = (image.data.min(), image.data.max()) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addPoint(scat, new_point, c='k'):\n old_off = scat.get_offsets()\n new_off = np.concatenate([old_off, np.array(new_point, ndmin=2)])\n old_c = scat.get_facecolors()\n new_c = np.concatenate([old_c, np.array(to_rgba(c), ndmin=2)])\n\n scat.set_offsets(new_off)\n scat.set_facecolors(new_c)\n\n ...
[ "0.55439585", "0.55319107", "0.55075544", "0.5425373", "0.5369888", "0.53670657", "0.5269444", "0.52346647", "0.520999", "0.5186761", "0.5135624", "0.5128617", "0.5114363", "0.5110885", "0.5108525", "0.5087154", "0.507161", "0.5051082", "0.5047803", "0.49867", "0.49838167", ...
0.68428254
0
Display image using physical or index coordinates.
def _get_display_coordinates(self) : return self._display_coordinates
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display(self):\n display(self.image)", "def show(self, screen):\n x_display = self.xy_position[0] * constants.CELL_SIZE\n y_display = self.xy_position[1] * constants.CELL_SIZE\n screen.blit(self.image, (x_display, y_display))", "def display(self, image):\n raise NotImplem...
[ "0.745933", "0.740819", "0.7257223", "0.7239815", "0.71864957", "0.715634", "0.71142626", "0.68808275", "0.6828431", "0.6821925", "0.6802677", "0.67949855", "0.6784546", "0.67628306", "0.6762713", "0.6737159", "0.6682209", "0.66761035", "0.6652455", "0.664794", "0.6647453", ...
0.0
-1
Returns the rule that defines the decision tree
def get_rule(self): return self.__rule_
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRule(self, *args):\n return _libsbml.Model_getRule(self, *args)", "def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")", "def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")", "def rule(self) -> pulumi.Input[str]:\n return pulumi.ge...
[ "0.6874737", "0.6843586", "0.6843586", "0.6843586", "0.67999446", "0.67816", "0.67816", "0.67816", "0.67816", "0.67816", "0.67816", "0.67816", "0.6621645", "0.6621645", "0.6621645", "0.6260332", "0.6216926", "0.6162008", "0.6161543", "0.59829193", "0.59243625", "0.5885613",...
0.6791814
5
Encodes float data as onehot
def float_to_one_hot(self, data=[]): if len(data) == 0: if len(self.__groups) != 0: return self.__data[0], self.__groups data = self.__data[0].copy() groups = np.zeros((self.__data[0].shape[1], self.__n_groups)) for col in range(data.shape[1]): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_encode(x):\n # TODO: Implement Function\n lb = preprocessing.LabelBinarizer()\n lb.fit([0,1,2,3,4,5,6,7,8,9])\n \n return lb.transform(x)", "def one_hot_encoding(data):\r\n encoder = LabelEncoder()\r\n y = encoder.fit_transform(data)\r\n return(y)", "def one_hot_encoding(dat...
[ "0.7661648", "0.7636247", "0.7634217", "0.7603763", "0.7505124", "0.74905723", "0.7387644", "0.7330821", "0.7297178", "0.7283698", "0.72557306", "0.72544634", "0.71715796", "0.71715796", "0.71707153", "0.71008295", "0.70751816", "0.7049512", "0.70273846", "0.70223063", "0.702...
0.0
-1
Gets the probability of a class 1 arrival to occur
def prob_class_1_arrival(state, lambda_1, mu, num_of_servers): return lambda_1 / (lambda_1 + (mu * min(state[1], num_of_servers)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_probability(self):\n return 0", "def calculate_class_apriori_probability(self, class_name):\n unique, counts = np.unique(self.class_data, return_counts=True)\n frequency_dict = dict(zip(unique, counts))\n return float(frequency_dict[class_name])/len(self.class_data)", ...
[ "0.6754256", "0.66566694", "0.66415906", "0.64009356", "0.6343848", "0.62600017", "0.6256348", "0.6233273", "0.62299186", "0.6228574", "0.622191", "0.6200979", "0.6132618", "0.6124477", "0.61117935", "0.60950464", "0.6077395", "0.6072238", "0.60721195", "0.6053972", "0.600978...
0.7393708
0
Create a new model, reading parameters from a dictionary.
def __init__(self, params): self.params = (params,) [setattr(self, key, value) for key, value in params.items()] self.speed_step = (self.speed_desire_mean - self.speed_min) / 3 # Average number of speeds to check # Batch Details self.time_id = 0 self.step_id = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dictionary(cls,\r\n dictionary):\r\n if dictionary is None:\r\n return None\r\n\r\n # Extract variables from the dictionary\r\n external_ids = dictionary.get('externalIds')\r\n harsh_accel_setting = dictionary.get('harsh_accel_setting')\r\n ...
[ "0.7304857", "0.72744143", "0.7258984", "0.7229222", "0.7137008", "0.7137008", "0.71235055", "0.69354904", "0.6927142", "0.6908141", "0.6862913", "0.68550795", "0.6782231", "0.67586374", "0.67520714", "0.67341995", "0.6716931", "0.66805214", "0.66743654", "0.6655442", "0.6654...
0.0
-1
Modifies the serializer context adding the current circle to the context.
def get_serializer_context(self): context = super(RideViewSet, self).get_serializer_context() context['circle'] = self.circle if self.action in ['join', 'finish', 'qualify']: context['ride'] = self.get_object() return context
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n\n shape = super().to_dict()\n shape[\"radius\"] = self.radius\n return shape", "def set_context(self, serializer):\n if 'order' in serializer.context:\n self.set_instance(serializer.context['order'])\n else:\n self.set_instance(seriali...
[ "0.55310136", "0.5440727", "0.5402025", "0.5402025", "0.5108128", "0.5059284", "0.5039419", "0.5039419", "0.49976954", "0.4960028", "0.49362814", "0.49350318", "0.49174938", "0.4905938", "0.48826665", "0.48826665", "0.48676038", "0.47956836", "0.47905245", "0.4786636", "0.476...
0.6407666
0
Manages getting the queryset.
def get_queryset(self): circle = self.circle if self.action not in ['finish', 'qualify']: offset = timezone.now() + timedelta(minutes=10) queryset = circle.ride_set.filter( available_seats__gte=1, departure_date__gte=offset ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self, request, queryset):\n\n return queryset", "def get_queryset(self):\r\n return self.model.objects.all()", "def get_queryset(self):\n if self.queryset is None:\n return self.model.objects.all()\n return self.queryset", "def get_queryset(self) -> Que...
[ "0.7954566", "0.78271765", "0.7809876", "0.77836436", "0.77616364", "0.75244313", "0.75244313", "0.7376197", "0.7358432", "0.7340163", "0.733432", "0.73308223", "0.72970015", "0.72651935", "0.72569853", "0.72321504", "0.71764666", "0.7153948", "0.715134", "0.7115535", "0.7031...
0.0
-1
Return the smallest number n that is a multiple of both a and b. >>> multiple(3, 4) 12 >>> multiple(14, 21) 42
def multiple(a, b): from fractions import gcd def lcm(x,y): return (x*y)//gcd(x,y) #return lcm(a,b) def gcd(x,y): if y > x: x, y = y, x while y != 0: x, y = y, x % y return x return (a*b) // gcd(a,b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowest_common_multiple(a, b):\n # 两个数字相乘后除以最大公约数 = 两个数字的最小公倍数\n return a * b // gcd(a, b)", "def smallest_multiple(n):\n return reduce(lowest_common_multiple, range(1, n+1))", "def next_smaller_multiple(value, multiple):\n return multiple * math.floor(value / multiple)", "def lcm(a: int, b: i...
[ "0.7195958", "0.71496266", "0.6937133", "0.67832553", "0.6770986", "0.67688614", "0.676496", "0.67615294", "0.67615294", "0.6721192", "0.67109597", "0.6687319", "0.6672046", "0.6672046", "0.66452235", "0.6622864", "0.6622864", "0.6622864", "0.6622864", "0.6622864", "0.6622864...
0.75785863
0
Return the number of unique digits in positive integer n >>> unique_digits(8675309) All are unique 7 >>> unique_digits(1313131) 1 and 3 2 >>> unique_digits(13173131) 1, 3, and 7 3 >>> unique_digits(10000) 0 and 1 2 >>> unique_digits(101) 0 and 1 2 >>> unique_digits(10) 0 and 1 2
def unique_digits(n): #return len(set(str(n))) f = sorted(list(str(n))) return len([x for i,x in enumerate(f) if x not in f[i+1:]]) #print(len(set(str(n))), r)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_digits(n):\n \"*** YOUR CODE HERE ***\"\n count = 0\n for k in range(0, 10):\n if has_digit(n, k):\n count = count + 1\n return count", "def ndigits(n):\n return len(str(abs(n)))", "def count_digits(n):\n return len(str(n))", "def _number_of_digits(numbe...
[ "0.83288056", "0.7192125", "0.715199", "0.65731144", "0.6548711", "0.6465295", "0.63710713", "0.632561", "0.6236519", "0.61644757", "0.6122112", "0.60541046", "0.604889", "0.6037273", "0.60355854", "0.60208684", "0.60130656", "0.59900653", "0.5984302", "0.5903801", "0.5897540...
0.83579713
0
View function for homepage of the site
def index(request): # Generate counts of blog posts and blog authors num_blogs = Blog.objects.all().count() num_authors = BlogAuthor.objects.count() context = { 'num_blogs' : num_blogs, 'num_authors' : num_authors, } # Render the HTML template index.html with ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homepage(request):\n\treturn render(request, 'core/homepage.html')", "def homepage(request):\n return render_to_response('h1ds_core/homepage.html', \n context_instance=RequestContext(request))", "def homepage(request):\n \n return render(request, 'homepage.html')", "...
[ "0.8622844", "0.853484", "0.8362235", "0.8271454", "0.8252227", "0.8220062", "0.8205728", "0.81418973", "0.8125051", "0.8106561", "0.809255", "0.8089681", "0.8063806", "0.80591655", "0.80591655", "0.80384344", "0.8031424", "0.8004934", "0.7975438", "0.7963651", "0.793291", ...
0.0
-1
Creates our default superuser, returns True for success and False for failure
def ensure_superuser_exists(*args, **kwargs): from django.contrib.auth.models import User username = settings.ADMIN_USERNAME password = settings.ADMIN_PASSWORD logger = logging.getLogger('otree') if User.objects.filter(username=username).exists(): # msg = 'Default superuser exists.' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_superuser(self, email, password):\n user = self.create_user(email, password)\n user.is_staff = True\n user.is_superuser = True\n user.save(using=self._db)\n\n return user", "def create_superuser(self, username, email, password):\n print(\"creating super user....\")\n user ...
[ "0.77977407", "0.77894527", "0.77489454", "0.77156234", "0.7715306", "0.76982427", "0.76713", "0.766384", "0.7658684", "0.7636522", "0.7635369", "0.7602167", "0.7595859", "0.75837076", "0.75545835", "0.7548293", "0.7544798", "0.75437474", "0.75425774", "0.75262856", "0.75224"...
0.7475576
32
return the output dimension given the input one for Conv2d or MaxPool2d
def N_out(K,P,S,N_in): return (int((N_in+2*P-K)/S)+1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_dim(self) -> int:\n raise NotImplementedError", "def get_conv1d_output_size(input_size, kernel_size, stride):\n return ((input_size - kernel_size)//stride) + 1", "def get_conv1d_output_size(input_size, kernel_size, stride):\n return ((input_size - kernel_size)//stride) + 1", "def get_...
[ "0.7241552", "0.72143215", "0.72143215", "0.7121234", "0.6999941", "0.6965102", "0.689241", "0.68909115", "0.68164825", "0.67469347", "0.67171204", "0.66891915", "0.6679558", "0.6665291", "0.6592426", "0.65586114", "0.65586114", "0.65586114", "0.649466", "0.64420843", "0.6433...
0.0
-1
returns the equivalent slice for the input tensor of the filter
def get_slic (slic,S,P,K,N): assert(isinstance(slic[0],int) and isinstance(slic[1],int)) assert(isinstance(S,int) and isinstance(K,int) and isinstance(P,int)) return (max(slic[0]*S-P,0),min(slic[1]*S +K-P,N))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getslice(arr: tf.Tensor, slice: tf.Tensor, axis: int) -> tf.Tensor:\n if arr is None:\n return None\n return tf.boolean_mask(arr, slice, axis=axis)", "def slice(tensor):\n out = tensor[:, 444:524, :]\n return out", "def _slice(tensor, size, i):\n return tensor[:, i * size : (i + 1) * ...
[ "0.7373297", "0.71620744", "0.69715893", "0.6311074", "0.6301479", "0.6255326", "0.6203137", "0.6167459", "0.61244345", "0.6077687", "0.60691786", "0.60324615", "0.6002256", "0.59788907", "0.59612715", "0.59460884", "0.5911506", "0.5853995", "0.58261776", "0.58142453", "0.581...
0.0
-1
Method to turn off all motors
def turnOffMotors(self) -> None: mh.getMotor(1).run(Adafruit_MotorHAT.RELEASE) mh.getMotor(2).run(Adafruit_MotorHAT.RELEASE) mh.getMotor(3).run(Adafruit_MotorHAT.RELEASE) mh.getMotor(4).run(Adafruit_MotorHAT.RELEASE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn_off_motors():\n MOTOR_HAT.release_motors()", "def turnOffMotors(self):\n self.mh.getMotor(1).run(Adafruit_MotorHAT.RELEASE)\n self.mh.getMotor(2).run(Adafruit_MotorHAT.RELEASE)\n self.mh.getMotor(3).run(Adafruit_MotorHAT.RELEASE)\n self.mh.getMotor(4).run(Adafruit_MotorHAT...
[ "0.8592148", "0.8516176", "0.8040889", "0.7906769", "0.7805959", "0.7798688", "0.7773433", "0.76799667", "0.7502376", "0.739445", "0.738192", "0.7315012", "0.7299683", "0.7183742", "0.7165379", "0.71424824", "0.7134631", "0.7134242", "0.7115855", "0.7101031", "0.70863384", ...
0.851119
2
Constructs a new rest client instance.
def get(host, port=None, version=None): port = 8081 if port is None else port version = "v1" if version is None else version if version not in VERSIONS.keys(): raise RestException(f"Unknown REST API version: {version}") api_client_cls = VERSIONS[version] return api_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new(\n host: str = \"localhost\",\n port: int = 4110,\n user: str = \"pyserval\",\n passwd: str = \"pyserval\",\n ):\n connection = RestfulConnection(host=host, port=port, user=user, passwd=passwd)\n return LowLevelClient(connection=connection)", "def __init__(sel...
[ "0.7374413", "0.73243415", "0.7220599", "0.71450883", "0.7109651", "0.6873812", "0.68594766", "0.68017465", "0.673662", "0.6730717", "0.671623", "0.6668291", "0.6661582", "0.66316", "0.6609823", "0.6551867", "0.65434337", "0.65397197", "0.6524681", "0.6516445", "0.64839035", ...
0.627167
30
The root under which all files for this archive are stored. It's deleted when the Archive is deleted.
def root_path(self) -> Path: return ARCHIVES_ROOT / self.source_name / self.key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def archive_root(self):\n return join(self._root, self._archive)", "def GetRoot(self):\n\n return self.GetPath()", "def rootfs(self):\r\n return self._rootfs", "def rootfs(self):\r\n return self._rootfs", "def root(self):\n return self.paths.root", "def get_root_path(self) ...
[ "0.7951157", "0.75424963", "0.7313497", "0.7313497", "0.7285105", "0.72555685", "0.7129602", "0.7119653", "0.7115457", "0.70661634", "0.7018048", "0.70140624", "0.6935436", "0.6935436", "0.69331986", "0.69272023", "0.6908822", "0.6908822", "0.6908822", "0.6893669", "0.6893669...
0.7636951
1
Generate a random string of fixed length
def randomString(stringLength): letters = string.ascii_lowercase return ''.join(random.choice(letters) for i in range(stringLength))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_random_string(length: int):\n\tall_chars = string.ascii_letters + string.digits\n\treturn ''.join(random.choices(all_chars, k=length))", "def generate_random_string(length=6):\n n = int(length / 2 + 1)\n x = binascii.hexlify(os.urandom(n))\n s = x[:length]\n return s.decode(\"utf-8\")",...
[ "0.8680464", "0.8573714", "0.85486245", "0.85297275", "0.85209286", "0.84331024", "0.8432044", "0.84157014", "0.84120053", "0.8389201", "0.8345882", "0.8343962", "0.83406156", "0.83348686", "0.83240855", "0.82986933", "0.82911193", "0.8281826", "0.82818025", "0.82811046", "0....
0.0
-1
Return adjusted matrix for size/padding combination
def adjusted_matrix(self): mat = AlignerExtract().transform_matrix(self.aligned["matrix"], self.aligned["size"], self.aligned["padding"]) return mat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def padding(image, padded_size):\n image_row, image_col = image.shape #asigna alto y ancho de la imagen \n\n padded_image = np.zeros((image_row + padded_size*2, image_col + padded_size*2)) #matriz de imagen con padding en zeros\n print(\"Padded image zeros:\")\n print(padded_image)\n\n padded_image[...
[ "0.6394975", "0.6256877", "0.6189915", "0.61371964", "0.60675055", "0.60554355", "0.60016215", "0.5994034", "0.59814125", "0.5927268", "0.59104526", "0.5904462", "0.58893687", "0.5885824", "0.5877527", "0.5875689", "0.5841097", "0.5806219", "0.5805805", "0.5801998", "0.578718...
0.69532
0
This ensures that a media (invoice) can only be seen within a company.
def validate(self, data): company = data['company'] if self.context['request'].user.has_perm("view_company", company): return data else: raise PermissionDenied()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, data):\n company = data['company']\n invoice = data.get(\"invoice\")\n if not self.context['request'].user.has_perm(\"view_company\", company) or not all(\n self.context['request'].user.has_perm(\"view_media\", media) for media in invoice):\n raise ...
[ "0.6852499", "0.6852499", "0.5367599", "0.52662086", "0.51306087", "0.508483", "0.49837443", "0.49253538", "0.4919247", "0.48707446", "0.48626187", "0.48339003", "0.47991934", "0.4791208", "0.4775708", "0.4761782", "0.4757667", "0.47284174", "0.4717786", "0.47098377", "0.4643...
0.47858933
14
Convert bitstring bs (str) to numpy.ndarray of int8.
def bs_to_array(bs): return np.array([int(x) for x in bs], dtype="int8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bitarray_to_data(bits):\n return np.fromstring(bits,dtype = np.int32)", "def from_ascii(s):\n\treturn numpy.array(\n\t\t[\n\t\t\tord(c)\n\t\t\tfor c in s\n\t\t],\n\t\tdtype=numpy.uint8\n\t)", "def string_to_array(arg):\n\n res = arg.replace('[', '').replace(']', '').replace(',', '')\n return np.ar...
[ "0.75145376", "0.6877663", "0.67333657", "0.6698026", "0.65753466", "0.6540179", "0.6360403", "0.63499284", "0.63486683", "0.6320942", "0.63167715", "0.6240664", "0.6147097", "0.6109892", "0.6109892", "0.6101808", "0.60647774", "0.60322577", "0.60280454", "0.60166496", "0.600...
0.8064167
0
Return +8 hours + 0 to 60 minutes
def get_exit_dt(in_dt): exit_dt = in_dt + dt.timedelta(hours=9) - dt.timedelta(minutes=random.randint(0,120)) return exit_dt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_zone_minus_8(time):\n return time + timedelta(hours=-8)", "def proxy_hours_minutes(self):\n\n td = self.convert_last_col_filtered()\n resultat = td.days * 24 + td.seconds // 3600, (td.seconds // 60) % 60\n # print('{} H {} M'.format(*resultat))\n print(resultat)\n r...
[ "0.6828732", "0.67006", "0.63761336", "0.60621244", "0.60584366", "0.5962619", "0.5893198", "0.58844894", "0.58704317", "0.584286", "0.5816542", "0.5811686", "0.57601196", "0.5746146", "0.57126236", "0.5699542", "0.5696678", "0.56950396", "0.5661786", "0.56541044", "0.564853"...
0.5455814
51
Creates a one shot iterator from the TFRecord files.
def consume_tfrecord(is_training=True, batch_size=32): if is_training: dataset = tf.data.TFRecordDataset(tfrecord_file_training) else: dataset = tf.data.TFRecordDataset(tfrecord_file_eval) dataset = dataset.map(tfrecord_utils.parse) if is_training: dataset = dataset.map(distort...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readTFRecord():\n #filenameQueue = tf.train.string_input_producer([tfName])\n dataset_fn = tf.data.TFRecordDataset\n _parse_fn = lambda x: parse_fn(x, is_train=False)\n \n # create a tf.data.Dataset from list of files\n filenames = tf.data.Dataset.list_files(\"./processed/train*.tfrecords\")\...
[ "0.7574853", "0.69558114", "0.6632008", "0.64200073", "0.63694733", "0.62489194", "0.6246814", "0.6246814", "0.6221869", "0.6196174", "0.6151926", "0.61117154", "0.60785913", "0.6026034", "0.60027605", "0.5973288", "0.59585863", "0.5917566", "0.59157676", "0.591299", "0.59125...
0.6348115
5
Sets the learning rate to the initial LR decayed by 10 every reduce_epoch epochs
def adjust_learning_rate(optimizer, epoch, reduce_epoch=5): for param_group in optimizer.param_groups: lr = param_group['lr'] # Decrease the current learning rate lr *= 0.1 if epoch > 0 and epoch % reduce_epoch == 0 else 1 param_group['lr'] = lr # print(optimizer.param_groups...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(initial_lr, optimizer, epoch, every_epoch):\n lr = initial_lr * (0.1 ** (epoch // every_epoch))\n for param_group in optimizer.param_groups:\n param_group['lr'] = lr", "def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #lr = start_lr * (0.1 ** (epoch // 30)...
[ "0.7974658", "0.7934057", "0.78568393", "0.7848428", "0.7836289", "0.7823883", "0.7792017", "0.7784007", "0.7781726", "0.7772908", "0.77677417", "0.7755315", "0.7752644", "0.7747437", "0.77356386", "0.7732912", "0.7726761", "0.77237755", "0.77153116", "0.7705096", "0.77019817...
0.74712396
84
Timestamp of last time ``key`` was updated.
def updated(self, key=None): if key: sql = u""" SELECT `updated` FROM `{table}` WHERE `key` = ? """.format(table=self.name) row = self.conn.execute(sql, (key,)).fetchone() if row: return row['updated'] return 0.0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_time(cls, key):\n key.put()", "def last_update_time(self):\n return self._last_update_time", "def dt_last_update(self):\n return self.last_update", "def last_updated_time(self) -> str:\n return pulumi.get(self, \"last_updated_time\")", "def get_last_update_time(self):...
[ "0.7004401", "0.6892841", "0.6721111", "0.66992164", "0.6692415", "0.6680198", "0.66759443", "0.66504335", "0.66415197", "0.66308355", "0.66227114", "0.66227114", "0.66085696", "0.66085696", "0.6574032", "0.65585905", "0.655018", "0.6526502", "0.64573", "0.6454909", "0.641419...
0.7295389
0
List of Stores in this Cache.
def stores(self): sql = u"SELECT name FROM `sqlite_master` WHERE type='table'" rows = self.conn.execute(sql) return [r['name'] for r in rows if r['name'] not in self.invalid_names]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_stores(self) -> List[NodeStorage]:\n return list(self._node_store_dict.values())", "def stores(self) -> List[BaseStorage]:\n return ([self._global_store] + list(self.node_stores) +\n list(self.edge_stores))", "def edge_stores(self) -> List[EdgeStorage]:\n return lis...
[ "0.7870625", "0.7819015", "0.7122774", "0.6936518", "0.68491995", "0.6757015", "0.6692155", "0.6636793", "0.6417748", "0.6270717", "0.6270062", "0.6226514", "0.615503", "0.61143893", "0.6087127", "0.60661", "0.59892386", "0.59729064", "0.59464455", "0.5866509", "0.5847541", ...
0.53683203
66
Dummy function that returns 0s of shape (n,) where data has n rows.
def _generate_predictions(self, data): return np.zeros(data.shape[0])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros_like(data):\n return _make.zeros_like(data)", "def zeros(shape, dtype=None):\n\n return full(shape, 0, dtype)", "def zeros(shape, dtype=None):\n raise NotImplementedError", "def zeros(n):\n return [0 for i in range(n)]", "def zero(self):\n return np.zeros([self.nx])", "de...
[ "0.724777", "0.6795954", "0.67944485", "0.6771869", "0.6630291", "0.66279304", "0.6622723", "0.6613804", "0.65688646", "0.65616745", "0.6561072", "0.65301436", "0.65296453", "0.65155804", "0.6489271", "0.6457998", "0.64159244", "0.64117944", "0.6406519", "0.640532", "0.638716...
0.0
-1
Generate all plane rows into a single list.
def _generate_plane_seats(cls, N): return cls._PLANE_ROW * N
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rows(self):\n out = []\n for row in self.a:\n new = self.new(1, len(row), fake=False)\n new.a[0] = row\n out.append(new)\n return out", "def rows(self):\n return list(self)", "def rows (self):\n for row in self._m:\n yield Vecto...
[ "0.6674731", "0.662724", "0.6528567", "0.6514183", "0.6100312", "0.60766673", "0.6069657", "0.6024483", "0.59949243", "0.59180677", "0.5914709", "0.59022135", "0.5850632", "0.5849894", "0.5814373", "0.57981086", "0.5791644", "0.57458204", "0.5742889", "0.5742278", "0.5731041"...
0.5322014
82
Find the max number of grouping of seats adjacent of length k amoung currently reserved seats.
def _find_max_number_of_grouping(cls, reserved_seats, k): # print(reserved_seats) n = len(reserved_seats) count_groups = 0 count_empty_contigous_seats = 0 i = 0 while i < n: if reserved_seats[i] != 0: # print('continue', i) coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marbles(n: int, k: int) -> int:\n # return (n-1) Choose (k - 1)\n # which is the number of possibilities with the given constraints.\n return n_choose_k(n - 1, k - 1)", "def allocate_candies(A, k):\n lo = 0\n\n # the maximum number of candies we could theoretically allocate\n # to each chil...
[ "0.64716023", "0.63671696", "0.61672527", "0.6161201", "0.6089349", "0.60779804", "0.6021262", "0.6017591", "0.59378225", "0.58523566", "0.5846861", "0.5840305", "0.5837861", "0.5834726", "0.5829725", "0.58153623", "0.57952964", "0.57573825", "0.5734927", "0.57208914", "0.570...
0.83454376
0
Convert single column matrix to one hot format (column per class) Converts a to a scalar and casts to int
def convert_to_one_hot(a): a = a[:, 0] a = a.astype(int) A = np.zeros((len(a), config.num_classes)) A[np.arange(len(a)), a] = 1 return A
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_hot_converter(column):\n # encode class values as integers\n encoder = LabelEncoder()\n encoder.fit(column) \n encoded_ = encoder.transform(column)\n # convert integers to dummy variables, i.e., one-hot encoded\n encoded_column = to_categorical(encoded_)\n \n return encoded_colum...
[ "0.7439391", "0.7264561", "0.7264561", "0.72644657", "0.7249212", "0.71103054", "0.69894487", "0.69518447", "0.69435763", "0.68881726", "0.6861722", "0.685841", "0.68304145", "0.6823574", "0.68071705", "0.67847383", "0.677993", "0.67459023", "0.6691896", "0.6691896", "0.66918...
0.8204225
0
Initializes test server by setting the wsgi application object.
def __init__(self): # Every WSGI application must have an application object - a callable # object that accepts two arguments. For that purpose, we're going to # use a function (note that you're not limited to a function, you can # use a class for example). The first argument passed to ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self) -> None:\n self._app = WebTestApp(application)", "def setUp(self):\n self.app = Flask(__name__)\n self.app_context = self.app.app_context()\n self.app_context.push()\n self.client = self.app.test_client()", "def setUpClass(cls):\n\n cls.client = TestWor...
[ "0.75076634", "0.7141633", "0.7137741", "0.70992506", "0.7026971", "0.7025642", "0.70103973", "0.6955283", "0.69357014", "0.6894322", "0.68847513", "0.68806434", "0.68806434", "0.6872717", "0.6870075", "0.68152094", "0.6813032", "0.6806205", "0.67996913", "0.67996913", "0.679...
0.0
-1
Tests making a request for an artist which can't be found.
def test_invalid_artist(self): response = self.client.get(reverse('exordium:artist', args=('notfound',))) self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_invalid_artist(self):\n self.assertRaises(HTTPError, lambda: self.d.artist(0).name)", "def test_artist_uri_exception(self):\n with mock.patch(\"spotlogin_api.get_artists_call\", self.mock_key):\n result = spotify_login.get_artists(self.user[INPUT])\n self.assertEqual(resu...
[ "0.8289355", "0.78961116", "0.7164784", "0.70997727", "0.69509256", "0.6734168", "0.6677777", "0.6628288", "0.65978086", "0.64817035", "0.6431857", "0.64218724", "0.63592386", "0.63151854", "0.62991774", "0.62842137", "0.6239475", "0.6238", "0.6200653", "0.617709", "0.6113990...
0.83402044
0
Test an artist who only has a single album
def test_single_album(self): self.add_mp3(artist='Artist', title='Title 1', album='Album', filename='song1.mp3') self.run_add() self.assertEqual(Artist.objects.count(), 2) self.assertEqual(Album.objects.count(), 1) self.assertEqual(Song.objects.count(), 1) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_track_no_artist(self):\n self.add_mp3(set_artist=True)\n (added, status) = self.app.add_album(self.filenames)\n self.assertEqual(added, False)\n self.assertIn('has no artist tag', status)\n self.assertEqual(self.get_album_count(), 0)", "def test_single_track_bla...
[ "0.75700617", "0.7389959", "0.7205919", "0.718145", "0.7051173", "0.7012892", "0.6997235", "0.6989847", "0.69796306", "0.6911871", "0.6889492", "0.6883251", "0.6875983", "0.68101954", "0.6800622", "0.6795062", "0.6790123", "0.671422", "0.6688665", "0.66426736", "0.6626097", ...
0.7009143
6
Test an artist who only has a single album, with album art.
def test_single_album_with_art(self): self.add_mp3(artist='Artist', title='Title 1', album='Album', filename='song1.mp3') self.add_art() self.run_add() self.assertEqual(Artist.objects.count(), 2) self.assertEqual(Album.objects.count(), 1) self.assertE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_single_track_no_artist(self):\n self.add_mp3(set_artist=True)\n (added, status) = self.app.add_album(self.filenames)\n self.assertEqual(added, False)\n self.assertIn('has no artist tag', status)\n self.assertEqual(self.get_album_count(), 0)", "def test_single_track_bla...
[ "0.76161236", "0.7522303", "0.7275202", "0.71618164", "0.71049017", "0.7046553", "0.70298964", "0.7028938", "0.69453293", "0.6933128", "0.6924511", "0.6891565", "0.6891005", "0.67364144", "0.6723347", "0.67030567", "0.66961145", "0.66692764", "0.6627899", "0.6618416", "0.6600...
0.76389796
0
Test a various artist album the one containing the artist we care about should show up in the list
def test_various_artists(self): self.add_mp3(artist='Artist 1', title='Title 1', album='Album 1', filename='song1.mp3', path='album_1') self.add_mp3(artist='Artist 2', title='Title 2', album='Album 1', filename='song2.mp3', path='album_1') self.add_mp3(artist='Artist 2', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_tracks_various_artists(self):\n self.add_mp3(filename='1.mp3')\n self.add_mp3(filename='2.mp3', set_artist=True, artist='Artist 2')\n (added, status) = self.app.add_album(self.filenames)\n self.assertEqual(added, True)\n self.assertEqual(self.get_album_count(), 1)\n ...
[ "0.7655978", "0.715142", "0.70946705", "0.7062092", "0.70616275", "0.6978352", "0.69739276", "0.69592106", "0.69056106", "0.68899107", "0.68865335", "0.6885555", "0.68837756", "0.6818023", "0.6794015", "0.6730428", "0.66650057", "0.66575986", "0.6648529", "0.65982574", "0.658...
0.7087836
3
Tests ordering of various types of albums. Regular albums should be first, followed by nonalbum tracks, and then Variousartists albums. Song lists should be alphabetical.
def test_ordering(self): # "Album 1" and "Album 3" are regular albums # "Album 2" is V/A # The remaining track will create a non-album track. self.add_mp3(artist='Artist 1', title='Title 1', album='Album 1', filename='song1.mp3', path='album_1') self.add_mp3(artist='A...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sorting_album(self):\n self.add_mp3(artist='Artist', title='Title 1',\n album='Album 1', year=2016, filename='song1.mp3')\n self.add_mp3(artist='Artist', title='Title 2',\n album='Album 2', year=2006, filename='song2.mp3')\n self.add_mp3(artist='Artist', title='T...
[ "0.71295744", "0.6968328", "0.69321585", "0.6830884", "0.6577456", "0.65621585", "0.64718014", "0.64640087", "0.6348015", "0.63079995", "0.62830967", "0.6281971", "0.62787485", "0.6264826", "0.61650527", "0.60994846", "0.60598445", "0.6043407", "0.6012692", "0.5989004", "0.59...
0.7492133
0
Test the scenario where our only track is as a conductor on a track on an album tagged with classical stuff. Also the album is classified as Various Artists
def test_classical_as_conductor_various(self): self.add_mp3(artist='Artist 1', title='Title 1', group='Group 1', conductor='Conductor 1', composer='Composer 1', album='Album 1', filename='song1.mp3', path='album_1') self.add_mp3(artist='Artist 2', title='Title 2', gro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_two_tracks_various_artists(self):\n self.add_mp3(filename='1.mp3')\n self.add_mp3(filename='2.mp3', set_artist=True, artist='Artist 2')\n (added, status) = self.app.add_album(self.filenames)\n self.assertEqual(added, True)\n self.assertEqual(self.get_album_count(), 1)\n ...
[ "0.6635681", "0.66305244", "0.65595543", "0.65030277", "0.6500896", "0.6479529", "0.6424793", "0.64121807", "0.6400899", "0.6395935", "0.63504994", "0.6337995", "0.6285553", "0.6222395", "0.6204887", "0.61986375", "0.61756957", "0.61703783", "0.6164389", "0.614107", "0.611714...
0.62296474
13
Reset the stacked_obs, add the reset observation to the stack, and return the stack.
def reset(self, observation: TObs) -> TObs: if isinstance(observation, dict): return { key: self.sub_stacked_observations[key].reset(obs) for key, obs in observation.items() } # pytype: disable=bad-return-type self.stacked_obs[...] = 0 if self.channels_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self, **kwargs):\n\n # on a reset we set the health back to 120\n self.player_hp = 120\n self.enemy_hp = 120\n\n # reset the environment\n \n observation = self.env.reset(**kwargs)\n\n # we restarted inc the number\n self.num_resets += 1\n\n ...
[ "0.5809161", "0.5690585", "0.5658881", "0.5607007", "0.5578343", "0.54902554", "0.54488194", "0.5429835", "0.54158765", "0.5400295", "0.5381578", "0.5358056", "0.5319358", "0.530833", "0.5286927", "0.5280571", "0.52361524", "0.5184345", "0.51815325", "0.5125754", "0.5110665",...
0.717965
0
The ID of the CommMessage.
def id(self): return self.getattr('id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_id(self):\n return self._message_id", "def getMessageID(self):\n return self._payload[1]", "def msg_id(self):\n return struct.unpack('<H', self.pkt.payload[0:2])[0]", "def message_id(self) -> int:\n enforce(self.is_set(\"message_id\"), \"message_id is not set.\")\n ...
[ "0.7954247", "0.779879", "0.7764527", "0.7751553", "0.72496164", "0.71974725", "0.71777856", "0.6996363", "0.67316085", "0.66868234", "0.6531889", "0.6528", "0.65171736", "0.6507418", "0.649101", "0.64861864", "0.6450529", "0.6448808", "0.643974", "0.64354557", "0.64030194", ...
0.0
-1
The date and time this message was created
def created_at(self): return self.getattr('created_at')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creationTime(self):\n \n if not self.logMessage is None :\n return self.logMessage[\"date\"]", "def created_date_time(self) -> str:\n return pulumi.get(self, \"created_date_time\")", "def create_time(self):\n return self._create_time", "def create_time(self):\n ...
[ "0.8526529", "0.8332602", "0.82212484", "0.82212484", "0.82212484", "0.82132673", "0.82132673", "0.82132673", "0.82132673", "0.81334907", "0.81334907", "0.81046456", "0.81046456", "0.81046456", "0.79960114", "0.79117465", "0.79117465", "0.79117465", "0.79117465", "0.79117465", ...
0.0
-1
The plain text body of the message
def body(self): return self.getattr('body')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plain_text_body(self):\n return self._plain_text_body", "def body(self):\n return self.message.get_data()", "def _get_plain_message (self) :\n return self._message", "def body_plain_text(self) -> \"str\":\n return self._attrs.get(\"bodyPlainText\")", "def body_plain_text(sel...
[ "0.8535344", "0.81181455", "0.78041774", "0.779329", "0.779329", "0.75720036", "0.75268275", "0.75268275", "0.7416806", "0.7406816", "0.739537", "0.72652894", "0.7207638", "0.7195515", "0.7195515", "0.7187034", "0.71492606", "0.71413356", "0.7126433", "0.70494014", "0.701975"...
0.6814559
24
The HTML body of the message.
def html_body(self): return self.getattr('html_body')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_body_html(self):\n ...", "def html_body(self):\n return self._html_body", "def body(self):\n return self.message.get_data()", "def body(self) -> str:\n return self.data['body']", "def body(self) -> str:\n return pulumi.get(self, \"body\")", "def body(self):\...
[ "0.8128541", "0.8118778", "0.79072607", "0.75395495", "0.75072074", "0.73316777", "0.73316777", "0.7330618", "0.7236717", "0.7236717", "0.7227517", "0.71475005", "0.7103565", "0.7038866", "0.7014022", "0.6922265", "0.6871855", "0.6862644", "0.6815904", "0.6809288", "0.6744836...
0.77780366
3
Returns self.df (created at initiation).
def get_df(self): return self.df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_df(self):\n return self.__df", "def getDataFrame(self):\n return self.df", "def df(self) -> pd.DataFrame:\n return self._df", "def df(self):\n return self._df", "def data_frame_creator(self):\n\n return pd.DataFrame()", "def dataframe(self):\n return self._df...
[ "0.8282649", "0.80769545", "0.8075917", "0.8060525", "0.8054267", "0.7694954", "0.7551118", "0.7482421", "0.74779594", "0.7445759", "0.7408816", "0.73816043", "0.73629457", "0.73576957", "0.7336557", "0.72816694", "0.7230548", "0.7224957", "0.7212845", "0.71635", "0.7103294",...
0.8319571
0
return the lowest item in the stack meets `filter`, or 1 if not found `filter` a callable which takes a stack item, and returns a truthy object if this item should be returned, a falsy object otherwise. `min` the index from which to search e.g. stack = A, B, B, C
def find_first(self, filter, min=0): assert callable(filter) for index, item in enumerate(self.stack[min:], min): if filter(item): return index return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_min(self):\n if self.is_empty(): # is_empty inherited from base class\n raise Empty('Priority queue is empty')\n small = self._data.first()\n walk = self._data.after(small)\n while walk is not None:\n if walk.element() < small.element():\n small = walk\n walk = self._dat...
[ "0.6142216", "0.56190383", "0.55131596", "0.5488062", "0.54842114", "0.5471388", "0.5461936", "0.5459729", "0.5446693", "0.54073167", "0.5391223", "0.5326437", "0.53128606", "0.5310951", "0.5305859", "0.52614045", "0.5249548", "0.5247434", "0.5247003", "0.5211769", "0.5204683...
0.7934399
0
return the highest item in the stack meets `filter`, or 1 if not found `filter` a callable which takes a stack item, and returns a truthy object if this item should be returned, a falsy object otherwise. `max` the index from which to search down e.g. stack = A, B, B, C
def find_last(self, filter): assert callable(filter) indexes = range(len(self.stack) - 1, -1, -1) items = self.stack[::-1] for index, item in zip(indexes, items): if filter(item): return index return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_max(self):\n # 0(1)\n return self.max_stack.peek()\n\n # Don't need find_max we returned max_stack.peek()", "def max_stack(self):\n if self.maxx == []:\n return None\n return self.maxx[-1]", "def return_the_maximum(self):\n\n return self.__max_stack[...
[ "0.62879103", "0.6014741", "0.59709257", "0.59642637", "0.5901191", "0.57429", "0.5668541", "0.5524984", "0.5509808", "0.54843765", "0.5449235", "0.5440364", "0.5436347", "0.5427523", "0.54042625", "0.5404123", "0.5386889", "0.53579473", "0.53519696", "0.53412384", "0.5325720...
0.64839846
0
Create an EventHubClient from an EventHub/IotHub connection string.
def from_connection_string(cls, conn_str, event_hub_path=None, **kwargs): is_iot_conn_str = conn_str.lstrip().lower().startswith("hostname") if not is_iot_conn_str: address, policy, key, entity = _parse_conn_str(conn_str) entity = event_hub_path or entity left_slash_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_eventhub_client(\n experiment_secrets: Secrets) -> EventHubManagementClient:\n return __azure_client_factory(\"EventHubManagementClient\", Secrets)", "def from_connection_string(cls, conn_str, eventhub=None, **kwargs):\n address, policy, key, entity = _parse_conn_str(conn_str)\n ...
[ "0.7329998", "0.7277756", "0.62822163", "0.6194322", "0.54016954", "0.5399035", "0.5336833", "0.5274769", "0.5251336", "0.52474797", "0.52443206", "0.5200818", "0.5120846", "0.50913286", "0.50844514", "0.5057612", "0.5048919", "0.5010584", "0.48551476", "0.48490575", "0.48306...
0.7626832
0
Create the flask app using application factor pattern
def create_app(settings_override=None): app = Flask(__name__, instance_relative_config=True) app.config.from_object('config.settings') app.config.from_pyfile('settings.py', silent=True) # set only during the testing if settings_override: app.config.update(settings_override) app.regist...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app():\n return create_app()", "def create_app(self):\r\n self.app = Flask(__name__, instance_relative_config=True)\r\n\r\n # Init the secret key of the app -it is a must for flask to run\r\n self.app.config.from_mapping(\r\n SECRET_KEY='!ZNeverSayNever116Z!',\r\n ...
[ "0.83621025", "0.8281909", "0.82343495", "0.81745845", "0.8141023", "0.8136941", "0.8116984", "0.8090296", "0.8054084", "0.8053973", "0.8052199", "0.80383134", "0.80302906", "0.80232716", "0.80113524", "0.7995199", "0.79917485", "0.798482", "0.79829127", "0.7976426", "0.79741...
0.0
-1
Return a str in the form of 'first name last name' by converting name, which is in the form of "last name, first name'.
def name_formatting(name: str) -> str: first_name = name.rstrip()[name.find(',') + 2 : ] last_name = name[ : name.find(',')] return first_name + ' ' + last_name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_formated_name(first_name,last_name):\n\tfull_name = first_name + '' + last_name\n\treturn full_name.title()", "def name_format(name):\n lst_name, fst_name = name.split(',')\n return ' '.join((fst_name, lst_name))", "def get_formatted_name(first_name, last_name):\n # Describe the function\n ...
[ "0.7781079", "0.7707419", "0.7613042", "0.75943756", "0.7584264", "0.7580416", "0.7580416", "0.7580416", "0.75311255", "0.75310445", "0.75310445", "0.75310445", "0.75243765", "0.7518555", "0.75156796", "0.7504956", "0.7504956", "0.75047666", "0.74948055", "0.7481154", "0.7474...
0.7936629
0
Return the average number of clubs that a person in person_to_clubs belongs to. >>> get_average_club_count(P2C) 1.6
def get_average_club_count(person_to_clubs: Dict[str, List[str]]) -> float: total = 0.0 if len(person_to_clubs) == 0: return total for person in person_to_clubs: total += len(person_to_clubs[person]) return total/len(person_to_clubs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def second_way(person_to_clubs: Dict[str, List[str]], \n club_to_person: Dict[str, List[str]], \n person: str, club: str) -> int:\n score = 0\n if person not in person_to_clubs:\n return score\n for member in club_to_person[club]:\n for diff_clubs in person_to_clu...
[ "0.59021014", "0.5855871", "0.5557595", "0.5064909", "0.50489277", "0.4878717", "0.48523962", "0.4836025", "0.4785415", "0.4754662", "0.4738737", "0.46982753", "0.46743897", "0.46725833", "0.46629763", "0.46397933", "0.4601844", "0.45852426", "0.45767555", "0.45591998", "0.45...
0.8341236
0
Return a "last name to first name(s)" dictionary with the people from the "person to friends" dictionary person_to_friends. >>> get_last_to_first(P2F) == {
def get_last_to_first( person_to_friends: Dict[str, List[str]]) -> Dict[str, List[str]]: last_to_first = {} for person in person_to_friends: update_dict(person[person.rfind(' ') + 1: ],\ person[ :person.rfind(' ')], last_to_first) for i in person_to_friends[perso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_first_and_last_name(self) -> Name:\n name_db = self.read_file(self.db_name)\n first_name = str(name_db.at[random.randint(0, len(name_db)), 'first name'])\n last_name = str(name_db.at[random.randint(0, len(name_db)), 'last name'])\n return Name(first_name=first_name, last_name=la...
[ "0.56945175", "0.56369627", "0.5617074", "0.55800617", "0.5387466", "0.53339505", "0.5252519", "0.5136645", "0.5125951", "0.5059854", "0.50575876", "0.5027986", "0.50187576", "0.49934596", "0.49892858", "0.49780688", "0.49505353", "0.49220136", "0.48772606", "0.48613995", "0....
0.81507343
0
Return an int representing the score gained by the counting the number of friends of person in club by going through person_to_friends and person_to_clubs. >>>first_way(P2F, P2C, "Jesse Katsopolis", 'Comics R Us') 1
def first_way(person_to_friends: Dict[str, List[str]], person_to_clubs: Dict[str, List[str]], club_to_person: Dict[str, List[str]], person: str, club: str) -> int: score = 0 if club in get_clubs_of_friends(person_to_friends, person_to_clubs,\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def second_way(person_to_clubs: Dict[str, List[str]], \n club_to_person: Dict[str, List[str]], \n person: str, club: str) -> int:\n score = 0\n if person not in person_to_clubs:\n return score\n for member in club_to_person[club]:\n for diff_clubs in person_to_clu...
[ "0.6061983", "0.50637835", "0.50444907", "0.5014922", "0.4921296", "0.48978993", "0.48733214", "0.4833616", "0.48237255", "0.4822719", "0.4822719", "0.4822719", "0.48086107", "0.47820303", "0.47801578", "0.47654083", "0.4757054", "0.47512028", "0.4708436", "0.46860507", "0.46...
0.73016477
0
Returns a matrix mapping lemmas to allowable predicates. masks[i] is a vector of size `num_predicates` that contains 1's in all entries of predicates that are possible for lemma i and 0's everywhere else.
def get_label_masks(self, vocabs, language): fn = 'data/{}/conll09/train.txt'.format(language) lemma_to_preds = get_lemma_to_preds(fn) masks = np.zeros((vocabs['plemmas'].size, vocabs['predicates'].size), dtype=np.float32) for i, lemma in vocabs['plemmas'].idx_to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_masks(num_masks, features, hidden_layers, hidden_units):\n\n # This array should contain numbers 1-784\n features_indices = []\n for i in range(features):\n features_indices.append(i + 1)\n masks = []\n indices = []\n for i in range(num_masks):\n set_masks = [] # Will conta...
[ "0.53410727", "0.5269827", "0.50874555", "0.5024905", "0.50134635", "0.49943882", "0.49832165", "0.49663585", "0.49566302", "0.49434072", "0.49381092", "0.49279618", "0.49103513", "0.4902202", "0.4896826", "0.48591676", "0.4853722", "0.48443136", "0.4842146", "0.48398596", "0...
0.61014277
0
Prompts the user to select a media file to be added to the media list.
def add_media_dialog(self): file = filedialog.askopenfilename() if add_media(file, 0, self): # Checking if the process of adding the media file was successful if file: # Checking whether the user has aborted the operation # Getting the path of the file with respec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_media(file):\r\n\r\n global option # Using the global variable that specifies user choice (typically \"Yes\" or \"No\" choices)\r\n cursor = connection.cursor()\r\n\r\n if file.isnumeric(): # The user has attempted to configure the media file based on its ID in the database\r\n...
[ "0.66447204", "0.65950495", "0.6556043", "0.6258184", "0.6225893", "0.60798633", "0.6074835", "0.6049748", "0.5998155", "0.5994092", "0.59373146", "0.5912433", "0.5891119", "0.5844204", "0.5840981", "0.5829314", "0.5814567", "0.5809198", "0.5794502", "0.5763027", "0.5753634",...
0.78907186
0
Constructs the necessary ModelV2 and action dist class for the Policy.
def make_model_and_action_dist( policy: Policy, obs_space: gym.spaces.Space, action_space: gym.spaces.Space, config: TrainerConfigDict) -> \ Tuple[ModelV2, Type[TorchDistributionWrapper]]: # Get the output distribution class for predicting rewards and next-obs. policy.dis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self,actionID,actiontype,policy,**kwargs):\n\t\tself._actionID \t = actionID\n\t\tself._actiontype = actiontype\n\t\tself._policy \t = policy\n\t\tself._params = kwargs", "def __init__(self,\n enable_worm_on_external_target=None,\n policy_type=None,\n ...
[ "0.5914376", "0.57363635", "0.56751895", "0.54479384", "0.53781986", "0.5337959", "0.53207904", "0.5319859", "0.53062344", "0.52976424", "0.52391315", "0.5233783", "0.52003235", "0.51689756", "0.5168689", "0.51531595", "0.51444304", "0.5144247", "0.5117268", "0.5096965", "0.5...
0.7094436
0
Transform correlation value by Fisher's z.
def fishertransform(log, inputcor, outpref): log.info('Do fishertransform') cmdargs = split("3dcalc -a {} -expr 'atanh(a)' \ -prefix {}".format(inputcor, outpref)) proc = Popen(cmdargs, stdout=PIPE, stderr=STDOUT) log.info(proc.stdout.read())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fisher_z_transform(r):\r\n if abs(r) == 1: # fisher z transform is undefined, have to return nan\r\n return nan\r\n return .5 * log((1. + r) / (1. - r))", "def inverse_fisher_z_transform(z):\r\n return ((e ** (2 * z)) - 1.) / ((e ** (2 * z)) + 1.)", "def z2x(self, z):\n ## Correlate...
[ "0.67454576", "0.66123563", "0.5836495", "0.580593", "0.5714723", "0.5713055", "0.5713055", "0.56251514", "0.56200576", "0.5587243", "0.5584298", "0.5581252", "0.5548599", "0.5548202", "0.5546941", "0.54759127", "0.5417353", "0.5361532", "0.5348446", "0.5338345", "0.5329537",...
0.57704175
4
takes localtimezone date string, returns epoch
def localstr2epoch(datestr=epoch2UTCstr(), fmat="%Y-%m-%d %H:%M:%S"): return mktime(strptime(datestr, fmat))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rfc2822_to_epoch(datestr):\n return mktime_tz(parsedate_tz(datestr))", "def UTCstr2epoch(datestr=epoch2UTCstr(), fmat=\"%Y-%m-%d %H:%M:%S\"):\n return timegm(strptime(datestr, fmat))", "def parse_time(s):\n\n dt = dateutil.parser.parse(s)\n# epoch_time = int((dt - datetime(1970, 1, 1, tzinfo=ti...
[ "0.7699569", "0.7339443", "0.7065982", "0.7037844", "0.7027195", "0.70020145", "0.69655454", "0.67805904", "0.6707467", "0.6546133", "0.6520107", "0.6515614", "0.65014416", "0.65014416", "0.6478241", "0.63273525", "0.631328", "0.62337345", "0.6141621", "0.61276764", "0.611863...
0.78960454
0
Normalise a vector to range [1, 1] using the maximum absolute value along axis 0.
def normalise_max_abs(vector): # Check vector shape assert len(vector.shape) == 2 assert vector.shape[0] < vector.shape[1] # Normalise for i in range(vector.shape[0]): maxabs = np.nanmax(np.abs(vector[i])) vector[i] = safe_divide(vector[i], maxabs) return vector
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def norm_max(vector):\n return la.norm(vector, np.inf)", "def _normalize_(x: np.array) -> np.array:\n if x.max() != 0:\n x = x / x.max()\n return np.clip(x, 0, 1)# ensure that no values are >1\n else:\n raise ZeroDivisionError('Image Normalization')", "def norm1(x,maxx):\n retu...
[ "0.77388227", "0.7486799", "0.72978413", "0.72904044", "0.7211163", "0.7193283", "0.71649766", "0.71306", "0.71057475", "0.7100421", "0.70991915", "0.7098806", "0.70958275", "0.70752066", "0.7071975", "0.7066731", "0.7062737", "0.70475614", "0.7018413", "0.698623", "0.6984334...
0.7938407
0
Find index of location in x or y that is closest to the requested location (loc_coord).
def find_index_for_location(flowcase_object, coord_key, loc_coord): # For convenience nx = flowcase_object.nx ny = flowcase_object.ny num_of_points = flowcase_object.num_of_points flow_dict = flowcase_object.flow_dict loc_idx = list() idx_list = list() # Find indexes of all y closest t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_closest_waypoint_index(self, x, y):\n return self.__waypoint_tree.query([x, y], 1)[1]", "def get_closest_waypoint(self, x, y):\n # TODO implement\n closest_idx = self.waypoint_tree.query([x, y], 1)[1]\n return closest_idx", "def closest(self, x, y):\n pts = np.colum...
[ "0.73158514", "0.72582483", "0.71407396", "0.7131564", "0.7020305", "0.6975356", "0.69487727", "0.69416326", "0.6934072", "0.691672", "0.68169785", "0.6806778", "0.6760551", "0.67564094", "0.6723742", "0.66734666", "0.662415", "0.6621647", "0.6621647", "0.6621647", "0.660633"...
0.76671696
0
Convert vector components for cylinder coordinates in the velocity gradient wrt to cartesian coordinates into vector components for cartesian coordinates. grad_xyz u_rtz to grad_xyz u_xyz
def gradient_vector_components_cylinder_to_cartesian(dictionary): # For convenience urm = dictionary['urm'] utm = dictionary['utm'] x = dictionary['x'] y = dictionary['y'] r = dictionary['r'] t = dictionary['t'] # Theta a = safe_divide(y, r**2) b = safe_divide(x, r**2) vel_g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient_wrt_cylinder_to_wrt_cartesian(dictionary, grad_keys):\n\n # Check input dictionary keys\n len_keys = len(grad_keys)\n assert len_keys > 3, 'Invalid amount of gradient components. Maximum is 3 but %r were given' % (len_keys)\n\n # For convenience\n nt = dictionary['nt']\n nr = diction...
[ "0.63713974", "0.63271266", "0.61157924", "0.61022854", "0.6088212", "0.6064755", "0.5993713", "0.5992187", "0.5877531", "0.5857507", "0.5817972", "0.573166", "0.569022", "0.56564105", "0.56394947", "0.56210726", "0.5603717", "0.55802345", "0.5564718", "0.5540414", "0.5539161...
0.74757904
0
Rename tau budgets from cylinder to cartesian.
def budget_tau_components_cylinder_to_cartesian(dictionary, cyl_bud_key, verbose=False): # Find cartesian key key_idx = CYL_ALL_BUDGET_KEYS.index(cyl_bud_key) # Find index in Key list car_bud_key = ALL_BUDGET_KEYS[key_idx] # Save same value under new name dictionary[car_bud_key] = dictionary[cyl_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tau_components_cylinder_to_cartesian(dictionary, cyl_tau_key, verbose=False):\n\n # For convenience\n t = dictionary['t']\n urur = dictionary['urur']\n utut = dictionary['utut']\n usus = dictionary['usus']\n\n # Check for off-diagonal component\n if 'urut' in dictionary:\n urut = di...
[ "0.61565554", "0.49329796", "0.4902167", "0.49012345", "0.4878791", "0.48541948", "0.47718614", "0.47495937", "0.47271588", "0.46504843", "0.46467322", "0.46375972", "0.46182516", "0.46025124", "0.46002585", "0.45873058", "0.4585695", "0.458054", "0.45595634", "0.45583585", "...
0.6103566
1
Compare whether two Molecule objects are equal
def assert_molecule_is_equal(molecule1, molecule2, msg): if not (molecule1.is_isomorphic_with(molecule2)): raise AssertionError(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basic_compare(self, other: \"Molecule\") -> bool:\n return self.inchi_key[:14] == other.inchi_key[:14]", "def is_same(source_molecule, target_molecule):\n return source_molecule.mol_text == target_molecule.mol_text", "def __eq__(self, other):\n if not isinstance(other, SolidCompressibl...
[ "0.7470479", "0.7265899", "0.69146365", "0.686479", "0.68575764", "0.682859", "0.6819768", "0.6796034", "0.6785687", "0.676896", "0.6751374", "0.6736754", "0.6730768", "0.67274874", "0.66949457", "0.66764474", "0.666641", "0.66654813", "0.66618466", "0.66605425", "0.6608242",...
0.7412893
2
Test serialization of a molecule object to and from dict.
def test_dict_serialization(self, molecule): serialized = molecule.to_dict() molecule_copy = Molecule.from_dict(serialized) assert molecule == molecule_copy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_to_from_dict(self, molecule):\n serialized = molecule.to_dict()\n molecule_copy = Molecule.from_dict(serialized)\n assert molecule == molecule_copy", "def test_to_from_dict(self, molecule):\n serialized = molecule.to_dict()\n molecule_copy = Molecule.from_dict(serializ...
[ "0.85008633", "0.85008633", "0.8142006", "0.7996338", "0.7749737", "0.7497601", "0.74185896", "0.74019265", "0.7361152", "0.73160136", "0.73040926", "0.73040926", "0.7196671", "0.719377", "0.7031945", "0.69736385", "0.69704914", "0.6865188", "0.68332607", "0.6785661", "0.6627...
0.87051755
0
Test serialization of a molecule object to and from YAML.
def test_yaml_serialization(self, molecule): serialized = molecule.to_yaml() molecule_copy = Molecule.from_yaml(serialized) assert molecule == molecule_copy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_yaml_serialization(self, molecule):\n serialized = molecule.to_yaml()\n molecule_copy = Molecule.from_yaml(serialized)\n assert molecule == molecule_copy\n assert molecule_copy.n_conformers == molecule.n_conformers\n assert np.allclose(molecule_copy.conformers[0], molecu...
[ "0.8515017", "0.77236193", "0.7574721", "0.75287557", "0.7435397", "0.7396959", "0.7297323", "0.722976", "0.722976", "0.71643776", "0.7081696", "0.7081696", "0.707029", "0.70060104", "0.70060104", "0.69392985", "0.689619", "0.6875995", "0.6779533", "0.6779533", "0.66934884", ...
0.89889455
0
Test serialization of a molecule object to and from BSON.
def test_bson_serialization(self, molecule): serialized = molecule.to_bson() molecule_copy = Molecule.from_bson(serialized) assert molecule == molecule_copy
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bson_serialization(self, molecule):\n serialized = molecule.to_bson()\n molecule_copy = Molecule.from_bson(serialized)\n assert molecule == molecule_copy\n assert molecule_copy.n_conformers == molecule.n_conformers\n assert np.allclose(molecule_copy.conformers[0], molecu...
[ "0.86160636", "0.7292799", "0.7100039", "0.7090254", "0.70880026", "0.70735914", "0.69891787", "0.69204277", "0.6912661", "0.6784014", "0.6735952", "0.6735952", "0.66865194", "0.6644719", "0.65595484", "0.6524692", "0.6524692", "0.6369782", "0.6369782", "0.6187226", "0.617080...
0.88954747
0
Test roundtrip serialization when molecules have no conformers or partial charges.
def test_serialization_no_conformers(self): mol = Molecule.from_smiles("CCO") dict_copy = Molecule.from_dict(mol.to_dict()) assert mol == dict_copy # TODO: yaml_copy = Molecule.from_yaml(mol.to_yaml()) with pytest.raises(NotImplementedError): mol.to_toml() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_json_serialization(self, molecule):\n # TODO: Test round-trip, on mini_drug_bank, when to_json bug is fixed, see #547\n mol = Molecule.from_smiles(\"CCO\")\n molecule_copy = Molecule.from_json(mol.to_json())\n assert molecule_copy == mol\n mol.generate_conformers(n_confo...
[ "0.7471003", "0.7091898", "0.69766533", "0.69766533", "0.69447184", "0.6800012", "0.67494816", "0.67335695", "0.65734977", "0.64664805", "0.6440942", "0.6421565", "0.62895083", "0.62895083", "0.6276578", "0.6258755", "0.62385195", "0.61894876", "0.6053755", "0.60352004", "0.5...
0.7319874
2
Test that conversion/creation of a molecule to and from an RDKit rdmol is consistent.
def test_to_from_rdkit(self, molecule): # import pickle from openforcefield.utils.toolkits import UndefinedStereochemistryError undefined_stereo = molecule.name in rdkit_drugbank_undefined_stereo_mols toolkit_wrapper = RDKitToolkitWrapper() rdmol = molecule.to_rdkit() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_to_from_rdkit(self, molecule):\n # import pickle\n from openff.toolkit.utils.toolkits import UndefinedStereochemistryError\n\n undefined_stereo = molecule.name in rdkit_drugbank_undefined_stereo_mols\n\n toolkit_wrapper = RDKitToolkitWrapper()\n\n rdmol = molecule.to_rdk...
[ "0.8299693", "0.71516085", "0.71303385", "0.6777719", "0.6773685", "0.6773685", "0.67283344", "0.6680571", "0.66634053", "0.64515257", "0.6421804", "0.6421804", "0.63478667", "0.6322146", "0.63209844", "0.6313115", "0.6304312", "0.6255419", "0.6243276", "0.6219669", "0.621966...
0.83444124
0
Test that conversion/creation of a molecule to and from a file is consistent.
def test_to_from_file(self, molecule, format): from openforcefield.utils.toolkits import UndefinedStereochemistryError # TODO: Test all file capabilities; the current test is minimal # TODO: This is only for OE. Expand to both OE and RDKit toolkits. # Molecules that are known to raise U...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_from_file(self):\n # TODO: Expand test to both openeye and rdkit toolkits\n filename = get_data_file_path(\"molecules/toluene.mol2\")\n\n molecule1 = Molecule(filename, allow_undefined_stereo=True)\n with open(filename, \"r\") as infile:\n molecule2 = Molecule...
[ "0.8055428", "0.80328906", "0.78450775", "0.68683165", "0.6858283", "0.675389", "0.6736899", "0.6733856", "0.6733856", "0.6707204", "0.6700808", "0.6639973", "0.66322273", "0.6617451", "0.6610922", "0.65877366", "0.65770185", "0.64782137", "0.64782137", "0.64705974", "0.64597...
0.8052136
1