query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Extracts the body of a specified `size` from `buffer`.
def _extract_body(buffer, size): # We account for the message start and command code bytes, hence the +2. if len(buffer) < size + 2: return None, size + 2 - len(buffer) body = buffer[2:size + 2] buffer[:size + 2] = [] return body, 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __read_block(self, size):\n buf = b\"\"\n if len(self.__read_buffer):\n limit = (\n size if size <= len(self.__read_buffer) else\n len(self.__read_buffer)\n )\n buf = self.__read_buffer[:limit]\n self.__read_buffer = self._...
[ "0.6191367", "0.60895145", "0.5873173", "0.5772755", "0.57718474", "0.5739988", "0.5719125", "0.5698225", "0.56644", "0.5449429", "0.54320264", "0.5406147", "0.5332291", "0.5266665", "0.5217389", "0.51856273", "0.51856273", "0.5151981", "0.5148639", "0.5140132", "0.5135234", ...
0.7962518
0
updates the treeview and fills it with all records in the transactions table
def update_table(self): self.cursor.execute("""SELECT * FROM transactions""") result = self.cursor.fetchall() self.tree.delete(*self.tree.get_children()) for item in result: self.tree.insert('', 'end', text=item[0], values=item[1:])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_treeview(self):\n for i in self.user_inventory.get_children():\n self.user_inventory.delete(i)\n \n #expired:\n self.df_expired = self.df_user.loc[self.df_user[\"expiration (days)\"] <= self.today]\n self.df_expired_rows = self.df_expired.to_numpy().toli...
[ "0.71143794", "0.66827446", "0.6435092", "0.62941474", "0.6287067", "0.6279537", "0.61216444", "0.60320663", "0.59254116", "0.5900165", "0.58603156", "0.5796129", "0.56489253", "0.56352526", "0.55968213", "0.5595423", "0.55919605", "0.55464005", "0.5537613", "0.5521705", "0.5...
0.8024838
0
Writes to the student/client's STDIN. Client should create a segment and send it to the student/server. Only checks that a segment is sent and contains the data (by checking segment length).
def client_sends(): test_str = "t35t1nG cl13nT 53nd1nG\n" server = start_server() client = start_client() write_to(client, test_str) segments = read_segments_from(client) if not segments: return False # The first segment should be one sent from the client, and should have the # correct length. s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fin_sent():\n test_str = \"f1N s3nt\\n\"\n server = start_server()\n client = start_client()\n\n # First write some data.\n write_to(client, test_str)\n if not read_segments_from(client):\n return False\n time.sleep(1)\n\n # Write an EOF character.\n write_to(client, '\\x1a')\n client.stdin.close(...
[ "0.6080363", "0.57543296", "0.5716248", "0.56101906", "0.56061274", "0.54835385", "0.546739", "0.5389556", "0.53850347", "0.5369113", "0.5360866", "0.53589594", "0.5357063", "0.5339195", "0.5339195", "0.5339195", "0.5306196", "0.5294233", "0.52678835", "0.5245546", "0.5234753...
0.5910685
1
Sends two segments. Makes sure they have the correct checksum by comparing it to the checksum from the reference solution.
def correct_checksum(): test_strs = ["ch3ck1nG c0rr3ct ch3cksu|\/|\n", "y3T an0th3r str1ng0_x\/.!&\n"] def test_checksum(test_str): server = start_server() client = start_client() write_to(client, test_str) segments = read_segments_from(client) if not segments: return False teardown(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify( fasta1, fasta2, num_iterations, fragment_size,\n stdout = sys.stdout, quiet = False ):\n if not quiet:\n options.stdout.write(\"verifying %s and %s using %i random segments of length %i\\n\" %\\\n (fasta1.getDatabaseName(),\n ...
[ "0.58773476", "0.5514789", "0.5365404", "0.5363739", "0.5349425", "0.53313994", "0.53235483", "0.5307787", "0.52593744", "0.5255213", "0.51900125", "0.51694834", "0.516163", "0.51526207", "0.5148607", "0.5139417", "0.50981134", "0.5078367", "0.50657135", "0.5062642", "0.50515...
0.57196456
1
Sends a complete segment from reference/client to student/server, which should be processed correctly. Then sends a truncated segment, which should be ignored.
def segment_truncated(): test_str = "n0t trunc4t3d 139482793 912847 192874 1928\n" truncated_str = DEBUG_TRUNCATE + "trunc4t3d 139482793 912847 192874 1928\n" server = start_server() client = start_client(reference=True) # Send full segment. write_to(client, test_str) time.sleep(TEST_TIMEOUT) if read_f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _done_sending(self):\n self.sfile.write('\\n')\n self.sfile.flush()", "def client_sends():\n test_str = \"t35t1nG cl13nT 53nd1nG\\n\"\n server = start_server()\n client = start_client()\n\n write_to(client, test_str)\n segments = read_segments_from(client)\n if not segments:\n return F...
[ "0.5659504", "0.5551302", "0.5488186", "0.5304388", "0.5187914", "0.51872045", "0.5173661", "0.50711083", "0.50645745", "0.50645745", "0.50645745", "0.5001264", "0.4990205", "0.49810544", "0.49803504", "0.4978353", "0.49176753", "0.49157938", "0.49002507", "0.4869038", "0.486...
0.7447061
0
Checks to see that a FIN segment is sent when an EOF is read from STDIN.
def fin_sent(): test_str = "f1N s3nt\n" server = start_server() client = start_client() # First write some data. write_to(client, test_str) if not read_segments_from(client): return False time.sleep(1) # Write an EOF character. write_to(client, '\x1a') client.stdin.close() # Check to see th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_after_fin():\n test_str = make_random(100)\n test_str_fin = \"s3nd 4ft3r f1N\\n\"\n server = start_server()\n client = start_client()\n\n # Write an EOF character to client so it sends a FIN.\n write_to(server, test_str)\n write_to(client, '\\x1a')\n client.stdin.close()\n\n # Check that a FIN wa...
[ "0.6662907", "0.6592054", "0.6576149", "0.6176294", "0.59841824", "0.5953553", "0.59051317", "0.5857678", "0.5856434", "0.57995206", "0.5788693", "0.57224506", "0.5675319", "0.5675319", "0.5675319", "0.56536347", "0.56049", "0.55862844", "0.55809706", "0.5558239", "0.55106324...
0.69732356
0
Makes sure connection teardown occurs when both sides send a FIN.
def connection_teardown(): test_str = make_random(100) server = start_server() client = start_client() # First write some data at both ends. write_to(client, test_str) write_to(server, test_str) time.sleep(TEST_TIMEOUT) # Write EOFs on both sides. write_to(client, '\x1a') write_to(server, '\x1a') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_finish_connection(tchannel_pair):\n server, client = tchannel_pair\n client.ping()\n client._connection._connection.close()\n\n def _handle(data, connection):\n pass\n server.handle_calls(_handle)", "def test_disconnect_closed(self):\n self.sock.close()\n self.inverte...
[ "0.69157124", "0.6902239", "0.6885584", "0.68576455", "0.6731117", "0.65483475", "0.65338904", "0.6509184", "0.6488512", "0.64882493", "0.64806277", "0.6480162", "0.64624083", "0.64539844", "0.64512795", "0.64017063", "0.6396657", "0.6365143", "0.63562244", "0.63420355", "0.6...
0.7399373
0
Sets a larger window size for student/client and reference/server. Reference/server immediately stops processing data and only sends repeated ACKs. Student/client should send up to the large window size (4 MAX_SEG_DATA_SIZE), but not less than (3 MAX_SEG_DATA_SIZE), otherwise, they aren't even using the larger window s...
def larger_windows(): global sliding_window_passed stop_str = DEBUG_STOP + "1t'5 h4mm3r t1m3!!!!!!!!\n" large_strs = [make_random(596) for _ in range(20)] server = start_server(reference=True, flags=["-w", str(4)]) client = start_client(flags=["-w", str(4)]) # Stop the server from processing anything. w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sets_window_size():\n test_str = make_random(596)\n server = start_server(reference=True)\n client = start_client(flags=[\"-w\", str(8)])\n\n write_to(client, test_str)\n segments = read_segments_from(client)\n if not segments:\n return False\n\n return segments[0].window == 8 * MAX_SEG_DATA_SIZE", ...
[ "0.6900556", "0.56651783", "0.55093974", "0.5497379", "0.54795605", "0.5444765", "0.542725", "0.53525776", "0.533649", "0.5309809", "0.5267125", "0.52099967", "0.52031416", "0.5195292", "0.51905316", "0.51734614", "0.516593", "0.5080279", "0.5064381", "0.50407636", "0.5040763...
0.6902364
0
Pingpongs short messages back and forth between the client and server.
def ping_pong(): test_strs = [make_random(100) for i in range(10)] server = start_server() client = start_client() # Send messages back and forth between client and server. for i in range(len(test_strs) / 2): write_to(client, test_strs[2 * i]) write_to(server, test_strs[2 * i + 1]) time.sleep(TES...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_pong(self):\r\n self._send(\"PONG\")", "def ping(self):\n self._write(f'PING :{self.server.name}')\n self.awaiting_pong_since = datetime.datetime.now()", "def ping(self):\n packet = Packet()\n packet.message = MessageType.CLIENT_PING\n packet.data = \"PING\"\...
[ "0.7529158", "0.71779794", "0.69635695", "0.6869674", "0.68149763", "0.6802937", "0.6784771", "0.6782395", "0.67609817", "0.6738858", "0.67156243", "0.67082304", "0.6705885", "0.6704774", "0.66810167", "0.6655728", "0.6655258", "0.66437304", "0.6633501", "0.66076154", "0.6599...
0.7269363
1
Student/client and reference/server, and viceversa.
def interoperation(): # Start client and reference server. test_str = make_random(100) ref_server = start_server(reference=True) client = start_client() # Write from client to reference server. write_to(client, test_str) if not read_from(ref_server) == test_str: return False # Write from reference...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client():", "def test_accessible_borrow_list_for_student(self):\n client1 = APIClient()\n client1.login(username=self.students[0].username, password=\"salam*123\")\n client1.post(\"/borrows/\", data={\"book\": 1})\n client2 = APIClient()\n client2.login(username=self.studen...
[ "0.5642053", "0.5606343", "0.55808353", "0.5401694", "0.5297133", "0.5279599", "0.51710415", "0.5139281", "0.5129775", "0.5092337", "0.50627875", "0.503359", "0.5033415", "0.5019344", "0.49896622", "0.49710542", "0.4970392", "0.49493286", "0.49429607", "0.49402353", "0.493379...
0.58996457
0
Makes sure there are only 5 retransmissions of a segment (6 total transmissions. Sends a segment from student/client to reference/server. Reference/server will ignore the segment.
def no_excessive_retrans(): test_str = DEBUG_IGNORE + "r3tr4n5m15510ns~~~~~~~\n" server = start_server(reference=True) client = start_client() # Send a segment to reference server, which should ignore it. See how many # times it was sent. write_to(client, test_str) segments = read_segments_from(server) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_truncated():\n test_str = \"n0t trunc4t3d 139482793 912847 192874 1928\\n\"\n truncated_str = DEBUG_TRUNCATE + \"trunc4t3d 139482793 912847 192874 1928\\n\"\n server = start_server()\n client = start_client(reference=True)\n\n # Send full segment.\n write_to(client, test_str)\n time.sleep(TEST_T...
[ "0.5473814", "0.5183754", "0.50722843", "0.49788105", "0.49673986", "0.4951302", "0.48840412", "0.48675218", "0.48543423", "0.48015732", "0.47839195", "0.4771921", "0.47533", "0.47516027", "0.47364625", "0.47244492", "0.4713454", "0.46841288", "0.46820426", "0.4659991", "0.46...
0.6117153
0
Sends a complete segment from reference/client to student/server, which should be processed correctly. Then sends a segment with a sequence number completely out of scope, which should be ignored.
def ignores_bad_seqno(): test_str = "cs144--cs144--cs144--cs144--cs144--cs144--cs144--cs144\n" bad_seqno_str = DEBUG_BAD_SEQNO + "cs144cs144cs144cs144cs144cs144cs144cs144\n" server = start_server() client = start_client(reference=True) # Send full segment. write_to(client, test_str) time.sleep(TEST_TIMEO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def segment_truncated():\n test_str = \"n0t trunc4t3d 139482793 912847 192874 1928\\n\"\n truncated_str = DEBUG_TRUNCATE + \"trunc4t3d 139482793 912847 192874 1928\\n\"\n server = start_server()\n client = start_client(reference=True)\n\n # Send full segment.\n write_to(client, test_str)\n time.sleep(TEST_T...
[ "0.58423656", "0.55498934", "0.5530398", "0.5483263", "0.5479365", "0.5384695", "0.53782636", "0.5260664", "0.52126765", "0.5156179", "0.51479036", "0.51272166", "0.50434875", "0.49900317", "0.49877423", "0.49753916", "0.49564484", "0.49411252", "0.49073324", "0.49045774", "0...
0.59031177
0
Student/server receives FIN. It should still send data to the client. Checks that a FIN was received first.
def send_after_fin(): test_str = make_random(100) test_str_fin = "s3nd 4ft3r f1N\n" server = start_server() client = start_client() # Write an EOF character to client so it sends a FIN. write_to(server, test_str) write_to(client, '\x1a') client.stdin.close() # Check that a FIN was received. time.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fin_sent():\n test_str = \"f1N s3nt\\n\"\n server = start_server()\n client = start_client()\n\n # First write some data.\n write_to(client, test_str)\n if not read_segments_from(client):\n return False\n time.sleep(1)\n\n # Write an EOF character.\n write_to(client, '\\x1a')\n client.stdin.close(...
[ "0.7651779", "0.72565854", "0.67559373", "0.6544908", "0.6085609", "0.6053574", "0.60232884", "0.5952287", "0.588818", "0.58216536", "0.57556015", "0.5739564", "0.5722135", "0.57121927", "0.57035065", "0.56975365", "0.56864864", "0.5676624", "0.56664944", "0.56625754", "0.565...
0.7525104
1
Client reads an EOF and should send a FIN. It should still be able to receive data from the server.
def recv_after_eof(): test_str = make_random(100) test_str_fin = "r3c31v3 4ft3r f1N\n" server = start_server() client = start_client() # Write an EOF character to client so it sends a FIN. write_to(server, test_str) write_to(client, '\x1a') client.stdin.close() # Check that a FIN was sent. time.sl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eof_received(self):\n logger.debug(\"EOF from client, closing.\")\n self.connection_lost(None)", "def send_after_fin():\n test_str = make_random(100)\n test_str_fin = \"s3nd 4ft3r f1N\\n\"\n server = start_server()\n client = start_client()\n\n # Write an EOF character to client so it send...
[ "0.78284335", "0.73806006", "0.7076207", "0.7013", "0.69987947", "0.6878545", "0.64714414", "0.6408276", "0.6382915", "0.6336182", "0.62248504", "0.62145495", "0.61686313", "0.6118387", "0.6106558", "0.6099158", "0.6079726", "0.60613066", "0.604967", "0.6037784", "0.6025446",...
0.7851663
0
Calculate depth data for points at requestedValues, given depthData and covarianceFunc
def getDepthArrayExperimental(depthData: numpy.ndarray, requestedValues: numpy.ndarray, covarianceFunc: Callable): """ xPrev = requestedValues[0] for xVal in requestedValues: # Calculate distance to previous distToPrev = abs(xVal - xPrev) # 2D distance # Calculate covar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depth_estimation(x_left, x_right, f=33.4, d=114):\n depth = abs(f * d / ((x_left - x_right) / 72 * 2.54)) / 100 # - 0.418879\n return depth", "def disc_val(self, val_data, batch_size):\n fakes = self.generate_poses(len(val_data))\n labels = np.array([1] * len(val_data) + [0] * len(fakes)...
[ "0.5295056", "0.5242438", "0.5220693", "0.5207092", "0.5097792", "0.50083566", "0.5006679", "0.4986816", "0.49857244", "0.49732733", "0.49697098", "0.49440157", "0.49382728", "0.4915959", "0.4913597", "0.49062333", "0.49047622", "0.49037802", "0.4896051", "0.48945013", "0.486...
0.81340986
0
Dump data for domain to stream.
def dump(self, output_stream): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def dump(self, data: dict, file: IO):", "def dumpData(self,out):\n #--Get sizes\n for record in self.records:\n #--Text\n if record.name == 'NAME':\n #--Truncate text?\n if len(self.text) > 511:\n self.text = self.text[:51...
[ "0.6574605", "0.64592576", "0.637863", "0.637863", "0.63642424", "0.6257538", "0.6221386", "0.6161159", "0.6138144", "0.61353606", "0.60472876", "0.6043062", "0.59851927", "0.5921861", "0.5884786", "0.5884686", "0.5857817", "0.5850663", "0.58451045", "0.580958", "0.580143", ...
0.6548187
1
make the union of the trees of x and y
def union(self,x,y): assert x in self and y in self rx,ry = self.find(x),self.find(y) if rx!=ry: nx,ny = self.__rank[rx],self.__rank[ry] if nx<=ny: self.__parent[rx] = ry self.__size[ry] += self.__size[rx] if nx==ny: self.__rank[ry]+=1 else: self.__parent[ry...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def union(self, x, y):\n\t\trx, ry = self.find(x), self.find(y)\n\t\tkrx, kry = self.__rank[rx], self.__rank[ry]\n\t\tif(krx >= kry):\n\t\t\tself.__parent[ry] = rx\n\t\t\tif(krx == kry): self.__rank[rx] = self.__rank[rx] + 1\n\t\telse: self.__parent[rx] = ry", "def union(self, x, y):\n \n px, py = ...
[ "0.7064512", "0.705985", "0.70128745", "0.6741631", "0.66894627", "0.66152054", "0.6579406", "0.64984643", "0.6430702", "0.63348776", "0.62756675", "0.62601674", "0.62502754", "0.6192367", "0.6139346", "0.61291367", "0.61289513", "0.61289513", "0.6125513", "0.61071765", "0.60...
0.7619764
0
The supported lengths of the predictor
def supportedLength(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\n return len(self.train) + len(self.val) + len(self.test)", "def __len__(self):\r\n return len(self.train_data)", "def _predict_feature_sizes(self):\n return self._feature_sizes", "def get_pred_length(self):\n return self.prediction_length", "def __len__(self)...
[ "0.736361", "0.6998112", "0.6977338", "0.6975378", "0.69442517", "0.6935557", "0.68784916", "0.6864196", "0.68472785", "0.684683", "0.67938626", "0.67794424", "0.67620033", "0.6754116", "0.67379314", "0.6736056", "0.67266524", "0.67266524", "0.66896105", "0.66629016", "0.6658...
0.7227685
1
Converts alleles into the internal allele representation of the predictor and returns a string representation
def convert_alleles(self, alleles): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_process_output(self,predictions,convert_to_string):\n normalized = [(p[0],REVERSE_ARROWS.get(p[1],p[1]),p[2]) for p in predictions]\n if convert_to_string:\n return ' '.join([\"%s%s\" % (p[0],p[1]) for p in normalized])\n return normalized", "def __str__(self):\n ...
[ "0.6184396", "0.5768091", "0.5712769", "0.56190765", "0.55800796", "0.55560637", "0.54867584", "0.54019606", "0.54016256", "0.53793234", "0.53760767", "0.53371274", "0.528604", "0.527637", "0.52741337", "0.52704126", "0.52626795", "0.5242563", "0.520618", "0.5175799", "0.5162...
0.6403247
0
Predicts the binding affinity for a given peptide or peptide lists for a given list of alleles. If alleles is not given, predictions for all valid alleles of the predictor is performed. If, however, a list of alleles is given, predictions for the valid allele subset is performed.
def predict(self, peptides, alleles=None, **kwargs): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, peptides, **kwargs):\n raise NotImplementedError", "def predict_all(self, all_ex_words: List[List[str]]) -> List[int]:\n return [self.predict(ex_words) for ex_words in all_ex_words]", "def eval_predicted(predicted, inputs, outputs, parse_beam_fn):\n best_p, best_score = None, -...
[ "0.55614895", "0.5547054", "0.5459956", "0.54064333", "0.54053646", "0.52904963", "0.5285741", "0.51725566", "0.51354027", "0.51295596", "0.51257443", "0.5097779", "0.50609297", "0.50480694", "0.5019661", "0.5019566", "0.49970984", "0.49909043", "0.4950063", "0.494749", "0.49...
0.69647753
0
Returns the feature encoding for peptides
def encode(self, peptides): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEncoded(df, feat, column, out_name, oh=False, clip=False, write_out=False, thresh=False):\n le = preprocessing.LabelEncoder()\n le.fit(df[column])\n y = le.transform(df[column]) \n if write_out is True:\n df[out_name] = pd.Series(y)\n # One Hot encode features\n if oh is True:\n ...
[ "0.58020437", "0.56009674", "0.552618", "0.55103755", "0.5440784", "0.5409019", "0.5382088", "0.5371378", "0.5367779", "0.53632474", "0.5362326", "0.5335267", "0.5300006", "0.5298888", "0.5270705", "0.52702075", "0.52668303", "0.52648956", "0.5260709", "0.5254797", "0.5242982...
0.65368515
0
Parses external results and returns the result
def parse_external_result(self, file): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_result(self, result, *, verbose=False, **kwargs):\n return get_fermilat_datafile(result)", "def task_parse_results():\n pass", "def parse_result(href):\n url=URLS['result-base']+href\n parse_functions={\n \"lobbyist\":parse_lobbyist\n , \"client\":parse_client\n }\n return parse_fu...
[ "0.712207", "0.70239043", "0.69925654", "0.69925654", "0.6953482", "0.6418458", "0.6294692", "0.6246567", "0.6133936", "0.6113321", "0.6071524", "0.60253865", "0.6020445", "0.5989748", "0.5982246", "0.59464705", "0.5942175", "0.5941691", "0.59284854", "0.5917822", "0.5897199"...
0.75591046
0
Checks whether the specified execution command can be found in PATH
def is_in_path(self): exe = self.command.split()[0] for try_path in os.environ["PATH"].split(os.pathsep): try_path = try_path.strip('"') exe_try = os.path.join(try_path, exe).strip() if os.path.isfile(exe_try) and os.access(exe_try, os.X_OK): return Tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for(command):\n if shutil.which(command) is None:\n print(colored(\"{} not available on system\".format(command),\"red\"))\n sys.exit(1)", "def find_on_path(command):\n\n if 'PATH' not in os.environ:\n return False\n\n path = os.environ['PATH']\n for element in path.spl...
[ "0.7577057", "0.75585085", "0.74920905", "0.74783725", "0.741286", "0.7362685", "0.73438174", "0.726088", "0.7077697", "0.70723623", "0.69637066", "0.6936767", "0.69339275", "0.68051726", "0.6798096", "0.6763038", "0.66706866", "0.66448194", "0.6632893", "0.6629532", "0.65697...
0.7675532
0
Benchmark the compute_iterative_fibonacci function.
def test_iterative_fibonacci_benchmark(benchmark): computed_iterative_value = benchmark( fibonacci.compute_iterative_fibonacci, value=19 ) assert computed_iterative_value == 4181
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_recursive_fibonacci_benchmark(benchmark):\n computed_recursive_value = benchmark(\n fibonacci.compute_recursive_fibonacci, value=19\n )\n assert computed_recursive_value == 4181", "def fib_cached(i):\n if i < 2: return 1\n return fib_cached(i-1) + fib_cached(i-2)", "def test_quic...
[ "0.80183786", "0.74013287", "0.7330856", "0.7119381", "0.70927745", "0.70785844", "0.7045561", "0.6983172", "0.6976063", "0.6937987", "0.68992245", "0.6839805", "0.6728518", "0.6724451", "0.66643965", "0.66435885", "0.6634579", "0.66091865", "0.65841097", "0.65841097", "0.658...
0.89311844
0
Benchmark the compute_recusrive_fibonacci function.
def test_recursive_fibonacci_benchmark(benchmark): computed_recursive_value = benchmark( fibonacci.compute_recursive_fibonacci, value=19 ) assert computed_recursive_value == 4181
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_iterative_fibonacci_benchmark(benchmark):\n computed_iterative_value = benchmark(\n fibonacci.compute_iterative_fibonacci, value=19\n )\n assert computed_iterative_value == 4181", "def test_quicker_than_recursive(self):\n mult = 250\n reps = 1000\n res_fib = timeit.t...
[ "0.81779134", "0.74096096", "0.6899512", "0.6888527", "0.6815627", "0.66488624", "0.6562564", "0.6527517", "0.64697", "0.63618094", "0.6347348", "0.6316405", "0.6313529", "0.6299702", "0.62782294", "0.6275454", "0.6226415", "0.621229", "0.61825955", "0.61655694", "0.6117408",...
0.83512175
0
Checks the iterative and recursive fibonacci functions with multiple inputs.
def test_fibonacci_multiple(fibonacci_input, expected_answer): computed_iterative_value = fibonacci.compute_iterative_fibonacci(fibonacci_input) computed_recursive_value = fibonacci.compute_recursive_fibonacci(fibonacci_input) assert computed_iterative_value == expected_answer assert computed_recursive_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_fibonacci(data: Sequence[int]) -> bool:\n if len(data) < 3:\n return False\n if data[0] != 0 or data[1] != 1:\n return False\n for n in range(2, len(data)):\n if data[n] != data[n - 1] + data[n - 2]:\n return False\n return True", "def fibonacciSeries(userinp...
[ "0.7178264", "0.7143379", "0.7013435", "0.6936545", "0.676014", "0.6662881", "0.6642217", "0.66400933", "0.66117245", "0.6579734", "0.64329857", "0.64186317", "0.6415477", "0.63852334", "0.62665355", "0.6260179", "0.6218458", "0.62144464", "0.6206261", "0.6198005", "0.6196254...
0.7537205
0
Check the iterative and recursive fibonacci functions with a single input.
def test_fibonacci_single(): computed_iterative_value = fibonacci.compute_iterative_fibonacci(18) computed_recursive_value = fibonacci.compute_recursive_fibonacci(18) assert computed_iterative_value == 2584 assert computed_recursive_value == 2584
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fibonacci_multiple(fibonacci_input, expected_answer):\n computed_iterative_value = fibonacci.compute_iterative_fibonacci(fibonacci_input)\n computed_recursive_value = fibonacci.compute_recursive_fibonacci(fibonacci_input)\n assert computed_iterative_value == expected_answer\n assert computed_r...
[ "0.75609815", "0.74707973", "0.74625546", "0.7423986", "0.73336613", "0.73101205", "0.72907925", "0.71682334", "0.7122653", "0.70729935", "0.7069784", "0.6992415", "0.69830483", "0.6973864", "0.69721997", "0.6952619", "0.69521326", "0.6895534", "0.68825495", "0.6838231", "0.6...
0.7659369
0
Check the fibonacci function returns correct values in tuple.
def test_fibonacci_tuple(): computed_fibonacci_value = fibonacci.fibonacci_tuple(8) assert computed_fibonacci_value == (1, 1, 2, 3, 5, 8, 13, 21)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci_tuple(number: int) -> Tuple[int]:\n # TODO: Add all of the required source code for this tuple-based function\n # create an empty tuple that will ultimately contain the results\n result = ()\n return result", "def good_fibonacci(n):\n\n if n <= 1:\n return (0,n)\n else:\n ...
[ "0.7495312", "0.7087924", "0.7006348", "0.6943637", "0.6943494", "0.6726427", "0.67202973", "0.6707711", "0.66854054", "0.661282", "0.660494", "0.65465456", "0.6528639", "0.6525882", "0.6490575", "0.64755964", "0.6462241", "0.6450144", "0.64456385", "0.64450544", "0.6440967",...
0.82736534
0
Check the fibonacci function returns correct values in list.
def test_fibonacci_list(): computed_fibonacci_value = fibonacci.fibonacci_list(8) assert computed_fibonacci_value == [1, 1, 2, 3, 5, 8, 13, 21]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fib():\n from fib import fibinacci\n result = fibinacci(0)\n assert result == CORRECT_LIST[0]", "def check_fibonacci(data: Sequence[int]) -> bool:\n if len(data) < 3:\n return False\n if data[0] != 0 or data[1] != 1:\n return False\n for n in range(2, len(data)):\n ...
[ "0.7688436", "0.74937403", "0.73775816", "0.73261154", "0.7310144", "0.7110707", "0.71075284", "0.7072487", "0.69218445", "0.68786097", "0.68698096", "0.68660873", "0.68476725", "0.6838543", "0.67813754", "0.6742429", "0.6730063", "0.6712836", "0.6694579", "0.6681888", "0.667...
0.81559217
0
Check the fibonacci function returns generator.
def test_fibonacci_generator(): computed_fibonacci_value = fibonacci.fibonacci_generator(8) assert isinstance(computed_fibonacci_value, types.GeneratorType) is True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fibonacci(self):\n fibonacci = [x for x in generators.fibonacci(10)]\n self.assertEqual(fibonacci[7], 21)", "def fibonacci():\n\ta, b = 0, 1\n\tyield 0\n\twhile True:\n\t\ta, b = b, a + b\n\t\tyield a", "def yieldFibonacci():\n yield 1\n a = 1\n b = 2\n while True:\n y...
[ "0.77140635", "0.7277792", "0.7176902", "0.71680737", "0.71608746", "0.7140828", "0.711126", "0.7085678", "0.70451903", "0.7023813", "0.7023769", "0.7016897", "0.69939935", "0.6988844", "0.69802195", "0.6955412", "0.6863057", "0.6839489", "0.6838587", "0.6837633", "0.6831056"...
0.7865597
0
play rock paper scissors with the computer
def rock_paper_scissors(): # creates a random integer between 0 and 2 and converts it to rock, paper, or scissors computer_guess = random.randint(0, 2) if computer_guess == 0: computer_guess = 'rock' elif computer_guess == 1: computer_guess = 'paper' else: computer_guess = 's...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rock_paper_scissors():\n rps = [\"rock\", \"paper\", \"scissors\"]\n wannaplay = input(\"do you want to play rock paper scissors? \")\n if wannaplay == \"yes\":\n computerpick = random.choice(rps)\n playerpick = input(\"what do you choose?\")\n if computerpick == \"rock\":\n ...
[ "0.7982476", "0.75652486", "0.7221312", "0.7203815", "0.7198876", "0.70861614", "0.6967138", "0.6955682", "0.6877361", "0.67542064", "0.6753567", "0.672975", "0.66974074", "0.66720617", "0.6622933", "0.66221225", "0.6594134", "0.65698695", "0.65573245", "0.6549117", "0.652660...
0.7786586
1
Function to plot the data saved into the files in real time
def real_time_plot(files): global len_data, first_iter, colors for i,F in enumerate(files): # Load data data = pylab.loadtxt(F, delimiter=',', skiprows=1, usecols=(5,6,7)) # Check if new data if (len_data!= len(data[:,0])): # Plot label = ntpath.basename(F) label = label[0:-4] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_data(self):", "def updateplot(self):\n plotfiles = []\n try:\n self.plotter.reset()\n self.plotter.set_xrange(self.xrangemin.value(), self.xrangemax.value())\n self.plotter.set_yrange(self.yrangemin.value(), self.yrangemax.value())\n self.plotter...
[ "0.73381495", "0.7053424", "0.70268565", "0.69449216", "0.69063354", "0.68788403", "0.6830094", "0.68118745", "0.66952527", "0.66853476", "0.6675326", "0.6637472", "0.6637472", "0.6637472", "0.6637472", "0.6637472", "0.663149", "0.66256434", "0.6610606", "0.6609929", "0.66070...
0.7893361
0
Bind initial data to a formset
def bind_formset(formset): if formset.is_bound: # do nothing if the formset is already bound return formset bindData={} # the formset.get_default_prefix() and form.add_prefix() methods add in the # dict keys that uniquely identify the various form fields with the individual # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_formset_data(self, request, step, formset):\n return None", "def test_view_initializes_formset_with_audit_initial_data(self):\n audit = AuditFactory(num_doctypes=3) # fixture\n\n formset = DocumentFormSet(audit_pk=audit.pk)\n\n expected_labels = {dt.name for dt in audit.r...
[ "0.75171286", "0.66315085", "0.6326573", "0.6272179", "0.62648076", "0.6243689", "0.6000025", "0.59879285", "0.59822977", "0.59440255", "0.5873928", "0.58384067", "0.58326924", "0.5798155", "0.57395196", "0.57047033", "0.570038", "0.56947863", "0.56623995", "0.5629219", "0.56...
0.7631694
0
Take an email and put it in the inbox of the client it is addressed to.
def send(self, email): client = self.clients[email.addressee] client.receive(email)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self, email):\n self.inbox += email", "def _send_mail(self, sender, subject, body, html=None):\n self.emails.append((sender, subject, body, html))", "def _send_mail(self, sender, subject, body, html=None):\n self.emails.append((sender, subject, body, html))", "def send_email(email: s...
[ "0.73855925", "0.61520404", "0.61520404", "0.59711707", "0.588577", "0.58609664", "0.5845908", "0.57926154", "0.57716554", "0.5729906", "0.57106847", "0.5706507", "0.5701675", "0.56726784", "0.5661653", "0.56558543", "0.5653912", "0.5635027", "0.56303835", "0.56113946", "0.56...
0.6936672
1
Takes a client object and client_name and adds it to the clients instance variable.
def register_client(self, client, client_name): self.clients[client_name] = client
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_clients(client_name): # Crear nuevo Cliente\n global clients\n\n if client_name not in clients:\n clients.append(client_name)\n else:\n print('The client name is alredy in the client\\'s list')", "def add_client(name):\n return create_client(name)", "def update_client(...
[ "0.752612", "0.7367797", "0.7360235", "0.7343854", "0.6815909", "0.6779203", "0.67535335", "0.66095585", "0.6547394", "0.65369165", "0.6477211", "0.6461652", "0.644304", "0.6378969", "0.63568664", "0.6327192", "0.63241255", "0.63210046", "0.6295234", "0.623358", "0.6229814", ...
0.79341835
0
Send an email with given message msg to the given recipient.
def compose(self, msg, recipient): email = Email(msg, self, recipient) self.mailman.send(email)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email(msg):\n common_send_email(subject=msg.subject, recipients=msg.recipients, html=msg.html)", "def send_message(self, recipient: str, msg: str) -> None:\n print(f'{self._name} sends a message to {recipient}: {msg}')\n self._group.private_message(sender=self, recipient_name=recipient,...
[ "0.7636544", "0.742264", "0.73602957", "0.72721535", "0.7057327", "0.7004801", "0.69507664", "0.6915788", "0.68165755", "0.6802773", "0.6533247", "0.65282345", "0.65067124", "0.64868224", "0.6430405", "0.6406949", "0.6379485", "0.6377416", "0.6361029", "0.6359102", "0.6353004...
0.7442873
1
Take an email and add it to the inbox of this client.
def receive(self, email): self.inbox += email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_mail(self, sender, subject, body, html=None):\n self.emails.append((sender, subject, body, html))", "def _send_mail(self, sender, subject, body, html=None):\n self.emails.append((sender, subject, body, html))", "async def add_email_address(self, ctx, email_address: str):\n author = ctx.m...
[ "0.66209656", "0.66209656", "0.64795595", "0.64078385", "0.63901234", "0.63149035", "0.6155216", "0.60956836", "0.60834974", "0.6063719", "0.6047605", "0.604135", "0.59993863", "0.5913825", "0.5892881", "0.5892881", "0.5892881", "0.5892881", "0.5892881", "0.5892881", "0.58928...
0.7970683
0
Fit the lambda means model
def fit(self, X, _, **kwargs): assert 'lambda0' in kwargs, 'Need a value for lambda' assert 'iterations' in kwargs, 'Need the number of EM iterations' lambda0 = kwargs['lambda0'] iterations = kwargs['iterations'] # TODO: Write code to fit the model. NOTE: labels should not be us...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tune_lambda(Xtrain, ytrain, Xval, yval):\n #####################################################\n # TODO 5: Fill in your code here #\n #####################################################\n bestlambda = None\n err = 1\n\n for v in range(-19,20):\n if v>=0:\n val = float(\"...
[ "0.6499958", "0.6446894", "0.6319095", "0.61819756", "0.6141082", "0.59941757", "0.5992641", "0.5890863", "0.5857018", "0.5783564", "0.57232213", "0.57163835", "0.5709896", "0.57097226", "0.5689378", "0.56857336", "0.56857336", "0.56857336", "0.5657545", "0.56331474", "0.5629...
0.71139395
0
Takes in a sentence and removes escape and unicode characters
def clean_up(sentence): return unicode(sentence.strip().replace("\n", ""), errors='ignore').strip().replace("\x0c", "")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_special_chars(sentence, replace_with=\"\"):\n sentence = sentence.replace('\\n', replace_with).replace('\\t', replace_with)\n return sentence", "def remove_special_chars(sentence):\r\n result = re.sub(r\"[^a-zA-Z0-9.]+\", ' ', re.sub('\\.\\.+', ' ', sentence))\r\n return result", ...
[ "0.7474423", "0.74422467", "0.7410658", "0.73010415", "0.72492003", "0.7232809", "0.7168041", "0.7168041", "0.71087813", "0.7105705", "0.7013335", "0.70034975", "0.6998236", "0.69968987", "0.69652265", "0.69615847", "0.6954357", "0.69324803", "0.69324803", "0.68823165", "0.68...
0.8358364
0
Checks if a string is empty or NaN
def check_nan(s): if s == "": return True if type(x) is not str: return np.isnan(s)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_null_or_empty(string_val):\n if string_val and string_val.strip():\n return False\n return True", "def non_empty(val):\n return val is not None and val != \"\"", "def is_str_none_or_empty(val):\n if val is None:\n return True\n if isinstance(val, string_types):\n ...
[ "0.7631642", "0.75115323", "0.74912184", "0.74632865", "0.73394746", "0.73057926", "0.7259161", "0.7225448", "0.7190422", "0.7146433", "0.714167", "0.7140877", "0.7089258", "0.7072765", "0.6981772", "0.69643974", "0.693484", "0.6930107", "0.689618", "0.6857327", "0.6751747", ...
0.8371675
0
Pooled MFoMEER, i.e., microaveraging EER approximation
def pooled_mfom_eer(y_true, y_pred): y_neg = 1 - y_true # number of positive samples P = K.sum(y_true) # number of negative samples N = K.sum(y_neg) # smooth false negative and false positive fn = y_pred * y_true fp = (1. - y_pred) * y_neg # smooth false negative and false positive r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emm(dataset):\r\n\r\n ####################### CONFIGURE THIS ##############################\r\n\r\n #Define subgroup\r\n #subgroup = dataset[(dataset['dvce_type'] == 'Tablet')]\r\n subgroup = dataset[(dataset['os_timezone'].str.contains(\"Asia\") & (dataset['os_name'].str.contains(\"iPhone\")))]\r\...
[ "0.5958953", "0.57141393", "0.56649196", "0.55627", "0.5562114", "0.5515414", "0.5514347", "0.5499168", "0.54952323", "0.54772395", "0.5469913", "0.54049045", "0.5397329", "0.53947175", "0.5379511", "0.535299", "0.5349559", "0.53284127", "0.5324324", "0.5302682", "0.5300826",...
0.5764583
1
MFoM micro F1, i.e. microaveraging F1 approximation (pool all scores and calculate errors)
def mfom_microf1(y_true, y_pred): p = 1. - y_pred numen = 2. * K.sum(p * y_true) denum = K.sum(p + y_true) smooth_f1 = numen / denum return 1.0 - smooth_f1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mfom_macrof1(y_true, y_pred):\n s = K.shape(y_true)\n y_true = K.reshape(y_true, (-1, s[-1]))\n y_pred = K.reshape(y_pred, (-1, s[-1]))\n y_neg = 1 - y_true\n # smooth counters per class\n tp = K.sum((1. - y_pred) * y_true, axis=0)\n fn = K.sum(y_pred * y_true, axis=0)\n fp = K.sum((1. ...
[ "0.65318006", "0.6385157", "0.63657004", "0.6327502", "0.6247419", "0.6231388", "0.61840904", "0.6177114", "0.6110904", "0.6081985", "0.6065075", "0.6055157", "0.6046821", "0.6025461", "0.60203606", "0.60167265", "0.5993932", "0.58769673", "0.58766234", "0.5874598", "0.586306...
0.69825727
0
MFoM macro F1, i.e. microaveraging F1 approximation (calculate errors per class)
def mfom_macrof1(y_true, y_pred): s = K.shape(y_true) y_true = K.reshape(y_true, (-1, s[-1])) y_pred = K.reshape(y_pred, (-1, s[-1])) y_neg = 1 - y_true # smooth counters per class tp = K.sum((1. - y_pred) * y_true, axis=0) fn = K.sum(y_pred * y_true, axis=0) fp = K.sum((1. - y_pred) * y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f1_macro(y_true, y_pred):\n tn, fp, fn, tp = confusion_matrix(y_pred, y_true).ravel()\n p = tp / (tp + fp) # Precision\n r = tp / (tp + fn) # Recall\n # Harmonic Mean of Precision and Recall\n f1 = 2 / (p**-1 + r**-1)\n return f1", "def macro_f1(y_true, y_pred):\n true_positives = K.sum(...
[ "0.70378786", "0.69138384", "0.68874615", "0.6594724", "0.6549159", "0.65351105", "0.64717937", "0.6450765", "0.6422856", "0.641389", "0.6364266", "0.6336707", "0.6302828", "0.6294392", "0.6287796", "0.627425", "0.6270049", "0.62664056", "0.6256716", "0.62228644", "0.62122804...
0.7380835
0
match is an abstract method which must be overwritten by all inheriting classes. This is run prior to applying a modifier, to ensure that it's being applied to the correct object. Match must return something truthy or falsy.
def match(self) -> bool:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleMatch(self, m):\r\n pass", "def match(self) -> \"MatchResult\":\n raise NotImplementedError", "def match(self, ctx):\n pass", "def matches(self):\n pass", "def null_match():\n return Self._.match(\n lambda e=Example: e\n )", "def matches(...
[ "0.6360904", "0.6255357", "0.6133291", "0.5979016", "0.58295554", "0.5766493", "0.57539165", "0.5730551", "0.56727016", "0.5654043", "0.565271", "0.563074", "0.5622233", "0.5607786", "0.5598791", "0.55559194", "0.55452245", "0.55452245", "0.55452245", "0.55452245", "0.5545224...
0.67145634
0
Override job success method to publish job status.
def handle_job_success(self, job): super().handle_job_success(job) self._handle_job_status(job, "finished")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mark(self, job, status='succeeded'):\n pass", "def put_job_success(job, message):\n print('Putting job success')\n print(message)\n code_pipeline.put_job_success_result(jobId=job)", "def _handle_success(self, result_ttl: int, pipeline: 'Pipeline'):\n # self.log.debug('Setting job %s ...
[ "0.7619745", "0.7176098", "0.7133502", "0.69943136", "0.69115824", "0.6872546", "0.6774765", "0.66946805", "0.66273", "0.6592162", "0.6588424", "0.6554816", "0.6483753", "0.6463557", "0.6463099", "0.6450274", "0.64069796", "0.63930815", "0.63866657", "0.6320475", "0.63036287"...
0.80101943
0
Override job error method to publish job status.
def handle_job_error(self, job): super().handle_job_error(job) self._handle_job_status(job, "failed")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_job_error(\n self,\n scheduler: plugin_jobs.Scheduler,\n job: tools_jobs.Job,\n exc: BaseException,\n ):\n self.error(exception=exc)", "def mark_error(self):\r\n self.status = ERROR", "def error(self):\n ...", "def handle_api_error(self, err, job_nam...
[ "0.7221201", "0.66594404", "0.6498647", "0.6491245", "0.64659506", "0.635241", "0.6345156", "0.6336844", "0.6297702", "0.62516487", "0.6205033", "0.6202307", "0.6143262", "0.61112696", "0.60876584", "0.6080668", "0.60524887", "0.6030096", "0.60265785", "0.6003622", "0.6003541...
0.7954076
0
Function that plots the football field for viewing plays.
def create_football_field(figsize=(12*2, 6.33*2), goals=True): #pitch outline & centre line pitch = patches.Rectangle((-52.5, -35), 105, 70, linewidth=2,capstyle='round', edgecolor='w', facecolor='darkgreen') fig, ax = plt.subplots(1, figsize=figsize) fig.patch.set_facecol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot(self):\n\t\tself.plotOfSpect()", "def plots(x_bef,y_bef,z_bef):\r\n # Makes a 3-D plot of the x, y and z axes representing the ball's total trajectory\r\n plt.figure(3)\r\n plot3 = plt.axes(projection=\"3d\")\r\n plot3.plot3D(x_bef,y_bef,z_bef,'blue')\r\n plot3.set_xlabel('x (ft)')\r\n ...
[ "0.61282665", "0.6110966", "0.60680497", "0.6056641", "0.59679395", "0.591012", "0.58574474", "0.58120966", "0.5806717", "0.5806647", "0.5776799", "0.57236886", "0.5697711", "0.56511635", "0.56275743", "0.5585723", "0.55778956", "0.5569716", "0.55657756", "0.5563268", "0.5558...
0.6909711
0
Test for validating an email is valid.
def test_is_valid_email(self): self.assertTrue(is_valid_email('abc@example.com'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_invalid_email(self):\n self.assertFalse(is_valid_email('helloworld'))", "def is_valid_email(email):\n assert email is not None\n return validate_email(str(email))", "def is_valid_email_address (email):\n return valid_email.search(email)", "def is_valid_email(self, email):\n r...
[ "0.7966595", "0.79205877", "0.79137427", "0.7898664", "0.78882504", "0.78553706", "0.78213567", "0.7798287", "0.7772676", "0.7767416", "0.77120966", "0.7700251", "0.7692308", "0.7688552", "0.7682156", "0.7664193", "0.7636919", "0.75773346", "0.7545542", "0.75453466", "0.75254...
0.84519744
0
Test for validating an email is invalid.
def test_is_invalid_email(self): self.assertFalse(is_valid_email('helloworld'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_email(self):\n # source: https://docs.python.org/2/howto/regex.html\n if not re.match(r\"[^@.]+@[A-Za-z]+\\.[a-z]+\", self.email):\n return 'Invalid email address!'\n return self.email", "def test_invalid_email(self):\n rv = self.login('Bo_wrong@example.com', '...
[ "0.7875082", "0.7867147", "0.78601694", "0.78475493", "0.7844588", "0.78331923", "0.7718214", "0.77108777", "0.7701428", "0.7693918", "0.766842", "0.7642582", "0.7625827", "0.76145154", "0.76109374", "0.7607006", "0.7587825", "0.75767756", "0.7554816", "0.75215554", "0.751663...
0.81805927
0
Test for successful password strength validation.
def test_password_strength_validator(self): self.assertIsNone(validate_password_strength('abcd123'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password_strength():\r\n\r\n password_regex = re.compile(r'''(\r\n (?=.*[A-Z]{2})\r\n (?=.*[a-z]{3})\r\n (?=.*[/!@#$%^&_*+'\\\"-?.:;<>,])\r\n (?=.*[0-9])\r\n .{8,}\r\n )''', re.VERBOSE)\r\n\r\n get_password(password_regex)", "def test_password_strength_va...
[ "0.811253", "0.7808661", "0.7498085", "0.7460592", "0.7393634", "0.73335767", "0.73282", "0.71243334", "0.70749134", "0.69481057", "0.6916921", "0.6855777", "0.6833095", "0.6819363", "0.68002194", "0.67896336", "0.6761693", "0.6758369", "0.6751114", "0.6736633", "0.6694997", ...
0.85219926
0
Test for length fail password strength validation.
def test_password_strength_validator_length_fail(self): with self.assertRaises(ValidationError): validate_password_strength('hi')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_password_strength_validator(self):\n self.assertIsNone(validate_password_strength('abcd123'))", "def test01_password_length(self):\n self.set_complexity(length=13, numeric=0, upper=0, lower=0, special=0)\n\n invalid = (\n \"A\",\n \"Tr0ub4dor&3\",\n ...
[ "0.8374114", "0.80661535", "0.79859805", "0.7951157", "0.7858637", "0.77230054", "0.76463336", "0.7581791", "0.7435477", "0.73920065", "0.73624104", "0.73472536", "0.7245728", "0.7207087", "0.7175876", "0.7170261", "0.71615016", "0.7102726", "0.71006024", "0.7093672", "0.7046...
0.8685554
0
Test for password strength missing digit.
def test_password_strength_validator_missing_digit(self): with self.assertRaises(ValidationError): validate_password_strength('abcdefg')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_password_strength_validator(self):\n self.assertIsNone(validate_password_strength('abcd123'))", "def test_password_strength_validator_missing_letter(self):\n with self.assertRaises(ValidationError):\n validate_password_strength('1234567')", "def check_password_strength():\r\n\...
[ "0.76214445", "0.7615998", "0.7283949", "0.7047271", "0.70288146", "0.68686", "0.68568677", "0.6758803", "0.6694275", "0.6566324", "0.6553022", "0.64874214", "0.6469547", "0.64618", "0.6447736", "0.6439617", "0.6412507", "0.641235", "0.63657725", "0.6363227", "0.6354931", "...
0.80876046
0
Test for password strength missing letter.
def test_password_strength_validator_missing_letter(self): with self.assertRaises(ValidationError): validate_password_strength('1234567')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_password_strength_validator(self):\n self.assertIsNone(validate_password_strength('abcd123'))", "def test_password_strength_validator_missing_digit(self):\n with self.assertRaises(ValidationError):\n validate_password_strength('abcdefg')", "def check_password_strength():\r\n\r...
[ "0.7635881", "0.7497957", "0.7032502", "0.6873941", "0.679898", "0.67746353", "0.6773938", "0.67620707", "0.6718229", "0.6624808", "0.6562677", "0.65404505", "0.6515814", "0.6507858", "0.643209", "0.6394227", "0.6375082", "0.63566536", "0.6346577", "0.63382757", "0.63098824",...
0.82154936
0
Test the is_valid_color method returns correct boolean for valid colors.
def test_is_valid_color(self): self.assertTrue(is_valid_color('black')) self.assertTrue(is_valid_color('#aabb11')) self.assertTrue(is_valid_color('rgba(23,45,67, .5)')) self.assertFalse(is_valid_color('bl(ack'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_rgb_color(self):\n self.assertTrue(is_valid_rgb_color('rgb(12,23,5)'))\n self.assertTrue(is_valid_rgb_color('rgb(12, 223, 225)'))\n self.assertTrue(is_valid_rgb_color('rgba(12, 223, 225, 1)'))\n self.assertTrue(is_valid_rgb_color('rgba(12, 223, 225, 1.0)'))\n se...
[ "0.82800925", "0.8025948", "0.7942473", "0.78476757", "0.76929873", "0.7682319", "0.76152545", "0.7574005", "0.7034168", "0.6930264", "0.69240725", "0.68971056", "0.68955773", "0.68178314", "0.68153834", "0.68081856", "0.67790467", "0.676682", "0.67347234", "0.6709806", "0.66...
0.85718346
0
Test the is_valid_hex method returns correct boolean for valid hex values.
def test_is_valid_hex(self): self.assertTrue(is_valid_hex('#aabb11')) self.assertTrue(is_valid_hex('#000')) self.assertTrue(is_valid_hex('#aaa')) self.assertFalse(is_valid_hex('black')) self.assertFalse(is_valid_hex('bl(ack'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_hex(hex_code: str) -> bool:\n\n match = re.search(r'^#(?:[0-9a-fA-F]{3}){1,2}$', hex_code)\n\n if match:\n return True\n else:\n return False", "def ishex(data: str) -> bool:\n return bool(re.fullmatch(r\"^0[x|X][0-9a-fA-F]+\", data)) or bool(re.fullmatch(r\"^[0-9a-fA-F]+[h...
[ "0.788637", "0.7450202", "0.7236668", "0.72257215", "0.6911687", "0.6770873", "0.67440605", "0.66821134", "0.66669804", "0.6646565", "0.6417729", "0.6403952", "0.6289003", "0.6203054", "0.6192361", "0.61916524", "0.613651", "0.6113249", "0.6108503", "0.60962427", "0.60597426"...
0.88187057
0
Test the is_valid_color_name method returns correct boolean for valid color names.
def test_is_valid_color_name(self): self.assertTrue(is_valid_color_name('black')) self.assertTrue(is_valid_color_name('red')) self.assertFalse(is_valid_color_name('#aabb11')) self.assertFalse(is_valid_color_name('bl(ack'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __isValidColor(self, name):\n try:\n if self.__isHexString(name) and len(name) in [3, 6, 9, 12]:\n return True\n return QColor.isValidColor(name)\n except AttributeError:\n if name.startswith(\"#\"):\n if len(name) not in [4, 7, 10, 1...
[ "0.83200604", "0.81965154", "0.7396032", "0.73364866", "0.7164896", "0.6983881", "0.6934124", "0.6925244", "0.6899707", "0.6870832", "0.68350774", "0.6824639", "0.6812794", "0.6721971", "0.6672961", "0.6653183", "0.66404563", "0.66331595", "0.6629673", "0.655786", "0.65213215...
0.9264244
0
Test the is_valid_rgb_color method returns the correct boolean for valid rgb and rgba colors.
def test_is_valid_rgb_color(self): self.assertTrue(is_valid_rgb_color('rgb(12,23,5)')) self.assertTrue(is_valid_rgb_color('rgb(12, 223, 225)')) self.assertTrue(is_valid_rgb_color('rgba(12, 223, 225, 1)')) self.assertTrue(is_valid_rgb_color('rgba(12, 223, 225, 1.0)')) self.assertT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_valid_color(self):\n self.assertTrue(is_valid_color('black'))\n self.assertTrue(is_valid_color('#aabb11'))\n self.assertTrue(is_valid_color('rgba(23,45,67, .5)'))\n self.assertFalse(is_valid_color('bl(ack'))", "def is_rgb_color(v):\n if hasattr(v, \"r\") and hasattr(v, ...
[ "0.77912307", "0.77550155", "0.75135416", "0.73164743", "0.72870094", "0.72755575", "0.72710174", "0.7164871", "0.7113623", "0.70725626", "0.6977921", "0.6952593", "0.67974997", "0.6797254", "0.67732257", "0.6749611", "0.6695688", "0.6689227", "0.6681818", "0.66803116", "0.66...
0.8792777
0
Cast all args to a common type using numpy promotion logic
def numeric_normalize_types(*args): dtype = np.result_type(*[a.dtype for a in args]) return [a.astype(dtype) for a in args]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cast_types(args):\n\targs.x_val = None if args.x_val == 'None' else int(args.x_val)\n\targs.test_size = float(args.test_size)\n\targs.alpha = float(args.alpha)\n\targs.fit_prior = (args.fit_prior in ['True', \"True\", 'true', \"true\"])\n\n\t# class_prior - array like type (problem to convert)\n\tif args.clas...
[ "0.70481193", "0.6366465", "0.63539773", "0.63233066", "0.6275716", "0.614064", "0.61271524", "0.61202806", "0.59463507", "0.5895006", "0.58899707", "0.58613306", "0.5814436", "0.58100325", "0.5803434", "0.5773968", "0.5766643", "0.57581913", "0.57475054", "0.57052386", "0.56...
0.6803261
1
Given a numpy or pandas dtype, converts it into the equivalent cuDF Python dtype.
def cudf_dtype_from_pydata_dtype(dtype): if cudf.api.types.is_categorical_dtype(dtype): return cudf.core.dtypes.CategoricalDtype elif cudf.api.types.is_decimal32_dtype(dtype): return cudf.core.dtypes.Decimal32Dtype elif cudf.api.types.is_decimal64_dtype(dtype): return cudf.core.dtyp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dtype(x, dtype):\n return x.type(dtype)", "def np_dtype(dali_dtype):\n return numpy.dtype(dali_dtype)", "def cudf_dtype_from_pa_type(typ):\n if pa.types.is_list(typ):\n return cudf.core.dtypes.ListDtype.from_arrow(typ)\n elif pa.types.is_struct(typ):\n return cudf.core.dtypes.S...
[ "0.7102082", "0.6950359", "0.68659675", "0.6791954", "0.67600906", "0.6706449", "0.6687098", "0.6632583", "0.66178405", "0.6519006", "0.6518103", "0.6425718", "0.63941944", "0.63792527", "0.63391143", "0.6304734", "0.62857044", "0.6259856", "0.6246659", "0.6194909", "0.614775...
0.75923187
0
Given a cuDF pyarrow dtype, converts it into the equivalent cudf pandas dtype.
def cudf_dtype_from_pa_type(typ): if pa.types.is_list(typ): return cudf.core.dtypes.ListDtype.from_arrow(typ) elif pa.types.is_struct(typ): return cudf.core.dtypes.StructDtype.from_arrow(typ) elif pa.types.is_decimal(typ): return cudf.core.dtypes.Decimal128Dtype.from_arrow(typ) e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cudf_dtype_from_pydata_dtype(dtype):\n\n if cudf.api.types.is_categorical_dtype(dtype):\n return cudf.core.dtypes.CategoricalDtype\n elif cudf.api.types.is_decimal32_dtype(dtype):\n return cudf.core.dtypes.Decimal32Dtype\n elif cudf.api.types.is_decimal64_dtype(dtype):\n return cu...
[ "0.757576", "0.7128742", "0.6667662", "0.63560766", "0.6272239", "0.6179554", "0.61016786", "0.60577655", "0.60316265", "0.59823334", "0.5971781", "0.59381866", "0.58385044", "0.5755033", "0.5734548", "0.5718757", "0.5669331", "0.5662042", "0.5653364", "0.56298435", "0.562907...
0.73913157
1
Converts the value `val` to a numpy/Pandas scalar, optionally casting to `dtype`. If `val` is None, returns None.
def to_cudf_compatible_scalar(val, dtype=None): if cudf._lib.scalar._is_null_host_scalar(val) or isinstance( val, cudf.Scalar ): return val if not cudf.api.types._is_scalar_or_zero_d_array(val): raise ValueError( f"Cannot convert value of type {type(val).__name__} " ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typedValue(val, dtype=None):\n\ttVal = None\n\t\n\tif dtype is not None:\n\t\tif dtype == \"num\":\n\t\t\tdtype = \"int\" if dtype.find(\".\") == -1 else \"float\"\n\t\t\t\n\t\tif dtype == \"int\":\n\t\t\ttVal = int(val)\n\t\telif dtype == \"float\":\n\t\t\ttVal = float(val)\n\t\telif dtype == \"bool\":\n\t\t\...
[ "0.64111996", "0.58769083", "0.58739436", "0.58730346", "0.58598644", "0.5829844", "0.57802534", "0.5682709", "0.56748736", "0.5644178", "0.5639977", "0.55624807", "0.55353075", "0.5530968", "0.55256444", "0.55256444", "0.55067986", "0.54407966", "0.5431665", "0.5428653", "0....
0.7483308
0
This function checks if the given `obj` is a columnlike (Series, Index...) type or not.
def is_column_like(obj): return ( isinstance( obj, ( cudf.core.column.ColumnBase, cudf.Series, cudf.Index, pd.Series, pd.Index, ), ) or ( hasattr(obj, "__cuda_array...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _is_object_type(df, field):\n return df[field].dtype.name == 'object'", "def can_convert_to_column(obj):\n return is_column_like(obj) or cudf.api.types.is_list_like(obj)", "def predicate(obj):\n return inspect.isclass(obj) and issubclass(obj, MafColumnRecord)", "def is_arraylike(obj):\n i...
[ "0.7964477", "0.78527325", "0.70655334", "0.7048928", "0.65591943", "0.6523134", "0.6514152", "0.6495595", "0.63864714", "0.6190344", "0.6165299", "0.6131327", "0.61073923", "0.6092305", "0.6044205", "0.60420626", "0.60420626", "0.6040725", "0.60335004", "0.59948176", "0.5915...
0.8504088
0
This function checks if the given `obj` can be used to create a column or not.
def can_convert_to_column(obj): return is_column_like(obj) or cudf.api.types.is_list_like(obj)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_column_like(obj):\n return (\n isinstance(\n obj,\n (\n cudf.core.column.ColumnBase,\n cudf.Series,\n cudf.Index,\n pd.Series,\n pd.Index,\n ),\n )\n or (\n hasattr(...
[ "0.7094436", "0.6623961", "0.6605608", "0.6200926", "0.60841525", "0.60360515", "0.59904623", "0.589983", "0.57284397", "0.5697302", "0.5693625", "0.56490564", "0.56466", "0.5643506", "0.56173486", "0.56114477", "0.5589786", "0.5583199", "0.5549619", "0.5520467", "0.5517214",...
0.7146523
0
Return the smallest signed integer dtype that can represent the integer ``x``
def min_signed_type(x, min_size=8): for int_dtype in np.sctypes["int"]: if (cudf.dtype(int_dtype).itemsize * 8) >= min_size: if np.iinfo(int_dtype).min <= x <= np.iinfo(int_dtype).max: return int_dtype # resort to using `int64` and let numpy raise appropriate exception: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_unsigned_type(x, min_size=8):\n for int_dtype in np.sctypes[\"uint\"]:\n if (cudf.dtype(int_dtype).itemsize * 8) >= min_size:\n if 0 <= x <= np.iinfo(int_dtype).max:\n return int_dtype\n # resort to using `uint64` and let numpy raise appropriate exception:\n return...
[ "0.76024413", "0.668726", "0.65399", "0.64511424", "0.6399774", "0.6128072", "0.6065688", "0.60427266", "0.60427266", "0.60032904", "0.60012406", "0.5924025", "0.5894979", "0.5814804", "0.5789021", "0.57721806", "0.57598513", "0.57583123", "0.5745024", "0.57367784", "0.572687...
0.80808735
0
Return the smallest unsigned integer dtype that can represent the integer ``x``
def min_unsigned_type(x, min_size=8): for int_dtype in np.sctypes["uint"]: if (cudf.dtype(int_dtype).itemsize * 8) >= min_size: if 0 <= x <= np.iinfo(int_dtype).max: return int_dtype # resort to using `uint64` and let numpy raise appropriate exception: return np.uint64(x)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_signed_type(x, min_size=8):\n for int_dtype in np.sctypes[\"int\"]:\n if (cudf.dtype(int_dtype).itemsize * 8) >= min_size:\n if np.iinfo(int_dtype).min <= x <= np.iinfo(int_dtype).max:\n return int_dtype\n # resort to using `int64` and let numpy raise appropriate exce...
[ "0.73269904", "0.70547926", "0.66033536", "0.59406954", "0.58949196", "0.58196664", "0.5806322", "0.57088995", "0.5687075", "0.5664583", "0.5655909", "0.564999", "0.564999", "0.56453305", "0.5612093", "0.5579257", "0.5549137", "0.55284584", "0.54975426", "0.5454876", "0.54279...
0.81060517
0
Return the smallest dtype which can represent all elements of the `NumericalColumn` `x` If the column is not a subtype of `np.signedinteger` or `np.floating` returns the same dtype as the dtype of `x` without modification
def min_column_type(x, expected_type): if not isinstance(x, cudf.core.column.NumericalColumn): raise TypeError("Argument x must be of type column.NumericalColumn") if x.valid_count == 0: return x.dtype if np.issubdtype(x.dtype, np.floating): return get_min_float_dtype(x) elif ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_signed_type(x, min_size=8):\n for int_dtype in np.sctypes[\"int\"]:\n if (cudf.dtype(int_dtype).itemsize * 8) >= min_size:\n if np.iinfo(int_dtype).min <= x <= np.iinfo(int_dtype).max:\n return int_dtype\n # resort to using `int64` and let numpy raise appropriate exce...
[ "0.6888512", "0.67179626", "0.6486889", "0.64012885", "0.6289411", "0.6284615", "0.62319744", "0.6221949", "0.614388", "0.6117546", "0.60550815", "0.6052811", "0.60378283", "0.6026932", "0.595357", "0.589386", "0.5893674", "0.5880051", "0.5877823", "0.5874977", "0.58729416", ...
0.7677199
0
Scale a Decimal such that the result is the integer that would result from removing the decimal point. Examples >>> _decimal_to_int64(Decimal('1.42')) 142 >>> _decimal_to_int64(Decimal('0.0042')) 42 >>> _decimal_to_int64(Decimal('1.004201')) 1004201
def _decimal_to_int64(decimal: Decimal) -> int: return int(f"{decimal:0f}".replace(".", ""))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_integer_price(decimal_price):\n return int(float(decimal_price) * 100)", "def decimal_to_digits(decimal, min_digits=None):\n digits = abs(int(np.log10(decimal)))\n if min_digits is not None:\n digits = np.clip(digits, min_digits, 20)\n return digits", "def float_to_int_64(x):...
[ "0.6094313", "0.5868377", "0.57986164", "0.5793088", "0.57803726", "0.573587", "0.5701622", "0.55719393", "0.54925525", "0.54124594", "0.5406755", "0.53769886", "0.5276925", "0.52483565", "0.5238759", "0.5227422", "0.5219708", "0.5164578", "0.51548785", "0.50831896", "0.50327...
0.8136278
0
Wrapper over np.find_common_type to handle special cases
def find_common_type(dtypes): if len(dtypes) == 0: return None # Early exit for categoricals since they're not hashable and therefore # can't be put in a set. if any(cudf.api.types.is_categorical_dtype(dtype) for dtype in dtypes): if all( ( cudf.api.types.is...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_type(*arrays):\n dtypes = {array.dtype.name for array in arrays}\n has_complex = not _COMPLEX_DTYPES.isdisjoint(dtypes)\n has_double = not _DOUBLE_DTYPES.isdisjoint(dtypes)\n return _DTYPE_MAP[has_complex, has_double]", "def common_type(*arrays):\n arrays = [numpoly.aspolynomial(array) ...
[ "0.71931887", "0.67270565", "0.5763443", "0.55000544", "0.5499155", "0.515625", "0.5150497", "0.514426", "0.51265186", "0.5125046", "0.50527203", "0.49514917", "0.49380565", "0.49347687", "0.49293438", "0.4913139", "0.48950943", "0.48901024", "0.48788613", "0.48710108", "0.48...
0.7117615
1
Utility function to determine if we can cast from `from_dtype` to `to_dtype`. This function primarily calls `np.can_cast` but with some special handling around cudf specific dtypes.
def _can_cast(from_dtype, to_dtype): if cudf.utils.utils.is_na_like(from_dtype): return True if isinstance(from_dtype, type): from_dtype = cudf.dtype(from_dtype) if isinstance(to_dtype, type): to_dtype = cudf.dtype(to_dtype) # TODO : Add precision & scale checking for # deci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _can_cast_to(self, value, cast_type):\n try:\n _ = cast_type(value)\n return True\n except ValueError:\n return False", "def test_upcast(self):\r\n if config.cast_policy == 'custom':\r\n assert arange(iscalar()).dtype == iscalar().dtype\r\n assert arange(fsca...
[ "0.6512901", "0.6029256", "0.6008407", "0.5839921", "0.58141434", "0.5667138", "0.56541944", "0.5560597", "0.5534378", "0.5519287", "0.5447551", "0.5432719", "0.54149824", "0.5303196", "0.52843744", "0.5275316", "0.52229995", "0.51824373", "0.5181992", "0.5151185", "0.5142572...
0.917543
0
Convert `dtype` to default if specified by user. If not specified, return as is.
def _maybe_convert_to_default_type(dtype): if cudf.get_option("default_integer_bitwidth"): if cudf.api.types.is_signed_integer_dtype(dtype): return cudf.dtype( f'i{cudf.get_option("default_integer_bitwidth")//8}' ) elif cudf.api.types.is_unsigned_integer_dtype...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_torch_default_dtype(dtype) -> torch.dtype:\n if dtype is None:\n return torch.get_default_dtype()\n if isinstance(dtype, str):\n if dtype not in dtype_mapping:\n raise ValueError(\n f\"Unknown torch dtype: {dtype}. \"\n f\"Choose from: {list(dtyp...
[ "0.7363833", "0.6817029", "0.68166256", "0.64516294", "0.6188759", "0.6085092", "0.60710496", "0.60582787", "0.60573584", "0.6052707", "0.59538263", "0.5938294", "0.58810425", "0.58723915", "0.57957613", "0.5775995", "0.57383156", "0.57367325", "0.5732564", "0.5722388", "0.57...
0.8073433
0
Checks if the unit was visible on a snapshot
def is_snapshot(self): return self.proto.display_type == DISPLAY_TYPE.Snapshot.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_visibility(self):\r\n\r\n for gs in self.ground_stations:\r\n if self.visible ^ (elevation_dot_product(self.r_ecef,self.ground_stations[gs][1],self.earth) > 0.0):\r\n self.visible ^= 1\r\n self.gs_id = self.ground_stations[gs][0]\r\n return ...
[ "0.6635701", "0.65887165", "0.6557644", "0.6523512", "0.6309742", "0.6167063", "0.6114277", "0.6098455", "0.60661596", "0.6048041", "0.6021813", "0.6008146", "0.5979416", "0.5978506", "0.59772563", "0.59762603", "0.5956536", "0.59140164", "0.589002", "0.5868256", "0.58513856"...
0.6746657
0
Returns the unit alliance
def alliance(self) -> ALLIANCE: return self.proto.alliance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weapon_holding():\n return unrealsdk.GetEngine().GamePlayers[0].Actor.Pawn.Weapon", "def get_unit(self):\n return self.unit", "def getVarUnit( self, name, adbOut ):\n\n if name not in _adbUnit: return None\n\n unit = None\n for item in _adbUnit[name]:\n ...
[ "0.618757", "0.60084546", "0.5974307", "0.58600867", "0.5816895", "0.57909936", "0.5775281", "0.5772687", "0.57205343", "0.57205343", "0.5619353", "0.559985", "0.55267227", "0.55230135", "0.55230135", "0.5519075", "0.55124843", "0.550832", "0.5463949", "0.54221255", "0.542164...
0.6642671
0
Checks if the unit is mine
def is_mine(self) -> bool: return self.proto.alliance == ALLIANCE.Self.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_mine(self):\n return self.has_label(MINE_LABEL)", "def is_won(self):\n for tile in self:\n if not tile.is_mine and tile.visibility != 1:\n return False\n return True", "def is_mine(board, x, y):\n return board[x, y] == MINE", "def isMine(self):\n re...
[ "0.683787", "0.6821652", "0.67176837", "0.6585365", "0.6462661", "0.6346446", "0.6329767", "0.6189364", "0.6164356", "0.6162114", "0.6154434", "0.6154434", "0.6154434", "0.6154434", "0.6154434", "0.6154434", "0.61218596", "0.60992813", "0.60683167", "0.60471827", "0.60274", ...
0.69367707
0
Checks if the unit is from the enemy
def is_enemy(self) -> bool: return self.proto.alliance == ALLIANCE.Enemy.value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attack(self, enemy: 'games.stardash.unit.Unit') -> bool:\n return self._run_on_server('attack', {\n 'enemy': enemy\n })", "def __is_will_belong_to_enemy(self, iceberg):\n simulation_data = self.__simulation_data\n last_turn_data = simulation_data.get(iceberg)[-1]\n ...
[ "0.68174136", "0.675546", "0.66239154", "0.6620806", "0.6594355", "0.6586144", "0.6476883", "0.64507884", "0.63767195", "0.627667", "0.6238833", "0.6225941", "0.6219776", "0.6193665", "0.61795765", "0.610945", "0.6093099", "0.605545", "0.6041871", "0.6026772", "0.60141253", ...
0.70494425
0
3d position of the unit.
def position3d(self) -> Point3: return Point3.from_proto(self.proto.pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def position(self, x, y, z):\n self.curr_position = Vector([x, y, z])\n self.ptr.position(x, y, z)", "def set_position(self, x, y, z):\n for sec in self.all:\n for i in range(int(nrn.n3d())):\n nrn.pt3dchange(i, \\\n x-self.x+nrn.x3d(i)...
[ "0.6906099", "0.687728", "0.6757202", "0.66627234", "0.66445655", "0.6620072", "0.6583574", "0.64869004", "0.64429545", "0.6421024", "0.64205307", "0.64181536", "0.641555", "0.641555", "0.6350701", "0.6316061", "0.6304115", "0.62886834", "0.6281074", "0.62697476", "0.6258691"...
0.7619963
0
Returns the unit radar range
def radar_range(self) -> Union[int, float]: return self.proto.radar_range
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def polar_radius(self):\n return self.r * (1 - self.f)", "def radii(self):\n dim_half = (self.shape[0] + 1) // 2\n x = np.arange(dim_half)\n if self.step is None:\n return x\n else:\n xmax = x.max()\n x2 = list(x[x*(self.step-1) <= 1])\n ...
[ "0.65111315", "0.6504559", "0.65019053", "0.6387397", "0.6380159", "0.629702", "0.6281683", "0.6266965", "0.61659265", "0.60936135", "0.60886836", "0.6071368", "0.6068421", "0.6052135", "0.6042729", "0.60379237", "0.60167426", "0.6009", "0.5983171", "0.5955859", "0.59381574",...
0.7913477
0
Returns the structure building progress
def build_progress(self) -> Union[int, float]: return self.proto.build_progress
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_build_progress_info(self, build_id):\n pass", "def getProgress(self):", "def calc_progress(self):\n if self.is_prepared():\n self._sync_info_from_disk()\n self._num_sown_batches = len(\n glob.glob(\n os.path.join(self.location, \"bat...
[ "0.6612247", "0.6320412", "0.6279761", "0.6238136", "0.62358683", "0.62171316", "0.6205578", "0.6187908", "0.6183282", "0.61451906", "0.60300565", "0.60300565", "0.60299975", "0.6015985", "0.5934461", "0.5904014", "0.5863854", "0.5849668", "0.5822888", "0.58013105", "0.579220...
0.71646124
0
Checks if the unit is flying
def is_flying(self) -> bool: return self.proto.is_flying
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_fallen(self):\n orientation = self.minitaur_env.minitaur.GetBaseOrientation()\n rot_mat = self.minitaur_env._pybullet_client.getMatrixFromQuaternion(orientation)\n local_up = rot_mat[6:]\n return (np.dot(np.asarray([0, 0, 1]), np.asarray(local_up)) < 0.3)", "def check_fleet(sel...
[ "0.6714423", "0.6327646", "0.6310387", "0.6241162", "0.62241924", "0.6197398", "0.61516845", "0.61313725", "0.60862607", "0.6074081", "0.6042982", "0.59909093", "0.5981111", "0.5970643", "0.59467703", "0.59375894", "0.5923914", "0.59213585", "0.59081155", "0.5905994", "0.5889...
0.6856984
0
Checks if the unit is a structure
def is_structure(self) -> bool: return ATTRIBUTE.Structure.value in self.type_data.attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_struct(self):\n return False", "def is_struct_type(self, objtype):\n return issubclass(objtype, self.get_real_ctypes_member('Structure'))", "def isUnitKind(*args):\n return _libsbml.Unit_isUnitKind(*args)", "def Unit_isUnitKind(*args):\n return _libsbml.Unit_isUnitKind(*args)", ...
[ "0.71684635", "0.66890734", "0.65594214", "0.6516844", "0.6315124", "0.60989225", "0.6083501", "0.60701495", "0.6067753", "0.59412205", "0.5836151", "0.57489586", "0.5738008", "0.566084", "0.5591216", "0.5588741", "0.5575983", "0.5564178", "0.55461234", "0.5534568", "0.547747...
0.73056
1
Checks if the unit is from the light class
def is_light(self) -> bool: return ATTRIBUTE.Light.value in self.type_data.attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def have_light(self, light):\n if light > 1:\n return False\n return bool(self.light_array[light])", "def check_lighting_state_room1():\n if timer_lights_on_off_room1() == room1_lux():\n pass\n else:\n light_room1(timer_lights_on_off_room1())", "def is_light(game_ob...
[ "0.67619145", "0.62722176", "0.624471", "0.6222856", "0.61466455", "0.6130839", "0.61091214", "0.6041529", "0.59606564", "0.5940065", "0.5884954", "0.5875173", "0.5874196", "0.58629966", "0.5836105", "0.5811311", "0.56859607", "0.5681524", "0.56774807", "0.56640285", "0.56581...
0.70930135
1
Checks if the unit is from the armored class
def is_armored(self) -> bool: return ATTRIBUTE.Armored.value in self.type_data.attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_instance(self):\n self.assertIsInstance(self.amenity_1, amenity)\n self.assertIsInstance(self.amenity_2, amenity)", "def match(self, cls):\n return isinstance(self, cls)", "def is_actor():\n return False", "def is_not_subclass(self, cls, seconds=60):\n st = '('+') & (...
[ "0.62438434", "0.61637175", "0.60709447", "0.60623026", "0.6050455", "0.6046287", "0.60447234", "0.5943034", "0.591435", "0.585211", "0.5851524", "0.58474976", "0.58188045", "0.5810405", "0.57621753", "0.5739988", "0.57276726", "0.57066995", "0.568539", "0.567616", "0.5666585...
0.6683675
1
Checks if the unit is from the robotic class
def is_robotic(self) -> bool: return ATTRIBUTE.Robotic.value in self.type_data.attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_applicable_to(cls, device_type: str,\n device_class: Type[gdm_test_base.DeviceType],\n device_name: str) -> bool:\n return issubclass(device_class, gazoo_device_base.GazooDeviceBase)", "def test_ground_vehicle(self):\n try:\n self.test = oop...
[ "0.62810934", "0.6114108", "0.6111489", "0.60843873", "0.60417813", "0.60207677", "0.5918093", "0.59043795", "0.5873593", "0.5871166", "0.5870519", "0.5862491", "0.5849073", "0.58296394", "0.5796854", "0.57912356", "0.5782388", "0.5762797", "0.5751194", "0.5750995", "0.574838...
0.661055
1
Checks if the unit is from the psionic class
def is_psionic(self) -> bool: return ATTRIBUTE.Psionic.value in self.type_data.attributes
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isUnitKind(*args):\n return _libsbml.Unit_isUnitKind(*args)", "def Unit_isUnitKind(*args):\n return _libsbml.Unit_isUnitKind(*args)", "def is_unit(self):\n return math.isclose(self.magnitude(), 1)", "def hasSummon(self):\n if self.isClass(\"Sorcerer\") and self.minionList:\n ...
[ "0.61035377", "0.6066632", "0.6008541", "0.5901321", "0.5820014", "0.5700515", "0.55786186", "0.5520976", "0.5505748", "0.5477234", "0.5328617", "0.53267735", "0.53158754", "0.5307552", "0.5296573", "0.5270201", "0.52660614", "0.5259549", "0.52338326", "0.52231985", "0.521761...
0.67083144
0
Building tech equality, e.g. OrbitalCommand is the same as CommandCenter For Hive, this returns [UnitTypeId.Hatchery, UnitTypeId.Lair] For SCV, this returns None
def tech_alias(self) -> Optional[List[UnitTypeId]]: return self.type_data.tech_alias
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit_type(self) -> str:", "def get_enduse_techs(fuel_tech_p_by):\n enduse_techs = []\n\n for tech_fueltype in fuel_tech_p_by.values():\n if 'placeholder_tech' in tech_fueltype.keys():\n return []\n else:\n enduse_techs += tech_fueltype.keys()\n\n return list(set(e...
[ "0.54681575", "0.532318", "0.5206584", "0.5172237", "0.5132882", "0.5122617", "0.50264764", "0.50133854", "0.50082165", "0.4973949", "0.49399197", "0.49248987", "0.49206087", "0.4909017", "0.4907926", "0.48900557", "0.48842818", "0.48838764", "0.48517433", "0.48451227", "0.48...
0.61599445
0
Returns the unit race
def race(self) -> RACE: return RACE(self.type_data.proto.race)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unit(self):\n return self.unit", "def race(self, instance):\r\n return '/'.join([raza.name for raza in instance.user.profile.race.all()])", "def unit(self):\n if self._pipeline:\n try:\n #return getattr(self, self._pipeline[-1][0].name).unit\n ...
[ "0.6350847", "0.619878", "0.6094755", "0.6057409", "0.59604293", "0.5947612", "0.5947612", "0.5906686", "0.57367295", "0.5582007", "0.55521536", "0.55200833", "0.55150247", "0.5500381", "0.5493672", "0.549077", "0.549077", "0.549077", "0.549077", "0.549077", "0.549077", "0....
0.67661387
0
Returns the unit current shield
def shield(self) -> Union[int, float]: return self.proto.shield
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shield(self):\n capacity = self._getAttribute(Attribute.shieldCapacity)\n recharge = self._getAttribute(Attribute.shieldRecharge)\n em = self._getAttribute(Attribute.shieldEM)\n explosive = self._getAttribute(Attribute.shieldExplosive)\n kinetic = self._getAttribute(Attribute.shieldKinetic)\n ...
[ "0.7095084", "0.67565095", "0.64647067", "0.6286027", "0.6218231", "0.6174586", "0.6174586", "0.5749591", "0.57085866", "0.57085866", "0.5695347", "0.5675916", "0.564563", "0.5520833", "0.5477099", "0.5453233", "0.5435188", "0.5431757", "0.54274654", "0.5418057", "0.5381869",...
0.7600682
1
Returns the unit max shield
def shield_max(self) -> Union[int, float]: return self.proto.shield_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shield(self) -> Union[int, float]:\n return self.proto.shield", "def shield(self) -> Union[int, float]:\n return self.proto.shield", "def getUmidadeArMax(self):\n return str(self.getWeather('umid-max')[:2]) + '%'", "def shield_percentage(self) -> Union[int, float]:\n if not se...
[ "0.66524976", "0.66524976", "0.6641473", "0.65482044", "0.65482044", "0.6506884", "0.6457938", "0.64100444", "0.63996667", "0.63713896", "0.63391215", "0.631314", "0.6224268", "0.61657584", "0.6144013", "0.61057657", "0.6100425", "0.6100425", "0.60905296", "0.6083612", "0.607...
0.8254433
1
Returns the unit current shield percentage
def shield_percentage(self) -> Union[int, float]: if not self.proto.shield_max: return 0 return self.proto.shield / self.proto.shield_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_percent(self):\n return self.percent", "def shield(self) -> Union[int, float]:\n return self.proto.shield", "def shield(self) -> Union[int, float]:\n return self.proto.shield", "def get_percentage(self):\n return self.percentage", "def get_percentage(self):\n retu...
[ "0.7029887", "0.69653", "0.69653", "0.6941394", "0.6941394", "0.69091225", "0.6898005", "0.68086296", "0.6731268", "0.66439867", "0.6607218", "0.6476712", "0.64499915", "0.6420584", "0.6419708", "0.6415546", "0.63554376", "0.6292765", "0.6292196", "0.6292196", "0.627772", "...
0.855793
1
Returns the unit max energy
def energy_max(self) -> Union[int, float]: return self.proto.energy_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_Ec_max(self):\n return self.Ec_max", "def _maximum(self) -> float:\n if self._type == \"power\":\n return 5.0\n elif self._type == \"setpoint\":\n return self._product.get_data_config_json()[\"_value_setpoint_max\"]\n elif self._type == \"fan1\":\n ...
[ "0.7158754", "0.7100571", "0.7078389", "0.7024071", "0.70133126", "0.6982264", "0.69725335", "0.6966379", "0.6940615", "0.6939813", "0.6856558", "0.682932", "0.6829139", "0.6802222", "0.6798505", "0.6798505", "0.6795786", "0.679211", "0.6791478", "0.6741895", "0.6739708", "...
0.82604754
1
Returns the unit current energy percentage
def energy_percentage(self) -> Union[int, float]: if not self.proto.energy_max: return 0 return self.proto.energy / self.proto.energy_max
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentage_used(self):\n return self.volume_used/self.total_volume * 100.0", "def total_energy(self):\n return self._total_energy", "def percentage_update(self):\n\n self.event_update()\n return self.percentage", "def unit_of_measurement(self):\n return \"%\"", "def get_p...
[ "0.7260914", "0.715174", "0.71471816", "0.7129316", "0.71087325", "0.71087325", "0.7087947", "0.70763487", "0.7016208", "0.7008012", "0.70043814", "0.6984919", "0.6962187", "0.6925202", "0.6843054", "0.6839179", "0.6819234", "0.68084145", "0.6756037", "0.6739484", "0.67370003...
0.7790874
0
Gets the weapons of the unit
def weapons(self): if self._weapons: return self._weapons if hasattr(self.type_data.proto, "weapons"): self._weapons = self.type_data.proto.weapons return self._weapons return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weapons(self):\n return self._get_by_class(Weapon)", "def weapon(self):\n if not (0 <= self._weapon_i < len(self.weapons)):\n raise Exception('No weapons')\n return self.weapons[self._weapon_i]", "def get_weapon_holding():\n return unrealsdk.GetEngine().GamePlayers[0].Act...
[ "0.81732154", "0.73420286", "0.7124047", "0.7047223", "0.69233257", "0.63363516", "0.62370163", "0.58344877", "0.5760204", "0.568579", "0.5684724", "0.5681291", "0.5652495", "0.56233495", "0.56164604", "0.5591934", "0.55885166", "0.55638725", "0.5534569", "0.55334944", "0.547...
0.7523198
1
How much cargo space is used (some units take up more than 1 space)
def cargo_used(self) -> Union[float, int]: return self.proto.cargo_space_taken
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCargoSpaceLeft(self):\n spaceused = self.cargo[\"wood\"] + self.cargo[\"coal\"] + self.cargo[\"uranium\"]\n if self.type == UNIT_TYPES.WORKER:\n return GAME_CONSTANTS[\"PARAMETERS\"][\"RESOURCE_CAPACITY\"][\"WORKER\"] - spaceused\n else:\n return GAME_CONSTANTS[\"P...
[ "0.691869", "0.68516904", "0.68139845", "0.67872095", "0.6642728", "0.64669245", "0.6460234", "0.64431036", "0.64162153", "0.64162153", "0.64162153", "0.64162153", "0.64162153", "0.64162153", "0.64162153", "0.64082515", "0.63786423", "0.63786423", "0.63745487", "0.6364653", "...
0.7691078
0
Returns the unit that are passengers tags
def passengers_tags(self) -> Set[int]: return {unit.tag for unit in self.proto.passengers}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_unit(self,tag):", "def engTagging(word, accurateMode, StanfordTagger):\n tokens = nltk.tokenize.word_tokenize(word)\n if accurateMode:\n tags = StanfordTagger.tag(tokens)\n for tag in tags:\n if tag[1] == 'PERSON':\n return 1\n elif tag[1] in ['ORG...
[ "0.6454601", "0.5695407", "0.55388343", "0.5504569", "0.5365013", "0.53606063", "0.53351146", "0.5320194", "0.531565", "0.5275182", "0.5269605", "0.5228612", "0.52207935", "0.5194548", "0.5177581", "0.51735795", "0.5171133", "0.5149033", "0.5149033", "0.5133746", "0.5129977",...
0.7001418
0
Gets the ground weapons of the unit
def ground_weapon(self): if self._ground_weapon: return self._ground_weapon if self.weapons: self._ground_weapon = next( (weapon for weapon in self.weapons if weapon.type in {TARGET_TYPE.Ground.value, TARGET_TYPE.Any.value}), None, ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weapons(self):\n return self._get_by_class(Weapon)", "def get_weapon_holding():\n return unrealsdk.GetEngine().GamePlayers[0].Actor.Pawn.Weapon", "def ground_range(self) -> Union[int, float]:\n if hasattr(self.type_data.proto, \"weapons\"):\n weapons = self.type_data.proto.weapo...
[ "0.6984032", "0.68695444", "0.669433", "0.66664845", "0.6424029", "0.6411573", "0.63551617", "0.6341753", "0.6335376", "0.6181134", "0.59627587", "0.59375674", "0.5718733", "0.5498892", "0.5459464", "0.54360014", "0.54295766", "0.5428505", "0.54121685", "0.53793263", "0.53201...
0.7385891
0
Gets the air weapons of the unit
def air_weapon(self): if self._air_weapon: return self._air_weapon if self.weapons: self._air_weapon = next( (weapon for weapon in self.weapons if weapon.type in {TARGET_TYPE.Air.value, TARGET_TYPE.Any.value}), None, ) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weapons(self):\n return self._get_by_class(Weapon)", "def get_weapon_holding():\n return unrealsdk.GetEngine().GamePlayers[0].Actor.Pawn.Weapon", "def weapons(self):\n if self._weapons:\n return self._weapons\n if hasattr(self.type_data.proto, \"weapons\"):\n s...
[ "0.72091115", "0.6857885", "0.6791066", "0.6668672", "0.65047014", "0.6473929", "0.63382876", "0.62787205", "0.61948407", "0.6023964", "0.60232615", "0.58107126", "0.5809153", "0.5799154", "0.57667565", "0.57152504", "0.5712398", "0.5667893", "0.5666294", "0.5623758", "0.5513...
0.71079904
1
Checks if the unit can attack ground
def can_attack_ground(self) -> bool: if hasattr(self.type_data.proto, "weapons"): weapons = self.type_data.proto.weapons weapon = next( (weapon for weapon in weapons if weapon.type in {TARGET_TYPE.Ground.value, TARGET_TYPE.Any.value}), None ) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_attack_ground(self) -> bool:\n if hasattr(self.type_data.proto, \"weapons\"):\n weapons = self.type_data.proto.weapons\n weapon = next(\n (weapon for weapon in weapons if weapon.type in [TARGET_TYPE.Ground.value, TARGET_TYPE.Any.value]), None\n )\n ...
[ "0.78913313", "0.7011123", "0.66745543", "0.6650226", "0.65617794", "0.65487546", "0.650418", "0.6458717", "0.6417536", "0.6376729", "0.6284213", "0.6278386", "0.62669563", "0.6263691", "0.62569064", "0.6137678", "0.61298555", "0.6104166", "0.6080718", "0.60655564", "0.606555...
0.7896708
0
Returns the unit movement speed
def movement_speed(self) -> Union[int, float]: return self.type_data.proto.movement_speed
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speed(self):\n return sqrt(self.velocity_x ** 2 + self.velocity_y ** 2)", "def get_speed(self):\n return self._speed", "def get_speed(self) -> float: \r\n if self.distance < self.distance_stop:\r\n print(\"STOP: Obstacle detected ({} cm)\".format(self.distance))\r\n ...
[ "0.7511374", "0.7306894", "0.7306178", "0.7221197", "0.7182297", "0.7182297", "0.71699685", "0.71699685", "0.7161676", "0.71568924", "0.71368206", "0.7089084", "0.70701754", "0.7040754", "0.69985515", "0.6961326", "0.6937583", "0.6937583", "0.69204515", "0.6907069", "0.689713...
0.7891986
0
Checks if a worker (or MULE) is carrying (gold)minerals.
def is_carrying_minerals(self) -> bool: return self.has_buff(BuffId.CARRYMINERALFIELDMINERALS) or self.has_buff( BuffId.CARRYHIGHYIELDMINERALFIELDMINERALS )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_mineral_field(self) -> bool:\n return self.type_data.has_minerals", "def verify_miner(self):\n for transaction in self.transaction_list:\n if(transaction.verify_miner()):\n return True\n return False", "def all_enter(self):\n return self.num_enters =...
[ "0.62416214", "0.61482203", "0.59674853", "0.5875922", "0.5744568", "0.5655014", "0.5642399", "0.56053805", "0.5594345", "0.5547255", "0.5547255", "0.5538677", "0.5538677", "0.5538677", "0.5538677", "0.5538677", "0.5538677", "0.54845953", "0.5477522", "0.5464437", "0.54502815...
0.703138
0
Checks if a worker is carrying vespene.
def is_carrying_vespene(self) -> bool: return ( self.has_buff(BuffId.CARRYHARVESTABLEVESPENEGEYSERGAS) or self.has_buff(BuffId.CARRYHARVESTABLEVESPENEGEYSERGASPROTOSS) or self.has_buff(BuffId.CARRYHARVESTABLEVESPENEGEYSERGASZERG) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_enter(self):\n return self.num_enters == self.num_workers", "def is_worker_allowed(self, worker_id):\n return worker_id in self.allowed_workers", "def _workers_available(self) -> bool:\n total_compute_power = sum(self.client.nthreads().values())\n if len(self.futures) < tota...
[ "0.6346869", "0.6190996", "0.60167", "0.6014252", "0.58534354", "0.5851993", "0.57939464", "0.5719733", "0.57030445", "0.56983227", "0.5682124", "0.56527627", "0.56478727", "0.5629735", "0.5602998", "0.5526202", "0.5517705", "0.5509002", "0.5499553", "0.54875815", "0.547757",...
0.66838014
0
Checks if the unit is an SCV that is currently building.
def is_constructing_scv(self) -> bool: return self.orders and self.orders[0].ability.id in { AbilityId.TERRANBUILD_ARMORY, AbilityId.TERRANBUILD_BARRACKS, AbilityId.TERRANBUILD_BUNKER, AbilityId.TERRANBUILD_COMMANDCENTER, AbilityId.TERRANBUILD_ENGINEER...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_building(self):\n return self._is_name_type(self.BUILDING)", "def canConstructSensorStation(self, pUnit, iBuild):\r\n\t\tbValid = false\r\n\t\tpBestPlot, iBestValue = self.findBestChokepoint(pUnit.getOwner(), true) # bug fix - was trying to use non-existent iPlayer\r\n\t\tif (pBestPlot != -1):\r\n\...
[ "0.61469597", "0.5953716", "0.58659333", "0.5855476", "0.5771452", "0.5711982", "0.5688464", "0.56500685", "0.5618142", "0.55776274", "0.5502253", "0.54851365", "0.5467927", "0.54370534", "0.54180664", "0.5416628", "0.54015076", "0.5363318", "0.53548175", "0.5348815", "0.5337...
0.6780311
0