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 |
|---|---|---|---|---|---|---|
Returns the number of reviews this item has received. | def num_reviews(self):
return self.review_set.count() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def review_count(self):\n\t\tcount = self.reviews.aggregate(\n\t\t\tcount=models.Count('rating'))['count']\n\t\tif count is None:\n\t\t\tcount = 0\n\t\treturn count",
"def get_product_total_reviews(self, driver):\n try:\n frame = driver.find_element_by_id(\"BVRRRatingSummaryLinkReadID\")\n ... | [
"0.7873674",
"0.7359509",
"0.6934374",
"0.6874461",
"0.64592177",
"0.63455856",
"0.6313853",
"0.62345254",
"0.6144477",
"0.61405325",
"0.6089022",
"0.6089022",
"0.60361207",
"0.6023565",
"0.6003377",
"0.59979534",
"0.59459865",
"0.5938533",
"0.5930962",
"0.5890171",
"0.588638... | 0.753558 | 1 |
Return a condensed version of the review so that it does not exceed some specified length. Includes ellipses to indicate that the text continues if it is longer than the max length. | def condensed_review(self, max_len=40):
return truncatechars(self.review, max_len) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shortened_text(self, max_chars=50):\n if len(self.comment) > max_chars:\n return self.comment[:max_chars] + \"...\"\n else:\n return self.comment",
"def shortened_text(self, max_chars=50):\n if len(self.text) > max_chars:\n return self.text[:max_chars] + ... | [
"0.6722693",
"0.67107177",
"0.66276777",
"0.6574656",
"0.65310395",
"0.65192646",
"0.64799404",
"0.6364686",
"0.6339288",
"0.63075477",
"0.6288298",
"0.62859076",
"0.62415665",
"0.6207872",
"0.61938876",
"0.61147434",
"0.60993254",
"0.5960138",
"0.59266937",
"0.5908461",
"0.5... | 0.8607684 | 0 |
Function to convert a tensor to a PIL image, show it and save it. | def tensor_to_image(tensor, save=None):
img = transforms.ToPILImage(mode='RGB')(tensor)
img.show()
if save:
img.save(save) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tensor_to_image(img):\n t = transforms.ToPILImage()\n return t(img)",
"def to_image(tensor):\n # Converts to PIL image\n unloader = transforms.ToPILImage()\n # Clone the tensor to CPU\n image = tensor.cpu().clone()\n # Remove fake batch dimension\n image = image.squeeze(0)\n # Conv... | [
"0.7564247",
"0.74056727",
"0.72033066",
"0.71953124",
"0.7072148",
"0.70350677",
"0.70091414",
"0.69938576",
"0.6954114",
"0.69509315",
"0.69324684",
"0.691701",
"0.691701",
"0.6914065",
"0.69139165",
"0.69139165",
"0.69139165",
"0.68705267",
"0.6849567",
"0.682147",
"0.6799... | 0.8431221 | 0 |
find euclidean dist b/w arrays x & y >>> KNN.euclidean(np.array([0, 0]), np.array([3, 4])) 5.0 | def euclidean(x, y):
ed = np.sqrt(np.sum((x-y)**2))
# print ed
return ed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def euclidean_dist(X, y):\n return np.sqrt(np.sum((X - y) ** 2, 1)) # broadcasted calculations",
"def test_euclidean_distance(self):\n knn = Knn(n_neighbors=3)\n knn.fit(np.array(little_X), little_Y)\n d = knn._euclidean_distance(np.array([5, 6]))\n assert (d == [5,5]).all(), \"Euc... | [
"0.81508106",
"0.8048962",
"0.8040036",
"0.8040036",
"0.8013634",
"0.800576",
"0.79853535",
"0.7839889",
"0.7760837",
"0.77046335",
"0.7704592",
"0.762838",
"0.7619347",
"0.76099575",
"0.75979793",
"0.7504445",
"0.7358911",
"0.7339859",
"0.7277312",
"0.72647184",
"0.72538716"... | 0.78300065 | 8 |
Test of the equality special method (__eq__) of Rnode class. | def test_eq():
# Test for equality special method with scalar Rnode object and float value
x = Rnode(2.0)
try:
assert (x == 2.0) == True
assert (x == 1.0) == False
except AssertionError as e:
print(e)
raise AssertionError
# Test for equality special method with two s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def... | [
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015",
"0.78237015"... | 0.8349103 | 0 |
Test of the not equal special method (__neq__) of Rnode class. | def test_neq():
# Test for not equal special method with scalar Rnode object and float value
x = Rnode(2.0)
try:
assert (x != 2) == False
assert (x != 1) == True
except AssertionError as e:
print(e)
raise AssertionError
# Test for equality special method with two sca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __neq__(self, other): \n return not self == other",
"def ne (self, other):\n return not (self == other) # opposite of eq",
"def test_not_equal(self):\n utils.compare_tracing_methods(\n SimpleCompareOpsModule(\"notEqual\"),\n torch.randn(3, 4, 5... | [
"0.7729452",
"0.7568806",
"0.7487238",
"0.74660546",
"0.7357911",
"0.7323891",
"0.7312588",
"0.7269901",
"0.7258679",
"0.7190942",
"0.7188006",
"0.71747214",
"0.7170952",
"0.71637297",
"0.7154526",
"0.7150574",
"0.71466833",
"0.71417236",
"0.71382135",
"0.70904255",
"0.707939... | 0.83115476 | 0 |
Creates a dict for degree program role emojis | def get_degree_program_emojis(self):
tmp_emojis = {}
emojis = {}
degree_program_assignable = self.assignable_roles[0]
# start with getting all emojis that are used in those roles as a dict
for emoji in self.bot.emojis:
if emoji.name in degree_program_assignable:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color_emojis(self):\n\n emojis = {}\n color_assignable = self.assignable_roles[1]\n\n # start with getting all emojis that are used in those roles as a dict\n for emoji in self.bot.emojis:\n if emoji.name in color_assignable:\n emojis[emoji.name] = emoj... | [
"0.67376924",
"0.6416135",
"0.566497",
"0.55706185",
"0.5553401",
"0.5523874",
"0.55177945",
"0.5304827",
"0.5247061",
"0.52435064",
"0.5193873",
"0.5188143",
"0.5119345",
"0.51125866",
"0.5111811",
"0.509967",
"0.5092796",
"0.50083697",
"0.50078994",
"0.50059485",
"0.4994313... | 0.772204 | 0 |
Creates a dict for special role emojis | def get_special_emojis(self):
return self.assignable_roles[2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_color_emojis(self):\n\n emojis = {}\n color_assignable = self.assignable_roles[1]\n\n # start with getting all emojis that are used in those roles as a dict\n for emoji in self.bot.emojis:\n if emoji.name in color_assignable:\n emojis[emoji.name] = emoj... | [
"0.6909326",
"0.6556305",
"0.6393406",
"0.5776544",
"0.57104194",
"0.55993867",
"0.55544674",
"0.5541749",
"0.5498031",
"0.5464273",
"0.54079306",
"0.53472483",
"0.53032136",
"0.5264089",
"0.5214847",
"0.5213427",
"0.5205784",
"0.52042633",
"0.5081268",
"0.5077816",
"0.507236... | 0.6518509 | 2 |
Get the key for a given role. This role is used for adding or removing a role from a user. | def get_key(self, role):
for key, role_name in self.assignable_roles[0].items():
if role_name == role.name:
return key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getProfileKeyForRoleKey(key, profile_model):\n\n entity = db.get(key)\n profile = _getProfileForRole(entity, profile_model)\n return profile.key()",
"def role_move_key(role, position):\n return {\n 'id': role.id,\n 'position': position,\n }",
"def role_id(self) -> pulumi.Input[str]:... | [
"0.7237859",
"0.66870034",
"0.6470941",
"0.6447546",
"0.6437402",
"0.6393708",
"0.63731253",
"0.63731253",
"0.63573575",
"0.63294184",
"0.627488",
"0.6259605",
"0.6172182",
"0.6165065",
"0.6143015",
"0.6126313",
"0.61181027",
"0.61163",
"0.61163",
"0.61163",
"0.606961",
"0.... | 0.8833362 | 0 |
Test validating a genesis block without a balance | def test_missing_balance(self):
db = MockDatabase()
prev = TestBlock(block_type=BlockTypes.CHECKPOINT, transaction={})
result, errors = prev.validate_transaction(db)
self.assertEqual(result, ValidationResult.invalid)
self.assertIsInstance(errors[0], EuroTokenBlock.MissingBalance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_balance_genesis(self):\n db = MockDatabase()\n prev = TestBlock(block_type=BlockTypes.CHECKPOINT, transaction={'balance': 0})\n result, errors = prev.validate_transaction(db)\n self.assertEqual(result, ValidationResult.valid)\n self.assertEqual(errors, [])\n ... | [
"0.87593347",
"0.8491371",
"0.810086",
"0.7774584",
"0.75393575",
"0.71184",
"0.70073706",
"0.6988844",
"0.6858272",
"0.67265385",
"0.6725867",
"0.67177886",
"0.67166823",
"0.67023444",
"0.6700901",
"0.6694032",
"0.6687411",
"0.6680484",
"0.66763043",
"0.6668178",
"0.6656399"... | 0.7751824 | 4 |
Test validating a genesis block without a balance | def test_missing_validated_balance(self):
db = MockDatabase()
G = db.owner
A = TestWallet()
G1 = TestBlock(
key = G,
block_type=BlockTypes.CREATION,
transaction={'amount': 10},
links=A
)
result, err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_valid_balance_genesis(self):\n db = MockDatabase()\n prev = TestBlock(block_type=BlockTypes.CHECKPOINT, transaction={'balance': 0})\n result, errors = prev.validate_transaction(db)\n self.assertEqual(result, ValidationResult.valid)\n self.assertEqual(errors, [])\n ... | [
"0.8759085",
"0.8491472",
"0.8099709",
"0.7752675",
"0.753929",
"0.7118385",
"0.7007441",
"0.6987988",
"0.6858475",
"0.67260003",
"0.6725478",
"0.671735",
"0.67161006",
"0.6702666",
"0.6700453",
"0.6694123",
"0.66869605",
"0.66800416",
"0.6675733",
"0.6667983",
"0.6655829",
... | 0.777491 | 3 |
Test validating a block that points towards a previous block with a non eurotoken block in between | def test_double_validate_skip_non_eurotoken(self):
db = MockDatabase()
G = db.owner
A1 = TestBlock(
block_type=BlockTypes.CHECKPOINT,
transaction={'balance': 0},
links=G
)
result, errors = A1.validate_transaction(db)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_missing_previous(self):\n db = MockDatabase()\n\n G = db.owner\n\n A1 = TestBlock(\n block_type=BlockTypes.CHECKPOINT,\n transaction={'balance': 0},\n links=G\n )\n result, errors = A1.validate_transaction(db)\n ... | [
"0.7168689",
"0.7145038",
"0.6877735",
"0.67636186",
"0.6729137",
"0.66422474",
"0.6636067",
"0.6624457",
"0.65232956",
"0.6517384",
"0.6478784",
"0.6478032",
"0.6471213",
"0.6467041",
"0.6453987",
"0.6446847",
"0.6430455",
"0.64177257",
"0.64101344",
"0.64051735",
"0.6399836... | 0.74822056 | 0 |
Renders the home page. | def index(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/site/indexSite.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Início',
... | {
"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 home page. | def inicio(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/index.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Index',
... | {
"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 home page. | def search(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/geral/resultados.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Resultados',
... | {
"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 home page. | def s_quemSomos(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/site/s_quemSomos.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Quem Somos',
... | {
"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 home page. | def s_contato(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/site/s_contato.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Contato',
... | {
"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 quemSomos(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/geral/quemSomos.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Quem Somos',
... | {
"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 cadPrestador(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/prestador/frm_prestador.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Cad.Pre... | {
"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.85655934",
"0.8504223",
"0.8449257",
"0.84052455",
"0.83946466",
"0.8293479",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.8267646",
... | 0.0 | -1 |
Renders the about page. | def servPrestados(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/prestador/servPrestados.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Serv.P... | {
"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 colmeiaPontos(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/prestador/colmeiaPontos.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | ColPon... | {
"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 cadContratante(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/contratante/frm_contratante.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | C... | {
"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 servContratados(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/contratante/frm_contratante.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | ... | {
"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.85655934",
"0.8504223",
"0.8449257",
"0.84052455",
"0.83946466",
"0.8293479",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.82707715",
"0.8267646",
... | 0.0 | -1 |
Renders the about page. | def relContratante(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/contratante/relatorioContratante.html',
context_instance=RequestContext(request,
{
'title': 'Colmei... | {
"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 sair(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/index.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Inicio',
... | {
"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 login(request):
assert isinstance(request, HttpRequest)
return render(
request,
'app/geral/login.html',
context_instance=RequestContext(request,
{
'title': 'Colmeia | Login',
... | {
"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 |
str to dict, replace '' with None | def string_to_dict(value):
if not value:
return None
values = json.loads(value)
for key in values:
if values[key] == "":
values[key] = None
return values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rawtodictonary(rawstring):\n\n if is_python3():\n rawstring = bytes(rawstring).decode('utf-8') \n \n raw = rawstring.split(NULL)[:-2]\n\n data = {}\n for i in range(0,len(raw) - 1,2):\n\n key,val = raw[i], raw[i+1]\n keyel = key.split(\"\\x1c\")\n\n if len(keyel) == ... | [
"0.6168078",
"0.60156316",
"0.59842765",
"0.59556097",
"0.5898509",
"0.58916295",
"0.58255106",
"0.5792088",
"0.57648796",
"0.5736805",
"0.57342845",
"0.5708212",
"0.5681782",
"0.5654695",
"0.5602385",
"0.5569952",
"0.5556853",
"0.5530618",
"0.551076",
"0.5510464",
"0.5497134... | 0.6775666 | 0 |
Add a new item onto the top of our stack. | def push(self, item):
# 0(1)
# Your code here
self.stack.push(item)
# update max if necessary
# if self.max is None or self.max < item:
# self.max = item
# get the current max, compate it to item, and if current max < item, new max - item
current_max =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push(self, item):\r\n self.stack.insert(0, item)",
"def push(self, item):\n self.stack.append(item)",
"def push(self, item):\n self.stack.append(item)",
"def push(self, item):\n super().add_item_to_front(item)",
"def push(self, item):\n # Reassign the link to top of t... | [
"0.8660057",
"0.8422733",
"0.8422733",
"0.82595897",
"0.822329",
"0.8117008",
"0.7997836",
"0.7981091",
"0.7941532",
"0.7931066",
"0.7874844",
"0.78689915",
"0.77990323",
"0.7743534",
"0.7714328",
"0.7706821",
"0.76146543",
"0.76113874",
"0.75759387",
"0.757182",
"0.757182",
... | 0.70391506 | 60 |
Remove and return the top item from our stack. | def pop(self):
# O(1)
# Your code here
item = self.stack.pop() # O(1)
# check if we're removing the max
#if item == max: #O(1)
# if so, we need to update self. max
#new_max = self.find_max() # O(n) # Don't need find anymore
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self):\n try:\n if self.size() > 0:\n top = self.top()\n self.items.pop()\n return top\n else:\n raise IndexError('Cannot pop item, stack is empty.')\n except IndexError as err:\n print(err)\n ... | [
"0.8795645",
"0.85758275",
"0.85595405",
"0.8312504",
"0.82554007",
"0.82049006",
"0.8165187",
"0.81395227",
"0.8128441",
"0.8109492",
"0.81087446",
"0.80679446",
"0.8064436",
"0.80616176",
"0.80537707",
"0.80385906",
"0.8038233",
"0.7967132",
"0.79590183",
"0.7957032",
"0.79... | 0.0 | -1 |
The last item in maxex_stack is the max item in our stack. | def get_max(self):
# 0(1)
return self.max_stack.peek()
# Don't need find_max we returned max_stack.peek() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_stack(self):\n if self.maxx == []:\n return None\n return self.maxx[-1]",
"def return_the_maximum(self):\n\n return self.__max_stack[-1]",
"def max(self):\n assert self.__stack\n return self.__max_values[-1]",
"def pop(self):\n item = self.stack.po... | [
"0.8510795",
"0.7924731",
"0.7765927",
"0.7196239",
"0.7151589",
"0.709411",
"0.7048309",
"0.6803708",
"0.6731458",
"0.6667348",
"0.6666899",
"0.6538575",
"0.6518682",
"0.6505575",
"0.6404108",
"0.6403371",
"0.6373301",
"0.6365572",
"0.63617873",
"0.63423467",
"0.6326194",
... | 0.791391 | 2 |
Visualizes annotation using cv2.imshow from OpenCV. Press `Esc` to exit. | def visualize(self, put_text, imshow_delay=1, shuffle=False):
max_image_size = 1280, 768
images = list(self.annotation['images'])
if shuffle:
import random
random.shuffle(images)
for frame in tqdm(images):
image_path = frame['file_name']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_image(img, label):\n cv2.imshow(label,img)\n cv2.waitKey(0)\n cv2.destroyAllWindows()",
"def show(img, name=\"img\"):\n cv2.imshow(name, img)\n cv2.waitKey(0)\n cv2.destroyWindow(name)",
"def show(image):\n cv2.imshow('press ENTER to close', image)\n cv2.waitKey(0)",
"def ... | [
"0.7073545",
"0.7017247",
"0.6957055",
"0.6829036",
"0.6626486",
"0.65930355",
"0.65789217",
"0.6578278",
"0.6545489",
"0.6517613",
"0.65037686",
"0.6487285",
"0.6481418",
"0.6464025",
"0.64157873",
"0.6399011",
"0.63903165",
"0.63572997",
"0.63012075",
"0.6297656",
"0.627864... | 0.62584 | 24 |
Return a reference to a component. | def get(name):
return componentManager.components[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def component(self):\n return self._component",
"def component(self):\n return self._component",
"def comp(self, componentname):\n retv = self.components.lookup(componentname)\n if (retv == None):\n raise Exception(\"Component not found: '{0}'.\".format(componentname))\n ... | [
"0.7232111",
"0.7232111",
"0.67434037",
"0.66446954",
"0.6628947",
"0.65864563",
"0.65580434",
"0.6483506",
"0.6451921",
"0.64111656",
"0.6335025",
"0.6333815",
"0.6294749",
"0.6263135",
"0.61872965",
"0.61623025",
"0.613299",
"0.6105409",
"0.6103949",
"0.6094527",
"0.607536"... | 0.6889208 | 2 |
Function to return. Takes an instance of the class and returns its string representation | def make_string_repr(instance):
arg_list = [] if args is None else [getattr(instance, arg) for arg in args if hasattr(instance, arg)]
kwarg_dict = {} if kwargs is None else {key: getattr(instance, key) for key in kwargs if hasattr(instance, key)}
# Check that we could bind the args/kwargs that... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __repr__(self):\n return \"<instance of {}>\".format(self.__class__.__name__)",
"def __repr__(self):\r\n return str(self.__class__) + str(self)",
"def __call__(self, cls):\n cls_dict = dict(cls.__dict__)\n\n def wrap_str(w_self):\n return self.pformat(w_self)\n\n ... | [
"0.7379035",
"0.73591554",
"0.7304432",
"0.73019904",
"0.72913086",
"0.7290749",
"0.7260209",
"0.7233015",
"0.7233015",
"0.7233015",
"0.7229833",
"0.7226634",
"0.72218925",
"0.72218925",
"0.72218925",
"0.7207321",
"0.7198061",
"0.7173377",
"0.7173377",
"0.7168357",
"0.7162599... | 0.0 | -1 |
This function takes in a pd.DataFrame, a user defined title str, a user defined values string, and then parses and produces a plotly express pie chart; it then appends a prefix of the title_str before it returns the dataframe. | def generate_pie_plot(user_defined_df, title_str, values_str):
import pandas as pd
import plotly.express as px
user_defined_df = user_defined_df[values_str].value_counts()
user_defined_df = pd.DataFrame(user_defined_df)
user_defined_df = user_defined_df.reset_index()
fig = px.pie(user_defined_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pie_plot(self,\n values: str,\n groupby: str,\n title: str='Pie Plot',\n **kwargs) -> Figure:\n fig = px.pie(self.df,\n values=values, names=groupby,\n title=title,\n **kwargs)\n ... | [
"0.6220093",
"0.60791814",
"0.59988254",
"0.58728814",
"0.5822571",
"0.56006414",
"0.5567305",
"0.55106544",
"0.55006415",
"0.5493332",
"0.5450346",
"0.5383633",
"0.53785443",
"0.53618294",
"0.53375953",
"0.53019255",
"0.51803726",
"0.5143313",
"0.5139939",
"0.5121946",
"0.51... | 0.79543734 | 0 |
The inchi representation of the molecule Created by lazy evaluation. Will cause the molecule to be sanitized. | def inchi(self) -> str:
if not self._inchi:
self.sanitize(raise_exception=False)
self._inchi = Chem.MolToInchi(self.rd_mol)
if self._inchi is None:
raise MoleculeException("Could not make InChI")
return self._inchi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inchi_key(self) -> str:\n if not self._inchi_key:\n self.sanitize(raise_exception=False)\n self._inchi_key = Chem.MolToInchiKey(self.rd_mol)\n if self._inchi_key is None:\n raise MoleculeException(\"Could not make InChI key\")\n return self._inchi_k... | [
"0.66942304",
"0.64981216",
"0.63017654",
"0.62291807",
"0.62291807",
"0.6121862",
"0.6089784",
"0.60197574",
"0.5882245",
"0.58663726",
"0.5770186",
"0.5677955",
"0.5667427",
"0.5654148",
"0.5627222",
"0.54973763",
"0.54892105",
"0.5479777",
"0.5465602",
"0.5449101",
"0.5405... | 0.8080842 | 0 |
Return a dictionary mapping to atom mappings to atom indices | def mapping_to_index(self) -> Dict[int, int]:
if not self._atom_mappings:
self._atom_mappings = {
atom.GetAtomMapNum(): atom.GetIdx()
for atom in self.rd_mol.GetAtoms()
if atom.GetAtomMapNum()
}
return self._atom_mappings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapping_to_index(self) -> Dict[int, int]:\n if not self._atom_mappings:\n self._atom_mappings = {\n atom.GetAtomMapNum(): atom.GetIdx()\n for atom in self.mapped_mol.GetAtoms()\n if atom.GetAtomMapNum()\n }\n return self._atom_map... | [
"0.7814939",
"0.7206743",
"0.6909596",
"0.6887894",
"0.6662952",
"0.6656431",
"0.6656431",
"0.65971655",
"0.6515416",
"0.6481276",
"0.6475598",
"0.6410209",
"0.63842255",
"0.63825047",
"0.6320345",
"0.628117",
"0.62599856",
"0.624677",
"0.62401754",
"0.6190376",
"0.618866",
... | 0.79496324 | 0 |
Returns an instance of the UniqueMolecule class that is representing the same molecule but is not hashable or comparable. | def make_unique(self) -> "UniqueMolecule":
return UniqueMolecule(rd_mol=self.rd_mol) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def none_molecule() -> UniqueMolecule:\n return UniqueMolecule(rd_mol=Chem.MolFromSmiles(\"\"))",
"def unique(self):\n return frozenset(self)",
"def unique(self):\n seen = {}\n result = []\n for p in map(tuple, self):\n if p not in seen:\n seen[p] = True... | [
"0.7282849",
"0.610543",
"0.5885973",
"0.5789799",
"0.5687429",
"0.5687429",
"0.55871034",
"0.54921764",
"0.54882026",
"0.54718494",
"0.5441569",
"0.5438885",
"0.54042864",
"0.53965944",
"0.53803945",
"0.5377621",
"0.5313008",
"0.5304414",
"0.52989197",
"0.52948606",
"0.52867... | 0.8251841 | 0 |
Return a dictionary mapping to atom mappings to atom indices | def mapping_to_index(self) -> Dict[int, int]:
if not self._atom_mappings:
self._atom_mappings = {
atom.GetAtomMapNum(): atom.GetIdx()
for atom in self.mapped_mol.GetAtoms()
if atom.GetAtomMapNum()
}
return self._atom_mappings | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mapping_to_index(self) -> Dict[int, int]:\n if not self._atom_mappings:\n self._atom_mappings = {\n atom.GetAtomMapNum(): atom.GetIdx()\n for atom in self.rd_mol.GetAtoms()\n if atom.GetAtomMapNum()\n }\n return self._atom_mapping... | [
"0.79496324",
"0.7206743",
"0.6909596",
"0.6887894",
"0.6662952",
"0.6656431",
"0.6656431",
"0.65971655",
"0.6515416",
"0.6481276",
"0.6475598",
"0.6410209",
"0.63842255",
"0.63825047",
"0.6320345",
"0.628117",
"0.62599856",
"0.624677",
"0.62401754",
"0.6190376",
"0.618866",
... | 0.7814939 | 1 |
Returns a new, single point via uniform distribution. | def sample(self):
ndim = len(self.lower_bounds)
pts = numpy.zeros(ndim)
for j in range(ndim):
lb = self.lower_bounds[j]
ub = self.upper_bounds[j]
pts[j] = numpy.random.uniform(lb, ub)
return pts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_one(self):\n # x = self.mean + self.sigma * np.random.normal()\n x = self.dist.sample(1)\n return x",
"def samplepoint(x,u):\n return point(x)",
"def random_uniform(self, n_samples=1, max_norm=1):\n point = ((np.random.rand(n_samples, self.dimension) - .5)\n ... | [
"0.670535",
"0.6499165",
"0.64316136",
"0.64157754",
"0.63686895",
"0.6287546",
"0.62819993",
"0.62597746",
"0.62487924",
"0.62299883",
"0.62272865",
"0.6218811",
"0.61978704",
"0.6152032",
"0.60811263",
"0.6076544",
"0.60763395",
"0.6063436",
"0.60350066",
"0.6031453",
"0.60... | 0.0 | -1 |
determine what the final output file name suffix is | def get_cleaned_suffix(cleaning_protocol, sample, config):
cleaned_suffix = QC_PROTOCOLS.get(cleaning_protocol, "")
num_raw_files = len(config["sample_data"][sample]["raw"])
# special cases
if cleaning_protocol not in JOINING_PROTOCOLS and num_raw_files == 1:
# if cleaning one file for assembly... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_filename(self, prefix, suffix):\n filename = \"%s%s%s\" % (prefix, _ExecutionWrapper._file_index, suffix)\n _ExecutionWrapper._file_index += 1\n return filename",
"def file_suffix(self):\n return f'{self.image_count:05}' if self.sequential_naming else \\\n dateti... | [
"0.75334775",
"0.72492594",
"0.7187885",
"0.71285695",
"0.7061977",
"0.7024112",
"0.694769",
"0.6922232",
"0.69019306",
"0.6874067",
"0.6861291",
"0.68280846",
"0.68128335",
"0.6808286",
"0.6808286",
"0.6808286",
"0.68066615",
"0.68066615",
"0.67965025",
"0.67462647",
"0.6728... | 0.6426988 | 64 |
Set up the sensors. | async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):
data = await nooa.get_data()
entities = [
NooaSensor(data, "R"),
NooaSensor(data, "S"),
NooaSensor(data, "G"),
]
async_add_entities(entities) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_sensors(self, configs):\n self.__sensors = self.setup_components(configs, 'scale_client.sensors')",
"def setup_sensors(self, settings):\n\n for sensor in settings.sensors: # for each sensor listed in yaml file\n s = Sensor(sensor, settings.sensors, settings, self.tiny_image,\n... | [
"0.79451984",
"0.7280013",
"0.719321",
"0.71287286",
"0.7115475",
"0.70235187",
"0.70175487",
"0.70025635",
"0.6995161",
"0.6968315",
"0.6840185",
"0.6827717",
"0.67570966",
"0.6757062",
"0.67450905",
"0.67096263",
"0.67093563",
"0.66530246",
"0.6593661",
"0.65507644",
"0.654... | 0.0 | -1 |
Property for the state attributes. | def state(self):
return self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_attributes(self):\n return self._attributes",
"def state_attributes(self):\n return self._attributes",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\... | [
"0.8222077",
"0.8222077",
"0.7945815",
"0.7945815",
"0.79192454",
"0.79192454",
"0.7833931",
"0.781245",
"0.7786447",
"0.7786339",
"0.7780284",
"0.77755797",
"0.7716974",
"0.7716974",
"0.7666419",
"0.76396936",
"0.76030153",
"0.76030153",
"0.76030153",
"0.76030153",
"0.760301... | 0.0 | -1 |
Name property for sensor. | def name(self):
return self._name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._sensor.name",
"def name(self):\n return f\"{self._name} {self._sensor_name}\"",
"def name(self):\n return f\"{self._name}_{self._sensor}\"",
"def name(self):\n return f\"{self._name} {SENSOR_TYPES[self.sensor][0]}\"",
"def name(self):\n retu... | [
"0.8401038",
"0.8286776",
"0.8209207",
"0.8089812",
"0.80468774",
"0.78169984",
"0.7793606",
"0.7586986",
"0.74556863",
"0.74098885",
"0.74098885",
"0.7384246",
"0.73621696",
"0.73397535",
"0.7325094",
"0.732079",
"0.723027",
"0.7183104",
"0.7126652",
"0.71193516",
"0.7091977... | 0.0 | -1 |
Property for the state attributes. | def state_attributes(self):
return self._attributes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\n return self._state_attrs",
"def device_state_attributes(self):\n return self.attr",
"def device_state_attributes(self):\n return self.attr",
"def state_attributes(self):\n ... | [
"0.7945815",
"0.7945815",
"0.79192454",
"0.79192454",
"0.7833931",
"0.781245",
"0.7786447",
"0.7786339",
"0.7780284",
"0.77755797",
"0.7716974",
"0.7716974",
"0.7666419",
"0.76396936",
"0.76030153",
"0.76030153",
"0.76030153",
"0.76030153",
"0.76030153",
"0.76030153",
"0.7603... | 0.8222077 | 1 |
Get the column represented by this source location. | def column(self):
return self._get_instantiation()[2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column(self):\n return self[\"column\"]",
"def get_source_column(self, column):\n return self._source.columns.get_loc(self._dataframe.columns[column])",
"def get_column(self):\n return self._column_number",
"def column(self): \r\n\r\n return self._column",
"def getColumn(sel... | [
"0.8202586",
"0.8186537",
"0.81281596",
"0.81090987",
"0.7839749",
"0.78167313",
"0.7734256",
"0.7679857",
"0.7651216",
"0.76362187",
"0.76080227",
"0.7458868",
"0.744459",
"0.7411419",
"0.7411419",
"0.7411419",
"0.7411419",
"0.7411419",
"0.7411419",
"0.7411419",
"0.7411419",... | 0.7495845 | 11 |
Return a SourceLocation representing the first character within a source range. | def start(self):
return conf.lib.clang_getRangeStart(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hgvs_start(self):\n try:\n return self.hp.parse(self.term).posedit.pos.start\n except hgvs.exceptions.HGVSParseError:\n # Log me\n # print(self.term)\n return None",
"def start(self, start=None):\n return self.bounds(start)[0]",
"def start_po... | [
"0.61829656",
"0.6081692",
"0.60044247",
"0.59896797",
"0.59643614",
"0.59604144",
"0.591591",
"0.58417094",
"0.5837312",
"0.578252",
"0.5671531",
"0.56464666",
"0.563894",
"0.5573167",
"0.5557585",
"0.5542953",
"0.5531345",
"0.5527467",
"0.5510017",
"0.5488377",
"0.5480777",... | 0.5620392 | 13 |
Obtain a registered TokenKind instance from its value. | def from_value(value):
result = TokenKind._value_map.get(value, None)
if result is None:
raise ValueError('Unknown TokenKind: %d' % value)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kind(self):\r\n return TokenKind.from_value(conf.lib.clang_getTokenKind(self))",
"def register(value, name):\r\n if value in TokenKind._value_map:\r\n raise ValueError('TokenKind already registered: %d' % value)\r\n\r\n kind = TokenKind(value, name)\r\n TokenKind._value... | [
"0.71096385",
"0.6861361",
"0.5733355",
"0.5616717",
"0.55858064",
"0.5507318",
"0.55009174",
"0.52356625",
"0.51657856",
"0.5150533",
"0.51364356",
"0.51281285",
"0.5124118",
"0.5101072",
"0.5100127",
"0.5100127",
"0.5094459",
"0.50671434",
"0.50639117",
"0.5058934",
"0.5040... | 0.85034496 | 0 |
Get the enumeration name of this cursor kind. | def name(self):
if self._name_map is None:
self._name_map = {}
for key,value in CursorKind.__dict__.items():
if isinstance(value,CursorKind):
self._name_map[value] = key
return self._name_map[self] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kind_name(self) -> str:\n\n return self.kindName_",
"def kind(self):\r\n return CursorKind.from_id(self._kind_id)",
"def enum(self, name: str) -> str:\n return camel_case(rstrip(lstrip(name, self.strip_prefix.lower() + \"_\"), '_t'))",
"def name(self):\r\n if self._name_ma... | [
"0.6952754",
"0.6836199",
"0.6568886",
"0.6470323",
"0.64484495",
"0.640635",
"0.6387758",
"0.6341467",
"0.6328878",
"0.6328878",
"0.6302517",
"0.6283944",
"0.62196887",
"0.61947507",
"0.6184855",
"0.6183771",
"0.6183771",
"0.6183771",
"0.6183771",
"0.6183771",
"0.6183771",
... | 0.7517167 | 0 |
Return all CursorKind enumeration instances. | def get_all_kinds():
return filter(None, CursorKind._kinds) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kind(self):\r\n return CursorKind.from_id(self._kind_id)",
"def find_cursor_kinds(node, kinds):\n def visitor(node, parent, found):\n if node.kind in kinds:\n found.append(node)\n return 2\n\n found = []\n cindex.Cursor_visit(node,\n cindex.Curs... | [
"0.7203632",
"0.66063005",
"0.6298967",
"0.6226333",
"0.59354454",
"0.58342755",
"0.5799652",
"0.57028824",
"0.5615335",
"0.55768055",
"0.5390652",
"0.5386993",
"0.53696704",
"0.5336619",
"0.52967525",
"0.52808607",
"0.52640164",
"0.5262177",
"0.5249215",
"0.52460957",
"0.517... | 0.8220977 | 0 |
Test if this is a reference kind. | def is_reference(self):
return conf.lib.clang_isReference(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_reference(type):\n nake_type = remove_alias(type)\n return isinstance(nake_type, cpptypes.reference_t)",
"def is_reference(self):\n return self.resource.is_reference()",
"def is_ref_known(self):\r\n \r\n if \"N\" in self.ref:\r\n return False\r\n else... | [
"0.7555281",
"0.7463913",
"0.6985615",
"0.6943711",
"0.6936441",
"0.68996096",
"0.6808804",
"0.65281665",
"0.648281",
"0.6480759",
"0.6454408",
"0.64146924",
"0.63703185",
"0.6369095",
"0.63676953",
"0.6333936",
"0.63290805",
"0.632155",
"0.626628",
"0.620127",
"0.619808",
... | 0.73788285 | 2 |
Test if this is an invalid kind. | def is_invalid(self):
return conf.lib.clang_isInvalid(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_kind(kind: Any) -> None:\r\n if not kind in {\"T\", \"P\"}:\r\n raise ValueError(f\"`kind` should be 'T' or 'P', but got {kind}.\")",
"def check_filekind(self):\n assert self.filekind in self.obs_package.FILEKINDS, \\\n \"Invalid filekind \" + repr(self.filekind) + \" in \"... | [
"0.649228",
"0.6314246",
"0.62624824",
"0.6208556",
"0.6190684",
"0.61733776",
"0.61721855",
"0.602325",
"0.5988068",
"0.59478384",
"0.5914175",
"0.5906867",
"0.58863896",
"0.5857071",
"0.58547044",
"0.58503956",
"0.57941204",
"0.57845545",
"0.57790446",
"0.57776433",
"0.5744... | 0.5782813 | 18 |
Return the kind of this cursor. | def kind(self):
return CursorKind.from_id(self._kind_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self):\r\n if not hasattr(self, '_type'):\r\n self._type = conf.lib.clang_getCursorType(self)\r\n\r\n return self._type",
"def kind(self):\n return self._kind()",
"def kind(self):\n return self._kind",
"def kind(self):\n return self._kind",
"def GetKin... | [
"0.8076149",
"0.7395552",
"0.72831637",
"0.72831637",
"0.7163372",
"0.7129203",
"0.7086099",
"0.70003194",
"0.6892582",
"0.6891974",
"0.68441606",
"0.684342",
"0.6806143",
"0.6759466",
"0.67292345",
"0.67292345",
"0.67292345",
"0.67292345",
"0.67292345",
"0.67292345",
"0.6729... | 0.8762075 | 0 |
Retrieve the Type (if any) of the entity pointed at by the cursor. | def type(self):
if not hasattr(self, '_type'):
self._type = conf.lib.clang_getCursorType(self)
return self._type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_type(self):\n return self._type_obj",
"def get_type(self) -> str:\n return self.row_dict['type']",
"def get_entity_type(self):\n return self.entity_type",
"def entity_type(self):\n return self._entity_type",
"def get_type(self):\n return self._type",
"def get_ty... | [
"0.7195941",
"0.7165912",
"0.7143174",
"0.70549",
"0.7047004",
"0.7047004",
"0.7024994",
"0.6984422",
"0.6984422",
"0.69765097",
"0.69765097",
"0.69765097",
"0.69765097",
"0.69765097",
"0.69765097",
"0.69765097",
"0.69765097",
"0.69765097",
"0.69765097",
"0.69765097",
"0.6976... | 0.71532154 | 2 |
Retrieve the Type of the result for this Cursor. | def result_type(self):
if not hasattr(self, '_result_type'):
self._result_type = conf.lib.clang_getResultType(self.type)
return self._result_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result_type(self) -> Optional[str]:\n if hasattr(self, \"_result_type\"):\n return self._result_type\n _args: list[Arg] = []\n _ctx = self._select(\"resultType\", _args)\n return _ctx.execute_sync(Optional[str])",
"def get_type(self) -> str:\n return self.row_dic... | [
"0.8078356",
"0.7562815",
"0.7324258",
"0.72558236",
"0.72528577",
"0.7252847",
"0.7245781",
"0.7243352",
"0.7243352",
"0.7213263",
"0.7213263",
"0.72067064",
"0.72004765",
"0.71624434",
"0.7155078",
"0.71191704",
"0.71191704",
"0.71191704",
"0.71191704",
"0.71191704",
"0.711... | 0.75714606 | 1 |
Return the integer type of an enum declaration. Returns a Type corresponding to an integer. If the cursor is not for an enum, this raises. | def enum_type(self):
if not hasattr(self, '_enum_type'):
assert self.kind == CursorKind.ENUM_DECL
self._enum_type = conf.lib.clang_getEnumDeclIntegerType(self)
return self._enum_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type(self):\n if self.__type is None:\n found_type = find_definition(\n self.__type_name, self.message_definition())\n if not (found_type is not Enum and\n isinstance(found_type, type) and\n issubclass(found_type, Enum)):\n ... | [
"0.6668528",
"0.6556559",
"0.6346278",
"0.6315874",
"0.6040577",
"0.5952468",
"0.5787921",
"0.57735497",
"0.57700783",
"0.57422316",
"0.5733731",
"0.56884867",
"0.5685823",
"0.56746346",
"0.5640415",
"0.5623708",
"0.56144726",
"0.56100196",
"0.560141",
"0.55462855",
"0.554627... | 0.834504 | 0 |
Return the value of an enum constant. | def enum_value(self):
if not hasattr(self, '_enum_value'):
assert self.kind == CursorKind.ENUM_CONSTANT_DECL
# Figure out the underlying type of the enum to know if it
# is a signed or unsigned quantity.
underlying_type = self.type
if underlying_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_constant(name, libgmt):\n c_get_enum = libgmt.GMT_Get_Enum\n c_get_enum.argtypes = [ctypes.c_char_p]\n c_get_enum.restype = ctypes.c_int\n\n value = c_get_enum(name.encode())\n\n if value is None or value == -99999:\n raise GMTCLibError(\n \"Constant '{}' doesn't exits in l... | [
"0.6877435",
"0.67854774",
"0.6428005",
"0.63341635",
"0.63341635",
"0.63341635",
"0.61973345",
"0.6167562",
"0.6158918",
"0.6133673",
"0.60927504",
"0.60549426",
"0.60345817",
"0.5913396",
"0.5896884",
"0.5874184",
"0.5840397",
"0.58348507",
"0.5827577",
"0.58219963",
"0.581... | 0.7888394 | 0 |
Obtain Token instances formulating that compose this Cursor. This is a generator for Token instances. It returns all tokens which occupy the extent this cursor occupies. | def get_tokens(self):
return TokenGroup.get_tokens(self._tu, self.extent) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokens(self):\r\n return self.iter_tokens(self._blob)",
"def get_tokens(self):\n def _traverse_preorder(cursor, token_list): # There is a method called \"walk_preorder\" in Cursor class. Here we need to ignore some subtrees so we implement on our own.\n if cursor.location.file and curso... | [
"0.70742357",
"0.70366806",
"0.7018434",
"0.7010121",
"0.69175786",
"0.6865068",
"0.6841545",
"0.68311644",
"0.6761095",
"0.6734778",
"0.66665196",
"0.6582777",
"0.65827334",
"0.65827334",
"0.65827334",
"0.64513296",
"0.6439483",
"0.64223206",
"0.62753505",
"0.6236372",
"0.62... | 0.7108672 | 0 |
Get the enumeration name of this cursor kind. | def name(self):
if self._name_map is None:
self._name_map = {}
for key,value in TypeKind.__dict__.items():
if isinstance(value,TypeKind):
self._name_map[value] = key
return self._name_map[self] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\r\n if self._name_map is None:\r\n self._name_map = {}\r\n for key,value in CursorKind.__dict__.items():\r\n if isinstance(value,CursorKind):\r\n self._name_map[value] = key\r\n return self._name_map[self]",
"def get_kind_name(... | [
"0.7517167",
"0.6952754",
"0.6836199",
"0.6568886",
"0.64484495",
"0.640635",
"0.6387758",
"0.6341467",
"0.6328878",
"0.6328878",
"0.6302517",
"0.6283944",
"0.62196887",
"0.61947507",
"0.6184855",
"0.6183771",
"0.6183771",
"0.6183771",
"0.6183771",
"0.6183771",
"0.6183771",
... | 0.6470323 | 4 |
Retrieve the spelling of this TypeKind. | def spelling(self):
return conf.lib.clang_getTypeKindSpelling(self.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spelling(self):\r\n return conf.lib.clang_getTranslationUnitSpelling(self)",
"def name(self):\r\n if self._name_map is None:\r\n self._name_map = {}\r\n for key,value in TypeKind.__dict__.items():\r\n if isinstance(value,TypeKind):\r\n sel... | [
"0.7000876",
"0.6776368",
"0.6767621",
"0.6715922",
"0.6512624",
"0.64286685",
"0.6419308",
"0.6412794",
"0.6376492",
"0.63488835",
"0.629028",
"0.628916",
"0.6243327",
"0.620276",
"0.61757696",
"0.6120861",
"0.6120861",
"0.6113694",
"0.6103267",
"0.6083025",
"0.60745436",
... | 0.86546105 | 0 |
Return the kind of this type. | def kind(self):
return TypeKind.from_id(self._kind_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kind(self):\n return self._kind()",
"def get_kind(self):\n\n return self._kind",
"def kind(self):\n return self._kind",
"def kind(self):\n return self._kind",
"def GetKind(self):\r\n\r\n return self.kind",
"def kind(self):\n return self.get_data(\"kind\")",
... | [
"0.8805417",
"0.8671091",
"0.8664501",
"0.8664501",
"0.86448044",
"0.8431001",
"0.8381873",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0.82542956",
"0... | 0.8864351 | 0 |
Determine whether this Type represents plain old data (POD). | def is_pod(self):
return conf.lib.clang_isPODType(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_raw(self):\n return not self.has_structure",
"def is_struct(self):\n return False",
"def is_simple(self) -> bool:\n return self.data in ('int', 'bool', 'float', 'str')",
"def is_basic_type(self, objtype):\n if not hasattr(objtype, '_type_'):\n # could be python t... | [
"0.6809016",
"0.66576004",
"0.63237625",
"0.616281",
"0.60937804",
"0.6042739",
"0.59935755",
"0.59933263",
"0.59440213",
"0.59237224",
"0.5922243",
"0.5922243",
"0.59220815",
"0.59200174",
"0.5914625",
"0.5895693",
"0.5891164",
"0.5891063",
"0.58569914",
"0.5814967",
"0.5814... | 0.7335874 | 0 |
Create a TranslationUnit instance from a saved AST file. A previouslysaved AST file (provided with emitast or TranslationUnit.save()) is loaded from the filename specified. If the file cannot be loaded, a TranslationUnitLoadError will be raised. index is optional and is the Index instance to use. If not provided, a def... | def from_ast_file(cls, filename, index=None):
if index is None:
index = Index.create()
ptr = conf.lib.clang_createTranslationUnit(index, filename)
if ptr is None:
raise TranslationUnitLoadError(filename)
return cls(ptr=ptr, index=index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_source(cls, filename, args=None, unsaved_files=None, options=0,\r\n index=None):\r\n if args is None:\r\n args = []\r\n\r\n if unsaved_files is None:\r\n unsaved_files = []\r\n\r\n if index is None:\r\n index = Index.create()\r\n\r\n... | [
"0.7135722",
"0.67183644",
"0.6540111",
"0.60254574",
"0.5984081",
"0.5877664",
"0.5866693",
"0.5775847",
"0.5764207",
"0.5709046",
"0.56454676",
"0.564197",
"0.5627172",
"0.55952233",
"0.55898684",
"0.5581314",
"0.5537145",
"0.5516443",
"0.54568744",
"0.54483056",
"0.5433146... | 0.8995971 | 0 |
Get the original translation unit source file name. | def spelling(self):
return conf.lib.clang_getTranslationUnitSpelling(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\r\n return conf.lib.clang_getCString(conf.lib.clang_getFileName(self))",
"def get_name(self):\n\t\treturn self.source.get_name()",
"def get_original_file_name(cleanup_event):\n original_name = None\n if not cleanup_event:\n return\n try:\n original_name = cleanup_e... | [
"0.7178109",
"0.6968237",
"0.6927974",
"0.6799572",
"0.66629463",
"0.6661065",
"0.6631746",
"0.6588131",
"0.6546193",
"0.6486504",
"0.64688313",
"0.6446357",
"0.6440533",
"0.6433717",
"0.6399247",
"0.6357081",
"0.6357081",
"0.6357081",
"0.6357081",
"0.6357081",
"0.63352764",
... | 0.0 | -1 |
Obtain a SourceLocation for a file in this translation unit. | def get_location(self, filename, position):
f = self.get_file(filename)
if isinstance(position, int):
return SourceLocation.from_offset(self, f, position)
return SourceLocation.from_position(self, f, position[0], position[1]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_position(tu, file, line, column):\r\n return conf.lib.clang_getLocation(tu, file, line, column)",
"def from_offset(tu, file, offset):\r\n return conf.lib.clang_getLocationForOffset(tu, file, offset)",
"def file_location(self, file: str) -> str:\n return os.path.join(str(self.id), ... | [
"0.6847043",
"0.64851457",
"0.62081945",
"0.61951745",
"0.5898386",
"0.58658266",
"0.58355093",
"0.57988423",
"0.5777193",
"0.57614523",
"0.5748111",
"0.5734581",
"0.571492",
"0.5675142",
"0.5658473",
"0.56413215",
"0.56351453",
"0.5623252",
"0.5620258",
"0.55920285",
"0.5588... | 0.71237415 | 0 |
The SourceLocation this Token occurs at. | def location(self):
return conf.lib.clang_getTokenLocation(self._tu, self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def location(self):\r\n if not hasattr(self, '_loc'):\r\n self._loc = conf.lib.clang_getCursorLocation(self)\r\n\r\n return self._loc",
"def get_location(self) -> tuple:\n return self.__location",
"def get_location(self):\r\n return self.__location",
"def location(self)... | [
"0.7474823",
"0.7098137",
"0.69544077",
"0.69299287",
"0.69299287",
"0.688192",
"0.68398285",
"0.6815098",
"0.678722",
"0.67455536",
"0.67392105",
"0.6726999",
"0.66918975",
"0.66918975",
"0.66918975",
"0.66894287",
"0.66824937",
"0.66738325",
"0.66532385",
"0.6567933",
"0.65... | 0.7883145 | 0 |
Set the current goal that the agent needs to achieve in the environment | def set_goal(self, goal: GoalType) -> None:
self.goal = goal | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_goal(self, **kwargs):\n return self.env.set_goal(**kwargs)",
"def goal(self, goal):\n\n self._goal = goal",
"def set_goal(self, goal):\r\n self.goal = goal\r\n self.start_time = self.get_current_time()",
"def set_goal(self, goal):\n self._pid_lock.acquire() ... | [
"0.8073704",
"0.73742783",
"0.72853035",
"0.71791995",
"0.683782",
"0.6798636",
"0.6642405",
"0.651443",
"0.6456783",
"0.6353563",
"0.62709266",
"0.6205044",
"0.6075797",
"0.60703367",
"0.60542816",
"0.60179466",
"0.6002478",
"0.592347",
"0.5770437",
"0.57452714",
"0.5743431"... | 0.7037371 | 4 |
Return self.template_name if set. Otherwise, resolve the template path by model app_label and name. | def get_template_name(self):
if self.template_name is not None:
return self.template_name
model_opts = self.queryset.model._meta
return f"{model_opts.app_label}/{model_opts.model_name}.html" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_template(self):\n model = self.get_object()\n template_name = self.model_template_name or 'template'\n try:\n template_string = getattr(model, template_name)\n except AttributeError as e:\n raise ImproperlyConfigured(\n \"%(model)s is missing... | [
"0.71611077",
"0.7061638",
"0.6938421",
"0.66925704",
"0.6648103",
"0.6602701",
"0.6588683",
"0.6568682",
"0.6446615",
"0.6441177",
"0.642512",
"0.6387935",
"0.6360613",
"0.63458544",
"0.62905234",
"0.62689495",
"0.6263235",
"0.6257681",
"0.6152296",
"0.6081352",
"0.60554194"... | 0.7669378 | 0 |
Reads a plain text file line by line | def read_plaintext(textfilep, mapper=None):
with open(os.path.expanduser(textfilep), 'r') as textin:
if mapper is not None:
for line in textin:
yield mapper(line)
else:
for line in textin:
yield line | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_text_file(file_name):\n target_file = open(file_name)\n lines = target_file.readlines()\n\n target_file.close()\n return lines",
"def read_txt_by_lines(path):\n\n with open(path, \"r\") as f:\n buffer = f.read().splitlines()\n f.close()\n return buffer",
"def read_txt(p... | [
"0.7221692",
"0.718376",
"0.7044758",
"0.7044758",
"0.70015895",
"0.69851875",
"0.6940246",
"0.6921058",
"0.68300956",
"0.68039554",
"0.68039554",
"0.67749524",
"0.6737522",
"0.6733063",
"0.67276615",
"0.6702963",
"0.6691704",
"0.66834134",
"0.66781735",
"0.6677143",
"0.66246... | 0.0 | -1 |
Cleanup PTF server, including delete test cases and root test folder. | def _cleanup_ptf(ptfhost):
_delete_sai_test_cases(ptfhost)
_delete_sai_test_folder(ptfhost) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDown(self):\n if os.path.isdir(SERVER_DIR):\n shutil.rmtree(SERVER_DIR)",
"def tearDown(self):\n if os.path.isdir(SERVER_DIR):\n shutil.rmtree(SERVER_DIR)",
"def teardown_package():\n # TODO If environment variable is set keep the workspace\n # and print out th... | [
"0.7709915",
"0.7709915",
"0.7578644",
"0.7410671",
"0.74088687",
"0.7368031",
"0.7368012",
"0.7337715",
"0.7267924",
"0.7251823",
"0.7220985",
"0.71946526",
"0.719021",
"0.7184331",
"0.7148105",
"0.7147391",
"0.713078",
"0.70856106",
"0.70847803",
"0.70847803",
"0.70578027",... | 0.81201303 | 0 |
Prepare SAI test env including create root test folder and copy cases. | def _prepare_test_cases(ptfhost, request):
logger.info("Preparing SAI test environment.")
_create_sai_test_folders(ptfhost)
_copy_sai_test_cases(ptfhost, request) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_test(self):\n\n VorpatestLibrary._test_index += 1\n self._status = -1\n self._preserve_files = []\n\n test_variables = _get_test_variables()\n\n test_name = test_variables['${TEST NAME}']\n logger.info(\"Setup test %s\" % test_name)\n\n test_name = test_... | [
"0.7469071",
"0.73028517",
"0.7237037",
"0.7081117",
"0.70688003",
"0.70015097",
"0.6990957",
"0.69040465",
"0.6878071",
"0.6836587",
"0.67487043",
"0.671235",
"0.6702409",
"0.66680336",
"0.6649729",
"0.663223",
"0.6627897",
"0.6575918",
"0.6568277",
"0.6568277",
"0.6568277",... | 0.8458113 | 0 |
Compute the pairwise distances matrix. Given input embedding vectors, this utility computes the (squared) pairwise distances matrix. | def compute_pairwise_distances(input_vecs: types.Tensor) -> types.Tensor:
r = tf.reduce_sum(input_vecs * input_vecs, axis=1, keepdims=True)
pdistance_matrix = (
r
- 2 * tf.matmul(input_vecs, input_vecs, transpose_b=True)
+ tf.transpose(r)
)
return tf.cast(pdistance_matrix, dtype=tf.float32) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pairwise_distance(self, src_embeds, vocab_embeds, squared=False):\n # compute square norm to avoid compute all the directions\n vocab_sq_norm = vocab_embeds.norm(p=2, dim=-1) ** 2\n src_sq_norm = src_embeds.norm(p=2, dim=-1) ** 2\n\n # dot product\n dot_product = self._pairw... | [
"0.76852447",
"0.7613163",
"0.75362676",
"0.74399203",
"0.70909184",
"0.6681631",
"0.6608723",
"0.6606141",
"0.6453361",
"0.63931906",
"0.6250037",
"0.6238846",
"0.62133175",
"0.6211315",
"0.62037796",
"0.61723065",
"0.6095981",
"0.605958",
"0.6056382",
"0.5985497",
"0.598172... | 0.73271704 | 4 |
A function to create a logger. | def create_logger(logging, tool_name, level):
logger = logging.getLogger(tool_name)
# Create handlers
handler = logging.StreamHandler()
handler.setLevel(level)
# Create formatters and add it to handlers
logformat = logging.Formatter(
'[%(name)s - %(asctime)s] %(levelname)s: %(message)s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_logger() -> logging.Logger:\n pass # TODO: Replace with implementation!",
"def create_logger():\r\n global logger\r\n logger = logging.getLogger(logger_name)\r\n\r\n formatter = logging.Formatter(fmt='%(asctime)s %(levelname)s %(message)s')\r\n \r\n handler = logging.StreamHandler()... | [
"0.8594537",
"0.8298179",
"0.78457147",
"0.78177017",
"0.77317595",
"0.7699181",
"0.7696191",
"0.7682176",
"0.7678915",
"0.7560471",
"0.75225383",
"0.7410358",
"0.7407225",
"0.74024403",
"0.734758",
"0.7334353",
"0.73106",
"0.7309574",
"0.72945255",
"0.7286092",
"0.72805953",... | 0.7303894 | 18 |
Returns the minimax action using self.depth and self.evaluationFunction | def getAction(self, gameState):
"*** YOUR CODE HERE ***"
return self.alpha_beta(gameState, 0, self.depth, (-10e8, None), (10e8, None))[1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAction(self, gameState: GameState):\n _max = float(\"-inf\")\n action = None\n for move in gameState.getLegalActions(0):\n util = minimax(self.evaluationFunction, 1, 0,\n gameState.generateSuccessor(0, move), self.depth)\n if util > _max o... | [
"0.7482665",
"0.7383559",
"0.71806973",
"0.7110041",
"0.70884514",
"0.70694935",
"0.70683014",
"0.7048308",
"0.70055133",
"0.69651455",
"0.69642085",
"0.69604385",
"0.6945924",
"0.68998593",
"0.6895832",
"0.688605",
"0.6826282",
"0.6767276",
"0.6758028",
"0.6751636",
"0.67054... | 0.0 | -1 |
Checks if a table exists with the given name. | def table_exists(table_name):
cnx = create_connection()
cursor = cnx.cursor()
try:
cursor.execute("SHOW TABLES LIKE '" + table_name + "'")
except:
cnx.close()
cursor.close()
print("Show Tables query didn't execute.")
return
rows = cursor.fetchall()
cnx.close()
cursor.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def does_table_exists(self, table_name: str) -> bool:\n\n return sqlalchemy.inspect(PyFunceble.sessions.DB_ENGINE).has_table(table_name)",
"def CheckTblNameExist(tblname):\n if not engine.dialect.has_table(engine, tblname):\n return False\n else:\n return True",
"def table_exists(sel... | [
"0.85193187",
"0.84410435",
"0.84112984",
"0.8382124",
"0.8313438",
"0.8308835",
"0.82274175",
"0.82096237",
"0.817949",
"0.81168747",
"0.8109942",
"0.8086627",
"0.8073405",
"0.804916",
"0.801264",
"0.7918885",
"0.787237",
"0.78723496",
"0.7869844",
"0.7845956",
"0.7807311",
... | 0.79917246 | 15 |
Constructor method; creates a BDLToPandas object based on the passed bdl_data value. | def __init__(self):
BDLQuery.__init__(self)
self.pandas_df = [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, pudl_engine, freq=None, start_date=None, end_date=None,\n rolling=False):\n self.pudl_engine = pudl_engine\n self.freq = freq\n\n if start_date is None:\n self.start_date = \\\n pd.to_datetime(\n '{}-01-01'.format(... | [
"0.59134245",
"0.5831505",
"0.5776117",
"0.5725441",
"0.5705764",
"0.5534953",
"0.55232364",
"0.5518365",
"0.5493648",
"0.5461806",
"0.54614383",
"0.54326206",
"0.5375795",
"0.5363052",
"0.5325064",
"0.5276987",
"0.5253269",
"0.51962966",
"0.5195874",
"0.5194251",
"0.51741",
... | 0.6237992 | 0 |
Converts the `min` column from minutes/seconds to minutes and decimals of minutes. | def __convert_min(self):
self.pandas_df["min"] = self.pandas_df["min"].str.replace(':','.').astype(float) # Converts column to float; column previously held strings
self.pandas_df["min"] = self.pandas_df["min"].astype(int) + (((self.pandas_df.loc[:, "min"] - self.pandas_df.loc[:, "min"].astype(int)) ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sec_to_min_pretty(time_secs: int) -> str:\n if time_secs % 60 == 0:\n return f'{time_secs // 60}'\n m = time_secs / 60\n return f'{m:.2g}'",
"def multMinuteAlign(ts, min):\n\tintv = secInMinute * min\n\treturn int((ts / intv)) * intv",
"def int_convert_to_minute(value):\n min = int(int(v... | [
"0.668429",
"0.6512969",
"0.6488133",
"0.64852476",
"0.6413825",
"0.63802475",
"0.6319943",
"0.63076246",
"0.6208787",
"0.61900145",
"0.6094321",
"0.6065351",
"0.60561085",
"0.6039695",
"0.603219",
"0.599995",
"0.5990582",
"0.5958932",
"0.5958284",
"0.59345317",
"0.5849321",
... | 0.7709544 | 0 |
Plot motion quiver on top of an image. | def plot_motion_field_overlay(I, V, minval, maxval, stride=10,
colorbar_label=None, plot_title=None):
if len(V.shape) != 3:
raise ValueError("V must be a three-dimensional array")
if I.shape != V.shape[0:2]:
raise ValueError("I and V must have the same shape")
fig = figur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quick_quiver():\n plt.quiver(x,y,u,v,sig2noise_ratio, scale=50,color='b')\n plt.gca().invert_yaxis()\n plt.gca().set_aspect(1)\n plt.plot(x.flat[xymask],y.flat[xymask],'rx')\n plt.colorbar(orientation='horizontal')",
"def ion():\n plt.ion()",
"def superimpose_field(u, v, img):\n \n ... | [
"0.69074863",
"0.6185567",
"0.6162103",
"0.6126877",
"0.60671085",
"0.60385",
"0.60096127",
"0.5985237",
"0.5971989",
"0.593883",
"0.58368593",
"0.5834218",
"0.58250654",
"0.5824373",
"0.5816438",
"0.5792457",
"0.57871026",
"0.57871026",
"0.57871026",
"0.5759019",
"0.574998",... | 0.0 | -1 |
Short function to build a batch normalization layer with less syntax | def norm_layer( x, training, name):
top = tf.layers.batch_normalization( x,
axis=3, # channels last
training=training,
name=name )
return top | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def BatchNormalization(inputs, data_format):\n return tf.layers.BatchNormalization(axis=1 if data_format == 'channels_first' else 3,\n momentum=_BATCH_NORM_DECAY,\n epsilon=_BATCH_NORM_EPSILON,\n scale=T... | [
"0.7129626",
"0.7101603",
"0.7091098",
"0.7001034",
"0.6996596",
"0.69212055",
"0.69170916",
"0.6882678",
"0.68783796",
"0.68710005",
"0.6868827",
"0.6831503",
"0.67668843",
"0.6699075",
"0.66879886",
"0.66404885",
"0.6617548",
"0.659394",
"0.65638477",
"0.6542637",
"0.653838... | 0.7173043 | 0 |
Creates a string of specified length, either by adding whitespace to the right, or concatenating | def rightpad(field, length):
field = str(field)
field_length = len(field)
if field_length>length:
field = field[:length]
if field_length<length:
while len(field)<length:
field+=' '
return field.upper() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def r_pad(arg, length):\n if length <= len(arg):\n return arg\n else:\n return arg + \" \" * (length - len(arg))",
"def get_fixed_length_string(string: str, length=20) -> str:\n if len(string) > length:\n return f\"{string[: length - 3]}...\"\n spacing = \"\".join(\" \" for _ in ... | [
"0.7970846",
"0.7273823",
"0.7216539",
"0.7151123",
"0.70272475",
"0.70058894",
"0.6891849",
"0.6890155",
"0.6764301",
"0.6732633",
"0.67102164",
"0.6693542",
"0.66901344",
"0.66811126",
"0.66744465",
"0.6603903",
"0.659562",
"0.6562817",
"0.6554759",
"0.6554683",
"0.65364474... | 0.70130754 | 5 |
Reads a single byte from I2C Bus | def read(self, reg):
return self.bus.read_byte_data(self.address, reg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_byte(fd, reg):\n b, = write_read_i2c(fd, bytes([reg]), 1)\n return b",
"def Read_Byte(self):\r\n data = self.Port.read(1)\r\n return data",
"def _i2c_read(self, register, bank=None):\n if bank is not None:\n self.set_bank(bank)\n return self.i2c.read_byte_d... | [
"0.80617946",
"0.7530884",
"0.7428474",
"0.73639494",
"0.7319571",
"0.70990145",
"0.7015081",
"0.6988176",
"0.6821304",
"0.68055683",
"0.67879254",
"0.67338437",
"0.67205846",
"0.67188895",
"0.6649439",
"0.6608932",
"0.6597721",
"0.6597721",
"0.6555857",
"0.6555857",
"0.65221... | 0.65364146 | 20 |
dict > int Just a sanity check to find the number of nodes on a undirected graph. | def check_number_edges(ugraph):
directed_edges = 0
for node in ugraph:
directed_edges += len(ugraph[node])
if directed_edges % 2 == 0:
return directed_edges / 2
else:
return "Not Undirected" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_num_nodes(graph):\n return len(graph.keys()) # return the number of nodes in the graph",
"def num_nodes(g):\n return len(g.keys())",
"def node_count(self) -> int:\n return int(self.graph_tuple_stats.node_count or 0)",
"def num_of_node(self):\n \n try:\n retu... | [
"0.768968",
"0.76730096",
"0.736214",
"0.7186066",
"0.7120402",
"0.70767295",
"0.6930425",
"0.69196856",
"0.68751156",
"0.6852514",
"0.6844907",
"0.6841625",
"0.6822395",
"0.682207",
"0.6805743",
"0.6785262",
"0.6777823",
"0.67750794",
"0.67616606",
"0.6755209",
"0.67515177",... | 0.6248431 | 73 |
Check for file name, size limits and whether they are readable | def clean_file_field(self):
files = self.files.getlist('file_field')
for file in files:
validators.validate_filename(file.name)
# Special error
if not file:
raise forms.ValidationError('Could not read file: %(file_name)s',
params=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_file_size(self, file_name:str)->bool:\n try:\n size = os.path.getsize(file_name)\n except Exception as e:\n print(\"Failed to get file file size for %s - %s\" % (file_name, e))\n return -1\n\n if size >= self.file_size: \n return True\n return False",
... | [
"0.6694444",
"0.6494879",
"0.6359874",
"0.63116676",
"0.62775886",
"0.627256",
"0.6157853",
"0.61169684",
"0.60863405",
"0.60738975",
"0.60631853",
"0.60620165",
"0.59731174",
"0.5969702",
"0.5946082",
"0.5925457",
"0.5870645",
"0.58688116",
"0.58512044",
"0.58486426",
"0.577... | 0.587739 | 16 |
Set the license queryset according to the set or selected access policy. | def set_license_queryset(self, access_policy):
self.fields['license'].queryset = License.objects.filter(
resource_types__icontains=str(self.instance.resource_type.id),
access_policy=access_policy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, editable=True, **kwargs):\n super().__init__(**kwargs)\n\n # Get licenses for this resource type\n licenses = License.objects.filter(\n resource_types__icontains=str(self.instance.resource_type.id))\n # Set allowed access policies based on license policies\... | [
"0.6292814",
"0.5715369",
"0.55870116",
"0.5525325",
"0.5466198",
"0.5367235",
"0.53351736",
"0.53175277",
"0.5315126",
"0.5315126",
"0.5202911",
"0.52006674",
"0.5145886",
"0.50934076",
"0.5076889",
"0.5073441",
"0.50716424",
"0.5014374",
"0.4999472",
"0.4977471",
"0.4958207... | 0.8609018 | 0 |
Invitation must be active, user must be invited | def clean(self):
cleaned_data = super().clean()
if not self.instance.is_active:
raise forms.ValidationError('Invalid invitation.')
if self.instance.email not in self.user.get_emails():
raise forms.ValidationError(
'You are not invited.')
retur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_user_invitation(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"send_user_invitation\")",
"def send_user_invitation(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"send_user_invitation\")",
"def invite(self):\n pass",
"def send_user_invitati... | [
"0.70818466",
"0.70818466",
"0.69969034",
"0.69837475",
"0.6752548",
"0.6684189",
"0.65947866",
"0.65220106",
"0.64866036",
"0.64336324",
"0.63623214",
"0.6356424",
"0.63498276",
"0.63496995",
"0.6347151",
"0.6326091",
"0.63260293",
"0.62712115",
"0.6268641",
"0.62617564",
"0... | 0.6688163 | 5 |
return a string to represent this RobustWemoControl object | def __str__(self):
s = '%s named "%s" (retry = %ds)' % (self.__class__.__name__, self.name, self.retry)
if self.state:
s += ' has %s' % self.state
else:
s += ' has not been discovered yet'
return s | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n struct_repr = \", \".join([\n \"group: \" + str(self.group),\n \"controls: \" + str(self.controls)\n ])\n\n return f\"ActuatorControlTarget: [{struct_repr}]\"",
"def __str__(self):\n return f'''\n {super().__str__()}\n ... | [
"0.7142754",
"0.6953869",
"0.68628013",
"0.68612415",
"0.68612415",
"0.6847384",
"0.6847384",
"0.6847384",
"0.6847384",
"0.68463326",
"0.68463326",
"0.68463326",
"0.68463326",
"0.68463326",
"0.68463326",
"0.68463326",
"0.68463326",
"0.68463326",
"0.68463326",
"0.68463326",
"0... | 0.0 | -1 |
Returns a function that maps each index in 0, 1, ..., n1 to a distinct RGB color; the keyword argument name must be a standard mpl colormap name. | def get_cmap(n, name="hsv"):
return plt.cm.get_cmap(name, n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cmap(n, name='jet'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name='hsv'):\n return plt.cm.get_cmap(name, n)",
"def get_cmap(n, name='Paired'):\n return plt.cm.get_cmap(name, n)",
"def palette_from_mpl_name(na... | [
"0.70270115",
"0.6977335",
"0.6977335",
"0.6946025",
"0.67233455",
"0.6578183",
"0.6510557",
"0.6427171",
"0.63589215",
"0.6329049",
"0.6286419",
"0.6181896",
"0.61389565",
"0.61124665",
"0.60927886",
"0.60417897",
"0.6018993",
"0.5989977",
"0.5959873",
"0.5958555",
"0.588903... | 0.6929189 | 5 |
Test that the census_area_to_observation API endpoint will raise an error if it's missing the required keyword arguments. | def test_census_area_to_observation_no_kwargs(client):
response = client.get(reverse('acs'))
assert response.status_code == 400
assert response.json().get('error') is not None
assert 'required query parameters' in response.json()['error'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_census_area_to_observation_no_census_area(client):\n response = client.get(\n reverse('acs'),\n {'census_area': '10000', 'primary_source': 'bar'}\n )\n assert response.status_code == 400\n assert response.json().get('error') is not None\n assert 'No CensusArea object' in respo... | [
"0.76882076",
"0.7227478",
"0.70550704",
"0.64740604",
"0.6260564",
"0.62261754",
"0.5891789",
"0.57930166",
"0.5700037",
"0.5650203",
"0.56330025",
"0.5601142",
"0.55904615",
"0.55292386",
"0.55245364",
"0.5512393",
"0.55047697",
"0.54997784",
"0.54839",
"0.545214",
"0.54378... | 0.8616821 | 0 |
Test that the census_area_to_observation API endpoint will raise an error if no SurveyComponent matches the given value for primary_source. | def test_census_area_to_observation_no_survey_component(client, census_area):
response = client.get(
reverse('acs'),
{'census_area': census_area.id, 'primary_source': 'bar'}
)
assert response.status_code == 400
assert response.json().get('error') is not None
assert 'No SurveyComponen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_census_area_to_observation_no_acs_variable(client, census_area, survey_component):\n response = client.get(\n reverse('acs'),\n {'census_area': census_area.id, 'primary_source': survey_component.name}\n )\n assert response.status_code == 400\n assert response.json().get('error') ... | [
"0.7502378",
"0.7317383",
"0.6705738",
"0.64691615",
"0.5503064",
"0.52981013",
"0.5281305",
"0.52505475",
"0.5244518",
"0.5233845",
"0.52287",
"0.5125688",
"0.51229334",
"0.5108435",
"0.51010627",
"0.50934577",
"0.50826454",
"0.5048",
"0.50320905",
"0.5016764",
"0.4960427",
... | 0.7872837 | 0 |
Returns True for primes, False for nonprimes and raises ValueError for unsure cases. | def is_miller_rabin_prime(n):
if n <= 1:
return False
elif n == 2:
return True
elif n % 2 == 0:
return False
witnesses = get_witnesses(n)
if witnesses is None:
msg = 'No definite Miller-Rabin test is available for %d' % n
raise ValueError(msg)
d,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_prime(self, num):\n if num == 2:\n return True\n if num < 2 or num % 2 == 0:\n return False\n for n in range(3, int(num ** 0.5) + 2, 2):\n if num % n == 0:\n return False\n return True",
"def is_prime(num: int) -> bool:\n retu... | [
"0.76142275",
"0.74802965",
"0.7415529",
"0.7399411",
"0.73923016",
"0.73830795",
"0.73809665",
"0.7376884",
"0.737067",
"0.73683363",
"0.73669016",
"0.7362903",
"0.73542917",
"0.73462844",
"0.73424715",
"0.7340357",
"0.73369205",
"0.73184973",
"0.73036975",
"0.7298675",
"0.7... | 0.0 | -1 |
Tests if mut_replace_terminal raises an exception if no valid mutation is possible. | def test_mut_replace_terminal_none_available(self):
ind = self.individuals[self.ind_strings[0]]
ind_clone = self.gama._toolbox.clone(ind)
with self.assertRaises(ValueError) as error:
mut_replace_terminal(ind_clone, self.gama._pset)
self.assertTrue("Individual could not be m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_mut_replace_terminal(self):\n ind1 = self.individuals[self.ind_strings[1]]\n self._test_mutation(ind1, mut_replace_terminal, self._mut_replace_terminal_is_applied)",
"def test_random_valid_mutation_without_terminal(self):\n # The tested individual contains no terminals and one primi... | [
"0.7506788",
"0.6660839",
"0.6444186",
"0.5763094",
"0.57083815",
"0.56965375",
"0.5392572",
"0.53382933",
"0.52986753",
"0.5185884",
"0.5173018",
"0.5129428",
"0.5126142",
"0.5103757",
"0.509309",
"0.50922424",
"0.5044614",
"0.5044458",
"0.49753955",
"0.49649343",
"0.4958031... | 0.7529728 | 0 |
Checks if mutation was caused by `deap.gp.mutInsert`. | def _mutInsert_is_applied(self, original, mutated):
primitives_original = [el for el in original if isinstance(el, gp.Primitive)]
primitives_mutated = [el for el in mutated if isinstance(el, gp.Primitive)]
if len(primitives_original) >= len(primitives_mutated):
return (False, "Number... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _can_insert(self, index, value):\n return not bool(self._insert_callback(index, value))",
"def is_insert(self) -> bool:\n return self.statement.is_dml and self.statement.is_insert",
"def has_insert(self, shape):\n for insert in self.inserts:\n if insert.shape == shape:\n ... | [
"0.6702704",
"0.6424923",
"0.6306667",
"0.62216896",
"0.61911243",
"0.6085243",
"0.60064816",
"0.5976177",
"0.5894078",
"0.5869688",
"0.57659245",
"0.56692725",
"0.56637037",
"0.5555225",
"0.55511403",
"0.553932",
"0.5523064",
"0.55163795",
"0.5502787",
"0.5471894",
"0.541966... | 0.5994648 | 7 |
A generator to divide a sequence into chunks of n units. | def split_by_n(seq, n):
while seq:
yield seq[:n]
seq = seq[n:] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chunks(l, n):\n\tfor i in range(0, len(l), n):\n\t\tyield l[i:i + n]",
"def _chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]",
"def chunks(seq: Sequence[T], n: int) -> Iterator[Sequence[T]]:\n for i in range(0, len(seq), n):\n yield seq[i:i + n]",
"de... | [
"0.8228046",
"0.8158689",
"0.81524664",
"0.81280315",
"0.8093729",
"0.8079474",
"0.8073035",
"0.8020304",
"0.80031013",
"0.79684955",
"0.79610103",
"0.79569995",
"0.79483324",
"0.7947087",
"0.7937754",
"0.7937198",
"0.7937198",
"0.7937198",
"0.7937198",
"0.7937198",
"0.793290... | 0.8043498 | 7 |
r""" Given a Normal distribution for the latent function, return the mean of Y if q(f) = N(Fmu, Fvar) and this object represents p(y|f) then this method computes the predictive mean \int\int y p(y|f)q(f) df dy and the predictive variance \int\int y^2 p(y|f)q(f) df dy [ \int\int y^2 p(y|f)q(f) df dy ]^2 Here, we impleme... | def predict_mean_and_var(self, Fmu, Fvar):
def integrand(*X):
return self.conditional_variance(*X) + self.conditional_mean(*X)**2
integrands = [self.conditional_mean, integrand]
nghp = self.num_gauss_hermite_points
E_y, E_y2 = ndiagquad(integrands, nghp, Fmu, Fvar)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict_mean_and_var(self, Fmu, Fvar):\n gh_x, gh_w = hermgauss(self.num_gauss_hermite_points)\n gh_w /= np.sqrt(np.pi)\n gh_w = gh_w.reshape(-1, 1)\n shape = tf.shape(Fmu)\n Fmu, Fvar = [tf.reshape(e, (-1, 1)) for e in (Fmu, Fvar)]\n X = gh_x[None, :] * tf.sqrt(2.0 * ... | [
"0.663573",
"0.6460364",
"0.6429855",
"0.6404866",
"0.62841773",
"0.6234333",
"0.6140915",
"0.602175",
"0.5968484",
"0.5883561",
"0.5763818",
"0.5759419",
"0.5677004",
"0.56543744",
"0.56238586",
"0.5618409",
"0.56159556",
"0.5589227",
"0.5565066",
"0.5555828",
"0.55404377",
... | 0.6765706 | 0 |
Convert time in seconds to time in hours, minutes and seconds. | def format_time(s):
s = int(s)
m, s = divmod(s, 60)
h, m = divmod(m, 60)
return f'{h:02d}h{m:02d}m{s:02d}s' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_seconds(hours, minutes, seconds):\n return hours*60**2 + minutes*60 + seconds",
"def to_seconds(hours, minutes, seconds):\n return hours*3600+minutes*60+seconds",
"def convert_time(t):\n minutes = int(t/60)\n seconds = int(t-60*minutes)\n return minutes, seconds",
"def to_seconds(hours,... | [
"0.80692863",
"0.80254215",
"0.799807",
"0.79945284",
"0.78130025",
"0.7704133",
"0.7704133",
"0.7698898",
"0.7696824",
"0.74990517",
"0.7410873",
"0.73650587",
"0.7349785",
"0.73492056",
"0.7289429",
"0.7117542",
"0.71097934",
"0.7022713",
"0.7018364",
"0.701456",
"0.7012328... | 0.0 | -1 |
This function checking allowed file extensions | def allowed_file(filename):
return '.' in filename and \
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_11_is_allowed_file_correct_ext(self):\n\n for ext in list(ALLOWED_EXTENSIONS):\n filename = f\"somename.{ext}\"\n is_allowed = utils.is_allowed_file(filename)\n self.assertTrue(is_allowed)",
"def file_allowed(self):\n if self._allowed_ext:\n if s... | [
"0.8545738",
"0.83287936",
"0.83192676",
"0.8236479",
"0.8138803",
"0.811488",
"0.811488",
"0.8112973",
"0.8111941",
"0.8084105",
"0.8084105",
"0.8084105",
"0.8084105",
"0.8084105",
"0.8084105",
"0.8079472",
"0.80490905",
"0.80490905",
"0.80483234",
"0.80283713",
"0.80039155"... | 0.80681026 | 24 |
Adds new tuple of (state, action, reward, next_state) sample to replay buffer If buffer is full (i.e. more than self. capacity) add new samples to beginning of replay buffer | def push(self, state, action, reward, next_state):
to_add = [state, action, reward, next_state]
if len(self.buffer) < self.capacity:
self.buffer.append(None)
self.buffer[self.position] = self.transition(*to_add)
self.position = int((self.position + 1) % self.capacity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add(self, sample):#obs_t, action, reward, obs_tp1, done):\n\n if self._next_idx >= len(self._buffer): #appends data if max capacity not reached yet\n self._buffer.append(sample)\n else:\n self._buffer[self._next_idx] = sample #drops old entry and appends new data if max cap... | [
"0.77560866",
"0.76785696",
"0.72983265",
"0.684511",
"0.68351316",
"0.6824877",
"0.6721372",
"0.6699466",
"0.66743344",
"0.6667704",
"0.66306",
"0.6615876",
"0.65554106",
"0.65277845",
"0.6514543",
"0.64194286",
"0.6419416",
"0.640763",
"0.6375637",
"0.6332847",
"0.6304025",... | 0.6817292 | 6 |
Get a Server object to perform OpenID authentication. | def getServer(request):
return Server(getOpenIDStore(), getViewURL(request, endpoint)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_server(self):\n server_class = self.get_server_class()\n validator_class = self.get_validator_class()\n return server_class(validator_class(), token_expires_in=oauth_api_settings.ACCESS_TOKEN_EXPIRATION)",
"def server(self):\n expires_in = self.app.config.get('OAUTH2_PROVIDER_... | [
"0.71160233",
"0.646662",
"0.6294737",
"0.6046784",
"0.58545995",
"0.5845522",
"0.5821783",
"0.5799322",
"0.57881004",
"0.5558022",
"0.55277944",
"0.54716",
"0.5450539",
"0.54219204",
"0.54199255",
"0.53839576",
"0.5380627",
"0.53803277",
"0.53803277",
"0.5353777",
"0.5330513... | 0.7269823 | 0 |
Get an openid request from the session, if any. | def getRequest(request):
return request.session.get('openid_request') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _request(self, *arg, **kwarg):\n return self.request_session.request(*arg, **kwarg)",
"def request_session(self):\n if not hasattr(self, \"_request_session\"):\n rqsid = self.shared_vars.pop(\"rqsid\", \"\")\n rqses = self.request_session_manager.pop_request_session(rqsid)... | [
"0.6442676",
"0.63404447",
"0.63169587",
"0.6301979",
"0.62605435",
"0.62605435",
"0.621756",
"0.60975814",
"0.6068422",
"0.6052874",
"0.6043776",
"0.6005419",
"0.59721625",
"0.5971672",
"0.59678847",
"0.5967356",
"0.5950531",
"0.59373575",
"0.58636814",
"0.5839714",
"0.58035... | 0.7254437 | 0 |
Split dataframe in half by drifters. | def train_test_split_drifters():
df = process_raw_df()
ids = np.unique(df.index.get_level_values(level=0))
rng = np.random.default_rng(seed=1)
train_ids = np.sort(rng.choice(ids, size=len(ids)//2, replace=False))
test_ids = np.sort(np.setdiff1d(ids, train_ids))
train_df = df[df.index.get_level_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_half(slice):\n slice = set_date(slice)\n slice['Date'] = pd.to_datetime(slice['Date'])\n col_names = ['Date', 'Label', 'Text Extract', 'Processed']\n slice = slice[col_names]\n max_date = slice['Date'].max()\n min_date = slice['Date'].min()\n split_day = min_date + (max_date-min_date... | [
"0.7023574",
"0.6993554",
"0.6990156",
"0.6822474",
"0.6762066",
"0.6669045",
"0.66426045",
"0.66318053",
"0.6470719",
"0.6401817",
"0.6371597",
"0.6366472",
"0.6351574",
"0.6311583",
"0.6243279",
"0.62074",
"0.616344",
"0.6156157",
"0.6143206",
"0.61354506",
"0.6113867",
"... | 0.67686856 | 4 |
Generate rolling windows of data. | def windows(X, width, skip_last):
ret = []
n = X.shape[0]
for i in range(n - width + 1 - skip_last):
window = X[i:i + width, :]
ret.append([tuple(x) for x in window[:]])
return np.array(ret) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rolling_windows(a, window):\n\n if window > a.shape[0]:\n raise ValueError(\n \"Specified `window` length of {0} exceeds length of\"\n \" `a`, {1}.\".format(window, a.shape[0])\n )\n if isinstance(a, (pd.Series, pd.DataFrame)):\n a = a.values\n if a.ndim == ... | [
"0.71918565",
"0.70031863",
"0.6970743",
"0.6831108",
"0.6812186",
"0.6783765",
"0.67305446",
"0.6666456",
"0.65978324",
"0.64609146",
"0.6452989",
"0.6430759",
"0.63927996",
"0.63502514",
"0.63501185",
"0.6286638",
"0.6257188",
"0.6212885",
"0.62062985",
"0.6178038",
"0.6152... | 0.6158828 | 20 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.