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 |
|---|---|---|---|---|---|---|
Check if any aliens have reached the bottom of the screen. | def checkAliensBottom(self):
screen_rect = self.screen.get_rect()
for alien in self.aliens.sprites():
if alien.rect.bottom >= screen_rect.bottom:
# Treat this the same as if the ship got hit.
self.shipHit()
break | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_aliens_bottom(self):\r\n\t\tscreen_rect = self.screen.get_rect()\r\n\t\tfor alien in self.aliens.sprites():\r\n\t\t\tif alien.rect.bottom >= screen_rect.bottom:\r\n\t\t\t\t#Como si chocara con la nave\r\n\t\t\t\tself._ship_hit()\r\n\t\t\t\tbreak",
"def _check_aliens_bottom(self):\n screen_rect ... | [
"0.8488546",
"0.8473649",
"0.84619975",
"0.8367438",
"0.80122244",
"0.80105305",
"0.79310024",
"0.7918591",
"0.78627837",
"0.7842704",
"0.77384675",
"0.7731643",
"0.76686",
"0.76563096",
"0.73064303",
"0.6988001",
"0.6976528",
"0.69500667",
"0.6706509",
"0.6619164",
"0.660234... | 0.86179876 | 0 |
Update position of bullets and get rid of old bullets. | def updateBullets(self):
# Update bullet positions.
self.bullets.update()
# Get rid of bullets that have disappeared.
for bullet in self.bullets.copy():
if bullet.rect.bottom <= 0:
self.bullets.remove(bullet)
self.checkBulletAlienCollisions() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_bullet(bullets):\n # Update bullet position\n bullets.update()\n\n # Delete bullets that have left the screen\n for bullet in bullets.copy():\n if bullet.rect.bottom <= 0:\n bullets.remove(bullet)",
"def update_bullets(bullets):\n bullets.update()\n # Delete bullets... | [
"0.8366198",
"0.8306891",
"0.8240365",
"0.8236856",
"0.81564134",
"0.8137091",
"0.8014817",
"0.7964732",
"0.7941751",
"0.79167974",
"0.7790724",
"0.7753283",
"0.77334625",
"0.7705732",
"0.7663166",
"0.765421",
"0.76291376",
"0.7473674",
"0.7436289",
"0.742098",
"0.7281851",
... | 0.8328425 | 1 |
Retrieve, update or delete user. | def user_detail(request, pk):
try:
user = User.objects.get(pk=pk)
except User.DoesNotExist:
return Response(status=status.HTTP_404_NOT_FOUND)
if request.method == 'GET':
serializer = UserSerializer(user)
return Response(serializer.data)
elif request.method == 'PUT':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user(self, id):\r\n return self.get('/users/%s' % id)",
"async def get_user(self):\n user = self.user = await self._state.db.get_user(self.user_id)\n return user",
"def get_user(self, user_id):\r\n try:\r\n return model.User.objects.get(pk=user_id)\r\n except m... | [
"0.69920206",
"0.6823553",
"0.6795066",
"0.67897797",
"0.6766995",
"0.6766995",
"0.6754909",
"0.6739709",
"0.67229664",
"0.670544",
"0.670544",
"0.670544",
"0.66601515",
"0.663745",
"0.662857",
"0.6620256",
"0.66090673",
"0.65735793",
"0.6555085",
"0.653058",
"0.6515244",
"... | 0.64289725 | 30 |
Returns a Google Cloud IOT Core Client ID. | def client_id(self):
client_id = "projects/{0}/locations/{1}/registries/{2}/devices/{3}".format(
self._proj_id, self._region, self._reg_id, self._device_id
)
if self._logger:
self._logger.debug("Client ID: {}".format(client_id))
return client_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id\")",
"def client_id(self) -> str:\n return pulumi.get(self, \"client_id... | [
"0.7485748",
"0.7485748",
"0.7485748",
"0.7485748",
"0.7485748",
"0.7485748",
"0.7485748",
"0.7485748",
"0.7485748",
"0.7485748",
"0.7485748",
"0.74851006",
"0.74851006",
"0.74851006",
"0.74851006",
"0.74851006",
"0.74851006",
"0.74851006",
"0.74851006",
"0.74851006",
"0.7485... | 0.0 | -1 |
Initialize a lattice Site object. | def __init__(self, number, coordinates, neighbors, energy, label):
self.number = number
self.index = Site.index
Site.index += 1
self.r = coordinates
self.neighbors = neighbors
self.p_neighbors = None # ptr to neighboring sites. init in Lattice
self.energy = ene... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, site=None):\n\t\tself.site = site or \"\"",
"def __init__(self, lattice, species, coords, validate_proximity=False,\n to_unit_cell=False, coords_are_cartesian=False,\n site_properties=None,site_properties_T=None,\n intensive_properties={}, extens... | [
"0.68991894",
"0.6778182",
"0.6628411",
"0.6593019",
"0.6474963",
"0.63701075",
"0.6291886",
"0.62870157",
"0.62859476",
"0.6194497",
"0.6111503",
"0.6064306",
"0.6024401",
"0.58707803",
"0.5718276",
"0.5712671",
"0.5711831",
"0.5710909",
"0.56814843",
"0.564099",
"0.5622651"... | 0.6433468 | 5 |
Generate random date between 2010 and today using specific format | def create_random_date():
start_date = datetime.date(2010, 1, 1)
end_date = datetime.date.today()
random_date = start_date + (end_date - start_date) * random.random()
return random_date.strftime('%m/%d/%Y') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_date():\n start = date(2010, 1, 1)\n end = date.today()\n\n chosen = start + (end - start) * random.random()\n\n return chosen.strftime(\"%m/%d/%Y\")",
"def random_date():\n year = random.choice(range(2015, 2016))\n month = random.choice(range(1, 13))\n day = random.choice(range(1... | [
"0.8503615",
"0.80301815",
"0.79501253",
"0.791459",
"0.7880832",
"0.78268313",
"0.74753726",
"0.74149305",
"0.73795956",
"0.7354244",
"0.7278721",
"0.7231835",
"0.7167365",
"0.71610516",
"0.7019311",
"0.7019311",
"0.70020115",
"0.69885874",
"0.6941494",
"0.68840784",
"0.6874... | 0.8299801 | 1 |
Initialize this LinkedListNode with the value value and successor next. >>> LinkedListNode(3).value 3 >>> LinkedListNode(3).next_ is None True | def __init__(self, value: object,
next_: Union["LinkedListNode", None] = None) -> None:
self.value = value
self.next_ = next_ | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, value: object,\n next_: Union[\"LinkedListNode\", None]=None) -> None:\n self.value, self.next_ = value, next_",
"def __init__(self, value, next=None):\n self.value = value # element at the node\n self.next = next # reference to next node in the LinkedLis... | [
"0.80740577",
"0.78322124",
"0.7786118",
"0.76309055",
"0.7577981",
"0.7574804",
"0.7546185",
"0.7526892",
"0.7503487",
"0.74877274",
"0.7477526",
"0.7469108",
"0.7353831",
"0.7343284",
"0.7343284",
"0.7324829",
"0.71129394",
"0.7043182",
"0.693579",
"0.69224834",
"0.6920066"... | 0.79884654 | 1 |
Initialize an empty LinkedList. >>> lnk = LinkedList() >>> lnk.size 0 | def __init__(self) -> None:
self.front = None
self.back = None
self.size = 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self: 'LinkedList') -> None:\r\n self.first = _Node()\r\n self.size = 0",
"def __init__(self):\n self.head = Node(None)\n self.size = 0",
"def __init__(self):\n self.head = MyLinkedListNode()\n self.tail = MyLinkedListNode()\n \n self.head.ne... | [
"0.7808975",
"0.76168",
"0.74028337",
"0.7378319",
"0.73501486",
"0.7315317",
"0.7315317",
"0.7289054",
"0.7289054",
"0.7289054",
"0.7289054",
"0.7246531",
"0.721861",
"0.7217734",
"0.7189963",
"0.7185841",
"0.7185841",
"0.71023804",
"0.7088325",
"0.70882106",
"0.70707506",
... | 0.0 | -1 |
Swap the LinkedListNodes of the front and back of this linked list. Do not create any new LinkedListNodes. Do not swap the values of the LinkedListNodes. >>> lnk = LinkedList() >>> lnk.prepend(3) >>> lnk.prepend(2) >>> lnk.prepend(1) >>> print(lnk) 1 > 2 > 3 > | >>> front_id = id(lnk.front) >>> back_id = id(lnk.back) >... | def swap_front_back(self) -> None:
temp = self.front
prev = None
while temp:
nxt = temp.next_
temp.next_ = prev
prev = temp
temp = nxt
self.front, self.back = self.back, self.front | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swap(self, before_a, before_b):\n if before_a is None:\n a = self.head\n else:\n a = before_a.next_node\n if a == before_b: # ie the nodes are adjacent\n self.swap_adjacent(before_a)\n return self\n if before_a and before_a.next_node:\n ... | [
"0.6851487",
"0.67262185",
"0.64400995",
"0.64341307",
"0.6406376",
"0.6378823",
"0.63575685",
"0.62923044",
"0.62564695",
"0.6230522",
"0.61484",
"0.6110974",
"0.6049392",
"0.6005363",
"0.5974548",
"0.59246016",
"0.59158754",
"0.589267",
"0.5882481",
"0.58559704",
"0.5850026... | 0.83673614 | 0 |
Generates a generic 5 characterstring to use as an ID. | def create_id(n: int = 5):
return ''.join(random.choices(string.ascii_lowercase + string.digits, k=n)).lower() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_readable_id():\n return ''.join(random.choice(string.ascii_uppercase + string.digits)\n for x in range(8))",
"def get_id():\n return ''.join([random.choice(string.ascii_lowercase + string.digits) for k in range(8)])",
"def _generate_id() -> str:\n return ''.join(... | [
"0.8126953",
"0.8089159",
"0.7944686",
"0.77797484",
"0.7778982",
"0.7725308",
"0.7603004",
"0.75807655",
"0.7552945",
"0.75469124",
"0.75370216",
"0.7535625",
"0.7495168",
"0.7487086",
"0.7473722",
"0.74432105",
"0.74161446",
"0.7412783",
"0.7389266",
"0.7366736",
"0.7352795... | 0.7892254 | 3 |
Returns the value of a folded exponentials. Employs some domain checking for making the calculation. | def folded_fit_func(t, tz, w, k):
t = t - tz
if t < -5. * w:
return 0.
elif t < 5. * w:
#print -t/w + w*k/2., w, k, t
return np.exp(k * (w*w*k/4.0 - t)) * 0.5 * fast_erfc(-t / w + w*k/2.)
elif t > 5. * w:
return np.exp(k * (w * w * k / (4.0) - t)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _bounded_exp(value):\r\n try:\r\n return exp(value)\r\n except OverflowError:\r\n return float(\"inf\")",
"def exp(x):\n return np.e**x",
"def em(x):\n return math.exp(x)-1",
"def exponential(x):\n return K.exp(x)",
"def safe_exp(value):\r\n try:\r\n ans = math.exp(value)\r\n ex... | [
"0.7197267",
"0.6850665",
"0.67249143",
"0.67082447",
"0.67061096",
"0.6700342",
"0.6685023",
"0.6677596",
"0.64972085",
"0.6437557",
"0.6416297",
"0.6402265",
"0.6387121",
"0.63410914",
"0.629328",
"0.6284369",
"0.627613",
"0.623525",
"0.6233492",
"0.62271804",
"0.6170647",
... | 0.0 | -1 |
Returns the values of exponentials for given parameters. | def _exp(t_arr, w, tz, tau_arr):
rates = 1 / tau_arr[:, None, None]
if not tz == 0:
t_arr -= tz
return np.exp(-rates * t_arr.T[None, ...]).T | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _param_energies(p: BeatModelParams) -> Tuple[float, float]:\n return sample.sample.modal_energy(p[:2], p[4:6])",
"def exponential(x, a, b, n):\n if n < 1.000001:\n n = 1.000001\n elif n > 1.2:\n n = 1.2\n if b < -10:\n b = -10\n elif b > 10:\n b = 10\n if isinstanc... | [
"0.68394506",
"0.67231363",
"0.66183674",
"0.65704197",
"0.6563432",
"0.6526794",
"0.6370295",
"0.6340872",
"0.61377037",
"0.61104757",
"0.6071514",
"0.59603727",
"0.5925645",
"0.5901162",
"0.5890965",
"0.5859907",
"0.58535445",
"0.58455104",
"0.584459",
"0.5835696",
"0.57991... | 0.55015206 | 48 |
Checks if the data is an instance of numpy.ndarray and checks if match the given dimensions. | def check_dim(data, dim):
_check_ndarray(data)
if data.ndim is not dim:
msg = "Argument dimension mistmatch, expected " + dim + " dimensions"
raise TypeError(msg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_ndarray(data):\n if data.__class__ is not np.ndarray:\n raise TypeError(\"Argument of type numpy.ndarray expected\")",
"def is_ndarray(data_to_check):\n flag = False\n if isinstance(data_to_check, np.ndarray):\n flag = True\n return flag",
"def _check_input(data):\n T ... | [
"0.81180304",
"0.7661977",
"0.7140262",
"0.6932696",
"0.68835413",
"0.68825966",
"0.67269945",
"0.6721878",
"0.6682524",
"0.65983146",
"0.6485804",
"0.6472598",
"0.6438209",
"0.638101",
"0.63764143",
"0.6373128",
"0.63630426",
"0.63522893",
"0.6348968",
"0.63458496",
"0.63197... | 0.7524356 | 2 |
Create Lex instance of tornado.web.Application. | def create_app():
routes = [
URLSpec(r'/?', RootHandler),
URLSpec(r'/healthcheck/?', HealthcheckHandler),
URLSpec(r'/version/?', VersionHandler),
URLSpec(r'/recommendation/?', NewsHandler),
URLSpec(r'/docs/?(.*)', StaticFileHandler, {'path': options["template_path"], 'default... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_app():\n return tornado.web.Application([\n (r\"/metrics\", MetricsHandler),\n (r\"/toggle\", ToggleHandler),\n (r\"/\", MainHandler),\n ], debug=True)",
"def make_app():\n _LOGGER.info(\"Initializing Tornado Web App\")\n return tornado.web.Application([\n (r\"/pr... | [
"0.7039867",
"0.6808978",
"0.66417676",
"0.6601607",
"0.6444447",
"0.640408",
"0.6320578",
"0.62331504",
"0.61274874",
"0.61132663",
"0.6107155",
"0.6071404",
"0.60517067",
"0.5975964",
"0.59400284",
"0.5914429",
"0.58616394",
"0.5843904",
"0.58240557",
"0.5793088",
"0.577716... | 0.622015 | 8 |
Compare each element of a pair of sequences for equivalence | def equivalent_sequence(u,m,tol=TOL):
assert len(u) == len(m), "different lengths: %s and %s" % (u,m)
OK = True
for u_i,m_i in izip(u,m):
OK &= abs(u_i - m_i) < tol
if OK:
return True
else:
print("Tolerance = %G" % tol)
print("Differences: ")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lists_of_series_are_equal(list_of_series_1,list_of_series_2):\n return all([(s1==s2).all() for s1,s2 in zip(list_of_series_1,list_of_series_2)])",
"def same_pairs(past_games, last_i, last_game):\n return ((past_games[:last_i,0] == last_game[0])\n & (past_games[:last_i,1] == last_game[1]))",
"d... | [
"0.69669557",
"0.6536977",
"0.65034974",
"0.6496298",
"0.64556557",
"0.64388645",
"0.64117134",
"0.6397136",
"0.6367425",
"0.63395435",
"0.63258696",
"0.63231784",
"0.6318661",
"0.63172674",
"0.62880564",
"0.6287725",
"0.62550896",
"0.6246033",
"0.62217945",
"0.6215189",
"0.6... | 0.6485934 | 4 |
Parses raw text into 2D list words per sentence using nltk.tokenize.sent_tokenize(). Fixes issues with sentences that do not end with a dot. | def sent_tokenizer(self, txt):
txt_list = []
for line in txt.splitlines():
line = re.sub(r"\.'|\.\"", "'.", line)
if line and not re.search(r"\.$", line):
line += "."
txt_list.append(line)
txt_string = " ".join(txt_list)
tokens = sent_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sent_tokenize(text):\n # TODO: Split text by sentence delimiters (remove delimiters)\n # TODO: Remove leading and trailing spaces from each sentence\n \n # TODO: Return a list of sentences (remove blank strings)\n return re.findall('([A-Z][^.?!]+)[\\.?!]', text)",
"def preprocess(text_raw, tk)... | [
"0.6943341",
"0.67052686",
"0.6656589",
"0.6644142",
"0.6560513",
"0.6537621",
"0.65234506",
"0.64925337",
"0.6481857",
"0.6465888",
"0.6452329",
"0.6452246",
"0.6433589",
"0.6423227",
"0.6415954",
"0.64097464",
"0.6402847",
"0.6376801",
"0.63758135",
"0.63637614",
"0.6360582... | 0.7177286 | 0 |
Returns whether SAML is available for a specific email address. | def get_is_saml_available_for_email(self, email: str) -> bool:
domain = email[email.index("@") + 1 :]
query = (
self.verified_domains()
.filter(domain=domain)
.exclude(
models.Q(saml_entity_id="")
| models.Q(saml_acs_url="")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_address(self, email: str) -> bool:\n addresses = self.client.list_verified_email_addresses().get(\n \"VerifiedEmailAddresses\"\n )\n\n if email in addresses:\n return True\n\n self.client.verify_email_address(EmailAddress=email)\n return False",
... | [
"0.6469875",
"0.6407276",
"0.63872796",
"0.63664955",
"0.6319397",
"0.6057737",
"0.6021216",
"0.5978516",
"0.5934202",
"0.58438087",
"0.58381754",
"0.57906616",
"0.5778399",
"0.57603616",
"0.5710914",
"0.57065475",
"0.5697141",
"0.5686088",
"0.56390786",
"0.560485",
"0.560323... | 0.85273635 | 0 |
Returns whether SAML is configured for the instance. Does not validate the user has the required license (that check is performed in other places). | def has_saml(self) -> bool:
return bool(self.saml_entity_id) and bool(self.saml_acs_url) and bool(self.saml_x509_cert) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needsSigning(self):\r\n return (\r\n (self.request.mode in ['checkid_setup', 'checkid_immediate'])\r\n and self.signed\r\n )",
"def get_is_saml_available_for_email(self, email: str) -> bool:\n domain = email[email.index(\"@\") + 1 :]\n query = (\n ... | [
"0.6220616",
"0.61934006",
"0.61808616",
"0.5996153",
"0.59623563",
"0.59623563",
"0.5962177",
"0.5932443",
"0.5837282",
"0.5805585",
"0.5761211",
"0.57047236",
"0.56842405",
"0.5681274",
"0.5676414",
"0.56724447",
"0.5647088",
"0.56213456",
"0.56213456",
"0.56213456",
"0.560... | 0.7827998 | 0 |
Convert the grayscale image to binary gray = cv2.cvtColor(cameras.img2, cv2.COLOR_BGR2GRAY) ret, binary = cv2.threshold(gray, 100, 255, cv2.THRESH_OTSU) Display the binary image cv2.imshow('Binary image', binary) inverted_binary = ~binary cv2.imshow('Inverted binary image', inverted_binary) | def skinMask(self, img):
hsvim = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
lower = np.array([0, 0, 10], dtype = "uint8")
upper = np.array([10, 100, 60], dtype = "uint8")
skinRegionHSV = cv2.inRange(hsvim, lower, upper)
blurred = cv2.blur(skinRegionHSV, (2,2))
ret,thresh = cv2.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toBinaryImage(img):\n #scale image\n ratio = 55 / img.shape[1]\n width = int(img.shape[1] * ratio)\n height = int(img.shape[0] * ratio)\n dim = (width, height)\n img = cv2.resize(img, dim, interpolation=cv2.INTER_AREA)\n # to gray and reduce noise\n img_grayscale = cv2.cvtColor(img, cv2... | [
"0.661481",
"0.64502347",
"0.63488233",
"0.62468207",
"0.622522",
"0.6217368",
"0.6210878",
"0.6191767",
"0.6141167",
"0.61122644",
"0.61110574",
"0.6089621",
"0.60859203",
"0.6071339",
"0.6020805",
"0.6018809",
"0.6010336",
"0.59758615",
"0.59423983",
"0.58756155",
"0.584526... | 0.0 | -1 |
Return time representation in local time | def to_time(utc_time_str):
dt = datetime.datetime.fromisoformat(utc_time_str).replace(tzinfo=None)
return dt.timestamp() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lst_time(self):\n return local_sidereal_time(self.time)",
"def local2RemoteTime(self,local_time=None): \r\n #drift=self.getDrift()\r\n offset=self.getOffset()\r\n if offset is None:\r\n return None\r\n if local_time is None:\r\n local_time=getTi... | [
"0.7474882",
"0.7121555",
"0.70950985",
"0.70651203",
"0.7058875",
"0.69747674",
"0.6968405",
"0.6891424",
"0.68786085",
"0.685386",
"0.68174154",
"0.6810408",
"0.67187923",
"0.6676386",
"0.6611746",
"0.66070676",
"0.6572808",
"0.6545717",
"0.65193635",
"0.6505271",
"0.650052... | 0.0 | -1 |
Gets a fresh WebPAC session cookie. | def new_session(self):
response = self._request('/')
self.cookie = response.headers.get('Set-Cookie') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getCookie():\n lettersAndDigits = string.ascii_lowercase + string.digits\n cookie = 'JSESSIONID='\n cookie += ''.join(random.choice(lettersAndDigits) for ch in range(31))\n return cookie",
"def getSessionCookie(self):\n return self.__cookie",
"def generateSessionCookie(self):\n pr... | [
"0.67932695",
"0.67463505",
"0.6520322",
"0.65037316",
"0.64711285",
"0.6446006",
"0.631971",
"0.62295127",
"0.6195208",
"0.6091727",
"0.6090505",
"0.6056236",
"0.60193807",
"0.59676486",
"0.59503573",
"0.58619165",
"0.5818107",
"0.5791601",
"0.57760346",
"0.576985",
"0.57662... | 0.6800861 | 0 |
Transform a sequential model with strides to a model that outputs dense predictions by removing the strides and instead inserting dilations. Modifies model inplace. | def to_dense_prediction_model(model, axis=(2, 3)):
if not hasattr(axis, "__len__"):
axis = [axis]
assert all([ax in [2, 3] for ax in axis]), "Only 2 and 3 allowed for axis"
axis = np.array(axis) - 2
stride_so_far = np.array([1, 1])
for module in model.modules():
if hasattr(mod... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_reshape(model: np.ndarray, expected_shape: Tuple[int, int]):\n init_shape = model.shape\n\n # if any dimension of the given model is smaller than the expected shape, pad that dimension.\n is_smaller = [s < st for s, st in zip(init_shape, expected_shape)]\n if any(is_smaller):\n px = ex... | [
"0.5703613",
"0.5703593",
"0.5532961",
"0.5514554",
"0.54759985",
"0.5417352",
"0.5406666",
"0.53735465",
"0.5369219",
"0.536889",
"0.53618515",
"0.53513503",
"0.5343537",
"0.5328017",
"0.53088075",
"0.53021324",
"0.52833015",
"0.52817965",
"0.5278652",
"0.5254394",
"0.524777... | 0.66982955 | 0 |
Checks if a given timestamp is less than x minutes old | def check_timestamp_recent(timestamp, age):
time_val = datetime.datetime.strptime(timestamp, "%Y%m%d%H%M%S")
now = datetime.datetime.now()
if now > time_val:
return (now - time_val).seconds < 60 * age
else:
return (time_val - now).seconds < 60 * age | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_ts(ts):\n current_time = datetime.datetime.utcnow()\n cache_time = datetime.datetime.strptime(ts, \"%Y-%m-%d %H:%M:%S.%f\")\n if cache_time + datetime.timedelta(minutes=5) > current_time:\n return True\n else:\n return False",
"def __expired(timestamp):\n\treturn timestamp <... | [
"0.7247133",
"0.6864572",
"0.673041",
"0.6343779",
"0.6343779",
"0.63246477",
"0.62477815",
"0.6199981",
"0.61978954",
"0.6191202",
"0.61788976",
"0.6173884",
"0.6128478",
"0.6100643",
"0.603365",
"0.59627295",
"0.5959946",
"0.5918523",
"0.5850343",
"0.5846991",
"0.58374447",... | 0.78284657 | 0 |
Gets the prediction array for a specific model in the ensemble. | def _get_model_pred(self, model_index: int, X: np.array) -> np.array:
return self.models[model_index].predict(X) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def predict(self, ensemble_model, _input):\n index = self.get_param(only_values=True).get_value()\n for i, model in enumerate(ensemble_model.get_models()):\n if i == index:\n return model.predict(_input)\n\n return ensemble_model.get_models()[0].predict(_input) # def... | [
"0.76125526",
"0.69808453",
"0.6964036",
"0.66291225",
"0.6619238",
"0.6583604",
"0.6510551",
"0.6435298",
"0.6412178",
"0.64024097",
"0.6367274",
"0.634281",
"0.63111216",
"0.63111216",
"0.62783575",
"0.62613404",
"0.62569034",
"0.62562597",
"0.62517756",
"0.6238411",
"0.623... | 0.74889797 | 1 |
Modifies the value of the hidden attribute _ship | def setShip(self, value):
assert isinstance(value, Ship)
self._ship = value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setShip(self,ship):\n self._ship = ship",
"def update(self, obs, ship):\n\t\tif(self.ship.placed):\n\t\t\tself.setEnabled(False)\n\t\telse:\n\t\t\tself.setEnabled(True)\n\t\t\t\n\t\tself.bs.update(self, ship)",
"def getShip(self):\n return self._ship",
"def getShip(self):\n return se... | [
"0.70272106",
"0.6547363",
"0.6455075",
"0.6455075",
"0.64287746",
"0.63502777",
"0.63502777",
"0.6336036",
"0.6057045",
"0.5986258",
"0.5944237",
"0.58318377",
"0.5793154",
"0.57304275",
"0.571676",
"0.56741685",
"0.5663727",
"0.56362104",
"0.5621568",
"0.5575612",
"0.555181... | 0.7001923 | 1 |
Returns the value of the hidden attribute _bolts | def getBolts(self):
return self._bolts | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b(self):\n return self[\"b\"]",
"def betmedia(self):\n return self.betm",
"def breed(self):\n \n return self.breed",
"def abelian_variety(self):\n return self.__abvar",
"def get_bombpln(self) -> bool:\r\n return self.__data[1]",
"def VBL(self):\n retur... | [
"0.5904125",
"0.5563679",
"0.54837614",
"0.5440455",
"0.5400379",
"0.5359758",
"0.5308517",
"0.52512175",
"0.52163994",
"0.51990813",
"0.51990813",
"0.5196773",
"0.5160752",
"0.5160752",
"0.5149495",
"0.5149495",
"0.50823116",
"0.50685513",
"0.5039854",
"0.5038323",
"0.501577... | 0.7160394 | 1 |
Creates the ship object SHIP_BOTTOM pixels from the bottom of the screen and xposition of halfway along the screen | def player(self):
xcoord = GAME_WIDTH / 2
ycoord = SHIP_BOTTOM + .5*SHIP_HEIGHT
player = Ship(xcoord, ycoord, SHIP_WIDTH, SHIP_HEIGHT, 'ship.png')
return player | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_ship(self):\n x = random.randint(Screen.SCREEN_MIN_X, Screen.SCREEN_MAX_X)\n y = random.randint(Screen.SCREEN_MIN_Y, Screen.SCREEN_MAX_Y)\n ship = Ship((STRT_SPEED, STRT_SPEED), (x, y), START_DIR)\n self.__screen.draw_ship(x, y, START_DIR)\n return ship",
"def __ini... | [
"0.62268955",
"0.6160542",
"0.6123437",
"0.59943545",
"0.56097203",
"0.5594214",
"0.55728316",
"0.5548276",
"0.554674",
"0.5497224",
"0.5494283",
"0.54336435",
"0.5413483",
"0.53978586",
"0.53976065",
"0.5357343",
"0.53472644",
"0.5328463",
"0.53274643",
"0.53265256",
"0.5320... | 0.5326196 | 20 |
Moves all aliens to the left every interval of time | def aliensmoveleft(self, time):
self._time += time
if self._time > self._alienspeed:
for x in self._aliens:
for y in x:
if y != None:
y.x -= ALIEN_H_WALK
self._time = 0
self._steps += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aliensmoveright(self, time):\n self._time += time\n if self._time > self._alienspeed:\n for x in self._aliens:\n for y in x:\n if y != None:\n y.x += ALIEN_H_WALK\n self._time = 0\n self._steps +... | [
"0.6910829",
"0.6636521",
"0.64337397",
"0.6358823",
"0.62964535",
"0.62657636",
"0.61937517",
"0.6015314",
"0.6005102",
"0.59541315",
"0.5921783",
"0.5861865",
"0.58549476",
"0.58095896",
"0.576152",
"0.57131237",
"0.5631273",
"0.5627622",
"0.56070065",
"0.55981684",
"0.5594... | 0.7484147 | 0 |
Iterates through the 2d list of alien objects and the list of bolt objects, checks if a player bolt is contained by an alien image. If so, the alien object is set equal to None, and the bolt object is removed from the list self._bolts. | def aliencollide(self):
collided = []
ylist = []
zlist = []
for x in range(len(self._bolts)):
bolt = self._bolts[x]
if bolt.isplayerbolt():
x1 = bolt.x - .5*BOLT_WIDTH # top left
y1 = bolt.y + .5*BOLT_HEIGHT
x2 =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_alien_bolt(self):\n for x in range(len(self._bolts)):\n if len(self._bolts) > x:\n if self._bolts[x].y <= 0 and len(self._bolts) != 0:\n del self._bolts[x]",
"def delete_bolt(self):\n for _ in self._bolts:\n if (self._bolts[self._bolts... | [
"0.69619685",
"0.6855981",
"0.6613189",
"0.6395868",
"0.6147264",
"0.58310944",
"0.57758766",
"0.5594848",
"0.5592234",
"0.557342",
"0.553121",
"0.5463814",
"0.54114956",
"0.5395318",
"0.53828883",
"0.5379075",
"0.5375662",
"0.5375359",
"0.5318402",
"0.5314555",
"0.52740836",... | 0.64186555 | 3 |
Iterates through the 2d list of alien objects and the list of bolt objects, checks if an alien bolt is contained by the ship image. If so, the ship object is set equal to None, and the bolt object is removed from the list self._bolts. | def shipcollide(self):
collided = []
for x in range(len(self._bolts)):
bolt = self._bolts[x]
if not bolt.isplayerbolt():
x1 = bolt.x - .5*BOLT_WIDTH # top left
y1 = bolt.y + .5*BOLT_HEIGHT
x2 = bolt.x + .5*BOLT_WIDTH # top rig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def del_alien_bolt(self):\n for x in range(len(self._bolts)):\n if len(self._bolts) > x:\n if self._bolts[x].y <= 0 and len(self._bolts) != 0:\n del self._bolts[x]",
"def collides_ship(self):\n for _ in self._bolts:\n if _.getType() == 'alien'... | [
"0.6789141",
"0.65407383",
"0.6374489",
"0.6132274",
"0.6115466",
"0.6105977",
"0.61044496",
"0.6038956",
"0.59642833",
"0.5938259",
"0.5937104",
"0.5933654",
"0.5767105",
"0.57244474",
"0.57120585",
"0.5655573",
"0.5568206",
"0.55588216",
"0.5520423",
"0.5515153",
"0.5489522... | 0.6498095 | 2 |
Keeps track of the aliens that are destroyed. If all the aliens are destroyed, then the player wins the game and self._win is set to True. | def victory(self):
total = ALIEN_ROWS * ALIENS_IN_ROW
count = 0
for x in self._aliens:
for y in x:
if y == None:
count += 1
if count == total:
self._win = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup(self):\n\t\t# list of all player \n\t\tself.player = {}\n\n\t\t# temprary kill list\n\t\tself.kill_list = []\n\n\t\t# current game state\n\t\tself.set_state(PRESTART)\n\n\t\t# True, if the witch has used her ealing potion\n\t\tself.witch_healed = False\n\n\t\t# True, if the witch has used her poison\n\... | [
"0.65521085",
"0.65314883",
"0.6401466",
"0.63413835",
"0.6198995",
"0.6096887",
"0.60300606",
"0.6010541",
"0.5954093",
"0.59084153",
"0.5902717",
"0.5825193",
"0.57976115",
"0.5787165",
"0.5786894",
"0.57836026",
"0.57770413",
"0.5764521",
"0.5759223",
"0.5756098",
"0.56837... | 0.64205647 | 2 |
Duration in seconds per frame / chunk. | def frame_length(self):
return self.config['streaming']['frame_length'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDuration(self):\n\t\treturn self.__maxFrames / 15 # 15 frames per second",
"def get_duration(self):\n return float(self.get_nframes())/float(self.get_framerate())",
"def getDuration(self):\n return self.getFrameCount() / self.getFrameRate()",
"def timeLineTimeDuration(self):\n ret... | [
"0.8118899",
"0.8001803",
"0.78201085",
"0.75947195",
"0.74462646",
"0.7399556",
"0.7371378",
"0.7294106",
"0.7294106",
"0.7200639",
"0.71497434",
"0.71207505",
"0.707548",
"0.7075055",
"0.70302904",
"0.69395804",
"0.6922822",
"0.69114316",
"0.69114316",
"0.690625",
"0.689727... | 0.63325125 | 80 |
Duration of overlap in seconds before/after current frame. | def frame_overlap(self):
return self.config['streaming']['frame_overlap'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDuration(self):\n\t\treturn self.__maxFrames / 15 # 15 frames per second",
"def duration(self):\n return self.end - self.start",
"def duration(self):\n return self.end_time - self.start_time",
"def totalSeconds(self):\n return self.leadout.getFrames()//75 - self.cdtoc[0].getFrames()//... | [
"0.6476187",
"0.647206",
"0.6430655",
"0.640602",
"0.6359632",
"0.6357891",
"0.6303497",
"0.62976474",
"0.61827314",
"0.6155832",
"0.61069065",
"0.6105102",
"0.61042625",
"0.6053774",
"0.60270655",
"0.6012604",
"0.6012604",
"0.60093814",
"0.5970878",
"0.5960506",
"0.59484094"... | 0.62222576 | 8 |
Validate the format of subscription path when subscription name contains valid path | def test_subscription_path_with_fullpath(self):
subsciption_path = main.get_subscription_path(
"project-id",
"projects/test-project/subscriptions/test-subscription")
self.assertEqual(
subsciption_path,
"projects/test-project/subscriptions/test-subscription... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subscription_path_with_subscribername(self):\n subsciption_path = main.get_subscription_path(\"test-project\",\n \"test-subscription\")\n self.assertEqual(\n subsciption_path,\n \"projects/test-project/subscriptions/t... | [
"0.69834745",
"0.6217848",
"0.6080174",
"0.602498",
"0.587118",
"0.5729287",
"0.5709882",
"0.5656592",
"0.5622788",
"0.559916",
"0.5578854",
"0.54777676",
"0.54671466",
"0.5454965",
"0.540994",
"0.53871316",
"0.5380897",
"0.5374038",
"0.5356419",
"0.5345881",
"0.5330905",
"... | 0.63091993 | 1 |
Validate the format of subscription path when subscription name contains valid path | def test_subscription_path_with_subscribername(self):
subsciption_path = main.get_subscription_path("test-project",
"test-subscription")
self.assertEqual(
subsciption_path,
"projects/test-project/subscriptions/test-subscriptio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_subscription_path_with_fullpath(self):\n subsciption_path = main.get_subscription_path(\n \"project-id\",\n \"projects/test-project/subscriptions/test-subscription\")\n self.assertEqual(\n subsciption_path,\n \"projects/test-project/subscriptions/t... | [
"0.63091993",
"0.6217848",
"0.6080174",
"0.602498",
"0.587118",
"0.5729287",
"0.5709882",
"0.5656592",
"0.5622788",
"0.559916",
"0.5578854",
"0.54777676",
"0.54671466",
"0.5454965",
"0.540994",
"0.53871316",
"0.5380897",
"0.5374038",
"0.5356419",
"0.5345881",
"0.5330905",
"... | 0.69834745 | 0 |
Returns if there is any word in the trie that starts with the given prefix. | def startsWith(self, prefix):
if len(prefix) == 0:
return True
head = self.root
prev, post = 0, 1
while prev < len(prefix):
#if prefix[prev:] in head:
# return True
if post == len(prefix):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def startsWith(self, prefix: str) -> bool:\n node = self.trie\n for w in prefix:\n if w not in node:\n return False\n node = node[w]\n \n return True",
"def startsWith(self, prefix):\n root = self.trie\n for c in prefix:\n ... | [
"0.84256893",
"0.8373294",
"0.83660233",
"0.8358397",
"0.83498925",
"0.82874507",
"0.8127019",
"0.81036514",
"0.80269796",
"0.7957733",
"0.79388463",
"0.7937959",
"0.79329795",
"0.7929007",
"0.78828317",
"0.78694534",
"0.78646344",
"0.7853117",
"0.78443897",
"0.7831895",
"0.7... | 0.7801062 | 23 |
Calculates interpolation coefficients and ongrid indices. | def calc_coef_and_indices(
tm: Tensor,
base_offset: Tensor,
offset_increments: Tensor,
tables: List[Tensor],
centers: Tensor,
table_oversamp: Tensor,
grid_size: Tensor,
conjcoef: bool = False,
) -> Tuple[Tensor, Tensor]:
assert len(tables) == len(offset_increments)
assert len(tab... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _computeCoefficients(self):\r\n k = np.arange(self.n)\r\n j = np.arange(self.n)\r\n K, J = np.meshgrid(k, j)\r\n \r\n temp = spp.binom(J, K) * spp.binom(2*self.n - J - 1, self.n-1) \\\r\n * (self.s0)**((J - K)*(J > K)) \\\r\n / (spp.factorial(J) * self.tau**(self.n - J))\r\n ... | [
"0.59087765",
"0.59055036",
"0.57137656",
"0.5693802",
"0.56346244",
"0.5581484",
"0.5545231",
"0.5529755",
"0.5501462",
"0.54633945",
"0.54305124",
"0.53892326",
"0.538856",
"0.53804684",
"0.53484255",
"0.5346951",
"0.5330646",
"0.53296685",
"0.53254634",
"0.5318766",
"0.531... | 0.54202104 | 11 |
Find all words in board. Returns a dict where keys are words and values are (x,y) paths | def get_word_list(board=None, min_length=0):
grid = list(zip(*[iter([l.lower() for l in board])] * 5)) # "reshape" str list
graph, chardict = make_graph(grid)
words, prefixes = make_lookups(grid)
results = {}
find_words(graph, chardict, None, [], results, words, prefixes, min_length)
return re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_words(y, x, chars, visited, board, all_words):\n if len(chars) >= MIN_WORD_LEN and all_words.contains(chars):\n found_words = {chars}\n else:\n found_words = set()\n\n visited.add((y, x))\n\n for n_y, n_x, n_char in neighbors(y, x, board):\n if (n_y, n_x) in visited:\n ... | [
"0.7499198",
"0.7221028",
"0.7147396",
"0.7011069",
"0.6626914",
"0.6533532",
"0.64759314",
"0.6472891",
"0.6413765",
"0.6365779",
"0.61762244",
"0.61479145",
"0.60999393",
"0.60546666",
"0.60342276",
"0.6031043",
"0.5941251",
"0.5927986",
"0.5924913",
"0.59188396",
"0.590635... | 0.7045887 | 3 |
Checks if the number already has a even and remainder associated with it | def check_for_number_completeness(self, num):
for even, remainders in self.evens.items():
# Performs the above equation then mods it with 1
possible_ints = [((num - rem) / 2 ** even) % 1
for rem in remainders]
# If there are any zeros, then the nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_even(number):\n remander = number%2\n if remander == 0:\n return True\n else:\n return False",
"def is_even(number):\r\n return number % 2 == 0",
"def is_even(nbr):\n return nbr % 2 == 0",
"def is_even(number):\n return number % 2 == 0",
"def even(number):\n\n retu... | [
"0.7777331",
"0.7483571",
"0.7429604",
"0.73961747",
"0.73591304",
"0.7311391",
"0.72319525",
"0.7231652",
"0.72152615",
"0.71200085",
"0.70020294",
"0.6973216",
"0.69463205",
"0.68107694",
"0.6790724",
"0.6727794",
"0.66979843",
"0.66962886",
"0.6682536",
"0.6643337",
"0.663... | 0.6441638 | 32 |
return the number of elements in an iterator in the most efficient way. Be aware that for unbound iterators, this method won't terminate! | def count_elements(iterable):
counter = itertools.count()
collections.deque(zip(iterable, counter), maxlen=0) # (consume at C speed)
return next(counter) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _len_iterable(iterable: Iterator) -> int:\n return sum(1 for _ in iterable)",
"def iterlen(items):\n for i, x in enumerate(items):\n count = i\n return count + 1",
"def iterable_len(\n iterable: Iterable[Any],\n) -> int:\n if hasattr(iterable, '__len__'):\n return len(iterable)... | [
"0.789295",
"0.7270321",
"0.72184694",
"0.7015904",
"0.6932509",
"0.6822228",
"0.6742998",
"0.67245835",
"0.67100644",
"0.66547906",
"0.66179895",
"0.65793335",
"0.65741765",
"0.65610737",
"0.6525686",
"0.6519916",
"0.6519829",
"0.64912736",
"0.64590394",
"0.6432767",
"0.6405... | 0.7123605 | 3 |
Instantiate GeneOntology object By default, a GeneOntology object is returned based on | def load_gene_ontology(self, factory=None, rels=None):
try:
fp = io.StringIO(self.db.root.Ontologies.GO.read().tobytes().decode('utf-8'))
except tables.NoSuchNodeError:
p = os.path.join(os.path.dirname(self.db.filename), 'go-basic.obo')
fp = open(p, 'rt')
if f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gene_ontology(self):\n return self.load_gene_ontology(GeneOntology)",
"def makeGene(self, name, start, stop, mim_accesion, mim_description, ensembl, gene_info, gene_type):\n gene = Gene(name, start, stop, mim_accesion, mim_description, ensembl, gene_info, gene_type)\n return gene",
"de... | [
"0.7163428",
"0.6375201",
"0.6367466",
"0.60050243",
"0.5853272",
"0.58096856",
"0.577606",
"0.5769178",
"0.57362604",
"0.5723623",
"0.56967163",
"0.568637",
"0.5546156",
"0.55271643",
"0.55134726",
"0.55095",
"0.5479967",
"0.5454212",
"0.5452349",
"0.54288846",
"0.53396887",... | 0.7087447 | 1 |
return the conversion end date from the DB attributes | def get_conversion_date(self):
return dateutil.parser.parse(self.db.root._v_attrs['conversion_end']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_coverage_end_date(self, obj):\n if hasattr(obj, 'metadata'):\n for coverage in obj.metadata.coverages.all():\n if coverage.type == 'period' and 'end' in coverage.value:\n clean_date = coverage.value[\"end\"][:10]\n if \"/\" in clean... | [
"0.7244013",
"0.7222731",
"0.71522677",
"0.6963932",
"0.6963932",
"0.6963932",
"0.6963932",
"0.6963932",
"0.6776728",
"0.6770803",
"0.66182905",
"0.6529728",
"0.6360735",
"0.6307628",
"0.62905204",
"0.6282172",
"0.6263613",
"0.6233381",
"0.62136424",
"0.6141438",
"0.6015419",... | 0.74327004 | 0 |
returns an array of protein entries which belong to a given fam | def member_of_fam(self, fam):
if not isinstance(fam, (int, numpy.number)):
raise ValueError('expect a numeric family id')
return self.member_of_hog_id(self.format_hogid(fam)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_family_identifiers(self):\n fam_data = []\n for line in self.fam_file:\n fid, iid, i_fid, i_mid, sex, phenotype = line.split()\n fam_data.append(FamId(fid, iid, i_fid, i_mid, sex, phenotype))\n\n return fam_data",
"def find_pathwayID_families(self, fmembers):\n ... | [
"0.64403826",
"0.6371508",
"0.6190033",
"0.5922826",
"0.5880763",
"0.5726935",
"0.56305563",
"0.56073534",
"0.55789286",
"0.5541875",
"0.55236864",
"0.54624194",
"0.543803",
"0.54311395",
"0.5419469",
"0.5362441",
"0.536105",
"0.53098524",
"0.524502",
"0.5235872",
"0.52265984... | 0.53671926 | 15 |
get the meta data associated with a OMA Group The meta data contains the fingerprint and the keywords infered for this group. The method retuns this information as a dictionary. The parameter must be the numeric oma group nr. | def oma_group_metadata(self, group_nr):
if not isinstance(group_nr, (int, numpy.integer)) or group_nr < 0:
raise InvalidId('Invalid group nr: {} (type: {})'.format(group_nr, type(group_nr)))
meta_tab = self.db.get_node('/OmaGroups/MetaData')
try:
e = next(meta_tab.where('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_meta(self):\n result = self._call('meta', True)\n data = {}\n for fmt in formats_re:\n formats = fmt.search(result)\n if formats:\n data['formats'] = formats.group(1).split(',')\n\n duration = duration_re.search(result)\n if duration:\... | [
"0.6261208",
"0.6042238",
"0.593299",
"0.5868463",
"0.5753399",
"0.57320887",
"0.5711003",
"0.5696173",
"0.5691158",
"0.5665481",
"0.5652658",
"0.5648828",
"0.5600601",
"0.5583868",
"0.5583836",
"0.55616474",
"0.55111235",
"0.55005044",
"0.5499548",
"0.54872316",
"0.5483124",... | 0.7942788 | 0 |
Get length of a particular entry. | def get_entry_length(self, ii):
return self.db.root.Protein.Entries[ii - 1]['SeqBufferLength'] - 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getLength(self, did: int) -> int:\n r = self.connection.execute(\"\"\"\n SELECT len from dls WHERE did=:did \n \"\"\", (did,))\n return int(r.fetchone()[0])",
"def get_length(self) -> Result[int]:\n return self._execute_command('getLength')",
"def getLength(self) ... | [
"0.7265916",
"0.72506315",
"0.7203929",
"0.71085197",
"0.7107457",
"0.70706385",
"0.70706385",
"0.70706385",
"0.699816",
"0.69940686",
"0.6977775",
"0.69580966",
"0.68795526",
"0.68565506",
"0.68565506",
"0.68565506",
"0.6844704",
"0.6837928",
"0.67892236",
"0.67587876",
"0.6... | 0.7326757 | 0 |
This function gets a list with 4 boolean values and returns a list with the right monotonicity if there is one, else returns None. The function uses check_monotonicity_inverse to check if the input is valid | def monotonicity_inverse(def_bool):
# Checks valid specifications
if not check_monotonicity_inverse(def_bool):
return None
else:
if def_bool[0] is True and def_bool[1] is not True \
and def_bool[2] is not True:
return [1,2,2,4]
elif def_bool[0] is True and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_monotonicity_inverse(def_bool):\n if def_bool[0] is True and def_bool[3] is True:\n return False\n if def_bool[1] is True and (def_bool[2] is True or def_bool[3] is True):\n return False\n if def_bool[1] is True and def_bool[0] is False:\n return False\n if def_bool[3] is... | [
"0.6816691",
"0.66164356",
"0.60043824",
"0.5970371",
"0.5838388",
"0.54315966",
"0.53396916",
"0.51856935",
"0.51435906",
"0.51215106",
"0.5075092",
"0.5059484",
"0.49711648",
"0.49392706",
"0.49320567",
"0.49287876",
"0.49090376",
"0.48615116",
"0.48370907",
"0.48216513",
"... | 0.75376856 | 0 |
This function checks if the values in the list are valid according to the monotonicity specifications. If they are returns True, else returns False | def check_monotonicity_inverse(def_bool):
if def_bool[0] is True and def_bool[3] is True:
return False
if def_bool[1] is True and (def_bool[2] is True or def_bool[3] is True):
return False
if def_bool[1] is True and def_bool[0] is False:
return False
if def_bool[3] is True and de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_sanity(mass_list: np.ndarray) -> None:\n if not all(\n mass_list[0][i] <= mass_list[0][i + 1] for i in range(len(mass_list[0]) - 1)\n ):\n raise ValueError(\"Masses are not sorted.\")",
"def test__isMonotonic(self):\n assert self.isMonotonic([502.3, 503.1, 504.01, 504.0099999... | [
"0.68217134",
"0.6655203",
"0.6563524",
"0.64275336",
"0.6322889",
"0.6318087",
"0.6273495",
"0.6169819",
"0.61640424",
"0.6144642",
"0.6143954",
"0.61307",
"0.6126706",
"0.612211",
"0.60786337",
"0.6076009",
"0.60751474",
"0.60308367",
"0.60290796",
"0.6022901",
"0.59761626"... | 0.0 | -1 |
This function returns list of the first n prime numbers using the is_prime function | def primes_for_asafi(n):
prime_list = []
counter = 0
last_prime_location = 1
while counter < n:
# If the loop finds prime number, changes the flag to False:
prime_flag = True
while prime_flag:
if is_prime(last_prime_location, prime_list):
prime_list.ap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prime_num(n: int) -> list:\n pl = []\n for i in range(1, n):\n if is_prime(i) is True:\n pl.append(i)\n return pl",
"def findprime(n):\r\n return([(num + 1) for num in range(n) if isprime(num + 1)])",
"def primes(n):\n\n prime_list = [2, 3, 5, 7]\n if n <= 1:\n re... | [
"0.84206784",
"0.82964486",
"0.826543",
"0.8219718",
"0.80811083",
"0.8072385",
"0.80287296",
"0.80049044",
"0.7914588",
"0.7904181",
"0.7785304",
"0.7780753",
"0.77367896",
"0.7703147",
"0.7644267",
"0.7642779",
"0.762942",
"0.7613834",
"0.7607425",
"0.75913733",
"0.7579997"... | 0.72075033 | 55 |
This function checks if the given number is prime by checking only if he is divided by the prime numbers that have already been found | def is_prime(n,prime_list):
if n == 1:
return False
if n == 2:
return True
for i in prime_list:
if n % i == 0:
return False
if i > n**0.5:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pregenprime(number):\n l = generateprimes(math.floor(math.sqrt(number)))\n for i in l:\n if number%i == 0:\n return False\n return True",
"def is_prime(number):\n\n # 1 is not prime number\n if number == 1:\n return False\n\n # Loop from 2 to number if any one befor... | [
"0.83574694",
"0.82870907",
"0.80419505",
"0.80046034",
"0.7991471",
"0.79899126",
"0.7989388",
"0.79852927",
"0.79721296",
"0.79687",
"0.7963613",
"0.79553926",
"0.78674304",
"0.78385484",
"0.78098726",
"0.7787091",
"0.77806604",
"0.7765967",
"0.7765833",
"0.77623117",
"0.77... | 0.0 | -1 |
The DescribeCacheClusters operation returns information about all provisioned cache clusters if no cache cluster identifier is specified, or about a specific cache cluster if a cache cluster identifier is supplied. By default, abbreviated information about the cache clusters(s) will be returned. You can use the optiona... | def describe_cache_clusters(self, cache_cluster_id=None,
max_records=None, marker=None,
show_cache_node_info=None):
params = {}
if cache_cluster_id is not None:
params['CacheClusterId'] = cache_cluster_id
if max_records ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_cluster(self, args):\n client = self.get_client()\n results = client.describe_cluster(ClusterId=args['CLUSTERID'])\n\n return [{\"cm\": {\"cloud\": \"aws\",\n \"kind\": \"emr cluster description\",\n \"name\": args['CLUSTERID']},\n ... | [
"0.6271727",
"0.60210943",
"0.57934946",
"0.55012125",
"0.5425843",
"0.54201216",
"0.5404387",
"0.53967124",
"0.53345424",
"0.5326609",
"0.5325541",
"0.52496177",
"0.5248427",
"0.5246155",
"0.52448624",
"0.51749945",
"0.5170034",
"0.5120651",
"0.51198816",
"0.51178384",
"0.50... | 0.8556082 | 0 |
The DescribeCacheParameterGroups operation returns a list of cache parameter group descriptions. If a cache parameter group name is specified, the list will contain only the descriptions for that group. | def describe_cache_parameter_groups(self,
cache_parameter_group_name=None,
max_records=None, marker=None):
params = {}
if cache_parameter_group_name is not None:
params['CacheParameterGroupName'] = cache_paramete... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_cache_security_groups(self, cache_security_group_name=None,\n max_records=None, marker=None):\n params = {}\n if cache_security_group_name is not None:\n params['CacheSecurityGroupName'] = cache_security_group_name\n if max_records ... | [
"0.6580393",
"0.65243065",
"0.6195183",
"0.5745927",
"0.55639696",
"0.54831564",
"0.53769666",
"0.51904",
"0.51555616",
"0.51344544",
"0.4905228",
"0.48726535",
"0.46972728",
"0.46731928",
"0.46442854",
"0.46325466",
"0.46142268",
"0.4609105",
"0.4564557",
"0.44777828",
"0.44... | 0.791869 | 0 |
The DescribeReplicationGroups operation returns information about a particular replication group. If no identifier is specified, DescribeReplicationGroups returns information about all replication groups. | def describe_replication_groups(self, replication_group_id=None,
max_records=None, marker=None):
params = {}
if replication_group_id is not None:
params['ReplicationGroupId'] = replication_group_id
if max_records is not None:
params['Ma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def role_groups_with_http_info(self, role_id, **kwargs):\n\n all_params = ['role_id', 'fields']\n all_params.append('callback')\n all_params.append('_return_http_data_only')\n all_params.append('_preload_content')\n all_params.append('_request_timeout')\n\n params = locals... | [
"0.5664773",
"0.5412841",
"0.52933633",
"0.5024597",
"0.5011128",
"0.4918338",
"0.4907959",
"0.48122668",
"0.47952542",
"0.47829807",
"0.4780229",
"0.4767272",
"0.47014484",
"0.46783516",
"0.46660885",
"0.46293247",
"0.4601783",
"0.4588294",
"0.45875087",
"0.45850945",
"0.457... | 0.71608174 | 0 |
The DescribeReservedCacheNodes operation returns information about reserved cache nodes for this account, or about a specified reserved cache node. | def describe_reserved_cache_nodes(self, reserved_cache_node_id=None,
reserved_cache_nodes_offering_id=None,
cache_node_type=None, duration=None,
product_description=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_reserved_cache_nodes_offering(self,\n reserved_cache_nodes_offering_id,\n reserved_cache_node_id=None,\n cache_node_count=None):\n params = {\n 'R... | [
"0.67429715",
"0.65475374",
"0.5430405",
"0.4709413",
"0.44008678",
"0.43068212",
"0.42831272",
"0.42758423",
"0.42149916",
"0.41951448",
"0.4128196",
"0.4099665",
"0.407108",
"0.40616024",
"0.40211535",
"0.4016626",
"0.4009901",
"0.40044942",
"0.3949871",
"0.3885994",
"0.386... | 0.7705363 | 0 |
The ModifyCacheCluster operation modifies the settings for a cache cluster. You can use this operation to change one or more cluster configuration parameters by specifying the parameters and the new values. | def modify_cache_cluster(self, cache_cluster_id, num_cache_nodes=None,
cache_node_ids_to_remove=None,
cache_security_group_names=None,
security_group_ids=None,
preferred_maintenance_window=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reboot_cache_cluster(self, cache_cluster_id,\n cache_node_ids_to_reboot):\n params = {'CacheClusterId': cache_cluster_id, }\n self.build_list_params(params,\n cache_node_ids_to_reboot,\n 'CacheNodeIdsToReboot.... | [
"0.627631",
"0.60063803",
"0.5665664",
"0.56581753",
"0.56227756",
"0.54897016",
"0.54524744",
"0.5442618",
"0.54365975",
"0.54255867",
"0.54174525",
"0.5341028",
"0.52894783",
"0.5194003",
"0.5176288",
"0.516681",
"0.51612425",
"0.51417977",
"0.5131147",
"0.4979759",
"0.4958... | 0.7436994 | 0 |
The ModifyCacheParameterGroup operation modifies the parameters of a cache parameter group. You can modify up to 20 parameters in a single request by submitting a list parameter name and value pairs. | def modify_cache_parameter_group(self, cache_parameter_group_name,
parameter_name_values):
params = {
'CacheParameterGroupName': cache_parameter_group_name,
}
self.build_complex_list_params(
params, parameter_name_values,
'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_cache_parameter_group(self, cache_parameter_group_name,\n parameter_name_values,\n reset_all_parameters=None):\n params = {\n 'CacheParameterGroupName': cache_parameter_group_name,\n }\n self.build_compl... | [
"0.67374134",
"0.61750424",
"0.61625916",
"0.61580175",
"0.61016136",
"0.6054573",
"0.5255652",
"0.51676834",
"0.50654674",
"0.504773",
"0.49200428",
"0.48568568",
"0.4849976",
"0.47907743",
"0.47576696",
"0.4735929",
"0.46234503",
"0.46199483",
"0.46131784",
"0.45891482",
"0... | 0.79291433 | 0 |
The ModifyReplicationGroup operation modifies the settings for a replication group. | def modify_replication_group(self, replication_group_id,
replication_group_description=None,
cache_security_group_names=None,
security_group_ids=None,
preferred_maintenance_window=None,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_name(self, group_name: str) -> None:\r\n\r\n data = {\"groupName\": {\"value\": group_name}}\r\n try:\r\n self._request_builder.patch(\r\n url=f\"{BASE_PATH['gaming_lounge']}{API_PATH['group_settings'].format(group_id=self.group_id)}\",\r\n data=jso... | [
"0.56506854",
"0.5565668",
"0.54122186",
"0.5348083",
"0.533524",
"0.52694553",
"0.52568656",
"0.52255124",
"0.5148666",
"0.5128962",
"0.51240575",
"0.5069563",
"0.50674975",
"0.5063175",
"0.50225914",
"0.50116926",
"0.49929875",
"0.49892724",
"0.498198",
"0.49772793",
"0.496... | 0.6675173 | 0 |
The PurchaseReservedCacheNodesOffering operation allows you to purchase a reserved cache node offering. | def purchase_reserved_cache_nodes_offering(self,
reserved_cache_nodes_offering_id,
reserved_cache_node_id=None,
cache_node_count=None):
params = {
'ReservedCac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def describe_reserved_cache_nodes_offerings(self,\n reserved_cache_nodes_offering_id=None,\n cache_node_type=None,\n duration=None,\n ... | [
"0.6806913",
"0.65577054",
"0.51380515",
"0.45839232",
"0.4491856",
"0.41070008",
"0.4008949",
"0.40073666",
"0.39835066",
"0.39347538",
"0.386574",
"0.38421488",
"0.3806856",
"0.3803822",
"0.37884313",
"0.37569037",
"0.37321824",
"0.36431408",
"0.36418632",
"0.36407584",
"0.... | 0.8526049 | 0 |
The providerassigned unique ID for this managed resource. | def id(self) -> str:
return pulumi.get(self, "id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provider_id(self) -> str:\n return self._provider_id",
"def provider_id(self):\n return self.__provider_id",
"def provider_id(self):\n raise NotImplementedError",
"def get_id(self):\n return \"{0} {1}\".format(self.get_issuer(), self.get_serial_number())",
"def get_resource_... | [
"0.8126432",
"0.80487597",
"0.78507495",
"0.7628359",
"0.75988305",
"0.74764425",
"0.74764425",
"0.74764425",
"0.74764425",
"0.74764425",
"0.74462813",
"0.74462813",
"0.73741746",
"0.73725253",
"0.73725253",
"0.73725253",
"0.73725253",
"0.73700505",
"0.73414904",
"0.7320673",
... | 0.0 | -1 |
Return the labels for GAE app. If the trace ID can be detected, it will be included as a label. Currently, no other labels are included. | def get_gae_labels(self):
gae_labels = {}
trace_id = self.get_trace_id_from_fastapi()
if trace_id is not None:
gae_labels[_TRACE_ID_LABEL] = trace_id
return gae_labels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def labels(self):\n return url_for('.get_project_labels', id=self.id, _external=True)",
"def get_labels(self) -> List[str]:\n pass",
"def get_labels() -> List[Dict[str, str]]:\n return configuration.labels",
"def labels(self) -> Optional[Sequence[str]]:\n return pulumi.get(self, \"lab... | [
"0.6436647",
"0.63910323",
"0.63075525",
"0.63024366",
"0.63024366",
"0.6281331",
"0.62634766",
"0.62496006",
"0.62496006",
"0.62496006",
"0.62496006",
"0.62496006",
"0.62496006",
"0.62496006",
"0.62385106",
"0.62385106",
"0.62385106",
"0.62164336",
"0.6207998",
"0.6187605",
... | 0.76463234 | 0 |
Create a population according to specified age and household size distributions. | def create_population(self, ind_type, logging=True):
self.P = Pop_HH(ind_type, logging)
self.P.gen_hh_age_structured_pop(self.params['pop_size'], self.hh_comp,
self.age_dist, self.params['age_cutoffs'], self.rng)
self.P.allocate_couples()
self.P.print_population_summary... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_age_structured_pop(self, pop_size, age_probs, rng):\n\n # TODO: move out of class?\n\n for _ in itertools.repeat(None, pop_size):\n self.add_individual(age=int(sample_table(age_probs, rng)[0]))",
"def gen_hh_age_structured_pop(self, pop_size, hh_probs, age_probs_i,\n c... | [
"0.671819",
"0.66715586",
"0.64572257",
"0.6395363",
"0.6301728",
"0.6156965",
"0.6138534",
"0.60346234",
"0.59398013",
"0.59386516",
"0.5889828",
"0.5866615",
"0.5850289",
"0.58229107",
"0.5794929",
"0.57875764",
"0.5778924",
"0.57706845",
"0.5734712",
"0.57323843",
"0.57284... | 0.65491855 | 2 |
Parse an ageyearrate table to produce a dictionary, keyed by age, with each entry being a list of annual rates (by year). Setting final to 'True' appends an age 100 rate of >1 (e.g., to ensure everyone dies! | def parse_age_rates(self, filename, factor, final):
dat = load_age_rates(filename)
rates = {}
for line in dat:
rates[line[0]] = [x * factor for x in line[1:]]
if final:
rates[101] = [100 for x in dat[0][1:]] # everybody dies...
return rates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_age(self, dob):\n today = datetime.date.today()\n dob = dob\n age = relativedelta(today, dob)\n\n return {\n \"year\": age.years,\n \"month\": age.months,\n \"day\": age.days,\n \"all_month\": (age.years * 12) + age.months\n ... | [
"0.58365524",
"0.5605629",
"0.5463597",
"0.5374374",
"0.53030217",
"0.5267397",
"0.5251329",
"0.5212957",
"0.5090502",
"0.50594985",
"0.50486207",
"0.50255156",
"0.5000718",
"0.497954",
"0.49739885",
"0.49488902",
"0.4923484",
"0.4875033",
"0.48258352",
"0.48153225",
"0.48150... | 0.6323948 | 0 |
Get the brackets. Get the brackets from the scopes endpoints using the given open and closing patterns. | def get_brackets(self, open_pattern, close_pattern, scope_id, bracket_id):
o = None
c = None
m = open_pattern.search(self.scope_bfr)
if m and m.group(1):
o = ScopeEntry(self.extent.begin() + m.start(1), self.extent.begin() + m.end(1), scope_id, bracket_id)
m = close_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def futures_leverage_bracket(self, **params):\n return self._request_futures_api('get', 'leverageBracket', True, data=params)",
"def futures_leverage_bracket(self, **params):\n return self._request_futures_api('get', 'leverageBracket', True, data=params)",
"def get_brackets(tree, idx=0):\n brack... | [
"0.53014416",
"0.53014416",
"0.5221691",
"0.5179323",
"0.513841",
"0.50861764",
"0.5065756",
"0.5065756",
"0.5065756",
"0.5065756",
"0.5065756",
"0.5065756",
"0.5065756",
"0.5065756",
"0.497155",
"0.49712765",
"0.497115",
"0.497115",
"0.497115",
"0.497115",
"0.497115",
"0.4... | 0.6977809 | 0 |
Check if sub bracket in string scope is escaped. | def escaped(self, pt, ignore_string_escape, scope):
if not ignore_string_escape:
return False
if scope and scope.startswith("string"):
return self.string_escaped(pt)
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _have_external_brackets(self, expr):\n if not (expr.startswith(self._bracket_left) and expr.endswith(self._bracket_right)):\n return False\n brackets_level = 0\n for sym in expr[:-1]:\n if sym == self._bracket_left:\n brackets_level += 1\n el... | [
"0.6737563",
"0.6634667",
"0.6524471",
"0.6402737",
"0.6154924",
"0.6085298",
"0.6082721",
"0.5988044",
"0.5916752",
"0.5878341",
"0.5852486",
"0.5841708",
"0.57840794",
"0.5768413",
"0.5757644",
"0.5724142",
"0.5712649",
"0.56911623",
"0.563922",
"0.56264263",
"0.56264234",
... | 0.62885493 | 4 |
Get book results from goodreads API. | def lookup(isbn):
# Request config
url = "https://www.goodreads.com/book/review_counts.json"
key = 'wFjwok88x2qelijJiSgVgA'
try:
res = requests.get(url, params={"key": key, "isbns": isbn})
res.raise_for_status()
except requests.RequestException:
return None
# Parse res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goodreads_api(isbn):\n\n # Get book data form db\n book = db.execute('SELECT * FROM books WHERE isbn=:isbn',\n {'isbn': isbn}).fetchone()\n\n # Make sure book exists in database\n if book is None:\n return jsonify({'error': 'ISBN not in database'}), 404\n\n # Get info... | [
"0.71830755",
"0.7102676",
"0.70817614",
"0.7052987",
"0.7028794",
"0.6808219",
"0.67627513",
"0.6549224",
"0.65270877",
"0.64678615",
"0.64056516",
"0.6403791",
"0.6374836",
"0.63127714",
"0.63012296",
"0.62975204",
"0.62945575",
"0.62866336",
"0.6230553",
"0.6212503",
"0.62... | 0.67293215 | 7 |
Get the path to the directory where tf records are written to. If using TPUs, this will be a gcs path. | def form_tf_record_cache_path(self, dataset):
total_samples = self.config["niters"] * self.config["itersize"]
if self.tpu:
return "{0}/capreolus_tfrecords/{1}_{2}".format(self.config["storage"], dataset.get_hash(), total_samples)
else:
base_path = self.get_cache_path()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_path(self):\n return self._tempdir",
"def path_gtfsdir(self, dt, zone):\n return join(self.procdir_zone(dt, zone), 'gtfs')",
"def get_path(self, dataset: Dataset) -> str:\n return os.path.join(dataset.dir, self.filename)",
"def app_storage_path():\n activity = _get_activity()\n ... | [
"0.65651125",
"0.6508083",
"0.64720684",
"0.6458068",
"0.6380545",
"0.6352491",
"0.62933004",
"0.626573",
"0.626573",
"0.62657213",
"0.62643164",
"0.6263543",
"0.62526566",
"0.6226556",
"0.61587447",
"0.6151039",
"0.61433846",
"0.61426675",
"0.61424756",
"0.61423194",
"0.6142... | 0.70019335 | 0 |
Skip to the last training iteration whose weights were saved. If saved model and optimizer weights are available, this method will load those weights into model and optimizer, and then return the next iteration to be run. For example, if weights are available for iterations 010 (11 zeroindexed iterations), the weights ... | def fastforward_training(self, model, weights_path, loss_fn, best_metric_fn):
default_return_values = (0, {})
if not (weights_path.exists() and loss_fn.exists()):
return default_return_values
try:
loss = self.load_loss_file(loss_fn)
metrics = self.load_metric... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_weights_if_possible(model, init_weight_path=None):\n initial_epoch = 0\n if init_weight_path:\n tf.compat.v1.logging.info(\"Load weights: {}\".format(init_weight_path))\n model.load_weights(init_weight_path).expect_partial()\n initial_epoch = int(init_weight_path.split('/')[-1].... | [
"0.61188924",
"0.5962468",
"0.58279365",
"0.5728479",
"0.5728479",
"0.5635842",
"0.56077564",
"0.5596701",
"0.55928797",
"0.55759275",
"0.5566751",
"0.5563833",
"0.5563833",
"0.5510071",
"0.5459355",
"0.53996515",
"0.5388874",
"0.53657347",
"0.53647953",
"0.53565365",
"0.5341... | 0.71897113 | 0 |
Compute my distance from the origin | def distance_from_origin(self):
return ((self.x ** 2) + (self.y ** 2)) ** 0.5 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance_from_origin(self):\r\n return ((self.x ** 2) + (self.y ** 2)) ** 0.5",
"def distance_from_origin(self):\n return ((self.x ** 2) + (self.y ** 2)) ** .5",
"def distance_from_origin(self):\n return (self.x ** 2 + self.y ** 2) ** 0.5",
"def from_origin(self):\n distance =... | [
"0.8584285",
"0.857379",
"0.8565385",
"0.8537587",
"0.83234584",
"0.77664506",
"0.74958456",
"0.7475024",
"0.7429921",
"0.73004097",
"0.7292693",
"0.72594285",
"0.7230087",
"0.7197718",
"0.71334696",
"0.7127469",
"0.7124221",
"0.7102407",
"0.70442855",
"0.7039425",
"0.7015957... | 0.85663384 | 3 |
Return the halfway point between myself and the target | def halfway(self, target):
mx = (self.x + target.x) / 2
my = (self.y + target.y) / 2
return Point(mx, my) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def halfway(self, target):\r\n mx = (self.x + target.x)/2\r\n my = (self.y + target.y)/2\r\n return Point(mx, my)",
"def halfway_to(self, p2):\n return Point((self.x + p2.x) / 2,\n (self.y + p2.y) / 2)",
"def get_halfway_point(p1, p2):\n return (p1[0] + p2[0])... | [
"0.8789036",
"0.7226614",
"0.6669085",
"0.661641",
"0.64064914",
"0.6379278",
"0.62633467",
"0.6157345",
"0.6118533",
"0.60864055",
"0.6058581",
"0.6024983",
"0.5990537",
"0.5986857",
"0.59785444",
"0.5961328",
"0.5935",
"0.58942497",
"0.5849097",
"0.5847601",
"0.5840852",
... | 0.87399906 | 1 |
Initialize a Board object based on the given json representation of the board. | def initialize_board(json_board: list) -> Board:
# Dict to store tile objects
tiles = {}
# Determine the maximum row length so that we can determine whether we need to pad certain rows with 0's
max_row_length = max(map(lambda x: len(x), json_board))
# Iterate through each row in the json board
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init(self, json: Optional[dict]) -> None:\n if json:\n self.from_dict(json)\n else:\n self.set(initial_board())\n self.update()",
"def from_dict(self, json: dict) -> None:\n self.state = json[\"state\"]\n self.player = json[\"player\"]\n sel... | [
"0.8094515",
"0.76856136",
"0.7679861",
"0.7458823",
"0.67021835",
"0.65440613",
"0.6531353",
"0.6340944",
"0.6310571",
"0.6212669",
"0.6194929",
"0.61876297",
"0.6164585",
"0.6096812",
"0.6087258",
"0.60486585",
"0.60181636",
"0.5995913",
"0.5953211",
"0.5944648",
"0.5937229... | 0.79657185 | 1 |
Initialize the Python Dictionary to store word mappings | def __init__(self):
self.words = dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _init_dictionary(self):\n self.word2index = {}\n self.index2word = {}\n self.word_counter = collections.Counter()\n for token in [self.PADDING_TOKEN, self.START_TOKEN, self.END_TOKEN, self.UNKNOWN_TOKEN]:\n self._add_word(token)",
"def __init__(self):\n self._wor... | [
"0.80980945",
"0.77628803",
"0.7591748",
"0.7496619",
"0.7093224",
"0.7073559",
"0.7003789",
"0.6985263",
"0.69519264",
"0.69236434",
"0.690214",
"0.6858041",
"0.6834418",
"0.6794865",
"0.67633677",
"0.66620815",
"0.6656238",
"0.66411406",
"0.6583183",
"0.65696555",
"0.653140... | 0.7153789 | 4 |
Get current email cc and additional cc and combines them together. | def get_email_cc(current_cc=None, additional_cc=None):
if current_cc:
if additional_cc:
return current_cc.replace(' ', '') + ',' + additional_cc.replace(' ', '')
else:
return current_cc.replace(' ', '')
elif additional_cc:
return additional_cc.replace(' ', '')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetCCList(self):\n if self.cc is None:\n base_cc = settings.GetDefaultCCList()\n more_cc = ','.join(self.more_cc)\n self.cc = ','.join(filter(None, (base_cc, more_cc))) or ''\n return self.cc",
"def add_cc(self, val):\n MessageValidator.mailto(val)\n if isinstance(val, list... | [
"0.69645476",
"0.6888688",
"0.6558727",
"0.6516461",
"0.64417404",
"0.62990326",
"0.61918896",
"0.6191372",
"0.6112273",
"0.6029812",
"0.5941425",
"0.56077015",
"0.5498351",
"0.52839994",
"0.51172256",
"0.5116064",
"0.50896007",
"0.5071489",
"0.5025132",
"0.50037605",
"0.4924... | 0.80338055 | 0 |
Get the email recipient. | def get_email_recipients(email_to, email_from, service_mail):
email_to_set = {email_from}
email_to = argToList(email_to)
email_to_set = email_to_set.union(set(email_to))
service_mail_recipient = next(recipient for recipient in email_to_set if service_mail in recipient)
if service_mail_recipient:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_matching_recipient(self):\n\n\t\temail = self.match_recipient()\n\n\t\tif not email:\n\t\t\temail = self.config.rc_mymails[0]\n\n\t\tself.log.write(1, \" get_matching_recipient(): Returning %s\" % email)\n\n\t\treturn email",
"def to_address(self):\n try:\n return self.recipients[0]\n ... | [
"0.73362386",
"0.7140335",
"0.71131414",
"0.7031148",
"0.6930376",
"0.6844403",
"0.6832769",
"0.6775153",
"0.67683357",
"0.6745224",
"0.6739385",
"0.67370784",
"0.67370784",
"0.67370784",
"0.67370784",
"0.67370784",
"0.67370784",
"0.67370784",
"0.67370784",
"0.67366844",
"0.6... | 0.0 | -1 |
Returns a list of all ancestors of a node containing the given key in the given tree (including itself) as decribed in the assignment. | def get_ancestors(tree: BinaryTreeNode, key: int) -> List[int]:
return list(tree.find_node(key).ancestors()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_ancestors(self):\n ancestors = []\n node = self\n while node.parent is not None:\n ancestors.append(node.parent)\n node = node.parent\n return ancestors",
"def get_ancestors_list(self, node):\n\n parent = node.parent\n ancestor_list = [paren... | [
"0.6852183",
"0.66951406",
"0.6691227",
"0.6691227",
"0.66245484",
"0.6481617",
"0.64613193",
"0.64245665",
"0.63819903",
"0.637169",
"0.62909746",
"0.61745",
"0.61533713",
"0.6134008",
"0.6101028",
"0.6023573",
"0.6023573",
"0.6023573",
"0.6023573",
"0.60054266",
"0.5974477"... | 0.86082137 | 0 |
Return the name of jupyter notebook or path to python file you are running. | def _get_launcher_name() -> str:
import ipykernel
try: # Python 3 (see Edit2 below for why this may not work in Python 2)
import notebook.notebookapp as ihnb
except ImportError: # Python 2
import warnings
import IPython.utils.shimmodule as iush
with warnings.catch_warnin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_notebook_path():\n try: working_directory\n except NameError: working_directory = os.getcwd()\n return working_directory",
"def get_notebook_path():\n notebook_name = NOTEBOOK_TEMPLATE_NAME\n this_dir = os.path.dirname(os.path.abspath(__file__))\n notebook_path = os.path.join(this_dir, ... | [
"0.7151963",
"0.7094269",
"0.70841026",
"0.68228555",
"0.6780071",
"0.65354544",
"0.6450634",
"0.6450634",
"0.62520754",
"0.6212553",
"0.6197007",
"0.6196353",
"0.6183596",
"0.61666954",
"0.6154691",
"0.6153823",
"0.6153823",
"0.6153823",
"0.6153823",
"0.6153823",
"0.6153823"... | 0.73463136 | 0 |
Checks if the user input is a valid string with a minimum length of 2 characters | def validate_str_input(self, user_input) -> bool:
if (not user_input.isalpha()) or len(user_input) < 2:
print(
'Your input should be a single word of a minimum of 2'
'characters.'
'Please try again.')
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_username_length(username: str) -> bool:\n\n if len(username) >= 2:\n\n return True\n\n return False",
"def validPasswordInput(password):\n if len(password) < 8:\n # Password need to be at least 8 charcters long\n return False\n elif \" \" in password:\n ... | [
"0.728292",
"0.71018654",
"0.69590753",
"0.688734",
"0.68527883",
"0.6851832",
"0.66705996",
"0.66638756",
"0.66221213",
"0.6619502",
"0.6603245",
"0.6600908",
"0.6590642",
"0.6461565",
"0.64232457",
"0.6382141",
"0.63721776",
"0.6366282",
"0.63210636",
"0.6298841",
"0.626492... | 0.82971734 | 0 |
Convert ndarrays in sample to Tensors. | def ToTensor(img):
# swap color axis because
# numpy image: H x W x C
# torch image: C X H X W
newimg = img.transpose((2, 0, 1))
return torch.from_numpy(newimg) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(samples):\n numpy = np.array(samples)\n numpy = numpy / 2**15\n # tensor = torch.as_tensor(numpy)\n # tensor_float32 = torch.tensor(tensor, dtype=torch.float32)\n # tensor_float32 = tensor.clone().detach().requires_grad_(True)\n # tensor_float32 = tensor_float32.type(torch.float32)\... | [
"0.62673575",
"0.6075677",
"0.60158986",
"0.59733826",
"0.5816997",
"0.5797368",
"0.5791001",
"0.5783595",
"0.5740311",
"0.5733192",
"0.5720983",
"0.57165784",
"0.5694344",
"0.56208825",
"0.56109565",
"0.55959654",
"0.55813986",
"0.5578712",
"0.55778",
"0.55385333",
"0.551147... | 0.0 | -1 |
Convert Tensors in sample to ndarrays. | def TensorToPILImage(t):
# swap color axis because
# torch image: C X H X W
# numpy image: H x W x C
t1 = np.array(t, dtype='uint8')
newimg = t1.transpose((1, 2, 0))
return newimg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_numpy(tensor):\n return x.data.cpu().numpy()",
"def tensor2np(x):\n return x.cpu().numpy()",
"def tensor_to_np(tensor: Tensor) -> ndarray:\n if len(tensor.shape) == 4:\n return tensor.permute(0, 2, 3, 1).cpu().detach().numpy()\n else:\n return tensor.permute(1, 2, 0).cpu().deta... | [
"0.67712784",
"0.6444196",
"0.636948",
"0.6364168",
"0.6232269",
"0.6208554",
"0.60974175",
"0.60219485",
"0.5859495",
"0.5858865",
"0.58486843",
"0.5835521",
"0.57710737",
"0.5769094",
"0.5760054",
"0.5756542",
"0.5747306",
"0.5737221",
"0.5736891",
"0.5718971",
"0.5715755",... | 0.0 | -1 |
Checks that all decays are known and recorded in the DECAY_MODES list | def check_decay_types():
mas = []
modes = []
unmatched_DSIDs = []
for k in range(1, 299):
filename = 'ensdf.{:0>3d}'.format(k)
ef = ensdf_file(folder + filename)
for ds in ef.datasets:
if ds.type == "DECAY":
output = DSID_decay_template_rex.match(ds.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testToKnownDecValues(self):\n\n\t\tfor dec,deg in self.knownDecValues:\n\t\t\tresult = utils.dec2deg(dec)\n\t\t\tself.assertAlmostEqual(deg,result,places=2)",
"def valid_decisions(self):\n return self.get_queryset().valid_decisions()",
"def extract_decays():\n nuc_by_decays = {}\n for k in ran... | [
"0.56382227",
"0.54301286",
"0.5429606",
"0.527842",
"0.52717",
"0.52461696",
"0.52120876",
"0.52116746",
"0.5077111",
"0.50363934",
"0.49423504",
"0.4877209",
"0.48545408",
"0.48363248",
"0.47654116",
"0.4763036",
"0.47597817",
"0.47304952",
"0.46962625",
"0.46939856",
"0.46... | 0.6257432 | 0 |
Checks that all decays are known and recorded in the DECAY_MODES list | def extract_decays():
nuc_by_decays = {}
for k in range(1, 29):
filename = 'ensdf.{:0>3d}'.format(k)
ef = ensdf_file(folder + filename)
for ds in ef.datasets:
if ds.type == "DECAY":
output = DSID_decay_template_rex.match(ds.records[0].DSID)
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_decay_types():\n mas = []\n modes = []\n unmatched_DSIDs = []\n for k in range(1, 299):\n filename = 'ensdf.{:0>3d}'.format(k)\n ef = ensdf_file(folder + filename)\n\n for ds in ef.datasets:\n if ds.type == \"DECAY\":\n output = DSID_decay_templa... | [
"0.62573403",
"0.5638215",
"0.54310626",
"0.52790934",
"0.52703536",
"0.5247114",
"0.5209975",
"0.5208438",
"0.50763255",
"0.5036472",
"0.4943534",
"0.48774436",
"0.48528013",
"0.48323894",
"0.47648048",
"0.47643948",
"0.47581658",
"0.47304973",
"0.46960223",
"0.46921518",
"0... | 0.5431642 | 2 |
Checks that all decays are known and recorded in the DECAY_MODES list | def extract_adoptedlevels(maxA = 30):
nuc_with_adlev = []
for k in range(1, maxA):
filename = 'ensdf.{:0>3d}'.format(k)
ef = ensdf_file(folder + filename)
for ds in ef.datasets:
# if "ADOPTED LEVELS" in ds.records[0].record_raw:
if ds.type == "ADOPTED LEVELS":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_decay_types():\n mas = []\n modes = []\n unmatched_DSIDs = []\n for k in range(1, 299):\n filename = 'ensdf.{:0>3d}'.format(k)\n ef = ensdf_file(folder + filename)\n\n for ds in ef.datasets:\n if ds.type == \"DECAY\":\n output = DSID_decay_templa... | [
"0.6257432",
"0.56382227",
"0.54301286",
"0.5429606",
"0.527842",
"0.52717",
"0.52461696",
"0.52120876",
"0.52116746",
"0.5077111",
"0.50363934",
"0.49423504",
"0.4877209",
"0.48545408",
"0.48363248",
"0.47654116",
"0.4763036",
"0.47597817",
"0.47304952",
"0.46962625",
"0.469... | 0.0 | -1 |
Checks that all decays are known and recorded in the DECAY_MODES list | def extract_dataset_by_type(dataset_type='REFERENCES', maxA = 30):
nuc_with_adlev = []
for k in range(1, maxA):
filename = 'ensdf.{:0>3d}'.format(k)
ef = ensdf_file(folder + filename)
for ds in ef.datasets:
if ds.Z > 0:
ncosid = int(ds.A) * 100 + ds.Z
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_decay_types():\n mas = []\n modes = []\n unmatched_DSIDs = []\n for k in range(1, 299):\n filename = 'ensdf.{:0>3d}'.format(k)\n ef = ensdf_file(folder + filename)\n\n for ds in ef.datasets:\n if ds.type == \"DECAY\":\n output = DSID_decay_templa... | [
"0.6257432",
"0.56382227",
"0.54301286",
"0.5429606",
"0.527842",
"0.52717",
"0.52461696",
"0.52120876",
"0.52116746",
"0.5077111",
"0.50363934",
"0.49423504",
"0.4877209",
"0.48545408",
"0.48363248",
"0.47654116",
"0.4763036",
"0.47597817",
"0.47304952",
"0.46962625",
"0.469... | 0.0 | -1 |
Checks that all decays are known and recorded in the DECAY_MODES list | def extract_datasets(maxA = 30):
nuc_with_adlev = []
for k in range(1, maxA):
filename = 'ensdf.{:0>3d}'.format(k)
ef = ensdf_file(folder + filename)
for ds in ef.datasets:
if "ADOPTED LEVELS" in ds.records[0].record_raw:
A = int(ds.records[0].record_raw[:3].... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_decay_types():\n mas = []\n modes = []\n unmatched_DSIDs = []\n for k in range(1, 299):\n filename = 'ensdf.{:0>3d}'.format(k)\n ef = ensdf_file(folder + filename)\n\n for ds in ef.datasets:\n if ds.type == \"DECAY\":\n output = DSID_decay_templa... | [
"0.6257432",
"0.56382227",
"0.54301286",
"0.5429606",
"0.527842",
"0.52717",
"0.52461696",
"0.52120876",
"0.52116746",
"0.5077111",
"0.50363934",
"0.49423504",
"0.4877209",
"0.48545408",
"0.48363248",
"0.47654116",
"0.4763036",
"0.47597817",
"0.47304952",
"0.46962625",
"0.469... | 0.0 | -1 |
Creates a new instance of the appropriate class based on discriminator value | def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> LifecycleManagementSettings:
if not parse_node:
raise TypeError("parse_node cannot be null.")
return LifecycleManagementSettings() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> RiskDetection:\n if not parse_node:\n raise TypeError(\"parse_node cannot be null.\")\n return RiskDetection()",
"def create_from_discriminator_value(parse_node: Optional[ParseNode] = None) -> ThreatAssessment... | [
"0.68235403",
"0.6506879",
"0.63856864",
"0.6360109",
"0.63128185",
"0.6290668",
"0.62799436",
"0.6200238",
"0.61718166",
"0.6156329",
"0.6106893",
"0.61054206",
"0.608815",
"0.60292286",
"0.599005",
"0.5967407",
"0.593848",
"0.58803546",
"0.5868052",
"0.58679354",
"0.5863489... | 0.5928308 | 17 |
Creates and saves a User with the given email and password. | def create_user(self, email, password=None):
if not email:
raise ValueError('Users must have an email address')
user = self.model(
email=self.normalize_email(email),
)
user.set_password(password)
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_user(self, email, password, **extra_fields):\n if not email:\n raise ValueError('User must have an email address')\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self.... | [
"0.8466284",
"0.8451141",
"0.84238786",
"0.84134024",
"0.8409551",
"0.84064895",
"0.8404198",
"0.8390803",
"0.83900774",
"0.83900774",
"0.83900774",
"0.83900774",
"0.8376972",
"0.83751047",
"0.83751047",
"0.83751047",
"0.83751047",
"0.8370614",
"0.8366722",
"0.83633083",
"0.8... | 0.0 | -1 |
Creates and saves a staff user with the given email and password. | def create_staffuser(self, email, password):
user = self.create_user(
email,
password=password,
)
user.is_staff = True
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_staffuser(self, email, password=None):\r\n user = self.create_user(email, password=password, is_staff=True) \r\n return user",
"def create_staffuser(self, email, password):\n user = self.create_user(\n email,\n password=password,\n )\n user.s... | [
"0.83980024",
"0.8351594",
"0.8351594",
"0.8351594",
"0.8351594",
"0.83343494",
"0.80609906",
"0.8059442",
"0.7827982",
"0.7664124",
"0.7652704",
"0.7626644",
"0.76223433",
"0.7610267",
"0.7599266",
"0.7592139",
"0.75918174",
"0.75918174",
"0.75918174",
"0.75899345",
"0.75838... | 0.81134397 | 6 |
Creates and saves a superuser with the given email and password. | def create_superuser(self, email, password):
user = self.create_user(
email,
password=password,
)
user.is_staff = True
user.is_admin = True
user.is_superuser = True
user.save(using=self._db)
return user | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_superuser(self, email, password):\n user = self.create_user(\n email,\n password=password,\n )\n user.is_admin = True\n user.save(using=self._db)\n return user",
"def create_superuser(self, email, password, **extra_fields):\n return self._create_user(email, password, Tr... | [
"0.8300737",
"0.82998645",
"0.82963973",
"0.82285047",
"0.8178329",
"0.8157767",
"0.8157621",
"0.8157621",
"0.8157621",
"0.81548005",
"0.81516325",
"0.81466043",
"0.81466043",
"0.81466043",
"0.81466043",
"0.81458265",
"0.81452596",
"0.81436664",
"0.81426245",
"0.8142163",
"0.... | 0.8036136 | 65 |
Constructor for Present frame. | def __init__(self, name, crow_globals):
self._img_filenames = []
tk.Frame.__init__(self, width=47, height=450)
# begin defintiion of callbacks, followed by user interface
def presentdatacallback():
"""
Upon clicking the present data button, validate input and
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, frame):\n self._frame = frame\n self._out = None",
"def __init__(self, req_frame, frame_dim=-3, *args, **kwargs):\n self.req_frame = req_frame\n self.frame_dim = frame_dim\n\n super().__init__(*args, **kwargs)",
"def __init__(self, label: str, numFrame: int... | [
"0.66027045",
"0.6320495",
"0.6285087",
"0.6262684",
"0.6251338",
"0.6251338",
"0.6251338",
"0.6251338",
"0.6251338",
"0.6164629",
"0.60646355",
"0.60512847",
"0.6007992",
"0.6000264",
"0.6000264",
"0.59954196",
"0.59451705",
"0.5932824",
"0.591318",
"0.58980304",
"0.5853217"... | 0.0 | -1 |
Convenience function for drawing a pie. | def draw_filled(
totalcolormap,
welldata,
subplt,
row,
col,
datafilter=0,
cutoffvalues=None,
cutoffcolors=None,
excludeColmax=None,
):
# handle wells where one or more pie slices are zero
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_pie(t, n, radius):\n\tpolygon_triangle(t, n, radius)\n\tt.pu()\n\tt.fd(radius*2)\n\tt.pd()",
"def draw_pie(self, data):\n\n self.update()\n width = self.winfo_width() / CANVAS_ELEMENTS \n height = self.winfo_height()\n self.pie.delete(\"all\")\n\n gap = 100\n se... | [
"0.7336931",
"0.7207695",
"0.71691805",
"0.70284396",
"0.6919953",
"0.6604947",
"0.66011536",
"0.6549781",
"0.6534355",
"0.6479281",
"0.63620394",
"0.63338023",
"0.62564963",
"0.6248589",
"0.62043184",
"0.6186526",
"0.617089",
"0.6147786",
"0.6135387",
"0.6128223",
"0.6107613... | 0.0 | -1 |
Return a classifier based on provided model type. | def get_classifier(model_type = 'mlp', **kwargs):
if model_type == 'logistic':
model = LogisticRegression(penalty='none', **kwargs)
elif model_type == 'gradient_boosting':
model = HistGradientBoostingClassifier(**kwargs)
elif model_type == 'mlp':
model = MLPClassifier(**kwargs)
else:
raise Value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_classifier_instance(model_name):\n if model_name == 'CART':\n return tree.DecisionTreeClassifier()\n elif model_name == 'NB':\n return GaussianNB()\n elif model_name == 'LR':\n return linear_model.LogisticRegression(C=1e5)\n else:\n return None",
"def get_model(n... | [
"0.7532996",
"0.69017047",
"0.6808599",
"0.6560281",
"0.64079493",
"0.63911176",
"0.62812763",
"0.624428",
"0.6230058",
"0.6190342",
"0.6147835",
"0.6113006",
"0.6086718",
"0.60729635",
"0.6070676",
"0.60364145",
"0.6024882",
"0.6012354",
"0.5981829",
"0.59800583",
"0.5920986... | 0.80632496 | 0 |
Find the min distance between all endpoints and line segments | def findDistanceEndpoint(mask):
mask = measure.label(mask)
distance = []
number = np.max(mask)
endpoints = labelendpoints(mask)
for i in range(number):
(_, _, d) = findClosestEndpoint(i, endpoints)
distance.append(d)
distance = sorted(distance)
output = distance[0]
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minDistance(A, B, E) :\n\n # vector AB\n AB = [None, None]\n AB[0] = B[0] - A[0]\n AB[1] = B[1] - A[1]\n\n # vector BP\n BE = [None, None]\n BE[0] = E[0] - B[0]\n BE[1] = E[1] - B[1]\n\n # vector AP\n AE = [None, None]\n AE[0] = E[0] - A[0]\n AE[1] = E[1] - A[1]\n\n # Var... | [
"0.67059565",
"0.6663259",
"0.6582771",
"0.6580451",
"0.64971936",
"0.645101",
"0.6368254",
"0.6331214",
"0.62763363",
"0.6247953",
"0.6231812",
"0.617224",
"0.61529857",
"0.6127986",
"0.6102504",
"0.6055901",
"0.6055588",
"0.60379815",
"0.6027998",
"0.60268253",
"0.6008661",... | 0.0 | -1 |
Return the 01adjacency matrix of the given graph. | def to_adj_matrix(G):
l= [str(G.order())]
l.extend( [str(int(G.has_edge(u,v))) for u in G for v in G] )
return ' '.join(l) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjacency_matrix(graph):\n assert isinstance(graph, BasicGraph)\n return {v1: {v2: 0 if v1 == v2 else graph.edge(v1, v2, default=float('inf'))\n for v2 in graph.nodes()}\n for v1 in graph.nodes()}",
"def graph2matrix(graph):\n # inititalize empty matrix with a nested list ... | [
"0.800075",
"0.755276",
"0.75006026",
"0.7024974",
"0.6977125",
"0.689457",
"0.68726766",
"0.6872519",
"0.6860215",
"0.6822935",
"0.672155",
"0.6719776",
"0.67133564",
"0.6672193",
"0.66430396",
"0.65469486",
"0.6496708",
"0.64651275",
"0.634957",
"0.63201475",
"0.6317938",
... | 0.7027489 | 3 |
test correct short name | def test_short_name(self):
self.logTestName()
for name, dev in self.dev.items():
self.assertEqual(dev.short_name, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_class_must_have_both_short_and_long_name(self):\n eqclass = Klass()\n self.assertFalse(eqclass.name is None)\n self.assertFalse(eqclass.short_name is None)",
"def test_short_hero_name_from_url(self):\n self.assertEqual(parser.short_hero_name_from_url('/Test_asdf.mp3'), 'Test'... | [
"0.69644296",
"0.679807",
"0.6703414",
"0.6690839",
"0.665866",
"0.66448474",
"0.6491542",
"0.6476513",
"0.6436457",
"0.64087445",
"0.6359937",
"0.6320067",
"0.63193065",
"0.63144195",
"0.6303767",
"0.6303767",
"0.6274732",
"0.6272984",
"0.62709534",
"0.62602973",
"0.61644024... | 0.81417876 | 0 |
Returns the dict as a model | def from_dict(cls, dikt):
return util.deserialize_model(dikt, cls) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'Model':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'ModelOutput':\n return util.deserialize_model(dikt, cls)",
"def from_dict(cls, dikt) -> 'ModelStat':\n return util.deserialize_model(dikt, cls)",
"def _raw_base_json_to_model(d... | [
"0.73100865",
"0.7226481",
"0.68927467",
"0.67388964",
"0.66993856",
"0.6698291",
"0.6698291",
"0.6698291",
"0.6650225",
"0.66464084",
"0.64976215",
"0.6493406",
"0.64472944",
"0.6402614",
"0.6380075",
"0.63752437",
"0.63694054",
"0.6366468",
"0.6355182",
"0.6350017",
"0.6349... | 0.67725724 | 7 |
Gets the source_port of this LinkedSourceDefinition. | def source_port(self):
return self._source_port | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_port(self, source_port):\n # Validating the attribute source_port and then saving it.\n if source_port is None:\n raise GeneratedClassesError(\n \"The required parameter 'source_port' must not be 'None'.\")\n type_error = GeneratedClassesTypeError.type_erro... | [
"0.68366146",
"0.67399144",
"0.6531039",
"0.6481908",
"0.6386727",
"0.6386727",
"0.6381726",
"0.61915374",
"0.6069608",
"0.6069423",
"0.6061675",
"0.6023394",
"0.59523773",
"0.5950168",
"0.5950123",
"0.5862293",
"0.5861011",
"0.585605",
"0.58254683",
"0.57919985",
"0.57833004... | 0.81711394 | 0 |
Sets the source_port of this LinkedSourceDefinition. | def source_port(self, source_port):
# Validating the attribute source_port and then saving it.
if source_port is None:
raise GeneratedClassesError(
"The required parameter 'source_port' must not be 'None'.")
type_error = GeneratedClassesTypeError.type_error(LinkedSour... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_host(self, source_host):\n # Validating the attribute source_host and then saving it.\n if source_host is None:\n raise GeneratedClassesError(\n \"The required parameter 'source_host' must not be 'None'.\")\n type_error = GeneratedClassesTypeError.type_erro... | [
"0.6489447",
"0.6407739",
"0.6381855",
"0.63259494",
"0.628645",
"0.6088189",
"0.60612905",
"0.6051194",
"0.6051194",
"0.6041225",
"0.6041225",
"0.6021402",
"0.59408104",
"0.59408104",
"0.59408104",
"0.59408104",
"0.59408104",
"0.59408104",
"0.59408104",
"0.5924629",
"0.59246... | 0.8502039 | 0 |
Gets the snapshot_name of this LinkedSourceDefinition. | def snapshot_name(self):
return self._snapshot_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n if self._name is None:\n self._name = self.source.name\n return self._name",
"def snapshot_name(self, snapshot_name):\n # Validating the attribute snapshot_name and then saving it.\n if snapshot_name is None:\n raise GeneratedClassesError(\n ... | [
"0.6944085",
"0.68192106",
"0.67199993",
"0.6704069",
"0.6571366",
"0.65185386",
"0.6503722",
"0.6488209",
"0.62488663",
"0.62424135",
"0.6216322",
"0.6216322",
"0.62044555",
"0.6188655",
"0.61846465",
"0.61846465",
"0.61846465",
"0.60211265",
"0.59338856",
"0.59338856",
"0.5... | 0.7927592 | 0 |
Sets the snapshot_name of this LinkedSourceDefinition. | def snapshot_name(self, snapshot_name):
# Validating the attribute snapshot_name and then saving it.
if snapshot_name is None:
raise GeneratedClassesError(
"The required parameter 'snapshot_name' must not be 'None'.")
type_error = GeneratedClassesTypeError.type_error(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_source_node_name(self, node_name):\n self._source_node_name = node_name",
"def __init__(self, snapshot_name):\n self._snapshot_name = snapshot_name",
"def snapshot_name(self):\n return self._snapshot_name",
"def src_name(self, name: str):\n self._src_name = name",
"def S... | [
"0.6301453",
"0.6194971",
"0.58729786",
"0.5839664",
"0.5671276",
"0.5597612",
"0.54363084",
"0.5422047",
"0.53792113",
"0.53525347",
"0.533965",
"0.53324443",
"0.5326787",
"0.5326787",
"0.5326787",
"0.5326787",
"0.5326787",
"0.5326787",
"0.53236663",
"0.53088677",
"0.5302951... | 0.8348877 | 0 |
Gets the source_host of this LinkedSourceDefinition. | def source_host(self):
return self._source_host | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def src_host(self):\n return self._flow_id.src_host()",
"def src_host(self):\n return self._src_host",
"def source_host(self, source_host):\n # Validating the attribute source_host and then saving it.\n if source_host is None:\n raise GeneratedClassesError(\n ... | [
"0.7259571",
"0.70842445",
"0.6527205",
"0.6425526",
"0.6358731",
"0.62879103",
"0.61984336",
"0.61980057",
"0.61684465",
"0.6069535",
"0.6069535",
"0.6069535",
"0.6069535",
"0.6069535",
"0.6069535",
"0.6069535",
"0.6069535",
"0.6060852",
"0.6042234",
"0.59862596",
"0.5986259... | 0.7761184 | 0 |
Sets the source_host of this LinkedSourceDefinition. | def source_host(self, source_host):
# Validating the attribute source_host and then saving it.
if source_host is None:
raise GeneratedClassesError(
"The required parameter 'source_host' must not be 'None'.")
type_error = GeneratedClassesTypeError.type_error(LinkedSour... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_port(self, source_port):\n # Validating the attribute source_port and then saving it.\n if source_port is None:\n raise GeneratedClassesError(\n \"The required parameter 'source_port' must not be 'None'.\")\n type_error = GeneratedClassesTypeError.type_erro... | [
"0.63084537",
"0.6244036",
"0.62184167",
"0.6212031",
"0.615937",
"0.615937",
"0.615937",
"0.615937",
"0.6150923",
"0.610067",
"0.610067",
"0.6040084",
"0.60041827",
"0.60041827",
"0.60041827",
"0.60041827",
"0.60041827",
"0.60041827",
"0.60041827",
"0.60040677",
"0.59349835"... | 0.8473901 | 0 |
Gets the mount_location of this LinkedSourceDefinition. | def mount_location(self):
return self._mount_location | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mount_location(self, mount_location):\n # Validating the attribute mount_location and then saving it.\n if mount_location is None:\n raise GeneratedClassesError(\n \"The required parameter 'mount_location' must not be 'None'.\")\n type_error = GeneratedClassesType... | [
"0.71607",
"0.7149562",
"0.6851928",
"0.6851928",
"0.6851514",
"0.6851514",
"0.6851514",
"0.6851514",
"0.6851514",
"0.6851444",
"0.6851444",
"0.68509716",
"0.67512447",
"0.67512447",
"0.64405125",
"0.6268715",
"0.6268715",
"0.6268715",
"0.6268715",
"0.6088471",
"0.6066488",
... | 0.7997093 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.