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 |
|---|---|---|---|---|---|---|
r"""pc_work_time_avg(randomsampler_sptr self) > float | def pc_work_time_avg(self) -> "float":
return _beamforming_swig.randomsampler_sptr_pc_work_time_avg(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pc_work_time_avg(self) -> \"float\":\n return _beamforming_swig.beamformer_sptr_pc_work_time_avg(self)",
"def pc_work_time_avg(self) -> \"float\":\n return _beamforming_swig.phasedarray_sptr_pc_work_time_avg(self)",
"def pc_work_time_avg(self) -> \"float\":\n return _beamforming_swig.d... | [
"0.819452",
"0.79933697",
"0.7979681",
"0.74716705",
"0.74663895",
"0.74439305",
"0.7429747",
"0.7397048",
"0.7363024",
"0.73322797",
"0.732198",
"0.7310387",
"0.730075",
"0.7259512",
"0.72591794",
"0.72584355",
"0.7146232",
"0.7108129",
"0.7098413",
"0.70819485",
"0.7068522"... | 0.869549 | 0 |
r"""pc_throughput_avg(randomsampler_sptr self) > float | def pc_throughput_avg(self) -> "float":
return _beamforming_swig.randomsampler_sptr_pc_throughput_avg(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pc_throughput_avg(self) -> \"float\":\n return _beamforming_swig.beamformer_sptr_pc_throughput_avg(self)",
"def pc_throughput_avg(self) -> \"float\":\n return _beamforming_swig.doaesprit_sptr_pc_throughput_avg(self)",
"def pc_throughput_avg(self) -> \"float\":\n return _beamforming_swi... | [
"0.7972623",
"0.7756988",
"0.7735128",
"0.7093949",
"0.7036483",
"0.6978328",
"0.68995243",
"0.68768096",
"0.6874852",
"0.68282914",
"0.6814054",
"0.6794002",
"0.6752893",
"0.6712535",
"0.66841036",
"0.6668931",
"0.6590327",
"0.658475",
"0.6579107",
"0.65499014",
"0.6546117",... | 0.8469719 | 0 |
r"""message_ports_out(randomsampler_sptr self) > swig_pmt_ptr | def message_ports_out(self) -> "pmt::pmt_t":
return _beamforming_swig.randomsampler_sptr_message_ports_out(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_ports_out(self) -> \"pmt::pmt_t\":\n return _beamforming_swig.doaesprit_sptr_message_ports_out(self)",
"def message_ports_out(self) -> \"pmt::pmt_t\":\n return _beamforming_swig.beamformer_sptr_message_ports_out(self)",
"def message_ports_out(self) -> \"pmt::pmt_t\":\n return _... | [
"0.7828717",
"0.7714449",
"0.7631163",
"0.74229515",
"0.73827976",
"0.726553",
"0.7235539",
"0.7193533",
"0.7183756",
"0.7157526",
"0.7148849",
"0.710894",
"0.70927835",
"0.7074927",
"0.70585597",
"0.70409185",
"0.7029286",
"0.69865817",
"0.69438195",
"0.6911576",
"0.68381834... | 0.86127365 | 0 |
Get the length of the dataset | def __len__(self):
length = len(self.data) - 2* self.skip_window
#print ('length', length)
return length
#raise NotImplementedError('Implement the __len__ method of the dataset')
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __len__(self):\n return self.dataset.shape[0]",
"def __len__(self):\n return self._dataset.size(dirs=self._dirs)",
"def __len__(self):\n return len(self.dataset)",
"def __len__(self):\n return self.data.num_samples",
"def __len__(self):\n\t\treturn min(len(self.dataset), sel... | [
"0.84423757",
"0.8413128",
"0.83421916",
"0.82973254",
"0.8207219",
"0.81764525",
"0.81082726",
"0.8073012",
"0.80676347",
"0.80647767",
"0.8061671",
"0.8061671",
"0.8061671",
"0.8057673",
"0.8030924",
"0.7995581",
"0.7990975",
"0.79832274",
"0.79832274",
"0.79832274",
"0.798... | 0.82494926 | 4 |
Return the URL path without GET parameters. Removes the trailing slash if there is one. | def path_only(self):
path = six.moves.urllib.parse.urlparse(self.path).path
if path.endswith('/'):
return path[:-1]
else:
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_only(self):\r\n path = urlparse.urlparse(self.path).path\r\n if path.endswith('/'):\r\n return path[:-1]\r\n else:\r\n return path",
"def noTrailingSlash(path):\n return path.split('/')[0]",
"def strip_path(self):\n return self.path.replace('/',... | [
"0.7569803",
"0.7356835",
"0.72801304",
"0.6873437",
"0.6775136",
"0.6712719",
"0.6670214",
"0.64691347",
"0.64686984",
"0.64268315",
"0.63855267",
"0.63347805",
"0.63065624",
"0.63022286",
"0.63006824",
"0.6228363",
"0.61978376",
"0.6174845",
"0.6172871",
"0.61670554",
"0.61... | 0.7435135 | 1 |
Test retrieving a list of ingredients | def test_retreive_ingredients_list(self):
Ingredients.objects.create(user=self.user, name='Kale')
Ingredients.objects.create(user=self.user, name='Carrot')
res = self.client.get(INGREDIENT_URL)
ingredients = Ingredients.objects.all().order_by('-name')
serializer = IngredientSer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_retrieve_ingredient_list(self):\n # sample ingredients\n Ingredient.objects.create(user=self.user, name='Potato')\n Ingredient.objects.create(user=self.user, name='Salt')\n\n response = self.client.get(INGREDIENTS_URL)\n\n ingredients = Ingredient.objects.all().order_by(... | [
"0.81821436",
"0.81327397",
"0.8122187",
"0.80485064",
"0.7958878",
"0.79069877",
"0.7906716",
"0.77825475",
"0.7762671",
"0.7657054",
"0.73742056",
"0.73425686",
"0.73395693",
"0.7306794",
"0.729159",
"0.7264492",
"0.72321564",
"0.7187532",
"0.713832",
"0.7133489",
"0.712752... | 0.82356113 | 0 |
test that only ingredients for the authenticated user are returned | def test_ingredients_limited_to_user(self):
user2 = get_user_model().objects.create_user(
'zohaib@123.com',
'zohaib123'
)
Ingredients.objects.create(user=user2, name='Vinegar')
ingredient = Ingredients.objects.create(
user=self.user, name=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_login_required_to_retrieve_ingredients(self):\n\n # Retrieve the ingredients belonging to user.\n response = self.client.get(URL_INGREDIENTS)\n\n self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)",
"def test_ingredients_limited_to_authenticated_user(self):\n\n ... | [
"0.7983234",
"0.7935168",
"0.7769101",
"0.7721603",
"0.7590096",
"0.7536502",
"0.73960096",
"0.73218113",
"0.7297385",
"0.7245279",
"0.72398764",
"0.7184505",
"0.71703583",
"0.71263367",
"0.7112988",
"0.709982",
"0.70998126",
"0.70788497",
"0.7043391",
"0.7025247",
"0.7020587... | 0.7647475 | 4 |
test that a invalid ingredient fails | def test_create_ingredient_invalid(self):
payload = {
'name': ''
}
res = self.client.post(INGREDIENT_URL, payload)
self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_ingredient_invalid(self):\n payload = {'name': ''}\n res = self.client.post(INGREDIENTS_URL, payload)\n\n self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)",
"def test_create_ingredient_invalid(self):\n\n payload = {'name': ''}\n\n res = self.client... | [
"0.7598517",
"0.7537379",
"0.7478667",
"0.7314315",
"0.7013902",
"0.6971008",
"0.6907249",
"0.66922617",
"0.6649067",
"0.6575912",
"0.65405315",
"0.64642555",
"0.644424",
"0.64380974",
"0.63848114",
"0.6326494",
"0.632599",
"0.62801594",
"0.62690735",
"0.6251324",
"0.6218282"... | 0.7524117 | 2 |
test filtering ingredients assigned to recipes | def test_retrieve_ingredients_assigned_to_recipes(self):
ingredient1 = Ingredients.objects.create(
user=self.user,
name='Breakfast'
)
ingredient2 = Ingredients.objects.create(user=self.user, name='Dinner')
recipe = Recipe.objects.create(
title='bir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_recipes_by_ingredients(self):\n pass",
"def test_filter_recipes_by_ingredients(self):\n recipe1 = sample_recipe(self.user, title='Waxy box')\n recipe2 = sample_recipe(self.user, title='Waxy noodle beans')\n ingredient1 = sample_ingredient(self.user, name='box')\n ... | [
"0.8489296",
"0.82127094",
"0.82007277",
"0.8110339",
"0.80544484",
"0.7994452",
"0.7825007",
"0.7818962",
"0.7710148",
"0.7430049",
"0.742214",
"0.74124473",
"0.7401191",
"0.73281574",
"0.7291974",
"0.72561693",
"0.7212767",
"0.6992358",
"0.6955232",
"0.69534856",
"0.6913464... | 0.66473436 | 43 |
Return unique ingredients assigned to recipes | def test_retrive_ingredients_assigned_to_unique(self):
ingredient = Ingredients.objects.create(user=self.user, name='supper')
Ingredients.objects.create(user=self.user, name='meetha')
recipe1 = Recipe.objects.create(
title='aloo matar',
time_minutes=15,
price... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filtered_ingredients_unique(self):\n ing = Ingredient.objects.create(user=self.user, name='Eggs')\n Ingredient.objects.create(user=self.user, name='Lentils')\n recipe1 = Recipe.objects.create(\n title='Eggs Benedict',\n time_minutes=60,\n price=Decimal... | [
"0.66768235",
"0.6618776",
"0.659632",
"0.65622914",
"0.6519944",
"0.65160143",
"0.6397091",
"0.6236369",
"0.6219199",
"0.6202294",
"0.6181134",
"0.61147386",
"0.61017096",
"0.60780233",
"0.606943",
"0.6012362",
"0.5992329",
"0.5989785",
"0.5978149",
"0.5960314",
"0.5951353",... | 0.67642385 | 0 |
Open a file and return a list that contains every line fileName The file's name return a list that contains every line | def getFileContent(fileName):
with open(fileName, "r") as targets:
lines = targets.readlines()
i = 0
#Remove the \n
for line in lines:
lines[i] = line.rstrip()
i += 1
return lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_file(file_name):\r\n try: \r\n with open(file_name, mode='r') as file: \r\n lines = file.readlines()\r\n except OSError:\r\n print(\"file\", file_name, \"not found.\")\r\n file_lines = []\r\n for line in lines:\r\n file_lines.append(line)\r\n return file_... | [
"0.77080405",
"0.76158893",
"0.76098645",
"0.75761116",
"0.757366",
"0.75579274",
"0.752743",
"0.7460342",
"0.7454724",
"0.7397872",
"0.73758143",
"0.73436236",
"0.733525",
"0.7308504",
"0.73002225",
"0.72601277",
"0.72414505",
"0.7224228",
"0.72173065",
"0.7216526",
"0.72163... | 0.66385037 | 82 |
Adds a chunk or token to this chunk and adjusts probability | def shift(self, chunk_or_token):
# TODO if we make a new chunk, we should try to merge with previous chunk
self.append(chunk_or_token)
self.leaves.extend(chunk_or_token.leaves) # SPEED: do we need to keep track of leaves?
# should probability include btp like chunkability?
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, log_prob, next_word_prob):\n if next_word_prob is not None:\n self.next_word_prob += next_word_prob\n else:\n self.missing_next_words += 1\n self.log_prob += log_prob\n self.count += 1",
"def updateProb(chromosome, sum):\n prob = chromosome[2]/(s... | [
"0.61657655",
"0.5901155",
"0.58448327",
"0.58124214",
"0.57316417",
"0.5720301",
"0.56943583",
"0.5689846",
"0.560087",
"0.5480089",
"0.5442933",
"0.5429661",
"0.542558",
"0.5420136",
"0.53779924",
"0.5360858",
"0.5335219",
"0.5315083",
"0.5299476",
"0.52497166",
"0.52471364... | 0.6788141 | 0 |
Returns the homepage with Prediction App | def index():
if request.method == 'GET':
return render_template('index.html')
if request.method == 'POST':
message = request.form['text']
data_vector = text_vector.transform([message])
data_transform = text_transformer.transform(data_vector)
prediction = lsvc_mode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage():\n return {'sample': 'ADAL'}",
"def home():\n rkwargs = {\n 'description': 'Shows API info',\n 'message': 'Welcome to the lung cancer prediction API!',\n 'links': {algo: '{}{}/predict/'.format(request.url_root, algo) for\n algo in PREDICTORS.keys()}\n ... | [
"0.7125719",
"0.68271434",
"0.66068983",
"0.6556316",
"0.65030706",
"0.63958687",
"0.6378712",
"0.6356087",
"0.63013655",
"0.62938625",
"0.6240054",
"0.6235036",
"0.62141615",
"0.6201637",
"0.6197204",
"0.6194072",
"0.61766964",
"0.6167475",
"0.61465204",
"0.6138583",
"0.6125... | 0.0 | -1 |
Prints a confusion matrix, as returned by sklearn.metrics.confusion_matrix, as a heatmap. Copied from shaypal5/confusion_matrix_pretty_print.py Arguments | def print_confusion_matrix(confusion_matrix, class_names, figsize = (6,5), fontsize=14, ax = None):
df_cm = pd.DataFrame(
confusion_matrix, index=class_names, columns=class_names,
)
# fig = plt.figure(figsize=figsize)
try:
heatmap = sns.heatmap(df_cm, annot=True, fmt="d", ax = ax)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_confusion_matrix(confusion_matrix, class_names, figsize = (10,7), fontsize=18):\n df_cm = pd.DataFrame(\n confusion_matrix, index=class_names, columns=class_names, \n )\n fig = plt.figure(figsize=figsize)\n try:\n heatmap = sns.heatmap(df_cm, annot=True, fmt=\"d\")\n except V... | [
"0.7898571",
"0.7793822",
"0.77306074",
"0.7428488",
"0.74149287",
"0.7412434",
"0.74077916",
"0.7379348",
"0.7349677",
"0.7340264",
"0.73377484",
"0.73282045",
"0.73157954",
"0.7277395",
"0.7247814",
"0.72342205",
"0.7223866",
"0.71231157",
"0.7104451",
"0.7101292",
"0.70995... | 0.791539 | 0 |
Return information on the currently authenticated user. | def get(self):
user = get_current_user()
if user is None:
context = {
'authenticated': False,
}
else:
context = {
'authenticated': True,
'user': user,
}
return self.respond(context) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_info(self):\n return self.auth.get_user_by_session()",
"def user_info(self):\n \n return self.auth.get_user_by_session()",
"def current_user_info():\n\n return current_user",
"def user_info(self):\n response = self.query('user_info')\n return response",
"def useri... | [
"0.8996944",
"0.88541836",
"0.86177224",
"0.8052399",
"0.80238336",
"0.79787093",
"0.79775614",
"0.79148436",
"0.7891504",
"0.7891504",
"0.7891504",
"0.7870922",
"0.7870922",
"0.7853573",
"0.78505516",
"0.78195286",
"0.7787011",
"0.77767545",
"0.7760793",
"0.7760793",
"0.7760... | 0.7310006 | 64 |
Calculates cross entropy loss given outputs and actual labels H(y,p) = sum (yi pi ) of ith element | def cross_entropy_loss(outputs, labels):
# works properly
m = labels.shape[0]
p = outputs
log_likelihood = -1*torch.log(p[range(m),labels])
loss = torch.sum(log_likelihood) / m
return loss.item() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss_fn(outputs, labels):\n return nn.CrossEntropyLoss()(outputs, labels)",
"def cross_entropy(y_observed, p):\n\n pass",
"def calculate_cross_entropy(self, output, flat_labels): #completed, expensive, should be compiled\n return -np.sum(np.log(np.clip(output, a_min=1E-12, a_max=1.0))[np.arang... | [
"0.74303067",
"0.7302722",
"0.7161997",
"0.69579995",
"0.69436926",
"0.69339913",
"0.69221777",
"0.69097567",
"0.6877698",
"0.6850627",
"0.68459946",
"0.6840756",
"0.6833279",
"0.68200505",
"0.6784105",
"0.6729272",
"0.67002386",
"0.6694645",
"0.66407114",
"0.66379136",
"0.66... | 0.7586763 | 0 |
distance from addr1 to addr2 | def to(addr1, addr2):
directions_result = gmaps.directions(addr1,
addr2,
mode="transit",
alternatives=True)
best,besti = mini(map(calc_time, directions_result), key=lambda x: x[0])
return best | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_distance(first: Waypoint, second: Waypoint) -> int:\n return int(distance.vincenty(first.coords(), second.coords()).m)",
"def get_distance(p1, p2):\n return ((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2) ** 0.5",
"def getDistance(pos1, pos2):\r\n return ((pos1[0] - pos2[0]) ** 2 + (pos1[1]... | [
"0.7574909",
"0.73816645",
"0.7379554",
"0.7366871",
"0.7343477",
"0.72559667",
"0.7239375",
"0.72180367",
"0.7180008",
"0.71723133",
"0.7168197",
"0.7144822",
"0.7144243",
"0.7138608",
"0.7137172",
"0.7135325",
"0.71287453",
"0.7112026",
"0.7111372",
"0.70920277",
"0.7084905... | 0.0 | -1 |
Safely convert a numpy object to a native Python object. | def safe_numpy_to_native(num):
try:
return num.item()
except:
return num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _as_numpy(y):\n if y is None:\n return None\n elif isinstance(y, np.ndarray):\n return np.copy(y)\n elif hasattr(y, 'as_matrix'):\n return y.as_matrix()\n elif hasattr(y, 'tolist'):\n return y.tolist()\n elif is_iterable(y):\n return np.asarray([i for i in y]) ... | [
"0.68060005",
"0.6759711",
"0.66854477",
"0.6684974",
"0.66808546",
"0.66229916",
"0.6609831",
"0.65294206",
"0.6499336",
"0.63046765",
"0.62868476",
"0.62856424",
"0.62640184",
"0.62478054",
"0.6231097",
"0.6189763",
"0.6158594",
"0.61520326",
"0.61387646",
"0.61322904",
"0.... | 0.7465645 | 0 |
Safely convert a list of numpy objects to a list of native Python objects. | def numpy_to_native_list(np_list):
ret = []
for val in np_list:
ret.append(safe_numpy_to_native(val))
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_numpy(a: List[tvm.nd.NDArray]) -> List[np.ndarray]:\n assert a is not None, \"Empty result cannot be converted to numpy\"\n return [x.numpy() for x in a]",
"def convertToPrimitiveArray(objectArray: typing.List[typing.Any]) -> typing.Any:\n ...",
"def convert_to_numpy_list_vector_arr... | [
"0.7231061",
"0.69225746",
"0.68102664",
"0.66078967",
"0.6574941",
"0.6477651",
"0.64680487",
"0.64542013",
"0.64408994",
"0.6436163",
"0.64231783",
"0.637175",
"0.6303386",
"0.627638",
"0.626605",
"0.62210727",
"0.61720973",
"0.6158665",
"0.6143415",
"0.61379313",
"0.612423... | 0.8167077 | 0 |
Check if the string is convertible into a list of integers. >>> str_to_index_list("2") [2] >>> str_to_index_list("25") [2,3,4,5] >>> str_to_index_list("2,5") [2,5] | def str_to_index_list(index_str):
if str2index_convertible(index_str):
index_list = []
if "," in index_str:
index_str = index_str.split(",")
for index in index_str:
index_list.append(int(index))
elif "-" in index_str:
index_str = index_str.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_index_list(inp, total_index_num, allow_slicing=True):\n if type(inp) is str:\n # split to string list\n inp = inp.strip().split()\n idxs = []\n for i, num in enumerate(inp):\n if type(num) is str:\n # parse string representation of indexes / slice ranges\n ... | [
"0.6767763",
"0.6612497",
"0.66099393",
"0.6500024",
"0.6436266",
"0.6333134",
"0.6320149",
"0.6223905",
"0.6202966",
"0.6179651",
"0.6123737",
"0.611956",
"0.60869366",
"0.60375935",
"0.6003453",
"0.6001818",
"0.5973063",
"0.58821154",
"0.58726513",
"0.58687925",
"0.5860723"... | 0.7964557 | 0 |
Home page for the Logs Application | def index():
module_name = deployment_settings.modules[module].name_nice
response.title = module_name
return dict(module_name=module_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def homepage_log():\n\n return render_template('home_log.html')",
"def home():\n return render_template(\n 'index.html',\n title='Automation Center',\n year=datetime.now().year,\n message='Welcome to the Automation Center'\n )",
"def home():\n\n\treturn render_template('ind... | [
"0.80109966",
"0.7650564",
"0.7421092",
"0.7319061",
"0.7249694",
"0.72198117",
"0.72000474",
"0.71845454",
"0.71417964",
"0.7139234",
"0.7139234",
"0.7139234",
"0.7139234",
"0.7139234",
"0.7139234",
"0.7139234",
"0.7139234",
"0.7139234",
"0.7139234",
"0.7101338",
"0.7070188"... | 0.0 | -1 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot(self):
plt.imshow(self.cm, interpolation='nearest', cmap=self.cmap)
plt.title(self.title)
plt.colorbar()
tick_marks = np.arange(len(self.classes))
plt.xticks(tick_marks, self.classes, rotation=45)
plt.yticks(tick_marks, self.classes)
if self.norm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.8194862",
"0.80949175",
"0.8029915",
"0.8019153",
"0.79941195",
"0.7991258",
"0.7980955",
"0.7976606",
"0.79610753",
"0.79590565",
"0.79378676",
"0.7934962",
"0.7934504",
"0.79313844",
"0.7926313",
"0.7924577",
"0.79241234",
"0.7923211",
"0.7923023",
"0.7921931",
"0.791787... | 0.7813563 | 100 |
Returns the id (key into INSTALLERS) of a currently running job, or the empty string if nothing is running. | def running(self,request):
# ----------- DEBUG -----------------
MODULE.info("updater/installer/running invoked with:")
pp = pprint.PrettyPrinter(indent=4)
st = pp.pformat(request.options).split("\n")
for s in st:
MODULE.info(" << %s" % s)
# -----------------------------------
result = self.__which... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"job_id\")",
"def jobid(self):\n return self.get_db('jobid')",
"def getJobID(self):\n return self.__nupicJobID",
"def _get_job_id(self) -> str:\n return self.split_name[2][3:]",
"def jobId(self):\n returnself._ShR... | [
"0.7533059",
"0.7139468",
"0.70201653",
"0.7000013",
"0.6990591",
"0.69855917",
"0.6935694",
"0.6872265",
"0.6815007",
"0.6712475",
"0.66775584",
"0.66775584",
"0.6632081",
"0.6631947",
"0.65886784",
"0.6482588",
"0.6478849",
"0.64566797",
"0.6449152",
"0.64211065",
"0.640486... | 0.0 | -1 |
Return normalized 3D vector v. | def normalize(v):
det = math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2])
return [v[0] / det, v[1] / det, v[2] / det] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize(v):\n return v / np.linalg.norm(v)",
"def normalize(v):\n return np.array(v) / np.linalg.norm(v)",
"def normalized(v):\n norm = np.linalg.norm(v)\n if norm:\n return np.array(v) / norm\n else:\n return v",
"def normal(self, u, v):\n result = np.cross(self.du(... | [
"0.7715632",
"0.7643061",
"0.7623499",
"0.7571536",
"0.74554205",
"0.74356395",
"0.74290925",
"0.7410868",
"0.73637825",
"0.7269433",
"0.7244467",
"0.71008205",
"0.69852144",
"0.6970036",
"0.6957438",
"0.6952184",
"0.6891339",
"0.6886572",
"0.6885978",
"0.68787456",
"0.684851... | 0.69622445 | 14 |
Compute the dot product of 3D vectors v1 and v2. | def dotProduct(v1, v2):
n1 = normalize(v1)
n2 = normalize(v2)
return n1[0] * n2[0] + n1[1] * n2[1] + n1[2] * n2[2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vector_dot(v1,v2):\n return (v1.x * v2.x) + (v1.y * v2.y) + (v1.z * v2.z)",
"def vec_dot(v1,v2):\r\n \r\n return np.dot(v1,v2)",
"def dotProduct(v1, v2):\n return sum((a * b) for a, b in zip(v1, v2))",
"def dot_product(v1, v2):\n return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]",
"def dot_... | [
"0.8668296",
"0.82768786",
"0.82056874",
"0.8180481",
"0.8127203",
"0.79950523",
"0.79904526",
"0.7964766",
"0.7963095",
"0.7930401",
"0.78257865",
"0.78153247",
"0.78011787",
"0.7795902",
"0.77713406",
"0.7722211",
"0.77053225",
"0.76747084",
"0.76537526",
"0.74949473",
"0.7... | 0.8580574 | 1 |
Return if the target object lies on the sight line. The sight line is defined by the origin point and sightVector. hitError specifies the difference errors in meters that can be considered as an hit. | def hit(self, origin, sightVector, hitError):
distance = [0, 0, 0]
for i in range(0, 3):
distance[i] = self.translation[i] - origin[i]
v1 = normalize(distance)
v2 = normalize(sightVector)
return abs(v1[0] - v2[0]) < hitError and \
abs(v1[1] - v2[1]) < hitE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_hit(ball, r_ball, v, target, r_target):\n v_norm = norm_2d(v)\n dr = (target[0] - ball[0], target[1] - ball[1])\n dr_norm = norm_2d(dr)\n\n p = project(dr, v)\n p_norm = norm_2d(p)\n\n if p_norm > v_norm:\n c = (v_norm ** 2 + dr_norm ** 2 - 2 * sc_mul(v, dr)) ** 0.5\n return ... | [
"0.6089051",
"0.5939454",
"0.5794178",
"0.57745093",
"0.57270354",
"0.5688043",
"0.55599463",
"0.5549703",
"0.5537237",
"0.5477546",
"0.5445187",
"0.54415226",
"0.53982365",
"0.53396297",
"0.532616",
"0.5307961",
"0.53038573",
"0.5300042",
"0.5281481",
"0.52666754",
"0.526546... | 0.77789605 | 0 |
Parse and return Places with their respective opening hours | def get_place_hours() -> (DataFrame, List[int]):
df = pd.read_csv("data/chefmozhours4.csv", encoding='utf-8')
df.placeID = df.placeID.astype(int)
df.drop_duplicates(subset=df.columns, keep='first', inplace=True)
# create new dataframe
columns = ['placeID', 'hours_week', 'hours_sat', 'hours_sun']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def places(place_id, key=GOOGLE_KEY):\n\n params = {'placeid': place_id, 'key': key}\n\n try:\n res = requests.get(PLACES_URL, params=params, verify=False)\n res.raise_for_status()\n res = res.json()['result']['opening_hours']\n except (AttributeError, KeyError):\n return {}\n ... | [
"0.70478946",
"0.67781734",
"0.6620414",
"0.6104398",
"0.58724344",
"0.5665652",
"0.5486499",
"0.5278421",
"0.5268686",
"0.5264674",
"0.52613574",
"0.52210957",
"0.5196722",
"0.5186993",
"0.5176113",
"0.5166596",
"0.5154154",
"0.51402605",
"0.5132435",
"0.5100923",
"0.5072011... | 0.64042133 | 3 |
Return a probability distribution over which page to visit next, given a current page. With probability `damping_factor`, choose a link at random linked to by `page`. With probability `1 damping_factor`, choose a link at random chosen from all pages in the corpus. | def transition_model(corpus, page, damping_factor):
probabilities = dict()
transitions = corpus[page]
if len(transitions) == 0:
p_corpus = 1 / len(corpus)
for p in corpus.keys():
probabilities[p] = p_corpus
return probabilities
if len(transitions) > 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transition_model(corpus, page, damping_factor):\n distribution = dict() #Create a dictionary for the probability distribution\n all_pages = []\n links = list(corpus[page]) #All pages linked by current page\n for u in corpus:\n all_pages.append(u)\n\n #If the current page does not link to ... | [
"0.7993274",
"0.7727412",
"0.7647625",
"0.7500372",
"0.74512404",
"0.7268626",
"0.70469546",
"0.69155616",
"0.68950677",
"0.6844489",
"0.6755242",
"0.6724535",
"0.6637623",
"0.6618855",
"0.6553674",
"0.6505267",
"0.6394851",
"0.63317496",
"0.62793547",
"0.6243842",
"0.6233524... | 0.6781943 | 10 |
Tests the `max_workers` shortcut. | def test_max_workers(self):
from concurrent.futures import ThreadPoolExecutor
session = FuturesSession()
self.assertEqual(session.executor._max_workers, 2)
session = FuturesSession(max_workers=5)
self.assertEqual(session.executor._max_workers, 5)
session = FuturesSe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_number_of_workers(self) -> pulumi.Output[Optional[int]]:\n return pulumi.get(self, \"maximum_number_of_workers\")",
"def maximum_number_of_workers(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"maximum_number_of_workers\")",
"def test_workers(self):\n wr = WorkflowRun... | [
"0.66919494",
"0.65824425",
"0.63891023",
"0.6305042",
"0.6260825",
"0.625994",
"0.6244914",
"0.6190248",
"0.61291575",
"0.6128778",
"0.6119127",
"0.61133605",
"0.6104459",
"0.6078529",
"0.6074325",
"0.5999638",
"0.59754044",
"0.5945874",
"0.5934958",
"0.5932359",
"0.59125394... | 0.67878395 | 0 |
If the current user does not have a profile, redirect them to the profile creation view. | def profile_required(func=None, login_url=None):
if not func:
return partial(profile_required, login_url=login_url)
@wraps(func)
@login_required(login_url=login_url)
def wrapped(request, *args, **kwargs):
if not request.user.profile:
return redirect('flicks.users.profile')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, request, *args, **kwargs):\n if request.user.is_authenticated():\n return HttpResponseRedirect('/')\n return super(ProfileCreate, self).get(request, *args, **kwargs)",
"def profile():\n if g.user:\n return render_template('profile.html', user=g.user)\n return r... | [
"0.8091693",
"0.7748662",
"0.7531918",
"0.7344172",
"0.7091509",
"0.6971493",
"0.6871103",
"0.6788356",
"0.6751459",
"0.6645295",
"0.6629284",
"0.66115034",
"0.66040564",
"0.66040564",
"0.6569401",
"0.6554981",
"0.6530386",
"0.6490443",
"0.648148",
"0.6460962",
"0.6457601",
... | 0.0 | -1 |
Check if tensor A is a sparse tensor | def is_sparse(A):
if isinstance(A, torch.Tensor):
return A.layout == torch.sparse_coo
raise TypeError("expected Tensor but got %s" % (type(A).__name__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sparse(tensor):\n return isinstance(tensor, sparse_tensor.SparseTensor)",
"def is_sparse(x: Any, backend=None) -> bool:\r\n module = get_module(backend)\r\n return module.is_sparse(x)",
"def isspsparse(var):\n if 'theano.sparse' in sys.modules:\n return (sp.sparse.issparse(var)\n ... | [
"0.86048955",
"0.7161802",
"0.7080189",
"0.65603733",
"0.6522472",
"0.6427291",
"0.63886297",
"0.62952006",
"0.6244867",
"0.6229549",
"0.62151974",
"0.6199925",
"0.6190189",
"0.6161968",
"0.60981226",
"0.60706556",
"0.6064328",
"0.60310256",
"0.6012801",
"0.5995372",
"0.59845... | 0.89470613 | 0 |
Write line string to standard error and flush | def debug(line):
sys.stderr.write(line + "\n")
sys.stderr.flush() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_err(self, text): # pragma: no cover\n # type: (str) -> None\n stderr = self.stderr\n if self.stderr.closed:\n stderr = sys.stderr\n stderr.write(decode_output(u\"\\r\", target_stream=stderr))\n stderr.write(decode_output(CLEAR_LINE, target_stream=stderr))\n ... | [
"0.7235095",
"0.7047463",
"0.6964287",
"0.68663406",
"0.6794799",
"0.67794967",
"0.6586635",
"0.6517666",
"0.6502301",
"0.64847887",
"0.6453221",
"0.6411421",
"0.64077234",
"0.64022255",
"0.6387582",
"0.63631517",
"0.6324148",
"0.6324115",
"0.6318084",
"0.62620974",
"0.626185... | 0.68995905 | 3 |
Initialize the calculator stack | def __init__(self):
self.stack = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.stack =[]\n self.min_num = None",
"def __init__(self, adder, subtracter, multiplier, divider):\n self.adder = adder\n self.subtracter = subtracter\n self.multiplier = multiplier\n self.divider = divider\n\n self.stack = []",
"def __ini... | [
"0.63249964",
"0.6312433",
"0.6312433",
"0.6278347",
"0.6272454",
"0.6243599",
"0.6189262",
"0.61823934",
"0.61442953",
"0.6102776",
"0.6100903",
"0.6092396",
"0.60904104",
"0.608251",
"0.6073774",
"0.6055508",
"0.605225",
"0.60407215",
"0.604047",
"0.6013165",
"0.5971824",
... | 0.58813316 | 34 |
Instance of linked list is created. | def __init__(self):
self.head = None
self.length = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, linked_list: object):\n self.current_node = linked_list._head",
"def __init__(self):\n self.head = ListNode()",
"def __init__(self):\n self.new_dll = DLinkedList()",
"def new_ll():\n from linked_list import Linked_List\n this_ll = Linked_List(PARAMS_SAMPLE_LIST)\... | [
"0.7463448",
"0.74594927",
"0.7396998",
"0.7227381",
"0.72204",
"0.70901984",
"0.6989914",
"0.69545364",
"0.69320124",
"0.68896717",
"0.68896717",
"0.68896717",
"0.68896717",
"0.68896717",
"0.6791921",
"0.67730826",
"0.6761502",
"0.6715041",
"0.6712915",
"0.667583",
"0.667575... | 0.642331 | 63 |
Insert a new node at the beginning. | def push(self, val):
new_node = Node(val)
new_node.next = self.head
self.head = new_node
self.length += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_at_beginning(self, data: int) -> None:\n current = self.head\n new_node = Node(data)\n if current is not None:\n new_node.set_next_node(self.head)\n self.head = new_node\n self._increase_length()",
"def prepend(self, node):\n if not isinstance(node,... | [
"0.7702179",
"0.7641196",
"0.7549501",
"0.7493346",
"0.7487006",
"0.7465431",
"0.7464625",
"0.73809147",
"0.7302195",
"0.7277421",
"0.72750306",
"0.72735834",
"0.72649646",
"0.7222142",
"0.719297",
"0.71919525",
"0.71835345",
"0.70853543",
"0.7079216",
"0.7067039",
"0.6973691... | 0.0 | -1 |
Remove and return an item from the queue. Returns an awaitable which resolves once an item is available, or raises `tornado.util.TimeoutError` after a timeout. ``timeout`` may be a number denoting a time (on the same scale as `tornado.ioloop.IOLoop.time`, normally `time.time`), or a `datetime.timedelta` object for a de... | def get(
self, timeout: Optional[Union[float, datetime.timedelta]] = None
) -> Awaitable[_T]:
future = Future() # type: Future[_T]
try:
future.set_result(self.get_nowait())
except QueueEmpty:
self._getters.append(future)
_set_timeout(future, timeo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self, timeout=None):\n item = super(ExclusiveQueue, self).pop(timeout)\n try:\n self.remove(item)\n except ValueError:\n pass\n return item",
"def put(\n self, item: _T, timeout: Optional[Union[float, datetime.timedelta]] = None\n ) -> \"Future[... | [
"0.7336923",
"0.6628001",
"0.6528864",
"0.65080005",
"0.6498318",
"0.63617206",
"0.6360227",
"0.6271478",
"0.60828185",
"0.60522467",
"0.59878767",
"0.59776556",
"0.5898504",
"0.5891952",
"0.5872132",
"0.5849278",
"0.5689446",
"0.5564281",
"0.5530899",
"0.55151176",
"0.550450... | 0.5572722 | 17 |
Remove and return an item from the queue without blocking. Return an item if one is immediately available, else raise `QueueEmpty`. | def get_nowait(self) -> _T:
self._consume_expired()
if self._putters:
assert self.full(), "queue not full, why are putters waiting?"
item, putter = self._putters.popleft()
self.__put_internal(item)
future_set_result_unless_cancelled(putter, None)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self, timeout=None):\n item = super(ExclusiveQueue, self).pop(timeout)\n try:\n self.remove(item)\n except ValueError:\n pass\n return item",
"def remove(self) -> T:\n if not self.is_empty():\n return self._queue.pop()",
"def pop(self)... | [
"0.77767026",
"0.7736018",
"0.770522",
"0.76563966",
"0.7526349",
"0.74764746",
"0.7470952",
"0.7458122",
"0.740367",
"0.7390114",
"0.7382221",
"0.73701715",
"0.7346305",
"0.7341975",
"0.7336125",
"0.7333435",
"0.7320937",
"0.73130584",
"0.7288222",
"0.7264022",
"0.7217338",
... | 0.75312173 | 4 |
Returns C/r exp( (rr0)/a) cos(K(r)+phi_0) + 1 evaluated at r. p = (a,K,C,phi_0) | def fun_decay_exp_inv_gen(r0):
def fit_fun(p,r):
return (p[2] / (r-p[3])) * np.exp(-(r-p[3])/p[0] ) * np.sin(p[1]*(r- p[3])) +1
return fit_fun | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CR(phi):\n return (np.kron(P0,s0) + np.kron(P1,R(phi)))",
"def K(r, R):\n u = r / R\n k = np.pi / 4 * u - 1. / 2 * np.sqrt(1 - 1. / u ** 2) - u / 2. * np.arcsin(1. / u)\n return k",
"def K(r, R, r_ani):\n u = r / R\n ua = r_ani / R\n k = (ua ** 2 + 1. / 2) / (ua... | [
"0.6942605",
"0.6841908",
"0.6762096",
"0.66977924",
"0.6452198",
"0.6435569",
"0.64074636",
"0.635043",
"0.62890214",
"0.6209179",
"0.62067455",
"0.61943483",
"0.6133918",
"0.61035126",
"0.6087219",
"0.607306",
"0.6064097",
"0.60191303",
"0.6005025",
"0.6000584",
"0.59941524... | 0.0 | -1 |
d(C/r exp( (rr_0)/a) cos(K(r)+phi_0) + b)/dr evaluated at r. p = (a,K,C,phi_0) | def fun_decay_exp_inv_dr_gen(r0):
def ret_fun(p,r):
return (p[2] /( r-p[3])) * np.exp(-(r-p[3])/p[0]) * np.sin(p[1]*(r - p[3]))*\
-1*(1/p[0] + 1/r + p[1]/ np.tan(p[1] * (r - p[3])))
return ret_fun | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def r_dc(self, phi, tl):\n\t # return self.r_d(tl)*(1. - exp(-phi))\n\t return 0.",
"def r_dc(self, phi, tl):\n\t return self.r_d(tl)*(1. - exp(-phi))",
"def CR(phi):\n return (np.kron(P0,s0) + np.kron(P1,R(phi)))",
"def DR(R,Pc):\n return r1*R*(K1**B1/(K1**B1 + (A/R)**B1))*(S/(S + R*Pc + Pc))... | [
"0.6636992",
"0.6556475",
"0.6550292",
"0.64924365",
"0.6438681",
"0.64220905",
"0.63966405",
"0.63341016",
"0.63087475",
"0.6196725",
"0.6138291",
"0.6124847",
"0.60633075",
"0.603966",
"0.60353655",
"0.60353297",
"0.6011074",
"0.59884423",
"0.5969927",
"0.5962698",
"0.59206... | 0.62495124 | 9 |
Returns C/r cos(K(r)+phi_0) evaluated at r. p = (K,C,phi_0) | def fun_decay_inv(p,r):
return (p[1]*r0 / r) * np.cos(p[0]*r + p[2]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CR(phi):\n return (np.kron(P0,s0) + np.kron(P1,R(phi)))",
"def K(r, R):\n u = r / R\n k = np.pi / 4 * u - 1. / 2 * np.sqrt(1 - 1. / u ** 2) - u / 2. * np.arcsin(1. / u)\n return k",
"def K(r, R):\n u = r / R\n k = np.sqrt(1 - 1. / u ** 2)\n return k",
"def phi... | [
"0.72665375",
"0.704408",
"0.68868864",
"0.67804235",
"0.67134005",
"0.6511614",
"0.6449185",
"0.6448285",
"0.64482063",
"0.64001536",
"0.6397148",
"0.6359526",
"0.6351848",
"0.63435084",
"0.6334776",
"0.6295738",
"0.62674606",
"0.6245572",
"0.6209222",
"0.6199725",
"0.616779... | 0.0 | -1 |
Check if the polygon is oriented clockwise or counterclockwise. If the polygon is not closed, then closes it | def _sector_orientation(self, vertices):
if not vertices[0] == vertices[-1]:
vertices.append(vertices[0])
xy = np.transpose(np.array(vertices))
x, y = xy[0], xy[1]
return np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)) > 0, vertices | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_clockwise(vertices):\n v = vertices\n area = ((v[1][0] - v[0][0]) * (v[1][1] + v[0][1]) +\n (v[2][0] - v[1][0]) * (v[2][1] + v[1][1]) +\n (v[0][0] - v[2][0]) * (v[0][1] + v[2][1])) / 2\n return (area > 0)",
"def ring_is_clockwise(ring):\n total = 0\n for (pt1, pt2) in ... | [
"0.6747626",
"0.6401129",
"0.635448",
"0.62022245",
"0.6182494",
"0.612847",
"0.6109565",
"0.60296345",
"0.6021205",
"0.6010633",
"0.5946114",
"0.5936023",
"0.5861069",
"0.58608973",
"0.58608973",
"0.5840856",
"0.5806993",
"0.5790126",
"0.5783694",
"0.5741617",
"0.5726277",
... | 0.0 | -1 |
Fetch the name of the item. | def get_item_name(sp, item_type, item_id):
if item_type == 'playlist':
name = sp.playlist(playlist_id=item_id, fields='name').get('name')
elif item_type == 'album':
name = sp.album(album_id=item_id).get('name')
elif item_type == 'track':
name = sp.track(track_id=item_id).get('name')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getName(self,item):\n return item.s",
"def get_item_name(self):\n return self.__item_name",
"def get_name(item_id):\n if item_id in all_items:\n return all_items[item_id]['name']\n return None",
"def get_name(self):\n if self.name != None: return self.name\n else: return ... | [
"0.8365611",
"0.8346293",
"0.79825485",
"0.79113615",
"0.7754865",
"0.7691313",
"0.766975",
"0.74173015",
"0.7375894",
"0.731291",
"0.7296194",
"0.7296194",
"0.7282027",
"0.72360784",
"0.71886194",
"0.7181925",
"0.71751404",
"0.7167402",
"0.71438724",
"0.71337664",
"0.7133766... | 0.78084064 | 4 |
Validate the URL and determine if the item type is supported. | def validate_spotify_url(url):
item_type, item_id = parse_spotify_url(url)
log.debug(f"Got item type {item_type} and item_id {item_id}")
if item_type not in ['album', 'track', 'playlist']:
log.error("Only albums/tracks/playlists are supported")
return False
if item_id is None:
lo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_url(self):\n pass",
"def _validate_type(self):\n if self._type != \"link\":\n raise securesystemslib.exceptions.FormatError(\n \"Invalid Link: field `_type` must be set to 'link', got: {}\"\n .format(self._type))",
"def check_url(url):\n return 'products.json' i... | [
"0.69111353",
"0.6565697",
"0.65086687",
"0.6501466",
"0.64377946",
"0.6371421",
"0.63473034",
"0.63169104",
"0.62989384",
"0.628231",
"0.6242617",
"0.62097794",
"0.617534",
"0.61322874",
"0.61017257",
"0.6071105",
"0.60380787",
"0.60350364",
"0.6009986",
"0.59684604",
"0.595... | 0.7493071 | 0 |
Returns the key name for aws access key id environment variable | def env_var_aws_access_key_id():
return 'AWS_ACCESS_KEY_ID' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def access_key_id(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"access_key_id\")",
"def access_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"access_key\")",
"def access_key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"access_key\")",
"def env_var_aws_s... | [
"0.76480216",
"0.7297909",
"0.72115576",
"0.7054044",
"0.6998159",
"0.69106483",
"0.6878439",
"0.68697554",
"0.677709",
"0.6750072",
"0.67449194",
"0.6702363",
"0.6670402",
"0.6668832",
"0.6668832",
"0.6668832",
"0.6630177",
"0.6578406",
"0.65742415",
"0.65614897",
"0.6517507... | 0.85637563 | 0 |
Returns the key name for aws session token environment variable | def env_var_aws_session_token():
return 'AWS_SESSION_TOKEN' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_var_aws_security_token():\n return 'AWS_SECURITY_TOKEN'",
"def env_var_aws_access_key_id():\n return 'AWS_ACCESS_KEY_ID'",
"def env_var_aws_secret_access_key():\n return 'AWS_SECRET_ACCESS_KEY'",
"def sessionkey(cls, session):\n return session[\"credential\"][\"Authorizati... | [
"0.77419096",
"0.7356209",
"0.687084",
"0.6821194",
"0.671304",
"0.6643045",
"0.66101414",
"0.653787",
"0.65057176",
"0.65055186",
"0.6471699",
"0.6459282",
"0.63822836",
"0.633365",
"0.633365",
"0.633365",
"0.6247375",
"0.62375563",
"0.62340814",
"0.62280977",
"0.6214375",
... | 0.8317656 | 0 |
Returns the key name for aws security token environment variable | def env_var_aws_security_token():
return 'AWS_SECURITY_TOKEN' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_var_aws_access_key_id():\n return 'AWS_ACCESS_KEY_ID'",
"def env_var_aws_session_token():\n return 'AWS_SESSION_TOKEN'",
"def env_var_aws_secret_access_key():\n return 'AWS_SECRET_ACCESS_KEY'",
"def key_name(self) -> str:\n return pulumi.get(self, \"key_name\")",
"def aw... | [
"0.7489451",
"0.7428569",
"0.700452",
"0.6646463",
"0.66105175",
"0.6584805",
"0.65412647",
"0.6527514",
"0.6527514",
"0.6527514",
"0.6445769",
"0.6444604",
"0.6400658",
"0.63923156",
"0.6380205",
"0.63683784",
"0.63671887",
"0.63669354",
"0.6363497",
"0.6363497",
"0.63508415... | 0.8146783 | 0 |
Returns the key name for aws secret access key environment variable | def env_var_aws_secret_access_key():
return 'AWS_SECRET_ACCESS_KEY' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_var_aws_access_key_id():\n return 'AWS_ACCESS_KEY_ID'",
"def secret_access_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"secret_access_key\")",
"def aws_credentials_secret_name(self) -> Optional[str]:\n return pulumi.get(self, \"aws_credentials_secret_name\")",
"def... | [
"0.84506404",
"0.7587261",
"0.7097253",
"0.7056799",
"0.7046539",
"0.7033541",
"0.6977223",
"0.6977223",
"0.6769221",
"0.67157805",
"0.66950864",
"0.6668506",
"0.6667329",
"0.6532539",
"0.6532076",
"0.653101",
"0.6530734",
"0.65238035",
"0.6522933",
"0.6500886",
"0.6498251",
... | 0.8265045 | 1 |
The rolling count of any nonNaN observations inside the window. | def count(self) -> FrameLike:
return super().count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def COUNT(condition: pd.DataFrame, n: int):\r\n return condition.rolling(n, center=False, min_periods=n).sum()",
"def null_count(df):\n return df.isnull().sum().sum()",
"def count_placeholders(series):\n count = 0\n\n for i in range(series.size-1, -1, -1):\n if pd.isnull(series[i]) or series... | [
"0.6742492",
"0.6388162",
"0.6070128",
"0.58365",
"0.5788624",
"0.5631775",
"0.56174415",
"0.55978847",
"0.5578722",
"0.5564355",
"0.5546377",
"0.5443131",
"0.5426645",
"0.5415506",
"0.5404296",
"0.53765166",
"0.5338709",
"0.5329187",
"0.5309082",
"0.5296353",
"0.52755773",
... | 0.0 | -1 |
Calculate rolling summation of given DataFrame or Series. | def sum(self) -> FrameLike:
return super().sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_rolling(self, X: pd.DataFrame, aggregate: str, days: list) -> pd.DataFrame:\n for d in days:\n X[f'rolling_{aggregate}_{d}'] = (X[['id', 'sales', 'd']]\n .groupby(['id'])['sales']\n .transform(lambda x: x\n .... | [
"0.67139715",
"0.6456743",
"0.6164658",
"0.60734415",
"0.5979015",
"0.59093314",
"0.5902472",
"0.59009683",
"0.5850244",
"0.584317",
"0.582164",
"0.57560194",
"0.57528484",
"0.56849587",
"0.56844455",
"0.56691283",
"0.5668916",
"0.5652469",
"0.56503654",
"0.5647865",
"0.56224... | 0.0 | -1 |
Calculate the rolling quantile of the values. | def quantile(self, quantile: float, accuracy: int = 10000) -> FrameLike:
return super().quantile(quantile, accuracy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantile(obj, quantile, window, min_periods=None, interpolation='linear'):\n return obj.rolling(window=window, min_periods=min_periods).quantile(quantile, interpolation=interpolation)",
"def quantile_inv(obj, window, min_periods=None):\n return obj.rolling(window=window, min_periods=min_periods).apply(... | [
"0.7531309",
"0.7186366",
"0.64934176",
"0.6449605",
"0.63455826",
"0.6265429",
"0.6207471",
"0.61604744",
"0.6069853",
"0.6014162",
"0.600804",
"0.5990357",
"0.59813446",
"0.59723234",
"0.59604645",
"0.5925752",
"0.5903909",
"0.5871063",
"0.5865568",
"0.58350533",
"0.5832931... | 0.59255546 | 17 |
The rolling count of any nonNaN observations inside the window. Returns Series or DataFrame Returned object type is determined by the caller of the expanding calculation. See Also | def count(self) -> FrameLike:
return super().count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def COUNT(condition: pd.DataFrame, n: int):\r\n return condition.rolling(n, center=False, min_periods=n).sum()",
"def null_count(df):\n return df.isnull().sum().sum()",
"def get_nan_counts(data, cols, null_col_suffix=''):\n nulls_df = pd.DataFrame(pd.isnull(data[cols]).sum())\n nulls_df.columns = [... | [
"0.65868795",
"0.5921516",
"0.5806247",
"0.56712025",
"0.56466436",
"0.56352276",
"0.5579832",
"0.556141",
"0.55022866",
"0.5487067",
"0.5443514",
"0.5416533",
"0.5412285",
"0.53992844",
"0.53850275",
"0.53658235",
"0.5311116",
"0.5276107",
"0.52737737",
"0.5269945",
"0.52648... | 0.0 | -1 |
The rolling summation of any nonNaN observations inside the window. Returns Series or DataFrame Returned object type is determined by the caller of the rolling calculation. See Also | def sum(self) -> FrameLike:
return super().sum() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rolling_mean(df, window):\n # return pd.rolling_mean(values, window=window)\n rolling_df=pd.DataFrame(index=df.index)\n for sym in df.columns:\n df_tmp= pd.Series.rolling(df[sym],window=window).mean().to_frame() # to_frame converts series to a data frame\n rolling_df=rolling_df.join(... | [
"0.67467463",
"0.6613442",
"0.6533916",
"0.64736253",
"0.64673936",
"0.629716",
"0.6283051",
"0.6198748",
"0.6114465",
"0.6087126",
"0.60358644",
"0.6002005",
"0.5986583",
"0.5895803",
"0.58494383",
"0.58375376",
"0.5808783",
"0.57779574",
"0.57769376",
"0.57069594",
"0.56865... | 0.0 | -1 |
The rolling minimum of any nonNaN observations inside the window. Returns Series or DataFrame Returned object type is determined by the caller of the rolling calculation. See Also | def min(self) -> FrameLike:
return super().min() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rolling_min_nb(a, window, minp=None):\n out = np.empty_like(a, dtype=np.float_)\n for col in range(a.shape[1]):\n out[:, col] = rolling_min_1d_nb(a[:, col], window, minp=minp)\n return out",
"def rolling_min_1d_nb(a, window, minp=None):\n if minp is None:\n minp = window\n if min... | [
"0.7334202",
"0.73163694",
"0.71986014",
"0.6907758",
"0.6754546",
"0.64330584",
"0.6414692",
"0.6397849",
"0.6236042",
"0.6200179",
"0.6168256",
"0.61582273",
"0.6108246",
"0.60841763",
"0.6082062",
"0.6036803",
"0.6036803",
"0.6019974",
"0.60003674",
"0.59005505",
"0.587979... | 0.0 | -1 |
The rolling mean of any nonNaN observations inside the window. Returns Series or DataFrame Returned object type is determined by the caller of the rolling calculation. See Also | def mean(self) -> FrameLike:
return super().mean() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rolling_mean(values, window):\n return pd.rolling_mean(values, window=window)",
"def get_rolling_mean(values, window):\r\n return pd.rolling_mean(values, window=window)",
"def get_rolling_mean(df, window):\n # return pd.rolling_mean(values, window=window)\n rolling_df=pd.DataFrame(index... | [
"0.8266824",
"0.8229196",
"0.80475366",
"0.794759",
"0.781616",
"0.7604971",
"0.72936034",
"0.6891473",
"0.68211347",
"0.6805047",
"0.66424984",
"0.66319966",
"0.65638167",
"0.64446044",
"0.63771135",
"0.63368434",
"0.6289321",
"0.6276824",
"0.62733346",
"0.62192655",
"0.6201... | 0.5715995 | 80 |
The expanding count of any nonNaN observations inside the window. | def count(self) -> FrameLike:
return super().count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_placeholders(series):\n count = 0\n\n for i in range(series.size-1, -1, -1):\n if pd.isnull(series[i]) or series[i] == 0:\n count += 1\n else:\n break\n\n return count",
"def null_count(df):\n return df.isnull().sum().sum()",
"def get_nan_counts(data, c... | [
"0.614406",
"0.6136183",
"0.60136473",
"0.5965262",
"0.57978404",
"0.5729527",
"0.5691633",
"0.567842",
"0.55719984",
"0.54842085",
"0.54111147",
"0.53994983",
"0.5356147",
"0.5330028",
"0.532125",
"0.5319173",
"0.53163654",
"0.52570134",
"0.5237816",
"0.52130353",
"0.5186760... | 0.46951455 | 65 |
Calculate the expanding quantile of the values. Returns Series or DataFrame Returned object type is determined by the caller of the expanding calculation. | def quantile(self, quantile: float, accuracy: int = 10000) -> FrameLike:
return super().quantile(quantile, accuracy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantiles(self, value):\n self._quantiles = pandas.DataFrame(value, dtype=float)",
"def quantile(obj, quantile, window, min_periods=None, interpolation='linear'):\n return obj.rolling(window=window, min_periods=min_periods).quantile(quantile, interpolation=interpolation)",
"def quantile(self, axi... | [
"0.6153257",
"0.6046",
"0.596912",
"0.5951916",
"0.57734144",
"0.5772762",
"0.57614744",
"0.5729488",
"0.56926376",
"0.5674497",
"0.56588715",
"0.5549241",
"0.5466749",
"0.54329956",
"0.5413596",
"0.54132473",
"0.54109955",
"0.53970623",
"0.53968835",
"0.53949827",
"0.5382592... | 0.57400614 | 9 |
The expanding count of any nonNaN observations inside the window. Returns Series or DataFrame Returned object type is determined by the caller of the expanding calculation. See Also | def count(self) -> FrameLike:
return super().count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nan_counts(data, cols, null_col_suffix=''):\n nulls_df = pd.DataFrame(pd.isnull(data[cols]).sum())\n nulls_df.columns = ['null_counts'+null_col_suffix]\n nulls_df['feature'] = nulls_df.index\n nulls_df.reset_index(inplace=True, drop=True)\n return nulls_df",
"def COUNT(condition: pd.DataFr... | [
"0.5884196",
"0.5648381",
"0.5532539",
"0.544448",
"0.54274565",
"0.534371",
"0.5282453",
"0.52467144",
"0.5232329",
"0.5217508",
"0.5193479",
"0.51837045",
"0.5105391",
"0.5054226",
"0.5033739",
"0.50286376",
"0.50119936",
"0.49868548",
"0.4965605",
"0.49602434",
"0.49534455... | 0.4356578 | 98 |
Calculate the expanding quantile of the values. | def quantile(self, quantile: float, accuracy: int = 10000) -> FrameLike:
return super().quantile(quantile, accuracy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transfo_quantile(xx):\n\n # nn = np.zeros(len(xx))\n # oo = np.argsort(xx)\n # nn[oo] = np.arange(len(xx)) / len(xx) + 1 / (2 * len(xx))\n # return nn\n\n return rankdata(xx) / len(xx) - 1 / (2 * len(xx))",
"def quantile_func(q):\n def f(x):\n return np.quantile(x, q)\n\n... | [
"0.6554137",
"0.63115823",
"0.6219473",
"0.6177999",
"0.61537474",
"0.6121143",
"0.6121143",
"0.611989",
"0.61117923",
"0.6086273",
"0.6068111",
"0.60444456",
"0.6014211",
"0.6013403",
"0.5987583",
"0.59792155",
"0.5972617",
"0.59611946",
"0.59491116",
"0.5948437",
"0.5945259... | 0.594926 | 19 |
Calculate expanding standard skew. Returns Series or DataFrame Returns the same object type as the caller of the expanding calculation. See Also | def skew(self) -> FrameLike:
return super().skew() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skewness(self,return_series:pd.Series): \n\n demeaned_returns = return_series - return_series.mean()\n\n # Use the population standard deviation, so set dof=0\n sigma_r = return_series.std(ddof=0)\n exp = (demeaned_returns ** 3).mean()\n return exp/sigma_r ** 3",
"def skew... | [
"0.6078592",
"0.59900975",
"0.5871541",
"0.5806588",
"0.5776601",
"0.5695841",
"0.56594837",
"0.5622702",
"0.5587426",
"0.55804914",
"0.53668517",
"0.5354548",
"0.533076",
"0.5293236",
"0.52794033",
"0.52194995",
"0.5174413",
"0.51682884",
"0.51613647",
"0.51313967",
"0.51173... | 0.5737168 | 7 |
Calculate an online exponentially weighted mean. Notes There are behavior differences between pandasonSpark and pandas. the current implementation of this API uses Spark's Window without specifying partition specification. This leads to move all data into single partition in single machine and could cause serious perfo... | def mean(self) -> FrameLike:
return super().mean() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exponential_weighted_moving_average(self, period=50,\n column='adj_close'):\n return pd.Series(\n self.ohlcv[column].ewm(ignore_na=False, min_periods=period - 1,\n span=period).mean(),\n name='... | [
"0.65114504",
"0.60645187",
"0.58863807",
"0.58267826",
"0.5805524",
"0.580511",
"0.5804684",
"0.5796743",
"0.57613146",
"0.57407624",
"0.567007",
"0.5654368",
"0.564549",
"0.5581292",
"0.5536963",
"0.55317104",
"0.5531338",
"0.5526338",
"0.5490223",
"0.5481733",
"0.54809994"... | 0.533443 | 41 |
Calculate an online exponentially weighted mean. Notes There are behavior differences between pandasonSpark and pandas. the current implementation of this API uses Spark's Window without specifying partition specification. This leads to move all data into single partition in single machine and could cause serious perfo... | def mean(self) -> FrameLike:
return super().mean() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exponential_weighted_moving_average(self, period=50,\n column='adj_close'):\n return pd.Series(\n self.ohlcv[column].ewm(ignore_na=False, min_periods=period - 1,\n span=period).mean(),\n name='... | [
"0.6511822",
"0.60625046",
"0.5885925",
"0.58253944",
"0.5806458",
"0.5805351",
"0.5803309",
"0.57966244",
"0.576166",
"0.57405263",
"0.56699467",
"0.5654006",
"0.5645146",
"0.5581624",
"0.5536618",
"0.55334294",
"0.5528486",
"0.5525051",
"0.5488619",
"0.5481305",
"0.54810065... | 0.5335349 | 40 |
Numeric scenarios where Oracle type info is 'broken', returning us precision, scale of the form (0, 0) or (0, 127). We convert to Decimal and let int()/float() processors take over. | def test_numerics_broken_inspection(self):
metadata = self.metadata
# this test requires cx_oracle 5
foo = Table('foo', metadata,
Column('idata', Integer),
Column('ndata', Numeric(20, 2)),
Column('ndata2', Numeric(20, 2)),
Column('nidata', Numer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_decimal_e(cursor: pyodbc.Cursor):\n value = Decimal((0, (1, 2, 3), 5)) # prints as 1.23E+7\n cursor.execute(\"create table t1(d decimal(10, 2))\")\n cursor.execute(\"insert into t1 values (?)\", value)\n result = cursor.execute(\"select * from t1\").fetchone()[0]\n assert result == value",... | [
"0.64769566",
"0.6471073",
"0.63983536",
"0.6364267",
"0.61503637",
"0.60364056",
"0.6020658",
"0.6007777",
"0.59986687",
"0.59626794",
"0.5961035",
"0.59441483",
"0.59394944",
"0.59222674",
"0.59026015",
"0.58304995",
"0.5813088",
"0.57763886",
"0.57734025",
"0.57529813",
"0... | 0.6691026 | 0 |
Returns true if the list is unique. | def unique_list(var):
return len([x for x in set(var)]) == len(var) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkUniqueness_(self, list):\n\n uniqueList = []\n # use a list comprehension statement (takes a while to understand) \n\n [uniqueList.append(it) for it in list if not uniqueList.count(it)]\n\n return (len(list)==len(uniqueList))",
"def is_unique(L):\n for i in range(len(L)):\... | [
"0.8162772",
"0.7768846",
"0.77603513",
"0.7749613",
"0.7407355",
"0.7351032",
"0.7310131",
"0.72431886",
"0.71386975",
"0.7130326",
"0.7104967",
"0.7103466",
"0.70849496",
"0.6982283",
"0.69577664",
"0.6928952",
"0.691983",
"0.6864547",
"0.6843328",
"0.681315",
"0.6763285",
... | 0.7630314 | 4 |
Return time series data of given province | def get_province_df(df, provinceName: str) -> pandas.core.frame.DataFrame:
return df[(df['province']==provinceName) & (df['city'].isnull())] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_provincial_series(province):\n series = prov_series_coll.find_one(\n {PROVINCE_KEY: province}, {\"_id\": False})\n return translate_series_lang(series)",
"def get_province_data(province):\n cursor = prov_data_coll.find({PROVINCE_KEY: province})\n df = pd.DataFrame(list(cursor))\n if... | [
"0.65234",
"0.6363227",
"0.6123158",
"0.5895928",
"0.5770566",
"0.5718587",
"0.5611552",
"0.56019753",
"0.5573704",
"0.55593425",
"0.55568475",
"0.5537867",
"0.5525989",
"0.5523191",
"0.55133015",
"0.5501706",
"0.54799443",
"0.5473967",
"0.54612404",
"0.5431595",
"0.5431574",... | 0.53054297 | 54 |
Returns the features of the current state (i.e., the location of the agent) | def get_features(self):
x,y = self.agent
return np.array([x,y]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFeatures(self, state, action, thisAgent):\n util.raiseNotDefined()",
"def get_who_features(self):\n return self.who_made_features",
"def get_features(self):\n return self._features",
"def getFeatures(self, state, action):\n util.raiseNotDefined()",
"def getFeatures(self, ... | [
"0.76511186",
"0.73879236",
"0.7264916",
"0.7073085",
"0.7073085",
"0.7073085",
"0.70612127",
"0.70573694",
"0.6970577",
"0.68356776",
"0.6733326",
"0.67205673",
"0.66852176",
"0.66139555",
"0.659136",
"0.659136",
"0.6588222",
"0.65070003",
"0.65032876",
"0.64905256",
"0.6441... | 0.7441654 | 1 |
Return a string with the current time nicely formatted. | def get_time(self):
x = time.localtime()
return ''.join([
str(x[0]).rjust(4, '0'), '/', str(x[1]).rjust(2, '0'), '/',
str(x[2]).rjust(2, '0'), ' ', str(x[3]).rjust(2, '0'), ':',
str(x[4]).rjust(2, '0'), ':', str(x[5]).rjust(2, '0')]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def str_current_time():\n return strftime(\"%Y_%m_%d_%H_%M_%S_%Z\", gmtime())",
"def _get_current_time() -> str:\n return datetime.now().strftime(\"%FT%H:%M:%S\")",
"def time_now() -> str:\n return datetime_to_str(datetime_now())",
"def timestr():\n return dt.strftime(dt.now(),'%H:%M:%S')",
"de... | [
"0.84012175",
"0.8361597",
"0.82953554",
"0.8238221",
"0.811072",
"0.8066993",
"0.8026812",
"0.79913104",
"0.7980262",
"0.79560447",
"0.7921243",
"0.79026",
"0.7878337",
"0.785339",
"0.77705663",
"0.7769186",
"0.7754033",
"0.7750938",
"0.77495265",
"0.77463174",
"0.7740321",
... | 0.7674273 | 24 |
Returns the current signal strength. | def GetCurrentSignalStrength(self, iwconfig=None):
try:
strength = int(self.wifi.GetSignalStrength(iwconfig))
except:
strength = 0
return strength | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wireless_signal_strength(self) -> int:\n return self.data[Attribute.WIRELESS_SIGNAL_STRENGTH]",
"def getStrength(self):\n return self.st",
"def strength(self) -> int:\n return self._strength",
"def strength(self) -> float:\n ...",
"def GetPrintableSignalStrength(self, iwconf... | [
"0.86211723",
"0.78083163",
"0.7472221",
"0.7319115",
"0.7258844",
"0.6974494",
"0.6964913",
"0.69649047",
"0.6963436",
"0.6757317",
"0.67060554",
"0.6680049",
"0.66463655",
"0.6592017",
"0.6583346",
"0.6572379",
"0.65464437",
"0.64455837",
"0.64267856",
"0.63989365",
"0.6351... | 0.8130565 | 1 |
Returns the current network. | def GetCurrentNetwork(self, iwconfig=None):
current_network = str(self.wifi.GetCurrentNetwork(iwconfig))
return current_network | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_network(self):\n return self._network",
"def get_network(self):\n return self.get_ip_network()[-1]",
"def network(self):\n return self.__network",
"def network(self):\n return self._network",
"def network(self):\n return self._network",
"def network(self):\n ... | [
"0.8669618",
"0.8464013",
"0.8426175",
"0.8423674",
"0.8423674",
"0.8423674",
"0.80385786",
"0.7931952",
"0.77918977",
"0.77775127",
"0.7530648",
"0.75047314",
"0.7222305",
"0.7190799",
"0.70858324",
"0.7003057",
"0.6899688",
"0.6740319",
"0.67005503",
"0.6687624",
"0.6687624... | 0.8243167 | 6 |
Finds the previous lastused network, and sets lastused to False. | def UnsetWiredLastUsed(self):
config = ConfigParser.ConfigParser()
config.read(self.wired_conf)
profileList = config.sections()
for profile in profileList:
if config.has_option(profile, "lastused"):
if misc.to_bool(config.get(profile, "lastused")):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_used(self, last_used):\n\n self._last_used = last_used",
"def GetLastUsedWiredNetwork(self):\n config = ConfigParser.ConfigParser()\n config.read(self.wired_conf)\n profileList = config.sections()\n for profile in profileList:\n if config.has_option(profile,... | [
"0.6704261",
"0.6562998",
"0.58863914",
"0.5752343",
"0.55431706",
"0.54944456",
"0.54129523",
"0.5368616",
"0.5343992",
"0.5276877",
"0.5184704",
"0.5180377",
"0.5176456",
"0.51272345",
"0.51226676",
"0.5101494",
"0.50584453",
"0.50232244",
"0.5021922",
"0.50021344",
"0.5000... | 0.63433534 | 2 |
Create requests session with any required auth headers applied. | def signed_session(self, session=None):
if session:
session = super(ClientCertAuthentication, self).signed_session(session)
else:
session = super(ClientCertAuthentication, self).signed_session()
if self.cert is not None:
session.cert = self.cert
if s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_session(self):\n self.session = requests.Session() # pragma: no cover\n self.session.headers[\"Accept\"] = \"application/json\" # pragma: no cover\n if self.user: # pragma: no cover\n self.session.auth = (self.user, self.cred) # pragma: no cover",
"def _initialize_... | [
"0.7982525",
"0.7685775",
"0.7522335",
"0.73731357",
"0.7173074",
"0.7056309",
"0.7031905",
"0.7011434",
"0.6936985",
"0.6871164",
"0.68638617",
"0.6847638",
"0.6841403",
"0.66765255",
"0.6656736",
"0.66522753",
"0.6648357",
"0.66448426",
"0.6634189",
"0.6620114",
"0.6613344"... | 0.0 | -1 |
Test that the access token is not included in the call to requests if it isn't actually set. | def test_request_should_not_include_token(self):
client = Client()
with patch("requests.request") as request:
request.return_value.json.return_value = {}
client.request("GET", "http://www.google.com/")
request.assert_called_once_with(
"GET",
"ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_should_include_token_when_set(self):\n client = Client()\n client.set_client_access_token(\"ABCDEF1234\")\n\n with patch(\"requests.request\") as request:\n request.return_value.json.return_value = {}\n\n client.request(\"GET\", \"http://www.google.com/\"... | [
"0.69099724",
"0.6793873",
"0.6654324",
"0.6580201",
"0.65588224",
"0.6500449",
"0.6497194",
"0.6463949",
"0.64552736",
"0.6439623",
"0.6430124",
"0.6421521",
"0.6421521",
"0.64164764",
"0.6411263",
"0.64094365",
"0.6386979",
"0.63326263",
"0.63274866",
"0.6315089",
"0.630704... | 0.6927419 | 0 |
Test that the access token is not included in the call to requests if it isn't actually set. | def test_request_should_include_token_when_set(self):
client = Client()
client.set_client_access_token("ABCDEF1234")
with patch("requests.request") as request:
request.return_value.json.return_value = {}
client.request("GET", "http://www.google.com/")
expected_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_should_not_include_token(self):\n client = Client()\n\n with patch(\"requests.request\") as request:\n request.return_value.json.return_value = {}\n\n client.request(\"GET\", \"http://www.google.com/\")\n\n request.assert_called_once_with(\n \"... | [
"0.692526",
"0.6794851",
"0.66552746",
"0.65810674",
"0.6560386",
"0.6500516",
"0.6498373",
"0.6464411",
"0.6455049",
"0.64409953",
"0.6431237",
"0.6422371",
"0.6422371",
"0.6416842",
"0.64118135",
"0.64092374",
"0.63875264",
"0.63331157",
"0.6328828",
"0.6314424",
"0.6308231... | 0.6907928 | 1 |
Denormalize a list of bounding boxes. | def denormalize_bboxes(bboxes: Sequence[BoxType], rows: int, cols: int) -> List[BoxType]:
return [denormalize_bbox(bbox, rows, cols) for bbox in bboxes] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def denormalize_bboxes(bboxes, rows, cols):\n return [denormalize_bbox(bbox, rows, cols) for bbox in bboxes]",
"def normalize_bboxes(bboxes, rows, cols):\n return [normalize_bbox(bbox, rows, cols) for bbox in bboxes]",
"def denormalize_bbox(bbox, rows, cols):\n x_min, y_min, x_max, y_max = bbox[:4]\n ... | [
"0.78807217",
"0.74085206",
"0.73613846",
"0.7231537",
"0.6852509",
"0.68149096",
"0.64614767",
"0.64555407",
"0.6405092",
"0.63514566",
"0.62930244",
"0.6263208",
"0.61158997",
"0.61002773",
"0.61002773",
"0.6096402",
"0.6092295",
"0.6078676",
"0.6065588",
"0.6061656",
"0.60... | 0.77204424 | 1 |
Calculate the area of a bounding box in (fractional) pixels. | def calculate_bbox_area(bbox: BoxType, rows: int, cols: int) -> float:
bbox = denormalize_bbox(bbox, rows, cols)
x_min, y_min, x_max, y_max = bbox[:4]
area = (x_max - x_min) * (y_max - y_min)
return area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundingBoxArea(box):\n return (box[2] - box[0] + 1) * (box[3] - box[1] + 1)",
"def box_area(box):\n x1, y1, x2, y2 = box\n w = x2 - x1\n h = y2 - y1\n return float(w) * h",
"def ratio_area_calculate(inpt_bboxes):\n bbox_width = inpt_bboxes[2] - inpt_bboxes[0]\n bbox_height = inpt_bboxes[3] - ... | [
"0.78045815",
"0.7625647",
"0.7602896",
"0.74564564",
"0.7390264",
"0.7215615",
"0.7076385",
"0.69173515",
"0.6872775",
"0.6869177",
"0.6868997",
"0.68631864",
"0.6829881",
"0.68236065",
"0.68236065",
"0.68236065",
"0.68232656",
"0.68232656",
"0.68194234",
"0.68158877",
"0.68... | 0.7702175 | 1 |
Parses .json file into corresponding dictionary. | def parse_json(file: str) -> Union[Dict, List]:
with open(file, 'r') as f:
return json.load(f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_json(json_file: str) -> dict:\n json_data = {}\n\n if not os.path.isfile(json_file):\n error_log(os.path.basename(json_file) + ' does not exist.')\n sys.exit(1)\n\n with open(json_file) as f:\n json_data = json.load(f)\n\n return json_data",
"def _parse_json(self, file_... | [
"0.7891738",
"0.7663358",
"0.75478274",
"0.75027597",
"0.74503195",
"0.74066526",
"0.73787266",
"0.73608536",
"0.7312658",
"0.7278362",
"0.72372603",
"0.72158164",
"0.72051376",
"0.7197018",
"0.7177204",
"0.7163607",
"0.7140415",
"0.7119488",
"0.7119488",
"0.7114829",
"0.7089... | 0.69856226 | 31 |
update the critics and actors of all the agents | def update(self, samples, agent_number, logger):
# need to transpose each element of the samples
# to flip obs[parallel_agent][agent_number] to
# obs[agent_number][parallel_agent]
obs, obs_full, action, reward, next_obs, next_obs_full, done = map(transpose_to_tensor, samples)
o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_all_agent(self):\n for a in self.agents:\n soft_update(a.target_actor, a.actor, self.tau)\n soft_update(a.target_critic, a.critic, self.tau)\n self.num_iteration += 1",
"def update(self):\n self.reset()\n\n # Indices of agents that are playing the game... | [
"0.7793435",
"0.62337434",
"0.5746579",
"0.57021135",
"0.56952703",
"0.5685467",
"0.5654011",
"0.5617586",
"0.55508715",
"0.55483985",
"0.55255216",
"0.5490698",
"0.54705274",
"0.5440514",
"0.54386806",
"0.54381484",
"0.5408061",
"0.53959286",
"0.5368262",
"0.5361991",
"0.536... | 0.53142095 | 25 |
Returns a list of unique elements. | def distinct(x):
return list(set(x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique(x):\n\n return list(set(x))",
"def _unique(li):\n return list(set(li))",
"def uniq(elements):\n us = set()\n ret = []\n for e in elements:\n if e not in us:\n ret.append(e)\n us.add(e)\n return ret",
"def unique(self) -> 'List':\n return List(s... | [
"0.8135051",
"0.81071657",
"0.78994274",
"0.7665435",
"0.76505595",
"0.75544333",
"0.7519827",
"0.75183785",
"0.74825877",
"0.7432918",
"0.7180456",
"0.7106987",
"0.7062618",
"0.69983023",
"0.6980118",
"0.6966864",
"0.69424653",
"0.6938975",
"0.6922897",
"0.69110525",
"0.6909... | 0.7652376 | 4 |
Determines if n is a pentagonal number. | def is_pentagonal_number(n):
_, x = quadratic.solve(3, -1, -2 * n)
return is_number(x) and x.is_integer() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pentagonal(n: int) -> bool:\r\n root = (1 + 24 * n) ** 0.5\r\n return ((1 + root) / 6) % 1 == 0",
"def is_pentagonal(n):\r\n if ((1+(24*n+1)**0.5) / 6)%1 == 0:\r\n return True\r\n return False",
"def is_pentagonal(n):\n if (1+(24*n+1)**0.5) % 6 == 0:\n return True\n retur... | [
"0.8522858",
"0.8440235",
"0.83206034",
"0.7996045",
"0.7980662",
"0.7979389",
"0.7956935",
"0.7767585",
"0.7568911",
"0.7174495",
"0.7059578",
"0.6889799",
"0.67332184",
"0.65034497",
"0.64901406",
"0.6219915",
"0.61275005",
"0.60998034",
"0.60733044",
"0.60708857",
"0.60448... | 0.8401958 | 2 |
Calculate the least common multiple (LCM) with the GCD | def lcm(a, b):
return a * b // gcd(a, b) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lcm(a, b):\n\treturn a * b // gcm(a, b)",
"def lcm(x, y):\n return x*y//gcd(x,y)",
"def calculate_lcm(a, b):\n return a * b / calculate_gcd(a, b)",
"def lcm(a, b):\r\n return a * b // gcd(a, b)",
"def lcm(a, b):\n return (a * b) // gcd(a, b)",
"def lcm(a, b):\n return (a * b) // gcd(a,... | [
"0.771724",
"0.75118214",
"0.7377945",
"0.73638743",
"0.7342399",
"0.7342399",
"0.72716194",
"0.7262457",
"0.7256145",
"0.7256122",
"0.7228192",
"0.72239876",
"0.7203598",
"0.7197848",
"0.7197848",
"0.7197848",
"0.71624833",
"0.714713",
"0.71353936",
"0.7112344",
"0.7092204",... | 0.7311851 | 13 |
Calculating the LCM for multiple digits is done with LCM(a,b,c) = LCM(LCM(a,b),c) | def lcm3(a, b, c):
return lcm(lcm(a, b), c) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lcms(argg: range) -> int:\n l = 1\n for arg in argg:\n l = lcm(l, arg)\n return l",
"def lcm(a, b):\n\treturn a * b // gcm(a, b)",
"def lcm(\n numbers: List[int]\n) -> int:\n current_product = 1\n current_gcd = 1\n for num in numbers:\n current_gcd = gcd(current_gcd, ... | [
"0.74799746",
"0.7416751",
"0.73715514",
"0.7331249",
"0.7331249",
"0.7331249",
"0.72743094",
"0.7223241",
"0.7195648",
"0.7182136",
"0.7175413",
"0.7173182",
"0.715772",
"0.71055746",
"0.7104485",
"0.70987123",
"0.7095417",
"0.70796764",
"0.70796764",
"0.70796764",
"0.707967... | 0.71872914 | 9 |
Returns true if a number is even. | def is_even(n):
return not n & 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_even(number: int) -> bool:\n return number % 2 == 0",
"def is_even(num: int) -> bool:\n return num % 2 == 0",
"def is_even(number):\n if ((number%2) == 0):\n return True\n else:\n return False",
"def is_even(number):\n return number % 2 == 0",
"def is_even(num):\n ret... | [
"0.91461295",
"0.9065452",
"0.9023459",
"0.8955101",
"0.89438593",
"0.8926138",
"0.8837423",
"0.8788827",
"0.8764839",
"0.8730728",
"0.8520685",
"0.84778684",
"0.8459611",
"0.84337556",
"0.840965",
"0.8362662",
"0.8144096",
"0.8134647",
"0.81077707",
"0.8101248",
"0.8086567",... | 0.8236534 | 16 |
Returns true if a number is odd. | def is_odd(n):
return n & 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_odd(number: int) -> bool:\n return number % 2 != 0",
"def is_odd(number):\r\n return number % 2 != 0",
"def is_odd(number):\n return (number%2)==1",
"def is_odd(n):\n if n % 2:\n return True\n else:\n return False",
"def is_odd(x):\n return x % 2 != 0",
"def is_odd(... | [
"0.9080994",
"0.8996677",
"0.89227676",
"0.86833453",
"0.8624675",
"0.8447069",
"0.8394348",
"0.8366546",
"0.8360469",
"0.83546597",
"0.83158505",
"0.8288782",
"0.82833856",
"0.8260126",
"0.82444865",
"0.8240067",
"0.8222919",
"0.8016853",
"0.79482347",
"0.7928637",
"0.787087... | 0.81228924 | 17 |
Shift all the elements in the list by n. | def shift(a, n=1):
return a[n:] + a[:n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate(l: list, n: int) -> list:\n return l[-n:] + l[:-n]",
"def shift(xs, n):\n if n == 0:\n return xs\n e = np.empty_like(xs)\n if n >= 0:\n e[:n] = np.nan\n e[n:] = xs[:-n]\n else:\n e[n:] = np.nan\n e[:n] = xs[-n:]\n return e",
"def shift(xs, n):\n ... | [
"0.75024766",
"0.7353221",
"0.73162395",
"0.722238",
"0.7216927",
"0.7197835",
"0.7197835",
"0.7190144",
"0.69390905",
"0.6933694",
"0.67388165",
"0.65248513",
"0.64849293",
"0.6400313",
"0.63938487",
"0.6310599",
"0.6282861",
"0.62806785",
"0.62598115",
"0.6251737",
"0.62077... | 0.77391315 | 0 |
Returns true if a list of numbers is pandigital from 1 up to n. | def is_pandigital_to_n(x, n, zero_based=False):
return set(x) == set(range(0 if zero_based else 1, n + 1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_pandigital(n: int) -> bool:\n str_n = str(n)\n for i in range(1, len(str_n) + 1):\n if str(i) not in str_n:\n return False\n return True",
"def pandigital(number):\n return sorted(list(str(number))) == PANDIGITAL",
"def is_pandigital(n):\n # Accept both str and int\n ... | [
"0.7976703",
"0.7689373",
"0.7605373",
"0.7470757",
"0.7452563",
"0.7234914",
"0.7121272",
"0.7109357",
"0.6803729",
"0.67169833",
"0.65595406",
"0.6474384",
"0.64248985",
"0.63553095",
"0.6286665",
"0.6243434",
"0.61898637",
"0.6164902",
"0.6095151",
"0.6094256",
"0.6013914"... | 0.83244246 | 0 |
Test if a number n is prime ktimes. | def is_prime(n, k):
if n <= 1 or n == 4:
return False
if n <= 3:
return True
if is_even(n):
return False
while k > 0:
# Take random int in [2, n-2]
a = random.randint(2, n-1)
# Check if a and n are co-prime.
if gcd(n, a) != 1:
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_prime(n):\n k = 2\n while n % k != 0:\n k += 1\n if k < n:\n return False\n else:\n return True",
"def is_prime(n, k=10):\n if n == 2 or n == 3:\n return True\n if not n & 1 or n < 2:\n return False\n m = n - 1\n s = 1\n d = m >> 1\n while n... | [
"0.7935233",
"0.78513116",
"0.7781704",
"0.7718821",
"0.7689199",
"0.76649594",
"0.7612282",
"0.75961745",
"0.75961745",
"0.7562867",
"0.7533709",
"0.7504115",
"0.7476252",
"0.7402502",
"0.739179",
"0.7319099",
"0.7317026",
"0.73155737",
"0.7305895",
"0.7296735",
"0.7280601",... | 0.78205246 | 2 |
Find the first index from the right whose element is larger than his neighbour. | def _first_index_with_bigger_neighbour(P):
i = len(P) - 1
while i > 0 and P[i-1] >= P[i]:
i -= 1
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findFirstElementGreaterThan(self, array, index):\n l, r = 0, len(array) - 1\n ans = -1;\n while (l <= r):\n mid = l + (r - l) // 2;\n # Move to right side if target is greater\n if (array[mid] <= index):\n l = mid + 1;\n # Move lef... | [
"0.69773877",
"0.6965572",
"0.68642104",
"0.6846698",
"0.66025203",
"0.6576602",
"0.6528824",
"0.65279424",
"0.6513431",
"0.64999205",
"0.6458335",
"0.6424017",
"0.642034",
"0.6405371",
"0.63683045",
"0.63634926",
"0.6362907",
"0.6344843",
"0.6338257",
"0.6338083",
"0.6335269... | 0.7449399 | 0 |
Find the first index from the right whose element is smaller than his neighbour. | def _first_index_with_smaller_neighbour(P):
i = len(P) - 1
while i > 0 and P[i-1] <= P[i]:
i -= 1
return i | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _first_index_with_bigger_neighbour(P):\n i = len(P) - 1\n while i > 0 and P[i-1] >= P[i]:\n i -= 1\n return i",
"def findMin(self, nums: list[int]) -> int:\n\n left_pointer = 0\n right_pointer = len(nums) -1\n\n while left_pointer != right_pointer:\n \n ... | [
"0.73993766",
"0.6832556",
"0.67739224",
"0.66365355",
"0.65787935",
"0.656294",
"0.65551186",
"0.6549718",
"0.6539957",
"0.65252745",
"0.6521195",
"0.65174854",
"0.6508279",
"0.64768",
"0.64746803",
"0.6472778",
"0.64505607",
"0.64353615",
"0.6431772",
"0.64125407",
"0.63896... | 0.7463599 | 0 |
Returns a list with the cumulative sum of a list L. | def cumsum(L):
for i in range(1, len(L)):
L[i] += L[i-1]
return L | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cumulative_sum(self, lis):\n new_list = []\n for i in range(len(lis)):\n if i == 0:\n new_list.append(lis[i])\n else:\n new_list.append(new_list[i-1] + lis[i])\n return new_list",
"def cumsum(ls):\n\t\n\tacc = 0\n\tr = [0 for v in ls]\n\tfor i,v in enumerate(ls):\n\t\tacc += ... | [
"0.81646955",
"0.80187523",
"0.74323314",
"0.735127",
"0.7269006",
"0.70629084",
"0.6967668",
"0.69544303",
"0.67749166",
"0.6676463",
"0.6608064",
"0.6608064",
"0.6608064",
"0.6586359",
"0.6550287",
"0.63230795",
"0.6281289",
"0.6187095",
"0.61505115",
"0.6111453",
"0.605791... | 0.8331271 | 0 |
Initialize an NN with one hidden layer. Weight of the hidden layer is the embedding. | def __init__(self, heropool_size, embedding_dim):
super().__init__()
self.embedding_dim = embedding_dim
self.embeddings = nn.Embedding(heropool_size, embedding_dim)
self.affine = nn.Linear(embedding_dim, heropool_size)
self.init_emb() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_hidden(self):\n\n weight = next(self.parameters()).data\n return Variable(weight.new(self.layers, self.batch_size, self.hidden_size).zero_())",
"def initialise_hidden(self, batch_size):\n \n weight = next(self.parameters()).data\n \n hidden = (weight.new(self._n... | [
"0.7965033",
"0.76091236",
"0.7468455",
"0.7224613",
"0.7218272",
"0.72060806",
"0.7202066",
"0.71193534",
"0.6988582",
"0.69583476",
"0.6902648",
"0.68493634",
"0.6843761",
"0.6814984",
"0.6794617",
"0.6781313",
"0.67502886",
"0.6736125",
"0.6729619",
"0.6725083",
"0.6708274... | 0.0 | -1 |
Reads in a pandas dataframe with 'structs' and 'valences' columns. Returms a dictionary with all ions' polarizability parameters. | def get_ion_params(self):
params = {}
# Extract formal valence dictionary from csv file
valences = self.get_valences()
if not valences:
return None
# Determine anion by finding element with highest electronegativity
# Assumes homoanionicity
anion, ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def df_2_dict(df,band_list,lens_model_list,source_model_list,lens_light_model_list):\n \n import re\n from lenstronomy.Util.param_util import ellipticity2phi_q\n from lenstronomy.Util.param_util import shear_cartesian2polar\n \n import pandas as pd\n \n\n model_kwarg_names = get_kwarg_names... | [
"0.56588984",
"0.56161743",
"0.55952996",
"0.54904026",
"0.546902",
"0.529164",
"0.5151079",
"0.5064812",
"0.5024605",
"0.5018308",
"0.5007193",
"0.49960458",
"0.49960136",
"0.49953946",
"0.49878415",
"0.4956519",
"0.49477887",
"0.4942417",
"0.49165404",
"0.49117386",
"0.4857... | 0.0 | -1 |
Hardware version if available. | def hardware_version(self):
return self.data.get('hw_ver') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hardware_version(self):\n cmd = protocol.GET_HARDWARE_VERSION\n response = self.__send_and_receive(cmd)\n\n value = self.__gen_response_value(response)\n if value:\n self.hardware_version = value[0][1:]\n else:\n return False",
"def hw_version(self... | [
"0.7971327",
"0.7812939",
"0.75628585",
"0.7403868",
"0.71892804",
"0.7079321",
"0.70732576",
"0.7002558",
"0.69431925",
"0.6895754",
"0.68952006",
"0.6779089",
"0.6748601",
"0.6748601",
"0.6747525",
"0.67072135",
"0.6643813",
"0.66342306",
"0.6629074",
"0.6612783",
"0.653914... | 0.7925143 | 1 |
Verify that given data overrides environ | def test_provided_data_takes_precedence_over_environ(self, mock_provider, monkeypatch):
p = mock_provider()
prefix = f'mock_'
monkeypatch.setenv(f'{prefix}{p.provider_name}_required'.upper(), 'foo')
rsp = p.notify(required='bar', env_prefix=prefix)
assert rsp.status == 'success'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_environ():\n global _environ_checked\n if _environ_checked:\n return\n\n if os.name == 'posix' and 'HOME' not in os.environ:\n import pwd\n os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]\n\n if 'PLAT' not in os.environ:\n os.environ['PLAT'] = _sysconfig.get_plat... | [
"0.6642426",
"0.6541707",
"0.6534115",
"0.62638474",
"0.62410915",
"0.61864275",
"0.6180307",
"0.6178446",
"0.6118315",
"0.61031157",
"0.60184413",
"0.60181314",
"0.5991904",
"0.5988207",
"0.59804714",
"0.597853",
"0.59596884",
"0.59570277",
"0.59444827",
"0.58905166",
"0.587... | 0.6144856 | 8 |
Align the xaxis of coords invert coordinates above the threshold. If you do not align, the average value of the rotation map will be incorrect. | def align_coords(self, coords_list, eps=0.03,
min_sample=2, angle_thresh=90., copy_list=True):
if copy_list:
coords_list = copy.copy(coords_list)
# dbscan = DBSCAN(eps=eps, min_samples=min_sample).fit(
# [coords.worldpos() for coords in coords_list])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resetAlignmentCenter(self):\n cent = self.TiltSeries_._TiltAlignmentParas.cent\n imdimX = self.TiltSeries_._imdimX\n imdimY = self.TiltSeries_._imdimY\n print(imdimX, imdimY)\n if cent[0] != imdimX//2+1 or cent[1] != imdimY//2+1:\n #rint \"Centers do not match: cen... | [
"0.6270752",
"0.59773225",
"0.5666243",
"0.5650593",
"0.5631661",
"0.5599575",
"0.55796343",
"0.55618596",
"0.55366474",
"0.54947186",
"0.5449549",
"0.54119194",
"0.5338995",
"0.5311515",
"0.53038174",
"0.52852815",
"0.5281521",
"0.5274515",
"0.52552736",
"0.52191436",
"0.520... | 0.0 | -1 |
Move camera to random position | def move_to_random_pos(self):
newpos = [(np.random.rand() - 0.5) * 0.1,
(np.random.rand() - 0.5) * 0.1,
np.random.rand() * 0.9 + 0.2]
self.move_to(newpos) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def MoveRandom(self):\n r = random.randint(0,3)\n if r == 0: self.x += 1\n elif r == 1: self.y += 1\n elif r == 2: self.x -= 1\n elif r == 3: self.y -= 1",
"def move(self):\n if random.random() < 0.5:\n self.y = (self.y + 1) % 100\n else:\n s... | [
"0.7386138",
"0.70071167",
"0.68540794",
"0.6778723",
"0.67470753",
"0.66943437",
"0.6659997",
"0.6598114",
"0.6584725",
"0.6552027",
"0.6417505",
"0.64119756",
"0.6408727",
"0.6398622",
"0.63780385",
"0.63716376",
"0.63701326",
"0.6346462",
"0.63422394",
"0.6337698",
"0.6337... | 0.72923326 | 1 |
Add quaternion to target pixel | def add_quaternion(self, px, py, q):
iy, ix = np.where(
create_circular_mask(self.height, self.width, py, px, radius=50))
idices = ix + iy * self.width
for idx in idices:
if self.average:
self._rotations_buffer[idx].append(q.tolist())
self._rot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rotate_quaternion(self, q):\n self._normalise()\n return self * q * self.conjugate",
"def _quatm(q1, q0):\n w0, x0, y0, z0 = q0\n w1, x1, y1, z1 = q1\n\n return torch.cuda.FloatTensor([\n -x1*x0 - y1*y0 - z1*z0 + w1*w0,\n x1*w0 + y1*z0 - z1*y0 + w1*x0,\n -x1*z0 + ... | [
"0.6438959",
"0.6425648",
"0.6224595",
"0.60717285",
"0.6026446",
"0.5997901",
"0.5965803",
"0.5942622",
"0.58422667",
"0.58208823",
"0.57938117",
"0.57823616",
"0.5717632",
"0.56897116",
"0.56224173",
"0.56224173",
"0.5584455",
"0.55586374",
"0.5546544",
"0.55264205",
"0.549... | 0.6486773 | 0 |
Check whether PyOP2 has been yet initialised but not yet finalised. | def initialised():
return _initialised | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialized(self):\n return len(self.ops) > 0",
"def _is_initialized(self) -> bool:\n return len(self) > 0",
"def is_initialized(self) -> bool:\n return (\n (self._exchange_params_by_currency_id is not None)\n and (self._utility_params_by_good_id is not None)\n ... | [
"0.6709851",
"0.65721846",
"0.63601816",
"0.62607545",
"0.61877376",
"0.6032089",
"0.6004365",
"0.5961692",
"0.58815646",
"0.58815646",
"0.5861061",
"0.5861061",
"0.5856769",
"0.58521485",
"0.58294636",
"0.58094513",
"0.5788506",
"0.5786367",
"0.57676417",
"0.57675046",
"0.57... | 0.58327687 | 14 |
Builds the soft position embedding layer. | def __init__(self, hidden_size, resolution):
super().__init__()
self.embedding = nn.Linear(4, hidden_size, bias=True)
self.grid = build_grid(resolution) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(self,unused):\n # (word_embeddings_shape, _) = input_shapes\n # width = word_embeddings_shape.as_list()[-1]\n if self.use_type_embeddings:\n self.type_embeddings = self.add_weight(\n \"token_type_embeddings\",\n shape=[self.token_type_vocab_size, self.word_embedding_width]... | [
"0.69787043",
"0.68255764",
"0.65567356",
"0.64129466",
"0.6338233",
"0.6317087",
"0.6184793",
"0.61430395",
"0.6114303",
"0.6098443",
"0.60975045",
"0.60855806",
"0.60527855",
"0.6040693",
"0.6037953",
"0.6034154",
"0.6028856",
"0.6008823",
"0.6006079",
"0.5994261",
"0.59707... | 0.0 | -1 |
return duration in ms | def get_duration(self) -> int:
return int( (self._frame_count / self._fps) * 1000 ) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration():\r\n elapsed_time, duration = video_time()\r\n return duration",
"def duration(self):\n return float('{0:.2f}'.format(self.end_time - self.start_time))",
"def duration(self):\n self._current_duration = time.perf_counter() - self._duration_start\n return round(self._cur... | [
"0.8198213",
"0.8135683",
"0.8001177",
"0.79982626",
"0.7969093",
"0.7958475",
"0.792942",
"0.7917078",
"0.7917078",
"0.78779304",
"0.7855336",
"0.77842885",
"0.7773819",
"0.777192",
"0.777192",
"0.77588755",
"0.77551085",
"0.7743518",
"0.77424026",
"0.7739521",
"0.7737986",
... | 0.7620283 | 38 |
Returns About US content from static JSON file '/api/resources/aboutus.json' | def get_about_us(request):
try:
filename = 'api/resources/about-us.json'
file = open(filename, 'r')
data = file.read()
data = json.loads(data)
file.close()
except (IOError, ValueError):
data = {"description": "Error in fetching content."}
return Response(d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n data = []\n with open(\"data/company.json\", \"r\", encoding=\"utf-8\") as json_data:\n data = json.load(json_data)\n return render_template(\"about.html\", page_title=\"About Us\", company=data)",
"def about_us():\n\n return render_template('about_us.html')",
"def about_us():... | [
"0.76732886",
"0.6446097",
"0.64255077",
"0.62863696",
"0.6154729",
"0.6136861",
"0.60952646",
"0.6062029",
"0.60210794",
"0.5977289",
"0.592536",
"0.58792615",
"0.5871299",
"0.586382",
"0.5852385",
"0.582388",
"0.5808138",
"0.58007264",
"0.57934916",
"0.57584137",
"0.5744753... | 0.853148 | 0 |
The command string formatted for the device | def fullCmdStr(self):
return "%s %s" % (self.locCmdID, self.cmdStr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatCommand(command):\n cmdstr=\"\"\n logging.debug(repr(command))\n for arg in command:\n if \" \" in arg:\n cmdstr=cmdstr+\" \\\"\"+arg+\"\\\"\"\n else:\n cmdstr=cmdstr+\" \"+arg\n return cmdstr",
"def command(self):\n return (self.command_).format(s... | [
"0.7277228",
"0.6961077",
"0.690658",
"0.68924063",
"0.6887406",
"0.67349434",
"0.672448",
"0.67003304",
"0.66987664",
"0.6636662",
"0.65768224",
"0.65441066",
"0.6485929",
"0.6469022",
"0.6437063",
"0.6416468",
"0.6416421",
"0.6394368",
"0.63923866",
"0.63922817",
"0.6329665... | 0.7348314 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.