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
Returns the set of all objects instead of just live objects
def queryset(self, request): qs = self.model.all_objects.get_query_set() ordering = self.ordering or () if ordering: qs = qs.order_by(*ordering) return qs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def objects_in_use(self):\n return set()", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(self):\n return self.__objects", "def all(sel...
[ "0.80215394", "0.7922002", "0.7922002", "0.7922002", "0.7922002", "0.7922002", "0.7922002", "0.7845179", "0.7754362", "0.7715909", "0.7468645", "0.74566925", "0.7332164", "0.7307938", "0.72778046", "0.71881217", "0.707433", "0.7026089", "0.7010139", "0.7000168", "0.6991465", ...
0.0
-1
Creating a custom time entry, minimum must is hour duration and project param
def createTimeEntry(self, hourduration, description=None, projectid=None, projectname=None, taskid=None, clientname=None, year=None, month=None, day=None, hour=None, billable=False, hourdiff=-2): data = { "time_entry": {} } if not projectid: if projectname and clientname: projectid = (self.getClientProject(clientname, projectname))['data']['id'] elif projectname: projectid = (self.searchClientProject(projectname))['data']['id'] else: print('Too many missing parameters for query') exit(1) if description: data['time_entry']['description'] = description if taskid: data['time_entry']['tid'] = taskid year = datetime.now().year if not year else year month = datetime.now().month if not month else month day = datetime.now().day if not day else day hour = datetime.now().hour if not hour else hour timestruct = datetime(year, month, day, hour + hourdiff).isoformat() + '.000Z' data['time_entry']['start'] = timestruct data['time_entry']['duration'] = hourduration * 3600 data['time_entry']['pid'] = projectid data['time_entry']['created_with'] = 'NAME' data['time_entry']['billable'] = billable response = self.postRequest(Endpoints.TIME_ENTRIES, parameters=data) return self.decodeJSON(response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_custom_hour(arg):\n pass", "def __init__(self, hour, minute=0, second=0, microsecond=0, tzinfo=None):", "def timeField(*args, annotation: Union[AnyStr, bool]=\"\", backgroundColor: Union[List[float,\n float, float], bool]=None, changeCommand: Script=None, defineTemplate: AnyStr=\"\"...
[ "0.63917255", "0.63114077", "0.5988722", "0.5984777", "0.59670573", "0.59660786", "0.59379464", "0.5916419", "0.58417237", "0.58348185", "0.5833585", "0.5783263", "0.5764132", "0.5757329", "0.5752414", "0.57444865", "0.57442397", "0.5735035", "0.57336044", "0.5732334", "0.572...
0.68871313
0
Return all of the projects for a given Workspace
def getWorkspaceProjects(self, id): return self.request(Endpoints.WORKSPACES + '/{0}'.format(id) + '/projects')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_projects(self):\n projects = []\n page = 1\n while not len(projects) % 100:\n projects += self._get('/projects?{0}'.format(urllib.urlencode({'per_page': 100, 'page': page})))\n if not projects:\n break\n page += 1\n return projects...
[ "0.74932694", "0.7458052", "0.7392975", "0.73838377", "0.737569", "0.7349293", "0.730423", "0.7239146", "0.72044575", "0.7192277", "0.71775115", "0.71413183", "0.71402687", "0.713788", "0.71083647", "0.7094535", "0.7094002", "0.7023004", "0.6982993", "0.6981023", "0.6948548",...
0.7177935
10
Provide only a projects name for query and search through entire available names
def searchClientProject(self, name): for client in self.getClients(): try: for project in self.getClientProjects(client['id']): if project['name'] == name: return project except Exception: continue print('Could not find client by the name') return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_projects_by_name(self, name):\n projects = []\n for i in storage_utils.get_proj_ids(self._storage_location):\n project = self.find_project_by_id(i)\n if name.upper() in project.name.upper():\n projects.append(project)\n return projects", "def tes...
[ "0.711047", "0.6944019", "0.6936128", "0.6779344", "0.6688481", "0.66640425", "0.6621097", "0.66138625", "0.6602506", "0.6593444", "0.6547937", "0.6496374", "0.6491965", "0.6417066", "0.6392265", "0.636261", "0.635305", "0.6313007", "0.62534356", "0.6243291", "0.62387365", ...
0.6892241
3
Fast query given the Client's name and Project's name
def getClientProject(self, clientName, projectName): for client in self.getClients(): if client['name'] == clientName: cid = client['id'] if not cid: print('Could not find such client name') return None for projct in self.getClientProjects(cid): if projct['name'] == projectName: pid = projct['id'] if not pid: print('Could not find such project name') return None return self.getProject(pid)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def searchClientProject(self, name):\n for client in self.getClients():\n try:\n for project in self.getClientProjects(client['id']):\n if project['name'] == name:\n return project\n except Exception:\n continue\n\...
[ "0.68639714", "0.61412024", "0.5989478", "0.5867039", "0.5781275", "0.5674645", "0.566956", "0.56622523", "0.5642613", "0.5634638", "0.55459017", "0.5535563", "0.5528021", "0.5521917", "0.5521528", "0.54804444", "0.5467839", "0.5415431", "0.5400909", "0.53992367", "0.53678286...
0.6326702
1
return all tasks of a given project
def getProjectTasks(self, pid, archived=False): return self.request(Endpoints.PROJECTS + '/{0}'.format(pid) + '/tasks')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tasks_of_project(self, project_id):\n res = self.conn.cursor().execute(\"SELECT * FROM tasks WHERE project_id=? ORDER BY project_order\", (project_id,))\n return res.fetchall()", "def get_tasks_list(project_id):\n project = Project.query.filter_by(id=project_id).first()\n if not proje...
[ "0.7955744", "0.75765634", "0.7526731", "0.7374001", "0.735808", "0.73461324", "0.7285441", "0.72829795", "0.7264477", "0.72372395", "0.722166", "0.7205922", "0.714417", "0.7095142", "0.70789766", "0.70438063", "0.6978584", "0.6959845", "0.6954135", "0.6882514", "0.68778336",...
0.7401329
3
create a new client
def createClient(self, name, wid, notes=None): data = {} data['client'] = {} data['client']['name'] = name data['client']['wid'] = wid data['client']['notes'] = notes response = self.postRequest(Endpoints.CLIENTS, parameters=data) return self.decodeJSON(response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_client(self) -> None:\n pass", "def create_client(name):\n client = Client(name=name)\n print(client.client_secret)\n db.session.add(client)\n db.session.commit()\n return client", "def create(ctx, name, company, mail, age):\n client = Client(name,company,mail,age)\n client_s...
[ "0.84618115", "0.7922506", "0.76412994", "0.7560049", "0.72630185", "0.7126018", "0.70866805", "0.7063268", "0.7053907", "0.70391697", "0.7030181", "0.702756", "0.69890064", "0.6928916", "0.6843426", "0.68396825", "0.6788722", "0.676113", "0.67482334", "0.67339486", "0.672684...
0.69494456
13
Update data for an existing client. If the name or notes parameter is not supplied, the existing data on the Toggl server will not be changed.
def updateClient(self, id, name=None, notes=None): data = {} data['client'] = {} data['client']['name'] = name data['client']['notes'] = notes response = self.postRequest(Endpoints.CLIENTS + '/{0}'.format(id), parameters=data, method='PUT') return self.decodeJSON(response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_client(client_name, updated_client_name): # Operacion modificar\n global clients\n\n if client_name in clients:\n index = clients.index(client_name)\n clients[index] = updated_client_name\n else:\n print(\"Client isn\\'t in the client list\")", "def test_update_client(se...
[ "0.67937523", "0.65493184", "0.6435495", "0.62011623", "0.6047726", "0.5984437", "0.5956502", "0.5945212", "0.5844981", "0.57898957", "0.5773103", "0.57370985", "0.5677678", "0.55478555", "0.5545997", "0.55407304", "0.55150896", "0.55113846", "0.5479551", "0.5476245", "0.5462...
0.7835998
0
Delete the specified client
def deleteClient(self, id): response = self.postRequest(Endpoints.CLIENTS + '/{0}'.format(id), method='DELETE') return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self, client):\n log(\"Deleting %s\" % self, self.opt)\n client.delete(self.path)", "def delete_client(self, client):\n for c in self.clients:\n if client == c:\n self.clients.remove(c)", "def delete(self, **kwargs):\n self.dbdel('client', kwargs...
[ "0.8223102", "0.81987244", "0.81581897", "0.80933565", "0.8074244", "0.7924584", "0.79122", "0.75041306", "0.74830085", "0.7278975", "0.7202662", "0.7177086", "0.7141298", "0.7069998", "0.7028738", "0.6995486", "0.68752044", "0.6845381", "0.6844797", "0.6833574", "0.68101287"...
0.78178424
7
Returns the items that overlap a bounding rectangle. Returns the set of all items in the quadtree that overlap with a bounding rectangle.
def hit(self, rect): # Find the hits at the current level hits = set(item for item in self.items if rect.contains(item.location)) # Recursively check the lower quadrants if self.nw and rect.left < self.cx and rect.top < self.cy: hits |= self.nw.hit(rect) if self.sw and rect.left < self.cx and rect.bottom >= self.cy: hits |= self.sw.hit(rect) if self.ne and rect.right >= self.cx and rect.top < self.cy: hits |= self.ne.hit(rect) if self.se and rect.right >= self.cx and rect.bottom >= self.cy: hits |= self.se.hit(rect) return hits
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self, rect):\n if hasattr(self, 'leaves'):\n return self.leaves.values()\n else:\n results = []\n rect = Rect(rect)\n for c in self.children:\n if c.rect.intersects(rect):\n results.extend(c.query(rect))\n ...
[ "0.6644186", "0.6522617", "0.6465768", "0.6435466", "0.59305274", "0.59259313", "0.5883582", "0.58389163", "0.5806691", "0.5789564", "0.5719773", "0.56912875", "0.5672954", "0.5642597", "0.56199247", "0.5603152", "0.5598976", "0.55976313", "0.5585401", "0.55301195", "0.550351...
0.6004383
4
This method will run all the episodes with epsilon greedy strategy
def run_epsilon(env, num_of_bandits, iterations, episodes): # Initialize total mean rewards array per episode by zero epsilon_rewards = np.zeros(iterations) for i in range(episodes): print(f"Running Epsilon episode:{i}") n = 1 action_count_per_bandit = np.ones(num_of_bandits) mean_reward = 0 total_rewards = np.zeros(iterations) mean_reward_per_bandit = np.zeros(num_of_bandits) env.reset() epsilon = 0.5 for j in range(iterations): a = get_epsilon_action(epsilon, env, mean_reward_per_bandit) observation, reward, done, info = env.step(a) # Update counts n += 1 action_count_per_bandit[a] += 1 # Update mean rewards mean_reward = mean_reward + ( reward - mean_reward) / n # Update mean rewards per bandit mean_reward_per_bandit[a] = mean_reward_per_bandit[a] + ( reward - mean_reward_per_bandit[a]) / action_count_per_bandit[a] # Capture mean rewards per iteration total_rewards[j] = mean_reward # Update mean episode rewards once all the iterations of the episode are done epsilon_rewards = epsilon_rewards + (total_rewards - epsilon_rewards) / (i + 1) return epsilon_rewards
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> None:\n for episode in range(1, self.episodes + 1):\n print('Episode:', episode)\n steps, state_action_history = self.run_one_episode()\n self.steps_per_episode.append(steps)\n if episode % parameters.CACHING_INTERVAL == 0 or steps < 1000:\n ...
[ "0.7450819", "0.7309439", "0.71770984", "0.7124558", "0.7124558", "0.7051895", "0.703537", "0.69566625", "0.684824", "0.68205166", "0.6802857", "0.68013686", "0.67991036", "0.6790752", "0.675303", "0.67489773", "0.67405975", "0.6739792", "0.67348915", "0.6732355", "0.6706088"...
0.74749076
0
This method will return action by epsilon greedy
def get_epsilon_action(epsilon, env, mean_reward_per_bandit): explore = np.random.uniform() < epsilon if explore: return env.action_space.sample() else: return np.argmax(mean_reward_per_bandit)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greedy(self) -> Action:\n return NotImplemented", "def eps_greedy(Q, epsilon, num_actions):\n if np.random.uniform(0,1,1) > epsilon:\n action = np.argmax(Q)\n else:\n action = np.random.randint(low=0, high=num_actions)\n \n Q_value = Q[action]\n return action, Q_value", ...
[ "0.7672569", "0.732197", "0.7154065", "0.71332085", "0.70703125", "0.6964753", "0.69215", "0.6916414", "0.68847233", "0.68748766", "0.6836524", "0.6821661", "0.677791", "0.6760553", "0.6743109", "0.6672397", "0.66714406", "0.65827435", "0.6575905", "0.6562029", "0.65613985", ...
0.6494198
24
Main method that is called by the user to calculate the manipulated variable.
def control(self, state, reference): self.ref[-1] = reference[self.ref_idx] # Set the reference epsilon_d = state[self.eps_idx] * self.limit[self.eps_idx] + self.dead_time * self.tau * state[self.omega_idx] * \ self.limit[self.omega_idx] * self.mp['p'] # Calculate delta epsilon # Iterate through high-level controller if self.omega_control: for i in range(len(self.overlaid_controller) + 1, 1, -1): # Calculate reference self.ref[i] = self.overlaid_controller[i-2].control(state[self.ref_state_idx[i + 1]], self.ref[i + 1]) # Check limits and integrate if (0.85 * self.state_space.low[self.ref_state_idx[i]] <= self.ref[i] <= 0.85 * self.state_space.high[self.ref_state_idx[i]]) and self.overlaid_type[i - 2]: self.overlaid_controller[i - 2].integrate(state[self.ref_state_idx[i + 1]], self.ref[i + 1]) else: self.ref[i] = np.clip(self.ref[i], self.nominal_values[self.ref_state_idx[i]] / self.limit[ self.ref_state_idx[i]] * self.state_space.low[self.ref_state_idx[i]], self.nominal_values[self.ref_state_idx[i]] / self.limit[ self.ref_state_idx[i]] * self.state_space.high[self.ref_state_idx[i]]) # Calculate reference values for i_d and i_q if self.torque_control: torque = self.ref[2] * self.limit[self.torque_idx] self.ref[0], self.ref[1] = self.torque_controller.control(state, torque) # Calculate action for continuous action space if self.has_cont_action_space: # Decouple the two current components if self.decoupling: self.u_sd_0 = -state[self.omega_idx] * self.mp['p'] * self.mp['l_q'] * state[self.i_sq_idx]\ * self.limit[self.i_sq_idx] / self.limit[self.u_sd_idx] * self.limit[self.omega_idx] self.u_sq_0 = state[self.omega_idx] * self.mp['p'] * ( state[self.i_sd_idx] * self.mp['l_d'] * self.limit[self.u_sd_idx] + self.psi_p) / self.limit[ self.u_sq_idx] * self.limit[self.omega_idx] # Calculate action for u_sd if self.torque_control: u_sd = self.d_controller.control(state[self.i_sd_idx], self.ref[1]) + self.u_sd_0 else: u_sd = self.d_controller.control(state[self.i_sd_idx], reference[self.ref_d_idx]) + self.u_sd_0 # Calculate action for u_sq u_sq = self.q_controller.control(state[self.i_sq_idx], self.ref[0]) + self.u_sq_0 # Shifting the reference potential action_temp = self.backward_transformation((u_sd, u_sq), epsilon_d) action_temp = action_temp - 0.5 * (max(action_temp) + min(action_temp)) # Check limit and integrate action = np.clip(action_temp, self.action_space.low[0], self.action_space.high[0]) if (action == action_temp).all(): if self.torque_control: self.d_controller.integrate(state[self.i_sd_idx], self.ref[1]) else: self.d_controller.integrate(state[self.i_sd_idx], reference[self.ref_d_idx]) self.q_controller.integrate(state[self.i_sq_idx], self.ref[0]) # Calculate action for discrete action space else: ref = self.ref[1] if self.torque_control else reference[self.ref_d_idx] ref_abc = self.backward_transformation((ref, self.ref[0]), epsilon_d) action = 0 for i in range(3): action += (2 ** (2 - i)) * self.abc_controller[i].control(state[self.i_abc_idx[i]], ref_abc[i]) # Plot overlaid reference values plot(external_reference_plots=self.external_ref_plots, state_names=self.state_names, external_data=self.get_plot_data(), visualization=True) return action
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_calculation():", "def execute(self):\n \n self.outvar = self.invar + .01", "def main():\n user_input_name()\n user_input_age()\n choose_unit()\n user_input_weight()\n user_input_height()\n bmi_calculator()\n bmi_categories()\n restart_calculator()", "def main():\...
[ "0.6921429", "0.6770756", "0.67365", "0.669798", "0.6433398", "0.64304745", "0.64164007", "0.6388115", "0.6387682", "0.6349823", "0.6285624", "0.6284488", "0.62795794", "0.6257987", "0.6253564", "0.62122047", "0.61981833", "0.61678576", "0.61678576", "0.6157993", "0.6157345",...
0.0
-1
Generate training data by playing games vs self. Gathers experiece tuples over n_episodes and pushes them to agent replay buffer.
def self_play(self, n_episodes): eps = self.eps(self.agent.learning_iters) experiences = self_play_episodes(self.mdp, self.agent, n_episodes, eps) for state, action, reward, next_state, done in experiences: self.agent.replay_buffer.push(state, action, reward, next_state, done)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_data(self, episodes, agents, batch_index):\n\n\t\tstate_dict = {}\n\t\talpha = 0.95\n\n\t\t# iterate over episodes\n\t\tfor e in range(episodes):\n\t\n\t\t\t# choose 2 random agents to play\n\t\t\tperm = np.random.permutation(len(agents))\n\n\t\t\tagent1 = agents[perm[0]]\n\t\t\tagent2 = agents[perm[1]]...
[ "0.7142396", "0.7135517", "0.68600905", "0.6848414", "0.683487", "0.68314207", "0.68152994", "0.68056613", "0.6796379", "0.6748984", "0.67470056", "0.671317", "0.6709892", "0.6708906", "0.66968066", "0.6685076", "0.66660935", "0.66479623", "0.6647209", "0.6645968", "0.6634925...
0.68460876
4
Update model with random batch from agent replay buffer.
def learn(self): batch = self.agent.replay_buffer.sample(self.batch_size) states = torch.tensor([x.state for x in batch], dtype=torch.float32).to(self.agent.device) # shape == (batch_size, 3, 6, 7) actions = [x.action for x in batch] rewards = torch.tensor([x.reward for x in batch], dtype=torch.float32).to(self.agent.device) next_states = torch.tensor([x.next_state for x in batch], dtype=torch.float32).to(self.agent.device) dones = [x.done for x in batch] self.optimizer.zero_grad() q_vals = self.agent.policy_net(states)[range(len(actions)), actions] # Q vals for actions taken q_next_vals = self.agent.target_net(next_states).detach() # we don't care about grad wrt target net q_next_vals[dones] = 0.0 # terminal states have no future expected value q_targets = rewards + self.gamma * torch.max(q_next_vals, dim=1)[0] # all_q_vals = self.agent.policy_net(states) # print() # print('actions') # print(actions) # print() # print('original all q vals') # print(self.agent.policy_net(states)) # print(self.agent.policy_net(states).shape) # print() # print('QVALS:', q_vals) # print(q_vals.shape) # print('\n\n') # print('QTARGETS:', q_targets) # print(q_targets.shape) # breakpoint() loss = self.loss_fn(q_targets, q_vals).to(self.agent.device) loss.backward() # for layer in self.agent.policy_net.named_parameters(): # # print(f'layer: {layer[0]}') # # print(f'grad:', layer[1].grad) # # print('loss', loss) # # print('q_vals grad:', q_vals.grad) # # print('states:', ) self.optimizer.step() self.agent.learning_iters += 1 if self.agent.learning_iters % self.target_update_freq == 0: self.agent.update_target_net() # logger.info('Updated target net')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replay(self):\n # Start only have enough memories\n if len(self.memory) < self.train_start:\n return\n\n batch_size = min(self.batch_size, len(self.memory))\n\n # Use mini_batch, sampling form the memory\n mini_batch = random.sample(self.memory, batch_size)\n\n ...
[ "0.6248699", "0.6233435", "0.6136998", "0.6025851", "0.6016958", "0.596585", "0.5935107", "0.5765406", "0.5739933", "0.57378775", "0.5711635", "0.5678842", "0.5633065", "0.5633065", "0.55791724", "0.55476403", "0.55153525", "0.54968476", "0.54914474", "0.54901624", "0.5484997...
0.0
-1
Train agent over given number of iterations. Each iteration consists of self play over n_episodes and then a learn step where agent updates network based on random sample from replay buffer
def train(self, iters, n_episodes): for i in range(iters): self.self_play(n_episodes) self.learn()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def learn(self, num_episodes=10000):\n for i in range(num_episodes):\n self.actor()\n self.learner()", "def trainAgent(self):\r\n\t\tfor episode in range(self.TOT_EPISODES):\r\n\t\t\t#reset environment, stacked frames every episode.\r\n\t\t\tstate = self.env.reset()\r\n\t\t\trewards ...
[ "0.7785768", "0.76625186", "0.76138806", "0.7555034", "0.7430718", "0.7399803", "0.73953015", "0.73881173", "0.7361592", "0.72675776", "0.72441524", "0.7235535", "0.72085416", "0.71934515", "0.71493644", "0.71422166", "0.7102493", "0.7057307", "0.70422393", "0.70264834", "0.7...
0.81745845
0
generate pair message between node Hv and Hw. since the cat operation, msgs from hv > hw and hw > hv are different
def __init__(self, dim_hv, dim_hw, msg_dim): super(PairMessageGenerator, self).__init__() self.dim_hv, self.dim_hw, self.msg_dim = dim_hv, dim_hw, msg_dim self.in_dim = dim_hv + dim_hw # row * feature_dim, 2048 self.mlp = nn.Sequential( nn.LayerNorm(self.in_dim), # this layer norm is important to create diversity nn.Linear(self.in_dim, self.msg_dim), nn.LeakyReLU(0.2) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_HHH(self, msg):\n self.prev_head = self.head\n self.head = msg.headx, msg.heady, msg.headz\n # self.torso = msg.torsox, msg.torsoy, msg.torsoz\n # self.Rhand = msg.Rhandx, msg.Rhandy, msg.Rhandz\n # self.Lhand = msg.Lhandx, msg.Lhandy, msg.Lhandz\n\n # if the dista...
[ "0.54044586", "0.5386834", "0.5290445", "0.51632214", "0.51632214", "0.51127476", "0.51023054", "0.50814384", "0.50715846", "0.50035816", "0.499038", "0.4964276", "0.4964276", "0.4964276", "0.49613354", "0.49603233", "0.49329245", "0.48807725", "0.48755825", "0.48755825", "0....
0.58693963
0
for n graph instances given edge index number this connected_msgs_list contains all connnected edges msg, say m connected edges
def aggregate_msgs(self, connected_msgs_list): msg_num = len(connected_msgs_list) agg_msg = connected_msgs_list[0] for i in range(1, msg_num): agg_msg += connected_msgs_list[i] if self.msg_aggrgt == 'AVG': return agg_msg / msg_num elif self.msg_aggrgt == 'SUM': return agg_msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_messages(j, i):\n j_neighbors_except_i = [k for k in edges[j] if k != i]\n \n for k in j_neighbors_except_i: # No effect when j_neighbors_except_i is empty []\n collect_messages(k, j)\n send_message(j, i, j_neighbors_except_i)", "def distribute_messages(i, j):...
[ "0.66461325", "0.6315994", "0.5970758", "0.594913", "0.57439035", "0.57150644", "0.5673093", "0.56705296", "0.56621045", "0.56380904", "0.5598652", "0.55890334", "0.55843794", "0.5572508", "0.55645573", "0.5527443", "0.5512135", "0.54903924", "0.54806775", "0.5466238", "0.545...
0.0
-1
deep geometric feature set as state representation
def __init__(self, _conv_encoder=None, _encoder_out_channels=32, _vi_key_pointer=None, key_point_num=20, _debug_tool=None, _debug_frequency=None, _vi_mode=True): super(M6EKViEncoder, self).__init__() self.encoder = _conv_encoder self.k_heatmaps_layer = nn.Sequential( nn.Conv2d(_encoder_out_channels, key_point_num, kernel_size=(1, 1), stride=(1, 1)), nn.BatchNorm2d(key_point_num), nn.ReLU()) self.vi_key_pointer = _vi_key_pointer self.debug_tool = _debug_tool self.debug_frequency = _debug_frequency self.it_count = 0 self.vi_mode = _vi_mode
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getStates(self):\n feature_states = []\n for i, sim in enumerate(self.sims):\n state = sim.getState()\n features = []\n for j in range(36):\n long_id = self._make_id(state.scanId, state.location.viewpointId,str(j+1))\n feature = self....
[ "0.63558125", "0.6102643", "0.606456", "0.6011864", "0.5996851", "0.59706515", "0.5943621", "0.59378874", "0.5885338", "0.5885338", "0.5870441", "0.5870441", "0.5846847", "0.5846655", "0.57815313", "0.5768379", "0.5745745", "0.5655412", "0.5653317", "0.56334156", "0.5630338",...
0.0
-1
Note that for training, you can keep training the model after it's already been trained because it automatically remembers the last error weights. So self.train(n=2) is equivalent to self.train(n=1); self.train(n=1)
def train(self, data, data_class, n=1): # Initialize the sample weights for _ in range(n): # Train the weak estimator new_estimator = BinaryDecisionTree(self.max_depth) new_estimator.train(data, data_class, self.error_weights) y_pred, _ = new_estimator.validate(data, data_class) # Check misclassifications and update the error weights accordingly incorrect = y_pred != data_class error = self.error_weights[incorrect].sum() alpha = 0.5 * np.log((1.0 - error) / error) sign = incorrect * 2 - 1 # Maps incorrect to 1, correct to -1 self.error_weights *= np.e ** (sign * alpha) self.error_weights /= self.error_weights.sum() # Save down alpha and estimator for prediction self.alphas.append(alpha) self.estimators.append(new_estimator)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_one_epoch(self):\n raise NotImplementedError", "def train(self, training_steps=10):", "def TrainOneStep(self):\n pass", "def train(self, ):\n raise NotImplementedError", "def train(self):\n raise NotImplementedError", "def train2(self):\n for epoch in range(se...
[ "0.7506583", "0.73702186", "0.7218326", "0.71550184", "0.7129135", "0.7113297", "0.7095796", "0.7077056", "0.7067491", "0.70636654", "0.70636654", "0.70636654", "0.70636654", "0.70636654", "0.70617354", "0.7049623", "0.703932", "0.70169145", "0.70089275", "0.69914174", "0.696...
0.0
-1
Fastest way to just consume an iterator.
def consume(iterator): deque(iterator, maxlen=0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consume(iterator, n=None):\n # Use functions that consume iterators at C speed.\n if n is None:\n # feed the entire iterator into a zero-length deque\n collections.deque(iterator, maxlen=0)\n else:\n # advance to the empty slice starting at position n\n next(islice(iterator...
[ "0.72329783", "0.71654475", "0.67598706", "0.606488", "0.60311234", "0.60123855", "0.5925557", "0.592464", "0.5869508", "0.5843964", "0.5843164", "0.58100826", "0.57714164", "0.5746189", "0.5739034", "0.5733739", "0.57284236", "0.5727265", "0.5726913", "0.5722843", "0.5719147...
0.7133738
2
Create an instance of this store with a loader object.
def __init__(self, loader): self.loader = loader self.models = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, loader, *args, **kw):\n self._loader = loader", "def create(self):\n\t\tif self.isInitialized():\n\t\t\tself.Loaded = self.loader.create()", "def __init__(self, loader, *args, **kw):\r\n self._loader = loader", "def create_loader(self, *args, **kwargs):\n def loader():...
[ "0.7120568", "0.71177053", "0.70920056", "0.6825259", "0.65534455", "0.6519639", "0.6312017", "0.6218765", "0.60434765", "0.58976614", "0.5878757", "0.5864052", "0.5856109", "0.58553034", "0.57751334", "0.5761484", "0.57599795", "0.5753757", "0.5739945", "0.57246524", "0.5698...
0.6796559
4
Import all model data using the loader.
def import_data(self): self.models = [] for o in self.loader.load(): klass = self.type_for(o) if hasattr(klass, "from_api"): self.models.append(klass.from_api(o)) else: self.models.append(klass(o)) return self.models
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_all():\n\n # count the number of files loaded\n count = 0\n\n # get model name\n model_name_list = [model for data_models in settings.OBJECT_DATA_MODELS\n for model in data_models]\n\n model_name_list += [model for model in settings.OTHER_DATA_MODELS]\n\n # import...
[ "0.7716706", "0.6954782", "0.6742698", "0.67201203", "0.6513403", "0.64677274", "0.64014745", "0.6369573", "0.6368797", "0.63448185", "0.633244", "0.6321181", "0.62659895", "0.6258032", "0.6243625", "0.6167777", "0.6158548", "0.6115253", "0.608663", "0.608182", "0.6074489", ...
0.7674908
1
Return the class type to be used for a given event name.
def type_for(data): switcher = { # Startup "FileHeader": models.FileHeader, "ClearSavedGame": models.ClearSavedGame, "NewCommander": models.NewCommander, "LoadGame": models.LoadGame, "Progress": models.Progress, "Rank": models.Rank, # Travel "Docked": models.Docked, "DockingCancelled": models.DockingCancelled, "DockingDenied": models.DockingDenied, "DockingGranted": models.DockingGranted, "DockingRequested": models.DockingRequested, "DockingTimeout": models.DockingTimeout, "FSDJump": models.FSDJump, "Liftoff": models.Liftoff, "Location": models.Location, "SupercruiseEntry": models.SupercruiseEntry, "SupercruiseExit": models.SupercruiseExit, "Touchdown": models.Touchdown, "Undocked": models.Undocked, # Combat "Bounty": models.Bounty, "CapShipBond": models.CapShipBond, "Died": models.Died, "EscapeInterdiction": models.EscapeInterdiction, "FactionKillBond": models.FactionKillBond, "HeatDamage": models.HeatDamage, "HeatWarning": models.HeatWarning, "HullDamage": models.HullDamage, "Interdicted": models.Interdicted, "Interdiction": models.Interdiction, "PVPKill": models.PVPKill, "ShieldState": models.ShieldState, # Exploration "Scan": models.Scan, "MaterialCollected": models.MaterialCollected, "MaterialDiscarded": models.MaterialDiscarded, "MaterialDiscovered": models.MaterialDiscovered, "BuyExplorationData": models.BuyExplorationData, "SellExplorationData": models.SellExplorationData, "Screenshot": models.Screenshot, # Trade "BuyTradeData": models.BuyTradeData, "CollectCargo": models.CollectCargo, "EjectCargo": models.EjectCargo, "MarketBuy": models.MarketBuy, "MarketSell": models.MarketSell, "MiningRefined": models.MiningRefined, # Station Services "BuyAmmo": models.BuyAmmo, "BuyDrones": models.BuyDrones, "CommunityGoalDiscard": models.CommunityGoalDiscard, "CommunityGoalJoin": models.CommunityGoalJoin, "CommunityGoalReward": models.CommunityGoalReward, "CrewAssign": models.CrewAssign, "CrewFire": models.CrewFire, "CrewHire": models.CrewHire, "EngineerApply": models.EngineerApply, "EngineerCraft": models.EngineerCraft, "EngineerProgress": models.EngineerProgress, "FetchRemoteModule": models.FetchRemoteModule, "MassModuleStore": models.MassModuleStore, "MissionAbandoned": models.MissionAbandoned, "MissionAccepted": models.MissionAccepted, "MissionCompleted": models.MissionCompleted, "MissionFailed": models.MissionFailed, "ModuleBuy": models.ModuleBuy, "ModuleRetrieve": models.ModuleRetrieve, "ModuleSell": models.ModuleSell, "ModuleSellRemote": models.ModuleSellRemote, "ModuleStore": models.ModuleStore, "ModuleSwap": models.ModuleSwap, "PayFines": models.PayFines, "PayLegacyFines": models.PayLegacyFines, "RedeemVoucher": models.RedeemVoucher, "RefuelAll": models.RefuelAll, "RefuelPartial": models.RefuelPartial, "Repair": models.Repair, "RepairAll": models.RepairAll, "RestockVehicle": models.RestockVehicle, "ScientificResearch": models.ScientificResearch, "SellDrones": models.SellDrones, "ShipyardBuy": models.ShipyardBuy, "ShipyardNew": models.ShipyardNew, "ShipyardSell": models.ShipyardSell, "ShipyardTransfer": models.ShipyardTransfer, "ShipyardSwap": models.ShipyardSwap, # Powerplay "PowerplayCollect": models.PowerplayCollect, "PowerplayDefect": models.PowerplayDefect, "PowerplayDeliver": models.PowerplayDeliver, "PowerplayFastTrack": models.PowerplayFastTrack, "PowerplayJoin": models.PowerplayJoin, "PowerplayLeave": models.PowerplayLeave, "PowerplaySalary": models.PowerplaySalary, "PowerplayVote": models.PowerplayVote, "PowerplayVoucher": models.PowerplayVoucher, # Other Events "ApproachSettlement": models.ApproachSettlement, "CockpitBreached": models.CockpitBreached, "CommitCrime": models.CommitCrime, "Continued": models.Continued, "DatalinkScan": models.DatalinkScan, "DatalinkVoucher": models.DatalinkVoucher, "DataScanned": models.DataScanned, "DockFighter": models.DockFighter, "DockSRV": models.DockSRV, "FuelScoop": models.FuelScoop, "JetConeBoost": models.JetConeBoost, "JetConeDamage": models.JetConeDamage, "LaunchFighter": models.LaunchFighter, "LaunchSRV": models.LaunchSRV, "Promotion": models.Promotion, "RebootRepair": models.RebootRepair, "ReceiveText": models.ReceiveText, "Resurrect": models.Resurrect, "SelfDestruct": models.SelfDestruct, "SendText": models.SendText, "Synthesis": models.Synthesis, "USSDrop": models.USSDrop, "VehicleSwitch": models.VehicleSwitch, "WingAdd": models.WingAdd, "WingJoin": models.WingJoin, "WingLeave": models.WingLeave, } return switcher.get(data["event"], models.BaseModel)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_event_class_by_type(type):\n event_module = importlib.import_module('.'.join(type.split('.')[:-1]))\n return getattr(event_module, type.split('.')[-1])", "def _get_event_type(event):\n return event.type()", "def _get_event_type(event):\n return event.type()", "def class_name(name:...
[ "0.7802693", "0.70439726", "0.70439726", "0.6722869", "0.6596402", "0.65878123", "0.65594405", "0.65270084", "0.645151", "0.64356005", "0.64065075", "0.6406168", "0.6361024", "0.63387644", "0.6334703", "0.62997335", "0.6297802", "0.6282378", "0.625796", "0.6205886", "0.618207...
0.0
-1
Force cancellations when owners of predictions are bankrupt
def admin_bankruptcy(self, with_report=False): name = self.client.srandmember(self._NAMES) self.admin_bankruptcy_forced_cancellation(name=name, with_report=with_report) self.admin_bankruptcy_notification(name=name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_dummy(self):\n if self.state != 'authorized':\n self.raise_user_error('cancel_only_authorized')\n else:\n self.state = 'cancel'\n self.save()", "def cancel():", "def cancel(self):", "def cancel(self):", "def cancel(self):", "def do_uncancel(self):...
[ "0.6585705", "0.6542071", "0.64821595", "0.64821595", "0.64821595", "0.6472716", "0.6299607", "0.6293841", "0.6284326", "0.6247299", "0.6247299", "0.6156231", "0.6093092", "0.6050534", "0.60215384", "0.59936893", "0.59936893", "0.59936893", "0.59936893", "0.59633005", "0.5921...
0.0
-1
Notify folks and set attribute so it only happens once
def admin_bankruptcy_notification(self, name:str): write_keys = list() for delay in self.DELAYS: write_keys.extend( self._get_sample_owners(name=name, delay=delay) ) for write_key in write_keys: if self.bankrupt(write_key): notified = self.get_attribute(attribute_type=AttributeType.update, granularity=AttributeGranularity.write_key, write_key=write_key) or False if not notified: self.set_attribute(attribute_type=AttributeType.update, granularity=AttributeGranularity.write_key, write_key=write_key, value=1) message = 'Your write_key is bankrupt. Consider topping it up with put_balance()' self.add_owner_alert_message(write_key=write_key, message=message)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setattr__(self, name, value):\n super(Message, self).__setattr__(name, value)\n if name not in ('bcc', '_dirty', '_processed'): \n self.__dict__['_dirty'] = True", "def dummy_update( self ):\r\n pass", "def _set_silent(self, model_instance, value):\n setattr(model_i...
[ "0.6458744", "0.6421269", "0.63834894", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.627908", "0.6269448", "0.62105566", "...
0.0
-1
Force cancellation of submissions for poorly performing bankrupt algorithms
def admin_bankruptcy_forced_cancellation(self, name, with_report): discards = list() for delay in self.DELAYS: write_keys = self._get_sample_owners(name=name, delay=delay) leaderboard = self.get_leaderboard(granularity=LeaderboardGranularity.name_and_delay, count=10000, name=name, delay=delay, readable=False) losers = [key for key in write_keys if (self.shash(key) in leaderboard) and (leaderboard[self.shash(key)] < -1.0)] for write_key in losers: if self.bankrupt(write_key=write_key): code = self.shash(write_key) memo = Memo(activity=Activity.cancel, context=ActivityContext.bankruptcy, name=name, code=code, write_key=write_key, message='Initiating cancellation of submissions due to bankruptcy') self.add_memo_as_owner_confirm(memo=memo) self.cancel(name=name, write_key=write_key, delay=delay) discards.append((name, write_key)) report_data = dict(discards) report_memo = Memo(activity=Activity.daemon, context=ActivityContext.bankruptcy, count=len(report_data), data=report_data) self.add_memo_as_system_confirm(memo=report_memo,private_actor=PrivateActor.bankruptcy_daemon) return len(discards) if not with_report else report_memo.as_dict()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel():", "def cancel(self):", "def cancel(self):", "def cancel(self):", "def cancel(self):\n pass", "def cancel_workers(self):\n pass", "def do_uncancel(self):\r\n self.write({'cancelled': False})", "def kill_pending(self):\n for req in self._outbox:\n if...
[ "0.7574049", "0.72383225", "0.72383225", "0.72383225", "0.7049807", "0.6872498", "0.6760143", "0.6673882", "0.660217", "0.660217", "0.659783", "0.659783", "0.659783", "0.659783", "0.64751947", "0.6469023", "0.6427791", "0.6421745", "0.6420724", "0.64180344", "0.6395012", "0...
0.64316154
16
Test running artifact rejection.
def test_temporal_derivative_distribution_repair(fname, tmp_path): raw = read_raw_nirx(fname) raw_od = optical_density(raw) raw_hb = beer_lambert_law(raw_od) # With optical densities # Add a baseline shift artifact about half way through data max_shift = np.max(np.diff(raw_od._data[0])) shift_amp = 5 * max_shift raw_od._data[0, 0:30] = raw_od._data[0, 0:30] - shift_amp # make one channel zero std raw_od._data[1] = 0.0 raw_od._data[2] = 1.0 assert np.max(np.diff(raw_od._data[0])) > shift_amp # Ensure that applying the algorithm reduces the step change raw_od = tddr(raw_od) assert np.max(np.diff(raw_od._data[0])) < shift_amp assert_allclose(raw_od._data[1], 0.0) # unchanged assert_allclose(raw_od._data[2], 1.0) # unchanged # With Hb # Add a baseline shift artifact about half way through data max_shift = np.max(np.diff(raw_hb._data[0])) shift_amp = 5 * max_shift raw_hb._data[0, 0:30] = raw_hb._data[0, 0:30] - (1.1 * shift_amp) # make one channel zero std raw_hb._data[1] = 0.0 raw_hb._data[2] = 1.0 assert np.max(np.diff(raw_hb._data[0])) > shift_amp # Ensure that applying the algorithm reduces the step change raw_hb = tddr(raw_hb) assert np.max(np.diff(raw_hb._data[0])) < shift_amp assert_allclose(raw_hb._data[1], 0.0) # unchanged assert_allclose(raw_hb._data[2], 1.0) # unchanged
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_itar_restrict_software_asset(self):\n pass", "def test_reject_proposal_demand(self):\n pass", "async def test_finish_release_no_release(doof, repo_info, event_loop, mocker):\n get_release_pr_mock = mocker.patch('bot.get_release_pr', autospec=True, return_value=None)\n with pytest.r...
[ "0.6357305", "0.6324513", "0.6190728", "0.6092561", "0.5969728", "0.5934762", "0.5933897", "0.59015524", "0.58819264", "0.5881338", "0.58585626", "0.5845605", "0.5825424", "0.577213", "0.5720475", "0.5704311", "0.56921726", "0.56621385", "0.56546986", "0.56332654", "0.5630342...
0.0
-1
Convert from camera_frame to world_frame
def cam_to_world(cam_point, world_to_cam): # cam_point = np.array([cam_pose[0], cam_pose[1], cam_pose[2]]) obj_vector = np.concatenate((cam_point, np.ones(1))).reshape((4, 1)) world_point = np.dot(world_to_cam, obj_vector) world_point = [p[0] for p in world_point] return world_point[0:3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camera_to_world(self, X):\n raise NotImplementedError", "def world_to_camera(self, X):\n raise NotImplementedError", "def cameraToWorld(self, p):\n result = self.camPos\n result += p[2] * self.camZ # result is now in the middle of the view-plane\n result += p[0] * sel...
[ "0.77324754", "0.7427758", "0.6999884", "0.6942515", "0.68882954", "0.630541", "0.62254226", "0.6142121", "0.6108579", "0.60515493", "0.6012601", "0.6009316", "0.60076267", "0.5937143", "0.5847855", "0.58359575", "0.58199376", "0.57920545", "0.57797766", "0.5773777", "0.57097...
0.7209461
2
Test GenBank parsing invalid product line raises ValueError
def test_invalid_product_line_raises_value_error(self): def parse_invalid_product_line(): rec = SeqIO.read(path.join('GenBank', 'invalid_product.gb'), 'genbank') self.assertRaises(ValueError, parse_invalid_product_line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testBadLine(self):\n\n self.assertRaises(\n ValueError,\n tools._trackInfo,\n 'not a real line'\n )", "def test_readbadformat(self):\n\n self.assertRaises(ParseError, self.hw, self.badfile)", "def test_invalid_regref(self, parse_input_mocked_metadata):\...
[ "0.6412361", "0.63490635", "0.6333902", "0.6294638", "0.62427443", "0.6210081", "0.6208923", "0.6203845", "0.6167732", "0.61114794", "0.6096026", "0.60889727", "0.6073056", "0.60688126", "0.6063661", "0.60588723", "0.6050436", "0.6005442", "0.5976354", "0.5972584", "0.5971466...
0.8058622
0
Publish apps to the 21 Marketplace. \b Usage _____ Publish your app to the 21 Marketplace. $ 21 publish submit path_to_manifest/manifest.yaml To update your published listing, run the above command after modifying your manifest.yaml. \b Publish your app to the 21 Marketplace without strict checking of the manifest against your current IP. $ 21 publish submit s path_to_manifest/manifest.yaml \b See the help for submit. $ 21 publish submit help \b View all of your published apps. $ 21 publish list \b See the help for list. $ 21 publish list help \b Remove one of your published apps from the marketplace. $ 21 publish remove {app_id} \b See the help for remove. $ 21 publish remove help
def publish(): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _publish(client, manifest_path, marketplace, skip, overrides):\n try:\n manifest_json = check_app_manifest(manifest_path, overrides, marketplace)\n app_url = \"{}://{}\".format(manifest_json[\"schemes\"][0], manifest_json[\"host\"])\n app_ip = urlparse(app_url).hostname\n\n if no...
[ "0.70976746", "0.6921972", "0.6737742", "0.61851317", "0.60648894", "0.5921255", "0.59202874", "0.57908696", "0.5747466", "0.5709409", "0.56947315", "0.5662847", "0.5600021", "0.55838025", "0.55629", "0.5550522", "0.55285674", "0.55028474", "0.54907167", "0.54901814", "0.5488...
0.6171967
4
\b Lists all your published apps. $ 21 publish list Results from the list command are paginated. Use 'n' to move to the next page and 'p' to move to the previous page. You can view detailed admin information about an app by specifying it's id at the prompt.
def list(ctx): # pylint: disable=redefined-builtin _list_apps(ctx.obj['config'], ctx.obj['client'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _list_apps(config, client):\n logger.info(\"Listing all the published apps by {}: \".format(config.username), fg=\"green\")\n current_page = 0\n total_pages = get_search_results(config, client, current_page)\n if total_pages < 1:\n return\n\n while 0 <= current_page < total_pages:\n ...
[ "0.71768415", "0.6380013", "0.6237213", "0.61973405", "0.6124043", "0.60990864", "0.60854894", "0.5944503", "0.5898133", "0.58913547", "0.5877315", "0.5836518", "0.5767014", "0.5754838", "0.5688991", "0.56420964", "0.56412876", "0.55870926", "0.5555698", "0.5543384", "0.55005...
0.64636713
1
\b Removes a published app from the Marketplace. $ 21 publish remove [yes] {app_id} \b Removes all published apps from the Marketplace. $ 21 publish remove [yes] all \b
def remove(ctx, app_id, all, assume_yes): if all and not app_id: for _app_id in _get_all_app_ids(ctx.obj['config'], ctx.obj['client']): _delete_app(ctx.obj['config'], ctx.obj['client'], _app_id, assume_yes) elif app_id and not all: _delete_app(ctx.obj['config'], ctx.obj['client'], app_id, assume_yes) else: logger.info(ctx.command.get_help(ctx)) sys.exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove():\n run('pew rm {0}'.format(package_name()))", "def app_delete(self, name):\n self.core.api.os.shell.cmd('{0} delete app /app.name:\"{1}\"'.format(self.APP_CMD, name))", "def remove_app(self):\n \n pass", "def delete_app(AppId=None):\n pass", "def delete_app(short_na...
[ "0.6542366", "0.63983655", "0.635603", "0.62508076", "0.6105173", "0.60880226", "0.5995787", "0.59228504", "0.5885536", "0.58168525", "0.57712317", "0.5742939", "0.56851757", "0.56586546", "0.5657139", "0.5622254", "0.5595414", "0.5593344", "0.55384624", "0.55296105", "0.5524...
0.67598
0
\b Publishes an app to 21 Marketplace. $ 21 publish submit path_to_manifest/manifest.yaml The contents of the manifest file should follow the guidelines specified at
def submit(ctx, manifest_path, marketplace, skip, parameters): if parameters is not None: try: parameters = _parse_parameters(parameters) except: logger.error( "Manifest parameter overrides should be in the form 'key1=\"value1\" " "key2=\"value2\".", fg="red") return _publish(ctx.obj['client'], manifest_path, marketplace, skip, parameters)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _publish(client, manifest_path, marketplace, skip, overrides):\n try:\n manifest_json = check_app_manifest(manifest_path, overrides, marketplace)\n app_url = \"{}://{}\".format(manifest_json[\"schemes\"][0], manifest_json[\"host\"])\n app_ip = urlparse(app_url).hostname\n\n if no...
[ "0.7300059", "0.67660546", "0.6331592", "0.6170584", "0.60555214", "0.6053848", "0.5974832", "0.58902156", "0.5870017", "0.58022076", "0.56858075", "0.56083417", "0.5599532", "0.5585206", "0.5573604", "0.5570114", "0.5532284", "0.5491696", "0.5456021", "0.5449518", "0.5443404...
0.69711465
1
Parses parameters string and returns a dict of overrides. This function assumes that parameters string is in the form of '"key1="value1" key2="value2"'. Use of single quotes is optional but is helpful for strings that contain spaces.
def _parse_parameters(parameters): if not re.match(r'^(\w+)="([^=]+)"(\s{1}(\w+)="([^=]+)")*$', parameters): raise ValueError # first we add tokens that separate key/value pairs. # in case of key='ss sss ss', we skip tokenizing when we se the first single quote # and resume when we see the second replace_space = True tokenized = "" for c in parameters: if c == '\"': replace_space = not replace_space elif c == ' ' and replace_space: tokenized += "$$" else: tokenized += c # now get the tokens tokens = tokenized.split('$$') result = {} for token in tokens: # separate key/values key_value = token.split("=") result[key_value[0]] = key_value[1] return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_params( self ):\n paramDic={}\n # Parameters are on the 3rd arg passed to the script\n paramStr=sys.argv[2]\n print paramStr\n if len(paramStr)>1:\n paramStr = paramStr.replace('?','')\n \n # Ignore last char if it is a '/'\n ...
[ "0.65870714", "0.65518653", "0.65437955", "0.65169543", "0.63385206", "0.6322526", "0.63106567", "0.6298732", "0.6283422", "0.6264256", "0.62140757", "0.6202048", "0.6163683", "0.60954064", "0.6093808", "0.6043404", "0.60339767", "0.6015657", "0.5971249", "0.5954985", "0.5940...
0.74429375
0
Lists all apps that have been published to the 21 marketplace
def _list_apps(config, client): logger.info("Listing all the published apps by {}: ".format(config.username), fg="green") current_page = 0 total_pages = get_search_results(config, client, current_page) if total_pages < 1: return while 0 <= current_page < total_pages: try: prompt_resp = click.prompt(uxstring.UxString.pagination, type=str) next_page = get_next_page(prompt_resp, current_page) if next_page == -1: model_id = prompt_resp display_app_info(config, client, model_id) elif next_page >= total_pages or next_page < 0: continue else: get_search_results(config, client, next_page) current_page = next_page except click.exceptions.Abort: return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_app_list(self):\n return self.get_setting('applications', 'installed_apps')", "def list_apps(self) -> list:\n apps = self.app.list_apps()\n app_list = [app[\"title\"] for app in apps]\n return app_list", "def ListApps(self, request, context):\n context.code(beta_interfa...
[ "0.70584273", "0.69872224", "0.69679195", "0.69105625", "0.66437083", "0.66229135", "0.657946", "0.64917386", "0.6440265", "0.63986486", "0.6345584", "0.63214445", "0.6319517", "0.63044786", "0.6269743", "0.6268732", "0.6233685", "0.61907285", "0.6159065", "0.6152657", "0.608...
0.6918819
3
Gets all apps published by the current user to the 21 marketplace
def _get_all_app_ids(config, client): rv = set() total_pages = client.get_published_apps(config.username, 0).json()["total_pages"] for current_page in range(total_pages): current_page_results = client.get_published_apps(config.username, current_page).json()['results'] for result in current_page_results: rv.add(result['id']) return rv
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_apps(self):\n return list(self.apps.values())", "async def get_apps(self, params: Optional = None) -> dict:\r\n return await self.get_items(API_APPS, params=params)", "def get_app_list(self):\n return self.get_setting('applications', 'installed_apps')", "def get_apps(self):\n...
[ "0.71890974", "0.71757436", "0.70074826", "0.68211126", "0.6804829", "0.6794968", "0.67782676", "0.6769873", "0.67512155", "0.6689302", "0.66789335", "0.66459394", "0.6527662", "0.64864933", "0.6406882", "0.63923347", "0.6377203", "0.63365346", "0.63237804", "0.62257147", "0....
0.5995079
28
Deletes an app that has been published to the 21 marketplace
def _delete_app(config, client, app_id, assume_yes): title = client.get_app_full_info(config.username, app_id).json()['app_info']['title'] if assume_yes or click.confirm( "Are you sure that you want to delete App '{} ({})'?".format(app_id, title)): try: resp = client.delete_app(config.username, app_id) resp_json = resp.json() deleted_title = resp_json["deleted_title"] logger.info("App {} ({}) was successfully removed from the marketplace.".format(app_id, deleted_title)) except ServerRequestError as e: if e.status_code == 404: logger.info("The app with id '{}' does not exist in the marketplace.".format(app_id), fg="red") elif e.status_code == 403: logger.info( "You don't have permission to delete the app with id '{}'. You " "can only delete apps that you have published.".format(app_id), fg="red")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_app(AppId=None):\n pass", "def app_delete(self, name):\n self.core.api.os.shell.cmd('{0} delete app /app.name:\"{1}\"'.format(self.APP_CMD, name))", "def delete_app(self, name):\n raise NotImplementedError", "def delete_app(self):\n contract = jc.Contract()\n return...
[ "0.77574676", "0.73077077", "0.7193325", "0.6995305", "0.6962425", "0.69525915", "0.69459826", "0.68724674", "0.6756195", "0.6666602", "0.6640245", "0.6541444", "0.65118265", "0.64288366", "0.64217", "0.63251245", "0.6289479", "0.62437224", "0.62267774", "0.62075216", "0.6170...
0.73056835
2
Publishes application by uploading the manifest to the given marketplace
def _publish(client, manifest_path, marketplace, skip, overrides): try: manifest_json = check_app_manifest(manifest_path, overrides, marketplace) app_url = "{}://{}".format(manifest_json["schemes"][0], manifest_json["host"]) app_ip = urlparse(app_url).hostname if not skip: address = get_zerotier_address(marketplace) if address != app_ip: wrong_ip = click.style("It seems that the IP address that you put in your manifest file (") +\ click.style("{}", bold=True) +\ click.style(") is different than your current 21market IP (") +\ click.style("{}", bold=True) +\ click.style(")\nAre you sure you want to continue publishing with ") +\ click.style("{}", bold=True) +\ click.style("?") if not click.confirm(wrong_ip.format(app_ip, address, app_ip)): switch_host = click.style("Please edit ") +\ click.style("{}", bold=True) +\ click.style(" and replace ") +\ click.style("{}", bold=True) +\ click.style(" with ") +\ click.style("[{}].", bold=True) logger.info(switch_host.format(manifest_path, app_ip, address)) return except exceptions.ValidationError as ex: # catches and re-raises the same exception to enhance the error message publish_docs_url = click.style("https://21.co/learn/21-publish/", bold=True) publish_instructions = "For instructions on publishing your app, please refer to {}".format(publish_docs_url) raise exceptions.ValidationError( "The following error occurred while reading your manifest file at {}:\n{}\n\n{}" .format(manifest_path, ex.args[0], publish_instructions), json=ex.json) app_name = manifest_json["info"]["title"] app_endpoint = "{}://{}{}".format(manifest_json["schemes"][0], manifest_json["host"], manifest_json["basePath"]) logger.info( (click.style("Publishing {} at ") + click.style("{}", bold=True) + click.style(" to {}.")) .format(app_name, app_endpoint, marketplace)) payload = {"manifest": manifest_json, "marketplace": marketplace} try: response = client.publish(payload) except ServerRequestError as e: if e.status_code == 403 and e.data.get("error") == "TO600": logger.info( "The endpoint {} specified in your manifest has already been registered in " "the marketplace by another user.\nPlease check your manifest file and make " "sure your 'host' field is correct.\nIf the problem persists please contact " "support@21.co.".format(app_endpoint), fg="red") return else: raise e if response.status_code == 201: response_data = response.json() mkt_url = response_data['mkt_url'] permalink = response_data['permalink'] logger.info( click.style( "\n" "You have successfully published {} to {}. " "You should be able to view the listing within a few minutes at {}\n\n" "Users will be able to purchase it, using 21 buy, at {} ", fg="magenta") .format(app_name, marketplace, permalink, mkt_url) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit(ctx, manifest_path, marketplace, skip, parameters):\n if parameters is not None:\n try:\n parameters = _parse_parameters(parameters)\n except:\n logger.error(\n \"Manifest parameter overrides should be in the form 'key1=\\\"value1\\\" \"\n ...
[ "0.68291336", "0.6059394", "0.6052995", "0.6010262", "0.5933436", "0.5847316", "0.5775076", "0.57516134", "0.5748247", "0.5703469", "0.56963223", "0.56790406", "0.5647197", "0.56322503", "0.5598916", "0.5595371", "0.5584658", "0.5561256", "0.54689205", "0.5453668", "0.5450249...
0.7366084
0
Queries the marketplace for published apps
def get_search_results(config, client, page): resp = client.get_published_apps(config.username, page) resp_json = resp.json() search_results = resp_json["results"] if search_results is None or len(search_results) == 0: logger.info( click.style("You haven't published any apps to the marketplace yet. Use ", fg="blue") + click.style("21 publish submit {PATH_TO_MANIFEST_FILE}", bold=True, fg="blue") + click.style(" to publish your apps to the marketplace.", fg="blue"), fg="blue") return 0 total_pages = resp_json["total_pages"] logger.info("\nPage {}/{}".format(page + 1, total_pages), fg="green") headers = ["id", "Title", "Url", "Rating", "Is up", "Is healthy", "Average Uptime", "Last Update"] rows = [] for r in search_results: rating = "Not yet Rated" if r["rating_count"] > 0: rating = "{:.1f} ({} rating".format(r["average_rating"], int(r["rating_count"])) if r["rating_count"] > 1: rating += "s" rating += ")" rows.append([r["id"], r["title"], r["app_url"], rating, str(r["is_up"]), str(r["is_healthy"]), "{:.2f}%".format(r["average_uptime"] * 100), util.format_date(r["last_update"])]) logger.info(tabulate(rows, headers, tablefmt="simple")) return total_pages
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_apps(provider, query):\n\n workdir = os.path.dirname(os.path.realpath(__file__))\n with open(os.path.join(workdir, '..', 'config.yml')) as f:\n config = yaml.load(f)\n ex = Explorer()\n logging.info('Read bucket: %s', config['SCOOP_BUCKET'])\n apps = ex.get_apps(os.path.expandvars(con...
[ "0.6542337", "0.65027314", "0.64569217", "0.6388464", "0.618664", "0.6088148", "0.6048241", "0.60335594", "0.60146016", "0.6012545", "0.5858998", "0.5831379", "0.57853997", "0.5776328", "0.5764713", "0.57061666", "0.5654142", "0.56492996", "0.56406236", "0.56354034", "0.56090...
0.66877913
0
Displays info about the application selected
def display_app_info(config, client, app_id): try: resp = client.get_app_full_info(config.username, app_id) result = resp.json() app_info = result["app_info"] title = click.style("App Name : ", fg="blue") + click.style( "{}".format(app_info["title"])) if app_info["rating_count"] == 0: rating = "Not yet rated" else: rating = "{:.1f} ({} rating".format(app_info["average_rating"], int(app_info["rating_count"])) if app_info["rating_count"] > 1: rating += "s" rating += ")" rating_row = click.style("Rating : ", fg="blue") + click.style("{}".format(rating)) up_status = click.style("Status : ", fg="blue") if app_info["is_up"]: up_status += click.style("Up") else: up_status += click.style("Down") last_crawl_str = "Not yet crawled" if "last_crawl" in app_info: last_crawl_str = util.format_date(app_info["last_crawl"]) last_crawl = click.style("Last Crawl Time : ", fg="blue") + click.style( "{}".format(last_crawl_str)) version = click.style("Version : ", fg="blue") + click.style( "{}".format(app_info["version"])) last_updated_str = util.format_date(app_info["updated"]) last_update = click.style("Last Update : ", fg="blue") + click.style( "{}".format(last_updated_str)) availability = click.style("Availability : ", fg="blue") + click.style( "{:.2f}%".format(app_info["average_uptime"] * 100)) app_url = click.style("Public App URL : ", fg="blue") + click.style( "{}".format(app_info["app_url"])) original_url = click.style("Private App URL : ", fg="blue") + click.style( "{}".format(app_info["original_url"])) category = click.style("Category : ", fg="blue") + click.style( "{}".format(app_info["category"])) desc = click.style("Description : ", fg="blue") + click.style( "{}".format(app_info["description"])) price = click.style("Price Range : ", fg="blue") + click.style( "{} - {} Satoshis").format( app_info["min_price"], app_info["max_price"]) doc_url = click.style("Docs URL : ", fg="blue") + click.style( "{}".format(app_info["docs_url"])) quick_start = click.style("Quick Start\n\n", fg="blue") + click.style( app_info["quick_buy"]) usage_docs = None if "usage_docs" in app_info: usage_docs = click.style("Detailed usage\n\n", fg="blue") + click.style( app_info["usage_docs"]) page_components = [title, "\n", rating_row, up_status, availability, last_crawl, last_update, version, "\n", desc, app_url, original_url, doc_url, "\n", category, price, "\n", quick_start, "\n"] if usage_docs: page_components.append(usage_docs + "\n") final_str = "\n".join(page_components) logger.info(final_str, pager=True) except ServerRequestError as e: if e.status_code == 404: logger.info( "The specified id for the app ({}) does not match any apps in the " "marketplace.".format(app_id)) else: raise e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info():\r\n app = application.Application()\r\n\r\n app.start(r\"C:\\\\AL50022\\\\Circ\\\\bin\\\\Circ.exe\")\r\n\r\n app.Circ.menu_select(\"View\")", "def on_about(self):\n MessageBox.showinfo(\"SuperSID\", self.controller.about_app())", "def program_info():\n\n print(\n color...
[ "0.7198173", "0.6656836", "0.66274256", "0.6559104", "0.6542044", "0.6500156", "0.6425056", "0.6402444", "0.63951284", "0.6386804", "0.6373861", "0.63630366", "0.6341547", "0.63411224", "0.63381755", "0.63182807", "0.63173515", "0.62924206", "0.62774503", "0.6272408", "0.6257...
0.66377944
2
Runs validate_manifest and handles any errors that could occur
def check_app_manifest(api_docs_path, overrides, marketplace): if not os.path.exists(api_docs_path): raise exceptions.ValidationError( click.style("Could not find the manifest file at {}.", fg="red").format(api_docs_path)) if os.path.isdir(api_docs_path): raise exceptions.ValidationError( click.style("{} is a directory. Please enter the direct path to the manifest file.", fg="red").format(api_docs_path)) file_size = os.path.getsize(api_docs_path) / 1e6 if file_size > 2: raise exceptions.ValidationError( click.style("The size of the manifest file at {} exceeds the maximum limit of 2MB.", fg="red") .format(api_docs_path)) try: with open(api_docs_path, "r") as f: original_manifest_dict = yaml.load(f.read()) manifest_dict = transform_manifest(original_manifest_dict, overrides, marketplace) # write back the manifest in case some clean up or overriding has happend with open(api_docs_path, "w") as f: yaml.dump(manifest_dict, f) return manifest_dict except (YAMLError, ValueError): raise exceptions.ValidationError( click.style("Your manifest file at {} is not valid YAML.", fg="red") .format(api_docs_path))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_manifest(parser, options):\n if not options.manifest:\n return\n\n template = \"When specifying --manifest, {0} is also required\"\n\n if not options.manifest_id:\n parser.error(template.format(\"--manifest-id\"))\n \n if not options.manifest_service:\n parser.error(template.format(\"--m...
[ "0.69982684", "0.67911905", "0.6616815", "0.65430355", "0.63983166", "0.6289555", "0.62729937", "0.6270612", "0.61467505", "0.6103869", "0.6071787", "0.5995637", "0.59809095", "0.5950012", "0.5940859", "0.5853178", "0.57848716", "0.5735434", "0.5723771", "0.56745976", "0.5658...
0.61277246
9
cleans up possible errors in the user manifest.
def clean_manifest(manifest_json): manifest_json = copy.deepcopy(manifest_json) host = manifest_json["host"] host = host.strip("/").lstrip("http://").lstrip("https://") manifest_json["host"] = host return manifest_json
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean():\n user_init.clean_setup()", "def clear_errors(self) -> None:", "def clear_errors(self) -> None:", "def clean_up(self):\n\t\tpass", "def cleanUp(self):\r\n # All intermediates should be removed by app controller\r\n pass", "def clean_up(self):\n pass", "def clean_up(...
[ "0.6784651", "0.64837694", "0.64837694", "0.64458686", "0.6421459", "0.6405516", "0.6405516", "0.63899606", "0.6353433", "0.63306385", "0.63012415", "0.62639797", "0.6250906", "0.6223817", "0.619754", "0.6186283", "0.61667925", "0.6079713", "0.6040983", "0.60129434", "0.59378...
0.0
-1
Overrides fields in the manifest file.
def apply_overrides(manifest_json, overrides, marketplace): manifest_json = copy.deepcopy(manifest_json) if overrides is None: return manifest_json if "title" in overrides: manifest_json["info"]["title"] = overrides["title"] if "description" in overrides: manifest_json["info"]["description"] = overrides["description"] if "price" in overrides: invalid_price_format = "Price should be a non-negative integer." try: price = int(overrides["price"]) manifest_json["info"]["x-21-total-price"]["min"] = price manifest_json["info"]["x-21-total-price"]["max"] = price if price < 0: raise exceptions.ValidationError(invalid_price_format) except ValueError: raise exceptions.ValidationError(invalid_price_format) if "name" in overrides: manifest_json["info"]["contact"]["name"] = overrides["name"] if "email" in overrides: manifest_json["info"]["contact"]["email"] = overrides["email"] if "host" in overrides: manifest_json["host"] = overrides["host"] if "port" in overrides: host = manifest_json["host"] # if the host is in the form of https://x.com/ remove the trailing slash host = host.strip("/") invalid_port_format = "Port should be an integer between 0 and 65536." try: port = int(overrides["port"]) if port <= 0 or port > 65536: raise exceptions.ValidationError(invalid_port_format) except ValueError: raise exceptions.ValidationError(invalid_port_format) host += ":{}".format(port) manifest_json["host"] = host if "basePath" in overrides: manifest_json["basePath"] = overrides["basePath"] return manifest_json
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_manifest(self, manifest: Dict) -> None:\n if \"metadata\" not in manifest:\n manifest[\"metadata\"] = {}\n\n if \"files\" not in manifest:\n manifest[\"files\"] = {\n \"includes\": [],\n \"excludes\": [],\n }\n\n with open...
[ "0.61127824", "0.57904774", "0.57481503", "0.54889697", "0.54140353", "0.5328529", "0.5295124", "0.52817696", "0.5250707", "0.52453095", "0.5233346", "0.5206509", "0.5180013", "0.5170564", "0.51529664", "0.51508546", "0.5138381", "0.51179296", "0.5108538", "0.50936186", "0.50...
0.53681576
5
Replace "AUTO" in the host and quickbuy with the ZeroTier IP. The server subsequently replaces, in the displayed quickbuy, instances of the manifest host value with a mkt.21.co address.
def replace_auto(manifest_dict, marketplace): manifest_dict = copy.deepcopy(manifest_dict) def get_formatted_zerotier_address(marketplace): host = get_zerotier_address(marketplace) if "." not in host: return "[{}]".format(host) else: return host if 'AUTO' in manifest_dict['host']: manifest_dict['host'] = manifest_dict['host'].replace( 'AUTO', get_formatted_zerotier_address(marketplace)) if 'AUTO' in manifest_dict['info']['x-21-quick-buy']: manifest_dict['info']['x-21-quick-buy'] = manifest_dict['info']['x-21-quick-buy'].replace( 'AUTO', get_formatted_zerotier_address(marketplace)) return manifest_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _post_task_update_advertise_address():\n default_network_interface = None\n\n with open(KUBE_APISERVER_CONFIG) as f:\n lines = f.read()\n m = re.search(REGEXPR_ADVERTISE_ADDRESS, lines)\n if m:\n default_network_interface = m.group(1)\n LOG.debug(' ...
[ "0.60582787", "0.6001809", "0.57579035", "0.5625545", "0.5491891", "0.5420629", "0.5379404", "0.5277771", "0.52422714", "0.52219576", "0.52120817", "0.52100813", "0.52078915", "0.5189471", "0.5156395", "0.51266915", "0.5107505", "0.5092903", "0.5082044", "0.5071935", "0.50623...
0.7036063
0
Validates the manifest file Ensures that the required fields in the manifest are present and valid
def validate_manifest(manifest_json): manifest_json = copy.deepcopy(manifest_json) for field in ["schemes", "host", "basePath", "info"]: if field not in manifest_json: raise exceptions.ValidationError( click.style("Field '{}' is missing from the manifest file.", fg="red").format(field), json=manifest_json) for field in ["contact", "title", "description", "x-21-total-price", "x-21-quick-buy", "x-21-category"]: if field not in manifest_json["info"]: raise exceptions.ValidationError( click.style( "Field '{}' is missing from the manifest file under the 'info' section.", fg="red").format(field), json=manifest_json) for field in {"name", "email"}: if field not in manifest_json["info"]["contact"]: raise exceptions.ValidationError( click.style( "Field '{}' is missing from the manifest file under the 'contact' section.", fg="red") .format(field), json=manifest_json) for field in ["min", "max"]: if field not in manifest_json["info"]["x-21-total-price"]: raise exceptions.ValidationError( click.style("Field '{}' is missing from the manifest file under the " "'x-21-total-price' section.", fg="red"), json=manifest_json) if len(manifest_json["schemes"]) == 0: raise exceptions.ValidationError( click.style( "You have to specify either HTTP or HTTPS for your endpoint under the " "`schemes` section.", fg="red"), json=manifest_json) valid_app_categories = {'blockchain', 'entertainment', 'social', 'markets', 'utilities', 'iot'} if manifest_json["info"]["x-21-category"].lower() not in valid_app_categories: valid_categories = ", ".join(valid_app_categories) raise exceptions.ValidationError( click.style("'{}' is not a valid category for the 21 marketplace. Valid categories are {}.", fg="red").format( manifest_json["info"]["x-21-category"], valid_categories), json=manifest_json)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_manifest(parser, options):\n if not options.manifest:\n return\n\n template = \"When specifying --manifest, {0} is also required\"\n\n if not options.manifest_id:\n parser.error(template.format(\"--manifest-id\"))\n \n if not options.manifest_service:\n parser.error(template.format(\"--m...
[ "0.73052067", "0.6979145", "0.69215554", "0.68080264", "0.6786265", "0.6757262", "0.6450811", "0.6440165", "0.640244", "0.6351523", "0.63133943", "0.62944144", "0.62856257", "0.62499046", "0.62444276", "0.62436587", "0.6221382", "0.61910504", "0.6152198", "0.60909945", "0.606...
0.741697
0
Gets the zerotier IP address from the given marketplace name
def get_zerotier_address(marketplace): logger.info("You might need to enter your superuser password.") address = zerotier.get_address(marketplace) if not address: join_cmd = click.style("21 join", bold=True, reset=False) no_zt_network = click.style( "You are not part of the {}. Use {} to join the market.", fg="red") raise UnloggedException(no_zt_network.format(marketplace, join_cmd)) return address
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_vip_address(self, vip_name):\n networks = self.nailgun_client.get_networks(self.cluster_id)\n vip = networks.get('vips').get(vip_name, {}).get('ipaddr', None)\n asserts.assert_is_not_none(\n vip, \"Failed to get the IP of {} server\".format(vip_name))\n\n logger.debug...
[ "0.64503324", "0.63069993", "0.6197815", "0.618933", "0.61700016", "0.609886", "0.5992339", "0.5982672", "0.5972976", "0.5954624", "0.5945781", "0.5938082", "0.5936992", "0.5928978", "0.59271926", "0.59166557", "0.58961654", "0.5854242", "0.581978", "0.58141637", "0.5809872",...
0.6974309
0
Checks the state of a field and its neighbors to decide whether the field should die or live in the next tick
def _should_cell_live(self, cell: Cell) -> bool: living_neighbours_count = self._count_living_neighbors(cell) # Any live cell with two or three live neighbours survives if cell.is_alive and living_neighbours_count in [2, 3]: return True # Any dead cell with three live neighbours becomes a live cell if not cell.is_alive and living_neighbours_count == 3: return True # All other live cells die in the next generation. Similarly, all other dead cells stay dead return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def live_or_die(self, x, y):\n neighbors = self.get_neighbors(x, y)\n num_neighbors = 0\n for val in neighbors:\n if val:\n num_neighbors+=1\n\n\n # cell dies if less than 2 neighbors\n if num_neighbors < 2:\n return False\n\n # cell li...
[ "0.604368", "0.5863431", "0.584722", "0.5698167", "0.567636", "0.5640735", "0.5575544", "0.5574422", "0.55377287", "0.5520766", "0.55079025", "0.5434514", "0.54343575", "0.5425291", "0.5410013", "0.5398703", "0.5397574", "0.5384121", "0.53724176", "0.5368251", "0.53623694", ...
0.0
-1
Returns a count of horizontally, vertically and diagonally adjacent living cells
def _count_living_neighbors(self, cell: Cell) -> int: count = 0 # borders of the area in which we are trying to find neighbors # Let's assume y axis directs downside and x axis directs to the left for x in range(cell.x - 1, cell.x + 2): for y in range(cell.y - 1, cell.y + 2): if cell.x == x and cell.y == y: continue if (x, y) in self.living_cells.keys(): count += 1 return count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAdjacentCount(grid, x, y, X, Y, char):\n count = 0\n try{\n if x == 0:\n\n if y == 0:\n\n if x == X-1:\n\n if y == Y-1:\n }", "def _count_adj_occupied(grid: List[List[str]], row: int, col: int) -> int:\n count = 0\n if row - 1 >= 0:\n if col - 1 >= 0:\n count...
[ "0.75605994", "0.7353794", "0.7319598", "0.7206011", "0.6943233", "0.6866241", "0.68430185", "0.68314976", "0.6813723", "0.6796741", "0.67812294", "0.6732968", "0.6658989", "0.6624076", "0.65973485", "0.658886", "0.65862817", "0.65752614", "0.652818", "0.6520708", "0.645585",...
0.68710995
5
Generates an initial state of the game
def _create_living_cells(self, living_cells_positions: List[Tuple[int, int]]) -> None: for x, y in living_cells_positions: self.living_cells[x, y] = Cell(x, y, True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_state(self):\n state = GameState(self.size)\n return state", "def make_initial_state(self,seed,scrambles):\n seen = {}\n ns=0\n x = range(self.N*self.N)\n\n for r in range(self.N):\n for c in range(self.N):\n if x[r*self.N+c]==0:\n ...
[ "0.75943387", "0.7504709", "0.7235902", "0.7209142", "0.6989828", "0.6983098", "0.6977527", "0.68630457", "0.68396306", "0.68289196", "0.6774058", "0.6772746", "0.67558104", "0.67219126", "0.6709018", "0.669816", "0.6664396", "0.6647363", "0.6641459", "0.65971696", "0.6497779...
0.0
-1
Creates a game with a random initial state
def randomize(self, count, deviation: int = 5): cells = [] for i in range(count): cells.append( (random.randint(-deviation, deviation - 1), random.randint(-deviation, deviation - 1)) ) self._create_living_cells(cells) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_state(self):\n state = GameState(self.size)\n return state", "def make_state() -> state.GameState:\r\n dung: world.Dungeon = worldgen.EmptyDungeonGenerator(20, 20).spawn_dungeon(0)\r\n p1x, p1y = dung.get_random_unblocked()\r\n p2x, p2y = dung.get_random_unblocked()\r\n whil...
[ "0.7173411", "0.7049228", "0.6956561", "0.6915384", "0.6877471", "0.67299753", "0.67241377", "0.6658237", "0.6629494", "0.66283655", "0.66206324", "0.65918475", "0.6558591", "0.6555488", "0.6528986", "0.65245974", "0.6520028", "0.64893174", "0.6486757", "0.64732444", "0.64720...
0.0
-1
Returns the next state of the game
def generate_next_state(self) -> Dict[Tuple[int, int], Cell]: next_state: Dict[Tuple[int, int], Cell] = {} for living_cell in self.living_cells.values(): for x in range(living_cell.x - 1, living_cell.x + 2): for y in range(living_cell.y - 1, living_cell.y + 2): cell = Cell(x, y) if (x, y) in self.living_cells.keys(): cell = self.living_cells[x, y] if self._should_cell_live(cell): next_state[x, y] = Cell(x, y, True) self.living_cells = next_state return self.living_cells
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_next(self):\n\t\tassert(len(self.past_values) < 256**3)\n\t\twhile self.advance_state() in self.past_values:\n\t\t\tpass\n\t\tself.past_values.add(self.state)\n\t\treturn self.state", "def getNextState(self):\n if self.__mode == \"AlphaBeta\":\n next_state = self.startAlphaBeta()\n ...
[ "0.81304115", "0.8000824", "0.7832929", "0.78188527", "0.7760601", "0.7588468", "0.75123686", "0.7505072", "0.7259888", "0.72233593", "0.7170211", "0.7106312", "0.70742047", "0.7022712", "0.7002653", "0.69881517", "0.6954046", "0.69376624", "0.69316417", "0.69316417", "0.6925...
0.6383667
59
Prints the current state in the console
def display_cli(self) -> None: if len(self.living_cells.keys()) == 0: print('.') return min_x, min_y = math.inf, math.inf max_x, max_y = -math.inf, -math.inf for x, y in self.living_cells.keys(): min_x = min(min_x, x) min_y = min(min_y, y) max_x = max(max_x, x) max_y = max(max_y, y) for y in range(min_y, max_y + 1): chars = "" for x in range(min_x, max_x + 1): chars += '*' if (x, y) in self.living_cells.keys() else '.' print(chars) print()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_state(self):\n print('\\nthe current state is: ' + str(self.state) + '\\n')", "def display_state(self):\r\n\r\n print('\\n')\r\n print('>>CURRENT STATE')\r\n ct = 0\r\n for i in self.state:\r\n for j in i:\r\n if j == -1:\r\n ...
[ "0.88597125", "0.8146921", "0.7986526", "0.7926085", "0.7904914", "0.7863573", "0.7799375", "0.7672214", "0.7600998", "0.7504073", "0.750387", "0.73954594", "0.7305813", "0.7303963", "0.724449", "0.71872765", "0.71179473", "0.7104623", "0.7040808", "0.70034736", "0.6951544", ...
0.0
-1
This program plays hangman game
def main(): # initial condition ans = random_word() remaining_guess_num = N_TURNS guess_word = '' for i in range(len(ans)): guess_word += '-' # start to play hangman game while (remaining_guess_num > 0) and (guess_word != ans): print('The word looks like: ' + str(guess_word)) print('You have ' + str(remaining_guess_num) + ' guesses left.') input_ch = str(input('Your guess: ')) # illegal format if not input_ch.isalpha(): print('illegal format.') elif len(input_ch) != 1: print('illegal format.') # correct format else: # case-insensitive input_ch = input_ch.upper() # wrong guess if ans.find(input_ch) == -1: print('There is no ' + str(input_ch) + '\'s in the word.') remaining_guess_num -= 1 # correct guess else: print('You are correct!') ans_slice = ans # replace all the correct guessed letter(s) while ans_slice.find(input_ch) != -1: replace_loc = len(ans) - len(ans_slice) + ans_slice.find(input_ch) guess_word = replace_letter(input_ch, replace_loc, guess_word) ans_slice = ans_slice[ans_slice.find(input_ch)+1:] # win if guess_word == ans: print('You win!!') # lose else: print('You are completely hung : (') print('The word was: ' + str(ans))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n game = Hangman()\n game.play_hangman()", "def play_hangman(self):\n while self.stage < 6:\n self.display_hangman()\n guess = input(f'{Fore.YELLOW}Choose a letter: {Style.RESET_ALL}').lower().strip() # noqa\n print('\\n')\n if guess.isalpha()...
[ "0.8373847", "0.8304962", "0.82357603", "0.8165628", "0.7786699", "0.7716054", "0.7695237", "0.7678341", "0.7639744", "0.7586323", "0.7568711", "0.75466156", "0.7424747", "0.7330501", "0.7276859", "0.72238797", "0.72146386", "0.71630037", "0.7157477", "0.714775", "0.7065392",...
0.77418953
5
Initialize the view provider
def __init__(self, obj): obj.Proxy = self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_view(self):\n self.view_map = self.ctx.clientmap", "def initialize(self, view, request, *args, **kwargs):\n view.request = request\n view.args = args\n view.kwargs = kwargs\n return view", "def setUp(self):\n self.theView = View()", "def initView(self):\n ...
[ "0.74448436", "0.70989877", "0.69125175", "0.67591083", "0.66585654", "0.653166", "0.6484332", "0.63898385", "0.63898385", "0.6375199", "0.63615674", "0.63615674", "0.63615674", "0.6273222", "0.62673444", "0.6202396", "0.61920524", "0.6179315", "0.6178323", "0.61032915", "0.6...
0.0
-1
View provider scene graph initialization
def attach(self, obj): self.Object = obj.Object
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_view(self):\n self.view_map = self.ctx.clientmap", "def viewer_setup(self):\n pass", "def viewer_setup(self):\n pass", "def __init__(self, scene: Scene):\n self.scene = scene", "def __init__(self, scene): # type: (Scene) -> None\n self.scene = scene", "def on_s...
[ "0.6847052", "0.6840577", "0.6840577", "0.66847914", "0.65465605", "0.63439626", "0.63439626", "0.63439626", "0.6235359", "0.6225565", "0.6199402", "0.61638135", "0.61520505", "0.6145105", "0.6108402", "0.6104385", "0.6099813", "0.6098735", "0.6098318", "0.6096668", "0.606917...
0.0
-1
Return default display mode
def getDefaultDisplayMode(self): return "Wireframe"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrentDisplay():\n # Windows reports the active display as 'console', so we hardcode it\n return \"console\"", "def mode(self) -> Optional[str]:\n return pulumi.get(self, \"mode\")", "def mode(self) -> Optional[str]:\n return pulumi.get(self, \"mode\")", "def get_mode(self):\r\n ...
[ "0.7362568", "0.72185713", "0.72185713", "0.7218308", "0.7204967", "0.7182178", "0.7182178", "0.7181349", "0.71671027", "0.7127637", "0.7036331", "0.7016391", "0.70013005", "0.6981956", "0.6971124", "0.6963615", "0.6962245", "0.6953157", "0.69366914", "0.6927507", "0.69018614...
0.7002804
12
Set mode wireframe only
def setDisplayMode(self, mode): return "Wireframe"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle_wireframe(self):\n self.view['wireframe'] = not self.view['wireframe']\n self.update_flags()", "def wireframe_only(self):\n return self._wireframe_only", "def setSurfaceShadingMode(mode='flat'):\n sdict = {'flat':'FLAT','smooth':'SMOOTH'}\n dislin.shdmod(sdict[mode], 'SURF...
[ "0.8165864", "0.7190839", "0.67805", "0.6758721", "0.65666986", "0.6441041", "0.6434427", "0.6336882", "0.6314271", "0.6215526", "0.61872584", "0.6129271", "0.60960007", "0.6085161", "0.5989606", "0.5981274", "0.59671307", "0.5965656", "0.5920257", "0.58588403", "0.5820351", ...
0.7538678
1
Handle individual property changes
def onChanged(self, vp, prop): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onPropertiesChange(self, data):\n pass", "def propertyChanged(self, p_str, Any): # real signature unknown; restored from __doc__\n pass", "def on_property_change(self, td, name):\n\n raise NotImplementedError()", "def onChanged(self, fp, prop):\n if prop == \"Length\" or prop ...
[ "0.75981975", "0.71719784", "0.7011226", "0.69150203", "0.66239375", "0.6611883", "0.6571908", "0.65436894", "0.6386289", "0.63312656", "0.6329722", "0.632825", "0.6243396", "0.6038764", "0.6026384", "0.60087305", "0.60087305", "0.60087305", "0.596836", "0.5836696", "0.582731...
0.74094045
2
Check internet connection Raise exception if none
def check_connection(url="http://example.com/"): try: requests.head(url) return True except requests.ConnectionError: spinner.warn("No internet connecction 🤭") sys.exit(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def internet_on(): \n try:\n urlopen('http://www.google.com', timeout=2)\n return True\n except urlopen.URLError as err: \n return False", "def check_internet_connection():\n logging.debug('Checking internet connection')\n try:\n urlopen(config.api_base_url,\...
[ "0.8113887", "0.8006314", "0.798462", "0.78738654", "0.7798628", "0.7766045", "0.7750547", "0.7554359", "0.7195896", "0.7195208", "0.7083016", "0.70552427", "0.69422174", "0.69266725", "0.6923615", "0.69057584", "0.6864931", "0.67980105", "0.67922544", "0.6775535", "0.6751784...
0.7992725
2
Creates a Flask application.
def _create_app(self, config={}): app = Flask('signac-dashboard') app.config.update({ 'SECRET_KEY': os.urandom(24), 'SEND_FILE_MAX_AGE_DEFAULT': 300, # Cache control for static files }) # Load the provided config app.config.update(config) # Enable profiling if app.config.get('PROFILE'): logger.warning("Application profiling is enabled.") from werkzeug.contrib.profiler import ProfilerMiddleware app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[10]) # Set up default signac-dashboard static and template paths signac_dashboard_path = os.path.dirname(__file__) app.static_folder = signac_dashboard_path + '/static' app.template_folder = signac_dashboard_path + '/templates' # Set up custom template paths # The paths in DASHBOARD_PATHS give the preferred order of template # loading loader_list = [] for dashpath in list(app.config.get('DASHBOARD_PATHS', [])): logger.warning("Adding '{}' to dashboard paths.".format(dashpath)) loader_list.append( jinja2.FileSystemLoader(dashpath + '/templates')) # The default loader goes last and is overridden by any custom paths loader_list.append(app.jinja_loader) app.jinja_loader = jinja2.ChoiceLoader(loader_list) turbolinks(app) return app
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_app() -> Flask:\n logger.info('creating flask application')\n app = Flask(\n 'pasta',\n static_url_path='/static',\n static_folder='./static',\n template_folder='./views')\n config.flask.SECRET_KEY = os.urandom(32)\n config.flask.SERVER_NAME = None\n app.config.f...
[ "0.85773337", "0.84702384", "0.8426545", "0.84196174", "0.84109616", "0.8407618", "0.83920527", "0.8390233", "0.83386177", "0.8315099", "0.83083576", "0.8303583", "0.8263485", "0.8250034", "0.8220532", "0.82113147", "0.82048184", "0.81779504", "0.81760377", "0.8132556", "0.81...
0.0
-1
Add assets for inclusion in the dashboard HTML.
def _create_assets(self): assets = Environment(self.app) # jQuery is served as a standalone file jquery = Bundle('js/jquery-*.min.js', output='gen/jquery.min.js') # JavaScript is combined into one file and minified js_all = Bundle('js/js_all/*.js', filters='jsmin', output='gen/app.min.js') # SCSS (Sassy CSS) is compiled to CSS scss_all = Bundle('scss/app.scss', filters='libsass', output='gen/app.css') assets.register('jquery', jquery) assets.register('js_all', js_all) assets.register('scss_all', scss_all) return assets
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assets():", "def assets():\n pass", "def compile_static_assets(assets):\n assets.auto_build = True\n assets.debug = False\n\n css = Bundle(\n \"css/*.css\",\n # filters=\"less,cssmin\",\n output=\"gen/avantui.css\",\n # extra={\"rel\": \"stylesheet/less\"},\n )\n\...
[ "0.7301845", "0.69285274", "0.6680427", "0.6377354", "0.60470253", "0.59089947", "0.5860708", "0.5840234", "0.5829316", "0.5822734", "0.5812532", "0.57396126", "0.57066774", "0.56420225", "0.556743", "0.5532212", "0.5530811", "0.5510526", "0.5499899", "0.548234", "0.54720134"...
0.6160059
4
Register an asset required by a dashboard module. Some modules require special scripts or stylesheets, like the
def register_module_asset(self, asset): self._module_assets.append(asset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_xmodule_assets():\r\n sh('xmodule_assets common/static/xmodule')", "def assets():\n pass", "def assets():", "def script_info_assets(app, static_dir, testcss):\n InvenioAssets(app)\n\n blueprint = Blueprint(__name__, \"test_bp\", static_folder=static_dir)\n\n class Ext(object):\n ...
[ "0.6323401", "0.6234134", "0.5986547", "0.57688546", "0.57355887", "0.57000977", "0.5596467", "0.5571452", "0.55544966", "0.55511576", "0.5550094", "0.54957074", "0.548881", "0.54596376", "0.5429053", "0.537195", "0.5304316", "0.52905613", "0.52882594", "0.5239327", "0.523754...
0.70824754
0
Prepare this dashboard instance to run.
def _prepare(self): # Set configuration defaults and save to the project document self.config.setdefault('PAGINATION', True) self.config.setdefault('PER_PAGE', 25) # Create and configure the Flask application self.app = self._create_app(self.config) # Add assets and routes self.assets = self._create_assets() self._register_routes() # Add module assets and routes self._module_assets = [] for module in self.modules: try: module.register(self) except Exception as e: logger.error('Error while registering {} module: {}'.format( module.name, e)) logger.error('Removing module {} from dashboard.'.format( module.name)) self.modules.remove(module) # Clear dashboard and project caches. self.update_cache()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n # Wipe the db\n self.wipe_db()\n\n # Set some global things\n try:\n dashboard_configuration = DashboardConfiguration(type=\"default\")\n dashboard_configuration.save()\n except IntegrityError:\n dashboard_configuration = Das...
[ "0.62227356", "0.61323386", "0.6124156", "0.6124156", "0.6124156", "0.603257", "0.6021469", "0.6008526", "0.59598756", "0.5919939", "0.5891619", "0.58891463", "0.5887354", "0.5885531", "0.58851296", "0.58174354", "0.57714", "0.57629365", "0.57341665", "0.57147014", "0.5703350...
0.6481295
0
Runs the dashboard webserver.
def run(self, *args, **kwargs): host = self.config.get('HOST', 'localhost') port = self.config.get('PORT', 8888) max_retries = 5 for _ in range(max_retries): try: self.app.run(host, port, *args, **kwargs) break except OSError as e: logger.warning(e) if port: port += 1 pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def webserver_start():\n run(_webserver_command())", "def run_dashboard(\n database_path,\n no_browser,\n port,\n updating_options,\n):\n port = _find_free_port() if port is None else port\n port = int(port)\n\n if not isinstance(database_path, (str, pathlib.Path)):\n raise TypeErr...
[ "0.7217987", "0.7090126", "0.6873404", "0.6859352", "0.6825107", "0.6763319", "0.67429936", "0.6691408", "0.6641341", "0.655142", "0.6534171", "0.6508218", "0.6484628", "0.64228106", "0.6421459", "0.64109594", "0.6343112", "0.63255435", "0.63101995", "0.63063806", "0.6303844"...
0.0
-1
Override this method for custom job titles. This method generates job titles. By default, the title is a pretty (but verbose) form of the job state point, based on the project schema.
def job_title(self, job): def _format_num(num): if isinstance(num, bool): return str(num) elif isinstance(num, Real): return str(round(num, 2)) return str(num) try: s = [] for keys in sorted(self._schema_variables()): v = job.statepoint()[keys[0]] try: for key in keys[1:]: v = v[key] except KeyError: # Particular key is present in overall continue # schema, but not this state point. else: s.append('{}={}'.format('.'.join(keys), _format_num(v))) return ' '.join(s) except Exception as error: logger.debug( "Error while generating job title: '{}'. " "Returning job-id as fallback.".format(error)) return str(job)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job_title(self, job_name):\n return ''", "def _make_title(self):\n ret = self.properties['reason'].capitalize()\n ret += ' has been reported near ' + self.properties['address'].split(',')[0]\n time = datetime.strptime(self.properties['when'], '%Y-%m-%dT%H:%M:%S')\n time...
[ "0.6774112", "0.6684482", "0.6545176", "0.65105885", "0.64988434", "0.6343814", "0.6343415", "0.6338762", "0.62752765", "0.6266623", "0.6256214", "0.6256214", "0.6229947", "0.6229947", "0.6226944", "0.61802864", "0.61802864", "0.6152143", "0.6079925", "0.60740346", "0.6057321...
0.756392
0
Override this method for custom job subtitles. This method generates job subtitles. By default, the subtitle is a minimal unique substring of the job id.
def job_subtitle(self, job): return str(job)[:max(8, self._project_min_len_unique_id())]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtitle(self, txt):\n num = len(txt)\n ticks = \"-\" * num\n print(txt)\n print(ticks)", "def getSubtitleURL(self):\n\n # If it is a movie, we use this methodology -\n try:\n IndexingParameters = [\"subtitleUrls\", 0, \"url\"]\n TitleParamters ...
[ "0.6298904", "0.5891134", "0.57354397", "0.57253325", "0.57177824", "0.5635711", "0.5478623", "0.5465625", "0.5414711", "0.54018885", "0.53634965", "0.53630906", "0.535014", "0.5312166", "0.5256253", "0.5206248", "0.5183688", "0.5179891", "0.517678", "0.516628", "0.51632917",...
0.74129283
0
Override this method for custom job sorting. This method returns a key that can be compared to sort jobs. By
def job_sorter(self, job): key = natsort.natsort_keygen(key=self.job_title, alg=natsort.REAL) return key(job)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_priority_key(self, job):\n raise NotImplemented", "def sort_key(self):\n ...", "def get_sort_key(self) -> str:\n return self.name", "def job_priority_key(self, job):\n camp, user = job.camp, job.user\n end = camp.time_left / user.shares # lower value -> higher prio...
[ "0.75236887", "0.74009395", "0.71635604", "0.7031687", "0.64361453", "0.6359381", "0.62978643", "0.6156635", "0.61132455", "0.6011168", "0.59698707", "0.59516037", "0.5946783", "0.592785", "0.5922575", "0.59023565", "0.58991647", "0.58991647", "0.5893522", "0.5864389", "0.584...
0.78755414
0
Add a route to the dashboard. This method allows custom view functions to be triggered for specified routes. These view functions are imported lazily, when their route
def add_url(self, import_name, url_rules=[], import_file='signac_dashboard', **options): if import_file is not None: import_name = import_file + '.' + import_name for url_rule in url_rules: self.app.add_url_rule( rule=url_rule, view_func=LazyView(dashboard=self, import_name=import_name), **options)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_routes(self):\n pass", "def add_route(config, route, view, route_name=None, renderer='json'):\n route_name = route_name or view.__name__\n config.add_route(route_name, route)\n config.add_view(view, route_name=route_name, renderer=renderer)", "def add_route(self, pattern: str, view: Cal...
[ "0.70428646", "0.69580984", "0.6819496", "0.6740185", "0.65938735", "0.6558933", "0.6456988", "0.643927", "0.64224243", "0.6417979", "0.6417649", "0.6408866", "0.6398267", "0.63959163", "0.638843", "0.6382129", "0.63491535", "0.63472974", "0.63417435", "0.6259017", "0.6238091...
0.0
-1
Registers routes with the Flask application. This method configures context processors, templates, and sets up routes for a basic Dashboard instance. Additionally, routes declared by modules are registered by this method.
def _register_routes(self): dashboard = self @dashboard.app.after_request def prevent_caching(response): if 'Cache-Control' not in response.headers: response.headers['Cache-Control'] = 'no-store' return response @dashboard.app.context_processor def injections(): session.setdefault('enabled_modules', [i for i in range(len(self.modules)) if self.modules[i].enabled]) return { 'APP_NAME': 'signac-dashboard', 'APP_VERSION': __version__, 'PROJECT_NAME': self.project.config['project'], 'PROJECT_DIR': self.project.config['project_dir'], 'modules': self.modules, 'enabled_modules': session['enabled_modules'], 'module_assets': self._module_assets } # Add pagination support from http://flask.pocoo.org/snippets/44/ @dashboard.app.template_global() def url_for_other_page(page): args = request.args.copy() args['page'] = page return url_for(request.endpoint, **args) @dashboard.app.template_global() def modify_query(**new_values): args = request.args.copy() for key, value in new_values.items(): args[key] = value return '{}?{}'.format(request.path, url_encode(args)) @dashboard.app.errorhandler(404) def page_not_found(error): return self._render_error(str(error)) self.add_url('views.home', ['/']) self.add_url('views.settings', ['/settings']) self.add_url('views.search', ['/search']) self.add_url('views.jobs_list', ['/jobs/']) self.add_url('views.show_job', ['/jobs/<jobid>']) self.add_url('views.get_file', ['/jobs/<jobid>/file/<path:filename>']) self.add_url('views.change_modules', ['/modules'], methods=['POST'])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_routes(self):\n# from server.flask import views as flask_views\n# flask_views_custom_methods = filter(lambda x: x.startswith(\"view_\"), dir(flask_views))\n# for custom_method in flask_views_custom_methods:\n# # Retrieve data needed to add the URL rule to the Flask app\n# ...
[ "0.72350115", "0.6712779", "0.67111504", "0.66817683", "0.6653695", "0.6587917", "0.6505443", "0.64713275", "0.6450273", "0.63990045", "0.63630635", "0.63256997", "0.63007975", "0.6283785", "0.6241679", "0.6237398", "0.62150884", "0.61836624", "0.6177383", "0.6159926", "0.612...
0.7511353
0
Clear project and dashboard server caches. The dashboard relies on caching for performance. If the data space is altered, this method may need to be called before the dashboard reflects those changes.
def update_cache(self): # Try to update signac project cache. Requires signac 0.9.2 or later. with warnings.catch_warnings(): warnings.simplefilter(action='ignore', category=FutureWarning) try: self.project.update_cache() except Exception: pass # Clear caches of all dashboard methods members = inspect.getmembers(self, predicate=inspect.ismethod) for func in filter(lambda f: hasattr(f, 'cache_clear'), map(lambda x: x[1], members)): func.cache_clear()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cache():\n # TODO\n pass", "def clear_cache(self):\n\n for dataset in self._datasets:\n dataset.clear_cache()", "def clear_cache(self):\n pass", "def _clear_cache(self):\n keys = [\"nodes\", \"availability\", \"capacity\", \"cost\"]\n for key in ...
[ "0.67237765", "0.67170703", "0.6651066", "0.65608287", "0.6541997", "0.64387864", "0.642453", "0.63758636", "0.6363097", "0.6251716", "0.62509453", "0.62315863", "0.6219807", "0.6218337", "0.6209813", "0.62015516", "0.61923134", "0.61808413", "0.6152699", "0.61314887", "0.611...
0.72654325
0
Call the dashboard as a WSGI application.
def __call__(self, environ, start_response): return self.app(environ, start_response)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\r\n run_wsgi_app(app)", "def main():\n run_wsgi_app(APP)", "def Main():\n wsgiref.handlers.CGIHandler().run(application)", "def main(_, **settings):\n config = Configurator(settings=settings)\n register_includes(config)\n register_json_renderer(config)\n register_routes(config)...
[ "0.74744", "0.72382814", "0.69897854", "0.6828364", "0.66787845", "0.6616081", "0.6616081", "0.658992", "0.6578323", "0.65606695", "0.65123874", "0.6492135", "0.64652956", "0.64537275", "0.6407495", "0.6406011", "0.640311", "0.63525355", "0.635047", "0.6333705", "0.6266929", ...
0.6479684
12
Runs the command line interface. Call this function to use signacdashboard from its command line
def main(self): def _run(args): kwargs = vars(args) if kwargs.get('host', None) is not None: self.config['HOST'] = kwargs.pop('host') if kwargs.get('port', None) is not None: self.config['PORT'] = kwargs.pop('port') self.config['PROFILE'] = kwargs.pop('profile') self.config['DEBUG'] = kwargs.pop('debug') self.run() parser = argparse.ArgumentParser( description="signac-dashboard is a web-based data visualization " "and analysis tool, part of the signac framework.") parser.add_argument( '--debug', action='store_true', help="Show traceback on error for debugging.") parser.add_argument( '--version', action='store_true', help="Display the version number and exit.") subparsers = parser.add_subparsers() parser_run = subparsers.add_parser('run') parser_run.add_argument( '-p', '--profile', action='store_true', help='Enable flask performance profiling.') parser_run.add_argument( '-d', '--debug', action='store_true', help='Enable flask debug mode.') parser_run.add_argument( '--host', type=str, help='Host (binding address). Default: localhost') parser_run.add_argument( '--port', type=int, help='Port to listen on. Default: 8888') parser_run.set_defaults(func=_run) # This is a hack, as argparse itself does not # allow to parse only --version without any # of the other required arguments. if '--version' in sys.argv: print('signac-dashboard', __version__) sys.exit(0) args = parser.parse_args() if args.debug: logger.setLevel(logging.DEBUG) if not hasattr(args, 'func'): parser.print_usage() sys.exit(2) try: self.observer.start() args.func(args) except RuntimeWarning as warning: logger.warning("Warning: {}".format(warning)) if args.debug: raise sys.exit(1) except Exception as error: logger.error('Error: {}'.format(error)) if args.debug: raise sys.exit(1) finally: self.observer.stop() self.observer.join()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():\n config, auth, execute_now = read_command_line_arguments()\n main(config, auth, execute_now)", "def cli():\n pass", "def main(args):\n cli = CLI()\n # Check arguments\n cli.parse_arguments(args)", "def main_cli():\n pass", "def main():\n CLI_APP.run()", "def cli():...
[ "0.73368174", "0.6704575", "0.66263586", "0.6620892", "0.65879875", "0.65856606", "0.6576689", "0.6504645", "0.64861155", "0.6461405", "0.6461405", "0.6461405", "0.6461405", "0.6461405", "0.6461405", "0.6461405", "0.6461405", "0.6461405", "0.6461405", "0.6461405", "0.6461405"...
0.70329654
1
Compresses a tensor with the given compression context, and then returns it with the context needed to decompress it.
def compress(self, tensor):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(self, tensor, *args, **kwargs):\n return self.compressor.compress(tensor)", "def compress(self, tensor, *args, **kwargs):\n return self.compressor.compress(tensor)", "def decompress(self, tensor, ctx, *args, **kwargs):\n return tensor", "def compress(self, tensor, *args, **k...
[ "0.7178514", "0.7178514", "0.6956097", "0.68778074", "0.6652845", "0.64798415", "0.6468104", "0.61270404", "0.60731876", "0.5983608", "0.56424665", "0.5547921", "0.5408176", "0.5383199", "0.53278595", "0.5266407", "0.5179403", "0.5145993", "0.5139783", "0.51359445", "0.513499...
0.67097557
4
Decompress the tensor with the given decompression context.
def decompress(self, tensors):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decompress(self, tensor, ctx, *args, **kwargs):\n pass", "def decompress(self, tensor, ctx, *args, **kwargs):\n return tensor", "def decompress(self, tensor, ctx, *args, **kwargs):\n tensor = self.compressor.decompress(tensor, ctx, *args, **kwargs)\n \n # uncompressed gra...
[ "0.8031564", "0.7931041", "0.75796515", "0.7512713", "0.71366394", "0.68911856", "0.66436976", "0.6177685", "0.60084254", "0.5998883", "0.5772824", "0.5761908", "0.5596383", "0.55957705", "0.5553985", "0.54953575", "0.5484418", "0.54572964", "0.54572964", "0.5454716", "0.5433...
0.71033555
5
Compresses a tensor with the given compression context, and then returns it with the context needed to decompress it.
def encode(self, seq):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(self, tensor, *args, **kwargs):\n return self.compressor.compress(tensor)", "def compress(self, tensor, *args, **kwargs):\n return self.compressor.compress(tensor)", "def decompress(self, tensor, ctx, *args, **kwargs):\n return tensor", "def compress(self, tensor, *args, **k...
[ "0.7178514", "0.7178514", "0.6956097", "0.68778074", "0.67097557", "0.6652845", "0.64798415", "0.6468104", "0.61270404", "0.60731876", "0.5983608", "0.56424665", "0.5547921", "0.5408176", "0.5383199", "0.53278595", "0.5266407", "0.5179403", "0.5145993", "0.5139783", "0.513594...
0.0
-1
Decompress the tensor with the given decompression context.
def decode(self, coded_set):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decompress(self, tensor, ctx, *args, **kwargs):\n pass", "def decompress(self, tensor, ctx, *args, **kwargs):\n return tensor", "def decompress(self, tensor, ctx, *args, **kwargs):\n tensor = self.compressor.decompress(tensor, ctx, *args, **kwargs)\n \n # uncompressed gra...
[ "0.8031564", "0.7931041", "0.75796515", "0.7512713", "0.71366394", "0.71033555", "0.68911856", "0.66436976", "0.6177685", "0.60084254", "0.5998883", "0.5772824", "0.5761908", "0.5596383", "0.55957705", "0.5553985", "0.54953575", "0.5484418", "0.54572964", "0.54572964", "0.545...
0.0
-1
Runs optimization over n rounds of k sequential trials.
def test_run_experiment_locally(self) -> None: experiment = Experiment( name="torchx_booth_sequential_demo", search_space=SearchSpace(parameters=self._parameters), optimization_config=OptimizationConfig(objective=self._objective), runner=self._runner, is_test=True, properties={Keys.IMMUTABLE_SEARCH_SPACE_AND_OPT_CONF: True}, ) scheduler = Scheduler( experiment=experiment, generation_strategy=( choose_generation_strategy( search_space=experiment.search_space, ) ), options=SchedulerOptions(), ) try: for _ in range(3): scheduler.run_n_trials(max_trials=2) # TorchXMetric always returns trial index; hence the best experiment # for min objective will be the params for trial 0. scheduler.report_results() except FailureRateExceededError: pass # TODO(ehotaj): Figure out why this test fails in OSS. # Nothing to assert, just make sure experiment runs.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, n_trials=10):\n # Create study object\n if self.study is None:\n self.study = optuna.create_study(\n direction=\"minimize\",\n sampler=optuna.samplers.RandomSampler(seed=123)\n )\n # Run trials\n self.study.optimize(\n ...
[ "0.62938315", "0.6189227", "0.6007014", "0.5923211", "0.58506715", "0.58172965", "0.58066565", "0.58060586", "0.57466394", "0.5720371", "0.5709016", "0.57055277", "0.56977755", "0.56941396", "0.5682223", "0.5663299", "0.56584656", "0.5658233", "0.56204224", "0.5607117", "0.55...
0.0
-1
Runs optimization over k x n rounds of k parallel trials. This asks Ax to run up to max_parallelism_cap trials in parallel by submitting them to the scheduler at the same time.
def test_run_experiment_locally_in_batches(self) -> None: parallelism = 2 rounds = 3 experiment = Experiment( name="torchx_booth_parallel_demo", search_space=SearchSpace(parameters=self._parameters), optimization_config=OptimizationConfig(objective=self._objective), runner=self._runner, is_test=True, properties={Keys.IMMUTABLE_SEARCH_SPACE_AND_OPT_CONF: True}, ) scheduler = Scheduler( experiment=experiment, generation_strategy=( choose_generation_strategy( search_space=experiment.search_space, max_parallelism_cap=parallelism, ) ), options=SchedulerOptions( run_trials_in_batches=True, total_trials=(parallelism * rounds) ), ) try: scheduler.run_all_trials() # TorchXMetric always returns trial index; hence the best experiment # for min objective will be the params for trial 0. scheduler.report_results() except FailureRateExceededError: pass # TODO(ehotaj): Figure out why this test fails in OSS. # Nothing to assert, just make sure experiment runs.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self, n_steps: int, n_parallel: int = 1, **kwargs):\n batch_size = kwargs.get(\"batch_size\", 1)\n n_parallel = min(n_parallel, batch_size)\n with self.scheduler(n_parallel=n_parallel) as scheduler:\n for i in range(n_steps):\n samples = self.optimiser.run_ste...
[ "0.58023125", "0.5677729", "0.55972874", "0.55697495", "0.5547481", "0.5508865", "0.54776615", "0.5470444", "0.5464197", "0.53902745", "0.53773487", "0.53718054", "0.53490144", "0.53486687", "0.5348121", "0.5320192", "0.5305906", "0.52872264", "0.5229914", "0.52269125", "0.52...
0.54965633
6
Test the popxl simple addition example
def test_documentation_popxl_addition(self): filename = "simple_addition.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_numbers(self):\n self.assertEqual(add(3, 8), 11)", "def test_add_numbers(self):\n self.assertEqual(add(3, 8), 11)", "def test_add_numbers(self):\n self.assertEqual(add(3, 8), 11)", "def test_and_numbers(self):\n self.assertEqual(add(3,8), 11)", "def test_add_two_num...
[ "0.65502137", "0.65502137", "0.65502137", "0.64431727", "0.63226366", "0.6308587", "0.628632", "0.6280519", "0.6253776", "0.6226606", "0.62078625", "0.61861867", "0.61754084", "0.6170412", "0.61692727", "0.615465", "0.6137472", "0.61353207", "0.6135082", "0.6111764", "0.60554...
0.70790774
0
Test the popxl simple addition example
def test_documentation_popxl_addition_variable(self): filename = "tensor_addition.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_addition(self):\n filename = \"simple_addition.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_add_numbers(self):\n self.assertEqual(add(3, 8), 11)", "def test_add_numbers(self):\n self.assertEqual(add(3, 8), 1...
[ "0.70790774", "0.65502137", "0.65502137", "0.65502137", "0.64431727", "0.63226366", "0.6308587", "0.628632", "0.6280519", "0.6253776", "0.6226606", "0.62078625", "0.61861867", "0.61754084", "0.6170412", "0.61692727", "0.615465", "0.6137472", "0.61353207", "0.6135082", "0.6111...
0.5998734
25
Test the popxl basic subgraph example
def test_documentation_popxl_basic_subgraph(self): filename = "basic_graph.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_create_multi_subgraph(self):\n filename = \"create_multi_graphs_from_same_func.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def sub_graph_merging(self):", "def show_subgraph(dfs_codes, nsupport, mapper):\n\tglobal __subgraph_count...
[ "0.75176567", "0.62960446", "0.60611916", "0.6042744", "0.6038377", "0.5965643", "0.5938931", "0.58985436", "0.587293", "0.5843227", "0.58157665", "0.5796282", "0.5735608", "0.5665891", "0.5604234", "0.5579183", "0.5560783", "0.5559308", "0.5536412", "0.5530756", "0.5525885",...
0.8505168
0
Test the popxl replication example
def test_documentation_popxl_replication(self): filename = "replication.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_mnist_replication_train(self):\n filename = \"mnist_rts.py --replication-factor 2\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_replicate_pg_to_pg(self):\n # TODO - Real and more complex e2e tests will be added here\n ...
[ "0.6849515", "0.5858241", "0.567002", "0.5621691", "0.5603418", "0.5590965", "0.55826133", "0.55337054", "0.55278075", "0.5499861", "0.5477127", "0.539578", "0.53619903", "0.5334775", "0.5324242", "0.53177917", "0.53116417", "0.53056175", "0.52885664", "0.5232968", "0.5212479...
0.8200137
0
Test the popxl create multiple subgraph example
def test_documentation_popxl_create_multi_subgraph(self): filename = "create_multi_graphs_from_same_func.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_basic_subgraph(self):\n filename = \"basic_graph.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def sub_graph_merging(self):", "def populate_graph(self):", "def test_documentation_popxl_repeat_2(self):\n filename = \"repeat...
[ "0.79100144", "0.65580076", "0.64052117", "0.63540345", "0.6348667", "0.61608034", "0.6133355", "0.5854858", "0.5819954", "0.5817296", "0.5729944", "0.57231635", "0.5651493", "0.5646747", "0.5616531", "0.5610424", "0.56057763", "0.5573422", "0.55470526", "0.5529936", "0.55223...
0.8254092
0
Test the popxl create multiple callsites for a subgraph input example
def test_documentation_popxl_multi_callsites_graph_input(self): filename = "multi_call_graph_input.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_create_multi_subgraph(self):\n filename = \"create_multi_graphs_from_same_func.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_documentation_popxl_basic_subgraph(self):\n filename = \"basic_graph.py\"\n self.run_...
[ "0.81625026", "0.75757235", "0.63863367", "0.63754267", "0.61888385", "0.5910345", "0.5906325", "0.568147", "0.56611234", "0.5634181", "0.5622761", "0.5596353", "0.5533244", "0.5507174", "0.54756355", "0.5458438", "0.5447056", "0.53142405", "0.5302135", "0.5267153", "0.525309...
0.69611263
2
Test the code loading example
def test_documentation_popxl_code_loading(self): filename = "code_loading.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_example(decorated_example):\n import visual_coding_2p_analysis", "def test_examples():\n import airconics\n # pytest runs test files in ./__pycache__: need to go up two levels\n example_dir = os.path.abspath(\n os.path.join(__file__, '..', '..', 'examples', 'core'))\n example_scrip...
[ "0.7195194", "0.7059802", "0.6890149", "0.6869557", "0.6869557", "0.6869557", "0.6869557", "0.67875314", "0.6767249", "0.6749942", "0.67483723", "0.67235684", "0.6716485", "0.6689319", "0.66765344", "0.66539055", "0.66304076", "0.6627514", "0.65707266", "0.6563701", "0.654868...
0.74833703
0
Test the nested code loading example
def test_documentation_popxl_nested_code_loading(self): filename = "code_loading_nested.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_example(decorated_example):\n import visual_coding_2p_analysis", "def inner_test():\n pass", "def inner_test():\n pass", "def test_documentation_popxl_code_loading(self):\n filename = \"code_loading.py\"\n self.run_python(filename, file_dir=working_dir, working...
[ "0.6656562", "0.6570933", "0.6570933", "0.6489614", "0.6259519", "0.6246904", "0.61843383", "0.61584216", "0.61110884", "0.61107814", "0.6097114", "0.6087612", "0.60835487", "0.60752654", "0.60712975", "0.6059714", "0.60356414", "0.60127175", "0.60122466", "0.601197", "0.5992...
0.83801514
0
Test the nested Session contexts example
def test_documentation_popxl_nested_session_contexts(self): filename = "nested_session_contexts.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_set_session():", "def test_resource(data_manager):\n sessions = set([])\n with data_manager.dal():\n context1 = current_context._get_current_object()\n session = context1.sqlalchemy\n assert isinstance(session, orm.Session)\n sessions.add(session)\n\n with data_m...
[ "0.67018175", "0.6668321", "0.6427891", "0.63258743", "0.62819177", "0.6264992", "0.6244206", "0.6197762", "0.6128129", "0.60963386", "0.59784377", "0.59195083", "0.5882602", "0.58783644", "0.5873574", "0.58591706", "0.5849194", "0.584282", "0.5837098", "0.58088905", "0.58034...
0.8149533
0
Test the popxl call_with_info example
def test_documentation_popxl_call_with_info(self): filename = "call_with_info.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hxlinfo():\n run_script(hxlinfo_main)", "def test_get_info(self):\n pass", "def test_application_info(self, mocked_serial, mocked_check):\n from supvisors.rpcinterface import RPCInterface\n # create RPC instance\n rpc = RPCInterface(self.supervisor)\n # test RPC call\n...
[ "0.6383911", "0.5714342", "0.55663514", "0.5375583", "0.532167", "0.52700174", "0.5258182", "0.5240253", "0.51907164", "0.5187251", "0.51472026", "0.50939924", "0.5084021", "0.50806963", "0.507654", "0.5028689", "0.50142485", "0.49954024", "0.4964053", "0.49308", "0.49162632"...
0.82054126
0
Test the popxl basic repeat example
def test_documentation_popxl_repeat_0(self): filename = "repeat_graph_0.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_repeat_1(self):\n filename = \"repeat_graph_1.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_documentation_popxl_repeat_2(self):\n filename = \"repeat_graph_2.py\"\n self.run_python(filename, file_dir=working_di...
[ "0.6505946", "0.6401242", "0.58164656", "0.54440105", "0.53839743", "0.5373807", "0.53707576", "0.53479195", "0.5337674", "0.5326383", "0.5316677", "0.53121865", "0.53121865", "0.5300285", "0.5297226", "0.52901715", "0.5276409", "0.5268856", "0.5196304", "0.5196304", "0.51730...
0.6540377
0
Test the popxl subgraph in parent in repeat example
def test_documentation_popxl_repeat_1(self): filename = "repeat_graph_1.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_basic_subgraph(self):\n filename = \"basic_graph.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_documentation_popxl_create_multi_subgraph(self):\n filename = \"create_multi_graphs_from_same_func.py\"\n self.run_...
[ "0.7205235", "0.70020497", "0.62084246", "0.6038614", "0.5988837", "0.58964515", "0.58667445", "0.58020157", "0.5726468", "0.5667711", "0.5539633", "0.5539633", "0.5504206", "0.54905653", "0.5482558", "0.5460695", "0.54255486", "0.5419617", "0.5398533", "0.5355489", "0.532643...
0.6087695
3
Test the popxl subgraph in parent in repeat example
def test_documentation_popxl_repeat_2(self): filename = "repeat_graph_2.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_basic_subgraph(self):\n filename = \"basic_graph.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_documentation_popxl_create_multi_subgraph(self):\n filename = \"create_multi_graphs_from_same_func.py\"\n self.run_...
[ "0.7205235", "0.70020497", "0.62084246", "0.6087695", "0.5988837", "0.58964515", "0.58667445", "0.58020157", "0.5726468", "0.5667711", "0.5539633", "0.5539633", "0.5504206", "0.54905653", "0.5482558", "0.5460695", "0.54255486", "0.5419617", "0.5398533", "0.5355489", "0.532643...
0.6038614
4
Test the popxl getting / setting tensor data example
def test_documentation_popxl_get_set_tensors(self): filename = "tensor_get_write.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_addition_variable(self):\n filename = \"tensor_addition.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_predictor():", "def test_loadData():\n \n sys = LVsystem.Ecosystem()\n \n sys.loadSetup('2Prey1Predator')\n ...
[ "0.6889487", "0.65411484", "0.62041", "0.61115885", "0.60792667", "0.60625935", "0.5973008", "0.5798675", "0.579797", "0.57839084", "0.5775764", "0.5711267", "0.57093495", "0.5704983", "0.5672286", "0.5643146", "0.5622259", "0.5604334", "0.5597279", "0.5581926", "0.558076", ...
0.7280651
0
Test the popxl advanced getting / writing tensor data example that shows exactly when devicehost transfers occur
def test_documentation_popxl_adv_get_write(self): filename = "tensor_get_write_adv.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_get_set_tensors(self):\n filename = \"tensor_get_write.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_remote_buffer() -> None:\n # Prepare the input and output data\n shape_1 = (1, 3, 5)\n shape_2 = (7, 11)\n d_ty...
[ "0.66837543", "0.66518664", "0.6184355", "0.6113137", "0.58957744", "0.5887892", "0.58565533", "0.5855714", "0.5791288", "0.5715855", "0.56533664", "0.5649407", "0.5645982", "0.5569726", "0.5525689", "0.5520632", "0.5512734", "0.5490553", "0.5452423", "0.54212606", "0.5381102...
0.65643054
2
Test the popxl autodiff op
def test_documentation_popxl_autodiff(self): filename = "autodiff.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_data_norange(self):\n ex = self.ex\n m = self.m\n n = self.n\n\n nreps = random.randint(1, 10)\n lensumrange = random.randint(1, 10)\n\n ex.nreps = nreps\n ex.sumrange = [\"j\", range(lensumrange)]\n ex.vary[\"X\"][\"with\"].add(\"rep\")\n ex....
[ "0.49731633", "0.49007177", "0.4868027", "0.48571473", "0.48517647", "0.48516244", "0.4770387", "0.47574338", "0.474696", "0.4732291", "0.47281486", "0.47268423", "0.47249767", "0.47073162", "0.46844417", "0.46804345", "0.46610695", "0.4651014", "0.4639932", "0.46340024", "0....
0.6394983
0
Test the popxl in sequence context manager
def test_documentation_popxl_in_sequence(self): filename = "in_sequence.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_pop_methods(self):\n\n batch = Batch(Mock())\n\n # mock BatchRequests\n mock_obj = Mock()\n mock_ref = Mock()\n batch._objects_batch = mock_obj\n batch._reference_batch = mock_ref\n\n mock_obj.pop.assert_not_called()\n mock_ref.pop.assert_not_called(...
[ "0.58948493", "0.5882581", "0.5770228", "0.54232585", "0.54092556", "0.54075843", "0.5373329", "0.5303253", "0.53030944", "0.5287886", "0.52534574", "0.5221736", "0.52018183", "0.5189823", "0.5175281", "0.5172834", "0.5172073", "0.51521003", "0.51421815", "0.5127545", "0.5124...
0.65936136
0
Test the popxl remote variable
def test_documentation_popxl_remote_var(self): filename = "remote_variable.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_remote_rts_var(self):\n filename = \"remote_rts_var.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_documentation_popxl_rts_var(self):\n filename = \"rts_var.py\"\n self.run_python(filename, file_dir=working_dir,...
[ "0.62325144", "0.53577113", "0.53224456", "0.5209967", "0.51961607", "0.5094487", "0.50844604", "0.5058393", "0.5020116", "0.49631917", "0.49456343", "0.49408296", "0.4912187", "0.48899758", "0.48812777", "0.48232034", "0.47519946", "0.46955076", "0.46878415", "0.46760944", "...
0.70022154
0
Test the popxl remote rts variable
def test_documentation_popxl_remote_rts_var(self): filename = "remote_rts_var.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_documentation_popxl_remote_var(self):\n filename = \"remote_variable.py\"\n self.run_python(filename, file_dir=working_dir, working_dir=working_dir)", "def test_documentation_popxl_rts_var(self):\n filename = \"rts_var.py\"\n self.run_python(filename, file_dir=working_dir, wo...
[ "0.6584408", "0.6459491", "0.5550423", "0.54029787", "0.53768945", "0.5342253", "0.528288", "0.52809453", "0.5237307", "0.51818335", "0.5181425", "0.50585806", "0.5056922", "0.50432426", "0.503633", "0.50314456", "0.50298536", "0.50265086", "0.5013454", "0.500096", "0.4989955...
0.6953812
0
Test the popxl rts variable
def test_documentation_popxl_rts_var(self): filename = "rts_var.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self):\n # 0x13 is nop\n self.gdb.command(\"p *((int*) 0x%x)=0x13\" % self.target.ram)\n self.gdb.command(\"p *((int*) 0x%x)=0x13\" % (self.target.ram + 4))\n self.gdb.command(\"p *((int*) 0x%x)=0x13\" % (self.target.ram + 8))\n self.gdb.p(\"$pc=0x%x\" % self.target.ram)...
[ "0.5512495", "0.54203445", "0.5234334", "0.5186235", "0.513492", "0.5132137", "0.5124492", "0.5119325", "0.5085518", "0.50540435", "0.50286376", "0.5028228", "0.50170285", "0.50151104", "0.50103855", "0.4989811", "0.49670818", "0.49645856", "0.49455714", "0.493474", "0.493474...
0.6135992
0
Test the popxl basic mnist example
def test_documentation_popxl_mnist(self): filename = "mnist.py" self.run_python(filename, file_dir=working_dir, working_dir=working_dir)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n os.system(\"rm -rf images; mkdir images\")\n\n if (len(sys.argv) > 1):\n N = int(sys.argv[1])\n else:\n N = 10\n\n x_test = np.load(\"../../../../data/mnist/mnist_test_images.npy\")\n\n for i in range(N):\n r,c = random.randint(6,12), random.randint(6,12)\n ...
[ "0.7192644", "0.7088527", "0.6992389", "0.6823488", "0.6820499", "0.65735173", "0.6531278", "0.6529289", "0.6502993", "0.63889843", "0.6371827", "0.6368664", "0.63274115", "0.6315902", "0.62861085", "0.62725544", "0.6220246", "0.6188648", "0.6144985", "0.61362416", "0.6119027...
0.6742171
5