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 |
|---|---|---|---|---|---|---|
Produce True if all the columns in board are valid | def is_cols_valid(bd):
for col in cols:
seen = []
for num in nums:
if bd[col[num]] == " ":
continue
elif bd[col[num]] not in seen:
seen += [bd[col[num]]]
else:
return False
else:
continue
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_board_valid(bd):\n return is_rows_valid(bd) and is_cols_valid(bd) and is_sqrs_valid(bd)",
"def check_full_board(self): #rows then columns\n for row in self.board:\n for column_of_row in row:\n if column_of_row == ' ':\n return False\n return Tr... | [
"0.8148822",
"0.80394965",
"0.78060925",
"0.7766209",
"0.77119875",
"0.77030057",
"0.7656814",
"0.7634992",
"0.76277673",
"0.7621578",
"0.7605814",
"0.7538337",
"0.7508653",
"0.7489973",
"0.7468745",
"0.7451293",
"0.7409968",
"0.7409968",
"0.7409277",
"0.7405512",
"0.73863757... | 0.7621387 | 10 |
Produce True if all the squares in board are valid | def is_sqrs_valid(bd):
for sqr in sqrs:
seen = []
for num in nums:
if bd[sqr[num]] == " ":
continue
elif bd[sqr[num]] not in seen:
seen += [bd[sqr[num]]]
else:
return False
else:
continue
retu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(self):\n for row in self.grid:\n for i in range(1, 10):\n if row.count(i) != 1:\n return False\n\n for col in range(9):\n lst = [row[col] for row in self.grid]\n for i in range(1, 10):\n if lst.count(i) != 1:\... | [
"0.784431",
"0.7843698",
"0.7840197",
"0.7829184",
"0.77732754",
"0.7739814",
"0.77205694",
"0.7581749",
"0.75570667",
"0.7472685",
"0.74633",
"0.7420677",
"0.7337626",
"0.7317925",
"0.7314828",
"0.73018175",
"0.729953",
"0.7294191",
"0.72923684",
"0.72762465",
"0.7269901",
... | 0.0 | -1 |
Renders the home page. | def home(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/index.html',
{
'title':'Aplicacion para transpasar datos del sensor FreeStyle Libre de MongoDB a MySql',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_home():\r\n\treturn render_template(\"index.html\")",
"def home():\n\n return render_template('home_page.html')",
"def home():\n\n return render_template(\"home.html\")",
"def home():\n return render_template('home.html')",
"def home():\n return render_template('home.html')",
"def ... | [
"0.85574406",
"0.853399",
"0.8351404",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.82762724",
"0.827363",
"... | 0.0 | -1 |
Renders the about page. | def about(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/about.html',
{
'title':'About',
'message':'Your application description page.',
'year':datetime.now().year,
}
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.7612688 | 74 |
Renders the about page. | def ConexionMongoDB(request):
assert isinstance(request, HttpRequest)
# conexión con mongo
#client = pymongo.MongoClient("mongodb+srv://Prueba:prueba@cluster0.xv7cj.mongodb.net/Prueba?retryWrites=true&w=majority")
# PARA PRUEBA LOCAL
client = pymongo.MongoClient("mongodb://localhost:27017")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def ConexionMysql(request):
assert isinstance(request, HttpRequest)
# conexión con MySql
# DOCUMENTACION DE:
# https://www.w3schools.com/python/python_mysql_select.asp
# PARA PRUEBA LOCAL
# ---------------------------------------------
#db =_mysql.connect(host="localhost",user="... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85650355",
"0.85034525",
"0.84489655",
"0.84044397",
"0.8394454",
"0.82935613",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82709616",
"0.82680845",... | 0.0 | -1 |
Renders the about page. | def TranspasoMongoDB_Mysql(request):
assert isinstance(request, HttpRequest)
# conexión con mongo
#client = pymongo.MongoClient("mongodb+srv://Prueba:prueba@cluster0.xv7cj.mongodb.net/Prueba?retryWrites=true&w=majority")
# PARA PRUEBA LOCAL
client = pymongo.MongoClient("mongodb://localhost:27... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about():\n return render_template('about.html', title='About')",
"def about():\n\n return render_template('about_page.html', title='About')",
"def about():\n\n\treturn render_template(\"about.html\")",
"def on_about(self):\n render_about_window()",
"def about():\n return render_temp... | [
"0.85647076",
"0.8502948",
"0.8448504",
"0.840492",
"0.83937883",
"0.8293176",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82704526",
"0.82675153",
"... | 0.0 | -1 |
run the inference to segment the given 'sentence' represented by the one_hot vector by time | def process_sentence(sess, model_settings, model_vars, one_hot_by_t):
states = np.zeros((model_settings['num_layers'], 2, 1, model_settings['lstm_size']))
feed = { model_vars['inputs']: one_hot_by_t, model_vars['init_state']: states }
probs = sess.run([model_vars['probs']], feed_dict=feed)
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_input_sentence(sess, char_dict, model_settings, model_vars, sentence):\n chars = list(sentence.strip())\n cids = char_dict.chars2cids(chars)\n \n in_embedding = np.eye(model_settings['input_classes'])\n one_hot = in_embedding[cids]\n one_hot_by_t = np.expand_dims(one_hot, 1)\n\n ... | [
"0.6521087",
"0.5847386",
"0.5743348",
"0.56052655",
"0.55592453",
"0.55573297",
"0.55425054",
"0.5487733",
"0.54837143",
"0.5477239",
"0.54739034",
"0.54292125",
"0.5428611",
"0.5395592",
"0.5375556",
"0.53449756",
"0.53403956",
"0.5335282",
"0.53305554",
"0.5326771",
"0.532... | 0.65943044 | 0 |
Remove the escaping double quote in database/schema/table name. | def removeEscapingDoubleQuoteInSQLString(string, forceDoubleQuote=True):
if string is None:
return string
string = string.replace('""', '"')
if forceDoubleQuote:
string = '"' + string + '"'
return string | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def standardize_table_name(self, schema_name: str, table: str) -> str:\n return table",
"def clean_table_name(self, query, table_name):\n stripped_tbl_name = table_name.replace(\":\", \"\")\n query = query.replace(table_name, stripped_tbl_name)\n return query",
"def encodeTableName(... | [
"0.6746013",
"0.6571479",
"0.64551353",
"0.63946885",
"0.63256586",
"0.6258923",
"0.6225575",
"0.61999094",
"0.6144464",
"0.60889405",
"0.58507246",
"0.5821105",
"0.5799137",
"0.5792837",
"0.57828605",
"0.5736763",
"0.57299495",
"0.56950504",
"0.56733775",
"0.5630779",
"0.558... | 0.6187336 | 8 |
Computes a gradient clipping coefficient based on gradient norm. | def clip_gradient(model, clip_norm):
totalnorm = 0
for p in model.parameters():
if p.requires_grad:
modulenorm = p.grad.data.norm()
totalnorm += modulenorm ** 2
totalnorm = torch.sqrt(totalnorm).item()
norm = (clip_norm / max(totalnorm, clip_norm))
for p in model.para... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_gradient(parameters, clip):\n totalnorm = 0\n for p in parameters:\n modulenorm = p.grad.data.norm()\n totalnorm += modulenorm ** 2\n totalnorm = math.sqrt(totalnorm)\n return min(1, clip / (totalnorm + 1e-6))",
"def clip_gradient(model, clip_norm):\n totalnorm = 0\n for ... | [
"0.8191716",
"0.78346074",
"0.78174865",
"0.7811237",
"0.69404197",
"0.69353336",
"0.6884082",
"0.67259157",
"0.6652198",
"0.65632784",
"0.6527539",
"0.6527539",
"0.6527539",
"0.6527539",
"0.6527539",
"0.65248495",
"0.6473864",
"0.64583087",
"0.6435212",
"0.6383344",
"0.63408... | 0.7682328 | 4 |
Sets the learning rate to the initial LR decayed by 0.5 every 20 epochs | def adjust_learning_rate(optimizer, decay=0.1):
for param_group in optimizer.param_groups:
param_group['lr'] = decay * param_group['lr'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr",
"def adjust_learning_rate(initial_lr, optimizer, epoch, every_epoch):\n lr = i... | [
"0.7835607",
"0.7812632",
"0.77776325",
"0.77257156",
"0.7719971",
"0.7695487",
"0.7695487",
"0.7686043",
"0.7679609",
"0.767844",
"0.7677539",
"0.7666965",
"0.76379675",
"0.7630909",
"0.7624285",
"0.7616628",
"0.7608715",
"0.760059",
"0.75950325",
"0.75872266",
"0.75723183",... | 0.0 | -1 |
Vertical position of aircraft MAC | def maCruise(self):
return .77 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top_y(self):\r\n return self.position.y + self.size.y + self.bulk",
"def vertPosT(self):\n return 5.47",
"def get_virtual_y_position(self):\n x_real = (\n - 1 * (self.get_x_position() - self.get_origin_x_position()) * cos(\n self.get_origin_direction() * pi / 18... | [
"0.58976644",
"0.5884633",
"0.5863856",
"0.58634156",
"0.57961035",
"0.57663465",
"0.57097375",
"0.56721014",
"0.5638988",
"0.5638735",
"0.5616592",
"0.56152296",
"0.5573647",
"0.55366784",
"0.5515802",
"0.5489761",
"0.54855865",
"0.54807484",
"0.54647785",
"0.5455101",
"0.54... | 0.0 | -1 |
Gravity center position of aircraft minus tail | def cg(self):
A = self.clAlphaT / self.clAlphaWF
B = (1 - self.downwashGradW)
C = (self.surfaceT * self.tlH) / (self.surfaceW * self.cMACW)
sm = 0.05 * self.cMACW # static margin, approximated as 5% of aircraft MAC
return self.ac + A * B * C * self.speedRatio**2 - sm | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_of_gravity(self):\n weights = [self.stabilizer_h.weight, self.stabilizer_vright.weight, self.stabilizer_vleft.weight]\n cgs = [self.stabilizer_h.center_of_gravity, self.stabilizer_vright.center_of_gravity,\n self.stabilizer_vleft.center_of_gravity]\n total_weight = sum... | [
"0.6927646",
"0.6704255",
"0.63623136",
"0.63343525",
"0.62096477",
"0.61994815",
"0.6154235",
"0.6134563",
"0.6126668",
"0.6065038",
"0.60513777",
"0.59931",
"0.5969647",
"0.5903629",
"0.59011346",
"0.58690214",
"0.58690214",
"0.586216",
"0.58571464",
"0.5853454",
"0.5775763... | 0.54887927 | 50 |
Yield successive nsized chunks from l. | def chunks(l, n):
for i in range(0, len(l), n):
yield l[i:i + n] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]",
"def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def get_chunks(self, ... | [
"0.8038813",
"0.79248375",
"0.7923423",
"0.7885103",
"0.78773195",
"0.7815877",
"0.77655786",
"0.77556044",
"0.77441615",
"0.7731815",
"0.77288336",
"0.772473",
"0.77028215",
"0.76889825",
"0.76889825",
"0.7664208",
"0.76570904",
"0.7655856",
"0.7655856",
"0.76458347",
"0.764... | 0.7448925 | 60 |
make a trie from input | def make_trie(self, root, *words):
_end = '_end_'
for word in words:
current_dict = root
for letter in word:
current_dict = current_dict.setdefault(letter, {})
current_dict[_end] = word
return root | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tricky_trie():\n from trie import Trie\n trie = Trie()\n trie.insert('bbbbbbb')\n trie.insert('bbb')\n trie.insert('lololololol')\n trie.insert('blololololol')\n return trie",
"def build_trie(text):\n\ttrie = Trie()\n\tnumbers, words = read_file(text)\n\tfor i in range(len(words)):\n\t\t... | [
"0.72452307",
"0.7073765",
"0.7000022",
"0.6864744",
"0.6701841",
"0.6684528",
"0.6617508",
"0.65324044",
"0.6498399",
"0.64209867",
"0.63756317",
"0.6355602",
"0.6330824",
"0.628766",
"0.6198793",
"0.61716527",
"0.61586726",
"0.61545414",
"0.61503285",
"0.61228555",
"0.61228... | 0.696359 | 3 |
We retrieve the trie from pickle | def retrieve_trie(self):
trie = pickle.load(open(self.persist, "rb"))
return trie | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\r\n self.trie = {}",
"def __init__(self):\n self.trie = {}",
"def __init__(self):\n self.trie = {}",
"def __init__(self):\n self.trie = {}",
"def __init__(self):\n self.trie = {}",
"def __init__(self):\n self.trie = dict()",
"def __init__(se... | [
"0.7368735",
"0.7325107",
"0.7325107",
"0.7325107",
"0.7325107",
"0.7123114",
"0.7123114",
"0.69638956",
"0.69357395",
"0.6866607",
"0.67798203",
"0.67592555",
"0.67410094",
"0.67410094",
"0.6682941",
"0.6638102",
"0.65764415",
"0.65193063",
"0.6486433",
"0.6484355",
"0.64634... | 0.8099526 | 0 |
Gets or sets id | def id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_id(self):\n return self.id",
"def set_id(self, id_=None):\n if id_ is None:\n self.id = id(self)\n else:\n self.id = id_",
"def get_id(self) -> Optional[str]:\n return self.id_",
"def id(self) -> int:\n return pulumi.get(self, \"id\")",
"def... | [
"0.79764104",
"0.78441656",
"0.76899105",
"0.76671135",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",
"0.7662573",... | 0.0 | -1 |
Gets or sets actions required | def action_required(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "action_required") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actions_required(self) -> Optional[str]:\n return pulumi.get(self, \"actions_required\")",
"def actions_required(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"actions_required\")",
"def actions_required(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self,... | [
"0.75239193",
"0.7467756",
"0.7467756",
"0.7467756",
"0.7467756",
"0.7206714",
"0.70487046",
"0.7028684",
"0.7028684",
"0.7028684",
"0.69650245",
"0.6898122",
"0.67680687",
"0.6741672",
"0.6738721",
"0.67366123",
"0.6729874",
"0.66955507",
"0.6654367",
"0.66112506",
"0.652756... | 0.66140014 | 19 |
Returns the name of the group this algorithm belongs to. This string should be localised. | def group(self):
return self.tr(self.groupId()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_name(self) -> str:\n return pulumi.get(self, \"group_name\")",
"def group_name(self):\n\n return self._group_name",
"def get_group_name(self):\n return self.groupname",
"def group_name(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"group_name\")",
"... | [
"0.85458577",
"0.83224183",
"0.82844394",
"0.8166846",
"0.8105201",
"0.79550886",
"0.78789186",
"0.78789186",
"0.78493077",
"0.78237367",
"0.7797956",
"0.77105546",
"0.76375717",
"0.76375717",
"0.7613731",
"0.7541708",
"0.7541708",
"0.74033934",
"0.7395264",
"0.7386644",
"0.7... | 0.77484226 | 13 |
Returns the unique ID of the group this algorithm belongs to. This string should be fixed for the algorithm, and must not be localised. The group id should be unique within each provider. Group id should contain lowercase alphanumeric characters only and no spaces or other formatting characters. | def groupId(self):
return 'Online mapping' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self) -> str:\n return pulumi.get(self, \"group_id\")",
"def group_id(self):\n # type: () -> string_types\n return self._group_id",
"def group_id(self) -> pulumi.Output[Optional[str]]:\n retu... | [
"0.8272601",
"0.8272601",
"0.8182149",
"0.78590405",
"0.7763692",
"0.7699002",
"0.7699002",
"0.7699002",
"0.7637535",
"0.7609121",
"0.7609121",
"0.7609121",
"0.7524615",
"0.73916095",
"0.72260267",
"0.7169113",
"0.7129854",
"0.7121548",
"0.7099108",
"0.7099108",
"0.7099108",
... | 0.0 | -1 |
Class for molecules featurization with Mordred | def __init__(self, data):
self.data = data
self.calculator = Calculator(descriptors, ignore_3D=True)
self.described_molecules = self.featurize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def featurize(self):\n\n self.make_molecule()\n\n self.described_molecules = self.calculator.pandas(self.data.molecules)\n self.described_molecules.index = self.data.index\n\n self.described_molecules = pd.concat([self.data, self.described_molecules], axis=1)\n\n return self.desc... | [
"0.71321183",
"0.6480469",
"0.6201923",
"0.5934646",
"0.5824182",
"0.5816569",
"0.5784067",
"0.56953573",
"0.5657429",
"0.56559646",
"0.56466794",
"0.5638117",
"0.5636001",
"0.56308395",
"0.56245637",
"0.5620246",
"0.56121254",
"0.5612043",
"0.5583757",
"0.55618906",
"0.55569... | 0.63585585 | 2 |
Return a dictionary representation of the key configuration for this Experiment. | def to_dict(self):
case_dict = dict()
for case, data in self._case_data.items():
case_dict[case] = dict(longname=data.longname, vals=data.vals)
return dict(
name=self.name, cases=case_dict, timeseries=self.timeseries,
case_path=self._case_path, output_prefix... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ToDict(self) -> Dict:\n return self.m_key_data",
"def as_dict(self) -> dict:\n return self._config",
"def as_dict(self):\n return {\n 'physical_keys': [str(self.physical_key)],\n 'size': self.size,\n 'hash': self.hash,\n 'meta': self._meta\n ... | [
"0.6674995",
"0.66457045",
"0.6626262",
"0.65885645",
"0.65158784",
"0.65158784",
"0.63805",
"0.6379943",
"0.6368729",
"0.6323789",
"0.6237286",
"0.62003046",
"0.6174918",
"0.61389494",
"0.6120901",
"0.60962677",
"0.6086563",
"0.60679805",
"0.60434926",
"0.60354024",
"0.60354... | 0.0 | -1 |
Overridden get_case_path() method which simply returns the data_dir, since that's where the data is held. | def case_path(self, **case_kws):
return self.data_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_path():\n return os.getcwd() + \"/data/\"",
"def data_dir(self) -> Path:\n return self._data_dir",
"def get_data_dir(self):\n return self.data_dir",
"def get_default_data_dir(self):\n data_dir_path = os.path.join(self.comicsite.short_name,self.folder_prefix,self.cleantitl... | [
"0.667664",
"0.6623089",
"0.6579102",
"0.65543956",
"0.64910936",
"0.6453784",
"0.6449007",
"0.64320505",
"0.6401833",
"0.63846886",
"0.63846886",
"0.6372788",
"0.634767",
"0.63282996",
"0.62603533",
"0.62441915",
"0.623596",
"0.62295455",
"0.62272364",
"0.6194542",
"0.608950... | 0.8533609 | 0 |
Does the index page return a 200 by default | def test_index():
app = create_ctfd()
with app.app_context():
with app.test_client() as client:
r = client.get('/')
assert r.status_code == 200
destroy_ctfd(app) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index():\n return (jsonify(status=\"OK\")), 200",
"def index():\n return 'OK'",
"def test_index_loads_properly(self):\n response = self.client.get('localhost:8000')\n self.assertEqual(response.status_code, 200)",
"def test_index_view(self):\n response = self.client.get('/')\n ... | [
"0.76499695",
"0.74890304",
"0.72321117",
"0.71666056",
"0.7111705",
"0.71094203",
"0.7099115",
"0.7046921",
"0.7014525",
"0.69991726",
"0.69818515",
"0.69769615",
"0.69511676",
"0.6938859",
"0.6910374",
"0.6902112",
"0.68972063",
"0.6896299",
"0.6883054",
"0.6853341",
"0.683... | 0.0 | -1 |
A user should not be able to login with an incorrect password | def test_user_bad_login():
app = create_ctfd()
with app.app_context():
register_user(app)
client = login_as_user(app, name="user", password="wrong_password")
r = client.get('/profile')
assert r.location.startswith("http://localhost/login") # We got redirected to login
destro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_login_with_bad_password(self):\n resp = self.client.post(\n reverse('login'),\n json.dumps({\n \"username\": self.USERNAME,\n \"password\": \"\",\n }),\n content_type=\"application/json\"\n )\n assert resp.statu... | [
"0.8029132",
"0.80249596",
"0.79221994",
"0.7852366",
"0.78017014",
"0.77512944",
"0.7723492",
"0.7682939",
"0.7655019",
"0.7648167",
"0.7626897",
"0.75733155",
"0.7572586",
"0.75713915",
"0.7516825",
"0.75129825",
"0.7505458",
"0.7503121",
"0.7486753",
"0.7477786",
"0.747697... | 0.75241655 | 14 |
Example of using requests to make a test call to the example Flask app | def example_test():
path = BASE_URL + "/projects/count"
for access_token, username in [(ACCESS_TOKEN_1, USERNAME_1),
(ACCESS_TOKEN_2, USERNAME_2)]:
headers = {"Accept": "application/json",
"Content-Type": "application/json",
"Auth... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_helloworld():\n with app.test_client() as c:\n response = c.get('/')\n assert response.status_code == 200",
"def test_simpleapp():\n class Handler(RequestHandler):\n def get(self):\n self.write('Hello')\n\n app = Application([url('/hello', Handler)])\n\n w... | [
"0.75006455",
"0.7302516",
"0.72955525",
"0.6970513",
"0.69451195",
"0.6913599",
"0.68074834",
"0.67835474",
"0.6760309",
"0.66911495",
"0.6670432",
"0.6662301",
"0.65704155",
"0.6554936",
"0.6526752",
"0.6525882",
"0.649832",
"0.64914274",
"0.64507955",
"0.6444298",
"0.64379... | 0.0 | -1 |
return nCk (mod MOD) | def comb(n:int,k:int,MOD:int):
nCk = 1
# n!/(n-k)!
for i in range(n-k+1, n+1):
nCk *= i
nCk %= MOD
# 1/k!
for i in range(1,k+1):
nCk *= pow(i,MOD-2,MOD)
nCk %= MOD
return nCk | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nCk(n, k):\n return factorial(n)//factorial(k)//factorial(n-k)",
"def ModExpo(a, k, n):\n ret = 1\n while k > 0:\n if k % 2:\n ret = ret * a % n\n k //= 2\n a = (a * a) % n\n return ret",
"def binomial(n, k):\n if 0 <= k <= n:\n ntok = 1\n ktok =... | [
"0.7102751",
"0.6763725",
"0.6695463",
"0.6679959",
"0.6620005",
"0.6598158",
"0.64266354",
"0.63809407",
"0.6348271",
"0.6331299",
"0.6268062",
"0.61716074",
"0.615527",
"0.6151125",
"0.60777146",
"0.6065207",
"0.60327226",
"0.6029984",
"0.602696",
"0.600112",
"0.6000698",
... | 0.7090004 | 1 |
Check if the Compute API is up an healthy. | def check_active(self):
try:
r = requests.get('/'.join([self.base_url, self.ENDPOINT_STATUS])).status_code
return r.status_code == 200
except Exception as e:
logger.warn(e)
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_healthy(self) -> bool:\n try:\n self.health()\n except MeiliSearchError:\n return False\n return True",
"def check_health(self):\n return defer.succeed(True)",
"def ready(self):\n\n if not self.running:\n return False\n\n try:\n ... | [
"0.74652874",
"0.7459284",
"0.7372733",
"0.73242354",
"0.7187302",
"0.71066606",
"0.71027994",
"0.71014905",
"0.7100068",
"0.70705163",
"0.70607245",
"0.6974901",
"0.6974853",
"0.6942992",
"0.6865484",
"0.67949873",
"0.6779634",
"0.66946566",
"0.6694109",
"0.66739255",
"0.667... | 0.62384385 | 65 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(lat1, lon1, lat2, lon2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat / 2) ** 2 + cos(lat1) * cos(lat2) * sin(dlon / 2) ** 2
c = 2 * asin(sqrt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.81444913",
"0.78628397",
"0.76311773",
"0.7604652",
"0.75954515",
"0.75949824",
"0.7592846",
"0.757015",
"0.75629693",
"0.7554376",
"0.752855",
"0.7515809",
"0.7492531",
"0.7465686",
"0.7450806",
"0.74330103",
"0.73909706",
"0.73566103",
"0.73473287",
"0.7329735",
"0.73278... | 0.0 | -1 |
Sets the id_tag of this AppElementsUpdateReferenceBody. | def id_tag(self, id_tag):
self._id_tag = id_tag | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_id(self, id_):\n\n self.id_ = id_",
"def set_id(self, id):\n self.data['id'] = id",
"def set_id(self, id):\n self.__id = id",
"def id(self, id: \"str\"):\n self._attrs[\"id\"] = id",
"def id(self, id):\n \n self._id = id",
"def id(self, id):\n \n ... | [
"0.64562964",
"0.6313377",
"0.62117267",
"0.6133583",
"0.6084872",
"0.6084872",
"0.6084872",
"0.6084872",
"0.6084872",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
"0.6071021",
... | 0.7185875 | 0 |
Sets the transaction_id of this AppElementsUpdateReferenceBody. | def transaction_id(self, transaction_id):
self._transaction_id = transaction_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transaction_id(self, transaction_id):\n if transaction_id is None:\n raise ValueError(\"Invalid value for `transaction_id`, must not be `None`\") # noqa: E501\n\n self._transaction_id = transaction_id",
"def set_merchant_transaction_id(self, transaction_id):\n self.merchant_t... | [
"0.63061434",
"0.6076186",
"0.5822397",
"0.536407",
"0.5218382",
"0.51701766",
"0.49542496",
"0.48648214",
"0.4844334",
"0.47488403",
"0.47302678",
"0.47283491",
"0.4669723",
"0.4645233",
"0.46315598",
"0.46209142",
"0.45839286",
"0.45808318",
"0.45804667",
"0.45776",
"0.4575... | 0.67571753 | 1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, AppElementsUpdateReferenceBody):
return False
return self.__dict__ == other.__dict__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
return not self == other | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.8457167",
"0.8393036",
"0.81455255",
"0.8139734",
"0.81333447",
"0.8094964",
"0.8093362",
"0.8093362",
"0.8093362",
"0.80863476",
"0.80863476",
"0.8077286",
"0.8077286",
"0.806682"
] | 0.0 | -1 |
Tick all buttons in the row and vise versa | def selectAll(self):
for ID in range(len(self.cboxes)):
if self.cboxes[ID].isChecked():
for ix in range(len(self.segments)):
if self.segments[ix][-1] == ID:
self.picbuttons[ix].mark = 'yellow'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_all_buttons(self) -> bool:\n raise NotImplementedError",
"def update_buttons(self):\n # Enable the Add/Remove/Up/Down measurements buttons if a Survey is loaded\n enable = self.mgr.obj is not None\n self.addButton.setEnabled(enable)\n self.removeButton.setEnabled(enabl... | [
"0.6206985",
"0.6114648",
"0.60956615",
"0.606688",
"0.60466826",
"0.5964312",
"0.59423614",
"0.593445",
"0.5913716",
"0.5905851",
"0.5902878",
"0.58411187",
"0.5805085",
"0.5800442",
"0.5780653",
"0.5777164",
"0.5749855",
"0.5742083",
"0.5737068",
"0.5720575",
"0.56317544",
... | 0.55409676 | 29 |
Heap constructor. Fills the heap using the build heap procedure | def __init__(self, *values, cmp=DEFAULT_CMP):
self.cmp = cmp
if len(values) == 0:
self.a = []
return
x = values[0]
if not is_series(x):
self.a = self.build_heap([x])
return
assert is_series(x)
assert len(x) > 0
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.heap = []",
"def __init__(self):\n self.heap = []",
"def __init__(self):\n self.heap = []",
"def __init__(self):\n # Initialize a new binary min heap to store the items\n self.heap = MinHeap()",
"def __init__(self):\n self.heap = [None]",... | [
"0.79828805",
"0.79828805",
"0.79828805",
"0.7954278",
"0.7950562",
"0.7886038",
"0.7831571",
"0.78060055",
"0.7805025",
"0.77844316",
"0.7743645",
"0.77020055",
"0.76365334",
"0.76016057",
"0.75205255",
"0.74453074",
"0.74026215",
"0.7388376",
"0.7374988",
"0.7373289",
"0.73... | 0.61949176 | 64 |
Initilizes the WGAN class. | def __init__(self, raw_dataset, raw_conditioning_dataset, generator,
discriminator, z_dim, generator_optimizer, discriminator_optimizer,
discriminator_training_ratio=5, batch_size=64, epochs=1, checkpoint_dir=None,
epochs_per_save=10, fn_compute_loss=_compute_losses,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_setup(self):\n self.DNN = SganMLP(self.settings.number_of_bins)\n self.D = SganMLP(self.settings.number_of_bins)\n self.G = Generator()",
"def init_weights(self):\n \n self.w = np.random.randn(self.D) / np.sqrt(self.D)",
"def __init__(self, W):\n self.W = W",... | [
"0.7067083",
"0.67569655",
"0.6660736",
"0.6636352",
"0.66287434",
"0.6532298",
"0.65242404",
"0.64688915",
"0.64676696",
"0.6394337",
"0.6392899",
"0.6389781",
"0.6385714",
"0.63841635",
"0.6373386",
"0.6354811",
"0.6341216",
"0.63319933",
"0.6312051",
"0.63025147",
"0.62910... | 0.0 | -1 |
Function gives the dataset to use during training. In this case, returns the joint data/conditioning dataset with random conditioning information. | def _get_training_dataset(self):
return tf.data.Dataset.zip((self.conditioned_dataset, self.dataset)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataset(args):\n\n if args['experiment']['dataset'] == Dataset.mindsets:\n xs, ys, cs = make_mindsets(mindset_sizes=args['dataset']['mindset_sizes'],\n nb_questions=args['dataset']['nb_questions'],\n nb_useless=args['dataset']['n... | [
"0.60713583",
"0.5750872",
"0.56890637",
"0.5688263",
"0.5687275",
"0.5665631",
"0.5639836",
"0.56327266",
"0.56258625",
"0.562124",
"0.5614187",
"0.56086653",
"0.5600147",
"0.55958354",
"0.5593305",
"0.55887866",
"0.5578064",
"0.55775607",
"0.557353",
"0.55700624",
"0.551855... | 0.6498017 | 0 |
Constructor. Any message fields that are implicitly/explicitly set to None will be assigned a default value. The recommend use is keyword arguments as this is more robust to future message changes. You cannot mix inorder arguments and keyword arguments. | def __init__(self, *args, **kwds):
if args or kwds:
super(MultiDataCell, self).__init__(*args, **kwds)
#message fields cannot be None, assign default values for those that are
if self.base is None:
self.base = rwrc12_msgs.msg.CellBase()
if self.mean_height is None:
self.mean_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwds):\n if args or kwds:\n super(KomodoSpeechRecCommand, self).__init__(*args, **kwds)\n #message fields cannot be None, assign default values for those that are\n if self.header is None:\n self.header = std_msgs.msg.Header()\n if self.cmd is None:\n ... | [
"0.7794351",
"0.7719884",
"0.7719884",
"0.7686347",
"0.76253426",
"0.7562994",
"0.74395365",
"0.7416649",
"0.73515975",
"0.730761",
"0.7279932",
"0.72373426",
"0.72264934",
"0.7223775",
"0.7223775",
"0.72189564",
"0.72111243",
"0.72111243",
"0.72111243",
"0.72111243",
"0.7211... | 0.0 | -1 |
Construct Conv1DLSTM. See `ConvLSTMCellAP` for more details. | def __init__(self, name="conv_1d_lstm_cell", **kwargs):
super(Conv1DLSTMCell, self).__init__(conv_ndims=1, name=name, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_2l_conv1d(input_shape, # type: tuple\n n_outputs, # type: int\n filters=64, # type: int\n kernel_size=3, # type: int\n dropout_rate=0.5, # type: float\n max_pool_size=2 # type: int\n ):... | [
"0.613067",
"0.6033429",
"0.58353853",
"0.5813954",
"0.5736567",
"0.5719038",
"0.5557529",
"0.5503755",
"0.54977334",
"0.5465851",
"0.5459606",
"0.5406778",
"0.5397167",
"0.537925",
"0.5347921",
"0.5320622",
"0.53017324",
"0.5289422",
"0.5264613",
"0.52509147",
"0.5216316",
... | 0.6987433 | 0 |
Assert that the link for the badge image is correct for a package. | def assertLinkUrl(self, package, actual_url):
parsed_url = urllib.parse.urlparse(actual_url)
params = urllib.parse.parse_qs(parsed_url.query)
self.assertEqual([package], params['package']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponseGithub(self, package_name):\n BadgeTestCase._assertImageResponseGithub(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def test_badge_should_have_image(self):\n\n badge = self.get_sample_badge()\n # It's a string, even though it often looks like a URL\n ... | [
"0.73755056",
"0.73498356",
"0.7340051",
"0.72899854",
"0.7215585",
"0.7183165",
"0.71770227",
"0.706455",
"0.6863311",
"0.6812109",
"0.6781824",
"0.67695314",
"0.6766021",
"0.67262",
"0.67109877",
"0.66438603",
"0.6349031",
"0.6199503",
"0.6064943",
"0.6024478",
"0.59163094"... | 0.66588557 | 15 |
Assert that the badge image response is correct for a package. | def _assertImageResponse(
self, package_name, expected_status, expected_left_text):
json_response = self.get_image_json(package_name)
self.assertEqual(json_response['left_text'], expected_left_text)
self.assertEqual(json_response['right_text'], expected_status.value)
self.ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponseGithub(self, package_name):\n BadgeTestCase._assertImageResponseGithub(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def assertImageResponseGithub(self, package_name):\n BadgeTestCase._assertImageResponseGithub(\n self, package_name, main.BadgeStat... | [
"0.8341529",
"0.8205102",
"0.819352",
"0.81351554",
"0.80803704",
"0.80057824",
"0.7993413",
"0.7809329",
"0.7804403",
"0.7745799",
"0.7732964",
"0.75902796",
"0.75149703",
"0.75025904",
"0.7501434",
"0.7408167",
"0.62723565",
"0.626134",
"0.6209287",
"0.6155526",
"0.59448886... | 0.76468927 | 11 |
Assert that the badge image response is correct for a PyPI package. | def _assertImageResponsePyPI(self, package_name, expected_status):
self._assertImageResponse(
package_name, expected_status, 'compatibility check (PyPI)') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.UNKNO... | [
"0.8597389",
"0.84856796",
"0.84026974",
"0.8396489",
"0.8335455",
"0.8330879",
"0.82360584",
"0.8097306",
"0.8041168",
"0.80237526",
"0.7992142",
"0.79849803",
"0.7929386",
"0.74909294",
"0.708183",
"0.6810431",
"0.6073492",
"0.5993659",
"0.59697735",
"0.5961331",
"0.5917099... | 0.8128076 | 7 |
Assert that the badge image response is correct for a PyPI package. | def assertImageResponsePyPI(self, package_name):
BadgeTestCase._assertImageResponsePyPI(
self, package_name, main.BadgeStatus.SUCCESS) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.UNKNOWN_PACKAGE)",
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStat... | [
"0.84856796",
"0.84026974",
"0.8396489",
"0.8335455",
"0.8330879",
"0.82360584",
"0.8128076",
"0.8097306",
"0.8041168",
"0.80237526",
"0.7992142",
"0.79849803",
"0.7929386",
"0.74909294",
"0.708183",
"0.6810431",
"0.6073492",
"0.5993659",
"0.59697735",
"0.5961331",
"0.5917099... | 0.8597389 | 0 |
Assert that the badge image response is correct for a PyPI package. | def assertImageResponsePyPI(self, package_name):
BadgeTestCase._assertImageResponsePyPI(
self, package_name, main.BadgeStatus.UNKNOWN_PACKAGE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.SELF_... | [
"0.8597389",
"0.84026974",
"0.8396489",
"0.8335455",
"0.8330879",
"0.82360584",
"0.8128076",
"0.8097306",
"0.8041168",
"0.80237526",
"0.7992142",
"0.79849803",
"0.7929386",
"0.74909294",
"0.708183",
"0.6810431",
"0.6073492",
"0.5993659",
"0.59697735",
"0.5961331",
"0.5917099"... | 0.84856796 | 1 |
Assert that the badge image response is correct for a PyPI package. | def assertImageResponsePyPI(self, package_name):
BadgeTestCase._assertImageResponsePyPI(
self, package_name, main.BadgeStatus.MISSING_DATA) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.UNKNO... | [
"0.8597389",
"0.84856796",
"0.84026974",
"0.8396489",
"0.8335455",
"0.82360584",
"0.8128076",
"0.8097306",
"0.8041168",
"0.80237526",
"0.7992142",
"0.79849803",
"0.7929386",
"0.74909294",
"0.708183",
"0.6810431",
"0.6073492",
"0.5993659",
"0.59697735",
"0.5961331",
"0.5917099... | 0.8330879 | 5 |
Assert that the badge image response is correct for a PyPI package. | def assertImageResponsePyPI(self, package_name):
BadgeTestCase._assertImageResponsePyPI(
self, package_name, main.BadgeStatus.SELF_INCOMPATIBLE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.UNKNO... | [
"0.8597389",
"0.84856796",
"0.8396489",
"0.8335455",
"0.8330879",
"0.82360584",
"0.8128076",
"0.8097306",
"0.8041168",
"0.80237526",
"0.7992142",
"0.79849803",
"0.7929386",
"0.74909294",
"0.708183",
"0.6810431",
"0.6073492",
"0.5993659",
"0.59697735",
"0.5961331",
"0.5917099"... | 0.84026974 | 2 |
Assert that the badge image response is correct for a PyPI package. | def assertImageResponsePyPI(self, package_name):
BadgeTestCase._assertImageResponsePyPI(
self, package_name, main.BadgeStatus.PAIR_INCOMPATIBLE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.UNKNO... | [
"0.8596834",
"0.8485089",
"0.8402575",
"0.8334881",
"0.8330627",
"0.82354414",
"0.8125842",
"0.8097933",
"0.8042411",
"0.8024615",
"0.79927933",
"0.7985916",
"0.79306436",
"0.74905074",
"0.70851576",
"0.6810492",
"0.60728776",
"0.59926814",
"0.5969874",
"0.5961486",
"0.591561... | 0.8396509 | 3 |
Assert that the badge image response is correct for a PyPI package. | def assertImageResponsePyPI(self, package_name):
BadgeTestCase._assertImageResponsePyPI(
self, package_name, main.BadgeStatus.OUTDATED_DEPENDENCY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.UNKNO... | [
"0.8597389",
"0.84856796",
"0.84026974",
"0.8396489",
"0.8335455",
"0.8330879",
"0.8128076",
"0.8097306",
"0.8041168",
"0.80237526",
"0.7992142",
"0.79849803",
"0.7929386",
"0.74909294",
"0.708183",
"0.6810431",
"0.6073492",
"0.5993659",
"0.59697735",
"0.5961331",
"0.5917099"... | 0.82360584 | 6 |
Assert that the badge image response is correct for a PyPI package. | def assertImageResponsePyPI(self, package_name):
BadgeTestCase._assertImageResponsePyPI(
self, package_name, main.BadgeStatus.OBSOLETE_DEPENDENCY) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.SUCCESS)",
"def assertImageResponsePyPI(self, package_name):\n BadgeTestCase._assertImageResponsePyPI(\n self, package_name, main.BadgeStatus.UNKNO... | [
"0.8596834",
"0.8485089",
"0.8402575",
"0.8396509",
"0.8330627",
"0.82354414",
"0.8125842",
"0.8097933",
"0.8042411",
"0.8024615",
"0.79927933",
"0.7985916",
"0.79306436",
"0.74905074",
"0.70851576",
"0.6810492",
"0.60728776",
"0.59926814",
"0.5969874",
"0.5961486",
"0.591561... | 0.8334881 | 4 |
A function to parse parameter file as a pandas dataframe. | def parse_parameter_file(param_file):
return pd.read_table(param_file, sep='=', index_col=0, names=["value"]).transpose() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse(self, filename: str, comment: str = None) -> pd.DataFrame:\n try:\n return pd.read_csv(filename, comment=comment)\n except pd.errors.EmptyDataError:\n mesg = f'Provided data file \\'{filename}\\' was empty'\n raise ValueError(mesg)\n except Exception... | [
"0.6723517",
"0.6700138",
"0.66589195",
"0.6530143",
"0.6529422",
"0.63812894",
"0.63155353",
"0.63088024",
"0.62570363",
"0.6173652",
"0.6137456",
"0.6136185",
"0.6124363",
"0.61093855",
"0.61022425",
"0.6089891",
"0.6069789",
"0.60673004",
"0.6056389",
"0.6048552",
"0.60200... | 0.8339482 | 0 |
Converts a CMYK quadruplet into an RGB triplet. CMYK values are expected to be on the interval [0, 1]. RGB values are given on the interval [0, 255]. | def cmyk2rgb(cmyk, prec=0):
for value in cmyk:
if not 0 <= value <= 1:
raise ValueError('One or more CMYK values are outside [0, 1]')
r = 255 * (1 - cmyk[0]) * (1 - cmyk[3])
g = 255 * (1 - cmyk[1]) * (1 - cmyk[3])
b = 255 * (1 - cmyk[2]) * (1 - cmyk[3])
return round(r, prec), r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_rgb_cmyk(rcol, gcol, bcol):\n if (rcol == 0) and (gcol == 0) and (bcol == 0):\n # black\n return 0, 0, 0, 1\n\n kcol = 1-max(rcol, gcol, bcol)\n ccol = (1-rcol-kcol)/(1-kcol)\n mcol = (1-gcol-kcol)/(1-kcol)\n ycol = (1-bcol-kcol)/(1-kcol)\n\n return ccol, mcol, ycol, kco... | [
"0.69199526",
"0.6816548",
"0.6593539",
"0.62032765",
"0.60574543",
"0.6039002",
"0.6036061",
"0.60168695",
"0.6008006",
"0.5966167",
"0.590553",
"0.5897587",
"0.5892505",
"0.5891561",
"0.5873327",
"0.5873095",
"0.5871833",
"0.5833985",
"0.58269083",
"0.57946694",
"0.5780379"... | 0.77031666 | 0 |
Converts an RGB triplet into a CMYK quadruplet. RGB values are expected to be on the interval [0, 255]. CMYK values are given on the interval [0, 1]. | def rgb2cmyk(rgb, prec=3):
for value in rgb:
if not 0 <= value <= 255:
raise ValueError('One or more RGB values are outside [0, 255]')
r, g, b = rgb[0] / 255, rgb[1] / 255, rgb[2] / 255
try:
k = 1 - max(r, g, b)
c = (1 - r - k) / (1 - k)
m = (1 - g - k) / (1 - k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_rgb_cmyk(rcol, gcol, bcol):\n if (rcol == 0) and (gcol == 0) and (bcol == 0):\n # black\n return 0, 0, 0, 1\n\n kcol = 1-max(rcol, gcol, bcol)\n ccol = (1-rcol-kcol)/(1-kcol)\n mcol = (1-gcol-kcol)/(1-kcol)\n ycol = (1-bcol-kcol)/(1-kcol)\n\n return ccol, mcol, ycol, kco... | [
"0.7463197",
"0.73320514",
"0.7239379",
"0.6345291",
"0.6217341",
"0.61769235",
"0.5910239",
"0.5893841",
"0.57856494",
"0.57522565",
"0.5728558",
"0.5716956",
"0.569338",
"0.56895447",
"0.5686191",
"0.56524426",
"0.5648783",
"0.56459737",
"0.5641703",
"0.56330144",
"0.563065... | 0.7496036 | 0 |
Converts an RGB triplet into an RGB Hexadecimal. RGB values are expected to be given on the interval [0, 255]. Hex values are given in the form 'xxxxxx'. | def rgb2hex(rgb):
for value in rgb:
if not 0 <= value <= 255:
raise ValueError('One or more RGB values are outside [0, 255]')
r_hex = hex(rgb[0])[2:]
g_hex = hex(rgb[1])[2:]
b_hex = hex(rgb[2])[2:]
return '#' + r_hex.zfill(2) + g_hex.zfill(2) + b_hex.zfill(2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgb_hexify(rgb: Iterable[int]) -> str:\n return ''.join(\n list(map(\n lambda x: hex(abs(x))[2:].zfill(2),\n rgb\n ))[::-1]\n )",
"def RGB_to_HEX(R, G, B):\n\n # slightly modified from https://stackoverflow.com/a/3380739\n\n return '%02x%02x%02x' % (R, G, B)",
... | [
"0.79308254",
"0.78454345",
"0.7706671",
"0.76498544",
"0.76251674",
"0.7604188",
"0.760087",
"0.760087",
"0.760087",
"0.7589735",
"0.75798273",
"0.7579681",
"0.75510246",
"0.7465341",
"0.7355241",
"0.73296875",
"0.73276705",
"0.7314186",
"0.7314186",
"0.7314186",
"0.72809845... | 0.75571 | 12 |
Setup for User tests. | def setUp(self):
self.user_1 = User() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUp(self):\n\n self.user_1 = User.objects.create_user(\n first_name=\"John\",\n last_name=\"Kenedy\",\n username=\"johnny\",\n password=\"Phrase908\",\n email=\"johnny@gmail.com\",\n )\n self.user_2 = User.objects.create_user(\n ... | [
"0.8113526",
"0.80435723",
"0.80300814",
"0.7923365",
"0.79185176",
"0.79171544",
"0.7892098",
"0.78622913",
"0.78508663",
"0.7839213",
"0.7811193",
"0.7780309",
"0.7778539",
"0.77623576",
"0.77521634",
"0.7749799",
"0.7739822",
"0.7732821",
"0.7732099",
"0.76972514",
"0.7646... | 0.795339 | 3 |
Test for correct inheritance of User object. | def test_inheritance(self):
self.assertTrue(issubclass(type(self.user_1), BaseModel)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_inherit(self):\n self.assertTrue(issubclass(User, BaseModel))",
"def test_issubclass(self):\n self.assertTrue(issubclass(User()), BaseModel)",
"def test_User_instance(self):\n obj = User()\n self.assertIsInstance(obj, User)\n self.assertIsInstance(obj, BaseModel)... | [
"0.8185956",
"0.76789415",
"0.7217012",
"0.7193389",
"0.70376444",
"0.70360684",
"0.69037896",
"0.6903454",
"0.6800744",
"0.6781127",
"0.6732609",
"0.6582837",
"0.6573324",
"0.6557717",
"0.6532555",
"0.6485434",
"0.64133435",
"0.63463056",
"0.6321212",
"0.6296875",
"0.6292040... | 0.8121529 | 1 |
Test for correct attribute types of User object. | def test_attribute_types(self):
self.assertIsInstance(self.user_1.email, str)
self.assertIsInstance(self.user_1.password, str)
self.assertIsInstance(self.user_1.first_name, str)
self.assertIsInstance(self.user_1.last_name, str) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_types(self):\n user = User()\n self.assertEqual(type(user.email), str)\n self.assertEqual(type(user.password), str)\n self.assertEqual(type(user.first_name), str)\n self.assertEqual(type(user.last_name), str)",
"def test_attributes(self):\n self.assertTrue(h... | [
"0.73608476",
"0.7036166",
"0.7007135",
"0.6819396",
"0.6792671",
"0.6749377",
"0.6733033",
"0.64164084",
"0.63797444",
"0.63464886",
"0.625153",
"0.6249479",
"0.6163784",
"0.61542153",
"0.61105543",
"0.61048603",
"0.61035174",
"0.6102037",
"0.608235",
"0.60737705",
"0.603184... | 0.81575066 | 0 |
Test for correct update of attribute updated_at | def test_save(self):
old_updated_at = self.user_1.updated_at
time.sleep(0.5)
self.user_1.save()
self.assertNotEqual(self.user_1.created_at, self.user_1.updated_at)
self.assertNotEqual(self.user_1.updated_at, old_updated_at) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_at(self):\n self.assertIsInstance(self.obj.update_at, datetime)",
"def test_update_at(self):\n self.assertIsInstance(self.obj.update_at, datetime)",
"def test_update_at(self):\n self.assertIsInstance(self.obj.update_at, datetime)",
"def test_baseupdated(self):\n se... | [
"0.80204254",
"0.80204254",
"0.80204254",
"0.7826725",
"0.77684253",
"0.76491815",
"0.7622512",
"0.75078833",
"0.72472024",
"0.7208199",
"0.71620405",
"0.7123322",
"0.69062597",
"0.6866724",
"0.6832748",
"0.67655975",
"0.6760359",
"0.67420274",
"0.6690235",
"0.6672666",
"0.66... | 0.6901209 | 13 |
Create a random string with given length. | def get_random_string(length: int) -> str:
return ''.join([random.choice(string.ascii_letters + string.digits)
for _ in range(length)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_random_string(length):\n return ''.join(random.choice(\"ACDEFGHJKMNPQRTWXYZ\")\n for _ in range(length)\n )",
"def generate_random_string(length):\r\n return ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(length))",
"def _gen... | [
"0.89105356",
"0.88546425",
"0.88436633",
"0.87740946",
"0.8715684",
"0.8705837",
"0.8637382",
"0.8603678",
"0.85763264",
"0.8528159",
"0.85242856",
"0.8516876",
"0.8515528",
"0.84724754",
"0.84698087",
"0.84559584",
"0.8447635",
"0.84288996",
"0.83740866",
"0.8372566",
"0.83... | 0.85705864 | 9 |
Return the number of keys stored by this bloom filter. | def __len__(self):
return self.count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_keys(self):\n return len(self.counter.keys())",
"def getNoOfKeys(self):\n return len(self.__keyList)",
"def getNumberOfKeys(self) -> int:\n ...",
"def num_keys(self):\r\n return len(self.keys)",
"def count(self):\n return self.connection._llen(self.key)",
"def c... | [
"0.8075673",
"0.7940063",
"0.7835801",
"0.772785",
"0.7703661",
"0.77006704",
"0.72986066",
"0.7222623",
"0.71733904",
"0.71241814",
"0.71129614",
"0.7033897",
"0.70002854",
"0.6892693",
"0.6892693",
"0.68822366",
"0.68766177",
"0.68709534",
"0.68709534",
"0.68117696",
"0.680... | 0.0 | -1 |
Return a copy of this bloom filter. | def copy(self):
raise NotImplementedError("RedisLocalBloomFilter not support copy") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy(self):\n new_filter = BloomFilter(self.capacity, self.error_rate)\n new_filter.filter = self.filter.copy()\n return new_filter",
"def copy(self) -> \"FilterAlgorithmState\":\n\n # NB: This is untested and might not be optimal tbh\n return deepcopy(self)",
"def allow_... | [
"0.88555247",
"0.6998392",
"0.6819608",
"0.6552665",
"0.6409717",
"0.63296604",
"0.63296604",
"0.63296604",
"0.63296604",
"0.63004595",
"0.629882",
"0.629882",
"0.629882",
"0.6282772",
"0.62801534",
"0.62761027",
"0.62761027",
"0.62409484",
"0.62409484",
"0.62409484",
"0.6240... | 0.77528685 | 1 |
Return a list of all enrollments for the passed course_id. | def get_enrollments_for_course(self, course_id, params={}):
url = COURSES_API.format(course_id) + "/enrollments"
enrollments = []
for datum in self._get_paged_resource(url, params=params):
enrollments.append(CanvasEnrollment(data=datum))
return enrollments | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_enrollments_for_section(self, section_id, params={}):\n url = SECTIONS_API.format(section_id) + \"/enrollments\"\n\n enrollments = []\n for datum in self._get_paged_resource(url, params=params):\n enrollments.append(CanvasEnrollment(data=datum))\n\n return enrollments... | [
"0.7191661",
"0.68659055",
"0.6336132",
"0.6317704",
"0.63118154",
"0.59861284",
"0.5888465",
"0.58837706",
"0.5842835",
"0.57466596",
"0.5697973",
"0.5660654",
"0.5587271",
"0.5559237",
"0.5508404",
"0.54928565",
"0.54875743",
"0.5444377",
"0.54264516",
"0.5395929",
"0.53808... | 0.80314666 | 0 |
Get the event handler for the provided ID or None | def GetHandler(self, evt_id):
return self._handlers.get(evt_id, None) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_event_handler(self, handler):\n assert handler\n\n obj = self\n for attr in handler.split(\".\"):\n obj = getattr(obj, attr)\n return obj",
"def _get_event_handler(self, handler):\n assert handler\n\n obj = self\n for attr in handler.split(\".\... | [
"0.62611467",
"0.62611467",
"0.62068826",
"0.61098635",
"0.6097923",
"0.57279205",
"0.57200694",
"0.56827235",
"0.56623787",
"0.5586079",
"0.55736434",
"0.55637634",
"0.5538754",
"0.5537712",
"0.55299664",
"0.5527451",
"0.5498018",
"0.5457332",
"0.54542273",
"0.54481035",
"0.... | 0.7827027 | 0 |
this function will create the head for the html given the css style template and the title of the html website. | def create_head(css, title):
doc = "<!DOCTYPE html>\n<html>\n"
head = "<head>\n<title>" + title + "\n</title>" + css + "</head>\n"
header = doc + head + "<body>\n<h1>" + title + "\n</h1>\n<hr/>\n"
return header | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def header(style=u'default'):\n return (docType() + \n u'<html xmlns=\"http://www.w3.org/1999/xhtml\">\\n'\n u'<head>\\n'\n u'<style type=\"text/css\">\\n'\n u' @import url(/css/exe.css);\\n'\n u' @import url(/style/base.css);\\n'\n u' @import... | [
"0.69461864",
"0.6905055",
"0.6762255",
"0.66626954",
"0.6486886",
"0.64486057",
"0.6397924",
"0.6218249",
"0.6168673",
"0.6148179",
"0.60952115",
"0.60858727",
"0.60850614",
"0.6068895",
"0.6052179",
"0.6032267",
"0.5994418",
"0.5968005",
"0.59630984",
"0.5933106",
"0.591209... | 0.81142956 | 0 |
Get the time, and formatted as well. | def get_time() -> str:
return time.strftime(TIMEFORMAT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time(self):\n return time.strftime(\"%d/%m/%y %M:%H:%S\", self.time)",
"def get_time() -> str:\n return strftime(\"%H:%M:%S\")",
"def get_time():\r\n return datetime.datetime.now().strftime(\"%H\")+\":\"+datetime.datetime.now().strftime(\"%M\")+\":\"+datetime.datetime.now().strftime(\"%S\"... | [
"0.82835513",
"0.80701655",
"0.8058658",
"0.7928017",
"0.7884826",
"0.7872348",
"0.7859797",
"0.7859083",
"0.7843759",
"0.78413737",
"0.7765198",
"0.7714719",
"0.7646649",
"0.7618219",
"0.75972587",
"0.7596998",
"0.7596998",
"0.7596998",
"0.7560018",
"0.7521435",
"0.7512082",... | 0.7939447 | 3 |
Assert that the repr of an item matches the expected string. | def assert_repr_equals(item: Any, expected: str) -> None:
if not isinstance(expected, str):
raise TypeError(f"'expected' must be a string; found {type(expected)}")
assert repr(item) == expected | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_str(self):\n item = self.item\n\n self.assertEqual(str(item), self.item_raw['name'])",
"def test_string_representation(self) -> None:\n item = Item(text=\"some text\")\n self.assertEqual(str(item), \"some text\")",
"def test_repr(self):\n self.assertEqual(repr(self.c... | [
"0.7654886",
"0.7319714",
"0.70566714",
"0.70364255",
"0.69668335",
"0.692953",
"0.6889585",
"0.6846516",
"0.6777582",
"0.6690588",
"0.66197294",
"0.6516967",
"0.6511773",
"0.6509202",
"0.6499829",
"0.64965343",
"0.64654696",
"0.64571005",
"0.6449583",
"0.64413196",
"0.640886... | 0.85558707 | 0 |
Initialize weights of Actor last layer to be between 0.003 and 0.003 as this avoid getting 1 or 1 output in the initial stage, which makes gradient zero. | def actor_critic_continuous(num_inputs, num_hidden, bound):
# Input
inputs = Input(shape=(num_inputs,), name='input_layer')
# Shared layer
common = Dense(units=num_hidden, activation='relu',
kernel_initializer='he_uniform', name='common_layer_1')(inputs)
# common = Dense(units=num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_weights(self):\r\n self.embedding.weight.data.uniform_(-0.1, 0.1)\r\n self.fc.bias.data.fill_(0)\r\n self.fc.weight.data.uniform_(-0.1, 0.1)",
"def init_weights(self) -> None:\n self.fc.bias.data.fill_(0)\n self.fc.weight.data.uniform_(-0.1, 0.1)",
"def init_weights(... | [
"0.7563728",
"0.75553966",
"0.7509317",
"0.7509317",
"0.7509317",
"0.73754275",
"0.73754275",
"0.7186291",
"0.7167194",
"0.7160075",
"0.7160075",
"0.7155502",
"0.7075003",
"0.70275486",
"0.70046747",
"0.69951457",
"0.6929048",
"0.6910636",
"0.68836683",
"0.6876566",
"0.686874... | 0.0 | -1 |
Set the root save dir path for downloaded data. | def _set_download_dir(self, path):
assert path, 'Must input a non-empty path.'
self.data['info']['root_downloads_dir'] = path
self.write_data_cache(self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_dir(self, save_dir):\n self._save_dir = save_dir",
"def setDataRoot(path):\n global dataRoot\n dataRoot = os.path.realpath(path)",
"def setModelDataDir(self):\n datadir = QtGui.QFileDialog.getExistingDirectory(parent=self,\n caption=\"Where to save image data and statis... | [
"0.6968293",
"0.6953091",
"0.68667465",
"0.68344307",
"0.67882216",
"0.675968",
"0.66772187",
"0.6606134",
"0.65940547",
"0.65859634",
"0.6572213",
"0.65084726",
"0.65084106",
"0.65018255",
"0.6332267",
"0.6329447",
"0.6326233",
"0.6326139",
"0.6322924",
"0.6303623",
"0.62855... | 0.76399547 | 0 |
Get the root save dir path. | def _get_download_dir(self):
return self.data['info']['root_downloads_dir'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getSavePath(self):\n path, filename = os.path.split(self.path)\n savePath = os.path.join(path, os.path.splitext(filename)[0])\n return savePath",
"def save_dir(self):\n return self._save_dir",
"def get_file_full_path(self):\n return self.save_dir + os.sep + self.save_fil... | [
"0.7672117",
"0.7586995",
"0.74255526",
"0.7411833",
"0.7383534",
"0.73772556",
"0.73758304",
"0.7345787",
"0.7345377",
"0.7329698",
"0.72976357",
"0.72602624",
"0.72564876",
"0.7240123",
"0.7234237",
"0.72144103",
"0.72043765",
"0.71986985",
"0.71587366",
"0.71449286",
"0.71... | 0.6563478 | 49 |
Updates the category list of all categories. | def update_categories(self):
categories = {}
datasets = self.data['dataset']
used_categories = self._get_list_categories_used(datasets)
for category in used_categories:
categories.update({
category: self._get_datasets_tasks_by_category(datasets, category)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_category_map(self, category_list):\n for category in category_list:\n skip = False\n for i in [\"wiki\", \"sources\", \"article\", \"stub\",\n \"wayback\", \"cs1\"]:\n if i in category.lower():\n skip = True\n ... | [
"0.6758589",
"0.6698878",
"0.6698878",
"0.6698878",
"0.6698878",
"0.66711956",
"0.6646916",
"0.6562645",
"0.6442713",
"0.6401711",
"0.6373445",
"0.63675374",
"0.6150187",
"0.611735",
"0.6072395",
"0.6071573",
"0.6061045",
"0.599049",
"0.5956492",
"0.5950494",
"0.5936105",
"... | 0.6951872 | 0 |
Returns a list of all categories available in the datasets data. | def _get_list_categories_used(self, datasets):
categories_used = []
for dataset in datasets:
categories_used.extend(datasets[dataset]['keywords'])
return list(sorted(set(categories_used))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories(self):\n cur = self.con.execute('select category from cc');\n return [d[0] for d in cur]",
"def categories(self):\n return self._data[\"categories\"]",
"def categories(self):\n game_categories = self.game_categories.all()\n return [ gc.category for gc in game_c... | [
"0.80238557",
"0.7797562",
"0.7761713",
"0.7760444",
"0.7618719",
"0.76022273",
"0.7567776",
"0.7535329",
"0.74873686",
"0.7485666",
"0.7478866",
"0.7444006",
"0.7426297",
"0.74144906",
"0.7393071",
"0.7392424",
"0.73660064",
"0.735992",
"0.7358738",
"0.7345824",
"0.7325694",... | 0.77228504 | 4 |
Checks if a category exists in cache. | def exists(self, category):
assert category, "Must input a valid category name."
return category in self.manager.data["category"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def has(self, category: str, key: str, check_category: bool = False) -> bool:\n async with self.lock:\n try:\n return await self.cache.has(category, key, check_category=True)\n except KeyError:\n category_data = await self.set_category_cache(category... | [
"0.75316364",
"0.6710749",
"0.6600631",
"0.6595525",
"0.6559366",
"0.6463599",
"0.64177996",
"0.6349733",
"0.63407004",
"0.6321732",
"0.62276614",
"0.62219435",
"0.61612004",
"0.61237216",
"0.61224896",
"0.6104433",
"0.61018443",
"0.6085565",
"0.604549",
"0.60288024",
"0.6028... | 0.6723008 | 1 |
Set the root save dir path for downloaded data. | def _set_download_dir(self, path):
assert path, 'Must input a non-empty path.'
self.manager.download_dir = path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_download_dir(self, path):\n assert path, 'Must input a non-empty path.'\n self.data['info']['root_downloads_dir'] = path\n self.write_data_cache(self.data)",
"def save_dir(self, save_dir):\n self._save_dir = save_dir",
"def setDataRoot(path):\n global dataRoot\n dataR... | [
"0.76381075",
"0.69672",
"0.6955451",
"0.6866198",
"0.6835621",
"0.6759262",
"0.66752857",
"0.6605017",
"0.6592926",
"0.6583753",
"0.65707",
"0.6512547",
"0.6506848",
"0.65001744",
"0.63327855",
"0.6328429",
"0.6326461",
"0.6324719",
"0.6322443",
"0.63033235",
"0.6286442",
... | 0.6786045 | 5 |
Get the root save dir path. | def _get_download_dir(self):
return self.manager.download_dir | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getSavePath(self):\n path, filename = os.path.split(self.path)\n savePath = os.path.join(path, os.path.splitext(filename)[0])\n return savePath",
"def save_dir(self):\n return self._save_dir",
"def get_file_full_path(self):\n return self.save_dir + os.sep + self.save_fil... | [
"0.76722395",
"0.758743",
"0.7425582",
"0.74104244",
"0.73824817",
"0.7376563",
"0.7374836",
"0.7344939",
"0.73442245",
"0.732887",
"0.7297472",
"0.726045",
"0.7255593",
"0.72394204",
"0.7232963",
"0.72130597",
"0.7203231",
"0.7197525",
"0.71579677",
"0.71436346",
"0.71436346... | 0.0 | -1 |
An issue can occur if you cast from bytes to a string in python 3 (that is using str(), not using encode/decode methods). This is because all characters in bytes are literals, no implicit decoding happens, like it does in python 2. You just shouldn't use bytes for exception messages in Python 3. THIS TEST ASSERTS THAT ... | def test_py3_transaction_exception_message_bytes_non_english():
try:
raise ValueError(BYTES_UTF8_ENCODED)
except ValueError:
notice_error() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_force_bytes_exception(self):\n error_msg = \"This is an exception, voilà\"\n exc = ValueError(error_msg)\n result = force_bytes(exc)\n self.assertEqual(result, error_msg.encode('utf-8'))",
"def test_py2_transaction_exception_message_bytes_implicit_encoding_non_english():\n ... | [
"0.83982474",
"0.83854526",
"0.83779114",
"0.82169294",
"0.8051513",
"0.8018951",
"0.7982018",
"0.79234064",
"0.77766854",
"0.77227134",
"0.77188665",
"0.7680384",
"0.759683",
"0.7540304",
"0.73007363",
"0.7245301",
"0.7208291",
"0.718664",
"0.7164256",
"0.71533537",
"0.71486... | 0.81878483 | 4 |
It really makes a mess of things when you cast from bytes to a string in python 3 (that is using str(), not using encode/decode methods). This is because all characters in bytes are literals, no implicit decoding happens, like it does in python 2. You just shouldn't use bytes for exception messages in Python 3. THIS TE... | def test_py3_application_exception_message_bytes_non_english():
try:
raise ValueError(BYTES_UTF8_ENCODED)
except ValueError:
app = application()
notice_error(application=app) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_force_bytes_exception(self):\n error_msg = \"This is an exception, voilà\"\n exc = ValueError(error_msg)\n result = force_bytes(exc)\n self.assertEqual(result, error_msg.encode('utf-8'))",
"def test_py2_transaction_exception_message_bytes_implicit_encoding_non_english():\n ... | [
"0.83300245",
"0.8293078",
"0.82899606",
"0.8099072",
"0.8075111",
"0.79836553",
"0.7915772",
"0.7881713",
"0.7815377",
"0.7703832",
"0.7588328",
"0.7578139",
"0.7501937",
"0.74587625",
"0.7190638",
"0.7185833",
"0.71811104",
"0.7130594",
"0.712847",
"0.70887744",
"0.7076988"... | 0.7591558 | 10 |
This function searches max element with it's index in input list. | def find_max(data):
index = 0
res = data[index]
for i in range(1, len(data)):
if data[i] > res:
res = float(data[i])
index = i
else:
break
return res, index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def indexOfMax(list):\n max = -np.Infinity\n index = 0\n i = 0\n for value in list:\n if value > max:\n max = value\n index = i\n i += 1\n return index",
"def find_max(list):\n return find_value_at(list, 0)",
"def nextMax(value,lista):\n for i in lista:\... | [
"0.8013602",
"0.7943734",
"0.7289179",
"0.7234828",
"0.7221612",
"0.718251",
"0.71367365",
"0.7092422",
"0.6963858",
"0.6909933",
"0.68377835",
"0.683222",
"0.68068737",
"0.6794828",
"0.67918044",
"0.6773975",
"0.67089784",
"0.6700111",
"0.6694915",
"0.66651",
"0.664207",
"... | 0.67003244 | 17 |
This function searches index of element in input array (list) that is the nearest to input value. | def find_index(arr, val):
index = 0
min_differ = abs(arr[0] - val)
for i in range(1, len(arr)):
if abs(arr[i] - val) < min_differ:
min_differ = abs(arr[i] - val)
index = i
return index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearestIndex(array, value):\n idx = np.searchsorted(array, value, side='left')\n if idx > 0 and (idx == len(array) or math.fabs(value - array[idx-1]) < math.fabs(value - array[idx])):\n return idx-1\n return idx",
"def find_nearest(array, value):\n if isinstance(array, list):\n arra... | [
"0.81723696",
"0.8115663",
"0.799281",
"0.79618543",
"0.79280716",
"0.79280716",
"0.78402966",
"0.7831224",
"0.78060013",
"0.7787744",
"0.77621496",
"0.7752677",
"0.77455515",
"0.77342576",
"0.77245",
"0.77245",
"0.7639271",
"0.76345104",
"0.75995934",
"0.7511292",
"0.7507363... | 0.6897207 | 36 |
Return the path to this module | def _get_module_path():
return os.path.dirname(os.path.realpath(__file__)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def module_path(self):\n return self.config['cwd']",
"def module_path():\n return os.path.dirname(unicode(__file__, sys.getfilesystemencoding( )))",
"def path(self):\n return self.lib.path",
"def modulePath(self, name):\n return os.path.join(self.modulesDir, name)",
"def ModulePath(self... | [
"0.8369496",
"0.82219434",
"0.81217426",
"0.8078486",
"0.79126674",
"0.79036653",
"0.7835996",
"0.762173",
"0.7614666",
"0.75929976",
"0.7572188",
"0.7538071",
"0.75268453",
"0.7519039",
"0.74714875",
"0.7448487",
"0.7443749",
"0.7443278",
"0.7435927",
"0.74301237",
"0.737337... | 0.7936861 | 4 |
Tensorable to numpy array. | def th_to_arr(tens: torch.Tensor) -> np.ndarray:
return check_tensor(tens).cpu().detach().numpy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_numpy(tensor):\n raise NotImplementedError",
"def tensor2np(x):\n return x.cpu().numpy()",
"def numpy(x):\n if isinstance(x, torch.Tensor):\n x = x.detach().cpu().numpy()\n elif isinstance(x, tf.Tensor):\n x = x.numpy()\n return x.astype(np.float64)",
"def numpy(self)... | [
"0.85760856",
"0.7846332",
"0.7749058",
"0.7596503",
"0.75871223",
"0.75594985",
"0.7549278",
"0.7540835",
"0.7400798",
"0.72199804",
"0.72066957",
"0.72012573",
"0.71998954",
"0.71904993",
"0.718654",
"0.71852696",
"0.71066284",
"0.70612115",
"0.7015041",
"0.6972305",
"0.679... | 0.6993943 | 19 |
Interactively get the start date to query for. | def get_start_date():
print()
print('Getting the first start date to query for.')
print()
print('The date must be greater than Jan 1st, 2018')
year = int(input('Enter a value for the year: '))
month = int(input('Enter a value for the month: '))
day = int(input('Enter a value for the day: '))
print()
return d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_start_date(query):\n if is_new_contact(query):\n return get_date()\n return datetime.datetime.strptime(fb.get(query, None)[\"startDate\"], \"%Y%m%d\").date()",
"def start_date(self) -> str:\n return pulumi.get(self, \"start_date\")",
"def start_date(self) -> str:\n return pul... | [
"0.7898854",
"0.7284921",
"0.7284921",
"0.72482824",
"0.7244562",
"0.7244562",
"0.71697575",
"0.71697575",
"0.71697575",
"0.71697575",
"0.71592194",
"0.7101324",
"0.70960075",
"0.70908237",
"0.7053775",
"0.7011456",
"0.6952614",
"0.6797961",
"0.6795022",
"0.67918515",
"0.6768... | 0.7601688 | 1 |
Returns the employees that started on the given date, or the closest one. | def get_same_or_newer(start_date):
# data = get_file_lines(FILE_URL) ## Moved up & out of the function
# reader = csv.reader(data[1:])
reader1 = csv.reader(data[1:]) ## Changed the above to two lines to these two
reader = sorted(reader1, key=operator.itemgetter(3))
# We want all employees that started at the s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_same_or_newer(this_date):\n data = requests.get(FILE_URL, allow_redirects=True)\n open(\"employees-with-date.csv\", \"wb\").write(data.content)\n with open(\"employees-with-date.csv\") as csv_file:\n reader = csv.DictReader(csv_file)\n \n # We want all employees that started a... | [
"0.63083255",
"0.6030401",
"0.5480336",
"0.5471086",
"0.5409277",
"0.53540045",
"0.532713",
"0.53079695",
"0.52458173",
"0.52153754",
"0.521167",
"0.5210721",
"0.51861554",
"0.5166614",
"0.5153752",
"0.51457083",
"0.5135986",
"0.51257044",
"0.5113109",
"0.5039486",
"0.5032692... | 0.66254914 | 0 |
Parses a single tf.Example into image and label tensors. | def parser(serialized_example):
features = tf.parse_single_example(
serialized_example,
features={
'env': tf.FixedLenFeature([1, 4], tf.int64),
# 'env_segment_number': tf.FixedLenFeature([], tf.int64),
# 'env_segment_cpu': tf.FixedLenFeature([], tf.int64),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_tfexample(example):\n\n ## parse\n features = tf.parse_single_example(example, KEYS2FEATURES)\n\n image = tf.image.decode_png(features['image/encoded'])\n label = tf.image.decode_png(features['label/encoded'])\n # label is decoded as a 3-D png image\n label = label[..., 0]\n im_path = features['i... | [
"0.83829236",
"0.8229335",
"0.8046354",
"0.80220467",
"0.792347",
"0.78906894",
"0.7831778",
"0.77363175",
"0.76417243",
"0.7498123",
"0.74800056",
"0.7437563",
"0.7437213",
"0.7389777",
"0.73031527",
"0.7254027",
"0.7237167",
"0.7227293",
"0.7180672",
"0.7136457",
"0.7120209... | 0.7488421 | 10 |
read all container's deployment spec | def read_all_containers():
with open("group_vars/container/container_frontend.yml", 'r') as stream:
try:
fe_data = yaml.load(stream)
except yaml.YAMLError as exc:
print(exc)
with open("group_vars/container/container_backend.yml", 'r') as stream:
try:
b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_deployment_resources(self):\n pass",
"def test_list_deployment_config_for_all_namespaces(self):\n pass",
"def test_list_namespaced_deployment_config(self):\n pass",
"async def container_specs(self, event):\n await self.send(text_data=event['specs'])",
"def test_get_... | [
"0.6611615",
"0.6296608",
"0.6256134",
"0.61950594",
"0.614495",
"0.614495",
"0.6058588",
"0.6058588",
"0.6018962",
"0.59787023",
"0.5974874",
"0.5911114",
"0.5879127",
"0.58538043",
"0.5786527",
"0.57451415",
"0.5709455",
"0.56973815",
"0.5687249",
"0.56753176",
"0.5642765",... | 0.5969469 | 11 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = input("Would you like to see data for Chicago, New York City or Washington?\n").lower()
while city not i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.5973401 | 33 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
df = pd.read_csv(CITY_DATA [city])
# convert the Start Time column to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
# extract month and day of week from Start Time to create new columns
df['month'] = df['Start Time'].dt.month
df['hour'] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n input_file_name = CITY_DATA.get(city)\n\n # Load the CSV file into a Pandas data frame\n df = pd.read_csv(input_file_name)\n\n # Convert the format of the existing date field to a python DateTime\n df[\"Start Time\"] = pd.to_datetime(df[\"Start Time\"])\n\n # ... | [
"0.8109285",
"0.8046106",
"0.80428624",
"0.80095434",
"0.8007891",
"0.7999541",
"0.79988176",
"0.79894936",
"0.79798806",
"0.79738617",
"0.79618454",
"0.7956426",
"0.7947887",
"0.79465497",
"0.7908793",
"0.79084915",
"0.7905055",
"0.790119",
"0.78935534",
"0.7889669",
"0.7883... | 0.81325537 | 0 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# TO DO: display the most common month
print('most common month: {}'.format(df['month'].mode()[0]) + '\n')
# TO DO: display the most common day of week
print('most common day of week: {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583438",
"0.75797... | 0.76867086 | 10 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
print('most commonly used start station : {}'.format(df.groupby(['Start Station']).count().idxmax()[0]))
# TO DO: display most commo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.71700895 | 49 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
print('total travel time : {}'.format(df['Trip Duration'].sum()))
# TO DO: display mean travel time
print('total travel time : {}'.format(df['Trip Duration'].mean... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664047",
"0.7863... | 0.7908032 | 9 |
Plot the effective beta over time. | def plot_effective_beta(t, recalled_ctx, ctx, ctx_test_env, ax=None):
if ax is None:
ax = plt.gca()
ax.set_prop_cycle('color', sns.color_palette("husl", ctx_test_env.n))
y = np.sum(recalled_ctx * ctx, axis=1)
for i in range(1, ctx_test_env.n):
sel = (t > i) & (t <= i + 1)
ax.plo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comp_beta_plot(p1=database['K+'], p2=database['pi+'], pmax=0.5):\r\n db = []\r\n mom = np.linspace(0, pmax, 1000)\r\n m1 = p1.mass\r\n m2 = p2.mass\r\n for p in mom:\r\n b1 = beta(p, m1)\r\n b2 = beta(p, m2)\r\n db.append(abs(b1-b2))\r\n fig = plt.figure(figsize=[10, 5])\... | [
"0.7197893",
"0.65237486",
"0.6431854",
"0.5891127",
"0.5836125",
"0.57683796",
"0.5737917",
"0.572118",
"0.5704273",
"0.56686825",
"0.5651512",
"0.56512684",
"0.5649194",
"0.56414586",
"0.55973625",
"0.55701464",
"0.5550003",
"0.55275005",
"0.54972893",
"0.5488611",
"0.54851... | 0.76010364 | 0 |
convert array of labels to matrix of onehot vectors where each vector is the training label for a neural net. Can then be supplied as output to conditional crossentropy layer. Uses keras.utilts.np_utils.to_categorical | def convert_labels_categorical(labelset, labels, return_zero_to_n=False):
# reshape labels so they match output for neural net
num_syl_classes = np.size(labelset)
# make a dictionary that maps labels to classes 0 to n-1 where n is number of
# classes of syllables.
# Need this map instead of e.g. co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def one_hot(labels, classes=None):\n return K.utils.to_categorical(labels, classes)",
"def labels_to_one_hot(\n labels: np.ndarray, categories: int, axis: int = 0,\n keepdims=False, dtype=bool\n):\n if keepdims:\n assert labels.shape[axis] == 1\n result_ndim = labels.ndim\n e... | [
"0.871994",
"0.837686",
"0.8320962",
"0.81366026",
"0.81366026",
"0.809131",
"0.8074671",
"0.7959086",
"0.79353493",
"0.7914371",
"0.7908282",
"0.7904179",
"0.7904179",
"0.7904179",
"0.7893525",
"0.7867279",
"0.7854417",
"0.7851589",
"0.7846683",
"0.7830379",
"0.78241944",
... | 0.7643615 | 45 |
Gets the boot_in_play of this CoreActivitySettings. Whether the host can boot a user while the status is PLAYING. Default false | def boot_in_play(self):
return self._boot_in_play | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isInPlay(self):\n return self.inPlay",
"def get_game_on_status(self) -> bool:\n return self._game_on.get()",
"def playing(self): # type: () -> bool\n return xbmc.getCondVisibility(\"Player.Playing\")",
"def boot_in_play(self, boot_in_play):\n\n self._boot_in_play = boot_in_pl... | [
"0.6504641",
"0.61347675",
"0.61330307",
"0.61165243",
"0.6106479",
"0.60651004",
"0.5977915",
"0.59296393",
"0.59097475",
"0.5875785",
"0.581463",
"0.5804684",
"0.57933354",
"0.57904583",
"0.5784115",
"0.5775867",
"0.57365936",
"0.5729732",
"0.57157445",
"0.5708549",
"0.5702... | 0.7839527 | 0 |
Gets the custom_launch_address_allowed of this CoreActivitySettings. Restriction for whether the host creating an occurrence can specify a custom launch address (such as their own ip address). Default 'false' | def custom_launch_address_allowed(self):
return self._custom_launch_address_allowed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_launch_address_allowed(self, custom_launch_address_allowed):\n\n self._custom_launch_address_allowed = custom_launch_address_allowed",
"def map_customer_owned_ip_on_launch(self) -> bool:\n return pulumi.get(self, \"map_customer_owned_ip_on_launch\")",
"def map_public_ip_on_launch(self)... | [
"0.7817998",
"0.5630514",
"0.55023706",
"0.54466707",
"0.53140706",
"0.5210803",
"0.51306415",
"0.51289827",
"0.50209785",
"0.50209785",
"0.50209785",
"0.50209785",
"0.50209785",
"0.50209785",
"0.5011991",
"0.5011991",
"0.50068593",
"0.4963337",
"0.49399874",
"0.49296084",
"0... | 0.8432801 | 0 |
Gets the host_option of this CoreActivitySettings. Restriction for who can host an occurrence. admin disallows regular users, player means the user must also be a player in the occurrence if not admin, nonplayer means the user has the option to host without being a player. Default 'player' | def host_option(self):
return self._host_option | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_option(self, host_option):\n allowed_values = [\"admin_only\", \"player\", \"non_player\"]\n if host_option not in allowed_values:\n raise ValueError(\n \"Invalid value for `host_option` ({0}), must be one of {1}\"\n .format(host_option, allowed_value... | [
"0.6968529",
"0.60741204",
"0.55345744",
"0.5456518",
"0.5441586",
"0.5392366",
"0.5392366",
"0.5392366",
"0.5327973",
"0.53060967",
"0.5297542",
"0.51555926",
"0.5134396",
"0.5134396",
"0.51329255",
"0.51299506",
"0.50775695",
"0.50775695",
"0.50707924",
"0.5032327",
"0.4987... | 0.70220447 | 0 |
Sets the host_option of this CoreActivitySettings. Restriction for who can host an occurrence. admin disallows regular users, player means the user must also be a player in the occurrence if not admin, nonplayer means the user has the option to host without being a player. Default 'player' | def host_option(self, host_option):
allowed_values = ["admin_only", "player", "non_player"]
if host_option not in allowed_values:
raise ValueError(
"Invalid value for `host_option` ({0}), must be one of {1}"
.format(host_option, allowed_values)
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_option(self):\n return self._host_option",
"def host(self, host):\n if host is None:\n raise ValueError(\"Invalid value for `host`, must not be `None`\")\n\n self._host = host",
"def set_host_enabled(self, host, enabled):\n if enabled:\n return 'enable... | [
"0.61863655",
"0.5612143",
"0.56045806",
"0.56045806",
"0.5405935",
"0.5371666",
"0.53407246",
"0.5317728",
"0.52144206",
"0.5210717",
"0.5210717",
"0.5210717",
"0.5210717",
"0.51825655",
"0.5146095",
"0.5124027",
"0.50735766",
"0.5049621",
"0.5042974",
"0.5005113",
"0.496637... | 0.8402428 | 0 |
Gets the host_status_control of this CoreActivitySettings. Restriction for whether the host has control of the status once the game launches. If false they can only manage the game before (when setup and open). Default 'false' | def host_status_control(self):
return self._host_status_control | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStatus(self):\n return self.enabled",
"def controller_status(self) -> Optional['outputs.CSIPowerMaxStatusControllerStatus']:\n return pulumi.get(self, \"controller_status\")",
"def get_status(self):\n return super(Cabling, self).get_status()",
"def controller_status(self) -> Optio... | [
"0.59537435",
"0.58969605",
"0.5781648",
"0.5727424",
"0.5676244",
"0.56292635",
"0.5592047",
"0.55847293",
"0.55775344",
"0.5574542",
"0.5497024",
"0.5477177",
"0.5472652",
"0.5423913",
"0.54197717",
"0.5405174",
"0.5405174",
"0.5380524",
"0.53444874",
"0.5325646",
"0.532155... | 0.7934116 | 0 |
Sets the host_status_control of this CoreActivitySettings. Restriction for whether the host has control of the status once the game launches. If false they can only manage the game before (when setup and open). Default 'false' | def host_status_control(self, host_status_control):
self._host_status_control = host_status_control | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host_status_control(self):\n return self._host_status_control",
"def set_on_tunnel(self, status: bool):\n self._is_on_tunnel = status",
"def set_host_enabled(self, host, enabled):\n if enabled:\n return 'enabled'\n return 'disabled'",
"def set_host_enabled(self, hos... | [
"0.6621864",
"0.57679933",
"0.57650864",
"0.57650864",
"0.5643003",
"0.555731",
"0.5484924",
"0.5399307",
"0.5338916",
"0.531136",
"0.52691483",
"0.52605104",
"0.5247349",
"0.5235841",
"0.52325577",
"0.52021956",
"0.5183064",
"0.51094323",
"0.5092675",
"0.5080855",
"0.5075874... | 0.7426717 | 0 |
Gets the join_in_play of this CoreActivitySettings. Whether users can join while the status is PLAYING. Default false | def join_in_play(self):
return self._join_in_play | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isInPlay(self):\n return self.inPlay",
"def join_in_play(self, join_in_play):\n\n self._join_in_play = join_in_play",
"def playing(self): # type: () -> bool\n return xbmc.getCondVisibility(\"Player.Playing\")",
"def is_playing(self):\n return self.status == \"PLAYING\"",
"d... | [
"0.6779762",
"0.64318055",
"0.639745",
"0.60925627",
"0.59029955",
"0.5897133",
"0.58157945",
"0.57740295",
"0.57404727",
"0.5733266",
"0.56783926",
"0.561087",
"0.55735147",
"0.5562807",
"0.55504453",
"0.55451727",
"0.55338633",
"0.5521529",
"0.5489539",
"0.548672",
"0.54340... | 0.75434244 | 0 |
Sets the join_in_play of this CoreActivitySettings. Whether users can join while the status is PLAYING. Default false | def join_in_play(self, join_in_play):
self._join_in_play = join_in_play | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_in_play(self):\n return self._join_in_play",
"def isInPlay(self):\n return self.inPlay",
"def playing(self): # type: () -> bool\n return xbmc.getCondVisibility(\"Player.Playing\")",
"async def set_playing(self, value: bool):\n await self._pytheos.api.player.set_play_stat... | [
"0.6862973",
"0.5825352",
"0.5504",
"0.546904",
"0.5462699",
"0.5427826",
"0.5248004",
"0.5099546",
"0.50899976",
"0.5086902",
"0.5056006",
"0.5027746",
"0.5016855",
"0.5016855",
"0.5001384",
"0.49734852",
"0.4899034",
"0.4891654",
"0.48899904",
"0.48578277",
"0.4827726",
"... | 0.77250314 | 0 |
Gets the leave_in_play of this CoreActivitySettings. Whether users can leave while the status is PLAYING. Default false | def leave_in_play(self):
return self._leave_in_play | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leave_in_play(self, leave_in_play):\n\n self._leave_in_play = leave_in_play",
"async def get_stopped(self) -> bool:\n play_state = await self.get_play_state()\n return play_state == models.player.PlayState.Stopped",
"def isInPlay(self):\n return self.inPlay",
"def get_game_on_... | [
"0.62875587",
"0.59117",
"0.5894549",
"0.5893648",
"0.5876595",
"0.5724671",
"0.5615581",
"0.5611917",
"0.5540887",
"0.54994917",
"0.5487072",
"0.54278433",
"0.54045403",
"0.53946364",
"0.5387648",
"0.53860074",
"0.5356515",
"0.5291121",
"0.5287862",
"0.5250274",
"0.5247529",... | 0.73644537 | 0 |
Gets the max_players of this CoreActivitySettings. The maximum number of players the game can hold | def max_players(self):
return self._max_players | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_players(self) -> int:\n return self.param.number_of_players",
"def get_max_id(self):\r\n max_id = None\r\n for pid in self.players:\r\n if max_id is None or pid > max_id:\r\n max_id = pid\r\n return max_id",
"def max_players(self, max_players)... | [
"0.6892044",
"0.6752201",
"0.66695833",
"0.64044714",
"0.64021665",
"0.63830245",
"0.6379546",
"0.6379287",
"0.6357826",
"0.6354502",
"0.63243073",
"0.62916917",
"0.62459356",
"0.6231929",
"0.62146723",
"0.6202158",
"0.6190944",
"0.6170819",
"0.61444896",
"0.6107099",
"0.6099... | 0.8657526 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.