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
Agent has been selected and a grain of sand is added to it. If the cell exceeds it capacity it add's itself to the model's spill queue. The model handles distributing the spill to adjacent cells.
def step(self): self.grains += 1 if self.grains > self.spill_size: print('spill -> ', self.agent_id) self.model.spill(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spill(self, agent):\n self.spill_list.append(agent)", "def step(self):\n self.age += 1\n self.move_agent()\n self.sugar -= self.metabolism\n\n # Eat sugar\n available_sugar = self.get_sugar(self.pos).amount\n self.sugar += available_sugar\n# self.total_...
[ "0.70932084", "0.61752456", "0.6172666", "0.57589626", "0.55338156", "0.54990155", "0.5498288", "0.5404687", "0.5382121", "0.5283981", "0.5247643", "0.5209323", "0.51918066", "0.5176298", "0.5169959", "0.5154262", "0.51332146", "0.5123966", "0.5116275", "0.508177", "0.5068731...
0.70183915
1
Set the state of the agent to the next state
def advance(self): self._state = self._next_state
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_next_state(self, state):\n self.next_state = state", "def next_state(self, action):\n self.state = self.states[action][self.state]", "def go_to_next_state(self):\n pass", "def next(self):\n self.state += 1\n if self.state > 1:\n self.state = 0", "def ne...
[ "0.77334386", "0.7549452", "0.7462713", "0.7221868", "0.7030984", "0.6958567", "0.6888716", "0.6752713", "0.67414314", "0.6740218", "0.67339367", "0.6675615", "0.6600173", "0.65947825", "0.65842956", "0.658048", "0.6566541", "0.6556136", "0.65397716", "0.6539616", "0.6531275"...
0.71685076
4
Add agent to model's spill queue.
def spill(self, agent): self.spill_list.append(agent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_grid_queue(self, agent):\n self.pipes[agent.grid_queue].send(\"add\")\n self.pipes[agent.grid_queue].send(agent)", "def add_to_simulation(self,agent):\n self.agents[agent.name] = agent\n self.network.add_node(agent)\n \n #agent given a grid queue at initializa...
[ "0.7249907", "0.724359", "0.6364773", "0.6199888", "0.610778", "0.59546876", "0.59015363", "0.58994764", "0.5738974", "0.5690717", "0.5538615", "0.5536676", "0.5536676", "0.5536676", "0.5536676", "0.5536676", "0.5536676", "0.5536676", "0.5536676", "0.5536676", "0.5536676", ...
0.82388806
0
Process spill_list and advance the model one step.
def step(self): for c in self.spill_list: self._schedule.step()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self):\n\n self.grains += 1\n\n if self.grains > self.spill_size:\n print('spill -> ', self.agent_id)\n self.model.spill(self)", "def spill(self, agent):\n self.spill_list.append(agent)", "def step(self, memories):\n return", "def _preprocess(self, o...
[ "0.5933351", "0.5655595", "0.5262983", "0.5020804", "0.49819398", "0.49550286", "0.49170116", "0.4878095", "0.48729232", "0.486313", "0.48542383", "0.4846436", "0.48377305", "0.48368984", "0.48039612", "0.47895807", "0.47695318", "0.47682866", "0.47671297", "0.47658867", "0.4...
0.6663731
0
/mesa/visualization/modules/CanvasGridVisualization.py is directly accessing Model.grid
def grid(self): return self._grid
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_grid(self):\r\n return self.grid", "def grid(self) -> aa.Grid2D:\r\n return self.analysis.dataset.grid", "def grid(self):\n return self.__grid", "def grid(self):\n if hasattr(self.cls, \"grid\"):\n return self.cls.grid", "def getGrid(self):\n\n\t\t\treturn sel...
[ "0.70682144", "0.6907529", "0.68824196", "0.68298477", "0.6724462", "0.66187364", "0.6615151", "0.658515", "0.64839584", "0.6413186", "0.6411681", "0.6379451", "0.62074244", "0.6158653", "0.61133534", "0.6071972", "0.6042853", "0.6031144", "0.6021297", "0.601962", "0.5985744"...
0.68091476
4
mesa_ABM/examples_ABM/color_patches/mesa/visualization/ModularVisualization.py", line 278, in run_model
def schedule(self): return self._schedule
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n \r\n world = WorldModel()\r\n #uncomment these lines and comment out the next 2 if you want to use the\r\n #full Baxter model\r\n #print \"Loading full Baxter model (be patient, this will take a minute)...\"\r\n #world.loadElement(os.path.join(model_dir,\"baxter.rob\"))\r\n pri...
[ "0.6065024", "0.58139783", "0.57608604", "0.5726678", "0.56774104", "0.56704617", "0.56335276", "0.5604466", "0.5602456", "0.5543141", "0.55224913", "0.55002517", "0.54867035", "0.54674447", "0.54572403", "0.54383457", "0.54381377", "0.5433474", "0.5411144", "0.53975135", "0....
0.0
-1
This is the first time that the agent sees the layout of the game board. Here, we choose a path to the goal. In this phase, the agent should compute the path to the goal and store it in a local variable. All of the work is done in this method!
def registerInitialState(self, state): if self.searchFunction == None: raise Exception("No search function provided for SearchAgent") starttime = time.time() problem = self.searchType(state) # Makes a new search problem self.actions = self.searchFunction(problem) # Find a path ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculateFirstPath(self):\n rd.shuffle(self.goals)\n self.path = self.goals", "def calculateNewPath(self):\r\n\r\n\t\tnodeDict = self.simulationHandle.getMap().getNodeDict()\r\n\t\tdistDict = self.simulationHandle.getMap().getDistDict()\r\n\r\n\t\tself.pathToGoal = pathfinder.findPath(self.curr...
[ "0.71514714", "0.69542295", "0.6888776", "0.6844573", "0.6621183", "0.66102225", "0.6598708", "0.65912944", "0.6584372", "0.65817904", "0.64739156", "0.6460624", "0.64539826", "0.63936776", "0.63668495", "0.6326644", "0.6316151", "0.63078594", "0.6255218", "0.6253189", "0.624...
0.0
-1
Returns the next action in the path chosen earlier (in registerInitialState). Return Directions.STOP if there is no further action to take.
def getAction(self, state): if 'actionIndex' not in dir(self): self.actionIndex = 0 i = self.actionIndex self.actionIndex += 1 if i < len(self.actions): return self.actions[i] else: return Directions.STOP
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action(self):\n next_action = self.strategy.get_next_move(self)\n return next_action", "def get_action(self, state):\n if self.globSeq == []:\n self.globSeq = self.graphSearch(state)\n if not(self.globSeq):\n return Directions.STOP\n return sel...
[ "0.72942245", "0.703718", "0.703718", "0.6975734", "0.687244", "0.68233156", "0.6763603", "0.66571885", "0.65745246", "0.6558087", "0.6465374", "0.64216137", "0.63660026", "0.63593185", "0.621351", "0.61860585", "0.6183947", "0.6181521", "0.61599606", "0.61497635", "0.6118962...
0.701559
4
Stores the start and goal.
def __init__(self, gameState, costFn=lambda x: 1, goal=(1, 1), start=None, warn=True, visualize=True): self.walls = gameState.getWalls() self.startState = gameState.getPacmanPosition() if start != None: self.startState = start self.goal = goal self.costFn = costFn self.vi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_goal(self, goal):\r\n self.goal = goal\r\n self.start_time = self.get_current_time()", "def replanning_path(self):\n start_state = self.extract_start_state()\n goal_state = self.extract_goal_state()", "def update_goal(self):\n pass", "def goal(self, goal):\n\n ...
[ "0.6584438", "0.5886289", "0.5828094", "0.5670449", "0.5650115", "0.5611662", "0.5580858", "0.5474834", "0.547023", "0.5460961", "0.5458281", "0.5414585", "0.5401672", "0.5395571", "0.5349603", "0.5334042", "0.5330076", "0.5278849", "0.5277182", "0.5264969", "0.5221725", "0...
0.0
-1
Returns successor states, the actions they require, and a cost of 1.
def getSuccessors(self, state): successors = [] for action in [Directions.NORTH, Directions.SOUTH, Directions.EAST, Directions.WEST]: x, y = state dx, dy = Actions.directionToVector(action) nextx, nexty = int(x + dx), int(y + dy) if not self.walls[nextx][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successorStates(self, state):\r\n\r\n successors = []\r\n\r\n for action in Directions.CARDINAL:\r\n x, y = state\r\n dx, dy = Actions.directionToVector(action)\r\n nextx, nexty = int(x + dx), int(y + dy)\r\n\r\n if (not self.walls[nextx][nexty]):\r\n ...
[ "0.69858253", "0.67503315", "0.67503315", "0.6592919", "0.65374583", "0.6465142", "0.6464361", "0.6457984", "0.6457984", "0.64522135", "0.64344466", "0.6423142", "0.64227897", "0.6419713", "0.6419713", "0.6419713", "0.64137363", "0.6407583", "0.6382118", "0.6361048", "0.63566...
0.62914854
29
Returns the cost of a particular sequence of actions. If those actions include an illegal move, return 999999.
def getCostOfActions(self, actions): if actions == None: return 999999 x, y = self.getStartState() cost = 0 for action in actions: # Check figure out the next state and see whether its' legal dx, dy = Actions.directionToVector(action) x, y = int(x + dx...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCostOfActions(self, actions):\n if actions == None: return 999999\n x,y= self.getStartState()\n cost = 0\n for action in actions:\n # Check figure out the next state and see whether its' legal\n dx, dy = Actions.directionToVector(action)\n x, y = ...
[ "0.7820553", "0.7820553", "0.78143483", "0.78090173", "0.7793637", "0.778846", "0.778846", "0.778846", "0.7624677", "0.7528754", "0.7528754", "0.750788", "0.7489202", "0.7310127", "0.71119225", "0.7026165", "0.6846151", "0.6645367", "0.6599338", "0.65375865", "0.6534645", "...
0.78454506
0
Stores the walls, pacman's starting position and corners.
def __init__(self, startingGameState): self.walls = startingGameState.getWalls() self.startingPosition = startingGameState.getPacmanPosition() top, right = self.walls.height - 2, self.walls.width - 2 self.corners = ((1, 1), (1, top), (right, 1), (right, top)) for corner in self.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_walls(self):\n self.wall_list = self.get_current_map().get_layer_by_name(\"Obstacles\").sprite_list", "def update(self):\n self.center_x += self.change_x\n self.center_y += self.change_y\n\n # boundary for the sides of the screen\n if self.left < 0:\n self....
[ "0.6553407", "0.6439267", "0.6410871", "0.6165757", "0.6142492", "0.61298555", "0.61298555", "0.61263794", "0.6081006", "0.5944192", "0.5859338", "0.5857254", "0.57709366", "0.575432", "0.5740533", "0.5733998", "0.5732627", "0.569977", "0.56823653", "0.5681751", "0.5681751", ...
0.5416992
52
Returns the start state (in your state space, not the full Pacman state space)
def getStartState(self): "*** YOUR CODE HERE ***" return self.startFoodPosition # util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_start_state(self):\n util.raiseNotDefined()", "def get_start_state(self):\r\n util.raiseNotDefined()", "def getStartState(self):\n\t\tutil.raiseNotDefined()", "def getStartState(self):\n\t\tutil.raiseNotDefined()", "def getStartState(self):\n return self._start_loc", "def get...
[ "0.7900373", "0.7881272", "0.7876114", "0.7876114", "0.7836209", "0.7813632", "0.7778253", "0.7778253", "0.7778253", "0.7778253", "0.7778253", "0.7778253", "0.7778253", "0.7778253", "0.7778253", "0.774456", "0.7720636", "0.7720636", "0.7720636", "0.7720636", "0.7720636", "0...
0.73107725
56
Returns whether this search state is a goal state of the problem.
def isGoalState(self, state): "*** YOUR CODE HERE ***" # Utilizaré el método .count del grid, de manera que me contará los trues que haya. # Cuando no queden trues, ya hemos acabado. return state[1].count() == 0 # util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_goal_state(self, state):\n return self._solved_board == state.board", "def is_goal(self, state: Grid2D.State) -> bool:\n return state.agent_position in self.goals", "def is_goal(self, state):\n return state in self.goals # Optionally override this!", "def isGoalState(self, state)...
[ "0.81648874", "0.8149119", "0.804305", "0.7807305", "0.771411", "0.771411", "0.77004784", "0.77004784", "0.7656927", "0.76477385", "0.7647404", "0.75857604", "0.748599", "0.7446579", "0.74351174", "0.7385353", "0.73555815", "0.73327357", "0.7320426", "0.73087615", "0.72870225...
0.74305105
15
Returns successor states, the actions they require, and a cost of 1.
def getSuccessors(self, state): successors = [] top, right = self.walls.height - 2, self.walls.width - 2 for action in [Directions.NORTH, Directions.SOUTH, Directions.EAST, Directions.WEST]: # Add a successor state to the successor list if the action is legal # Here's a ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def successorStates(self, state):\r\n\r\n successors = []\r\n\r\n for action in Directions.CARDINAL:\r\n x, y = state\r\n dx, dy = Actions.directionToVector(action)\r\n nextx, nexty = int(x + dx), int(y + dy)\r\n\r\n if (not self.walls[nextx][nexty]):\r\n ...
[ "0.69875056", "0.6748617", "0.6748617", "0.6595867", "0.65359575", "0.64630675", "0.64619744", "0.6455761", "0.6455761", "0.6450122", "0.6432776", "0.6422064", "0.64208174", "0.64180684", "0.64180684", "0.64180684", "0.6412825", "0.64060354", "0.63809764", "0.63629216", "0.63...
0.0
-1
Returns the cost of a particular sequence of actions. If those actions include an illegal move, return 999999. This is implemented for you.
def getCostOfActions(self, actions): if actions == None: return 999999 x, y = self.startingPosition for action in actions: dx, dy = Actions.directionToVector(action) x, y = int(x + dx), int(y + dy) if self.walls[x][y]: return 999999 return len(actions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCostOfActions(self, actions):\n if actions == None: return 999999\n x, y = self.getStartState()\n cost = 0\n for action in actions:\n # Check figure out the next state and see whether its' legal\n dx, dy = Actions.directionToVector(action)\n x, y ...
[ "0.7912567", "0.7894573", "0.7894573", "0.7892286", "0.7860232", "0.7848207", "0.7843637", "0.7843637", "0.7843637", "0.77154154", "0.75512975", "0.7548826", "0.7381445", "0.71972", "0.70733166", "0.68809414", "0.6711399", "0.6657395", "0.663557", "0.66057223", "0.6591992", ...
0.75842506
11
A heuristic for the CornersProblem that you defined.
def cornersHeuristic(state, problem): corners = problem.corners # These are the corner coordinates walls = problem.walls # These are the walls of the maze, as a Grid (game.py) "*** YOUR CODE HERE ***" """ En este ejercicio me he dado cuenta de un problema de mi definición del espacio de estados: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cornersHeuristic(state, problem):\n corners = problem.corners # These are the corner coordinates\n walls = problem.walls # These are the walls of the maze, as a Grid (game.py)\n\t\n util.raiseNotDefined()", "def cornersHeuristic(state, problem):\n\n # Useful information.\n # corners = proble...
[ "0.76773816", "0.7427512", "0.73100895", "0.6543437", "0.6530663", "0.6282049", "0.61698675", "0.61315817", "0.6004433", "0.60016656", "0.5962924", "0.5940898", "0.593283", "0.5849472", "0.5847571", "0.5844245", "0.584287", "0.584087", "0.5838965", "0.58175015", "0.58063775",...
0.7329421
2
Returns the cost of a particular sequence of actions. If those actions include an illegal move, return 999999
def getCostOfActions(self, actions): x, y = self.getStartState()[0] cost = 0 for action in actions: # figure out the next state and see whether it's legal dx, dy = Actions.directionToVector(action) x, y = int(x + dx), int(y + dy) if self.walls[x][y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCostOfActions(self, actions):\n if actions == None: return 999999\n x, y = self.getStartState()\n cost = 0\n for action in actions:\n # Check figure out the next state and see whether its' legal\n dx, dy = Actions.directionToVector(action)\n x, y ...
[ "0.79198736", "0.7901613", "0.7901613", "0.78904784", "0.788902", "0.7876151", "0.7876151", "0.7876151", "0.7714509", "0.75729525", "0.75729525", "0.7536753", "0.75249106", "0.73637825", "0.7127707", "0.7030042", "0.6826243", "0.6705996", "0.66891235", "0.6635452", "0.6619968...
0.7892356
3
Your heuristic for the FoodSearchProblem goes here. This heuristic must be consistent to ensure correctness. First, try to come up with an admissible heuristic; almost all admissible heuristics will be consistent as well. If using A ever finds a solution that is worse uniform cost search finds, your heuristic is not co...
def foodHeuristic(state, problem): position, foodGrid = state "*** YOUR CODE HERE ***" """ Mi heurística consiste en hacer simplemente el máximo de las distancias reales del state a cada nodo con comida He provado diferentes heurísticas y esta es la que me expande menos nodos, aunque no es la más óp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foodHeuristic(state, problem):\n import itertools\n\n\n\n def manhattan(startPosition, targetPosition):\n xy1 = startPosition\n xy2 = targetPosition\n return abs(xy1[0] - xy2[0]) + abs(xy1[1] - xy2[1])\n\n position, foodGrid = state\n\n return len(foodGrid.asList())\n #\n ...
[ "0.83897704", "0.830523", "0.8223044", "0.6986859", "0.69107854", "0.6910324", "0.6817668", "0.67753005", "0.6737241", "0.67104596", "0.66949224", "0.66923463", "0.6692185", "0.66603684", "0.66597563", "0.66365445", "0.66059625", "0.6605135", "0.65819836", "0.6560537", "0.652...
0.85888267
0
Returns a path (a list of actions) to the closest dot, starting from gameState.
def findPathToClosestDot(self, gameState): # Here are some useful elements of the startState startPosition = gameState.getPacmanPosition() food = gameState.getFood() walls = gameState.getWalls() problem = AnyFoodSearchProblem(gameState) "*** YOUR CODE HERE ***" r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findPathToClosestDot(self, gameState):\n # Here are some useful elements of the startState\n startPosition = gameState.getPacmanPosition(self.index)\n food = gameState.getFood()\n walls = gameState.getWalls()\n problem = AnyFoodSearchProblem(gameState, self.index)\n\n\n ...
[ "0.7966998", "0.715944", "0.7031334", "0.7026767", "0.68767905", "0.6658364", "0.64656806", "0.6376818", "0.6200842", "0.6165224", "0.6043223", "0.60112387", "0.59972686", "0.59689665", "0.5964047", "0.5963518", "0.58828336", "0.5865455", "0.58330965", "0.58273715", "0.580822...
0.7227898
1
The state is Pacman's position. Fill this in with a goal test that will complete the problem definition.
def isGoalState(self, state): x, y = state[0] "*** YOUR CODE HERE ***" return self.food[x][y] # util.raiseNotDefined()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def goal_test(self, state):\n self.numbernodes += 1\n\n i = 0\n for box in state.boxes :\n for coord in self.board.positionGoal :\n if coord[0] == box.y and coord[1] == box.x : \n i+=1\n if i == 0 : return False\n i = 0\n ...
[ "0.67018145", "0.6565885", "0.6543021", "0.6499273", "0.6493787", "0.64873224", "0.6445942", "0.6436759", "0.6386426", "0.63844115", "0.6348103", "0.6292585", "0.6277623", "0.6226234", "0.6225019", "0.62167645", "0.61972904", "0.61972904", "0.61792105", "0.6155007", "0.615252...
0.59515357
41
Returns the maze distance between any two points, using the search functions you have already built. The gameState can be any game state Pacman's position in that state is ignored.
def mazeDistance(point1, point2, gameState): x1, y1 = point1 x2, y2 = point2 walls = gameState.getWalls() assert not walls[x1][y1], 'point1 is a wall: ' + str(point1) assert not walls[x2][y2], 'point2 is a wall: ' + str(point2) prob = PositionSearchProblem(gameState, start=point1, goal=point2, w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mazeDistance(point1, point2, gameState):\n x1, y1 = int(point1[0]),int(point1[1])\n x2, y2 = int(point2[0]),int(point2[1])\n walls = gameState.getWalls()\n \n assert not walls[x1][y1], 'point1 is a wall: ' + point1\n assert not walls[x2][y2], 'point2 is a wall: ' + str(point2)\n prob = Pos...
[ "0.7405596", "0.62337524", "0.6202874", "0.61033416", "0.60770017", "0.5981286", "0.5948442", "0.5916513", "0.58608997", "0.58241653", "0.5822506", "0.5700954", "0.5659414", "0.5651273", "0.56431204", "0.56091815", "0.5609093", "0.56061876", "0.5589039", "0.5576174", "0.55667...
0.7542628
1
(file open for reading) > query dictionary Read query_file and return information in the query dictionary format.
def process_query(query_file): query_data = query_file.readlines() query_dict = {} x = 1 search_dict = {} search_dict['username'] = query_data[x].strip('\n') x += 1 operation_list = [] while query_data[x] != 'FILTER\n': operation_list.append(query_data[x].strip('...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_query (file):\n\n # initialize all the dictionaries and lists we will be using\n query_data = {}\n query_data ['search'] = {'operations':[]}\n query_data ['filter'] = {}\n query_data ['present'] = {}\n\n temp = ''\n\n file.readline() # for when the file says SEARCH\n\n query_dat...
[ "0.7843726", "0.7040409", "0.6731658", "0.6676415", "0.65146685", "0.62667567", "0.62590575", "0.6256823", "0.6215728", "0.62133837", "0.61976427", "0.6147864", "0.61316043", "0.61125714", "0.60755527", "0.6060231", "0.6012341", "0.6004686", "0.59304434", "0.5879766", "0.5842...
0.80009
0
(dict, list, str, int) > dict Return a dict with key filter_type of query_data given the index.
def filter_format(filter_dict, query_data, filter_type, index): filter_list = '' count = 0 while query_data[index] != 'PRESENT\n': if filter_type in query_data[index]: count += 1 filter_keyword = query_data[index].strip(filter_type) fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __index_data_body(index, doc_type, doc_id, source):\n\n index_data = {\n \"_index\": index,\n \"_type\": doc_type,\n \"_id\": doc_id,\n \"_source\": source\n }\n\n return index_data", "def fetch_querydict(self):\n query = dict()\n ...
[ "0.5705551", "0.5667574", "0.5598227", "0.55603284", "0.5518409", "0.5467773", "0.54619396", "0.54030484", "0.53398377", "0.532923", "0.5268471", "0.5182582", "0.5160404", "0.51402986", "0.51049006", "0.508951", "0.5088857", "0.5058746", "0.50552565", "0.50269693", "0.5026853...
0.65318596
0
(Twitterverse dictionary, str) > list of str Return a list of all users following twitter_name in twitter_dict. >>> twitter_file = open('data.txt', 'r') >>> twitter_dictionary = process_data(twitter_file) >>> all_followers(twitter_dictionary, 'NicoleKidman') ['PerezHilton', 'q', 'p', 'tomCruise'] >>> twitter_file = ope...
def all_followers(twitter_dict, twitter_name): following_list = [] for user in twitter_dict: f_list = twitter_dict[user]['following'] if twitter_name in f_list: following_list.append(user) return following_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_followers (twitter_data, username):\n\n # initialize\n followers = []\n\n for key in twitter_data: # go through every username in twitter_data\n if username in twitter_data [key]['following']: # check each 'following'\n followers.append (key)\n\n followers.sort() # sort the li...
[ "0.83895", "0.7141314", "0.680105", "0.6771905", "0.6646324", "0.66039145", "0.6573563", "0.6453545", "0.644731", "0.63955975", "0.62907255", "0.62907255", "0.62907255", "0.62907255", "0.6255389", "0.6255389", "0.6255389", "0.62464976", "0.6245325", "0.620537", "0.6181806", ...
0.8723968
0
(Twitterverse dictionary, search specification dictionary) > list of str Return a list of users from twitter_dict that fit the specification declared by search_dict. >>> data_file = open('data.txt', 'r') >>> twitter_dict = process_data(data_file) >>> query_file = open('query3.txt', 'r') >>> query_dict = process_query(q...
def get_search_results(twitter_dict, search_dict): search_list = [search_dict['username']] search_specified_list = [] for user in search_list: search_users_list = [user] for operation in search_dict['operations']: search_users_list = search_helper(search_user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filter_results(twitter_dict, username_list, filter_dict):\r\n twitter_handles = username_list \r\n name_filtered_list = []\r\n upper_user = []\r\n \r\n if 'name_includes' in filter_dict: \r\n for user in twitter_handles: \r\n user = user.upper()\r\n upper_user.ap...
[ "0.67444634", "0.63622165", "0.61439055", "0.5823485", "0.57738215", "0.56694967", "0.56202865", "0.561638", "0.5604377", "0.55924684", "0.557445", "0.552582", "0.5494284", "0.5484312", "0.5452842", "0.53725946", "0.5361354", "0.5322175", "0.5318818", "0.5298553", "0.5283197"...
0.7901854
0
(list of str, str, twitterverse dictionary) > list of str Return the list of users that result from operation having applied to name_list from the twitter_dict. >>> data_file = open('data.txt', 'r') >>> twitter_dict = process_data(data_file) >>> query_file = open('query3.txt', 'r') >>> query_dict = process_query(query_...
def search_helper(name_list, operation, twitter_dict): return_list = [] for name in name_list: if operation == 'following': search_specified_list = twitter_dict[name]['following'] for following_names in search_specified_list: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_search_results(twitter_dict, search_dict):\r\n\r\n search_list = [search_dict['username']] \r\n search_specified_list = []\r\n\r\n for user in search_list:\r\n search_users_list = [user]\r\n \r\n for operation in search_dict['operations']:\r\n search_users_list = se...
[ "0.7890037", "0.7527938", "0.7475859", "0.7460602", "0.6427471", "0.5894421", "0.5808291", "0.57747966", "0.576515", "0.5687546", "0.56544125", "0.5608119", "0.55629736", "0.55307204", "0.54812115", "0.5464305", "0.5451584", "0.5441889", "0.54186994", "0.5417747", "0.540404",...
0.83645403
0
(Twitterverse dictionary, list of str, filter specification dictionary) > list of str >>> data_file = open('data.txt', 'r') >>> twitter_dict = process_data(data_file) >>> query_file = open('query2.txt', 'r') >>> query_dict = process_query(query_file) >>> username_list = get_search_results(twitter_dict, search_dict) >>>...
def get_filter_results(twitter_dict, username_list, filter_dict): twitter_handles = username_list name_filtered_list = [] upper_user = [] if 'name_includes' in filter_dict: for user in twitter_handles: user = user.upper() upper_user.append(user) n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_filter_results (twitter_data, search_list, filter_data):\n\n #initialize\n filter_list = []\n\n for operation in filter_data:\n if operation == 'name-includes':\n for username in search_list:\n # since case doesnt matter, eveything is made uppercase and\n ...
[ "0.7434036", "0.68169296", "0.63130534", "0.63128114", "0.6289486", "0.6159073", "0.61330956", "0.60395426", "0.6004611", "0.600197", "0.5982023", "0.59766793", "0.59600365", "0.59467745", "0.582324", "0.58030814", "0.5769613", "0.576816", "0.5756492", "0.5753108", "0.5703192...
0.76796806
0
(Twitterverse dictionary, list of str, presentation specification dictionary) > str Return final_list of users from twitter_dict in the order and format as indicated by present_dict. >>> data_file = open('data.txt', 'r') >>> twitter_dict = process_data(data_file) >>> query_file = open('query2.txt', 'r') >>> query_dict ...
def get_present_string(twitter_dict, final_list, present_dict): if present_dict['sort-by'] == 'username': tweet_sort(twitter_dict, final_list, username_first) if present_dict['sort-by'] == 'name': tweet_sort(twitter_dict, final_list, name_first) if present_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_present_string (twitter_data, filter_list, present_data):\n\n #initialize\n present_string = ''\n present_list = filter_list\n\n if present_data ['sort-by'] == 'username':\n tweet_sort (twitter_data, present_list, username_first)\n\n elif present_data ['sort-by'] == 'name':\n t...
[ "0.7329098", "0.6643551", "0.6021003", "0.5802761", "0.56354165", "0.5613348", "0.5397948", "0.5390319", "0.538293", "0.53705984", "0.5061108", "0.5039742", "0.50106114", "0.49880728", "0.4931404", "0.4930936", "0.49084416", "0.48675862", "0.48386815", "0.48338753", "0.483336...
0.77881116
0
(Twitterverse dictionary, list of str, function) > NoneType Sort the results list using the comparison function cmp and the data in twitter_data. >>> twitter_data = {\
def tweet_sort(twitter_data, results, cmp): # Insertion sort for i in range(1, len(results)): current = results[i] position = i while position > 0 and cmp(twitter_data, results[position - 1], current) > 0: results[position] = results[position - 1] pos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tweet_sort(twitter_data, results, cmp):\n\n # Insertion sort\n for i in range(1, len(results)):\n current = results[i]\n position = i\n while position > 0 and cmp(twitter_data, results[position - 1], current) > 0:\n results[position] = results[position - 1]\n po...
[ "0.7567489", "0.650274", "0.6290785", "0.62436324", "0.623184", "0.61069995", "0.60515857", "0.59873897", "0.5878488", "0.5872183", "0.58214015", "0.58214015", "0.57846797", "0.5771403", "0.5755637", "0.57172424", "0.5692742", "0.56895584", "0.56837285", "0.56682867", "0.5616...
0.76030976
0
(Twitterverse dictionary, str, str) > int Return 1 if user a has more followers than user b, 1 if fewer followers, and the result of sorting by username if they have the same, based on the data in twitter_data. >>> twitter_data = {\
def more_popular(twitter_data, a, b): a_popularity = len(all_followers(twitter_data, a)) b_popularity = len(all_followers(twitter_data, b)) if a_popularity > b_popularity: return -1 if a_popularity < b_popularity: return 1 return username_first(twitter_data, a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def more_popular(twitter_data, a, b):\n\n a_popularity = len(all_followers(twitter_data, a))\n b_popularity = len(all_followers(twitter_data, b))\n if a_popularity > b_popularity:\n return -1\n if a_popularity < b_popularity:\n return 1\n return username_first(twitter_data, a, b)", "...
[ "0.7528208", "0.69588375", "0.66971797", "0.65298504", "0.6497349", "0.6357412", "0.63211817", "0.6200824", "0.61589175", "0.61370516", "0.61224115", "0.61210734", "0.60854435", "0.6016705", "0.60084724", "0.59806305", "0.5883615", "0.58259416", "0.57227236", "0.5703999", "0....
0.7497807
1
(Twitterverse dictionary, str, str) > int Return 1 if user a has a username that comes after user b's username alphabetically, 1 if user a's username comes before user b's username, and 0 if a tie, based on the data in twitter_data. >>> twitter_data = {\
def username_first(twitter_data, a, b): if a < b: return -1 if a > b: return 1 return 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username_first(twitter_data, a, b):\n\n if a < b:\n return -1\n if a > b:\n return 1\n return 0", "def name_first(twitter_data, a, b):\n\n a_name = twitter_data[a][\"name\"]\n b_name = twitter_data[b][\"name\"]\n if a_name < b_name:\n return -1\n if a_name > b_name:\...
[ "0.7257887", "0.7018444", "0.69511354", "0.65835136", "0.6546135", "0.6383048", "0.5989066", "0.5976186", "0.565109", "0.56353337", "0.5623372", "0.56220394", "0.56099427", "0.55019134", "0.5429901", "0.5400648", "0.52955055", "0.5273156", "0.527068", "0.5203552", "0.5171498"...
0.7232197
1
(Twitterverse dictionary, str, str) > int Return 1 if user a's name comes after user b's name alphabetically, 1 if user a's name comes before user b's name, and the ordering of their usernames if there is a tie, based on the data in twitter_data. >>> twitter_data = {\
def name_first(twitter_data, a, b): a_name = twitter_data[a]["name"] b_name = twitter_data[b]["name"] if a_name < b_name: return -1 if a_name > b_name: return 1 return username_first(twitter_data, a, b)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name_first(twitter_data, a, b):\n\n a_name = twitter_data[a][\"name\"]\n b_name = twitter_data[b][\"name\"]\n if a_name < b_name:\n return -1\n if a_name > b_name:\n return 1\n return username_first(twitter_data, a, b)", "def username_first(twitter_data, a, b):\n\n if a < b:\n...
[ "0.7261839", "0.6815641", "0.67782587", "0.65419745", "0.6481994", "0.6463288", "0.62870765", "0.6256376", "0.5890704", "0.5813191", "0.5721417", "0.57102513", "0.5625274", "0.55444145", "0.5516707", "0.55118585", "0.5480974", "0.5467732", "0.5466456", "0.5454952", "0.5449887...
0.723645
1
similar to euclidean_mean_distance but with different parameters and meaning
def euclidean_distance(self, point): mean = self.mean() dist = euclidean(mean, point) radius = self.radius * self.distance_factor() if radius == 0.0: # corner case: the ball consists of a single point only # distance is defined as > 1 for flat dimensions unless po...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _dist(x, y):\n return np.sqrt(np.mean(np.square(x - y)))", "def dist(mean, example):\n return np.linalg.norm(example.row - mean)", "def _calculate_mean_distance_theoretical(self):\n\t\tx_mean_distance = 0\n\t\tx_vals,prob_vals = self.tuple_of_probabilities\n\t\tfor i in range(len(x_vals)):\n\t\t\tx_v...
[ "0.67453414", "0.67426956", "0.6655829", "0.6623442", "0.6519455", "0.65169704", "0.64831185", "0.6479274", "0.6475939", "0.6420653", "0.6352085", "0.63425595", "0.6339648", "0.63304144", "0.6301134", "0.62871855", "0.62703985", "0.62633747", "0.62022936", "0.6182767", "0.618...
0.0
-1
Func that get the appropriate table by the message that we get
def get_table_by_text(text: str) -> Dict[str, str]: for morse_table in MORSE_TABLES: letter_to_check = _get_first_letter_in_text(text) if letter_to_check.upper() in morse_table.keys(): return morse_table if letter_to_check in morse_table.values(): return MORSE_EN_CODE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_table(table_type):\n if table_type == 'chaining':\n return chaining()\n elif table_type == 'probing':\n return probing()\n elif table_type == 'probing2':\n return probing(probe=2)\n else:\n return robinhood()", "def get_table(new_arr, types, titles):\n try:\n ...
[ "0.6598475", "0.6046571", "0.6041634", "0.58675545", "0.5861172", "0.57853436", "0.5702748", "0.5686857", "0.56158406", "0.56112516", "0.55846083", "0.5560058", "0.5524576", "0.5524576", "0.551431", "0.5511044", "0.5503505", "0.55027205", "0.54950345", "0.5490587", "0.5407383...
0.5371161
22
Get the first letter in the message from user if it is not an alpha
def _get_first_letter_in_text(text: str) -> str: for letter in text: if letter.isalpha(): return letter return text[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_message(message):\n alphabet = ''\n for i in range(len(message)):\n if message[i].isalpha():\n alphabet = alphabet + message[i].upper()\n return alphabet\n # Will obtain a str that will only contain alphabets that are uppercase.", "def Prints_single_letter_string_when_tryi...
[ "0.7021727", "0.69095814", "0.6808512", "0.67910373", "0.6768156", "0.6737975", "0.67040485", "0.66168314", "0.65995246", "0.65331924", "0.6513524", "0.64735717", "0.6369872", "0.6368524", "0.63524103", "0.6332107", "0.6301702", "0.6275444", "0.6264006", "0.6255922", "0.62482...
0.77461845
0
Function called when plugin is created. No data should be set to Provider in this function because Location don't have to provide valid location data yet.
def init(): global PLUGIN_NAME PLUGIN_NAME = inspect.currentframe().f_code.co_filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, location):\n self.location = location", "def location_callback(self,msg):\n self.location = msg.data", "def __init__(self, location, latitude, longitude, *args, **kwargs):\n super().__init__(*args, **kwargs)\n self.location = location\n self.latitude = lati...
[ "0.6313835", "0.6262843", "0.62485856", "0.61801076", "0.6073936", "0.60558265", "0.6055061", "0.6036741", "0.5996565", "0.5970159", "0.5897557", "0.5896188", "0.57455975", "0.57201284", "0.570606", "0.56932735", "0.5686622", "0.5674247", "0.5652441", "0.5621614", "0.55897707...
0.0
-1
Called when plugin data are requested. When this function is called, Location data are valid. In this function should be set data for provider. Data are set with Provider.serProperty(pluginName, key, value) method. This method can by called multiple times, all keys are added to this plugin datasource. At the end, when ...
def request(): Provider.setProperty(PLUGIN_NAME, "Hello!", "You are in %s." % Location.getCity()) Provider.done(PLUGIN_NAME)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_plugin_data(self, plugin_data):\n self.plugin_data = plugin_data", "def load_plugin_data(self, data):\n return", "def plugin_data(self) -> global___SummaryMetadata.PluginData:", "def save_plugin_data(self):\n return", "def onRefreshPluginData(self, plugin_name, data):\n ...
[ "0.661341", "0.6536815", "0.60909444", "0.59573627", "0.5681677", "0.56695366", "0.56579214", "0.5650003", "0.56410986", "0.56398", "0.5607061", "0.5585324", "0.5378627", "0.53782827", "0.5350443", "0.53449184", "0.5344845", "0.5332154", "0.53285", "0.53275234", "0.53275234",...
0.0
-1
Convert a Composer checkpoint to a pretrained HF checkpoint folder. Write a ``config.json`` and ``pytorch_model.bin``, like
def write_huggingface_pretrained_from_composer_checkpoint( checkpoint_path: Union[Path, str], output_path: Union[Path, str], output_precision: str = 'fp32', local_checkpoint_save_location: Optional[Union[Path, str]] = None ) -> Tuple[PretrainedConfig, Optional[PreTrainedTokenizerBase]]: dtype = { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_checkpoint(huggingface_model_name_or_path, output_path):\n output_dir, _ = os.path.split(output_path)\n tf.io.gfile.makedirs(output_dir)\n\n huggingface_bert_model, huggingface_bert_config = _get_huggingface_bert_model_and_config(\n huggingface_model_name_or_path)\n encoder = _create_fffner_mo...
[ "0.6353711", "0.6301693", "0.63011956", "0.610833", "0.6077828", "0.59906185", "0.59823364", "0.59694815", "0.5962135", "0.5917442", "0.59148014", "0.5914448", "0.5885656", "0.58622265", "0.5843601", "0.5778996", "0.5778468", "0.57622725", "0.5746577", "0.57425416", "0.573442...
0.66567194
0
Generate a complex layout report with simple elements
def gen_report_complex_no_files() -> dp.Report: select = dp.Select(blocks=[md_block, md_block], type=dp.SelectType.TABS) group = dp.Group(md_block, md_block, columns=2) return dp.Report( dp.Page( blocks=[ dp.Group(md_block, md_block, columns=2), dp.Select...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_layout(self):\n\n pass", "def create_layout( self ):", "def display_reports(self, layout): # pylint: disable=arguments-differ", "def create_html_layout(self):\n page = \"\"\"<!DOCTYPE html>\n <!doctype html>\n <html lang=\"en\">\n <head>\n <meta c...
[ "0.69769275", "0.6473278", "0.63054246", "0.60292476", "0.59565306", "0.5911801", "0.5869038", "0.5819134", "0.57823735", "0.5755476", "0.57442385", "0.56819475", "0.56775093", "0.5628919", "0.56264186", "0.5593363", "0.5590153", "0.5521933", "0.55100393", "0.5480658", "0.543...
0.67525214
1
Test case unused atm
def __test_gen_report_id_check(): # all fresh report = dp.Report(md_block, md_block, md_block) assert_report(report) # expected_id_count=5) # 2 fresh report = dp.Report(md_block, md_block_id, md_block) assert_report(report) # expected_id_count=4) # 0 fresh report = dp.Report(md_block_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test(self):\n pass", "def _test(self):\n pass", "def _test(self):\n pass", "def test_4_4_1_1(self):\n pass", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def _test(self):", "def test(self):\n pass", "def test(self):\n ...
[ "0.78134644", "0.78134644", "0.78134644", "0.7711441", "0.76790416", "0.76790416", "0.76790416", "0.76790416", "0.76790416", "0.7488815", "0.7460914", "0.7328567", "0.71997136", "0.71704173", "0.7143496", "0.70497507", "0.70497507", "0.7022566", "0.7022566", "0.69937253", "0....
0.0
-1
Test TextReport API and id/naming handling
def test_textreport_gen(): s_df = gen_df() # Simple report = dp.TextReport("Text-3") assert_text_report(report, 1) # multiple blocks report = dp.TextReport("Text-1", "Text-2", s_df) assert_text_report(report, 3) # empty - raise error with pytest.raises(DPError): report = d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_basic_usage(self):\n self._test_reports_helper({}, [\"report.txt\"])", "def run_test_ner():\n # This note is a fake report\n\n text = \"\"\"\nRecord date: 2063-12-13\n\n\n\n\nNAME: Doe, Jane \nMRN: 98765432\n\nThe patient is here as a walk-in. Her spouse is present.\n\nPatient sa...
[ "0.61058956", "0.59754026", "0.59663147", "0.5875179", "0.5820495", "0.5816298", "0.5780176", "0.56849706", "0.5683433", "0.56673104", "0.56545895", "0.5620811", "0.55447906", "0.552769", "0.5513816", "0.55067", "0.54996467", "0.549786", "0.54872155", "0.5484214", "0.5477892"...
0.63549286
0
| Indicates if SofortBank could estabilish if the transaction could successfully be processed. 0 You should wait for the transaction to be reported as paid before shipping any goods. 1 You can ship the goods. In case the transaction is not reported as paid you can initiate a claims process with SofortBank.
def security_indicator(self): return self.__security_indicator
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_succeeded(self):\n return self.transaction_result == TERMINAL_PAYMENT_SUCCESS", "def get_success_flag(self):\n return True", "def is_success(self):\n return self.type_id == STATE_SUCCESS", "def task_success(self, ref2goal=True):\n # for sit in list(turn_data['final_goal_st...
[ "0.66063505", "0.6404131", "0.638745", "0.63153917", "0.6293099", "0.6174246", "0.614074", "0.6126725", "0.60886395", "0.6074187", "0.606531", "0.60510194", "0.6040676", "0.6032343", "0.6032343", "0.6019132", "0.5954168", "0.5939761", "0.5916004", "0.58997816", "0.58165276", ...
0.0
-1
Set required and widgets for fields.
def __init__(self, *args, **kwargs): super(SignupForm, self).__init__(*args, **kwargs) self.fields['email'].required = True self.fields['first_name'].required = True self.fields['password'].widget = forms.PasswordInput() for field in self.fields: self.fields[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n placeholders = {\n \"first_name\": \"First Name\",\n \"last_name\": \"Last Name\",\n \"default_phone_num\": \"Phone Number\",\n \"default_passport_num\": \"Passport Number\",\n ...
[ "0.6541632", "0.6453019", "0.6182293", "0.613699", "0.61324316", "0.61182314", "0.611023", "0.6102259", "0.6014309", "0.5993374", "0.5987304", "0.59669083", "0.59576404", "0.59438926", "0.59405667", "0.59002674", "0.58811474", "0.5862535", "0.58578044", "0.58545446", "0.58465...
0.6483126
1
Validate if email is already used by other user.
def clean_email(self): email = self.cleaned_data['email'].lower() if User.objects.filter(email__iexact=email).exists(): raise ValidationError(_('A user with that email already exists.')) return email
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_email(self, email):\n if email.data != current_user.email:\n user = User.query.filter_by(email=email.data).first()\n if user:\n raise ValidationError('That email already exists. Please choose another email.')", "def clean_email(self):\n try:\n ...
[ "0.7807831", "0.7748905", "0.7703968", "0.77026623", "0.7623712", "0.76225734", "0.75870395", "0.75870395", "0.7544878", "0.75052977", "0.7495125", "0.7474632", "0.7456973", "0.7412911", "0.738862", "0.7304129", "0.729272", "0.7292294", "0.7270725", "0.72010756", "0.71731097"...
0.71971816
20
Validate password with settings constraints.
def clean_password(self): password = self.cleaned_data.get('password') password_validation.validate_password(self.cleaned_data.get('password'), self.instance) return password
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_password(self, value):\n policy = PasswordPolicy.from_names(\n length=8, # min length: 8\n uppercase=1, # need min. 1 uppercase letter\n numbers=1, # need min. 1 digit\n special=1, # need min. 1 special characters\n nonletters=1,\n ...
[ "0.7843949", "0.78396183", "0.76012516", "0.754959", "0.75224483", "0.74456346", "0.7356819", "0.7329701", "0.729943", "0.7290045", "0.7280439", "0.7245891", "0.7228651", "0.7214994", "0.7207353", "0.7188498", "0.7177668", "0.71768767", "0.7148098", "0.7129629", "0.7114455", ...
0.69429576
31
Set email and password for new user.
def save(self, commit=True): user = super(SignupForm, self).save(commit=False) user.email = self.cleaned_data.get('email') user.username = self.cleaned_data.get('email') user.set_password(self.cleaned_data['password']) if commit: user.save() return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password, **extra_fields):\n\n email = self.normalize_email(email)\n #username = self.model.normalize_username(username)\n user = self.model( email=email, **extra_fields)\n user.set_password(password)\n user.save(using=self._db)\n return user"...
[ "0.766087", "0.7580593", "0.75752753", "0.7525016", "0.7522465", "0.7521504", "0.75023276", "0.74982846", "0.7490862", "0.74790376", "0.74702173", "0.74702173", "0.74702173", "0.7445269", "0.74423265", "0.74345076", "0.7434215", "0.7425774", "0.7410549", "0.73849636", "0.7378...
0.7396652
19
Set required and widgets for fields.
def __init__(self, *args, **kwargs): super(ProfileForm, self).__init__(*args, **kwargs) for field in self.fields: self.fields[field].widget.attrs.update( { 'class': 'form-control', } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n placeholders = {\n \"first_name\": \"First Name\",\n \"last_name\": \"Last Name\",\n \"default_phone_num\": \"Phone Number\",\n \"default_passport_num\": \"Passport Number\",\n ...
[ "0.6541632", "0.6483126", "0.6453019", "0.6182293", "0.613699", "0.61324316", "0.61182314", "0.611023", "0.6102259", "0.6014309", "0.5993374", "0.5987304", "0.59669083", "0.59576404", "0.59438926", "0.59405667", "0.59002674", "0.58811474", "0.5862535", "0.58578044", "0.585454...
0.57386833
26
Set required and widgets for fields.
def __init__(self, *args, **kwargs): super(CustomAuthenticationForm, self).__init__(*args, **kwargs) for field in self.fields: self.fields[field].widget.attrs.update( { 'class': 'form-control', } )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, *args, **kwargs):\n super().__init__(*args, **kwargs)\n placeholders = {\n \"first_name\": \"First Name\",\n \"last_name\": \"Last Name\",\n \"default_phone_num\": \"Phone Number\",\n \"default_passport_num\": \"Passport Number\",\n ...
[ "0.6541632", "0.6483126", "0.6453019", "0.6182293", "0.613699", "0.61324316", "0.61182314", "0.611023", "0.6102259", "0.6014309", "0.5993374", "0.5987304", "0.59669083", "0.59576404", "0.59438926", "0.59405667", "0.59002674", "0.58811474", "0.5862535", "0.58578044", "0.585454...
0.5717068
27
Create the sh script for starting unblur
def create_sh_script( unblur_path, input_image, output_dir, input_dir, input_suffix, options ): strSh = '' # To make sure it is a bash script strSh += '#!/bin/bash\n\n' # Export number of threads strSh += 'export OMP_NUM_THREADS={:d}\n'.forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n parser = make_arg_parser()\n if len(sys.argv) == 1:\n parser.print_help()\n sys.exit(1)\n args = parser.parse_args()\n deblur_transcripts(args.input, args.cds_fa, args.vblur, args.output)", "def launchgui(image):\n from filter import launch\n launch(image)", "def r...
[ "0.6045751", "0.54544467", "0.5439029", "0.534224", "0.53305626", "0.5258778", "0.52516085", "0.5213264", "0.5197605", "0.51781684", "0.51781684", "0.51781684", "0.51781684", "0.51781684", "0.51781684", "0.51781684", "0.51781684", "0.51781684", "0.51781684", "0.51781684", "0....
0.6334928
0
Creates a dictionary that maps domains to encoded ids.
def _get_domain_mappings(domain_to_intents: Dict) -> Dict: domain2id = {} domains = list(domain_to_intents) for index, domain in enumerate(domains): domain2id[domain] = index return domain2id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_intent_mappings(domain_to_intents: Dict) -> Dict:\n domain_to_intent2id = {}\n for domain in domain_to_intents:\n intent_labels = {}\n for index, intent in enumerate(domain_to_intents[domain]):\n intent_labels[intent] = index\n domain_to_intent...
[ "0.68493307", "0.6190228", "0.6138264", "0.6116921", "0.61143875", "0.59695417", "0.5882584", "0.58567834", "0.5835327", "0.58119893", "0.5768381", "0.5751803", "0.5672121", "0.56632924", "0.564285", "0.56324285", "0.5624405", "0.56145364", "0.5583475", "0.557813", "0.556828"...
0.7636259
0
Creates a dictionary that maps intents to encoded ids.
def _get_intent_mappings(domain_to_intents: Dict) -> Dict: domain_to_intent2id = {} for domain in domain_to_intents: intent_labels = {} for index, intent in enumerate(domain_to_intents[domain]): intent_labels[intent] = index domain_to_intent2id[domain]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_intent_token_dict(intents, intent_split_symbol):\r\n\r\n distinct_tokens = set([token\r\n for intent in intents\r\n for token in intent.split(\r\n intent_split_symbol)])\r\n return {token: i...
[ "0.6695217", "0.64867634", "0.6394871", "0.60963374", "0.59980714", "0.5829211", "0.5791798", "0.57791173", "0.56940323", "0.5672877", "0.56094426", "0.5583357", "0.55793476", "0.55350786", "0.5458744", "0.5416988", "0.538743", "0.5383223", "0.5371814", "0.53664494", "0.53332...
0.7101111
0
Generates index mapping for entity labels in an application. Supports both BIO and BIOES tag schemes.
def _get_entity_mappings(query_list: ProcessedQueryList) -> Dict: entity_labels = set() logger.info("Generating Entity Labels...") for d, i, entities in zip( query_list.domains(), query_list.intents(), query_list.entities() ): if len(entities): for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label_map_gen(df_main):\n # Function to flatten a list of list\n flatten = lambda l: [item for sublist in l for item in sublist]\n labels = list(set(flatten([l.split(' ') for l in df_main['tags'].values])))\n\n # Create list of labels\n label_map = {l: i for i, l in enumerate(labels)}\n retur...
[ "0.6224174", "0.59211826", "0.58924776", "0.57814723", "0.5704783", "0.56490207", "0.5625467", "0.56178284", "0.54621464", "0.5448301", "0.5429293", "0.5419123", "0.5365201", "0.5340245", "0.53379524", "0.53297305", "0.52976096", "0.5295537", "0.5263942", "0.52478415", "0.523...
0.5245018
20
Creates a class label for a set of queries. These labels are used to split queries by type. Labels follow the format of "domain" or "domain|intent". For example, "date|get_date".
def get_class_labels( tuning_level: list, query_list: ProcessedQueryList ) -> List[str]: if TuneLevel.INTENT.value in tuning_level: return [ f"{d}.{i}" for d, i in zip(query_list.domains(), query_list.intents()) ] else: return [f"{d}" for d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_label(termtype, timeperiod):\n label = 'Graph these comma-separated noun phrases (yearly frequencies):' if termtype == 'Noun phrases' and timeperiod == 'Yearly' \\\n else 'Graph these comma-separated noun phrases (monthly frequencies):' if termtype == 'Noun phrases' and timeperiod == 'Monthly...
[ "0.6051387", "0.5911016", "0.58429545", "0.5480097", "0.54685163", "0.5401774", "0.5383226", "0.5366071", "0.5278606", "0.5277043", "0.5194852", "0.5194105", "0.51914555", "0.51535213", "0.5120259", "0.5098108", "0.50675786", "0.5051951", "0.50454336", "0.50446814", "0.503565...
0.62765896
0
Creates a label map.
def create_label_map(app_path, file_pattern): resource_loader = ResourceLoader.create_resource_loader(app_path) query_tree = resource_loader.get_labeled_queries(label_set=file_pattern) return LabelMap(query_tree)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_labels_and_mapping(self, labels, mapping):\n numbered_classes = list(enumerate(list(labels), start=0))\n if mapping:\n new_mapping = {number: str(mapping[label]) for number, label in numbered_classes}\n else:\n new_mapping = {number: str(label) for number, lab...
[ "0.7576466", "0.74621993", "0.73188335", "0.71555984", "0.7096146", "0.6969032", "0.6945365", "0.69231826", "0.6836402", "0.68079114", "0.68001956", "0.67257994", "0.65746284", "0.65047145", "0.6429039", "0.6415675", "0.63368577", "0.627749", "0.6263282", "0.62631065", "0.625...
0.64313173
14
This class loads data as processed queries from a specified log file.
def __init__(self, app_path: str, tuning_level: list, log_file_path: str): self.app_path = app_path self.tuning_level = tuning_level self.log_file_path = log_file_path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(logFile):\n pass #TODO", "def _ProcessLog(self, log_processor, logfile): # pylint: disable=R0201\n for line in open(os.path.join(self.data_directory, logfile)):\n log_processor.ProcessLine(line)", "def process_log_file(cur, filepath):\n \n # open log file\n df = pd.read_json(fil...
[ "0.6776109", "0.6508564", "0.64269346", "0.63747877", "0.6232887", "0.6207779", "0.60483116", "0.6015258", "0.6014473", "0.598701", "0.59513843", "0.5894735", "0.5886366", "0.58820903", "0.5859833", "0.58380693", "0.5823934", "0.58144087", "0.5813929", "0.58069664", "0.579026...
0.0
-1
Removes duplicates in the text queries.
def deduplicate_raw_text_queries(log_queries_iter) -> List[str]: return list(set(q for q in log_queries_iter))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _remove_duplicates(self):\n self.search_query = remove_duplicates(self.search_query)", "def remove_duplicates(self, hits):\n\t\tseen = set()\n\t\tkeep = []\n\n\t\tfor i in range(len(hits)):\n\t\t\tif hits[i][\"Text\"] not in seen:\n\t\t\t\tseen.add(hits[i][\"Text\"])\n\t\t\t\tkeep.append(hits[i])\n\n\...
[ "0.7845041", "0.6695697", "0.6653341", "0.65625846", "0.639675", "0.6349758", "0.6328951", "0.6103831", "0.6063389", "0.60107267", "0.59329724", "0.5881362", "0.58800447", "0.5849684", "0.5797378", "0.5773862", "0.5744445", "0.57247037", "0.56726134", "0.5653875", "0.562954",...
0.76712906
1
Converts text queries to processed queries using an annotator.
def convert_text_queries_to_processed( self, text_queries: List[str] ) -> List[ProcessedQuery]: logger.info("Loading a Bootstrap Annotator to process log queries.") annotator_params = DEFAULT_AUTO_ANNOTATOR_CONFIG annotator_params["app_path"] = self.app_path bootstrap_annotat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_analysis(self, query, key=None):\n logger.info(\"Running analysis on query...\")\n core_annotation = Annotation(query, key)\n clf_pipeline = AnalysisPipeline()\n entity_pipeline = AnalysisPipeline()\n clf = self.clf_accessor.get_classification_pipeline('multiclass', 'inte...
[ "0.58529824", "0.5585822", "0.5577068", "0.55282134", "0.5404479", "0.53600365", "0.53220135", "0.52643645", "0.52558595", "0.5248043", "0.52073747", "0.5193515", "0.51917845", "0.5176019", "0.5160177", "0.50877666", "0.5071344", "0.50710976", "0.50638235", "0.5001331", "0.49...
0.70313007
0
Method to get multiple queries from the QueryCache given a list of query ids.
def get_queries(self, query_ids): return [ self.resource_loader.query_cache.get(query_id) for query_id in query_ids ]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_many(self, queries):\n assert isinstance(queries, list)\n cursor = self._cursor()\n results = []\n for query in queries:\n try:\n cursor.execute(query)\n result = cursor.fetchall()\n except Exception as e:\n pr...
[ "0.722569", "0.65023124", "0.64487207", "0.64159083", "0.6410242", "0.635374", "0.62091815", "0.6204514", "0.6176422", "0.6157128", "0.61314714", "0.606496", "0.59988225", "0.5957463", "0.5924632", "0.5920572", "0.5903233", "0.58550835", "0.5850858", "0.58000696", "0.57887274...
0.8206793
0
Update the current set of sampled queries by adding the set of newly sampled queries. A new PrcoessedQueryList object is created with the updated set of query ids.
def update_sampled_queries(self, newly_sampled_queries_ids): sampled_queries_ids = self.sampled_queries.elements + newly_sampled_queries_ids self.sampled_queries = ProcessedQueryList( cache=self.resource_loader.query_cache, elements=sampled_queries_ids )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_unsampled_queries(self, remaining_indices):\n remaining_queries_ids = [\n self.unsampled_queries.elements[i] for i in remaining_indices\n ]\n self.unsampled_queries = ProcessedQueryList(\n cache=self.resource_loader.query_cache, elements=remaining_queries_ids\n...
[ "0.68086916", "0.5676029", "0.5447187", "0.5287999", "0.5281685", "0.5269392", "0.5163817", "0.50805366", "0.5080143", "0.50727624", "0.50701463", "0.50502145", "0.50495815", "0.5037603", "0.5023451", "0.4994067", "0.49848914", "0.49457482", "0.49016884", "0.48877212", "0.488...
0.83345515
0
Update the current set of unsampled queries by removing the set of newly sampled queries. A new PrcoessedQueryList object is created with the updated set of query ids.
def update_unsampled_queries(self, remaining_indices): remaining_queries_ids = [ self.unsampled_queries.elements[i] for i in remaining_indices ] self.unsampled_queries = ProcessedQueryList( cache=self.resource_loader.query_cache, elements=remaining_queries_ids )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_sampled_queries(self, newly_sampled_queries_ids):\n sampled_queries_ids = self.sampled_queries.elements + newly_sampled_queries_ids\n self.sampled_queries = ProcessedQueryList(\n cache=self.resource_loader.query_cache, elements=sampled_queries_ids\n )", "def clearpredic...
[ "0.75596094", "0.5790968", "0.5650789", "0.55124557", "0.5401627", "0.53630894", "0.5264245", "0.5239242", "0.5194279", "0.5116806", "0.50995237", "0.50639457", "0.5062219", "0.49259344", "0.4909404", "0.4904073", "0.48995757", "0.48682117", "0.48384356", "0.48304084", "0.482...
0.7108111
1
Method to sample a DataBucket's unsampled_queries and update its sampled_queries and newly_sampled_queries.
def sample_and_update( self, sampling_size: int, confidences_2d: List[List[float]], confidences_3d: List[List[List[float]]], heuristic: Heuristic, confidence_segments: Dict = None, tuning_type: TuningType = TuningType.CLASSIFIER, ): if tuning_type == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_sampled_queries(self, newly_sampled_queries_ids):\n sampled_queries_ids = self.sampled_queries.elements + newly_sampled_queries_ids\n self.sampled_queries = ProcessedQueryList(\n cache=self.resource_loader.query_cache, elements=sampled_queries_ids\n )", "def update_unsa...
[ "0.7476263", "0.683936", "0.55779433", "0.53435713", "0.5312937", "0.5255059", "0.52298653", "0.51839805", "0.515455", "0.5151065", "0.51435345", "0.5071322", "0.5067455", "0.50468653", "0.5040171", "0.50190806", "0.5019019", "0.5006471", "0.499834", "0.49799365", "0.4929359"...
0.54295814
3
Filter queries for training preperation.
def filter_queries_by_nlp_component( query_list: ProcessedQueryList, component_type: str, component_name: str ): filtered_queries = [] filtered_queries_indices = [] for index, query in enumerate(query_list.processed_queries()): if getattr(query, component_type) == compon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_filter(self, qs):\n return qs", "def filter_query(self, query, request, resource):\n raise NotImplementedError()", "def filter_query(self, request, query, view):\n raise NotImplementedError('.filter_query() must be implemented.') # pragma: no cover", "def _custom_filter(self, qu...
[ "0.6468298", "0.6155105", "0.61386013", "0.6082538", "0.6041894", "0.60124743", "0.5988044", "0.5880612", "0.5872636", "0.58634984", "0.5804566", "0.5785709", "0.5770729", "0.56347954", "0.562477", "0.5616445", "0.56004584", "0.55968624", "0.5573194", "0.5567288", "0.5564817"...
0.0
-1
Creates a DataBucket to be used for strategy tuning.
def get_data_bucket_for_strategy_tuning( app_path: str, tuning_level: list, train_pattern: str, test_pattern: str, train_seed_pct: float, ): label_map = LabelMap.create_label_map(app_path, train_pattern) resource_loader = ResourceLoader.create_resource_loader(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_bucket() -> None:\n try:\n client.make_bucket(DATASETS_BUCKET)\n except BucketAlreadyOwnedByYou:\n logger.debug(f\"Not creating bucket {DATASETS_BUCKET}: Bucket already exists\")\n pass\n else:\n logger.debug(f\"Successfully created bucket {DATASETS_BUCKET}\")", "d...
[ "0.66712546", "0.64462686", "0.6387001", "0.63800037", "0.6142138", "0.6073936", "0.6030172", "0.59908855", "0.59375703", "0.59357345", "0.5933943", "0.5915313", "0.59029347", "0.58879966", "0.58430094", "0.57862043", "0.57170695", "0.5711254", "0.56925535", "0.56899697", "0....
0.6229102
4
Creates a DataBucket to be used for log query selection.
def get_data_bucket_for_query_selection( app_path: str, tuning_level: list, train_pattern: str, test_pattern: str, unlabeled_logs_path: str, labeled_logs_pattern: str = None, log_usage_pct: float = AL_MAX_LOG_USAGE_PCT, ): label_map = LabelMap.create_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_bucket() -> None:\n try:\n client.make_bucket(DATASETS_BUCKET)\n except BucketAlreadyOwnedByYou:\n logger.debug(f\"Not creating bucket {DATASETS_BUCKET}: Bucket already exists\")\n pass\n else:\n logger.debug(f\"Successfully created bucket {DATASETS_BUCKET}\")", "d...
[ "0.67508155", "0.6295921", "0.62482023", "0.62026525", "0.6182254", "0.61577547", "0.59622437", "0.5957801", "0.5936315", "0.5883336", "0.5852739", "0.5831283", "0.58034855", "0.5784298", "0.57722795", "0.57370543", "0.5728525", "0.56832904", "0.5631121", "0.5600316", "0.5600...
0.52690667
47
Establish http routes for the given list of routes containing tuples of the form (route, handler object)
def make_routes(routelist): return webapp2.WSGIApplication(routelist, debug=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def routes():\n import urllib.request, urllib.parse, urllib.error\n output = []\n for rule in app.url_map.iter_rules():\n options = {}\n for arg in rule.arguments:\n options[arg] = \"[{0}]\".format(arg)\n methods = ','.join(rule.methods)\n url = url_for(rule.endpoint...
[ "0.65212214", "0.64429027", "0.62730944", "0.61776197", "0.61614925", "0.60371983", "0.60076576", "0.5969171", "0.5950606", "0.5946168", "0.59317756", "0.5844661", "0.58265465", "0.5787878", "0.57873255", "0.57807803", "0.57449365", "0.5722084", "0.5693369", "0.5688424", "0.5...
0.6722308
0
Replaces all of the ultisnips variables with the corresponding vscode
def _replace_variables(self, string): conversions = {"VISUAL": "TM_SELECTED_TEXT"} for old, new in conversions.items(): string = string.replace(old, new) return string
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replace_variables(self, text, context):\n text = text.replace('__VENV_DIR__', context.env_dir)\n text = text.replace('__VENV_NAME__', context.env_name)\n text = text.replace('__VENV_PROMPT__', context.prompt)\n text = text.replace('__VENV_BIN_NAME__', context.bin_name)\n text...
[ "0.6394522", "0.58065987", "0.5606063", "0.5557312", "0.54911727", "0.5431594", "0.5424897", "0.5397946", "0.5366627", "0.5284732", "0.52125996", "0.51902866", "0.5151045", "0.51302266", "0.5101047", "0.5086249", "0.5032191", "0.50283474", "0.5023271", "0.5014109", "0.5012332...
0.6078713
1
Parses out the snippets into JSON form with the following schema {
def parse_snippet(self, ultisnip_file: Path) -> dict: snippets_dictionary = {} with open(ultisnip_file, "r") as f: for line in f: if line.startswith("snippet"): snippet = {} prefix = line.split()[1].strip() snippet["...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snippet_list(request):\n if request.method == 'GET':\n quickstart = Quickstart.objects.all()\n serializer = QuickstartSerializer(snippets, many=True)\n return JsonResponse(serializer.data, safe=False)\n\n elif request.method == 'POST':\n data = JSONParser().parse(request)\n ...
[ "0.6311338", "0.6069845", "0.59527874", "0.5810302", "0.5810302", "0.5762867", "0.57340497", "0.55275506", "0.54961646", "0.5488228", "0.5488193", "0.54133624", "0.5376377", "0.533812", "0.5299759", "0.5267433", "0.52651376", "0.52602667", "0.5223165", "0.51634073", "0.515207...
0.63587433
0
This function gets the trial sets for each leaf node in this graph.
def get_trial_sets(graph, leaves, diff = 2): trialsets = {} for leaf in leaves: parents = get_parent_path(graph, leaf) psizes = [len(graph.node[p]['leaves']) for p in parents] root = parents[-1] l1id = 1 while l1id < len(parents) -1 and psizes[l1id] < 5: l1id...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_all_roots(trial):\r\n root_nodes = trial.node_map[0].children.copy()\r\n shuffle(root_nodes)\r\n states = []\r\n for node in root_nodes:\r\n trial_copy = copy.deepcopy(trial)\r\n states.append(trial_copy)\r\n node.observe()\r\n trial_copy = copy.deepcopy(trial)\r\n ...
[ "0.6844502", "0.6840591", "0.6083935", "0.5979716", "0.59425783", "0.5910932", "0.5865636", "0.5863153", "0.5837333", "0.5722749", "0.57013834", "0.56999", "0.5659051", "0.5631628", "0.5579923", "0.5571343", "0.55593115", "0.55593115", "0.55299985", "0.54905343", "0.5464976",...
0.7629318
0
generate a trial from the given trialset and image maps
def generate_trial(trialset, synset2img, trialtype, num_imgs): # randomly shuffle the sets. for s in trialset: random.shuffle(s) source = trialset[trialtype] # sample images # make sure we have the most specific guy src_imgs = [random.choice(synset2img[trialset[0][0]])] for i in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stim_generate(params,stim_list,train):\n if train:\n stim = list(stim_list.keys())\n shuffled_stim = shuffled_images = []\n #for each run get equal amounts of stim and shuffle\n #can only work if 'trials_per_run' is divisible by number of stims\n for run in range(params['r...
[ "0.6116985", "0.6031568", "0.5918441", "0.5664884", "0.5622315", "0.5615459", "0.5599443", "0.5529613", "0.55038154", "0.54847896", "0.5482034", "0.5451923", "0.5441349", "0.5423713", "0.5408815", "0.5383447", "0.5371646", "0.5351493", "0.53448683", "0.5335508", "0.52934724",...
0.7455843
0
Calculates the fuzzy match of needle in haystack, using a modified version of the Levenshtein distance algorithm. The function is modified from the levenshtein function in the bktree module by Adam Hupp
def __fuzzy_substring(needle, haystack): m, n = len(needle), len(haystack) # base cases if m == 1: # return not needle in haystack row = [len(haystack)] * len(haystack) row[haystack.find(needle)] = 0 return row if not n: return m row1 = [0] * (n + 1) for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levenshtein_normalised(str1, str2):\n\treturn levenshtein(str1, str2, normalise=True)", "def levenshtein(str1, str2, normalise=False):\n\ttmp = Levenshtein.distance(str1, str2)\n\tif(normalise) and (len(str1) + len(str2)): tmp /= max(len(str1), len(str2))\n\treturn tmp", "def get_closest_levenshtein(word, ...
[ "0.65816826", "0.64453566", "0.6444688", "0.64391017", "0.63947976", "0.63769424", "0.63476413", "0.6301144", "0.6251837", "0.61857057", "0.6146241", "0.6121829", "0.6104246", "0.6104119", "0.607645", "0.60713935", "0.6024334", "0.60240644", "0.60073864", "0.5990242", "0.5945...
0.66017675
0
TypesConsoleCertificateSettings a model defined in OpenAPI
def __init__(self, check_revocation=None, console_ca_cert=None, console_custom_cert=None, hpkp=None, local_vars_configuration=None): # noqa: E501 # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = lo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.swagger_types = {\n 'id_conta': 'int',\n 'id_pessoa': 'int',\n 'id_cartao': 'int',\n 'id_bandeira': 'int',\n 'id_tipo_cartao': 'int',\n 'numero_cartao': 'str',\n 'nome_plastico': 'str',\n 'cvv2...
[ "0.51528734", "0.49188662", "0.48297343", "0.4826368", "0.4826368", "0.48228797", "0.4819829", "0.47996086", "0.4773806", "0.4751501", "0.47396463", "0.4729209", "0.47166255", "0.4694356", "0.46928954", "0.46187517", "0.46133664", "0.46113682", "0.4605297", "0.46039793", "0.4...
0.0
-1
Sets the check_revocation of this TypesConsoleCertificateSettings.
def check_revocation(self, check_revocation): self._check_revocation = check_revocation
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_compatibility_check(check_status):\r\n if Config.loaded:\r\n raise Exception(\"compatibility_check must be set before before \" \\\r\n \"using any other functionalities in libclang.\")\r\n\r\n Config.compatibility_check = check_status", "def svn_client_...
[ "0.50971395", "0.45247346", "0.4501634", "0.44256946", "0.43760172", "0.43499175", "0.43033206", "0.42995754", "0.42879218", "0.42419428", "0.42351454", "0.42196298", "0.41943878", "0.41834015", "0.4180629", "0.4163931", "0.4148873", "0.41426238", "0.41319498", "0.41168395", ...
0.7481139
0
Sets the console_ca_cert of this TypesConsoleCertificateSettings.
def console_ca_cert(self, console_ca_cert): self._console_ca_cert = console_ca_cert
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ca_cert(self, ca_cert):\n\n self._ca_cert = ca_cert", "def console_custom_cert(self, console_custom_cert):\n\n self._console_custom_cert = console_custom_cert", "def ca_cert_path(self, ca_cert_path: str):\n\n self._ca_cert_path = ca_cert_path", "def save_ca():\n cert_file = os...
[ "0.68265325", "0.65130776", "0.6440239", "0.58595866", "0.5228995", "0.5037131", "0.5037131", "0.5013002", "0.490777", "0.48871157", "0.48593655", "0.48507708", "0.48467252", "0.4803529", "0.48032707", "0.47784925", "0.4713782", "0.46828216", "0.46399626", "0.4594442", "0.456...
0.85301137
0
Sets the console_custom_cert of this TypesConsoleCertificateSettings.
def console_custom_cert(self, console_custom_cert): self._console_custom_cert = console_custom_cert
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def console_ca_cert(self, console_ca_cert):\n\n self._console_ca_cert = console_ca_cert", "def set_custom_property(self, sNewVmCustomProperty):\n\t\tcall_sdk_function('PrlVmCfg_SetCustomProperty', self.handle, sNewVmCustomProperty)", "def custom_compliance_domain(self, custom_compliance_domain):\n\n ...
[ "0.6610284", "0.54055816", "0.53626394", "0.52227587", "0.51395243", "0.5006331", "0.49909642", "0.4988925", "0.49661958", "0.49389002", "0.49314305", "0.49158552", "0.489311", "0.4870659", "0.48248613", "0.4814451", "0.47850242", "0.4669491", "0.460155", "0.4534467", "0.4508...
0.8813465
0
Sets the hpkp of this TypesConsoleCertificateSettings.
def hpkp(self, hpkp): self._hpkp = hpkp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pssh(self, pssh):\n self._pssh = pssh\n return self", "def hdp_version(self, hdp_version):\n\n self._hdp_version = hdp_version", "def set_kp():\n kp = request.params.get(\"kp\", 0, type=float)\n pid = request.params.get(\"pid\", 1, type=int)\n retval = RP_LIB.rp_PIDSetKp(pid, ...
[ "0.56403214", "0.5224331", "0.5040199", "0.50149983", "0.48443633", "0.48201424", "0.48000458", "0.4754778", "0.47419602", "0.4728604", "0.46491504", "0.45619443", "0.45580828", "0.45580828", "0.45580828", "0.4547807", "0.4547807", "0.4547807", "0.4473194", "0.4460671", "0.44...
0.7709247
0
Returns the model properties as a dict
def to_dict(self, serialize=False): result = {} def convert(x): if hasattr(x, "to_dict"): args = getfullargspec(x.to_dict).args if len(args) == 1: return x.to_dict() else: return x.to_dict(serialize) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_dict(self):\n return self.properties", "def to_dict(self):\n return self.properties", "def get_properties(self):\n return self.properties", "def asdict(self):\n return self._prop_dict", "def json(self):\n rv = {\n prop: getattr(self, prop)\n f...
[ "0.7751993", "0.7751993", "0.73391134", "0.7334895", "0.7297356", "0.727818", "0.7159078", "0.71578115", "0.71494967", "0.71494967", "0.71283495", "0.71275014", "0.7122587", "0.71079814", "0.7060394", "0.7043251", "0.7034103", "0.70233124", "0.69635814", "0.69586295", "0.6900...
0.0
-1
Returns the string representation of the model
def to_str(self): return pprint.pformat(self.to_dict())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n return super().__str__() + self.model.__str__()", "def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ...
[ "0.8585678", "0.7814723", "0.77902746", "0.7750817", "0.7750817", "0.7713574", "0.7699132", "0.7670784", "0.76510423", "0.7600937", "0.7582941", "0.7570682", "0.75406617", "0.75233835", "0.75168735", "0.75013274", "0.74877244", "0.74877244", "0.74700385", "0.7451798", "0.7446...
0.0
-1
For `print` and `pprint`
def __repr__(self): return self.to_str()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)", "def print_out():\n pass", "def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)", "def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)", "def _printable(self):\n ...
[ "0.75577617", "0.73375154", "0.6986672", "0.698475", "0.6944995", "0.692333", "0.6899106", "0.6898902", "0.68146646", "0.6806209", "0.6753795", "0.67497987", "0.6744008", "0.6700308", "0.6691256", "0.6674591", "0.6658083", "0.66091245", "0.6606931", "0.6601862", "0.6563738", ...
0.0
-1
Returns true if both objects are equal
def __eq__(self, other): if not isinstance(other, TypesConsoleCertificateSettings): return False return self.to_dict() == other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self, other):\n return are_equal(self, other)", "def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False", "def __eq__(self, other):\n if i...
[ "0.8088132", "0.8088132", "0.8054589", "0.7982687", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", "0.79670393", ...
0.0
-1
Returns true if both objects are not equal
def __ne__(self, other): if not isinstance(other, TypesConsoleCertificateSettings): return True return self.to_dict() != other.to_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True", "def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)", "def __ne__(self, other) -> bool:\n return not self.__eq__(other)", "def __eq__(self, other):\n ...
[ "0.845611", "0.8391477", "0.8144138", "0.81410587", "0.8132492", "0.8093973", "0.80920255", "0.80920255", "0.80920255", "0.8085325", "0.8085325", "0.8076365", "0.8076365", "0.8065748", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", "0.8042487", ...
0.0
-1
Generates a unique id which will be used by paynow to refer to the payment initiated
def generate_transaction_id(): return str(int(time.time() * 1000))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_id(self, context):\n tmp = datetime.datetime.now()\n tmp = tmp.strftime('%Y%m%d%H%M%S%f')\n tmp += context.peer()\n m = hashlib.md5()\n m.update(tmp.encode('utf-8'))\n return str(m.hexdigest())", "def _generate_order_id():\n current_milli_time = str(...
[ "0.75733525", "0.7475758", "0.74029607", "0.7379154", "0.7355747", "0.7351507", "0.7347127", "0.73232245", "0.7290395", "0.72684765", "0.7227526", "0.7220504", "0.7218613", "0.7189539", "0.71791047", "0.71791047", "0.717642", "0.71746486", "0.71354276", "0.71192765", "0.71178...
0.79250395
0
This the point where Paynow returns user to our site
def paynow_return(request, payment_id): # Get payment object payment = get_object_or_404(PaynowPayment, reference=payment_id) # Init Paynow oject. The urls can now be blank paynow = Paynow(settings.PAYNOW_INTEGRATION_ID, settings.PAYNOW_INTEGRATION_KEY, '', '') # Check the status of the payme...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self):\n self.response.headers.add_header(\"Set-Cookie\", \"user_id=; Path=/\")\n self.redirect(\"/signup\")", "def awaiting_payment(self):", "def post(self):\n cont = self.request_string('continue', default=\"/\")\n self.redirect(users.create_login_url(cont))", "def payRe...
[ "0.65489256", "0.6326221", "0.6302619", "0.61190206", "0.6105587", "0.6082659", "0.6058248", "0.60442585", "0.60005426", "0.5996423", "0.59853405", "0.5955397", "0.594845", "0.59100366", "0.58981246", "0.5893184", "0.5892947", "0.58726484", "0.5856111", "0.5855935", "0.585531...
0.60124165
8
This the point which Paynow polls our site with a payment status. I find it best to check with the Paynow Server. I also do the check when a payer is returned to the site when user is returned to site
def paynow_update(request, payment_reference): # Get saved paymend details payment = get_object_or_404(PaynowPayment, reference=payment_reference) # Init paynow object. The URLS can be blank paynow = Paynow(settings.PAYNOW_INTEGRATION_ID, settings.PAYNOW_INTEGRATION_KEY, '', '') # Check the s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_payment_status():\n\ttry:\n\t\torders = []\n\t\terror_log = {}\n\t\tfields = [\"name\", \"sales_tokens\"]\n\t\tfilters = {\n\t\t\t\"payment_status\": (\"in\", [\"Pending\", \"\", None]),\n\t\t\t\"docstatus\": (\"!=\", 2),\n\t\t\t\"mode_of_order\": \"Web\"\n\t\t}\n\t\tdue_orders = frappe.get_list(\"Sales ...
[ "0.7122953", "0.7110178", "0.65054214", "0.639817", "0.61742175", "0.61226845", "0.6104691", "0.5995269", "0.5959673", "0.5959388", "0.5890821", "0.57182485", "0.5644974", "0.5628669", "0.5604625", "0.5577589", "0.55546874", "0.55534333", "0.55522", "0.5548011", "0.5545392", ...
0.6033519
7
Creates a new database session for a test.
def session(project, engine_sessionmaker, connection): _, Session = engine_sessionmaker try: session = Session(bind=connection) yield session finally: session.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initTestingDB(): \n from sqlalchemy import create_engine\n engine = create_engine('sqlite://')\n from .models import (\n Base,\n TodoUser,\n )\n DBSession.configure(bind=engine)\n Base.metadata.create_all(engine)\n \n return DBSession", "def create_test_db(self, *a...
[ "0.7618117", "0.73792046", "0.7159167", "0.71482813", "0.7045171", "0.7042163", "0.69432914", "0.690918", "0.6870981", "0.6835914", "0.6805257", "0.6765318", "0.6759865", "0.673872", "0.67327875", "0.6709266", "0.67053777", "0.66906506", "0.66815907", "0.6679495", "0.66528684...
0.0
-1
Reflect the elements of a numpy array along a specified axis about the first element.
def reflect(arr,axis=0,sign=1): refl_idx = axis * [slice(None)] + [slice(None,0,-1), Ellipsis] return np.concatenate((arr[tuple(refl_idx)],arr), axis=axis)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reflect_array(x, axis=1, kind='even'):\n if axis == 0:\n x_sym = np.flipud(x)\n elif axis == 1:\n x_sym = np.fliplr(x)\n else:\n raise NotImplementedError\n\n if kind == 'even':\n fact = 1.0\n elif kind == 'odd':\n fact = -1.0\n else:\n raise NotImple...
[ "0.67617947", "0.6650867", "0.61850905", "0.6083956", "0.5720959", "0.57025504", "0.5559801", "0.5524613", "0.55142355", "0.54787475", "0.5478125", "0.5472565", "0.54558724", "0.5451142", "0.53963137", "0.53875583", "0.5342568", "0.5339039", "0.5313937", "0.53026325", "0.5300...
0.69821197
0
Return some points from a 2d lattice (with the origin first).
def make_lattice(min,max,lattice_vectors): xs = np.roll(np.arange(min[0],max[0]),max[0]) ys = np.roll(np.arange(min[1],max[1]),max[1]) lattice = np.dstack(np.meshgrid(xs,ys)).reshape(-1,2) lattice = np.matmul(lattice,lattice_vectors) return lattice
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getLatticePoints():\n latticePoints = []\n\n for y in arange(yMin, yMax + yStep, yStep):\n for x in arange(xMin, xMax + xStep, xStep):\n latticePoints.append(LatticePoint(x, y))\n\n \n return latticePoints", "def get_lattice_points(self) -> List[np.ndarray]:\n lattice_poi...
[ "0.72631", "0.66125095", "0.65590817", "0.64682907", "0.6441065", "0.6329514", "0.6315307", "0.6234959", "0.61652595", "0.6115704", "0.61074376", "0.6102117", "0.6076739", "0.6037446", "0.60364854", "0.60296583", "0.6005677", "0.6000581", "0.5999192", "0.5998226", "0.5966211"...
0.0
-1
Returns a list of flows with randomly selected sources and destinations that will saturate the network (i.e. a flow will be admitted provided that it would not cause the utilization of any link in the network to exceed 1. Flows are equally split across the K shortest paths connecting the source node to the destination ...
def compute_path_hopping_flow_allocations(target_graph, K=3): flow_allocation_seed_number = 0xCAFE_BABE np.random.seed(flow_allocation_seed_number) # id_to_dpid = topo_mapper.get_and_validate_onos_topo_x(target_graph) link_utilization = {(u, v): 0.0 for u, v in target_graph.edges} node_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_equal_flow_allocations(target_graph, K=3):\n # id_to_dpid = topo_mapper.get_and_validate_onos_topo_x(target_graph)\n flow_allocation_seed_number = 0xDEAD_BEEF\n np.random.seed(flow_allocation_seed_number)\n flows = []\n for node in target_graph.nodes:\n possible_destination_nodes ...
[ "0.6073624", "0.5772932", "0.56998974", "0.5527996", "0.54848486", "0.5443951", "0.5443951", "0.53789777", "0.53648436", "0.53508836", "0.5280728", "0.5269755", "0.5099018", "0.50866324", "0.50755084", "0.50711346", "0.50711346", "0.50291127", "0.5007661", "0.4996117", "0.496...
0.62126094
0
Returns a list of flows with randomly selected sources and destinations that will saturate the network (i.e. a flow will be addmitted provided that it will not cause the utilization of any link in the network to exceed 1. Flows are split across the K least utilized paths connecting the source node to the destination no...
def compute_greedy_flow_allocations( target_graph , flow_selection_fn , seed_number=DEFAULT_SEED_NUMBER): flow_allocation_seed_number = seed_number np.random.seed(flow_allocation_seed_number) link_utilization = {tuple(sorted(link_tup...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_path_hopping_flow_allocations(target_graph, K=3):\n flow_allocation_seed_number = 0xCAFE_BABE\n np.random.seed(flow_allocation_seed_number)\n # id_to_dpid = topo_mapper.get_and_validate_onos_topo_x(target_graph)\n link_utilization = {(u, v): 0.0 for u, v in target_graph.edges}\n...
[ "0.6332378", "0.60935616", "0.5811239", "0.560641", "0.5514502", "0.5492238", "0.5380612", "0.5344111", "0.5344111", "0.53399456", "0.5291331", "0.5245833", "0.52410334", "0.5200011", "0.51825786", "0.51523155", "0.51386243", "0.51315624", "0.5101362", "0.5068613", "0.5018153...
0.622782
1
Returns a set of flows st. there will be a single flow sourced from each node in the network with a destination randomly chosen from the set V / {s} where V is the set of nodes in the graph and s is the source node of the flow. Flows are equally distributed over the three shortest paths connecting the source node to th...
def compute_equal_flow_allocations(target_graph, K=3): # id_to_dpid = topo_mapper.get_and_validate_onos_topo_x(target_graph) flow_allocation_seed_number = 0xDEAD_BEEF np.random.seed(flow_allocation_seed_number) flows = [] for node in target_graph.nodes: possible_destination_nodes = set(targe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paths_for_flow(F, s, f):\n links = [((u, v), split_ratio) \n for (flow_id, u, v), split_ratio in F.items() \n if flow_id == f and u == s and split_ratio > 0.001]\n return links", "def get_paths_for_flow(F, s, f):\n links = [((u, v), split_ratio) \n ...
[ "0.5869763", "0.5869763", "0.5623528", "0.558636", "0.55374354", "0.5450709", "0.54248506", "0.54232466", "0.53542936", "0.532742", "0.53266317", "0.5317662", "0.53176224", "0.53126985", "0.5301199", "0.528309", "0.5279385", "0.52754855", "0.5249356", "0.52429557", "0.5217097...
0.5799766
2
Returns a set of flows st. there will be a single flow sourced from each node in the network with a destination randomly chosen from the set V / {s} where V is the set of nodes in the graph and s is the source node of the flow. Flows are split over the three shortest paths connecting the sender to the receiver in such ...
def compute_unequal_flow_allocations(target_graph, K=3): # id_to_dpid = topo_mapper.get_and_validate_onos_topo_x(target_graph) flow_allocation_seed_number = 0xDEAD_BEEF np.random.seed(flow_allocation_seed_number) flows = [] link_utilization = {} for node in target_graph.nodes: possible_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paths_for_flow(F, s, f):\n links = [((u, v), split_ratio) \n for (flow_id, u, v), split_ratio in F.items() \n if flow_id == f and u == s and split_ratio > 0.001]\n return links", "def get_paths_for_flow(F, s, f):\n links = [((u, v), split_ratio) \n ...
[ "0.6088071", "0.6088071", "0.58521134", "0.56622416", "0.5531953", "0.5518096", "0.54397494", "0.54385334", "0.54131764", "0.5411593", "0.53891915", "0.5348688", "0.53438646", "0.5327883", "0.52937067", "0.5290496", "0.5274863", "0.5273465", "0.5230514", "0.5225777", "0.52235...
0.0
-1
r""" RETURNS A set of paths, P. \forall p_i \in P, p_i begins at s and ends at t. The set also includes the proportion of flow f that should transit each path p_i \in P
def traverse_graph(F, f, s, t, u, sr): def get_paths_for_flow(F, s, f): """ RETURNS A set of outgoing links and corresponding splitting ratios for flow f at node s """ links = [((u, v), split_ratio) for (flow_id, u, v), split_ratio in F.items(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_paths_for_flow(F, s, f):\n links = [((u, v), split_ratio) \n for (flow_id, u, v), split_ratio in F.items() \n if flow_id == f and u == s and split_ratio > 0.001]\n return links", "def get_paths_for_flow(F, s, f):\n links = [((u, v), split_ratio) \n ...
[ "0.6825437", "0.6825437", "0.6509935", "0.5756425", "0.5675671", "0.5626487", "0.55647385", "0.5557139", "0.554731", "0.55453545", "0.5439347", "0.5434702", "0.5434155", "0.5415356", "0.54112595", "0.5397447", "0.5393359", "0.53482777", "0.53389424", "0.5324333", "0.5324295",...
0.6100076
3
RETURNS A set of outgoing links and corresponding splitting ratios for flow f at node s
def get_paths_for_flow(F, s, f): links = [((u, v), split_ratio) for (flow_id, u, v), split_ratio in F.items() if flow_id == f and u == s and split_ratio > 0.001] return links
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse_graph(F, f, s, t, u, sr):\n def get_paths_for_flow(F, s, f):\n \"\"\"\n RETURNS\n A set of outgoing links and corresponding splitting ratios for flow f\n at node s\n \"\"\"\n links = [((u, v), split_ratio) \n for (flow_id, u, v), spli...
[ "0.69459766", "0.5595106", "0.5534561", "0.5483686", "0.54691195", "0.5467508", "0.53494895", "0.53470665", "0.53366846", "0.53234804", "0.5310389", "0.52716064", "0.52382374", "0.5235263", "0.52303815", "0.5227401", "0.52202076", "0.5218126", "0.5190948", "0.51826143", "0.51...
0.7221145
1
RETURNS A set of outgoing links and corresponding splitting ratios for flow f at node s
def get_paths_for_flow(F, s, f): links = [((u, v), split_ratio) for (flow_id, u, v), split_ratio in F.items() if flow_id == f and u == s and split_ratio > 0.001] return links
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def traverse_graph(F, f, s, t, u, sr):\n def get_paths_for_flow(F, s, f):\n \"\"\"\n RETURNS\n A set of outgoing links and corresponding splitting ratios for flow f\n at node s\n \"\"\"\n links = [((u, v), split_ratio) \n for (flow_id, u, v), spli...
[ "0.6946733", "0.5595293", "0.55341357", "0.5483804", "0.54689676", "0.546619", "0.53488106", "0.5347624", "0.53359586", "0.5324602", "0.531136", "0.527324", "0.52406126", "0.52348506", "0.52295214", "0.5226473", "0.5220885", "0.52176976", "0.5189963", "0.5180724", "0.5178925"...
0.7221145
0
View function for home page of site.
def summary(request): # Generate counts of some of the main objects num_courses = models.Course.objects.all().count() num_quizzes = models.Quiz.objects.all().count() num_questions = models.Question.objects.count() num_students = models.User.objects.count() num_visits = request.session.get('num_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def home(request):\n\treturn render(request, \"compta/home.html\")", "def home_page(request):\r\n return render(request, 'ez_main/home_page.html')", "def home(request):\r\n return render(request, 'home.html')", "def homepage(request):\n\treturn render(request, 'core/homepage.html')", "def homepage(req...
[ "0.8493426", "0.84268916", "0.83415145", "0.83306193", "0.82976943", "0.8295291", "0.8276345", "0.82545686", "0.82155704", "0.8132563", "0.81246215", "0.81224865", "0.8121264", "0.81049734", "0.8098485", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0.80935514", "0...
0.0
-1
Creates an address for a purchase.
def __init__(self, street="", street2="", city="", state="", zip_code=""): self.street = street self.street2 = street2 self.city = city self.state = state self.zip_code = zip_code
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateNewAddress(self, currency):\n pass", "def create_address(self, address: str) -> Optional[Address]:\n raise NotImplemented", "def test_create_shipping_address(self):\n self.cim.create_shipping_address(\n customer_profile_id=100,\n ship_phone=u'415-415-4154'...
[ "0.73644215", "0.7143773", "0.7031508", "0.6538616", "0.64551836", "0.64361376", "0.64270854", "0.6425408", "0.6418397", "0.63918406", "0.6356949", "0.62770784", "0.6219692", "0.62043613", "0.6161881", "0.6076241", "0.6072444", "0.6055833", "0.6051252", "0.60130686", "0.59843...
0.0
-1
Given a vehicle and its current visiting customer, return the next visiting customer. Here we use the Timeoriented NearestNeighborhood Heuristic proposed by Solomon(1987).
def time_nn(self, on_way_time, curr_cust, remain_list, used_resource, rout_len, vehicle_type): if vehicle_type == 2: veh_cap = small_veh elif vehicle_type == 3: veh_cap = medium_veh else: veh_cap = large_veh real_wait_time = 0 # the final wait ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determineNextMove(player_location, opponentLocation, coins):\n global route, currentcoin, meta_route, best_weight, best_path, coins_to_search, index\n if opponentLocation in coins_to_search:\n coins_to_search, meta_route, route = change_way(coins, opponentLocation, player_location)[:3]\n in...
[ "0.6084116", "0.5874696", "0.5782421", "0.57132584", "0.5656202", "0.56430805", "0.5636324", "0.5563873", "0.5542704", "0.5528435", "0.5520394", "0.5506145", "0.5500587", "0.54915744", "0.54864365", "0.5473194", "0.54112583", "0.53902376", "0.53827214", "0.53707117", "0.53412...
0.0
-1
Generate an initial solution based on the Timeoriented Nearestneighbor heuristic proposed by Solomon.
def greedy_initial(self): sol = [] # [[0;2;5;0;4;6;0],[],...] sol_veh_type = [] # corresponding vehicle type for the solution route_way_time = [] to_vist = [i+1 for i in range(store_num - 1)] # [1,5,8,...] itr = 0 while len(to_vist) > 0 and itr < 500: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(self):\n # Use a trivial tour (1-2-3-...-N-1) to set the global upper bound.\n tour = list(range(self._N))\n upper_bound = sum([self._G[i][(i + 1) % self._N] for i in range(self._N)])\n trace = []\n\n # Start from a configuration with a single vertex.\n frontier = [BranchAndBoundConfigu...
[ "0.6477208", "0.63721377", "0.63295656", "0.6317618", "0.62916344", "0.6283113", "0.62769455", "0.627362", "0.6254762", "0.62242985", "0.6224087", "0.61772007", "0.6172025", "0.61346906", "0.61340076", "0.611956", "0.6112025", "0.6105103", "0.6101848", "0.60936993", "0.607927...
0.63413787
2
Given the solution saved in list, calculate the total cost of the solution. Write the solution to local in the required format.
def print_result(self, solution, vehicle_type, if_write): result = [['Vehicle_ID', 'Vehicle_type', 'Route', 'Leave_Time', 'Back_Time', 'Work_Time', 'Distance', 'Load_Volume', 'Wait_Time', 'Fixed_Cost', 'Travel_Cost', 'Total_Cost']] total_dist = 0 total_cost = 0 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_and_save_solution(data, manager, routing, assignment):\n total_distance = 0\n total_load = 0\n routes = []\n for vehicle_id in range(data['num_vehicles']):\n route = []\n index = routing.Start(vehicle_id)\n plan_output = 'Route for vehicle {}:\\n'.format(vehicle_id)\n ...
[ "0.60077643", "0.59991765", "0.5897307", "0.5896258", "0.5895152", "0.5890144", "0.5856607", "0.58172816", "0.5780239", "0.5713375", "0.5707637", "0.57038105", "0.57038105", "0.5679921", "0.5667275", "0.5651229", "0.5595291", "0.5590735", "0.55840975", "0.5565297", "0.5565179...
0.5381247
35
Given the solution saved in list, calculate the total cost of the solution. Write the solution to local in the required format.
def print_route_detail(self, solution, vehicle_type, if_write): result = [[ '线路编号', '门店编码', '门店名称', '门店地址', '经度', '纬度', '车型', '额定体积/m3', '额定重量/t', '到达时间', '离开时间', ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_and_save_solution(data, manager, routing, assignment):\n total_distance = 0\n total_load = 0\n routes = []\n for vehicle_id in range(data['num_vehicles']):\n route = []\n index = routing.Start(vehicle_id)\n plan_output = 'Route for vehicle {}:\\n'.format(vehicle_id)\n ...
[ "0.60075754", "0.599813", "0.5897581", "0.58958864", "0.58943343", "0.58902836", "0.5857024", "0.5817814", "0.5779555", "0.5712807", "0.57073516", "0.57030547", "0.57030547", "0.56806123", "0.5668559", "0.56510866", "0.5595581", "0.55908483", "0.5583591", "0.5566087", "0.5564...
0.0
-1