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
Post a stop transaction
def on_post(self, req, resp): USER_IDTAG = req.media.get('idTag') METERVALUE_STOP = req.media.get('meterValue') VICINITY_OID = req.media.get('vicinityOid') CONTRACT_ADDRESS = 'address' print("Stopping TX for idTag {} with meter value {}".format(USER_IDTAG, METERVALUE_STOP)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exit_transaction():\n _state.transactions = max(get_transactions() - 1, 0)", "def endTransaction(self, transactionID: int) -> None:\n ...", "def abort_transaction(self) -> None:\n pass", "def stop(self):\n self.auto_commit_interval = None", "def tpc_abort(self, transaction):\n ...
[ "0.6699632", "0.66263175", "0.6615936", "0.65986675", "0.6569888", "0.65262157", "0.649279", "0.63895684", "0.63655126", "0.63429636", "0.63281006", "0.6308372", "0.6287366", "0.624233", "0.6233434", "0.62268543", "0.621473", "0.621473", "0.61691254", "0.61691254", "0.6169125...
0.0
-1
To load the descriptor settings from the config file,only HOG is supported
def load_descriptor(settings): return { 'hog': descriptors.HogDescriptor.from_config_file(settings['hog']), }.get(settings['train']['descriptor'], 'hog') # Default to HOG for invalid input
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_config(self):\n pass", "def config():", "def config():", "def read_config(self, config_filename):", "def loadConfig(self):\r\n self.config.read(self.CONFIG_FILE)\r\n try:\r\n assert \"Settings\" in self.config\r\n except AssertionError:\r\n print(\...
[ "0.64163566", "0.60806596", "0.60806596", "0.5885641", "0.58768445", "0.58304346", "0.58304346", "0.582294", "0.57977813", "0.5787138", "0.5759142", "0.57564086", "0.57534146", "0.5717577", "0.5700591", "0.56643593", "0.56641626", "0.563442", "0.56303775", "0.5625049", "0.562...
0.7915412
0
Generator which yields all files in the given directories with any of the EXTENSIONS.
def get_files(dirs): for dir in dirs: for root, _, files in os.walk(dir): for file in files: path = Path(os.path.join(root, file)) if path.suffix in EXTENSIONS: yield path
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files_in_dir(dir, ext):\n import os\n\n for root, dirs, files in os.walk(dir):\n for file in files:\n if file.split('.')[1].lower() == ext.lower() or not ext:\n file_full_path = os.path.join(root, file)\n yield file_full_path", "def search_images(\n ...
[ "0.7361726", "0.7168468", "0.70106226", "0.6978779", "0.69671875", "0.6956483", "0.69562167", "0.69542754", "0.6939163", "0.68995976", "0.68970984", "0.683653", "0.68256193", "0.6820684", "0.67836255", "0.67363906", "0.67210203", "0.6719789", "0.6704543", "0.67027146", "0.669...
0.8138541
0
assumed called after can_place_piece
def place_piece(cfg, b, m, n, piece): for mm, nn in threats_gen_for[piece](cfg, m, n): mark_if_empty(cfg, b, mm, nn, ':') b[board_idx(cfg, m, n)] = piece cfg[piece] = cfg[piece] - 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_comp_place_piece():\n board = Board(640, 640, 8)\n black_piece = GamePiece(0, 0, BLACK, 0)\n white_piece = GamePiece(0, 0, WHITE, 0)\n board.start_game()\n\n board.game_pieces[3][3] = None\n board.game_pieces[3][4] = None\n board.game_pieces[4][3] = None\n board.game_pieces[4][4] =...
[ "0.72498935", "0.7119869", "0.7078613", "0.69797564", "0.66100985", "0.6450406", "0.63937426", "0.63600475", "0.6337117", "0.6296665", "0.627747", "0.6170568", "0.6148269", "0.6143879", "0.61077535", "0.6037338", "0.6025112", "0.6015202", "0.6011923", "0.60070294", "0.5972882...
0.6223171
11
Set the hash preprocessors of the state and the action, in order to make them hashable.
def _initialize_hash(self): # action if isinstance(self.env.action_space, gym.spaces.Discrete): self._hash_action = lambda x: x elif isinstance(self.env.action_space, gym.spaces.Box): if self.__class__.__name__ == "MCTS": raise Exception("Cannot run vanil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_hash_state(self) -> None:\n self.hash_states = [hashlib.sha1()]", "def __setstate__(self, state):\n self.__dict__ = dict(state)\n self._init_compiled()", "def hash_functions(self):\n pass", "def _state_actions(self) -> dict:\n return {}", "def state_encod_arch2(s...
[ "0.57571864", "0.5435478", "0.54035085", "0.52372074", "0.518619", "0.5141052", "0.5130122", "0.50220853", "0.5004999", "0.49558762", "0.4926324", "0.49014458", "0.48990655", "0.48768932", "0.48673987", "0.48605478", "0.48585635", "0.4834343", "0.48277575", "0.48239538", "0.4...
0.5770757
0
Return the decision node of drawn by the select outcome function. If it's a new node, it gets appended to the random node. Else returns the decsion node already stored in the random node.
def update_decision_node(self, decision_node, random_node, hash_preprocess): if hash_preprocess(decision_node.state) not in random_node.children.keys(): decision_node.father = random_node random_node.add_children(decision_node, hash_preprocess) else: decision_node = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_outcome(self, env, random_node):\n new_state_index, r, done, _ = env.step(random_node.action)\n return DecisionNode(state=new_state_index, father=random_node, is_final=done), r", "def choose_node(self, choices, scores):\n total = sum(scores)\n cumdist = list(itertools.accum...
[ "0.710089", "0.6310771", "0.62979186", "0.61296755", "0.60056055", "0.566461", "0.56139195", "0.5580124", "0.55776966", "0.5576547", "0.55047697", "0.54978997", "0.54622674", "0.5436584", "0.54286194", "0.5427209", "0.5420681", "0.54089963", "0.5405846", "0.5405593", "0.53766...
0.5864453
5
Explores the current tree with the UCB principle until we reach an unvisited node where the reward is obtained with random rollouts.
def grow_tree(self): decision_node = self.root internal_env = copy.copy(self.env) while (not decision_node.is_final) and decision_node.visits > 1: a = self.select(decision_node) new_random_node = decision_node.next_random_node(a, self._hash_action) (new_d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UCT(rootstate, itermax, verbose=False):\n\n rootnode = Node(state=rootstate)\n\n for i in range(itermax):\n node = rootnode\n state = rootstate.Clone()\n\n # Select\n while node.untriedMoves == [] and node.childNodes != []: # node is fully expanded and non-terminal\n ...
[ "0.6164046", "0.61358875", "0.6106919", "0.6031748", "0.60115874", "0.595056", "0.59471905", "0.59269196", "0.58961433", "0.58696514", "0.58533907", "0.58485657", "0.5842488", "0.5821475", "0.5783845", "0.5782573", "0.57748175", "0.5721878", "0.57213783", "0.5706393", "0.5656...
0.6590161
0
Evaluates a DecionNode playing until an terminal node using the rollotPolicy
def evaluate(self, env): max_iter = 100 R = 0 done = False iter = 0 while ((not done) and (iter < max_iter)): iter += 1 a = env.action_space.sample() s, r, done, _ = env.step(a) R += r return R
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def q_learning_episode(self, policy):\n state = self.env.reset(self.agent_start_pos)\n done = False\n\n while not done:\n action = policy(state, self.q_values)\n next_cell = self.env.move(self.env.agent_position, action)\n s_next, rew, done, _ = self.env.step(n...
[ "0.55386966", "0.5254755", "0.52383435", "0.52076405", "0.5176333", "0.51604325", "0.5145268", "0.5110981", "0.5029525", "0.5023521", "0.5023521", "0.50121635", "0.5000631", "0.4986676", "0.4981898", "0.49673364", "0.49540222", "0.49504992", "0.49406677", "0.49151736", "0.491...
0.0
-1
Given a RandomNode returns a DecisionNode
def select_outcome(self, env, random_node): new_state_index, r, done, _ = env.step(random_node.action) return DecisionNode(state=new_state_index, father=random_node, is_final=done), r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_node(self):\n if random.randint(0, 100) > self.goal_sample_rate:\n random_node = self.Node(\n random.uniform(self.min_rand, self.max_rand),\n random.uniform(self.min_rand, self.max_rand),\n )\n else: # goal point sampling\n ...
[ "0.6875797", "0.6506942", "0.636228", "0.632881", "0.6185813", "0.6153899", "0.6089393", "0.6014047", "0.5892125", "0.5744766", "0.5736307", "0.56658673", "0.56345004", "0.562233", "0.5617714", "0.56049466", "0.5597951", "0.5591621", "0.5579573", "0.5573688", "0.557171", "0...
0.7110679
0
Selects the action to play from the current decision node
def select(self, x): if x.visits <= 2: x.children = {a: RandomNode(a, father=x) for a in range(self.env.action_space.n)} def scoring(k): if x.children[k].visits > 0: return x.children[k].cumulative_reward/x.children[k].visits + \ self.K*np.sqr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ChooseAction(self):\n self.lastAction = None\n self.lastState = None\n if(self.attention is None or self.attention == \"\"): return\n # find best action for the currently attended node\n actions = list(self.vi.Q[self.states.index(self.attention)])\n actionIndex = actions.i...
[ "0.74682564", "0.7420793", "0.7184482", "0.7134516", "0.7029573", "0.69586843", "0.6921828", "0.691864", "0.6875106", "0.6863868", "0.68618166", "0.6847336", "0.6800394", "0.6723351", "0.67138106", "0.6693452", "0.6592016", "0.65595233", "0.6557133", "0.6526618", "0.65131426"...
0.0
-1
At the end of the simulations returns the most visited action
def best_action(self): number_of_visits_children = [node.visits for node in self.root.children.values()] index_best_action = np.argmax(number_of_visits_children) a = list(self.root.children.values())[index_best_action].action return a
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_action(self) -> int:\n # simulation loop\n for i in range(self.iterations):\n self.__simulate(self.root, self.iterations)\n\n # action choice\n max_q = 0\n best_action = 0\n for action in actions:\n new_node = self.root.children[action]\n ...
[ "0.70127183", "0.687149", "0.6863603", "0.67862076", "0.6771671", "0.6724781", "0.670188", "0.66465", "0.66390723", "0.66019285", "0.6597186", "0.6585305", "0.6570425", "0.6556634", "0.65416694", "0.65311867", "0.6512796", "0.6509938", "0.6498248", "0.64976394", "0.6495535", ...
0.7107038
0
Expand the tree and return the bet action
def learn(self, Nsim, progress_bar=False): if progress_bar: iterations = tqdm(range(Nsim)) else: iterations = range(Nsim) for _ in iterations: self.grow_tree()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expand(node):\n if not node.is_leaf():\n return\n\n # build children\n is_done = []\n for action in constants.Action:\n child_node = node.copy()\n agents_obs = node.game_env.get_observations()\n\n # Combine current observation with the agent's memory of the game\n ...
[ "0.71309716", "0.6870978", "0.6248184", "0.6238105", "0.61890656", "0.61695313", "0.61247694", "0.6108605", "0.60646635", "0.60078114", "0.59485406", "0.58924407", "0.5844102", "0.5844102", "0.5844102", "0.5844102", "0.58059675", "0.5793563", "0.5791642", "0.5724908", "0.5716...
0.0
-1
If the env is determonostic we can salvage most of the tree structure. Advances the tree in the action taken if found in the tree nodes.
def forward(self, action, new_state): if self._hash_action(action) in self.root.children.keys(): rnd_node = self.root.children[self._hash_action(action)] if len(rnd_node.children) > 1: self.root = DecisionNode(state=new_state, is_root=True) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean():\n new_tree = None", "def reset_tree(self):\n self.root = None\n self.action = None\n self.dist_probability = None", "def tree_removeDeadBranches():\n nonlocal d_tree\n d_tree = { k : v for k, v in d_tree.items() if v}\n # By creating a new b...
[ "0.66061085", "0.6231232", "0.6116748", "0.60997236", "0.60270435", "0.5866573", "0.5859067", "0.58203506", "0.57578725", "0.56961167", "0.56451476", "0.55916977", "0.5587942", "0.5561475", "0.55515796", "0.5533417", "0.5515334", "0.5514626", "0.5477468", "0.54768384", "0.547...
0.54636896
21
Collects the data and parameters to save.
def _collect_data(self): data = { "K": self.K, "root": self.root } return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveData(self):\n pass", "def save_data(self):\n pass", "def make_save(self):\n\t\tsave = {}\n\t\tsave['p'] = self.p\n\t\tsave['injail'] = self.injail.copy()\n\t\tsave['tile'] = self.tile.copy()\n\t\tsave['bal'] = self.bal.copy()\n\t\tsave['goojf'] = self.goojf.copy()\n\t\tsave['isalive'] = s...
[ "0.79443794", "0.7918926", "0.72642434", "0.6999899", "0.6981673", "0.69450337", "0.69021773", "0.6835701", "0.6794337", "0.67396384", "0.6688276", "0.66301215", "0.6612951", "0.65625846", "0.65606374", "0.653039", "0.652962", "0.6527134", "0.6516258", "0.64973986", "0.649706...
0.0
-1
Saves the tree structure as a pkl.
def save(self, path=None): data = self._collect_data() name = np.random.choice(['a', 'b', 'c', 'd', 'e', 'f']+list(map(str, range(0, 10))), size=8) if path is None: path = './logs/'+"".join(name)+'_' with open(path, "wb") as f: cloudpickle.dump(data, f) p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, path):\n with open(path, 'wb') as f:\n pkl.dump(self, f)", "def _save_tree(tree, tree_path):\n try:\n with open(tree_path, 'wb') as f:\n pickle.dump(tree, f)\n except Exception as e:\n logger.warning('Could not save tree to {}: {...
[ "0.6902854", "0.6814618", "0.6799568", "0.67856103", "0.6687682", "0.6494133", "0.6403352", "0.6380208", "0.62340564", "0.62287766", "0.61716175", "0.614781", "0.6124842", "0.60752356", "0.6000558", "0.5963424", "0.5955345", "0.5908942", "0.5908559", "0.5869761", "0.5800398",...
0.0
-1
Return the best action accoring to the maximum visits principle.
def act(self): action = self.best_action() return action
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_action(self):\n\n number_of_visits_children = [node.visits for node in self.root.children.values()]\n index_best_action = np.argmax(number_of_visits_children)\n\n a = list(self.root.children.values())[index_best_action].action\n return a", "def _best_action(self, state):\n ...
[ "0.7849317", "0.7557292", "0.7380547", "0.72836643", "0.7183584", "0.7147923", "0.71446735", "0.7056981", "0.7048105", "0.69948894", "0.6994605", "0.69541126", "0.69461155", "0.6939793", "0.69361454", "0.69264233", "0.69251484", "0.6905916", "0.6904357", "0.6896602", "0.68432...
0.69599766
11
Builds a DAG of Steps from a SQL expression so that it's easier to execute in an engine.
def from_expression( cls, expression: exp.Expression, ctes: t.Optional[t.Dict[str, Step]] = None ) -> Step: ctes = ctes or {} expression = expression.unnest() with_ = expression.args.get("with") # CTEs break the mold of scope and introduce themselves to all in the context. ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plan_step_to_expr(atom: clingo.Symbol) -> str:\n # The predicate and its arguments are double-quoted. Simply extract them\n matches = re.findall(r'\\\"(.+?)\\\"', str(atom))\n predicate = matches[0]\n args = f'({\",\".join(matches[1:])})' if matches[1:] else ''\n return predicate + args", "def...
[ "0.5711968", "0.5664347", "0.538123", "0.52660775", "0.52169806", "0.51955956", "0.51791394", "0.5158939", "0.51581794", "0.51150316", "0.51042306", "0.5073506", "0.50646734", "0.505281", "0.5020296", "0.49805304", "0.49764872", "0.4972279", "0.49443945", "0.49404278", "0.493...
0.6603545
0
This is used for debugging and will not return the tree in a pretty way, only the info about this node will be returned
def __repr__(self): return (f'Heuristic: {self.heuristic}\n'\ f'Ancestors: {self.ancestors}\n'\ f'Result: {self.result}\n'\ f'Attributes: {self.attributes}\n'\ f'Split Attribute: {self.split_attr}\n'\ f'Has children: {self.val0 != N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tree(self):\n return \"\"", "def print_tree(self):\n\t\tprint(self.__print_tree('', True, ''))", "def __repr__(self):\n return show_tree(self, lambda node: node.name,\n lambda node: node.children)", "def print_tree(self):\n print(_Node.__print_tree(self)...
[ "0.8037728", "0.79554933", "0.76366156", "0.75786775", "0.7553154", "0.7531516", "0.7483125", "0.74414235", "0.73703814", "0.7342984", "0.7342984", "0.7313995", "0.7260545", "0.7253631", "0.72212666", "0.71999764", "0.7148193", "0.7119914", "0.71159977", "0.7104752", "0.70868...
0.0
-1
This will continue splitting the tree until every leaf node is pure and the training data is perfectly characterized by the decision tree
def train(self): max_tuple = self.max_gain() # If that gain is 0 then every node should be a pure leaf (hopefully) and you can stop while max_tuple.gain != 0: max_tuple.node.split(max_tuple.attribute) max_tuple = self.max_gain()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decision_tree(original_training_data,call_depth):\n\n ''' Checking the stopping criterion. If yes then it returns the majority class (Muffin or CupCake) '''\n if check_if_stopping_criterion_is_met(original_training_data.values) or call_depth > 10:\n majority = classification(original_training_data...
[ "0.736419", "0.6879376", "0.68064624", "0.66134644", "0.65553546", "0.6515525", "0.6498684", "0.6492946", "0.6436828", "0.6393142", "0.6376377", "0.6344093", "0.63422775", "0.62961286", "0.62934136", "0.62801987", "0.62608254", "0.6223276", "0.61976653", "0.6194716", "0.61382...
0.7007727
1
If the node has children it will return the (node, attribute, gain) tuple of the child with the highest gain If the node does not have children and is not pure it will return the (node, attribute, gain) tuple with itself as the node and the highest heuristic score of splitting on any of its attributes as the gain If th...
def max_gain(self): if self.val1: val1_gain_tuple, val0_gain_tuple = self.val1.max_gain(), self.val0.max_gain() if val1_gain_tuple.gain > val0_gain_tuple.gain: return val1_gain_tuple else: return val0_gain_tuple elif self.attributes: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_child(self, node):\n ucb_values = []\n for action, child in node.children.items():\n if node.state.player_turn == 1:\n if child.n_visits == 0:\n ucb_max = float('inf')\n else:\n ucb_max = self.calculate_ucb_max...
[ "0.64669144", "0.63168865", "0.6179859", "0.6137272", "0.6127355", "0.6071936", "0.6051509", "0.6038578", "0.60306424", "0.5946005", "0.59143674", "0.5897368", "0.5833015", "0.5821131", "0.5816206", "0.58110994", "0.5801434", "0.57993925", "0.57883", "0.5769697", "0.57651377"...
0.6359626
1
This splits a node on the attribute "attribute"
def split(self, attribute): if attribute not in self.attributes: raise KeyError('Attribute not present in node') self.split_attr = attribute # list() is used to make a copy of the list instead of pointing to the same list child_attributes = list(self.attribu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitAttribute(self, atr, divider=0.5):\n big, lit = DecisionTree(None, self.atr), DecisionTree(None, self.atr)\n for d in self:\n if d[atr] > divider: big.append(d)\n else: lit.append(d)\n return lit, big", "def split_by_attribute(dbsession, group, attr):\n valu...
[ "0.5715175", "0.5710266", "0.5545711", "0.55031914", "0.55031914", "0.5446711", "0.5446711", "0.54354566", "0.5370533", "0.53344154", "0.5330768", "0.5245361", "0.52420187", "0.5240586", "0.5158735", "0.5151447", "0.5148021", "0.5079045", "0.50706065", "0.50669575", "0.506043...
0.77221286
0
If the sample is pure, returns class, else returns None
def purity_test(self): mean = filter_data(self.data,self.ancestors)['Class'].mean() if mean == 0: return 0 elif mean == 1: return 1 return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_returns_class(self):\n assert type is simple_class().__class__", "def sample(self):\r\n raise NotImplementedError", "def sample(self, sample_id: str):\n\n class LimsSample:\n \"\"\" A mock class for a sample coming from LIMS. It only needs a comment \"\"\"\n\n de...
[ "0.66925657", "0.61924195", "0.6062284", "0.6007603", "0.5844515", "0.58352", "0.5829622", "0.5829622", "0.580038", "0.57619864", "0.57172626", "0.5700162", "0.56975627", "0.5693888", "0.56934226", "0.56467", "0.5638737", "0.563829", "0.55490357", "0.5489884", "0.54813504", ...
0.5173868
37
This will return the information gain that you get from splitting a node with that has the data "data" on the attribute "attribute"
def entropy_gain(node,attribute): data_subset1 = filter_data(node.data,node.ancestors) data_counts = list(Counter(data_subset1['Class']).values()) base_entropy = entropy(data_counts,base=2) num_values = len(data_subset1) entropy_sum = 0 for value in [0,1]: data_subset2 = filter_data...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSplitAttr(self, data, attributes):\n splitAttrIndex = 0\n lengthAttr = len(attributes)\n del self.infoGain[:]\n index = 0\n while index < lengthAttr:\n self.infoGain.append(self.getInfoGain(data, index))\n index += 1\n\n for gain in self.infoGa...
[ "0.6657157", "0.63218254", "0.61898667", "0.6106076", "0.60014737", "0.5843759", "0.56900775", "0.5589873", "0.55893284", "0.5522103", "0.54951817", "0.54832", "0.54067916", "0.5388961", "0.53631663", "0.53464425", "0.53424656", "0.53007346", "0.5284335", "0.527781", "0.52702...
0.5414344
12
This will return the information gain that you get from splitting a node with that has the data "data" on the attribute "attribute"
def impurity_gain(node, attribute): data_subset1 = filter_data(node.data,node.ancestors) data_counts = list(Counter(data_subset1['Class']).values()) base_impurity = impurity(data_counts) num_values = len(data_subset1) impurity_sum = 0 for value in [0,1]: data_subset2 = filter_data(n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSplitAttr(self, data, attributes):\n splitAttrIndex = 0\n lengthAttr = len(attributes)\n del self.infoGain[:]\n index = 0\n while index < lengthAttr:\n self.infoGain.append(self.getInfoGain(data, index))\n index += 1\n\n for gain in self.infoGa...
[ "0.66578203", "0.6325501", "0.6186457", "0.6108713", "0.6002287", "0.5846265", "0.5691551", "0.559086", "0.5583705", "0.5522734", "0.54993653", "0.54846495", "0.5415968", "0.5407902", "0.53898907", "0.5364955", "0.5345286", "0.5343627", "0.5299366", "0.52865124", "0.5280009",...
0.51550907
28
This filters the training data according to the ancestors of this node so that only a subset of the training data is considered for calculations like entropy
def filter_data(data,filters): final_filter = pd.Series(np.array([True] * data.shape[0])) for attribute, value in filters: final_filter &= data[attribute] == value return data[final_filter]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_nodes(self, node_filter, parent=None):\n if self.data is None:\n return None\n\n if parent is None:\n return self.data.xpath(node_filter)\n else:\n return parent.xpath(node_filter)", "def __filterEdges(self):", "def get_filtered_pedigree_with_sam...
[ "0.5749394", "0.57379466", "0.56971365", "0.5644228", "0.56307316", "0.5488976", "0.5440608", "0.542651", "0.5393545", "0.5392112", "0.5351504", "0.5328558", "0.5202672", "0.520047", "0.51837265", "0.517472", "0.5142696", "0.513255", "0.51286936", "0.5114975", "0.51093954", ...
0.0
-1
sort and retrieve top rows of df
def get_top_recipes(df, sort_params=None, count=10): if not sort_params: logging.warning("Column names to soty by are not defined.") return df return df.sort_values(sort_params["names"], ascending=sort_params["order"]).head(count)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_topn(df, top_n=25):\n assert df.columns.str.contains(\"ranking\").any(), \"select_topn failed. Missing 'ranking' column.\"\n \n # top-n by ranking\n topn_idx = df.groupby(\"ranking\").value_normalized.nlargest(top_n).droplevel(0).index\n \n return df.loc[topn_idx, : ]", "def analyse_...
[ "0.68262124", "0.6588031", "0.6443308", "0.6321405", "0.6281697", "0.62319", "0.6184617", "0.6135005", "0.6129716", "0.6061375", "0.6024057", "0.60073507", "0.59771293", "0.59485084", "0.5929012", "0.5920936", "0.5898448", "0.5891113", "0.5877641", "0.5877335", "0.5831138", ...
0.6937662
0
1. parse the json object and extract name, headline, prepTime, ratingsCount, favoritesCount, nutrition and export to a csv file 2. retrieve top 10 recipes based on ratingsCount, favoritesCount and export to a csv file
def read_recipes(year, week): # read config file cp = ConfigParser() cp.read("config.ini") # load menu data fname_json = cp["other"]["json_out_fname"] if not os.path.exists(fname_json): logging.error("JSON file not found.") return with open(fname_json) as f: m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTopMovies(endpoint, date, count=10):\n\n try:\n response = urlreq.urlopen(endpoint.format(date))\n soup = BeautifulSoup(response.read(), \"html.parser\")\n table = soup.find('table', border=\"0\", cellpadding=\"5\", cellspacing=\"1\")\n tdata = []\n\n for i, r...
[ "0.5909842", "0.57680744", "0.5694507", "0.56098086", "0.5597891", "0.556882", "0.551984", "0.5511607", "0.550861", "0.547752", "0.54691005", "0.5456482", "0.54545885", "0.54326177", "0.54270613", "0.54165226", "0.54148346", "0.5412836", "0.5410096", "0.53659177", "0.5352422"...
0.6317173
0
Sanity check that the tests have been set up correctly.
def setUp(self): assert COMMANDS.keys() == EXPCT_RESULTS.keys() self.tests = [] self.test_numbers = deque(sorted(COMMANDS.keys()))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tests():", "def setUp(self):\n\n app.testing = True\n self.app = app.test_client()\n\n self.valid_question = {\n \"title\" : \"tests\",\n \"question\": \"How do I refactor tests with database?\"\n }\n\n self.invalid_question = {\n \"title\" ...
[ "0.7378789", "0.72924495", "0.72878474", "0.7285571", "0.71925694", "0.71835464", "0.71835464", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741", "0.7178741"...
0.0
-1
Check whether the test has passed by comparing its stdout to what is expected.
def check_test(self, test): (stdout, stderr) = (out.decode('ascii').strip() for out in test.process.communicate()) self.assertEqual(stderr, "") self.assertEqual(stdout, EXPCT_RESULTS[test.number], "Test {} failed".format(test.number)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_stdout(self, expected: str):\n assert self._std_out is not None, f\"You first need to `execute` the program before checking stdout!\"\n self._test.assertEqual(self._std_out.strip(), expected.strip())", "def testStdoutAndStderr(self):\n with self.OutputCapturer():\n print('foo')\n ...
[ "0.80546683", "0.7428795", "0.7355473", "0.717167", "0.7111023", "0.7000859", "0.6972296", "0.6900554", "0.682078", "0.6813413", "0.67746073", "0.67362183", "0.67312825", "0.6682966", "0.6635578", "0.66335154", "0.66038454", "0.6588386", "0.65542763", "0.65454364", "0.6543559...
0.78012776
1
Start the next test.
def start_next_test(self): next_test_num = self.test_numbers.popleft() self.tests.append( self.TEST( process=Popen(COMMANDS[next_test_num], stdout=PIPE, stderr=PIPE), number=next_test_num))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def startTestRun(self):", "def startTest(self, test):\n self._timer = time()", "def test_run_started(self):", "def startTestRun(self, test):\n self.runTime= time.time()\n self.logger.debug(\"\\nBeginning ForceBalance test suite at %s\\n\" % time.strftime('%x %X %Z'))", "def startTest(a...
[ "0.7740946", "0.71101433", "0.7070812", "0.70663023", "0.7035438", "0.6931316", "0.6830204", "0.6806938", "0.6774849", "0.6727763", "0.669437", "0.66846573", "0.6676877", "0.6663228", "0.66558033", "0.6652603", "0.6652206", "0.66263163", "0.6597661", "0.6591751", "0.6574502",...
0.8345263
0
Poll tests for completion. When one finishes, start another one if there are more to run. Stop when all are finished.
def poll_tests(self): for i, test in enumerate(self.tests): if test.process.poll() is not None: self.check_test(test) self.tests.pop(i) if self.test_numbers: self.start_next_test()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wait_for_all_operations_done(self):\n while self._test_names_to_processes:\n time.sleep(10)\n running_test_names = list(self._test_names_to_processes.keys())\n for test_name in running_test_names:\n running_proc = self._test_names_to_processes.get(test_name)\n return_code = run...
[ "0.73554826", "0.674941", "0.65526724", "0.6549344", "0.6529588", "0.64772254", "0.64764065", "0.6411808", "0.6316884", "0.62365717", "0.6232344", "0.6232344", "0.6232344", "0.6232344", "0.6192078", "0.6168625", "0.6148079", "0.6129336", "0.60931456", "0.609054", "0.6083866",...
0.7962783
0
Parse the tests to be run. These may be given as a single number, a commaseperated list or two numbers seperated by a dash.
def parse_tests(tests_input): if '-' in tests_input: limits = tests_input.partition('-') tests = list(range(int(limits[0]), int(limits[2]) + 1)) else: tests = [int(t) for t in tests_input.split(',')] return tests
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_parser():\n return parser(\"Testing\", \"Use this from a test\", \"\")", "def test_multiple_series(self):\n assert parse_command('test{{A,B}}{{1,2}}') == [\n ('testA1', {}), ('testA2', {}), ('testB1', {}), ('testB2', {})]", "def parse(lines):\n num_tests = int(lines.next())\n ...
[ "0.64865124", "0.64598006", "0.64436996", "0.624886", "0.62173283", "0.61449796", "0.61414963", "0.61308944", "0.6120973", "0.6089176", "0.6052001", "0.60171705", "0.59748244", "0.5970603", "0.59605867", "0.59500784", "0.5947035", "0.59386694", "0.5920873", "0.59173906", "0.5...
0.7508628
0
Description The neighbor matching procedure of edge coarsening used in
def _neighbor_matching( graph_idx, num_nodes, edge_weights=None, relabel_idx=True ): edge_weight_capi = nd.NULL["int64"] if edge_weights is not None: edge_weight_capi = F.zerocopy_to_dgl_ndarray(edge_weights) node_label = F.full_1d( num_nodes, -1, getattr(F, graph_idx.dty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect_neighbours(self):\n for prev in self.unvisited:\n for next in self.unvisited:\n if (next[0] == prev[0] and next[1] == prev[1] + 1) or (next[0] == prev[0] + 1 and next[1] == prev[1]):\n self.graph.addEdge((prev, next))\n self.visite...
[ "0.6153587", "0.6068474", "0.6067164", "0.6052014", "0.59956855", "0.59085745", "0.58968294", "0.58965975", "0.5831831", "0.5774917", "0.5721212", "0.5705071", "0.5704869", "0.5701278", "0.5695957", "0.5694912", "0.5684748", "0.56846213", "0.5665716", "0.5652258", "0.5650964"...
0.556528
30
Orchestrator class, get all args, compare if exist any aggregation tag and set the right class To add more aggregator, create a class using IAgregation abstract class and register on mapp variable. Design Pattern Chain of Responsability
def __init__(self, args): self._mapp = { 'top_ips': ATopIps, 'request_rate': ARequests, 'top_sources': ATopSources } self.active = False self.ag = self.setup(args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(self, args):\n for key, ags in self._mapp.items():\n arg = args.get(key)\n\n if arg: #if exist, turn aggregator actived and create a new instance a new aggregator class\n self.active = True\n return ags(arg)", "def __init__(self, aggregator: a...
[ "0.7207149", "0.6826493", "0.5828733", "0.57781553", "0.5631342", "0.55537397", "0.5534474", "0.54947203", "0.5353859", "0.5275775", "0.52713186", "0.52707237", "0.5251632", "0.5243231", "0.5236624", "0.5222265", "0.5210367", "0.52063924", "0.5206035", "0.5178624", "0.5167367...
0.54321074
8
Find which aggregator will be use, accordly cli args
def setup(self, args): for key, ags in self._mapp.items(): arg = args.get(key) if arg: #if exist, turn aggregator actived and create a new instance a new aggregator class self.active = True return ags(arg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregator_name(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"aggregator_name\")", "def aggregator_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"aggregator_name\")", "def main():\n parser = argparse.ArgumentParser()\n parser.add_argument(\"--process_qu...
[ "0.623255", "0.60802627", "0.5820678", "0.5737905", "0.57234126", "0.57187593", "0.5651868", "0.55634636", "0.5494111", "0.5488788", "0.54820406", "0.53977966", "0.5384751", "0.5330864", "0.5323734", "0.5302474", "0.52866167", "0.5259916", "0.52444696", "0.52374387", "0.52364...
0.6193614
1
Used by Crawler class, append a line on instance of aggregator setuped.
def append(self, line): self.ag.append(line)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_add_node(self, line=''):\n self.fibbing.add_node()", "def add(self, line):\n self.body.append(line)", "def connectionMade(self):\n self.output = DelayedStartupLineLogger()\n self.output.makeConnection(self.transport)\n self.output.tag = self.name", "def _augment_pipe...
[ "0.56161034", "0.5413999", "0.5366023", "0.5317709", "0.531319", "0.52674985", "0.52674633", "0.52596486", "0.52380824", "0.5237493", "0.52317125", "0.5214208", "0.5210514", "0.51949674", "0.51943386", "0.51818913", "0.5181332", "0.5165727", "0.51442534", "0.5141288", "0.5126...
0.6032251
0
Return the result accordly each aggregator
def out(self): return self.ag.output()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aggregate_results(self):\n\n raise NotImplementedError", "def getResults():", "def get_results_from_aggregation_sources(self, context):", "def _get_aggregated_results(self):\n gradients = self.gradients\n client_traj_infos = flatten_lists(self.client_traj_infos)\n client_opt_i...
[ "0.7283095", "0.66016525", "0.6454805", "0.6355541", "0.62754244", "0.62277496", "0.6226932", "0.6183611", "0.6155009", "0.61124384", "0.6013284", "0.599175", "0.59845525", "0.5940563", "0.5931043", "0.59026664", "0.58947885", "0.5873596", "0.58522385", "0.58376825", "0.58325...
0.0
-1
Start command to start bot on Telegram. = information about the bot = the user info.
def start(self, bot, update): start_text = "This is the bot!" bot.send_message(chat_id=update.message.chat_id, text=start_text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_start(self, bot, update):\n\n msg = (\"Hi! I'm @MylesBot, a Telegram bot made by @MylesB about \"\n \"@MylesB.\")\n\n self.send_message(bot, update, msg)", "def start(bot, update, session, chat, user):\n if chat.is_maintenance:\n call_tg_func(update.message.chat,...
[ "0.72836596", "0.72188544", "0.7043724", "0.701264", "0.6987553", "0.6909063", "0.6845654", "0.6818385", "0.67974985", "0.6768815", "0.6725957", "0.67126876", "0.67044854", "0.67025495", "0.66472197", "0.66286534", "0.66097116", "0.6591849", "0.65889055", "0.6547758", "0.6530...
0.7057546
2
Echo the user message.
def echo(self, bot, update): # print(update) update.message.reply_text(update.message.text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showMessage(self, message):\r\n print message", "def do_echo(self, message):\r\n\t\tself.trace(f'Echo: {message}!')", "def say(self, message):\r\n print message", "def echo(self, msg=None):\n return msg", "def Echo(self, message):\n logging.info('Echoing %s', message)\n retur...
[ "0.76790404", "0.76771134", "0.76046246", "0.7395257", "0.72742033", "0.72385746", "0.7237779", "0.7188829", "0.7183256", "0.7162561", "0.7158835", "0.71545786", "0.7038126", "0.702889", "0.702889", "0.70086247", "0.6957034", "0.6957034", "0.6937433", "0.6937433", "0.6937433"...
0.6567033
51
Release module to pypi
def release_pypi(): local('python setup.py clean sdist register upload')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publish():\n fab.local(\"env/bin/python setup.py sdist\")\n tar_filename = fab.local(\n \"env/bin/python setup.py --fullname\", capture=True\n )\n dist_filename = \"dist/{}.tar.gz\".format(tar_filename)\n fab.put(dist_filename, PYREPO_DIR)", "def upload():\n sh('python setup.py regis...
[ "0.67773676", "0.6478244", "0.63994586", "0.6243652", "0.62267685", "0.62066156", "0.6148887", "0.60896164", "0.60631406", "0.6047037", "0.60178316", "0.5989916", "0.59694237", "0.5946053", "0.58958906", "0.5860913", "0.5859919", "0.58371365", "0.58328044", "0.5812867", "0.57...
0.77637976
0
Subprocess call for command that return non zero exit code...
def _subexec(command): lcwd = fabric.state.env.get('lcwd', None) or None #sets lcwd to None if it bools to false as well process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=lcwd) out, err = process.communicate() print "command : %s " % command print "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(cmd, shell=False, cwd=None):\n try:\n out = check_output(cmd, shell=shell, cwd=cwd, stderr=STDOUT)\n except CalledProcessError as ex:\n return ex.returncode, ex.output\n else:\n return 0, out", "def run(cmd):\n print ' '.join(cmd)\n try:\n check_call(cmd)\n e...
[ "0.7782048", "0.76977396", "0.7639604", "0.7635583", "0.75630707", "0.75365514", "0.7409323", "0.740015", "0.7330668", "0.73245245", "0.731855", "0.73132306", "0.7309477", "0.7276661", "0.727039", "0.72444963", "0.72279525", "0.72127426", "0.7181438", "0.71659833", "0.7133339...
0.67369956
66
Pylint and PEP8 QA report generator We use subprocess instead local because pylint and pep8 don't return a zero exit code. This behaviour is incompatible with fabric...
def release_qa(): lines = StringIO.StringIO(local('find . -name "*.py"', capture=True)) for line in lines.readlines(): print "PYLINT CHECK" print "-----------------------" pyfile = os.path.normpath(line).replace("\n","").replace("\r","") reportfilename = pyfile.replace("....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lint(to_lint):\n exit_code = 0\n for linter, options in (('pyflakes', []), ('pep8', pep8_options)):\n try:\n output = local[linter](*(options + to_lint))\n except commands.ProcessExecutionError as e:\n output = e.stdout\n\n if output:\n exit_code = 1\...
[ "0.65316886", "0.64339733", "0.62938845", "0.6269195", "0.6211118", "0.61833465", "0.61646247", "0.61259955", "0.6116404", "0.6100978", "0.6065386", "0.60457647", "0.60411966", "0.6017067", "0.5966548", "0.5959962", "0.5957931", "0.5918821", "0.5904913", "0.5893862", "0.58845...
0.7032081
0
installs and configures a fresh DIRAC UI (VO specific)
def install_ui(): # pick which VO I want to test, default gridpp print "Which VO do you want to test (default: gridpp) ?" user_VO = raw_input("Your choices are: gridpp, lz, lsst, solidexperiment.org, skatelescope.eu: ") \ or "gridpp" if user_VO not in ["gridpp", "lz", "lsst", "solidexperiment.org", "skate...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap():\n validate_configurator_version()\n\n # put new mkinitcpio.conf in place\n run(\"mv /etc/mkinitcpio.conf.pacnew /etc/mkinitcpio.conf\")\n sed(\"/etc/mkinitcpio.conf\",\n 'MODULES=\"\"',\n 'MODULES=\"xen-blkfront xen-fbfront xen-kbdfront xen-netfront xen-pcifront xenbus_pr...
[ "0.603138", "0.58798337", "0.5784808", "0.5766571", "0.57437", "0.5734021", "0.5714146", "0.56864846", "0.5641124", "0.5625011", "0.56127167", "0.56086886", "0.5601726", "0.55902636", "0.55759335", "0.55585897", "0.55564934", "0.55510265", "0.5542947", "0.5528047", "0.5500627...
0.7038603
0
Create a new installable package.
def __init__(self, pkg_info, remote_files, install_mgr): _check_pkg_info(pkg_info, self._MANDATORY_KEYS) _add_pkg_info_defaults(pkg_info) self.pkg_info = pkg_info self.remote_files = remote_files self.install_mgr = install_mgr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_package(self, **kwargs):\n results = self.api.action.package_create(**kwargs)\n self.get_ckan_metadata(True)\n return results", "def makePackage(self, destination, packageName):\r\n packageFolder = os.path.join(destination, packageName)\r\n MakePyDir().makePyDir(pack...
[ "0.7582697", "0.73307925", "0.7132005", "0.7014748", "0.6922174", "0.69100004", "0.6891954", "0.68648934", "0.6862199", "0.679142", "0.6751084", "0.67348325", "0.66702074", "0.6627358", "0.6554115", "0.6535373", "0.6498029", "0.6456046", "0.6427742", "0.6420937", "0.6355059",...
0.0
-1
Create a new installed package. pkg_info same as pkg_info for installable package but adds the
def __init__(self, pkg_info): _check_pkg_info(pkg_info, self._MANDATORY_KEYS) _add_pkg_info_defaults(pkg_info) self.pkg_info = pkg_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_package ( self, package_info, addition_control, **pkg_add_kw ):\n return self._get_package_dir ( package_info ['name'] ).add_package (\n package_info, addition_control, **pkg_add_kw\n )", "def create_package(self, **kwargs):\n results = self.api.action.package_create(**kwargs)\n ...
[ "0.664372", "0.6378287", "0.6274833", "0.6235504", "0.62233025", "0.62112504", "0.61472887", "0.6116683", "0.6106578", "0.6072149", "0.6033826", "0.6025865", "0.60145664", "0.6013302", "0.60074437", "0.5996898", "0.5982463", "0.59394276", "0.59046775", "0.5891099", "0.5850441...
0.57937473
27
Called before anything else, i.e. just after installer controller creation. Return value is ignored.
def pre_installation(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepareController(self):\n pass", "def preRunSetup(self):\n self.logDesc(\"Pre Run Setup\") \n self.verifyCurrentUser(userRole='Administrator', loginAsUser=True)", "def preRunSetup(self):\n self.logDesc(\"Pre Run Setup\") \n self.verifyCurrentUser(userRole='Ad...
[ "0.69888854", "0.6657627", "0.6657627", "0.65865713", "0.64082533", "0.6388744", "0.6384215", "0.6347374", "0.63209623", "0.6310592", "0.6240077", "0.62371147", "0.62121433", "0.6202042", "0.619813", "0.61480397", "0.61330086", "0.6025088", "0.6025088", "0.60231227", "0.60074...
0.71761113
0
Return a list of package IDs from the given list of package IDs. Every returned package ID must be in the installable package storage.
def preprocess_raw_pkg_ids(self, raw_pkg_ids): return raw_pkg_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages(self, package_ids):\n return [self.get_package(package_id) for package_id in package_ids]", "def list_package_ids(self):\n raise NotImplementedError", "def get_all_package_ids(self):\n return self._package_cache.keys()", "def BuildIdsPaths(package_paths):\n\n build_ids_...
[ "0.7364979", "0.7235984", "0.6563376", "0.6440611", "0.63969654", "0.61363554", "0.59568906", "0.59266436", "0.5838303", "0.57976454", "0.57939595", "0.5681225", "0.56639105", "0.56542856", "0.5640473", "0.5615153", "0.5544031", "0.5539764", "0.5531911", "0.55237174", "0.5521...
0.62428546
5
Return a list of package from the given list of packages.
def preprocess_raw_pkgs(self, raw_installable_pkgs): for installable_pkg in raw_installable_pkgs: installable_pkg.pkg_info['explicit_install'] = True return raw_installable_pkgs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_packages_list(packages: list = [], **kwargs) -> list:\n\n response = ca_client.list_packages(\n domain=domain,\n domainOwner=domain_owner,\n repository=repository,\n format=lang_format,\n **kwargs\n )\n if \"nextToken\" in response:\n packages = get_packag...
[ "0.75616795", "0.745376", "0.7141492", "0.69627184", "0.6918363", "0.689751", "0.6887808", "0.68198246", "0.6819392", "0.66968155", "0.6656828", "0.66327983", "0.6632158", "0.6531161", "0.6528741", "0.65256906", "0.6519611", "0.65063256", "0.6493329", "0.6492118", "0.6467504"...
0.0
-1
Return a list of remote file from the given list of remote files.
def preprocess_raw_remote_files(self, raw_remote_files): return [xfile for xfile in raw_remote_files if not xfile.exists()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(target_files, config):\n out = []\n find_fn = _find_file(config)\n for fname_in in target_files.keys():\n if isinstance(fname_in, (list, tuple)):\n fnames = fname_in\n else:\n fnames = fname_in.split(\";\")\n for fname in fnames:\n remote...
[ "0.7237889", "0.6767547", "0.66274375", "0.65912855", "0.65586805", "0.6552874", "0.6420708", "0.6325109", "0.6185326", "0.616658", "0.6161692", "0.61429477", "0.6124814", "0.61134636", "0.6096036", "0.6086759", "0.60865915", "0.60829717", "0.6061942", "0.60608625", "0.603315...
0.67033446
2
Called before any files have downloaded.
def pre_download(self, remote_files): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_and_prepare(self):\n self._download_and_prepare()", "def download_files(self):", "def pre_download(self):\n while not os.path.exists(self.file_path):\n time.sleep(1)\n\n if self.downloader.file_size != 0:\n # Waits %1 of the total download\n percen...
[ "0.72078025", "0.6953876", "0.6938813", "0.6892764", "0.6278536", "0.60983944", "0.60776293", "0.59928954", "0.59894645", "0.59894645", "0.59813267", "0.5980656", "0.5966963", "0.59472805", "0.5930741", "0.59225214", "0.58397645", "0.58169204", "0.57641727", "0.57575905", "0....
0.80088097
0
Called to download the next file.
def download_file(self, remote_file): remote_file.download()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_file(self):\n raise NotImplementedError()", "def download_files(self):", "def setNextFile(self):\n\n if (self.nReadBlocks >= self.processingHeaderObj.dataBlocksPerFile):\n self.nReadFiles=self.nReadFiles+1\n if self.nReadFiles > self.nTotalReadFiles:\n ...
[ "0.7292811", "0.7247551", "0.67648876", "0.6716271", "0.66955405", "0.6679946", "0.66258854", "0.6596123", "0.6596123", "0.65185505", "0.65049696", "0.6477158", "0.6471547", "0.64661497", "0.64401084", "0.642619", "0.6409882", "0.6366054", "0.63562936", "0.635614", "0.6333223...
0.58904463
62
Called after every files have been downloaded.
def post_download(self, remote_files): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_finish(self, cloud_file):", "def pre_download(self, remote_files):\n pass", "def download_files(self):", "def _finalize(self):\n if self.url and self.url.startswith('file://'):\n self.parse_external_files(self.url[7:])\n Media._finalize(self)", "def download_fil...
[ "0.6957989", "0.6865277", "0.68242747", "0.64642113", "0.64255536", "0.64033055", "0.62918645", "0.62449217", "0.62424684", "0.62129873", "0.62109494", "0.62088096", "0.6166017", "0.616356", "0.6145047", "0.6114954", "0.6033107", "0.6015093", "0.59706825", "0.5961392", "0.594...
0.7216123
0
Called before the installation of any pkg.
def pre_install(self, installable_pkgs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_install_pkg(self, installable_pkg):\n pass", "def pre_installation(self):\n pass", "def post_install(self, installable_pkgs):\n pass", "def post_install_pkg(self, installable_pkg):\n pass", "def _install(self):\n\n pass", "def do_post_install(self, context):\n ...
[ "0.87274486", "0.8490351", "0.78138494", "0.76809055", "0.7401921", "0.7185641", "0.7014699", "0.7007921", "0.68065137", "0.6684582", "0.6648925", "0.6547911", "0.6547911", "0.6547911", "0.6547911", "0.6547911", "0.6534111", "0.65294236", "0.6491212", "0.6484541", "0.64816105...
0.86834514
1
Called before the installation of the given installable pkg.
def pre_install_pkg(self, installable_pkg): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_install(self, installable_pkgs):\n pass", "def post_install_pkg(self, installable_pkg):\n pass", "def post_install(self, installable_pkgs):\n pass", "def pre_installation(self):\n pass", "def setPkgRequired(self, *args):\n return _libsbml.SBMLDocument_setPkgRequir...
[ "0.803951", "0.79661417", "0.72544426", "0.7061348", "0.6615395", "0.645456", "0.63259906", "0.62912256", "0.6285924", "0.62740517", "0.625301", "0.62484384", "0.6227197", "0.6225595", "0.6215587", "0.6126311", "0.6083534", "0.60764074", "0.5963906", "0.59445024", "0.5924112"...
0.89542097
0
Called after the successful installation of the given installable pkg.
def post_install_pkg(self, installable_pkg): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_install(self, installable_pkgs):\n pass", "def pre_install_pkg(self, installable_pkg):\n pass", "def do_post_install(self, context):\n pass", "def notify_add_package(self, pkg):\n ver_key = (pkg.category, pkg.package)\n s = set(self.versions.get(ver_key, ()))\n ...
[ "0.7332126", "0.69622064", "0.6393076", "0.60962796", "0.5933556", "0.58876604", "0.58322257", "0.58148694", "0.5752", "0.554155", "0.5408007", "0.5398204", "0.53647107", "0.5351951", "0.5319673", "0.52867943", "0.5283457", "0.52370936", "0.5234688", "0.5212532", "0.52116287"...
0.8569286
0
Called after the successful installation of all pkg.
def post_install(self, installable_pkgs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_install_pkg(self, installable_pkg):\n pass", "def do_post_install(self, context):\n pass", "def post_installation(self, exc_value):\n pass", "def pre_install(self, installable_pkgs):\n pass", "def pre_install_pkg(self, installable_pkg):\n pass", "def _install(s...
[ "0.83991206", "0.7399972", "0.7169786", "0.69973654", "0.6994343", "0.6681931", "0.657458", "0.6570379", "0.65510577", "0.64301735", "0.6408434", "0.63056946", "0.6250174", "0.6222582", "0.61908776", "0.61649483", "0.6062687", "0.6025747", "0.6022049", "0.599792", "0.5966197"...
0.8408907
0
Called after anything else (will be called if pre_installation returned successfully) exc_value is None if no error, else the exception value
def post_installation(self, exc_value): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exc_handler(self, exc_type, exc, *args) -> None:\n self.exception = exc\n self.exit_code = 1", "def on_failure(self, exc: BaseException) -> None:", "def postcondition(self, result, exc_info, *args, **kwargs):\n pass", "def pre_setup(self) -> None:\n if self.__setup_done:\n ...
[ "0.62841517", "0.62787837", "0.6137501", "0.5973818", "0.5940887", "0.58668447", "0.58472353", "0.5836734", "0.5826562", "0.5807436", "0.5798474", "0.57931894", "0.57608753", "0.5755618", "0.5744285", "0.57340395", "0.57157147", "0.5701963", "0.5669499", "0.566829", "0.564802...
0.8339836
0
Return the list of tuple (installed pkg, installable pkg) to upgrade from the list of (installed pkg, installable pkg) tuple that have a different version than their installable counterpart.
def preprocess_raw_upgrade_list(self, raw_upgrade_list): # By default, upgrade all package that are not in sync, which is # not what you want to do for more evolved package management return raw_upgrade_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_package_lists(manifest, installed):\n\n uninstalled = [x for x in manifest if x not in installed]\n\n # == comm -23\n also_installed = [x for x in installed if x not in manifest]\n\n # 'easiest' solution\n # print \"apt-get remove -y %s\" % (' '.join(uninstalled))\n # print \"apt-get ...
[ "0.65186965", "0.6409755", "0.62714106", "0.62447596", "0.6222031", "0.6134092", "0.6092698", "0.60819024", "0.60146976", "0.5998767", "0.59756505", "0.5935078", "0.5915402", "0.5899426", "0.58644897", "0.5856976", "0.5855966", "0.58493674", "0.58337134", "0.5801425", "0.5791...
0.54904187
45
From the list of known to be upgraded pkgs, return a list of tuple (installed_pkg, [], [])) such that both list doesn't contains the pkg of the installed pkg. Also, if a new package to install is found in more than in one list, it will be discard in the later list.
def preprocess_upgrade_list(self, upgrade_list): return [(ed_pkg, able_pkg, [], []) for (ed_pkg, able_pkg) in upgrade_list]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_installed_packages() -> List['Package']:\n repo_packages_names = set(expac(\"-S\", ['n'], []))\n\n # packages the user wants to install from aur\n aur_names = packages_from_other_sources()[0]\n repo_packages_names -= aur_names\n\n installed_packages_names = set(expac(\"-Q...
[ "0.68577033", "0.66643363", "0.63001037", "0.6242023", "0.6221818", "0.61724806", "0.611967", "0.6084042", "0.608403", "0.60733235", "0.60682243", "0.6050123", "0.6046999", "0.60445344", "0.60400933", "0.599542", "0.59662074", "0.5938913", "0.5904515", "0.5884107", "0.5870722...
0.7349749
0
Called before the installation of any pkg.
def pre_upgrade(self, upgrade_specs): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_install_pkg(self, installable_pkg):\n pass", "def pre_install(self, installable_pkgs):\n pass", "def pre_installation(self):\n pass", "def post_install(self, installable_pkgs):\n pass", "def post_install_pkg(self, installable_pkg):\n pass", "def _install(self):\...
[ "0.87274486", "0.86834514", "0.8490351", "0.78138494", "0.76809055", "0.7401921", "0.7185641", "0.7014699", "0.7007921", "0.68065137", "0.6684582", "0.6648925", "0.6547911", "0.6547911", "0.6547911", "0.6547911", "0.6547911", "0.6534111", "0.65294236", "0.6491212", "0.6484541...
0.0
-1
Builds the Tensorflow graph.
def _build_model(self): # Placeholders for our input # Our input are MEMORY_LENGTH frames of shape 5, 5 each self.X_pl = tf.placeholder(shape=[None, 5, 5, MEMORY_LENGTH], dtype=tf.uint8, name="X") # The TD target value self.y_pl = tf.placeholder(shape=[None], dtype=tf.float32, n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_tf_graph(self):\n raise NotImplementedError", "def build_graph(self):\n\t\tself._create_placeholders()\n\t\tself._create_embedding()\n\t\tself._create_recurrent_layers()\n\t\tself._create_de_embedding()\n\t\tself._create_loss()\n\t\tself._create_optimizer()\n\t\tself._create_summaries()", "def bui...
[ "0.8258779", "0.8072614", "0.8026864", "0.7975154", "0.7965664", "0.7960153", "0.79411334", "0.7920188", "0.79135257", "0.7908656", "0.7888244", "0.78879184", "0.78817815", "0.7828711", "0.7801996", "0.77979594", "0.77831817", "0.7782756", "0.77774066", "0.7767193", "0.776609...
0.6579968
79
Copies the model parameters of one estimator to another.
def copy_model_parameters(sess, estimator1, estimator2): e1_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator1.scope)] e1_params = sorted(e1_params, key=lambda v: v.name) e2_params = [t for t in tf.trainable_variables() if t.name.startswith(estimator2.scope)] e2_params = sorte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy_para(from_model, to_model):\n for i, j in zip(from_model.trainable_weights, to_model.trainable_weights):\n j.assign(i)", "def sync_parameters(self, model: nn.Module) -> None:\n # before ema, copy weights from orig\n avg_param = (\n itertools.chain(self....
[ "0.6655023", "0.6186064", "0.6186064", "0.61854655", "0.6052574", "0.60511726", "0.60407877", "0.5963009", "0.5963009", "0.59216297", "0.59045017", "0.58989644", "0.589293", "0.58706653", "0.5860739", "0.58496034", "0.58299047", "0.58268255", "0.5764856", "0.57535136", "0.574...
0.7852629
1
Creates an epsilongreedy policy based on a given Qfunction approximator and epsilon.
def make_epsilon_greedy_policy(estimator, nA): def policy_fn(sess, observation, epsilon): A = np.ones(nA, dtype=float) * epsilon / nA q_values = estimator.predict(sess, np.expand_dims(observation, 0))[0] print(f'q_values: {q_values}') best_action = np.argmax(q_values) A[best_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createEpsilonGreedyPolicy(Q, epsilon, num_actions):\n\n def policyFunction(state):\n Action_probabilities = np.ones(num_actions,\n dtype=float) * epsilon / num_actions\n\n best_action = np.argmax(Q[state])\n Action_probabilities[best_action] += (1.0...
[ "0.78010213", "0.7771446", "0.7609632", "0.7590617", "0.75758374", "0.75702316", "0.7455431", "0.7435255", "0.72975755", "0.70651025", "0.7052984", "0.6743078", "0.6650919", "0.65363425", "0.6319062", "0.62520564", "0.62376964", "0.6202657", "0.61382174", "0.6107149", "0.6052...
0.7177619
9
QLearning algorithm for offpolicy TD control using Function Approximation. Finds the optimal greedy policy while following an epsilongreedy policy.
def empathic_deep_q_learning(sess, env, q_estimator, target_estimator, empathic_estimator, num_episodes, replay_memory_size=500000, replay_memory_init_size=50000, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def policies(self, QTable, epsilon, state, next_states, action_to_do): # Inspiration from https://www.geeksforgeeks.org/q-learning-in-python/?fbclid=IwAR1UXR88IuJBhhTakjxNq_gcf3nCmJB0puuoA46J8mZnEan_qx9hhoFzhK8\r\n num_actions = 5 # 5 actions-value, [moved_out, into_goal, send_opp_home, send_self_home, move...
[ "0.77068037", "0.6990565", "0.69714993", "0.6962928", "0.69604427", "0.6906738", "0.6886918", "0.6791934", "0.6698574", "0.6691974", "0.66405153", "0.65949064", "0.65601516", "0.6510425", "0.64388055", "0.6399038", "0.6367646", "0.63593113", "0.63479406", "0.6339692", "0.6325...
0.0
-1
trim nonlinear aircraft with angle of attack and elevator.
def trim_alpha_de_nonlinear(speed, altitude, gamma, n=1, tol=1e-1): def obj(x): out = x[2] return out def alpha_stab(x): u = array([0, x[1], 0, x[2]]) x = array([speed * cos(x[0]), 0, speed * sin(x[0]), 0, x[0] + deg2rad(gamma), 0, 0, 0, 0, 0, 0, altitude]) x_dot = mode...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coll_trim(th):\n lam = TipLoss(lamInit, th)\n AoA = th - lam / r\n dCL, dCD = PolarLookup(AoA)\n dCT = 0.5 * solDist * (dCL*np.cos(lam/r)-dCD*np.sin(lam/r))* r ** 2\n # dCT = 0.5 * solDist * dCL * r ** 2\n CT = np.trapz(dCT, r)\n\n return CT, dCT, dCL, dCD, lam,...
[ "0.57309926", "0.5562074", "0.54877454", "0.53574204", "0.53017944", "0.52877146", "0.522877", "0.52124757", "0.51419944", "0.51196784", "0.51184297", "0.50799096", "0.50414336", "0.49780405", "0.49701124", "0.49640945", "0.49638167", "0.49542117", "0.49492422", "0.49434245", ...
0.48222995
28
LSTM input Generates a tensor that corresponds an LSTM input sequence from a two dimensional table (rows = samples, columns = variables)
def generate_lstm_input_sequence( input_tensor: Tensor, seq_len: int, window_shift_step_size: int ): num_iterations = (seq_len // window_shift_step_size) num_vars = input_tensor.shape[1] tensor_list = [] for i in range(num_iterations): # calculate how much the window has to be shifte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def LSTM(inputs, dim, seq_len, name):\r\n with tf.name_scope(name) as scope:\r\n cell = tf.contrib.rnn.LSTMCell(num_units=dim)\r\n hidden_states, cell_states = tf.nn.dynamic_rnn(cell, inputs=inputs, sequence_length=seq_len, dtype=tf.float32, scope=name)\r\n\r\n return hidden_states, cell_states...
[ "0.671775", "0.6443419", "0.63130444", "0.6284584", "0.62595385", "0.6248711", "0.61987054", "0.61636215", "0.6117673", "0.6102052", "0.6073893", "0.6053332", "0.60326666", "0.5990912", "0.5978899", "0.59719133", "0.5913929", "0.58949786", "0.58881134", "0.5882032", "0.587783...
0.66498864
1
Gets the maximum sequence bounds of non idle time Machines shows default values at the beginning and end of the operations; this functions returns the ids of the longest sequence that is not operating with the default values. Note that you cannot just remove all default values, essentially because order matters and the...
def get_id_bounds( values: Tensor, default_value: float ): # get all values that are not default ones default_value_idx = (values == default_value).nonzero()[:, 0] # get the longest sequence without interruption # to do this, get the difference of the above ids diff = default_value_idx[1:] -...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_loose_bounds(maxlum=None):\n return[(None,None), (10**-6, None), (2., 350),\n (None, -10**-6), (None, None)]", "def longest_sequence(start=1, end=1000000):\n\n max_length = 0\n max_start_value = 0\n\n # generate sequence for each value\n for i in range(start, end):\n cu...
[ "0.5749199", "0.5637835", "0.5553669", "0.5540054", "0.5517348", "0.54871017", "0.547557", "0.5464125", "0.54230356", "0.53948283", "0.53876203", "0.53298086", "0.5300341", "0.52418303", "0.5241372", "0.52193195", "0.5216842", "0.52015424", "0.520039", "0.51883274", "0.516819...
0.7332722
0
Pad sequences that are too short
def padding_tensor(sequences, max_length=1000000): # get the number of sequences num = len(sequences) # get the maximum length (clip too long sequences) max_len = min(max([s.shape[0] for s in sequences]), max_length) # define new output dimensions out_dims = (num, max_len, *sequences[0].shape[1:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(seq, n):\n return", "def _pad_shorter(sequence: str) -> str:\n return sequence.ljust(3, \"X\")", "def pad_to_max_length(self, sequence):\n sequence = sequence[:self.max_seq_length]\n n = len(sequence)\n #return sequence + ['[PAD]'] * (self.max_seq_length - n)\n ret...
[ "0.8076515", "0.79440534", "0.78587586", "0.76918006", "0.76324975", "0.747446", "0.7422067", "0.7331402", "0.7119049", "0.70603657", "0.69992334", "0.6998201", "0.698124", "0.6966674", "0.6966566", "0.69475687", "0.68809956", "0.6873199", "0.6871419", "0.68637884", "0.685601...
0.6648124
33
Ensure that sequence is a numeric array.
def ensure_numeric(A, typecode=None): if isinstance(A, basestring): msg = 'Sorry, cannot handle strings in ensure_numeric()' raise Exception(msg) if typecode is None: if isinstance(A, numpy.ndarray): return A else: return numpy.array(A) else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_number_sequence(self, seq, n):\n if seq is None:\n return np.zeros(n)\n if len(seq) is n:\n try:\n l = [float(e) for e in seq]\n except ValueError:\n raise ValueError(\"One or more elements in sequence <\" + repr(seq) + \"> ...
[ "0.7163305", "0.7004887", "0.6348093", "0.6331678", "0.62893003", "0.6272969", "0.62521833", "0.6226475", "0.6204775", "0.6202429", "0.6157295", "0.6149922", "0.6109198", "0.6074564", "0.6060793", "0.60362536", "0.60159546", "0.5984151", "0.5964977", "0.59511167", "0.5949249"...
0.69070625
2
Cumulative Normal Distribution Function Input
def cdf(x, mu=0, sigma=1, kind='normal'): msg = 'Argument "kind" must be either normal or lognormal' if kind not in ['normal', 'lognormal']: raise RuntimeError(msg) if kind == 'lognormal': return cdf(numpy.log(x), mu=mu, sigma=sigma, kind='normal') arg = (x - mu) / (sigma * numpy.sqrt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normal_cdf(x: torch.Tensor) -> torch.Tensor:\n return torch.distributions.Normal(0, 1.0).cdf(x)", "def cumulative_normal_distribution(z):\n from math import exp\n\n b1 = +0.319381530\n b2 = -0.356563782\n b3 = +1.781477937\n b4 = -1.821255978\n b5 = +1.330274429\n p = +0.2316419\n ...
[ "0.78193784", "0.7713642", "0.74481666", "0.73976594", "0.7385765", "0.7318204", "0.7032038", "0.6768214", "0.6707595", "0.67005926", "0.6619152", "0.65774465", "0.65379506", "0.65120757", "0.64703155", "0.64342105", "0.64087766", "0.63950425", "0.63945556", "0.6386111", "0.6...
0.5889642
80
Creates a list of strings indicating available devices to test on. Checks for CUDA devices, primarily. Assumes CPU is always available.
def get_test_devices(): # Assumption: CPU is always available devices = ['cpu'] if torch.cuda.is_available(): devices.append('cuda') return devices
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_devices():\n devices = [\"cpu\"]\n if torch.cuda.is_available():\n devices.append(\"cuda\")\n return devices", "def get_available_devices():\n executable_path = os.path.join(os.path.dirname(__file__), 'build')\n try:\n num_devices = int(subprocess.check_output(\n ...
[ "0.79648924", "0.779924", "0.74314016", "0.742399", "0.72089636", "0.7203299", "0.7203299", "0.71994233", "0.71461236", "0.71363676", "0.7131888", "0.7081655", "0.69478077", "0.6909545", "0.6909545", "0.68895745", "0.6862883", "0.6847569", "0.6778976", "0.67201084", "0.671292...
0.8175212
0
Defines the basic properties of the dataset reader.
def __init__(self, language, dataset_name): self._language = language self._dataset_name = dataset_name # TODO: Maybe the paths should be passed as parameters or read from a configuration file. self._trainset_path = "data/raw/{}/{}_Train.tsv".format(language.lower(), dataset_name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readProperties(self):\r\n print('not yet implemented')", "def __init__(self, resource, read_header=True, dialect=None, encoding=None,\r\n detect_header=False, sample_size=200, skip_rows=None,\r\n empty_as_null=True,fields=None, **reader_args):\r\n self.read_heade...
[ "0.59841424", "0.5928963", "0.5784238", "0.57840806", "0.57327986", "0.57229203", "0.57107365", "0.5557109", "0.5537866", "0.5524832", "0.54842496", "0.5471898", "0.5462397", "0.5455518", "0.5455518", "0.5455518", "0.54534966", "0.5443496", "0.54328513", "0.54135853", "0.5410...
0.0
-1
list. Getter method for the training set.
def train_set(self): if self._trainset is None: # loads the data to memory once and when requested. trainset_raw = self.read_dataset(self._trainset_path) trainset_spacy = self.read_spacy_pickle(self._trainset_spacy_path) if trainset_raw is None and trainset_spacy is None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def training_set(self):\n return self._training_set", "def getTrainSet(self):\r\n return self.fTrainData", "def get_train_examples(self):\n raise NotImplementedError()", "def getTrainingData(self):\n raise NotImplementedError", "def ytrain(self,)->list:", "def train_data(self)...
[ "0.7853087", "0.7833995", "0.7162848", "0.7011273", "0.69807905", "0.68640167", "0.6779734", "0.67625207", "0.67128795", "0.6642267", "0.66175365", "0.6588874", "0.65435916", "0.6489735", "0.64823407", "0.64677966", "0.64677536", "0.64677536", "0.64677536", "0.64677536", "0.6...
0.63743335
26
list. Getter method for the development set.
def dev_set(self): if self._devset is None: # loads the data to memory once and when requested. devset_raw = self.read_dataset(self._devset_path) devset_spacy = self.read_spacy_pickle(self._devset_spacy_path) if devset_raw is None and devset_spacy is None: # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getList(self):\n\treturn self.list", "def getList(self):\n pass", "def list(self):\n return self._get_list()", "def getList(self):", "def getList(self):", "def getList(self):\n return self.list", "def _list(self):\n raise NotImplementedError", "def getList(self):\n ...
[ "0.73627645", "0.71417344", "0.71412355", "0.70894736", "0.70894736", "0.70750684", "0.7051862", "0.6963677", "0.68805003", "0.68201923", "0.66853786", "0.665861", "0.665861", "0.65717626", "0.65602267", "0.65473986", "0.6545399", "0.65362054", "0.65142536", "0.6490376", "0.6...
0.0
-1
list. Getter method for the test set.
def test_set(self): if self._testset is None: # loads the data to memory once and when requested. testset_raw = self.read_dataset(self._testset_path) testset_spacy = self.read_spacy_pickle(self._testset_spacy_path) self._testset = pd.concat([testset_raw, testset_spacy], axis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getTestSet(self):\r\n return self.fTestData", "def test_list(self):\n pass", "def test_list(self):\n pass", "def test_get_list(self):\n pass", "def test_setlist(self):\n self.assertEqual(self.show.setlist, [])", "def getList(self):", "def getList(self):", "def _...
[ "0.7663302", "0.75377935", "0.75377935", "0.74939066", "0.7442792", "0.7260937", "0.7260937", "0.7233362", "0.71777934", "0.7144615", "0.708761", "0.7086548", "0.7085815", "0.69690573", "0.6968609", "0.68739635", "0.68606836", "0.68267024", "0.6802899", "0.6769468", "0.675869...
0.0
-1
Read the dataset file.
def read_dataset(self, file_path): try: with open(file_path, encoding="utf-8") as file: fieldnames = ['hit_id', 'sentence', 'start_offset', 'end_offset', 'target_word', 'native_annots', 'nonnative_annots', 'native_complex', 'nonnative_complex', 'gold_lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_file(path):\n input_file = os.path.join(path)\n with open(input_file) as f:\n dataset = f.read()\n return dataset", "def read_data(self, file_path):\n raise NotImplementedError('should be overridden with specific data reader')", "def read_data_file(self, file_name: str = \"\") -...
[ "0.7127761", "0.7097751", "0.6955917", "0.69546825", "0.6948491", "0.691113", "0.691113", "0.68785495", "0.68783164", "0.6860642", "0.6858185", "0.681202", "0.6805915", "0.6805572", "0.68029416", "0.6799209", "0.67829126", "0.6773895", "0.6773895", "0.6763192", "0.674889", ...
0.6905276
7
Read the pickled spacy objects
def read_spacy_pickle(self, file_path): vocab = self.nlp.vocab try: file = open(file_path, "rb") # putting the spacy doc in a single-item list to avoid pandas splitting it up spacy_objects = [[Doc(vocab).from_bytes(x)] for x in pickle.load(file)] file.cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_dictionary():\n # model = 'en_core_web_sm'\n # model = 'en_core_web_md'\n # model = 'en_core_web_lg'\n model = 'en' # Using 'en' instead of 'en_core_web_md', as the latter has many words without vector data. Check!\n print(\"Starting to read the model:\", model)\n # nlp = spacy.cli.down...
[ "0.60844487", "0.60844284", "0.59511757", "0.59002733", "0.587763", "0.5824237", "0.5801722", "0.5801091", "0.57834816", "0.57699907", "0.5766996", "0.57638127", "0.57596767", "0.57547075", "0.5739896", "0.5739467", "0.57228065", "0.57223886", "0.57158464", "0.5714373", "0.57...
0.67977774
0
Creates an Experiment with totaly artificial data. Experiment has one setup with two modalities, EMG and kin. EMG has four channels, KIN has three channels. Two sessions are "recorded" for two different subjects. All EMG recordings have sampling rate of 20Hz, all KIN recordings sampling rate of 5Hz.
def setup(cls): cls.logger = logging.getLogger('ModelTestLogger') cls.logger.setLevel(logging.DEBUG) s1 = model.Subject('subject1') s2 = model.Subject('subject2') cls.experiment = model.Experiment() cls.experiment.put_subject(s1) cls.experiment.put_subject(s2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_exp2(args):\n\n # load data.\n SC = np.load(args.SC)\n sc_lbls = np.load(args.sc_lbls)\n c_lbls = np.load(args.c_lbls)\n b_lbls = np.load(args.b_lbls)\n\n # compute dimensions.\n n = args.n\n m = SC.shape[0]\n k = c_lbls.shape[0]\n l = SC.shape[1]\n t = args.t\n q = a...
[ "0.62235945", "0.6049082", "0.6045395", "0.5995295", "0.5993515", "0.5865029", "0.5863797", "0.579151", "0.5732537", "0.57056975", "0.56597024", "0.56380254", "0.56178087", "0.56018513", "0.55858195", "0.5584628", "0.5583475", "0.55769795", "0.5555405", "0.55462915", "0.55410...
0.7082174
0
Initialise with repository of choice, default is CMIP6
def __init__(self, source='cmip6'): self.source = source # We keep a dictionary of document sets so each call to getbyname does not need # to get the document set first, unless that document set has not previously been requested. self.documents = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, repository):\n self.__repo = repository", "def repo_init(self, repo_id, numpkgs, islocal=False):\n self.send(repo_id, 'repo_init', numpkgs, islocal)", "def repo_init(_request):\n python = models.Repository.query(models.Repository.name == 'Python').get()\n if python is None:\n...
[ "0.6699109", "0.64469814", "0.6162112", "0.6121241", "0.6062029", "0.60173815", "0.5958106", "0.59234595", "0.58981305", "0.5851899", "0.5851416", "0.58101404", "0.57702166", "0.5729564", "0.57086456", "0.5697416", "0.5675124", "0.565054", "0.5635948", "0.5585092", "0.5546062...
0.0
-1
Get a particular document, given knowledge of it's name and document type
def getbyname(self, name, doctype='experiment'): if doctype not in self.documents: self.documents[doctype] = esd.search(self.source, doctype) return self.documents[doctype].load_document(name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_document_by_name(label, doc_type):\n return Documents.query.filter_by(type=doc_type, label=label).first()", "def get_document(name):\n document = [d for d in documents if d.name == name]\n if len(document) > 0:\n return document[0]", "def get_named_document(self, entity, name):\n ...
[ "0.8119024", "0.7807013", "0.7141701", "0.71329045", "0.6930829", "0.69083655", "0.68151665", "0.6775295", "0.67580533", "0.66710275", "0.666382", "0.66597706", "0.6616618", "0.65856236", "0.6542822", "0.652078", "0.64975977", "0.6474223", "0.64734006", "0.64587903", "0.64214...
0.67501426
9
Get a particular document when you know it's id
def getbyid(self, id): return esd.retrieve(id)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_document_by_id(document_id):\n return Documents.query.filter_by(id=document_id).first()", "def get_document(self, docid):\n raise NotImplementedError", "def obj_get(self, request=None, **kwargs):\n return Document(self.get_collection(request).find_one({\n \"_id\": Object...
[ "0.8036257", "0.78460073", "0.7527839", "0.74206144", "0.72871727", "0.72503227", "0.72271115", "0.7211136", "0.7207188", "0.7205287", "0.7191581", "0.716146", "0.71606684", "0.71544635", "0.71252185", "0.7115029", "0.7100616", "0.706832", "0.70278084", "0.7019712", "0.696564...
0.0
-1
Set up the templates
def _settemplates(self, onecol, twocol): self.template = """ <table class="f"><tbody> %s %s </tbody></table> """ % (self.header, onecol) # This is suitable for two column width. self.wide_template = """ <table class="f"><tbody> ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_templates(self):\n self.libs[\"template\"] = (\"#libs/templates/include\", None, \"\")\n self[\"CPPPATH\"].append(\"#libs/templates/include\")", "def setUp(self):\n print \"Setting Up: %s\" % self.id()\n # render the template\n g.render_template(self.template_file,\n ...
[ "0.80348116", "0.7463657", "0.7155762", "0.7095249", "0.6724418", "0.6702859", "0.6654424", "0.6569718", "0.6396812", "0.63617265", "0.63503236", "0.63492066", "0.63473433", "0.632623", "0.62927055", "0.6273522", "0.6273522", "0.62619275", "0.62587327", "0.6243744", "0.621850...
0.5902942
40
Mixin method. Not implemented in the base class.
def html(self, children, ordering): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __call__(self):\r\n raise NotImplementedError('override me')", "def __call__(self):\n raise NotImplementedError", "def __call__(self):\n raise NotImplementedError()", "def __call__( self ):\n pass", "def __call__(self, *args, **kwargs):\r\n raise NotImplementedError",...
[ "0.789931", "0.77198046", "0.7548892", "0.71948624", "0.71636724", "0.71636724", "0.71636724", "0.7158493", "0.7158493", "0.71576095", "0.71576095", "0.7091741", "0.7085437", "0.7035599", "0.7027999", "0.70000744", "0.6968931", "0.6883279", "0.6883279", "0.6883279", "0.688327...
0.0
-1
Render to html. This should be called by the parent class's html method.
def _html(self, children, wide=False, additional="", ordering='normal'): def sorter(r): """ provides a number to sort related in ascending length of description""" ans = len(r.description) if additional: for rr in r.monkey_additional: an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(self):\r\n super().render()", "def render(self):\n raise NotImplementedError", "def render(self):\n raise NotImplementedError()", "def __html__(self):\n return self.html", "def render(self):\n pass", "def render(self):\n pass", "def render(self):\n ...
[ "0.82992643", "0.8107857", "0.8076577", "0.7906086", "0.7878678", "0.7878678", "0.7878678", "0.7878678", "0.7878678", "0.7878678", "0.7871989", "0.78110904", "0.7726244", "0.7694776", "0.75172067", "0.74649364", "0.74395216", "0.74395216", "0.7385232", "0.7338748", "0.7338651...
0.0
-1
provides a number to sort related in ascending length of description
def sorter(r): ans = len(r.description) if additional: for rr in r.monkey_additional: ans += len(rr) return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort():\n return -1", "def Order(self) -> int:", "def _natural_sort_worksheet(x):\n l = re.findall(r\"\\d+$\", x.title)\n if l:\n return int(l[0])\n\n return -1", "def _wiki_sort_key(doc):\n url = doc['url']\n return 1 if url.startswith('https://en.wikipedia') else -1...
[ "0.6401724", "0.62728316", "0.60654205", "0.60012025", "0.59754735", "0.59544206", "0.59370434", "0.59157306", "0.58810264", "0.58680815", "0.58301955", "0.5825593", "0.57766974", "0.5709983", "0.5653453", "0.560097", "0.5593121", "0.555219", "0.5539747", "0.5538889", "0.5534...
0.6969995
0
Render to PDF if desired, by first getting the HTML version.
def render(self, output_name, wide=False): html = self.html(wide) print 'You can ignore the GLib-Gobject errors (if they occur)' if wide: HTML(string=html).write_pdf( output_name, stylesheets=[CSS(string=esCSS.replace("8.8cm", "18cm"))]) else: HTM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_as_pdf(self, width, height):\n pass", "def get_raw_pdf(html_path, pdf_path, width='', height=''):\n debug = False\n if mg.EXPORT_IMAGES_DIAGNOSTIC: debug = True\n try:\n url = html_path.as_uri()\n cmd_make_pdf = 'cmd_make_pdf not successfully generated yet'\n \"\"\...
[ "0.70788", "0.6738788", "0.6705874", "0.6704703", "0.66870785", "0.666667", "0.66463214", "0.6614933", "0.66001874", "0.65993774", "0.6502286", "0.6423387", "0.64061946", "0.6362002", "0.63022816", "0.6281078", "0.62789476", "0.6275642", "0.6163935", "0.6161958", "0.6047067",...
0.6588409
10
Initialise with an experiment document
def __init__(self, document): self._settemplates(self.onecol, self.twocol) assert document.type_key == 'cim.2.designing.NumericalExperiment' self.doc = document # In most cases there is only one related mip. # Handle the edge case here rather than in template. mips = '' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, document):\n\n self._settemplates(self.onecol, self.twocol)\n assert document.type_key == 'cim.2.designing.Project'\n self.doc = document\n\n # We will populate the \"mip\" variable with the mip era\n self.mips = 'CMIP6'\n\n self.related = []\n fo...
[ "0.7011294", "0.69498855", "0.68237424", "0.66328037", "0.66267675", "0.6497485", "0.6457093", "0.6423474", "0.6372848", "0.62703747", "0.6235102", "0.6179923", "0.60615146", "0.6018496", "0.60152483", "0.5986631", "0.5941061", "0.5928936", "0.58815664", "0.5872775", "0.58648...
0.67475593
3
Initialise with a MIP document
def __init__(self, document): self._settemplates(self.onecol, self.twocol) assert document.type_key == 'cim.2.designing.Project' self.doc = document # We will populate the "mip" variable with the mip era self.mips = 'CMIP6' self.related = [] for r in self.doc.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, doc):\n\n self.doc = doc\n if self.doc.doi:\n self._populate()\n self.populated = True\n else:\n self.populated = False", "def __init__(self, document):\n self._settemplates(self.onecol, self.twocol)\n assert document.type_key...
[ "0.6678455", "0.6528227", "0.61595803", "0.6156851", "0.6055568", "0.5943074", "0.5899902", "0.58804005", "0.5799892", "0.5787662", "0.5785426", "0.57476616", "0.5745662", "0.5730278", "0.5711061", "0.57024944", "0.57002866", "0.56933963", "0.56916255", "0.5650309", "0.564237...
0.7006556
0
Intialise with a pyesdoc citation document
def __init__(self, doc): self.doc = doc if self.doc.doi: self._populate() self.populated = True else: self.populated = False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_citation(meta):\n pass", "def init_doc(self):\n raise NotImplementedError()", "def main(rc):\n with store_client(rc) as sclient:\n for doc in rc.documents:\n sclient.copydoc(doc)", "def make_bibtex(self):\n\n\t\t# bib = requests.request('GET', 'http://dx.doi.org/' + self.doi...
[ "0.6251723", "0.61804336", "0.61777425", "0.6167132", "0.6147496", "0.610238", "0.60910994", "0.6082328", "0.6082024", "0.6033947", "0.6022621", "0.59620064", "0.59356797", "0.59301627", "0.59235984", "0.5893333", "0.5893333", "0.58614635", "0.5857272", "0.58394206", "0.58379...
0.6069784
9
Want a citation string as opposed to a reference. That is, we want author (year), as opposed to author, title, journal, volume pages etc, they go in the bibliography.
def _populate(self): # Assume the first word is what we want, and we can find well formed years # This sucks, but will work for these ones. # Roll on bibtex for citations in the CIM. citation_detail = self.doc.citation_detail author = citation_detail.split(',')[0] match...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_citation(self, type):\n acs_authors = \"; \".join(self.format_authors(\"acs\"))\n # Some articles don't come with pages. :-(\n pages_with_endash = (self.pages.replace(\"-\", \"\\u2013\") if self.pages\n else \"\")\n # Actually, not using quote() genera...
[ "0.728667", "0.68427366", "0.68227404", "0.66083246", "0.65711814", "0.6367512", "0.6355733", "0.6156344", "0.61316967", "0.6123189", "0.6094504", "0.6091088", "0.60479695", "0.5990289", "0.59520656", "0.5934677", "0.5889932", "0.5889375", "0.58619887", "0.5843337", "0.581594...
0.5731608
24
Load the CMIP6 experiment description.
def __init__(self): # simple header only necessary for this table of MIPs self.header = '<tr class="ename"><td colspan="1">{{d.name}} ({{mips}})</td></tr>' self.mips = 'core MIPS recorded by ES-DOC' self._settemplates(self.onecol, self.twocol) r = Repo() c = r.getbyname(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testCMIP6(self):\n\n c = CMIP6()\n c.render(self.testoutput[3])\n for r in c.reference_list:\n print r\n print c.nocite", "def test_load_from_v6(self) -> None:\n self.save_new_valid_exploration(\n 'Exp1', 'user@example.com', end_state_name='End')\n ...
[ "0.58439624", "0.56758475", "0.5097717", "0.5092497", "0.50313264", "0.5024391", "0.5001988", "0.4999472", "0.497601", "0.49601525", "0.4910506", "0.48574418", "0.48146957", "0.47966567", "0.47924876", "0.47363088", "0.47330913", "0.4709552", "0.47017694", "0.4664248", "0.465...
0.0
-1
make sure the html output works
def testHTML(self): html = self.E.html()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_html_output(self):\n pass", "def test_error_html_using_patch(self):\n pass", "def test_prep_fields_called_html_output(self):\n pass", "def get_html(self):\r\n pass", "def rawHTMLrendered(self):", "def __html__(self):\n return self.html", "def test_error_html_...
[ "0.84040964", "0.69680446", "0.6919716", "0.687463", "0.6762656", "0.67169726", "0.66983867", "0.65646785", "0.6555906", "0.6548506", "0.6533556", "0.65294725", "0.6498341", "0.6488538", "0.6470183", "0.64627945", "0.6459197", "0.64506996", "0.64353263", "0.64152896", "0.6384...
0.7505332
1
double column mip table
def testDoubleMIP(self): self.M.render(self.testoutput[2], wide=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def columns(self):\n \n pass", "def with_column(self, label, values):\n \n \n \n # self.column_labels.append(label)\n # for i in range(len(self.rows)):\n # self.rows[i].append(values[i]) \n \n new_label = []\n new_rows = []\n ...
[ "0.6182871", "0.58670676", "0.5789016", "0.5669425", "0.56620336", "0.5656002", "0.56398475", "0.5629267", "0.5606348", "0.5552602", "0.55167204", "0.54714936", "0.53963476", "0.53924036", "0.53915703", "0.5390585", "0.53538346", "0.5328843", "0.53097725", "0.5293032", "0.528...
0.5124593
44
Create a table which names each of the CMIP experiments, adds references for each, and outputs the strings necessary for bibtex to put the references in the reference list.
def testCMIP6(self): c = CMIP6() c.render(self.testoutput[3]) for r in c.reference_list: print r print c.nocite
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n # simple header only necessary for this table of MIPs\n self.header = '<tr class=\"ename\"><td colspan=\"1\">{{d.name}} ({{mips}})</td></tr>'\n self.mips = 'core MIPS recorded by ES-DOC'\n self._settemplates(self.onecol, self.twocol)\n\n r = Repo()\n ...
[ "0.648065", "0.5882049", "0.5557056", "0.52493566", "0.52067536", "0.51254106", "0.51068753", "0.50777084", "0.5076734", "0.5042223", "0.50285196", "0.5026917", "0.4994443", "0.49744835", "0.49690348", "0.49572152", "0.4908166", "0.49010965", "0.48995394", "0.48971975", "0.48...
0.0
-1
For example purposes, we do not remove the outputs, which is why this is NOtearDown. If you really want to use this for unit tests, rename to tearDown.
def NOtearDown(self): for f in self.testoutput: if os.path.exists(f): os.remove(f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tearDown(self):\n print('Calling \\'tearDown\\'')", "def tearDown(self):\n self.logger.info(\"tearDown begin\")\n self.logger.info(\"tearDown end\\n\")", "def tearDown(self):\n pass\n # teardown called after each test\n # e.g. maybe write test results to some text ...
[ "0.80834854", "0.7997705", "0.7978577", "0.7940476", "0.7940476", "0.7940476", "0.78952134", "0.78137136", "0.77655464", "0.77655464", "0.77423745", "0.7723258", "0.7723258", "0.7723258", "0.7717584", "0.7717088", "0.77133566", "0.7675167", "0.76713866", "0.76457465", "0.7645...
0.80674917
1
Generate bootstrap replicate of 1D data.
def bootstrap_replicate_1d(data, func): bs_sample = np.random.choice(data, len(data)) return func(bs_sample)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bootstrap_replicate_1d(data, func):\n bs_sample = np.random.choice(data, len(data))\n return func(bs_sample)", "def bootstrap_replicate_1d(data, func):\n bs_sample = np.random.choice(data, len(data))\n\n return func(bs_sample)", "def bootstrap(X):\n return X[np.random.choice(list(range(X.sha...
[ "0.7789665", "0.77793765", "0.740078", "0.7145126", "0.6915617", "0.676676", "0.65354204", "0.6499645", "0.6398692", "0.62889034", "0.62032557", "0.6193025", "0.6095193", "0.601948", "0.5998936", "0.58984625", "0.5879488", "0.58694214", "0.5786773", "0.5758723", "0.5742155", ...
0.78276443
0
Actualiza los canvas, los pinta en esta ventana, y lleva a cabo el flip para mostrar los cambios
def display(self): for c in self.canvas.values(): c.update() self.superficie.blit(c.superficie, c.origen) pygame.display.flip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop(self, frame):\n self.root = frame\n self.drawUI()\n cv2.imshow('Fotopasca', self.root)", "def renderizar(self):\n\t\t# Limpiar la pantalla\n\t\tglClear(GL_COLOR_BUFFER_BIT)\n\t\t# Renderizar la escena\n\t\tself.escena.renderizar()\n\t\t# Renderizar los buffers a la pantalla\n\t\tpyg...
[ "0.6508464", "0.6444371", "0.6252179", "0.62192374", "0.6206115", "0.6204564", "0.6166355", "0.61551905", "0.6130094", "0.60961246", "0.6088001", "0.60873604", "0.6068308", "0.6057062", "0.60507476", "0.6043697", "0.60300726", "0.60265714", "0.60210216", "0.6011016", "0.60062...
0.71416545
0
Setup injections Note that the actual injected current is proportional to dt of the clock So, you need to use the same dt for stimulation as for the model Strangely, the pulse gen in compartment_net refers to firstdelay, etc.
def setupinj(model, delay,width,neuron_pop): pg = moose.PulseGen('pulse') pg.firstDelay = delay pg.firstWidth = width pg.secondDelay = 1e9 for ntype in neuron_pop.keys(): for num, name in enumerate(neuron_pop[ntype]): injectcomp=moose.element(name +'/'+model.param_cond.NAME_SOMA)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup(timestep=None, min_delay=None, max_delay=None, **kwargs):\n global controller\n\n logger.info(\"PACMAN103 (c) 2014 APT Group, University of Manchester\")\n logger.info(\" Release version 2014.4.1 - April 2014\")\n # Raise an exception if no SpiNNaker machine is specified\n ...
[ "0.60317343", "0.5933767", "0.59041595", "0.5831756", "0.57520694", "0.57439333", "0.5739036", "0.57341063", "0.5705485", "0.5683423", "0.5623893", "0.5612428", "0.5607956", "0.5603607", "0.5600375", "0.5599384", "0.55948526", "0.55602384", "0.5559706", "0.55517477", "0.55408...
0.611647
0
This is a mocked integration function to mimic scipy.integrate.quad. It doesn't do anything other than return some value in the correct format.
def quad(*args, **kwargs): return (42, 0.001)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sp_integrate_1D ( func , xmin , xmax , *args , **kwargs ) : \n from scipy import integrate\n ##\n result = integrate.quad ( func , xmin , xmax , *args , **kwargs )\n return result[0]", "def integrate_fun(fun: Callable, low_b: float, upp_b: float) -> float:\n return integrate.quad(fun, low_b...
[ "0.7110071", "0.66581416", "0.6405214", "0.6365771", "0.6297045", "0.6241524", "0.6084706", "0.5989712", "0.59154487", "0.5907231", "0.59036356", "0.58382195", "0.58156836", "0.5791033", "0.5787734", "0.575591", "0.57527786", "0.5731111", "0.560053", "0.5583005", "0.55691606"...
0.5866004
11
Runs the unit tests without test coverage.
def test(): nose.run()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_ci_test():\n _run_install(False)\n _run_coverage_html(False)\n _run_typecheck_xml(False)\n _run_lint(True)", "def main():\n import coverage\n import nose\n import os\n from shutil import rmtree\n rmtree('./covhtml', ignore_errors=True)\n try:\n os.remove('./.coverage...
[ "0.7740198", "0.7395665", "0.73899317", "0.73077023", "0.7184236", "0.71184987", "0.7116021", "0.7049126", "0.695683", "0.6951264", "0.6858743", "0.682145", "0.6820713", "0.6819008", "0.6809791", "0.67945355", "0.6780462", "0.6749489", "0.671787", "0.6669164", "0.66648895", ...
0.6756857
17