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
Run a forward step on a given model.
def feed_forward(model: Union[tf.keras.Model, torch.nn.Module], *x: Union[Tensor, np.ndarray], training: bool = True) -> Tensor: if isinstance(model, tf.keras.Model): x = to_tensor(x, "tf") x = model(*x, training=training) elif isinstance(model, torch.nn.Module): model.t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def step(self, model):\n pass", "def step(self, model):\n pass", "def step_forward(self):", "def run_step(self):\n \n # Ensure model has been initialized at least once\n self._model_has_been_initialized(\"run_step\")\n\n # Check if sim is steady-state (doesn't contai...
[ "0.7323865", "0.7323865", "0.7256661", "0.70867026", "0.7019303", "0.6756755", "0.66994774", "0.66733825", "0.66320074", "0.6591438", "0.6570029", "0.6518695", "0.6503238", "0.6496296", "0.64465", "0.64440316", "0.6436829", "0.6436766", "0.6436766", "0.6351596", "0.63447165",...
0.625451
34
Heuristic evaluation of the current board state
def heuristic(state, depth): if state.has_tic_tac_toe(COMP): score = depth + 1 elif state.has_tic_tac_toe(HUMAN): score = -(depth + 1) else: # draw/undetermined outcome score = 0 return score
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluateBoardState(self, board):\n\n \"\"\"\n These are the variables and functions for board objects which may be helpful when creating your Agent.\n Look into board.py for more information/descriptions of each, or to look for any other definitions which may help you.\n\n Board Var...
[ "0.7698078", "0.7464756", "0.7242388", "0.70961666", "0.7050396", "0.6989849", "0.6952592", "0.68367285", "0.67278254", "0.6721866", "0.6704963", "0.668141", "0.66759187", "0.66431457", "0.663874", "0.6630629", "0.6623085", "0.6622015", "0.6609591", "0.659221", "0.6586396", ...
0.64483744
41
Returns the coordinates of all the unclaimed spaces on the board
def get_empty_cells(state): cells = [] for row_index, row in enumerate(state.board): for col_index, cell in enumerate(row): if cell == 0: cells.append([row_index, col_index]) return cells
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def board_empty_positions(self, x, y):\n board = self.boards[x][y]\n coords = [(x, y, i, j) for (i, j) in board.empty_squares]\n return self.coords_to_positions(coords)", "def _get_available_spaces(world):\n spaces = []\n for y, row in enumerate(world):\n for x, column in enumer...
[ "0.722278", "0.71272844", "0.6875039", "0.686478", "0.6762596", "0.6523001", "0.64591116", "0.6424836", "0.6354838", "0.6283037", "0.62756515", "0.62519187", "0.6230979", "0.6230465", "0.62190616", "0.62147015", "0.62123954", "0.6204192", "0.6177941", "0.6176664", "0.61588883...
0.0
-1
The minimax algorithm itself. Returns a random move if the depth is 9, otherwise the first move would always be the top left corner.
def minimax(state, depth, player): if depth == 9: row = choice([0, 1, 2]) col = choice([0, 1, 2]) return row, col, '' if player == COMP: best = [-1, -1, float("-inf")] else: best = [-1, -1, float("inf")] if depth == 0 or state.has_tic_tac_toe(COMP) or state.has_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimax(self, game, depth):\n _, move = self.minimax_search(game, depth)\n return move", "def generateMoveWithMiniMax(board: np.ndarray, player: BoardPiece, saved_state: Optional[SavedState]\n) -> Tuple[PlayerAction, Optional[SavedState]]:\n\n # creating a minimax tree with depth 4\n root...
[ "0.78148496", "0.7535416", "0.7317246", "0.7303343", "0.7244281", "0.7237863", "0.7195684", "0.7176656", "0.7146682", "0.7145599", "0.71382374", "0.71261007", "0.7091745", "0.70631224", "0.704436", "0.70239663", "0.6977927", "0.6977572", "0.69681394", "0.69232583", "0.689288"...
0.6861013
23
Finds the next local board to play on. If undefined, it uses the minimax algorithm to decide which board to play on. Then uses the minimax algorithm again to decide where to play on that board.
def bot_turn(global_board, bot): # Determine if the bot is player 1 or 2 global COMP global HUMAN COMP = bot HUMAN = (bot % 2) + 1 # If the next board is undetermined if all(lb.focus == lb.playable for lb in global_board.local_boards): # Use minimax on the global board to determine ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimax(board):\n\n current_player = player(board)", "def minimax(board):\n if (terminal(board)):\n return None\n if (player(board) == X):\n best_so_far = -2\n else:\n best_so_far = 2\n best_move = ()\n for move in actions(board):\n new_board = [row[:] for row in...
[ "0.7786163", "0.74768823", "0.73884565", "0.7269957", "0.7229853", "0.7210471", "0.7192481", "0.7094221", "0.70769274", "0.7074329", "0.70546144", "0.7029542", "0.7011342", "0.6985897", "0.69649065", "0.69320726", "0.6913221", "0.6906551", "0.69055486", "0.6905456", "0.689455...
0.64651513
61
Calculate mean of role/token embeddings for a node.
def _mean_vec(self, node) -> Tuple[np.array, int]: tokens = [t for t in chain(node.token, ("RoleId_%d" % role for role in node.roles)) if t in self.emb] if not tokens: return None, 0 return np.mean([self.emb[t] for t in tokens], axis=0), len(tokens)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_mean(self):\n # load_in_all_parameters(self.save_directory, self.auto_encoder)\n for i, data_row in enumerate(self.X_train_naive):\n input_nn = data_row\n if torch.cuda.is_available():\n input_nn = Variable(torch.Tensor(np.asarray(input_nn).reshape(1, ...
[ "0.6682953", "0.6198933", "0.6104026", "0.61020845", "0.606138", "0.59226686", "0.59124076", "0.5786445", "0.5759134", "0.57552254", "0.57463694", "0.5732782", "0.572047", "0.57162076", "0.5711725", "0.5707686", "0.5694124", "0.56877744", "0.5685827", "0.567916", "0.567916", ...
0.7650001
0
Calculate mean of role/token embeddings for nodes and their children in a UAST.
def _mean_vecs(self, root) -> Tuple[Dict[int, np.array], Dict[int, np.array]]: node_vecs = {0: self._mean_vec(root)} child_vecs = {} parent_vecs = {0: None} n_nodes = 1 # incremented in accoradance with node_iterator for node, node_idx in node_iterator(root): node_c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mean_vec(self, node) -> Tuple[np.array, int]:\n tokens = [t for t in chain(node.token, (\"RoleId_%d\" % role for role in node.roles))\n if t in self.emb]\n if not tokens:\n return None, 0\n return np.mean([self.emb[t] for t in tokens], axis=0), len(tokens)", ...
[ "0.6652418", "0.6104074", "0.60613614", "0.58062", "0.57312095", "0.55728334", "0.5552793", "0.5548033", "0.55363387", "0.5521133", "0.55169815", "0.549175", "0.54699457", "0.5461554", "0.5455657", "0.5437836", "0.5394639", "0.5368514", "0.53438914", "0.53310144", "0.5312195"...
0.6019041
3
Convert UAST into feature and label arrays. Had to be defined outside of RolesMLP so that we don't suppply `self` twice.
def _process_uast(self, filename: str) -> Tuple[np.array, np.array]: X, y = [], [] uast_model = UASTModel().load(filename) for uast in uast_model.uasts: child_vecs, parent_vecs = self._mean_vecs(uast) for node, node_idx in node_iterator(uast): child_vec = child_vecs[node_idx] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_to_features(self, img: np.ndarray) -> np.ndarray:", "def convert_examples_to_features(tokens_set, labels_set, max_seq_length, tokenizer):\r\n\r\n #label_map = {label: i for i, label in enumerate(label_list, 1)}\r\n\r\n input_ids, input_masks, segment_ids, labels = [], [], [], []\r\n for ind...
[ "0.5990265", "0.568541", "0.55585814", "0.5532058", "0.54721767", "0.54471904", "0.54443514", "0.5410015", "0.5367583", "0.5366209", "0.53495264", "0.5344927", "0.5325683", "0.53237617", "0.53112566", "0.5272182", "0.52613175", "0.5252806", "0.52363384", "0.5218285", "0.52105...
0.6829204
0
Searches linkedin for a given job within a given location
def job_filter(self, job_name, job_location): self.job_name = job_name self.job_location = job_location self.driver.implicitly_wait(5) job_icon = driver.find_element_by_link_text('Jobs') job_icon.click() self.driver.implicitly_wait(5) search_keywords = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_jobs_from(website, job_title, location, search_category, filename=\"results.xls\"):\n jobs_list = []\n if website == 'Indeed':\n job_soup = load_jobs_div(job_title, location)\n jobs_list, num_listings = extract_job_details(\n job_soup, search_category)\n return jobs_l...
[ "0.6411991", "0.6256398", "0.62035584", "0.6004536", "0.6001758", "0.59986025", "0.59674996", "0.5892777", "0.58021027", "0.574696", "0.56093585", "0.55751437", "0.55597985", "0.5527168", "0.5435926", "0.5424789", "0.54233384", "0.5395632", "0.53306293", "0.5324306", "0.53124...
0.546543
14
Get all the jobs present and calls apply function on each of them
def get_job_listings(self): for attempt in range(5): try: job_listings = WebDriverWait(self.driver, 8).until( EC.presence_of_all_elements_located((By.XPATH, '//li[@class="jobs-search-results__list-item occludable-update p0 relative ember-view"]'))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_jobs_(jobs):\n out = []\n for job in jobs:\n out_ = MultiProcessingFunctions.expand_call(job)\n out.append(out_)\n return out", "def run_joblist(self):\n\n for message in self.message_list:\n self.run_job(message)", "def do_jobs(self, job...
[ "0.7337891", "0.7115954", "0.68574774", "0.6723561", "0.66961753", "0.65273744", "0.6507136", "0.64142436", "0.6274337", "0.6259099", "0.6234052", "0.61838686", "0.6158065", "0.6152318", "0.61400574", "0.6124629", "0.6111011", "0.6107523", "0.6103505", "0.60958016", "0.608197...
0.0
-1
Applies to all the jobs that are found with the easy apply filter
def apply_to_job(self, job_listing): print('\n') self.job_listing = job_listing print('You are applying to: ', self.job_listing.text) #apply_or_discard = input('Do you want to apply for this job? Please enter Yes or No: ') #if 'yes' in apply_or_discard.lower(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_all(self):\n\n print(\"Are you sure? Enter 'y' if so\")\n\n if input() == 'y':\n\n for job in self.old_jobs:\n if job.is_relevant:\n job.reject('a') # 0 for apply\n self.jobs_save(self.old_jobs, 'overwrite')\n print('All re...
[ "0.7203814", "0.64106554", "0.63290906", "0.6088612", "0.6088612", "0.6067502", "0.59964967", "0.59620374", "0.59418", "0.588748", "0.588748", "0.588748", "0.588748", "0.588748", "0.58411205", "0.58308405", "0.58237165", "0.57050246", "0.57050246", "0.5691325", "0.5691324", ...
0.54587257
31
Executes the entire application process
def execute(self): if username and password: job_name = input('Please enter the name of the job that you would like to apply for: ') job_location = input('Please enter where you would like to work: ') self.login_to_linkedin() self.driver.maximize_window() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self):\n\n input_args = {}\n self._execute(input_args, self.args)", "def main():\n run_program()", "def execute():", "def run(self):\n while self.container.process(): pass", "def run(self):\n self.process.start()", "def run():\n main()", "def run(self):\r\n ...
[ "0.6859497", "0.68517375", "0.67610633", "0.67602587", "0.67416245", "0.6649335", "0.6574325", "0.65529567", "0.6552377", "0.6526339", "0.6505417", "0.65016794", "0.6495118", "0.6475961", "0.64572", "0.6424465", "0.64177424", "0.64160836", "0.6413572", "0.6413572", "0.6413572...
0.0
-1
on_load is called when a objects is instantiated from database
def on_load(self): self.__init__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_load(self):\n pass", "def on_load(self):\n pass", "def postLoad(self):\n pass", "def on_load(self):", "def __init_on_load__(self):", "def _post_load(self):\n pass", "def on_loaded(self, func):\n self._on_loaded_funcs.append(func)", "def onInit(self):\n p...
[ "0.77701694", "0.77701694", "0.74983925", "0.7490084", "0.7307622", "0.71171945", "0.6513983", "0.6450546", "0.64347255", "0.6360762", "0.63267064", "0.6259976", "0.6241833", "0.6180361", "0.61745167", "0.6063532", "0.6045345", "0.6027878", "0.6021052", "0.60068715", "0.59551...
0.7820616
0
Bulk insert from a file
def bulk_insert(self, file): self.feed_type.ad_mapper.iter_from_file(file) max_pending = 10000 # Max INSERTs pending to commit current_pending = 0 # count the number of ads processing from the xml inserted_ads = 0 info = {'status': None, 'file': file, 'inserted': Non...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_data_from_file(self, filename):\n self.get_cursor()\n if self.check_bulk_insert() and self.table.header_rows < 2 and (\n self.table.delimiter in [\"\\t\", \",\"]):\n print(\"Inserting data from \" + os.path.basename(filename) + \"...\")\n\n if self.tabl...
[ "0.73229885", "0.7233491", "0.7145047", "0.6866277", "0.6753085", "0.6744226", "0.670137", "0.65829086", "0.6543675", "0.6540247", "0.6463855", "0.64511883", "0.6396226", "0.6365634", "0.6346232", "0.63205814", "0.6291509", "0.6280021", "0.6234122", "0.62065065", "0.618417", ...
0.6801561
4
Set properties based on a dictionary
def set_properties(self, dict_properties): for name, value in dict_properties.items(): if name.startswith("_") and hasattr(self, name[1:]): setattr(self, name[1:], value) elif name.startswith("_") and not hasattr(self, name[1:]): continue else:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, properties_dict):\n for k, v in properties_dict.items():\n self.__setattr__(k,v)", "def set_properties(self, property_dict):\n self.properties.update(property_dict)", "def set_properties(props):\n return impl.set_properties(**locals())", "def set_attr_from_dict(self...
[ "0.79062176", "0.79026854", "0.710076", "0.70500404", "0.67946094", "0.6738108", "0.6686813", "0.66813546", "0.6602526", "0.65777516", "0.6562734", "0.6514456", "0.6501659", "0.65016055", "0.6494247", "0.6480445", "0.6480445", "0.64173824", "0.63765496", "0.63476676", "0.6338...
0.74090147
2
Return column number of first zombie in row.
def first_zombie_col(self, row_num): row = self.board[row_num] for col_num, square in enumerate(row): if any(self.is_zombie([row_num, col_num])): return col_num
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_colnumber(self, header):\n for i in range(0, len(self.data)):\n if self.data[i][0] == header:\n return i\n return None", "def row(self):\n\t\tif self._parent != None:\n\t\t\treturn self._parent._children.index(self)\n\t\telse:\n\t\t\treturn 0", "def get_rownumber...
[ "0.6535265", "0.6504764", "0.6361898", "0.6265344", "0.6231301", "0.62140507", "0.61831784", "0.61463916", "0.61094284", "0.6089981", "0.60148174", "0.60148174", "0.60148174", "0.60148174", "0.5994073", "0.5961097", "0.59416634", "0.59152573", "0.5907639", "0.5887093", "0.588...
0.7976616
0
Removes an item from it's 2D location on the board.
def del_item(self, item): index = self.board[item.pos[0]][item.pos[1]].index(item) del self.board[item.pos[0]][item.pos[1]][index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delItem(self,row,column):\n data = self.data\n if row in data and column in data[row]:\n del data[row][column]\n self.hasChanged = True", "def remove_item(self, idx_of_item):\n del self.items[idx_of_item]", "def remove(self, item) -> None:\n entry = self.en...
[ "0.7109872", "0.7100431", "0.6982199", "0.6915672", "0.6915672", "0.689267", "0.68600845", "0.6831838", "0.67709464", "0.67571646", "0.67114854", "0.66505504", "0.6625568", "0.6608895", "0.6597562", "0.65652883", "0.6518909", "0.6506016", "0.6490994", "0.6490032", "0.64801955...
0.834085
0
Remove all objects that are no longer alive.
def clean(self): filtered_items = {} for name, ls in self.items.items(): filtered_ls = [] for i in ls: if i.alive(): filtered_ls.append(i) else: self.del_item(i) filtered_items[name] = filtered_ls...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge_dead(self):\n if self.live == None:\n return\n\n remove = []\n\n for s in self.streams:\n if not s.remote_location in self.live:\n remove.append(s)\n\n while len(remove) > 0:\n s = remove.pop()\n del s", "def clear_g...
[ "0.72169393", "0.7131462", "0.710511", "0.7069617", "0.698678", "0.69787264", "0.69597036", "0.69319737", "0.68848646", "0.67965287", "0.67901033", "0.67546594", "0.66708785", "0.66639525", "0.66491336", "0.66485494", "0.6599556", "0.6585536", "0.65660405", "0.6546759", "0.65...
0.62263244
44
Randomly add new Zombie to board
def spawn(self): new_zombie_lvl = random.randint(0, min(self.level, 3)) _ = Zombie(new_zombie_lvl, [random.randint(0, 4), 99], self.board) self.zombie_spawn_delay = random.randint(*self.zombie_spawn_delay_range)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_tile(self):\r\n rand_x = random.randrange(self.width)\r\n rand_y = random.randrange(self.height)\r\n while self.get_tile(rand_y, rand_x) != 0:\r\n rand_x = random.randrange(self.width)\r\n rand_y = random.randrange(self.height)\r\n value = random.choice([2,...
[ "0.6850253", "0.6792333", "0.67741394", "0.6765152", "0.67399603", "0.6598132", "0.6563493", "0.6486989", "0.6478938", "0.6375682", "0.6322192", "0.62981117", "0.62190646", "0.6154359", "0.6128631", "0.61138046", "0.6106024", "0.60815513", "0.60446703", "0.6044434", "0.600304...
0.73000026
0
If there is a Sun at a position, convert it to player gold.
def try_collecting(self, event): sun_list = [i for i in self.board[event.pos] if isinstance(i, Sun)] if sun_list: sun_list[0].collected = True self.player.gold += Sun.gold self.ev_manager.post(events.SunCollected(self.player.gold))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkSun(ontology_sun):\n elevation = ontology_sun.has_elevation[0] #gets the elevation value of the Sun in the ontology. \n azimuth = ontology_sun.has_azimuth[0] #gets the azimuth value of the Sun in the ontology. \n intensity = ontology_sun.has_intensity[0] #gets the intensity value of the Sun in th...
[ "0.5345387", "0.5232973", "0.51683986", "0.5097628", "0.5020059", "0.48194417", "0.47753277", "0.47593406", "0.46944553", "0.46863693", "0.4672161", "0.46698081", "0.4665255", "0.46307704", "0.46187636", "0.45967177", "0.45949432", "0.45921183", "0.45918754", "0.45915216", "0...
0.5606547
0
Load the appropriate locator file for the current version If no version can be determined, we'll use the highest numbered locator file name.
def _init_locators(self): try: version = int(float(self.get_latest_api_version())) self.builtin.set_suite_metadata("Salesforce API Version", version) locator_module_name = "locators_{}".format(version) except RobotNotRunningError: # We aren't part of a ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autodetect(self):\n\t\tif (self.version == None):\n\t\t\ttry:\n\t\t\t\tentries = os.listdir(\n\t\t\t\t\tos.path.join(\n\t\t\t\t\t\tAppFolders.get(self.type),\n\t\t\t\t\t\tself.name\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\texcept OSError:\n\t\t\t\traise ApplicationNotFoundException()\n\n\t\t\tentry_has = False\n\t\t\...
[ "0.5741487", "0.56461775", "0.5644669", "0.5638092", "0.55532765", "0.5533157", "0.55262965", "0.54877573", "0.54856133", "0.54326785", "0.54237175", "0.54203695", "0.5399302", "0.5386041", "0.5377447", "0.5377447", "0.5377447", "0.531227", "0.52914315", "0.5276611", "0.52591...
0.5479534
9
Initialize the Salesforce location strategies 'text' and 'title' plus any strategies registered by other keyword libraries
def initialize_location_strategies(self): locator_manager.register_locators("sf", lex_locators) locator_manager.register_locators("text", "Salesforce.Locate Element by Text") locator_manager.register_locators("title", "Salesforce.Locate Element by Title") # This does the work of actuall...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def InitStrategy(self, sname, strategy):\n\n self._string = sname\n\n self.strategy = strategy\n self.postracker = position.PositionTracker(self.strategy)", "def __init__(self):\r\n\t\tself.label = \"Linked Data Spatial Query\"\r\n\t\tself.description = \"Get geographic features from wikidat...
[ "0.6045109", "0.57539535", "0.5687557", "0.5604759", "0.5474559", "0.54511374", "0.5398299", "0.5344921", "0.5298376", "0.5295734", "0.5262278", "0.52585125", "0.52350414", "0.5218184", "0.5204428", "0.5204428", "0.5204428", "0.5204428", "0.5204428", "0.5204428", "0.5204428",...
0.77248496
0
Use javascript to click an element on the page
def _jsclick(self, locator): self.selenium.wait_until_page_contains_element(locator) self.selenium.wait_until_element_is_enabled(locator) for should_retry in (True, False): try: # Setting the focus first seems to be required as of Spring'20 # (read: w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(self, element):\n element.click()", "def click(self) -> None:\n logging.info(f\"click element. {self.desc}\")\n js = f\"\"\"var elm = document.querySelectorAll(\"{self.css}\")[{self.index}];\n elm.style.border=\"2px solid red\";\n elm.click();\"\...
[ "0.762903", "0.74474466", "0.7332855", "0.73293924", "0.702175", "0.6995986", "0.69918084", "0.69341105", "0.6796663", "0.67411786", "0.6718307", "0.66858315", "0.65415794", "0.65234894", "0.6496898", "0.64878553", "0.64431417", "0.6389323", "0.6330668", "0.62215525", "0.6188...
0.6066639
27
Set the locale for fake data This sets the locale for all calls to the ``Faker`` keyword and ``${faker}`` variable. The default is en_US For a list of supported locales see
def set_faker_locale(self, locale): try: self._faker = faker.Faker(locale) except AttributeError: raise Exception(f"Unknown locale for fake data: '{locale}'")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setLocale(self, value):\n return self._set(locale=value)", "def set_locale_de():\n try:\n if platform.system() == \"Windows\":\n locale.setlocale(locale.LC_ALL, \"German\")\n else:\n locale.setlocale(locale.LC_ALL, \"de_DE.utf8\")\n except locale.Error:\n ...
[ "0.6244255", "0.623005", "0.62105423", "0.62015533", "0.6130801", "0.60855186", "0.6064039", "0.587886", "0.5830364", "0.5727264", "0.5697302", "0.5605824", "0.5514231", "0.543558", "0.5397802", "0.5365363", "0.5353766", "0.5340136", "0.52725", "0.52648044", "0.52474874", "...
0.7908526
0
Call the Create Webdriver keyword. Retry on connection resets which can happen if custom domain propagation is slow.
def create_webdriver_with_retry(self, *args, **kwargs): # Get selenium without referencing selenium.driver which doesn't exist yet selenium = self.builtin.get_library_instance("SeleniumLibrary") for _ in range(12): try: return selenium.create_webdriver(*args, **kwargs...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_driver(self, config):\n raise NotImplementedError(\"Must override WebAccess::_create_driver.\")", "def _instantiate_driver(self) -> webdriver:\n\n if self.driver is None: return Browser.run_chromedriver()\n\n return self.driver", "def create_driver(self, random_proxy, login):\n...
[ "0.6135514", "0.5874731", "0.5788318", "0.57601655", "0.55990976", "0.55637485", "0.55528617", "0.55183816", "0.5475551", "0.54655373", "0.5433355", "0.53960615", "0.53960615", "0.53876483", "0.535044", "0.53414094", "0.53316253", "0.53288877", "0.529636", "0.52818716", "0.52...
0.73880607
0
Clicks a button in a Lightning modal.
def click_modal_button(self, title): locator = lex_locators["modal"]["button"].format(title) self.selenium.wait_until_page_contains_element(locator) self.selenium.wait_until_element_is_enabled(locator) self._jsclick(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_button(self):\n self.widgets.get('button').click()", "def click_button(self):\n self.q(css='div#fixture button').first.click()", "def click_button(self):\n self.q(css='div#fixture input').first.click()", "def click_button(button_to_click):\n try:\n button_to_click.cli...
[ "0.7707747", "0.73895776", "0.70711553", "0.6560236", "0.65126336", "0.64796257", "0.637078", "0.6339298", "0.6310775", "0.6302573", "0.6269785", "0.6242594", "0.62221867", "0.6221472", "0.6171821", "0.61612403", "0.6127239", "0.6119369", "0.6108662", "0.60760576", "0.6076057...
0.730086
2
Clicks a button in an object's actions.
def click_object_button(self, title): locator = lex_locators["object"]["button"].format(title) self._jsclick(locator) self.wait_until_modal_is_open()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_button(self):\n self.widgets.get('button').click()", "def click_button(self):\n self.q(css='div#fixture button').first.click()", "def atomacclick(objecttoclick):\n try:\n objecttoclick.Press()\n #print \"clicked on : %s\" %objecttoclick\n except Exception as er:\n ...
[ "0.7688248", "0.75102335", "0.7358888", "0.7092473", "0.7046478", "0.7011274", "0.7010241", "0.69833755", "0.6960983", "0.69513756", "0.6842773", "0.67193353", "0.66176766", "0.6548501", "0.65350246", "0.652321", "0.64355844", "0.6430837", "0.6358855", "0.6345518", "0.6324997...
0.7504934
2
Scrolls down until the specified related list loads.
def load_related_list(self, heading): locator = lex_locators["record"]["related"]["card"].format(heading) el = None i = 0 while el is None: i += 1 if i > 50: raise AssertionError( "Timed out waiting for {} related list to load."...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll_to_end_by_class_name(driver, class_name, number_requested):\r\n eles = driver.find_elements_by_class_name(class_name)\r\n count = 0\r\n new_count = len(eles)\r\n\r\n while new_count != count:\r\n try:\r\n utils.update_progress(new_count / number_requested, f' - Scrolling...
[ "0.5779658", "0.55728656", "0.5540163", "0.55229944", "0.5462364", "0.5460338", "0.5396183", "0.5335078", "0.53216785", "0.527404", "0.524986", "0.5238928", "0.5187637", "0.51747584", "0.51492304", "0.51451564", "0.51219696", "0.5107789", "0.5088162", "0.5058758", "0.5033915"...
0.71188396
0
Clicks a button in the heading of a related list. Waits for a modal to open after clicking the button.
def click_related_list_button(self, heading, button_title): self.load_related_list(heading) locator = lex_locators["record"]["related"]["button"].format( heading, button_title ) self._jsclick(locator) self.wait_until_modal_is_open()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_modal_button(self, title):\n locator = lex_locators[\"modal\"][\"button\"].format(title)\n self.selenium.wait_until_page_contains_element(locator)\n self.selenium.wait_until_element_is_enabled(locator)\n self._jsclick(locator)", "def click_button(self):\n self.q(css='...
[ "0.7189076", "0.6988168", "0.6578444", "0.656465", "0.65359074", "0.6386164", "0.6233494", "0.61503845", "0.61457515", "0.6088066", "0.60567385", "0.5973108", "0.5930721", "0.5856589", "0.5836955", "0.57845676", "0.57726026", "0.575332", "0.57077295", "0.56876504", "0.5687377...
0.7815718
0
Clicks a link in the related list with the specified heading. This keyword will automatically call Wait until loading is complete.
def click_related_item_link(self, heading, title): self.load_related_list(heading) locator = lex_locators["record"]["related"]["link"].format(heading, title) try: self._jsclick(locator) except Exception as e: self.builtin.log(f"Exception: {e}", "DEBUG") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_related_item_popup_link(self, heading, title, link):\n self.load_related_list(heading)\n locator = lex_locators[\"record\"][\"related\"][\"popup_trigger\"].format(\n heading, title\n )\n\n self.selenium.wait_until_page_contains_element(locator)\n self._jsclic...
[ "0.7736881", "0.7507538", "0.71692616", "0.60561264", "0.57515484", "0.56041235", "0.5319994", "0.53053665", "0.52839065", "0.527617", "0.5163625", "0.51312894", "0.51164484", "0.5106151", "0.5098942", "0.504578", "0.5043064", "0.49847758", "0.4957203", "0.4951363", "0.493011...
0.82479006
0
Clicks a link in the popup menu for a related list item. heading specifies the name of the list, title specifies the name of the item, and link specifies the name of the link
def click_related_item_popup_link(self, heading, title, link): self.load_related_list(heading) locator = lex_locators["record"]["related"]["popup_trigger"].format( heading, title ) self.selenium.wait_until_page_contains_element(locator) self._jsclick(locator) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_related_item_link(self, heading, title):\n self.load_related_list(heading)\n locator = lex_locators[\"record\"][\"related\"][\"link\"].format(heading, title)\n try:\n self._jsclick(locator)\n except Exception as e:\n self.builtin.log(f\"Exception: {e}\", ...
[ "0.74758106", "0.6553461", "0.6115421", "0.6080586", "0.5914096", "0.5731324", "0.57025373", "0.5691324", "0.5634803", "0.55465114", "0.5527079", "0.5513927", "0.55018294", "0.5477213", "0.5428236", "0.5418471", "0.54158795", "0.5388323", "0.53676933", "0.53380686", "0.533078...
0.82255656
0
Closes the open modal
def close_modal(self): locator = lex_locators["modal"]["close"] self._jsclick(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _close(self, event):\n self.EndModal(wx.ID_OK)", "def onBtnCloseClicked(self):\n self.close()", "def click_close_modal_content_button(self):\n self._basket.click_close_modal_content_button()", "def close(self):\n\n\t\tself._window.close()", "def close(self, **kwargs):\n if s...
[ "0.7485135", "0.71692693", "0.7112385", "0.7063925", "0.67974085", "0.677635", "0.670848", "0.67019016", "0.66175354", "0.6605917", "0.65781903", "0.6553257", "0.65518093", "0.6550994", "0.65053326", "0.6490589", "0.64872533", "0.6476808", "0.6416838", "0.6399266", "0.6394791...
0.838349
0
Validates the currently selected Salesforce App
def current_app_should_be(self, app_name): locator = lex_locators["app_launcher"]["current_app"].format(app_name) elem = self.selenium.get_webelement(locator) assert app_name == elem.text, "Expected app to be {} but found {}".format( app_name, elem.text )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __ValidateAppId(self, app_id):\n assert app_id\n if not self.__trusted and app_id != self.project_id:\n raise datastore_errors.BadRequestError(\n 'app %s cannot access app %s\\'s data' % (self.project_id, app_id))", "def valid_app_id(self, app_id):\n return self.app_id == app_id", ...
[ "0.6195508", "0.60521305", "0.5839649", "0.58389854", "0.5760422", "0.57135284", "0.5709878", "0.5609615", "0.5208296", "0.5207175", "0.5174594", "0.5173392", "0.51524776", "0.5151011", "0.5132887", "0.512911", "0.5125823", "0.5117493", "0.51113725", "0.5105867", "0.5087956",...
0.4998966
30
Deletes records that were created while running this test case. (Only records specifically recorded using the Store Session Record keyword are deleted.)
def delete_session_records(self): self._session_records.reverse() self.builtin.log("Deleting {} records".format(len(self._session_records))) for record in self._session_records[:]: self.builtin.log(" Deleting {type} {id}".format(**record)) try: self.sales...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_records(self):\n pass", "def delete_record(records):\n delete_record()", "def delete_test_data(session_maker):\n\n orm_session = session_maker()\n orm_session.query(USERS).filter(USERS.username.like('%test%')).delete(synchronize_session=False)\n orm_session.query(USER_POSTS)....
[ "0.7481224", "0.7373201", "0.7205428", "0.69691026", "0.6664302", "0.65132904", "0.64798975", "0.64461666", "0.64307034", "0.639961", "0.63823223", "0.6344583", "0.6338384", "0.633812", "0.6276203", "0.62057465", "0.6177603", "0.6175238", "0.6172349", "0.61712223", "0.6158834...
0.80059433
0
Return the id of all open browser ids
def get_active_browser_ids(self): # This relies on some private data structures, but presently # there is no other way. There's been a discussion in the # robot slack channels about adding a new keyword that does # what this keyword does. When that happens, we can remove # this ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ids(self):\n page = r.get(self.url)\n tree = html.fromstring(page.content)\n ids_elements = tree.xpath(\"//div[@id='selectedcontent']/div/ul/li/a\")\n return [self._e_to_id(e) for e in ids_elements]", "def getIDs():", "def getAllWindowHandles(self):\n cmdId = self.executeCommand(Comm...
[ "0.6569217", "0.628429", "0.62061906", "0.6202266", "0.58726", "0.5845237", "0.58393615", "0.5779246", "0.5755626", "0.57022905", "0.56826526", "0.56637734", "0.5652637", "0.56374764", "0.5617484", "0.5593592", "0.5584265", "0.5559799", "0.5544296", "0.55259955", "0.5506343",...
0.71545905
0
Parses the current url to get the object id of the current record.
def get_current_record_id(self): url = self.selenium.get_location() for part in url.split("/"): oid_match = re.match(OID_REGEX, part) if oid_match is not None: return oid_match.group(2) raise AssertionError("Could not parse record id from url: {}".format(u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id(self, url):\n return url.split('/')[-1]", "def obj_id(self) -> int:\n return int(self.index.split(\"/\")[-1]) if self.index else None", "def getOID(self, selfURL):\n\n selfURL_path = urlsplit(selfURL).path\n oID = Path(selfURL_path).name\n try:\n r = int...
[ "0.7274164", "0.7020472", "0.6777252", "0.6688561", "0.6602918", "0.6407275", "0.635892", "0.63425964", "0.6307531", "0.6288161", "0.6233897", "0.6204031", "0.619106", "0.61868566", "0.6139848", "0.6139848", "0.6139848", "0.6139848", "0.6139848", "0.6139848", "0.6139848", "...
0.7598501
0
Return the current value of a form field based on the field label
def get_field_value(self, label): input_element_id = self.selenium.get_element_attribute( "xpath://label[contains(., '{}')]".format(label), "for" ) value = self.selenium.get_value(input_element_id) return value
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getValue(self):\n return self.field.currentText()", "def getValue(self):\n return self.field.text()", "def field(self):\r\n return self.value", "def get_field_value(self, field_name):\n if field_name in self.fields.keys():\n return self.fields[field_name]\n e...
[ "0.6556248", "0.65483963", "0.6508708", "0.64794666", "0.63468665", "0.6334696", "0.63046134", "0.62998545", "0.629518", "0.6286994", "0.62621415", "0.6250413", "0.6250221", "0.6250221", "0.6250221", "0.6250221", "0.6246163", "0.6246163", "0.61561424", "0.6147392", "0.6099475...
0.80294776
0
Returns a rendered locator string from the Salesforce lex_locators dictionary. This can be useful if you want to use an element in a different way than the built in keywords allow.
def get_locator(self, path, *args, **kwargs): locator = lex_locators for key in path.split("."): locator = locator[key] return locator.format(*args, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_locator(locator_text: str, locator_type: str = \"id\") -> tuple:\n locator = locator_type.upper()\n return getattr(By, locator), locator_text", "def __str__(self):\n return 'Token({type}, {lexema})'.format(\n type= tokenNames[self.type],\n lexema=self.lexema\n )"...
[ "0.4768227", "0.46713182", "0.45936868", "0.44802696", "0.4458644", "0.44231966", "0.43998763", "0.43943584", "0.43852997", "0.43272206", "0.43175244", "0.42806837", "0.42482546", "0.42070994", "0.42069843", "0.4188468", "0.41546643", "0.4154236", "0.4147403", "0.41430965", "...
0.5943993
0
Returns the Record Type Id for a record type name
def get_record_type_id(self, obj_type, developer_name): soql = "SELECT Id FROM RecordType WHERE SObjectType='{}' and DeveloperName='{}'".format( obj_type, developer_name ) res = self.cumulusci.sf.query_all(soql) return res["records"][0]["Id"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_type_id(record: TNSRecord) -> int:\n return ObjectType.get_or_create(record.type or 'Unknown').id", "def get_id(type_: Dict[str, str]) -> int:\n return int(type_[f'{type_name}_id'])", "def _type_str(self):\n try:\n record_name = RECORD_TYPES[self.type]\n ...
[ "0.7928146", "0.7352052", "0.7027344", "0.700802", "0.6797513", "0.6752316", "0.67234236", "0.66540086", "0.6632991", "0.6545357", "0.64484364", "0.64434844", "0.64428693", "0.6408364", "0.64009094", "0.63250935", "0.63191825", "0.6295935", "0.62649363", "0.6245594", "0.62261...
0.77214324
1
Returns the number of items indicated for a related list.
def get_related_list_count(self, heading): locator = lex_locators["record"]["related"]["count"].format(heading) count = self.selenium.get_webelement(locator).text count = count.replace("(", "").replace(")", "") return int(count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_items(self):\n count = 0\n for o in self.order_lst:\n count += o.count()\n \n return count", "def get_num_items(self):\r\n return self.num_items", "def items_num(self):\n\t\treturn len(self.items)", "def items_num(self):\n\t\treturn len(self.items)"...
[ "0.74805504", "0.7285734", "0.69391817", "0.69391817", "0.6899637", "0.6876357", "0.68688875", "0.68223625", "0.68114096", "0.67848015", "0.67558473", "0.6744843", "0.67436016", "0.6710305", "0.66789955", "0.6653826", "0.6590316", "0.6518359", "0.6511388", "0.6493154", "0.648...
0.75440687
0
Navigates to the Home view of a Salesforce Object
def go_to_object_home(self, obj_name): url = self.cumulusci.org.lightning_base_url url = "{}/lightning/o/{}/home".format(url, obj_name) self.selenium.go_to(url) self.wait_until_loading_is_complete(lex_locators["actions"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _go_to_page(self):\n self.salesforce.go_to_setup_home()\n self.eda.wait_for_new_window(\"Home | Salesforce\")\n self.selenium.switch_window(\"Home | Salesforce\")\n self.salesforce.wait_until_loading_is_complete()", "def go_to_record_home(self, obj_id):\n url = self.cumulus...
[ "0.72055185", "0.6643557", "0.65994006", "0.65149677", "0.6487298", "0.6410646", "0.6332935", "0.63148344", "0.6233376", "0.6232684", "0.6230519", "0.61904204", "0.61904204", "0.61904204", "0.6159019", "0.6148358", "0.6115426", "0.6086321", "0.6041018", "0.60313743", "0.60254...
0.7644369
0
Navigates to the Home view of a Salesforce Object
def go_to_object_list(self, obj_name, filter_name=None): url = self.cumulusci.org.lightning_base_url url = "{}/lightning/o/{}/list".format(url, obj_name) if filter_name: url += "?filterName={}".format(filter_name) self.selenium.go_to(url) self.wait_until_loading_is_co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_object_home(self, obj_name):\n url = self.cumulusci.org.lightning_base_url\n url = \"{}/lightning/o/{}/home\".format(url, obj_name)\n self.selenium.go_to(url)\n self.wait_until_loading_is_complete(lex_locators[\"actions\"])", "def _go_to_page(self):\n self.salesforce....
[ "0.76447284", "0.72046864", "0.6643849", "0.6600578", "0.65158856", "0.64881563", "0.64114314", "0.63341653", "0.6316015", "0.6233497", "0.6233113", "0.62312764", "0.6190278", "0.6190278", "0.6190278", "0.61591583", "0.61487323", "0.61156327", "0.60873824", "0.60420287", "0.6...
0.5533636
71
Navigates to the Home view of a Salesforce Object
def go_to_record_home(self, obj_id): url = self.cumulusci.org.lightning_base_url url = "{}/lightning/r/{}/view".format(url, obj_id) self.selenium.go_to(url) self.wait_until_loading_is_complete(lex_locators["actions"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_object_home(self, obj_name):\n url = self.cumulusci.org.lightning_base_url\n url = \"{}/lightning/o/{}/home\".format(url, obj_name)\n self.selenium.go_to(url)\n self.wait_until_loading_is_complete(lex_locators[\"actions\"])", "def _go_to_page(self):\n self.salesforce....
[ "0.76436394", "0.7206324", "0.66016656", "0.6517559", "0.6490742", "0.64134145", "0.63359326", "0.6317862", "0.62348145", "0.62334824", "0.6230328", "0.61923933", "0.61923933", "0.61923933", "0.6159758", "0.6152044", "0.6117551", "0.6088819", "0.60412717", "0.60342234", "0.60...
0.66427916
2
Navigates to the Home tab of Salesforce Setup
def go_to_setup_home(self): url = self.cumulusci.org.lightning_base_url self.selenium.go_to(url + "/lightning/setup/SetupOneHome/home") self.wait_until_loading_is_complete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _go_to_page(self):\n self.salesforce.go_to_setup_home()\n self.eda.wait_for_new_window(\"Home | Salesforce\")\n self.selenium.switch_window(\"Home | Salesforce\")\n self.salesforce.wait_until_loading_is_complete()", "def home(self):\n self.goto(0, 0)", "def go_home(self):...
[ "0.8230737", "0.71648955", "0.70775753", "0.70246947", "0.7019923", "0.7007859", "0.67817223", "0.67309695", "0.6720572", "0.6715987", "0.6700127", "0.6590666", "0.65675294", "0.6565556", "0.65384", "0.65323144", "0.630954", "0.6259082", "0.62556046", "0.6235437", "0.6228942"...
0.7788175
1
Navigates to the Object Manager tab of Salesforce Setup
def go_to_setup_object_manager(self): url = self.cumulusci.org.lightning_base_url self.selenium.go_to(url + "/lightning/setup/ObjectManager/home") self.wait_until_loading_is_complete()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _go_to_page(self):\n self.salesforce.go_to_setup_home()\n self.eda.wait_for_new_window(\"Home | Salesforce\")\n self.selenium.switch_window(\"Home | Salesforce\")\n self.salesforce.wait_until_loading_is_complete()", "def go_to_object_home(self, obj_name):\n url = self.cumul...
[ "0.70036185", "0.6478363", "0.5637787", "0.55917794", "0.5564666", "0.5546104", "0.5476443", "0.54016584", "0.5381777", "0.5281001", "0.5279266", "0.52702373", "0.52061206", "0.5108897", "0.50760114", "0.50358033", "0.5031218", "0.5030932", "0.5012035", "0.4993091", "0.498590...
0.79498047
0
Validates that a field in the record header has a text value.
def header_field_should_have_value(self, label): locator = lex_locators["record"]["header"]["field_value"].format(label) self.selenium.page_should_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_text(self, text):\n if text is None:\n return\n if not (0 < len(text) <= self.TEXT_MAX):\n raise ValidationError", "def verify_text(self, text):\n pass", "def is_text(self):\n return self.value_type in (str, unicode)", "def validate(self, text):...
[ "0.6118447", "0.6077854", "0.6071562", "0.6058976", "0.6022076", "0.60061294", "0.5977624", "0.5856549", "0.57605785", "0.574175", "0.5736056", "0.57306993", "0.57281125", "0.5717858", "0.57031816", "0.56322557", "0.56106055", "0.5594493", "0.5589283", "0.55705214", "0.555206...
0.56265754
16
Validates that a field in the record header does not have a value.
def header_field_should_not_have_value(self, label): locator = lex_locators["record"]["header"]["field_value"].format(label) self.selenium.page_should_not_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _entry_field_values_are_not_empty(entry: _LexiconEntry) -> None:\n empty_fields = [f for f in _REQUIRED_FIELDS if not entry[f]]\n\n if empty_fields:\n field_str = \", \".join(sorted(empty_fields))\n raise InvalidLexiconEntryError(\n f\"Entry fields have empty values: '{field_str}'\")", "def ge...
[ "0.683849", "0.6365718", "0.63112915", "0.6230485", "0.61937124", "0.6048413", "0.60448253", "0.59929425", "0.5948517", "0.59356445", "0.5925059", "0.5915659", "0.59072083", "0.58865273", "0.5876951", "0.58721685", "0.5848566", "0.5842581", "0.5815589", "0.5799302", "0.578277...
0.74657786
0
Validates that a field in the record header has a link as its value
def header_field_should_have_link(self, label): locator = lex_locators["record"]["header"]["field_value_link"].format(label) self.selenium.page_should_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_check(form, field):\n if form.registrable.data and len(field.data)==0:\n raise validators.ValidationError('link should is required when the forum is registrable')", "def _validate_item_link(self, item):\n if len(item.link) > 255:\n raise ValueError(\"item.link length too long...
[ "0.6734898", "0.6680483", "0.6659962", "0.6447703", "0.6380813", "0.6207591", "0.61978114", "0.6009429", "0.59542733", "0.59263813", "0.59231883", "0.58986306", "0.5892022", "0.58560866", "0.5845754", "0.5796058", "0.5663516", "0.56422627", "0.5615367", "0.5592679", "0.556438...
0.7419405
0
Validates that a field in the record header does not have a link as its value
def header_field_should_not_have_link(self, label): locator = lex_locators["record"]["header"]["field_value_link"].format(label) self.selenium.page_should_not_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_type(self):\n if self._type != \"link\":\n raise securesystemslib.exceptions.FormatError(\n \"Invalid Link: field `_type` must be set to 'link', got: {}\"\n .format(self._type))", "def link_check(form, field):\n if form.registrable.data and len(field.data)==0:\n ...
[ "0.6651557", "0.6540842", "0.64729846", "0.64548326", "0.62218595", "0.6217006", "0.607596", "0.5975116", "0.5898353", "0.5898042", "0.58803624", "0.5827015", "0.57602894", "0.5649541", "0.56489056", "0.5622549", "0.5617436", "0.5537711", "0.55272186", "0.5523555", "0.5493546...
0.7414802
0
Clicks a link in record header.
def click_header_field_link(self, label): locator = lex_locators["record"]["header"]["field_value_link"].format(label) self._jsclick(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(cls, user, link):\r\n pass", "def click(cls, user, link):\n pass", "def header_field_should_have_link(self, label):\n locator = lex_locators[\"record\"][\"header\"][\"field_value_link\"].format(label)\n self.selenium.page_should_contain_element(locator)", "def click(self...
[ "0.6810575", "0.6691521", "0.65496945", "0.6337218", "0.6258854", "0.6115506", "0.6081313", "0.60441154", "0.60302216", "0.6012667", "0.59126896", "0.58689827", "0.5819385", "0.58138835", "0.5788098", "0.57601273", "0.56691664", "0.5654446", "0.5648386", "0.56409955", "0.5631...
0.77199167
0
Validates that a checkbox field in the record header is checked
def header_field_should_be_checked(self, label): locator = lex_locators["record"]["header"]["field_value_checked"].format(label) self.selenium.page_should_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_CheckboxRequired(request):\n schema = schemaish.Structure()\n schema.add('checkbox', schemaish.Boolean(validator=validatish.Required()))\n\n form = formish.Form(schema, 'form')\n return form", "def header_field_should_be_unchecked(self, label):\n locator = lex_locators[\"record\"][\"h...
[ "0.6631701", "0.61190456", "0.6105029", "0.59637266", "0.5737197", "0.5682851", "0.56638116", "0.5659438", "0.5628575", "0.56126165", "0.56080025", "0.55531156", "0.5528249", "0.5469722", "0.54687536", "0.5466557", "0.5465746", "0.54445034", "0.54380137", "0.5435806", "0.5425...
0.6943328
0
Validates that a checkbox field in the record header is unchecked
def header_field_should_be_unchecked(self, label): locator = lex_locators["record"]["header"]["field_value_unchecked"].format( label ) self.selenium.page_should_contain_element(locator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_widget_is_not_checkbox():\n form = ExampleForm()\n field = form[\"text\"]\n assert is_checkbox(field) is False", "def header_field_should_not_have_value(self, label):\n locator = lex_locators[\"record\"][\"header\"][\"field_value\"].format(label)\n self.selenium.page_should_not_co...
[ "0.62513125", "0.5875742", "0.58471143", "0.5810528", "0.5569274", "0.5510167", "0.5480259", "0.54778147", "0.5469235", "0.54215735", "0.5408021", "0.5368687", "0.53532887", "0.5350012", "0.527463", "0.5266475", "0.524117", "0.5231928", "0.5221544", "0.5200423", "0.5185765", ...
0.687146
0
Logs all of the browser capabilities as reported by selenium
def log_browser_capabilities(self, loglevel="INFO"): output = "selenium browser capabilities:\n" output += pformat(self.selenium.driver.capabilities, indent=4) self.builtin.log(output, level=loglevel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capabilities(self):\n pass", "def get_capabilities(self, config_section):\n get_opt = self.shishito_support.get_opt\n test_platform = self.shishito_support.test_platform\n if (test_platform == 'web'):\n # Get logging levels from config\n logging_driver = get_...
[ "0.6352043", "0.63287675", "0.6234685", "0.621302", "0.6083162", "0.60344166", "0.5915496", "0.58780015", "0.57179224", "0.57058084", "0.56078523", "0.5575174", "0.5550384", "0.5535238", "0.55145127", "0.548253", "0.54572767", "0.54152566", "0.54052216", "0.5400952", "0.53993...
0.87539417
0
Opens the Saleforce App Launcher Modal
def open_app_launcher(self, retry=True): self._jsclick("sf:app_launcher.button") self._jsclick("sf:app_launcher.view_all") self.wait_until_modal_is_open() try: # the modal may be open, but not yet fully rendered # wait until at least one link appears. We've seen ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def launch_an_app(appname,ui):\r\n ui = ui\r\n time.sleep(WAIT)\r\n \"\"\"Clicking on Launcher button\"\"\"\r\n ui.doDefault_on_obj('Launcher', False, role='button') \r\n time.sleep(WAIT)\r\n ui.doDefault_on_obj(name='Expand to all apps', role='button')\r\n time.sleep(WAIT)\r\n \"\"\"Launch...
[ "0.6479038", "0.6462919", "0.6434212", "0.6430649", "0.593074", "0.59013236", "0.5849572", "0.5847336", "0.5841618", "0.5819635", "0.58001095", "0.57615477", "0.57615477", "0.57615477", "0.57615477", "0.574904", "0.570637", "0.5686895", "0.5643976", "0.5634945", "0.5630922", ...
0.6853186
0
Enters a value into an input or textarea field.
def populate_field(self, name, value): locator = self._get_input_field_locator(name) self._populate_field(locator, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _enter_value(self, element_id: str, value: str) -> None:\n element = self._driver.find_element_by_id('{}0'.format(element_id))\n element.send_keys(value)", "def fill_input_field(self, by, locator, value=\"\"):\n field = self.wait_until_visible(locator_type=by, locator=locator)\n f...
[ "0.70664865", "0.652488", "0.61882347", "0.61631274", "0.6126441", "0.6014756", "0.60045373", "0.5950494", "0.58524966", "0.5852306", "0.5851793", "0.5840166", "0.5763286", "0.5759499", "0.5740569", "0.5687926", "0.56578696", "0.564509", "0.56324375", "0.5620508", "0.56141216...
0.5602482
21
Enters a value into a lookup field.
def populate_lookup_field(self, name, value): input_locator = self._get_input_field_locator(name) menu_locator = lex_locators["object"]["field_lookup_link"].format(value) self._populate_field(input_locator, value) for x in range(3): self.wait_for_aura() try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_lookup_text_row(self, label, value, lookup, extra='', nothing=-1):\n if value in lookup:\n text = '<tt>{}</tt>{} (ID {})'.format(lookup[value].name, extra, value)\n else:\n if value > nothing:\n text = 'Unknown{} (ID {})'.format(extra, value)\n ...
[ "0.641252", "0.6169455", "0.606925", "0.5937431", "0.59248924", "0.57467043", "0.5721739", "0.5638932", "0.5584096", "0.55563086", "0.5553404", "0.5487033", "0.5400404", "0.53917044", "0.53668934", "0.53653044", "0.5303664", "0.5296934", "0.52910006", "0.5274896", "0.5239275"...
0.63465446
1
Given an input field label, return a locator for the related input field This looks for a element with the given text, or a label with a span with the given text. The value of the 'for' attribute is then extracted from the label and used to create a new locator with that id. For example, the locator 'abc123' will be re...
def _get_input_field_locator(self, name): try: # we need to make sure that if a modal is open, we only find # the input element inside the modal. Otherwise it's possible # that the xpath could pick the wrong element. self.selenium.get_webelement(lex_locators["moda...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element_id_by_label(browser, label):\r\n for_id = browser.find_elements_by_xpath(str('//label[contains(., \"%s\")]' %\r\n label))\r\n if not for_id:\r\n return False\r\n return for_id[0].get_attribute('for')", "def compute_xpath_input_name_of_lab...
[ "0.6745804", "0.6711275", "0.6662311", "0.6331845", "0.60269594", "0.56949073", "0.55723345", "0.54360366", "0.53590757", "0.5343721", "0.52722913", "0.5173268", "0.51611763", "0.51282626", "0.512565", "0.50956", "0.5087571", "0.49649236", "0.49378383", "0.48838076", "0.48583...
0.63638973
3
Set focus to an element In addition to merely setting the focus, we click the mouse to the field in case there are functions tied to that event.
def _focus(self, element): actions = ActionChains(self.selenium.driver) actions.move_to_element(element).click().perform() self.selenium.set_focus_to_element(element)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setFocus(*args, **kwargs)->None:\n pass", "def OnSetFocus(self, event):\r\n\r\n self._owner.SetFocus()", "def set_focus(self, locator: Locator) -> None:\n element = self.ctx.get_element(locator)\n if not hasattr(element.item, \"SetFocus\"):\n raise ActionNotPossible(\n ...
[ "0.7593092", "0.75229216", "0.7500942", "0.7327072", "0.7300871", "0.7300871", "0.7300871", "0.7300871", "0.7252314", "0.7038113", "0.6970362", "0.6846653", "0.6653739", "0.66419196", "0.6593716", "0.65261585", "0.6503203", "0.64390767", "0.6426012", "0.6426012", "0.6426012",...
0.8282901
0
Clear the field, using any means necessary This is surprisingly hard to do with a generic solution. Some methods work for some components and/or on some browsers but not others. Therefore, several techniques are employed.
def _clear(self, element): element.clear() self.selenium.driver.execute_script("arguments[0].value = '';", element) # Select all and delete just in case the element didn't get cleared element.send_keys(Keys.HOME + Keys.SHIFT + Keys.END) element.send_keys(Keys.BACKSPACE) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clearField(self):\n self.field.setText(\"\")", "def clearField(self):\n self.field.setValue(self.default_val)", "def clearField(self):\n self.field.setValue(self.default_val)", "def clearField(self):\n self.field.clearFields()", "def clearField(self):\n raise Exceptio...
[ "0.84726983", "0.7901275", "0.7901275", "0.7807097", "0.7765736", "0.7625532", "0.7542695", "0.74903935", "0.7404852", "0.73436654", "0.72836494", "0.7239012", "0.7237266", "0.71757096", "0.71659225", "0.70995873", "0.70575094", "0.7030943", "0.6971853", "0.6969143", "0.69655...
0.7016099
18
Use bruteforce to clear an element This moves the cursor to the end of the input field and then issues a series of backspace keys to delete the data in the field.
def _force_clear(self, element): value = element.get_attribute("value") actions = ActionChains(self.selenium.driver) actions.move_to_element(element).click().send_keys(Keys.END) for character in value: actions.send_keys(Keys.BACKSPACE) actions.perform()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _clear(self, element):\n\n element.clear()\n self.selenium.driver.execute_script(\"arguments[0].value = '';\", element)\n\n # Select all and delete just in case the element didn't get cleared\n element.send_keys(Keys.HOME + Keys.SHIFT + Keys.END)\n element.send_keys(Keys.BACK...
[ "0.7640167", "0.7266357", "0.71256816", "0.6985051", "0.6673201", "0.6649528", "0.65886164", "0.65132946", "0.646155", "0.64538974", "0.64445746", "0.64432126", "0.6439535", "0.6426399", "0.64018774", "0.6384927", "0.63733244", "0.63733244", "0.63733244", "0.63733244", "0.637...
0.79356056
0
Enters multiple values from a mapping into form fields.
def populate_form(self, **kwargs): for name, value in kwargs.items(): self.populate_field(name, value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_values(self):\n for key in self.inputs.keys():\n value = self.inputs[key]['entry'].get()\n self.inputs[key]['value'] = value", "def _update_all_fields(self, name, value):\n for field in self._field_map.values():\n setattr(field, name, value)", "def mult...
[ "0.5659952", "0.5232755", "0.51979226", "0.51860756", "0.5185267", "0.5160687", "0.5100644", "0.5097913", "0.5079921", "0.50635326", "0.5046377", "0.50151217", "0.49936998", "0.49446088", "0.4937811", "0.49083483", "0.49044922", "0.489954", "0.4892619", "0.4890959", "0.488867...
0.6376247
0
Remove a record from the list of records that should be automatically removed.
def remove_session_record(self, obj_type, obj_id): try: self._session_records.remove({"type": obj_type, "id": obj_id}) except ValueError: self.builtin.log( "Did not find record {} {} in the session records list".format( obj_type, obj_id ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_record():\n # could use .../record/<name> in URL or as in this case as an argument .../record?name=bob\n if 'name' not in request.args:\n return \"need a name to delete a record!\", 400\n with RECORD_LOCK:\n if len([r for r in RECORDS if r.get('name') == request.args.get('name')])...
[ "0.7034022", "0.6982833", "0.69142175", "0.69113374", "0.68829197", "0.68307793", "0.67032003", "0.6521555", "0.6456832", "0.63513076", "0.6314116", "0.62977254", "0.6261102", "0.62341815", "0.6103095", "0.60772467", "0.60498047", "0.6044321", "0.59926325", "0.59657073", "0.5...
0.56806654
62
Selects a record type while adding an object.
def select_record_type(self, label): self.wait_until_modal_is_open() locator = lex_locators["object"]["record_type_option"].format(label) self._jsclick(locator) self.selenium.click_button("Next")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_type(self, typename, db):\n self._dbs[typename] = db\n return None", "def setRecord(self,record):\n idLower = record.getId().lower()\n type = record.name\n typeIds = self.indexed[type]\n if idLower in typeIds:\n oldRecord = typeIds[idLower]\n ...
[ "0.634989", "0.6107559", "0.6105183", "0.59830755", "0.5978904", "0.5968171", "0.5839918", "0.579843", "0.57609946", "0.5749956", "0.57482135", "0.5670924", "0.56359786", "0.56163234", "0.56163234", "0.56163234", "0.56163234", "0.56163234", "0.5583426", "0.556422", "0.5558005...
0.64888483
0
Navigates to a Salesforce App via the App Launcher
def select_app_launcher_app(self, app_name): locator = lex_locators["app_launcher"]["app_link"].format(app_name) self.open_app_launcher() self.selenium.wait_until_page_contains_element(locator, timeout=30) self.selenium.set_focus_to_element(locator) elem = self.selenium.get_webel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _go_to_page(self):\n self.salesforce.go_to_setup_home()\n self.eda.wait_for_new_window(\"Home | Salesforce\")\n self.selenium.switch_window(\"Home | Salesforce\")\n self.salesforce.wait_until_loading_is_complete()", "def open_app(device, package_name):\n\n device.shell('am star...
[ "0.6630189", "0.65731233", "0.6526059", "0.63613737", "0.60408837", "0.5917637", "0.577395", "0.5712062", "0.5689278", "0.56718296", "0.5667603", "0.5623108", "0.56094015", "0.5607468", "0.5590593", "0.5582051", "0.5543398", "0.5540418", "0.5524639", "0.5519889", "0.5515682",...
0.6569904
2
Navigates to a tab via the App Launcher
def select_app_launcher_tab(self, tab_name): locator = lex_locators["app_launcher"]["tab_link"].format(tab_name) self.open_app_launcher() self.selenium.wait_until_page_contains_element(locator) self.selenium.set_focus_to_element(locator) self._jsclick(locator) self.wait_u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go_to_tab(self, tab_name):\r\n\r\n if tab_name not in ['Courseware', 'Course Info', 'Discussion', 'Wiki', 'Progress']:\r\n self.warning(\"'{0}' is not a valid tab name\".format(tab_name))\r\n\r\n # The only identifier for individual tabs is the link href\r\n # so we find the tab...
[ "0.6880814", "0.6681028", "0.6590685", "0.6584148", "0.62873447", "0.62018365", "0.6067406", "0.5995313", "0.59724635", "0.59715986", "0.59331524", "0.58777994", "0.584674", "0.58315337", "0.58249784", "0.5794458", "0.5784082", "0.5779934", "0.5776915", "0.5733068", "0.572697...
0.7127252
0
Deletes a Salesforce object by object name and Id.
def salesforce_delete(self, obj_name, obj_id): self.builtin.log("Deleting {} with Id {}".format(obj_name, obj_id)) obj_class = getattr(self.cumulusci.sf, obj_name) obj_class.delete(obj_id) self.remove_session_record(obj_name, obj_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_delete(self, object_name, object_id):\n cmd = self.object_cmd(object_name, 'list')\n cmd_delete = self.object_cmd(object_name, 'delete')\n if object_id in self.cinder(cmd):\n self.cinder(cmd_delete, params=object_id)", "def delete_object(self, id):\n self.request...
[ "0.7758005", "0.76952064", "0.76122814", "0.74693274", "0.7362586", "0.73347324", "0.7282619", "0.7258193", "0.7237982", "0.72049564", "0.7141652", "0.7136172", "0.71041375", "0.7103634", "0.70919704", "0.7081055", "0.7081055", "0.7081055", "0.7081055", "0.70636696", "0.70365...
0.84441805
0
Gets a Salesforce object by Id and returns the result as a dict.
def salesforce_get(self, obj_name, obj_id): self.builtin.log(f"Getting {obj_name} with Id {obj_id}") obj_class = getattr(self.cumulusci.sf, obj_name) return obj_class.get(obj_id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, id):\n return {'id': id}", "def getbyid(self, id):\n\n return esd.retrieve(id)", "def get(cls, id):\n\n return cls.query.get(id)", "def get(cls, id):\n\n return cls.query.get(id)", "def get_object(id):", "async def get(self, collection: str, obj_id) -> dict:\n\t\...
[ "0.71033096", "0.65637094", "0.65452147", "0.65452147", "0.6522671", "0.64929986", "0.641275", "0.63342565", "0.6298969", "0.62821114", "0.627364", "0.62098897", "0.6207032", "0.6184861", "0.61029357", "0.6097872", "0.60920376", "0.6079806", "0.6054238", "0.6028868", "0.60259...
0.7229265
0
Creates a new Salesforce object and returns the Id. The fields of the object may be defined with keyword arguments where the keyword name is the same as the field name. The object name and Id is passed to the Store Session Record keyword, and will be deleted when the keyword Delete Session Records is called. As a best ...
def salesforce_insert(self, obj_name, **kwargs): self.builtin.log("Inserting {} with values {}".format(obj_name, kwargs)) obj_class = getattr(self.cumulusci.sf, obj_name) res = obj_class.create(kwargs) self.store_session_record(obj_name, res["id"]) return res["id"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ID(cls,objectid, **kkw):\n rec = cls(**kkw)\n rec.setObjectID(objectid) \n return rec", "def _create_instance(**kwargs):\n ctxt = context.get_admin_context()\n return db.instance_create(ctxt, _create_instance_dict(**kwargs))['id']", "def salesforce_delete(self, obj_name, o...
[ "0.6099784", "0.57673496", "0.5745987", "0.56620574", "0.5496389", "0.5413757", "0.54007477", "0.53912675", "0.5366959", "0.53419036", "0.53338027", "0.5332641", "0.5327667", "0.5312216", "0.52999014", "0.52999014", "0.52650034", "0.5248084", "0.5237554", "0.5214156", "0.5195...
0.7094382
0
Generate bulk test data This returns an array of dictionaries with templateformatted arguments which can be passed to the Salesforce Collection Insert keyword. You can use ``{{number}}`` to represent the unique index of the row in the list of rows. If the entire string consists of a number, Salesforce API will treat th...
def generate_test_data(self, obj_name, number_to_create, **fields): objs = [] for i in range(int(number_to_create)): formatted_fields = { name: format_str(value, {"number": i}) for name, value in fields.items() } newobj = self._salesforce_generate_obj...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_sample_data(no_of_records):\n rows_in_database = [{'id': counter, 'name': get_random_string(string.ascii_lowercase, 20), 'dt': '2017-05-03'}\n for counter in range(0, no_of_records)]\n return rows_in_database", "def _generate_samples(samples_data_table=None):\n samples_d...
[ "0.62281257", "0.58414435", "0.57256013", "0.56998044", "0.55656403", "0.5547948", "0.55262107", "0.54210865", "0.54113424", "0.54010236", "0.53936654", "0.5307927", "0.5285569", "0.52823174", "0.5281768", "0.52781165", "0.5264683", "0.5262325", "0.52562386", "0.5229721", "0....
0.6927312
0
Inserts records that were created with Generate Test Data. _objects_ is a list of data, typically generated by the Generate Test Data keyword. A 200 record limit is enforced by the Salesforce APIs. The object name and Id is passed to the Store Session Record keyword, and will be deleted when the keyword Delete Session ...
def salesforce_collection_insert(self, objects): assert ( not obj.get("id", None) for obj in objects ), "Insertable objects should not have IDs" assert len(objects) <= SF_COLLECTION_INSERTION_LIMIT, ( "Cannot insert more than %s objects with this keyword" % SF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_orm_bulk_insert(n):\n session = Session(bind=engine)\n session.execute(\n insert(Customer),\n [\n {\n \"name\": \"customer name %d\" % i,\n \"description\": \"customer description %d\" % i,\n }\n for i in range(n)\n ...
[ "0.64643896", "0.6081418", "0.60779667", "0.6074153", "0.5980561", "0.5979267", "0.5907617", "0.5818981", "0.5811491", "0.57162386", "0.57037383", "0.56994545", "0.5665415", "0.5661283", "0.5619838", "0.5602595", "0.5576301", "0.5541686", "0.5505862", "0.54812557", "0.5477006...
0.7367196
0
Updates records described as Robot/Python dictionaries. _objects_ is a dictionary of data in the format returned by the Salesforce Collection Insert keyword. A 200 record limit is enforced by the Salesforce APIs.
def salesforce_collection_update(self, objects): for obj in objects: assert obj[ "id" ], "Should be a list of objects with Ids returned by Salesforce Collection Insert" if STATUS_KEY in obj: del obj[STATUS_KEY] assert len(objects) <= S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def partial_update_objects(self, objects):\n requests = []\n for obj in objects:\n requests.append({\"action\": \"partialUpdateObject\", \"objectID\": obj[\"objectID\"], \"body\": obj})\n request = {\"requests\": requests}\n return self.batch(request)", "def save_objects(se...
[ "0.74889565", "0.7275556", "0.67248726", "0.6552144", "0.6240532", "0.61281914", "0.5878936", "0.5844297", "0.58166015", "0.5668504", "0.56546557", "0.565175", "0.5629312", "0.5626341", "0.5616312", "0.5604614", "0.55680174", "0.5566948", "0.55641276", "0.55485463", "0.551291...
0.79533464
0
Constructs and runs a simple SOQL query and returns a list of dictionaries. By default the results will only contain object Ids. You can specify a SOQL SELECT clase via keyword arguments by passing a commaseparated list of fields with the ``select`` keyword argument.
def salesforce_query(self, obj_name, **kwargs): query = "SELECT " if "select" in kwargs: query += kwargs["select"] else: query += "Id" query += " FROM {}".format(obj_name) where = [] for key, value in kwargs.items(): if key == "select":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query_object_raw(self, o):\n self.setQuery(\"\"\"\n Select ?s ?p where {\n ?s ?p %s\n } ORDER BY (?s)\"\"\" % (o))\n\n try:\n rval = self.query()\n g = rval.convert()\n return [(x['s'], x['p']) for x in g['results']['bindings']]\n excep...
[ "0.59299433", "0.58073217", "0.5761999", "0.571226", "0.5626093", "0.55796915", "0.5573094", "0.54810995", "0.5442956", "0.54407555", "0.5440693", "0.54233193", "0.5400067", "0.5384152", "0.53717834", "0.53488815", "0.53299403", "0.5325337", "0.53251", "0.532294", "0.5310475"...
0.71230334
0
Updates a Salesforce object by Id. The keyword returns the result from the underlying simple_salesforce ``insert`` method, which is an HTTP status code. As with `Salesforce Insert`, field values are specified as keyword arguments. The following example assumes that ${contact id} has been previously set, and adds a Desc...
def salesforce_update(self, obj_name, obj_id, **kwargs): self.builtin.log( "Updating {} {} with values {}".format(obj_name, obj_id, kwargs) ) obj_class = getattr(self.cumulusci.sf, obj_name) return obj_class.update(obj_id, kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(self, id):\n return Contacts().update_one(id, request.json)", "def update_contact(self, context, payload):\n\n if context.get('headers').get('api_key') is None or context.get('headers').get('app_id') is None:\n raise Exception(\"Please provide Api-Key and Api-Appid\")\n \n...
[ "0.6796243", "0.66646194", "0.65797853", "0.6524307", "0.65121305", "0.6400086", "0.6356132", "0.6187858", "0.6113421", "0.60885215", "0.5942049", "0.59296274", "0.59255993", "0.5884791", "0.58503395", "0.5847934", "0.5845939", "0.58335674", "0.5808931", "0.58066744", "0.5793...
0.64649135
5
Runs a simple SOQL query and returns the dict results The _query_ parameter must be a properly quoted SOQL query statement. The return value is a dictionary. The dictionary contains the keys as documented for the raw API call. The most useful key is ``records``, which contains a list of records which were matched by th...
def soql_query(self, query): self.builtin.log("Running SOQL Query: {}".format(query)) return self.cumulusci.sf.query_all(query)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_records_query(query):\n result, hits, output = execute_basic(TYPE_RECORD, query)\n for rec in hits.get('hits', []):\n record = rec.get('_source')\n record['score'] = rec.get('_score')\n record['text'] = rec.get('highlight', {}).get('text')\n output['results'].append(re...
[ "0.6876594", "0.6448251", "0.6260428", "0.62032634", "0.6186823", "0.6174165", "0.612572", "0.61155254", "0.607906", "0.60382897", "0.6013262", "0.59480464", "0.5928375", "0.5904451", "0.58017564", "0.5784412", "0.57576144", "0.57267946", "0.5713506", "0.57090914", "0.5686935...
0.61896497
4
Stores a Salesforce record's Id for use in the Delete Session Records keyword. This keyword is automatically called by Salesforce Insert.
def store_session_record(self, obj_type, obj_id): self.builtin.log("Storing {} {} to session records".format(obj_type, obj_id)) self._session_records.append({"type": obj_type, "id": obj_id})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_record(self, record_id):\r\n self.record.deleteObject(id=record_id)", "def salesforce_delete(self, obj_name, obj_id):\n self.builtin.log(\"Deleting {} with Id {}\".format(obj_name, obj_id))\n obj_class = getattr(self.cumulusci.sf, obj_name)\n obj_class.delete(obj_id)\n ...
[ "0.655404", "0.63315195", "0.63199645", "0.62394655", "0.6121925", "0.58118975", "0.5748757", "0.5679553", "0.5669685", "0.56032157", "0.56032157", "0.55656755", "0.5536358", "0.55261534", "0.5509624", "0.5463475", "0.5460917", "0.5456755", "0.54553473", "0.5435946", "0.54230...
0.5784279
6
Wait for modal to open
def wait_until_modal_is_open(self): self.selenium.wait_until_page_contains_element( lex_locators["modal"]["is_open"], timeout=15, error="Expected to see a modal window, but didn't", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until_modal_is_closed(self):\n self.selenium.wait_until_page_does_not_contain_element(\n lex_locators[\"modal\"][\"is_open\"], timeout=15\n )", "def check_modal(client):\n modal_close_btn_xpath = \"/html/body/div[9]/div[3]/div/button[1]\"\n\n try:\n modal_close_btn ...
[ "0.7622249", "0.7095724", "0.70760953", "0.7060797", "0.6790178", "0.6715883", "0.6715883", "0.6715883", "0.6715883", "0.6562302", "0.64118767", "0.64118767", "0.64118767", "0.64118767", "0.6298654", "0.622454", "0.62229896", "0.61371136", "0.6118723", "0.59900486", "0.593611...
0.8239222
0
Wait for modal to close
def wait_until_modal_is_closed(self): self.selenium.wait_until_page_does_not_contain_element( lex_locators["modal"]["is_open"], timeout=15 )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until_modal_is_open(self):\n self.selenium.wait_until_page_contains_element(\n lex_locators[\"modal\"][\"is_open\"],\n timeout=15,\n error=\"Expected to see a modal window, but didn't\",\n )", "def check_modal(client):\n modal_close_btn_xpath = \"/html/b...
[ "0.7273317", "0.71254295", "0.68904704", "0.6873608", "0.6804555", "0.68041027", "0.6513829", "0.61945766", "0.6140105", "0.6140105", "0.6140105", "0.6140105", "0.60835415", "0.6065856", "0.6049788", "0.60275036", "0.59850746", "0.59787047", "0.59585005", "0.592383", "0.59188...
0.8103863
0
Wait for LEX page to load. (We're actually waiting for the actions ribbon to appear.)
def wait_until_loading_is_complete(self, locator=None): locator = lex_locators["body"] if locator is None else locator try: self.selenium.wait_until_page_contains_element(locator) self.wait_for_aura() # this knowledge article recommends waiting a second. I don't ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_page_load(self):\n pass", "def wait_for_page_load(self):\n # For right now, just wait for 2 seconds since webdriver returns when loaded.\n # TODO: switch to waiting for network idle\n time.sleep(2)", "def wait_front_page_load(self, timeout=DEFAULT_LOGIN_TIMEOUT):\n ...
[ "0.7558595", "0.68268955", "0.68262166", "0.64772445", "0.61812717", "0.6159595", "0.60686195", "0.5997278", "0.58562386", "0.58362883", "0.57594675", "0.5720463", "0.57074416", "0.56784874", "0.5639317", "0.5621778", "0.5602068", "0.5602068", "0.5563476", "0.5552708", "0.554...
0.6509503
3
Waits until we are able to render the initial salesforce landing page It will continue to refresh the page until we land on a lightning page or until a timeout has been reached. The timeout can be specified in any time string supported by robot
def wait_until_salesforce_is_ready(self, locator=None, timeout=None, interval=5): # Note: we can't just ask selenium to wait for an element, # because the org might not be availble due to infrastructure # issues (eg: the domain not being propagated). In such a case # the element will ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_front_page_load(self, timeout=DEFAULT_LOGIN_TIMEOUT):\n conditions = [\n invisibility_of_element_located(self.page.button_accept.locator),\n invisibility_of_element_located(self.page.div_loading_documents.locator),\n invisibility_of_element_located(self.page.div_loa...
[ "0.66434354", "0.6375672", "0.6361778", "0.62447697", "0.60764015", "0.60569257", "0.60387635", "0.60162246", "0.6012954", "0.60054886", "0.59714395", "0.5865687", "0.5821413", "0.5795354", "0.5770845", "0.57457644", "0.57266104", "0.5703139", "0.5673199", "0.5658159", "0.565...
0.66569376
0
Serves as a breakpoint for the robot debugger
def breakpoint(self): return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gdb_breakpoint():\n _gdb_python_call_gen('gdb_breakpoint')()", "def add_breakpoint():\n raise NotImplementedError()", "def pdb_view(request):\n import pdb; pdb.set_trace()\n return HttpResponse(\"This works.\")", "def debug():\n # written before I knew about the pdb module\n caller = curren...
[ "0.80616933", "0.708041", "0.6795347", "0.67953384", "0.6641149", "0.6635265", "0.66266686", "0.6533395", "0.6507743", "0.64715624", "0.64667577", "0.6454341", "0.6438292", "0.6403162", "0.63000405", "0.6268363", "0.62050426", "0.6176233", "0.61758935", "0.616019", "0.6157194...
0.7725402
1
Switch to lightning if we land on a classic page This seems to happen randomly, causing tests to fail catastrophically. The idea is to detect such a case and autoclick the "switch to lightning" link
def _check_for_classic(self): try: # we don't actually want to wait here, but if we don't # explicitly wait, we'll implicitly wait longer than # necessary. This needs to be a quick-ish check. self.selenium.wait_until_element_is_visible( "class:swi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lightning_turnon(self):\n self.turnOn()", "def test_light_interface(light_name='head_green_light'):\n l = Lights()\n rospy.loginfo(\"All available lights on this robot:\\n{0}\\n\".format(\n ', '.join(l.list_all_lights())))\n rospy.loginfo(\"Blinki...
[ "0.6474351", "0.6049255", "0.60098785", "0.58803", "0.571039", "0.5609471", "0.5589023", "0.5588631", "0.55719453", "0.552486", "0.5519454", "0.5497041", "0.5464873", "0.5446799", "0.54293966", "0.5422532", "0.5421984", "0.5421487", "0.5380591", "0.536266", "0.5356685", "0....
0.73217934
0
Handle the case where we land on a login screen Sometimes we get redirected to a login URL rather than being logged in, and we've yet to figure out precisely why that happens. Experimentation shows that authentication has already happened, so in this case we'll try going back to the instance url rather than the front d...
def _check_for_login_failure(self): location = self.selenium.get_location() if "//test.salesforce.com" in location or "//login.salesforce.com" in location: login_url = self.cumulusci.org.config["instance_url"] self.builtin.log(f"setting login_url temporarily to {login_url}", "DE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(self):\n identity = request.environ.get('repoze.who.identity')\n came_from = str(request.GET.get('came_from', '')) or \\\n url('/')\n if identity:\n redirect(url(came_from))\n else:\n c.came_from = came_from\n c.login_counter...
[ "0.72486156", "0.7233952", "0.7159176", "0.7072958", "0.7041602", "0.699048", "0.6865217", "0.67884225", "0.677518", "0.6756044", "0.669548", "0.6681277", "0.66732764", "0.6644884", "0.662254", "0.65995103", "0.65877813", "0.6563334", "0.6563334", "0.6560527", "0.6530429", ...
0.0
-1
r""" Return all rows from sql table that match condition.
def read_all_rows(condition, database, table): connection = sqlite3.connect(database) connection.row_factory = sqlite3.Row cursor = connection.cursor() cursor.execute('SELECT * FROM ' + table + ' WHERE ' + condition) rows = cursor.fetchall() cursor.close() connection.close() return rows
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(self, table_name: str, row_filter: dict) -> list:\n sql = 'SELECT * FROM ' + table_name + ' WHERE '\n for key, value in row_filter.items():\n if type(value) is tuple:\n sql += key + ' '\n sql += value[0] + ' '\n sql += \"'\" + value[1...
[ "0.6921658", "0.68708515", "0.67352384", "0.66947955", "0.66095924", "0.65919626", "0.6581109", "0.6542389", "0.65064514", "0.6394499", "0.63609296", "0.6296992", "0.6295895", "0.622317", "0.6203416", "0.6198122", "0.619671", "0.61933297", "0.61845225", "0.61834896", "0.61724...
0.7410855
0
r""" Return cursor object which can iterate through rows matching condition.
def cursor_with_rows(condition, database, table): connection = sqlite3.connect(database) connection.row_factory = sqlite3.Row cursor = connection.cursor() cursor.execute('SELECT * FROM ' + table + ' WHERE ' + condition) return cursor, connection
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor(self):\n with self.connection() as conn:\n cursor = conn.cursor(prepared=True)\n try:\n yield cursor\n finally:\n cursor.close()", "def rowgen(searchcursor_rows):\n rows = searchcursor_rows\n ro...
[ "0.6193378", "0.6168785", "0.6114055", "0.6057929", "0.60495085", "0.59896654", "0.592929", "0.5915509", "0.59063196", "0.59040475", "0.59040475", "0.5888552", "0.58679223", "0.5834532", "0.577474", "0.5744007", "0.57143974", "0.57027924", "0.5641648", "0.56361765", "0.563343...
0.7218549
0
r""" Close connection and cursor.
def close(connection, cursor): cursor.close() connection.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n if self.cursor:\n self.cursor.close()\n if self.conn:\n self.conn.close()", "def close_connection(self):\n self.cursor.close()\n self.connection.close()", "def close(cursor, conn):\n cursor.close()\n conn.close()", "def __clos...
[ "0.83350396", "0.83227044", "0.8266605", "0.8200751", "0.81766593", "0.79859394", "0.7881802", "0.7783966", "0.77768856", "0.77637964", "0.7759937", "0.7715322", "0.7711181", "0.77009636", "0.7679163", "0.76544863", "0.76360935", "0.7625238", "0.7625238", "0.7625238", "0.7615...
0.835283
0
this is adapted from code by Sebastian Dahlgren
def ssh_command(ssh,command,noprint=False): # Send the command (non-blocking) print("ssh> " + command) stdin,stdout,stderr = ssh.exec_command(command) # Wait for the command to terminate last_line = '' complete_received = '' while not stdout.channel.exit_status_ready(): # Only print da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exo2():", "def substantiate():", "def degibber(self):", "def regular(self):", "def _regr_basic():", "def cx():", "def falcon():", "def preprocess(self):", "def exercise_b2_53():\r\n pass", "def support(self):", "def sth():", "def exercise_b2_106():\r\n pass", "def use(self):", "...
[ "0.60299593", "0.5892087", "0.57498854", "0.57194114", "0.5715358", "0.56828845", "0.55236274", "0.5419346", "0.54116005", "0.54081154", "0.53808916", "0.53618544", "0.5324013", "0.5302614", "0.5299262", "0.5299262", "0.5299262", "0.5299262", "0.5299262", "0.5299262", "0.5299...
0.0
-1
this is adapted from code by Sebastian Dahlgren
def ssh_connect(cf): try: ssh = paramiko.SSHClient() ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(cf.server,username=cf.username) print("Connected to %s" % cf.server) except paramiko.AuthenticationException as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exo2():", "def substantiate():", "def degibber(self):", "def regular(self):", "def _regr_basic():", "def cx():", "def falcon():", "def preprocess(self):", "def exercise_b2_53():\r\n pass", "def support(self):", "def sth():", "def exercise_b2_106():\r\n pass", "def use(self):", "...
[ "0.6030258", "0.5893122", "0.5750985", "0.5720798", "0.5716037", "0.5683565", "0.5524006", "0.5419422", "0.5411884", "0.54090285", "0.53825855", "0.53617215", "0.53249943", "0.530355", "0.53003025", "0.53003025", "0.53003025", "0.53003025", "0.53003025", "0.53003025", "0.5300...
0.0
-1
Find where values of a first tensor are equal to values of a second one.
def where_in(a, b): return torch.nonzero((a[..., None] == b).any(-1)).squeeze()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def intersect1d(tensor1, tensor2):\n aux = torch.cat((tensor1, tensor2), dim=0)\n aux = aux.sort()[0]\n return aux[:-1][(aux[1:] == aux[:-1]).data]", "def check_equal(tensor_1, tensor_2):\n return tf.reduce_max(tf.abs(tensor_1 - tensor_2)).numpy() < 1e-6", "def _at_least_x_are_equal(a, b, x):\n ma...
[ "0.69859505", "0.6417683", "0.62976325", "0.62053716", "0.6149471", "0.6149237", "0.6107486", "0.6081227", "0.606979", "0.5993573", "0.59305525", "0.58065206", "0.57969844", "0.5771546", "0.57571447", "0.56957847", "0.56957316", "0.56669915", "0.5662999", "0.564584", "0.55743...
0.65178233
1
Randomly choose n elements from a 1dtensor.
def choose(n, a): return torch.as_tensor([a[idx] for idx in torch.randperm(len(a))[:n]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sample(self, n=1):\n return [self[i] for i in np.random.choice(self.length, n, replace=False)]", "def random_sampling(elements, n):\r\n import random\r\n return [random.choice(elements) for i in range(n)]", "def Sample(n=6):\n t = [random.normalvariate(0.0, 1.0) for i in range(n)]\n t.s...
[ "0.7265496", "0.7151787", "0.684487", "0.68300295", "0.6747794", "0.6736281", "0.67220575", "0.67206866", "0.6678554", "0.6662675", "0.6657964", "0.6632153", "0.6624737", "0.66138387", "0.6607942", "0.6597783", "0.65779805", "0.65667385", "0.6557566", "0.6545551", "0.6535659"...
0.744539
0
Unpack the data from a JSON object and create encodings. This function assumes that for each synset, its lemma on highway is always at index 0.
def process_data(self, json_dict: dict): all_token_ids = [] all_level_ids = [] all_synset_ids = [] all_lemma_ids = [] all_is_highway = [] all_targets = [] def tokenize(lemma_): return self.tokenizer( lemma_, add_special...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_to_packstream(cls, data):\n # TODO: other partial hydration\n if \"self\" in data:\n if \"type\" in data:\n return Structure(ord(b\"R\"),\n cls._uri_to_id(data[\"self\"]),\n cls._uri_to_id(data[\"start\...
[ "0.55587035", "0.53674453", "0.505383", "0.50060594", "0.5005306", "0.4995134", "0.49444664", "0.49142903", "0.48940662", "0.4857965", "0.4856359", "0.48483723", "0.48413804", "0.48019016", "0.47903192", "0.47873363", "0.47782275", "0.47761175", "0.47713354", "0.47687137", "0...
0.64224637
0
The function fetches action infromation from the db given action information it runs Karger's algorithm it marks anctions and annotations based on the output it writes information back to the db
def run_offline_computations(session): ActionClass = ActionMixin.cls ItemClass = ItemMixin.cls # Creates graph graph = gk.Graph() # Fetches all actions actions = ActionClass.sk_get_actions_offline_spam_detect(session) items = ItemClass.sk_get_items_offline_spam_detect(session) # Adds inf...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_action(self, action):\n if action[0] == 10: # Query\n return self.process_query(action)\n elif action[0] == 20: # Look at a document\n return self.examine_document(action)", "def apply_action(self, action):\n agent = action['action_details']['agent_id']\n ...
[ "0.59102964", "0.58218175", "0.5718176", "0.57159907", "0.5639502", "0.5600681", "0.55872303", "0.54870325", "0.5480381", "0.5479079", "0.5463407", "0.5455286", "0.5414611", "0.5407148", "0.5381112", "0.5347308", "0.53001034", "0.5289037", "0.52551705", "0.52476245", "0.52448...
0.0
-1
Adds spam information a graph for detection using Karger's algorithm.
def _add_spam_info_to_graph_k(graph, items, actions): # Adds flag information (graph.add_answer(...)) to the graph object. for act in actions: if act.type == ACTION_FLAG_SPAM: # Spam flag! graph.add_answer(act.user_id, act.item_id, -1, base_reliability = act.user....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spam(bot, msg):\n\n sendername = msg.sendername\n\n if msg.command != \"PRIVMSG\" or sendername in bot.services:\n return\n\n message = msg.args[1]\n\n if sendername not in spammers or message != spammers[sendername][0]:\n spammers[sendername] = [message, 0]\n else:\n spamme...
[ "0.60310346", "0.5441528", "0.5307215", "0.5306278", "0.5292672", "0.5228955", "0.5169543", "0.51104075", "0.50563246", "0.50283116", "0.5006519", "0.49944475", "0.4940373", "0.49399513", "0.49128112", "0.49016973", "0.4895419", "0.48774913", "0.483557", "0.48349544", "0.4821...
0.74099356
0
The function udoes flagging spam/ham without checking for original action in the DB (it is assumed that it should be done outside the function)
def _undo_spam_ham_flag(item, user, session, spam_flag=True): answr = -1 if spam_flag else 1 if item.sk_frozen: # The item is known as spam/ham. val = np.sign(item.sk_weight) * answr * BASE_SPAM_INCREMENT user.sk_base_reliab -= val return # Okay, item participate in offline s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _raise_spam_ham_flag_fresh(item, user, timestamp,\n session, spam_flag=True):\n # Creates a record in Action table\n if spam_flag:\n answr = -1\n act = ActionMixin.cls(item.id, user.id, ACTION_FLAG_SPAM, timestamp)\n item.spam_flag_counter += 1\n ...
[ "0.6985311", "0.59789354", "0.59601426", "0.5940987", "0.5914589", "0.58679473", "0.58446145", "0.57047296", "0.56003463", "0.5582888", "0.5571693", "0.5566933", "0.55616117", "0.5528202", "0.5487382", "0.54783595", "0.5448711", "0.5412162", "0.5398329", "0.5384775", "0.53812...
0.6337893
1
The function flags spam/ham on the item. It is assumed that the item was not flagged as spam/ham by the user.
def _raise_spam_ham_flag_fresh(item, user, timestamp, session, spam_flag=True): # Creates a record in Action table if spam_flag: answr = -1 act = ActionMixin.cls(item.id, user.id, ACTION_FLAG_SPAM, timestamp) item.spam_flag_counter += 1 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _undo_spam_ham_flag(item, user, session, spam_flag=True):\n answr = -1 if spam_flag else 1\n if item.sk_frozen:\n # The item is known as spam/ham.\n val = np.sign(item.sk_weight) * answr * BASE_SPAM_INCREMENT\n user.sk_base_reliab -= val\n return\n # Okay, item participate ...
[ "0.7864932", "0.6828174", "0.63705266", "0.6302362", "0.6109251", "0.58881116", "0.58711064", "0.57879716", "0.5656033", "0.56387347", "0.55657727", "0.55283886", "0.55069524", "0.53776723", "0.5350696", "0.53247046", "0.53102404", "0.5235352", "0.5226677", "0.5216656", "0.52...
0.7826373
1
Deletes spam action from the db, it takes care of spam flag counter.
def _delete_spam_action(act, session): if act is None: return act.item.spam_flag_counter -= 1 session.delete(act)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_activity():\n pass", "def delete_spam_item_by_author(item, session):\n actions = ActionMixin.cls.get_actions_on_item(item.id, session)\n if item.sk_frozen:\n # If the item is frozen then users who flagged it already got changes\n # to their spam reliability.\n # In this c...
[ "0.63294035", "0.62134814", "0.6096816", "0.5966107", "0.5942011", "0.5865762", "0.5857666", "0.5855021", "0.58430976", "0.58430976", "0.58430976", "0.58430976", "0.58396226", "0.57542235", "0.5742879", "0.5742321", "0.57266784", "0.57226205", "0.5712291", "0.5710714", "0.570...
0.8381546
0
If item is deleted by author then there is no reputation damage to the author, plus users who flagged it receive boost to base reliability.
def delete_spam_item_by_author(item, session): actions = ActionMixin.cls.get_actions_on_item(item.id, session) if item.sk_frozen: # If the item is frozen then users who flagged it already got changes # to their spam reliability. # In this case the user's karma user also has changes to it...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_item(self, item_id, user_id):\r\n item = self._db_manager.get_item(item_id)\r\n if item is None:\r\n flash(\"Invalid item.\")\r\n return\r\n if item[\"user_id\"] != user_id:\r\n flash(\"Only the original creator can delete an item.\")\r\n ...
[ "0.6042252", "0.58367413", "0.57703066", "0.5738266", "0.57119405", "0.57119405", "0.5659373", "0.56316453", "0.5622158", "0.5544149", "0.5543135", "0.5539816", "0.55358565", "0.55128115", "0.55047125", "0.55024445", "0.5482617", "0.5474065", "0.5461759", "0.5452901", "0.5446...
0.7050691
0
Extract numerical data for data analysis. The data generated here should be able to be directly used in machine learning packages such as sklearn.
def _extract_data(self) -> np.ndarray: mats = Material.objects.all() mat_arrays = [] for mat in mats: # django queryset -> python list mat_features = [] # Add data # Some data are missing here. #TODO: Delete those if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_data():\n data = [np.array([32.,595.]),\n np.array([30.,599.]),\n np.array([18.,622.]),\n np.array([51.,606.]),\n np.array([38.,578.])]\n return data", "def get_data():\r\n spatial_expmat = np.load('/home/anniegao/spatial_magan/data/spatial_pca_with_co...
[ "0.66716206", "0.6373898", "0.6116155", "0.6062082", "0.6051417", "0.60368246", "0.6000983", "0.5969263", "0.59440583", "0.594246", "0.59292024", "0.5926102", "0.58919245", "0.58629364", "0.5860401", "0.5843536", "0.5836818", "0.5818033", "0.5801506", "0.5788108", "0.57813793...
0.62617147
2
Extract PVT and 7Param data for data analysis. Only extract the most important features, which are PVT data and 7Param data for machine learning algorithm.
def _extract_imp_data(self) -> np.ndarray: mats = Material.objects.all() mat_arrays = [] for mat in mats: # django queryset -> python list mat_features = [] # Add data # Some data are missing here. #TODO: Delete those...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_features(self):\n self.extract_features_static()\n self.extract_features_dynamic()", "def _extract_features(self):\n # print(os.getpid())\n return {n:self._extract_feature(f) for (n,f) in self.features.items()}", "def extractFeatures(self, datum):\n abstract", "...
[ "0.63477063", "0.6009554", "0.58986515", "0.58936614", "0.5770655", "0.57358736", "0.5719346", "0.5631496", "0.56190664", "0.56025267", "0.5574645", "0.55543464", "0.5519124", "0.55074036", "0.5504653", "0.5490351", "0.5479932", "0.54705286", "0.54514164", "0.5434877", "0.543...
0.52204204
50
Preprocess data after extracted for ml. As the the scale between features are very difference, running scaling normalization before put data into machine learning algorithm is essential.
def _preprocess(self, data, normalize=False) -> np.ndarray: preprocessor = StandardScaler() if not normalize else Normalizer() data = preprocessor.fit_transform(data) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_data(self):\n\n self._preprocess_train_data()\n self._preprocess_test_data()", "def data_preprocessing_TA(X):\n \n #Removing the mean and scaling the data\n X_prep=StandardScaler().fit_transform(X)\n #do here your preprocessing\n return X_prep", "def preprocess(data)...
[ "0.7693326", "0.7410056", "0.73902357", "0.72746557", "0.72113276", "0.71665233", "0.7021973", "0.6938132", "0.69301885", "0.69071275", "0.6894873", "0.68790245", "0.6878616", "0.68515855", "0.6807007", "0.67938256", "0.67871", "0.6757415", "0.6750153", "0.67189497", "0.67176...
0.7775244
0
Run the data similarity analysis for the project. After getting a get request, the application run the data similarity analysis and give back the possible results.
def get(self, request, mat_pk:int, params:str="all", target_results:int=Conf.results_num, components:int=pcaConf.components): try: mats_id = [x.id for x in Material.objects.all()] # Get data from database and prepocess those data. # Preprocess use Standa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_analysis(ckpt, queries_type, entities_type, request):\n global currently_analyzing, results, d, analysis_user\n try:\n print(\"starting analysis!\")\n if entities_type == \"all\":\n print(\"using all entities detected!\")\n elif entities_type == \"uploaded\":\n ...
[ "0.5790701", "0.5675038", "0.5589162", "0.55791926", "0.55663115", "0.55436003", "0.5514665", "0.55100244", "0.54896605", "0.54859126", "0.5473931", "0.5472289", "0.5463743", "0.54581034", "0.5457119", "0.54463804", "0.5431948", "0.53738683", "0.5371428", "0.53505945", "0.534...
0.0
-1