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 |
|---|---|---|---|---|---|---|
``RegistrationProfile.send_activation_email`` sends an email. | def test_activation_email_uses_registration_default_from_email(self):
new_user = UserModel().objects.create_user(**self.user_info)
profile = self.registration_profile.objects.create_profile(new_user)
profile.send_activation_email(Site.objects.get_current())
self.assertEqual(mail.outbox[0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_activation_email(self):\n ctx_dict = {\n 'activation_key': self.activation_key,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,\n 'user': self.user,\n 'SITE_URL': settings.SITE_URL,\n ... | [
"0.7949695",
"0.79065245",
"0.74792427",
"0.73209125",
"0.7295338",
"0.71521664",
"0.71488476",
"0.7118745",
"0.6992142",
"0.6942355",
"0.66829264",
"0.6604554",
"0.65535015",
"0.65181637",
"0.65029484",
"0.64943045",
"0.6489618",
"0.6449097",
"0.6443088",
"0.64343107",
"0.63... | 0.6844352 | 10 |
``RegistrationProfile.send_activation_email`` sends an email. | def test_activation_email_falls_back_to_django_default_from_email(self):
new_user = UserModel().objects.create_user(**self.user_info)
profile = self.registration_profile.objects.create_profile(new_user)
profile.send_activation_email(Site.objects.get_current())
self.assertEqual(mail.outbo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_activation_email(self):\n ctx_dict = {\n 'activation_key': self.activation_key,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,\n 'user': self.user,\n 'SITE_URL': settings.SITE_URL,\n ... | [
"0.7949695",
"0.79065245",
"0.74792427",
"0.73209125",
"0.7295338",
"0.71521664",
"0.71488476",
"0.7118745",
"0.6992142",
"0.6942355",
"0.6844352",
"0.66829264",
"0.6604554",
"0.65535015",
"0.65181637",
"0.65029484",
"0.64943045",
"0.6489618",
"0.6449097",
"0.6443088",
"0.643... | 0.6296309 | 27 |
``RegistrationProfile.send_activation_email`` sends an email with the ``from`` address configured by the site. | def test_activation_email_uses_site_address(self):
new_user = UserModel().objects.create_user(**self.user_info)
profile = self.registration_profile.objects.create_profile(new_user)
site = Site.objects.get_current()
profile.send_activation_email(site)
from_email = 'admin@{}'.forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_activation_email(self):\n ctx_dict = {\n 'activation_key': self.activation_key,\n 'expiration_days': settings.ACCOUNT_ACTIVATION_DAYS,\n 'user': self.user,\n 'SITE_URL': settings.SITE_URL,\n ... | [
"0.76894623",
"0.7427498",
"0.736338",
"0.73333824",
"0.727794",
"0.71633375",
"0.7155248",
"0.6977253",
"0.6938941",
"0.6697889",
"0.66020495",
"0.659564",
"0.6589177",
"0.6512339",
"0.6472171",
"0.6423645",
"0.63828295",
"0.63771296",
"0.63559425",
"0.6335049",
"0.63266003"... | 0.7354725 | 3 |
``RegistrationProfile.send_activation_email`` won't send an email if improperly configured. | def test_activation_email_uses_site_address_improperly_configured(self):
new_user = UserModel().objects.create_user(**self.user_info)
profile = self.registration_profile.objects.create_profile(new_user)
with self.assertRaises(ImproperlyConfigured):
profile.send_activation_email(Site.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_confirmation_email(self, registration_profile,\n text_template=None, html_template=None,\n subject=None, email_data=None, **kwargs):\n user_id = registration_profile.user.id\n key = registration_profile.activation_key\n sel... | [
"0.75561",
"0.7538538",
"0.73136663",
"0.7299038",
"0.7277031",
"0.721585",
"0.71819395",
"0.6920575",
"0.688873",
"0.6870609",
"0.68241763",
"0.68005157",
"0.6773182",
"0.67697835",
"0.6691519",
"0.66737664",
"0.6661781",
"0.6634517",
"0.6549644",
"0.6508386",
"0.64143443",
... | 0.68423826 | 10 |
``RegistrationProfile.activation_key_expired()`` is ``False`` within the activation window. Even if the user was created in the past. | def test_unexpired_account_old_date_joined(self):
self.user_info['date_joined'] = datetime_now(
) - timedelta(settings.ACCOUNT_ACTIVATION_DAYS + 1)
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
profile = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_key_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return self.activation_key == RegistrationProfile.ACTIVATED or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())",
"def activation_key_expired(self... | [
"0.86101323",
"0.8551831",
"0.8493373",
"0.8389834",
"0.83643293",
"0.82226425",
"0.82189536",
"0.7981806",
"0.79596514",
"0.7958026",
"0.7926819",
"0.7852483",
"0.7705962",
"0.7563689",
"0.75202036",
"0.7202501",
"0.71821123",
"0.71781164",
"0.71226853",
"0.7067573",
"0.7025... | 0.7098458 | 19 |
``RegistrationProfile.activation_key_expired()`` is ``False`` within the activation window. | def test_unexpired_account(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
profile = self.registration_profile.objects.get(user=new_user)
self.assertFalse(profile.activation_key_expired()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_key_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return self.activation_key == RegistrationProfile.ACTIVATED or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())",
"def activation_key_expired(self... | [
"0.82939416",
"0.8242265",
"0.81896764",
"0.8142267",
"0.8115104",
"0.7671749",
"0.7664502",
"0.7395705",
"0.73860854",
"0.7371087",
"0.72821814",
"0.72067547",
"0.7109646",
"0.7076913",
"0.7049064",
"0.68543893",
"0.6730856",
"0.66777366",
"0.6648433",
"0.6633406",
"0.653713... | 0.73560894 | 10 |
``RegistrationProfile.activation_key_expired()`` is ``True`` when the account is already active. | def test_active_account_activation_key_expired(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
profile = self.registration_profile.objects.get(user=new_user)
self.registration_profile.objects.activate_user(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_key_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return self.activation_key == RegistrationProfile.ACTIVATED or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())",
"def activation_key_expired(self... | [
"0.847925",
"0.8473135",
"0.8437289",
"0.82632077",
"0.8221293",
"0.8038691",
"0.8031182",
"0.7994014",
"0.7711129",
"0.770146",
"0.74515724",
"0.7400366",
"0.7337085",
"0.73257303",
"0.72925615",
"0.7184183",
"0.71287096",
"0.7052126",
"0.7045366",
"0.7013834",
"0.6941264",
... | 0.8071736 | 5 |
``RegistrationProfile.activation_key_expired()`` is ``True`` when the account is already active and the activation window has passed. | def test_active_account_and_expired_accountactivation_key_expired(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
new_user.date_joined -= datetime.timedelta(
days=settings.ACCOUNT_ACTIVATION_DAYS + 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_key_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return self.activation_key == RegistrationProfile.ACTIVATED or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())",
"def activation_key_expired(self... | [
"0.8560944",
"0.8532134",
"0.849496",
"0.8378311",
"0.8347782",
"0.8022357",
"0.7998295",
"0.7966149",
"0.7838549",
"0.767627",
"0.7375217",
"0.7321083",
"0.7263128",
"0.7259876",
"0.712038",
"0.7104367",
"0.7069715",
"0.70576113",
"0.69714934",
"0.69031584",
"0.6867958",
"... | 0.8001795 | 6 |
``RegistrationProfile.activation_key_expired()`` is ``True`` outside the activation window. | def test_expired_account(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
new_user.date_joined -= datetime.timedelta(
days=settings.ACCOUNT_ACTIVATION_DAYS + 1)
new_user.save()
profile = s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_key_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return self.activation_key == RegistrationProfile.ACTIVATED or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())",
"def activation_key_expired(self... | [
"0.8257134",
"0.82151777",
"0.81876385",
"0.81148624",
"0.8075003",
"0.7468668",
"0.7434815",
"0.740106",
"0.7277542",
"0.72754884",
"0.7113131",
"0.68426645",
"0.68109626",
"0.68080616",
"0.67601717",
"0.66782945",
"0.6674066",
"0.66577876",
"0.6627815",
"0.6522896",
"0.6507... | 0.72275496 | 10 |
Test resending activation email to an existing user | def test_resend_activation_email(self):
user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), send_email=False, **self.user_info)
self.assertEqual(len(mail.outbox), 0)
profile = self.registration_profile.objects.get(user=user)
orig_a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_resend_activation_email_activated_user(self):\n user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), send_email=False, **self.user_info)\n\n profile = self.registration_profile.objects.get(user=user)\n user, activated = self.regi... | [
"0.83999896",
"0.8292599",
"0.81918204",
"0.80736554",
"0.79771644",
"0.7935104",
"0.78606844",
"0.76296455",
"0.7612933",
"0.75723714",
"0.746926",
"0.74641615",
"0.7438704",
"0.7394641",
"0.73463005",
"0.7321463",
"0.73108983",
"0.7279628",
"0.72380596",
"0.72116923",
"0.71... | 0.8512436 | 0 |
Test resending activation email to a nonexisting user | def test_resend_activation_email_nonexistent_user(self):
self.assertFalse(self.registration_profile.objects.resend_activation_mail(
email=self.user_info['email'],
site=Site.objects.get_current(),
))
self.assertEqual(len(mail.outbox), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_resend_activation_email(self):\n user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), send_email=False, **self.user_info)\n self.assertEqual(len(mail.outbox), 0)\n\n profile = self.registration_profile.objects.get(user=user)\n ... | [
"0.82796556",
"0.82518494",
"0.82356507",
"0.8166747",
"0.81311166",
"0.77691895",
"0.76394284",
"0.7639169",
"0.7480525",
"0.7434209",
"0.7420683",
"0.73485184",
"0.7306991",
"0.7222386",
"0.7206487",
"0.7183373",
"0.7159346",
"0.71508497",
"0.71354586",
"0.7133031",
"0.7125... | 0.83734745 | 0 |
Make sure that users created with the old create_new_activation_key method can still be activated. | def test_activation_key_backwards_compatibility(self):
current_method = self.registration_profile.create_new_activation_key
def old_method(self, save=True):
salt = hashlib.sha1(
str(random.random()).encode('ascii')
).hexdigest()[:5]
salt = salt.encode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_activation_key_backwards_compatibility(self):\n current_method = self.registration_profile.create_new_activation_key\n\n def old_method(self, save=True):\n salt = hashlib.sha1(\n str(random.random()).encode('ascii')\n ).hexdigest()[:5]\n salt =... | [
"0.80733716",
"0.7934203",
"0.7856112",
"0.7726737",
"0.7689222",
"0.76855624",
"0.7584228",
"0.7542768",
"0.75306755",
"0.7386188",
"0.73742163",
"0.72761464",
"0.7140411",
"0.70580685",
"0.6964887",
"0.69541126",
"0.69507843",
"0.6939093",
"0.6906592",
"0.67780584",
"0.6769... | 0.8035581 | 1 |
Make sure that users created with the old create_new_activation_key method can still be activated. | def test_activation_key_backwards_compatibility_sha1(self):
current_method = self.registration_profile.create_new_activation_key
def old_method(self, save=True):
random_string = get_random_string(length=32, allowed_chars=string.printable)
self.activation_key = hashlib.sha1(rando... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_activation_key_backwards_compatibility(self):\n current_method = self.registration_profile.create_new_activation_key\n\n def old_method(self, save=True):\n salt = hashlib.sha1(\n str(random.random()).encode('ascii')\n ).hexdigest()[:5]\n salt =... | [
"0.8071676",
"0.8033863",
"0.7933081",
"0.7854976",
"0.77255726",
"0.76887643",
"0.7583042",
"0.75415534",
"0.7530136",
"0.7385372",
"0.7373074",
"0.7275384",
"0.7139133",
"0.70563346",
"0.69630754",
"0.6953569",
"0.6950548",
"0.6938408",
"0.6905752",
"0.6776311",
"0.6768379"... | 0.7684377 | 6 |
``SupervisedRegistrationProfile.activation_key_expired()`` is ``True`` when the account is already active. | def test_active_account_activation_key_expired(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
profile = self.registration_profile.objects.get(user=new_user)
self.registration_profile.objects.activate_user(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_key_expired(self):\r\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\r\n return self.activation_key == \"ALREADY_ACTIVATED\" or \\\r\n (self.user.date_joined + expiration_date <= datetime.datetime.now())",
"def activation_key_expired(self):... | [
"0.8400178",
"0.8375826",
"0.8357075",
"0.8196818",
"0.81614023",
"0.80347884",
"0.7955996",
"0.792461",
"0.75959367",
"0.7594405",
"0.7390242",
"0.73472744",
"0.7329091",
"0.7320324",
"0.7311677",
"0.7108112",
"0.7096362",
"0.70484674",
"0.6970755",
"0.6959066",
"0.69567466"... | 0.80113006 | 6 |
``SupervisedRegistrationProfile.activation_key_expired()`` is ``True`` when the account is already active and the activation window has passed. | def test_active_account_and_expired_accountactivation_key_expired(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
new_user.date_joined -= datetime.timedelta(
days=settings.ACCOUNT_ACTIVATION_DAYS + 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activation_key_expired(self):\n expiration_date = datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)\n return self.activation_key == RegistrationProfile.ACTIVATED or \\\n (self.user.date_joined + expiration_date <= datetime.datetime.now())",
"def activation_key_expired(self... | [
"0.84482336",
"0.8440654",
"0.8394967",
"0.82949084",
"0.82747465",
"0.7995131",
"0.79853874",
"0.7925615",
"0.7715227",
"0.7577623",
"0.731007",
"0.72762275",
"0.72216195",
"0.7154178",
"0.71412414",
"0.709966",
"0.70434207",
"0.70117044",
"0.6905254",
"0.6886078",
"0.686227... | 0.7901429 | 8 |
Approving a non existent user profile does nothing and returns False | def test_admin_approval_nonexistent_id(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
profile = self.registration_profile.objects.get(user=new_user)
user = self.registration_profile.objects.admin_approve_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_admin_approval_not_activated(self):\n new_user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), **self.user_info)\n profile = self.registration_profile.objects.get(user=new_user)\n\n user = self.registration_profile.objects.admin_... | [
"0.7211909",
"0.704508",
"0.666929",
"0.6517962",
"0.65164953",
"0.645244",
"0.6382132",
"0.6325677",
"0.62553895",
"0.6239202",
"0.6206933",
"0.62003577",
"0.616768",
"0.6134095",
"0.6110486",
"0.6090319",
"0.60772467",
"0.6069243",
"0.6048604",
"0.6048152",
"0.6034915",
"... | 0.7436616 | 0 |
Make sure that users created with the old create_new_activation_key method can still be activated. | def test_activation_key_backwards_compatibility(self):
current_method = self.registration_profile.create_new_activation_key
def old_method(self, save=True):
salt = hashlib.sha1(
str(random.random()).encode('ascii')
).hexdigest()[:5]
salt = salt.encode... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_activation_key_backwards_compatibility(self):\n current_method = self.registration_profile.create_new_activation_key\n\n def old_method(self, save=True):\n salt = hashlib.sha1(\n str(random.random()).encode('ascii')\n ).hexdigest()[:5]\n salt =... | [
"0.8035581",
"0.7934203",
"0.7856112",
"0.7726737",
"0.7689222",
"0.76855624",
"0.7584228",
"0.7542768",
"0.75306755",
"0.7386188",
"0.73742163",
"0.72761464",
"0.7140411",
"0.70580685",
"0.6964887",
"0.69541126",
"0.69507843",
"0.6939093",
"0.6906592",
"0.67780584",
"0.67694... | 0.80733716 | 0 |
Make sure that users created with the old create_new_activation_key method can still be activated. | def test_activation_key_backwards_compatibility_sha1(self):
current_method = self.registration_profile.create_new_activation_key
def old_method(self, save=True):
random_string = get_random_string(length=32, allowed_chars=string.printable)
self.activation_key = hashlib.sha1(rando... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_activation_key_backwards_compatibility(self):\n current_method = self.registration_profile.create_new_activation_key\n\n def old_method(self, save=True):\n salt = hashlib.sha1(\n str(random.random()).encode('ascii')\n ).hexdigest()[:5]\n salt =... | [
"0.8071676",
"0.8033863",
"0.7933081",
"0.7854976",
"0.76887643",
"0.7684377",
"0.7583042",
"0.75415534",
"0.7530136",
"0.7385372",
"0.7373074",
"0.7275384",
"0.7139133",
"0.70563346",
"0.69630754",
"0.6953569",
"0.6950548",
"0.6938408",
"0.6905752",
"0.6776311",
"0.6768379",... | 0.77255726 | 4 |
Approving a non existent user profile does nothing and returns False | def test_no_admins_registered(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
with self.assertRaises(ImproperlyConfigured):
self.registration_profile.objects.send_admin_approve_email(
ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_admin_approval_nonexistent_id(self):\n new_user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), **self.user_info)\n profile = self.registration_profile.objects.get(user=new_user)\n\n user = self.registration_profile.objects.admin... | [
"0.7436616",
"0.7211909",
"0.704508",
"0.666929",
"0.6517962",
"0.65164953",
"0.645244",
"0.6382132",
"0.6325677",
"0.62553895",
"0.6239202",
"0.6206933",
"0.62003577",
"0.616768",
"0.6134095",
"0.6110486",
"0.6090319",
"0.60772467",
"0.6069243",
"0.6048604",
"0.6048152",
"... | 0.59410995 | 31 |
Approving a non existent user profile does nothing and returns False | def test_no_registration_admins_registered(self):
new_user = self.registration_profile.objects.create_inactive_user(
site=Site.objects.get_current(), **self.user_info)
with warnings.catch_warnings(record=True) as _warning:
self.registration_profile.objects.send_admin_approve_ema... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_admin_approval_nonexistent_id(self):\n new_user = self.registration_profile.objects.create_inactive_user(\n site=Site.objects.get_current(), **self.user_info)\n profile = self.registration_profile.objects.get(user=new_user)\n\n user = self.registration_profile.objects.admin... | [
"0.7436616",
"0.7211909",
"0.704508",
"0.666929",
"0.6517962",
"0.65164953",
"0.645244",
"0.6382132",
"0.6325677",
"0.62553895",
"0.6239202",
"0.6206933",
"0.62003577",
"0.616768",
"0.6134095",
"0.6110486",
"0.6090319",
"0.60772467",
"0.6069243",
"0.6048604",
"0.6048152",
"... | 0.0 | -1 |
Area of a circle | def area_of_circle(radius = radious):
area = radius * radious * 3.142
print("Calculating area...")
time.sleep(2)
return area | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circle_area(circle):\n return pi * circle.radius * circle.radius",
"def area_of_circle(radius):\n return radius",
"def area(self):\n\t\t#print (self.radius*self.radius*math.pi)\n\t\tcircle_area = (self.radius*self.radius*math.pi)\n\t\treturn circle_area",
"def circleArea(radius):\n return math.p... | [
"0.87967515",
"0.8697741",
"0.8523346",
"0.84880656",
"0.84618044",
"0.84374386",
"0.8413479",
"0.8336493",
"0.82823867",
"0.82823867",
"0.8215312",
"0.817681",
"0.81382656",
"0.81382656",
"0.8114525",
"0.8099303",
"0.8080847",
"0.8073403",
"0.8031185",
"0.8007116",
"0.798425... | 0.7675476 | 27 |
Computes IUO between two bboxes in the form [x1,y1,x2,y2] | def iou(bb_test, bb_gt):
xx1 = np.maximum(bb_test[0], bb_gt[0])
yy1 = np.maximum(bb_test[1], bb_gt[1])
xx2 = np.minimum(bb_test[2], bb_gt[2])
yy2 = np.minimum(bb_test[3], bb_gt[3])
w = np.maximum(0., xx2 - xx1)
h = np.maximum(0., yy2 - yy1)
wh = w * h
o = wh / ((bb_test[2]-bb_test[0])*(b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bboxes_iou(boxes1, boxes2):\n boxes1 = np.array(boxes1)\n boxes2 = np.array(boxes2)\n boxes1_area = (boxes1[..., 2] - boxes1[..., 0]) * (boxes1[..., 3] - boxes1[..., 1])\n boxes2_area = (boxes2[..., 2] - boxes2[..., 0]) * (boxes2[..., 3] - boxes2[..., 1])\n left_up = np.maxim... | [
"0.7835872",
"0.76479733",
"0.75411224",
"0.7489639",
"0.7474853",
"0.7459696",
"0.7459484",
"0.7459484",
"0.7443315",
"0.7419611",
"0.73922247",
"0.7391839",
"0.7327725",
"0.7315838",
"0.73052406",
"0.7246565",
"0.7230692",
"0.72218716",
"0.7210955",
"0.7180109",
"0.70957893... | 0.0 | -1 |
Return root mean square energy of the audio in decibels. | def get_rms_db(data):
# square root => multiply by 10 instead of 20 for dBs
mean_square = np.mean(data ** 2)
return 10 * np.log10(mean_square) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy(data):\n\n return np.real(np.mean(np.abs(data)**2, axis=1))",
"def amplitude(self):\r\n return np.sqrt(self.maxint) * self.weights",
"def waveno(E):\r\n C1 = 9.7846113e-07\r\n C2 = 12.263868e0 \r\n k = np.sqrt(E + C1 * E**2)/C2\r\n return k",
"def energy(e: float) -> float:\n... | [
"0.6872344",
"0.67966384",
"0.6599035",
"0.6563712",
"0.65591514",
"0.65446734",
"0.6524143",
"0.6522738",
"0.65193045",
"0.64933807",
"0.646895",
"0.6452153",
"0.6442864",
"0.64361703",
"0.63224447",
"0.62662745",
"0.62287545",
"0.6215246",
"0.61966306",
"0.61746836",
"0.615... | 0.0 | -1 |
Tests if a number n is prime | def is_prime(n):
if n <= 1:
return False
for i in range(2, n):
if n % i == 0:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isprime(n):\r\n\treturn is_prime(n)",
"def isprime(n):\n\treturn is_prime(n)",
"def is_prime(n):\n return mr_prime(n)",
"def isprime(n):\n if n % 2 == 0:return False\n return all(n % i for i in range(3, int(n**0.5) + 1, 2))",
"def if_prime(cls, n):\n\n if (n <= 1):\n return F... | [
"0.8657328",
"0.8614113",
"0.847204",
"0.8440417",
"0.8401939",
"0.83987176",
"0.8387073",
"0.8378617",
"0.8371008",
"0.83604544",
"0.83475083",
"0.8344897",
"0.83447963",
"0.83371514",
"0.83338034",
"0.83172303",
"0.83117396",
"0.8308119",
"0.830693",
"0.83066714",
"0.830362... | 0.82753694 | 24 |
Makes a list of primes less than n | def make_primes(n):
out_list = []
for i in range(2, n):
if is_prime(i):
out_list.append(i)
return out_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]",
"def generate_prime_less_than_n(n):\n\tif n <= 1:\n\t\treturn []\n\tlist_of_primes = [2]\n\tfor i in range(3, n, 2):\n\t\tis_prime = True\n\t\tfor j in list_of_primes:\n\t\t\tif i%j == 0:\n\t\t\t\tis_prime = False\n\t\t\t\tbreak\n\t\tif is... | [
"0.8713316",
"0.8503495",
"0.8476378",
"0.83455896",
"0.8327164",
"0.8288371",
"0.8264936",
"0.82252353",
"0.8222862",
"0.8146621",
"0.81397367",
"0.8082055",
"0.8082055",
"0.80769616",
"0.8067349",
"0.80551946",
"0.799892",
"0.79690963",
"0.7966319",
"0.7964421",
"0.79084826... | 0.8633674 | 1 |
Get a specific row dat. This function insure that the edited line is complete and is properly formated. | def _get_score_marker(self, idx):
it = {'art': -1., 'wake': 0., 'n1': 1., 'n2': 2., 'n3': 3., 'rem': 4.}
# Get unit :
fact = self._get_fact_from_unit()
# Get selected row :
# idx = self._scoreTable.currentRow()
# ============= NON EMPTY ITEM =============
# Define... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_row(self):\n return self._fin.readline().strip('\\n').strip(' ')",
"def get_raw_value_from_dat_file(self, row, field):\n if len(self.field_map[field]) == 2:\n return row[int(self.field_map[field][0]) - 1:int(self.field_map[field][1])].strip()\n if len(self.field_map[field]... | [
"0.6559713",
"0.6327667",
"0.6276837",
"0.61381876",
"0.6057434",
"0.5994516",
"0.598149",
"0.5911314",
"0.5810685",
"0.577521",
"0.57602894",
"0.57408696",
"0.57360333",
"0.5720512",
"0.56691647",
"0.5636922",
"0.5617813",
"0.5617813",
"0.55995077",
"0.55831355",
"0.55747783... | 0.0 | -1 |
Get the encoding type out of given item from the file. | def _get_encoding_type(file: str) -> Encoding:
try:
with open(file, 'r') as f:
f.read()
except UnicodeDecodeError:
encoding = Encoding.DER
else:
encoding = Encoding.PEM
return encoding | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_encoding_type(file): \n with open(file, 'rb') as f:\n rawdata = f.read()\n return detect(rawdata)['encoding']",
"def getType(file):\n\n with open(file, \"r\") as result:\n return result.readline().strip()",
"def get_encoding(fname):\n file = open(fname, 'rb')\n encoding = c... | [
"0.7261095",
"0.62854016",
"0.6118274",
"0.6100573",
"0.6017653",
"0.5980837",
"0.594074",
"0.5851768",
"0.5766606",
"0.5754866",
"0.57493925",
"0.57193446",
"0.5664526",
"0.56490785",
"0.5646268",
"0.5622929",
"0.561016",
"0.5590955",
"0.558657",
"0.5581057",
"0.5568738",
... | 0.6800192 | 1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
#list to validate the input from user against these city names.
city_list = ['chicago', 'new york city', '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.59671944 | 34 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
#Used the practice#3 from Project solution here to convert time columns to month and weekday_name
# load data file into a dataframe
df = pd.read_csv(CITY_DATA[city])
# convert the Start Time column to datetime
df['Start Time'] = pd.to_datetime(df['Start Time'])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.81320685",
"0.8108889",
"0.8045821",
"0.8042514",
"0.80090284",
"0.80071104",
"0.79991937",
"0.7998333",
"0.7988789",
"0.797905",
"0.79737365",
"0.79610896",
"0.7956163",
"0.7947432",
"0.79463065",
"0.7908287",
"0.7908229",
"0.7904569",
"0.7900715",
"0.78930074",
"0.788921... | 0.76225895 | 77 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# TO DO: display the most common month
#Use practice#1 solution mode method to obtain popular month, day of week and hour
df_common_month = df['month'].mode()[0]
#use dictionary to l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80247396",
"0.80233026",
"0.7915788",
"0.78266186",
"0.7822246",
"0.78143597",
"0.77659196",
"0.7740343",
"0.773628",
"0.77344066",
"0.76867086",
"0.7668633",
"0.7651731",
"0.7644636",
"0.76399267",
"0.76367253",
"0.7625196",
"0.7623158",
"0.7612803",
"0.76002145",
"0.7583... | 0.7072392 | 88 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
start_station = df['Start Station'].mode()[0]
print("The most commonly used start station is: ", start_station)
# TO DO: display mo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.7815675",
"0.7662213",
"0.7553417",
"0.74914914",
"0.74748665",
"0.7446617",
"0.7428588",
"0.74237514",
"0.74177027",
"0.7400495",
"0.7387161",
"0.7385634",
"0.73647535",
"0.735934",
"0.73566747",
"0.73548365",
"0.7351854",
"0.7351274",
"0.735057",
"0.73421645",
"0.7340198... | 0.68405586 | 93 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
total_travel = df['Trip Duration'].sum()
print("Total Time traveled is: ", total_travel)
# TO DO: display mean travel time
avg_travel = df['Trip Duration'].m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664047",
"0.7863... | 0.7886722 | 14 |
Provide currently logged in user. | def resolve_user(self, info):
if info.context.user.is_authenticated:
return info.context.user
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_user(self):\n return self.current_user",
"def current_user(self):\n user_dict = self.auth.get_user_by_session()\n return self.auth.store.user_model.get_by_id(user_dict['user_id'])",
"def get_current_user(self):\r\n return self.jira.current_user()",
"def get_user(self):\n ... | [
"0.8721943",
"0.85588825",
"0.84461474",
"0.84167224",
"0.84167224",
"0.8414067",
"0.83997834",
"0.83361864",
"0.8332539",
"0.8277089",
"0.82207966",
"0.8193016",
"0.81717086",
"0.81635326",
"0.81255734",
"0.8119643",
"0.8103504",
"0.803552",
"0.80282533",
"0.799265",
"0.7962... | 0.71884036 | 88 |
Trivial view to serve the `graphiql.html` file. | def graphiql(request):
del request
graphiql_filepath = pathlib.Path(__file__).absolute().parent / "graphiql.html"
with open(graphiql_filepath) as f:
return django.http.response.HttpResponse(f.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graphs():\n return render_template(\"graphs.html\")",
"def home():\n return render_template(\"d3_graph.html\")",
"def graphing1():\n return render_template('graph1.html')",
"def graph(graph_file):\n return render_template(graph_file)",
"def get(self):\n self.render('view.html')",
"... | [
"0.6823622",
"0.67768425",
"0.671672",
"0.6425824",
"0.64172035",
"0.6391936",
"0.63784313",
"0.6268856",
"0.6258848",
"0.625319",
"0.62249345",
"0.6219032",
"0.62177974",
"0.6196758",
"0.61770403",
"0.61762196",
"0.6161369",
"0.61571264",
"0.61453485",
"0.61381763",
"0.61381... | 0.8503598 | 0 |
Creates an instance of this model from a dictionary | def from_dictionary(cls,
dictionary):
if dictionary is None:
return None
# Extract variables from the dictionary
cycle_remaining = dictionary.get('cycleRemaining')
cycle_tomorrow = dictionary.get('cycleTomorrow')
driver_id = dictionary... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dictionary(cls,\n dictionary):\n if dictionary is None:\n return None\n\n # Extract variables from the dictionary\n id = dictionary.get('id')\n name = dictionary.get('name')\n mtype = dictionary.get('type')\n usage_bytes = diction... | [
"0.83181584",
"0.8168118",
"0.8168118",
"0.8118749",
"0.8089047",
"0.79787344",
"0.7949278",
"0.79231393",
"0.7898951",
"0.78923255",
"0.788838",
"0.7882321",
"0.7882212",
"0.7876749",
"0.78585315",
"0.7836853",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",
"0.7801407",... | 0.0 | -1 |
Saved logged metrics into a json file | def save(self, file_name_override=None):
self.protocol.commit(file_name_override=file_name_override) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_metrics(log_dir, params):\n metrics_file = os.path.join(log_dir, 'metrics.json')\n with open(metrics_file, 'w') as f:\n f.write(json.dumps(params))",
"def logging_data(self):\n with open('sensor_data.log','w') as f:\n json.dump(self.read_continuous_data, f)",
"def save_... | [
"0.71709055",
"0.71244407",
"0.6989549",
"0.68426085",
"0.67097247",
"0.67057693",
"0.66966504",
"0.66543776",
"0.66480196",
"0.65859544",
"0.6578312",
"0.6487556",
"0.6447462",
"0.64137137",
"0.6408592",
"0.63966864",
"0.6364586",
"0.6317079",
"0.6303004",
"0.62814814",
"0.6... | 0.0 | -1 |
Calculate the normalized gini index without weights. It is a float between 1 and 1. The higher the value is, the closer the model, only taking into account the ordering of the values. A negative Gini means most of the time that the model inverts high values and low values. ordering of the target value. | def Gini(y_true, y_pred):
# check and get number of samples
assert y_true.shape == y_pred.shape
n_samples = y_true.shape[0]
# sort rows on prediction column
# (from largest to smallest)
arr = np.array([y_true, y_pred]).transpose()
true_order = arr[arr[:, 0].argsort()][::-1, 0]
pred_orde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gini(values):\n v = values.copy()\n v.sort()\n\n sum_iy = 0\n for i, y in enumerate(v):\n i += 1\n sum_iy += i*y\n\n sum_y = sum(v)\n n = len(v)\n\n return 1 - (((2*sum_iy)/(n*sum_y)) - ((n+1)/n))",
"def giniIndex(p_m1):\n G = p_m1*(1-p_m1)*2 \n return G",
"def gin... | [
"0.63931614",
"0.63931036",
"0.63429064",
"0.6149669",
"0.6130019",
"0.6096283",
"0.60961545",
"0.59859324",
"0.5960882",
"0.59328765",
"0.5821902",
"0.57501966",
"0.5678476",
"0.558463",
"0.55258733",
"0.5513415",
"0.54865897",
"0.541244",
"0.54001695",
"0.5383822",
"0.53629... | 0.50647783 | 37 |
pyzmq_version() Return the version of pyzmq as a string. | def pyzmq_version():
if __revision__:
return '@'.join([__version__,__revision__[:6]])
else:
return __version__ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()",
"def zmq_version():\n return \"%i.%i.%i\" % zmq_version_info()",
"def pyzmq_version_info():\n return version_info",
"def pyzmq_version_info():\n import re\n parts = re.findall('[0-9]+', __version__)\n parts = [ int(p) for p in ... | [
"0.84373516",
"0.84373516",
"0.80661434",
"0.6667663",
"0.6549085",
"0.6435804",
"0.6347818",
"0.6327694",
"0.6327694",
"0.6276691",
"0.6276691",
"0.6200533",
"0.61859506",
"0.61743695",
"0.6147893",
"0.61379194",
"0.60783356",
"0.6067122",
"0.6050079",
"0.6044156",
"0.604415... | 0.8878596 | 0 |
zmq_version() Return the version of ZeroMQ itself as a string. | def zmq_version():
return "%i.%i.%i" % zmq_version_info() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pyzmq_version():\n if __revision__:\n return '@'.join([__version__,__revision__[:6]])\n else:\n return __version__",
"def pyzmq_version():\n if __revision__:\n return '@'.join([__version__,__revision__[:6]])\n else:\n return __version__",
"def pyzmq_version_info():\n... | [
"0.8685192",
"0.8685192",
"0.80834395",
"0.674612",
"0.6704914",
"0.6492072",
"0.6461652",
"0.6461652",
"0.6400034",
"0.6352624",
"0.63269675",
"0.63269675",
"0.63269675",
"0.63269675",
"0.63269675",
"0.63120574",
"0.6306926",
"0.6306926",
"0.62852186",
"0.62732023",
"0.62667... | 0.87617785 | 0 |
Create and save yellowbrick visualizer image for model specificed | def create_img(X_train, X_test, y_train, y_test, labels, model, visualizer, upsampled, IMG_OUTPUT_FILEPATH):
viz = Visualizer(X_train, X_test, y_train, y_test, labels, model, visualizer, upsampled=upsampled)
viz.evaluate()
if upsampled == True:
outpath_ = IMG_OUTPUT_FILEPATH + str(model).split('('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_callback(model):\n\n # Get samples & Display them\n pred_img = model.predict([masked, mask])\n pred_time = datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')\n\n # Clear current output and display test images\n combine_imgs = np.concatenate([pred_img, masked, mask, ori], axis=2)\n for... | [
"0.66604346",
"0.6626089",
"0.66033375",
"0.654884",
"0.6471268",
"0.6439516",
"0.6375745",
"0.6337654",
"0.6334921",
"0.6328005",
"0.62666893",
"0.6247176",
"0.6222995",
"0.6202766",
"0.6198136",
"0.6175613",
"0.6159791",
"0.61297286",
"0.61181533",
"0.6102077",
"0.60640174"... | 0.6954059 | 0 |
Ensure a new ad can be added to the database. | def test_add_ad(self):
with self.client:
data = {'category': 'food'}
data = {key: str(value) for key, value in data.items()}
data['image'] = (io.BytesIO(b"ad.png"), 'ad.png')
response = self.client.post(
'/ads',
data=data,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_article(article):\r\n\tcollection=create_database_connection()\r\n\tinsert_article(collection,article)",
"def test_shorturl_not_saving_without_longurl(self):\n db.session.add(self.short_url)\n with self.assertRaises(sqlalchemy.exc.IntegrityError):\n db.session.commit()",
"... | [
"0.6350939",
"0.5799389",
"0.57665575",
"0.56594",
"0.56178635",
"0.56089073",
"0.5568797",
"0.5566294",
"0.5514329",
"0.55101174",
"0.54969716",
"0.54820824",
"0.5454322",
"0.5448606",
"0.5436308",
"0.5435855",
"0.542952",
"0.5428207",
"0.5416877",
"0.53936774",
"0.53893906"... | 0.58857304 | 1 |
Make human readable repr of object | def pretty_repr(src, indent=0, no_indent_start=False, max_indent=20):
if _simple(src) or indent >= max_indent:
indent = 0 if no_indent_start else indent
if isinstance(src, (six.binary_type, six.text_type)):
if isinstance(src, six.binary_type):
string = src.decode(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repr_(object_):\n return repr(object_)",
"def srepr(obj):\n return repr(str(obj))",
"def __repr__(self):\n return repr(self.__dict__['_obj'])",
"def __str__(self):\n return str(self.__dict__['_obj'])",
"def __str__(self):\r\n return repr(self)",
"def __str__... | [
"0.8652125",
"0.8316382",
"0.7994549",
"0.79661006",
"0.7925168",
"0.78912747",
"0.78149796",
"0.78074527",
"0.78013045",
"0.77802086",
"0.7745705",
"0.7745705",
"0.7745705",
"0.7745705",
"0.7745705",
"0.77302027",
"0.77272815",
"0.7692457",
"0.76789665",
"0.7673775",
"0.7613... | 0.0 | -1 |
cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterID2ID2D | def cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args)",
"def itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFi... | [
"0.7317763",
"0.69602925",
"0.67005634",
"0.654515",
"0.65173227",
"0.6511917",
"0.64960444",
"0.6478478",
"0.64703274",
"0.6445255",
"0.6444223",
"0.6410898",
"0.63994706",
"0.6398797",
"0.63909125",
"0.63687414",
"0.6348721",
"0.632899",
"0.6326499",
"0.6326468",
"0.6312569... | 0.7054719 | 1 |
New() > itkThresholdSegmentationLevelSetImageFilterID2ID2D Create a new object of the class itkThresholdSegmentationLevelSetImageFilterID2ID2D and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new ob... | def New(*args, **kargs):
obj = itkThresholdSegmentationLevelSetImageFilterID2ID2D.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterIF2IF2F.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkContourDirectedMeanDistanceImageFilterID2ID2.__New_orig__()\n ... | [
"0.76449573",
"0.6972659",
"0.6953555",
"0.69390565",
"0.6938342",
"0.68854594",
"0.68711585",
"0.67835695",
"0.6757741",
"0.6740783",
"0.6740581",
"0.6735739",
"0.67284083",
"0.6723157",
"0.6708133",
"0.6677817",
"0.66719407",
"0.66626775",
"0.66591215",
"0.66462713",
"0.663... | 0.8383676 | 0 |
itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterID2ID2D | def itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID2ID2D_cast(*args)",
"def itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetIm... | [
"0.7294599",
"0.70769775",
"0.6743314",
"0.6553998",
"0.65133744",
"0.6460269",
"0.6445589",
"0.64438605",
"0.6434699",
"0.6419761",
"0.64042693",
"0.64037067",
"0.6375267",
"0.63676065",
"0.636465",
"0.6340213",
"0.6332837",
"0.63279384",
"0.63178873",
"0.6315206",
"0.629502... | 0.77298045 | 0 |
cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterID3ID3D | def cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args)",
"def itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFi... | [
"0.7209301",
"0.68689644",
"0.6615143",
"0.6600894",
"0.651897",
"0.65104765",
"0.64990205",
"0.6474515",
"0.64730364",
"0.6470683",
"0.64666504",
"0.64618325",
"0.6459481",
"0.64516294",
"0.64422476",
"0.6437559",
"0.63825923",
"0.63612485",
"0.6354498",
"0.63529867",
"0.635... | 0.6889926 | 1 |
New() > itkThresholdSegmentationLevelSetImageFilterID3ID3D Create a new object of the class itkThresholdSegmentationLevelSetImageFilterID3ID3D and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new ob... | def New(*args, **kargs):
obj = itkThresholdSegmentationLevelSetImageFilterID3ID3D.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterIF3IF3F.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkReinitializeLevelSetImageFilterIF3.__New_orig__()\n import i... | [
"0.78972745",
"0.71143615",
"0.70890355",
"0.6992841",
"0.69659144",
"0.69288987",
"0.6889642",
"0.68776995",
"0.6869911",
"0.6847723",
"0.6847122",
"0.6831883",
"0.6824473",
"0.6822326",
"0.68186426",
"0.681508",
"0.68134487",
"0.681233",
"0.68105024",
"0.6805832",
"0.679231... | 0.8504184 | 0 |
itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterID3ID3D | def itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterID3ID3D_cast(*args)",
"def itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetIm... | [
"0.719463",
"0.7146745",
"0.6782238",
"0.67221576",
"0.66516876",
"0.6632296",
"0.661204",
"0.6539844",
"0.65397674",
"0.6532192",
"0.652296",
"0.65126014",
"0.65101147",
"0.65098053",
"0.6495247",
"0.6489122",
"0.6486863",
"0.64809346",
"0.6472191",
"0.64660865",
"0.6464932"... | 0.7688943 | 0 |
cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterIF2IF2F | def cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args)",
"def itkBinaryContourImageFilterIF2IF2_cast(obj: 'itkLightObject') -> \"itkBinaryContourImageFilterIF2IF2 *\":\n ret... | [
"0.76542753",
"0.68155116",
"0.6797408",
"0.6748474",
"0.6747602",
"0.67378294",
"0.67185706",
"0.66765267",
"0.66664845",
"0.6659888",
"0.6634118",
"0.6613836",
"0.66097015",
"0.65771776",
"0.65644",
"0.65612817",
"0.6527321",
"0.652634",
"0.65179163",
"0.65167093",
"0.64896... | 0.72226197 | 1 |
New() > itkThresholdSegmentationLevelSetImageFilterIF2IF2F Create a new object of the class itkThresholdSegmentationLevelSetImageFilterIF2IF2F and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new ob... | def New(*args, **kargs):
obj = itkThresholdSegmentationLevelSetImageFilterIF2IF2F.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterID2ID2D.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkHuangThresholdImageFilterIF2ISS2.__New_orig__()\n import itk... | [
"0.74795395",
"0.72359747",
"0.7172076",
"0.71413183",
"0.7139767",
"0.7006789",
"0.6972409",
"0.6958476",
"0.69502664",
"0.69376004",
"0.6931795",
"0.6912964",
"0.69100153",
"0.6900817",
"0.6892454",
"0.68917257",
"0.68663836",
"0.68546194",
"0.6843664",
"0.6824719",
"0.6803... | 0.8467628 | 0 |
itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterIF2IF2F | def itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF2IF2F_cast(*args)",
"def itkBinaryContourImageFilterIF2IF2_cast(obj: 'itkLightObject') -> \"itkBinaryContourImageFilterIF2IF2 *\":\n return _itkBinaryContourImageFilterPython.itkBin... | [
"0.7546829",
"0.70317763",
"0.6924223",
"0.69231355",
"0.6912477",
"0.6891269",
"0.6876223",
"0.6874975",
"0.6874549",
"0.6867892",
"0.6814128",
"0.67884517",
"0.6784134",
"0.67438495",
"0.6678557",
"0.6656256",
"0.6651595",
"0.6644246",
"0.6642174",
"0.6632778",
"0.6630479",... | 0.80827314 | 0 |
cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterIF3IF3F | def cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args)",
"def cast(obj: 'itkLightObject') -> \"itkHuangThresholdImageFilterIF3IUS3 *\":\n return _itkHuangThresholdImageF... | [
"0.7473776",
"0.6951387",
"0.69450647",
"0.6919215",
"0.6896403",
"0.68893766",
"0.68640095",
"0.6810401",
"0.6806885",
"0.67720574",
"0.6750099",
"0.670569",
"0.6699713",
"0.6681266",
"0.6679633",
"0.66769445",
"0.66750157",
"0.6673079",
"0.6664501",
"0.6662498",
"0.6658105"... | 0.70774716 | 1 |
New() > itkThresholdSegmentationLevelSetImageFilterIF3IF3F Create a new object of the class itkThresholdSegmentationLevelSetImageFilterIF3IF3F and set the input and the parameters if some named or nonnamed arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new ob... | def New(*args, **kargs):
obj = itkThresholdSegmentationLevelSetImageFilterIF3IF3F.__New_orig__()
import itkTemplate
itkTemplate.New(obj, *args, **kargs)
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def New(*args, **kargs):\n obj = itkThresholdSegmentationLevelSetImageFilterID3ID3D.__New_orig__()\n import itkTemplate\n itkTemplate.New(obj, *args, **kargs)\n return obj",
"def New(*args, **kargs):\n obj = itkHuangThresholdImageFilterIF3ISS3.__New_orig__()\n import itk... | [
"0.7859565",
"0.7401686",
"0.73201567",
"0.7261661",
"0.72541434",
"0.7216809",
"0.7158068",
"0.71521986",
"0.71271557",
"0.71151334",
"0.7108641",
"0.71076304",
"0.7092853",
"0.70817626",
"0.70721686",
"0.70538735",
"0.7051881",
"0.7002831",
"0.69878745",
"0.69857913",
"0.69... | 0.86294013 | 0 |
itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(itkLightObject obj) > itkThresholdSegmentationLevelSetImageFilterIF3IF3F | def itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args):
return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast(*args):\n return _itkThresholdSegmentationLevelSetImageFilterPython.itkThresholdSegmentationLevelSetImageFilterIF3IF3F_cast(*args)",
"def itkHuangThresholdImageFilterIF3ISS3_cast(obj: 'itkLightObject') -> \"itkHuangThresholdImageFilterIF3ISS3 *\":\n return _itkHuangThresholdImageFilterPython.i... | [
"0.7516081",
"0.72488433",
"0.7213387",
"0.7206106",
"0.71808314",
"0.71590215",
"0.7137719",
"0.7125754",
"0.7115165",
"0.7052657",
"0.7004331",
"0.6959764",
"0.6950602",
"0.6944445",
"0.693499",
"0.6925875",
"0.69155777",
"0.6906629",
"0.68950164",
"0.6867126",
"0.686403",
... | 0.8021722 | 0 |
Compute softmax values for each sets of scores in x. | def softmax(x):
e_x = np.exp(x - np.max(x, axis=1).reshape(-1, 1))
return e_x / np.sum(e_x, axis=1).reshape(-1, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(self, scores):\n\n\n # for each sample, for each class ,caclulate\n # np.exp(scores) : still (n_samples, n_classes)\n\n # axis = 1\n # a00, a01, a02 as a sinlge one to perfrom np_sum\n # which is the same sample \n # sum_exp : still (n_samples, 1)\n\n # ... | [
"0.7796373",
"0.7761191",
"0.7759723",
"0.77571064",
"0.765803",
"0.765803",
"0.765803",
"0.765803",
"0.75856936",
"0.74314815",
"0.74069375",
"0.73939854",
"0.7358033",
"0.7317298",
"0.72690034",
"0.7262341",
"0.7261389",
"0.72569704",
"0.72300184",
"0.72146094",
"0.72015774... | 0.71012366 | 37 |
Method to transform a float amount to text words E.g. 100 ONE HUNDRED | def l10n_mx_edi_amount_to_text(self, amount_total):
self.ensure_one()
currency = self.currency_id.name.upper()
# M.N. = Moneda Nacional (National Currency)
# M.E. = Moneda Extranjera (Foreign Currency)
currency_type = 'M.N' if currency == 'MXN' else 'M.E.'
# Split integer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_to_words(amount):\n digits = {\n 0: 'нуль', 1: 'одна',\n 2: 'дві', 3: 'три',\n 4: 'чотири', 5: 'п\\'ять',\n 6: 'шість', 7: 'сім',\n 8: 'вісім', 9: 'дев\\'ять',\n 10: 'десять', 11: 'одинадцять',\n 12: 'дванадцять', 13: 'тринадцять',\n 14: 'чотирна... | [
"0.69767445",
"0.6734786",
"0.65856355",
"0.6414861",
"0.62515616",
"0.6240848",
"0.6209962",
"0.6184267",
"0.6145886",
"0.60546446",
"0.604937",
"0.60099334",
"0.5943315",
"0.59345275",
"0.5928641",
"0.5923201",
"0.5918003",
"0.585031",
"0.5815089",
"0.58010364",
"0.5782184"... | 0.5612742 | 26 |
Create misfits table if does not exist | def create_misfits_table(self, schema: str):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_misfits(self, schema: str, misfits: List[dict]):\n return",
"def _create_table_if_not_exists(self) -> bigquery.Table:\n table = self.client.create_table(\n table=bigquery.Table(table_ref=self._table_ref, schema=Schema),\n exists_ok=True,\n )\n logging.... | [
"0.65010846",
"0.6255917",
"0.6072083",
"0.6061742",
"0.6058533",
"0.5989394",
"0.5968818",
"0.5918865",
"0.58964455",
"0.587468",
"0.5776405",
"0.5760882",
"0.57527506",
"0.57400507",
"0.5721688",
"0.5705203",
"0.56743723",
"0.56445485",
"0.56305426",
"0.5610155",
"0.5609625... | 0.77973133 | 0 |
Create misfits table if does not exist | def insert_misfits(self, schema: str, misfits: List[dict]):
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_misfits_table(self, schema: str):\n return",
"def _create_table_if_not_exists(self) -> bigquery.Table:\n table = self.client.create_table(\n table=bigquery.Table(table_ref=self._table_ref, schema=Schema),\n exists_ok=True,\n )\n logging.info(\"table %s... | [
"0.779613",
"0.6259269",
"0.6074648",
"0.6065671",
"0.6060536",
"0.5993914",
"0.59707904",
"0.5923863",
"0.59006983",
"0.5877432",
"0.5780372",
"0.57664883",
"0.57570076",
"0.57453257",
"0.5725309",
"0.5710089",
"0.5679856",
"0.56471354",
"0.5635639",
"0.5615736",
"0.5612979"... | 0.64983237 | 1 |
Loads config from a yaml file | def load_config(self, config_file):
if config_file is None:
config_file = CrypTenConfig.__DEFAULT_CONFIG_PATH
# Use yaml to open stream for safe load
with open(config_file) as stream:
config_dict = yaml.safe_load(stream)
self.config = OmegaConf.create(config_dict... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_config(config_file):\n with open(config_file) as f:\n return yaml.load(f)",
"def load_yaml(cls, file=None):\n if file is None: file = f'{rcp.base_path}cfg.yml'\n try:\n with open(file, 'r') as f:\n config = yaml.load(f, Loader=yaml.FullLoader)\n ... | [
"0.8367653",
"0.82981765",
"0.82852507",
"0.8280083",
"0.8183604",
"0.8169945",
"0.8124675",
"0.810506",
"0.8099261",
"0.80854475",
"0.80707",
"0.8066222",
"0.80316937",
"0.80060565",
"0.7981556",
"0.7947537",
"0.79029316",
"0.78784835",
"0.7869254",
"0.7832072",
"0.7810559",... | 0.0 | -1 |
Gets the model state. | def get_state(self, veh, t):
return self._get_demand_supply_costs_df(veh.ozone, t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_model_state(self) -> dict:\n raise NotImplementedError",
"def get_state(self) -> Optional[BaseModel]:\n return self.state",
"def get_state(self):\n return self.controller.get_state()",
"def getState(self) :\n return self.state",
"def get_state(self):\n return sel... | [
"0.8376834",
"0.81420416",
"0.8069894",
"0.80272377",
"0.80264366",
"0.80264366",
"0.79990625",
"0.79990625",
"0.79990625",
"0.79545265",
"0.79545265",
"0.79545265",
"0.79545265",
"0.79545265",
"0.79030573",
"0.79030573",
"0.78839993",
"0.7864819",
"0.7822577",
"0.7819333",
"... | 0.0 | -1 |
Returns the critical angle if it exists for a ball moving from a medium with velocity `s0` to a medium with velocity `s1`. If the critical angle does not exist, returns None. | def get_critical_angle(s0: float, s1: float) -> Union[float, None]:
if s0 < s1:
critical_angle = math.asin(s0 / s1)
else:
critical_angle = None
return critical_angle | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _exceeds_critical_angle(angle: float, s0: float, s1: float) -> bool:\n if s1 > s0: # if the second speed is faster, there is a critical angle\n critical_angle = get_critical_angle(s0, s1)\n if abs(angle) >= critical_angle:\n return True\n return False",
"de... | [
"0.6010786",
"0.579282",
"0.539038",
"0.530186",
"0.5274534",
"0.52288604",
"0.5030306",
"0.4990997",
"0.4958949",
"0.49580598",
"0.49514675",
"0.49347538",
"0.49278605",
"0.49215996",
"0.49145883",
"0.4881637",
"0.48812023",
"0.4877278",
"0.4851266",
"0.48504397",
"0.4849300... | 0.7503091 | 0 |
Line representing the trajectory of the point on the bottom right corner of the rectangle | def bottom_right(self) -> Line:
start = Point(self.shape.right_bound, self.shape.bottom_bound)
return Line(start, start + self.velocity) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_walking_line(self):\n\t\treturn self._bottom_rect.move(0,1)",
"def line():\n tt.left(90)\n tt.down()\n tt.forward(50)\n tt.up()\n tt.right(90)\n tt.forward(10)\n tt.right(90)\n tt.forward(50)\n tt.left(90)",
"def bottom_left(self) -> Line:\n start = Point(self.shape.le... | [
"0.70809007",
"0.68511844",
"0.66570073",
"0.66522264",
"0.63814306",
"0.6367143",
"0.6353308",
"0.6326941",
"0.62217885",
"0.6182864",
"0.6161414",
"0.61573404",
"0.6155028",
"0.61501205",
"0.6149612",
"0.61307883",
"0.6123404",
"0.61039734",
"0.60611546",
"0.60571724",
"0.6... | 0.6944726 | 1 |
Move the ball to the next position according to the speed of the layer it is in. | def _step_ball(self, speed: Union[float, int] = None):
trajectory = self._get_trajectory(speed)
self._get_first_intersection(trajectory)
reward = 0
if trajectory.intersection is None: # No intersection
self.ball.pos = trajectory.center.end
else:
reward =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ball_move(self):\n self.ball.move(self.__dx, self.__dy)",
"def move(self):\n self.position += self.speed",
"def move_ball(self):\r\n self.canvas.move(self.ball, (self.x_speed * self.speed), (self.y_speed * self.speed))\r\n (leftPos, topPos, rightPos, bottomPos) = self.canvas.coo... | [
"0.764544",
"0.7546134",
"0.7478087",
"0.71920246",
"0.7164236",
"0.7124832",
"0.7096922",
"0.7061917",
"0.6918336",
"0.6897",
"0.6879579",
"0.67422515",
"0.6686483",
"0.6657752",
"0.6624664",
"0.6610424",
"0.6597164",
"0.6591763",
"0.6568128",
"0.6551132",
"0.65332437",
"0... | 0.65152466 | 23 |
Test endpoints.post_pull_request_review with an incorrect signature | def test_post_pull_request_review_bad_sign(
self,
validate_config,
handler_class,
conn,
verify_signature
):
conn.request.data.return_value = ''
conn.request.headers.get.return_value = 'sha1=signature'
verify_signature.side_effect =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_post_pull_request_review_unapproved(\n self,\n validate_config,\n handler_class,\n conn,\n verify_signature\n ):\n conn.request.data.return_value = ''\n conn.request.headers.get.return_value = 'sha1=signature'\n verify_signatur... | [
"0.7453087",
"0.7399019",
"0.6997548",
"0.6940954",
"0.6869423",
"0.6795312",
"0.6534847",
"0.64309883",
"0.64241874",
"0.628642",
"0.62513655",
"0.62419754",
"0.6214618",
"0.6212909",
"0.6208724",
"0.61728865",
"0.6151403",
"0.6101003",
"0.60562",
"0.60487765",
"0.60104835",... | 0.69309485 | 4 |
Compute the leaky ReLU activation function. | def leaky_relu(x, alpha=0.01):
return tf.maximum(x,alpha*x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leaky_relu(x, alpha=0.01):\n return tf.maximum(x, tf.multiply(x, alpha))",
"def test_leaky_relu_activation(self):\n self.assertEqual(\n [-0.0050, 0.5000], list(af.LeakyRelu(0.01).output(np.array([-0.5, 0.5]))))\n self.assertEqual([0.01, 1], list(af.LeakyRelu(\n 0.01).de... | [
"0.72324014",
"0.7216286",
"0.70243454",
"0.70038503",
"0.6969655",
"0.6929563",
"0.6864869",
"0.6849147",
"0.68292725",
"0.68021005",
"0.67519647",
"0.67474496",
"0.6747445",
"0.6747445",
"0.670609",
"0.668123",
"0.6672017",
"0.66471547",
"0.66453314",
"0.6642755",
"0.659231... | 0.7314766 | 0 |
Returns the number of days in a month of a particular year. | def days_in_month(year, month):
month_days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if month == 2 and is_leap(year):
return month_days[1] + 1
else:
return month_days[month - 1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dayInYear(month, day, year):\n current = 1\n numberOfDays = day\n while (current < month):\n numberOfDays = numberOfDays + daysInMonth(current, year)\n current = current + 1\n return numberOfDays",
"def numDays(month, year):\n\tif month in [9, 4, 6, 11]:\n\t\treturn 30\n\telif month... | [
"0.8018876",
"0.7938739",
"0.7933974",
"0.7761896",
"0.76952803",
"0.7582218",
"0.75290364",
"0.7435412",
"0.73891866",
"0.7312206",
"0.72649264",
"0.7197095",
"0.7187798",
"0.7179535",
"0.7179535",
"0.7179535",
"0.7177935",
"0.71364826",
"0.7032886",
"0.6970319",
"0.68929315... | 0.7600419 | 5 |
String for representing the Model object. | def __str__(self):
return self.card_no | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self):\n return \"DataModel(name={},attributes={},description={})\".format(\n self.name, {a.name: str(a) for a in self.attributes}, self.description\n )",
"def __str__(self):\n \n res =... | [
"0.82368803",
"0.79901737",
"0.7849152",
"0.78468513",
"0.77520275",
"0.7625378",
"0.7625378",
"0.76225406",
"0.76225406",
"0.75483394",
"0.7522958",
"0.7470355",
"0.7469358",
"0.7447144",
"0.7447144",
"0.74314755",
"0.7427648",
"0.7389925",
"0.7351721",
"0.73424315",
"0.7322... | 0.0 | -1 |
Returns the url to access a detail record for this card. | def get_absolute_url(self):
return reverse('card-detail', args=[str(self.id)]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details_url(self):\n if self._data.get('details_url'):\n path = self._data.get('details_url')\n try:\n path, hash_ = path.split('#')\n hash_ = '#' + hash_\n except ValueError:\n hash_ = ''\n return '{}?from_activity... | [
"0.7252138",
"0.7122791",
"0.6609128",
"0.6586927",
"0.65646684",
"0.6540515",
"0.65038",
"0.64735013",
"0.6464368",
"0.64480615",
"0.642915",
"0.6389873",
"0.63890266",
"0.635177",
"0.631059",
"0.6298563",
"0.6298563",
"0.6298563",
"0.62849885",
"0.62828815",
"0.62722015",
... | 0.7311372 | 0 |
r""" Return the genus of the surface. | def genus(self):
return 1 - self.euler_characteristic() // 2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genes():\n return [\"b2935\", \"b0723\", \"b0451\"]",
"def gene(self, idx):\r\n return self.genes[idx]",
"def G(self):\n return self._properties['G']",
"def genres(self):\n if \"genres\" in self._prop_dict:\n return self._prop_dict[\"genres\"]\n else:\n ... | [
"0.6060225",
"0.60602057",
"0.598353",
"0.5891596",
"0.5854243",
"0.5854243",
"0.58437705",
"0.5838291",
"0.58079755",
"0.58079755",
"0.5725381",
"0.5688497",
"0.5665119",
"0.5653446",
"0.56409246",
"0.560487",
"0.55763316",
"0.55609643",
"0.55455524",
"0.5544166",
"0.5538799... | 0.70825785 | 0 |
r""" Return the degree of the constellation. The degree of a constellation is the number `n` that corresponds to the symmetric group `S(n)` in which the permutations of the constellation are defined. | def degree(self):
return self.parent()._degree | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def degree(self, k):\n one_if_my_all_k = 1 if self.my_alll(k) else 0\n return (2 * self.get_prp_j(k)[0]) + one_if_my_all_k",
"def degree( self, n ):\n return len(self._G.neighbors(n))",
"def _degree_of_polarization(S):\n if S[0] == 0:\n return 0\n return np.sqrt(S[1]**2+S[2]**... | [
"0.6643592",
"0.6554146",
"0.6500712",
"0.6490105",
"0.6412964",
"0.6292619",
"0.62736607",
"0.6261276",
"0.6229872",
"0.6221745",
"0.6049977",
"0.6046254",
"0.6046254",
"0.6046254",
"0.6044987",
"0.5955894",
"0.59387827",
"0.59346795",
"0.59346795",
"0.59041977",
"0.57822615... | 0.59288895 | 19 |
r""" Return the profile of ``self``. The profile of a constellation is the tuple of partitions associated to the conjugacy classes of the permutations of the constellation. This is also called the passport. | def profile(self, i=None):
if i is None:
return tuple(self.profile(j) for j in range(self.length()))
else:
parts = [len(cy) for cy in self._g[i].cycle_tuples(True)]
return Partition(sorted(parts, reverse=True)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile(self):\n\n def _flatten(f):\n return [coeffifient for value in f.values()\\\n for coeffifient in value.coefficients()]\n\n elements = _flatten(self.domain().j) +\\\n _flatten(self.codomain().j) +\\\n _flatten(self)\n\n\n profile = env... | [
"0.7290075",
"0.6533272",
"0.6533272",
"0.6500473",
"0.6481984",
"0.6403248",
"0.6206054",
"0.6110937",
"0.60901266",
"0.5973097",
"0.59630865",
"0.5879019",
"0.58383894",
"0.58383894",
"0.5825291",
"0.5774235",
"0.57059985",
"0.5673895",
"0.5646577",
"0.5636422",
"0.56289375... | 0.61175925 | 7 |
r""" Return the permutation `g_i` of the constellation. | def g(self, i=None):
from copy import copy
if i is None:
return copy(self._g)
else:
gi = self._g[i]
return gi.parent()(gi) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def G_permutation(self, W):\n Wsh = W.get_shape().as_list()\n cayley = self.cayleytable\n U = []\n for i in range(24):\n perm_mat = self.get_permutation_matrix(cayley, i)\n w = W[:,:,:,:,:,:,i]\n w = tf.transpose(w, [0,1,2,3,5,4])\n w = tf.res... | [
"0.67287",
"0.6150917",
"0.5887132",
"0.5703429",
"0.5688113",
"0.56630045",
"0.5624985",
"0.56176496",
"0.5595301",
"0.5552057",
"0.5536241",
"0.5527577",
"0.55212027",
"0.5504064",
"0.5490653",
"0.54765654",
"0.54647994",
"0.5449945",
"0.5428851",
"0.5411907",
"0.5409807",
... | 0.55283064 | 11 |
Iterator over all constellations of given degree and length. | def __iter__(self):
from itertools import product
if self._length == 1:
if self._degree == 1:
yield self([[0]])
return
S = self._sym
for p in product(S, repeat=self._length - 1):
if self._connected and not perms_are_connected(p, self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for i in range(len(self.ks)):\n yield self.get_neighs([i]), self.get_sp_rel_pos([i]),\\\n [self.ks[i]], self.iss",
"def elements(self, degree):\r\n \r\n elements = []\r\n darts = set(self.darts())\r\n\r\n list_of_alpha_value = ran... | [
"0.5840303",
"0.5709773",
"0.568631",
"0.5642443",
"0.55471396",
"0.5542346",
"0.5496706",
"0.54941493",
"0.54905415",
"0.54516786",
"0.5417595",
"0.540483",
"0.53563493",
"0.5346115",
"0.5343145",
"0.5294001",
"0.5267207",
"0.52572596",
"0.5229214",
"0.5209834",
"0.5173835",... | 0.5743113 | 1 |
Drop collection if it exists. | def drop_collection(self, db_name: str = None, collection_name: str = None, **kwargs) -> bool:
db: Database = self.db if db_name is None else self.client[db_name]
coll: Collection = self.coll if collection_name is None else db[collection_name]
if(coll.name in db.list_collection_names()):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_collection(self, collection):\n self.database.drop_collection(collection)",
"def remove_collection(cls, collection_name):\n cls.log.debug('Removing collection: {}'.format(collection_name))\n cls.conn[cls.DATABASE_NAME][collection_name].drop()\n cls.log.info('Collection succes... | [
"0.79765016",
"0.7429648",
"0.7095391",
"0.66072655",
"0.660125",
"0.65903586",
"0.6577248",
"0.65324676",
"0.6467471",
"0.64559305",
"0.6452855",
"0.6444502",
"0.6412875",
"0.64091974",
"0.6406886",
"0.61746615",
"0.6164482",
"0.61408913",
"0.61309135",
"0.61051005",
"0.5991... | 0.75118566 | 1 |
Return a custom 404 error. | def page_not_found(e):
return 'Sorry, nothing at this URL.', 404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found():\n return HttpError(404)",
"def error_404(error):\n return '404 Error'",
"def error_404(error):\n return 'Bummer, there is nothing at this URL.'",
"def error_not_found(error):\n return 'No page here, dood. 404!', 404",
"def not_found(self, error):\n return jsonify({'error': 'NO... | [
"0.81159586",
"0.80410045",
"0.7738874",
"0.77369535",
"0.77182025",
"0.7689595",
"0.7670471",
"0.76112473",
"0.7602477",
"0.7570698",
"0.75528365",
"0.7545827",
"0.751882",
"0.74745256",
"0.7458403",
"0.7455682",
"0.74548143",
"0.74505144",
"0.7442062",
"0.7428278",
"0.74065... | 0.72672606 | 34 |
Overrides the list method to get all articles | def list(self, request):
queryset = Article.objects.all()
serializer_context = {'request': request}
page = self.paginate_queryset(queryset)
serializer = self.serializer_class(
page,
context=serializer_context,
many=True
)
output = self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list():\r\n articles = []\r\n if request.method == 'GET':\r\n # Get all articles\r\n response = table.scan()\r\n articles = response.get('Items')\r\n\r\n return render_template('article/articles.html', articles=articles, title='List Articles')",
"def articles(self):\n ret... | [
"0.8153018",
"0.78935546",
"0.7866161",
"0.7855109",
"0.773087",
"0.759292",
"0.7509773",
"0.7423594",
"0.73636776",
"0.73286885",
"0.7023938",
"0.6991687",
"0.6953285",
"0.6938244",
"0.6904753",
"0.68493533",
"0.68246543",
"0.6767677",
"0.675045",
"0.6746897",
"0.6728936",
... | 0.7819919 | 4 |
Ensure all months were found | def test_found_all_months(self):
ary = self.ar[2009]
self.assertEqual(ary.months, [11,12]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_iter_all_months(self):\n ary = self.ar[2009]\n self.assertEqual([arm.month for arm in ary], [11,12])",
"def test_all_valid_months(self):\n\n for expected, month in enumerate(range(1, 12), 2):\n actual = self.expander.get_next_month(month)\n self.assertEqual(exp... | [
"0.7435198",
"0.741321",
"0.72674966",
"0.66813445",
"0.66769683",
"0.66602445",
"0.6584554",
"0.65477747",
"0.65444785",
"0.6527775",
"0.6511594",
"0.6503141",
"0.63049865",
"0.6303601",
"0.6270493",
"0.62528765",
"0.6175067",
"0.6160518",
"0.61507237",
"0.6081394",
"0.60449... | 0.7632666 | 0 |
This function prints and plots the confusion matrix. Normalization can be applied by setting `normalize=True`. | def plot_confusion_matrix(cm, classes,
normalize=False,
title='Confusion matrix',
cmap=plt.cm.Blues):
import itertools
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
print("Normalized confusion ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n... | [
"0.81922984",
"0.80933887",
"0.80272716",
"0.8016492",
"0.79913706",
"0.79885876",
"0.79777396",
"0.79729784",
"0.7958926",
"0.7954523",
"0.79347897",
"0.7931899",
"0.7931772",
"0.7928666",
"0.7923684",
"0.7921764",
"0.79213995",
"0.7920191",
"0.792016",
"0.7919876",
"0.79153... | 0.0 | -1 |
Check if user is course staff. | def is_course_staff(self):
# pylint: disable=no-member
return getattr(self.xmodule_runtime, 'user_is_staff', False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_staff(self):\n # Simplest possible answer: All admins are staff\n return self.is_admin",
"def is_staff(self):\n # Simplest possible answer: All admins are staff\n return self.is_admin",
"def is_staff(self):\n # Simplest possible answer: All admins are staff\n re... | [
"0.7812888",
"0.7812888",
"0.7812888",
"0.77043736",
"0.75808585",
"0.74982476",
"0.74982476",
"0.74835616",
"0.7433671",
"0.7433608",
"0.7419011",
"0.7370185",
"0.7277466",
"0.7176093",
"0.7100349",
"0.70355904",
"0.69785076",
"0.6971723",
"0.69194937",
"0.68560183",
"0.6839... | 0.8251043 | 1 |
Check if user role is instructor. | def is_instructor(self):
# pylint: disable=no-member
return self.xmodule_runtime.get_user_role() == 'instructor' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_instructor(self):\n return bool(LTI_ROLES[INSTRUCTOR] & self.roles)",
"def test_user_role_instructor(self):\r\n self.assertEqual(\r\n 'instructor',\r\n access.get_user_role(self.course_instructor, self.course_key)\r\n )\r\n # Masquerade instructor\r\n ... | [
"0.8229154",
"0.80855906",
"0.76690066",
"0.743809",
"0.6934937",
"0.68856174",
"0.68823963",
"0.68345535",
"0.6777783",
"0.67101526",
"0.6564345",
"0.651139",
"0.6504513",
"0.64901537",
"0.6472167",
"0.64069164",
"0.63845605",
"0.63611573",
"0.6316969",
"0.63070035",
"0.6298... | 0.8304061 | 0 |
Set the video url and thumbnail url from Kulu Valley. We first call a KV api to get the mp4/hls url. Calling with 'kulu_id' = '' deletes existing video. | def set_video_id(self, data, suffix=''):
kulu_id = data['kulu_id']
def studentVideoData():
return {
'video_mp4_url': none_to_empty(self.video_mp4_url),
'video_hls_url': none_to_empty(self.video_hls_url),
'video_thumbnail_url': self.video_thumb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_video_urls(self, kulu_id, retry=True):\n mp4_url = None\n hls_url = None\n if (kulu_id):\n def fetch_kulu_urls(kulu_id):\n mp4_url = None\n hls_url = None\n kulu_valley_kulus_url = \"https://imd.kuluvalley.com/api/2.1/rest/kulus/\... | [
"0.6160896",
"0.6141144",
"0.5943396",
"0.59220606",
"0.587498",
"0.5847446",
"0.57661587",
"0.5741027",
"0.5693852",
"0.5692398",
"0.56496",
"0.5589736",
"0.5558275",
"0.54962265",
"0.5485665",
"0.54696524",
"0.54669696",
"0.5452187",
"0.54437584",
"0.5406843",
"0.5399361",
... | 0.6809097 | 0 |
Mark the assignment as done for a this student. | def mark_as_done(self):
grade_event = {'value': self.points, 'max_value': self.points}
self.runtime.publish(self, 'grade', grade_event) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subjectDone(self, subject):\n self._serialized[subject] = True",
"def mark_as_done(self):\n self.status = \"DONE\"",
"def mark_as_done(self, task):\n raise NotImplementedError('')",
"def action_set_done(self):\n self.ensure_one()\n self.write({\"state\": \"done\"})\n ... | [
"0.63143384",
"0.6287947",
"0.62783206",
"0.5814581",
"0.58060694",
"0.5748234",
"0.57456166",
"0.57456166",
"0.57456166",
"0.5666484",
"0.5602084",
"0.5598528",
"0.55672514",
"0.55634844",
"0.5512992",
"0.548863",
"0.548863",
"0.53646314",
"0.535736",
"0.530437",
"0.52867836... | 0.6171663 | 3 |
Get current date and time in UTC. | def nowUTC():
return datetime.datetime.now(pytz.utc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_utc_now():\n return datetime.datetime.utcnow().replace(tzinfo=pytz.timezone(\"UTC\"))",
"def currentUTC():\n return str(datetime.utcnow())",
"def utc_now():\n return datetime.now(tz=timezone.utc)",
"def now_utc() -> datetime:\n return datetime.now(timezone.utc)",
"def utc_now():\n real... | [
"0.7977052",
"0.7973361",
"0.79039377",
"0.7867884",
"0.7760147",
"0.7717462",
"0.76961374",
"0.7683743",
"0.75971127",
"0.75816166",
"0.75357926",
"0.75291264",
"0.75291264",
"0.75020146",
"0.7498298",
"0.7488854",
"0.74866146",
"0.742559",
"0.74225163",
"0.7386496",
"0.7383... | 0.8204733 | 0 |
Rounds a tensor whose values are in [0,1] to a tensor with values in {0, 1}, using the straight through estimator for the gradient. | def binary_round(x):
g = tf.get_default_graph()
with ops.name_scope("BinaryRound") as name:
with g.gradient_override_map({"Round": "Identity"}):
return tf.round(x, name=name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_gradient_to_tensor(x):\n return x",
"def one_hot_round(x): \n g = tf.get_default_graph()\n\n with g.gradient_override_map({\"Log\": \"Identity\"}): \n x = tf.log(x)\n x = 1e4 * x\n with g.gradient_override_map({\"Identity\": \"CustomGrad\"}):\n x = tf.identity(x, na... | [
"0.6640717",
"0.6213459",
"0.612682",
"0.6091711",
"0.60450894",
"0.6001786",
"0.59331554",
"0.58702356",
"0.58492017",
"0.5846758",
"0.58314395",
"0.5821055",
"0.5817605",
"0.57962924",
"0.5685072",
"0.5631543",
"0.56260675",
"0.5625001",
"0.55630875",
"0.5519944",
"0.549344... | 0.57825404 | 14 |
Rounds a tensor whose values are in [0,1] to a tensor with values in {0, 1}, using the straight through estimator for the gradient. | def one_hot_round(x):
g = tf.get_default_graph()
with g.gradient_override_map({"Log": "Identity"}):
x = tf.log(x)
x = 1e4 * x
with g.gradient_override_map({"Identity": "CustomGrad"}):
x = tf.identity(x, name="Identity")
with g.gradient_override_map({"Softmax": "Identity"}):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_gradient_to_tensor(x):\n return x",
"def _clip_0to1_warn(tensor_0to1):\n msg = \"Some values outside [0, 1], so clipping happened\"\n if isinstance(tensor_0to1, tf.Tensor):\n if tf.reduce_min(tensor_0to1) < 0 or tf.reduce_max(tensor_0to1) > 1:\n logger.debug(msg)\n ... | [
"0.66395307",
"0.61258894",
"0.6092261",
"0.60424596",
"0.60015225",
"0.59311134",
"0.5871849",
"0.5848265",
"0.5844342",
"0.58283174",
"0.58186597",
"0.58166295",
"0.5793238",
"0.5784018",
"0.56837785",
"0.56308585",
"0.56247044",
"0.5623522",
"0.5560255",
"0.5516721",
"0.54... | 0.6213325 | 1 |
Converts a 2D point to a 3D pose in the XY plane including rotation being tangent to the path | def point2D_2_pose(point, tangent):
return transl(point.x, point.y, 0)*rotz(tangent.angle()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_point(self, point: Point3D) -> Point3D:\n x, y, z = point\n cam_x, cam_y, cam_z = self._pos\n x -= cam_x\n y -= cam_y\n z -= cam_z\n dx = self._cy*(self._sz*y + self._cz*x) - self._sy*z\n dy = self._sx*(self._sy*(self._sz*y + self._cz*x) + self._cy*z) + ... | [
"0.7342222",
"0.700183",
"0.67462987",
"0.6689601",
"0.65957445",
"0.6510016",
"0.65098464",
"0.63813823",
"0.63400126",
"0.63054836",
"0.6097757",
"0.608902",
"0.6033613",
"0.6030715",
"0.5989176",
"0.5978964",
"0.5951556",
"0.5938445",
"0.5923447",
"0.5912586",
"0.5910447",... | 0.6675463 | 4 |
Given two means +/ CIs return True if they do NOT overlap. | def do_mean_cis_differ(mean1, ci1, mean2, ci2):
assert ci1 >= 0.0 and ci2 >= 0.0, 'Found negative confidence interval from bootstrapping.'
x1 = mean1 - ci1
y1 = mean1 + ci1
x2 = mean2 - ci2
y2 = mean2 + ci2
return do_intervals_differ((x1, y1), (x2, y2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _overlapping(self, atom1, atom2):\n\n if np.linalg.norm(atom1.pos-atom2.pos) < (atom1.rad+atom2.rad):\n return True\n else:\n return False",
"def _overlap(x1, w1, x2, w2):\r\n if x1+w1 < x2-w2: return False\r\n if x1-w1 > x2+w2: return False\r\n\r\n return True",
"def... | [
"0.6744992",
"0.65211433",
"0.6472582",
"0.64701766",
"0.6415023",
"0.63862205",
"0.6350856",
"0.63217103",
"0.631138",
"0.6227721",
"0.62166584",
"0.6205302",
"0.6167926",
"0.61130357",
"0.6106148",
"0.6085412",
"0.603488",
"0.6021987",
"0.602061",
"0.5984093",
"0.59680265",... | 0.6075713 | 16 |
Return True if all pexecs in a detailed classification dict are 'no steady state'. | def all_nss(classifications):
return (classifications['warmup'] == 0 and classifications['slowdown'] == 0 and
classifications['flat'] == 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def any_nss(classifications):\n\n return classifications['no steady state'] > 0",
"def all_flat(classifications):\n\n return (classifications['warmup'] == 0 and classifications['slowdown'] == 0\n and classifications['no steady state'] == 0)",
"def all_is_stopped(self):\r\n return all(no... | [
"0.762411",
"0.6539862",
"0.62332046",
"0.6231461",
"0.60690296",
"0.6060528",
"0.6052441",
"0.60428137",
"0.5957794",
"0.59479433",
"0.59453076",
"0.5896173",
"0.58896697",
"0.5853992",
"0.58524144",
"0.58216655",
"0.5814278",
"0.5814082",
"0.57616687",
"0.57366985",
"0.5729... | 0.670616 | 1 |
Return True if any pexec in a detailed classification dict is 'no steady state'. | def any_nss(classifications):
return classifications['no steady state'] > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_nss(classifications):\n\n return (classifications['warmup'] == 0 and classifications['slowdown'] == 0 and\n classifications['flat'] == 0)",
"def all_flat(classifications):\n\n return (classifications['warmup'] == 0 and classifications['slowdown'] == 0\n and classifications['no... | [
"0.6504176",
"0.6281875",
"0.6127798",
"0.6064117",
"0.6001149",
"0.5946058",
"0.59368294",
"0.5900736",
"0.58576006",
"0.58486515",
"0.5843609",
"0.58285344",
"0.5816433",
"0.57958907",
"0.57880586",
"0.5783659",
"0.57649934",
"0.5759076",
"0.5750961",
"0.5743338",
"0.573075... | 0.76184374 | 0 |
Checks if a file is an allowed image extension. | def is_image_file(filename, extensions):
return filename.lower().endswith(extensions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_file(filename):\n return '.' in filename and \\\n\t filename.rsplit('.', 1)[1] in ALLOWED_IMAGE_EXTENSIONS",
"def allowed_image(filename):\n \n if not '.' in filename:\n return False\n \n ext = filename.rsplit('.', 1)[1]\n \n if ext.lower() in ALLOWED_IMAGE_EXTENSIONS:\n ... | [
"0.8669711",
"0.8491734",
"0.8285595",
"0.8164902",
"0.808807",
"0.8079307",
"0.8010739",
"0.8007056",
"0.7972675",
"0.7958227",
"0.7957102",
"0.79055774",
"0.7892396",
"0.78922427",
"0.7851082",
"0.7851082",
"0.7851082",
"0.7851082",
"0.7851082",
"0.7851082",
"0.7843634",
... | 0.81652546 | 3 |
Returns the total number of items in the container. Returns | def __len__(self):
return self.count_of(CUBA.NODE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def items_count(self):\n return len(self.items)",
"def get_num_items(self):\r\n return self.num_items",
"def size(self) -> int:\n return self.num_items",
"def items_num(self):\n return len(self.items)",
"def items_num(self):\n\t\treturn len(self.items)",
"def items_num(self):\... | [
"0.8285695",
"0.8251955",
"0.81169397",
"0.81011933",
"0.8096166",
"0.8096166",
"0.7995818",
"0.7971186",
"0.78586584",
"0.7823772",
"0.78142947",
"0.78142947",
"0.78142947",
"0.78142947",
"0.78142947",
"0.7783246",
"0.7762027",
"0.7759762",
"0.775441",
"0.7717325",
"0.770322... | 0.0 | -1 |
given a sklearn confusion matrix (cm), make a nice plot Arguments | def plot_confusion_matrix(cm,
target_names,
title='Confusion matrix',
cmap=None,
normalize=True,
save_as_file=None):
import matplotlib.pyplot as plt
import numpy as np
im... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_... | [
"0.7998953",
"0.79943913",
"0.7946874",
"0.79344404",
"0.79131955",
"0.7896219",
"0.78781104",
"0.78595",
"0.78595",
"0.78530246",
"0.7848679",
"0.78483564",
"0.78388304",
"0.7833984",
"0.7827247",
"0.7823944",
"0.78033894",
"0.7800449",
"0.7780714",
"0.77779824",
"0.77747816... | 0.0 | -1 |
For a given point on the track, get the direction of travel a unit vector | def direction(self, segment_index, t):
return self.segments[segment_index].direction(t) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_direction_vector(line):\n pt1, pt2 = line\n pt1 = np.array(pt1).reshape(2,)\n pt2 = np.array(pt2).reshape(2,)\n direct = pt2 - pt1\n direct_norm = normalize(direct)\n return direct_norm",
"def direction(point0, point1):\n d = [0, 0, 0]\n vector = [point1[0] - point0[0], point1[1]... | [
"0.7077104",
"0.70212084",
"0.6645603",
"0.66404146",
"0.6633019",
"0.6583143",
"0.6493118",
"0.6486818",
"0.63921815",
"0.6384645",
"0.6288176",
"0.62692744",
"0.6268733",
"0.6216227",
"0.6212832",
"0.61881405",
"0.61865866",
"0.61588264",
"0.6143655",
"0.6065213",
"0.606516... | 0.6032815 | 22 |
Creates a single csv file containing all the enhanced data | def merge(parent_folder):
parent_folder = Path(parent_folder)
address_csv_files = sorted(parent_folder.glob('*_step_*.csv'))
frames = []
#: read all csv's delimiter='|', quoting=csv.QUOTE_MINIMAL
for address_csv_file in address_csv_files:
temp = pd.read_csv(
address_csv_file, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_csv(self):\n with open(self.__csv_file_name, 'w', newline='', encoding='utf-8') as csv_file:\n writer = csv.DictWriter(csv_file, fieldnames=self.__csv_fields, delimiter=';')\n writer.writeheader()",
"def file(self):\n result = []\n completePath = CompleteP... | [
"0.7304333",
"0.72596985",
"0.72459936",
"0.7137571",
"0.70768213",
"0.70081866",
"0.7004889",
"0.69858706",
"0.69794446",
"0.6953722",
"0.69531065",
"0.6901506",
"0.6834578",
"0.6832981",
"0.6819997",
"0.68154514",
"0.68150836",
"0.6812106",
"0.6781125",
"0.67678154",
"0.676... | 0.0 | -1 |
GET /orgunittypes/ without auth or app id should result in a 200 empty response | def test_org_unit_types_list_without_auth_or_app_id(self):
response = self.client.get("/api/orgunittypes/")
self.assertJSONResponse(response, 200)
self.assertValidOrgUnitTypeListData(response.json(), 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_org_unit_types_retrieve_without_auth_or_app_id(self):\n\n response = self.client.get(f\"/api/orgunittypes/{self.org_unit_type_1.id}/\")\n self.assertJSONResponse(response, 404)",
"def test_org_unit_types_retrieve_ok(self):\n\n self.client.force_authenticate(self.jane)\n respo... | [
"0.87519795",
"0.7420495",
"0.69041955",
"0.6516785",
"0.61798966",
"0.6130988",
"0.61043733",
"0.61042553",
"0.60826296",
"0.5991248",
"0.5978981",
"0.596227",
"0.59595525",
"0.5948186",
"0.5926202",
"0.58903813",
"0.5885066",
"0.5870741",
"0.5850269",
"0.58145046",
"0.57778... | 0.7984175 | 1 |
GET /orgunittypes/ without auth or app id should result in a 200 empty response | def test_org_unit_types_list_with_auth(self):
self.client.force_authenticate(self.jane)
response = self.client.get("/api/orgunittypes/")
self.assertJSONResponse(response, 200)
response_data = response.json()
self.assertValidOrgUnitTypeListData(response_data, 2)
for org_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_org_unit_types_retrieve_without_auth_or_app_id(self):\n\n response = self.client.get(f\"/api/orgunittypes/{self.org_unit_type_1.id}/\")\n self.assertJSONResponse(response, 404)",
"def test_org_unit_types_list_without_auth_or_app_id(self):\n\n response = self.client.get(\"/api/orguni... | [
"0.87517565",
"0.7983601",
"0.7420666",
"0.6517214",
"0.6179711",
"0.6130727",
"0.61053693",
"0.6104676",
"0.6082634",
"0.59919316",
"0.59794647",
"0.5962089",
"0.5959578",
"0.5947949",
"0.59261703",
"0.5890904",
"0.58858436",
"0.5870298",
"0.5850647",
"0.58160657",
"0.577890... | 0.69041115 | 3 |
GET /orgunittypes// without auth or app id should result in a 200 empty response | def test_org_unit_types_retrieve_without_auth_or_app_id(self):
response = self.client.get(f"/api/orgunittypes/{self.org_unit_type_1.id}/")
self.assertJSONResponse(response, 404) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_org_unit_types_list_without_auth_or_app_id(self):\n\n response = self.client.get(\"/api/orgunittypes/\")\n self.assertJSONResponse(response, 200)\n self.assertValidOrgUnitTypeListData(response.json(), 0)",
"def test_org_unit_types_retrieve_ok(self):\n\n self.client.force_auth... | [
"0.7917087",
"0.7496427",
"0.68529516",
"0.6351911",
"0.6267484",
"0.6165139",
"0.61551106",
"0.59798086",
"0.59788877",
"0.5970946",
"0.59020483",
"0.5862904",
"0.5849123",
"0.5816277",
"0.57916224",
"0.5763007",
"0.5753423",
"0.5751714",
"0.5744749",
"0.57144815",
"0.571267... | 0.872766 | 0 |
Convert the list of off times to a list containing the off and now on periods, which are deduced from the off times. This should be the list after it has been collapsed. Output list will contain a status, on or off. | def process_to_on_off(list_dt_dt):
output_list = []
list_iter = iter(list_dt_dt)
# put the first row in the output_list - this is always off
first_row = next(list_iter)
previous_time_off_start = first_row[0]
previous_time_off_end = first_row[1]
output_list.append([previous_time_off_start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_on_off(self):\n self.laser_off = []\n self.laser_on = []\n\n self.laser_off.append(\n (0+self.time_to_number(self.skip['bcg_start']), self.starts[0]-self.time_to_number(self.skip['bcg_end'])))\n\n for i in range(len(self.starts)-1):\n self.laser_off.appe... | [
"0.5942776",
"0.58838075",
"0.5232749",
"0.5215545",
"0.50533724",
"0.5045575",
"0.50441617",
"0.50100267",
"0.49974123",
"0.4977477",
"0.49657625",
"0.4947541",
"0.488322",
"0.48574734",
"0.48308867",
"0.48288673",
"0.4811619",
"0.4808722",
"0.48032254",
"0.47492984",
"0.474... | 0.7695517 | 0 |
Get the date in DDDDMMYY format | def get_date(fmt="%Y-%m-%d"):
now = datetime.datetime.now().replace(tzinfo=IST)
return now.strftime(fmt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_date(self):\n return self.date.strftime(\"%a %x\")",
"def _calculate_date(day_of_year):\n date = datetime.datetime.strptime(str(day_of_year), '%j')\n return date.strftime('%d-%b')",
"def Date(self):\n return \"%s/%2.2d/%2.2d\" % (self._year, self._month, self._day)",
"def ... | [
"0.72058445",
"0.7066212",
"0.6975212",
"0.6898036",
"0.6880251",
"0.68269366",
"0.68058187",
"0.6788389",
"0.6783534",
"0.6781108",
"0.67280906",
"0.67056924",
"0.6695071",
"0.6661497",
"0.66282374",
"0.657951",
"0.65632385",
"0.6553971",
"0.65417117",
"0.6537841",
"0.652982... | 0.5996205 | 84 |
Add warmup decay to a learning rate schedule. | def __init__(
self,
lr_schedule: tf.keras.optimizers.schedules.LearningRateSchedule,
warmup_steps: int,
**kwargs):
super(WarmupDecaySchedule, self).__init__()
self._lr_schedule = lr_schedule
self._warmup_steps = warmup_steps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjust_learning_rate(optimizer, epoch, lr, schedule, gamma, num_gpus=1, warmup=5):\n if epoch in schedule:\n lr *= gamma\n if num_gpus > 1 and epoch < warmup:\n param_lr = lr * (epoch + 1) / warmup\n else:\n param_lr = lr\n for param_group in optimizer.param... | [
"0.7005632",
"0.6841199",
"0.67021495",
"0.668435",
"0.66736406",
"0.66736406",
"0.66681194",
"0.66065794",
"0.6517671",
"0.6463484",
"0.63832265",
"0.6369079",
"0.63663036",
"0.63535094",
"0.6343438",
"0.6340109",
"0.6324249",
"0.63002986",
"0.6272357",
"0.62689996",
"0.6240... | 0.72938305 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.