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
Moves `step_side` in the `gradient` direction from `v`
def gradient_step(v: np.ndarray, gradient: np.ndarray, step_size: float) -> np.ndarray: assert len(v) == len(gradient) step = step_size * gradient return v + step
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient_step(v: Vector, gradient: Vector, step_size: float) -> Vector:\n assert len(v) == len(gradient)\n step = scalar_multiply(step_size, gradient)\n return add(v, step)", "def gradient_step(v: Vector, gradient: Vector, step_size: float) -> Vector:\n assert len(v) == len(gradient)\n step = ...
[ "0.719661", "0.719661", "0.6257147", "0.62302023", "0.5911716", "0.5908844", "0.58350974", "0.5799036", "0.56608707", "0.5641247", "0.5641183", "0.5571177", "0.55179965", "0.55179965", "0.5449358", "0.53776103", "0.5348916", "0.5322859", "0.53219855", "0.5320207", "0.5310357"...
0.71007687
2
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key
def get(self, key: int) -> int: idx = key % self.size if self.mp[idx]: for i in range(len(self.mp[idx])): if self.mp[idx][i][0] == key: return self.mp[idx][i][1] return -1 else: return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]", "def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1", "def get(self, key: int) -> int:\n sh = key % 37\n if ...
[ "0.8004181", "0.79102916", "0.7629919", "0.756535", "0.7556953", "0.75304717", "0.7526158", "0.7493195", "0.7374779", "0.72952664", "0.72940034", "0.72176445", "0.71817064", "0.717828", "0.71625984", "0.69816315", "0.69285554", "0.6785937", "0.67571914", "0.6733915", "0.66132...
0.7222593
11
Returns the value to which the specified key is mapped, or 1 if this map contains no mapping for the key
def get(self, key): hash_key = key % self.key_space return self.hash_table[hash_key].get(key)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, key: int) -> int:\n if key not in self.map:\n return -1\n return self.map[key]", "def get(self, key: int) -> int:\n if key in self.hashmap.keys():return self.hashmap[key]\n else:return -1", "def get(self, key: int) -> int:\n sh = key % 37\n if ...
[ "0.8004181", "0.79102916", "0.7629919", "0.756535", "0.7556953", "0.75304717", "0.7526158", "0.7493195", "0.7374779", "0.72952664", "0.72940034", "0.7222593", "0.72176445", "0.71817064", "0.717828", "0.71625984", "0.69816315", "0.69285554", "0.6785937", "0.67571914", "0.67339...
0.5840598
65
Returns the canonical URL for this instance. References `get_absolute_url()`_
def get_absolute_url(self) -> str: return reverse("accounts:user-detail", args=[str(self.user.id)])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_absolute_url(self):\n # TODO not implemented yet\n return self.slug", "def get_canonical_link(self):\n if self.article.final_url:\n kwargs = {'tag': 'link', 'attr': 'rel', 'value': 'canonical'}\n meta = self.parser.getElementsByTag(self.article.doc, **kwargs)\n ...
[ "0.79397535", "0.7904348", "0.75072145", "0.75039196", "0.736469", "0.7239944", "0.7187903", "0.717445", "0.70453185", "0.70269036", "0.70269036", "0.699991", "0.69523066", "0.6882423", "0.6881941", "0.6869155", "0.6835402", "0.6807677", "0.68027925", "0.67201734", "0.6674523...
0.0
-1
Draw on an image the bounding boxes on frame_tracks, with a different color for each track
def visualize_tracks_opencv(image, frame_tracks, colors, display=False, export_frames=False, export_path="test.png"): for id in frame_tracks.keys(): bbox = frame_tracks[id] minc, minr, maxc, maxr = bbox['bbox'] cv2.rectangle(image, (minc, minr), (maxc, maxr), colors[id]*255, 20) cv2....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visualize_tracks(image, frame_tracks, colors, display=False, export_frames=False, export_path=\"test.png\"):\n fig, ax = plt.subplots()\n ax.imshow(cv2.cvtColor(image, cv2.COLOR_BGR2RGB), cmap='gray')\n plt.xticks([]), plt.yticks([])\n\n for id in frame_tracks.keys():\n bbox = frame_tracks[i...
[ "0.7231601", "0.69444764", "0.62043005", "0.5989387", "0.59423065", "0.59415907", "0.5906465", "0.58898765", "0.5884432", "0.58801574", "0.5865228", "0.58565754", "0.5842156", "0.58415973", "0.58323175", "0.5824195", "0.5804158", "0.58015215", "0.5799903", "0.57890046", "0.57...
0.7106114
1
Return True if obj is a string or non iterable
def not_iterable(obj): return hasattr(obj,"rstrip") or not (hasattr(obj,"__getitem__") or hasattr(obj,"__iter__"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_non_string_iterable(obj: object) -> bool:\n return not (isinstance(obj, str) or isinstance(obj, bytes))\\\n and isinstance(obj, Iterable)", "def nonstringiter(obj):\n return not isinstance(obj, string_types) and isinstance(obj, Iterable)", "def isiterable(obj, strings=False, isinstance=isin...
[ "0.84285563", "0.83334494", "0.8150007", "0.8097691", "0.8062227", "0.80372655", "0.7920058", "0.78959554", "0.7860199", "0.7822824", "0.781209", "0.7809038", "0.7802446", "0.77585155", "0.7600159", "0.7517114", "0.75018835", "0.7474328", "0.7434571", "0.7407439", "0.73216915...
0.73294985
20
Add headers to both force latest IE rendering engine or Chrome Frame, and also to cache the rendered page for 10 minutes.
def add_header(r): r.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" r.headers["Pragma"] = "no-cache" r.headers["Expires"] = "0" r.headers['Cache-Control'] = 'public, max-age=0' return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, max-age=60'\n return response", "def add_header(response):\n response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'\n response.headers['Cache-Control'] = 'public, m...
[ "0.8223418", "0.8222592", "0.8222592", "0.8222592", "0.8222592", "0.8195761", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "0.8163386", "...
0.7141783
44
(list of int, int) > NoneType The funtion mutates the deck by swapping the card at given index with the following card. >>> swap_cards([5, 8, 1, 3, 2, 4, 7, 6], 2) >>> swap_cards([5, 6, 7, 1, 3, 2, 4], 3)
def swap_cards(deck, index): if index == len(deck) - 1: deck[0], deck[-1] = deck[-1], deck[0] else: deck[index], deck[index + 1] = deck[index + 1], deck[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_cards(deck: List[int], index: int) -> None:\n if index == len(deck) - 1:\n swap = deck[index]\n deck[index] = deck[0]\n deck[0] = swap\n\n else:\n swap = deck[index]\n deck[index] = deck[index + 1]\n deck[index + 1] = swap", "def swap_cards(deck_of_cards, ...
[ "0.83169466", "0.77344364", "0.71126163", "0.7112253", "0.69378555", "0.68194324", "0.6512175", "0.6503032", "0.6424223", "0.6130206", "0.61106616", "0.607789", "0.6077389", "0.60530096", "0.5961425", "0.59474367", "0.58971065", "0.58907413", "0.585749", "0.5852532", "0.58459...
0.7821934
1
(list of int) > int The function returns the value of the top card as an index, and returns the card at that index. If the top is the big joker, use the small joker as an index. >>> get_card_at_top_index([1, 7, 6, 2, 3, 4, 5]) 7 >>> get_card_at_top_index([4, 7, 6, 3, 5, 1, 2]) 5
def get_card_at_top_index(deck): small_joker_value = get_small_joker_value(deck) if deck[0] == get_big_joker_value(deck): return deck[get_small_joker_value(deck)] else: return deck[deck[0]]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_card_at_top_index(deck_of_cards):\n big_joker_value = get_big_joker_value(deck_of_cards)\n small_joker_value = get_small_joker_value(deck_of_cards)\n first_card = deck_of_cards[0]\n \n if first_card == big_joker_value:\n return deck_of_cards[small_joker_value]\n else:\n retu...
[ "0.8430752", "0.8368957", "0.65628237", "0.6508303", "0.6480749", "0.62888247", "0.6132346", "0.61089146", "0.6069625", "0.6052614", "0.6019172", "0.5985446", "0.5959198", "0.59510815", "0.5919342", "0.5912086", "0.5903366", "0.57885253", "0.57684875", "0.5756766", "0.5699034...
0.8284063
2
Check if block_hash is valid hash of block and satisfies the difficulty criteria.
def is_valid_proof(self, block, block_hash): return (block_hash.startswith('0' * Blockchain.difficulty) and block_hash == block.compute_hash())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_proof(self, block, block_hash): \n return (block_hash.startswith('0' * Blockchain.difficulty) and block_hash == compute_hash())", "def is_valid_proof(cls, block, block_hash):\n return (block_hash.startswith('0' * Blockchain.difficulty) and\n block_hash == block.compute_h...
[ "0.8461188", "0.7979075", "0.7979075", "0.78142095", "0.74190104", "0.7335974", "0.70439756", "0.6898661", "0.6725774", "0.65993714", "0.6548844", "0.6510162", "0.64781404", "0.6453064", "0.64419734", "0.6414622", "0.63950735", "0.639226", "0.63585657", "0.63573205", "0.63508...
0.7990994
1
Set the value of the future. This may only be done once.
def set(self, value): # The assertion is not thread-safe, but merely a sanity check. assert not self.event.is_set() self.value = value self.event.set()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_future(self, future):\r\n self._future = future", "async def set(self, value: Any) -> None:\n # Reminder for future self part 2:\n # - Entering the `async with` block acquires the condition's lock (waiting if necessary).\n # - We update the value in the container.\n # –...
[ "0.81511164", "0.71869475", "0.7174392", "0.70301986", "0.68746793", "0.67708147", "0.6714509", "0.6695727", "0.6605135", "0.65473336", "0.6526545", "0.65242565", "0.6518479", "0.6483149", "0.6483149", "0.6450734", "0.6445864", "0.6445864", "0.6445864", "0.6445864", "0.644586...
0.6778289
5
Return a version string of the latest APK version.
def version(self): if not self._version: self._version = self._get_version() return self._version
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_version_number(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"latest_version_number\")", "def get_version(self) -> str:\n return versioning.get_version()", "def get_version():\n return \"0.0.1 (prerelease prototype)\"", "def get_version():\n vers = [\"%(major)i.%(mino...
[ "0.74020886", "0.7350751", "0.73266", "0.73018694", "0.7233651", "0.72319394", "0.71115315", "0.7107694", "0.7101634", "0.7068449", "0.70358557", "0.7023338", "0.7007341", "0.70070773", "0.7002844", "0.6999086", "0.6997078", "0.69772154", "0.69648534", "0.695762", "0.6950873"...
0.0
-1
A query for an unknown user must return a 404 status code.
def test_unknown_user(self): self.sign_in() response = self.client.get(reverse('backend:user_details', args=(0,))) self.assertEqual(response.status_code, 404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_user_404(self):\n resp = self.app.get('/users/thisuserdoesntexist')\n assert resp.status_code == 404", "def test_returns_404_if_user_doesnt_exist(self):\n # Act\n response = self.client.get(\"/api/v2/projects/queries/non_existent/touched/\")\n self.assertEqual(resp...
[ "0.757701", "0.75699514", "0.72638494", "0.72149855", "0.7197626", "0.70950204", "0.7090081", "0.701981", "0.6964456", "0.6901627", "0.6834508", "0.68176764", "0.6771068", "0.67408645", "0.66560835", "0.66472983", "0.66286045", "0.6618836", "0.6605758", "0.6582285", "0.652114...
0.71590006
5
Sending a request without a `password` request parameter must return a 400 error.
def test_no_password(self): response = self.register({ 'first_name': "David", 'last_name': "Smith", 'email': "david.smith@mom.com", 'phone_number': "012-345-6789" }) self.assertEqual(response.status_code, 400) self.assertDic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_post_password_recoveries__bad_request(client):\n response = await client.post(\n \"/password_recoveries/\", json={\"some-useless-field\": \"foo\"}\n )\n assert response.status == 400", "def bad_request():\n return HttpError(400)", "def test_login_missing_password(self):\n ...
[ "0.720546", "0.7150178", "0.6913645", "0.6832836", "0.67685163", "0.6767013", "0.6714813", "0.67040884", "0.66772753", "0.6676721", "0.6659586", "0.6649965", "0.6638357", "0.6633523", "0.65945655", "0.6587868", "0.65782994", "0.6569439", "0.65271235", "0.65045196", "0.6450718...
0.6762625
6
Sending a request without an `email` request parameter must return a 400 error.
def test_no_email(self): response = self.register({ 'first_name': "David", 'last_name': "Smith", 'password': "******", 'phone_number': "012-345-6789" }) self.assertEqual(response.status_code, 400) self.assertDictContainsSubs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reset_request_non_existing_email(client, models):\n response = client.post(\n \"/password/reset-request\", json={\"email\": \"not-a-real@email.com\"}\n )\n assert response.status_code == 404", "def bad_request():\n return HttpError(400)", "def test_create_account_failed_no_email(sel...
[ "0.70593774", "0.69336706", "0.6843372", "0.67586035", "0.67586035", "0.67536", "0.67361397", "0.6720486", "0.66924226", "0.6682856", "0.66822046", "0.66598594", "0.6640234", "0.6634708", "0.6623896", "0.6588158", "0.6578471", "0.6502052", "0.6498784", "0.6494061", "0.6466241...
0.6560098
17
Sending a request with a blank `email` request parameter must return a 400 error.
def test_blank_email(self): response = self.register({ 'first_name': "David", 'last_name': "Smith", 'password': '******', 'email': "", 'phone_number': "012-345-6789" }) self.assertEqual(response.status_code, 400) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reset_request_non_existing_email(client, models):\n response = client.post(\n \"/password/reset-request\", json={\"email\": \"not-a-real@email.com\"}\n )\n assert response.status_code == 404", "def test_empty_email(self):\n data = json.dumps({\"email\": \"\", \"password\":\"123456...
[ "0.70741844", "0.70335484", "0.69518155", "0.6880298", "0.6880298", "0.6874552", "0.68134874", "0.67650694", "0.67627984", "0.67539746", "0.67415833", "0.67401016", "0.67192286", "0.6704304", "0.66925204", "0.6691991", "0.66717935", "0.6663471", "0.65430593", "0.6505024", "0....
0.65211767
19
Sending a request with an already existing `email` request parameter must return a 400 error.
def test_duplicate_email(self): params = { 'first_name': "David", 'last_name': "Smith", 'password': '******', 'email': "david.smith@mom.com", 'phone_number': "012-345-6789" } self.register(params) response = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_reset_request_non_existing_email(client, models):\n response = client.post(\n \"/password/reset-request\", json={\"email\": \"not-a-real@email.com\"}\n )\n assert response.status_code == 404", "def test_create_account_failed_existing_email(self):\n data = self.user_data.copy()\n ...
[ "0.69400656", "0.6847345", "0.67115164", "0.67015976", "0.6696879", "0.6612051", "0.658267", "0.6580306", "0.6547056", "0.6547056", "0.6532874", "0.65083736", "0.65083736", "0.6466007", "0.6431288", "0.63779557", "0.6377067", "0.6371997", "0.63108176", "0.62978464", "0.629709...
0.6163088
29
Sending a sign in request without an `email` request parameter must return a 400 error.
def test_sign_in_no_email(self): response = self.client.post(reverse('backend:sign_in'), {'password': '******'}) self.assertEqual(response.status_code, 400) self.assertDictContainsSubset({'status': "failure"}, response.json()) self.assertDictContainsSubset({'message': "Missing parameters...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_login_missing_email(self):\n response = self.client.post('/api/v2/auth/login',\n data=json.dumps(users[6]),\n content_type='application/json')\n self.assertEqual(response.status_code, 400)\n self.assertIn('Missing r...
[ "0.67451", "0.67221314", "0.67154175", "0.662729", "0.65787643", "0.65474606", "0.6453221", "0.6356258", "0.6352138", "0.63146853", "0.63018894", "0.6240601", "0.622584", "0.62224513", "0.6141697", "0.61063814", "0.60809183", "0.6054309", "0.6053659", "0.60360426", "0.6035620...
0.72418934
0
Sending a sign in request with an invalid `email` request parameter must return a 401 error.
def test_sign_in_invalid_email(self): user = User.objects.create(email='david.smith@mom.com', password='******') response = self.client.post(reverse('backend:sign_in'), {'email': 'wrong@email.com', 'password': user.password}) self.assertEqual(response.status_code, 401) self.assertDictCon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_signin(email, password):\n user = User.get_byemail(email)\n\n if not user:\n return \"Account doesn't exists, please register\", 401\n\n # check if authentication method by email exists for this user\n auth_id = 'email${}'.format(user.id)\n user_auth = UserAuth.exists(auth_id)\n ...
[ "0.7110344", "0.6856103", "0.6817743", "0.67419046", "0.67022127", "0.6634645", "0.6614103", "0.65519", "0.64859724", "0.6420294", "0.63928956", "0.6360221", "0.6352962", "0.6345161", "0.6318314", "0.6288452", "0.62824947", "0.6233794", "0.6192361", "0.6176929", "0.6170488", ...
0.69257593
1
Sending a sign in request with an invalid `email` request parameter must return a 401 error.
def test_sign_in_invalid_password(self): user = User.objects.create(email='david.smith@mom.com', password='******') response = self.client.post(reverse('backend:sign_in'), {'email': user.email, 'password': 'wrong_password'}) self.assertEqual(response.status_code, 401) self.assertDictCont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_signin(email, password):\n user = User.get_byemail(email)\n\n if not user:\n return \"Account doesn't exists, please register\", 401\n\n # check if authentication method by email exists for this user\n auth_id = 'email${}'.format(user.id)\n user_auth = UserAuth.exists(auth_id)\n ...
[ "0.71108764", "0.6927691", "0.6858432", "0.6819163", "0.67433053", "0.67028", "0.66368735", "0.66166484", "0.65511245", "0.6488245", "0.6422437", "0.6392444", "0.6361529", "0.6352191", "0.63476765", "0.6320803", "0.6290245", "0.62832296", "0.62329906", "0.61942", "0.61792386"...
0.58817714
50
Return the LandauLifshitz torque m moment unit vector heff effective magnetic field alpha Gilbert damping parameter
def landau_lifshitz(m, heff, alpha): hxm = np.cross(heff,m) return hxm + alpha*np.cross(m,hxm)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_torque(self):\n def torque_func(m):\n heff = self.field(m)\n total_torque = torque.landau_lifshitz(m, heff, self.damping)\n if self.stt != 0:\n total_torque += torque.slonczewski(m, self.Jc, self.stt)\n return total_torque\n self.tor...
[ "0.6267058", "0.60297215", "0.5872876", "0.58271825", "0.581367", "0.5790903", "0.5741664", "0.5741664", "0.5721938", "0.5720839", "0.5716535", "0.56928045", "0.56830835", "0.56767845", "0.56408024", "0.56408024", "0.56180066", "0.5581955", "0.5571666", "0.5570663", "0.556670...
0.59770703
2
Return the Slonczewski spintransfer torque m moment unit vector Jc current density vector stt torque prefactor (precalculated)
def slonczewski(m, Jc, stt): p = -Jc*stt return np.cross(m,np.cross(p,m))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_torque(self):\n return self.node.sdo[0x6077].phys # rate torque(mN.m) /1000", "def _compute_solar_torque(self):\n pass", "def get_torque(self, theta, modulus):\n\n\t\treturn self.get_k(modulus)*theta", "def make_torque(self):\n def torque_func(m):\n heff = self.field...
[ "0.66428894", "0.6471683", "0.6231447", "0.6156875", "0.5988345", "0.5988345", "0.59550995", "0.5905779", "0.58930105", "0.58844227", "0.5866877", "0.58215475", "0.5798129", "0.5789564", "0.569655", "0.5666042", "0.5585717", "0.5583017", "0.557717", "0.55695283", "0.5438054",...
0.0
-1
Returns whether all elements of sequence are the same
def allsame(xs): assert len(xs) > 0 return all(x == xs[0] for x in xs[1:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_equal(sequence):\n return all(x == sequence[0] for x in sequence)", "def same(seq: typing.Iterable[typing.Any]) -> bool:\n seq = iter(seq)\n first = type(next(seq))\n return all(isinstance(i, first) for i in seq)", "def all_same(items):\n \n return all(x == items[0] for x ...
[ "0.8690832", "0.7782505", "0.7672542", "0.7458347", "0.7458347", "0.740885", "0.7356207", "0.73302054", "0.7281289", "0.7078206", "0.7050159", "0.6911079", "0.6902018", "0.6872127", "0.6834911", "0.68009186", "0.6800209", "0.6784766", "0.670457", "0.667601", "0.66593885", "...
0.7814995
1
Get the plugin config status and settings from QSettings
def ApisPluginSettings(): s = QSettings() if s.contains("APIS/config_ini"): if os.path.isfile(s.value("APIS/config_ini")): return IsApisIni(s.value("APIS/config_ini")) else: # Settings INI as stored does not exist return False, tr(u"Ausgewählte APIS INI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_plugin_config(self, **kwargs) -> Any:\n namespace = self._get_namespace(**kwargs)\n return await self.AD.plugins.get_plugin_meta(namespace)", "def _get_settings():\n # store_last_good=True tells config component to update the config file\n # in a cron job. Here we just read from the...
[ "0.6948694", "0.68398756", "0.68317646", "0.6797159", "0.6774139", "0.66477865", "0.6565564", "0.65460765", "0.65072894", "0.6349131", "0.6328165", "0.6302951", "0.6302951", "0.6254989", "0.62194836", "0.62096786", "0.62076133", "0.6199631", "0.6188538", "0.617836", "0.617516...
0.6569709
6
Helper function to convert the GPS coordinates stored in the EXIF to degress in float format
def ConvertToDegress(value): return float(value.values[0].num) / float(value.values[0].den) + (float(value.values[1].num) / float(value.values[1].den) / 60.0) + (float(value.values[2].num) / float(value.values[2].den) / 3600.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def points2float(gpx_track):\n \n points = np.empty([gpx_track.get_points_no(), 2])\n elevation = np.empty([gpx_track.get_points_no(), 1])\n n = 0\n for segment in gpx_track.segments:\n for point in segment.points:\n points[n, 0] = point.longitude\n points[n, 1] = point....
[ "0.6406841", "0.6318658", "0.6221846", "0.6213082", "0.61686385", "0.61533195", "0.6113347", "0.60742605", "0.5935368", "0.5931068", "0.5846192", "0.58205545", "0.5800774", "0.57275814", "0.57250226", "0.57180613", "0.5695942", "0.56818783", "0.56557953", "0.56557953", "0.564...
0.59942853
8
Get a graph from the stored edges.
def to_graph(self, undirected=True, imposed_labels=None): from .graph import Graph # Check for directionality. Crucial for storing in a # lower triangular sparse matrix, the graph. labels = None if imposed_labels is None: labels = ( sorted(self.labels,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def graph_from_edges(e):\n G = Graph()\n for (x, y) in e:\n G.add_vertex(x)\n G.add_vertex(y)\n G.add_edge( (x, y) )\n return G", "def extract_edges(graph):\n return graph.get_edges()", "def get_graph(self):\n return copy.deepcopy(self.graph)", "def get_graph(path: str...
[ "0.71540546", "0.68345946", "0.6592369", "0.6582886", "0.6550074", "0.6549306", "0.6536619", "0.65175766", "0.6496022", "0.64897263", "0.644948", "0.6431618", "0.63834697", "0.63332695", "0.63277715", "0.63277715", "0.63171583", "0.6313049", "0.62819433", "0.62556446", "0.623...
0.0
-1
Get a dictionary to represent the edge list.
def get_df_dict(self, threshold=None): return self.df[np.abs(self.df['intensity']) > threshold ].to_dict() if threshold else self.df.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edges(self):\n return [(k, val) for k, v in self.dict.iteritems() for val in v]", "def edgeMap (self):\n return self.__edgeMap", "def edges(self):\n edge_list = []\n for node1 in self.node_dict:\n for node2 in self.node_dict[node1]:\n edge_list.append((...
[ "0.7460863", "0.73529005", "0.7271635", "0.7156048", "0.7121664", "0.70994216", "0.70223427", "0.6956359", "0.6945023", "0.69388175", "0.6910567", "0.6894074", "0.683775", "0.68029237", "0.6754493", "0.6727433", "0.6725324", "0.6718698", "0.6693398", "0.66924065", "0.66875005...
0.0
-1
String representation for an InteractionTable.
def __str__(self): return ( 'cosifer.collections.interactions_table.' + 'InteractionsTable\n{}\n{}'.format(self.labels, self.df) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n\n table_list = [self.headers]\n\n for row in self.data:\n table_list.append([row[col] or \"\" for col in self.headers])\n\n return create_table_string(table_list)", "def __repr__(self):\n return \"[\" + \", \".join([str(member) for member in self.table]...
[ "0.7173547", "0.7085337", "0.6919677", "0.6833411", "0.6788228", "0.6715547", "0.6651445", "0.6640299", "0.66123414", "0.6569657", "0.6562555", "0.6556305", "0.6556305", "0.6521573", "0.6507041", "0.6507041", "0.6451217", "0.64381516", "0.6436835", "0.64301604", "0.6425686", ...
0.8108659
0
Construct an InteractionTable from a dictionary.
def interaction_table_from_dict(interaction_dictionary): return InteractionTable( df=pd.DataFrame(interaction_dictionary['interactions']), labels=interaction_dictionary['labels'] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(cls, input_dict):\n expected_keys = set([\"row_start\", \"row_end\", \"col_start\", \"col_end\"])\n VERIFICATION.verify_type(input_dict, dict, \"input must be dict\")\n VERIFICATION.verify_value(set(input_dict.keys()) == expected_keys,\n \"expecte...
[ "0.6193479", "0.5979516", "0.5877095", "0.5827393", "0.5818396", "0.5736301", "0.5728961", "0.5725682", "0.5724076", "0.5680048", "0.5662759", "0.5644166", "0.5643065", "0.56002575", "0.55820495", "0.55820495", "0.5582038", "0.5578741", "0.5531663", "0.55216545", "0.55064416"...
0.8523352
0
Instantiate from a dict
def from_dict(cls, idict, **kwargs): slf = cls(SkyCoord(ra=idict['RA'], dec=idict['DEC'], unit='deg'), zem=idict['zem'], name=idict['name'], **kwargs) # Other for key in idict.keys(): if key in ['RA', 'DEC', 'zem', 'name', 'components']: continue ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n return cls.from_dict(_dict)", "def _from_dict(cls, _dict):\n ...
[ "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906", "0.84858906"...
0.0
-1
Returns an sqlalchemy session, and after the test tears down everything properly.
def dbsession(engine, tables): Session = sessionmaker(bind=engine) session = Session() yield session for sneaker in session.query(Sneaker).all(): session.delete(sneaker) for source in session.query(Source).all(): session.delete(source) session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_session(configuration, request):\n SessionFactory = configuration.registry['dbsession_factory']\n session = SessionFactory()\n engine = session.bind\n Base.metadata.drop_all(engine)\n Base.metadata.create_all(engine)\n\n def teardown():\n session.transaction.rollback()\n Base...
[ "0.7709301", "0.7646407", "0.75536275", "0.754508", "0.74127966", "0.7384151", "0.7337394", "0.7337288", "0.7309262", "0.71998763", "0.7175955", "0.71282077", "0.71282077", "0.7122699", "0.71180487", "0.7070358", "0.7050763", "0.70484364", "0.7016291", "0.70106256", "0.698541...
0.0
-1
Emit a message to the specified stream (default `sys.stderr`).
def emit_message(message, stream=None): if stream is None: stream = sys.stderr stream.write("%(message)s\n" % vars()) stream.flush()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, msg):\n sys.stderr.write(msg)", "def write(self, msg):\n\n sys.stderr.write(msg)", "def to_stderr(message):\n print >> sys.stderr, message", "def print_to_stderr(msg):\n sys.stderr.write(msg)", "def error(message):\n print(message, file=sys.stderr)", "def print_...
[ "0.68711364", "0.6829964", "0.681114", "0.6739621", "0.6470576", "0.6445075", "0.6374977", "0.63438404", "0.6340822", "0.63338846", "0.6276301", "0.6261263", "0.6124463", "0.6102289", "0.60573477", "0.6034428", "0.6029426", "0.60064465", "0.5998845", "0.5976955", "0.59517", ...
0.84494895
0
Return list of prime numbers less than equal to n
def sieve(n): results = [1 for _ in range(n+1)] results[0], results[1] = 0, 0 results = [0,0] + [1]*(n - 1) len(results) div = 2 for i,num in enumerate(results): if num: k = i * 2 while k <= n: seive[k] = 0 k+= i return [x for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes(n):\n return [i for i in xrange(1, n + 1) if mr_prime(i)]", "def generate_prime_less_than_n(n):\n\tif n <= 1:\n\t\treturn []\n\tlist_of_primes = [2]\n\tfor i in range(3, n, 2):\n\t\tis_prime = True\n\t\tfor j in list_of_primes:\n\t\t\tif i%j == 0:\n\t\t\t\tis_prime = False\n\t\t\t\tbreak\n\t\tif is...
[ "0.85212415", "0.8498636", "0.84208864", "0.84084016", "0.81956875", "0.8144652", "0.8068942", "0.80118805", "0.7967104", "0.7945543", "0.7938975", "0.79361534", "0.7927065", "0.78900254", "0.7853399", "0.78142273", "0.7801944", "0.7781685", "0.7774308", "0.7729891", "0.77257...
0.0
-1
Returns the key of the file with the given config.context
def get_key(self, file_name, config) -> str: self.validate_correct_operation(op_name=self.name, key_type=config[ConfigKeys.key_type]) return self._get_key(file_name, config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_key(self, file_name, config) -> str:\n pass", "def file_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"file_key\")", "def file_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"file_key\")", "def file_key(filename):\n return FILE_PREFIX + filename", "...
[ "0.7825358", "0.65962696", "0.65962696", "0.6478777", "0.6415051", "0.6351035", "0.62190413", "0.6098302", "0.60659033", "0.60595864", "0.6059109", "0.59660876", "0.5946941", "0.5883707", "0.58818763", "0.58517313", "0.58515346", "0.5785396", "0.5774071", "0.575473", "0.57434...
0.6990027
1
Returns the key of the file with the given config.context
def _get_key(self, file_name, config) -> str: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_key(self, file_name, config) -> str:\n self.validate_correct_operation(op_name=self.name, key_type=config[ConfigKeys.key_type])\n return self._get_key(file_name, config)", "def file_key(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"file_key\")", "def file_key(self) -> pul...
[ "0.6990027", "0.65962696", "0.65962696", "0.6478777", "0.6415051", "0.6351035", "0.62190413", "0.6098302", "0.60659033", "0.60595864", "0.6059109", "0.59660876", "0.5946941", "0.5883707", "0.58818763", "0.58517313", "0.58515346", "0.5785396", "0.5774071", "0.575473", "0.57434...
0.7825358
0
Fakes `date`. Sets day to `1`.
def fake_date_without_day(value): return date(year=value[0], month=value[1], day=1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_day(date):\n year, month, day = (date.year, date.month, date.day)\n try:\n day += 1\n return datetime.date(year, month, day)\n except ValueError:\n try:\n month += 1\n day = 1\n return datetime.date(year, month, day)\n except Value...
[ "0.7199576", "0.6836182", "0.6836182", "0.64389855", "0.62450105", "0.6209069", "0.6159879", "0.61415374", "0.61415374", "0.608314", "0.5967545", "0.59614974", "0.5904009", "0.5872342", "0.5864313", "0.5855805", "0.5843234", "0.57852036", "0.57852036", "0.57852036", "0.578520...
0.6513064
3
Should return http status 400 when task name has a exceeded amount of char.
def test_list_tasks_exceeded_amount_characters(self): rv = TEST_CLIENT.post( "/tasks/list-tasks", json={ "filters": { "name": "LoremipsumdolorsitametconsecteturadipiscingelitInteerelitexauc" } }, ) result = r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_task_exceeded_amount_characters(self):\n rv = TEST_CLIENT.post(\n TASK_ROUTE,\n json={\n \"name\": \"LoremipsumdolorsitametconsecteturadipiscingelitInteerelitexauc\"\n },\n )\n result = rv.json()\n expected = {\n ...
[ "0.7812788", "0.7385697", "0.7271345", "0.71459967", "0.6906761", "0.6700208", "0.6528484", "0.6349938", "0.633722", "0.62562716", "0.6213755", "0.6122487", "0.6091234", "0.6086678", "0.6082462", "0.6025023", "0.5978479", "0.59350413", "0.5927258", "0.58082324", "0.57244265",...
0.7531851
1
Should return http status 400 when task name has a exceeded amount of char.
def test_create_task_exceeded_amount_characters(self): rv = TEST_CLIENT.post( TASK_ROUTE, json={ "name": "LoremipsumdolorsitametconsecteturadipiscingelitInteerelitexauc" }, ) result = rv.json() expected = { "code": "Exceeded...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_list_tasks_exceeded_amount_characters(self):\n rv = TEST_CLIENT.post(\n \"/tasks/list-tasks\",\n json={\n \"filters\": {\n \"name\": \"LoremipsumdolorsitametconsecteturadipiscingelitInteerelitexauc\"\n }\n },\n ...
[ "0.7531851", "0.7385697", "0.7271345", "0.71459967", "0.6906761", "0.6700208", "0.6528484", "0.6349938", "0.633722", "0.62562716", "0.6213755", "0.6122487", "0.6091234", "0.6086678", "0.6082462", "0.6025023", "0.5978479", "0.59350413", "0.5927258", "0.58082324", "0.57244265",...
0.7812788
0
Should return http status 400 when task data_in has a exceeded amount of char.
def test_create_task_exceeded_amount_characters_in_dataIn(self): rv = TEST_CLIENT.post( TASK_ROUTE, json={ "dataIn": DESCRIPTION }, ) result = rv.json() expected = { "code": "ExceededCharQuantity", "message": "Ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_task_exceeded_amount_characters_in_dataOut(self):\n rv = TEST_CLIENT.post(\n TASK_ROUTE,\n json={\n \"dataIn\": DESCRIPTION\n },\n )\n result = rv.json()\n expected = {\n \"code\": \"ExceededCharQuantity\",\n ...
[ "0.7594554", "0.74093795", "0.7249633", "0.70895064", "0.70603883", "0.6846049", "0.6700865", "0.6425223", "0.58832693", "0.58751744", "0.5873143", "0.5795467", "0.5769055", "0.5768104", "0.5738529", "0.56816626", "0.5634966", "0.56095386", "0.5501887", "0.5490004", "0.544051...
0.77867115
0
Should return http status 400 when task tag has any forbidden char.
def test_create_task_tags_with_forbidden_char(self): rv = TEST_CLIENT.post( TASK_ROUTE, json={ "tags": [ "tag1", "tag2", "tag3", "tag4", "tag@", ] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_update_task_tags_with_forbidden_char(self):\n task_id = util.MOCK_UUID_5\n rv = TEST_CLIENT.patch(\n f\"/tasks/{task_id}\",\n json={\n \"tags\": [\n \"tag1\",\n \"tag2\",\n \"tag3\",\n ...
[ "0.75851053", "0.6844821", "0.6629892", "0.65474415", "0.6419741", "0.6363458", "0.6196935", "0.6169127", "0.616309", "0.6162857", "0.61517495", "0.6124134", "0.60712373", "0.6017188", "0.5958713", "0.59209335", "0.59144604", "0.58707035", "0.57603335", "0.5719665", "0.569893...
0.8001675
0
Should return http status 400 and a message 'invalid docker image name'.
def test_create_task_invalid_docker_image_error(self): docker_image = "unk" rv = TEST_CLIENT.post( TASK_ROUTE, json={ "image": docker_image, }, ) result = rv.json() expected = { "message": "invalid docker image name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_error_invalid_dockerimage_name(self):\n invalid_docker_image_name = ':baz'\n config = dict(\n version=1,\n applications={'mysql-hybridcluster': dict(\n image=invalid_docker_image_name)})\n parser = Configuration()\n exception = self.assertRa...
[ "0.68951213", "0.6534", "0.64682156", "0.64259684", "0.6418903", "0.6415244", "0.6381294", "0.63677245", "0.6347496", "0.6329139", "0.62480223", "0.62257606", "0.62043345", "0.6201926", "0.6146025", "0.6045508", "0.6043042", "0.60330194", "0.5987971", "0.59359145", "0.5917924...
0.7976879
0
Should return a http error 404 and a message 'specified task does not exist'.
def test_get_task_not_found(self): task_id = "foo" rv = TEST_CLIENT.get(f"/tasks/{task_id}") result = rv.json() expected = { "message": "The specified task does not exist", "code": "TaskNotFound", } self.assertDictEqual(expected, result) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_05d_get_nonexistant_app_task(self):\r\n res = self.app.get('/app/noapp/task', follow_redirects=True)\r\n assert res.status == '404 NOT FOUND', res.status\r\n # Pagination\r\n res = self.app.get('/app/noapp/task/25', follow_redirects=True)\r\n assert res.status == '404 NO...
[ "0.7835368", "0.76944184", "0.76746774", "0.7659655", "0.7204364", "0.7147904", "0.7107935", "0.70461804", "0.7005151", "0.69685316", "0.69601434", "0.69439447", "0.6942516", "0.6915237", "0.6901413", "0.68565905", "0.6814928", "0.68060994", "0.67951113", "0.67771405", "0.673...
0.8576574
0
Should return a http error 404 and a message 'The specified task does not exist'.
def test_update_task(self): rv = TEST_CLIENT.patch( "/tasks/foo", json={ "name": "foo 2", }, ) result = rv.json() expected = { "message": "The specified task does not exist", "code": "TaskNotFound", } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_task_not_found(self):\n task_id = \"foo\"\n\n rv = TEST_CLIENT.get(f\"/tasks/{task_id}\")\n result = rv.json()\n\n expected = {\n \"message\": \"The specified task does not exist\",\n \"code\": \"TaskNotFound\",\n }\n self.assertDictEqual...
[ "0.85842264", "0.7769934", "0.7731954", "0.764185", "0.760977", "0.7114625", "0.70919275", "0.699508", "0.69752306", "0.6959012", "0.6941566", "0.6926577", "0.6921741", "0.68800676", "0.68740827", "0.68003154", "0.67798793", "0.67158145", "0.66920793", "0.66819364", "0.664373...
0.7019205
7
Should return a http error 400 and a message 'Invalid category. Choose any of {valid_str}'.
def test_update_task_invalid_category_error(self): task_id = util.MOCK_UUID_4 category = "unk" rv = TEST_CLIENT.patch( f"/tasks/{task_id}", json={ "category": category, }, ) result = rv.json() valid_str = "DEFAULT,DATAS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_category(self, data):\n try:\n if data['category_name'] == \"\":\n return \"Category_name cannot be blank\"\n if 'category_name' not in data.keys():\n return \"Enter category_name\"\n if not re.match(r\"^[a-zA-Z0-9 _]*$\", data['cat...
[ "0.70289874", "0.6699313", "0.66132545", "0.649449", "0.638027", "0.6287617", "0.6163031", "0.6071611", "0.6071006", "0.6032324", "0.6014144", "0.59745026", "0.5943954", "0.5904474", "0.5893927", "0.5858132", "0.5858021", "0.5835313", "0.58172923", "0.57886434", "0.57827604",...
0.69926435
1
Should return a http error 404 and a message 'The specified task does not exist'.
def test_delete_task_not_found(self): task_id = "unk" rv = TEST_CLIENT.delete(f"/tasks/{task_id}") result = rv.json() expected = { "message": "The specified task does not exist", "code": "TaskNotFound", } self.assertDictEqual(expected, result) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_task_not_found(self):\n task_id = \"foo\"\n\n rv = TEST_CLIENT.get(f\"/tasks/{task_id}\")\n result = rv.json()\n\n expected = {\n \"message\": \"The specified task does not exist\",\n \"code\": \"TaskNotFound\",\n }\n self.assertDictEqual...
[ "0.85842264", "0.7769934", "0.764185", "0.760977", "0.7114625", "0.70919275", "0.7019205", "0.699508", "0.69752306", "0.6959012", "0.6941566", "0.6926577", "0.6921741", "0.68800676", "0.68740827", "0.68003154", "0.67798793", "0.67158145", "0.66920793", "0.66819364", "0.664373...
0.7731954
2
Should return http status 400 when task data_in has a exceeded amount of char.
def test_update_task_exceeded_amount_characters_in_dataIn(self): task_id = util.MOCK_UUID_5 rv = TEST_CLIENT.patch( f"/tasks/{task_id}", json={ "dataIn": DESCRIPTION }, ) result = rv.json() expected = { "code": "Exce...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_task_exceeded_amount_characters_in_dataIn(self):\n rv = TEST_CLIENT.post(\n TASK_ROUTE,\n json={\n \"dataIn\": DESCRIPTION\n },\n )\n result = rv.json()\n expected = {\n \"code\": \"ExceededCharQuantity\",\n ...
[ "0.7787049", "0.75947297", "0.72499067", "0.7089931", "0.70613617", "0.6846448", "0.67015785", "0.6425751", "0.5883493", "0.5874909", "0.58717924", "0.5794927", "0.57684433", "0.5767928", "0.5738096", "0.5680652", "0.56366986", "0.56092316", "0.55014384", "0.54902273", "0.544...
0.7409815
2
Should return http status 200.
def test_update_task_dataIn_success(self, mock_api, mock_custom_objects_api, mock_kube_config): task_id = util.MOCK_UUID_5 rv = TEST_CLIENT.patch( f"/tasks/{task_id}", json={ "dataIn": "description" }, ) self.assertEqual(rv.status_code,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_response_200_on_get(self):\n pass", "def test_status_code(self):\n self.assertEquals(self.response.status_code, 200)", "def test_view_success_code(self):\n response = self.client.get(self.get_url())\n self.assertEqual(response.status_code, 200)", "def test_view_success_co...
[ "0.80502963", "0.77810353", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", ...
0.0
-1
Should return http status 200.
def test_update_task_dataOut_success(self, mock_api, mock_custom_objects_api, mock_kube_config): task_id = util.MOCK_UUID_5 rv = TEST_CLIENT.patch( f"/tasks/{task_id}", json={ "dataOut": "description" }, ) self.assertEqual(rv.status_cod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_response_200_on_get(self):\n pass", "def test_status_code(self):\n self.assertEquals(self.response.status_code, 200)", "def test_view_success_code(self):\n response = self.client.get(self.get_url())\n self.assertEqual(response.status_code, 200)", "def test_view_success_co...
[ "0.80502963", "0.77810353", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", ...
0.0
-1
Should return http status 400 when task tag has any forbidden char.
def test_update_task_tags_with_forbidden_char(self): task_id = util.MOCK_UUID_5 rv = TEST_CLIENT.patch( f"/tasks/{task_id}", json={ "tags": [ "tag1", "tag2", "tag3", "tag4", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_task_tags_with_forbidden_char(self):\n rv = TEST_CLIENT.post(\n TASK_ROUTE,\n json={\n \"tags\": [\n \"tag1\",\n \"tag2\",\n \"tag3\",\n \"tag4\",\n \"tag@\",\n...
[ "0.8001675", "0.6844821", "0.6629892", "0.65474415", "0.6419741", "0.6363458", "0.6196935", "0.6169127", "0.616309", "0.6162857", "0.61517495", "0.6124134", "0.60712373", "0.6017188", "0.5958713", "0.59209335", "0.59144604", "0.58707035", "0.57603335", "0.5719665", "0.5698933...
0.75851053
1
Should return http status 200.
def test_update_task_tag(self, mock_api, mock_custom_objects_api, mock_kube_config): task_id = util.MOCK_UUID_5 rv = TEST_CLIENT.patch( f"/tasks/{task_id}", json={ "tags": [ "tag1", "tag2", "tag3", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_response_200_on_get(self):\n pass", "def test_status_code(self):\n self.assertEquals(self.response.status_code, 200)", "def test_view_success_code(self):\n response = self.client.get(self.get_url())\n self.assertEqual(response.status_code, 200)", "def test_view_success_co...
[ "0.80502963", "0.77810353", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", ...
0.0
-1
Should return http status 200.
def test_update_task_docs(self, mock_api, mock_custom_objects_api, mock_kube_config): task_id = util.MOCK_UUID_5 rv = TEST_CLIENT.patch( f"/tasks/{task_id}", json={"docs": "https://www.google.com.br"}, ) self.assertEqual(rv.status_code, 200)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_response_200_on_get(self):\n pass", "def test_status_code(self):\n self.assertEquals(self.response.status_code, 200)", "def test_view_success_code(self):\n response = self.client.get(self.get_url())\n self.assertEqual(response.status_code, 200)", "def test_view_success_co...
[ "0.80502963", "0.77810353", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", "0.7715312", ...
0.0
-1
Return a tuple (u, v, d); they are the greatest common divisor d of two integers x and y and u, v such that d = x u + y v.
def extgcd(x, y): # Crandall & Pomerance "PRIME NUMBERS", Algorithm 2.1.4 page 85 of "http://thales.doa.fmph.uniba.sk/macaj/skola/teoriapoli/primes.pdf" a, b, g, u, v, w = 1, 0, x, 0, 1, y while w: q, t = divmod(g, w) a, b, g, u, v, w = u, v, w, a-q*u, b-q*v, t if g >= 0: return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greatest_common_divisor(x: int, y: int) -> int:\n while y != 0:\n (x, y) = (y, x % y)\n return x", "def gcd(x, y):\n if x < y: x, y = y, x\n while y: x, y = y, x%y\n return x", "def gcd(x, y):\n x, y = abs(x), abs(y)\n while y:\n x, y =...
[ "0.6941031", "0.6888487", "0.68209743", "0.6819619", "0.67412305", "0.6729684", "0.6711755", "0.67072856", "0.66960275", "0.6642795", "0.6635084", "0.6618099", "0.6562939", "0.6539578", "0.6539578", "0.6537952", "0.6537885", "0.6525528", "0.6521369", "0.6516852", "0.65057194"...
0.63107663
57
Convert Rotation Matrices to Quaternions
def mat2quat(mat, rot_type='proper'): #leila: read this: https://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm ax_ang = vrrotmat2vec(mat, rot_type) q0 = np.cos(ax_ang[3, :]/2) q1 = ax_ang[0, :]*np.sin(ax_ang[3, :]/2) q2 = ax_ang[1, :]*np.sin(ax_ang[3, :]/2) q3 = ax...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rotation_mat_to_quat(R, q):\n q[0] = np.sqrt(R[0] + R[4] + R[8]) / 2\n q[1] = (R[7] - R[5]) / (4. * q[0])\n q[2] = (R[2] - R[6]) / (4. * q[0])\n q[3] = (R[3] - R[1]) / (4. * q[0])", "def quaternion_to_rotation_matrix(q0, q1, q2, q3) -> np:\n\n # First row of the rotation matrix\n r00 = 2 * ...
[ "0.7195342", "0.71134377", "0.7092584", "0.70420396", "0.7008543", "0.7004162", "0.69914675", "0.69645756", "0.6957282", "0.6919714", "0.6898155", "0.68469375", "0.6843546", "0.6839718", "0.68340373", "0.6831574", "0.6829084", "0.67991596", "0.6792751", "0.67809165", "0.67612...
0.6375884
36
Create a quaternion corresponding to the rotation specified by an axis and an angle
def axang2quat(ax_ang): if ax_ang.ndim == 1: if np.size(ax_ang) == 5: ax_ang = np.reshape(ax_ang, (5, 1)) msz = 1 elif np.size(ax_ang) == 4: ax_ang = np.reshape(np.hstack((ax_ang, np.array([1]))), (5, 1)) msz = 1 else: raise Except...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quaternion_about_axis(angle, axis):\r\n q = numpy.array([0.0, axis[0], axis[1], axis[2]])\r\n qlen = vector_norm(q)\r\n if qlen > _EPS:\r\n q *= math.sin(angle/2.0) / qlen\r\n q[0] = math.cos(angle/2.0)\r\n return q", "def angle_axis_to_quaternion(angle_axis: torch.Tensor) -> torch.Tens...
[ "0.8622127", "0.8261001", "0.8101002", "0.7772343", "0.77266437", "0.7613964", "0.74365413", "0.7385388", "0.72055", "0.71809655", "0.7173881", "0.71556646", "0.7138661", "0.7086025", "0.6977137", "0.6967763", "0.6925111", "0.6887898", "0.6812898", "0.681024", "0.6798782", ...
0.7443052
6
Get proper GPU indices form `gpu` arguments. Given `gpus` argument, exclude inappropriate indices and transform to list of int format.
def get_gpu_ids(gpus: str) -> List[int]: num_available_gpu = torch.cuda.device_count() gpu_ids = [] for gpu_id in gpus.split(","): if not gpu_id.isnumeric(): raise ValueError("--gpus argument should be numbers separated by ','.") gpu_ids.append(int(gpu_id)) wrong_gpus = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_gpus():\n try:\n re = subprocess.check_output([\"nvidia-smi\", \"-L\"], universal_newlines=True)\n except OSError:\n return []\n return range(len([i for i in re.split('\\n') if 'GPU' in i]))", "def gpus_for_process(process_idx: int, num_gpus_per_process: int, gpu_mask: Optional[Lis...
[ "0.66485584", "0.63633764", "0.6355843", "0.628668", "0.58854395", "0.588046", "0.5709567", "0.56861997", "0.56650585", "0.56650585", "0.5663565", "0.565623", "0.5641231", "0.5614819", "0.5614819", "0.56133384", "0.5599287", "0.5587114", "0.5578608", "0.5541125", "0.551105", ...
0.7979022
0
Implement vitis 8bit transforms. Currently this means the following. 1. Pull activations into layers, and apply fuse activations. (TODO) 2. Modify range in incoming layers for Concat. (TODO) 3. Fuse Conv2D/DepthwiseConv2D + BN into single layer.
def apply(self, model, layer_quantize_map, quantize_registry, mode): transforms = [ vitis_8bit_quantize_transforms.InputLayerQuantize( quantize_registry.get_input_quantizer(), mode), vitis_8bit_quantize_transforms.ConvActivationQuantize(), vitis_8bit_quantize_transforms.AddActiv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_bisenet(inputs, num_classes):\n\n ### The spatial path\n ### The number of feature maps for each convolution is not specified in the paper\n ### It was chosen here to be equal to the number of feature maps of a classification\n ### model at each corresponding stage\n # spatial_net = fl...
[ "0.63503504", "0.6127692", "0.6025885", "0.60222787", "0.59774333", "0.594558", "0.5910501", "0.590765", "0.5900788", "0.5892498", "0.5868209", "0.58656496", "0.5856557", "0.5853635", "0.5847782", "0.58004177", "0.57956475", "0.5786369", "0.57799613", "0.5778847", "0.5776057"...
0.6095659
2
Determines if a given numpy.arraylike is sorted in ascending order.
def is_sorted(x, ascending=True): return np.all((np.diff(x) * (1.0 if ascending else -1.0) >= 0))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_sorted(array):\n if(all(array[i] <= array[i + 1] for i in range(len(array)-1))) or (all(array[i] >= array[i + 1] for i in range(len(array)-1))):\n return True\n return False", "def is_sorted_array(arr, increasing=True):\n # If only 1\n if len(arr) == 0:\n return True\n # If mu...
[ "0.7452085", "0.7424731", "0.7403294", "0.7395038", "0.69357103", "0.6907829", "0.68330723", "0.67261463", "0.6645373", "0.6591744", "0.6349577", "0.6340224", "0.6266757", "0.6195723", "0.6119161", "0.6103929", "0.6103734", "0.61012983", "0.6094735", "0.6042103", "0.6035387",...
0.75576997
0
Return the day number for the specified date.
def date_to_day_of_week(year, month, day): # Calculate the day offset from Jan, 1 in the specified year. day_num = date_to_day_of_year(year, month, day) is_pre_2k = year < 2000 if is_pre_2k: # Calculate the number of days from the end of the year. num_days = days_in_year(year) - day_num...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DAY(date):\n return _make_datetime(date).day", "def date_day(date):\n return date_day_of_month(date)", "def get_day_number(day):\n day_dict = {\n 'Sunday': 0,\n 'Monday': 1,\n 'Tuesday': 2,\n 'Wednesday': 3,\n 'Thursday': 4,\n 'Friday': 5,\n 'Saturday...
[ "0.86250085", "0.75476384", "0.7441019", "0.7320909", "0.7268337", "0.70647323", "0.69726527", "0.6885271", "0.68764955", "0.6828292", "0.6812784", "0.66739595", "0.66662306", "0.66520184", "0.6628792", "0.65757203", "0.657275", "0.6484293", "0.6484293", "0.6482385", "0.64816...
0.0
-1
Implement dot product of the two vectors.
def dot_product(vector1, vector2): out = None ### YOUR CODE HERE out=np.dot(vector1,vector2) ### END YOUR CODE return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(vector1, vector2):\n return sum(a1 * a2 for a1, a2 in zip(vector1, vector2))", "def vec_dot(v1,v2):\r\n \r\n return np.dot(v1,v2)", "def dot(a, b):\n\n if len(a) != len(b):\n raise Exception(\"Input vectors must be of same length, not %d and %d\" % (len(a), len(b)))\n\n ...
[ "0.8607755", "0.86047083", "0.8601358", "0.8597061", "0.8551729", "0.85287976", "0.8492116", "0.8485161", "0.8447833", "0.839337", "0.836711", "0.83544147", "0.83447236", "0.83015573", "0.8261457", "0.82280064", "0.8205515", "0.82047594", "0.8188006", "0.8170715", "0.81460476...
0.8075297
24
Serving main page template
def home(request): return render(request,'KIT_test/home.html')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main_page():\n return render_template(\"main_page.html\")", "def main_page():\n return render_template(\"index.html\")", "def home():\n return render_template('Main_Page.html')", "def get(self):\n template = Constants.JINJA_ENVIRONMENT.get_template('homepage.html')\n self.response....
[ "0.83166534", "0.8316629", "0.78862184", "0.7817113", "0.78051394", "0.7804739", "0.7800497", "0.7800497", "0.7705164", "0.7705164", "0.77051634", "0.77051634", "0.77051634", "0.7703439", "0.7628041", "0.7584006", "0.7580053", "0.7580053", "0.7579556", "0.75691783", "0.756399...
0.0
-1
r"""Returns the state vector of a (PNR postselected) Gaussian state. The resulting density matrix will have shape
def state_vector( mu, cov, post_select=None, normalize=False, cutoff=5, hbar=2, check_purity=True, **kwargs ): if check_purity: if not is_pure_cov(cov, hbar=hbar, rtol=1e-05, atol=1e-08): raise ValueError("The covariance matrix does not correspond to a pure state") beta = complex_to_rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_qs(self, state: np.array) -> np.array:\r\n return self.model.predict(np.array(state).reshape(-1, *state.shape))[0]", "def sample(self):\n x = self.state\n# dx = self.theta * (self.mu - x) + self.sigma * np.array([random.random() for i in range(len(x))])\n dx = self.theta * (s...
[ "0.619603", "0.61448866", "0.6117619", "0.60878146", "0.6044878", "0.59666985", "0.5966666", "0.59231615", "0.5917071", "0.586096", "0.5854712", "0.5833994", "0.5833994", "0.5833994", "0.5833994", "0.5833994", "0.5833959", "0.5830407", "0.5827027", "0.5807288", "0.5795444", ...
0.0
-1
r"""Returns the density matrix of a (PNR postselected) Gaussian state. The resulting density matrix will have shape
def density_matrix(mu, cov, post_select=None, normalize=False, cutoff=5, hbar=2): N = len(mu) // 2 pref = _prefactor(mu, cov, hbar=hbar) if post_select is None: A = Amat(cov, hbar=hbar).conj() sf_order = tuple(chain.from_iterable([[i, i + N] for i in range(N)])) if np.allclose(mu, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_density_matrix(states=None, dimensions=None):\n if states is None:\n tdim = np.prod(dimensions)\n dmtotal0 = np.eye(tdim) / tdim\n\n return dmtotal0\n\n dmtotal0 = np.eye(1, dtype=np.complex128)\n\n for i, s in enumerate(states):\n\n if not hasattr(s, \"__len__\"):\n ...
[ "0.6856901", "0.64004314", "0.61535126", "0.6066098", "0.5938987", "0.5869517", "0.58543664", "0.58440024", "0.5802672", "0.57732296", "0.57327724", "0.57204974", "0.568061", "0.56769615", "0.5617186", "0.5597178", "0.5572593", "0.5561574", "0.5560677", "0.5536515", "0.553187...
0.0
-1
calculates distance between two rows of data (based on Euclidean distance)
def getDistance(X1, X2): distance = 0 length = len(X1) for i in range(length): distance += (X1[i] - X2[i])**2 # differences of the columns squared distance = math.sqrt(distance) return distance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def euclidianDistance(row1, row2):\n\n dist = 0.0\n for i in range(len(row1)-1):\n dist += (row1[i] - row2[i])**2\n \n return sqrt(dist)", "def euclidean_distance(x1: np.ndarray, x2: np.ndarray) -> float:\n return np.sqrt(np.square(x1 - x2).sum())", "def euclidean_distance(x1, x2):\n r...
[ "0.83121836", "0.76971805", "0.7605502", "0.75328237", "0.75137174", "0.7477755", "0.74260134", "0.74136573", "0.74110717", "0.73677295", "0.7353811", "0.7268839", "0.7264", "0.7260089", "0.7257254", "0.7247142", "0.7241579", "0.7208455", "0.7201493", "0.7187903", "0.71878755...
0.7223828
17
Gets the URL that users can connect to.
def get_buildbot_url(): return "http://10.45.4.98:8001/"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_url(self):\n return 'http://{}:{}'.format(self.host, self.port)", "def url(self) -> str:\n return getattr(\n self.auth_accounts[-1], \"url\" # pylint: disable=unsubscriptable-object\n )", "def realm_url(self):\n return self._realm_url", "def get_url(self):\n ...
[ "0.6919182", "0.6801329", "0.6716512", "0.66797656", "0.66797656", "0.66634417", "0.6644857", "0.66420376", "0.6617643", "0.6617643", "0.6584805", "0.65595955", "0.6547548", "0.6545267", "0.65123135", "0.649547", "0.6487731", "0.6470337", "0.6439944", "0.6412081", "0.64087665...
0.0
-1
Gets the MySQL database containing the Katana builds.
def mysql_database(): return DATABASE
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database():\n return conf().database", "def get_db():\n if not hasattr(g, 'mysql_db'):\n g.mysql_db = connect_db()\n return g.mysql_db", "def get_database_url():\n details = {\n # This specifies what database buildbot uses to store its state. You can leave\n # this at its ...
[ "0.6966115", "0.6642892", "0.65372956", "0.6479584", "0.63967866", "0.6389546", "0.6382224", "0.6318427", "0.62686557", "0.62686557", "0.6256003", "0.6188696", "0.6178963", "0.6154603", "0.61518985", "0.6123795", "0.6122082", "0.6119133", "0.6066906", "0.60609365", "0.6057985...
0.6699401
1
Node groups specification as Python dictionary.
def node_group_spec(self): return { 'name': 'nodes', 'source': 'tree', 'transform': [ { 'type': 'filter', 'expr': 'datum.type == "node"' } ] }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_groups(self) -> dict:\n return dict(self._groups)", "def groups(self):\n\n group_config = {}\n\n # legacy way of threating any dict as a potential\n # group config (pre #44 implementation)\n # supported until vaping 2.0\n\n for k,v in list(self.config.items()):\n...
[ "0.6479059", "0.61204326", "0.60906076", "0.6084806", "0.6062145", "0.59498376", "0.5933085", "0.58731025", "0.5867287", "0.5853941", "0.58485425", "0.5844727", "0.5822661", "0.5807974", "0.5782158", "0.57697874", "0.5714147", "0.56695104", "0.5650857", "0.5641814", "0.563127...
0.71175516
0
Impute zeros to numerical and None to categorical variables.
def impute_missing(df): for name in df.select_dtypes("number"): df[name] = df[name].fillna(0) for name in df.select_dtypes("category"): df[name] = df[name].fillna("None") return df
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def impute(data):\n for column in data:\n column_data = data[column]\n if column_data.dtype in (np.int, np.float):\n fill_value = column_data.mean()\n else:\n fill_value = column_data.mode()[0]\n\n data[column] = data[column].fillna(fill_value)\n\n return dat...
[ "0.67325103", "0.64714456", "0.59937066", "0.58828056", "0.58579534", "0.58238924", "0.5715457", "0.5553143", "0.5529767", "0.54620004", "0.544266", "0.5415945", "0.53676474", "0.5362321", "0.5353347", "0.5339118", "0.5333088", "0.53308725", "0.52324456", "0.5210814", "0.5203...
0.7055178
0
Get history of user's transactions.
def get_history(self): return self.__history[:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def history():\n\n # get all transactions for current user\n transactions = db.execute(\"SELECT * FROM transactions WHERE user_id = :user_id\", user_id=session[\"user_id\"])\n\n # render history.html with all user transactions\n return render_template(\"history.html\", transactions=transactions, usd=us...
[ "0.772964", "0.7554498", "0.75097245", "0.7305745", "0.72252274", "0.71561676", "0.7116203", "0.70987314", "0.7096675", "0.7068022", "0.70482033", "0.7027512", "0.7026951", "0.7000245", "0.697927", "0.697555", "0.69637173", "0.6946666", "0.69108146", "0.69066197", "0.68843794...
0.67064756
31
Return how many 100dollar bill can be printed from this amount of cash.
def how_many_100s(self, amount): return amount // 100
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cash(self) -> float:\n return self._cash", "def getCash(self) -> int:\n return self.state[CASH]", "def cash_ratio(self):\n return self.cash / self.current_liabilities", "def calcul_buy_nb_action(self):\n nb_action = self.max_loss / (self.buy_price - self.stop_loss)\n in...
[ "0.6649561", "0.6621992", "0.6601195", "0.65391403", "0.6486688", "0.6445053", "0.64083564", "0.63718146", "0.63159233", "0.62961155", "0.62943304", "0.6285521", "0.6281661", "0.626485", "0.62531626", "0.6228579", "0.62118506", "0.61849105", "0.61722094", "0.6142209", "0.6106...
0.6555071
3
Return how many 50dollar bill can be printed from this amount of cash.
def how_many_50s(self, amount): return amount // 50
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_cash_without_50s(self, amount):\n return amount % 50", "def calcul_buy_nb_action(self):\n nb_action = self.max_loss / (self.buy_price - self.stop_loss)\n invest = self.max_loss / (self.buy_price - self.stop_loss) * self.buy_price\n\n if invest > self.capital:\n ...
[ "0.6839984", "0.65893066", "0.6517756", "0.6482814", "0.64510983", "0.642632", "0.6400921", "0.6387949", "0.6336911", "0.6330796", "0.62974346", "0.6231293", "0.62299055", "0.6222049", "0.6188447", "0.6175398", "0.61228955", "0.61224926", "0.6074375", "0.60437423", "0.60349",...
0.6810906
1
Return how many 20dollar bill can be printed from this amount of cash.
def how_many_20s(self, amount): return amount // 20
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cash_ratio(self):\n return self.cash / self.current_liabilities", "def total(self):\n for card in self.cards:\n if not card.value:\n return 0\n t = 0\n for card in self.cards:\n t += card.value\n contains_ace = False\n for card in...
[ "0.66276145", "0.6596256", "0.65281093", "0.6518528", "0.6508884", "0.6474759", "0.6370006", "0.63635004", "0.6303712", "0.6300608", "0.6235348", "0.622084", "0.6209585", "0.6168031", "0.6150687", "0.6114566", "0.61100656", "0.6104596", "0.60977983", "0.6072506", "0.60391116"...
0.61938983
13
Find the smallest multiple of all numbers from 1 to the given number.
def find_multiple(self, num): result = dict() for n in range(1, num+1): temp = self.find_prime_divisors(n) result.update({k:v for k,v in temp.items() if k not in result or result[k] < v}) return reduce(operator.mul, (pow(k, v) for k,v in result.items()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_multiple(n):\n return reduce(lowest_common_multiple, range(1, n+1))", "def smallestMultiple(x):\r\n ans = 1\r\n for prime in xprime(x):\r\n ans *= prime**int(log(x, prime))\r\n\r\n return ans", "def smallest_multiple(n):\n if n == 1:\n return 1\n res = 1\n primes...
[ "0.81792176", "0.81649256", "0.7750031", "0.77447075", "0.7664004", "0.7534783", "0.7335728", "0.73217124", "0.7319336", "0.71423554", "0.69448835", "0.69352186", "0.67931837", "0.67191017", "0.6665189", "0.66469055", "0.66291827", "0.66180444", "0.65898067", "0.6506504", "0....
0.62049127
33
Checks if num is evenly divisible by n.
def is_divisible(num, n): return num % n == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_divisible(n: int, divisors: Iterable) -> bool:\n for i in divisors:\n if n % i != 0:\n return False\n return True", "def div_by(n, list_of_num):\n for num in list_of_num:\n if not n % num:\n return True\n return False", "def snt(n):\r\n f = True\...
[ "0.78296596", "0.7816904", "0.77420396", "0.7642597", "0.7620788", "0.7599114", "0.7599114", "0.7526802", "0.7450844", "0.73770326", "0.73770326", "0.7355424", "0.72856253", "0.7196798", "0.7194723", "0.7166605", "0.7157876", "0.7094404", "0.70826745", "0.70661384", "0.703626...
0.8853613
0
Get duration from file as number of seconds
def __get_duration_from_line(self, line): # TODO: catch exceptions duration_str = line.split('=')[1] return int(duration_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_duration(file):\n cmd = 'ffprobe -i \"{}\" -show_entries format=duration -v quiet -of csv=\"p=0\"'.format(file)\n try:\n output = subprocess.check_output(\n cmd,\n shell=True, # Let this run in the shell\n stderr=subprocess.STDOUT)\n except subprocess.Calle...
[ "0.7898523", "0.7786872", "0.7725611", "0.7610942", "0.7273601", "0.7043183", "0.7038639", "0.70121634", "0.68542045", "0.6832816", "0.6745789", "0.670392", "0.66651106", "0.66560686", "0.66041857", "0.6596064", "0.6593739", "0.6537936", "0.6503092", "0.64249146", "0.63836765...
0.6859132
8
Get Engine hours from line as float number
def __get_engine_hours_from_line(self, line): # TODO: catch exceptions hours_str = line.split('engine_hours')[1] if hours_str.startswith('='): hours_str = hours_str[1:] hours_str = hours_str.split(';')[0] return float(hours_str)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pH(self):\n rawline = self.f.readline()\n while rawline:\n rematch = self.solvphre.match(rawline)\n if rematch:\n return float(rematch.groups()[0])\n rawline = self.f.readline()", "def _calc_time(time_lines: list) -> np.ndarray:\n time = [time_to_fracti...
[ "0.6649436", "0.6612638", "0.6277559", "0.62514144", "0.6202356", "0.6185711", "0.60339004", "0.59633267", "0.5953654", "0.5864964", "0.58508605", "0.5747257", "0.5724702", "0.57240283", "0.57002425", "0.5692755", "0.5669807", "0.56350726", "0.56348675", "0.5618601", "0.56079...
0.8523258
0
Method to get relative path of loaded page
def get_relative_path(self): return urlparse(self.browser.current_url).path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path(self):\n return self._selenium.current_url.replace(\n 'http://{}'.format(self._address), '')", "def getBasePath(request):\n return request.rootpage.getPagePath('pages')", "def __relative_path(self, p4file):\n return self.ctx.depot_path(p4file.depot_path).to_gwt()", "def l...
[ "0.70092595", "0.69462067", "0.68127006", "0.67637193", "0.6665196", "0.66468495", "0.6579726", "0.65442705", "0.6541777", "0.6541775", "0.6532035", "0.6511223", "0.6508869", "0.64980835", "0.6496541", "0.6487011", "0.6458795", "0.64568484", "0.64523655", "0.6451513", "0.6437...
0.84251916
0
close the connection to the database.
def disconnect(self): try: super(NERDmLoader, self).disconnect() finally: self.lateloadr._client = None self.relloadr._db = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close_db_connection(cls):\n db.close()", "def close_database(self):\n if self._conn is not None:\n self._conn.close()\n self._conn = None", "def close(self):\n Log.debug('DB -> close')\n # 关闭数据库连接\n self.conn.close()", "def close(self):\n if...
[ "0.8670051", "0.8501116", "0.8410733", "0.8270201", "0.8187021", "0.8160223", "0.8117305", "0.8107972", "0.8058615", "0.80055964", "0.8005287", "0.7950234", "0.7933582", "0.79324245", "0.79264647", "0.7842355", "0.7806763", "0.77820516", "0.7747405", "0.7747405", "0.7747405",...
0.0
-1
Sets the description of this Product.
def description(self, description): self._description = description
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_description(self, description):\n self.__description = description", "def set_description(self, description):\r\n self.__description = description", "def set_description(self, description):\n self.description = description", "def set_description(self, description):\n self....
[ "0.8383204", "0.8376429", "0.83712584", "0.8350903", "0.82433724", "0.80381507", "0.80381507", "0.80381507", "0.80381507", "0.7970083", "0.7970083", "0.7970083", "0.7970083", "0.79369473", "0.7909474", "0.7785794", "0.7777406", "0.7696617", "0.7664708", "0.76456475", "0.75812...
0.80425024
29
Sets the epid of this Product.
def epid(self, epid): self._epid = epid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_id(self, product_id):\n self._product_id = product_id", "def product_id(self, product_id):\n\n self._product_id = product_id", "def product_id(self, product_id):\n\n self._product_id = product_id", "def eid(self, eid):\n\n self._eid = eid", "def entity_id(self, entit...
[ "0.7221626", "0.7139267", "0.7139267", "0.70915365", "0.6269724", "0.6258747", "0.62039185", "0.62039185", "0.6120413", "0.6106977", "0.5937478", "0.5937478", "0.59024143", "0.5849628", "0.5849628", "0.58250904", "0.5817866", "0.5817866", "0.5817866", "0.5817866", "0.5817639"...
0.8224006
1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, Product): return False return self.__dict__ == other.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): return not self == other
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748" ]
0.0
-1
Read text file in reversed direction, return iteration of lines
def reverse_file_reader(cls, file_object: object, lines_separator: str = '\n', keep_lines_separator: bool = True, save_memory: bool = True): f = open(filename, 'w') def ceil_division(left_number, right_number): """ Divides given numbers with ceiling. """ return -(-left_number // ri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_readfile(filename: Union[str, Path]) -> Generator[str, str, None]:\n try:\n with zopen(filename, \"rb\") as f:\n if isinstance(f, (gzip.GzipFile, bz2.BZ2File)):\n for line in reversed(f.readlines()):\n yield line.decode(\"utf-8\").rstrip()\n ...
[ "0.69842607", "0.6357434", "0.623254", "0.6231467", "0.6222857", "0.6221075", "0.6157578", "0.6034899", "0.5929396", "0.590962", "0.5858264", "0.5783795", "0.5774172", "0.5766958", "0.57479566", "0.5744451", "0.5699199", "0.5691955", "0.5573952", "0.55698323", "0.55641776", ...
0.5500751
24
Inspects a custom lambda function and tries to determine whether it is symbolically commutative (disregarding data type).
def is_op_commutative(wcr_str): if wcr_str == '' or wcr_str is None: return None # Get lambda function from string wcr = eval(wcr_str) # Run function through symbolic math engine a = sympy.Symbol('a') b = sympy.Symbol('b') try: aRb = wcr(a, b) bRa = wcr(b, a) ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_lambda(fun):\n return isinstance(fun, type(LAMBDA)) and fun.__name__ == LAMBDA.__name__", "def islambda(func):\n return getattr(func, 'func_name', False) == '<lambda>'", "def has_curry(tree, userlambdas=[]):\n return has_deco([\"curry\"], tree, userlambdas)", "def is_op_associative(wcr_str):\...
[ "0.666805", "0.652953", "0.58758575", "0.57659847", "0.562268", "0.55440086", "0.5533249", "0.5432047", "0.54275006", "0.53410333", "0.53028214", "0.5295937", "0.52474564", "0.5220733", "0.52181447", "0.5149709", "0.5084852", "0.5077263", "0.5054437", "0.503736", "0.50239503"...
0.6301599
2
Accumulate for a single datapoint. This call can only be made when the adaptation state is ACCUMULATING
def accum_one_frame(self, mi, gamma, comp_scores, frame): self._verify_index_for_accum(mi) self._require_state("ACCUMULATING") self._accums[mi].accum_one_frame(gamma, comp_scores, frame)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __apply_accumulators():\n self.__xdata = np.array([])\n self.__ydata = np.array([])\n for acc in self.signal_accumulators:\n self.__xdata = __array_append(self.__xdata,acc.attempt)\n self.__ydata = __array_append(self.__ydata,acc.count)\n self.__applied = True"...
[ "0.6104166", "0.6088561", "0.60841966", "0.59880704", "0.5932588", "0.5918114", "0.58795935", "0.58363545", "0.5765449", "0.5757558", "0.5710376", "0.56825674", "0.56786096", "0.5663558", "0.5631574", "0.56124437", "0.5593801", "0.5590369", "0.5547484", "0.5543528", "0.553291...
0.5291486
45
Given a float returns a rounded int. Should give the same result on both Py2/3
def intround(value): return int(decimal.Decimal.from_float( value).to_integral_value(decimal.ROUND_HALF_EVEN))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def int_r(f):\n return int(np.round(f))", "def rint(flt: float) -> int | float:\n return int(rounded) if (rounded := round(flt, 2)).is_integer() else rounded", "def _float2int(x: float) -> int:\n return round(x * 100)", "def round_int(num):\n try:\n float(num)\n except TypeError:\n ...
[ "0.7796194", "0.7791462", "0.7602636", "0.7363093", "0.70661354", "0.70631975", "0.70404613", "0.70381194", "0.7027889", "0.68660855", "0.68584484", "0.681991", "0.68141717", "0.6800256", "0.6791723", "0.67634344", "0.6759591", "0.67321956", "0.67298174", "0.66592366", "0.661...
0.75691056
3
Like fileobj.seek(offset, 2), but will not try to go beyond the start Needed since file objects from BytesIO will not raise IOError and file objects from open() will raise IOError if going to a negative offset. To make things easier for custom implementations, instead of allowing both behaviors, we just don't do it.
def seek_end(fileobj, offset): if offset < 0: raise ValueError if get_size(fileobj) < offset: fileobj.seek(0, 0) else: fileobj.seek(-offset, 2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _seek(self, offset):\n assert offset % self.recordsize == 0\n file_number, file_offset = divmod(offset,\n self.filesize - self.header_size)\n self.open(file_number)\n self.fh_raw.seek(file_offset + self.header_size)\n self.offset = off...
[ "0.74189854", "0.7154907", "0.7124377", "0.69461596", "0.6881851", "0.6881851", "0.6593302", "0.6579465", "0.6480783", "0.6409056", "0.6319345", "0.6310804", "0.62028414", "0.6186576", "0.6177191", "0.6131797", "0.6117652", "0.60831636", "0.6053595", "0.60344887", "0.5975833"...
0.72395414
1
Insert size bytes of empty space starting at offset. fobj must be an open file object, open rb+ or equivalent. Mutagen tries to use mmap to resize the file, but falls back to a significantly slower method if mmap fails.
def insert_bytes(fobj, size, offset, BUFFER_SIZE=2 ** 16): if size < 0 or offset < 0: raise ValueError fobj.seek(0, 2) filesize = fobj.tell() movesize = filesize - offset if movesize < 0: raise ValueError resize_file(fobj, size, BUFFER_SIZE) if mmap is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_bytes(self,fobj, size, offset, BUFFER_SIZE=2 ** 16):\n\n if size < 0 or offset < 0:\n raise ValueError\n\n fobj.seek(0, 2)\n filesize = fobj.tell()\n movesize = filesize - offset\n\n if movesize < 0:\n raise ValueError\n\n self.resize_file(...
[ "0.74079037", "0.6687683", "0.6400288", "0.62285495", "0.61452436", "0.6054007", "0.5927422", "0.5602", "0.55221754", "0.5474256", "0.5411046", "0.5408975", "0.5326317", "0.5261175", "0.5242342", "0.5188048", "0.50676775", "0.50609404", "0.5048499", "0.5041186", "0.5021386", ...
0.7578306
0
Returns a bytearray of length `count`. Works unaligned.
def bytes(self, count): if count < 0: raise ValueError # fast path if self._bits == 0: data = self._fileobj.read(count) if len(data) != count: raise BitReaderError("not enough data") return data return bytes(bytearray(sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_bytes(self, count):\r\n bts = self.b_form[self._ip:self._ip + count]\r\n self._ip += count\r\n return bts", "def read(self, bytecount: int = -1) -> bytes:\n if not bytecount or bytecount < 0:\n return self.read1()\n bfr = bytearray(bytecount)\n offset...
[ "0.6723796", "0.6040334", "0.5972829", "0.5927453", "0.581622", "0.580186", "0.56533235", "0.5587902", "0.55379736", "0.54010576", "0.5392472", "0.52283037", "0.5226907", "0.5203962", "0.5203649", "0.5199864", "0.5190235", "0.5170492", "0.5166892", "0.5092369", "0.5053942", ...
0.64359
1
Skip `count` bits. Might raise BitReaderError if there wasn't enough data to skip, but might also fail on the next bits() instead.
def skip(self, count): if count < 0: raise ValueError if count <= self._bits: self.bits(count) else: count -= self.align() n_bytes = count // 8 self._fileobj.seek(n_bytes, 1) count -= n_bytes * 8 self.bits(coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip(self, count):\n self.bytepos += count", "def skip(self):\r\n length = self.next_byte()\r\n while length != b\"\\x00\" and length:\r\n self.next_bytes(parse_int(length, 'big'))\r\n length = self.next_byte()", "def bits(self, count):\n\n if count < 0:\n ...
[ "0.7157496", "0.6450507", "0.6301046", "0.6167968", "0.60330373", "0.5777534", "0.568266", "0.56792724", "0.5585285", "0.5526355", "0.5513701", "0.5349103", "0.5309461", "0.5309461", "0.52333885", "0.51825273", "0.51682067", "0.514723", "0.513244", "0.5101181", "0.50879747", ...
0.83949655
0
Checks that fname has one of the provided extensions.
def check_file_extensions(fname, extensions): if fname is None: return assert isinstance(extensions, tuple), "The 'extensions' must be a tuple." if not fname.endswith(extensions): raise ValueError("Invalid file extension (%s). Must be one of %s" % extensions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)", "def has_file_allowed_extension(filename, extensions):\n return filename.lower().endswith(extensions)", "def has_file_allowed_extension(\n filename: Union[Path, str],\n extensions: tuple[str, ...]...
[ "0.82834345", "0.82834345", "0.8100357", "0.80992466", "0.8026359", "0.79824466", "0.79824466", "0.79754186", "0.7952315", "0.79121125", "0.7896674", "0.78304005", "0.77155715", "0.76968277", "0.7648792", "0.7646323", "0.760212", "0.7586791", "0.7574435", "0.75537294", "0.754...
0.85929507
0
Dumps dictionary as a json object to a file with file_name name.
def write_json(fname, data, check_extension=False): if fname is None: raise ValueError("File name is None") if check_extension: IOUtils.check_file_extensions(fname, ('.json', '.json.gz')) IOUtils.mkdirf(fname) with OpenFile(fname, 'w') as fobj: json.du...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_json_to_file(dictionary, file_name):\n if file_name is not None:\n IOUtils.mkdirf(file_name)\n with open(file_name, 'w') as file_obj:\n json.dump(dictionary, file_obj, indent=4)", "def to_file(self, file_name: str) -> None:\n\n with open(file_name, 'w')...
[ "0.8462733", "0.8026518", "0.79208636", "0.7748574", "0.7739286", "0.77206194", "0.7711347", "0.7698838", "0.762147", "0.76008123", "0.7582553", "0.7537253", "0.7525442", "0.74622864", "0.7459011", "0.7440289", "0.7421963", "0.7416847", "0.7416149", "0.74134", "0.7409963", ...
0.66713727
100
Creates new dictionary with items which keys start with prefix. Creates new dictionary with items from dictionary which keys names starts with prefix. If remove_prefix is True, keys in new dictionary will not contain this prefix. The dictionary dictionary is not modified.
def filter_by_key_prefix(dictionary, prefix, remove_prefix=True): return_dictionary = {} for key in dictionary: if key.startswith(prefix): return_key = key[len(prefix):] if remove_prefix else key return_dictionary[return_key] = copy.deepcopy(dictionary[key]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_dic_by_key_prefix(dic,key_prefix_list):\n new_dic = {}\n for key in dic:\n retain = True\n for prefix in key_prefix_list:\n if key.startswith(prefix):\n retain = False\n if retain:\n new_dic[key] = dic[key]\n return new_dic", "def filt...
[ "0.75500476", "0.70344096", "0.7015549", "0.69922745", "0.6979635", "0.68354994", "0.67461884", "0.67389077", "0.6662732", "0.6609951", "0.633804", "0.63246626", "0.6315697", "0.6255116", "0.6130498", "0.6104047", "0.6064955", "0.6031019", "0.5999914", "0.5916186", "0.591303"...
0.83424884
0
Dumps dictionary as a json object to a file with file_name name.
def dump_json_to_file(dictionary, file_name): if file_name is not None: IOUtils.mkdirf(file_name) with open(file_name, 'w') as file_obj: json.dump(dictionary, file_obj, indent=4)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_file(self, file_name: str) -> None:\n\n with open(file_name, 'w') as fi:\n json.dump(self.to_dict(), fi, indent=1)", "def write_json(dict_to_write, path, file_name):\n with open(path + \"/\" + file_name + \".json\", \"w\") as fp:\n json.dump(dict_to_write, fp)\n return None"...
[ "0.80241674", "0.7920995", "0.77489483", "0.7739289", "0.7722602", "0.77131873", "0.7699249", "0.7622183", "0.7602195", "0.7584451", "0.75363094", "0.75245875", "0.74621475", "0.7460464", "0.7441086", "0.7421572", "0.7418366", "0.7415917", "0.74134827", "0.74121016", "0.73513...
0.84623295
0
Updates dictionary with items from iterable object. This method modifies/updates dictionary with items from iterable object. This object must support ``for something in iterable`` (list, opened file etc). Only those items in iterable are considered, that match pattern (it's a regexp epression). If a particular item doe...
def add(dictionary, iterable, pattern, must_match=True, add_only_keys=None, ignore_errors=False): matcher = re.compile(pattern) for line in iterable: match = matcher.match(line) if not match: if must_match: raise ConfigurationError("Cannot matc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_by_list_of_keys(dictionary: Dict, key_path: List[Any], value: Any) -> Dict:\n key = key_path[0]\n dictionary[key] = (\n value\n if len(key_path) == 1\n else add_by_list_of_keys(\n dictionary[key] if key in dictionary else dict(),\n key_path[1:],\n ...
[ "0.5341071", "0.5220354", "0.51635385", "0.5031238", "0.49762875", "0.49528491", "0.49510676", "0.49048623", "0.48874095", "0.48242366", "0.47714472", "0.47378278", "0.47348964", "0.47133338", "0.46789774", "0.46522626", "0.46491906", "0.46448138", "0.4625679", "0.45685178", ...
0.7991692
0
Closes queue and waits for resource monitor to finish.
def stop(self): with open(self.pid_file, 'w') as fhandle: fhandle.write('exit') self.queue.close() self.queue.join_thread() self.monitor_process.join() self.remove_pid_file()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(self):\n self.queue.join()", "def wait(self):\n self.drain_call_queue()", "def Finish(self):\n\t\n self.queue.join()", "def drain(queue):\n while not queue.is_empty():\n queue.remove()", "def __exit__(self, exc_type, exc_val, exc_tb):\n self.queue.channel.rpc(...
[ "0.6702483", "0.6387367", "0.6360253", "0.62603915", "0.6229616", "0.62126917", "0.6211487", "0.6183273", "0.6176807", "0.6167198", "0.61511976", "0.6119246", "0.6066761", "0.6044037", "0.5995759", "0.5991034", "0.5958489", "0.5948596", "0.5929895", "0.59128755", "0.59125113"...
0.0
-1
Sets the current value of the togglebox to `value`.
def set_box_value(self, value, *value_sig): set_box_value(self.checkbox, value[0]) set_box_value(self.widget, value[1], *value_sig)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_value(self, value):\n self.value = value", "def set_value(self, value):\n self.value = value", "def set_value(self, value):\n self.value = value", "def set_value(self, value):\n if self.notebook:\n self.widget.value = value\n else:\n if hasattr...
[ "0.742062", "0.742062", "0.742062", "0.7210438", "0.7157633", "0.70544916", "0.69965965", "0.6993335", "0.6970577", "0.69340783", "0.6906684", "0.6864974", "0.6864974", "0.6767598", "0.67285585", "0.66552883", "0.6585132", "0.65805554", "0.65805554", "0.65805554", "0.65805554...
0.68269217
13
Creates a transposedconvolutional layer, with optional batch normalization.
def deconv( in_channels, out_channels, kernel_size, stride=2, padding=1, batch_norm=True, ): layers = [] layers.append( nn.ConvTranspose2d( in_channels, out_channels, kernel_size, stride, padding, bias=False ) ) if batch_norm: layers.append(nn....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transpose(incoming, conv, nonlinearity, *args, **kwargs):\n return TransposedConv2DLayer(incoming, conv.input_shape[1],\n conv.filter_size, stride=conv.stride,\n crop=conv.pad, W=conv.W,\n flip_filters=not conv.f...
[ "0.7040915", "0.6893093", "0.67176014", "0.6710079", "0.6708082", "0.6663472", "0.6663338", "0.66571265", "0.6606713", "0.65221524", "0.65110224", "0.6509939", "0.64646214", "0.6452036", "0.6451129", "0.6449012", "0.6433785", "0.6417472", "0.63981646", "0.6397703", "0.6380099...
0.5603751
89
Check if the input is a string, if so, converts it to a list
def str2list(input): if isinstance(input, str): return [input] else: return input
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _strings_to_list(one_or_more_strings):\n if isinstance(one_or_more_strings, str):\n return [one_or_more_strings]\n else:\n return list(one_or_more_strings)", "def to_list(value):\n if hasattr(value, '__iter__') and not isinstance(value, str):\n return list(value)\n return [va...
[ "0.7878537", "0.7787954", "0.7741449", "0.7717572", "0.76445377", "0.74994344", "0.74705714", "0.74636996", "0.7382013", "0.73511875", "0.73296595", "0.72797275", "0.71756727", "0.71564317", "0.71372485", "0.71317095", "0.71272564", "0.7113769", "0.71094614", "0.7108431", "0....
0.89611244
0
Sets the learning rate to the initial LR decayed by 10 every 30 epochs
def adjust_learning_rate(optimizer, epoch, step, opt): _lr_decay_epoch = [# 150, int(4/8*opt.n_epochs), # int(5/8*opt.n_epochs), int(6/8*opt.n_epochs), int(7/8*opt.n_epochs), opt.n_epochs] if epoch...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjust_learning_rate(init_lr, optimizer, epoch, n=100):\n init_lr = init_lr * (0.1 ** (epoch // n))\n print('learning rate : ', init_lr)\n for param_group in optimizer.param_groups:\n param_group['lr'] = init_lr", "def adjust_learning_rate(start_lr, optimizer, epoch, total_epoch_num):\n #l...
[ "0.7913037", "0.79065263", "0.7850287", "0.7775244", "0.77343005", "0.7730824", "0.7723519", "0.77228487", "0.772005", "0.77095324", "0.7694036", "0.7674953", "0.76661867", "0.76661867", "0.76661867", "0.76546687", "0.764281", "0.7640212", "0.7638316", "0.76263756", "0.762475...
0.0
-1
Returns the string representation of the object
def __str__(self): return "[{}] ({}) {}".format(self.__class__.__name__, self.id, self.__dict__)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.__dict__['_obj'])", "def __str__(self):\n return str(self.obj)", "def __str__(self):\n return str(self.serialize())", "def to_string(self):\r\n return self.__str__()", "def __str__(self):\n return str(self.__dict__)", "def __...
[ "0.855347", "0.8476072", "0.83733624", "0.8325834", "0.81988674", "0.81988674", "0.8109982", "0.8106969", "0.80935043", "0.80935043", "0.80935043", "0.80935043", "0.80935043", "0.80895895", "0.8087514", "0.80274796", "0.8025889", "0.8025212", "0.80183464", "0.80128413", "0.80...
0.0
-1