query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Integrate ODE with velocity verlet rule
def integrate_VV_one_step(self, h, m): qs = np.array([planet.position[-1] for planet in self.planets]).flatten() vs = np.array([planet.velocity[-1] for planet in self.planets]).flatten() # Velocity verlet rule q_new = qs + h*vs + 0.5*h**2*self.rhs(qs, m) v_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, timestep=1.0 * simtk.unit.femtoseconds):\n\n super(VelocityVerletIntegrator, self).__init__(timestep)\n\n self.addPerDofVariable(\"x1\", 0)\n\n self.addUpdateContextState()\n self.addComputePerDof(\"v\", \"v+0.5*dt*f/m\")\n self.addComputePerDof(\"x\", \"x+dt*v...
[ "0.69790566", "0.69155824", "0.67686814", "0.676095", "0.67001384", "0.66451144", "0.65395856", "0.65192693", "0.64639986", "0.64069223", "0.62580323", "0.625561", "0.6218177", "0.6199242", "0.6185856", "0.61609584", "0.61557555", "0.6152949", "0.6087269", "0.6077202", "0.607...
0.6586397
6
performs evolution of gravitational problem by solving ODE System
def evolve(self, tEnd, nsteps): tStart = self.timeline[-1] m = [planet.mass for planet in self.planets] h = (float(tEnd - tStart))/float(nsteps) for i in range(nsteps): self.integrate_VV_one_step(h, m) self.timeline.append(tStart + (i+1)*h)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_odeint(particle_object,dt,omega):\n \n# print \n# print '##########################'\n# \n r = particle_object.position\n v = particle_object.velocity \n beta = particle_object.beta \n# \n# print 'Initial parameters'\n# print 'r', r\n# print 'v', v\n# print 'beta',beta\...
[ "0.7172907", "0.646518", "0.6415619", "0.6383432", "0.61928487", "0.61663693", "0.6134493", "0.6088288", "0.6077409", "0.6022923", "0.6007185", "0.59988606", "0.5998538", "0.5997303", "0.5994409", "0.59925014", "0.5991818", "0.5969261", "0.59685314", "0.59635097", "0.5961449"...
0.0
-1
updates position and velocity
def changeposvel(self, newpos, newvel): self.position.append(newpos) self.velocity.append(newvel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_position(self):\n self.position[0] += self.velocity[0]\n self.position[1] += self.velocity[1]", "def updatePos(self):\n self.timeDriving +=1\n self.pos[0] += self.vx\n self.pos[1] += self.vy", "def update(self):\r\n # change in position -> velocity\r\n ...
[ "0.85512257", "0.8209232", "0.8162798", "0.80040765", "0.79971707", "0.79405236", "0.7837445", "0.77498865", "0.7737172", "0.7632638", "0.76268536", "0.76204854", "0.7579972", "0.7482718", "0.74079674", "0.7392498", "0.7346028", "0.7342991", "0.73272717", "0.7303948", "0.7298...
0.6976005
49
outputs x positions as strin "[1.222, 1.2226, .. ]"
def x_as_plotly(self): xs = np.asarray(self.position)[:,0] return numpy_to_plotlystring(xs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec_x(self):\t\r\n if self.ox != 0:\r\n ov = self.ox\r\n lv = self.self.lx + self.ox\r\n else:\r\n ov = self.dx / 2\r\n lv = self.lx\r\n\r\n xv = \"\"\r\n for num in np.arange(ov, lv, self.dx):\r\n xv += str(num) + \" \"\r\n\r\n...
[ "0.71450645", "0.6810249", "0.6673763", "0.6567991", "0.6540675", "0.63349146", "0.6268591", "0.6193773", "0.6130126", "0.61087924", "0.6093594", "0.60668325", "0.60067976", "0.60057795", "0.60003287", "0.59720314", "0.5943515", "0.5881741", "0.58783597", "0.58677405", "0.585...
0.6141436
8
outputs x positions as strin "[1.222, 1.2226, .. ]"
def y_as_plotly(self): xs = np.asarray(self.position)[:,1] return numpy_to_plotlystring(xs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec_x(self):\t\r\n if self.ox != 0:\r\n ov = self.ox\r\n lv = self.self.lx + self.ox\r\n else:\r\n ov = self.dx / 2\r\n lv = self.lx\r\n\r\n xv = \"\"\r\n for num in np.arange(ov, lv, self.dx):\r\n xv += str(num) + \" \"\r\n\r\n...
[ "0.71444696", "0.68112135", "0.6672699", "0.6567815", "0.65418977", "0.63358814", "0.6268534", "0.6194604", "0.6141355", "0.6130819", "0.6109853", "0.6095049", "0.6068203", "0.60069877", "0.6006738", "0.60013515", "0.5972044", "0.5944388", "0.58800787", "0.58775926", "0.58673...
0.0
-1
outputs x positions as strin "[1.222, 1.2226, .. ]"
def z_as_plotly(self): xs = np.asarray(self.position)[:,2] return numpy_to_plotlystring(xs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec_x(self):\t\r\n if self.ox != 0:\r\n ov = self.ox\r\n lv = self.self.lx + self.ox\r\n else:\r\n ov = self.dx / 2\r\n lv = self.lx\r\n\r\n xv = \"\"\r\n for num in np.arange(ov, lv, self.dx):\r\n xv += str(num) + \" \"\r\n\r\n...
[ "0.71450645", "0.6810249", "0.6673763", "0.6567991", "0.6540675", "0.63349146", "0.6268591", "0.6193773", "0.6141436", "0.6130126", "0.61087924", "0.6093594", "0.60668325", "0.60067976", "0.60057795", "0.60003287", "0.59720314", "0.5943515", "0.5881741", "0.58783597", "0.5867...
0.0
-1
Figure out how 'stealable' a product is.
def stealability(self): value_weight_ratio = self.price / self.weight if value_weight_ratio < 0.5: return 'Not so stealable...' elif value_weight_ratio < 1.0: return 'Kinda stealable.' else: return 'Very stealable!'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_stealable(self):\r\n prod = Product(name='Test Product',\r\n weight=100, price=1,\r\n flammability=0.5)\r\n self.assertEqual(prod.stealability(), \"Not so stealable...\")", "def get_product_purity(product):\n return product.imass[products].sum...
[ "0.7068694", "0.68756706", "0.6865457", "0.68567866", "0.6746189", "0.67266905", "0.6655292", "0.6651548", "0.5973055", "0.591588", "0.58441055", "0.58441055", "0.5834489", "0.58047146", "0.5793756", "0.5649274", "0.55833334", "0.55405885", "0.55398786", "0.5513801", "0.55071...
0.6795847
4
Destroy products if they have a potency 10 or over
def explode(self): potency = self.flammability * self.weight if potency < 10: return '...fizzle.' elif potency < 50: return '...boom!' else: return '...BABOOM!!'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_03_product_delete(self):\n product = self.create_product()\n products = self.product_obj.search([])\n self.assertIn(product, products)\n product.unlink()\n self.assertNotIn(product.exists(), products)", "def destroy(self, good, quantity=None):\n if quantity is N...
[ "0.62185144", "0.59200734", "0.572847", "0.5650125", "0.5647066", "0.5629055", "0.5602103", "0.55858773", "0.55444473", "0.55411506", "0.5466819", "0.5395617", "0.53691226", "0.53192776", "0.5294266", "0.52941823", "0.5286533", "0.5273428", "0.52670205", "0.52670205", "0.5259...
0.0
-1
The main purpose of a boxing glove.
def punch(self): if self.weight < 5: return "That tickles." elif self.weight < 15: return "Hey that hurt!" else: return "OUCH!"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def box(self, x, y, w, h):\n\t\tpass", "def test_default_boxing_glove_weight(self):\n glove = BoxingGlove('Test Boxing Glove')\n self.assertEqual(glove.weight, 10)", "def test_box_shoot():\n rng = galsim.BaseDeviate(1234)\n obj = galsim.Box(width=1.3, height=2.4, flux=1.e4)\n im = galsim...
[ "0.6335239", "0.62205344", "0.5916162", "0.58255595", "0.58229667", "0.58111346", "0.57119113", "0.5704412", "0.5701285", "0.565995", "0.56531554", "0.5649582", "0.5586943", "0.556026", "0.5521398", "0.5511402", "0.550355", "0.5497406", "0.5493279", "0.54882395", "0.5483882",...
0.0
-1
Initiate the class by the file path.
def __init__(self, path): self.path = path self.stat = os.stat(path) self.timestamp = self.stat.st_mtime self.datetime = datetime.fromtimestamp(self.timestamp) self.modified_at = self.datetime.strftime(ISOFORMAT) self.hash = self._get_hash(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, path_to_the_file):", "def __init__(self, path_to_the_file):", "def __init__(self, path=None):\n pass", "def __init__(self, path):\n self.path = path", "def __init__(self, path):\n self.path = path", "def __init__(self, path):\n self.path = path", "def __in...
[ "0.7629349", "0.7629349", "0.7264906", "0.7259031", "0.7259031", "0.7259031", "0.7259031", "0.71294206", "0.707562", "0.7073415", "0.70441884", "0.6974368", "0.6956341", "0.6928309", "0.68991226", "0.679767", "0.6743757", "0.6643421", "0.6632877", "0.6632012", "0.65475446", ...
0.0
-1
Generate a hash from a path.
def _get_hash(self, path): with open(path, "r") as fp: content = fp.read() return sha256(content).hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hash(path: Path) -> str:\n m = hashlib.sha256()\n m.update(path.read_bytes())\n return m.hexdigest()", "def hash(path):\n\n with open(path, 'r') as file:\n return hashlib.sha1(file.read()).hexdigest()", "def hash_file(path: str) -> str:\n return _hash_file(path, hashlib.md5()).hex...
[ "0.8353133", "0.79902816", "0.7831256", "0.75318193", "0.73715246", "0.73625535", "0.73011464", "0.72034276", "0.7094866", "0.70322156", "0.7031676", "0.6988874", "0.697214", "0.6966215", "0.6926758", "0.6904041", "0.6845439", "0.6797321", "0.67444646", "0.6710574", "0.669085...
0.7663555
3
Verify if a file is equal or different from another file.
def __eq__(self, other): if (self.timestamp == other.timestamp) and (self.hash == other.hash): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def are_files_equal(file1, file2):\n input_file_1 = open(file1, \"r\")\n input_file_2 = open(file2, \"r\")\n\n file1 = input_file_1.read()\n file2 = input_file_2.read()\n print(type(file1), file1, type(file2), file2)\n\n result =False\n if file1 == file1:\n result = True\n\n input_fi...
[ "0.82369065", "0.8006959", "0.76935977", "0.7641318", "0.76184404", "0.75801724", "0.7558758", "0.755381", "0.75402236", "0.7494288", "0.7491777", "0.7351352", "0.7313978", "0.7262525", "0.72543037", "0.72270894", "0.7206164", "0.7196517", "0.7137066", "0.7131839", "0.7044682...
0.0
-1
Verify if a new file is different froma another file.
def __ne__(self, other): if (self.timestamp != other.timestamp) and (self.hash != other.hash): return True else: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_duplicate(fp1, fp2):\n try:\n subprocess.check_output(['diff', fp1, fp2])\n return True\n except subprocess.CalledProcessError:\n return False", "def test_new_file_diff(self):\n diff = (\n b'diff --git a/IAMNEW b/IAMNEW\\n'\n b'new file mode 100644\\n'\n ...
[ "0.74250644", "0.7307473", "0.72700745", "0.72628975", "0.7191385", "0.718327", "0.71489614", "0.71243423", "0.707887", "0.6985169", "0.69682914", "0.6959802", "0.6910966", "0.68806756", "0.6812512", "0.67898667", "0.6786714", "0.67848563", "0.67508864", "0.6724743", "0.67231...
0.0
-1
Return the official string representation of the object.
def __repr__(self): return "<FileItem path='{0}'>".format(self.path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return str(self.__dict__['_obj'])", "def to_string(self):\r\n return self.__str__()", "def toString(self) -> str:\n raise NotImplementedError", "def __str__(self):\n return str(self.obj)", "def get_str(self, obj):\n if self.pretty:\n ...
[ "0.79084724", "0.77594864", "0.7741893", "0.773866", "0.770523", "0.7658698", "0.76131463", "0.76131463", "0.7573172", "0.75557417", "0.7535943", "0.7528846", "0.75268936", "0.7526087", "0.7498243", "0.7497394", "0.7442554", "0.74345976", "0.74343866", "0.74243754", "0.739801...
0.0
-1
Initializes the position of the pieces on the board (x, y), color of piece (color), and if it is on the board (True or False).
def __init__(self, color): self._color = color # Color redefined when placed # Palace coords self._d = ['d1','d2','d3','d8','d9','d10'] self._e = ['e1','e2','e3','e8','e9','e10'] self._f = ['f1','f2','f3','f8','f9','f10'] self._special = self._d + self._f + self._e ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_board(self):\n self.board = np.zeros(shape=(BOARD_SIZE, BOARD_SIZE), dtype=np.int) # another way of defining board: [[for x in range(cm.BOARD_SIZE)] for x in range(cm.BOARD_SIZE)]\n center = int(BOARD_SIZE / 2)\n self.board[center-1][center-1] = self.board[center][center] = WH...
[ "0.70904624", "0.6952656", "0.6930828", "0.68304855", "0.68072546", "0.6751505", "0.6677907", "0.666762", "0.6638752", "0.6597177", "0.65884244", "0.65839565", "0.6566997", "0.6516349", "0.65150744", "0.6497887", "0.6476026", "0.647289", "0.64177", "0.6414555", "0.6397623", ...
0.0
-1
Returns the type of piece in a position on the board
def piece_type(self, pos, board): piece = board[self.ind(pos)[0]][self.ind(pos)[1]] return piece
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_piece_type(self, pos):\n piece = self.get_board()[self.ind(pos)[0]][self.ind(pos)[1]]\n return piece", "def piece_type(self):\n return self._piece_type", "def piece_type(self):\n return self._piece_type", "def piece_type(self):\n return self._piece_type", "def pie...
[ "0.86817193", "0.7477756", "0.7477756", "0.7477756", "0.7477756", "0.7477756", "0.7477756", "0.74554956", "0.7289101", "0.72572297", "0.69393", "0.6906759", "0.66416234", "0.6636054", "0.6636054", "0.66352475", "0.66080254", "0.66080254", "0.66034764", "0.6596245", "0.6439447...
0.8838244
0
Returns the color of the piece
def get_color(self): return self._color
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def color(piece):\n return Color.BLACK if piece in {Piece.BP, Piece.BN, Piece.BB, Piece.BR, Piece.BQ, Piece.BK} else Color.WHITE", "def piece_color(self, piece):\n if piece == None:\n return None\n if ord(ChessPiece.W_KING) <= ord(piece) <= ord(ChessPiece.W_PAWN):\n ret...
[ "0.7939147", "0.7717077", "0.7684216", "0.76383805", "0.7632601", "0.7610868", "0.7576671", "0.7567566", "0.7567566", "0.7567566", "0.7567566", "0.7528468", "0.75168306", "0.7486091", "0.74580204", "0.7429947", "0.7415221", "0.7405115", "0.73971117", "0.7374749", "0.7362447",...
0.7503997
14
Converts the string input to an easier index for the board
def ind(self, pos): row = int(pos[1:]) - 1 column = self.letter_to_column(pos[0]) return row, column
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_tile_index(s, index_of_a = 0xe6, index_of_zero = 0xdb, special_cases = None):\n\n\tres = []\n\tfor c in s:\n\t\tindex = None\n\t\tif ord(c) >= ord('a') and ord(c) <= ord('z'):\n\t\t\tindex = ord(c) - ord('a') + index_of_a\n\t\telif ord(c) >= ord('A') and ord(c) <= ord('Z'):\n\t\t\tindex = ord(c) - ord('...
[ "0.6576328", "0.6363488", "0.624561", "0.624561", "0.6237214", "0.62040347", "0.6185074", "0.61043257", "0.606646", "0.5939117", "0.5930663", "0.5908649", "0.58882946", "0.5851099", "0.5829864", "0.580793", "0.5769647", "0.57682794", "0.57541066", "0.57187545", "0.5717817", ...
0.0
-1
Method to convert string letters of columns to int to index
def letter_to_column(self, pos): column_dict = {} column_dict['a'] = 0 column_dict['b'] = 1 column_dict['c'] = 2 column_dict['d'] = 3 column_dict['e'] = 4 column_dict['f'] = 5 column_dict['g'] = 6 column_dict['h'] = 7 column_dict['i'] = 8 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toindex(col, row):\n a2z = 'ABCDEFGHIJLKMNOPQRSTUVWXYZ'\n\n total = 0\n mult = 0\n for char in col:\n total += (a2z.find(char) + (26 * mult))\n mult += 1\n\n return total, row - 1", "def _index_to_column(i, column=''):\n\n # A dictionary of numbers to letters starting at 0, e....
[ "0.697564", "0.6872223", "0.6809196", "0.6733294", "0.670394", "0.66991305", "0.659503", "0.6433898", "0.6289558", "0.6243379", "0.62226945", "0.616821", "0.61548716", "0.61546075", "0.6106652", "0.60687786", "0.60532284", "0.6017571", "0.5993722", "0.5990299", "0.5941516", ...
0.59708834
20
A check to see if the general can still make moves
def check_general(self, gb, gr): gb = General("BLUE") gr = General("RED") # Look to see if the generals are in the same column gr_row = self.ind(new_pos)[0] gr_col = self.ind(new_pos)[1] gb_row = self.ind(cur_pos)[0] gb_col = self.ind(cur_pos)[1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_check(self):\r\n \r\n if not self.run:\r\n return False\r\n \r\n if self.get_num_legal_moves() == 0:\r\n SlTrace.lg(\"NO more legal moves!\", \"nolegalmoves\")\r\n ###return False \r\n \r\n if self.new_move:\r\n se...
[ "0.74166924", "0.740076", "0.737363", "0.73624766", "0.71835196", "0.7156893", "0.71426195", "0.7047893", "0.7012101", "0.6978454", "0.69773424", "0.69601774", "0.6956621", "0.6950494", "0.69336253", "0.69222677", "0.69169897", "0.68975604", "0.6894488", "0.6885957", "0.68812...
0.0
-1
Initializes the General object
def __init__(self, color): super().__init__(color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def initialize(self):\n\t\tpass", ...
[ "0.765378", "0.765378", "0.765378", "0.765378", "0.765378", "0.765378", "0.765378", "0.765378", "0.7540846", "0.7486289", "0.74687177", "0.74687177", "0.74307793", "0.74307793", "0.74307793", "0.74307793", "0.74307793", "0.73436445", "0.73008484", "0.72553277", "0.72162044", ...
0.0
-1
Returns whether or not moving a piece to a desired position is a legal move.
def check_legal(self, cur_pos, new_pos, board, state): if cur_pos and new_pos in self._special: new_row = self.ind(new_pos)[0] new_col = self.ind(new_pos)[1] cur_row = self.ind(cur_pos)[0] cur_col = self.ind(cur_pos)[1] if state == "UNFINISHED"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal_move(self, current_player, move):\n\t\tstarting_pos = move[0]\n\t\tending_pos = move[1]\n\t\tif ending_pos[0] not in range(self.board_size) or ending_pos[1] not in range(self.board_size):\t# Discard any generated moves that fall off of the board\n\t\t\treturn False \n\t\tif self.board.repr[starting_...
[ "0.80670345", "0.7887482", "0.7804901", "0.7694283", "0.76606935", "0.7650084", "0.7638945", "0.7626525", "0.7550252", "0.75415576", "0.7538948", "0.7497688", "0.7491545", "0.7488044", "0.74343395", "0.74303377", "0.74189925", "0.741797", "0.7385709", "0.73738515", "0.7362131...
0.74184275
17
Initializes the Guard object
def __init__(self, color): super().__init__(color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n self._authorize()", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\...
[ "0.66751796", "0.6549449", "0.6549449", "0.6549449", "0.6549449", "0.6549449", "0.6549449", "0.6549449", "0.6549449", "0.65249234", "0.65249234", "0.65249234", "0.65249234", "0.65249234", "0.65057564", "0.65057564", "0.65014035", "0.64822745", "0.64812714", "0.647015", "0.647...
0.0
-1
Returns whether or not moving a piece to a desired position is a legal move.
def check_legal(self, cur_pos, new_pos, board, state): if cur_pos and new_pos in self._special: new_row = self.ind(new_pos)[0] new_col = self.ind(new_pos)[1] cur_row = self.ind(cur_pos)[0] cur_col = self.ind(cur_pos)[1] if state == "UNFINISHED": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal_move(self, current_player, move):\n\t\tstarting_pos = move[0]\n\t\tending_pos = move[1]\n\t\tif ending_pos[0] not in range(self.board_size) or ending_pos[1] not in range(self.board_size):\t# Discard any generated moves that fall off of the board\n\t\t\treturn False \n\t\tif self.board.repr[starting_...
[ "0.80670345", "0.7887482", "0.7804901", "0.7694283", "0.76606935", "0.7650084", "0.7638945", "0.7626525", "0.7550252", "0.75415576", "0.7538948", "0.7497688", "0.7491545", "0.7488044", "0.74343395", "0.74303377", "0.74189925", "0.74184275", "0.741797", "0.73738515", "0.736213...
0.7385709
19
Initializes the Horse object
def __init__(self, color): super().__init__(color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\n\n # --------- BEGIN YOUR CODE ----------\n\n # This is exactly the same as Human.initialize, just copy the code over\n\n # --------- END YOUR CODE ----------\n pass", "def __init__(self):\n\t\tself.hog = cv2.HOGDescriptor()\n\t\tself.hog.setSVMDetector(cv2.HOGD...
[ "0.62536705", "0.6193872", "0.59844786", "0.59842765", "0.5983944", "0.5982943", "0.5981144", "0.5977151", "0.5969011", "0.5948414", "0.5927264", "0.59155196", "0.5910404", "0.58812", "0.5878882", "0.58774865", "0.5867995", "0.5852446", "0.5848517", "0.5822541", "0.58182365",...
0.0
-1
Returns whether or not moving a piece to a desired position is a legal move.
def check_legal(self, cur_pos, new_pos, board, state): new_row = self.ind(new_pos)[0] new_col = self.ind(new_pos)[1] cur_row = self.ind(cur_pos)[0] cur_col = self.ind(cur_pos)[1] piece = self.piece_type(cur_pos, board) if state == "UNFINISHED": # Check if the mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal_move(self, current_player, move):\n\t\tstarting_pos = move[0]\n\t\tending_pos = move[1]\n\t\tif ending_pos[0] not in range(self.board_size) or ending_pos[1] not in range(self.board_size):\t# Discard any generated moves that fall off of the board\n\t\t\treturn False \n\t\tif self.board.repr[starting_...
[ "0.80670345", "0.7887482", "0.7804901", "0.7694283", "0.76606935", "0.7650084", "0.7638945", "0.7626525", "0.7550252", "0.75415576", "0.7538948", "0.7497688", "0.7491545", "0.7488044", "0.74343395", "0.74303377", "0.74189925", "0.74184275", "0.741797", "0.7385709", "0.7373851...
0.71017843
41
Initializes the Elephant object
def __init__(self, color): super().__init__(color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(self):\n\n # --------- BEGIN YOUR CODE ----------\n\n # This is exactly the same as Human.initialize, just copy the code over\n\n # --------- END YOUR CODE ----------\n pass", "def setup(self):\n self.ae = None", "def __init__(self, bee):\n self.id = Bee...
[ "0.6365033", "0.6240697", "0.6126713", "0.6047953", "0.6047953", "0.6047953", "0.6047953", "0.6047953", "0.6047953", "0.6047953", "0.6047953", "0.60300183", "0.6027994", "0.60207295", "0.6016816", "0.6010854", "0.5991587", "0.5991587", "0.5991587", "0.5991587", "0.5991587", ...
0.0
-1
Returns whether or not moving a piece to a desired position is a legal move.
def check_legal(self, cur_pos, new_pos, board, state): new_row = self.ind(new_pos)[0] new_col = self.ind(new_pos)[1] cur_row = self.ind(cur_pos)[0] cur_col = self.ind(cur_pos)[1] piece = self.piece_type(cur_pos, board) if state == "UNFINISHED": if (new_row ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal_move(self, current_player, move):\n\t\tstarting_pos = move[0]\n\t\tending_pos = move[1]\n\t\tif ending_pos[0] not in range(self.board_size) or ending_pos[1] not in range(self.board_size):\t# Discard any generated moves that fall off of the board\n\t\t\treturn False \n\t\tif self.board.repr[starting_...
[ "0.80670345", "0.7887482", "0.7804901", "0.7694283", "0.76606935", "0.7650084", "0.7638945", "0.7626525", "0.7550252", "0.75415576", "0.7538948", "0.7497688", "0.7491545", "0.7488044", "0.74343395", "0.74303377", "0.74189925", "0.74184275", "0.741797", "0.7385709", "0.7373851...
0.6890454
65
Initializes the Chariot object
def __init__(self, color): super().__init__(color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize(self):\n self.send_init_command()", "def init(self) -> None:\n ...", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "d...
[ "0.7165378", "0.7119273", "0.71136373", "0.71136373", "0.71136373", "0.71136373", "0.71136373", "0.71136373", "0.71136373", "0.71136373", "0.70866865", "0.70866865", "0.70866865", "0.70866865", "0.70866865", "0.70742416", "0.70396006", "0.7035639", "0.7035639", "0.6998097", "...
0.0
-1
Returns whether or not moving a piece to a desired position is a legal move.
def check_path(self, cur_pos, new_pos, board, state): new_row = self.ind(new_pos)[0] new_col = self.ind(new_pos)[1] cur_row = self.ind(cur_pos)[0] cur_col = self.ind(cur_pos)[1] cannon_pieces = [Cannon('BLUE'), Cannon('RED')] # Ensures the range is always in the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal_move(self, current_player, move):\n\t\tstarting_pos = move[0]\n\t\tending_pos = move[1]\n\t\tif ending_pos[0] not in range(self.board_size) or ending_pos[1] not in range(self.board_size):\t# Discard any generated moves that fall off of the board\n\t\t\treturn False \n\t\tif self.board.repr[starting_...
[ "0.80670345", "0.7887482", "0.7804901", "0.7694283", "0.76606935", "0.7650084", "0.7638945", "0.7626525", "0.7550252", "0.75415576", "0.7538948", "0.7497688", "0.7491545", "0.7488044", "0.74343395", "0.74303377", "0.74189925", "0.74184275", "0.741797", "0.7385709", "0.7373851...
0.0
-1
Returns whether or not moving a piece to a desired position is a legal move.
def check_legal(self, cur_pos, new_pos, board, state): new_row = self.ind(new_pos)[0] new_col = self.ind(new_pos)[1] cur_row = self.ind(cur_pos)[0] cur_col = self.ind(cur_pos)[1] if state == "UNFINISHED": # Make sure the position you're going into isn't your own piece ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal_move(self, current_player, move):\n\t\tstarting_pos = move[0]\n\t\tending_pos = move[1]\n\t\tif ending_pos[0] not in range(self.board_size) or ending_pos[1] not in range(self.board_size):\t# Discard any generated moves that fall off of the board\n\t\t\treturn False \n\t\tif self.board.repr[starting_...
[ "0.806804", "0.7886987", "0.7805555", "0.7694613", "0.76609105", "0.76509035", "0.7638461", "0.7627283", "0.7551364", "0.7542628", "0.75390583", "0.74978685", "0.7492485", "0.74871546", "0.74348223", "0.743149", "0.7419824", "0.741848", "0.74178165", "0.73851764", "0.737407",...
0.69577366
56
Initializes the Cannon object
def __init__(self, color): super().__init__(color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.dna = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]", "def __init__(self):\n self.screen = pg.display.get_surface()\n self.screen_rect = self.screen.get_rect()\n self.joys = initialize_all_gamepads()\n self.done = False\n self.clock = pg.tim...
[ "0.6676756", "0.66760147", "0.6470259", "0.64511144", "0.64349926", "0.63484627", "0.6214447", "0.6211741", "0.61788964", "0.6160442", "0.6149705", "0.6126983", "0.61217487", "0.6110981", "0.61099446", "0.609572", "0.6090035", "0.608955", "0.608861", "0.6083246", "0.6064265",...
0.0
-1
Returns whether or not moving a piece to a desired position is a legal move.
def check_legal(self, cur_pos, new_pos, board, state): print("we are in check legal???") new_row = self.ind(new_pos)[0] new_col = self.ind(new_pos)[1] cur_row = self.ind(cur_pos)[0] cur_col = self.ind(cur_pos)[1] cannon_pieces = [Cannon('BLUE'), Cannon('RED')] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal_move(self, current_player, move):\n\t\tstarting_pos = move[0]\n\t\tending_pos = move[1]\n\t\tif ending_pos[0] not in range(self.board_size) or ending_pos[1] not in range(self.board_size):\t# Discard any generated moves that fall off of the board\n\t\t\treturn False \n\t\tif self.board.repr[starting_...
[ "0.80669796", "0.7887585", "0.78052557", "0.76942205", "0.7660359", "0.764954", "0.7639212", "0.7626182", "0.7550657", "0.7541531", "0.7539006", "0.7497845", "0.7491266", "0.7487243", "0.74339044", "0.74294484", "0.7418835", "0.7418604", "0.7417427", "0.7384702", "0.7373439",...
0.6782942
77
Initializes the Soldier object
def __init__(self, color): super().__init__(color)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\n\n self.sold = Soldier(0, 0)\n self.R = Random(seed)", "def __init__(self):\n self.x_coord = default_init\n self.y_coord = default_init\n self._init_random_coord() # generating random coordinates\n self.x_speed = default_init\n self.y_speed = de...
[ "0.7056018", "0.67353684", "0.6601777", "0.65038085", "0.6429334", "0.63965416", "0.6358217", "0.63580596", "0.63155276", "0.62712073", "0.6229866", "0.62221044", "0.62221044", "0.62221044", "0.62221044", "0.62221044", "0.62221044", "0.62221044", "0.62221044", "0.6212346", "0...
0.0
-1
Returns whether or not moving a piece to a desired position is a legal move.
def check_legal(self, cur_pos, new_pos, board, state): new_row = self.ind(new_pos)[0] new_col = self.ind(new_pos)[1] cur_row = self.ind(cur_pos)[0] cur_col = self.ind(cur_pos)[1] if state == "UNFINISHED": # Make sure the position you're going into isn't your own ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_legal_move(self, current_player, move):\n\t\tstarting_pos = move[0]\n\t\tending_pos = move[1]\n\t\tif ending_pos[0] not in range(self.board_size) or ending_pos[1] not in range(self.board_size):\t# Discard any generated moves that fall off of the board\n\t\t\treturn False \n\t\tif self.board.repr[starting_...
[ "0.806804", "0.7886987", "0.7805555", "0.7694613", "0.76609105", "0.76509035", "0.7638461", "0.7627283", "0.7551364", "0.7542628", "0.75390583", "0.74978685", "0.7492485", "0.74348223", "0.743149", "0.7419824", "0.741848", "0.74178165", "0.73851764", "0.737407", "0.736229", ...
0.74871546
13
Builds the board and places the pieces in its spots
def __init__(self): self._board = [] for i in range(10): self._board.append([None for i in range(9)]) self.place_pieces()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pieces(self):\n\n for i in range(len(self._game_board)):\n\n # Row 1\n if i == 0:\n for ii in range(len(self._game_board[i])):\n if ii == 0 or ii == 8:\n self._game_board[i][ii] = Chariot(\"black\", \"BCHA\")\n ...
[ "0.76958317", "0.75001955", "0.74567485", "0.7341733", "0.70812273", "0.7060305", "0.7044529", "0.703703", "0.7003849", "0.70005375", "0.6979452", "0.6912584", "0.6899879", "0.6873802", "0.68558186", "0.68404317", "0.68015313", "0.6734895", "0.67268836", "0.6687073", "0.66094...
0.7115662
4
pos is a string of a letter (column) and a number (row) for example pos = 'a2' which is the first column in the second row
def add_piece(self, pos, piece): self._board[self.ind(pos)[0]][self.ind(pos)[1]] = piece
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_pos(self, pos):\r\n\r\n column = ord(pos[0]) - 97\r\n if len(pos) == 2:\r\n row = ord(pos[1]) - 49\r\n else:\r\n row = 9\r\n return [row, column]", "def ind(self, pos):\n row = int(pos[1:]) - 1\n column = self.letter_to_column(pos[0])\n ...
[ "0.77553797", "0.76948345", "0.76948345", "0.76948345", "0.7183702", "0.6877627", "0.681922", "0.6784532", "0.6784532", "0.6784532", "0.6606381", "0.65445465", "0.6504546", "0.64573586", "0.6438382", "0.63509005", "0.6310229", "0.6288248", "0.6281679", "0.62796885", "0.626522...
0.0
-1
Places the pieces into the board
def place_pieces(self): # Soldiers # RED self.add_piece('a4', Soldier('RED')) self.add_piece('c4', Soldier('RED')) self.add_piece('e4', Soldier('RED')) self.add_piece('g4', Soldier('RED')) self.add_piece('i4', Soldier('RED')) # BLUE self.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pieces(self):\n\n for i in range(len(self._game_board)):\n\n # Row 1\n if i == 0:\n for ii in range(len(self._game_board[i])):\n if ii == 0 or ii == 8:\n self._game_board[i][ii] = Chariot(\"black\", \"BCHA\")\n ...
[ "0.7959982", "0.749098", "0.734272", "0.72255486", "0.71461445", "0.71421164", "0.7104146", "0.7104122", "0.7098994", "0.7047633", "0.6989514", "0.6965336", "0.69504815", "0.6940305", "0.691998", "0.6877462", "0.6824572", "0.682331", "0.678611", "0.676654", "0.6737048", "0....
0.72615147
3
Converts the string input to an easier index for the board
def ind(self, pos): row = int(pos[1:]) - 1 column = self.letter_to_column(pos[0]) return row, column
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_tile_index(s, index_of_a = 0xe6, index_of_zero = 0xdb, special_cases = None):\n\n\tres = []\n\tfor c in s:\n\t\tindex = None\n\t\tif ord(c) >= ord('a') and ord(c) <= ord('z'):\n\t\t\tindex = ord(c) - ord('a') + index_of_a\n\t\telif ord(c) >= ord('A') and ord(c) <= ord('Z'):\n\t\t\tindex = ord(c) - ord('...
[ "0.65749663", "0.63636225", "0.6246017", "0.6246017", "0.6236835", "0.620381", "0.6185024", "0.6103975", "0.60677254", "0.5938762", "0.59301907", "0.5907308", "0.58895487", "0.58494514", "0.58299446", "0.58082986", "0.57690984", "0.5768399", "0.5753516", "0.57182777", "0.5717...
0.0
-1
Method to convert string letters of columns to int to index
def letter_to_column(self, pos): column_dict = {} column_dict['a'] = 0 column_dict['b'] = 1 column_dict['c'] = 2 column_dict['d'] = 3 column_dict['e'] = 4 column_dict['f'] = 5 column_dict['g'] = 6 column_dict['h'] = 7 column_dict['i'] = 8 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toindex(col, row):\n a2z = 'ABCDEFGHIJLKMNOPQRSTUVWXYZ'\n\n total = 0\n mult = 0\n for char in col:\n total += (a2z.find(char) + (26 * mult))\n mult += 1\n\n return total, row - 1", "def _index_to_column(i, column=''):\n\n # A dictionary of numbers to letters starting at 0, e....
[ "0.69773763", "0.68732166", "0.68112355", "0.6735234", "0.6705109", "0.669631", "0.65928155", "0.6434589", "0.62909186", "0.6246335", "0.62254184", "0.6169324", "0.61528987", "0.615157", "0.6108927", "0.60706455", "0.60536516", "0.6016396", "0.5995302", "0.5989416", "0.593823...
0.5971387
21
Initializes the JanggiGame object and any data members within it Will also initialize the board and the state of the game
def __init__(self): self._current_state = "UNFINISHED" self._start_color = "RED" self._board = Board()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n\n super().__init__()\n self.setup_janggi_game()\n self._game_state = 'UNFINISHED'\n self._player_turn = 'BLUE'", "def __init__(self):\n self._game_state = \"UNFINISHED\"\n self._current_player = \"BLACK\"\n self._game_board = Board()", "def...
[ "0.76960254", "0.75917774", "0.7335311", "0.7320754", "0.72306293", "0.7104167", "0.70632404", "0.7060205", "0.70424086", "0.6992594", "0.69829863", "0.69746006", "0.69513136", "0.6912526", "0.6892557", "0.68804467", "0.68785805", "0.6833406", "0.6831556", "0.68277174", "0.68...
0.69185317
13
Returns the current state of the game
def get_current_state(self): return self._current_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_game_state(self):\n return self._current_state", "def get_current_state(self):\n return self.game.get_current_state()", "def get_game_state(self):\n return self.game_state", "def get_game_state(self):\r\n return self._game_state", "def game_state(self):\n return s...
[ "0.8688084", "0.85931563", "0.85584146", "0.8483973", "0.83962715", "0.8340202", "0.8340202", "0.8340202", "0.8292515", "0.82672775", "0.81334084", "0.81334084", "0.8076709", "0.7736215", "0.7632696", "0.7541725", "0.7511679", "0.7510378", "0.75102514", "0.74861866", "0.74576...
0.7496113
19
Returns the modified board
def get_board(self): return self._board.get_board()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_board(self):\n return copy.deepcopy(self.board)", "def get_board(self):\n return self.board.copy()", "def board(self):\n return copy.deepcopy(self._board)", "def get_board(self) -> Tuple[Tuple[chr]]:\n # If we return the list, then the caller could modify the board,\n ...
[ "0.7892362", "0.77313495", "0.77217025", "0.71888256", "0.7169571", "0.7100963", "0.70776004", "0.702484", "0.6998541", "0.69512707", "0.6892022", "0.68709606", "0.68190193", "0.681414", "0.67837346", "0.6763473", "0.6762538", "0.6758408", "0.67419964", "0.6720759", "0.667477...
0.65364766
32
Returns the state of the game of the JanggiGame object. Depending on the game state, it will return 'UNFINISHED', 'RED_WON', or 'BLUE_WON'.
def get_game_state(self): return self._current_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_game_state(self):\n return self._game_status", "def get_game_state(self):\n return self.game_state", "def get_game_state(self):\r\n return self._game_state", "def game_state(self):\n return self._game_state", "def get_game_state(self):\n return self._game_state", ...
[ "0.7859136", "0.7574257", "0.74340075", "0.7409152", "0.7396259", "0.7396259", "0.7396259", "0.72932476", "0.72932476", "0.7233707", "0.69657916", "0.6771893", "0.67710197", "0.6616355", "0.65371597", "0.6462404", "0.6418556", "0.6380044", "0.629822", "0.62753946", "0.6242666...
0.732088
7
Takes as a parameter a player (red or blue) and returns True if that player is in check, but return False otherwise.
def is_in_check(self, player): # List of coords in board col = ['a','b','c','d','e','f','g','h','i'] # the columns a = [] for i in range(10): a.append([j + str(i+1) for j in col]) # Flatten the list board_coords = [] for sublist in a: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_a_player_in_check(self, color):\n\n current_player = color\n if current_player == 'red':\n opposing_player = 'blue'\n else:\n opposing_player = 'red'\n\n if self.can_checkmate(opposing_player):\n return self.get_general(current_player)\n\n ...
[ "0.79236925", "0.7398487", "0.72824985", "0.72756344", "0.7033824", "0.66424614", "0.6566459", "0.64891684", "0.64220923", "0.6324632", "0.6276745", "0.625594", "0.6253059", "0.6247629", "0.62069917", "0.6168962", "0.6150106", "0.6135477", "0.6122833", "0.6112812", "0.6101494...
0.6679276
5
Returns the Piece object sitting in the pos of the board
def get_piece_type(self, pos): piece = self.get_board()[self.ind(pos)[0]][self.ind(pos)[1]] return piece
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_game_piece_object_at_position(self, position):\n\n column, row = self.transpose_position(position)\n\n return self.get_board()[int(row)][int(column)]", "def get_piece(self, position):\n return self.board[position[0]][position[1]]", "def get_piece(self, square):\n return self...
[ "0.8197641", "0.79538995", "0.7825521", "0.7825521", "0.76192605", "0.7518913", "0.74976397", "0.73587805", "0.71033704", "0.7013367", "0.7013367", "0.7009093", "0.69670683", "0.689905", "0.68621624", "0.6834348", "0.6766392", "0.6760974", "0.6722869", "0.6645159", "0.6597885...
0.7186229
8
Takes two parameters, strings that represent the square to move from and the square to move to. If the square being moved from doesn't contain an opposing piece, the move is not legal, or if the game has already won, then it should return False. Otherwise, make the move, remove any captured piece, update the game state...
def make_move(self, cur_pos, new_pos): print(cur_pos, new_pos) # Automatically check if the new_pos is the same color piece piece = self.get_piece_type(cur_pos) # Check if cur_pos is None if piece == None: print("the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_piece(self, from_square, to_square):\n moving_piece = self.get_piece(from_square)\n if moving_piece is not None and moving_piece.player == self.current_player:\n self.set_piece(to_square, moving_piece)\n self.promotion_check(to_square, from_square, moving_piece)\n ...
[ "0.7655737", "0.7623852", "0.7501258", "0.74465007", "0.7432097", "0.7288445", "0.7230711", "0.7222319", "0.71864444", "0.71783805", "0.71758235", "0.71665055", "0.71586996", "0.71384645", "0.7130617", "0.71106654", "0.7063356", "0.7027979", "0.70070565", "0.6989784", "0.6983...
0.66769207
41
Converts the string input to an easier index for the board
def ind(self, pos): row = int(pos[1:]) - 1 column = self.letter_to_column(pos[0]) return row, column
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_to_tile_index(s, index_of_a = 0xe6, index_of_zero = 0xdb, special_cases = None):\n\n\tres = []\n\tfor c in s:\n\t\tindex = None\n\t\tif ord(c) >= ord('a') and ord(c) <= ord('z'):\n\t\t\tindex = ord(c) - ord('a') + index_of_a\n\t\telif ord(c) >= ord('A') and ord(c) <= ord('Z'):\n\t\t\tindex = ord(c) - ord('...
[ "0.6576328", "0.6363488", "0.624561", "0.624561", "0.6237214", "0.62040347", "0.6185074", "0.61043257", "0.606646", "0.5939117", "0.5930663", "0.5908649", "0.58882946", "0.5851099", "0.5829864", "0.580793", "0.5769647", "0.57682794", "0.57541066", "0.57187545", "0.5717817", ...
0.0
-1
Method to convert string letters of columns to int to index
def letter_to_column(self, pos): column_dict = {} column_dict['a'] = 0 column_dict['b'] = 1 column_dict['c'] = 2 column_dict['d'] = 3 column_dict['e'] = 4 column_dict['f'] = 5 column_dict['g'] = 6 column_dict['h'] = 7 column_dict['i'] = 8 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toindex(col, row):\n a2z = 'ABCDEFGHIJLKMNOPQRSTUVWXYZ'\n\n total = 0\n mult = 0\n for char in col:\n total += (a2z.find(char) + (26 * mult))\n mult += 1\n\n return total, row - 1", "def _index_to_column(i, column=''):\n\n # A dictionary of numbers to letters starting at 0, e....
[ "0.6976945", "0.6873612", "0.680931", "0.67332953", "0.67033523", "0.66989946", "0.65949094", "0.6431376", "0.62918687", "0.6244091", "0.6221332", "0.61669165", "0.6154201", "0.61530066", "0.61059856", "0.60690355", "0.6052834", "0.6016676", "0.5995972", "0.59907895", "0.5941...
0.59729916
22
Method to convert string letters of columns to int to index
def column_to_letter(self, pos): column_dict = {} column_dict[0] = 'a' column_dict[1] = 'b' column_dict[2] = 'c' column_dict[3] = 'd' column_dict[4] = 'e' column_dict[5] = 'f' column_dict[6] = 'g' column_dict[7] = 'h' column_dict[8] = 'i' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toindex(col, row):\n a2z = 'ABCDEFGHIJLKMNOPQRSTUVWXYZ'\n\n total = 0\n mult = 0\n for char in col:\n total += (a2z.find(char) + (26 * mult))\n mult += 1\n\n return total, row - 1", "def _index_to_column(i, column=''):\n\n # A dictionary of numbers to letters starting at 0, e....
[ "0.69773763", "0.68732166", "0.68112355", "0.6735234", "0.6705109", "0.669631", "0.65928155", "0.6434589", "0.62909186", "0.6246335", "0.62254184", "0.6169324", "0.61528987", "0.615157", "0.6108927", "0.60706455", "0.60536516", "0.6016396", "0.5995302", "0.5989416", "0.597138...
0.54425776
55
Covert 'f([a,b,c,d,e,f]) to f(a,b,c,d,e,f) call.
def func_star(a_b): return insideroutine(*a_b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_f(f, xs):\n l = []\n for x in xs:\n l.append(f(x))\n return l", "def f(*args):\n alist = [a() for a in args]\n print(alist)", "def sequence(f, lst: list) -> list:\n ret = []\n for ele in lst:\n ret.append(f(ele))\n return ret", "def eval_func_tuple(f_args):\n ...
[ "0.64417416", "0.6194303", "0.6032134", "0.59193003", "0.5899575", "0.589807", "0.58902675", "0.5849441", "0.5749209", "0.57405674", "0.57334536", "0.57245374", "0.5656731", "0.56464416", "0.56302327", "0.5609536", "0.5590731", "0.55637425", "0.55504274", "0.55219024", "0.550...
0.0
-1
Calculate the value of pi using a random generator. The random generator generate two values between 1 and 1 and calculates if they are inside of a circle with radius 1 inscribed in the square. The result is returned as an approx. of pi.
def calc_p(ran): import random from math import sqrt p = None; hits = 0; misses = 0 for i in range(ran): x = random.random() * 2 - 1 y = random.random() * 2 - 1 r = sqrt(x**2 + y**2) if r <= 1: hits += 1 p = 4 * hits / ran return p
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimate_pi(sims):\n \n # counter to hold points lying inside the circle\n in_circle = 0\n \n for s in range(0,sims):\n \n x = np.random.rand()\n y = np.random.rand()\n \n if (x**2 + y**2) <= 1:\n in_circle += 1\n \n # The ratio of pts. ins...
[ "0.74176675", "0.7202477", "0.7179133", "0.67010486", "0.668326", "0.66006446", "0.6467354", "0.6415425", "0.6362446", "0.62683564", "0.62245226", "0.62131464", "0.6184186", "0.6181681", "0.6101566", "0.6096848", "0.6072919", "0.6071029", "0.60627145", "0.6019927", "0.5976569...
0.5991947
20
Programa para realizar un diagrama de doble eje con las transacciones OP_RETURN acumuladas en cada mes comparadas con las totales de la blockchain de Bitcoin y la evolucion del precio del dolar estadounidense durante ese tiempo
def main():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_calculation():", "def main():\n\t\n\t# Inicializo algunas variables que utilizare despues\n\ti = 0\n\tcommits_totales = 0\n\tnombres_contribuidores = []\n\tnumero_commits = []\n\tacumula_contribuidores = []\n\tacumula_commits = []\n\t\n\t# Los datos que he parseado los he obtenido desde la web https://bi...
[ "0.60324055", "0.5963619", "0.58010584", "0.5757816", "0.57402194", "0.5715608", "0.57114327", "0.5643373", "0.562714", "0.5624544", "0.5597461", "0.5596113", "0.5591563", "0.5589612", "0.55728364", "0.5535985", "0.553396", "0.55213356", "0.5505578", "0.5474051", "0.5448077",...
0.0
-1
Method MUST return the SAME copy of the Content object each time Be sure to initiate any randomness in the __init__ function of the class, before returning it from here
def get_content(self) -> Content: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clone_rand(self):", "def getContent(self) -> object:\n ...", "def __init__(self):\n self.content = dict()", "def rand(self):\n raise NotImplementedError", "def __init__(self):\n self.content = \"\"", "def dummy_content():\n return os.urandom(1 * 1024 * 1024) # 1MB", ...
[ "0.6796832", "0.61951834", "0.60562557", "0.5941559", "0.5938283", "0.5827374", "0.5814455", "0.5808163", "0.579704", "0.5717248", "0.56987363", "0.5663192", "0.5629828", "0.552759", "0.54836583", "0.5479959", "0.5479959", "0.546736", "0.5439642", "0.54374665", "0.54196405", ...
0.58078265
8
Function to display pretty version of our data
def data_prettified(self, instance): # Convert the data to sorted, indented JSON response = json.dumps(instance.data, sort_keys=True, indent=2) # Truncate the data. Alter as needed response = response # Get the Pygments formatter formatter = HtmlFormatter(style='colorf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PrettyPrint(self):\r\n print(self.data)\r\n return", "def print_pretty(self, data):\n length = max(map(lambda x: len(x), data.keys()))\n print '+-------------------------------------+'\n print '| Company Name | Year | Month | Value |'\n print '+----------------------...
[ "0.7719173", "0.7675689", "0.75009155", "0.73934764", "0.7364615", "0.7338962", "0.7307983", "0.7254877", "0.7247562", "0.71973693", "0.71448267", "0.701191", "0.7006872", "0.7006784", "0.6964423", "0.6919075", "0.6915411", "0.6909021", "0.6883892", "0.6865821", "0.68612784",...
0.6304845
68
Function to display pretty version of our data
def criteria_prettified(self, instance): # Convert the data to sorted, indented JSON response = json.dumps(instance.criteria, sort_keys=True, indent=2) # Truncate the data. Alter as needed response = response # Get the Pygments formatter formatter = HtmlFormatter(style...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def PrettyPrint(self):\r\n print(self.data)\r\n return", "def print_pretty(self, data):\n length = max(map(lambda x: len(x), data.keys()))\n print '+-------------------------------------+'\n print '| Company Name | Year | Month | Value |'\n print '+----------------------...
[ "0.77185553", "0.7675632", "0.750126", "0.73926747", "0.7364857", "0.7339593", "0.7308107", "0.72555494", "0.72478586", "0.7197169", "0.7144456", "0.7011706", "0.7006958", "0.7006817", "0.6964377", "0.6919984", "0.6915803", "0.69093925", "0.68848515", "0.6866261", "0.6861478"...
0.0
-1
Constructor for Port instances.
def __init__(self, env, name): self.in_queue = simpy.Store(env) self.out_queue = simpy.Store(env, capacity=1) # indicates whether the port is already connected to a link self.is_free = True self.name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, address: str, port: int) -> None:\n super().__init__()\n self.address = address\n self.port = port", "def __init__(self, env, name, num_ports):\n self.env = env\n self.ports = [Port(self.env, \"{}-port{}\".format(name, i))\n for i in rang...
[ "0.76332444", "0.74735856", "0.7443325", "0.742413", "0.73209405", "0.7252206", "0.7206813", "0.717169", "0.71701837", "0.71494883", "0.70678425", "0.7031187", "0.70053107", "0.70053107", "0.70024794", "0.6982665", "0.6973641", "0.69500995", "0.6920169", "0.6881882", "0.68489...
0.6252036
72
Create a new instance of class Link.
def __init__( self, env, port1, port2, megabits_per_second, propagation_delay_us): if megabits_per_second <= 0: raise FT4FTTSimException("Mbps must be a positive number.") if propagation_delay_us < 0: raise FT4FTTSimException("Propagation delay...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, link):\n self.__link = link", "def link(self):\n return Link(connection=self)", "def newLinkAtom(self, **attrlinks):\n return LinkAtom(self, **attrlinks)", "def link(self, link):\r\n return links.Link(self, link)", "def clone(self) -> \"Link\":\n cls = self...
[ "0.71911746", "0.7103806", "0.70951915", "0.70128417", "0.6998912", "0.6950566", "0.6664468", "0.64406437", "0.63864386", "0.6384914", "0.63063693", "0.61813426", "0.61374193", "0.6131095", "0.6112448", "0.60522026", "0.6046845", "0.6038728", "0.5975803", "0.5960274", "0.5952...
0.0
-1
Gives the time in microseconds to transmit num_bytes on the link.
def transmission_time_us(self, num_bytes): bits_to_transmit = num_bytes * 8 transmission_time_us = (bits_to_transmit / self.megabits_per_second) return transmission_time_us
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def us(self):\n return 1000 * 1000 * self.read()", "def _estimate_write_time(self, data):\n return (len(data.encode('utf-8'))/(self.byte_rate))*1.25\n #1.25 multiplier accounts for start & stop bits", "def ms(self):\n # my clock uses seconds internally\n return 1000 * self.re...
[ "0.6720585", "0.6504805", "0.6378402", "0.62854517", "0.6226713", "0.6151735", "0.61439157", "0.61234903", "0.60965896", "0.6089865", "0.6087299", "0.6076675", "0.6055497", "0.6042046", "0.60022366", "0.5985856", "0.59717196", "0.59255844", "0.59157556", "0.59102046", "0.5861...
0.8264343
0
Create a new instance of class _Sublink.
def __init__( self, env, link, transmitter_port, receiver_port): self.env = env self.link = link self._transmitter_port = transmitter_port self._receiver_port = receiver_port env.process(self.run())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createSubLinko(linko, lowerBound=None, upperBound=None,\n commands=None):\n\n if lowerBound is None:\n lowerBound = 0\n else:\n lowerBound = max(0, lowerBound)\n\n if upperBound is None:\n upperBound = len(linko)-1\n\n else:\n upperBound = min(len(linko...
[ "0.6257967", "0.6163073", "0.60195", "0.57882196", "0.577464", "0.574946", "0.5686489", "0.55936325", "0.549292", "0.54859895", "0.5432537", "0.5427302", "0.54079264", "0.53992283", "0.5375226", "0.5358826", "0.5355751", "0.5349792", "0.534975", "0.5316411", "0.53084326", "...
0.0
-1
The port that is at the transmitting end of the _Sublink.
def transmitter_port(self): return self._transmitter_port
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_port(self):\n return self.port", "def port(self) -> int:\n return self.proto.port", "def get_port(self):\n return self.__port", "def port(self) -> int:", "def port(self):\n # This property is not 100% needed, but is included instead of making the raw variable public to p...
[ "0.7666643", "0.7646722", "0.76203775", "0.7555813", "0.7527526", "0.7489178", "0.74788153", "0.74788153", "0.74788153", "0.74788153", "0.74788153", "0.74788153", "0.7478317", "0.7445367", "0.74300957", "0.74130577", "0.73831666", "0.7348526", "0.7346532", "0.7333242", "0.733...
0.0
-1
The port that is at the receiving end of the _Sublink.
def receiver_port(self): return self._receiver_port
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port(self) -> int:\n return self.proto.port", "def get_port(self):\n return self.port", "def get_port(self):\n return self.__port", "def port(self) -> int:", "def get_port(self) -> int:\n return int(self.socket.getsockname()[1])", "def port(self):\n return self._por...
[ "0.7565528", "0.7532018", "0.74659866", "0.7439742", "0.742285", "0.73868966", "0.73868966", "0.73868966", "0.73868966", "0.73868966", "0.73868966", "0.7381384", "0.73809", "0.7347191", "0.73221254", "0.7295965", "0.72778606", "0.72594", "0.7227357", "0.7207438", "0.7188952",...
0.7643471
0
Get a message from the transmitter port and simulate its transmission.
def run(self): while True: get_request = self.transmitter_port.out_queue.get() message = yield get_request log.debug("{} transmission of {} started".format(self, message)) bytes_to_transmit = (ethernet.PREAMBLE_SIZE_BYTES + etherne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transmit(self, message):\n pass", "def sendmessage(self):\n \n self.message.parentItem = self.rxtxcontroller.transmittable.rootItem\n self.message.can_id = self.idInput.toPlainText()\n self.message.dlc = self.lengthInput.value()\n self.message.cycle_time = self.cycle...
[ "0.684243", "0.67363435", "0.64805746", "0.6397877", "0.6275249", "0.62701553", "0.61841", "0.612267", "0.607932", "0.6078788", "0.60505307", "0.6041035", "0.60303885", "0.59952426", "0.59837866", "0.5981079", "0.595386", "0.59508383", "0.5949485", "0.5944476", "0.5925772", ...
0.5619365
64
Constructor for NetworkDevice instances.
def __init__(self, env, name, num_ports): self.env = env self.ports = [Port(self.env, "{}-port{}".format(name, i)) for i in range(num_ports)] self.name = name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, env, name):\n NetworkDevice.__init__(self, env, name, 1)\n self.env.process(self.listen_for_messages(self.echo))", "def __init__(self, env, name, num_ports, forwarding_table=None):\n NetworkDevice.__init__(self, env, name, num_ports)\n env.process(self.listen_for_me...
[ "0.6851177", "0.6748132", "0.66309136", "0.66309136", "0.6500413", "0.63843066", "0.63698804", "0.6369662", "0.6225673", "0.6225343", "0.6225343", "0.6225343", "0.6225343", "0.6225343", "0.6225343", "0.61941713", "0.61874044", "0.616988", "0.6166115", "0.6155921", "0.61374366...
0.0
-1
Simpy process that calls callback when messages are received.
def listen_for_messages(self, callback): # generate get requests for all input queues requests = [port.in_queue.get() for port in self.ports] while requests: # helper variable for the asserts queues_with_pending_requests = [req.resource for req in requests] # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle(self, message):\n for callback in self.callbacks:\n callback(message['data'])", "def process(self, message, callback):\n\n\t\tif message.type == message_type.EMIT:\n\t\t\t# We are in the server, the message has just been built.\n\t\t\t# Forward it nearly \"as is\". Only the message t...
[ "0.6461456", "0.6393571", "0.63271964", "0.63271964", "0.6291915", "0.6262493", "0.6188397", "0.6178309", "0.61189246", "0.61158496", "0.61088336", "0.60785425", "0.60589385", "0.60589385", "0.6042948", "0.59404564", "0.59378827", "0.5920575", "0.5919739", "0.5919469", "0.588...
0.5810423
22
Simpy process that transmits a given message through a given port.
def instruct_transmission(self, message, port): log.debug("{} instructing transmission of {} on {}".format( self, message, port)) if port not in self.ports: raise FT4FTTSimException("{} is not a port of {}".format( port, self)) log.debug("{} queued for tra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendtoserial(self, module, msg):\n self.send(\"sendserial/{}/{}:{}\\n\".format(self.msg_id, module, msg))\n self.msg_id += 1", "def main():\n\tports = glob.glob(\"/dev/tty.wchusbserial*\") + glob.glob(\"/dev/tty.usbserial*\") + glob.glob(\"COM3\") + glob.glob(\"COM4\")\n\tBAUDRATE = 9600\n\tcho...
[ "0.6341472", "0.6293827", "0.61935765", "0.61768764", "0.60845244", "0.59997296", "0.5982778", "0.59600025", "0.5941384", "0.59384024", "0.5926423", "0.5847764", "0.58273816", "0.5824853", "0.58207375", "0.5782529", "0.576689", "0.5765747", "0.57117426", "0.5698292", "0.56982...
0.5942089
8
Returns a list of all the input queues of the NetworkDevice instance.
def input_queues(self): return [port.in_queue for port in self.ports]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queue_list(self):\n return self.manager.get_queue_list()", "def queues(self):\r\n return queues.Queues(self)", "def queues(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"queues\")", "def _get_queues(self):\n return self.__queues", "...
[ "0.7292679", "0.6934699", "0.69167936", "0.66446567", "0.66446567", "0.66446567", "0.66446567", "0.66446567", "0.66446567", "0.66446567", "0.66446567", "0.66446567", "0.66436195", "0.6511804", "0.6432993", "0.63185084", "0.604206", "0.6019034", "0.5928827", "0.5894514", "0.58...
0.8002415
0
Creates a new EchoDevice instance.
def __init__(self, env, name): NetworkDevice.__init__(self, env, name, 1) self.env.process(self.listen_for_messages(self.echo))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_device(self, name: str, app_eui: str, app_key: str, dev_eui: str):\n return create_device(self.api_key, name, app_eui, app_key, dev_eui)", "def create_device():\n sonyapilib.device.TIMEOUT = 0.1\n device = SonyDevice(\"test\", \"test\")\n device.api_version = 3\n dev...
[ "0.67282104", "0.67042243", "0.63540506", "0.6162925", "0.6115467", "0.5974485", "0.5958021", "0.59126955", "0.5904831", "0.5904831", "0.582459", "0.5774012", "0.574377", "0.5706385", "0.5654795", "0.56512624", "0.5632538", "0.5628998", "0.5586961", "0.5574681", "0.5540587", ...
0.5755721
12
Transmits messages through port number 0 of self.
def echo(self, messages): for msg in messages: self.env.process(self.instruct_transmission(msg, self.ports[0]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transmit(self, msg):\r\n # send our message to the client\r\n self.conn.sendall(msg)", "def sendmessage(self):\n \n self.message.parentItem = self.rxtxcontroller.transmittable.rootItem\n self.message.can_id = self.idInput.toPlainText()\n self.message.dlc = self.lengt...
[ "0.6586354", "0.6306763", "0.6275869", "0.62235427", "0.62213975", "0.61291033", "0.6056939", "0.59652483", "0.59083354", "0.59018594", "0.58479804", "0.58443874", "0.5816736", "0.5814703", "0.5814414", "0.5814414", "0.5814414", "0.5767786", "0.5765079", "0.57547325", "0.5745...
0.0
-1
Create a new MessageRecordingDevice instance.
def __init__(self, env, name, num_ports): NetworkDevice.__init__(self, env, name, num_ports) self.reception_records = {} self.env.process(self.listen_for_messages(self.do_timestamp_messages))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_recording(self) -> None:\n # Clear the internal ring buffer.\n self._buffer.fill(0)\n\n # Start recording using sounddevice's InputStream.\n self._stream.start()", "def __create_record(self, id, message_reference_beginning):\n\n instrument = self.get_random_instrument()\n\n me...
[ "0.5758916", "0.5686636", "0.5537721", "0.5493648", "0.54801685", "0.5463428", "0.53606737", "0.5157371", "0.51448524", "0.5118914", "0.5102212", "0.5065266", "0.5059805", "0.50597054", "0.5050642", "0.5007147", "0.5006307", "0.4985408", "0.4973321", "0.49512675", "0.49166542...
0.45228213
80
Timestamp each message in messages with the current time.
def do_timestamp_messages(self, messages): timestamp = self.env.now self.reception_records[timestamp] = messages log.debug("{} recorded {}".format(self, self.reception_records))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_timestamp(self):\n self._timestamp = datetime.datetime.now()", "def _set_timestamp(self):\n d = datetime.now()\n self._time_stamp = \"{:>2} {} {} {:>2}:{:>02}\".format(\n d.day, MONTH_ABBREV[d.month], d.year, d.hour, d.minute)", "def update_sent_at_timesta...
[ "0.57357347", "0.56538224", "0.55772907", "0.5564249", "0.5544044", "0.55338705", "0.5520455", "0.55119085", "0.5480451", "0.5466076", "0.545656", "0.54557925", "0.5449149", "0.5431155", "0.5430672", "0.5411746", "0.53955257", "0.5393176", "0.5375465", "0.5375465", "0.5371491...
0.7175772
0
Return the messages so far received by self.
def recorded_messages(self): messages = [] for time in sorted(self.reception_records): messages.extend(self.reception_records[time]) return messages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_messages(self):\n return self.messages_received", "def get_messages(self):\n return self.messages_received", "def get_messages(self):\n return self.messages_received", "def get_received_messages(self):\n return self.received_messages", "def receive_messages(self):\n ...
[ "0.88695073", "0.88695073", "0.88695073", "0.8815797", "0.8482073", "0.80366856", "0.80197936", "0.80197936", "0.79494613", "0.78715163", "0.78715163", "0.78715163", "0.78098845", "0.76520985", "0.75286716", "0.7497776", "0.73959994", "0.733988", "0.7331962", "0.731863", "0.7...
0.0
-1
Return list of instants of time when messages have been received. The list is sorted from earlier time instants to later time instants.
def recorded_timestamps(self): return sorted(self.reception_records.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recorded_messages(self):\n messages = []\n for time in sorted(self.reception_records):\n messages.extend(self.reception_records[time])\n return messages", "def get_times(self):\n times = []\n for i in range(1, len(self.events)):\n times.append(self.eve...
[ "0.684062", "0.61729896", "0.6143938", "0.6120178", "0.6120178", "0.6120178", "0.6105195", "0.61050284", "0.6102716", "0.6013917", "0.5986549", "0.5985908", "0.59154207", "0.5880672", "0.5832029", "0.5814234", "0.5798199", "0.5797925", "0.5794117", "0.5742637", "0.5725615", ...
0.5795757
18
Load the transmission commands to execute once the run method is activated by simpy.
def load_transmission_commands(self, transmission_commands): self.transmission_commands = transmission_commands log.debug("{} loaded transmissions: {}".format( self, self.transmission_commands))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commands():\n pass", "def commands():\n pass", "def commands():\n pass", "def commands():\n pass", "def run_setup_commands(self):\n if not hasattr(self, 'commands') or not self.commands:\n return\n print('{GREEN}Running setup commands...{NC}'.format(**colors))\n ...
[ "0.61570454", "0.61570454", "0.61570454", "0.61570454", "0.61092925", "0.60501635", "0.6043742", "0.5988766", "0.57840395", "0.5749445", "0.57305175", "0.5717177", "0.57016313", "0.56879026", "0.5674538", "0.5642886", "0.5623862", "0.5583021", "0.5561773", "0.5525386", "0.552...
0.6781366
0
Simpy process that executes previously loaded transmission commands.
def run(self): for time in sorted(self.transmission_commands): delay_before_next_tx_order = time - self.env.now log.debug("{} waiting for next transmission time".format(self)) # wait until next transmission time yield self.env.timeout(delay_before_next_tx_order) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _command_dispatcher(self):\n # sysex commands are assembled into this list for processing\n #checkingport = self.serial_port.com_port\n logstring(\"Starting Command Dispatcher\")\n sysex = []\n while True:\n if self._valid_target_exists:\n #log...
[ "0.6074242", "0.6074194", "0.6026074", "0.6014388", "0.59757674", "0.59675294", "0.5964339", "0.5933806", "0.59212637", "0.59133595", "0.58851624", "0.5854616", "0.58538175", "0.58313733", "0.5826945", "0.5811035", "0.576115", "0.5749615", "0.5723569", "0.571908", "0.5709516"...
0.5676819
24
Returns a list of time instants when transmissions will be instructed.
def transmission_start_times(self): return sorted(self.transmission_commands.keys())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_target_timestamps(self):\n times=[]\n curr = self.begin_ts\n while curr<=self.end_ts:\n times.append(curr)\n curr = curr + 24 * 60 * 60\n return times", "def ensemble_times(self):\n return self['validtime'].values", "def transit_times(self):\n ...
[ "0.6600924", "0.64621645", "0.6443462", "0.64339167", "0.61645526", "0.6126809", "0.60728866", "0.60608023", "0.6047479", "0.6042055", "0.60369664", "0.60369664", "0.60369664", "0.6036148", "0.60101277", "0.60079336", "0.59973717", "0.59792835", "0.5938966", "0.5935055", "0.5...
0.65130126
1
Creates a new Switch instance.
def __init__(self, env, name, num_ports, forwarding_table=None): NetworkDevice.__init__(self, env, name, num_ports) env.process(self.listen_for_messages(self.forward_messages)) if forwarding_table is None: self.forwarding_table = {} else: self.forwarding_table = f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_switch():\n connection = MagicMock()\n connection.address = 'addr'\n connection.port = 'port'\n connection.protocol.version = 0x04\n switch = Switch('00:00:00:00:00:00:00:01', connection)\n switch._enabled = True\n return switch", "def _create_switch(kn...
[ "0.80681705", "0.6859319", "0.6448392", "0.6421026", "0.63343406", "0.6104088", "0.5923678", "0.58337927", "0.5742754", "0.5739367", "0.57389903", "0.5723718", "0.5708668", "0.5675376", "0.56334275", "0.5611639", "0.55722886", "0.555142", "0.5515055", "0.54920065", "0.5438675...
0.0
-1
Forward each message in 'message_list' through the appropriate port. Note that forwarding a message from one port to another port is implemented as creating a new message instance based on the message in the first port, and transmitting the new message instance on the second port.
def forward_messages(self, message_list): def find_ports(destination): """ Return a list of the ports that according to the forwarding table lead to 'destination'. Arguments: destination: an instance of class NetworkDevice or an iterable ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _forward(self, messages):\n assert isinstance(messages, (tuple, list))\n assert len(messages) > 0\n assert all(isinstance(message, Message.Implementation) for message in messages)\n assert all(message.community == messages[0].community for message in messages)\n assert all(me...
[ "0.6203733", "0.5830506", "0.56460434", "0.5634888", "0.55948746", "0.5523897", "0.55229384", "0.5491743", "0.5479526", "0.5479526", "0.5468768", "0.5325395", "0.5231763", "0.5212095", "0.5202612", "0.51999635", "0.51933783", "0.51795065", "0.51346564", "0.5112899", "0.509607...
0.8666615
0
Return a list of the ports that according to the forwarding table lead to 'destination'.
def find_ports(destination): output_ports = set() if isinstance(destination, collections.Iterable): for device in destination: # ports leading to device ports_towards_device = self.forwarding_table.get( device, self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _GetPorts(self):\n ports = []\n for start, end in self.term.destination_port:\n if start == end:\n ports.append(str(start))\n else:\n ports.append('%d-%d' % (start, end))\n return ports", "def get_log_forwarding_destinations(self) -> dict:\n uri = f\"{self.uri}/log-for...
[ "0.68636054", "0.63937044", "0.6293385", "0.61560774", "0.6080188", "0.60246485", "0.602398", "0.59798646", "0.59217554", "0.59217554", "0.5894943", "0.5894943", "0.5879433", "0.58708215", "0.5780149", "0.5772737", "0.5771177", "0.5760051", "0.57555175", "0.5754745", "0.57275...
0.8411196
0
Create an instance of Message.
def __init__( self, env, source, destination, size_bytes, message_type, data=None): if not isinstance(size_bytes, int): raise FT4FTTSimException("Message size must be integer") if not (ethernet.MIN_FRAME_SIZE_BYTES <= size_bytes <= ethernet.MAX_FRAME_S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMessage( self, *args, **kw ):\n return MailMessage( *args, **kw )", "def Message(self, *args, **kwargs):\n return Message(self, *args, **kwargs)", "def message(self, *args, **kwargs) -> Message:\n return Message(self.handle, *args, **kwargs)", "def new_message(self, body=''):\r...
[ "0.84884113", "0.8175667", "0.79955214", "0.7640678", "0.7473492", "0.72302175", "0.7222123", "0.71496403", "0.71381205", "0.712775", "0.7072882", "0.69774204", "0.6921473", "0.690925", "0.68973404", "0.68225324", "0.6820419", "0.67508817", "0.6748958", "0.6748958", "0.674895...
0.6519352
45
Integer that uniquely identifies the Message instance.
def identifier(self): return self._identifier
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def msg_id(self):\n return struct.unpack('<H', self.pkt.payload[0:2])[0]", "def message_id(self) -> int:\n enforce(self.is_set(\"message_id\"), \"message_id is not set.\")\n return cast(int, self.get(\"message_id\"))", "def getMessageID(self):\n return self._payload[1]", "def _gen...
[ "0.76075435", "0.7545699", "0.73668766", "0.7294178", "0.7286209", "0.70943856", "0.68959796", "0.6863287", "0.6861981", "0.6852783", "0.6852783", "0.6852783", "0.6852783", "0.6852783", "0.6852783", "0.6852783", "0.6852783", "0.6852783", "0.6852783", "0.6852783", "0.6852783",...
0.0
-1
Creates a new message instance using template_message as a template.
def from_message(cls, template_message): new_equivalent_message = cls( template_message.env, template_message.source, template_message.destination, template_message.size_bytes, template_message.message_type, template_message.data) r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_message(filename):\n\n with open(filename, 'r', encoding='utf-8') as template_file:\n template_file_contents = template_file.read()\n return Template(template_file_contents)", "def createMessage( self, *args, **kw ):\n return MailMessage( *args, **kw )", "def create_message(message_...
[ "0.6601167", "0.65768903", "0.6510156", "0.62768304", "0.6161473", "0.6139816", "0.59907115", "0.59879017", "0.5969052", "0.5905473", "0.59045595", "0.5868151", "0.5855637", "0.5845727", "0.58385235", "0.5831153", "0.5827659", "0.5786477", "0.57841724", "0.5783322", "0.578185...
0.7471443
0
Returns true if self and message are identical except for the message identifier.
def __eq__(self, message): return (self.source == message.source and self.destination == message.destination and self.size_bytes == message.size_bytes and self.message_type == message.message_type and self.data == message.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n result = NotImplemented\n if isinstance(other, Message):\n result = False\n if self is other:\n result = True\n else:\n # does not compare _id\n if (self._message_length == other._message_length a...
[ "0.75409573", "0.6845765", "0.6833236", "0.67646956", "0.676177", "0.67007315", "0.6687098", "0.6542909", "0.6538792", "0.6526526", "0.6486344", "0.64815634", "0.6458272", "0.6454662", "0.6447595", "0.6419478", "0.63492614", "0.6322484", "0.6286339", "0.6276497", "0.6268068",...
0.735989
1
Create a player in the dictionary with and fill
def create_player(dct, player_name, place): dct.update({player_name: ['N/A'] * place})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\r\n self.players = {}", "def create_player(self, players, player_no, start_tile):\n if player_no in players.keys():\n raise ValueError(f\"Invalid map layout. Can't create player no {player_no} as it already exists.\")\n players[player_no] = Player(player_no, st...
[ "0.71841913", "0.7117534", "0.6787139", "0.6747371", "0.67037123", "0.66691554", "0.6661246", "0.665843", "0.66209733", "0.65938175", "0.64562774", "0.64398587", "0.6433812", "0.64123106", "0.6350407", "0.6346398", "0.6294373", "0.62786156", "0.62754565", "0.6242238", "0.6237...
0.80811304
0
update a player's rank based on where the place is
def update_player_rank(dct, player_name, place, rank): dct.get(player_name)[place - 1] = rank
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_player_rank(self, player, rank, match):\n\n # if player isn't moving, do nothing\n if player.rank == rank:\n return\n\n # if player doesn't have a rank yet, make them last\n if player.rank is None:\n player.rank = self.player_set.count()\n\n # upd...
[ "0.78234625", "0.74328", "0.73013973", "0.7031596", "0.69860005", "0.69297636", "0.69227743", "0.6718269", "0.65675956", "0.65450794", "0.63905835", "0.6374642", "0.63725924", "0.6286222", "0.62859046", "0.6284572", "0.62633055", "0.62573326", "0.6210624", "0.62010586", "0.61...
0.8145205
0
Calculates real fx vol
def calculate_real_vol(df: pd.DataFrame)->pd.DataFrame: # Real FX Vol # Creating a DataFrame with real exchange rate for each country real_fx = df.loc[:, (slice(None), 'r')] # Getting the returns of real exchange rate real_rets = real_fx.pct_change()*100 real_rets.columns = real_rets.column...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vol(x):\r\n return pi*(topdia(x)/2000.)**2 * length (x)", "def _fv(self):\n return self.beta * (self.x ** self.c)", "def vol(self) -> float:\n return float(self.tsdf.pct_change().std() * np.sqrt(self.periods_in_a_year))", "def _dvolume_dbsf(self):\n\n vol = ((self.I0 * self.V.omega *\n ...
[ "0.73070735", "0.7055493", "0.69172645", "0.6573522", "0.65009266", "0.6455832", "0.64117163", "0.6403448", "0.6331578", "0.6297328", "0.6286567", "0.62574166", "0.6218514", "0.6216334", "0.62065506", "0.6197417", "0.61916447", "0.6146077", "0.6138969", "0.60833204", "0.60826...
0.6478381
5
Generates output for MATLAB
def matlab_generate(df: pd.DataFrame, file_name: str): df_matlab = df.copy() df_matlab.columns = df_matlab.columns.map('_'.join) df_matlab.index = df_matlab.index.strftime("%Y%m%d") (df_matlab.pct_change()*100).to_csv(data_path+file_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeMatlabOutput(self, output, prettyname):\n self.writeHeaderOutput((\"%\",\"%\"), output, prettyname)\n for d in self.data:\n # now just print it out\n line = d.buildMatlabDeclaration(\"\", \"\", root=self.matlabRoot)\n if len(line) != 0:\n outpu...
[ "0.6261904", "0.61863387", "0.6012252", "0.59941685", "0.5992061", "0.5971011", "0.5931234", "0.58379275", "0.58114743", "0.5741615", "0.5732039", "0.5726772", "0.57029516", "0.56981534", "0.5697533", "0.569699", "0.56939423", "0.56920123", "0.5633407", "0.5568645", "0.556820...
0.0
-1
Computes cross entropy between predicted and true discrete distrubtions.
def cross_entropy(true, pred, axis=-1, epsilon=1e-7): pred = ivy.clip(pred, epsilon, 1 - epsilon) log_pred = ivy.log(pred) # noinspection PyUnresolvedReferences return -ivy.reduce_sum(log_pred * true, axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy(y_observed, p):\n\n pass", "def cross_entropy(self, true_values, predicted_values):\n\n testing_set_size = len(true_values)\n running_sum = 0\n for i in range(len(true_values)):\n true_set = true_values[i]\n predicted_set = predicted_values[i]\n ...
[ "0.7500701", "0.73290604", "0.7280353", "0.72169656", "0.71859753", "0.7156666", "0.7091561", "0.70152426", "0.6998785", "0.6982236", "0.6946835", "0.68625927", "0.6841047", "0.68150157", "0.67943674", "0.67832506", "0.6776295", "0.67718947", "0.6770149", "0.67530984", "0.674...
0.7321498
2
Computes the binary cross entropy loss.
def binary_cross_entropy(true, pred, epsilon=1e-7): pred = ivy.clip(pred, epsilon, 1-epsilon) # noinspection PyTypeChecker return -(ivy.log(pred) * true + ivy.log(1 - pred) * (1 - true))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cross_entropy_loss():\n return nn.CrossEntropyLoss()", "def loss(params: hk.Params, batch, label) -> jnp.ndarray:\r\n logits = net.apply(params, batch)\r\n labels = jax.nn.one_hot(label, n_classes)\r\n\r\n # Cross Entropy Loss\r\n softmax_xent = -jnp.sum(labels * jax.nn.log_sof...
[ "0.7383736", "0.7212885", "0.72030777", "0.71922994", "0.71341836", "0.7111369", "0.7096483", "0.7090471", "0.70701796", "0.7056353", "0.7049108", "0.7034045", "0.70304507", "0.70156217", "0.7005296", "0.69976836", "0.69873434", "0.69613475", "0.69289887", "0.6923281", "0.692...
0.6654386
68
Computes sparse cross entropy between logits and labels.
def sparse_cross_entropy(true, pred, axis=-1, epsilon=1e-7): true = ivy.one_hot(true, pred.shape[axis]) return cross_entropy(true, pred, axis, epsilon)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sparse_softmax_cross_entropy_with_logits(\n labels=None,\n logits=None,\n name=None):\n _ensure_xent_args(\"sparse_softmax_cross_entropy_with_logits\", labels, logits)\n\n # TODO(pcmurray) Raise an error when the label is not an index in\n # [0, num_classes). Note: This could break users who call t...
[ "0.7383931", "0.731593", "0.7313389", "0.7231131", "0.71668744", "0.7103112", "0.70853496", "0.70765847", "0.7019666", "0.69701236", "0.6949585", "0.69058555", "0.68960786", "0.68960786", "0.6874639", "0.68409586", "0.68385947", "0.67765355", "0.67698383", "0.67664945", "0.67...
0.75039977
0
Return the number of fixations in the item.
def fixation_count(self) -> int: return len([fix for fix in self.fixations if not fix.excluded])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total(self) -> int:\n return len(self.fixes)", "def item_count(self):\n return self.items.shape[0]", "def count(self, item):\n return _(self._.count(item))", "def items_num(self):\n\t\treturn len(self.items)", "def items_num(self):\n\t\treturn len(self.items)", "def items_num(sel...
[ "0.7213083", "0.6613063", "0.6595034", "0.6532938", "0.6532938", "0.6506132", "0.6467765", "0.645923", "0.64033294", "0.6388774", "0.632877", "0.6280365", "0.623872", "0.61082006", "0.61007196", "0.60832393", "0.605388", "0.6051676", "0.6040764", "0.6022371", "0.600364", "0...
0.77495074
0
Event handler for when the "assign" button is clicked
def on_assign(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_clicked(self, info):\n\n assignment = self._validate(info)\n if assignment is None:\n return\n\n # Update the data in the database.\n try:\n get_permissions_manager().policy_manager.policy_storage.set_assignment(assignment.user_name, [r.name for r in assi...
[ "0.629694", "0.61017966", "0.60601336", "0.5925632", "0.59112716", "0.58607006", "0.58108014", "0.57452774", "0.5703086", "0.5687298", "0.56709224", "0.55582875", "0.55336756", "0.5520792", "0.5518935", "0.54766655", "0.5393926", "0.53858465", "0.5372325", "0.5365118", "0.534...
0.65540296
0
Event handler for when the "unassign" button is clicked
def on_unassign(self):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_assign_unassign(self, **kwargs):\n\n return self.api_request(self._get_method_fullname(\"update_assign_unassign\"), kwargs)", "def assignmentsCalced(self, message):\n self.assign_btn.Disable()", "def unassign(self, assignment, created_by):\n assignee = assignment.assignee\n ...
[ "0.6539649", "0.6224625", "0.6205943", "0.6197301", "0.60103565", "0.5933693", "0.59179527", "0.58602744", "0.5758165", "0.5743737", "0.57365894", "0.5708317", "0.5708317", "0.5708317", "0.5708317", "0.56715363", "0.5670001", "0.56364554", "0.55899113", "0.55891675", "0.55556...
0.75327337
0
Builds the file tree for overrides compaction
def _build_file_tree(self): # Build file tree with packmode and weigth info (# of file in the packmode) root = {"packmode": None, "weight": None, "children": {}} for filepath, packmode in self.override_packmode_map.items(): node = root for part in filepath: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _buildindex( self ):\n try:\n import ROOT as rt\n except:\n print \"Could not load ROOT\"\n sys.exit(-1)\n \n # sigh. this is a mess\n self.producers = [] # all producer names found in ROOT files\n self.datatypes = [] # all data types...
[ "0.5822903", "0.57955813", "0.57734984", "0.556816", "0.54924077", "0.5468945", "0.5466384", "0.5444506", "0.5417983", "0.54117495", "0.540151", "0.53963", "0.5385253", "0.53663236", "0.5315143", "0.5312253", "0.5294251", "0.52787477", "0.5272092", "0.52637345", "0.524155", ...
0.71749103
0
Uses DFS to assign to directory the packmode with maximum weight The override format support assigning a whole directory to a packmode, and having exception in that directory This method assign the packmode with the most files to the directory, so that the least amount of files/directory needs to be specified in the "o...
def _dfs_assign(self, filetree): stack = [filetree] while stack: node = stack.pop() if isinstance(node, tuple) and node[0]["packmode"] is None: # all children have been seen already, assing packmode node = node[0] # unpack the actual node ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _build_file_tree(self):\n # Build file tree with packmode and weigth info (# of file in the packmode)\n root = {\"packmode\": None, \"weight\": None, \"children\": {}}\n for filepath, packmode in self.override_packmode_map.items():\n node = root\n for part in filepath...
[ "0.62167066", "0.55113137", "0.545679", "0.5249099", "0.52270174", "0.52258456", "0.5218894", "0.5173524", "0.5060165", "0.50510776", "0.5016965", "0.49667448", "0.49320337", "0.4899114", "0.4883986", "0.48228544", "0.48040769", "0.47905743", "0.47506174", "0.47441763", "0.47...
0.5894984
1
Uses recursive DFS to write the overrides from a weigthed, assigned file tree
def _write_overrides( self, node, parent=None, parent_packmode=None, path_parts=tuple(), root=None ): if root is None: root = node if (parent is root) or ( parent_packmode and node["packmode"] != parent_packmode ): self.overrides[str(PurePath(*path...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mutate_file(self, node, visited = set([])):\n for ch in self._get_children(node):\n\n if ch not in visited:\n visited.add(ch)\n\n try:\n self._mutate_node(ch)\n except Exception as e:\n print(e)\n\n ...
[ "0.67543304", "0.5652397", "0.55918777", "0.5476559", "0.5439046", "0.54237384", "0.53918606", "0.538221", "0.5363778", "0.5344074", "0.52756155", "0.521393", "0.517851", "0.51598054", "0.5157991", "0.5055687", "0.5039144", "0.50361437", "0.5031006", "0.49998572", "0.49961793...
0.61889166
1
Print a simple greeting to each user in the list.
def greet_user(names): for name in names: msg = f"Hello, {name.title()} !" print(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greet_users(names):\n for name in names:\n msg = \"Hello, \" + name.title() + \"!\"\n print(msg)", "def greet_users(names):\n for name in names:\n msg = \"Hello, \" + name.title() + \"!\"\n print(msg)", "def greet_users(names):\n for name in names:\n print(f\"Hel...
[ "0.7735355", "0.7735355", "0.7734715", "0.77266586", "0.77149934", "0.7699153", "0.7699153", "0.73098725", "0.7258156", "0.7245961", "0.7140347", "0.7128372", "0.712475", "0.70942545", "0.70942545", "0.7049544", "0.7025611", "0.69582665", "0.6946257", "0.68995595", "0.6774867...
0.7658193
7
Start a combat, make all NPCs to cast skills automatically.
def start_combat(self): super(HonourAutoCombatHandler, self).start_combat() # All characters auto cast skills. for char in self.characters.values(): character = char["char"] character.start_auto_combat_skill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def StartCombat(self):\n\n print(\"------------------------------------\")\n self.fighter1.PrintInfo()\n self.fighter2.PrintInfo()\n print(\"------------------------------------\")\n self.combatInProgress = True\n while self.combatInProgress and self.currentTurn < self.max...
[ "0.68635476", "0.61531", "0.6022753", "0.60088336", "0.5843919", "0.58394575", "0.5778643", "0.56064093", "0.5535863", "0.55134916", "0.5509995", "0.5499876", "0.54166967", "0.5389035", "0.53655183", "0.536523", "0.53433776", "0.53231376", "0.5306996", "0.52780104", "0.527367...
0.841464
0
Finish a combat. Send results to players, and kill all failed characters.
def finish(self): for char in self.characters.values(): character = char["char"] character.stop_auto_combat_skill() super(HonourAutoCombatHandler, self).finish()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def leave_combat(self):\n self.__regen()", "def endBattle(self):\n self.map.removeDead()\n self.cancelAttackMode()\n self.deselectUnit()", "def endCompetition(self):\n self.robot_exit = True", "def finish(self, npc, world):\n pass", "def finishTurn(self):\n ...
[ "0.5964447", "0.5951488", "0.583827", "0.58253044", "0.57186526", "0.569342", "0.5643143", "0.5618079", "0.5599302", "0.55874985", "0.556114", "0.5545428", "0.5520197", "0.5506429", "0.5500326", "0.5500326", "0.5500326", "0.5500326", "0.54973876", "0.5483571", "0.5472781", ...
0.7119523
0
to get the whole data in 'bus'
def getList(self): nodeList = get_array(self.casenum, 'bus') self.nodeList = nodeList return nodeList
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bus_details():\n\n\tbus_detail = db.session.query(Bus.bus_name == (Bus.bus_name)).one()\n\n \n\treturn bus_detail", "def get_bus_list():\n\n\tbuses = db.session.query(Bus.bus_name).all()\n\n \n\treturn buses", "def _read_data(self):", "def readOneData(self):\n\t\tpass", "def get_all(self):\n ...
[ "0.66622156", "0.6451813", "0.6422266", "0.6291614", "0.62907284", "0.6256919", "0.6247429", "0.61632484", "0.61528784", "0.61516654", "0.6148364", "0.60508144", "0.6022441", "0.6019723", "0.60150313", "0.6006078", "0.6003648", "0.5983829", "0.59709984", "0.596881", "0.594059...
0.54014295
100