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 |
|---|---|---|---|---|---|---|
Repeatedly apply a function f onto an original input Yields x, then f(x), then f(f(x)), then f(f(f(x))), etc.. | def iterate(f, x):
while True:
yield x
x = f(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate(func, x):\n while True:\n x = func(x)\n yield x",
"def make_func_repeater(f, x):\n\n def repeat(i, x=x):\n if i == 0:\n return x\n else:\n return repeat(i-1, f(x))\n return repeat",
"def repeatedly(func, /, *args, **kwargs):\n func = to_... | [
"0.74091274",
"0.7000441",
"0.6745888",
"0.66321695",
"0.649637",
"0.6408161",
"0.6293555",
"0.62705964",
"0.6188598",
"0.61679155",
"0.61679155",
"0.61482906",
"0.61267513",
"0.61078167",
"0.6068974",
"0.60461646",
"0.603153",
"0.5980083",
"0.59559304",
"0.5911748",
"0.58859... | 0.7568979 | 0 |
Returns a matplotlib figure containing the plotted confusion matrix. | def plot_confusion_matrix(cm, class_names):
figure = plt.figure(figsize=(8, 8))
plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)
plt.title("Confusion matrix")
plt.colorbar()
tick_marks = np.arange(len(class_names))
plt.xticks(tick_marks, class_names, rotation=45)
plt.yticks(tick_ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_... | [
"0.78412247",
"0.7717752",
"0.7664576",
"0.76329076",
"0.75771934",
"0.75757915",
"0.7523076",
"0.75182974",
"0.75016636",
"0.74832636",
"0.746719",
"0.7453887",
"0.7453294",
"0.74216324",
"0.74176985",
"0.7395515",
"0.7386801",
"0.73838943",
"0.7383021",
"0.73677856",
"0.736... | 0.77491516 | 1 |
Get the start and end time from the log data. This function will return a tuple of start and end time. | def parse_game_session_start_and_end_times(log_data, frags):
try:
log_start_time = parse_log_start_time(log_data)
# Get the match starting time
start_match = search(
r"<(\d{2}):(\d{2})> [^d]* Loading level \w+\/\w+, \w+ \w+",
log_data)
start_time = log_start_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_times(self):\n data = self.simulate_file.readlines()\n data = list(map(str.strip, data))\n data = list(map(float, data))\n start = data[0]\n times = data[1:]\n return (start, times)",
"def time(self):\n return self.raw[\"logTime\"]",
"def parse_log_start_t... | [
"0.6859266",
"0.6808932",
"0.6611192",
"0.6528971",
"0.6301918",
"0.62701046",
"0.6230074",
"0.6228107",
"0.61802197",
"0.6165671",
"0.61075574",
"0.60965973",
"0.60938215",
"0.60265505",
"0.6009882",
"0.594939",
"0.5925774",
"0.59253323",
"0.5921582",
"0.590829",
"0.5852322"... | 0.5976989 | 15 |
Provides all descendants of the given type. Includes klass. | def get_subclasses(self, klass: TypeInfo) -> OrderedSet[TypeInfo]:
if klass not in self._graph:
return OrderedSet([klass])
result: OrderedSet[TypeInfo] = OrderedSet(nx.descendants(self._graph, klass))
result.add(klass)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def descendants(self, type: str):\n return list(descendants(self.type_tree, type))",
"def descendants(cls):\n return cls.__subclasses__() + \\\n [g for s in cls.__subclasses__() for g in s.descendants()]",
"def descendant_classes(self):\n response = check_defined(self, inspect.s... | [
"0.81014854",
"0.7003053",
"0.68531823",
"0.6478727",
"0.6168609",
"0.60948336",
"0.6030036",
"0.59735334",
"0.5944309",
"0.5937556",
"0.5936306",
"0.5920937",
"0.59043145",
"0.58937293",
"0.58680224",
"0.5865847",
"0.582701",
"0.5784753",
"0.5776869",
"0.5693442",
"0.5679254... | 0.65370834 | 3 |
Only an admin can post products | def test_post_product(self):
with self.client:
# Register an admin user
self.client.post(
'/api/v1/auth/register',
data=json.dumps(dict(
name='leticia',
email='kokuleba@gmail.com',
role='admin',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permission(self):\n return \"core.manage_products\"",
"def test_only_admin_can_create_product(self):\n resp = self.admin_create_user()\n reply = self.attendant_login()\n token = reply['token']\n product = dict(\n prod_name='NY_denims',\n category='deni... | [
"0.720782",
"0.7153936",
"0.64834005",
"0.641502",
"0.6325029",
"0.6291831",
"0.6291831",
"0.62828994",
"0.6260777",
"0.6209634",
"0.6175433",
"0.6127744",
"0.60628",
"0.60407424",
"0.6016531",
"0.59795654",
"0.59795654",
"0.5943077",
"0.592803",
"0.5923449",
"0.59109104",
... | 0.0 | -1 |
insert null byte before string >>> tamper("1 AND '1'='1") '%001 AND '1'='1' | def tamper(payload, **kwargs):
return (payload+'%00') if payload else payload | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode_null_term(self, input):\n return input.encode() + b'\\x00'",
"def test_hexlify_empty_script():\n assert uflash.hexlify('') == ''",
"def no_null(x):\n return \"\\0\" not in x",
"def _wadifyString(s):\n\n if len(s) < 8:\n s += \"\\x00\" * (8 - len(s))\n return s",
"def un... | [
"0.6149872",
"0.5950001",
"0.55294305",
"0.5508528",
"0.55057997",
"0.55035996",
"0.5471932",
"0.5471912",
"0.5415258",
"0.54004097",
"0.5344739",
"0.53436196",
"0.5323801",
"0.5323801",
"0.5323801",
"0.5316458",
"0.53125095",
"0.5280506",
"0.52689606",
"0.52674514",
"0.52604... | 0.52330613 | 23 |
Return a function to pad elements of a list. | def padder(str_list, extra=0):
length = max(len(str(s)) for s in str_list) + extra
def pad(string):
string = str(string)
padding = max(0, length - len(string))
return string + (padding * " ")
return pad | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pad_list(xs, pad_value=0.0, pad_left=False):\n bs = len(xs)\n max_time = max(x.size(0) for x in xs)\n xs_pad = xs[0].new_zeros(bs, max_time, *xs[0].size()[1:]).fill_(pad_value)\n for b in range(bs):\n if len(xs[b]) == 0:\n continue\n if pad_left:\n xs_pad[b, -xs[... | [
"0.7674492",
"0.76731604",
"0.7416787",
"0.7285273",
"0.7239374",
"0.72163254",
"0.71986103",
"0.69835824",
"0.6923576",
"0.66847235",
"0.6625077",
"0.6605411",
"0.6583567",
"0.6560094",
"0.6545725",
"0.6521352",
"0.6475346",
"0.64614195",
"0.644858",
"0.6372992",
"0.6372992"... | 0.706407 | 7 |
recordSymbolKind(int symbolId, SymbolKind symbolKind) > bool | def recordSymbolKind(symbolId, symbolKind):
return _sourcetraildb.recordSymbolKind(symbolId, symbolKind) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recordSymbolDefinitionKind(symbolId, symbolDefinitionKind):\n return _sourcetraildb.recordSymbolDefinitionKind(symbolId, symbolDefinitionKind)",
"def _kind(d):\n return _SYMBOL_KIND_MAP.get(d.type)",
"def has_symbol(self, sym):\n return self.symbols.has_key(sym)",
"def is_symbol(obj):\n r... | [
"0.75940293",
"0.6315197",
"0.6185989",
"0.6089939",
"0.56914717",
"0.5552093",
"0.5515827",
"0.5426238",
"0.5420301",
"0.54181653",
"0.5417435",
"0.53692114",
"0.53555936",
"0.53093374",
"0.5295296",
"0.5277134",
"0.5254358",
"0.5250694",
"0.5215313",
"0.5192999",
"0.5126858... | 0.80896986 | 0 |
Shift 3D tensor forwards in time with padding. | def pad_shift(x, shift, padv=0.0):
if shift > 0:
padding = torch.ones(x.size(0), shift, x.size(2)).to(x.device) * padv
return torch.cat((padding, x[:, :-shift, :]), dim=1)
elif shift < 0:
padding = torch.ones(x.size(0), -shift, x.size(2)).to(x.device) * padv
return torch.cat((x[:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shift_rigth_3d(x, pad_value=None):\n if pad_value is None:\n shifted_targets = tf.pad(x, [[0, 0], [1, 0], [0, 0]])[:, :-1, :]\n else:\n shifted_targets = tf.concat([pad_value, x], axis=1)[:, :-1, :]\n return shifted_targets",
"def _rel_shift(x, klen=-1):\n\n x = tf.transpose(x, perm=[... | [
"0.6957321",
"0.6896348",
"0.68950534",
"0.682579",
"0.66471726",
"0.6604212",
"0.6572679",
"0.6540047",
"0.6455436",
"0.6373999",
"0.6373999",
"0.6373999",
"0.6373999",
"0.63667166",
"0.6301078",
"0.6298633",
"0.62869304",
"0.6244009",
"0.621644",
"0.61963135",
"0.61335826",... | 0.6754037 | 4 |
Update a post if the current user is the author. | def update(id):
post = get_post(id)
if request.method == 'POST':
title = request.form['title']
body = request.form['body']
error = None
if not title:
error = 'Title is required.'
if error is not None:
flash(error)
else:
db = get_db()
db.execute(
'UPDATE post SET title = ?, body = ? WHER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, request, pk=None):\n user = RareUser.objects.get(user=request.auth.user)\n\n # Do mostly the same thing as POST, but instead of\n # creating a new instance of Post, get the Post record\n # from the database whose primary key is `pk`\n post = Post.objects.get(pk=p... | [
"0.64033383",
"0.63095564",
"0.6191704",
"0.61885726",
"0.615415",
"0.61531925",
"0.6136559",
"0.6109247",
"0.6064209",
"0.59939826",
"0.5925683",
"0.59127086",
"0.5905584",
"0.5817421",
"0.5781429",
"0.5777928",
"0.5773793",
"0.5763027",
"0.5746472",
"0.57412624",
"0.5732245... | 0.57814234 | 15 |
Delete a post. Ensures that the post exists and that the logged in user is the author of the post. | def delete(id):
get_post(id)
db = get_db()
get_post(id)
db = get_db()
db.execute('DELETE FROM post WHERE id = ?', (id,))
db.commit()
return redirect(url_for('blog.index')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_post(request, post_id):\n post = Post.objects.get(id=post_id)\n\n check_post_owner(request, post)\n post.delete()\n\n return redirect('/posts')",
"def delete_post(post_id):\n\n if CURRENT_USER_KEY not in session:\n raise Unauthorized()\n\n post = Post.query.get_or_404(post_id)... | [
"0.82036835",
"0.8148285",
"0.79966795",
"0.7979907",
"0.79518944",
"0.78901106",
"0.7819013",
"0.78037083",
"0.7792348",
"0.77912194",
"0.77896076",
"0.76400936",
"0.7621717",
"0.7567783",
"0.7484394",
"0.7420754",
"0.7403539",
"0.7327933",
"0.7295707",
"0.7175031",
"0.71616... | 0.6984236 | 25 |
Is data cached at name less than max_age old? | def cached_data_fresh(name, max_age):
age = get_cached_data_age(name)
if not age:
return False
return age < max_age | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cached_data_age(name):\n cache_path = get_cachefile('%s.cache' % name)\n if not os.path.exists(cache_path):\n return 0\n return time.time() - os.stat(cache_path).st_mtime",
"def test_client_max_age_3600(self, sess):\r\n r = sess.get(self.url)\r\n assert self.cache.get(self.u... | [
"0.72965616",
"0.7153269",
"0.70713377",
"0.70586544",
"0.6953036",
"0.6891018",
"0.6786858",
"0.6751199",
"0.6621201",
"0.6565467",
"0.6547826",
"0.65193224",
"0.6484371",
"0.64834225",
"0.6409674",
"0.63673294",
"0.635884",
"0.63153917",
"0.6275169",
"0.62646645",
"0.616324... | 0.88099766 | 0 |
Initializes ResponseGraphUCB instance. Assumes that all payoffs fall in the interval [0,1]. | def __init__(self,
game,
exploration_strategy='uniform-exhaustive',
confidence_method='ucb-standard',
delta=0.01,
ucb_eps=0,
per_payoff_confidence=True,
time_dependent_delta=False):
self.exploration_strategy = e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.counts = [0] * 10\n self.values = [0] * 10\n self.ucb_values = [0] * 10\n self.minmax = 0",
"def __init__(__self__, *,\n count_of_downgrades: Optional[float] = None,\n count_of_upgrades_after_downgrades: Optional[float] = None... | [
"0.57106537",
"0.56416196",
"0.5479917",
"0.5332052",
"0.5301096",
"0.5290658",
"0.52858675",
"0.5282333",
"0.52401644",
"0.52161527",
"0.5172802",
"0.5168146",
"0.5149063",
"0.51293385",
"0.51009285",
"0.5100224",
"0.50839627",
"0.5072702",
"0.5066358",
"0.50627834",
"0.5042... | 0.49025044 | 43 |
Evaluates a strategy profile on the sampling queue. | def evaluate_strategy_profile(self, yield_outcomes=False):
if self.profile_queue:
s = self.profile_queue.pop(0)
if s not in self.active_strategy_profiles:
self.active_strategy_profiles.append(s)
game_outcome = self.G.observe_result(s)
if yield_outcomes:
yield s, game_outcome
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_strategy_evaluate(self, MetricClass, seed):\n m = MetricClass()\n strategy = RandomTrader(seed=seed).run(make_randomwalk(seed=seed))\n result0 = np.array(m.result(strategy)) # from metric method\n result1 = np.array(strategy.evaluate(m)) # from strategy method\n assert... | [
"0.5969119",
"0.5633794",
"0.538661",
"0.5345422",
"0.522462",
"0.5210097",
"0.5199366",
"0.51986796",
"0.519764",
"0.51925373",
"0.5109528",
"0.5101279",
"0.5093053",
"0.50835174",
"0.5083061",
"0.50826895",
"0.50613225",
"0.50515187",
"0.50392723",
"0.5016928",
"0.5011067",... | 0.7300616 | 0 |
Returns upper confidence bound for proportion p successes of n trials. Uses exact ClopperPearson interval. | def _bernoulli_upper(self, p, n, delta):
if p > 1 - 1e-6:
return 1.
else:
upper = scipy.stats.beta.ppf(1. - delta / 2, p * n + 1, n - p * n)
return upper | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ci_prop(p, n, conf_level=95):\n # calculate significance level\n alpha = np.round((1 - conf_level / 100), 2)\n # standard error\n std_error = np.sqrt(p * (1 - p) / n)\n # find the z critical value\n z_star = np.round(stats.norm.ppf(1 - alpha / 2), 3)\n # margin of error\n margin_of_erro... | [
"0.6998814",
"0.64962876",
"0.595823",
"0.5941224",
"0.5918993",
"0.5901527",
"0.58296585",
"0.57775664",
"0.57620996",
"0.5741478",
"0.5741384",
"0.5736505",
"0.5735129",
"0.5710484",
"0.569269",
"0.5689493",
"0.5670027",
"0.56609076",
"0.5651708",
"0.5647094",
"0.56341124",... | 0.5152565 | 58 |
Returns lower confidence bound for proportion p successes of n trials. Uses exact ClopperPearson interval. | def _bernoulli_lower(self, p, n, delta):
if p < 1e-6:
return 0.
else:
lower = scipy.stats.beta.ppf(delta / 2, p * n, n - p * n + 1)
return lower | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ci_prop(p, n, conf_level=95):\n # calculate significance level\n alpha = np.round((1 - conf_level / 100), 2)\n # standard error\n std_error = np.sqrt(p * (1 - p) / n)\n # find the z critical value\n z_star = np.round(stats.norm.ppf(1 - alpha / 2), 3)\n # margin of error\n margin_of_erro... | [
"0.6784953",
"0.6666219",
"0.638372",
"0.5912771",
"0.59070927",
"0.5872947",
"0.5866034",
"0.5781815",
"0.56731147",
"0.56494725",
"0.5635466",
"0.56259406",
"0.56119",
"0.55895066",
"0.55773395",
"0.55713755",
"0.5543089",
"0.55124664",
"0.5490302",
"0.54796183",
"0.5479553... | 0.5224509 | 41 |
Returns kth player's payoff upperconfidencebound given profile s. | def _ucb(self, s, k):
if self.confidence_method == 'ucb-standard':
ucb_factor = self._ucb_standard_factor(s, k)
return self.mu[k][s] + ucb_factor
elif self.confidence_method == 'ucb-standard-relaxed':
ucb_factor = self._ucb_standard_factor(s, k) - self.ucb_eps
return self.mu[k][s] + ucb_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commuting_measurement_value_upper_bound(self, k: int | str = 1) -> float:\n alice_out, bob_out, alice_in, bob_in = self.pred_mat.shape\n\n mat = defaultdict(cvxpy.Variable)\n for x_in in range(alice_in):\n for y_in in range(bob_in):\n mat[x_in, y_in] = cvxpy.Varia... | [
"0.5742807",
"0.571121",
"0.55681527",
"0.553988",
"0.54806167",
"0.54524016",
"0.538193",
"0.5374032",
"0.5372753",
"0.53507614",
"0.53410345",
"0.53332704",
"0.5329912",
"0.5321811",
"0.52907944",
"0.5283707",
"0.5260353",
"0.5247896",
"0.52271086",
"0.5215809",
"0.51892704... | 0.5731787 | 1 |
Returns kth player's payoff lowerconfidencebound given profile s. | def _lcb(self, s, k):
if self.confidence_method == 'ucb-standard':
ucb_factor = self._ucb_standard_factor(s, k)
return self.mu[k][s] - ucb_factor
elif self.confidence_method == 'ucb-standard-relaxed':
ucb_factor = self._ucb_standard_factor(s, k) + self.ucb_eps
return self.mu[k][s] - ucb_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_best_lower_bound(self):\n if not self.tours:\n raise Exception('No lower bound has been computed yet')\n best = max(self.lower_bounds,key=self.lower_bounds.get)\n print('The best lower bound is given by {} with score {}'.format(best,self.lower_bounds[best]))\n return ... | [
"0.5595362",
"0.5578217",
"0.55689",
"0.54349214",
"0.54166657",
"0.5412363",
"0.53970104",
"0.53970104",
"0.53737116",
"0.5349379",
"0.5329898",
"0.5287656",
"0.5177802",
"0.51716083",
"0.5166101",
"0.5150292",
"0.51501316",
"0.51461995",
"0.513952",
"0.5067333",
"0.5011263"... | 0.5800637 | 0 |
Updates grand total after each product addition | def update_total(self):
# the 'or 0' sets order_total as 0 instead of None,
# preventing an error when calculating delivery_costs
self.order_total = self.lineitems.aggregate(
Sum('lineitem_total'))['lineitem_total__sum'] or 0
if self.order_total < settings.FREE_DELIVERY_THRES... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_update_total(self):\n for order in self:\n amount_untaxed = 0.0\n for line in order.order_line_ids:\n amount_untaxed += line.price_subtotal\n order.price_subtotal = amount_untaxed",
"def _grand_total(self):\n count = 0\n for product ... | [
"0.75299513",
"0.73253286",
"0.7230569",
"0.705829",
"0.6921791",
"0.6753439",
"0.67432326",
"0.66982865",
"0.6659161",
"0.6509991",
"0.6469508",
"0.64573425",
"0.6446052",
"0.63694704",
"0.6369132",
"0.6358287",
"0.63530296",
"0.63383436",
"0.6335633",
"0.63332987",
"0.63262... | 0.6979133 | 4 |
Similar to save override in Order model, this sets the lineitem_total and updates the order total | def save(self, *args, **kwargs):
self.lineitem_total = self.product.price * self.quantity
super().save(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lineitem_post_save(**kwargs):\n lineitem = kwargs['instance']\n bill = lineitem.bill\n bill.update_cached_totals()",
"def action_update_total(self):\n for order in self:\n amount_untaxed = 0.0\n for line in order.order_line_ids:\n amount_untaxed += line.pr... | [
"0.77101815",
"0.75834686",
"0.7514907",
"0.74727106",
"0.74727106",
"0.7369916",
"0.73158824",
"0.71956384",
"0.71045256",
"0.70027614",
"0.68427974",
"0.6665695",
"0.6463089",
"0.63442713",
"0.63174725",
"0.6292446",
"0.6232442",
"0.62302035",
"0.6142497",
"0.6140944",
"0.6... | 0.83230525 | 0 |
Constructor depending of the elements past in parameters the constructor will init the cluster differently depending of | def __init__(self,elements, merging_cluster = None):
if type(elements) == Sequence:
self.cluster_elements = elements
self.cluster_elements_str = elements.to_string()
self.cluster_elements_labels = elements.to_label()
elif type(elements) == list:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n ## self.clusters[cluster] = list of coordinates\n self.clusters = {}\n ## self.centroids[cluster] = centroid\n self.centroids = {}",
"def __init__(self, **kwargs):\n cluster1 = None\n cluster2 = None\n index = None\n if kwargs is not N... | [
"0.74846715",
"0.7447633",
"0.72179496",
"0.7178606",
"0.7153271",
"0.7127128",
"0.70745826",
"0.69556785",
"0.69498295",
"0.69413424",
"0.6898927",
"0.68848985",
"0.6858915",
"0.68392634",
"0.6837581",
"0.68008965",
"0.6800636",
"0.67544585",
"0.6750083",
"0.6743469",
"0.672... | 0.7491525 | 0 |
Convert datetime object to string of YYYYMMDD. | def dto_to_str(dto):
try:
return datetime.strftime(dto, DATE_FORMAT_1)
except ValueError:
raise | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_datetime_to_string(dt):\n\treturn '{0}-{1}-{2}'.format(dt.year, dt.month, dt.day)",
"def convert_datetime_to_string(dt):\n\treturn '{0}-{1}-{2}'.format(dt.year, dt.month, dt.day)",
"def date_to_final_str(date_obj: datetime) -> str:\n return date_obj.strftime(\"%Y-%m-%d\")",
"def date2str(d... | [
"0.82302934",
"0.82302934",
"0.7655485",
"0.72548306",
"0.72238666",
"0.7218908",
"0.71954966",
"0.7174997",
"0.7092741",
"0.70277184",
"0.69947326",
"0.693315",
"0.6818119",
"0.679778",
"0.6784673",
"0.67461944",
"0.6680696",
"0.66769797",
"0.66748536",
"0.6653088",
"0.66345... | 0.6347389 | 41 |
Verifies that Magpie returned an Unauthorized response. Validates that at the bare minimum, no underlying internal error occurred from the API or UI calls. | def check_Unauthorized(test_case, method, path, expected_type=CONTENT_TYPE_JSON, override_cookies=null):
# type: (AnyMagpieTestCaseType, Str, Str, Str, Optional[CookiesType]) -> Union[JSON, Str]
app_or_url = get_app_or_url(test_case)
resp = test_request(app_or_url, method, path,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_unauthorized(self):\n self._error_test(fitbit_exceptions.HTTPUnauthorized)",
"def test_invalid_credentials_unauthorized(self):\n response = self._mock_utility(get_kwargs=self._data(),\n error=fitbit_exceptions.HTTPUnauthorized)\n self._check_resp... | [
"0.76950675",
"0.74877256",
"0.7338133",
"0.7314387",
"0.7311925",
"0.7311925",
"0.72560763",
"0.7189692",
"0.71084464",
"0.70742536",
"0.70674336",
"0.7059214",
"0.7041926",
"0.69873106",
"0.6984639",
"0.6975339",
"0.6970429",
"0.6959398",
"0.69451344",
"0.6939596",
"0.69254... | 0.0 | -1 |
Validates that test resource nested immediately under test service does not exist. Skips validation if the test service does not exist. | def check_NonExistingTestServiceResource(test_case, override_service_name=null, override_resource_name=null):
# type: (AnyMagpieTestCaseType, Optional[Str], Optional[Str]) -> None
resources = TestSetup.get_TestServiceDirectResources(test_case,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_creation_of_service_in_store_that_does_not_exist(self):\n response2 = self.client.post(store_url + '5a2bc733791e4bbc9a26f7a5/service/',\n data=json.dumps(self.service_zero),\n headers=self.my_header)\n self.assertEqual(r... | [
"0.6071377",
"0.6043958",
"0.5994362",
"0.58915544",
"0.5721648",
"0.56700635",
"0.56522864",
"0.55893904",
"0.5578353",
"0.5570871",
"0.5556533",
"0.5536094",
"0.54679364",
"0.5463218",
"0.5454187",
"0.5408944",
"0.5393335",
"0.5383498",
"0.5376995",
"0.5366523",
"0.5359982"... | 0.6714326 | 0 |
Validates that the test service does not exist. | def check_NonExistingTestService(test_case, override_service_name=null):
# type: (AnyMagpieTestCaseType, Optional[Str]) -> None
services_info = TestSetup.get_RegisteredServicesList(test_case)
services_names = [svc["service_name"] for svc in services_info]
service_name = override_service_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_creation_of_service_in_store_that_does_not_exist(self):\n response2 = self.client.post(store_url + '5a2bc733791e4bbc9a26f7a5/service/',\n data=json.dumps(self.service_zero),\n headers=self.my_header)\n self.assertEqual(r... | [
"0.71348107",
"0.6864465",
"0.671331",
"0.667063",
"0.6652851",
"0.65822685",
"0.65597785",
"0.65354407",
"0.65234494",
"0.636613",
"0.6362749",
"0.6335114",
"0.63140076",
"0.6289238",
"0.6287692",
"0.628501",
"0.622946",
"0.6208283",
"0.6185006",
"0.61789393",
"0.61514735",
... | 0.7576391 | 0 |
Delete the test group. Skip operation if the group does not exist. Otherwise, proceed to delete it and validate its removal. | def delete_TestGroup(test_case, override_group_name=null, override_headers=null, override_cookies=null):
# type: (AnyMagpieTestCaseType, Optional[Str], Optional[HeadersType], Optional[CookiesType]) -> None
app_or_url = get_app_or_url(test_case)
headers = override_headers if override_headers is n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_080_group_delete(self):\n\n testflow.step(RMV_GRP_MSG, TEST_GROUP_DELETE)\n assert GROUP_CLI.run(\n 'delete',\n TEST_GROUP_DELETE\n )[0], \"Failed to delete group '%s'\" % TEST_GROUP_DELETE",
"def test_delete_group(self):\n pass",
"def test_delete_grou... | [
"0.82440627",
"0.7965804",
"0.7965804",
"0.78738534",
"0.78214514",
"0.7813539",
"0.76134014",
"0.7527522",
"0.75090754",
"0.7498816",
"0.7382029",
"0.73272973",
"0.72239107",
"0.7188836",
"0.7109205",
"0.7085497",
"0.70691955",
"0.70497054",
"0.700776",
"0.700726",
"0.700726... | 0.7235654 | 12 |
Calculates the softmax of each row of X. | def softmax(self, X):
n_samples, _ = X.shape
X_ = np.empty((n_samples, self.n_classes_))
old_ind = 0
for i, n in enumerate(self.n_weights_per_class):
new_ind = int(old_ind + n + 1)
X_[:, i] = np.dot(X[:, old_ind: new_ind], self.weights_[old_ind: new_ind])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x: npt.NDArray) -> npt.NDArray:\n row_wise_max = np.max(x, axis=1).reshape(-1, 1)\n exp_x = np.exp(x - row_wise_max)\n return exp_x / np.sum(exp_x, axis=1).reshape(-1, 1)",
"def softmax(self, x):\n\n out = np.zeros(x.shape)\n for i in range(x.shape[0]):\n max_x = x[i... | [
"0.8534722",
"0.8422346",
"0.83319545",
"0.82956815",
"0.82828474",
"0.82120085",
"0.8192384",
"0.8154918",
"0.8147",
"0.81244105",
"0.811679",
"0.8095815",
"0.80748945",
"0.8074718",
"0.8060091",
"0.8056744",
"0.8044604",
"0.8041348",
"0.8032782",
"0.80273956",
"0.80273956",... | 0.76877916 | 95 |
Display image using matplotlib. | def show_image(image, percentile=[1, 99], subplots=None, cmap='gray_r',
rasterized=False, **kwargs):
if subplots is None:
figsize = kwargs.pop('figsize', (10, 10))
fig, ax = plt.subplots(figsize=figsize,
subplot_kw=dict(xticks=[], yticks=[]),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_image(path):\n img = mpimg.imread(path)\n imgplot = plt.imshow(img)\n plt.show()\n plt.close()",
"def matplotlibDisplay(img, title=\"Image\", colorFlag = 'gray'):\n plt.imshow(img, colorFlag)\n plt.title(title)\n plt.xticks([])\n plt.yticks([])\n plt.show()... | [
"0.8320322",
"0.80858546",
"0.7922074",
"0.7922074",
"0.7922074",
"0.78919786",
"0.7826738",
"0.77931833",
"0.7789232",
"0.77763367",
"0.7775491",
"0.77748805",
"0.77419996",
"0.7630295",
"0.7619223",
"0.7575761",
"0.7537007",
"0.7455123",
"0.74345255",
"0.74185985",
"0.74147... | 0.0 | -1 |
Histogram matching of the input image with the reference image using SimpleITK This function uses HistogramMatchingImageFilter implemented in SimpleITK/ITK. | def Histogram_Matching(inImFile, outImFile, refImFile,
number_of_histogram_levels=1024,
number_of_match_points=7,
threshold_at_mean_intensity=False):
inputIm = sitk.ReadImage(inImFile)
referenceIm = sitk.ReadImage(refImFile)
histMatchingFilte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cs4243_histmatch(ori_image, refer_image):\n \n ##your code here ###\n\n # get cdf of ori and ref image\n grey_level = 256\n ori_hist, ori_cum_hist, ori_res_image, ori_uni_hist = cs4243_histequ(ori_image, grey_level)\n ref_hist, ref_cum_hist, ref_res_image, ref_uni_hist = cs4243_histequ(refer_... | [
"0.74354124",
"0.72736305",
"0.67961675",
"0.6701607",
"0.6498471",
"0.6409669",
"0.63957417",
"0.6384505",
"0.6377174",
"0.6369875",
"0.6356987",
"0.63000095",
"0.6276054",
"0.6253482",
"0.6251662",
"0.6236999",
"0.62256294",
"0.6183007",
"0.6172917",
"0.6147577",
"0.6144441... | 0.81811213 | 0 |
Create an empty dataframe with the columns required by this class. | def _make_blank(cls) -> pd.DataFrame:
spec = list(zip(cls._required_columns, cls._required_dtypes))
try:
arr = np.zeros(0, dtype=spec)
return pd.DataFrame(arr)
except TypeError as exc:
raise TypeError(r"{exc}: {spec}") from exc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_frame_creator(self):\n\n return pd.DataFrame()",
"def _constructEmptyDf(self,cols=['DummyCol1','DummyCol2']):\r\n\r\n logStr = \"{0:s}.{1:s}: \".format(self.__class__.__name__, sys._getframe().f_code.co_name)\r\n logger.debug(\"{0:s}{1:s}\".format(logStr,'Start.')) \r\n \r\n ... | [
"0.784695",
"0.7412779",
"0.7344918",
"0.72827166",
"0.7185767",
"0.7124673",
"0.7124673",
"0.7124673",
"0.7124673",
"0.7124673",
"0.7085299",
"0.707741",
"0.7072158",
"0.7022713",
"0.7018842",
"0.69983715",
"0.69759613",
"0.69651383",
"0.69609517",
"0.6906332",
"0.69019836",... | 0.7803658 | 1 |
Create a new instance from a list of rows, as tuples or arrays. | def from_rows(
cls,
rows: Iterable,
columns: Optional[Sequence[str]] = None,
meta_dict: Optional[Mapping] = None,
):
if columns is None:
columns = cls._required_columns
table = pd.DataFrame.from_records(rows, columns=columns)
return cls(table, meta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_list(cls, rowslist, shape, domain):\n return cls(rowslist, shape, domain)",
"def from_list(cls, rows, domain):\n nrows = len(rows)\n ncols = 0 if not nrows else len(rows[0])\n conv = lambda e: domain(*e) if isinstance(e, tuple) else domain(e)\n domain_rows = [[conv(e) ... | [
"0.76973224",
"0.72964895",
"0.69260794",
"0.6734386",
"0.67300195",
"0.6621048",
"0.6571504",
"0.6536043",
"0.64729804",
"0.6463493",
"0.64256203",
"0.6308479",
"0.6214093",
"0.62099075",
"0.6186991",
"0.61352205",
"0.6107339",
"0.6058422",
"0.60131955",
"0.600162",
"0.59668... | 0.6217184 | 12 |
Coerce `arraylike` to a Series with this instance's index. | def as_series(self, arraylike: Iterable) -> pd.Series:
return pd.Series(arraylike, index=self.data.index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_series(self) -> \"pd.Series\":\n import pandas as pd\n\n data = {\"_row_id\": self.id, \"_row_num\": self.num, **self.as_dict()}\n series = pd.Series(data)\n return series",
"def pandas_series(arr, nan_to_null=False):\n import pandas as pd\n return pd.Series(arr, copy=Fal... | [
"0.70400625",
"0.6879043",
"0.68024653",
"0.6728168",
"0.6555522",
"0.6550331",
"0.6437792",
"0.6294714",
"0.6275131",
"0.6194347",
"0.6158122",
"0.6119693",
"0.609753",
"0.6094025",
"0.6086227",
"0.6075753",
"0.6052453",
"0.60496277",
"0.60222876",
"0.5989694",
"0.5961374",
... | 0.83972543 | 0 |
Sort this array's bins inplace, with smart chromosome ordering. | def sort(self):
sort_key = self.data.chromosome.apply(sorter_chrom)
self.data = (
self.data.assign(_sort_key_=sort_key)
.sort_values(by=["_sort_key_", "start", "end"], kind="mergesort")
.drop("_sort_key_", axis=1)
.reset_index(drop=True)
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precalculate(self):\n self._sorted = np.argsort(\n self.base[self._array], kind='mergesort') # mergesort for stability\n self._boundaries = util.find_boundaries(\n self.base[self._array][self._sorted])",
"def _sort_compounds(self):\n self.sorted_molecules = sorted(... | [
"0.62714213",
"0.6004813",
"0.5978882",
"0.595729",
"0.5924952",
"0.58990234",
"0.5776702",
"0.57457966",
"0.5661029",
"0.56164414",
"0.55334383",
"0.5530408",
"0.5521393",
"0.5483534",
"0.5468315",
"0.5462785",
"0.54391754",
"0.54192376",
"0.5418567",
"0.53905886",
"0.537014... | 0.6727469 | 0 |
function for parsing the local hour angle | def get_local_hour_angle(self):
LHA = self.Calculations.local_hour_angle(self.Longitude, self.right_ascension)
self.LHA = LHA
return LHA | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hour(hour):\n if int(hour) == 0:\n return 12\n elif int(hour) > 12:\n return int(hour) - 12\n else:\n return hour",
"def hour(self):\n return \"%s:00:00\" % self.timestamp[:13]",
"def check_hour_range(self, hour):\n if 0 <= hour <= 5:\n return 'Ear... | [
"0.6511776",
"0.6272711",
"0.6264724",
"0.62330997",
"0.6221382",
"0.6206206",
"0.59587604",
"0.5957508",
"0.5941786",
"0.59351957",
"0.58999026",
"0.58870393",
"0.58814335",
"0.5861206",
"0.5848067",
"0.58216274",
"0.5806287",
"0.57736397",
"0.5764118",
"0.5747307",
"0.57453... | 0.61004585 | 6 |
Returns a UTC offset string of the current time suitable for use in the | def get_utc_offset_str():
# Calculate the UTC time difference in seconds.
timestamp = time.time()
time_now = datetime.fromtimestamp(timestamp)
time_utc = datetime.utcfromtimestamp(timestamp)
utc_offset_secs = (time_now - time_utc).total_seconds()
# Flag variable to hold... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _format_timezone_offset(converted_time):\n\n # Windows treats %z in the format string as %Z, so we compute the hour/minute offset\n # manually.\n if converted_time.tm_isdst == 1 and time.daylight:\n utc_offset_secs = time.altzone\n else:\n utc_offset_secs = tim... | [
"0.7254286",
"0.7167424",
"0.70807934",
"0.6761435",
"0.67554796",
"0.66784036",
"0.6670253",
"0.6656187",
"0.6652087",
"0.65509915",
"0.65509915",
"0.65272313",
"0.6475465",
"0.6464382",
"0.6434502",
"0.64007866",
"0.6380021",
"0.6363318",
"0.6357447",
"0.6331158",
"0.632086... | 0.83040845 | 0 |
Moves the character in given direction for the given duration arguments direction accepts "left", "right", "forward", "backward" and uses it as dict key for self.move_dir duration how long to hold the movement key | def move(self, direction='forward', duration=0.0):
# Depress proper movement key
keyboard.press(self.move_dir[direction])
# After duration, release key
if duration > 0.0:
sleep(duration)
keyboard.release(self.move_dir[direction]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timed_move(self, direction, duration):\n print(\"Timed move \", end='')\n if direction == MOV_FORWARD:\n print(\"forward\")\n elif direction == MOV_BACK:\n print(\"back\")\n else:\n print(\"?\")\n print(\"Duration:\", duration)\n\n self... | [
"0.71435624",
"0.70243645",
"0.69156986",
"0.6881963",
"0.65851784",
"0.65483314",
"0.6538735",
"0.6493119",
"0.64872855",
"0.6486142",
"0.6428443",
"0.637382",
"0.63414377",
"0.62614614",
"0.62512434",
"0.62193334",
"0.6147643",
"0.61280406",
"0.61262244",
"0.61262244",
"0.6... | 0.8135537 | 0 |
Turns a given number of degrees in the given direction arguments direction accepts "left" or "right" and uses it as dict key for self.turn_dir degrees number of degrees you wish to turn the character | def turn(self, direction='left', degrees=0):
duration_of_turn = self.degrees_to_duration(degrees)
# Depress proper turn key
keyboard.press(self.turn_dir[direction])
# After duration, release key
if duration_of_turn > 0.0:
sleep(duration_of_turn)
keyboard.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn(self, dir):\n if dir.upper() == 'R':\n if self.direction == 3:\n self.direction = 0\n else:\n self.direction += 1\n if dir.upper() == 'L':\n if self.direction == 0:\n self.direction = 3\n else:\n ... | [
"0.73210454",
"0.69366246",
"0.6679597",
"0.6600808",
"0.6551328",
"0.6492578",
"0.63753194",
"0.63121635",
"0.6305108",
"0.6274639",
"0.6269894",
"0.6246395",
"0.62227905",
"0.61980975",
"0.61158204",
"0.60727537",
"0.60574234",
"0.6055724",
"0.60330665",
"0.597591",
"0.5972... | 0.7166694 | 1 |
Given an instance of a serializer, return a dictionary of metadata about its fields. | def get_serializer_info(self, serializer):
if hasattr(serializer, "child"):
# If this is a `ListSerializer` then we want to examine the
# underlying child serializer instance instead.
serializer = serializer.child
# Remove the URL field if present
serializer.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fields(self):\n\n return {\n attr: field['serializer']\n for attr, field in self._fields.items()\n }",
"def get_fields(self):\n fields = {}\n allowed_types = (\n SerializerMethodField,\n Field,\n Serializer,\n )\n ... | [
"0.7323075",
"0.67004484",
"0.6350399",
"0.61360943",
"0.6043718",
"0.6036233",
"0.59390324",
"0.5927445",
"0.5925667",
"0.59210116",
"0.5899225",
"0.58932304",
"0.5892627",
"0.58893937",
"0.58744884",
"0.5859291",
"0.5851844",
"0.5841337",
"0.58262753",
"0.5823886",
"0.57775... | 0.7540421 | 0 |
Given an instance of a serializer field, return a dictionary of metadata about it. | def get_field_info(self, field):
field_info = {}
serializer = field.parent
if isinstance(field, serializers.ManyRelatedField):
field_info["type"] = self.type_lookup[field.child_relation]
else:
field_info["type"] = self.type_lookup[field]
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_fields(self):\n\n return {\n attr: field['serializer']\n for attr, field in self._fields.items()\n }",
"def get_serializer_info(self, serializer):\n if hasattr(serializer, \"child\"):\n # If this is a `ListSerializer` then we want to examine the\n ... | [
"0.6593335",
"0.6574828",
"0.6190593",
"0.6137806",
"0.60714644",
"0.59437436",
"0.58842355",
"0.5855818",
"0.5844208",
"0.5779441",
"0.576801",
"0.57314557",
"0.57256305",
"0.5712764",
"0.57118374",
"0.56983626",
"0.56626946",
"0.5615629",
"0.5614134",
"0.55997163",
"0.55875... | 0.6626879 | 0 |
getdefaultencoding() > string Return the current default string encoding used by the Unicode implementation. | def getdefaultencoding(): # real signature unknown; restored from __doc__
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getpreferredencoding() -> str:\n return locale.getpreferredencoding() or \"UTF-8\"",
"def get_charset(self, default: str) -> str:\n ...",
"def get_encoding(enc, default='latin1'):\n\n if not enc:\n return default\n try:\n codecs.lookup(enc)\n ... | [
"0.77499235",
"0.7464563",
"0.7405454",
"0.71397215",
"0.6966229",
"0.6966229",
"0.6901542",
"0.6832482",
"0.67906934",
"0.6702058",
"0.6618024",
"0.6578314",
"0.65594625",
"0.6557166",
"0.64743364",
"0.63048446",
"0.628028",
"0.6259909",
"0.6227286",
"0.6214048",
"0.6177194"... | 0.86211926 | 0 |
getfilesystemencoding() > string Return the encoding used to convert Unicode filenames in operating system filenames. | def getfilesystemencoding(): # real signature unknown; restored from __doc__
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getfilesystemencoding():\n encoding = sys.getfilesystemencoding()\n if encoding is None:\n # Must be Linux or Unix and nl_langinfo(CODESET) failed.\n encoding = PREFERRED_ENCODING\n return encoding",
"def getsystemenc():\n\n return sys.getfilesystemencoding()",
"def get_file_encod... | [
"0.8229572",
"0.7732857",
"0.68935233",
"0.6804994",
"0.66989315",
"0.6679651",
"0.6638953",
"0.6638953",
"0.6610522",
"0.65706474",
"0.6460731",
"0.6448716",
"0.64475274",
"0.6358718",
"0.6299554",
"0.62771094",
"0.6254006",
"0.62244594",
"0.6206625",
"0.61403924",
"0.612931... | 0.8575656 | 0 |
_current_frames() > dictionary Return a dictionary mapping each current thread T's thread id to T's current stack frame. This function should be used for specialized purposes only. | def _current_frames(): # real signature unknown; restored from __doc__
return {} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getouterframes(frame, context=1):\r\n framelist = []\r\n while frame:\r\n framelist.append((frame,) + getframeinfo(frame, context))\r\n frame = frame.f_back\r\n return framelist",
"def currentframe():\n return sys._getframe(3)",
"def getinnerframes(tb, context=1):\r\n framelist... | [
"0.6090527",
"0.608579",
"0.6020393",
"0.59718895",
"0.59696347",
"0.5962012",
"0.59076893",
"0.58308023",
"0.5797438",
"0.57722795",
"0.5754105",
"0.5646045",
"0.5634119",
"0.56302696",
"0.5530798",
"0.552655",
"0.55195403",
"0.5517164",
"0.54991895",
"0.54802054",
"0.543477... | 0.7780735 | 0 |
Return repr for the module. The method is deprecated. The import machinery does the job itself. | def module_repr(module): # reliably restored by inspect
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_repr(*args,**kw):\n pass",
"def __repr__(self) -> str:\n return f\"<Module[{self.path}]>\"",
"def __repr__(self):\n location = attr(self, '__spec__.origin',\n '__file__',\n '__package__')\n name = attr(self, '__nam... | [
"0.77776474",
"0.75011677",
"0.7398434",
"0.68957216",
"0.67717457",
"0.6583072",
"0.6580197",
"0.6529352",
"0.65247625",
"0.64683145",
"0.6383973",
"0.6343904",
"0.6307563",
"0.6304915",
"0.6293533",
"0.62484473",
"0.6233853",
"0.6174163",
"0.61484087",
"0.6123342",
"0.60245... | 0.81093186 | 0 |
Return TRELLO_API_KEY for use in templates. | def trello_api_key():
return TRELLO_API_KEY | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ot_api_key() -> str|None:\n # Reuse the API key's value if we've already obtained it.\n if settings.OT_API_KEY is not None:\n return settings.OT_API_KEY\n\n if settings.DEV_MODE or settings.UNIT_TEST_MODE:\n # In dev or unit test mode, pull the API key from a local file.\n try:\n with open... | [
"0.7462007",
"0.7279564",
"0.7271457",
"0.72624266",
"0.71599334",
"0.71522397",
"0.7141559",
"0.7138159",
"0.7132009",
"0.7121057",
"0.7048457",
"0.7048186",
"0.7041526",
"0.7041526",
"0.7041526",
"0.7041526",
"0.6997704",
"0.6997344",
"0.69490266",
"0.69460964",
"0.6924445"... | 0.8414874 | 0 |
Returns the number of days (or months) between two dates | def get_diff_start_end(start_date, end_date, min_yr=None, monthly=False):
day_s, mon_s, yr_s = start_date[0], start_date[1], start_date[2]
day_e, mon_e, yr_e = end_date[0], end_date[1], end_date[2]
if not min_yr:
min_yr = yr_s
start, end = date(yr_s, mon_s, day_s), date(yr_e, mon_e, day_e)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def diff_dates(date1, date2):\n\n return abs(date2 - date1).days",
"def daysBetweenDates(year1, month1, day1, year2, month2, day2):\n\n days = 0\n while dateIsBefore(year1, month1, day1, year2, month2, day2):\n year1, month1, day1 = nextDay(year1, month1, day1)\n days += 1\n return days... | [
"0.79920995",
"0.7896767",
"0.7865328",
"0.7825949",
"0.7822661",
"0.77921796",
"0.77640855",
"0.77548546",
"0.7741251",
"0.7739907",
"0.77221966",
"0.77145594",
"0.7701616",
"0.7640416",
"0.7546257",
"0.74441856",
"0.73063666",
"0.7245142",
"0.72414124",
"0.71676946",
"0.714... | 0.61686295 | 47 |
Returns the index of the element closest to value in array | def find_nearest(array, value):
array = np.asarray(array)
idx = (np.abs(array - value)).argmin()
return idx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def closest(array, value):\n idx = (np.abs(array-value)).argmin()\n return idx",
"def find_nearest(array,value):\n idx = (np.abs(array-value)).argmin()\n return idx",
"def find_nearest(array, value):\n idx = (np.abs(array-value)).argmin()\n return idx",
"def find_nearest(array, value):\n ... | [
"0.879006",
"0.85460496",
"0.84953326",
"0.8494627",
"0.8423116",
"0.83981174",
"0.8370991",
"0.83250314",
"0.8247083",
"0.8207293",
"0.81542456",
"0.81378627",
"0.8122104",
"0.8122104",
"0.8006899",
"0.7977014",
"0.7919829",
"0.7834604",
"0.7831902",
"0.7628504",
"0.7623822"... | 0.83828336 | 7 |
Search for coincidences in a set of timestamps Given a set of timestamps, search for coincidences. That is, search for events which occured almost at the same time and thus might be the result of an extended air shower. | def do_search_coincidences(timestamps, window=200000):
coincidences = []
# traverse all timestamps
for i in xrange(len(timestamps)):
# build coincidence, starting with the current timestamp
c = [i]
t0 = timestamps[i][0]
# traverse the rest of the timestamps
for j i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_times(timestamps, time_difference):\n timestamps = sorted(set(timestamps))\n\n filtered_timestamps = []\n for current_timestamp in timestamps:\n if not filtered_timestamps or current_timestamp - filtered_timestamps[-1] > time_difference:\n filtered_timestamps.append(current_ti... | [
"0.6222778",
"0.5719726",
"0.5664501",
"0.56395787",
"0.55810034",
"0.5558987",
"0.5517311",
"0.5501492",
"0.54588217",
"0.54234046",
"0.5323761",
"0.53221667",
"0.5313011",
"0.5302765",
"0.5284599",
"0.5281517",
"0.5277219",
"0.52509254",
"0.5249739",
"0.52426803",
"0.521687... | 0.7533535 | 0 |
Overrides the equality method implementation. | def __str__(self):
return "Region: " + self.name + " with parent " + self.parent + " and self code " + self.FHIRCode | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n raise NotImplementedError",
"def __eq__(self, other):\n raise NotImplementedError",
"def __eq__(self, other):\n raise NotImplementedError",
"def __eq__(self, other):\n pass",
"def __eq__(self, other):\n pass",
"def __eq__(self, *args):\r\n ... | [
"0.82993126",
"0.82993126",
"0.82993126",
"0.8279628",
"0.8279628",
"0.827198",
"0.827198",
"0.827198",
"0.827198",
"0.827198",
"0.827198",
"0.827198",
"0.827198",
"0.827198",
"0.827198",
"0.827198",
"0.82373226",
"0.82373226",
"0.82373226",
"0.82373226",
"0.82221377",
"0.8... | 0.0 | -1 |
Test parsing invalid durations from TVMaze API. | def test_parse_duration_exceptions(
test_input: typing.Any,
expected: Exception,
):
with pytest.raises(expected):
tvmaze.parsers.parse_duration(test_input) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_parse_duration(\n test_input: int,\n expected: datetime.timedelta,\n):\n assert tvmaze.parsers.parse_duration(test_input) == expected",
"def test_parse_time_with_invalid_interval(self):\n now = datetime(2015, 2, 1, 0, 0, 0)\n self.assert_TPVE(parse_time, \"-0\", now)\n ... | [
"0.7181432",
"0.7092153",
"0.70551395",
"0.6774812",
"0.6763515",
"0.6763207",
"0.668546",
"0.65754163",
"0.65632933",
"0.6311343",
"0.62748945",
"0.6179953",
"0.61337334",
"0.6098421",
"0.60370433",
"0.60180724",
"0.60137993",
"0.5987067",
"0.5965356",
"0.5949888",
"0.592722... | 0.72819936 | 0 |
Get the current Amperage. | def getAmps(self):
return self.json_state.get("charging").get("amps_current") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_AIA(self):\n\n return self.get_POW().getAIA()",
"def get_age(self):\n return self.glb[iage]",
"def get_age(self):\n return self.__age",
"def pillar_a_room(self):\r\n return self.__pillar_a",
"def get_age(self):\n return self._age",
"def get_age(self):\n r... | [
"0.6258013",
"0.618623",
"0.6124007",
"0.60744244",
"0.60626155",
"0.60626155",
"0.60626155",
"0.5982053",
"0.59755147",
"0.5965359",
"0.5933949",
"0.5887052",
"0.5869244",
"0.5831793",
"0.582333",
"0.5811592",
"0.57885647",
"0.576356",
"0.57578355",
"0.5743405",
"0.57138234"... | 0.61620724 | 2 |
Get the current status. | def getStatus(self):
return self.json_state.get("state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status(self):\n return self.status",
"def get_status(self):\n return self.status",
"def get_status(self):\n return self.status",
"def getstatus(self):\n return self.__status",
"def get_status(self):\n return self._status",
"def GetStatus(self):\r\n return sel... | [
"0.86927676",
"0.86927676",
"0.86927676",
"0.8663911",
"0.8661699",
"0.86579514",
"0.8573755",
"0.8572048",
"0.84423053",
"0.8409137",
"0.8408199",
"0.8383405",
"0.83805305",
"0.8320583",
"0.8267915",
"0.82589805",
"0.82589805",
"0.82589805",
"0.82589805",
"0.82589805",
"0.82... | 0.0 | -1 |
Set to override schedule or not. | def setOverride(self, charge_now):
override_time = 0
energy_at_plugin = 0
energy_to_add = 0
if charge_now:
# To enter the "Charge Now" state, override_time
# should be set to a time in the past. Otherwise, it simply
# sets the target time the vehicle ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schedule(self, schedule):\n \n self._schedule = schedule",
"def schedule(self, schedule):\n\n self._schedule = schedule",
"def schedule(self, schedule):\n\n self._schedule = schedule",
"def svn_info_t_schedule_set(svn_info_t_self, svn_wc_schedule_t_schedule): # real signature ... | [
"0.7215234",
"0.7072425",
"0.7072425",
"0.68272793",
"0.66678053",
"0.66249335",
"0.6472469",
"0.643736",
"0.6434246",
"0.6341643",
"0.6307422",
"0.6188436",
"0.61707866",
"0.6164208",
"0.6138029",
"0.6123734",
"0.6091858",
"0.6066912",
"0.60464257",
"0.60464257",
"0.59831524... | 0.0 | -1 |
Creates a vocabulary mapping from words to ids. Increasing integer ids are assigned by word frequency, using lexical sorting as a tie breaker. The only exception to this are special symbols such as the padding symbol (PAD). | def build_vocab(
data_source: Iterable[str],
data_target: Iterable[str],
single_vocab: bool = False,
num_words_source: int = 50000,
num_words_target: int = 50000,
min_count_source: int = 1,
min_count_target: int = 1,
) -> (Dict[str, int], Dict[str, int]):
vocab_symbols_set = set(VOCAB_SY... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_lookup_tables(words):\n\n word_counts = Counter(words)\n sorted_vocab = sorted(word_counts, key=word_counts.get, reverse=True)\n int_to_vocab = {(ii+1): word for ii, word in enumerate(sorted_vocab)}\n vocab_to_int = {word: (ii+1) for ii, word in int_to_vocab.items()}\n\n return vocab_to_i... | [
"0.73699003",
"0.72523075",
"0.7189173",
"0.7181838",
"0.7174813",
"0.70853657",
"0.6934304",
"0.6879009",
"0.6858828",
"0.6849512",
"0.68144983",
"0.6745805",
"0.66091204",
"0.6588328",
"0.658411",
"0.65822005",
"0.65429914",
"0.6530509",
"0.6508405",
"0.64926934",
"0.649269... | 0.0 | -1 |
Load vocab from JSON | def vocab_from_json(path: str) -> Dict:
with open(path, encoding=VOCAB_ENCODING) as inp:
vocab = json.load(inp)
logger.info('Vocabulary (%d words) loaded from "%s"', len(vocab), path)
return vocab | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(cls, path: str) -> 'Vocab':\n with open(path, 'r', encoding='utf-8') as f:\n return cls.from_json(f.read())",
"def get_vocab(which_vocab):\n path = os.path.join(mg.WORKING_PATH, 'vocab', ''.join([which_vocab, '.json'\n ]))\n if os.path.exists(path):\n with open(p... | [
"0.7383053",
"0.72281736",
"0.7153435",
"0.7129347",
"0.6920643",
"0.6900413",
"0.6892449",
"0.68210644",
"0.67851615",
"0.6699833",
"0.6654643",
"0.6641702",
"0.65374404",
"0.64846003",
"0.6436098",
"0.64151007",
"0.64074373",
"0.6396858",
"0.6322019",
"0.62961197",
"0.62947... | 0.83683556 | 0 |
Checks if string contains a valid SMS code | def sms_code(string: str) -> Union[str, None]:
m = p.search(string.strip())
if m: m = m.group().replace('-', '').replace('sms:', '')
return m | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sms_valid(text=''):\n try:\n text.decode('ascii')\n except:\n return False\n if len(text) > 160:\n return False\n\n return True",
"def mobile_validator(mobile):\n if mobile[0:4] != '+989':\n raise ValidationError('Invalid mobile')",
"def isSpamSMS(textLine):\n\... | [
"0.76758754",
"0.6381424",
"0.63430536",
"0.6330676",
"0.6277171",
"0.6192343",
"0.6120925",
"0.6044895",
"0.6044203",
"0.5982672",
"0.5957734",
"0.59510475",
"0.5949857",
"0.5943442",
"0.59111303",
"0.58842593",
"0.58581394",
"0.5856176",
"0.5844374",
"0.58332616",
"0.576246... | 0.7208684 | 1 |
Convert arraylike data (list/numpy array/pandas) to 2D numpy array. | def to_2dnp_array(X):
if isinstance(X, np.ndarray):
if X.ndim == 1:
return X.reshape((-1, 1))
if X.ndim == 2:
return X
if isinstance(X, Number):
X = [X]
X = np.array(X)
X = X.reshape([-1, np.prod(X.shape) // X.shape[0]])
return X | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_arraylike(data):\n _load_objects()\n if data is None:\n raise ValueError('Cannot convert None data.')\n return None\n if not isinstance(data, (ndarray, DataArray, DataFrame, Series, Index)):\n data = np.asarray(data)\n if not np.iterable(data):\n data = np.atleast_1d... | [
"0.7945745",
"0.7721907",
"0.74875873",
"0.7299131",
"0.7159762",
"0.70749307",
"0.7010113",
"0.7003717",
"0.7003717",
"0.68570745",
"0.6827771",
"0.67900044",
"0.6769252",
"0.67586446",
"0.6690123",
"0.65906477",
"0.6587689",
"0.6585068",
"0.6567797",
"0.65086746",
"0.647016... | 0.69870424 | 9 |
Update the model with newX to transform the data Online version to do the fit transform with much faster speed. | def fit_transform_online(self, new_ts_minibatch):
if self.ts_data is None:
raise ValueError("fit_transform_online can not be called in the\
very first time, should followed fit_transform.")
radius = self.radius
exp_D = self.exp_D
ts_data =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_fit(self, X, y):\n pass",
"def _update_model(self, X_all, Y_all):\n if self.model is None:\n self._create_model(X_all, Y_all)\n else:\n self.model.set_XY(X_all, Y_all)\n\n # WARNING: Even if self.max_iters=0, the hyperparameters are bit modified...\n ... | [
"0.67725384",
"0.6739249",
"0.66024005",
"0.65393645",
"0.6527778",
"0.64266586",
"0.64266586",
"0.64266586",
"0.6399944",
"0.63682306",
"0.63518196",
"0.63081616",
"0.6281664",
"0.62521887",
"0.62060374",
"0.6199304",
"0.61987555",
"0.61877036",
"0.6174904",
"0.61715114",
"0... | 0.0 | -1 |
Update the model with newX to transform the data Online version to do the fit transform with much faster speed. | def fit_transform_online(self, new_ts_minibatch):
if self.ts_data is None:
raise ValueError("fit_transform_online can not be called in the\
very first time, should followed fit_transform.")
adj_radius = self.adj_radius
radius = self.radius
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_fit(self, X, y):\n pass",
"def _update_model(self, X_all, Y_all):\n if self.model is None:\n self._create_model(X_all, Y_all)\n else:\n self.model.set_XY(X_all, Y_all)\n\n # WARNING: Even if self.max_iters=0, the hyperparameters are bit modified...\n ... | [
"0.67710245",
"0.67386675",
"0.6601867",
"0.6538586",
"0.65259",
"0.642643",
"0.642643",
"0.642643",
"0.63996285",
"0.6368339",
"0.6350167",
"0.6310121",
"0.6283339",
"0.6250899",
"0.62085015",
"0.61990243",
"0.6198224",
"0.61872256",
"0.6175653",
"0.6173606",
"0.6146397",
... | 0.0 | -1 |
A function that takes a pandas dataframe as an input, tokenises the sentences and removes all the stopwords in the input using a stop words dictionary and returns a modified version of the pandas dataframe | def stop_words_remover(df):
df['Without Stop Words'] = df['Tweets'].apply(str.lower).apply(str.split)
for i in range(len(twitter_df)):
df['Without Stop Words'][i] = [x for x in df['Without Stop Words'][i] if x not in stop_words_dict['stopwords']]
return df
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_words_remover(df):\n stop_words = stop_words_dict['stopwords']\n\n df['Without Stop Words'] = [' '.join([w for w in x.lower().split()\n if w not in stop_words])\n for x in df['Tweets'].tolist()\n ]\n resu... | [
"0.80349636",
"0.7908949",
"0.7395624",
"0.7391324",
"0.72956973",
"0.7273814",
"0.7258432",
"0.72530496",
"0.71138287",
"0.6982694",
"0.6910817",
"0.6807659",
"0.6760508",
"0.66717595",
"0.6670105",
"0.66359085",
"0.6602602",
"0.6526728",
"0.6450629",
"0.6428185",
"0.6427812... | 0.7996187 | 1 |
Converts color(s) to the specified color type Takes a single color or an iterable of colors and outputs a list of the color(s) converted all to an rgb or tuple color type. If colors is a Plotly Scale name then the cooresponding colorscale will be outputted and colortype will not be applicable | def convert_colors_to_same_type(colors, colortype='rgb'):
colors_list = []
if isinstance(colors, str):
if colors in PLOTLY_SCALES:
return PLOTLY_SCALES[colors]
elif 'rgb' in colors or '#' in colors:
colors_list = [colors]
else:
raise exceptions.Plotly... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_dict_colors_to_same_type(colors, colortype='rgb'):\n for key in colors:\n if '#' in colors[key]:\n colors[key] = color_parser(\n colors[key], hex_to_rgb\n )\n colors[key] = color_parser(\n colors[key], label_rgb\n )\n\n... | [
"0.778564",
"0.6566585",
"0.6505118",
"0.6467339",
"0.63705945",
"0.6054577",
"0.59893274",
"0.59517163",
"0.5943329",
"0.59202266",
"0.58056206",
"0.5757748",
"0.5723414",
"0.5719189",
"0.5718632",
"0.5707927",
"0.56753373",
"0.5625021",
"0.5619141",
"0.5554289",
"0.5542776"... | 0.8730237 | 0 |
Converts color(s) to the specified color type Takes a single color or an iterable of colors and outputs a list of the color(s) converted all to an rgb or tuple color type. If colors is a Plotly Scale name then the cooresponding colorscale will be outputted | def convert_dict_colors_to_same_type(colors, colortype='rgb'):
for key in colors:
if '#' in colors[key]:
colors[key] = color_parser(
colors[key], hex_to_rgb
)
colors[key] = color_parser(
colors[key], label_rgb
)
elif is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_colors_to_same_type(colors, colortype='rgb'):\n colors_list = []\n\n if isinstance(colors, str):\n if colors in PLOTLY_SCALES:\n return PLOTLY_SCALES[colors]\n elif 'rgb' in colors or '#' in colors:\n colors_list = [colors]\n else:\n raise exc... | [
"0.85662997",
"0.6990363",
"0.67474616",
"0.66939604",
"0.66461027",
"0.6259489",
"0.60896623",
"0.60689384",
"0.59838325",
"0.5879109",
"0.5820348",
"0.58060336",
"0.57990676",
"0.578778",
"0.57405794",
"0.5727918",
"0.56719625",
"0.5663443",
"0.56379896",
"0.5624054",
"0.56... | 0.74615693 | 1 |
Return a tuple where each element gets divided by 255 Takes a (list of) color tuple(s) where each element is between 0 and 255. Returns the same tuples where each tuple element is normalized to a value between 0 and 1 | def unconvert_from_RGB_255(colors):
un_rgb_color = (colors[0]/(255.0),
colors[1]/(255.0),
colors[2]/(255.0))
return un_rgb_color | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_RGB_255(colors):\n return (colors[0]*255.0, colors[1]*255.0, colors[2]*255.0)",
"def generate_normalized_rgb(self):\n \n r,g,b=(Numeric.zeros(256),Numeric.zeros(256),Numeric.zeros(256))\n for i in Numeric.arange(256):\n r_,g_,b_=self.colfct(i/255.0) # these ar... | [
"0.7387007",
"0.7329272",
"0.72662413",
"0.71194726",
"0.69531566",
"0.69138104",
"0.68012786",
"0.6800311",
"0.67782444",
"0.6737016",
"0.6626885",
"0.66244",
"0.66198385",
"0.654064",
"0.6540106",
"0.65297306",
"0.65292233",
"0.65098464",
"0.6484736",
"0.648232",
"0.6480925... | 0.6844516 | 6 |
Converts a colorscale into a list of colors | def colorscale_to_colors(colorscale):
color_list = []
for color in colorscale:
color_list.append(color[1])
return color_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_colorscale(colors, scale=None):\n colorscale = []\n\n # validate minimum colors length of 2\n if len(colors) < 2:\n raise exceptions.PlotlyError(\"You must input a list of colors that \"\n \"has at least two colors.\")\n\n if not scale:\n scale... | [
"0.7403445",
"0.6880691",
"0.6825099",
"0.6779631",
"0.66633695",
"0.6608235",
"0.66077864",
"0.6604994",
"0.66031563",
"0.6576544",
"0.64994454",
"0.6487098",
"0.64830196",
"0.64828354",
"0.6468766",
"0.6462795",
"0.64323926",
"0.6422903",
"0.6405151",
"0.63881737",
"0.63815... | 0.88714296 | 0 |
Sets the id of this Invoice. | def id(self, id):
self._id = id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.__id = id",
"def SetId(self, id):\n self.id = int(id)",
"def id(self, id: int):\n if id is None:\n raise ValueError(\"Invalid value for `id`, must not be `None`\") # noqa: E501\n\n self._i... | [
"0.7600149",
"0.7546821",
"0.7493094",
"0.72401494",
"0.7239182",
"0.72360134",
"0.7201842",
"0.71968675",
"0.71739244",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",
"0.7157821",... | 0.0 | -1 |
Sets the account_id of this Invoice. | def account_id(self, account_id):
self._account_id = account_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def account_id(self, account_id):\n self._account_id = account_id",
"def setAccount(self, account_id):\n self.data_struct['_setAccount'] = account_id",
"def account_id(self, account_id):\n if account_id is None:\n raise ValueError(\"Invalid value for `account_id`, must not be `N... | [
"0.81417274",
"0.797933",
"0.7322539",
"0.7272648",
"0.66879886",
"0.66879886",
"0.66879886",
"0.66879886",
"0.6639793",
"0.6568327",
"0.64952475",
"0.63927525",
"0.6270199",
"0.6093832",
"0.59998107",
"0.59998107",
"0.5957956",
"0.594924",
"0.5936459",
"0.5825439",
"0.581112... | 0.81816703 | 5 |
Sets the created_by of this Invoice. | def created_by(self, created_by):
self._created_by = created_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, created_by: \"str\"):\n self._attrs[\"createdBy\"] = created_by",
"def created_by(self, cre... | [
"0.77844715",
"0.77844715",
"0.77844715",
"0.77844715",
"0.7106459",
"0.70040953",
"0.68863076",
"0.66293925",
"0.6558995",
"0.6438006",
"0.6438006",
"0.6438006",
"0.6438006",
"0.6438006",
"0.6438006",
"0.6256636",
"0.62313765",
"0.62225956",
"0.62225956",
"0.62225956",
"0.62... | 0.8210472 | 4 |
Sets the created_on of this Invoice. | def created_on(self, created_on):
self._created_on = created_on | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_date(self, created_date):\n self._created_date = created_date",
"def created_date(self, created_date):\n\n self._created_date = created_date",
"def created_date(self, created_date):\n\n self._created_date = created_date",
"def created_date(self, created_date):\n\n self... | [
"0.6808776",
"0.6789699",
"0.6789699",
"0.6789699",
"0.6789699",
"0.6789699",
"0.6708881",
"0.67077106",
"0.6689685",
"0.6689685",
"0.66508824",
"0.66508824",
"0.66508824",
"0.6542428",
"0.6489087",
"0.6409075",
"0.63969123",
"0.63885856",
"0.63855606",
"0.63855606",
"0.63855... | 0.7875019 | 4 |
Sets the payment_id of this Invoice. | def payment_id(self, payment_id):
self._payment_id = payment_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payment_reference_id(self, payment_reference_id):\n\n self._payment_reference_id = payment_reference_id",
"def payment_type_id(self, payment_type_id):\n\n self._payment_type_id = payment_type_id",
"def payor_id(self, payor_id):\n\n self._payor_id = payor_id",
"def payment_date(self, ... | [
"0.7556409",
"0.6852017",
"0.6428344",
"0.62794644",
"0.62794644",
"0.6126047",
"0.5971838",
"0.589281",
"0.5844277",
"0.5777966",
"0.5700879",
"0.5618178",
"0.56067383",
"0.55602574",
"0.5533535",
"0.55216354",
"0.55216354",
"0.5521394",
"0.5469303",
"0.5469303",
"0.5419809"... | 0.85541546 | 0 |
Sets the paid of this Invoice. | def paid(self, paid):
self._paid = paid | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paid_interest(self, paid_interest):\n\n self._paid_interest = paid_interest",
"def transaction_amount_paid(self, transaction_amount_paid):\n\n self._transaction_amount_paid = transaction_amount_paid",
"def update_invoice_payment_status(self, invoice_id, paid=True):\n self._request('set... | [
"0.71118146",
"0.68751043",
"0.6470374",
"0.6076682",
"0.5806382",
"0.57565767",
"0.5673155",
"0.54964036",
"0.5486134",
"0.5443263",
"0.5386599",
"0.5372043",
"0.53404045",
"0.5311332",
"0.52929515",
"0.5218374",
"0.52046144",
"0.51996523",
"0.5167581",
"0.5143295",
"0.51186... | 0.851411 | 0 |
Sets the line_items of this Invoice. | def line_items(self, line_items):
self._line_items = line_items | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_item_id(self, line_item_id):\n\n self._line_item_id = line_item_id",
"def invoice_lines(self, invoice_lines):\n if self.local_vars_configuration.client_side_validation and invoice_lines is None: # noqa: E501\n raise ValueError(\"Invalid value for `invoice_lines`, must not be `N... | [
"0.6666923",
"0.6609244",
"0.64970934",
"0.6249937",
"0.6206147",
"0.60185146",
"0.5922748",
"0.58824813",
"0.5765157",
"0.570581",
"0.57036614",
"0.56830037",
"0.56592447",
"0.5638203",
"0.5607459",
"0.555337",
"0.5523017",
"0.5452432",
"0.54291415",
"0.5421177",
"0.5401261"... | 0.82457817 | 0 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, Invoice):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, Invoice):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Load a JSON file. Params ====== | def load_json(fpath):
with open(fpath, "r") as f:
return json.load(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(file_name):\n return json.load(open(file_name))",
"def load_json_data(filepath):\n with open(filepath,'r') as f:\n return json.load(f)",
"def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(json_f... | [
"0.80938023",
"0.80891216",
"0.7919483",
"0.7908465",
"0.7893987",
"0.788293",
"0.7835652",
"0.7806246",
"0.7806246",
"0.7792857",
"0.77920884",
"0.77859575",
"0.7730966",
"0.7729283",
"0.77256244",
"0.77043283",
"0.7686077",
"0.76677114",
"0.7661505",
"0.76507187",
"0.764839... | 0.77560073 | 12 |
Load a JSON file. Params ====== | def main(args):
replace_ipynb(args.root) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(file_name):\n return json.load(open(file_name))",
"def load_json_data(filepath):\n with open(filepath,'r') as f:\n return json.load(f)",
"def load_json(file_path):\n\n \n with open(file_path, 'r') as json_file:\n # print(file_path)\n dictionary = json.loads(json_f... | [
"0.80938023",
"0.80891216",
"0.7919483",
"0.7908465",
"0.7893987",
"0.788293",
"0.7835652",
"0.7806246",
"0.7806246",
"0.7792857",
"0.77920884",
"0.77859575",
"0.77560073",
"0.7730966",
"0.7729283",
"0.77256244",
"0.77043283",
"0.7686077",
"0.76677114",
"0.7661505",
"0.765071... | 0.0 | -1 |
Normalise a 2D vector, i.e. return a vector in the same direction as the vector between a and b but with unit length | def normalise(a, b):
dy = b[1] - a[1]
dx = b[0] - a[0]
vector = (dy ** 2 + dx ** 2) ** 0.5
# Normalise, round and cast to int
dx = int(round(dx / vector))
dy = int(round(dy / vector))
return (dx, dy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(v):\n return v / np.linalg.norm(v)",
"def normalize(vector):\n return vector / np.linalg.norm(vector)",
"def normalize(v):\n return np.array(v) / np.linalg.norm(v)",
"def normalize2(vec,norm=1.0):\n vec = check_numpy_array(vec)\n vel = numpy.sqrt(numpy.dot(vec,vec))\n out ... | [
"0.75288063",
"0.7473549",
"0.73827386",
"0.73801214",
"0.7368384",
"0.73165053",
"0.73080987",
"0.7274887",
"0.7274887",
"0.7274887",
"0.72695774",
"0.72375256",
"0.72375256",
"0.72375256",
"0.72375256",
"0.72375256",
"0.72375256",
"0.72375256",
"0.72375256",
"0.72375256",
"... | 0.7942017 | 0 |
remove accented characters from text, e.g. cafe | def remove_accented_chars(text):
text = unidecode.unidecode(text)
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_accented_chars(text):\n text = unicodedata.normalize('NFKD', text).encode('ascii', 'ignore').decode('utf-8', 'ignore')\n return text",
"def strip_accents(text):\n text = unicodedata.normalize(\"NFD\", text)\n text = text.encode(\"ascii\", \"ignore\")\n text = text.decode(\"utf8\")\n ... | [
"0.87563145",
"0.85978603",
"0.84717906",
"0.84188145",
"0.8363904",
"0.8361153",
"0.83502066",
"0.83387655",
"0.8292097",
"0.80897015",
"0.7587782",
"0.7556356",
"0.7527288",
"0.7492908",
"0.7446902",
"0.74296635",
"0.73600036",
"0.7347273",
"0.733698",
"0.73206484",
"0.7300... | 0.8858065 | 0 |
Initialize the card with number and suit . | def __init__(self, number: str, suit: str) -> None:
self.number = number
self.suit = suit | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, suit: str, rank: str) -> None:\n self.suit = suit\n self.rank = rank\n self.value = Card.values[rank]\n self.hidden = False",
"def __init__(self, value, suit):\n self.value = value # A,2,3,4,5,6,7,8,9,10,J,Q, or K\n self.suit = suit # heart... | [
"0.7528525",
"0.73660344",
"0.7156633",
"0.7154676",
"0.7145494",
"0.71165603",
"0.7092519",
"0.7069209",
"0.70430064",
"0.7041722",
"0.7021801",
"0.70205426",
"0.6995803",
"0.6955573",
"0.68873024",
"0.68510544",
"0.68427217",
"0.68377465",
"0.6810783",
"0.67761075",
"0.6771... | 0.7873357 | 0 |
Return True iff this Card is equal to . Two cards are equal if they have the same number. | def __eq__(self, other: Card) -> bool:
return compare_map[self.number] == compare_map[other.number] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other_card):\n if self.rank == other_card.rank or self.suit == other_card.suit:\n return True\n else:\n return False",
"def __eq__(self, card2):\n return self.suit == card2.suit and self.rank == card2.rank",
"def __eq__(self, other):\n if isinstanc... | [
"0.7612709",
"0.75479436",
"0.7260245",
"0.6907878",
"0.6863286",
"0.6807668",
"0.6774836",
"0.6756191",
"0.6696493",
"0.66882545",
"0.66715086",
"0.666661",
"0.66569376",
"0.6618338",
"0.66104877",
"0.65573585",
"0.65283895",
"0.65015894",
"0.6491595",
"0.6468011",
"0.646335... | 0.7656766 | 0 |
Return True iff this Card is not equal to . | def __ne__(self, other: Card) -> bool:
return not self.__eq__(other) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other):\n return not (self == other) # opposite of __eq__",
"def __ne__(self, ... | [
"0.7235088",
"0.7212215",
"0.71886444",
"0.7183595",
"0.7164907",
"0.71528524",
"0.7146346",
"0.7145354",
"0.7144223",
"0.71398425",
"0.7127878",
"0.7127878",
"0.71206003",
"0.71206003",
"0.7111732",
"0.7107056",
"0.7107056",
"0.7107056",
"0.7103229",
"0.70888424",
"0.7088842... | 0.85990524 | 0 |
Check if 2 grids are equal return boolean value | def grid_equal(grid1, grid2):
for i in range(len(grid1)):
for j in range(len(grid1[i])):
if grid1[i][j] != grid2[i][j]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grid_equal (grid1, grid2):\r\n if grid1 == grid2:\r\n return True\r\n else:\r\n return False",
"def grid_equal (grid1, grid2):\r\n if grid1 == grid2:\r\n return True\r\n return False",
"def grid_equal (grid1, grid2):\r\n for i in range (4):\r\n for j in range (4):... | [
"0.89347094",
"0.8916087",
"0.87047255",
"0.8559624",
"0.82122976",
"0.80740815",
"0.79240525",
"0.78835154",
"0.78444386",
"0.7505653",
"0.74689347",
"0.74685746",
"0.74685746",
"0.7435515",
"0.74187225",
"0.73936117",
"0.7214343",
"0.71721923",
"0.71600556",
"0.71267986",
"... | 0.85525453 | 4 |
Returns model specific evaluation metric Tensor Op | def _get_eval_metric(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_eval_metric(self):\n self._validate_eval_metric()\n if isinstance(self.eval_metric, types.FunctionType):\n UserDefinedEvalMetric().set_metric(self.eval_metric)\n return \"user_defined_metric\"\n\n if self.eval_metric == \"auto\":\n if self._get_ml_task... | [
"0.71054876",
"0.696161",
"0.6865393",
"0.66233003",
"0.63560545",
"0.62732697",
"0.625372",
"0.623171",
"0.6199923",
"0.6142185",
"0.6134862",
"0.60356164",
"0.6028207",
"0.60053974",
"0.59840226",
"0.59722537",
"0.5968629",
"0.59548897",
"0.59189445",
"0.58827394",
"0.58806... | 0.68792844 | 2 |
Returns model specific Optimizer Op | def _get_optimizer(self):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimize_op(self):\n return self._optimize_op",
"def optimizer(self):\n return 'sgd'",
"def name(self) -> str:\n return \"UnnamedOptimizer\"",
"def get_training_op(self, graph, loss):\n with graph.as_default():\n opt = model_ops.optimizer(self.optimizer, self.learning_rate,\n ... | [
"0.6705821",
"0.6388277",
"0.6356156",
"0.6339564",
"0.6310742",
"0.63095725",
"0.6261288",
"0.6260692",
"0.6243419",
"0.6225094",
"0.6170032",
"0.61623156",
"0.61623156",
"0.6154761",
"0.6088127",
"0.60804594",
"0.60618514",
"0.6046481",
"0.6039586",
"0.6035075",
"0.6008412"... | 0.68825114 | 0 |
Gets the variables state of the model and stores them in a json | def _log_params(self):
params_path = os.path.join(self._log_dir, self._name + "params.json")
logger.info("Writing params to {}".format(params_path))
params = [(str(k),str(v)) for k,v in self.__dict__.items()]
with open(params_path, 'w') as params_file:
json.dump(dict(param... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_variables(self):\n\t\treturn self.variables",
"def get_variables(self):\n return self.variables",
"def variables(self):\n if save_context.in_save_context():\n return [self._vars[0]]\n return self._vars",
"def savable_variables(self):\n return tf.global_variables()",
"def get_st... | [
"0.68796384",
"0.65980077",
"0.6465097",
"0.64610004",
"0.6439466",
"0.64263695",
"0.6419049",
"0.6342331",
"0.63338286",
"0.63082534",
"0.6304701",
"0.6275162",
"0.623656",
"0.6221415",
"0.6211878",
"0.6205348",
"0.61984247",
"0.61697465",
"0.616644",
"0.61361706",
"0.611333... | 0.0 | -1 |
Create a new OneNote notebook. | def add(self, display_name):
return super(NotebookCollection, self).add(displayName=display_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new(notebook, note):\n nb = select_notebook(notebook)\n if nb is None:\n echo('The notebook `{0}` doesn\\'t exist.'.format(notebook))\n return\n\n # Assume Markdown if no ext specified.\n _, ext = os.path.splitext(note)\n if not ext: note += '.md'\n\n path = os.path.join(nb.path... | [
"0.7738977",
"0.74216247",
"0.74009854",
"0.68847376",
"0.67615104",
"0.66890067",
"0.66216636",
"0.6532857",
"0.64851356",
"0.63531256",
"0.6308573",
"0.6308573",
"0.6263171",
"0.6229068",
"0.61772144",
"0.6145046",
"0.60621923",
"0.60530245",
"0.60300845",
"0.59948564",
"0.... | 0.0 | -1 |
Private method that maps the columns in the file to an integer index | def __get_column_mapping(self):
s1 = list(Sample("FL", "M1.0@265_Primary_ar115_s2010-08-06T06_36_00_e2010-08-06T18_24_00.csv").get_data().columns)[:25]
column_mapping = {}
for i in range(len(s1)):
column_mapping[i] = s1[i]
return column_mapping | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getColumnIndices(*args, filepath=\"CO2.tab\"):\n # idxDict = {\"PT\": 0, \"TM\": 0, \"HG\": 0, \"SEG\": 0}\n idxDict = {\"PT\": 0, \"TM\": 0, \"HG\": 0, \"VISG\": 0, \"VISHL\": 0, \"ROG\": 0, \"ROHL\": 0}\n if filepath:\n cols = tabLineToList(readFullLine(filepath, 52))\n for key in idxDict:... | [
"0.723523",
"0.71931326",
"0.6832925",
"0.6541179",
"0.64789474",
"0.6454937",
"0.6378162",
"0.6371237",
"0.6311819",
"0.62832546",
"0.6266667",
"0.6175116",
"0.6156575",
"0.61557454",
"0.6151977",
"0.6144335",
"0.6132116",
"0.6121597",
"0.60919446",
"0.602414",
"0.6006897",
... | 0.55434483 | 68 |
Takes in short_ratings dataframe, group by perfume id, return a dictionary with perfume id as key, all short comments of that perfume as values | def short_comments_df(short_ratings_df):
scomments = defaultdict(list)
for pid in short_ratings_df['perfume_id'].unique():
df = short_ratings_df[(short_ratings_df['perfume_id'] == pid)]
for c in df['short_comment']:
scomments[pid].append(c)
stacked = pd.DataFrame.from_dict(scomme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine_comments(short_comments_df, long_comments_df):\n long_comments_df.set_index('perfume_id', inplace=True)\n long_comments_df['long_comments'] = long_comments_df['comments'].apply(','.join)\n all_comments = pd.merge(short_comments_df, long_comments_df, how='left', left_index=True, right_index=Tru... | [
"0.5101397",
"0.49811336",
"0.4974245",
"0.49642193",
"0.49578878",
"0.4908577",
"0.48813957",
"0.48355108",
"0.480407",
"0.47856924",
"0.4760423",
"0.4748922",
"0.47381297",
"0.47011238",
"0.46939063",
"0.46722868",
"0.46702626",
"0.4661651",
"0.46464935",
"0.46265265",
"0.4... | 0.82146406 | 0 |
Get the register type. | def register_type(self) -> str:
return self._register_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reg_def_type(self) -> str:\n return self._reg_def_type",
"def get_type(self) -> str:\n # Note: this name conflicts with existing python builtins\n return self[\"Type\"]",
"def get_type(self) -> str:\n return self.type",
"def get_type(self):\n return self._type",
"def ... | [
"0.747045",
"0.69853294",
"0.69776267",
"0.69538915",
"0.69538915",
"0.6948132",
"0.6948132",
"0.6936758",
"0.68779194",
"0.68646145",
"0.68296516",
"0.6800975",
"0.67360306",
"0.67140883",
"0.67138606",
"0.6661503",
"0.6659335",
"0.6652948",
"0.6642877",
"0.6642877",
"0.6605... | 0.781765 | 0 |
Create ROOT TH1 filled with a Gaussian distribution | def makeTH1(name,mean,sigma):
hist = TH1D(name,name,100,-10,10)
for i in range(1000):
hist.Fill(gRandom.Gaus(mean,sigma))
return hist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gaussian_distribution(self, x: ndarray, mu: float, sigma: float) -> ndarray:\n return 1 / (np.sqrt(2 * np.pi) * sigma) * np.exp(\n -np.power(\n (x - mu) / sigma, 2) / 2)",
"def test_gaussian_basis_hon(self):\n def row_generator():\n return [random.gauss(0, ... | [
"0.6476005",
"0.6419681",
"0.6398783",
"0.63678724",
"0.62925464",
"0.62547433",
"0.6178954",
"0.61453617",
"0.61378396",
"0.61306834",
"0.61133933",
"0.60898346",
"0.6083299",
"0.60644",
"0.6018058",
"0.5996053",
"0.5984178",
"0.59570616",
"0.59489834",
"0.5938205",
"0.59102... | 0.729309 | 0 |
Convert a list of strings into a tf.Example. | def convert_instance_to_tf_example(tokenizer, sent_tokens, max_sent_length,
max_para_length):
input_ids_list = [
tokenizer.convert_tokens_to_ids(tokens) for tokens in sent_tokens
]
features = collections.OrderedDict()
# pack or trim sentences to max_sent_length
# pac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_example(example,\n tokenizer,\n label_list,\n max_seq_length=512,\n is_test=False):\n if not is_test:\n # `label_list == None` is for regression task\n label_dtype = \"int64\" if label_list else \"float32\"\n ... | [
"0.6750633",
"0.6705025",
"0.6624028",
"0.6606941",
"0.65753984",
"0.64643246",
"0.6440046",
"0.6437968",
"0.64069235",
"0.6348529",
"0.63305575",
"0.6329963",
"0.631944",
"0.6287436",
"0.62661815",
"0.6256302",
"0.62322795",
"0.61961937",
"0.61571527",
"0.61292535",
"0.61291... | 0.0 | -1 |
Create a spark session for the project to interact with various spark's functionality | def create_spark_session():
spark = SparkSession \
.builder \
.config("spark.jars.packages", "org.apache.hadoop:hadoop-aws:2.7.0") \
.getOrCreate()
return spark | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_sparksession():\n return SparkSession.builder.\\\n appName(\"Transforming the historical parking occupancy and blockface datasets\").\\\n getOrCreate()",
"def create_spark_session():\n return SparkSession.builder \\\n .appName(\"Dataframe Reader\") \\... | [
"0.8580574",
"0.8204687",
"0.8164546",
"0.8160139",
"0.8059125",
"0.80583256",
"0.8045966",
"0.8045966",
"0.8045966",
"0.8045966",
"0.8024192",
"0.80131125",
"0.8006901",
"0.7943525",
"0.7921983",
"0.79204345",
"0.7911685",
"0.791123",
"0.7887828",
"0.7794173",
"0.7564952",
... | 0.8024196 | 13 |
All the logic to move, and the game logic goes here. Normally, you'll call update() on the sprite lists that need it. | def on_update(self, delta_time):
self.physics_engine.update()
self.physics_engine2.update()
# See if we hit any apples
apple_hit_list = arcade.check_for_collision_with_list(self.player_sprite,
self.apple_list)
# Loop ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_logic(self):\n if not self.game_over:\n # Move all the sprites\n self.all_sprites_list.update()",
"def update(self):\n self.moving_sprites.update() \n self.static_sprites.update()\n self.camera.update(self.player)",
"def update(self):\r\n if self... | [
"0.8133112",
"0.75657123",
"0.7411846",
"0.7386061",
"0.7197449",
"0.7155682",
"0.71433836",
"0.71139944",
"0.7048409",
"0.7021325",
"0.6957522",
"0.6953524",
"0.69499093",
"0.6881818",
"0.67385006",
"0.673602",
"0.6731394",
"0.6702488",
"0.66944313",
"0.6693237",
"0.66910195... | 0.0 | -1 |
r"""ResNet V1 model from `"Deep Residual Learning for Image Recognition" | def get_resnet(version, num_layers, **kwargs):
assert num_layers in resnet_spec, "Invalid number of layers: %d. Options are %s"%( num_layers, str(resnet_spec.keys() ))
block_type, layers, channels = resnet_spec[num_layers]
assert version >= 1 and version <= 2, "Invalid resnet version: %d. Options are 1 and ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resnet():\n return models.resnet152(pretrained=True)",
"def resnet_v1(input_shape, depth, num_classes=10,input_tensor=None):\n if (depth - 2) % 6 != 0:\n raise ValueError('depth should be 6n+2 (eg 20, 32, 44 in [a])')\n # Start model definition.\n num_filters = 16\n num_res_blocks = int... | [
"0.7365767",
"0.6957699",
"0.690873",
"0.6836464",
"0.6780612",
"0.6752202",
"0.6705754",
"0.6705754",
"0.6705754",
"0.6705754",
"0.6699111",
"0.66834813",
"0.66672003",
"0.6645697",
"0.6642539",
"0.6640137",
"0.66045165",
"0.65721655",
"0.6571693",
"0.6519657",
"0.6493308",
... | 0.0 | -1 |
Turn to a certain direction | def turn(self, direction, map_direction, gyro_angle):
initial_angle = gyro_angle.value
start_frequency = 150
max_frequency = 300
add = 0
# Change the wheel spinning direction to spin in place
direction_pin = "DirectionMotor" + str(direction)
GPIO.output(pins[dir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn(self, dir):\n if dir.upper() == 'R':\n if self.direction == 3:\n self.direction = 0\n else:\n self.direction += 1\n if dir.upper() == 'L':\n if self.direction == 0:\n self.direction = 3\n else:\n ... | [
"0.8370708",
"0.7450915",
"0.7384818",
"0.73715746",
"0.7348913",
"0.7337406",
"0.7217971",
"0.7217971",
"0.7213739",
"0.7211227",
"0.71767324",
"0.71410054",
"0.71279013",
"0.70745105",
"0.70744413",
"0.7068399",
"0.70243233",
"0.7011851",
"0.6996565",
"0.698688",
"0.6984145... | 0.0 | -1 |
Decide the direction to turn in relative to the robot | def decide_turn_direction(self, next_direction):
# if facing backwards, try to initially go forwards.
if GPIO.input(pins["DirectionMotorRight"]):
GPIO.output(pins["DirectionMotorRight"], GPIO.LOW)
GPIO.output(pins["DirectionMotorLeft"], GPIO.HIGH)
self.facing = not s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getRobotDirection(self):\n return self.direction",
"def getRobotDirection(self):\n return self.direction",
"def getRobotDirection(self):\n return self.direction\n #raise NotImplementedError",
"def getRobotDirection(self):\n return self.direction\n #raise NotImple... | [
"0.74904394",
"0.74904394",
"0.7332256",
"0.7332256",
"0.72943324",
"0.7208709",
"0.7078935",
"0.6999339",
"0.69108695",
"0.683539",
"0.683539",
"0.682298",
"0.68122977",
"0.6782501",
"0.6759455",
"0.6738724",
"0.673538",
"0.6731321",
"0.6728323",
"0.67067975",
"0.67028403",
... | 0.6882379 | 9 |
Calculates the euclidean distance from any point (x,y) given in map_x object towards its sourrounding neighbour points, which are cointained in map_x.roads. | def _euclidean_dist_loc(map_x: object) -> dict:
local_distance = {}
for node, connections in enumerate(map_x.roads):
nx, ny = map_x.intersections[node]
for connection in connections:
cx, cy = map_x.intersections[connection]
distance = math.sqrt( (nx-cx)**2 + (ny-cy)*... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _euclidean_dist_glob(map_x: object, goal: int) -> dict:\n \n global_distance = {}\n xg, yg = map_x.intersections[goal]\n for node, (xn, yn) in map_x.intersections.items():\n distance = math.sqrt( (xg-xn)**2 + (yg-yn)**2 )\n global_distance[node] = distance\n return global_distance"... | [
"0.65643346",
"0.64513713",
"0.63841766",
"0.6373166",
"0.63397765",
"0.632415",
"0.63126475",
"0.6276056",
"0.6257271",
"0.6233553",
"0.6184884",
"0.61683863",
"0.61064583",
"0.6104228",
"0.6098429",
"0.6084753",
"0.6070217",
"0.606662",
"0.605188",
"0.6041738",
"0.60360974"... | 0.7578011 | 0 |
Calculates the underestimated (minimum) euclidean distance from any point (x,y) given in map_x object towards a specified goal point. Required to guarantee for As "greedybestfirstsearch" paradigm, leading to an expansion of nodes / intersections first that are closest by euclidean distance towards the target. Calculate... | def _euclidean_dist_glob(map_x: object, goal: int) -> dict:
global_distance = {}
xg, yg = map_x.intersections[goal]
for node, (xn, yn) in map_x.intersections.items():
distance = math.sqrt( (xg-xn)**2 + (yg-yn)**2 )
global_distance[node] = distance
return global_distance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heuristic(self, root, goal):\n\n dx = abs(root.row - goal.row)\n dy = abs(root.col - goal.col)\n\n return dx + dy",
"def closest_points_naive(self, x, y):\r\n # Running time: O(n ** 2)\r\n\r\n dist = []\r\n for i in range(len(x)):\r\n for j in range(i+1, l... | [
"0.6320026",
"0.6279764",
"0.62364215",
"0.62341315",
"0.62137204",
"0.6174377",
"0.6172368",
"0.6059483",
"0.5937916",
"0.59054124",
"0.5901431",
"0.5892355",
"0.5884345",
"0.5874521",
"0.5860715",
"0.58527696",
"0.5846171",
"0.5805825",
"0.57953364",
"0.5785152",
"0.5783859... | 0.68145263 | 0 |
Get a list of recommended movies for a movie. | def recommendations(self, **kwargs):
path = self._get_movie_id_path('recommendations')
resp = self._get_method(path, kwargs)
return resp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _recommend_movie(user_id, movie_id, number_movies):\n #get the recommended movie ids from pickled model\n rec_movies = sparkrecommender.movie_recomendation(user_id,movie_id,number_movies)\n #get a list of movies ids used in model\n moviesdf = pd.read_csv('movies.csv',index_col='movieId')\n \n ... | [
"0.73985803",
"0.6672902",
"0.645852",
"0.6243045",
"0.62020135",
"0.6198806",
"0.61174536",
"0.6091463",
"0.60607594",
"0.60475534",
"0.6009142",
"0.5997928",
"0.5970934",
"0.5939982",
"0.59363353",
"0.5931252",
"0.59142596",
"0.59080803",
"0.5892634",
"0.5892084",
"0.589135... | 0.7109265 | 1 |
Get the release date along with the certification for a movie. | def release_dates(self, **kwargs):
path = self._get_movie_id_path('release_date')
resp = self._get_method(path, kwargs)
return resp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getYear(movieInfo):\n if \"release_date\" in movieInfo:\n date = movieInfo[\"release_date\"]\n if (date != '') :\n return datetime.strptime(date, \"%Y-%m-%d\").year\n else:\n return 0\n else:\n raise AttributeError(\"%s instance has no attribute release_d... | [
"0.6711595",
"0.6563982",
"0.64657223",
"0.63099766",
"0.5776768",
"0.5712398",
"0.5589539",
"0.54743624",
"0.54603285",
"0.54441214",
"0.5390347",
"0.53358847",
"0.5330151",
"0.53233296",
"0.53077465",
"0.5286131",
"0.52525586",
"0.5208864",
"0.5191374",
"0.51776975",
"0.516... | 0.6041648 | 4 |
Get a list of similar movies. This is not the same as the "Recommendation" system you see on the website. These items are assembled by looking at keywords and genres. | def similar_movies(self, **kwargs):
path = self._get_movie_id_path('similar')
resp = self._get_method(path, kwargs)
return resp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _similar_movies(v, bad_movies=[], n=50):\n if bad_movies:\n v = _remove_dislikes(bad_movies, v, harshness=harshness)\n return clf.similar_by_vector(v, topn= n+1)[1:]",
"def similar_movie(movie_title, names_list):\n # covert movie features into count vector\n df = re... | [
"0.755968",
"0.72411406",
"0.70853955",
"0.70113343",
"0.6952319",
"0.69393384",
"0.6935728",
"0.6593501",
"0.6556901",
"0.6550072",
"0.6541409",
"0.6517391",
"0.6480606",
"0.6369751",
"0.6365865",
"0.6358237",
"0.6357587",
"0.6327551",
"0.6272381",
"0.6240926",
"0.62189424",... | 0.7812552 | 0 |
Get the most newly created movie. This is a live response and will continuously change. | def latest(self, **kwargs):
path = self._get_movie_id_path('latest')
resp = self._get_method(path, kwargs)
return resp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetRecentMovies(self, limit=5):\n self.logger.debug(\"Fetching recently added movies\")\n try:\n xbmc = Server(self.url('/jsonrpc', True))\n properties = ['title', 'year', 'runtime', 'plot', 'thumbnail', 'file',\n 'fanart', 'trailer', 'imdbnumber', '... | [
"0.6575423",
"0.64725035",
"0.6254452",
"0.6004162",
"0.59428036",
"0.59235334",
"0.5907708",
"0.5906305",
"0.5878865",
"0.5789607",
"0.5760728",
"0.57403165",
"0.5711764",
"0.5682661",
"0.56659967",
"0.56649077",
"0.55827975",
"0.5544352",
"0.5531881",
"0.5531181",
"0.552466... | 0.67123926 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.