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
A function for loading all your assets. (Audio assets can at their earliest be loaded here.)
def init(): # Load images here assets["teapot"] = pg.image.load("teapot.png") # Load sounds here assets["plong"] = pg.mixer.Sound("plong.wav")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_all_resources():\n\n # Load the fonts\n ResourcesManager._load_font(\"Munro.ttf\")\n\n # Load images\n ResourcesManager.HIBER_NATION_IMG = ResourcesManager._load_image(\"hiber_nation.png\")\n ResourcesManager.SHIP_IMG = ResourcesManager._load_image(\"ship.png\")\n ...
[ "0.738746", "0.7295234", "0.70359105", "0.6854749", "0.6653372", "0.63334167", "0.6238324", "0.62300277", "0.6180015", "0.6180015", "0.6065265", "0.6042485", "0.60398155", "0.60117227", "0.59782004", "0.59469503", "0.5945268", "0.5940043", "0.58893687", "0.5882322", "0.587674...
0.67304325
4
The program starts here
def update(): # Initialization (only runs on start/restart) player1 = Player() player2 = Player() walls, start = parse_level(LEVEL) player1.idx = 1 player1.key_up = "w" player1.key_down = "s" player1.key_left = "a" player1.key_right = "d" player1.key_small = "f" player1.key...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main():", "def main(...
[ "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "0.8413572", "...
0.0
-1
Get the parameters of megaconstellations
def get_parameters(path): f = open(path, "r") line = f.readline() line = line.strip('\n') values = line.split(',') parameter = [[0 for i in range(len(values))] for i in range(6)] row = 0 while line: line = line.strip('\n') values = line.split(',') for i in range(len(v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParams(self):\n\n\t\tparams = {\"Nparticles\":self.__Nparticles,\"Nkicks\":self.__Nkicks,\"kappa\":self.__kappa, \"eta\":self.__eta,\"gamma\":self.__gamma, \"omega\":self.__omega,\n\t\t\"Kbt\":self.__Kbt, \"tk\":self.__tk}\n\n\t\treturn params", "def get_params(self):\n return {\n \"nspe...
[ "0.67819893", "0.6544209", "0.65331507", "0.63874495", "0.63380563", "0.6320081", "0.6292219", "0.6286185", "0.62480485", "0.6242391", "0.62254477", "0.6211043", "0.62070125", "0.6196785", "0.6164515", "0.6148743", "0.6136785", "0.61115974", "0.60750973", "0.6074272", "0.6068...
0.0
-1
Takes a list of float values and creates a padded torch.Tensor.
def forward(self, v: TorchscriptPreprocessingInput) -> torch.Tensor: if torch.jit.isinstance(v, List[torch.Tensor]): return self.forward_list_of_tensors(v) if torch.jit.isinstance(v, List[str]): return self.forward_list_of_strs(v) raise ValueError(f"Unsupported input: {v}...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_list(xs: torch.Tensor, pad_value: int):\n n_batch = len(xs)\n max_len = max(x.size(0) for x in xs)\n pad = xs[0].new(n_batch, max_len, *xs[0].size()[1:]).fill_(pad_value)\n\n for i in range(n_batch):\n pad[i, : xs[i].size(0)] = xs[i]\n\n return pad", "def pad_lists(lists, pad_int, p...
[ "0.7406693", "0.70428735", "0.6466515", "0.6323249", "0.62024957", "0.60464835", "0.60222167", "0.6001368", "0.59981996", "0.59465325", "0.5926647", "0.5863943", "0.58620673", "0.5842579", "0.5789935", "0.5789883", "0.57518977", "0.5749336", "0.5729196", "0.5676192", "0.56408...
0.0
-1
Initialize statistics that can change during the game.
def reset_stats(self): print("Reseting stats") self.player_lives = self.ai_stts.player_lives self.score = 0 self.level = 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setup_stats(self) -> None:\n\n # Save statistics\n self.mass = np.array([0])\n self.mass_balance = np.array([0])\n self.mass_balance_trend = np.array([0])", "def init_mc_stats(self):\n # number of total move steps attempted (viable or not)\n self.steps = 0\n ...
[ "0.81667167", "0.74663603", "0.7446635", "0.733872", "0.70888126", "0.7070155", "0.7058171", "0.70145094", "0.69871485", "0.6968445", "0.6954551", "0.689005", "0.6883575", "0.6848135", "0.6795712", "0.6793943", "0.6649954", "0.6649136", "0.66382384", "0.66156614", "0.6585602"...
0.65310246
23
Performs a single HTTP call and puts the result into the status_code_counter. RequestExceptions are caught and put into the errors set.
def onecall(method, url, results, **options): start = time.time() if 'data' in options and callable(options['data']): options = copy(options) options['data'] = options['data'](method, url, options) if 'pre_hook' in options: method, url, options = options[ 'pre_hook'](me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(url):\n result = requests.get(url)\n if 300 <= result.status_code < 400:\n raise TemporaryException\n if result.status_code == 429:\n raise ApiCountZeroException\n if 400 <= result.status_code < 600:\n raise PermanentException\n return result", "def onecall(method, ur...
[ "0.6456138", "0.6433048", "0.6302685", "0.618835", "0.6050249", "0.60415924", "0.6016724", "0.5999743", "0.596109", "0.59553635", "0.5880258", "0.586366", "0.58634615", "0.5852645", "0.583467", "0.58081484", "0.5800827", "0.5786141", "0.57681704", "0.57596326", "0.57167345", ...
0.60074794
7
Generate indices to split data into training and test set.
def split(self,X,y=None): all_idx = pd.Series(np.arange(X.shape[0])) mbrg = int(X.shape[0]*self.embargo_pct) test_starts=[(i[0],i[-1]+1) for i in np.array_split(all_idx.values,self.n_splits)] for i, j in test_starts: t0 = all_idx.index[i] # start of test set test...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __train_test_splits(self):\n # By default, our indices are just 0-n\n split_indices = list(range(len(self.data)))\n # If shuffling, use our shared Random instance to shuffle our indices before slicing\n if self.shuffle:\n np.random.shuffle(split_indices)\n # Regard...
[ "0.79160523", "0.7753309", "0.72858137", "0.7023322", "0.69424915", "0.6905531", "0.6871766", "0.68313086", "0.6823792", "0.682361", "0.6819748", "0.68136865", "0.67683995", "0.6727116", "0.67197716", "0.6714979", "0.67087257", "0.67059606", "0.669956", "0.6690938", "0.664086...
0.7115239
3
Return a popup dialog box containing message mssg
def showDialogBox(mssg, icon="info", type="ok", default="ok"): return tkMessageBox._show("Battleship", mssg, icon, type, default=default)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message(self,message,style=wx.OK | wx.ICON_INFORMATION):\n dlg = wx.MessageDialog(self, message, self.app.title, style)\n answer = dlg.ShowModal()\n dlg.Destroy()\n return answer", "def MessageDialog( message, caption, style ):\n dlg = wx.MessageDialog( wx.GetApp().GetTopWindow...
[ "0.7287852", "0.7254086", "0.7190771", "0.7112899", "0.7016351", "0.68596673", "0.6794621", "0.6782828", "0.6731746", "0.67001075", "0.6698958", "0.6686943", "0.6657202", "0.6644042", "0.6639947", "0.6639783", "0.6619283", "0.6608545", "0.66004807", "0.6592722", "0.65916014",...
0.7207876
2
Prevent user from closing window
def clickOverride(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_close(self):\n\n\t\tself._window.force_close()", "def __window_close(self):\n pass", "def OnClose(self, event):\n\t\tself.Show(False)", "def OnClose(self, event):\n self.Show(False)", "def exit(self):\n if self.window:\n self.window.close()", "def __window_stop(s...
[ "0.7924727", "0.7920558", "0.77095264", "0.77079576", "0.7510519", "0.7501453", "0.74451953", "0.74308765", "0.7417873", "0.74169785", "0.7397683", "0.736508", "0.732761", "0.732761", "0.732761", "0.732761", "0.7268191", "0.72650576", "0.72416866", "0.72301424", "0.7228536", ...
0.0
-1
Display popup dialog box to confirm game exit
def exitConfirm(): confirm = showDialogBox('Exit the game now?', 'question', 'yesno', 'no') if confirm == 'yes': raise SystemExit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onExit(self, event):\r\n\t\tdlg = wx.MessageDialog(self, \"Are you sure you wish to exit?\",\r\n\t\t\t\t\t\t\t\"Confirm Exit\", wx.CANCEL|wx.OK|wx.ICON_QUESTION)\r\n\t\tresult = dlg.ShowModal()\r\n\t\tdlg.Destroy()\r\n\t\tif result == wx.ID_OK: sys.exit()", "def leave(self):\n p = GameOverPopup(self)\...
[ "0.76142627", "0.7329652", "0.69724643", "0.6886522", "0.68566287", "0.6802856", "0.6779717", "0.67677563", "0.6766365", "0.6754058", "0.67408264", "0.67349386", "0.67311794", "0.67250013", "0.67158383", "0.67048454", "0.66943", "0.6679825", "0.6664499", "0.66626614", "0.6630...
0.805535
0
Return user's choice of playing against human or computer
def askOpponentType(): opponentType = Dialog.Dialog(None, {'title': 'Battleship', 'text': 'Choose your opponent', 'bitmap': 'question', 'default': 0, 'strings': ('Human', 'Computer',)}).num return opponentType
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decide_winner(user_choice, computer_choice):\n if user_choice == \"P\" and computer_choice == \"R\":\n print(\"You win\")\n elif user_choice == \"R\" and computer_choice == \"S\":\n print(\"You win\")\n elif user_choice == \"S\" and computer_choice == \"P\":\n print(\"You win\")\n el...
[ "0.71559167", "0.6886031", "0.6836436", "0.68249863", "0.6808385", "0.6746298", "0.6660418", "0.6447238", "0.64162004", "0.64001656", "0.635829", "0.6353897", "0.6336762", "0.6336361", "0.63345927", "0.6308507", "0.6296464", "0.62713", "0.62332267", "0.62115496", "0.61529374"...
0.66534543
7
Return user's choice of style of scoring
def askWinCondition(): winCondition = Dialog.Dialog(None, {'title': 'Battleship', 'text': 'Choose your win condition', 'bitmap': 'question', 'default': 0, 'strings': ('Win by points', 'Win by moves',)}).num return winCondition
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_style(self, input_style: str) -> str:\r\n try: # Try to get from the dictionary\r\n return self.get_style_from_styles(input_style)\r\n except KeyError: # If you get a key error, it is not in the dictionary\r\n new_style = input(input_style + '\\nWhat style is this?')...
[ "0.67796683", "0.6183087", "0.6105836", "0.598263", "0.596421", "0.59597254", "0.5944806", "0.5859029", "0.5814033", "0.581316", "0.5793324", "0.5781219", "0.57083035", "0.56631756", "0.5641185", "0.5567913", "0.55597574", "0.554282", "0.5537247", "0.5522046", "0.5484849", ...
0.0
-1
(inputForm, widget) > NoneType Populate widget with input fields, labels and submit button
def __init__(self, root): self.root = root self.usernames = [] self.shipList = {} # ships present board self.boardsize = 10 self.opponentType = 0 # default opponent human self.winCondition = 0 # default condition "win by points" # Generate Part 1 - User de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _form(self, r, widget, **attr):\n\n widget_get = widget.get\n\n label = widget_get(\"label\", \"\")\n # Activate if-required\n #if label and isinstance(label, str):\n if label:\n label = current.T(label)\n icon = widget_get(\"icon\", \"\")\n if icon:\...
[ "0.6772358", "0.6580968", "0.654727", "0.6275811", "0.6125593", "0.60910493", "0.606845", "0.6021408", "0.5983857", "0.5977639", "0.59678584", "0.59307754", "0.5896761", "0.585094", "0.58494806", "0.5830047", "0.5814654", "0.5803265", "0.57951486", "0.57862514", "0.5732496", ...
0.0
-1
(Players, widget, widget, list of str, int) > NoneType
def __init__(self, frame1, frame2, usernames, winCondition): self.frame1 = frame1 self.frame2 = frame2 self.usernames = usernames self.winCondition = winCondition self.tracker = None self.message = {0: None, 1: None} self.score = [0, 0] self.moves = [[0],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_players(self) -> None:\n players_list = []\n for player in PLAYERS:\n data_player = ((\n str(player.get(\"first_name\")) + \" \" +\n str(player.get(\"last_name\")) + \" | \" +\n str(player.get(\"birthday\")) + \" | \" +\n ...
[ "0.60937613", "0.60758775", "0.59227043", "0.58652186", "0.58602345", "0.57987446", "0.57637435", "0.57542133", "0.5732737", "0.5707989", "0.56703615", "0.5669131", "0.5666853", "0.5660256", "0.5636019", "0.56277496", "0.5625653", "0.5591696", "0.55910516", "0.55755556", "0.5...
0.0
-1
(Players) > NoneType Update title of the widget to display current player's turn
def updateWidget(self): if self.frame1.state() == 'normal': self.frame2.deiconify() self.frame1.withdraw() else: self.frame2.withdraw() self.frame2.update() self.frame2.deiconify() self.frame1.title("%s's turn" % self.usernames[1])...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_turn_text(self):\n if self.turn_display_timer > 0:\n self.turn_display_timer -= 1\n if self.turn_display_timer > 0:\n fill(1, 0, 0)\n textSize(self.WINDOW_SIZE//20)\n textAlign(CENTER)\n if self.player_turn is True...
[ "0.7002769", "0.65161884", "0.63520014", "0.6310842", "0.6283611", "0.6257139", "0.6219182", "0.6207914", "0.620026", "0.6124011", "0.60627913", "0.60494995", "0.6037499", "0.60145146", "0.6012637", "0.6004304", "0.59991753", "0.5988134", "0.5971973", "0.5967771", "0.59676695...
0.651695
1
(Players) > NoneType Switch turns between the two players Switch between widgets belonging to the respective players
def switchTurn(self): # Widget for player 1 if self.frame1.state() == 'normal': self.frame2.deiconify() self.frame1.withdraw() self.frame1.update() self.frame2.update() if self.message[0]: showDialogBox(self.message[0]) # anno...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switchPlayer(self):\n\n \n tmp = self.current\n self.current = self.other\n self.other = tmp\n\n self.topSelector.toggleActive()\n self.bottomSelector.toggleActive()", "def switch_player(self):\n if self.playerOne:\n # sets the chip color to blue\n ...
[ "0.7426509", "0.6998824", "0.6808672", "0.6744094", "0.63660485", "0.6339389", "0.62118816", "0.6183109", "0.6131109", "0.6131109", "0.6129296", "0.61174875", "0.60700214", "0.59835243", "0.5968046", "0.59500325", "0.59343904", "0.59280646", "0.5894448", "0.58891624", "0.5836...
0.7315319
1
(Players, dict) > NoneType Check for a winner after each turn and declare him if available Calculate player scores and winning margin
def endOfTurn(self, tracker): # Get status on whether all ships have been sunk win = self.checkForWin(tracker) if not win: if self.frame1.state() == 'normal': battleships = game1 else: battleships = game2 self.frame1.after(500...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_winner(self):\n pass", "def winFor(self,player):\n if(self.cachedWin == False):\n won = False;\n if(player==WHITE):\n for x in range(0,WIDTH):\n if(self.gameState[x,0]==WHITE):\n won = True\n \n ...
[ "0.7050733", "0.6838986", "0.67631024", "0.67109716", "0.6681339", "0.6672927", "0.66493315", "0.654616", "0.6513941", "0.64997345", "0.6498171", "0.6483149", "0.6470959", "0.64598453", "0.64597416", "0.6446109", "0.63859123", "0.6380843", "0.63421977", "0.63418794", "0.63281...
0.0
-1
(Players, dict) > int Return True if all ships have been sunk, False otherwise
def checkForWin(self, tracker): # Check damage levels for all ships in the tracker # 0 = Fully damaged (sunk), Non-zero otherwise for i in tracker.values(): if i != 0: break else: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ship_sunk(self, x, y):\n marker = self.markers[x][y]\n total_hits = self.ship_hits[marker]\n return total_hits == MarkerType.MAX_HITS[marker]", "def allBoatsSunk(self):\n for boat in self.boats:\n if not boat.isCaput():\n return False\n return T...
[ "0.7086923", "0.6830485", "0.68004906", "0.67870086", "0.6423188", "0.6418556", "0.6263552", "0.6241059", "0.6236851", "0.6165947", "0.6144907", "0.61259025", "0.61222136", "0.61161816", "0.61093026", "0.6049935", "0.6041142", "0.59935373", "0.5979564", "0.59648657", "0.59629...
0.65183234
4
(Board, widget, Players, dict, int, int, int) > NoneType
def __init__(self, frame, players, shipList, boardsize, opponent, number): self.myframe = frame self.players = players self.shipList = shipList self.boardsize = boardsize self.isComputer = opponent # 0 human, 1 computer self.playerNumber = number self.shipID = 1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.board = Board()\n #self.player1 = player1\n #self.player2 = player2\n self.winner = None", "def __init__(self, players):\n self.players = players\n self.board = Board()", "def __init__(self, player, board):\n self.player = player\n ...
[ "0.64182025", "0.617996", "0.612873", "0.60559887", "0.59374595", "0.5908192", "0.5902293", "0.58809745", "0.58661926", "0.58341885", "0.5834114", "0.5827774", "0.58216006", "0.5815975", "0.5803514", "0.5752149", "0.5743406", "0.57250565", "0.5696697", "0.569361", "0.56876224...
0.5563183
30
(Board) > NoneType Randomly place each ship on the board in 20 attempts Announce failures in placing ships to the user
def placeShips(self): self.ships = [] # Canvas co-ordinates for the ships self.shipText = [] # Text to be displayed besides each ship self.failedAttempts = [] self.names = {2: 'BOAT', 3: 'SUB', 4: 'CRUISER', 5: 'CARRIER'} items = self.shipList.items() for k, v in item...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_ships(self):\n # An array that holds the ships to then be looped through\n length_of_ships = [6, 4, 3, 2]\n\n for ship_length in length_of_ships:\n while True:\n if self.user == 'computer':\n orientation = random.choice(['H', 'V'])\n ...
[ "0.77851987", "0.71791416", "0.692289", "0.6760538", "0.6685494", "0.6635419", "0.6634116", "0.66018915", "0.6573452", "0.65290695", "0.64881796", "0.64754516", "0.64248055", "0.6380921", "0.63760126", "0.6361738", "0.63463557", "0.6336883", "0.6308116", "0.6266603", "0.62579...
0.7395961
1
(Board) > NoneType Proceed with the game once user is done placing ships
def clickDone(self): # Hide done button self.clickDone.place_forget() # Hide all ships and their names self.canvas.tag_lower('ship') self.canvas.tag_lower('text') self.canvas.tag_bind('square', '<Button-1>', self.fire) self.players.updateWidget() # If o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def place_ships(self):\n # An array that holds the ships to then be looped through\n length_of_ships = [6, 4, 3, 2]\n\n for ship_length in length_of_ships:\n while True:\n if self.user == 'computer':\n orientation = random.choice(['H', 'V'])\n ...
[ "0.7097795", "0.70951974", "0.7043386", "0.67466724", "0.6739445", "0.6659705", "0.65870076", "0.65360975", "0.65081865", "0.6482293", "0.6446605", "0.6420638", "0.6394709", "0.63698894", "0.6322538", "0.62863004", "0.62814033", "0.6254247", "0.62501675", "0.624039", "0.62289...
0.0
-1
(Board, event) > NoneType Bomb the location that user clicked on
def fire(self, event): # Unbind left-click to prevent user from bombing # multiple locations at once self.canvas.tag_unbind('square', '<Button-1>') self.canvas.update() # Get co-ordinates of the square that was clicked n = self.canvas.find_closest(event.x, event.y) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bomb(self, index):\n\n coords = self.canvas.coords(self.squares[index])\n x, y = coords[0] + 10, coords[1] + 10\n tag = self.hit[index]\n\n # Count moves for player (used for scoring)\n if self.players.winCondition == 1:\n self.players.moves[self.playerNumber][0] +...
[ "0.6646679", "0.6438571", "0.63480586", "0.6284458", "0.6263875", "0.61304384", "0.609052", "0.6035234", "0.60325086", "0.602507", "0.6016339", "0.5970993", "0.59499353", "0.59125906", "0.59030676", "0.59016794", "0.5841434", "0.58179694", "0.5795095", "0.5780501", "0.5770864...
0.6606424
1
(Board, mouse event) > NoneType Randomly fire on a new location
def computer_fire(self): # Check tracker to see if previous attempt was a hit # If yes, continue to bomb rest of the ship first for shipID, size in self.tracker.items(): if (size != 0) and (self.counter_copy[shipID] != size): for n in range(len(self.hit)): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fire(self, event):\n\n # Unbind left-click to prevent user from bombing\n # multiple locations at once\n self.canvas.tag_unbind('square', '<Button-1>')\n self.canvas.update()\n\n # Get co-ordinates of the square that was clicked\n n = self.canvas.find_closest(event.x, ...
[ "0.70954293", "0.6746754", "0.6722297", "0.64904827", "0.6295307", "0.6293422", "0.6278944", "0.62741244", "0.62656355", "0.62607986", "0.6246792", "0.6226984", "0.6211823", "0.61945266", "0.6189894", "0.6187888", "0.6173481", "0.61596376", "0.61518615", "0.61504084", "0.6135...
0.56940734
75
(Board, int) > NoneType Bomb the square on the board at location index Display visually if the location is a hit, sink or a miss
def bomb(self, index): coords = self.canvas.coords(self.squares[index]) x, y = coords[0] + 10, coords[1] + 10 tag = self.hit[index] # Count moves for player (used for scoring) if self.players.winCondition == 1: self.players.moves[self.playerNumber][0] += 1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _board_detail(self, i, j, player=None):\n if self.board[i][j] is not None:\n return self.board[i][j]\n else:\n return ' '", "def open_tile(self, y, x):\n # Find the letter index and convert into a y-coordinate.\n # Checks if it is a mine\n if [y, x] in...
[ "0.6560357", "0.6459542", "0.6036888", "0.6023518", "0.59488803", "0.59221", "0.58814245", "0.5858179", "0.58324164", "0.5821298", "0.58056515", "0.5783976", "0.57837015", "0.57567793", "0.5751314", "0.57417196", "0.57401717", "0.57344073", "0.57321626", "0.5721358", "0.57197...
0.74928945
0
A new config unit was created
def add_target(self, target: "ConfigUnit", force: bool = True) -> None: raise NotImplementedError()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_config(self) -> None:\n pass", "def create_config(self) -> None:\n pass", "def test_new_config(self, context, permissions, wizard):\n context.config_exists.return_value = False\n permissions.return_value = True\n wizard.return_value = \"/some/file/path\"\n\n ...
[ "0.65981936", "0.65981936", "0.6412118", "0.63568556", "0.6152337", "0.60796976", "0.60681283", "0.60665476", "0.5984143", "0.59282815", "0.590882", "0.59014803", "0.5888511", "0.5866537", "0.5841513", "0.5821081", "0.5818333", "0.5796457", "0.5781293", "0.57518935", "0.57449...
0.0
-1
Add a signal handler for a given signal
def add_signal_handler(self, signal: str, handler: SignalType) -> None: self.signals[signal].append(handler)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_signal_handler():\n signal.signal(signal.SIGUSR1, sig_handler)\n signal.signal(signal.SIGTERM, term_handler)\n #logger.warning(\"Signal handler installed.\")", "def signal(sig, action): # real signature unknown; restored from __doc__\n pass", "def add_signal(self, signal_type, signal):\n\n...
[ "0.7463304", "0.6929054", "0.68717974", "0.6861777", "0.68480754", "0.6819123", "0.67900306", "0.6741492", "0.67177755", "0.6694262", "0.66740245", "0.66523397", "0.6566147", "0.65374196", "0.65315366", "0.64460534", "0.64369327", "0.64045984", "0.63855124", "0.6362513", "0.6...
0.82271916
0
Remove a signal handler for a given signal
def remove_signal_handler(self, signal: str, handler: SignalType) -> None: self.signals[signal].remove(handler)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect(signal, handler=None):\n if signal not in REGISTRY:\n return\n if handler:\n REGISTRY[signal].disconnect(handler)\n return\n REGISTRY[signal].registry.clear()\n del REGISTRY[signal]", "def remove_handler(self, handler):\n pass", "def unhandle(self, handler...
[ "0.7518128", "0.73878825", "0.733965", "0.7093696", "0.7082112", "0.7016719", "0.6983593", "0.6968562", "0.69220537", "0.67706484", "0.677042", "0.6749921", "0.6749921", "0.674355", "0.671034", "0.66765815", "0.65682906", "0.65674055", "0.65650666", "0.65581524", "0.65396845"...
0.8691496
0
Trigger the execution of a signal
def trigger_signal(self, signal: str) -> None: logger.debug("Triggered Signal %s", signal) for handler in self.signals[signal]: if not iscoroutinefunction(handler): handler(self, signal)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal(self, args):\n pass", "def signal(self):\n pass", "def signal(self):\n self.mainloop().signal()", "def send_signal(self, signal):\n self.kill()", "def signal(sig, action): # real signature unknown; restored from __doc__\n pass", "def handler(signum, frame):\n ...
[ "0.73056024", "0.7291485", "0.7155616", "0.71059185", "0.7004548", "0.68484515", "0.68122315", "0.66860735", "0.66161615", "0.6582161", "0.6528276", "0.64471304", "0.64067465", "0.63644886", "0.63605857", "0.6347991", "0.6341407", "0.6310366", "0.627935", "0.6233564", "0.6217...
0.724445
2
Trigger the ready signal
def trigger_ready(self) -> None: self.trigger_signal("ready")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_trigger_ready(self) -> None:\n await self.async_trigger_signal(\"ready\")", "def _ready(cls):\n sync_call(cls.ready)", "def signal_ready(self):\n self.logger.debug(\"service is ready\")", "def set_ready(self, ready):\n\n if ready != self.ready:\n self.re...
[ "0.8025426", "0.7645126", "0.7626614", "0.74764514", "0.729565", "0.7278469", "0.7272239", "0.71919453", "0.7183721", "0.71314156", "0.7097618", "0.7070732", "0.7034649", "0.7022209", "0.7019923", "0.70172924", "0.70098567", "0.7004107", "0.69810987", "0.6939787", "0.69081724...
0.906193
0
Trigger the reloading signal
def trigger_reloading(self) -> None: self.trigger_signal("reloading")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload(self):", "def reload(self):", "async def async_trigger_reloading(self) -> None:\n await self.async_trigger_signal(\"reloading\")", "def reload(self):\n\n pass", "def handleReload(self, confInfo=None):", "def reloadfile(self, ):\n self.loadfile()", "def onReload(self, eve...
[ "0.7571994", "0.7571994", "0.7530184", "0.7265492", "0.7066332", "0.6972975", "0.69430655", "0.6931121", "0.6902578", "0.6864657", "0.68005574", "0.6678387", "0.66441363", "0.6629255", "0.65927565", "0.65846795", "0.65178376", "0.649942", "0.6400243", "0.6395761", "0.63782394...
0.8661393
0
Trigger the stopping signal
def trigger_stopping(self) -> None: self.trigger_signal("stopping")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_stop(self):\n self.terminate = True\n self.stop_event.set()", "def stop(self):\n self._stop_event.set()", "def stop(self):\n self._stop_signal = True", "async def async_trigger_stopping(self) -> None:\n await self.async_trigger_signal(\"stopping\")", "def stop(sel...
[ "0.83172107", "0.7786065", "0.77781236", "0.7761774", "0.76054394", "0.76054394", "0.7582804", "0.7582804", "0.7535837", "0.7515825", "0.7493608", "0.74792635", "0.7423843", "0.7423843", "0.7423843", "0.7423843", "0.73963726", "0.73890865", "0.73866063", "0.73866063", "0.7358...
0.8796747
0
Asynchronously trigger a signal
async def async_trigger_signal(self, signal: str, call_non_async: bool = True) -> None: logger.debug("Triggered async Signal %s", signal) for handler in self.signals[signal]: if iscoroutinefunction(handler): await handler(self, signal) elif call_non_async: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_trigger_ready(self) -> None:\n await self.async_trigger_signal(\"ready\")", "def signal(self):\n pass", "def signal(self):\n self.mainloop().signal()", "def wait(self, signal):\n while True:\n s = self.receive()\n if s == signal:\n ...
[ "0.65525323", "0.63653135", "0.62964845", "0.6249843", "0.6248277", "0.609612", "0.6083517", "0.5988911", "0.59010714", "0.5864339", "0.5805615", "0.57938665", "0.57897955", "0.5769629", "0.5765342", "0.56968933", "0.5655166", "0.5621324", "0.5615974", "0.56096613", "0.560776...
0.7176681
0
Asynchronously trigger ready signal
async def async_trigger_ready(self) -> None: await self.async_trigger_signal("ready")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_ready(self) -> None:\n self.trigger_signal(\"ready\")", "async def wait_until_ready(self):\n await self._ready.wait()", "def _ready(cls):\n sync_call(cls.ready)", "async def wait_until_ready(self) -> None:\n await self._ready.wait()", "def wait_until_ready(self):\n ...
[ "0.7957024", "0.76273876", "0.75980026", "0.7584667", "0.73376846", "0.73272824", "0.71455956", "0.7090845", "0.6984995", "0.6972566", "0.6957092", "0.694639", "0.68779695", "0.6805574", "0.6723002", "0.6695403", "0.6651755", "0.66165686", "0.66163814", "0.6561962", "0.655465...
0.8690879
0
Asynchronously trigger reloading signal
async def async_trigger_reloading(self) -> None: await self.async_trigger_signal("reloading")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_reloading(self) -> None:\n self.trigger_signal(\"reloading\")", "def __work__(self):\n while not self.is_done:\n self.refreshSignal.emit()\n time.sleep(0.05)", "def receive_reload_request(self, _: EmptyMsg):\n self.update()", "async def on_reload(name: s...
[ "0.77258253", "0.68277395", "0.65592974", "0.6540588", "0.6480827", "0.6469871", "0.64691025", "0.64691025", "0.63705677", "0.6348815", "0.6345243", "0.6345243", "0.6331519", "0.6307918", "0.62133044", "0.61762387", "0.6157899", "0.61375374", "0.61370605", "0.6109216", "0.608...
0.8389388
0
Asynchronously trigger stopping signal
async def async_trigger_stopping(self) -> None: await self.async_trigger_signal("stopping")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def stop(self):", "async def stop_signal():\n global user_exit\n user_exit = True\n await cancel_async_tasks()", "async def _stop(self) -> None:\n self._stopped.set()", "async def _stop(self):\n return", "async def stop(self):\n self._stopped.set()", "def _async_stop(s...
[ "0.7618304", "0.7535549", "0.7479075", "0.7390178", "0.73786783", "0.7311615", "0.72304475", "0.7133008", "0.7077584", "0.70226985", "0.69951266", "0.6995009", "0.6995009", "0.69884837", "0.6905019", "0.6893961", "0.6875865", "0.68426615", "0.6798531", "0.6798531", "0.6798531...
0.8404765
0
Return a subconfig This is used if a unit wants to spawns multiple processes, or turns over the execution into an async event loop
def subconfig(self) -> "Config": config = Config() config.func = self.func config.targets = self.targets.copy() config.blacklisted_targets = self.blacklisted_targets.copy() config.variables = self.variables.copy() config.unit_iterator = self.unit_iterator.copy() c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subconfig(self, subsection):\n if config.is_config(self.config):\n raise PluginFeatureError(\"subconfig() incompatible with plugin.Config, \"\n \"use config.option_map()\")\n section = self.plugin_name() + '/' + subsection\n if section not in ...
[ "0.60988027", "0.60472995", "0.59924436", "0.5848383", "0.5754003", "0.5652345", "0.56391656", "0.561206", "0.5585556", "0.55465674", "0.5543928", "0.55178064", "0.5506117", "0.5506117", "0.55029464", "0.54643583", "0.5461314", "0.5458342", "0.5458342", "0.5458342", "0.545834...
0.7124728
0
Execute the initialization and run all targets/commands
def init(self) -> Optional[FinalTargetType]: for unit in self.unit_iterator: logger.debug("Init Config Unit %s", unit) if unit in self.blacklisted_targets: logger.debug("Config Unit %s is blacklisted", unit) instance = None result = None ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialise_run(self) -> None:", "def _initialize_all():\n registry.clear_checkers()\n registry.clear_contexts()\n cli._register_internal_plugins.has_run = ( # pylint: disable=protected-access\n False\n )\n cli._register_internal_plugins() # pylint: disable=pro...
[ "0.6870501", "0.68618506", "0.6855256", "0.6775831", "0.67421097", "0.6735817", "0.66639394", "0.6623143", "0.6574771", "0.65253943", "0.65238065", "0.6493621", "0.64715785", "0.6471033", "0.6447333", "0.64468986", "0.64338243", "0.642914", "0.6405109", "0.6386025", "0.637724...
0.0
-1
Asynchronously execute all targets/commands
async def async_init(self) -> Optional[FinalTargetType]: for unit in self.unit_iterator: logger.debug("Run Config Unit %s", unit) if unit in self.ran_units: logger.debug("Unit already ran %s", unit) continue if unit.is_empty: i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RunAsyncCommand(devices, command):\n for device in devices:\n device.AsyncCommand(command)\n for device in devices:\n device.WaitForTasks()", "def execute(self, targets):", "async def execute(self):", "async def _execute(self):", "def execute(self, targets):\r\n raise TaskError('execute() no...
[ "0.688624", "0.6870549", "0.6731832", "0.6620648", "0.6588405", "0.655179", "0.6543455", "0.635691", "0.6311866", "0.62929934", "0.62369114", "0.6232107", "0.6223383", "0.61921984", "0.6173736", "0.61398774", "0.613352", "0.61080295", "0.6008409", "0.59872687", "0.5978436", ...
0.0
-1
Asynchronously exit all targets
async def async_exit(self) -> None: while True: try: unit = self.ran_units.pop() except IndexError: break instance = self.active_units[unit] if unit == self.entry_point: return logger.debug("Exit Config...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _exit_jobs() -> None:\n logger.info(f\"Exiting {len(tasks)} active jobs.\")\n\n for task in tasks:\n task.cancel()\n\n await asyncio.gather(*tasks, return_exceptions=True)", "def exit_loop(self):\n self.loop.exit()", "async def __aexit__(self, *args) -> None:\n self.stop...
[ "0.6994148", "0.6619564", "0.65522337", "0.65431434", "0.6410722", "0.63933057", "0.63517857", "0.62914884", "0.62700874", "0.6232084", "0.6218019", "0.615043", "0.6085669", "0.6072486", "0.6070191", "0.60553247", "0.6022142", "0.6011097", "0.5998008", "0.5997682", "0.5997682...
0.64262086
4
Returns a config value
def __getitem__(self, key: str) -> Any: return self.variables[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_config_value(self, name):\r\n if name in self.config_values:\r\n return self.config_values[name]", "def value(self) -> str:\n return self._config.get('value')", "def _get_config_value(self, section, key):\n return config.get(section, key)", "def config_value(name):\n ...
[ "0.83533496", "0.80241734", "0.79516804", "0.772929", "0.7663415", "0.7605796", "0.75783", "0.7518339", "0.747167", "0.74433523", "0.7403487", "0.7380993", "0.7370448", "0.7341626", "0.7287305", "0.7253601", "0.72316563", "0.72029024", "0.7199229", "0.7188936", "0.7181148", ...
0.0
-1
Returns a config value with a given default
def get(self, key: str, default: Any = None) -> Any: try: return self.variables[key] except KeyError: return default
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_configval(self, keyname, defaultval=None):\n return self.cfghelper.get_value(keyname,defaultval)", "def setting(self, config, name, default=None):\n\n return config.get(name, default) if config else default", "def get_value(val_name, default=None):\r\n configuration = get_configuration...
[ "0.7744531", "0.7702715", "0.75827324", "0.7576914", "0.74662286", "0.7428725", "0.72849745", "0.7254284", "0.7243781", "0.7208191", "0.7178237", "0.71760774", "0.71760774", "0.7175235", "0.7167265", "0.70747626", "0.7053393", "0.7041356", "0.7032819", "0.69746035", "0.695504...
0.0
-1
Check if key is in the config
def has(self, key: str) -> Any: return key in self.variables
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(self, key):\n return self.__config.contains(key)", "def _check(self, key):\n if not self.contains(key):\n raise KeyError(\"ConfigManager does not contain key '%s'\" % key)", "def has_value(key: str) -> bool:\n Config.__get()\n assert Config.__config is not No...
[ "0.8192631", "0.78098345", "0.7585253", "0.7554064", "0.7395869", "0.7386637", "0.7342632", "0.7336908", "0.72926855", "0.72714746", "0.72366637", "0.71868646", "0.7180342", "0.71164626", "0.70905167", "0.7077759", "0.7070522", "0.7018947", "0.7007525", "0.6978691", "0.696024...
0.7044245
17
Set a config value
def __setitem__(self, key: str, value: Any) -> None: self.variables[key] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_config_value(self, value, index=None):", "def setconfig(self, key, value):\n self.config[key] = value", "def set_config(self, attr, value):\n setattr(self.config, attr, value)", "def set_config(self, attr, value):\n setattr(self.config, attr, value)", "def config_set(self, name...
[ "0.84315234", "0.8009848", "0.8004304", "0.8004304", "0.77232933", "0.77127486", "0.763976", "0.7554772", "0.75404507", "0.7442232", "0.7434719", "0.7279616", "0.72004604", "0.70588046", "0.69772005", "0.697253", "0.6958759", "0.6949299", "0.6931892", "0.6921241", "0.6892", ...
0.0
-1
Remove a config value
def __delitem__(self, key: str) -> None: del self.variables[key]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, value):\n pass", "def remove_config(name):\n db = dbm.open(config_file, 'c')\n del db[name]\n db.close()", "def remove(self, value):\n self.values.remove(value)", "def remove(self, value):\n\t\tself.__remove(self, value, None)", "def remove(self, e):\n try:\n ...
[ "0.7204579", "0.7015371", "0.692847", "0.68955314", "0.68906724", "0.68822175", "0.6709954", "0.67038137", "0.66886425", "0.6681859", "0.6681859", "0.6681859", "0.66668016", "0.66531783", "0.658481", "0.65197504", "0.6515367", "0.64973366", "0.6488835", "0.6463948", "0.641932...
0.0
-1
Return the number of variables set
def __len__(self) -> int: return len(self.variables)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nvar(self):\n return len(self.__vars)", "def nVariables(self):\n return len(self.variables)", "def num_vars(self):\n return self.nvars", "def get_num_variables(self):\n return len(self.variables)", "def countVars(self):\n return len(self.initializedVars[\"GF\"]) + len(sel...
[ "0.84948695", "0.8389925", "0.8304923", "0.827945", "0.8186456", "0.81460345", "0.80395687", "0.79198205", "0.7865168", "0.78592515", "0.77672356", "0.77296805", "0.7693469", "0.7657799", "0.7612893", "0.72387826", "0.718583", "0.6963806", "0.69209385", "0.688964", "0.6860557...
0.77604926
11
Add a couple of targets
def add_targets(self, targets: List["ConfigUnit"]) -> None: for target in targets: self.add_target(target)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_for_targets(self, targets, products):\n # FIXME: This is a temporary helper for use until the classpath has been split.\n for target in targets:\n self.add_for_target(target, products)", "def addTargets(self, **kwargs):\n self.targets.update(kwargs)\n for key, val in kwargs.items():\n ...
[ "0.75258464", "0.74412984", "0.67919725", "0.67026454", "0.66502565", "0.64302343", "0.63414145", "0.620095", "0.59678", "0.5941169", "0.5926424", "0.5833991", "0.5790687", "0.5789335", "0.5789186", "0.5767488", "0.57362753", "0.57196784", "0.57172567", "0.5712924", "0.570663...
0.7605349
0
Set a function/command to be executed
def set_func(self, func: FinalTargetType) -> None: if self.func is not None: raise Exception("Can't change func") self.func = func # pylint: disable=import-outside-toplevel from .command import Command if iscoroutinefunction(func) or (isinstance(func, Command) and f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_function(self):\n value = 0x20 | self.power | self.addressing | self.instr\n self.command([value])", "def set_func(self, function):\n self.get(COMMAND_UIC, 'SetFunc', [('function', function)])", "def register_command(self, func):\n self.commands[func.__name__] = func", "def s...
[ "0.77926934", "0.763545", "0.7266966", "0.69897604", "0.68003684", "0.6796049", "0.6796049", "0.6796049", "0.6704106", "0.66178507", "0.66103816", "0.6596623", "0.65963894", "0.6595024", "0.6541416", "0.6537568", "0.6509991", "0.6502617", "0.6499466", "0.6495502", "0.64940387...
0.6119241
44
Load config from python modules
def load_from_module_path(self, filename: str) -> None: # pylint: disable=import-outside-toplevel import importlib.util spec = importlib.util.spec_from_file_location("base_config", filename) module = importlib.util.module_from_spec(spec) if spec.loader is not None: sp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\n pass", "def loadConfigs(self):\n self.onLoadConfig(urlopen(self.inipath))", "def load():\n # get (or create) config path\n p = initialize()\n return load_config(open(p['config']))", "def load_conf_modules():\n for modname in _list_module_names():\n mod = ...
[ "0.72497326", "0.7083084", "0.7046125", "0.69165975", "0.68692094", "0.6737923", "0.67242295", "0.6686938", "0.66771865", "0.6632461", "0.6618244", "0.6604397", "0.66030544", "0.65675026", "0.6565883", "0.655887", "0.65504205", "0.6490937", "0.64830065", "0.6402454", "0.64011...
0.6614479
11
Updates variables from module variables Fetches all keys from a module not beginning with `__` and puts them into the variables dict.
def load_from_module(self, module: ModuleType) -> None: for key in dir(module): if key.startswith("__") and key.endswith("__"): continue value = getattr(module, key) self[key] = value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_variables(mod):\n for k in dir(mod):\n if '__' not in k:\n globals()[k] = getattr(mod, k)", "def get_module_vars(module) -> dict:\n d = vars(module)\n return {k: v for k, v in d.items() if not k.startswith('_')}", "def updateVariables(self) -> None:\n ...", "def _ge...
[ "0.75164855", "0.6815525", "0.6087645", "0.6051903", "0.6037844", "0.60374606", "0.57758737", "0.57646626", "0.5736392", "0.5659179", "0.5539135", "0.5537163", "0.54957986", "0.5493666", "0.54934907", "0.5459913", "0.5419371", "0.54047734", "0.5389527", "0.5377797", "0.535739...
0.6134498
2
Get a config object with a preset of values from a module
def get_from_module(cls, module: ModuleType) -> "Config": config = Config() config.load_from_module(module) return config
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_module_config(name):\n return _CONFIGS[name]", "def get_config(\n config_module: str, config_name: str, overrides: List[str] = []\n) -> PipelineConfig:\n _ensure_hydra_initialized(config_module)\n config = compose(config_name=config_name, overrides=overrides)\n return config # type: ignor...
[ "0.6761987", "0.64763343", "0.6444306", "0.6280169", "0.6217964", "0.60760456", "0.6073496", "0.60730475", "0.6055335", "0.6041652", "0.6026207", "0.60070944", "0.6006351", "0.6006167", "0.5896163", "0.5896163", "0.58649266", "0.5849656", "0.5849656", "0.58370876", "0.5822898...
0.68166244
0
Returns the current config variable
def get_config() -> Optional[Config]: return CurrentConfig.get()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(self):\n return self.namespace['config']", "def config(self):\n return self[CONFIG_KEY]", "def config(self):\n return CurrentProject().config.config[self.key]", "def get_config_var(name):\n return get_config_vars().get(name)", "def _get_config(self):\n return self.__config...
[ "0.7465803", "0.7437359", "0.738738", "0.73662037", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", "0.71334124", ...
0.6623554
93
Sets the current config variable
def set_config(config: Config): CurrentConfig.set(config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _setConfig(self,config):\n if config:\n self.config = config\n else:\n from layman import config\n self.config = config", "def set(name):\n set_config(name)", "def config(self, config):\n self._config = config", "def set_config(self, attr, value):...
[ "0.73220515", "0.717356", "0.70822525", "0.70399904", "0.70399904", "0.7011923", "0.67849416", "0.66773766", "0.6659831", "0.65874934", "0.65869415", "0.65798306", "0.652901", "0.6460033", "0.6352335", "0.63502425", "0.632236", "0.63159484", "0.62957823", "0.62849516", "0.623...
0.74602777
0
Returns a list of items If param is a list returns param, if param is None returns empty list otherwise return a list containing param.
def _param_to_list(param: OptionalConfigUnitList) -> List["ConfigUnit"]: if param is None: return [] if isinstance(param, list): return param.copy() return [param]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_helper(self, param):\n if param.name == 'list':\n address = param.address\n else:\n address = self.get_value(\n param.address, param.type_, param.is_global)\n return self.list_table[address]", "def get_subparams_list(param_name = None):\n ...
[ "0.66779256", "0.6531761", "0.6481148", "0.6286537", "0.6194483", "0.61740565", "0.6156124", "0.6154225", "0.6076655", "0.6076655", "0.6016638", "0.60031086", "0.59561324", "0.59488076", "0.5926385", "0.59183264", "0.5917936", "0.5917832", "0.59167904", "0.5913159", "0.591087...
0.7490679
0
Checks if this unit doesn't do anything
def is_empty(self) -> bool: return self.func is None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _should_run_now(self):\n # Assumes the unit/all values will have values.\n if not len(self._device_values.keys()) > 0:\n return False\n return not len(self._needed_devices) > 0", "def is_not_used(self):\n pass", "def check(self):\n pass", "def...
[ "0.66958106", "0.65781957", "0.63975894", "0.63975894", "0.63975894", "0.63975894", "0.63781667", "0.6349756", "0.6349071", "0.63391685", "0.63279146", "0.6327419", "0.6259889", "0.6256734", "0.62520736", "0.6240618", "0.62401515", "0.6221144", "0.62018996", "0.61908615", "0....
0.0
-1
Add a config unit to the global list of config units
def add_unit(cls, unit: "ConfigUnit", path: str) -> None: if path in cls.units: raise Exception("Can't overwrite config unit {}".format(path)) cls.units[path] = unit for listener in cls.listener: listener.add_target(unit, force=False) for container in unit.belon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_unit(number_of_units=1):\n zaza.model.add_unit(\n \"ovn-central\",\n count=number_of_units,\n wait_appear=True\n )\n zaza.model.wait_for_application_states()", "def addconfiguration(self, name, q, unit='rad'):\n v = getvector(q, self.n)\n ...
[ "0.62909514", "0.62766176", "0.5906996", "0.580822", "0.5765161", "0.57047325", "0.56498396", "0.56426114", "0.5507572", "0.54749453", "0.54564583", "0.54489315", "0.53271854", "0.52905995", "0.5268504", "0.52679884", "0.5252192", "0.52068555", "0.5104467", "0.5103326", "0.50...
0.7123583
0
Add a listener to track for new config units This is used in case an import leads to new units. If you initiated a config than this config will add a listener here. Because the listeneres `add_target` method will be called with `force=False`. Units will just be added if they are already implicitly selected.
def add_listener(cls, listener: ConfigUnitListener) -> None: cls.listener.append(listener)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_target(self, target: \"ConfigUnit\", force: bool = True) -> None:\n raise NotImplementedError()", "def added(self, configuration):\n log.debug('ConfigListener: configuration %s added' % configuration)", "def pre_configure_target(name):\n ListenerManager.call(_target_pre_configure_m...
[ "0.62391466", "0.5685482", "0.56807923", "0.563405", "0.55722517", "0.5544438", "0.5483096", "0.54174834", "0.5350144", "0.53082293", "0.5286893", "0.5259616", "0.51942605", "0.51904094", "0.51435626", "0.51106787", "0.505528", "0.5054847", "0.5011461", "0.49943042", "0.49943...
0.6901531
0
Just a shortcut for ConfigUnit
def config_unit(*args, **kwargs) -> Union[ConfigUnit, Callable[[Any], ConfigUnit]]: def wrapper(func: Any) -> ConfigUnit: if "name" not in kwargs: kwargs["name"] = func.__name__ if "description" not in kwargs: kwargs["description"] = func.__doc__ path = "{}.{}".form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_config_class():\n assert config is not None", "def setUpConfig(self):\n pass", "def config():", "def config():", "def configuration():", "def test_everything():\n # TODO: split this up and write better tests\n\n @make_config()\n class Config:\n \"\"\"The test config...
[ "0.74491554", "0.7226312", "0.6989412", "0.6989412", "0.6985273", "0.69546634", "0.6788977", "0.67733526", "0.6750671", "0.67372453", "0.6676391", "0.66572154", "0.6642288", "0.66375", "0.66051465", "0.6544601", "0.6544601", "0.6539695", "0.65373456", "0.65342915", "0.6532069...
0.6404721
32
Run a programm asynchronously using ackermann This function will run all targets, then the function and then cleanup all the mess it left.
async def async_run( func: FinalTargetType = None, config: Optional[Config] = None, targets: Optional[List[ConfigUnit]] = None ) -> None: if config is None: assert func is not None or targets is not None config = Config(targets=targets, func=func) else: assert fu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do():\n # get all apks which are linked in the database\n # will come with [0] package [1] path_to_apk\n appsList = Apps().getAllApps()\n\n threads = []\n for list in chunkify(appsList, 4):\n p = Process(target=explaindroid, args=(list,))\n logger.info(\"starting mallodroid thread ...
[ "0.5962585", "0.5645139", "0.53960097", "0.53960097", "0.5390332", "0.53194207", "0.5302891", "0.5294377", "0.52914506", "0.5256078", "0.5244832", "0.5209862", "0.5193533", "0.51491034", "0.51411825", "0.51409423", "0.5122826", "0.5105916", "0.50836325", "0.50792783", "0.5060...
0.46748263
90
Asynchronously initializes all targets This function will not run aynthing like `async_run` but rather, as a context manager, enable the user to execute whatever she wants.
async def async_init( config: Optional[Config] = None, targets: Optional[List[ConfigUnit]] = None ) -> AsyncGenerator[Config, None]: # pylint: disable=import-outside-toplevel from .units import ASYNC_UNIT if config is None: assert targets is not None config = Config(targets=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def async_setup(self):\n pass", "async def initialize(self):", "async def async_init(self) -> Optional[FinalTargetType]:\n for unit in self.unit_iterator:\n logger.debug(\"Run Config Unit %s\", unit)\n if unit in self.ran_units:\n logger.debug(\"Unit alr...
[ "0.6919155", "0.6721145", "0.6462371", "0.6447364", "0.6447364", "0.6354801", "0.63443065", "0.63086605", "0.63086605", "0.62547606", "0.62547606", "0.62547606", "0.62547606", "0.6208426", "0.6191402", "0.6144838", "0.6113137", "0.6084455", "0.6014905", "0.59837544", "0.59801...
0.69338
0
Run a programm using ackermann This function will run all targets, then the function and then cleanup all the mess it left.
def run( func: FinalTargetType = None, config: Optional[Config] = None, targets: Optional[List[ConfigUnit]] = None ) -> None: # pylint: disable=import-outside-toplevel from .units import ASYNC_UNIT if config is None: assert func is not None or targets is not None con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_all(self):\n\n self.run_mash() ###Run MASH analysis\n self.filter_query() ###Filter fasta sequences out based on p value\n self.build_index(self.filtered_out_path) ###Build index for off-target analysis\n os.remove(self.filtered_out_path) ###Clean up intermediate fasta file\n ...
[ "0.5848556", "0.5814749", "0.57394105", "0.5561391", "0.5448861", "0.5428305", "0.5405755", "0.5402405", "0.53800285", "0.5378617", "0.53585124", "0.5316986", "0.53027886", "0.52864605", "0.52786565", "0.52747124", "0.52654445", "0.5264913", "0.52580065", "0.52568954", "0.524...
0.0
-1
Initializes all targets This function will not run aynthing like `run` but rather, as a context manager, enable the user to execute whatever she wants.
def init( config: Optional[Config] = None, targets: Optional[List[ConfigUnit]] = None ) -> Generator[Config, None, None]: if config is None: assert targets is not None config = Config(targets=targets) else: assert targets is None assert isinstance(config, Config) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initialize_all():\n registry.clear_checkers()\n registry.clear_contexts()\n cli._register_internal_plugins.has_run = ( # pylint: disable=protected-access\n False\n )\n cli._register_internal_plugins() # pylint: disable=protected-access", "def _initialize_runne...
[ "0.67708266", "0.6669621", "0.6608555", "0.6413173", "0.6391623", "0.6335327", "0.6094842", "0.6054466", "0.6053088", "0.6033769", "0.5976094", "0.59517103", "0.5944193", "0.58962715", "0.58852327", "0.5885213", "0.58763385", "0.58699656", "0.5869766", "0.5850643", "0.5842151...
0.0
-1
Load requirements from a pip requirements file.
def parse_requirements(filename): try: lineiter = (line.strip() for line in open(filename)) return [line for line in lineiter if line and not line.startswith("#")] except OSError: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_requirements_from_pipfile():\n lineiter = (line.strip() for line in open('Pipfile'))\n requirements_pipfile_style = [line for line in lineiter]\n start_index = requirements_pipfile_style.index('[packages]') + 1\n end_index = requirements_pipfile_style.index('[requires]') - 1\n requirements...
[ "0.7140471", "0.69411206", "0.6918211", "0.6898259", "0.6884532", "0.6796581", "0.67297643", "0.6702323", "0.6694401", "0.6694401", "0.6565847", "0.65304285", "0.6509914", "0.6489069", "0.6451843", "0.63243556", "0.63096094", "0.6305995", "0.6304723", "0.6291954", "0.6272886"...
0.0
-1
Execute run. After calling the super class implementation, this function removes the directories specific to scikitbuild ++.
def run(self): super(CleanUp, self).run() for dir_ in CleanUp.CLEANFOLDERS: if exists(dir_): print("Removing: {}".format(dir_)) if not self.dry_run and exists(dir_): rmtree(dir_) for dir_ in CleanUp.CLEANFOLDERSRECURSIVE: for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n # Call to the method of the parent to\n # clean common files and directories\n Clean.run(self)\n\n # Remove C and C++ files if the current working directory\n # is not a source distribution, since the source files\n # are needed by the package in release m...
[ "0.70541626", "0.68802536", "0.66727626", "0.6591431", "0.65701807", "0.65054595", "0.6487707", "0.6474494", "0.63858336", "0.6361844", "0.63577706", "0.63068336", "0.63011086", "0.629727", "0.62970245", "0.6282185", "0.62442654", "0.6232809", "0.62124085", "0.62100893", "0.6...
0.68531376
2
Flota el elemento en la posicion del indice
def flotar(heap, indice): padre = (indice-1)//2 while (padre >= 0) and (heap.vector[padre] > heap.vector[indice]): heap.vector[padre], heap.vector[indice] = heap.vector[indice], heap.vector[padre] indice = padre padre = (padre - 1) // 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(self, elem):\n ponteiro = self.inicio\n i = 0\n while(ponteiro):\n if ponteiro.dado == elem:\n return i\n ponteiro = ponteiro.prox\n i = i + 1\n raise ValueError(\"{} is not in list\".format(elem))", "def __getitem__(self, inde...
[ "0.6411704", "0.6374627", "0.63157314", "0.6304254", "0.6295695", "0.62191075", "0.62191075", "0.6200214", "0.6137511", "0.61216503", "0.60779715", "0.6053396", "0.6053396", "0.5991397", "0.5959192", "0.5941304", "0.59400946", "0.5919152", "0.58912444", "0.5888736", "0.587655...
0.0
-1
Hunde el elemento en la posicion del indice
def hundir(heap, indice): # hi = Hijo izquierdo hi = (2 * indice) + 1 control = True while (hi < heap.tamanio - 1) and control: # Ve cual de los hijos es mayor menor = hi # hd = Hijo derecho hd = hi + 1 if (hd <= heap.tamanio - 1) and (heap.vector[hd] < heap.vec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_element(cls, d, idx):\n d[idx, 2] = 0\n return d", "def __delitem__(self, i):\n if not (0 <= i < len(self)):\n raise IndexError(\"index en dehors de la plage admissible.\")\n\n if i == 0:\n self.supprimer_tete()\n return\n\n courante...
[ "0.6990049", "0.62794125", "0.623694", "0.6142792", "0.60941684", "0.60679543", "0.5988683", "0.59881485", "0.59802425", "0.59698164", "0.59203905", "0.5901094", "0.58908606", "0.58798105", "0.5870572", "0.57969886", "0.57832396", "0.57723296", "0.5753294", "0.57511806", "0.5...
0.0
-1
Change movement speed of the actor
def change_velocity(self, delta): self.velocity += delta
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n self.position += self.speed", "def set_speed(self, new_speed):\n self.__x_speed, self.__y_speed = new_speed", "def movementSpeedModifier(self):\n return 0", "def walk(self):\n self.speed = self.speed + (0.2 * self.legs)", "def move_turtle(self):\n self.f...
[ "0.7517198", "0.73021114", "0.72913533", "0.7256577", "0.7237594", "0.72325927", "0.71787024", "0.7162943", "0.7150172", "0.7146387", "0.7097154", "0.70641166", "0.7045905", "0.6994485", "0.6977949", "0.69730586", "0.6972232", "0.696598", "0.69605356", "0.6959815", "0.6948275...
0.67232895
36
Change the position of the agent to show movement
def update_position(self): # clamp on upper and lower bounds new_pos = self.position[1] + self.velocity # TODO: proper centering on borders if new_pos >= (config['globals']['HEIGHT'] - int(config['globals']['PAD_HEIGHT'] / 2) or new_pos <= int(config['globals']['PA...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n \n self.position = self.wander()", "def movement(self):", "def move(self):\n possible_steps = self.model.grid.get_neighborhood(\n self.pos,\n moore=False, # implements Von Neumann neighborhood\n include_center=False)\n new_position = s...
[ "0.7571383", "0.7284361", "0.7184241", "0.7150989", "0.71362656", "0.7057185", "0.7012484", "0.6970319", "0.6948752", "0.688544", "0.6796978", "0.6755326", "0.674048", "0.6710682", "0.6673721", "0.66386414", "0.66232866", "0.66104656", "0.6609451", "0.6608374", "0.6564065", ...
0.0
-1
Importing customers from csv
def import_customers(ctx): load_csv(ctx, 'data/sample/customers.csv', 'res.partner')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingest_customer_csv(csv_path):\n # Create a CSV import generator (next yields one db row)\n import_generator = import_csv_gen(csv_path)\n # Skip over the title row\n next(import_generator)\n # Iterate over all other rows\n while True:\n try:\n data = next(import_generator)\n...
[ "0.7907247", "0.7341674", "0.7154953", "0.70078534", "0.700205", "0.692045", "0.69052356", "0.68793905", "0.68598324", "0.6829377", "0.6810357", "0.6772564", "0.67216235", "0.66662025", "0.6599912", "0.6596026", "0.6590651", "0.6519543", "0.64981043", "0.6441509", "0.64220226...
0.8267799
0
Find the first index whose value target
def _find(self, candidates, target, lb, rb): # we'v made sure there's no duplicate in candidates li, ri = lb, rb while li < ri: mi = (li + ri) // 2 if candidates[mi] < target: li = mi + 1 elif candidates[mi] > target: ri = mi - ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_equals_value_search1(arr):\n for key, value in enumerate(arr):\n if value == key:\n return value\n return -1", "def linearSearch(values: list, target: int) -> int:\n for i in range(len(values)):\n if target == values[i]:\n return i\n \n return -1", "def Find_the_fir...
[ "0.75015247", "0.7461274", "0.7328772", "0.72724575", "0.71318346", "0.71318346", "0.70577985", "0.70444566", "0.70301926", "0.69558185", "0.6898459", "0.6864955", "0.6859883", "0.68126976", "0.6794005", "0.67442167", "0.66998094", "0.6698883", "0.66974026", "0.66941434", "0....
0.0
-1
The only difference lies in duplicate in candidates As result shouldn't contain duplicate, we can turn the candidates into a list of unique elements and their frequencies.
def combinationSum2(self, candidates, target): if not candidates: return [] candidates = sorted(candidates) c, f = [candidates[0]], [1] for i in xrange(1, len(candidates)): if candidates[i-1] == candidates[i]: f[-1] += 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_all_holds(hand):\n ans_set = set([()])\n\n for dummy_idx in range(len(hand)):\n temp_set = set([()])\n for seq in ans_set:\n for item in hand:\n new_seq = list(seq)\n if hand.count(item) > new_seq.count(item):\n new_seq.append(...
[ "0.6509342", "0.64812076", "0.6419035", "0.6231188", "0.6226224", "0.6185147", "0.6176219", "0.61741096", "0.613935", "0.6127911", "0.6096435", "0.6092666", "0.6082089", "0.60359985", "0.6005809", "0.5965437", "0.58880466", "0.5880285", "0.5835042", "0.58078444", "0.5804763",...
0.0
-1
This is a copy of CharField.prepare_template, except that it adds a fake request to the context, which is mainly needed to render CMS placeholders
def _prepare_template(self, obj, needs_request=False): if self.instance_name is None and self.template_name is None: raise SearchFieldError("This field requires either its instance_name variable to be populated or an explicit template_name in order to load the correct template.") if sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_template(self, obj):\n if self.instance_name is None and self.template_name is None:\n raise SearchFieldError(\n \"This field requires either its instance_name variable to be populated or an explicit template_name in order to load the correct template.\"\n )\...
[ "0.6153747", "0.60101753", "0.5881539", "0.5870305", "0.58173484", "0.57768446", "0.57493883", "0.5698434", "0.56751007", "0.5672635", "0.5669253", "0.5664703", "0.5644459", "0.5637024", "0.5635972", "0.5587371", "0.5558491", "0.5539983", "0.55088854", "0.549886", "0.54948735...
0.6982965
0
gets the translated value of field name. If `FALLBACK`evaluates to `True` and the field has no translation for the current language, it tries to find a fallback value, using the languages defined in `settings.LANGUAGES`.
def get_value(self, context, obj, field_name): try: language = get_language() value = self.get_translated_value(obj, field_name, language) if value: return value if self.FALLBACK: for lang, lang_name in settings.LANGUAGES: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_localised_field_value(instance, field_name, use_get=False):\n try:\n current_language = get_language()\n default_language = settings.LANGUAGES[0][0]\n\n current_field_name = '%s_%s' % (field_name, current_language)\n default_field_name = '%s_%s' % (field_name, default_languag...
[ "0.72564465", "0.6232545", "0.6061771", "0.6037152", "0.59930974", "0.58454067", "0.5741291", "0.5723845", "0.5710129", "0.5498982", "0.5490709", "0.54545844", "0.54410774", "0.54275036", "0.5411096", "0.53789973", "0.5334559", "0.53225064", "0.5306349", "0.5301584", "0.52906...
0.7574892
0
Returns the given HTML with all tags stripped. This is a copy of django.utils.html.strip_tags, except that it adds some whitespace in between replaced tags to make sure words are not erroneously concatenated.
def _strip_tags(value): return re.sub(r'<[^>]*?>', ' ', force_unicode(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stripHTMLTags (html):\r\n import re\r\n text = html\r\n \r\n # apply rules in given order!\r\n rules = [\r\n { r'>\\s+' : u'>'}, # remove spaces after a tag opens or closes\r\n { r'\\s+' : u' '}, # replace consecutive spaces\r\n { r'\\s*<br\\s*/?>\\s*' : u'\\n'},...
[ "0.81393677", "0.81104815", "0.79820424", "0.7756733", "0.7708477", "0.76916313", "0.7668854", "0.75973123", "0.75973123", "0.75871766", "0.75851536", "0.7555502", "0.7548902", "0.7544044", "0.75279355", "0.7509415", "0.74946666", "0.74862015", "0.74829584", "0.74829584", "0....
0.67829764
53
Replaces spectral traces with their SVD transformed equivalents truncating at the nth component
def apply_svd(self, n): ## should really handle svd sensibly if we have multiple traces ## fitting multiple traces simultaneously requires they all have the ## same basis. Could pick the first trace to define the basis #svd_trace, s, self.rs_vectors = np.linalg.svd(self.traces[0], f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_smoothing():\n spec = IGRINSSpectrum(file=file)\n new_spec = spec.remove_outliers(threshold=3)\n\n assert len(new_spec.flux) > 0\n assert new_spec.shape[0] <= spec.shape[0]\n assert new_spec.shape[0] > 0\n assert new_spec.mask is not None", "def normalize(traces):\n\n start = time()...
[ "0.5761264", "0.5749155", "0.5724773", "0.5530607", "0.5521944", "0.5486506", "0.54782325", "0.5366299", "0.5365444", "0.53456056", "0.5317082", "0.5311268", "0.53095454", "0.5274362", "0.5255685", "0.52273995", "0.5148688", "0.5129812", "0.51054215", "0.5089043", "0.5089043"...
0.68789
0
Extraction of predicted spectra given concentration traces and spectral_traces
def get_spectra(self, conc_traces,spectral_trace): # linear fit of the fitted_concs to the spectra CANNOT fit intercept here! self.regressor.fit(conc_traces,spectral_trace) fitted_spectra = self.regressor.coef_ return fitted_spectra
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_traces(self, conc_traces, spectra):\n # linear fit of the fitted_concs to the spectra CANNOT fit intercept here!\n #self.regressor.fit(conc_traces,spectral_trace)\n #fitted_spectral_traces = self.regressor.predict(conc_traces)\n fitted_spectral_traces = spectra.dot(conc_traces.T...
[ "0.73953843", "0.59392315", "0.58455896", "0.5840992", "0.56691813", "0.56298405", "0.56196576", "0.56067437", "0.5575594", "0.5565665", "0.55577856", "0.5539701", "0.55241483", "0.5521413", "0.54929256", "0.54926497", "0.5449172", "0.5448283", "0.5431577", "0.54244214", "0.5...
0.72131884
1
Extraction of fitted spectral traces given concentration traces and spectral traces
def get_traces(self, conc_traces, spectra): # linear fit of the fitted_concs to the spectra CANNOT fit intercept here! #self.regressor.fit(conc_traces,spectral_trace) #fitted_spectral_traces = self.regressor.predict(conc_traces) fitted_spectral_traces = spectra.dot(conc_traces.T) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_spectra(self, conc_traces,spectral_trace):\n # linear fit of the fitted_concs to the spectra CANNOT fit intercept here!\n self.regressor.fit(conc_traces,spectral_trace)\n fitted_spectra = self.regressor.coef_\n return fitted_spectra", "def signal_spectral(signal, FS):\n # c...
[ "0.7544013", "0.6135971", "0.61327654", "0.60406107", "0.6037455", "0.60138136", "0.5927169", "0.5919424", "0.5919397", "0.58779633", "0.58650166", "0.5854092", "0.5844608", "0.58175015", "0.5817054", "0.5798176", "0.57689226", "0.5761942", "0.5754797", "0.5746217", "0.573928...
0.747247
1
Rate function for the given reaction matrix. Rows of the reaction matrix correspond reactant species Columns of the reaction correspond to product species e.g. reaction_matrix = [[0, 1, 0], [0, 0, 1], [0, 0, 0]] Corresponds to the reaction scheme A>B>C.
def dc_dt(self,C,t,K): # dc/dt built up by separately computing the positive and negative contributions. # In our example positive_dcdt = [0, k1[A], k2[B]] and negative_dcdt = [-k1[A],-k2[B],0] reaction_matrix = np.array(self.reaction_matrix,dtype=np.int) C = np.array(C) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reaction_rate (self):\n raise NotImplementedError('Subclass must implement this method')", "def recall(cMatrix):\n return cMatrix[0,0] / np.sum(cMatrix[:,0])", "def test_reaction_rate__results_03():\n rc = chemkin.ReactionRate()\n rate = rc.read_XML('./data/rxns_hw5.xml').set_temp(1500).get...
[ "0.59202105", "0.5731627", "0.5588103", "0.55504525", "0.5530202", "0.5510254", "0.548251", "0.548251", "0.53401923", "0.5269454", "0.52626663", "0.52353424", "0.5203837", "0.5200688", "0.5133107", "0.50830877", "0.5062707", "0.505948", "0.5055534", "0.50316256", "0.50177914"...
0.0
-1
Concentration function returns concentrations at the times given in t Uses odeint to integrate dc/dt using rate constants k over times t at initial concentrations c0 Implicitly uses self.dc_dt
def C(self,t,K,c0): #ode(self.dc_dt,c0,t,args=(k,)).set_integrator('lsoda') #ode(self.dc_dt,c0,t,args=(k,)).set_integrator('vode', method='bdf', order=15) # if we have any negative times we assume they occur before the # reaction starts hence all negative times are assigned con...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dc_dt(self,C,t,K):\n \n # dc/dt built up by separately computing the positive and negative contributions.\n # In our example positive_dcdt = [0, k1[A], k2[B]] and negative_dcdt = [-k1[A],-k2[B],0]\n reaction_matrix = np.array(self.reaction_matrix,dtype=np.int)\n C = np.array...
[ "0.6939089", "0.6678995", "0.6678481", "0.64412683", "0.6246044", "0.623071", "0.60813147", "0.5940947", "0.59370506", "0.59000605", "0.5868189", "0.5811064", "0.57907593", "0.5774607", "0.5751241", "0.57507056", "0.5726319", "0.57118165", "0.5708015", "0.5692963", "0.5673289...
0.8079857
0
Master error function Computes residuals for a given rate function, rate constants and initial concentrations by linearly fitting the integrated concentrations to the provided spectra. As we wish to simultaneously fit multiple data sets T and S contain multiple arrays of times and spectral traces respectively. params a...
def errfunc(self, params): K = self._get_K(params) T0 = self._get_T0(params) C0 = self._get_C0(params) OD_offset = self._get_OD_offset(params) offset_times = [t-t0 for t,t0 in zip(self.times,T0)] offset_traces = [st - od for st,od in zip(self.traces,OD_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fitRateSpectrum(Times, Data, Rates, w, Lnorm='ridge', standardizeData=True, CalcNdof=False, rho=0.5):\n\n \n if Lnorm == 'lasso':\n # Use L1-norm Lasso regression\n try:\n from scikits.learn.linear_model import Lasso \n except:\n print 'Error: could NOT import L...
[ "0.6031641", "0.60028064", "0.5769116", "0.56840014", "0.5682552", "0.5609652", "0.5597647", "0.55745053", "0.54805255", "0.5466741", "0.5466002", "0.5461182", "0.5457156", "0.54216826", "0.53635955", "0.53407264", "0.5331584", "0.52818257", "0.52758473", "0.5265389", "0.5227...
0.6964196
0
Method passed to minimize if we are debugging to print out the values of the parameters as minimisation is occuring
def printfunc(self, params, iter, resid, *args, **kwargs): print(iter) print(params.valuesdict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimize(self):\n pass", "def minimize(self):\n raise NotImplementedError", "def compute_debug(self):", "def _minimize(self, board, possible_actions, depth_limit, alpha, beta):\r\n pass", "def optimize_parameters(self):\n pass", "def optimize_parameters(self):\n pas...
[ "0.73074085", "0.6873178", "0.6683266", "0.6657617", "0.6596366", "0.6596366", "0.6596366", "0.59792906", "0.5937868", "0.5934875", "0.59060085", "0.58843315", "0.588408", "0.5879655", "0.58312917", "0.5816162", "0.5816162", "0.5798417", "0.57627344", "0.57617694", "0.5750807...
0.0
-1
If only a single set of parameters has been provided then we expand the parameters by constructing a set for each dataset
def expand_params(self): no_datasets = len(self.traces) no_species = self.reaction_matrix.shape[0] t0_keys = [key for key in self.input_params.keys() if 't0' in key] od_keys = [key for key in self.input_params.keys() if 'OD' in key] k_keys = [key for key in self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_dataset_param(self, dataset):\n if dataset is None and self.dataset is None:\n return []\n if dataset is 'all':\n dataset = ''\n if dataset is None and self.dataset is not None:\n dataset = self.dataset\n return dataset", "def expand_meta_p...
[ "0.6278451", "0.61863405", "0.61345685", "0.60741186", "0.58544976", "0.5854048", "0.5829348", "0.58233947", "0.58083564", "0.57842964", "0.5757557", "0.5747619", "0.5726513", "0.5703662", "0.57034504", "0.5681105", "0.56639737", "0.5641781", "0.56325614", "0.561404", "0.5589...
0.6242219
1
Initialises parameters for a sequential fit
def init_sequential(self, no_species): if not self.no_species is None and self.no_species != no_species: raise UserWarning('Inconsistent number of species') if not self.reaction_matrix is None: raise UserWarning('Reaction matrix already specified') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fit_params(self):\n\n self.p0 = np.array([self.A_arr, self.T_a])\n # initial guess at A_arr and T_a\n\n self.popt, self.pcov = curve_fit(\n self.get_eta_fit, self.T_exp, self.eta_exp, p0=self.p0\n )\n\n self.A_arr = self.popt[0]\n self.T_a = self.popt[1]\n\n self.T_array = s...
[ "0.6893164", "0.6695361", "0.6529452", "0.65172595", "0.64541614", "0.64108133", "0.6403849", "0.6378977", "0.63701195", "0.6362028", "0.63389206", "0.63249373", "0.6314111", "0.63132894", "0.63132894", "0.6311908", "0.62708104", "0.62270665", "0.62188524", "0.61743784", "0.6...
0.0
-1
Utility function to fit assuming a sequential reaction model Sets the reaction matrix up for a sequential model then calls the master fit() method
def fit_sequential(self, no_species, debug=False): self.init_sequential(no_species) self.fit(debug)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit():\n pass", "def fitted_model(model_data, sequential_model):\n x_train, y_train, x_val, y_val, x_test, _ = model_data\n compile_model(sequential_model)\n fitted_model = fit_model(sequential_model, 64, 1, False, x_train, y_train, x_val, y_val, x_test)\n return fitted_model", "def fit_...
[ "0.64742583", "0.6445856", "0.63966495", "0.6344927", "0.62193805", "0.6152714", "0.6093543", "0.6078134", "0.6075871", "0.60507065", "0.6024773", "0.60206896", "0.5976558", "0.5969459", "0.5966335", "0.59576577", "0.59506774", "0.59072554", "0.5899322", "0.5877998", "0.58676...
0.6447086
1
Initialises parameters for a parallel fit
def init_parallel(self, no_species): if not self.no_species is None and self.no_species != no_species: raise UserWarning('Inconsistent number of species') if not self.reaction_matrix is None: raise UserWarning('Reaction matrix already specified') self.reaction_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_fit_params(self):\n\n self.p0 = np.array([self.A_arr, self.T_a])\n # initial guess at A_arr and T_a\n\n self.popt, self.pcov = curve_fit(\n self.get_eta_fit, self.T_exp, self.eta_exp, p0=self.p0\n )\n\n self.A_arr = self.popt[0]\n self.T_a = self.popt[1]\n\n self.T_array = s...
[ "0.69897383", "0.680928", "0.67262113", "0.6669915", "0.6614294", "0.6602186", "0.6500722", "0.649278", "0.64711213", "0.6458418", "0.64311844", "0.64283663", "0.6396482", "0.63622653", "0.636004", "0.6342822", "0.63280195", "0.63226557", "0.6313498", "0.6292607", "0.62734", ...
0.0
-1
Utility function to fit assuming a parallel reaction model Sets the reaction matrix up for a parallel model then calls the master fit() method
def fit_parallel(self, no_species,debug=False): self.init_parallel(no_species) self.fit(debug)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fit(self, X, _transform=False):\n\n n_cols = X.shape[1]\n\n data = DistributedDataHandler.create(data=X, client=self.client)\n self.datatype = data.datatype\n\n if \"svd_solver\" in self.kwargs and self.kwargs[\"svd_solver\"] == \"tsqr\":\n comms = Comms(comms_p2p=True)\...
[ "0.6496851", "0.64436406", "0.63440764", "0.62476355", "0.6204807", "0.6138343", "0.6115907", "0.6078986", "0.60787815", "0.60163367", "0.59925085", "0.5985123", "0.59803116", "0.59718335", "0.5964751", "0.59567624", "0.59344", "0.59056485", "0.589933", "0.58992696", "0.58986...
0.6665549
0
Returns a Latex representation of the current reaction scheme
def tex_reaction_scheme(self): if self.reaction_matrix is None or self.input_params is None: return 'undefined' species = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' eqn = [] reactants, products = self.reaction_matrix.nonzero() for r,p,k in zip(reactan...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reaction_str(self):\n\n def format(number):\n return str(number).rstrip(\".0\") + \" \"\n\n reactant_bits = []\n product_bits = []\n for met in sorted(self._metabolites, key=attrgetter(\"id\")):\n coefficient = self._metabolites[met]\n if coefficient...
[ "0.6516189", "0.61752766", "0.6117226", "0.6117226", "0.61046225", "0.60964334", "0.60246444", "0.5972512", "0.5943637", "0.5936047", "0.5920423", "0.5911163", "0.58398604", "0.58012223", "0.57974076", "0.57868797", "0.5786228", "0.577146", "0.57446593", "0.5738029", "0.57333...
0.7731967
0
Creates sample data to load into database
def setUp(self): cwd = Path(__file__).parent.absolute() with open(f'{cwd}/test.json', 'r') as f: default = json.load(f) for data in default['results']: set_id = data.pop('set_id') products_data = data.pop('products') set_obj = Set.objects.create(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sample_data(no_of_records):\n rows_in_database = [{'id': counter, 'name': get_random_string(string.ascii_lowercase, 20), 'dt': '2017-05-03'}\n for counter in range(0, no_of_records)]\n return rows_in_database", "def setUpTestData(cls):\n call_command('loaddata', 'db....
[ "0.7618462", "0.7249078", "0.71025825", "0.7085048", "0.7083938", "0.7068347", "0.70422816", "0.6950347", "0.68991643", "0.6871878", "0.68035567", "0.6770294", "0.67098796", "0.67098796", "0.67098796", "0.67098796", "0.6701584", "0.6688565", "0.66865635", "0.6668617", "0.6666...
0.0
-1
Test creation of set in db
def test_create_set(self): obj1 = Set.objects.first() obj2 = Set.objects.last() self.assertEqual(str(obj1), obj1.id) self.assertEqual(str(obj2), obj2.id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_io_success(self):\r\n m1 = TestSetModel.create(int_set={1, 2}, text_set={'kai', 'andreas'})\r\n m2 = TestSetModel.get(partition=m1.partition)\r\n\r\n assert isinstance(m2.int_set, set)\r\n assert isinstance(m2.text_set, set)\r\n\r\n assert 1 in m2.int_set\r\n asse...
[ "0.69416434", "0.68995917", "0.6744727", "0.66820097", "0.66440153", "0.66096723", "0.6553905", "0.64886695", "0.6466538", "0.64500856", "0.64318264", "0.63216364", "0.6292189", "0.6287698", "0.6272713", "0.62361026", "0.6229549", "0.6219275", "0.621327", "0.6202346", "0.6197...
0.75687176
0
Test creation of spl in db
def test_create_spl(self): obj1 = Spl.objects.first() obj2 = Spl.objects.last() expected_str1 = f"{obj1.id} -- {obj1.set} -- {obj1.labeler}" self.assertEqual(str(obj1), expected_str1) self.assertNotEqual(str(obj2), expected_str1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create(self):\n pass", "def test_create_record(self):\n pass", "def test_create(self):\n Person.create('created_person', 'create@example.com', '125 Fake Street')\n with database() as db:\n results = db.query(\"SELECT * FROM persons WHERE person_name = 'created_pe...
[ "0.7290396", "0.7164855", "0.70358706", "0.6898995", "0.6860027", "0.6707694", "0.66566277", "0.6616834", "0.6603478", "0.65934837", "0.65929335", "0.6578616", "0.6553673", "0.6475263", "0.6431095", "0.64092445", "0.6405413", "0.6397605", "0.6389816", "0.6381485", "0.63731223...
0.67237914
5
Test creation of product in db
def test_create_product(self): obj1 = Product.objects.first() obj2 = Product.objects.last() expected_str1 = f"{obj1.code} -- {obj1.name} -- " \ f"{obj1.schedule} -- {obj1.spl}" self.assertEqual(str(obj1), expected_str1) self.assertNotEqual(str(obj2), expected_str1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_product_create(self):\n self._create_model(\"product\", self.product_data, [\"name\", \"description\", \"image_link\", \"price\"])", "def test_create(self):\n self.assertEqual(Product.objects.count(), 2)\n payload = {\n 'name': 'New product',\n 'category': self...
[ "0.84601223", "0.8094423", "0.8065334", "0.79718393", "0.7751315", "0.77269304", "0.7685652", "0.7644878", "0.7614808", "0.7580474", "0.74933785", "0.7444505", "0.74412197", "0.7417311", "0.74115133", "0.7408773", "0.73953843", "0.73321605", "0.73079616", "0.7274021", "0.7238...
0.74196386
13
Test creation of inactive ingredient in db
def test_create_inactive_ingredient(self): obj1 = InactiveIngredient.objects.first() obj2 = InactiveIngredient.objects.last() expected_str1 = f"{obj1.name} -- {obj1.unii}" self.assertEqual(str(obj1), expected_str1) self.assertNotEqual(str(obj2), expected_str1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_ingredient(self):\n\n ingredient_payload = {'name': 'Test Ingredient'}\n self.client.post(URL_INGREDIENTS, ingredient_payload)\n\n is_ingredient_created = Ingredient.objects.filter(\n user=self.user,\n name=ingredient_payload['name']\n ).exists()\n\...
[ "0.76488996", "0.75348985", "0.7447309", "0.73327684", "0.71762353", "0.71219957", "0.6925784", "0.6882997", "0.6866519", "0.68122995", "0.68054897", "0.6775812", "0.67718816", "0.67675376", "0.67643166", "0.67201257", "0.6704289", "0.6682483", "0.6682293", "0.66705", "0.6632...
0.7074623
6
Test creation of package in db
def test_create_package(self): obj1 = Package.objects.first() obj2 = Package.objects.last() expected_str1 = f"{obj1.code} -- {obj1.product}" self.assertEqual(str(obj1), expected_str1) self.assertNotEqual(str(obj2), expected_str1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_package(self):\n pass", "def test_save(self):\n pkg = make_package(factory=SQLPackage)\n self.db.save(pkg)\n count = self.sql.query(SQLPackage).count()\n self.assertEqual(count, 1)\n saved_pkg = self.sql.query(SQLPackage).first()\n self.assertEqual(saved_...
[ "0.73585474", "0.73364145", "0.72528106", "0.72395086", "0.70533574", "0.7045003", "0.6929917", "0.69233435", "0.68823296", "0.68545395", "0.6728404", "0.6692722", "0.66815156", "0.6667017", "0.66531336", "0.66418016", "0.66352665", "0.65886265", "0.6576775", "0.6570198", "0....
0.6918138
8
Try to detect the presence of the kcc tool.
def _detect(env): try: return env['KCC'] except KeyError: pass kcc = env.WhereIs('kcc', env['KCC_DIR']) if kcc: return kcc raise SCons.Errors.StopError( KccNotFound, "Could not find Kalimba C compiler (kcc.exe)")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_nvcc_available():\r\n def set_version():\r\n p_out = output_subprocess_Popen([nvcc_path, '--version'])\r\n ver_line = decode(p_out[0]).strip().split('\\n')[-1]\r\n build, version = ver_line.split(',')[1].strip().split()\r\n\r\n assert build == 'release'\r\n global nvcc_...
[ "0.6018184", "0.5991554", "0.58086854", "0.58063084", "0.5731486", "0.57303655", "0.5663401", "0.5663401", "0.55095214", "0.5506362", "0.55029947", "0.54678726", "0.54535484", "0.54263836", "0.5421077", "0.54184335", "0.5403426", "0.53653455", "0.5360666", "0.5358234", "0.535...
0.7571903
0
Add Builders and construction variables to the Environment.
def generate(env): gcc.generate(env) # Set up standard folder locations env.SetDefault(SDK_TOOLS = env['TOOLS_ROOT'] + '/tools') env.SetDefault(KCC_DIR = env['SDK_TOOLS'] + '/kcc/bin') env['KCC'] = _detect(env) env['AS'] = '$KCC' env['CC'] = '$KCC' env['OBJSUFFIX'] = '.o' env['BUI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_env(self, env):\n pass", "def build_python_environment(self):\n # build command for creating the python environment\n cmd_args = {\n 'exe': self.env_executable,\n 'cmds': \" \".join(self.env_commands),\n 'flags': \" \".join(self.env_flags),\n ...
[ "0.62251735", "0.6193408", "0.61694264", "0.6053279", "0.60429704", "0.60402143", "0.6032007", "0.6003108", "0.5964706", "0.5935372", "0.591583", "0.5880104", "0.5880104", "0.5880104", "0.5880104", "0.5880104", "0.5880104", "0.5874729", "0.58605754", "0.5760427", "0.5760427",...
0.529818
71
Builder of box sampler.
def build_sampler(cfg, **default_args): return build_from_cfg(cfg, BBOX_SAMPLERS, default_args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, box):\n self.is_hidden = False\n self.last_boxes = []\n self.best_box = None\n self.frames_undetected = 0\n self.age = 0\n self.n_frames = 10\n\n self.update(box)", "def __init__(self, *args):\n _Bnd.Bnd_Box_swiginit(self,_Bnd.new_Bnd_Box...
[ "0.6656309", "0.6314685", "0.62152916", "0.6111694", "0.5956912", "0.59178895", "0.5855898", "0.57529503", "0.5739196", "0.5715391", "0.5680769", "0.56713676", "0.56610125", "0.5658545", "0.5658545", "0.5658531", "0.56481713", "0.5646691", "0.56446224", "0.56418985", "0.56397...
0.5792929
7
load default config and update it with arguments if provided
def setup_config(args): # Set the default configuration file f = pkgutil.get_data(__package__, 'dnstap.conf') cfg = load_yaml(f) # Overwrites then with the external file ? if args.c: cfg_ext = load_yaml(open(args.c, 'r')) merge_cfg(u=cfg_ext,o=cfg) # Or searches for a file ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_default_user_configs(args):\n # Skip any imported keys from future\n import __future__ as ff\n future_keys = dir(ff)\n # Load default settings\n import pythiaplotter.default_config as dc\n default_settings = {k: getattr(dc, k) for k in dir(dc)\n if k not in future_...
[ "0.7204939", "0.7133817", "0.7069775", "0.6954889", "0.69438267", "0.69321847", "0.69108415", "0.6866273", "0.6854772", "0.68134815", "0.6661569", "0.66395104", "0.6524558", "0.65017855", "0.6491883", "0.648499", "0.647498", "0.64722943", "0.64687335", "0.64638644", "0.645244...
0.7182467
1
use to decorate a function that will print out the time it took for this function to run.
def timed(func): def inner(*args, **kwargs): start = datetime.datetime.now() result = func(*args, **kwargs) finish = datetime.datetime.now() print('\t{} - {}'.format(func.__name__, finish-start)) return result return inner
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_time(func):\n def wrapper(*args, **kwargs):\n start = time.time()\n result = func(*args, **kwargs)\n done = time.time()\n print(f\"start_time: {start}, end_time: {done}, duration: {done - start}\")\n return result\n\n return wrapper", "def timed(func):\n @wra...
[ "0.8484811", "0.83920836", "0.8362368", "0.8339548", "0.8281916", "0.82737803", "0.8254914", "0.8203537", "0.8177899", "0.81559014", "0.81279564", "0.8110341", "0.8096469", "0.80864686", "0.8054826", "0.80485725", "0.8029379", "0.80177706", "0.79745007", "0.79612505", "0.7958...
0.80998695
12
Naive approach to solving the egg drop problem recursively.
def naive_recursive(k, n): # If no floors remaining, no more attempts need to be made. if n == 0: return 0 # It will take n attempts to find the correct floor if there is only one egg remaining. if k == 1: return n # Solve the problem recursively. return min((max(naive_recursive(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, egg):", "def solve(self):\n self.left -= len(self.nodes)\n \n def depths(x,depth = 0):\n depth+=1\n for y in self.graph[x]:\n if y in self.nodes:\n self.nodes.remove(y)\n depth = depths(y,depth)\n ...
[ "0.58126837", "0.5553139", "0.51516867", "0.5146352", "0.5140429", "0.506389", "0.5049936", "0.5005331", "0.49439305", "0.49104607", "0.489988", "0.48893788", "0.4875797", "0.48725885", "0.48559326", "0.48553297", "0.4854866", "0.4805919", "0.48056465", "0.48052478", "0.48014...
0.5346863
2
Dynamic, iterative approach to solving the egg drop problem.
def dynamic_iteration(k, n): # If only one egg remains, n attempts must be made to find the correct floor. if k == 1: return n # Lookup table for previous solutions. W = [[0 for y in range(n + 1)] for x in range(k)] # Initialize the first row. for i in range(n + 1): W[0][i] = i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, egg):", "def post_solve_pig_wood(arbiter, space_obj, _):\n removed_pigs = []\n if arbiter.total_impulse.length > 700:\n pig_shape, wood_shape = arbiter.shapes\n for pig in total_pig:\n if pig_shape == pig.shape:\n pig.life -= 20\n\n if...
[ "0.5761975", "0.54290056", "0.5377224", "0.5321181", "0.5249601", "0.51657736", "0.5081823", "0.50800425", "0.50622433", "0.504122", "0.5035238", "0.5024038", "0.49913105", "0.49786785", "0.49776444", "0.4957171", "0.49419302", "0.48797897", "0.48512948", "0.48503053", "0.484...
0.50292474
11
Provide a hashed lfn from an lfn.
def getHashLfn(lfn): return hashlib.sha224(lfn).hexdigest()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _s_hash(fn, data: str):\n\n return fn(_b(data)).hexdigest()", "def generate_function_key(fn):\n return hashlib.md5(fn.func_code.co_code).hexdigest()", "def get_hash(hash_function, x: str):\n hash_function.update(x.encode())\n return int.from_bytes(hash_function.digest(), byteorder=\"big\")", ...
[ "0.6238101", "0.6153464", "0.6071181", "0.6069656", "0.6035795", "0.5960966", "0.59406644", "0.5940355", "0.58954185", "0.5881548", "0.58747935", "0.5853849", "0.5838578", "0.5833709", "0.58259416", "0.5795485", "0.5772984", "0.57470024", "0.5737209", "0.5716741", "0.57127243...
0.7909504
0